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 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
279 def initialize(keyword, value)
280   super("tEXt")
281   @keyword, @value = keyword, value
282 end
read(type, content) click to toggle source
    # File lib/chunky_png/chunk.rb
284 def self.read(type, content)
285   keyword, value = content.unpack("Z*a*")
286   new(keyword, value)
287 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
293 def content
294   [keyword, value].pack("Z*a*")
295 end