Using backspce to create composite characters or underlining with Pango

I’m trying to render text using pango (in a cairo context) that contains backspaces to make a composite character and to underline… i.e “30\008/0\008/ MHz” (so the zero character has a slash through it).
It seems that pango_layout_set_text (layout, "30\b/0\b/ MHz", -1); renders this…
fred
Is it possible for pango to actually overwrite with backspace?
(I’m receiving the string from an instrument, not generating it myself and so I don’t want to have to handle each character of the string individually)
Michael

I’m not a pango expert, but I doubt it can do that.

Is that purely intended to disambiguate zero and O? If so, I’d just strip out the "\b/" sequences and use an appropriate font.

In theory, you could replace "\b/" with a Unicode combining solidus, either U+0337 (short) or U+0338 (long). However, that seems to work poorly with many fonts. “Noto Sans Mono” does well, but that font has slashed zeros anyway.

No, it’s actually the opposite in this case.
I’m writing an HP plotter emulator (HPGL). The “label” strings from the various instruments expect the simple fonts that are embedded in the plotter (like AV Hershey fonts). I can hack the string in this case but that’s no guarantee it will work with some other instrument.
I’m tokenizing the string (on \b) and backing up one character (only possible because the old HP plotters used mono-spaced fonts). I just thought there should be a better way.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.