From 752f093b7228511a874cdb826a7615a34c8e6bb1 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Tue, 28 Nov 2023 20:02:57 +0100 Subject: Dump the name table --- src/Graphics/Fountainhead/TrueType.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/Graphics/Fountainhead/TrueType.hs') 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] -- cgit v1.2.3