Class: TTFunk::Table::Hhea

Inherits:
TTFunk::Table show all
Defined in:
lib/ttfunk/table/hhea.rb

Overview

Horizontal Header (‘hhea`) table.

Instance Attribute Summary collapse

Attributes inherited from TTFunk::Table

#file, #length, #offset

Class Method Summary collapse

Methods inherited from TTFunk::Table

#exists?, #initialize, #raw, #tag

Constructor Details

This class inherits a constructor from TTFunk::Table

Instance Attribute Details

#advance_width_maxInteger (readonly)

Maximum advance width value in ‘hmtx` table.

Returns:

  • (Integer)


27
28
29
# File 'lib/ttfunk/table/hhea.rb', line 27

def advance_width_max
  @advance_width_max
end

#ascentInteger (readonly)

Typographic ascent.

Returns:

  • (Integer)


15
16
17
# File 'lib/ttfunk/table/hhea.rb', line 15

def ascent
  @ascent
end

#caret_offsetInteger (readonly)

Caret offset.

Returns:

  • (Integer)


66
67
68
# File 'lib/ttfunk/table/hhea.rb', line 66

def caret_offset
  @caret_offset
end

#caret_slope_riseInteger (readonly)

Caret slope rise.

Returns:

  • (Integer)


44
45
46
# File 'lib/ttfunk/table/hhea.rb', line 44

def caret_slope_rise
  @caret_slope_rise
end

#caret_slope_runInteger (readonly)

Caret slope run.

Returns:

  • (Integer)


55
56
57
# File 'lib/ttfunk/table/hhea.rb', line 55

def caret_slope_run
  @caret_slope_run
end

#carot_slope_riseInteger (readonly)

Deprecated.

Use #caret_slope_rise instead.

Returns:

  • (Integer)


49
50
51
# File 'lib/ttfunk/table/hhea.rb', line 49

def carot_slope_rise
  @caret_slope_rise
end

#carot_slope_runInteger (readonly)

Deprecated.

Use #caret_slope_run instead.

Returns:

  • (Integer)


60
61
62
# File 'lib/ttfunk/table/hhea.rb', line 60

def carot_slope_run
  @caret_slope_run
end

#descentInteger (readonly)

Typographic descent.

Returns:

  • (Integer)


19
20
21
# File 'lib/ttfunk/table/hhea.rb', line 19

def descent
  @descent
end

#line_gapInteger (readonly)

Typographic line gap.

Returns:

  • (Integer)


23
24
25
# File 'lib/ttfunk/table/hhea.rb', line 23

def line_gap
  @line_gap
end

#metric_data_formatInteger (readonly)

Metric data format. ‘0` for current format.

Returns:

  • (Integer)


70
71
72
# File 'lib/ttfunk/table/hhea.rb', line 70

def metric_data_format
  @metric_data_format
end

#min_left_side_bearingInteger (readonly)

Minimum left sidebearing value in ‘hmtx` table for glyphs with contours (empty glyphs should be ignored).

Returns:

  • (Integer)


32
33
34
# File 'lib/ttfunk/table/hhea.rb', line 32

def min_left_side_bearing
  @min_left_side_bearing
end

#min_right_side_bearingInteger (readonly)

Minimum right sidebearing value.

Returns:

  • (Integer)


36
37
38
# File 'lib/ttfunk/table/hhea.rb', line 36

def min_right_side_bearing
  @min_right_side_bearing
end

#number_of_metricsInteger (readonly)

Number of hMetric entries in ‘hmtx` table.

Returns:

  • (Integer)


74
75
76
# File 'lib/ttfunk/table/hhea.rb', line 74

def number_of_metrics
  @number_of_metrics
end

#versionInteger (readonly)

Table version

Returns:

  • (Integer)


11
12
13
# File 'lib/ttfunk/table/hhea.rb', line 11

def version
  @version
end

#x_max_extentInteger (readonly)

Maximum extent.

Returns:

  • (Integer)


40
41
42
# File 'lib/ttfunk/table/hhea.rb', line 40

def x_max_extent
  @x_max_extent
end

Class Method Details

.encode(hhea, hmtx, original, mapping) ⇒ String

Encode table.

Parameters:

Returns:

  • (String)


85
86
87
88
89
90
91
92
93
94
95
# File 'lib/ttfunk/table/hhea.rb', line 85

def encode(hhea, hmtx, original, mapping)
  ''.b.tap do |table|
    table << [hhea.version].pack('N')
    table << [
      hhea.ascent, hhea.descent, hhea.line_gap,
      *min_max_values_for(original, mapping),
      hhea.caret_slope_rise, hhea.caret_slope_run, hhea.caret_offset,
      0, 0, 0, 0, hhea.metric_data_format, hmtx[:number_of_metrics],
    ].pack('n*')
  end
end