[cairo] Pango + Cairo, text clusters & invisible glyphs

Han-Wen Nienhuys hanwenn at gmail.com
Sat Feb 5 23:33:06 UTC 2022

Hi there,

I'm trying to fix some corner cases in LilyPond's Cairo support. For
proper copy&paste support in our PDF output
(https://gitlab.com/lilypond/lilypond/-/issues/6172), I'm trying to
use cairo_show_text_glyphs(). This seems to mostly work in normal
cases. However, when rendering bidi text in Pango, the direction
changing codes (U+202A, U+202B, U+202C) generate a cluster entry in
Pango, but the glyph is invisible.

Currently, LilyPond simply filters out the invisible glyph, but with
cairo_show_text_glyphs that causes the UTF-8 text, glyph list and
cluster mapping to go out of sync, leading to 'input clusters do not
represent the accompanying text and glyph arrays'

Is there a standard way to specify an invisible glyph  to
cairo_show_text_glyphs? I'd rather not have to edit the UTF-8 string
to filter out the invisible chars.

Han-Wen Nienhuys - hanwenn at gmail.com - http://www.xs4all.nl/~hanwen

More information about the cairo mailing list