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.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Graphics/Fountainhead/Dumper.hs b/src/Graphics/Fountainhead/Dumper.hs
index 3bbbf3f..46655cb 100644
--- a/src/Graphics/Fountainhead/Dumper.hs
+++ b/src/Graphics/Fountainhead/Dumper.hs
@@ -45,6 +45,8 @@ import Graphics.Fountainhead.TrueType
( CmapTable(..)
, FontDirectory(..)
, FontDirectionHint(..)
+ , GASPRange(..)
+ , GASPTable(..)
, HeadTable(..)
, HheaTable(..)
, HmtxTable(..)
@@ -84,6 +86,7 @@ import Graphics.Fountainhead.Parser
, headTableP
, hheaTableP
, hmtxTableP
+ , gaspTableP
, locaTableP
, maxpTableP
, nameTableP
@@ -617,6 +620,18 @@ dumpMaxp (OpenMaxp OpenMaxpTable{..})
<> " 'maxp' version: " <> dumpFixed32 version <> newlineBuilder <> newlineBuilder
<> " numGlyphs: " <> Text.Builder.decimal numGlyphs <> newlineBuilder
+dumpGASP :: GASPTable -> Text.Builder.Builder
+dumpGASP GASPTable{..} = dumpCaption "'gasp' Table - Grid-fitting And Scan-conversion Procedure"
+ <> "'gasp' version: " <> Text.Builder.decimal version <> newlineBuilder
+ <> "numRanges: " <> Text.Builder.decimal (Prelude.length gaspRange) <> newlineBuilder
+ <> foldMap dumpGASPRange (zip [0..] gaspRange)
+ where
+ dumpGASPRange :: (Int, GASPRange) -> Text.Builder.Builder
+ dumpGASPRange (index', GASPRange{..}) = newlineBuilder
+ <> " gasp Range " <> Text.Builder.decimal index' <> newlineBuilder
+ <> " rangeMaxPPEM: " <> Text.Builder.decimal rangeMaxPPEM <> newlineBuilder
+ <> " rangeGaspBehavior: 0x" <> halfPaddedHexadecimal rangeGaspBehavior <> newlineBuilder
+
dumpTables
:: Megaparsec.State ByteString Void
-> FontDirectory
@@ -655,6 +670,7 @@ dumpTables processedState directory@FontDirectory{..}
"post" -> Just $ dumpPost <$> parseTable tableEntry postTableP processedState
"OS/2" -> Just $ dumpOs2 <$> parseTable tableEntry os2TableP processedState
"cvt " -> Just $ dumpCVTable <$> parseTable tableEntry cvTableP processedState
+ "gasp" -> Just $ dumpGASP <$> parseTable tableEntry gaspTableP processedState
_ -> Nothing
dumpTrueType :: ByteString -> FilePath -> Either DumpError Text.Builder.Builder