prawn-ruby/ttfunk-1.4.0/lib/ttfunk/table/glyf.rb
# Accepts a hash mapping (old) glyph-ids to glyph objects, and a hash
# mapping old glyph-ids to new glyph-ids.
#
# Returns a hash containing:
# 
# * :table - a string representing the encoded 'glyf' table containing
#   the given glyphs.
# * :offsets - an array of offsets for each glyph
Accepts a hash mapping (old) glyph-ids to glyph objects, and a hash
mapping old glyph-ids to new glyph-ids.

Returns a hash containing.

:table - a string representing the encoded 'glyf' table containing
the given glyphs.
:offsets - an array of offsets for each glyph
Accepts a hash mapping ( old ) glyph - ids to glyph objects and a hash mapping old glyph - ids to new glyph - ids . Returns a hash containing . : table - a string representing the encoded ' glyf ' table containing the given glyphs . : offsets - an array of offsets for each glyph
def for(glyph_id)
        return @cache[glyph_id] if @cache.key?(glyph_id)
        index = file.glyph_locations.index_of(glyph_id)
        size  = file.glyph_locations.size_of(glyph_id)
        if size.zero? 
          @cache[glyph_id] = nil
          return nil
        end
        parse_from(offset + index) do
          raw = io.read(size)
          number_of_contours, x_min, y_min, x_max, y_max = raw.unpack("n5").map { |i| to_signed(i) }
          @cache[glyph_id] = if number_of_contours == -1
              Compound.new(raw, x_min, y_min, x_max, y_max)
            else
              Simple.new(raw, number_of_contours, x_min, y_min, x_max, y_max)
            end
        end
      end
def for ( glyph_id ) return @cache [ glyph_id ] if @cache . key? ( glyph_id ) index = file . glyph_locations . index_of ( glyph_id ) size = file . glyph_locations . size_of ( glyph_id ) if size . zero? @cache [ glyph_id ] = nil return nil end parse_from ( offset + index ) do raw = io . read ( size ) number_of_contours , x_min , y_min , x_max , y_max = raw . unpack ( "n5" ) . map { | i | to_signed ( i ) } @cache [ glyph_id ] = if number_of_contours == - 1 Compound . new ( raw , x_min , y_min , x_max , y_max ) else Simple . new ( raw , number_of_contours , x_min , y_min , x_max , y_max ) end end end
Accepts a hash mapping (old) glyph-ids to glyph objects, and a hash
mapping old glyph-ids to new glyph-ids.
Accepts a hash mapping ( old ) glyph - ids to glyph objects and a hash mapping old glyph - ids to new glyph - ids .
# blank glyph, e.g. space character
glyph_id
<not_specific>