MS Office Chinese fonts in ConTeXt
Hi all, I was trying to create a Chinese document. However, it was quite difficult to find actual information and find fonts... Here is the result: https://github.com/BruXy/ConTeXt-Chinese There is still wrong numbering of Tables and I am not sure how to convert mschinese.ctex into module, but maybe somebody will help. Regards, BruXy PS: It you have some other working Chinese ConTeXt documents, I would be happy to get inspired.
On 8/27/2017 4:17 AM, Martin Bruchanov wrote:
Hi all,
I was trying to create a Chinese document. However, it was quite difficult to find actual information and find fonts...
Here is the result:
https://github.com/BruXy/ConTeXt-Chinese
There is still wrong numbering of Tables and I am not sure how to convert mschinese.ctex into module, but maybe somebody will help. These are old fonts yes? Anyway, here is a better typescript:
\starttypescriptcollection[microsoft-chinese-old] \starttypescript [serif] [mschinese,mschinese-light] \definefontsynonym [STSong] [name:STSong] [features=chinese] \definefontsynonym [STKaiti] [name:STKaiti] [features=chinese] \definefontsynonym [STZHongsong] [name:STZHongsong] [features=chinese] \definefontsynonym [STFangsong] [name:STFangsong] [features=chinese] \stoptypescript \starttypescript [sans] [mschinese] \definefontsynonym [STXIHei] [name:STXIHei] [features=chinese] \stoptypescript \starttypescript [serif] [mschinese] \usetypescript[serif][fallback] \definefontsynonym [Serif] [STSong] [features=chinese] \definefontsynonym [SerifItalic] [STKaiti] [features=chinese] \definefontsynonym [SerifBold] [STZHongsong] [features=chinese] \stoptypescript \starttypescript [serif] [mschinese-light] \usetypescript[serif][fallback] \definefontsynonym [Serif] [STFangsong] [features=chinese] \definefontsynonym [Serif] [STSong] [features=chinese] \definefontsynonym [SerifItalic] [STKaiti] [features=chinese] \definefontsynonym [SerifBold] [STZHongsong] [features=chinese] \stoptypescript \starttypescript [sans] [mschinese] \setups[font:fallback:sans] \definefontsynonym [Sans] [STXIHei] [features=chinese] \stoptypescript \starttypescript[mschinese] \definetypeface [mschinese] [rm] [serif] [mschinese] [default] \definetypeface [mschinese] [ss] [sans] [mschinese] [default] \definetypeface [mschinese] [mm] [math] [pagella] \definetypeface [mschinese] [tt] [mono] [modern] \stoptypescript \starttypescript[mschinese-light] \definetypeface [mschinese] [rm] [serif] [mschinese-light] [default] \definetypeface [mschinese] [ss] [sans] [mschinese] [default] \definetypeface [mschinese] [mm] [math] [modern] \definetypeface [mschinese] [tt] [mono] [modern] \stoptypescript \stoptypescriptcollection if needed I can add type-imp-windows-chinese.mkiv but we need to be sure about the name(s). In your test you need: \setupbodyfont [mschinese,12pt] \usebodyfont [mschinese-light,12pt] % preloads \definebodyfontenvironment[24pt] % prevents messages \definebodyfontenvironment[18pt] % prevents messages There is no need to enable utf. Your table now becomes: \bTABLEbody \bTR\bTD 华文宋体 \eTD\bTD \tt STSONG.TTF \eTD\bTD STSong \eTD\bTD \tf 我能吞下玻璃而不伤身体 \eTD \eTR \bTR\bTD 华文中宋 \eTD\bTD \tt STZHONGS.TTF \eTD\bTD STZhongsong \eTD\bTD \bf 我能吞下玻璃而不伤身体 \eTD \eTR \bTR\bTD 华文细黑 \eTD\bTD \tt STXIHEI.TTF \eTD\bTD STXihei \eTD\bTD \it 我能吞下玻璃而不伤身体 \eTD \eTR \bTR\bTD 华文楷体 \eTD\bTD \tt STKAITI.TTF \eTD\bTD STKaiti \eTD\bTD \ss 我能吞下玻璃而不伤身体 \eTD \eTR \bTR\bTD 华文仿宋 \eTD\bTD \tt STFANGSO.TTF \eTD\bTD STFangsong \eTD\bTD \switchtobodyfont[mschinese-light]我能吞下玻璃而不伤身体 \eTD \eTR \eTABLEbody There is no need for grouping. You switch to sans with \ss as it's part of the typeface specification. For other issues you need to be more specific Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Hi, Attached is a better alternative (just replace the file in the distribution). \usetypescriptfile[mscore] \setupbodyfont [mschinese,12pt] \usebodyfont [mschinese-light,12pt] \definebodyfontenvironment[24pt] \definebodyfontenvironment[18pt] Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Hi Hans, Thank you for your help! I have switched to \usetypescriptfile[mscore]. However, I do not understand one thing, I am using envvar in Linux `OSFONTDIR` and all font file names are in upper case. When \usetypescriptfile[mscore] is set, ConTeXt cannot find font files, when I have renamed all files to lower case, then it works. If I will query font cache with: `mtxrun --script font --list --all --pattern=stsong`, it will return correct path to font file and it does not depend on case. Is it a feature? Best regards, BruXy On 27/08/17 03:12 PM, Hans Hagen wrote:
Hi,
Attached is a better alternative (just replace the file in the distribution).
\usetypescriptfile[mscore]
\setupbodyfont [mschinese,12pt] \usebodyfont [mschinese-light,12pt]
\definebodyfontenvironment[24pt] \definebodyfontenvironment[18pt]
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Am 2017-09-05 um 03:18 schrieb Martin Bruchanov
However, I do not understand one thing, I am using envvar in Linux `OSFONTDIR` and all font file names are in upper case. When \usetypescriptfile[mscore] is set, ConTeXt cannot find font files, when I have renamed all files to lower case, then it works.
I had this experience also with other fonts on OSX. Regardless of the spelling in my typescripts, fonts were only found if I renamed them to all-lowercase. I guess the problem is not current any more, but since I use mostly the same fonts since years, I’m not sure. No time to check at the moment. Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
On 9/5/2017 3:18 AM, Martin Bruchanov wrote:
Hi Hans,
Thank you for your help! I have switched to \usetypescriptfile[mscore].
However, I do not understand one thing, I am using envvar in Linux `OSFONTDIR` and all font file names are in upper case. When \usetypescriptfile[mscore] is set, ConTeXt cannot find font files, when I have renamed all files to lower case, then it works.
If I will query font cache with: `mtxrun --script font --list --all --pattern=stsong`, it will return correct path to font file and it does not depend on case.
Is it a feature? indeed, to avoid issues we do lookups in lowercase (often mixed case works but is more sensitive to the os)
Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
Henning Hraban Ramm
-
Martin Bruchanov