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.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Graphics/Fountainhead/TrueType.hs b/src/Graphics/Fountainhead/TrueType.hs
index 4043098..5de0918 100644
--- a/src/Graphics/Fountainhead/TrueType.hs
+++ b/src/Graphics/Fountainhead/TrueType.hs
@@ -3,6 +3,7 @@
obtain one at https://mozilla.org/MPL/2.0/. -}
{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE RecordWildCards #-}
-- | Types representing a TrueType font.
module Graphics.Fountainhead.TrueType
@@ -78,6 +79,7 @@ module Graphics.Fountainhead.TrueType
, UnicodeValueRange(..)
, VariationSelectorMap
, unLocaTable
+ , nameStringOffset
) where
import Data.ByteString (ByteString)
@@ -128,6 +130,12 @@ data NameRecord = NameRecord
, offset :: Int -- ^ Offset.
} deriving (Eq, Show)
+nameStringOffset :: NameTable -> Word16
+nameStringOffset NameTable{..} =
+ let nameRecordSize = 12
+ precedingFieldsSize = 2 * 3
+ in nameRecordSize * fromIntegral (Prelude.length nameRecord) + precedingFieldsSize
+
-- * 'cvt ' table
newtype CVTable = CVTable [Int16]