ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Failure when loading variable font
@ 2021-08-14 15:56 Marcel Krüger via ntg-context
  2021-08-14 19:05 ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Krüger via ntg-context @ 2021-08-14 15:56 UTC (permalink / raw)
  To: ConTeXt users list; +Cc: Marcel Krüger

Hi,

the latest ConTeXt version fails for the following
document:

    \definefontfeature
      [default:test]
      [default]
      [axis={Weight=100}]
    \definefont
      [SomeFont]
      [file:Fraunces.ttf*default:test]
    \starttext
    \SomeFont Abcdef
    \stoptext

and the font from
https://github.com/undercasetype/Fraunces/raw/master/fonts/Fraunces%5BSOFT%2CWONK%2Copsz%2Cwght%5D.ttf
renamed to Fraunces.ttf

with the error message

    otf reader      > user instance: weight=100, factors: 0 -1.0 0 0
    otf reader      > fatal error in file 'Fraunces.ttf': ...e0dde776fb1556f32e/formats/luametatex/font-ttf-macro.lua:274: attempt to index a nil value (local 'p1')
    stack traceback:
	    ...e0dde776fb1556f32e/formats/luametatex/font-otr-macro.lua:2339: in metamethod 'index'
	    ...e0dde776fb1556f32e/formats/luametatex/font-ttf-macro.lua:274: in upvalue 'applyaxis'
	    ...e0dde776fb1556f32e/formats/luametatex/font-ttf-macro.lua:1428: in field 'gvar'
	    ...e0dde776fb1556f32e/formats/luametatex/font-ttf-macro.lua:1155: in local 'reader'
	    ...e0dde776fb1556f32e/formats/luametatex/font-otr-macro.lua:2084: in upvalue 'readtable'
	    ...e0dde776fb1556f32e/formats/luametatex/font-otr-macro.lua:2197: in upvalue 'readdata'
	    ...e0dde776fb1556f32e/formats/luametatex/font-otr-macro.lua:2252: in function <...e0dde776fb1556f32e/formats/luametatex/font-otr-macro.lua:2235>
	    [C]: in function 'xpcall'
	    ...e0dde776fb1556f32e/formats/luametatex/font-otr-macro.lua:2341: in upvalue 'loadfont'
	    ...e0dde776fb1556f32e/formats/luametatex/font-otr-macro.lua:2396: in field 'loadfont'
	    ...mtx/tex/texmf-context/tex/context/base/mkiv/font-otl.lua:160: in field 'load'
	    ...mtx/tex/texmf-context/tex/context/base/mkiv/font-otl.lua:599: in upvalue 'otftotfm'
	    ...mtx/tex/texmf-context/tex/context/base/mkiv/font-otl.lua:627: in function <...mtx/tex/texmf-context/tex/context/base/mkiv/font-otl.lua:626>
	    (...tail calls...)
	    ...mtx/tex/texmf-context/tex/context/base/mkxl/font-def.lmt:377: in function <...mtx/tex/texmf-context/tex/context/base/mkxl/font-def.lmt:365>
	    (...tail calls...)
	    ...mtx/tex/texmf-context/tex/context/base/mkxl/font-def.lmt:483: in field 'read'
	    ...mtx/tex/texmf-context/tex/context/base/mkxl/font-ctx.lmt:1336: in function <...mtx/tex/texmf-context/tex/context/base/mkxl/font-ctx.lmt:1193>
	    (...tail calls...)
    fonts           > otf loading > loading failed due to read error

(This run used luametatex, but the same issue occurs when using luatex)
The same font worked correctly with the ConTeXt version from 2021-05-20.

Best regards,
Marcel 
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Failure when loading variable font
  2021-08-14 15:56 Failure when loading variable font Marcel Krüger via ntg-context
@ 2021-08-14 19:05 ` Hans Hagen via ntg-context
  2021-08-15 16:03   ` Marcel Fabian Krüger via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen via ntg-context @ 2021-08-14 19:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen, Marcel Krüger

On 8/14/2021 5:56 PM, Marcel Krüger via ntg-context wrote:
> Hi,
> 
> the latest ConTeXt version fails for the following
> document:
> 
>      \definefontfeature
>        [default:test]
>        [default]
>        [axis={Weight=100}]
>      \definefont
>        [SomeFont]
>        [file:Fraunces.ttf*default:test]
>      \starttext
>      \SomeFont Abcdef
>      \stoptext
> 
> and the font from
> https://github.com/undercasetype/Fraunces/raw/master/fonts/Fraunces%5BSOFT%2CWONK%2Copsz%2Cwght%5D.ttf
> renamed to Fraunces.ttf
> 
> with the error message
> 
>      otf reader      > user instance: weight=100, factors: 0 -1.0 0 0
>      otf reader      > fatal error in file 'Fraunces.ttf': ...e0dde776fb1556f32e/formats/luametatex/font-ttf-macro.lua:274: attempt to index a nil value (local 'p1')
>      stack traceback:
> 	    ...e0dde776fb1556f32e/formats/luametatex/font-otr-macro.lua:2339: in metamethod 'index'
> 	    ...e0dde776fb1556f32e/formats/luametatex/font-ttf-macro.lua:274: in upvalue 'applyaxis'
> 	    ...e0dde776fb1556f32e/formats/luametatex/font-ttf-macro.lua:1428: in field 'gvar'
> 	    ...e0dde776fb1556f32e/formats/luametatex/font-ttf-macro.lua:1155: in local 'reader'
> 	    ...e0dde776fb1556f32e/formats/luametatex/font-otr-macro.lua:2084: in upvalue 'readtable'
> 	    ...e0dde776fb1556f32e/formats/luametatex/font-otr-macro.lua:2197: in upvalue 'readdata'
> 	    ...e0dde776fb1556f32e/formats/luametatex/font-otr-macro.lua:2252: in function <...e0dde776fb1556f32e/formats/luametatex/font-otr-macro.lua:2235>
> 	    [C]: in function 'xpcall'
> 	    ...e0dde776fb1556f32e/formats/luametatex/font-otr-macro.lua:2341: in upvalue 'loadfont'
> 	    ...e0dde776fb1556f32e/formats/luametatex/font-otr-macro.lua:2396: in field 'loadfont'
> 	    ...mtx/tex/texmf-context/tex/context/base/mkiv/font-otl.lua:160: in field 'load'
> 	    ...mtx/tex/texmf-context/tex/context/base/mkiv/font-otl.lua:599: in upvalue 'otftotfm'
> 	    ...mtx/tex/texmf-context/tex/context/base/mkiv/font-otl.lua:627: in function <...mtx/tex/texmf-context/tex/context/base/mkiv/font-otl.lua:626>
> 	    (...tail calls...)
> 	    ...mtx/tex/texmf-context/tex/context/base/mkxl/font-def.lmt:377: in function <...mtx/tex/texmf-context/tex/context/base/mkxl/font-def.lmt:365>
> 	    (...tail calls...)
> 	    ...mtx/tex/texmf-context/tex/context/base/mkxl/font-def.lmt:483: in field 'read'
> 	    ...mtx/tex/texmf-context/tex/context/base/mkxl/font-ctx.lmt:1336: in function <...mtx/tex/texmf-context/tex/context/base/mkxl/font-ctx.lmt:1193>
> 	    (...tail calls...)
>      fonts           > otf loading > loading failed due to read error
> 
> (This run used luametatex, but the same issue occurs when using luatex)
> The same font worked correctly with the ConTeXt version from 2021-05-20.

that's because since then we check for the cycle (otherwise artifacts)

it probably relates to these extra points (the 'standard' is somewhat 
fuzzy in that respect also because some fonts have them and some don't 
so it's the usual wait till we run into something issue)

we can check for bounds

                         for i=1,nofpoints do
                             local d1, d2, d3 = find(i)
                             local p2 = points[i]
                             if d2 then
                                 xv[i] = xvalues[d2]
                                 yv[i] = yvalues[d2]
                             else
                                 local n1 = dpoints[d1]
                                 local n3 = dpoints[d3]
if n1 > nofpoints then
     n1 = nofpoints
end
if n3 > nofpoints then
     n3 = nofpoints
end

no crash then (the resulting shapes look good enough to me, assumign 
that the weird f is intended)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Failure when loading variable font
  2021-08-14 19:05 ` Hans Hagen via ntg-context
@ 2021-08-15 16:03   ` Marcel Fabian Krüger via ntg-context
  0 siblings, 0 replies; 3+ messages in thread
From: Marcel Fabian Krüger via ntg-context @ 2021-08-15 16:03 UTC (permalink / raw)
  To: Hans Hagen; +Cc: Marcel Fabian Krüger, mailing list for ConTeXt users

Hi,

On Sat, Aug 14, 2021 at 09:05:45PM +0200, Hans Hagen wrote:
> that's because since then we check for the cycle (otherwise artifacts)
> 
> it probably relates to these extra points (the 'standard' is somewhat fuzzy
> in that respect also because some fonts have them and some don't so it's the
> usual wait till we run into something issue)

As far as I understand the spec the phantom points shouldn't influence
this since the next and previous points are only looked up in the current
contour and the phantom point are not on any contour, so they can never
appear as next or previous point anyway. That doesn't seem to be
implemented though.

> 
> we can check for bounds
> 
>                         for i=1,nofpoints do
>                             local d1, d2, d3 = find(i)
>                             local p2 = points[i]
>                             if d2 then
>                                 xv[i] = xvalues[d2]
>                                 yv[i] = yvalues[d2]
>                             else
>                                 local n1 = dpoints[d1]
>                                 local n3 = dpoints[d3]
> if n1 > nofpoints then
>     n1 = nofpoints
> end
> if n3 > nofpoints then
>     n3 = nofpoints
> end
> 
> no crash then (the resulting shapes look good enough to me, assumign that
> the weird f is intended)

Thanks, with this change ConTeXt seems to give the expected output for
this font. (Yes, the weird f is intentional. Evn though IMO it's not
siginificantly weirder than the other glyphs in that font)

Best,
Marcel
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2021-08-15 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-14 15:56 Failure when loading variable font Marcel Krüger via ntg-context
2021-08-14 19:05 ` Hans Hagen via ntg-context
2021-08-15 16:03   ` Marcel Fabian Krüger via ntg-context

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