On Wed, May 13, 2009 at 10:59, Mojca Miklavec wrote:
> I suspect that what LaTeX does is something similar to the following
> (in ConTeXt slang):
> \starttypescript[cjk] [zhfont]
>  \definefontsynonym [CJK]           [file:SimSun]
>  \definefontsynonym [CJKBold]       [file:SimSun] % you could
> artificially embolden the font
>  \definefontsynonym [CJKItalic]     [file:SimSun] % you could
> artificially slant the font
>  \definefontsynonym [CJKBoldItalic] [file:SimSun]
> \stoptypescript
> \definetypeface [myzhfont] [rm] [serif] [latin-modern] [default]
> \definetypeface [myzhfont] [ss] [sans] [latin-modern] [default]
> \definetypeface [myzhfont] [tt] [mono] [latin-modern] [default]
> \definetypeface [myzhfont] [cjk] [cjk] [zhfont] [default]
> \dorecurse{10000}{ hello {\cjk 你好 \it 你好}}
> In a similar way ConTeXt supports handwriting/calligraphy families
> (\hw, \cg I think; well, maybe you could even pretend that you are
> defining the "calligraphy font" to start with, as that one is already
> defined where it needs to be defined). If you manage to make the
> proposal above to run, this will save you the need for switching the
> whole typeface ten thousands of times and should become really fast
> (hopefully).

I tested the following, but you should compare the timing on your
machine (it's a different processor and a different font):

\starttypescript[calligraphy] [song]
        \definefontsynonym [AdobeSong] [file:AdobeSongStd-Light]
\starttypescript[calligraphy] [song] [name]
        \definefontsynonym [Calligraphy] [AdobeSong]
        \definetypeface [zhfont] [rm] [serif]       [modern] [default]
        \definetypeface [zhfont] [ss] [sans]        [modern] [default]
        \definetypeface [zhfont] [tt] [mono]        [modern] [default]
        \definetypeface [zhfont] [cg] [calligraphy] [song]   [default]



% test 1: takes 12 seconds
\dorecurse{10000}{ hello {\cg 你好}}
% test 2: takes 9 seconds
\dorecurse{10000}{ hello {\ccg 你好}}

Switching the whole typescript (\def\ccg{\zhfont} and running the
second test) took 123 seconds eating 100% of processor time.

So maybe that's the way to go, just define a calligraphy-like constant
for cjk family that will enable switching to bold/italic as well (an
equivalent to rm/ss/tt)?

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net

Reply via email to