Class: Fontisan::Hints::PostScriptHintExtractor
- Inherits:
-
Object
- Object
- Fontisan::Hints::PostScriptHintExtractor
- Defined in:
- lib/fontisan/hints/postscript_hint_extractor.rb
Overview
Extracts rendering hints from PostScript/CFF CharString data
PostScript Type 1 and CFF fonts embed hints directly in the CharString data as operators. This extractor parses CharString sequences to identify and extract hint operators.
**Supported PostScript Hint Operators:**
-
hstem/vstem - Horizontal/vertical stem hints
-
hstem3/vstem3 - Multiple stem hints
-
hintmask - Hint replacement masks
-
cntrmask - Counter control masks
Constant Summary collapse
- HSTEM =
CFF CharString operators
1- VSTEM =
3- HINTMASK =
19- CNTRMASK =
20- HSTEM3 =
12 << 8 | 2
- VSTEM3 =
12 << 8 | 1
Instance Method Summary collapse
-
#extract(charstring) ⇒ Array<Hint>
Extract hints from CFF CharString.
Instance Method Details
#extract(charstring) ⇒ Array<Hint>
Extract hints from CFF CharString
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fontisan/hints/postscript_hint_extractor.rb', line 36 def extract(charstring) return [] if charstring.nil? # Get CharString bytes bytes = if charstring.respond_to?(:data) charstring.data elsif charstring.respond_to?(:bytes) charstring.bytes elsif charstring.is_a?(String) charstring.bytes else return [] end return [] if bytes.empty? parse_charstring(bytes) end |