[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fallback fonts in LaTeX export for non latin scripts
From: |
Juan Manuel Macías |
Subject: |
Re: Fallback fonts in LaTeX export for non latin scripts |
Date: |
Wed, 06 Sep 2023 14:58:22 +0000 |
Ihor Radchenko writes:
> Do I understand correctly that onchar=id will not break anything if text
> is correctly marked with \selectlanguage{<lang>}?
To load language features (hyphen rules, captions, etc.) there is no
problem. But to load a font associated with a language, the font of the
last declared language will always be loaded. Well, it is not a problem,
because if in a document there are texts in Russian and Bulgarian, for
example, the natural thing is that they go in the same font, since both
languages share the Cyrillic script. But there may be cases when the
author needs different fonts. In such a case, the user should not use
the onchar = etc property:
https://i.imgur.com/vmsCNkP.png
In any case (to organize myself mentally) I thought that it could be
done on two levels:
- Level 0: The fonts associated with each script are loaded (from a
defcustom list) if luatex is the current engine. And low-level code is
generated in Lua with the luaotfload.add_fallback function. That code
can be in a Lua file or directly within the preamble, enclosed in the
\directlua primitive (mode=harf means that HarfBuzz is used as otf
rendering):
\directlua
{luaotfload.add_fallback("orgfallback",
{
"oldstandard:mode=harf;script=grek;",
"oldstandard:mode=harf;script=cyrl;",
"freeserif:mode=harf;script=arab;",
"freeserif:mode=harf;script=dev2;",
etc., etc.
})
}
And, to load the fallback fonts:
\setmainfont{latinmodernroman}[RawFeature={fallback=orgfallback}]
At this level per-language properties are not loaded, but at least
readability is ensured. The user cannot modify the fonts associated
with each script within the document, but can modify, of course, the
defcustom.
- Level 1: The user can load language properties and associate fonts
with each language using Babel's high-level code (via keywords in Org,
as we have commented in previous messages). Here you can also modify
the default fonts (also, as we mentioned before): main, mono, sans and
math. If the language is declared with an asterisk (for example:
russian*) the onchar=etc property will be included in the preamble,
and it would not be necessary to switch to russian explicitly. It is
assumed that in this scenario the only language with Cyrillic script
would be Russian. For language swithcing, in the rest of the cases,
some babel command would have to be used using @@latex:@@, special
blocks, etc. When Org already has its own language switching
mechanism, this would be used instead. Wdyt?
--
Juan Manuel Macías
https://juanmanuelmacias.com
https://lunotipia.juanmanuelmacias.com
https://gnutas.juanmanuelmacias.com
- Re: Fallback fonts in LaTeX export for non latin scripts, (continued)
- Re: Fallback fonts in LaTeX export for non latin scripts, Ihor Radchenko, 2023/09/04
- Re: Fallback fonts in LaTeX export for non latin scripts, Juan Manuel Macías, 2023/09/04
- Re: Fallback fonts in LaTeX export for non latin scripts, Ihor Radchenko, 2023/09/05
- Re: Fallback fonts in LaTeX export for non latin scripts, Juan Manuel Macías, 2023/09/20
- Re: Fallback fonts in LaTeX export for non latin scripts, Ihor Radchenko, 2023/09/21
- Re: Fallback fonts in LaTeX export for non latin scripts, Juan Manuel Macías, 2023/09/24
- Re: Fallback fonts in LaTeX export for non latin scripts, Ihor Radchenko, 2023/09/26
- Re: Fallback fonts in LaTeX export for non latin scripts, Max Nikulin, 2023/09/05
- Re: Fallback fonts in LaTeX export for non latin scripts, Juan Manuel Macías, 2023/09/05
- Re: Fallback fonts in LaTeX export for non latin scripts, Ihor Radchenko, 2023/09/06
- Re: Fallback fonts in LaTeX export for non latin scripts,
Juan Manuel Macías <=
- Re: Fallback fonts in LaTeX export for non latin scripts, Ihor Radchenko, 2023/09/07
- Re: Fallback fonts in LaTeX export for non latin scripts, Juan Manuel Macías, 2023/09/07
- Re: Fallback fonts in LaTeX export for non latin scripts, Ihor Radchenko, 2023/09/08