[NTG-context] Problems with ttc-fonts

Hans Hagen pragma at wxs.nl
Sun May 1 09:48:45 CEST 2016


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


More information about the ntg-context mailing list