@@ 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 = []