Class: Ucode::Audit::Extractors::Hinting

Inherits:
Base
  • Object
show all
Defined in:
lib/ucode/audit/extractors/hinting.rb

Overview

Hinting summary: TrueType bytecode counts + gasp policy + CFF stem count, with derived ‘is_unhinted` and `hinting_format` fields.

Returned fields:

hinting: Models::Audit::Hinting instance, or nil for Type 1

The fpgm/prep/cvt/gasp tables have no BinData classes yet — they are read as raw bytes from ‘font.table_data`. Bytecode is one byte per instruction; cvt is an array of FWord (int16), so the entry count is bytesize / 2.

Constant Summary collapse

HSTEM =

Raw CFF / CFF2 charstring operator bytes that declare stem hints.

1
VSTEM =
3
HSTEMHM =
18
VSTEMHM =
23
HINTMASK =
19
CNTRMASK =
20

Instance Method Summary collapse

Instance Method Details

#extract(context) ⇒ Hash{Symbol=>Object}

Parameters:

Returns:

  • (Hash{Symbol=>Object})


31
32
33
34
35
36
# File 'lib/ucode/audit/extractors/hinting.rb', line 31

def extract(context)
  font = context.font
  return { hinting: nil } unless sfnt?(font)

  { hinting: Models::Audit::Hinting.new(**gather(font)) }
end