Is there a way to make Anki pick different fonts for different languages/Unicode ranges?

A lot of my Anki usage is learning vocabulary with a focus on etymology and historical linguistics. In addition to simple “Front” and “Back” fields I generally include a “Notes” field in my note types, where I add supplementary information, displayed upon answering, like etymologies or examples of use. This “Notes” field will often contain a variety of different scripts all at once, but since no one font is very good at all the scripts, it’ll often end up looking rather bad.

Is there a way that I can tell Anki to apply certain fonts by script type or by Unicode range? Or even just the sequence of fonts to use as fallbacks when the first font given doesn’t contain the characters encountered?

To give an example, I just reviewed a card of mine where the “Notes” field has the following text:

[< ᴘꜱ *qayθ̣- ]

[ɪᴀꜰᴍ קָצִיר “høst” el. חֹ֫רֶף “vinter”]

עֹ֖ד כָּל־יְמֵ֣י הָאָ֑רֶץ זֶ֡רַע וְ֠קָצִיר וְקֹ֨ר וָחֹ֜ם וְקַ֧יִץ וָחֹ֛רֶף וְיֹ֥ום וָלַ֖יְלָה לֹ֥א יִשְׁבֹּֽתוּ׃ (Gen 8, 22)

This is from a Hebrew note-type, where the main font used is the brilliant SBL Hebrew font, but that font can’t handle the θ with the combining underdot in the first line and so displays a replacement square character garbled with the letter. To avoid this, of course, I could style the entire “Notes” field with a comprehensive Latin range font, like Gentium Plus, but then the accented Hebrew would look horrible.

So, is there any way to have different scripts automatically displayed in different fonts? Or at least control the sequence of fallback fonts?

1 Like

Try CSS’ unicode-range, which is used with the @font-face rule. Take a look at the attached links for examples.

2 Likes

Been using this one to learn my languages since it came out!

https://ankiweb.net/shared/info/1603486068

CSS supports specifying fallback fonts, but how the toolkit handles missing characters, I’m not sure.