ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Problems with ttc-fonts
@ 2016-04-29  7:51 Ulrike Fischer
  2016-04-29  8:37 ` Hans Hagen
  2016-05-01  7:48 ` Hans Hagen
  0 siblings, 2 replies; 4+ messages in thread
From: Ulrike Fischer @ 2016-04-29  7:51 UTC (permalink / raw)
  To: ntg-context

I was playing with the addfeature handler mentioned here
https://mailman.ntg.nl/pipermail/ntg-context/2016/083952.html and
run into a problem with ttc-fonts:

\starttext
\directlua{
    fonts.handlers.otf.addfeature {
        name = "oneb",
        {
            type = "substitution",
            data = {
                ["1"] = "period",
            },
        },
        "feature test",
    }
}
\font\test= name:LatinModernRoman:+oneb \test

1234567890

\font\test= name:cambria:+oneb \test

1234567890

\stoptext

This gives:

.234567890
p234567890

So with latin modern it works fine, while with cambria the first
letter of the substituation is used. 

The used fonts are:

filename=lmroman10-bold.otf filetype=otf format=otf
foundname=D:/context-minimals/context/tex/texmf/fonts/opentype/public/lm/lmroman10-bold.otf
usedmethod=database

filename=c:/windows/fonts/cambria.ttc format=ttc
foundname=c:/windows/fonts/cambria.ttc usedmethod=direct

(I have no idea why the bold version of lm is used, but I don't care
now)

Looking at the tma I see one difference between both fonts:
glyphs in cambria have no "name". A typical entry looks like this

  [46]={
   ["boundingbox"]={ 109, 0, 311, 232 },
   ["index"]=484,
   ["unicode"]=46,
   ["width"]=420,
  },  

while with latin modern it looks like this:

  [46]={
   ["boundingbox"]={ 81, 0, 237, 156 },
   ["index"]=88,
   ["name"]="period",
   ["unicode"]=46,
   ["width"]=319,
  },
  
Is is normal that glyph of ttc-fonts have no name data? If yes how
should one do substituations in such fonts? 



-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/

___________________________________________________________________________________
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: Problems with ttc-fonts
  2016-04-29  7:51 Problems with ttc-fonts Ulrike Fischer
@ 2016-04-29  8:37 ` Hans Hagen
  2016-04-29  9:25   ` Ulrike Fischer
  2016-05-01  7:48 ` Hans Hagen
  1 sibling, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2016-04-29  8:37 UTC (permalink / raw)
  To: ntg-context

On 4/29/2016 9:51 AM, Ulrike Fischer wrote:
> I was playing with the addfeature handler mentioned here
> https://mailman.ntg.nl/pipermail/ntg-context/2016/083952.html and
> run into a problem with ttc-fonts:
>
> \starttext
> \directlua{
>     fonts.handlers.otf.addfeature {
>         name = "oneb",
>         {
>             type = "substitution",
>             data = {
>                 ["1"] = "period",
>             },
>         },
>         "feature test",
>     }
> }
> \font\test= name:LatinModernRoman:+oneb \test
>
> 1234567890
>
> \font\test= name:cambria:+oneb \test
>
> 1234567890
>
> \stoptext
>
> This gives:
>
> .234567890
> p234567890
>
> So with latin modern it works fine, while with cambria the first
> letter of the substituation is used.
>
> The used fonts are:
>
> filename=lmroman10-bold.otf filetype=otf format=otf
> foundname=D:/context-minimals/context/tex/texmf/fonts/opentype/public/lm/lmroman10-bold.otf
> usedmethod=database
>
> filename=c:/windows/fonts/cambria.ttc format=ttc
> foundname=c:/windows/fonts/cambria.ttc usedmethod=direct
>
> (I have no idea why the bold version of lm is used, but I don't care
> now)
>
> Looking at the tma I see one difference between both fonts:
> glyphs in cambria have no "name". A typical entry looks like this
>
>   [46]={
>    ["boundingbox"]={ 109, 0, 311, 232 },
>    ["index"]=484,
>    ["unicode"]=46,
>    ["width"]=420,
>   },
>
> while with latin modern it looks like this:
>
>   [46]={
>    ["boundingbox"]={ 81, 0, 237, 156 },
>    ["index"]=88,
>    ["name"]="period",
>    ["unicode"]=46,
>    ["width"]=319,
>   },
>
> Is is normal that glyph of ttc-fonts have no name data? If yes how
> should one do substituations in such fonts?

you can use the unicode number instead (unless i made a mistake)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | 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] 4+ messages in thread

* Re: Problems with ttc-fonts
  2016-04-29  8:37 ` Hans Hagen
@ 2016-04-29  9:25   ` Ulrike Fischer
  0 siblings, 0 replies; 4+ messages in thread
From: Ulrike Fischer @ 2016-04-29  9:25 UTC (permalink / raw)
  To: ntg-context

Am Fri, 29 Apr 2016 10:37:51 +0200 schrieb Hans Hagen:

>> Is is normal that glyph of ttc-fonts have no name data? If yes how
>> should one do substituations in such fonts?
> 
> you can use the unicode number instead (unless i made a mistake)

["1"] = 46 works, but as names are easier to handle I'm still
interested to know why cambria doesn't have them. 



-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/

___________________________________________________________________________________
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: Problems with ttc-fonts
  2016-04-29  7:51 Problems with ttc-fonts Ulrike Fischer
  2016-04-29  8:37 ` Hans Hagen
@ 2016-05-01  7:48 ` Hans Hagen
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2016-05-01  7:48 UTC (permalink / raw)
  To: news3, mailing list for ConTeXt users

On 4/29/2016 9:51 AM, Ulrike Fischer wrote:
> I was playing with the addfeature handler mentioned here
> https://mailman.ntg.nl/pipermail/ntg-context/2016/083952.html and
> run into a problem with ttc-fonts:
>
> \starttext
> \directlua{
>     fonts.handlers.otf.addfeature {
>         name = "oneb",
>         {
>             type = "substitution",
>             data = {
>                 ["1"] = "period",
>             },
>         },
>         "feature test",
>     }
> }
> \font\test= name:LatinModernRoman:+oneb \test
>
> 1234567890
>
> \font\test= name:cambria:+oneb \test
>
> 1234567890
>
> \stoptext
>
> This gives:
>
> .234567890
> p234567890
>
> So with latin modern it works fine, while with cambria the first
> letter of the substituation is used.

I found the reason for that (side effect of utf conversion that takes 
the first character) of 'period'.

> The used fonts are:
>
> filename=lmroman10-bold.otf filetype=otf format=otf
> foundname=D:/context-minimals/context/tex/texmf/fonts/opentype/public/lm/lmroman10-bold.otf
> usedmethod=database
>
> filename=c:/windows/fonts/cambria.ttc format=ttc
> foundname=c:/windows/fonts/cambria.ttc usedmethod=direct
>
> (I have no idea why the bold version of lm is used, but I don't care
> now)
>
> Looking at the tma I see one difference between both fonts:
> glyphs in cambria have no "name". A typical entry looks like this
>
>   [46]={
>    ["boundingbox"]={ 109, 0, 311, 232 },
>    ["index"]=484,
>    ["unicode"]=46,
>    ["width"]=420,
>   },
>
> while with latin modern it looks like this:
>
>   [46]={
>    ["boundingbox"]={ 81, 0, 237, 156 },
>    ["index"]=88,
>    ["name"]="period",
>    ["unicode"]=46,
>    ["width"]=319,
>   },
>
> Is is normal that glyph of ttc-fonts have no name data? If yes how
> should one do substituations in such fonts?

i need to check it but some fonts have no sane glyph names (so we 
discard them) and there is also an standard name set (so no need for 
names then).

I uploaded a version that fixes the 'p' issue and falls back on agl 
names as well.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | 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] 4+ messages in thread

end of thread, other threads:[~2016-05-01  7:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-29  7:51 Problems with ttc-fonts Ulrike Fischer
2016-04-29  8:37 ` Hans Hagen
2016-04-29  9:25   ` Ulrike Fischer
2016-05-01  7: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).