ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Virtual font question
@ 2015-06-22 16:47 Zhichu Chen
  2015-06-23  3:57 ` Aditya Mahajan
  0 siblings, 1 reply; 4+ messages in thread
From: Zhichu Chen @ 2015-06-22 16:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello list,

I was trying to use the Math Times Pro 2 fonts in ConTeXt MKIV. This 
Type1 font
contains a map file, a set of pfb files and the corresponding tfm files. 
I was managed
to write a .lfg file and a type-imp-xxx file, but here's my problem.

The font comes with three different sizes, the virtual fonts in my .lfg 
file look like:
===================================================================
         virtuals = {
             ["mtpro06a-regular"] = {
                 { name = "file:texgyretermes-regular.otf", features = 
"virtualmath", main = true },
                 { name = "mt2mif.tfm", vector = "mtpro2-mi", 
skewchar=0x7F },
                 { name = "mt2syf.tfm", vector = "mtpro2-sy", 
skewchar=0x30, parameters = true },
                 { name = "mt2mbf.tfm", vector = "mtpro2-mb", 
skewchar=0x7F },
                 { name = "mt2syaf.tfm", vector = "mtpro2-sya", 
skewchar=0x7F },
                 { name = "mt2bbf.tfm", vector = "mtpro2-bb", 
skewchar=0x7F },
                 { name = "mt2msf.tfm", vector = "mtpro2-mca", 
skewchar=0x7F },
                 { name = "mt2bmsf.tfm", vector = "mtpro2-bmca", 
skewchar=0x7F },
                 { name = "mt2mff.tfm", vector = "mtpro2-mfa", 
skewchar=0x7F },
                 { name = "mt2bmff.tfm", vector = "mtpro2-bmfa", 
skewchar=0x7F },
                 { name = "mt2bbif.tfm", vector = "mtpro2-bbi", 
skewchar=0x7F },
             },
             ["mtpro08a-regular"] = {
                 { name = "file:texgyretermes-regular.otf", features = 
"virtualmath", main = true },
                 { name = "mt2mis.tfm", vector = "mtpro2-mi", 
skewchar=0x7F },
                 { name = "mt2sys.tfm", vector = "mtpro2-sy", 
skewchar=0x30, parameters = true },
                 { name = "mt2mbs.tfm", vector = "mtpro2-mb", 
skewchar=0x7F },
                 { name = "mt2syas.tfm", vector = "mtpro2-sya", 
skewchar=0x7F },
                 { name = "mt2bbs.tfm", vector = "mtpro2-bb", 
skewchar=0x7F },
                 { name = "mt2mss.tfm", vector = "mtpro2-mca", 
skewchar=0x7F },
                 { name = "mt2bmss.tfm", vector = "mtpro2-bmca", 
skewchar=0x7F },
                 { name = "mt2mfs.tfm", vector = "mtpro2-mfa", 
skewchar=0x7F },
                 { name = "mt2bmfs.tfm", vector = "mtpro2-bmfa", 
skewchar=0x7F },
                 { name = "mt2bbis.tfm", vector = "mtpro2-bbi", 
skewchar=0x7F },
             },
             ["mtpro10a-regular"] = {
                 { name = "file:texgyretermes-regular.otf", features = 
"virtualmath", main = true },
                 { name = "mt2mit.tfm", vector = "mtpro2-mi", 
skewchar=0x7F },
                 { name = "mt2syt.tfm", vector = "mtpro2-sy", 
skewchar=0x30, parameters = true },
                 { name = "mt2mbt.tfm", vector = "mtpro2-mb", 
skewchar=0x7F },
                 { name = "mt2syat.tfm", vector = "mtpro2-sya", 
skewchar=0x7F },
                 { name = "mt2bbt.tfm", vector = "mtpro2-bb", 
skewchar=0x7F },
                 { name = "mt2mst.tfm", vector = "mtpro2-mca", 
skewchar=0x7F },
                 { name = "mt2bmst.tfm", vector = "mtpro2-bmca", 
skewchar=0x7F },
                 { name = "mt2mft.tfm", vector = "mtpro2-mfa", 
skewchar=0x7F },
                 { name = "mt2bmft.tfm", vector = "mtpro2-bmfa", 
skewchar=0x7F },
                 { name = "mt2bbit.tfm", vector = "mtpro2-bbi", 
skewchar=0x7F },
             },
===================================================================
I guess the suffixes "f" "s" and "t" may correspond to "five" "seven" 
and "ten", but that's
not important. I could use one of them as the virtual font in the 
typescript:
===================================================================
\definefontsynonym [\s!MathRoman] [MTPro10a-Regular@mtpro10a-regular]
===================================================================
The output pdf used the 10-size font as expected.

I stole some codes from lm.lfg and added the following code:
===================================================================
     designsizes = {
         ["MathTimeProA-Regular"] = {
             ["4pt"]  = "MTPro06a-Regular@mtpro06a-regular",
             ["5pt"]  = "MTPro06a-Regular@mtpro06a-regular",
             ["6pt"]  = "MTPro06a-Regular@mtpro06a-regular",
             ["7pt"]  = "MTPro08a-Regular@mtpro08a-regular",
             ["8pt"]  = "MTPro08a-Regular@mtpro08a-regular",
             ["9pt"]  = "MTPro08a-Regular@mtpro08a-regular",
             ["10pt"] = "MTPro10a-Regular@mtpro10a-regular",
             ["11pt"] = "MTPro10a-Regular@mtpro10a-regular",
             ["12pt"] = "MTPro10a-Regular@mtpro10a-regular",
             default  = "MTPro10a-Regular@mtpro10a-regular"
         },
===================================================================
and modified the typescript:
===================================================================
\definefontsynonym [\s!MathRoman] [\v!name:MathTimeProA-Regular] 
[\s!goodies=math-times-pro-math]
===================================================================
It failed as expected:
===================================================================
fonts           > defining > start stage one: MathRoman mo 1
fonts           > defining > specification 'MathRoman mo 1', lookup 
'file', name 'MathRoman', sub '', method '', detail ''
fonts           > defining > stop stage one
fonts           > defining > start stage two: name:MathTimeProA-Regular 
(size 393216)
fonts           > names > font with name 'mathtimeproaregular' cannot be 
found
fonts           > names > font database has matching configuration and 
file hashes
fonts           > defining > trying (reader sequence driven) type 'otf' 
for 'MathTimeProA-Regular' with file ''
fonts           > names > font database has matching configuration and 
file hashes
fonts           > defining > trying (reader sequence driven) type 'ttf' 
for 'MathTimeProA-Regular' with file ''
fonts           > names > font database has matching configuration and 
file hashes
fonts           > defining > trying (reader sequence driven) type 'afm' 
for 'MathTimeProA-Regular' with file ''
fonts           > names > font database has matching configuration and 
file hashes
fonts           > names > font database has matching configuration and 
file hashes
fonts           > defining > loading tfm with name 
'MathTimeProA-Regular' fails
fonts           > defining > trying (reader sequence driven) type 'tfm' 
for 'MathTimeProA-Regular' with file ''
fonts           > names > font database has matching configuration and 
file hashes
fonts           > defining > loading tfm with name 
'MathTimeProA-Regular' fails
fonts           > defining > trying (reader sequence driven) type 'lua' 
for 'MathTimeProA-Regular' with file ''
fonts           > lua loading > using lua reader for 'MathRoman mo 1'
fonts           > defining > font with asked name 'MathTimeProA-Regular' 
is not found using lookup 'name'
fonts           > defining > not loaded and hashed: mathtimeproa-regular 
@ normal:goodies=math-times-pro-math @ 393216
fonts           > defining > unknown font 'MathTimeProA-Regular', 
loading aborted
fonts           > defining > unable to define 'MathTimeProA-Regular' as 
'math-times-pro-11pt-mm-mr--3'
fonts           > defining > memory usage after: 45 MB (ctx: 45 MB)
fonts           > defining > stop stage two
===================================================================
I get it. There's no MathTimeProA-Regular file. I've tried the built-in 
"ebgaramond"
typescript which also comes with the "designsizes" field. Interesting, the
"ebgaramond-regular" is remapped to "EBGaramond12-Regular" magically:
===================================================================
fonts           > defining > start stage two: file:ebgaramond-regular 
(size 720896)
fonts           > defining > remapping name 'ebgaramond-regular', 
specification 'auto', size 720896, designsize 'file:EBGaramond12-Regular'
===================================================================

Well, what am I missing? How to get the designsize names recognized? 
What is the right
way to make the virtual fonts?

Thanks for noticing.

Best regards,
Zhichu

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

* Re: Virtual font question
  2015-06-22 16:47 Virtual font question Zhichu Chen
@ 2015-06-23  3:57 ` Aditya Mahajan
  2015-06-23  5:20   ` Zhichu Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Aditya Mahajan @ 2015-06-23  3:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, 23 Jun 2015, Zhichu Chen wrote:

> I was trying to use the Math Times Pro 2 fonts in ConTeXt MKIV. This 
> Type1 font contains a map file, a set of pfb files and the corresponding 
> tfm files. I was managed to write a .lfg file and a type-imp-xxx file, 
> but here's my problem.

I don't have the fonts, so I cannot describe the exact method. But see 
below and also have a look at Section 5 of
https://www.tug.org/TUGboat/tb30-2/tb95mahajan-cmath.pdf The description 
is old, and some of the file locations have changes, but the basic 
infrastructure is still the same.

> The font comes with three different sizes, the virtual fonts in my .lfg 
> file look like:
> ===================================================================
>         virtuals = {
>             ["mtpro06a-regular"] = {
>                 { name = "file:texgyretermes-regular.otf", features = 
> "virtualmath", main = true },
>                 { name = "mt2mif.tfm", vector = "mtpro2-mi", 
> skewchar=0x7F },
[...]
>             },

The vectors mptpro2-mi etc are not defined. Look at math-ttv.lua for a 
list of predefined vectors (mapping type1 fonts to unicode symbols. It is 
quite likely that the mtpro fonts would follow the "standard" mappings; if 
not, you will need to create an approrpriate mapping for each font. This 
is not difficult (just monotonous).

> ===================================================================
> I guess the suffixes "f" "s" and "t" may correspond to "five" "seven" 
> and "ten", but that's
> not important. I could use one of them as the virtual font in the 
> typescript:

Once this is done, rest of the typescript should work. It may be a good 
idea to try to see if you can get roman letters from mtpro.

Aditya
___________________________________________________________________________________
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] 4+ messages in thread

* Re: Virtual font question
  2015-06-23  3:57 ` Aditya Mahajan
@ 2015-06-23  5:20   ` Zhichu Chen
  2015-06-24 10:33     ` Zhichu Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Zhichu Chen @ 2015-06-23  5:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4097 bytes --]

Hi Aditya,


On 06/23/2015 11:57 AM, Aditya Mahajan wrote:
> I don't have the fonts, so I cannot describe the exact method. But see 
> below and also have a look at Section 5 of
> https://www.tug.org/TUGboat/tb30-2/tb95mahajan-cmath.pdf The 
> description is old, and some of the file locations have changes, but 
> the basic infrastructure is still the same.
Thank you for sharing this article. It seems that the
===================================================================
return {
     mathematics = {
         mapfiles = {
             "mtpro2.map",
         },
         virtuals = {
             ["mtpro06a-regular"] = {
...
===================================================================
codes may have done the job in the mathematics.make_font function.

In this snippet:
===================================================================
\definefontsynonym
   [LMMathRoman10-Regular]
   [LMMath10-Regular@lmroman10-math]
===================================================================
I know that LMMathRoman10-Regular will be used as the font synonym, 
@lmroman10-math is the
virtual font, but what does LMMath10-Regular stand for? I chose some 
random names in my typescript
but maybe there's some magic there?
> The vectors mptpro2-mi etc are not defined. Look at math-ttv.lua for a 
> list of predefined vectors (mapping type1 fonts to unicode symbols. It 
> is quite likely that the mtpro fonts would follow the "standard" 
> mappings; if not, you will need to create an approrpriate mapping for 
> each font. This is not difficult (just monotonous).
I've already defined these vectors in the same .lfg file. What a tedious 
work it was, by the way. I thought
that would be irrelevant, so I skipped those codes. I'm sorry I didn't 
make that clear.

I almost forgot to mention. The font has its own \Relbar and \relbar 
characters rather than the equality
and the dash marks. What is the best way to use them? I currently put 
them in a private-use-area slot
in the vectors' definitions, but I'm not sure that's a good solution.
>
>> ===================================================================
>> I guess the suffixes "f" "s" and "t" may correspond to "five" "seven" 
>> and "ten", but that's
>> not important. I could use one of them as the virtual font in the 
>> typescript:
>
> Once this is done, rest of the typescript should work. It may be a 
> good idea to try to see if you can get roman letters from mtpro.
If I claimed the font synonym with the virtual font directly:
===================================================================
# typescripts
\definefontsynonym [\s!MathRoman] [MTPro10a-Regular@mtpro10a-regular]
===================================================================
the 10-size-version fonts were loaded without any problem. But if I want 
to use the designsize feature:
===================================================================
-- lfg
     designsizes = {
         ["MathTimeProA-Regular"] = {
             ["4pt"]  = "MTPro06a-Regular@mtpro06a-regular",
             ["5pt"]  = "MTPro06a-Regular@mtpro06a-regular",
             ["6pt"]  = "MTPro06a-Regular@mtpro06a-regular",
         ...
# typescripts
\definefontsynonym [\s!MathRoman] [\v!file:mathtimeproa-regular]
===================================================================
the mathtimeproa-regular font could not be remapped to the correct 
virtual font with the appropriate size.
I just want to know how type-imp-ebgaramond.mkiv managed to remap the 
designsize filename
"file:ebgaramond-regular" to "file:EBGaramond12-Regular".
>
> Aditya
> ___________________________________________________________________________________ 
>
> 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
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 7303 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Virtual font question
  2015-06-23  5:20   ` Zhichu Chen
@ 2015-06-24 10:33     ` Zhichu Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Zhichu Chen @ 2015-06-24 10:33 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 6390 bytes --]

Hi everybody,

I finally got my typescript work. It was the "serif" typeface that 
failed me. When I defined the fixed size type:
===================================================================
         \definetypeface [mathtimespro] [rm] [serif] [times]     [default]
         \definetypeface [mathtimespro] [ss] [sans] [helvetica] 
[default] [rscale=0.9]
         \definetypeface [mathtimespro] [tt] [mono] [courier]   
[default] [rscale=1.1]
         \definetypeface [mathtimespro] [mm] [math] [mathtimespro]    
[default]
===================================================================
where mathtimespro in the last line was defined as:
===================================================================
         \definefontsynonym [MathTimeProA-Regular] 
[MTP06A-Regular@mtpro06a-regular]
===================================================================
Everything was fine. But the designsize version needs to be:
===================================================================
         \definetypeface [mathtimespro] [rm] [serif] [times]     
[default][designsize=auto]
         \definetypeface [mathtimespro] [ss] [sans]  [helvetica] 
[default] [rscale=0.9]
         \definetypeface [mathtimespro] [tt] [mono]  [courier] [default] 
[rscale=1.1]
         \definetypeface [mathtimespro] [mm] [math] [mathtimespro]    
[default][designsize=auto]
===================================================================
Without the last parameter in the serif definition, the math font could 
not be remapped (WHY???).

Fix me if I'm wrong about this conclusion.


Best regards,
Zhichu

On 06/23/2015 01:20 PM, Zhichu Chen wrote:
> Hi Aditya,
>
>
> On 06/23/2015 11:57 AM, Aditya Mahajan wrote:
>> I don't have the fonts, so I cannot describe the exact method. But 
>> see below and also have a look at Section 5 of
>> https://www.tug.org/TUGboat/tb30-2/tb95mahajan-cmath.pdf The 
>> description is old, and some of the file locations have changes, but 
>> the basic infrastructure is still the same.
> Thank you for sharing this article. It seems that the
> ===================================================================
> return {
>     mathematics = {
>         mapfiles = {
>             "mtpro2.map",
>         },
>         virtuals = {
>             ["mtpro06a-regular"] = {
> ...
> ===================================================================
> codes may have done the job in the mathematics.make_font function.
>
> In this snippet:
> ===================================================================
> \definefontsynonym
>   [LMMathRoman10-Regular]
>   [LMMath10-Regular@lmroman10-math]
> ===================================================================
> I know that LMMathRoman10-Regular will be used as the font synonym, 
> @lmroman10-math is the
> virtual font, but what does LMMath10-Regular stand for? I chose some 
> random names in my typescript
> but maybe there's some magic there?
>> The vectors mptpro2-mi etc are not defined. Look at math-ttv.lua for 
>> a list of predefined vectors (mapping type1 fonts to unicode symbols. 
>> It is quite likely that the mtpro fonts would follow the "standard" 
>> mappings; if not, you will need to create an approrpriate mapping for 
>> each font. This is not difficult (just monotonous).
> I've already defined these vectors in the same .lfg file. What a 
> tedious work it was, by the way. I thought
> that would be irrelevant, so I skipped those codes. I'm sorry I didn't 
> make that clear.
>
> I almost forgot to mention. The font has its own \Relbar and \relbar 
> characters rather than the equality
> and the dash marks. What is the best way to use them? I currently put 
> them in a private-use-area slot
> in the vectors' definitions, but I'm not sure that's a good solution.
>>
>>> ===================================================================
>>> I guess the suffixes "f" "s" and "t" may correspond to "five" 
>>> "seven" and "ten", but that's
>>> not important. I could use one of them as the virtual font in the 
>>> typescript:
>>
>> Once this is done, rest of the typescript should work. It may be a 
>> good idea to try to see if you can get roman letters from mtpro.
> If I claimed the font synonym with the virtual font directly:
> ===================================================================
> # typescripts
> \definefontsynonym [\s!MathRoman] [MTPro10a-Regular@mtpro10a-regular]
> ===================================================================
> the 10-size-version fonts were loaded without any problem. But if I 
> want to use the designsize feature:
> ===================================================================
> -- lfg
>     designsizes = {
>         ["MathTimeProA-Regular"] = {
>             ["4pt"]  = "MTPro06a-Regular@mtpro06a-regular",
>             ["5pt"]  = "MTPro06a-Regular@mtpro06a-regular",
>             ["6pt"]  = "MTPro06a-Regular@mtpro06a-regular",
>         ...
> # typescripts
> \definefontsynonym [\s!MathRoman]     [\v!file:mathtimeproa-regular]
> ===================================================================
> the mathtimeproa-regular font could not be remapped to the correct 
> virtual font with the appropriate size.
> I just want to know how type-imp-ebgaramond.mkiv managed to remap the 
> designsize filename
> "file:ebgaramond-regular" to "file:EBGaramond12-Regular".
>>
>> Aditya
>> ___________________________________________________________________________________ 
>>
>> 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
>> ___________________________________________________________________________________
>
>
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 11444 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2015-06-24 10:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-22 16:47 Virtual font question Zhichu Chen
2015-06-23  3:57 ` Aditya Mahajan
2015-06-23  5:20   ` Zhichu Chen
2015-06-24 10:33     ` Zhichu Chen

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