ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Math in MKIV - HOWTO (was: Lucida Fonts with MKIV)
@ 2010-02-22 23:02 Mojca Miklavec
  2010-02-24  3:15 ` Zhichu Chen
  0 siblings, 1 reply; 15+ messages in thread
From: Mojca Miklavec @ 2010-02-22 23:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

These basic set of rules should also apply to fourier or any other
font that still needs better math support. I'm posting them on the
list for future reference (for when the next volunteer pops up).


On Fri, Feb 19, 2010 at 14:50, Troy Henderson wrote:
>
> I have followed the first set of instructions at
>
> http://wiki.contextgarden.net/Lucida
...
> Is there an easy way to adapt the configuration file(s) for MKII to MKIV?
> If this is possible but just requires a tedious process, I'm willing
> to do this, but I have no clue of the steps needed.

So here are some basic instructions:

Step 1: check what's in the fonts
=====

The file lucida.map includes the following lines:

hlcda LucidaNewMath-Arrows-Demi <lbmad.pfb
hlcdim LucidaNewMath-DemiItalic <lbmdi.pfb
hlcdima LucidaNewMath-AltDemiItalic <lbmdo.pfb
hlcdm LucidaNewMath-Demibold <lbmd.pfb
hlcdy LucidaNewMath-Symbol-Demi <lbmsd.pfb
hlcra LucidaNewMath-Arrows <lbma.pfb
hlcrim LucidaNewMath-Italic <lbmi.pfb
hlcrima LucidaNewMath-AltItalic <lbmo.pfb
hlcrm LucidaNewMath-Roman <lbmr.pfb
hlcrv LucidaNewMath-Extension <lbme.pfb
hlcry LucidaNewMath-Symbol <lbms.pfb

After short inspection you may notice that some are just bold
variants, so you are basically left with only 6 files that you need to
take care of:

hlcrm LucidaNewMath-Roman <lbmr.pfb
hlcrim LucidaNewMath-Italic <lbmi.pfb
hlcrima LucidaNewMath-AltItalic <lbmo.pfb

hlcrv LucidaNewMath-Extension <lbme.pfb
hlcry LucidaNewMath-Symbol <lbms.pfb
hlcra LucidaNewMath-Arrows <lbma.pfb

You may want to visualize the content of those fonts by using:

\loadmapfile[lucida.map]
\starttext
\showfont[hlcrm]
\showfont[hlcrim]
\showfont[hlcrima]
\showfont[hlcrv]
\showfont[hlcry]
\showfont[hlcra]
\stoptext

Step 2: compare
=====

It might be interesting to know what's in LM (so that you know what
you need to modify):

\starttext
\showfont[rm-lmr10]
\showfont[lmmi10]
\showfont[lmex10]
\showfont[lmsy10]
\stoptext

as well as seing what's in ams fonts perhaps. Now all the info that
describes the content of these files is in math-tex.mkii (for MKII)
and math-vfu.lua (for MKIV):

mathematics.make_font ( "lmroman10-math", {
    { name = "lmroman10-regular.otf", features = "virtualmath", main = true },
    { name = "rm-lmr10.tfm", vector = "tex-mr-missing" } ,
    { name = "lmmi10.tfm", vector = "tex-mi", skewchar=0x7F },
    { name = "lmmi10.tfm", vector = "tex-it", skewchar=0x7F },
    { name = "lmsy10.tfm", vector = "tex-sy", skewchar=0x30,
parameters = true } ,
    { name = "lmex10.tfm", vector = "tex-ex", extension = true } ,
    { name = "msam10.tfm", vector = "tex-ma" },
    { name = "msbm10.tfm", vector = "tex-mb" },
 -- { name = "rm-lmbx10.tfm", vector = "tex-bf" } ,
    { name = "lmroman10-bold.otf", vector = "tex-bf" } ,
    { name = "lmmib10.tfm", vector = "tex-bi", skewchar=0x7F } ,
    { name = "lmsans10-regular.otf", vector = "tex-ss", optional=true },
    { name = "lmmono10-regular.otf", vector = "tex-tt", optional=true },
    { name = "eufm10.tfm", vector = "tex-fraktur", optional=true },
    { name = "eufb10.tfm", vector = "tex-fraktur-bold", optional=true },
} )

You may want to check any tfm font mentioned here as well as any
vector="..." mentioned.

fonts.enc.math["tex-mi"] = {
    [0x1D6E4] = 0x00, -- Gamma
    [0x1D6E5] = 0x01, -- Delta
    [0x1D6E9] = 0x02, -- Theta
    [0x1D6F3] = 0x02, -- varTheta (not present in TeX)
    [0x1D6EC] = 0x03, -- Lambda
    [0x1D6EF] = 0x04, -- Xi
    [0x1D6F1] = 0x05, -- Pi

There's a very precious source of information available for unicode
mappings for many fonts that might be worth considering:
     tex4ht/ht-fonts/unicode/

Step 3: make use of available glyph information
=====

3a)
You may use lucidabr.sty as a pretty reliable source of information to
extract the mapping between:
- glyph name (in LaTeX)
- font
- slot

3b)
In char-def.lua there are some mappings between context commands and
unicode points. If any mapping is missing, you need to add it anyway
(else you won't be able to use that particular command), for all other
commands you already have unicode point, so when you find "rightarrow"
or some other glyph in font, you may look it up in char-def.lua to
determine the unicode number.

You may want to use both the comprehensive TeX symbol list as well as
the Unicode Standard to help you out if there are some glyphs you
don't know.

Step 4: fix math-lbr
=====

Step 5: complete the vectors in math-vfu.lua
=====

I'm not completly sure about some aspects of bold math, but here are
at least some points to start with.

Step 6: test
=====

Translate ams test paper and the comprehensive LaTeX symbol list to
ConTeXt in order to test if all the characters work ok in all the math
fonts supported by ConTeXt :) :) :)

Mojca
___________________________________________________________________________________
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] 15+ messages in thread

end of thread, other threads:[~2010-03-02 15:56 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.510.1267129043.26807.ntg-context@ntg.nl>
2010-02-25 23:39 ` Math in MKIV - HOWTO Vyatcheslav Yatskovsky
2010-02-22 23:02 Math in MKIV - HOWTO (was: Lucida Fonts with MKIV) Mojca Miklavec
2010-02-24  3:15 ` Zhichu Chen
2010-02-24  9:01   ` Math in MKIV - HOWTO Hans Hagen
2010-02-24 10:24     ` Hans Hagen
2010-02-24 11:55       ` Zhichu Chen
2010-02-24 12:24         ` Hans Hagen
     [not found]           ` <6faad9f01002240427l7da7a675r4ec6805f6f7455ba@mail.gmail.com>
2010-03-01 16:26             ` Zhichu Chen
2010-03-01 17:07               ` Zhichu Chen
2010-03-02 10:45               ` Hans Hagen
2010-03-02 11:25                 ` Zhichu Chen
2010-03-02 11:34                   ` Hans Hagen
2010-03-02 13:49                 ` Mojca Miklavec
2010-03-02 14:28                   ` Hans Hagen
2010-03-02 15:23                     ` Mojca Miklavec
2010-03-02 15:41                       ` Zhichu Chen
2010-03-02 15:56                         ` Mojca Miklavec

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