summaryrefslogtreecommitdiff
path: root/src/Graphics/Fountainhead/TrueType.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Graphics/Fountainhead/TrueType.hs')
-rw-r--r--src/Graphics/Fountainhead/TrueType.hs32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/Graphics/Fountainhead/TrueType.hs b/src/Graphics/Fountainhead/TrueType.hs
index 2fff036..3828f38 100644
--- a/src/Graphics/Fountainhead/TrueType.hs
+++ b/src/Graphics/Fountainhead/TrueType.hs
@@ -40,6 +40,8 @@ module Graphics.Fountainhead.TrueType
, FontDirectionHint(..)
, FontDirectory(..)
, FontStyle(..)
+ , GASPRange(..)
+ , GASPTable(..)
, GlyfTable(..)
, GlyphArgument(..)
, GlyphCoordinate(..)
@@ -71,6 +73,7 @@ module Graphics.Fountainhead.TrueType
, PostSubtable(..)
, PostTable(..)
, PrepTable(..)
+ , RangeGaspBehavior(..)
, SimpleGlyphDefinition(..)
, TableDirectory(..)
, TrueMaxpTable(..)
@@ -387,8 +390,9 @@ data OutlineFlag = OutlineFlag
newtype GlyfTable = GlyfTable (Vector GlyphDescription)
deriving (Eq, Show)
--- * Character to glyph mapping table
+-- 'cmap' table
+-- | Character to glyph mapping table.
data CmapTable = CmapTable
{ version :: Word16 -- ^ Version number is zero.
-- | Encodings with an offset into subtables map.
@@ -1273,3 +1277,29 @@ data KernFormat2Table = KernFormat2Table
, classTableHeader :: ClassTableHeader
, values :: [Int16]
} deriving (Eq, Show)
+
+-- * 'gasp' table
+
+-- | Grid-fitting And Scan-conversion Procedure.
+data GASPTable = GASPTable
+ { version :: Word16 -- ^ Version number (set to 0).
+ , gaspRange :: [GASPRange] -- ^ Sorted by ppem.
+ } deriving (Eq, Show)
+
+data GASPRange = GASPRange
+ { rangeMaxPPEM :: Word16 -- ^ Upper limit of range, in PPEM.
+ , rangeGaspBehavior :: Word16 -- ^ Flags describing desired rasterizer behavior.
+ } deriving (Eq, Show)
+
+data RangeGaspBehavior
+ = KGASPGridFit -- ^ Use gridfitting.
+ | KGASPDoGray -- ^ Use grayscale rendering.
+ deriving (Eq, Show)
+
+instance Enum RangeGaspBehavior
+ where
+ toEnum 1 = KGASPGridFit
+ toEnum 2 = KGASPDoGray
+ toEnum _ = error "Unknown range GASP behavior"
+ fromEnum KGASPGridFit = 1
+ fromEnum KGASPDoGray = 2