ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Encoding and mapping glyphs from an expert font
@ 2005-04-09 21:02 Idris Samawi Hamid
  2005-04-09 21:54 ` Thomas A.Schmitz
  2005-04-09 21:56 ` Adam Lindsay
  0 siblings, 2 replies; 9+ messages in thread
From: Idris Samawi Hamid @ 2005-04-09 21:02 UTC (permalink / raw)


[To all the font experts out there: I really need your help!! I have spent at 
least 12 hours (!) trying to make this work but to no avail.]

Dear gang,

I have two fonts (actually, lots more but let's keep it simple), one normal 
and one expert. I did the following:

1. installed the regular font with texnansi encoding. It works fine. It uses, 
say,

texnansi-myfont.map, texnansi-lm.enc

with lines like

====================================================
texnansi-raw-myfont  MyFont 4 <texnansi-lm.enc <myfont.pfb 
====================================================

2. also installed the expert font with a private encoding. Basically the same 
as 
texnansi where they share characters in common. It uses, say,

myfontx.map, myencoding.enc

with lines like

====================================================
myencoding-raw-myfontx MyFontX 4 < myfont.pfb   myencoding.enc
====================================================

3. With a view to getting characters from my expert font, I carefully studied 
as best as I could the implementation of old style figures in lmr, which 
involves mappings to cmmi10. This is what I could figure out: Activating old 
style is done by

====================================================
\usetypescript [modern][texnansi]
\usetypescript [map]   [latin-modern-os] [texnansi]

\usetypescript[latin-modern][texnansi]
\setupbodyfont[latin-modern]
====================================================

There appear to be two main things going on (but I think I'm missing 
something):

a. loading a map file:

====================================================
\starttypescript [map] [latin-modern-os] [ec,texnansi,qx,t5,pl0,il2]
  \loadmapfile[\typescriptthree-os-public-lm.map]
\stoptypescript
====================================================

Since I'm using texnansi, I looked at texnansi-os-public-lm.map . It contains 
lines like

====================================================
texnansi-lmb10 LMRomanDemi10-Regular <texnansi-os-lm.enc <lmb10.pfb
====================================================

So I designed an encoding file myfont-plus.enc almost identical to 
texnansi-os-lm.enc, containing, e.g., old style numerals from my expert font. 
I edited the myfont map files to exactly match the syntax of both

texnansi-os-public-lm.map 
and 
texnansi-public-lm.map

So for my fonts I have a total of three map files:

\loadmapfile[texnansi-myfont.map]
 % for regular font

\loadmapfile[myencoding-myfontx.map] 
% for expert font

\loadmapfile[texnansi-x-myfont.map]  
% for mapping minion reg to minion ex

>From this point I am lost. I set up my type-myfont.tex to load these maps. I 
can get myfont to work alone, and myfontx to work alone, but I cannot map  
characters from myfontx to myfont.

By the way, I still don't understand how placing, e.g., /zerooldstyle in the 
respective /zero position in an encoding file will instruct LatinModern to 
pick up the glyph from cmmi10. In, for example,

====================================================
texnansi-lmb10 LMRomanDemi10-Regular <texnansi-os-lm.enc <lmb10.pfb
====================================================

How does ConTeXt know that /zerooldstyle is to be mapped to cmmbi10?
I must be missing something....

Thnx in advance for your help
Idris

============================
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523

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

* Re: Encoding and mapping glyphs from an expert font
  2005-04-09 21:02 Encoding and mapping glyphs from an expert font Idris Samawi Hamid
@ 2005-04-09 21:54 ` Thomas A.Schmitz
  2005-04-09 21:56 ` Adam Lindsay
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas A.Schmitz @ 2005-04-09 21:54 UTC (permalink / raw)


Idris,

I am not sure I have understood everything you write, but here's a very  
brief outline of what I think you need to do. There are two cases you  
need to consider:

1. You have more than one font (this seems to be your case), normally  
these will be postscript type1 fonts (extensions .pfb or .pfa). If you  
want to mix characters from two fonts (say, normal letters from font A,  
oldstyle numerals and maybe small caps from font B), you can most  
easily do this via a virtual font. It's not too hard; I wrote a small  
how-to which you can find on CTAN  
(http://www.ctan.org/tex-archive/info/virtualfontshowto/?action=/tex- 
archive/info/)

2. Your expert glyphs are within the same TrueType font (extension  
.ttf). In that case, the approach would be to have special encoding  
vectors which would be used to produce special tfms. For TeX, this  
would then constitute a new font (this is explained in the article I  
sent you last week.)

So there is no simple answer to your question. TeX knows to pick up  
zerooldstyle instead of zero either
1. because you have a virtual font that says MAPFONT 1, so it knows it  
will have to use a different pfb than for the rest, or
2. because the encoding file points to character zerooldstyle within  
the ttf.

Sounds too complicated? It isnt!

Best

Thomas

On Apr 9, 2005, at 11:02 PM, Idris Samawi Hamid wrote:

> [To all the font experts out there: I really need your help!! I have  
> spent at
> least 12 hours (!) trying to make this work but to no avail.]
>
> Dear gang,
>
> I have two fonts (actually, lots more but let's keep it simple), one  
> normal
> and one expert. I did the following:
>
> 1. installed the regular font with texnansi encoding. It works fine.  
> It uses,
> say,
>
> texnansi-myfont.map, texnansi-lm.enc
>
> with lines like
>
> ====================================================
> texnansi-raw-myfont  MyFont 4 <texnansi-lm.enc <myfont.pfb
> ====================================================
>
> 2. also installed the expert font with a private encoding. Basically  
> the same
> as
> texnansi where they share characters in common. It uses, say,
>
> myfontx.map, myencoding.enc
>
> with lines like
>
> ====================================================
> myencoding-raw-myfontx MyFontX 4 < myfont.pfb   myencoding.enc
> ====================================================
>
> 3. With a view to getting characters from my expert font, I carefully  
> studied
> as best as I could the implementation of old style figures in lmr,  
> which
> involves mappings to cmmi10. This is what I could figure out:  
> Activating old
> style is done by
>
> ====================================================
> \usetypescript [modern][texnansi]
> \usetypescript [map]   [latin-modern-os] [texnansi]
>
> \usetypescript[latin-modern][texnansi]
> \setupbodyfont[latin-modern]
> ====================================================
>
> There appear to be two main things going on (but I think I'm missing
> something):
>
> a. loading a map file:
>
> ====================================================
> \starttypescript [map] [latin-modern-os] [ec,texnansi,qx,t5,pl0,il2]
>   \loadmapfile[\typescriptthree-os-public-lm.map]
> \stoptypescript
> ====================================================
>
> Since I'm using texnansi, I looked at texnansi-os-public-lm.map . It  
> contains
> lines like
>
> ====================================================
> texnansi-lmb10 LMRomanDemi10-Regular <texnansi-os-lm.enc <lmb10.pfb
> ====================================================
>
> So I designed an encoding file myfont-plus.enc almost identical to
> texnansi-os-lm.enc, containing, e.g., old style numerals from my  
> expert font.
> I edited the myfont map files to exactly match the syntax of both
>
> texnansi-os-public-lm.map
> and
> texnansi-public-lm.map
>
> So for my fonts I have a total of three map files:
>
> \loadmapfile[texnansi-myfont.map]
>  % for regular font
>
> \loadmapfile[myencoding-myfontx.map]
> % for expert font
>
> \loadmapfile[texnansi-x-myfont.map]
> % for mapping minion reg to minion ex
>
>> From this point I am lost. I set up my type-myfont.tex to load these  
>> maps. I
> can get myfont to work alone, and myfontx to work alone, but I cannot  
> map
> characters from myfontx to myfont.
>
> By the way, I still don't understand how placing, e.g., /zerooldstyle  
> in the
> respective /zero position in an encoding file will instruct  
> LatinModern to
> pick up the glyph from cmmi10. In, for example,
>
> ====================================================
> texnansi-lmb10 LMRomanDemi10-Regular <texnansi-os-lm.enc <lmb10.pfb
> ====================================================
>
> How does ConTeXt know that /zerooldstyle is to be mapped to cmmbi10?
> I must be missing something....
>
> Thnx in advance for your help
> Idris
>
> ============================
> Professor Idris Samawi Hamid
> Department of Philosophy
> Colorado State University
> Fort Collins, CO 80523
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
>

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

* Re: Encoding and mapping glyphs from an expert font
  2005-04-09 21:02 Encoding and mapping glyphs from an expert font Idris Samawi Hamid
  2005-04-09 21:54 ` Thomas A.Schmitz
@ 2005-04-09 21:56 ` Adam Lindsay
  1 sibling, 0 replies; 9+ messages in thread
From: Adam Lindsay @ 2005-04-09 21:56 UTC (permalink / raw)


Idris Samawi Hamid said this at Sat, 9 Apr 2005 15:02:51 -0600:

>By the way, I still don't understand how placing, e.g., /zerooldstyle in the 
>respective /zero position in an encoding file will instruct LatinModern to 
>pick up the glyph from cmmi10. In, for example,
>
>====================================================
>texnansi-lmb10 LMRomanDemi10-Regular <texnansi-os-lm.enc <lmb10.pfb
>====================================================
>
>How does ConTeXt know that /zerooldstyle is to be mapped to cmmbi10?
>I must be missing something....

I think I'm missing something from your description. What markup are you
using in your source in order to ascribe these magical properties to OldStyle?
Are you aware of the default mapping of OldStyle to MathItalic?

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Adam T. Lindsay, Computing Dept.     atl@comp.lancs.ac.uk
 Lancaster University, InfoLab21        +44(0)1524/510.514
 Lancaster, LA1 4WA, UK             Fax:+44(0)1524/510.492
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

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

* Re: Encoding and mapping glyphs from an expert font
  2005-04-10  7:37 Idris Samawi Hamid
@ 2005-04-12 17:48 ` Hans Hagen
  0 siblings, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2005-04-12 17:48 UTC (permalink / raw)


Idris Samawi Hamid wrote:

> Oh well, I certainly learned a lot about fonts and ConTeXt this past 
> day-and-a-half, so I guess it was not a total waste of time. Now I guess I 
> have to make some virtual fonts (sigh), so it's now on to Thomas' how-to.

be prepared ... a next version ofpdftex will provide ways to construct fonts at 
runtime, for instance turn boxes into glyphs;

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

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

* RE: Encoding and mapping glyphs from an expert font
@ 2005-04-10  7:37 Idris Samawi Hamid
  2005-04-12 17:48 ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Idris Samawi Hamid @ 2005-04-10  7:37 UTC (permalink / raw)


Hi Thomas, Adam, and all...

>===== Original Message From "Thomas A.Schmitz" <thomas.schmitz@uni-bonn.de>
>So there is no simple answer to your question. TeX knows to pick up
>zerooldstyle instead of zero either
>1. because you have a virtual font that says MAPFONT 1, so it knows it
>will have to use a different pfb than for the rest, or
>2. because the encoding file points to character zerooldstyle within
>the ttf.

You are right. I just realized that I misunderstood what Hans meant by 
avoiding virtual fonts:

I was assuming all this time that the

\usetypescript[map][latin-modern-os][texnansi]

setup was mapping latin modern to cmmi10, etc. I looked at the log of a test 
file for latin-modern-os: no mention of cmmi10, etc. I looked at the pdf, 
listed all fonts, and boom, only one font, lmr12.pfb. I opened lmr12 in 
FontLab and, lo and behold, it contains a palette of old style numerals!

So what Hans meant was that there is no need for a virtual font to remap lmr 
itself, not that you could actually map the numerals of lmr to cmmibi without 
a virtual font. The OldStyle to MathItalic mappings are apparently useful for 
local switches like \os, but not for global setups.

Oh well, I certainly learned a lot about fonts and ConTeXt this past 
day-and-a-half, so I guess it was not a total waste of time. Now I guess I 
have to make some virtual fonts (sigh), so it's now on to Thomas' how-to.

Thnx to all
Idris

============================
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523

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

* Re: Encoding and mapping glyphs from an expert font
  2005-04-09 23:22 ` Adam Lindsay
@ 2005-04-10  1:17   ` Idris Samawi Hamid
  0 siblings, 0 replies; 9+ messages in thread
From: Idris Samawi Hamid @ 2005-04-10  1:17 UTC (permalink / raw)


On Sun, 10 Apr 2005 00:22:31 +0100, Adam Lindsay <atl@comp.lancs.ac.uk> 
wrote:

> Idris Samawi Hamid said this at Sat, 9 Apr 2005 16:30:35 -0600:
>
>> Could you tell me where the default mapping of OldStyle to MathItalic is
>> documented/implemented in the sources? Maybe I could make a similar
> mechanism
>> for my normal-expert dyad.
>
> font-ini for os > OldStyle
> type-syn for OldStyle > MathItalic in most cases.

Thnx; I'll take a look. I want to understand the entire chain from

texnansi-os-public-lm.map

==>

texnansi-os-lm.enc

==>

cmmi instead of lmr

I think I understand the first two links, just need to track down the last 
one now...

> But I would recommend looking at font variants. The "palatino bonus" at
> the end of type-syn is a brief example, and the wiki has some stuff about
> Font Variants as well.

ok

> But wait, where are you coming from? Are your source fonts really Minion
> .pfbs, or are they from OpenType? With OpenType, you can use some nice
> TeXFont stuff to select the features (OSF, SC, alternates) without having
> to draw from two arbitrary encodings.

Right now I am using some pfb's. Following your advice here

http://semantics-online.org/geek/2003/09/how_to_install_adobe_garamond_for_latex

I ordered the Adobe classics pack and should soon have the open type 
versions as well (except for Poetica:-<).

Thnx and good night:-)
Idris
-- 
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523

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

* Re: Encoding and mapping glyphs from an expert font
  2005-04-09 22:30 Idris Samawi Hamid
@ 2005-04-09 23:22 ` Adam Lindsay
  2005-04-10  1:17   ` Idris Samawi Hamid
  0 siblings, 1 reply; 9+ messages in thread
From: Adam Lindsay @ 2005-04-09 23:22 UTC (permalink / raw)


Idris Samawi Hamid said this at Sat, 9 Apr 2005 16:30:35 -0600:

>Could you tell me where the default mapping of OldStyle to MathItalic is 
>documented/implemented in the sources? Maybe I could make a similar
mechanism 
>for my normal-expert dyad.

font-ini for os > OldStyle
type-syn for OldStyle > MathItalic in most cases.

But I would recommend looking at font variants. The "palatino bonus" at
the end of type-syn is a brief example, and the wiki has some stuff about
Font Variants as well.

But wait, where are you coming from? Are your source fonts really Minion
.pfbs, or are they from OpenType? With OpenType, you can use some nice
TeXFont stuff to select the features (OSF, SC, alternates) without having
to draw from two arbitrary encodings.

adam
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Adam T. Lindsay, Computing Dept.     atl@comp.lancs.ac.uk
 Lancaster University, InfoLab21        +44(0)1524/510.514
 Lancaster, LA1 4WA, UK             Fax:+44(0)1524/510.492
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

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

* RE: Encoding and mapping glyphs from an expert font
@ 2005-04-09 22:30 Idris Samawi Hamid
  2005-04-09 23:22 ` Adam Lindsay
  0 siblings, 1 reply; 9+ messages in thread
From: Idris Samawi Hamid @ 2005-04-09 22:30 UTC (permalink / raw)


Hi Adam,

Thank you so much for your help...

>===== Original Message From "Adam Lindsay" <atl@comp.lancs.ac.uk> =====
>Idris Samawi Hamid said this at Sat, 9 Apr 2005 15:02:51 -0600:
>
>>By the way, I still don't understand how placing, e.g., /zerooldstyle in the
>>respective /zero position in an encoding file will instruct LatinModern to
>>pick up the glyph from cmmi10. In, for example,
>>
>>====================================================
>>texnansi-lmb10 LMRomanDemi10-Regular <texnansi-os-lm.enc <lmb10.pfb
>>====================================================
>>
>>How does ConTeXt know that /zerooldstyle is to be mapped to cmmbi10?
>>I must be missing something....
>
>I think I'm missing something from your description. What markup are you
>using in your source in order to ascribe these magical properties to 
OldStyle?
>Are you aware of the default mapping of OldStyle to MathItalic?

Well, Hans claimed this could be done without virtual fonts, and I was trying 
to follow his implementation.

Could you tell me where the default mapping of OldStyle to MathItalic is 
documented/implemented in the sources? Maybe I could make a similar mechanism 
for my normal-expert dyad.

Best and thnx a million
Idris

============================
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523

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

* RE: Encoding and mapping glyphs from an expert font
@ 2005-04-09 22:10 Idris Samawi Hamid
  0 siblings, 0 replies; 9+ messages in thread
From: Idris Samawi Hamid @ 2005-04-09 22:10 UTC (permalink / raw)


Thank you very much for responding, Thomas.

>===== Original Message From "Thomas A.Schmitz" <thomas.schmitz@uni-bonn.de> 
=====
>I am not sure I have understood everything you write, but here's a very
>brief outline of what I think you need to do. There are two cases you
>need to consider:

I am in case 1: pfb-normal + pfb-expert

>1. You have more than one font (this seems to be your case), normally
>these will be postscript type1 fonts (extensions .pfb or .pfa). If you
>want to mix characters from two fonts (say, normal letters from font A,
>oldstyle numerals and maybe small caps from font B), you can most
>easily do this via a virtual font. It's not too hard; I wrote a small
>how-to which you can find on CTAN
>(http://www.ctan.org/tex-archive/info/virtualfontshowto/?action=/tex-
>archive/info/)

<snip>

>So there is no simple answer to your question. TeX knows to pick up
>zerooldstyle instead of zero either
>1. because you have a virtual font that says MAPFONT 1, so it knows it
>will have to use a different pfb than for the rest, or
>2. because the encoding file points to character zerooldstyle within
>the ttf.

Ok, but Hans explicitly claimed to have done this for Latin Modern without 
virtual fonts, only encoding trickery (I'll c if I can find that message). 
Actually, I was really surprised when Hans said he could do this without 
virtual fonts, and have always been eager to learn the trick;->

With Alan Hoenig's help almost 2 years ago I contructed a complete virtual 
font for old style cmr using virtual fonts; I guess I can do that again 
(though with a non-TeX font I'm scared;-> I'll read your how-to). On the other 
hand, how will TeXFont handle virtual fonts? What does TeXfont need to do this 
correctly? Or do we just forget about TeXFont?

Thanks again!

Best
Idris

============================
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523

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

end of thread, other threads:[~2005-04-12 17:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-09 21:02 Encoding and mapping glyphs from an expert font Idris Samawi Hamid
2005-04-09 21:54 ` Thomas A.Schmitz
2005-04-09 21:56 ` Adam Lindsay
2005-04-09 22:10 Idris Samawi Hamid
2005-04-09 22:30 Idris Samawi Hamid
2005-04-09 23:22 ` Adam Lindsay
2005-04-10  1:17   ` Idris Samawi Hamid
2005-04-10  7:37 Idris Samawi Hamid
2005-04-12 17:48 ` Hans Hagen

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