Class ChunkyPNG::Chunk::Text
In: lib/chunky_png/chunk.rb
Parent: Base

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

Methods

content   new   read  

Attributes

keyword  [RW] 
value  [RW] 

Public Class methods

[Source]

     # File lib/chunky_png/chunk.rb, line 252
252:       def initialize(keyword, value)
253:         super('tEXt')
254:         @keyword, @value = keyword, value
255:       end

[Source]

     # File lib/chunky_png/chunk.rb, line 257
257:       def self.read(type, content)
258:         keyword, value = content.unpack('Z*a*')
259:         new(keyword, value)
260:       end

Public Instance methods

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.

[Source]

     # File lib/chunky_png/chunk.rb, line 266
266:       def content
267:         [keyword, value].pack('Z*a*')
268:       end

[Validate]