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, line 304
def initialize(keyword, value)
  super("tEXt")
  @keyword, @value = keyword, value
end
read(type, content) click to toggle source
# File lib/chunky_png/chunk.rb, line 309
def self.read(type, content)
  keyword, value = content.unpack("Z*a*")
  new(keyword, value)
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, line 318
def content
  [keyword, value].pack("Z*a*")
end