~jaro/balkon

7e49e20750cc725749f4f9c89942a19b85049881 — Jaro 1 year, 5 months ago 13f4f8e
Prevent empty shaped runs.

This is in preparation for a breaking change that introduces some
empty fragments into the output. Since the shaped runs output is not
concerned with runs of zero glyphs, these will be proactively removed.
1 files changed, 4 insertions(+), 2 deletions(-)

M src/Data/Text/ParagraphLayout/Internal/Plain/ParagraphLayout.hs
M src/Data/Text/ParagraphLayout/Internal/Plain/ParagraphLayout.hs => src/Data/Text/ParagraphLayout/Internal/Plain/ParagraphLayout.hs +4 -2
@@ 81,6 81,8 @@ appendFragments pla plb = paragraphLayout sls'
paragraphFragments :: ParagraphLayout d -> [Fragment d]
paragraphFragments pl = concat $ map spanFragments $ spanLayouts pl

-- | Return all shaped runs in the paragraph.
-- | Return all non-empty shaped runs in the paragraph.
shapedRuns :: ParagraphLayout d -> [ShapedRun]
shapedRuns pl = map shapedRun $ paragraphFragments pl
shapedRuns pl = map shapedRun $ filter hasGlyphs $ paragraphFragments pl
    where
        hasGlyphs = not . null . fragmentGlyphs