From 9a11ff5dd465cef33317ef6cc858f861956ade55 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sat, 18 Nov 2023 04:40:17 +0100 Subject: Dump hmtx --- src/Graphics/Fountainhead/Parser.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Graphics/Fountainhead/Parser.hs') diff --git a/src/Graphics/Fountainhead/Parser.hs b/src/Graphics/Fountainhead/Parser.hs index f39cbda..96209f7 100644 --- a/src/Graphics/Fountainhead/Parser.hs +++ b/src/Graphics/Fountainhead/Parser.hs @@ -337,9 +337,9 @@ longHorMetricP = LongHorMetric <$> Megaparsec.Binary.word16be <*> Megaparsec.Binary.int16be -hmtxTableP :: Int -> Parser HmtxTable +hmtxTableP :: Word16 -> Parser HmtxTable hmtxTableP numOfLongHorMetrics = HmtxTable - <$> countP numOfLongHorMetrics longHorMetricP + <$> countP (fromIntegral numOfLongHorMetrics) longHorMetricP <*> Megaparsec.many Megaparsec.Binary.int16be -- * Glyph name and PostScript font table @@ -928,7 +928,7 @@ parseTable -> Parser a -> Megaparsec.State ByteString Void -> Either (Megaparsec.ParseErrorBundle ByteString Void) a -parseTable TableDirectory{ offset, length } parser state = snd +parseTable TableDirectory{ offset, length = length' } parser state = snd $ Megaparsec.runParser' parser $ state { Megaparsec.stateInput = stateInput @@ -940,7 +940,7 @@ parseTable TableDirectory{ offset, length } parser state = snd } where posState = Megaparsec.statePosState state - stateInput = ByteString.take length + stateInput = ByteString.take length' $ ByteString.drop (offset - Megaparsec.stateOffset state) $ Megaparsec.stateInput state stateOffset = offset -- cgit v1.2.3