diff options
Diffstat (limited to 'lib/Graphics/Fountainhead/TrueType.hs')
| -rw-r--r-- | lib/Graphics/Fountainhead/TrueType.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Graphics/Fountainhead/TrueType.hs b/lib/Graphics/Fountainhead/TrueType.hs index 0c15081..55d55ae 100644 --- a/lib/Graphics/Fountainhead/TrueType.hs +++ b/lib/Graphics/Fountainhead/TrueType.hs @@ -2,6 +2,7 @@ v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. -} +{-# LANGUAGE DataKinds #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE RecordWildCards #-} @@ -81,11 +82,13 @@ module Graphics.Fountainhead.TrueType , UVSMapping(..) , UnicodeValueRange(..) , VariationSelectorMap + , findTableByTag , unLocaTable , nameStringOffset ) where import Data.ByteString (ByteString) +import qualified Data.ByteString.Char8 as Char8 import Data.Int (Int8, Int16) import Data.IntMap (IntMap) import Data.List.NonEmpty (NonEmpty(..)) @@ -93,6 +96,8 @@ import Data.Time (LocalTime(..)) import Data.Vector (Vector) import Data.Word (Word8, Word16, Word32) import Graphics.Fountainhead.Type (F2Dot14(..), Fixed32(..), FWord, UFWord) +import GHC.Records (HasField(..)) +import Data.Foldable (find) -- * Font directory @@ -101,6 +106,10 @@ data FontDirectory = FontDirectory , tableDirectory :: [TableDirectory] } deriving (Eq, Show) +findTableByTag :: String -> FontDirectory -> Maybe TableDirectory +findTableByTag needle = find ((needle ==) . Char8.unpack . getField @"tag") + . getField @"tableDirectory" + data OffsetSubtable = OffsetSubtable { scalerType :: Word32 , numTables :: Int |
