ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Can we make font loading much faster?
@ 2008-09-12 14:30 Yue Wang
  2008-09-12 16:00 ` Wolfgang Schuster
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Yue Wang @ 2008-09-12 14:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

Hi:

The following cases all use second run of context. So there is no font
cache time. I use a new installed Windows XP SP3 on a Core 2 Duo
1.68GHz with 1GB mem machine. Only TeXWorks and ConTeXt are installed
and running on the machine. I close all pre-installed software (like
MSN, IE, etc.) and leave all extra memory for LuaTeX.

Only 3 big chinese font, AdobeSongStd-Light, AdobeHeitiStd-Regular,
AdobeKaitiStd-Regular are loaded. However, different approaches have
different runtime, here, two cases are tested (zhfonts is attached in
the mail):

\usetypescriptfile[zhfonts]
\usetypescript[myfont]
\setupbodyfont[myfont,rm,11pt]
\starttext
  你好 {\it 你好} {\bf 你好}
\stoptext
MtxRun | total runtime: 194.156


\definefontfeature[zh][mode=node, script=hang, lang=zhs]
\definefontsynonym[song][AdobeSongStd-Light][features=zh]
\definefont[song][song at 12pt]
\definefontsynonym[hei][AdobeHeitiStd-Regular][features=zh]
\definefont[hei][hei at 12pt]
\definefontsynonym[kai][AdobeKaitiStd-Regular][features=zh]
\definefont[kai][kai at 12pt]
\starttext
{\song  你好}{\hei  你好}{\kai  你好}
\stoptext
MtxRun | total runtime: 13.797


This also applies to file which only one big font, AdobeSongStd-Light,
is used, two cases are tested:

\definefontfeature[zh][mode=node, script=hang, lang=zhs]
\definefontsynonym[song][AdobeSongStd-Light][features=zh]
\definefont[song][song at 12pt]
\definefontsynonym[hei][AdobeHeitiStd-Regular][features=zh]
\definefont[hei][hei at 12pt]
\definefontsynonym[kai][AdobeKaitiStd-Regular][features=zh]
\definefont[kai][kai at 12pt]
\starttext
{\song  你好}
\stoptext
MtxRun | total runtime: 5.609

\usetypescriptfile[zhfonts]
\usetypescript[myfont]
\setupbodyfont[myfont,rm,11pt]
\starttext
  你好
\stoptext
MtxRun | total runtime: 135.125


If no Chinese fonts are used, three cases are tested:
\usetypescriptfile[zhfonts]
\usetypescript[myfont]
\setupbodyfont[myfont,rm,11pt]
\starttext
 Hello
\stoptext
MtxRun | total runtime: 89.938

\starttext
 Hello
\stoptext
MtxRun | total runtime: 2.594

\definefontfeature[zh][mode=node, script=hang, lang=zhs]
\definefontsynonym[song][AdobeSongStd-Light][features=zh]
\definefont[song][song at 12pt]
\definefontsynonym[hei][AdobeHeitiStd-Regular][features=zh]
\definefont[hei][hei at 12pt]
\definefontsynonym[kai][AdobeKaitiStd-Regular][features=zh]
\definefont[kai][kai at 12pt]
\starttext
 Hello
\stoptext
MtxRun | total runtime: 2.734

In a typical chinese science book, usually 4 to 10 chinese
truetype/opentype font are used. Magazines might use twenty or more.
So if we want to use the standard way (use chinese font as body font,
use virtual fonts mechanism to mix the font with latin fonts, use
different alternatives for single chinese font)
as the zhfonts.tex is presented, the running time here is usually
intolerable (more than 3 minutes' loading time with very simple text
for three fonts).

A simple XeLaTeX file with three font embeding using XeCJK or
zhspacing for interchartoken font switching  usually runs less than 8
seconds. In this case, all the family (rm, ss, tt) parts (like bf, it,
etc) in NFSS are defined.

So, I think there should be a way to improve the font loading
procedure. Maybe we had made deep copy to every fontsynonym defined
here which made the loading time terribly long? Are there some way to
mirror all the unchanged part of a new loading font B from a loaded
time A and only leave the modified table when A and B points to same
physical font? Thanks.

Yue Wang

[-- Attachment #2: zhfonts.tex --]
[-- Type: application/x-tex, Size: 4316 bytes --]

[-- Attachment #3: Type: text/plain, Size: 487 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2008-09-26 15:17 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-12 14:30 Can we make font loading much faster? Yue Wang
2008-09-12 16:00 ` Wolfgang Schuster
2008-09-12 16:02 ` Hans Hagen
2008-09-12 16:48   ` Yue Wang
2008-09-12 17:15     ` Hans Hagen
2008-09-26 12:06       ` Yue Wang
2008-09-26 15:17         ` Hans Hagen
2008-09-12 18:21     ` Hans Hagen
2008-09-13  0:13       ` Yue Wang
2008-09-13  0:44         ` Yue Wang
2008-09-13 10:14           ` Hans Hagen
2008-09-14 11:29             ` Yue Wang
2008-09-12 16:47 ` Hans Hagen
2008-09-12 19:03 ` Mohamed Bana
2008-09-12 20:15   ` Hans Hagen
2008-09-12 20:42     ` Thomas A. Schmitz

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