[NTG-context] How do I add cyrillic to my typescript/document?

Vladimir Lomov lomov.vl at yandex.ru
Mon May 4 04:37:20 CEST 2020

** Gerben Wierda <gerben.wierda at rna.nl> [2020-05-04 00:36:11 +0200]:

> On 3 May 2020, at 15:55, Pablo Rodriguez <oinos at gmx.es> wrote:
>> On 5/3/20 2:56 PM, Gerben Wierda wrote:
>>> ConTeXtgarden had theanswer when I searched again:
>>> \setupbodyfont[dejavu]
>>> \mainlanguage[russian]
>> Hi Gerben,
>> I’m afraid they may be different issues: setting a language and getting
>> the glyphs required for that language.
>> See the following sample:
>>    \setupbodyfont[dejavu]
>>    \mainlanguage[russian]
>>    \starttext
>>    \hyphenatedword{%
>>    Николаевич
>>    typography
>>    \en typography}
>>    \stoptext
>> Since you set the main language to Russian in the document, you would
>> have to mark all English texts properly. I doubt this may be what you
>> intend.
>> The way to get a fallback font would be (depending on which approach you
>> use) \definefontfallback or \definefallbackfamily.
>> A sample of the second option would read:
>>  \definefallbackfamily
>>    [mainface]
>>    [ss]
>>    [FreeSans]
>>    [preset=range:cyrillic,
>>     force=yes]
>> In any case,
>> http://www.pragma-ade.com/general/qrcs/setup-en.pdf#search=%22definefontfallback%22
>> explains the syntax of the first option (sorry, but I only use the
>> \definefontfamily approach).
>> Just in case it helps,

> Thank you.

> It could help if I would understand ConTeXt better. The link gives me a
> grammar for a command, but doesn’t tell me what to put in.

Prepare a (small) example, for example.

> I tried many, many different permutations, I tried everything I could find
> on ConTeXtgarden (but then, that also finds me stuff from 15 years ago that
> isn’t valid anymore), but no luck so far.

> The last I tried was

> \starttypescript [sans] [optima]
>    \setups[font:fallback:sans]
>    \definefontsynonym [Sans]           [file:Optima.ttc(Optima Regular)]     [features=default]
>    \definefontsynonym [SansBold]       [file:Optima.ttc(Optima Bold)]        [features=default]
>    \definefontsynonym [SansItalic]     [file:Optima.ttc(Optima Italic)]      [features=default]
>    \definefontsynonym [SansBoldItalic] [file:Optima.ttc(Optima Bold Italic)] [features=default]
> \stoptypescript

> \definetypeface [optima] [ss] [sans] [optima] [default]
> \definetypeface [optima] [rm] [serif] [optima] [default]
> \definetypeface [optima] [tt] [mono] [modern] [default]
> \definetypeface [optima] [mm] [math] [pagella] [default]

>   \definefallbackfamily
>     [optima]
>     [ss]
>     [file:Helvetica.ttc]
>     [preset=range:cyrillic,
>     force=yes]

> \setupbodyfont [optima]

> The error is:

> fonts           > typescripts > unknown library 'optima'
> open source     > level 3, order 6, name '/usr/local/context-osx-64/tex/texmf-context/tex/context/fonts/mkiv/type-imp-texgyre.mkiv'
> close source    > level 3, order 6, name '/usr/local/context-osx-64/tex/texmf-context/tex/context/fonts/mkiv/type-imp-texgyre.mkiv'
> selectfont      > the requested fallback font 'file:Helvetica.ttc' for typeface 'optima' style 'ss' was ignored because no files where found.

> Which is weird because Optima.ttc is in the same directory and it is found.

Note that log says about "Helvetica.ttc" not "Optima.ttc". Why you mention it
is it a typo and you mean "Helvetica.ttc"? I'm not sure how context searches
for fonts, but when I plainly use "standard" locations for fonts, for example
OSFONTDIR variable, it could find and use requested font.

> I have a lot o difficulty understanding any of the documentation (as far as
> it is available for the subjects and commands I am lookng for).

> For instance: what is the difference between the “Syntax (autogenerated)”
> and “Syntax entries on ConTeXtgarden? If they differ which one should I
> take? If you tell me “preset=range:cyrillic and what I find says
> "range=cyrillic", which one do I use ( in this case, changing did not help).
> There are just too many things that can be different for tial and error to
> be effective.

> But anyway, even if I could understand it, I can’t find anything useful
> (that is: something that works or makes me try something that works) about
> font fallbacks. Spending hours of looking (losing a lot of sleep) and then
> having to bother the list again is very frustrating. Why isn’t this
> straightforward? I am sorry, everybody is very helpful, but the frustration
> mounts again.

I couldn't help here because I understand better the LaTeX font mechanism than
ConTeXt one but I don't use ConTeXt as often as LaTeX. If I understand
correctly, fallback mechanism allows to use some "main" font for most of
letters in a document, for example, for Latin letters and use another font, if
some letters are missing from "main" one. The "missing" is based on letters
codes, see "range" above.

Your original question is a bit unclear to me. Do you want typeset document
with Cyrillic letters, for example Russian text or just want to include some
words using Cyrillic (Russian) letters? The former assumes that you will use
\mainlanguage[ru] and appropriate font with Cyrillic glyphs, while for the
latter you need only the font.

I'm not a Mac OS user neither I have Optima nor Helvetica fonts, but Computer
Modern Unicode (OTF) and OldStandard (OTF) have both Cyrillic and Latin
letters (OldStandard doesn't have support "out of box" in context while
Computer Modern Unicode has) so I made two small examples (well, the first
example not so small, sometimes I prepare example not only for others but for
myself too) which show both uses. Both fonts can be found on ctan:
https://ctan.org/pkg/cm-unicode and https://ctan.org/pkg/oldstandard.

> G

WBR, Vladimir Lomov

Girls marry for love.  Boys marry because of a chronic irritation that
causes them to gravitate in the direction of objects with certain curvilinear
		-- Ashley Montagu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rus-text.tex
Type: application/x-tex
Size: 6693 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20200504/ef635c6c/attachment-0002.tex>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mixed-text.tex
Type: application/x-tex
Size: 172 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20200504/ef635c6c/attachment-0003.tex>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20200504/ef635c6c/attachment-0001.sig>

More information about the ntg-context mailing list