I'm working with a display font that is missing many common characters, including parenthesis, em-dash, and true ``directional quotes''.

I'd like a straightfoward way to replace these with matching characters set in another font when encountered. A general "if the primary font is missing this character, use this other font" would work, but I can identify all of the characters I care about. I do not need change the character; if the missing character is, say "(", it will be ( in the fallback font. I'm only using the font in limited circumstances (\chapter and \section in memoir) which may may the problem easier or harder. Similarly, all fonts involved are TrueType/OpenType.

newunicodechar and ucharclasses seem promising, but the former won't meddle with ASCII characters and the latter only works on entire Unicode blocks.

XeTeX's interchar class mechanism seems promising, and is my plan B. But I'd prefer something a bit more portable, if only between XeLaTeX and LuaLaTex.

Minimal Working Example, relying on the free Cyberfunk font.

``Dr. J---/Mr. H---'s (Missing Glyph) Day''

\fontspec{Cyberfunk}``Dr. J---/Mr. H---'s (Missing Glyph) Day''

enter image description here

I can provide a longer, more realistic example of how I'm using it with memoir if that's helpful; but it was a lot longer.

  • Making ( active (which is what \newunicodechar would do) is a sure way to break other constructs where ( is expected to be the regular one. Doing a replacement before passing the titles to the actual macros seems the solution with the least impact. – egreg Jan 25 '17 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.