summaryrefslogtreecommitdiff
path: root/src/Graphics/Fountainhead/TrueType.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2023-11-28 20:02:57 +0100
committerEugen Wissner <belka@caraus.de>2023-11-28 20:02:57 +0100
commit752f093b7228511a874cdb826a7615a34c8e6bb1 (patch)
treea0fee6e180c89cd18937ca1ca5426d7a416ed050 /src/Graphics/Fountainhead/TrueType.hs
parentaf16ee7b8ed205f95c271c3a9a9840d1e0e62c85 (diff)
downloadfountainhead-752f093b7228511a874cdb826a7615a34c8e6bb1.tar.gz
Dump the name table
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]