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
273 def initialize(keyword, value)
274   super('tEXt')
275   @keyword, @value = keyword, value
276 end
read(type, content) click to toggle source
    # File lib/chunky_png/chunk.rb
278 def self.read(type, content)
279   keyword, value = content.unpack('Z*a*')
280   new(keyword, value)
281 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
287 def content
288   [keyword, value].pack('Z*a*')
289 end