Class: Fontisan::Hints::TrueTypeHintExtractor
- Inherits:
-
Object
- Object
- Fontisan::Hints::TrueTypeHintExtractor
- Defined in:
- lib/fontisan/hints/truetype_hint_extractor.rb
Overview
Extracts rendering hints from TrueType glyph data
TrueType uses bytecode instructions for hinting. This extractor analyzes glyph instruction sequences and converts them into universal Hint objects for format-agnostic representation.
**Supported TrueType Instructions:**
-
MDAP - Move Direct Absolute Point (stem positioning)
-
MDRP - Move Direct Relative Point (stem width)
-
IUP - Interpolate Untouched Points (smooth interpolation)
-
SHP - Shift Point (point adjustments)
-
ALIGNRP - Align to Reference Point (alignment)
-
DELTA - Delta instructions (pixel-level adjustments)
Constant Summary collapse
- MDAP_RND =
TrueType instruction opcodes
0x2E- MDAP_NORND =
0x2F- MDRP_MIN_RND_BLACK =
0xC0- IUP_Y =
0x30- IUP_X =
0x31- SHP =
[0x32, 0x33]
- ALIGNRP =
0x3C- DELTAP1 =
0x5D- DELTAP2 =
0x71- DELTAP3 =
0x72
Instance Method Summary collapse
-
#extract(glyph) ⇒ Array<Hint>
Extract hints from TrueType glyph.
Instance Method Details
#extract(glyph) ⇒ Array<Hint>
Extract hints from TrueType glyph
42 43 44 45 46 47 48 49 50 |
# File 'lib/fontisan/hints/truetype_hint_extractor.rb', line 42 def extract(glyph) return [] if glyph.nil? || glyph.empty? return [] unless glyph.respond_to?(:instructions) instructions = glyph.instructions || [] return [] if instructions.empty? parse_instructions(instructions) end |