ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* using \definebodyfont with multiple size declarations -- Why?
@ 2010-07-26  9:36 Martin Althoff
  2010-07-27 17:42 ` Hans Hagen
  2010-07-27 20:28 ` Wolfgang Schuster
  0 siblings, 2 replies; 13+ messages in thread
From: Martin Althoff @ 2010-07-26  9:36 UTC (permalink / raw)
  To: ntg-context

As someone new to Context, I am trying to get to grips with font handling. Reading through a fair amount of documentation it is not always to clear to me what recommended practice in todays Luatex/MKIV enviroment is.

My setup is "Minimals" updated 26.7.2010 (luatex 0.60.2, MTXrun 2010.07.22) setup on Mac OS X 10.6.4. I use it to produce documents I need in a language teaching environment. As I am starting of without legacy documents, there is no need for MKII or any other type of Tex.

Confusing for me is the use of "\definebodyfont" in typescripts. I read in "co-fonts.pdf" (no release date, internal creation date 18/11/2009):

"because Latin Modern comes in design sizes, there was a need to associate a specific font with each bodyfont size. You may find yourself in a similar situation when you attempt to create a typescript for a ‘professional' commercial font set."

Looking at the example:

\definebodyfont [10pt,11pt,12pt] [rm] [tfe=Serif at 48pt, ite=SerifItalic at 48pt] 
\tfe Big {\it Words}.

What I simply don't understand is the need for multiple font size declarations. I can (kind of) see that it might be necessary (looking at typescripts), if the whole typescript resolves to "design sizes" where each point size is a single font file. But for ttf/otf fonts, ie. where the font is scaled?


This minimal example, including a "special" font (TitleFont) works (almost) fine for me. 

% the only two statements to declare the fonts I want to use
\usetypescriptfile[type-otf] % being default, I could even miss this declaration 
\setupbodyfont[pagella,10pt]

\definefont [WonderFont] [BoldItalic sa 4.8]

\starttext
{\WonderFont The Big Title}
\input aesop-de
\stoptext

I do get one consistant error (the "5pt" can vary depending on the size I give in "setupbodyfont"): 

{/Users/martin/contextMini/tex/texmf-context/fonts/map/pdftex/context/mkiv-px.map}
virtual math    > the mapping is incomplete for 'pxmath' at 5pt

Though, the document looks fine. Does the error hint I am missing something? What is "good practice" in Luatex/MKIV to access the desired fonts?


My questions: 

- when do I need to use the multiple point sizes at all in a Luatex/MKIV environment?
- when would I need to provide that information in typescript files I need to create? (simplefonts is very slow to load fonts with phonetic symbols)

Any tips to help my understanding would be appreciated!





___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: using \definebodyfont with multiple size declarations -- Why?
  2010-07-26  9:36 using \definebodyfont with multiple size declarations -- Why? Martin Althoff
@ 2010-07-27 17:42 ` Hans Hagen
  2010-07-28  9:47   ` Martin Althoff
  2010-07-27 20:28 ` Wolfgang Schuster
  1 sibling, 1 reply; 13+ messages in thread
From: Hans Hagen @ 2010-07-27 17:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 26-7-2010 11:36, Martin Althoff wrote:

> \definebodyfont [10pt,11pt,12pt] [rm] [tfe=Serif at 48pt, ite=SerifItalic at 48pt]
> \tfe Big {\it Words}.
>
> What I simply don't understand is the need for multiple font size declarations. I can (kind of) see that it might be necessary (looking at typescripts), if the whole typescript resolves to "design sizes" where each point size is a single font file. But for ttf/otf fonts, ie. where the font is scaled?

as mentioned, it originates in design sizes and finetuning

for most fonts you will see things like

\definetypeface [main] [rm] [serif] [palatino] [default]

this will use the default set

   \definebodyfont
     [4pt,5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,14.4pt,17.3pt]
     [rm] [default]

in principle we could do without, but this helps predefining a couple of 
things that otherwise would slow down each font switch

it also relates to bodyfont environments where there are relationships 
between sizes

but anyhow, it's mostly a side effect of lm having design sizes

in practice, if you choose say 13pt it will work out ok  as things are 
checked and defined on the fly; but there might be a slight performance hit

> This minimal example, including a "special" font (TitleFont) works (almost) fine for me.
>
> % the only two statements to declare the fonts I want to use
> \usetypescriptfile[type-otf] % being default, I could even miss this declaration

sure, as that one is already part of the load-set

> \setupbodyfont[pagella,10pt]
>
> \definefont [WonderFont] [BoldItalic sa 4.8]

you probably want features enables, so "*default"

\definefont [WonderFont] [BoldItalic*default sa 4.8]

> \starttext
> {\WonderFont The Big Title}
> \input aesop-de
> \stoptext
>
> I do get one consistant error (the "5pt" can vary depending on the size I give in "setupbodyfont"):
>
> {/Users/martin/contextMini/tex/texmf-context/fonts/map/pdftex/context/mkiv-px.map}
> virtual math>  the mapping is incomplete for 'pxmath' at 5pt

harmless: it means that the math virtual font vector is not yet 
completely defined, and the message is only given once per set (i.e. 
pxmath) so in this case that happens to be the 5pt version (small sizes 
are defined as part of math setup)

> Though, the document looks fine. Does the error hint I am missing something? What is "good practice" in Luatex/MKIV to access the desired fonts?

using \definefont as you do is ok

>
> My questions:
>
> - when do I need to use the multiple point sizes at all in a Luatex/MKIV environment?

if you want an adaptive situation, so, in a title where you have only 
text, it' ok to use \definefont; when you expect things like math, 
smaller or larger sizes and style switches, you can best use a bodyfont 
switch

> - when would I need to provide that information in typescript files I need to create? (simplefonts is very slow to load fonts with phonetic symbols)

depends .. wolfgang might know the answer

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: using \definebodyfont with multiple size declarations -- Why?
  2010-07-26  9:36 using \definebodyfont with multiple size declarations -- Why? Martin Althoff
  2010-07-27 17:42 ` Hans Hagen
@ 2010-07-27 20:28 ` Wolfgang Schuster
  2010-07-28  9:08   ` Martin Althoff
  1 sibling, 1 reply; 13+ messages in thread
From: Wolfgang Schuster @ 2010-07-27 20:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users

  Am 26.07.10 11:36, schrieb Martin Althoff:
> - when would I need to provide that information in typescript files I need to create? (simplefonts is very slow to load fonts with phonetic symbols)

Can you show me a example where simplefonts is so slow.

Wolfgang

___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: using \definebodyfont with multiple size declarations -- Why?
  2010-07-27 20:28 ` Wolfgang Schuster
@ 2010-07-28  9:08   ` Martin Althoff
  2010-07-28  9:20     ` Arthur Reutenauer
  2010-07-28  9:20     ` Hans Hagen
  0 siblings, 2 replies; 13+ messages in thread
From: Martin Althoff @ 2010-07-28  9:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> Can you show me a example where simplefonts is so slow.


Sure, here goes.

I should say, most of my documents are 1-5 pages and build time is usually under 5 seconds (2nd and higher runs). 

One (relatively) slow use of simplefonts is the Chinese example (1) below. The way I pasted it, it runs just under 13 seconds on 2nd and consecutive runs. Not using the adobe but eg the ht series is a whee faster.

It's not that I am doing huge amounts of Chinese, but jumping from, say, 3 to 12 seconds, is considerably slower. I was hoping by creating a typescript I could speed things up a bit. Any suggestions welcome.

Standing corrected, the impact using eg. CharisSIL for phonetic/IPA symbols the impact is much less: eg. a jump from 2.8 to 4.8 seconds in Example (2) given below. The impact of 2 seconds is bearable!

Let me know if you want to see any output or whatever.

cheers, Martin


%Example (1)

\usemodule[simplefonts]

\setmainfont[texgyrepagella]
\setsansfont[texgyreheros]
\setmonofont[texgyrecursor]

\setcjkmainfont[adobesongstd]
\setcjksansfont[adobeheitistd]
\setcjkmonofont[adobefangsongstd]

% ttf fonts htsong, hthei, htkai, htfs from:
% http://ftp.ctex.org/pub/tex/fonts/truetype/ttf/

%\setcjkmainfont[htsong] % serif, regular
%\setcjksansfont[hthei] % sans
%\setcjkmonofont[htsong] % mono

\setscript[hanzi]

\starttext

Where there is a will, there is a way.

我命由我不由天
\blank
{\rm Serif:  兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財}
%{\ss Sans:  兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財}
%{\tt Mono:  兡也包因沘氓侷柵苗孫孫財 text 兡也包因沘氓侷柵苗孫孫財}

\stoptext



% Example (2) - Not sure if the IPA symbols post properly...

\usemodule[simplefonts]
\setmainfont[CharisSIL] 

\starttext
besser [ˈbɛsɐ], der [deːɐ] 

d͡ʒ
\stoptext




___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: using \definebodyfont with multiple size declarations -- Why?
  2010-07-28  9:08   ` Martin Althoff
@ 2010-07-28  9:20     ` Arthur Reutenauer
  2010-07-28  9:20     ` Hans Hagen
  1 sibling, 0 replies; 13+ messages in thread
From: Arthur Reutenauer @ 2010-07-28  9:20 UTC (permalink / raw)
  To: Mailing list for ConTeXt users

> Standing corrected, the impact using eg. CharisSIL for phonetic/IPA symbols the impact is much less: eg. a jump from 2.8 to 4.8 seconds in Example (2) given below. The impact of 2 seconds is bearable!

  Then it must simply be the font.  Whatever the amount of text you
typeset using that font, it must be loaded in the first place, and that
– obviously – takes more time if it's larger, as is the case for
Chinese.

	Arthur
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: using \definebodyfont with multiple size declarations -- Why?
  2010-07-28  9:08   ` Martin Althoff
  2010-07-28  9:20     ` Arthur Reutenauer
@ 2010-07-28  9:20     ` Hans Hagen
  2010-07-28  9:30       ` Martin Althoff
  1 sibling, 1 reply; 13+ messages in thread
From: Hans Hagen @ 2010-07-28  9:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 28-7-2010 11:08, Martin Althoff wrote:

> One (relatively) slow use of simplefonts is the Chinese example (1) below. The way I pasted it, it runs just under 13 seconds on 2nd and consecutive runs. Not using the adobe but eg the ht series is a whee faster.

cjk fonts are huge ... are you using a slow machine with not that much 
memory?

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: using \definebodyfont with multiple size declarations -- Why?
  2010-07-28  9:20     ` Hans Hagen
@ 2010-07-28  9:30       ` Martin Althoff
  0 siblings, 0 replies; 13+ messages in thread
From: Martin Althoff @ 2010-07-28  9:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> cjk fonts are huge ... are you using a slow machine with
> not that much memory?

Hi Hans, well, slow is kind of right: MacBook 2GHz Core Duo (first series of MacBooks), but 2GB of RAM is something I would think to be ok. For the Chinese example I see:

mkiv lua stats : current memory usage      - 147 MB (ctx: 150 MB)

Not exactly challenging -- if that's a key number.

Best, Martin



___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: using \definebodyfont with multiple size declarations -- Why?
  2010-07-27 17:42 ` Hans Hagen
@ 2010-07-28  9:47   ` Martin Althoff
  2010-07-28 10:41     ` Hans Hagen
  0 siblings, 1 reply; 13+ messages in thread
From: Martin Althoff @ 2010-07-28  9:47 UTC (permalink / raw)
  To: ntg-context

Hans, thanks for the detailed answer! My understanding is slowly advancing :D


> in principle we could do without, but this helps
> predefining a couple of things that otherwise would slow
> down each font switch

This confirms my (vague) assumption that deep in the internals it helps structure things.

> it also relates to bodyfont environments where there are
> relationships between sizes

... thereby creating the a "font enviroment"


> in practice, if you choose say 13pt it will work out
> ok  as things are checked and defined on the fly; but
> there might be a slight performance hit

This goes towards my fear: I prefer to state things explicitly. "Automagic" that happens in the background covering up for my sloppyness is great, but... creates confusion when things trip up. Internals might change. Or I might have been building on side effects for all I know. 

For this reason examples with wordy declarations are welcome... Working with hard-blocking Modula compilers was a good teacher, but that's long ago.


> you probably want features enables, so "*default"
> \definefont [WonderFont] [BoldItalic*default sa 4.8]

Hm, I'll have to read up on that one. 

Thanks ! Martin




___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: using \definebodyfont with multiple size declarations -- Why?
  2010-07-28  9:47   ` Martin Althoff
@ 2010-07-28 10:41     ` Hans Hagen
  2010-07-28 10:46       ` luigi scarso
  0 siblings, 1 reply; 13+ messages in thread
From: Hans Hagen @ 2010-07-28 10:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 28-7-2010 11:47, Martin Althoff wrote:

> For this reason examples with wordy declarations are welcome... Working with hard-blocking Modula compilers was a good teacher, but that's long ago.

Taco once told me that one could see from the context sources (old ones 
maybe) that I had my share of modula programming too -)

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: using \definebodyfont with multiple size declarations -- Why?
  2010-07-28 10:41     ` Hans Hagen
@ 2010-07-28 10:46       ` luigi scarso
  2010-07-28 10:54         ` Arthur Reutenauer
  0 siblings, 1 reply; 13+ messages in thread
From: luigi scarso @ 2010-07-28 10:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, Jul 28, 2010 at 12:41 PM, Hans Hagen <pragma@wxs.nl> wrote:
> On 28-7-2010 11:47, Martin Althoff wrote:
>
>> For this reason examples with wordy declarations are welcome... Working
>> with hard-blocking Modula compilers was a good teacher, but that's long ago.
>
> Taco once told me that one could see from the context sources (old ones
> maybe) that I had my share of modula programming too -)
Still today
#> grep -i MODULA tex/texmf-context/tex/context/base/*

-- 
luigi
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: using \definebodyfont with multiple size declarations -- Why?
  2010-07-28 10:46       ` luigi scarso
@ 2010-07-28 10:54         ` Arthur Reutenauer
  2010-07-29  1:35           ` Martin Althoff
  0 siblings, 1 reply; 13+ messages in thread
From: Arthur Reutenauer @ 2010-07-28 10:54 UTC (permalink / raw)
  To: Mailing list for ConTeXt users

> #> grep -i MODULA tex/texmf-context/tex/context/base/*

  I especially like, from core-con.mkii:

%D \macros
%D   {getdayoftheweek, dayoftheweek}
%D
%D The conversion algoritm is an old one and a translation from
%D a procedure written in MODULA~2 back in the 80's. I finaly
%D found the 4--100-400 rules in some enclopedia. Look at this
%D messy low level routine that takes the day, month and year
%D as arguments:

  [followed by the actual TeX code]

  :-)

	Arthur
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: using \definebodyfont with multiple size declarations -- Why?
  2010-07-28 10:54         ` Arthur Reutenauer
@ 2010-07-29  1:35           ` Martin Althoff
  0 siblings, 0 replies; 13+ messages in thread
From: Martin Althoff @ 2010-07-29  1:35 UTC (permalink / raw)
  To: Mailing list for ConTeXt users

> While \MODULA\ taught me to structure, \TEX\ taught me to think recursive.

I would certainly go along with the "teaching structure" part for Modula! 



___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: using \definebodyfont with multiple size declarations -- Why?
       [not found] <4C4FFA8F.9000904@wxs.nl>
@ 2010-07-28  9:50 ` Martin Althoff
  0 siblings, 0 replies; 13+ messages in thread
From: Martin Althoff @ 2010-07-28  9:50 UTC (permalink / raw)
  To: ntg-context

> indeed. in that case it's mostly the cpu caches that
> matter

Ah... Time to save some money for new hardware 



___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2010-07-29  1:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-26  9:36 using \definebodyfont with multiple size declarations -- Why? Martin Althoff
2010-07-27 17:42 ` Hans Hagen
2010-07-28  9:47   ` Martin Althoff
2010-07-28 10:41     ` Hans Hagen
2010-07-28 10:46       ` luigi scarso
2010-07-28 10:54         ` Arthur Reutenauer
2010-07-29  1:35           ` Martin Althoff
2010-07-27 20:28 ` Wolfgang Schuster
2010-07-28  9:08   ` Martin Althoff
2010-07-28  9:20     ` Arthur Reutenauer
2010-07-28  9:20     ` Hans Hagen
2010-07-28  9:30       ` Martin Althoff
     [not found] <4C4FFA8F.9000904@wxs.nl>
2010-07-28  9:50 ` Martin Althoff

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