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.hs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Graphics/Fountainhead/TrueType.hs b/src/Graphics/Fountainhead/TrueType.hs
index 3828f38..0c15081 100644
--- a/src/Graphics/Fountainhead/TrueType.hs
+++ b/src/Graphics/Fountainhead/TrueType.hs
@@ -341,6 +341,8 @@ data SimpleGlyphDefinition = SimpleGlyphDefinition
{ endPtsOfContours :: Vector Word16
-- | Array of instructions for this glyph.
, instructions :: Vector Word8
+ -- Array of flags.
+ , flags :: Vector OutlineFlag
-- | Array of coordinates; the first is relative to (0,0), others are
-- relative to previous point.
, coordinates :: Vector GlyphCoordinate
@@ -366,9 +368,19 @@ data ComponentGlyphFlags = ComponentGlyphFlags
data GlyphCoordinate = GlyphCoordinate
{ coordinateX :: Int16
, coordinateY :: Int16
- , onCurve :: Bool
} deriving (Eq, Show)
+instance Semigroup GlyphCoordinate
+ where
+ lhs <> rhs =
+ let GlyphCoordinate{ coordinateX = lhX, coordinateY = lhY } = lhs
+ GlyphCoordinate{ coordinateX = rhX, coordinateY = rhY } = rhs
+ in GlyphCoordinate{ coordinateX = lhX + rhX, coordinateY = lhY + rhY }
+
+instance Monoid GlyphCoordinate
+ where
+ mempty = GlyphCoordinate 0 0
+
data ComponentGlyphPartDescription = ComponentGlyphPartDescription
{ flags :: ComponentGlyphFlags
, glyphIndex :: Word16
@@ -383,6 +395,7 @@ data OutlineFlag = OutlineFlag
{ onCurve :: Bool
, xShortVector :: Bool
, yShortVector :: Bool
+ , repeat :: Word8
, thisXIsSame :: Bool
, thisYIsSame :: Bool
} deriving (Eq, Show)