37 lines
1.1 KiB
Erlang
37 lines
1.1 KiB
Erlang
|
-module(hhea).
|
||
|
-export([parse_hhea_table/1]).
|
||
|
|
||
|
-include("sizes.hrl").
|
||
|
-import(read_utils, [read_fixed/1, read_long_datetime/1]).
|
||
|
|
||
|
parse_hhea_table(
|
||
|
<<1:16, 0:16,
|
||
|
Ascender:16/signed,
|
||
|
Descender:16/signed,
|
||
|
LineGap:16/signed,
|
||
|
AdvanceWidthMax:16,
|
||
|
MinLeftSideBearing:16/signed,
|
||
|
MinRightSideBearing:16/signed,
|
||
|
XMaxExtent:16/signed,
|
||
|
CaretSlopeRise:16/signed,
|
||
|
CaretSlopeRun:16/signed,
|
||
|
CaretOffset:16/signed,
|
||
|
0:16/signed, 0:16/signed, 0:16/signed, 0:16/signed, %% reserved
|
||
|
MetricDataFormat:16/signed, NumberOfHMetrics:16>>) ->
|
||
|
case MetricDataFormat == 0 of false -> throw(invalid_metric_data_format); true -> ok end,
|
||
|
[
|
||
|
{majorVersion, 1},
|
||
|
{minorVersion, 0},
|
||
|
{ascender, Ascender},
|
||
|
{descender, Descender},
|
||
|
{line_gap, LineGap},
|
||
|
{advance_width_max, AdvanceWidthMax},
|
||
|
{min_left_side_bearing, MinLeftSideBearing},
|
||
|
{min_right_side_bearing, MinRightSideBearing},
|
||
|
{x_max_extent, XMaxExtent},
|
||
|
{caret_slope_rise, CaretSlopeRise},
|
||
|
{caret_slope_run, CaretSlopeRun},
|
||
|
{caret_offset, CaretOffset},
|
||
|
{metric_data_format, MetricDataFormat},
|
||
|
{number_of_h_metrics, NumberOfHMetrics}
|
||
|
].
|