Hi everybody, I have an almost finished report inside which I need to typeset some russian words. I am using ConTeXt Standalone current (2011.05.18 18:04 MKII). Reading the wiki, it seems that there are no more fonts with cyrillic glyphs in this distribution. So I switched to XeTeX in order to use my system fonts. Unfortunately I stumbled into a problem when combining my fr settings with a font switching command. Here is a minimal example. \mainlanguage[fr] \useencoding[ffr] \definefontsynonym[CyrF][name:Lucida Grande] \definefont[Russian][CyrF sa 1] \starttext Quelques caractères cyrilliques {\Russian Мама и Папа} et on continue tranquillement. \stoptext If I delete either line \mainlanguage[fr] or \useencoding[ffr] everything works fine (for the font switching, but obviously not for the other part of my report :-). Below is the output when I try to compile the above example with "texexec --xtx". Could someone tell me if I am doing something wrong. Thanks. TeXExec | processing document 'fr-ffr-cyr' TeXExec | no ctx file found TeXExec | tex processing method: context TeXExec | TeX run 1 TeXExec | writing option file fr-ffr-cyr.top TeXExec | using randomseed 1093 TeXExec | tex engine: xetex TeXExec | tex format: cont-en.mkii This is XeTeX, Version 3.1415926-2.2-0.999.7 (Web2C 7.5.6) \write18 enabled. entering extended mode (./fr-ffr-cyr.tex ConTeXt ver: 2011.05.18 18:04 MKII fmt: 2011.7.31 int: english/english system : cont-new.mkii loaded (/Users/jprey/ConTeXt-2011.05.18/tex/texmf-context/tex/context/base/cont-new.mk ii systems : beware: some patches loaded from cont-new.mkii ) system : cont-sys.rme loaded (/Users/jprey/ConTeXt-2011.05.18/tex/texmf-context/tex/context/user/cont-sys.rm e (/Users/jprey/ConTeXt-2011.05.18/tex/texmf-context/tex/context/base/type-siz.mk ii) (/Users/jprey/ConTeXt-2011.05.18/tex/texmf-context/tex/context/base/type-otf.mk ii) (/Users/jprey/ConTeXt-2011.05.18/tex/texmf-context/tex/context/base/type-xtx.mk ii)) system : fr-ffr-cyr.top loaded (./fr-ffr-cyr.top) bodyfont : 12pt rm is loaded language : patterns nl->default:default->1->2:2 us->default:default->2-> 2:3 de->default:default->3->3:3 da->default:default->4->2:2 sv->default:default ->5->2:2 af->default:default->6->2:2 gb->default:default->7->2:2 fr->default:de fault->8->2:2 es->default:default->9->2:2 ca->default:default->10->2:2 it->defa ult:default->11->2:2 la->default:default->12->2:2 pt->default:default->13->2:2 ro->default:default->14->2:2 pl->default:default->15->2:2 cs->default:default-> 16->2:2 sk->default:default->17->2:2 hr->default:default->18->2:2 sl->default:d efault->19->2:2 tr->default:default->20->2:2 tk->default:default->21->1:2 lt->d efault:default->22->2:2 agr->default:default->24->2:2 fi->default:default->25-> 2:2 hu->default:default->26->2:2 ru->default:default->28->2:2 uk->default:defau lt->29->3:3 loaded specials : dvips loaded language : language en is active specials : loading definition file dpx (/Users/jprey/ConTeXt-2011.05.18/tex/texmf-context/tex/context/base/spec-dpx.mk ii specials : loading definition file fdf (/Users/jprey/ConTeXt-2011.05.18/tex/texmf-context/tex/context/base/spec-fdf.mk ii)) specials : loading definition file xet (/Users/jprey/ConTeXt-2011.05.18/tex/texmf-context/tex/context/base/spec-xet.mk ii) encoding : coding ffr is loaded (/Users/jprey/ConTeXt-2011.05.18/tex/texmf-context/tex/context/base/enco-ffr.mk ii system : module tryout not found language : language specific options [default-fr] seamless appended language : language specific options [default-fr] seamless appended ) (./fr-ffr-cyr.tuo) (./fr-ffr-cyr.tuo) (./fr-ffr-cyr.tuo) (./fr-ffr-cyr.tuo) (./fr-ffr-cyr.tuo) (./fr-ffr-cyr.tuo) (./fr-ffr-cyr.tuo) (./fr-ffr-cyr.tuo) (./fr-ffr-cyr.tuo) (./fr-ffr-cyr.tuo) (./fr-ffr-cyr.tuo) publications : file fr-ffr-cyr.bbl not found, waiting for bibtex (./fr-ffr-cyr.tuo) systems : begin file fr-ffr-cyr at line 7 ! Missing \endcsname inserted. <to be read again> \edef \dodirectdiscretionary #1->\edef \discretionarytoken {\detokenize {#1}}\let ... <argument> ...text {:}{\dodirectdiscretionary {:}} Lucida Grande \dotruefontname ...->\ifcsname \??ff \fontclass #1 \endcsname \ifx #2\empty \... \dotruefontname ... \??ff \fontclass #1\endcsname \else \@EA \redotruefontna... \donoparsefontspec ...\truefontname \somefontname }\ifx \fontfile \s!unknown... ... l.9 {\Russian Мама и Папа} et on ? x No pages of output. Transcript written on fr-ffr-cyr.log. TeXUtil | parsing file fr-ffr-cyr.tui TeXUtil | check loading of file 'fr-ffr-cyr', begin/end problem TeXUtil | shortcuts : 0 TeXUtil | expansions: 0 TeXUtil | reductions: 0 TeXUtil | divisions : 0 TeXUtil | loaded files: 1 TeXUtil | temporary files: 0 TeXUtil | commands: 2 TeXUtil | programs: 0 TeXUtil | tuo file saved -- Jean-Philippe Rey Professeur - École Centrale Paris jean-philippe.rey@ecp.fr 92295 Châtenay-Malabry Cedex - France
Hi, Le 6 août 2011 à 20:28, Jean-Philippe Rey a écrit :
Hi everybody,
I have an almost finished report inside which I need to typeset some russian words. I am using ConTeXt Standalone current (2011.05.18 18:04 MKII). Reading the wiki, it seems that there are no more fonts with cyrillic glyphs in this distribution. So I switched to XeTeX in order to use my system fonts. Unfortunately I stumbled into a problem when combining my fr settings with a font switching command.
Here is a minimal example.
\mainlanguage[fr] \useencoding[ffr]
\definefontsynonym[CyrF][name:Lucida Grande] \definefont[Russian][CyrF sa 1]
\starttext Quelques caractères cyrilliques {\Russian Мама и Папа} et on continue tranquillement. \stoptext
If I delete either line \mainlanguage[fr] or \useencoding[ffr] everything works fine (for the font switching, but obviously not for the other part of my report :-).
I think I found an explanation of the problem stated above. ":" is made active by \mainlanguage[fr] AND \useencoding[ffr]. I initially thought that only the latter activates :, but obviously both are needed in order to change the status of :. I've found three workarounds : 1) don't use the "name:" prefix, if a font file is not found, a system font with that name will be selected. However, this doesn't work for fonts with spaces in their name. 2) deactivate the colon character before calling \definefontsynonym and reactivate it after (quite ugly in my opinion) \catcode`\:=12 \definefontsynonym[TNR][name:Times New Roman] \catcode`\:=13 3) reorder the instructions (not always easy for complex documents) \definefontsynonym[TNR][name:Times New Roman] \definefont[MyFont][TNR] \mainlanguage[fr] \useencoding[ffr] \starttext Text in the default font. {\MyFont This is Times New Roman.} Back to the default font. \stoptext -- Jean-Philippe Rey jean-philippe.rey@ecp.fr
Am 06.08.2011 um 20:28 schrieb Jean-Philippe Rey:
Hi everybody,
I have an almost finished report inside which I need to typeset some russian words. I am using ConTeXt Standalone current (2011.05.18 18:04 MKII). Reading the wiki, it seems that there are no more fonts with cyrillic glyphs in this distribution. So I switched to XeTeX in order to use my system fonts. Unfortunately I stumbled into a problem when combining my fr settings with a font switching command.
Have you considered to use MkIV: \usemodule[simplefonts] \setmainfontfallback[Times New Roman][range=cyrillic] \setmainfont[TeX Gyre Pagella] \starttext Example text from the wiki: Немного русского текста для пробы. \stoptext Wolfgang
Le 9 août 2011 à 17:53, Wolfgang Schuster a écrit :
Am 06.08.2011 um 20:28 schrieb Jean-Philippe Rey:
Hi everybody,
I have an almost finished report inside which I need to typeset some russian words. I am using ConTeXt Standalone current (2011.05.18 18:04 MKII). Reading the wiki, it seems that there are no more fonts with cyrillic glyphs in this distribution. So I switched to XeTeX in order to use my system fonts. Unfortunately I stumbled into a problem when combining my fr settings with a font switching command.
Have you considered to use MkIV:
Yes I have. I tried, but my MkII format doesn't work smoothly under MkIV. I am trying to convert it but I am afraid I won't be able to do it before my deadline.
\usemodule[simplefonts]
\setmainfontfallback[Times New Roman][range=cyrillic] \setmainfont[TeX Gyre Pagella]
\starttext Example text from the wiki: Немного русского текста для пробы. \stoptext
Thank you for this example. It will be very useful once I manage to switch to MkIV. Do you have a similar trick for chinese characters ? -- Jean-Philippe Rey Professeur - École Centrale Paris jean-philippe.rey@ecp.fr 92295 Châtenay-Malabry Cedex - France
Le 9 août 2011 à 20:20, Wolfgang Schuster a écrit :
Am 09.08.2011 um 20:10 schrieb Jean-Philippe Rey:
Do you have a similar trick for chinese characters ?
\usemodule[simplefonts]
\setcjkmainfont[…] \setmainfont[…]
\starttext … \stoptext
I couldn't make \setcjkmainfont to work. Here is my example: \usemodule[simplefonts] \setmainfontfallback[Arial Unicode][range=cyrillic] \setcjkmainfont[Arial Unicode] \starttext Example text from the wiki: Немного русского текста для пробы. And some Chinese: --- 人民日报海外版 --- back to English \stoptext There are 7 chinese characters between ---. Everything is fine with russian but the cjk characters seem to be ignored, I don't even get a replacement character in the output. The font is not to blame as \definefontsynonym[AU][Arial Unicode] \definefont[Arial][AU] \starttext \Arial Example text from the wiki: Немного русского текста для пробы. And some Chinese: --- 人民日报海外版 --- back to English \stoptext displays all the seven Chinese characters. -- Jean-Philippe Rey Professeur - École Centrale Paris jean-philippe.rey@ecp.fr 92295 Châtenay-Malabry Cedex - France
2011/8/10 Jean-Philippe Rey
I couldn't make \setcjkmainfont to work. Here is my example:
\usemodule[simplefonts] \setmainfontfallback[Arial Unicode][range=cyrillic] \setcjkmainfont[Arial Unicode] \starttext Example text from the wiki: Немного русского текста для пробы. And some Chinese: --- 人民日报海外版 --- back to English \stoptext
There are 7 chinese characters between ---. Everything is fine with russian but the cjk characters seem to be ignored,
Because Chinese characters are not in the cyrillic area in unicode, you can try the following example: \usemodule[simplefonts] \setmainfontfallback[arialuni][range={0x0400-0x2FA1F}] \setcjkmainfont[arialuni] \starttext Example text from the wiki: Немного русского текста для пробы. And some Chinese: --- 人民日报海外版 --- back to English \stoptext -- Best regards, Li Yanrui (李延瑞)
Am 10.08.2011 um 14:09 schrieb Li Yanrui (李延瑞):
2011/8/10 Jean-Philippe Rey
: I couldn't make \setcjkmainfont to work. Here is my example:
\usemodule[simplefonts] \setmainfontfallback[Arial Unicode][range=cyrillic] \setcjkmainfont[Arial Unicode] \starttext Example text from the wiki: Немного русского текста для пробы. And some Chinese: --- 人民日报海外版 --- back to English \stoptext
There are 7 chinese characters between ---. Everything is fine with russian but the cjk characters seem to be ignored,
Because Chinese characters are not in the cyrillic area in unicode, you can try the following example:
\usemodule[simplefonts] \setmainfontfallback[arialuni][range={0x0400-0x2FA1F}] \setcjkmainfont[arialuni]
\setmainfontfallback and \setcjkmainfont use the same command to set the fallback font, the difference between both is that \setcjkmainfont has a default value for “range” which is empty for \setmainfontfallback. Wolfgang
Le 10 août 2011 à 14:09, Li Yanrui (李延瑞) a écrit :
2011/8/10 Jean-Philippe Rey
: I couldn't make \setcjkmainfont to work. Here is my example:
\usemodule[simplefonts] \setmainfontfallback[Arial Unicode][range=cyrillic] \setcjkmainfont[Arial Unicode] \starttext Example text from the wiki: Немного русского текста для пробы. And some Chinese: --- 人民日报海外版 --- back to English \stoptext
There are 7 chinese characters between ---. Everything is fine with russian but the cjk characters seem to be ignored,
Because Chinese characters are not in the cyrillic area in unicode, you can try the following example:
\usemodule[simplefonts] \setmainfontfallback[arialuni][range={0x0400-0x2FA1F}] \setcjkmainfont[arialuni] \starttext Example text from the wiki: Немного русского текста для пробы. And some Chinese: --- 人民日报海外版 --- back to English \stoptext
Thanks, that works. But makes pointless \setcjkmainfont[arialuni]. Moreover, I couldn't select different fonts for Russian and Chinese, as, given Wolfgang answer, I thought would be possible. When I try \setmainfontfallback[Arial Unicode][range=0x3400-0x2FA1F] \setmainfontfallback[Times New Roman][range=cyrillic] only the first one is taken into account. -- Jean-Philippe Rey Professeur - École Centrale Paris jean-philippe.rey@ecp.fr 92295 Châtenay-Malabry Cedex - France
Am 10.08.2011 um 15:01 schrieb Jean-Philippe Rey:
Thanks, that works. But makes pointless \setcjkmainfont[arialuni]. Moreover, I couldn't select different fonts for Russian and Chinese, as, given Wolfgang answer, I thought would be possible. When I try
\setmainfontfallback[Arial Unicode][range=0x3400-0x2FA1F] \setmainfontfallback[Times New Roman][range=cyrillic]
only the first one is taken into account.
Add “\setmainfont[…]” after the \setmainfontfallback lines. Wolfgang
Le 10 août 2011 à 15:24, Wolfgang Schuster a écrit :
Am 10.08.2011 um 15:01 schrieb Jean-Philippe Rey:
Thanks, that works. But makes pointless \setcjkmainfont[arialuni]. Moreover, I couldn't select different fonts for Russian and Chinese, as, given Wolfgang answer, I thought would be possible. When I try
\setmainfontfallback[Arial Unicode][range=0x3400-0x2FA1F] \setmainfontfallback[Times New Roman][range=cyrillic]
only the first one is taken into account.
Add “\setmainfont[…]” after the \setmainfontfallback lines.
I tried, but couldn't use latin modern as the main font. No problem for example with \setmainfont[Helvetica] or \setmainfont[Tex Gyre Pagella], but with \setmainfont[Latin Modern Roman] I get only cyrillic OR chinese depending on the order of the fallback definitions. It is the same outcome as without \setmainfont. -- Jean-Philippe Rey Professeur - École Centrale Paris jean-philippe.rey@ecp.fr 92295 Châtenay-Malabry Cedex - France
Am 10.08.2011 um 17:33 schrieb Jean-Philippe Rey:
Le 10 août 2011 à 15:24, Wolfgang Schuster a écrit :
Am 10.08.2011 um 15:01 schrieb Jean-Philippe Rey:
Thanks, that works. But makes pointless \setcjkmainfont[arialuni]. Moreover, I couldn't select different fonts for Russian and Chinese, as, given Wolfgang answer, I thought would be possible. When I try
\setmainfontfallback[Arial Unicode][range=0x3400-0x2FA1F] \setmainfontfallback[Times New Roman][range=cyrillic]
only the first one is taken into account.
Add “\setmainfont[…]” after the \setmainfontfallback lines.
I tried, but couldn't use latin modern as the main font.
You can use “CMU Serif” which support for cyrillic.
No problem for example with \setmainfont[Helvetica] or \setmainfont[Tex Gyre Pagella], but with \setmainfont[Latin Modern Roman] I get only cyrillic OR chinese depending on the order of the fallback definitions. It is the same outcome as without \setmainfont.
The module already sets “Latin Modern” as default font and when you set a fallback font the base font is loaded with the fallback font and you can’t add more fallbacks. When you use now a font different from LM all fallback are applied and you get the desired output. What you can do when you insist on LM is to postpone simplefonts font loading with the following method: \usemodule[simplefonts] \disablesimplefonts % define a fallback fonts! \setmainfontfallback[Arial Unicode] [range=0x3400-0x2FA1F] \setmainfontfallback[Times New Roman][range=cyrillic] \enablesimplefonts \setmainfont[Latin Modern Roman] \starttext Example text from the wiki: Немного русского текста для пробы. And some Chinese: --- 人民日报海外版 --- back to English \stoptext Wolfgang
participants (3)
-
Jean-Philippe Rey
-
Li Yanrui (李延瑞)
-
Wolfgang Schuster