Sha256: 0ce172f8f0e5176c71f46a1f7c76f98265f7a356f3472c9c7c2ab92672fc9386

Contents?: true

Size: 1.1 KB

Versions: 34

Compression:

Stored size: 1.1 KB

Contents

require 'ttfunk/table'

module TTFunk  
  class Table
    class Hhea < Table
      attr_reader :version
      attr_reader :ascent
      attr_reader :descent
      attr_reader :line_gap
      attr_reader :advance_width_max
      attr_reader :min_left_side_bearing
      attr_reader :min_right_side_bearing
      attr_reader :x_max_extent
      attr_reader :carot_slope_rise
      attr_reader :carot_slope_run
      attr_reader :metric_data_format
      attr_reader :number_of_metrics

      def self.encode(hhea, hmtx)
        raw = hhea.raw
        raw[-2,2] = [hmtx[:number_of_metrics]].pack("n")
        return raw
      end

      private

        def parse!
          @version = read(4, "N").first
          @ascent, @descent, @line_gap = read_signed(3)
          @advance_width_max = read(2, "n").first

          @min_left_side_bearing, @min_right_side_bearing, @x_max_extent,
            @carot_slope_rise, @carot_slope_run, @caret_offset,
            reserved, reserved, reserved, reserved,
            @metric_data_format = read_signed(11)

          @number_of_metrics = read(2, "n").first
        end
    end
  end
end

Version data entries

34 entries across 34 versions & 10 rubygems

Version Path
ttfunk-1.2.2 lib/ttfunk/table/hhea.rb
ttfunk-1.2.1 lib/ttfunk/table/hhea.rb
ttfunk-1.2.0 lib/ttfunk/table/hhea.rb
ttfunk-1.1.1 lib/ttfunk/table/hhea.rb
ttfunk-1.1.0 lib/ttfunk/table/hhea.rb
ttfunk-1.0.3 lib/ttfunk/table/hhea.rb
ttfunk-1.0.2 lib/ttfunk/table/hhea.rb
ttfunk-1.0.1 lib/ttfunk/table/hhea.rb
davebenvenuti-prawn-0.11.1.pre vendor/ttfunk/lib/ttfunk/table/hhea.rb
piglop-prawn-0.10.2.3 vendor/ttfunk/lib/ttfunk/table/hhea.rb
piglop-prawn-0.10.2.2 vendor/ttfunk/lib/ttfunk/table/hhea.rb
piglop-prawn-0.10.2.1 vendor/ttfunk/lib/ttfunk/table/hhea.rb
glyph_imager-0.1.1 vendor/ttfunk/lib/ttfunk/table/hhea.rb
prawn-0.11.1.pre vendor/ttfunk/lib/ttfunk/table/hhea.rb
goodwill-prawn-edge-0.10.0 vendor/ttfunk/lib/ttfunk/table/hhea.rb
alphasights-prawn-0.10.4 vendor/ttfunk/lib/ttfunk/table/hhea.rb
alphasights-prawn-0.10.3 vendor/ttfunk/lib/ttfunk/table/hhea.rb
alphasights-prawn-0.10.2 vendor/ttfunk/lib/ttfunk/table/hhea.rb
alphasights-prawn-0.10.1 vendor/ttfunk/lib/ttfunk/table/hhea.rb
glyph_imager-0.1.0 vendor/ttfunk/lib/ttfunk/table/hhea.rb