From 7ca58a19fec436cf76bddcd18204d7841d8959ea Mon Sep 17 00:00:00 2001 From: Jaro Date: Wed, 15 Mar 2023 22:40:23 +0100 Subject: [PATCH] Document considerations for beginsText/endsText. --- src/Data/Text/ParagraphLayout/Internal/Plain.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Data/Text/ParagraphLayout/Internal/Plain.hs b/src/Data/Text/ParagraphLayout/Internal/Plain.hs index d06d74f..81c07ff 100644 --- a/src/Data/Text/ParagraphLayout/Internal/Plain.hs +++ b/src/Data/Text/ParagraphLayout/Internal/Plain.hs @@ -198,13 +198,23 @@ shapeRun :: WithSpan Run -> [(GlyphInfo, GlyphPos)] shapeRun (WithSpan rs run) = shape font buffer features where font = RS.spanFont rs - -- TODO: Set beginsText / endsText. buffer = defaultBuffer { text = Lazy.fromStrict $ runText run , contentType = Just ContentTypeUnicode , direction = runDirection run , script = runScript run , language = Just $ RS.spanLanguage rs + -- Perhaps counter-intuitively, the `beginsText` and `endsText` + -- flags refer to everything that "Data.Text.Glyphize" can see, + -- not just the current run. + -- + -- Since all runs are cut from a single continuous `Text` that + -- represents the entire paragraph, and "Data.Text.Glyphize" peeks + -- at the whole underlying byte array, HarfBuzz will be able to see + -- both the beginning and the end of the paragraph at all times, + -- so these flags can always be set. + , beginsText = True + , endsText = True } features = [] -- 2.30.2