ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* MS Office Chinese fonts in ConTeXt
@ 2017-08-27  2:17 Martin Bruchanov
  2017-08-27 17:57 ` Hans Hagen
  2017-08-27 18:12 ` Hans Hagen
  0 siblings, 2 replies; 6+ messages in thread
From: Martin Bruchanov @ 2017-08-27  2:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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.

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MS Office Chinese fonts in ConTeXt
  2017-08-27  2:17 MS Office Chinese fonts in ConTeXt Martin Bruchanov
@ 2017-08-27 17:57 ` Hans Hagen
  2017-08-27 18:12 ` Hans Hagen
  1 sibling, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2017-08-27 17:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Martin Bruchanov

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MS Office Chinese fonts in ConTeXt
  2017-08-27  2:17 MS Office Chinese fonts in ConTeXt Martin Bruchanov
  2017-08-27 17:57 ` Hans Hagen
@ 2017-08-27 18:12 ` Hans Hagen
  2017-09-05  1:18   ` Martin Bruchanov
  1 sibling, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2017-08-27 18:12 UTC (permalink / raw)
  To: Martin Bruchanov, mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]

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
-----------------------------------------------------------------

[-- Attachment #2: type-imp-mscore.mkiv --]
[-- Type: text/plain, Size: 6925 bytes --]

%D \module
%D   [       file=type-imp-mscore,
%D        version=2007.07.30,
%D          title=\CONTEXT\ Typescript Macros,
%D       subtitle=Microsoft Core Fonts,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\starttypescriptcollection[mscore]

    % .ttf not really needed but we want to force the originals

    \starttypescript [\s!serif] [mscoretimes] [\s!name]
        \setups[\s!font:\s!fallback:\s!serif]
        \definefontsynonym [\s!Serif]           [\s!file:times.ttf]   [\s!features=\s!default]
        \definefontsynonym [\s!SerifBold]       [\s!file:timesbd.ttf] [\s!features=\s!default]
        \definefontsynonym [\s!SerifItalic]     [\s!file:timesi.ttf]  [\s!features=\s!default]
        \definefontsynonym [\s!SerifBoldItalic] [\s!file:timesbi.ttf] [\s!features=\s!default]
    \stoptypescript

    \starttypescript [\s!sans] [mscorearial] [\s!name]
        \setups[\s!font:\s!fallback:\s!sans]
        \definefontsynonym [\s!Sans]           [\s!file:arial.ttf]   [\s!features=\s!default]
        \definefontsynonym [\s!SansBold]       [\s!file:arialbd.ttf] [\s!features=\s!default]
        \definefontsynonym [\s!SansItalic]     [\s!file:ariali.ttf]  [\s!features=\s!default]
        \definefontsynonym [\s!SansBoldItalic] [\s!file:arialbi.ttf] [\s!features=\s!default]
    \stoptypescript

    \starttypescript [\s!sans] [mscorearialnarrow] [\s!name]
        \setups[\s!font:\s!fallback:\s!sans]
        \definefontsynonym [\s!Sans]           [\s!file:arialn.ttf]   [\s!features=\s!default]
        \definefontsynonym [\s!SansBold]       [\s!file:arialnb.ttf]  [\s!features=\s!default]
        \definefontsynonym [\s!SansItalic]     [\s!file:arialni.ttf]  [\s!features=\s!default]
        \definefontsynonym [\s!SansBoldItalic] [\s!file:arialnbi.ttf] [\s!features=\s!default]
    \stoptypescript

    \starttypescript [\s!mono] [mscorecourier] [\s!name]
        \setups[\s!font:\s!fallback:\s!mono]
        \definefontsynonym [\s!Mono]           [\s!file:cour.ttf]   [\s!features=\s!none]
        \definefontsynonym [\s!MonoBold]       [\s!file:courbd.ttf] [\s!features=\s!none]
        \definefontsynonym [\s!MonoItalic]     [\s!file:couri.ttf]  [\s!features=\s!none]
        \definefontsynonym [\s!MonoBoldItalic] [\s!file:courbi.ttf] [\s!features=\s!none]
    \stoptypescript

    \starttypescript [\s!sans] [mscoreverdana] [\s!name]
        \setups[\s!font:\s!fallback:\s!sans]
        \definefontsynonym [\s!Sans]           [\s!file:verdana.ttf]  [\s!features=\s!default]
        \definefontsynonym [\s!SansBold]       [\s!file:verdanab.ttf] [\s!features=\s!default]
        \definefontsynonym [\s!SansItalic]     [\s!file:verdanai.ttf] [\s!features=\s!default]
        \definefontsynonym [\s!SansBoldItalic] [\s!file:verdanaz.ttf] [\s!features=\s!default]
    \stoptypescript

    \starttypescript[mscore]
        \definetypeface [\typescriptone] [\s!rm] [\s!serif] [mscoretimes]   [\s!default]
        \definetypeface [\typescriptone] [\s!ss] [\s!sans]  [mscorearial]   [\s!default] [\s!rscale=0.860]
        \definetypeface [\typescriptone] [\s!tt] [\s!mono]  [mscorecourier] [\s!default] [\s!rscale=1.065]
        \definetypeface [\typescriptone] [\s!mm] [\s!math]  [times]         [\s!default] [\s!rscale=1.020]
    \stoptypescript

    \starttypescript[mscorenarrow,mscore-narrow]
        \definetypeface [\typescriptone] [\s!rm] [\s!serif] [mscoretimes]       [\s!default]
        \definetypeface [\typescriptone] [\s!ss] [\s!sans]  [mscorearialnarrow] [\s!default] [\s!rscale=0.860]
        \definetypeface [\typescriptone] [\s!tt] [\s!mono]  [mscorecourier]     [\s!default] [\s!rscale=1.065]
        \definetypeface [\typescriptone] [\s!mm] [\s!math]  [times]             [\s!default] [\s!rscale=1.020]
    \stoptypescript

  % \starttypescript[mscoress]
  %     \definetypeface [mscoress] [\s!ss] [\s!sans]  [mscorearial]   [\s!default]
  %     \definetypeface [mscoress] [\s!rm] [\s!serif] [mscoretimes]   [\s!default] [rscale=1.160]
  %     \definetypeface [mscoress] [\s!tt] [\s!mono]  [mscorecourier] [\s!default] [rscale=1.240]
  %     \definetypeface [mscoress] [\s!mm] [\s!math]  [times]         [\s!default] [rscale=1.185]
  % \stoptypescript

\stoptypescriptcollection

\starttypescriptcollection[microsoft-chinese-old]

  % \starttypescript [\s!serif] [mschinese,mschinese-light]
  %     \definefontsynonym [STSong]      [\s!file:stsong.ttf]   [\s!features=chinese]
  %     \definefontsynonym [STKaiti]     [\s!file:stkaiti.ttf]  [\s!features=chinese]
  %     \definefontsynonym [STZHongsong] [\s!file:stzhongs.ttf] [\s!features=chinese]
  %     \definefontsynonym [STFangsong]  [\s!file:stfangso.ttf] [\s!features=chinese]
  % \stoptypescript

  % \starttypescript [\s!sans] [mschinese]
  %     \definefontsynonym [STXIHei] [\s!file:stxihei.ttf] [\s!features=chinese]
  % \stoptypescript

    \starttypescript [\s!serif] [mschinese]
        \setups[\s!font:\s!fallback:\s!serif]
        \definefontsynonym [\s!Serif]       [\s!file:stsong.ttf]   [\s!features=chinese]
        \definefontsynonym [\s!SerifItalic] [\s!file:stkaiti.ttf]  [\s!features=chinese]
        \definefontsynonym [\s!SerifBold]   [\s!file:stzhongs.ttf] [\s!features=chinese]
    \stoptypescript

    \starttypescript [\s!serif] [mschinese-light]
        \setups[\s!font:\s!fallback:\s!serif]
        \definefontsynonym [\s!Serif]       [\s!file:stfangso.ttf] [\s!features=chinese]
        \definefontsynonym [\s!SerifItalic] [\s!file:stkaiti.ttf]  [\s!features=chinese]
        \definefontsynonym [\s!SerifBold]   [\s!file:stzhongs.ttf] [\s!features=chinese]
    \stoptypescript

    \starttypescript [\s!sans] [mschinese]
        \setups[\s!font:\s!fallback:\s!sans]
        \definefontsynonym [\s!Sans] [\s!file:stxihei.ttf] [\s!features=chinese]
    \stoptypescript

    \starttypescript[mschinese]
        \definetypeface [\typescriptone] [\s!rm] [\s!serif] [mschinese] [\s!default]
        \definetypeface [\typescriptone] [\s!ss] [\s!sans]  [mschinese] [\s!default]
        \definetypeface [\typescriptone] [\s!mm] [\s!math]  [cambria]
        \definetypeface [\typescriptone] [\s!tt] [\s!mono]  [mscorecourier]
    \stoptypescript

    \starttypescript[mschineselight,mschinese-light]
        \definetypeface [\typescriptone] [\s!rm] [\s!serif] [mschinese-light] [\s!default]
        \definetypeface [\typescriptone] [\s!ss] [\s!sans]  [mschinese]       [\s!default]
        \definetypeface [\typescriptone] [\s!mm] [\s!math]  [cambria]
        \definetypeface [\typescriptone] [\s!tt] [\s!mono]  [mscorecourier]
    \stoptypescript

\stoptypescriptcollection

[-- Attachment #3: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MS Office Chinese fonts in ConTeXt
  2017-08-27 18:12 ` Hans Hagen
@ 2017-09-05  1:18   ` Martin Bruchanov
  2017-09-05  7:02     ` Henning Hraban Ramm
  2017-09-05  7:30     ` Hans Hagen
  0 siblings, 2 replies; 6+ messages in thread
From: Martin Bruchanov @ 2017-09-05  1:18 UTC (permalink / raw)
  To: Hans Hagen, mailing list for ConTeXt users

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
> -----------------------------------------------------------------

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MS Office Chinese fonts in ConTeXt
  2017-09-05  1:18   ` Martin Bruchanov
@ 2017-09-05  7:02     ` Henning Hraban Ramm
  2017-09-05  7:30     ` Hans Hagen
  1 sibling, 0 replies; 6+ messages in thread
From: Henning Hraban Ramm @ 2017-09-05  7:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 2017-09-05 um 03:18 schrieb Martin Bruchanov <bruxy@regnet.cz>:

> 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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MS Office Chinese fonts in ConTeXt
  2017-09-05  1:18   ` Martin Bruchanov
  2017-09-05  7:02     ` Henning Hraban Ramm
@ 2017-09-05  7:30     ` Hans Hagen
  1 sibling, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2017-09-05  7:30 UTC (permalink / raw)
  To: Martin Bruchanov, mailing list for ConTeXt users

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-09-05  7:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-27  2:17 MS Office Chinese fonts in ConTeXt Martin Bruchanov
2017-08-27 17:57 ` Hans Hagen
2017-08-27 18:12 ` Hans Hagen
2017-09-05  1:18   ` Martin Bruchanov
2017-09-05  7:02     ` Henning Hraban Ramm
2017-09-05  7:30     ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).