2009/5/12 Hans Hagen
Yue Wang wrote:
Thank you, Taco.
currently I found one way to speed up font loading:
\synchronizemathfontsfalse \let\synchronizetext\relax \starttypescript[serif] [myzhfont] \definefontsynonym [Serif] [file:SimSun] \stoptypescript \definetypeface [myzhfont] [rm] [serif][myzhfont] [default] \def\a{\myzhfont} \dorecurse{10000}{{hello {\a 你好}}\par} \bye
as wolfgang already pointed out, if you want fast fonts you should define them directly using \definefont
I have no speed gain while testing his example.
if you disable bits and pieces of the setupbodyfont mechanism you will eventually run into problems, for instance because \tfd etc are not defined and your chapter titles etc will behave unexpected (sizes as well as when mixed with math)
You are right.
in a regular document you only set up the bodyfont once (not 10000 times) and then use \bf, \sl, \itc etc which are pretty fast
for multilingual typesetting this is different. different fonts will be used for full-width punctuations, cjk-characters (maybe also splict to ruby, kanji, hangul and hanzi), cjk-exta, cjk-extb, and latin. for a not-so-long document (100 pages), switching more than 100times/page is ordinary case. Especially for educational documents (For example, English text book for Chinese students)
TeXExec | runtime: 10.172 much faster, but still far slower than \definefont.
this reminds me another possible bug in ConTeXt:
as mentioned ... we're no talking bugs here but 'features' and side effects of them
ok. this is a feature that I don't like so much...
Test1:
\definetypeface[iwona][ss][sans] [iwona] [default] \definetypeface[iwona][mm][math] [iwona] [default][text=ss] \setupbodyfont[iwona] \starttext foobar \stoptext
runtime= 6.625. There is a 5 seconds pause after loading (c:/context/tex/texmf-context/tex/context/base/spec-xet.tex)
But I don't know what xetex is loading.
fonts (like the sans and more noticeably math (6 families * 3 sizes = 18 fonts at least)
but it's pretty fast on mac (only 1 second delay) on the same machine. [mac do not use fontconfig for searching system fonts] Strange uh? Well, I call it Windows features:) moreover, can you tell me why pdftex load these fonts so fast? (also 6 families * 3 sizes)
Test 2:
\definetypeface[iwona][ss][sans] [iwona] [default] %\definetypeface[iwona][mm][math] [iwona] [default][text=ss] \setupbodyfont[iwona] \starttext foobar \stoptext
I only comment the math defination line. now runetime = 0.969
right .. and as context is supposed to do math (keep in mind that some symbols come from math anyway) this is expected
ok.
Test 3:
move the three lines to context.rme, \definetypeface[iwona][ss][sans] [iwona] [default] \definetypeface[iwona][mm][math] [iwona] [default][text=ss] \setupbodyfont[iwona] then rebuild the format. note we also load the math font. but one thing is clear: Hans said unlike plain TeX and LaTeX, font tfm is not dumped into ConTeXt format.
well, in this case you probably *did* force them in format; the normal default font (lm) is not in the format and loading is delayed
no. I did exactly the same as the default settings do. you also use : \setupencoding[default=ec] \usetypescript[fallback][\defaultencoding] \setupbodyfont[rm,12pt] in cont-en.tex. also in context.tex: \setupencoding[default=ec] \usetypescript[fallback][\defaultencoding] \setupbodyfont[rm,12pt] So I am not forcing them into the format. actually the loading of iwona is delayed to runtime.
However, at this time we compile \starttext foobar \stoptext
runtime =0.875
I don't know the reason for this problem too.... I think XeTeX load math tfms quite fast. (it should be even faster than otf loading, but in xecontext, this is not true).
more needs to be set up ... not only fonts, + some testing + ...
just do a \tracingall before setupbodyfont and you will see
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________