font-ocl.lua:76: attempt to call a nil value (field 'register')
I tried to register a demo colorpalette: \starttext \directlua{fonts.handlers.otf.registerpalette("demo", { { g=1 }, %accents { b=1 }, %06dd { r=0.5, g=0.5, b=0.5 }, %unused? { g = 0.5, b=0, r=1 }, } )} blub \stoptext and got the error font-ocl.lua:76: attempt to call a nil value (field 'register') (I wanted to test the coloring of https://github.com/alif-type/amiri/blob/master/AmiriQuranColored.ttf, Khaled wrote that "is that [the code] uses the last palette color for layers using paletteIndex 0xFFFF (special value that means use text color)." and that local default = colorvalues[#colorvalues] font-ocl.lua is faulty) -- Ulrike Fischer http://www.troubleshooting-tex.de/
Am Wed, 21 Nov 2018 13:01:47 +0100 schrieb Ulrike Fischer:
Khaled wrote that "is that [the code] uses the last palette color
A bit too much deleted. It should say "it is a bug that ..." -- Ulrike Fischer http://www.troubleshooting-tex.de/
On 11/21/2018 1:37 PM, Ulrike Fischer wrote:
Am Wed, 21 Nov 2018 13:01:47 +0100 schrieb Ulrike Fischer:
Khaled wrote that "is that [the code] uses the last palette color
A bit too much deleted. It should say "it is a bug that ..." in context use the context interface (which uses a different implementation of the function you call)
\starttext \definefontfeature[seguiemj-cl][default][colr=yes,ccmp=yes,dist=yes] \definefontsynonym[emoji][seguiemj*seguiemj-cl] \definecolor[emoji-red] [r=.4] \definecolor[emoji-gray][s=1,t=.5,a=1] \definefontcolorpalette [emoji-r] [emoji-red,emoji-gray] \definefontfeature[seguiemj-r][ccmp=yes,dist=yes,colr=emoji-r] \definefont[MyEmojiR][seguiemj*seguiemj-r @ 100pt] \startTEXpage[offset=10pt] \MyEmojiR\resolvedemoji{triangular ruler} \stopTEXpage \stoptext I'm not sure what yoy mwan with 0xFFFF as that's intercepted .. the choice for the last color as default is just that, a choice, could be the first one or none (or configureable if needed) 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 -----------------------------------------------------------------
Am Wed, 21 Nov 2018 18:46:44 +0100 schrieb Hans Hagen:
I'm not sure what yoy mwan with 0xFFFF as that's intercepted
With this example (font from https://github.com/alif-type/amiri/blob/master/AmiriQuranColored.ttf) a part of the glyphs are in blue. Khaled claims that this is wrong, that the blue should be black, and the output look like this https://i.stack.imgur.com/gpoO7.jpg (sorry about the ^^, it is a translation from a plain example): \starttext \definefontfeature[quran][script=arab,colr=yes] \definefont[quran][AmiriQuranColored*quran @ 20pt] \catcode`\^=7 \pardir TRT\textdir TRT \quran \baselineskip=2.6em \parindent=0pt \leftskip=0pt plus 1fil \rightskip=0pt plus -1fil \parfillskip=0pt plus 2fil \def\aya#1{{\textdir TLT ^^^^06dd#1}} ^^^^fdfd~\aya{١}\par ٱلۡحَمۡدُ لِلَّهِ رَبِّ ٱلۡعَٰلَمِینَ~\aya{٢} ٱلرَّحۡمَٰنِ ٱلرَّحِیمِ~\aya{٣} مَٰلِكِ یَوۡمِ ٱلدِّینِ~\aya{٤} إِیَّاكَ نَعۡبُدُ وَإِیَّاكَ نَسۡتَعِینُ~\aya{٥} ٱهۡدِنَا ٱلصِّرَٰطَ ٱلۡمُسۡتَقِیمَ~\aya{٦} صِرَٰطَ ٱلَّذِینَ أَنۡعَمۡتَ عَلَیۡهِمۡ غَیۡرِ ٱلۡمَغۡضُوبِ عَلَیۡهِمۡ وَلَا ٱلضَّاۤلِّینَ~\aya{٧}\par \stoptext -- Ulrike Fischer http://www.troubleshooting-tex.de/
On Wed, Nov 21, 2018 at 7:04 PM Ulrike Fischer
Am Wed, 21 Nov 2018 18:46:44 +0100 schrieb Hans Hagen:
I'm not sure what yoy mwan with 0xFFFF as that's intercepted
With this example (font from https://github.com/alif-type/amiri/blob/master/AmiriQuranColored.ttf)
a part of the glyphs are in blue. Khaled claims that this is wrong, that the blue should be black, and the output look like this https://i.stack.imgur.com/gpoO7.jpg
(sorry about the ^^, it is a translation from a plain example):
\starttext \definefontfeature[quran][script=arab,colr=yes] \definefont[quran][AmiriQuranColored*quran @ 20pt]
\catcode`\^=7 \pardir TRT\textdir TRT \quran \baselineskip=2.6em \parindent=0pt \leftskip=0pt plus 1fil \rightskip=0pt plus -1fil \parfillskip=0pt plus 2fil \def\aya#1{{\textdir TLT ^^^^06dd#1}} ^^^^fdfd~\aya{١}\par ٱلۡحَمۡدُ لِلَّهِ رَبِّ ٱلۡعَٰلَمِینَ~\aya{٢} ٱلرَّحۡمَٰنِ ٱلرَّحِیمِ~\aya{٣} مَٰلِكِ یَوۡمِ ٱلدِّینِ~\aya{٤} إِیَّاكَ نَعۡبُدُ وَإِیَّاكَ نَسۡتَعِینُ~\aya{٥} ٱهۡدِنَا ٱلصِّرَٰطَ ٱلۡمُسۡتَقِیمَ~\aya{٦} صِرَٰطَ ٱلَّذِینَ أَنۡعَمۡتَ عَلَیۡهِمۡ غَیۡرِ ٱلۡمَغۡضُوبِ عَلَیۡهِمۡ وَلَا ٱلضَّاۤلِّینَ~\aya{٧}\par \stoptext
\definefontfeature[quran][mode=node,language=dflt,script=arab, init=yes,medi=yes,fina=yes,isol=yes, ccmp=yes,locl=yes,calt=yes, liga=yes,clig=yes,dlig=yes,rlig=yes, mark=yes,mkmk=yes,kern=yes,curs=yes, colr=yes] \definefont[quran][AmiriQuranColored*quran @ 18pt] I have just copied-and- pasted an example around, but at least the "black-and-white" typography match. -- luigi
Am Wed, 21 Nov 2018 20:37:29 +0100 schrieb luigi scarso:
\definefontfeature[quran][mode=node,language=dflt,script=arab, init=yes,medi=yes,fina=yes,isol=yes, ccmp=yes,locl=yes,calt=yes, liga=yes,clig=yes,dlig=yes,rlig=yes, mark=yes,mkmk=yes,kern=yes,curs=yes, colr=yes] \definefont[quran][AmiriQuranColored*quran @ 18pt]
I have just copied-and- pasted an example around, but at least the "black-and-white" typography match.
When I use this definitions I still get partly blue glyphs with this preamble. Don't you get them? -- Ulrike Fischer https://www.troubleshooting-tex.de/
On 11/21/2018 9:04 PM, Ulrike Fischer wrote:
Am Wed, 21 Nov 2018 20:37:29 +0100 schrieb luigi scarso:
\definefontfeature[quran][mode=node,language=dflt,script=arab, init=yes,medi=yes,fina=yes,isol=yes, ccmp=yes,locl=yes,calt=yes, liga=yes,clig=yes,dlig=yes,rlig=yes, mark=yes,mkmk=yes,kern=yes,curs=yes, colr=yes] \definefont[quran][AmiriQuranColored*quran @ 18pt]
I have just copied-and- pasted an example around, but at least the "black-and-white" typography match.
When I use this definitions I still get partly blue glyphs with this preamble. Don't you get them? well, i don't know what to expect ... anyway:
\definefontfeature[quran][arabic][script=arab,colr=yes] helps to get better arabic, also use \righttoleft instead of the dir commands; the ^^ can be avoided with \Uchar"FDFD in font-ocl you can change this local default = false -- colorvalues[#colorvalues] -- or 1 or ... maybe make it an option so, no default (i used the default as in emoji it was better that way and those were the only fonts i had) .. when i have time i'll make it an option 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 -----------------------------------------------------------------
Am Thu, 22 Nov 2018 13:50:08 +0100 schrieb Hans Hagen:
When I use this definitions I still get partly blue glyphs with this preamble. Don't you get them?
well, i don't know what to expect
Khaled mentioned this link which shows how (harfbuzz-based) browsers like firefox interpret the font https://www.amirifont.org/fatiha-colored.html Also the spec https://docs.microsoft.com/en-us/typography/opentype/spec/colr#layer-record says ==== A palette entry index value of 0xFFFF is a special case indicating that the text foreground color (defined by a higher-level client) should be used and shall not be treated as actual index into CPAL ColorRecord array. ==== -- Ulrike Fischer http://www.troubleshooting-tex.de/
On Thu, Nov 22, 2018 at 2:13 PM Ulrike Fischer
Am Thu, 22 Nov 2018 13:50:08 +0100 schrieb Hans Hagen:
When I use this definitions I still get partly blue glyphs with this preamble. Don't you get them?
well, i don't know what to expect
Khaled mentioned this link which shows how (harfbuzz-based) browsers like firefox interpret the font https://www.amirifont.org/fatiha-colored.html
Also the spec https://docs.microsoft.com/en-us/typography/opentype/spec/colr#layer-record says
==== A palette entry index value of 0xFFFF is a special case indicating that the text foreground color (defined by a higher-level client) should be used and shall not be treated as actual index into CPAL ColorRecord array. ====
sure, in font-dsp.lua 2953 -- The special value 0xFFFF is foreground (but we index from 1). It 2954 -- more looks like indices into a palette so 'class' is a better name 2955 -- than 'palette'. " the text foreground color (defined by a higher-level client) should be used" doesn't mean "you MUST take the current color text" or even "you MUST use black" In fact "defined by a higher-level client" means that I could define a palette such that each glyph marked with 0xFFFF has its own color based on my palette --- not necessarily the *same* color. (this is the meaning in font-ocl.lua of 247 local default = colorvalues[#colorvalues] -- or 1 or ... maybe make it an option ) So..in this situation black makes sense as blue -- I guess that 0xFFFF is mapped as "cuirrent text color" in harfbuzz-browsers, so, sure, it has a bit more functionality. -- luigi
Am Thu, 22 Nov 2018 14:46:57 +0100 schrieb luigi scarso:
==== A palette entry index value of 0xFFFF is a special case indicating that the text foreground color (defined by a higher-level client) should be used and shall not be treated as actual index into CPAL ColorRecord array. ====
" the text foreground color (defined by a higher-level client) should be used" doesn't mean "you MUST take the current color text" or even "you MUST use black" In fact "defined by a higher-level client" means that I could define a palette such that each glyph marked with 0xFFFF has its own color based on my palette --- not necessarily the *same* color.
Sounds as if there is some room for interpretation ;-). But assume that I want in my example the 0xFFFF to be interpretated as "the current text color", so the currently blue glyphs should be black, and if I add \color[red] before the text they should be red. Can and if yes how this be setup? (Both in context and in generic) -- Ulrike Fischer http://www.troubleshooting-tex.de/
On Thu, Nov 22, 2018 at 4:15 PM Ulrike Fischer
Am Thu, 22 Nov 2018 14:46:57 +0100 schrieb luigi scarso:
==== A palette entry index value of 0xFFFF is a special case indicating that the text foreground color (defined by a higher-level client) should be used and shall not be treated as actual index into CPAL ColorRecord array. ====
" the text foreground color (defined by a higher-level client) should be used" doesn't mean "you MUST take the current color text" or even "you MUST use black" In fact "defined by a higher-level client" means that I could define a palette such that each glyph marked with 0xFFFF has its own color based on my palette --- not necessarily the *same* color.
Sounds as if there is some room for interpretation ;-). But assume that I want in my example the 0xFFFF to be interpretated as "the current text color", so the currently blue glyphs should be black, and if I add \color[red] before the text they should be red. Can and if yes how this be setup? (Both in context and in generic)
no, at this moment is fixed, but we are discussing just now how to implement this. -- luigi
On Thu, Nov 22, 2018 at 4:34 PM luigi scarso
no, at this moment is fixed, but we are discussing just now how to implement this.
kind of \starttext \definefontfeature[quran][mode=node,language=dflt,script=arab, init=yes,medi=yes,fina=yes,isol=yes, ccmp=yes,locl=yes,calt=yes, liga=yes,clig=yes,dlig=yes,rlig=yes, mark=yes,mkmk=yes,kern=yes,curs=yes, colr=yes] \definefont[quran][AmiriQuranColored*quran @ 18pt] \definecolor[R][r=0.6] \definecolor[G][g=1.0] \definecolor[B][b=0.6] \definefontcolorpalette [colorpalet] [R,G,B,red,textcolor] \definefontfeature[quranA][mode=node,language=dflt,script=arab, init=yes,medi=yes,fina=yes,isol=yes, ccmp=yes,locl=yes,calt=yes, liga=yes,clig=yes,dlig=yes,rlig=yes, mark=yes,mkmk=yes,kern=yes,curs=yes, colr=colorpalet] \definefont[quranA][AmiriQuranColored*quranA @ 18pt] \catcode`\^=7 \pardir TRT\textdir TRT \externalfigure[gpoO7.jpg] \quran \baselineskip=2.6em \parindent=0pt \leftskip=0pt plus 1fil \rightskip=0pt plus -1fil \parfillskip=0pt plus 2fil \def\aya#1{{\textdir TLT ^^^^06dd#1}} ^^^^fdfd~\aya{١}\par ٱلۡحَمۡدُ لِلَّهِ رَبِّ ٱلۡعَٰلَمِینَ~\aya{٢} ٱلرَّحۡمَٰنِ ٱلرَّحِیمِ~\aya{٣} مَٰلِكِ یَوۡمِ ٱلدِّینِ~\aya{٤} إِیَّاكَ نَعۡبُدُ وَإِیَّاكَ نَسۡتَعِینُ~\aya{٥} ٱهۡدِنَا ٱلصِّرَٰطَ ٱلۡمُسۡتَقِیمَ~\aya{٦} صِرَٰطَ ٱلَّذِینَ أَنۡعَمۡتَ عَلَیۡهِمۡ غَیۡرِ ٱلۡمَغۡضُوبِ عَلَیۡهِمۡ وَلَا ٱلضَّاۤلِّینَ~\aya{٧}\par \startcolor[orange] ^^^^fdfd~\aya{١}\par ٱلۡحَمۡدُ لِلَّهِ رَبِّ ٱلۡعَٰلَمِینَ~\aya{٢} ٱلرَّحۡمَٰنِ ٱلرَّحِیمِ~\aya{٣} مَٰلِكِ یَوۡمِ ٱلدِّینِ~\aya{٤} إِیَّاكَ نَعۡبُدُ وَإِیَّاكَ نَسۡتَعِینُ~\aya{٥} ٱهۡدِنَا ٱلصِّرَٰطَ ٱلۡمُسۡتَقِیمَ~\aya{٦} صِرَٰطَ ٱلَّذِینَ أَنۡعَمۡتَ عَلَیۡهِمۡ غَیۡرِ ٱلۡمَغۡضُوبِ عَلَیۡهِمۡ وَلَا ٱلضَّاۤلِّینَ~\aya{٧}\par \stopcolor \quranA ^^^^fdfd~\aya{١}\par ٱلۡحَمۡدُ لِلَّهِ رَبِّ ٱلۡعَٰلَمِینَ~\aya{٢} ٱلرَّحۡمَٰنِ ٱلرَّحِیمِ~\aya{٣} مَٰلِكِ یَوۡمِ ٱلدِّینِ~\aya{٤} إِیَّاكَ نَعۡبُدُ وَإِیَّاكَ نَسۡتَعِینُ~\aya{٥} ٱهۡدِنَا ٱلصِّرَٰطَ ٱلۡمُسۡتَقِیمَ~\aya{٦} صِرَٰطَ ٱلَّذِینَ أَنۡعَمۡتَ عَلَیۡهِمۡ غَیۡرِ ٱلۡمَغۡضُوبِ عَلَیۡهِمۡ وَلَا ٱلضَّاۤلِّینَ~\aya{٧}\par \startcolor[gray] ^^^^fdfd~\aya{١}\par ٱلۡحَمۡدُ لِلَّهِ رَبِّ ٱلۡعَٰلَمِینَ~\aya{٢} ٱلرَّحۡمَٰنِ ٱلرَّحِیمِ~\aya{٣} مَٰلِكِ یَوۡمِ ٱلدِّینِ~\aya{٤} إِیَّاكَ نَعۡبُدُ وَإِیَّاكَ نَسۡتَعِینُ~\aya{٥} ٱهۡدِنَا ٱلصِّرَٰطَ ٱلۡمُسۡتَقِیمَ~\aya{٦} صِرَٰطَ ٱلَّذِینَ أَنۡعَمۡتَ عَلَیۡهِمۡ غَیۡرِ ٱلۡمَغۡضُوبِ عَلَیۡهِمۡ وَلَا ٱلضَّاۤلِّینَ~\aya{٧}\par \stopcolor \stoptext From the font cache one can see the palette of the font. -- luigi
==== A palette entry index value of 0xFFFF is a special case indicating that the text foreground color (defined by a higher-level client) should be used and shall not be treated as actual index into CPAL ColorRecord array. ==== unrelated ... 0xFFFF is intercepted and dealt with elsewhere ... default relates to what we like as default (which is an arbitrary choice from
On 11/22/2018 2:12 PM, Ulrike Fischer wrote: the palette but as said: that can be an option) 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 -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
luigi scarso
-
Ulrike Fischer