From e9d8aec6fbeb6fd490d49c75a90c80d3f34db787 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Fri, 17 Mar 2023 15:00:51 +1300 Subject: [PATCH] Hardcode fallback fontfile, associate vals per span-line not per span. --- Graphics/Layout/CSS/Internal.hs | 3 +++ Graphics/Layout/Inline.hs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Graphics/Layout/CSS/Internal.hs b/Graphics/Layout/CSS/Internal.hs index 1dd0a14..2658b8a 100644 --- a/Graphics/Layout/CSS/Internal.hs +++ b/Graphics/Layout/CSS/Internal.hs @@ -89,6 +89,9 @@ hbScale f = fontSize f*hbUnit hbUnit = 64 :: Double pattern2hbfont :: Pattern -> Int -> [Variation] -> Font +pattern2hbfont pat scale variations | Nothing <- lookup "file" pat = + let pat' = setValue "file" "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf" pat + in pattern2hbfont pat' scale variations pattern2hbfont pat scale variations = createFontWithOptions options face where bytes = unsafePerformIO $ B.readFile $ getValue0 "file" pat diff --git a/Graphics/Layout/Inline.hs b/Graphics/Layout/Inline.hs index e8770a5..384befa 100644 --- a/Graphics/Layout/Inline.hs +++ b/Graphics/Layout/Inline.hs @@ -28,8 +28,8 @@ inlineSize :: (CastDouble x, CastDouble y) => Font' -> Paragraph -> Size x y inlineSize font self = Size (c font $ width r) (c font $ height r) where r = paragraphRect $ layoutPlain self inlineChildren :: [x] -> Paragraph -> [(x, Fragment)] -inlineChildren vals self = concat $ map inner $ zip vals $ spanLayouts $ layoutPlain self - where inner (x, SpanLayout y) = map (x,) y +inlineChildren vals self = zip vals $ concat $ map inner $ spanLayouts $ layoutPlain self + where inner (SpanLayout y) = y layoutPlain' :: Paragraph -> Int32 -> Rect Int32 layoutPlain' (Paragraph a b c d) width = -- 2.30.2