class ChunkyPNG::Chunk::Text

The Text (tEXt) chunk contains keyword/value metadata about the PNG stream. In this chunk, the value is stored uncompressed.

The tEXt chunk only supports Latin-1 encoded textual data. If you need UTF-8 support, check out the InternationalText chunk type.

@see www.w3.org/TR/PNG/#11tEXt @see ChunkyPNG::Chunk::CompressedText @see ChunkyPNG::Chunk::InternationalText

Attributes

keyword[RW]
value[RW]

Public Class Methods

new(keyword, value) click to toggle source
Calls superclass method ChunkyPNG::Chunk::Base::new
    # File lib/chunky_png/chunk.rb
305 def initialize(keyword, value)
306   super("tEXt")
307   @keyword, @value = keyword, value
308 end
read(type, content) click to toggle source
    # File lib/chunky_png/chunk.rb
310 def self.read(type, content)
311   keyword, value = content.unpack("Z*a*")
312   new(keyword, value)
313 end

Public Instance Methods

content() click to toggle source

Creates the content to write to the stream, by concatenating the keyword with the value, joined by a null character.

@return The content that should be written to the datastream.

    # File lib/chunky_png/chunk.rb
319 def content
320   [keyword, value].pack("Z*a*")
321 end