summaryrefslogtreecommitdiff
path: root/src/Graphics/Fountainhead/Dumper.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Graphics/Fountainhead/Dumper.hs')
-rw-r--r--src/Graphics/Fountainhead/Dumper.hs44
1 files changed, 33 insertions, 11 deletions
diff --git a/src/Graphics/Fountainhead/Dumper.hs b/src/Graphics/Fountainhead/Dumper.hs
index 1a7da2b..8c99fc7 100644
--- a/src/Graphics/Fountainhead/Dumper.hs
+++ b/src/Graphics/Fountainhead/Dumper.hs
@@ -272,19 +272,41 @@ dumpOs2 = (dumpCaption "'OS/2' Table - OS/2 and Windows Metrics" <>) . go
<> " ySuperscriptYOffset: " <> Text.Builder.decimal ySuperscriptYOffset <> newlineBuilder
<> " yStrikeoutSize: " <> Text.Builder.decimal yStrikeoutSize <> newlineBuilder
<> " yStrikeoutPosition: " <> Text.Builder.decimal yStrikeoutPosition <> newlineBuilder
- <> " sFamilyClass:" <> familyClass sFamilyClass
+ <> " sFamilyClass:" <> familyClass sFamilyClass <> newlineBuilder
<> " PANOSE:" <> newlineBuilder <> dumpPanose panose
+ <> fold (Vector.imap dumpUnicodeRange ulUnicodeRange)
+ <> " achVendID: '" <> achVendID' achVendID <> "'\n"
+ achVendID' = Text.Builder.fromText . Text.decodeLatin1 . ByteString.pack . fmap fromIntegral . toList
+ dumpUnicodeRange index value =
+ let bits = index * 32
+ parens = "( Bits " <> Text.Builder.decimal bits <> " - "
+ <> Text.Builder.decimal (bits + 31) <> " ):"
+ in " Unicode Range: " <> Text.Builder.decimal (index + 1)
+ <> Text.Builder.fromLazyText (Text.Lazy.justifyLeft 25 ' ' (Text.Builder.toLazyText parens))
+ <> paddedHexadecimal value
+ <> newlineBuilder
dumpPanose Panose{..}
- = " Family Kind: 0 'Any'"
- <> " Serif Style: 0 'Any'"
- <> " Weight: 0 'Any'"
- <> " Proportion: 0 'Any'"
- <> " Contrast: 0 'Any'"
- <> " Stroke: 0 'Any'"
- <> " Arm Style: 0 'Any'"
- <> " Lettreform: 0 'Any'"
- <> " Midline: 0 'Any'"
- <> " X-height: 0 'Any'"
+ = " Family Kind: " <> dumpPanoseField bFamilyType
+ <> " Serif Style: " <> dumpPanoseField bSerifStyle
+ <> " Weight: " <> dumpPanoseField bWeight
+ <> " Proportion: " <> dumpPanoseField bProportion
+ <> " Contrast: " <> dumpPanoseField bContrast
+ <> " Stroke: " <> dumpPanoseField bStrokeVariation
+ <> " Arm Style: " <> dumpPanoseField bArmStyle
+ <> " Lettreform: " <> dumpPanoseField bLetterform
+ <> " Midline: " <> dumpPanoseField bMidline
+ <> " X-height: " <> dumpPanoseField bXHeight
+ dumpPanoseField field' =
+ let numericField = Text.Builder.fromLazyText
+ $ Text.Lazy.justifyLeft 8 ' '
+ $ Text.Builder.toLazyText
+ $ Text.Builder.decimal
+ $ fromEnum field'
+ in numericField
+ <> Text.Builder.singleton '\''
+ <> Text.Builder.fromString (show field')
+ <> Text.Builder.singleton '\''
+ <> newlineBuilder
familyClass value =
" " <> Text.Builder.decimal (value .>>. 8) <> " subclass = " <> Text.Builder.decimal (value .&. 0x00ff)
weightClass classValue