From b7e2da83c6eaeb921f5113e58f2f1fa4e580e292 Mon Sep 17 00:00:00 2001 From: Jaro Date: Fri, 30 Jun 2023 09:04:38 +0200 Subject: [PATCH] Do not pass around unnecessary data. --- src/Data/Text/ParagraphLayout/Internal/Layout.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Data/Text/ParagraphLayout/Internal/Layout.hs b/src/Data/Text/ParagraphLayout/Internal/Layout.hs index f57edf2..d2983ed 100644 --- a/src/Data/Text/ParagraphLayout/Internal/Layout.hs +++ b/src/Data/Text/ParagraphLayout/Internal/Layout.hs @@ -364,12 +364,12 @@ layoutRunH (WithSpan rs run) = WithSpan rs pf glyphs = shapeRun (WithSpan rs run) dir = runDirection run lvl = runLevel run - vo = verticalOffsets rs dir + vo = verticalOffsets (RS.spanTextOptions rs) dir hard = runHardBreak run -- | Vertical offsets for the given fragment, with baseline set to 0. -verticalOffsets :: RS.ResolvedSpan d -> Direction -> VO.VerticalOffsets -verticalOffsets rs dir = VO.VerticalOffsets +verticalOffsets :: TextOptions -> Direction -> VO.VerticalOffsets +verticalOffsets opts dir = VO.VerticalOffsets { VO.layoutTop = ascent + topHalfLeading , VO.fontTop = ascent , VO.baseline = 0 @@ -391,7 +391,6 @@ verticalOffsets rs dir = VO.VerticalOffsets lineHeight = case textLineHeight opts of Normal -> normalLineHeight Absolute h -> h - opts = RS.spanTextOptions rs -- | Calculate layout for the given run independently of its position. shapeRun :: WithSpan d Run -> [(GlyphInfo, GlyphPos)] -- 2.30.2