* Addressing glyphs in Lua
@ 2018-10-09 20:40 Marco Patzer
2018-10-09 21:36 ` Hans Hagen
0 siblings, 1 reply; 5+ messages in thread
From: Marco Patzer @ 2018-10-09 20:40 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi!
I have two questions regarding addressing glyphs in Lua:
1) How to address glyphs in slots as e.g. U+F0029?
2) How to address glyphs by name?
Use:
\startluacode
fonts.handlers.otf.addfeature {
name = "foo",
type = "substitution",
data = { [0xF0029] = 0xF0030 }, -- ← doesn't work
}
\stopluacode
Marco
___________________________________________________________________________________
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] 5+ messages in thread
* Re: Addressing glyphs in Lua
2018-10-09 20:40 Addressing glyphs in Lua Marco Patzer
@ 2018-10-09 21:36 ` Hans Hagen
2018-10-10 6:46 ` Marco Patzer
0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2018-10-09 21:36 UTC (permalink / raw)
To: mailing list for ConTeXt users, Marco Patzer
On 10/9/2018 10:40 PM, Marco Patzer wrote:
> Hi!
>
> I have two questions regarding addressing glyphs in Lua:
>
> 1) How to address glyphs in slots as e.g. U+F0029?
> 2) How to address glyphs by name?
>
> Use:
>
> \startluacode
> fonts.handlers.otf.addfeature {
> name = "foo",
> type = "substitution",
> data = { [0xF0029] = 0xF0030 }, -- ← doesn't work
> }
> \stopluacode
this is a mnwe .. make a mwe with at least a font ... anyway, glyph
names should normally work (given that they are sane ones, because in
context we strip some)
(messing with badly names privates is asking for troubles)
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] 5+ messages in thread
* Re: Addressing glyphs in Lua
2018-10-09 21:36 ` Hans Hagen
@ 2018-10-10 6:46 ` Marco Patzer
2018-10-10 8:26 ` Hans Hagen
0 siblings, 1 reply; 5+ messages in thread
From: Marco Patzer @ 2018-10-10 6:46 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Tue, 9 Oct 2018 23:36:32 +0200
Hans Hagen <j.hagen@xs4all.nl> wrote:
> On 10/9/2018 10:40 PM, Marco Patzer wrote:
> > Hi!
> >
> > I have two questions regarding addressing glyphs in Lua:
> >
> > 1) How to address glyphs in slots as e.g. U+F0029?
> > 2) How to address glyphs by name?
> >
> > Use:
> >
> > \startluacode
> > fonts.handlers.otf.addfeature {
> > name = "foo",
> > type = "substitution",
> > data = { [0xF0029] = 0xF0030 }, -- ← doesn't work
> > }
> > \stopluacode
> this is a mnwe .. make a mwe with at least a font
Sorry, here it is:
\startluacode
fonts.handlers.otf.addfeature {
name = "phone",
type = "substitution",
data = { [0x260E] = 0xF003A }, -- doens't work
}
\stopluacode
\definefontfeature [phone] [phone=yes]
\definefallbackfamily [mainface] [serif] [MarVoSym] [range=0x260E,
features=phone] \definefontfamily [mainface] [serif] [TeX Gyre
Pagella] \setupbodyfont [mainface]
\starttext
substitution: \utfchar{"260E} %% black telephone
\blank direct:
\resolvedglyphdirect {name:marvosym}{n:Mobilefone} %% works
\stoptext
%% glyph name and slot taken from
%%
%% \usemodule [fnt-10]
%% \starttext
%% \ShowCompleteFont{name:marvosym}{10pt}{1}
%% \stoptext
> ... anyway, glyph names should normally work (given that they are
> sane ones, because in context we strip some)
The question is how to input the name in the Lua code (here:
“Mobilefone”). And it seems like substitutions don't work beyond
0xFFFF.
Marco
___________________________________________________________________________________
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] 5+ messages in thread
* Re: Addressing glyphs in Lua
2018-10-10 6:46 ` Marco Patzer
@ 2018-10-10 8:26 ` Hans Hagen
2018-10-10 8:56 ` Marco Patzer
0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2018-10-10 8:26 UTC (permalink / raw)
To: mailing list for ConTeXt users, Marco Patzer
On 10/10/2018 8:46 AM, Marco Patzer wrote:
> On Tue, 9 Oct 2018 23:36:32 +0200
> Hans Hagen <j.hagen@xs4all.nl> wrote:
>
>> On 10/9/2018 10:40 PM, Marco Patzer wrote:
>>> Hi!
>>>
>>> I have two questions regarding addressing glyphs in Lua:
>>>
>>> 1) How to address glyphs in slots as e.g. U+F0029?
>>> 2) How to address glyphs by name?
>>>
>>> Use:
>>>
>>> \startluacode
>>> fonts.handlers.otf.addfeature {
>>> name = "foo",
>>> type = "substitution",
>>> data = { [0xF0029] = 0xF0030 }, -- ← doesn't work
>>> }
>>> \stopluacode
>> this is a mnwe .. make a mwe with at least a font
>
> Sorry, here it is:
>
> \startluacode
> fonts.handlers.otf.addfeature {
> name = "phone",
> type = "substitution",
> data = { [0x260E] = 0xF003A }, -- doens't work
> }
> \stopluacode
>
> \definefontfeature [phone] [phone=yes]
>
> \definefallbackfamily [mainface] [serif] [MarVoSym] [range=0x260E,
> features=phone] \definefontfamily [mainface] [serif] [TeX Gyre
> Pagella] \setupbodyfont [mainface]
>
> \starttext
> substitution: \utfchar{"260E} %% black telephone
> \blank direct:
> \resolvedglyphdirect {name:marvosym}{n:Mobilefone} %% works
> \stoptext
>
> %% glyph name and slot taken from
> %%
> %% \usemodule [fnt-10]
> %% \starttext
> %% \ShowCompleteFont{name:marvosym}{10pt}{1}
> %% \stoptext
>
>> ... anyway, glyph names should normally work (given that they are
>> sane ones, because in context we strip some)
>
> The question is how to input the name in the Lua code (here:
> “Mobilefone”). And it seems like substitutions don't work beyond
> 0xFFFF.
(1) use glyph names, so Telefon here
(2) enable node mode
(3) force a nocheck
(in a next beta i'll also support the P<original private> lookup for
feature extensions)
\startluacode
fonts.handlers.otf.addfeature {
name = "phone",
type = "substitution",
nocheck = true,
data = { [0x260E] = "Telefon" },
}
\stopluacode
\definefontfeature [phone] [mode=node,phone=yes]
\definefallbackfamily [mainface] [serif] [MarVoSym] [range=0x260E,
features=phone]
\definefontfamily [mainface] [serif] [TeX Gyre Pagella]
\setupbodyfont [mainface]
\starttext
substitution: \utfchar{"260E} %% black telephone
\blank direct:
\resolvedglyphdirect {name:marvosym}{n:Mobilefone} %% works
\resolvedglyphdirect {name:marvosym}{n:PF003A} %% works
\resolvedglyphdirect {name:marvosym}{n:Telefon} %% works
\stoptext
-----------------------------------------------------------------
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] 5+ messages in thread
* Re: Addressing glyphs in Lua
2018-10-10 8:26 ` Hans Hagen
@ 2018-10-10 8:56 ` Marco Patzer
0 siblings, 0 replies; 5+ messages in thread
From: Marco Patzer @ 2018-10-10 8:56 UTC (permalink / raw)
To: Hans Hagen; +Cc: mailing list for ConTeXt users
On Wed, 10 Oct 2018 10:26:14 +0200
Hans Hagen <j.hagen@xs4all.nl> wrote:
> On 10/10/2018 8:46 AM, Marco Patzer wrote:
> > On Tue, 9 Oct 2018 23:36:32 +0200
> > Hans Hagen <j.hagen@xs4all.nl> wrote:
> >
> >> On 10/9/2018 10:40 PM, Marco Patzer wrote:
> >>> Hi!
> >>>
> >>> I have two questions regarding addressing glyphs in Lua:
> >>>
> >>> 1) How to address glyphs in slots as e.g. U+F0029?
> >>> 2) How to address glyphs by name?
> >>>
> >>> Use:
> >>>
> >>> \startluacode
> >>> fonts.handlers.otf.addfeature {
> >>> name = "foo",
> >>> type = "substitution",
> >>> data = { [0xF0029] = 0xF0030 }, -- ← doesn't work
> >>> }
> >>> \stopluacode
> >> this is a mnwe .. make a mwe with at least a font
> >
> > Sorry, here it is:
> >
> > \startluacode
> > fonts.handlers.otf.addfeature {
> > name = "phone",
> > type = "substitution",
> > data = { [0x260E] = 0xF003A }, -- doens't work
> > }
> > \stopluacode
> >
> > \definefontfeature [phone] [phone=yes]
> >
> > \definefallbackfamily [mainface] [serif] [MarVoSym] [range=0x260E,
> > features=phone] \definefontfamily [mainface] [serif] [TeX Gyre
> > Pagella] \setupbodyfont [mainface]
> >
> > \starttext
> > substitution: \utfchar{"260E} %% black telephone
> > \blank direct:
> > \resolvedglyphdirect {name:marvosym}{n:Mobilefone} %% works
> > \stoptext
> >
> > %% glyph name and slot taken from
> > %%
> > %% \usemodule [fnt-10]
> > %% \starttext
> > %% \ShowCompleteFont{name:marvosym}{10pt}{1}
> > %% \stoptext
> >
> >> ... anyway, glyph names should normally work (given that they are
> >> sane ones, because in context we strip some)
> >
> > The question is how to input the name in the Lua code (here:
> > “Mobilefone”). And it seems like substitutions don't work beyond
> > 0xFFFF.
> (1) use glyph names, so Telefon here
> (2) enable node mode
> (3) force a nocheck
>
> (in a next beta i'll also support the P<original private> lookup for
> feature extensions)
>
> \startluacode
> fonts.handlers.otf.addfeature {
> name = "phone",
> type = "substitution",
> nocheck = true,
> data = { [0x260E] = "Telefon" },
> }
> \stopluacode
>
> \definefontfeature [phone] [mode=node,phone=yes]
>
> \definefallbackfamily [mainface] [serif] [MarVoSym] [range=0x260E,
> features=phone]
> \definefontfamily [mainface] [serif] [TeX Gyre Pagella]
> \setupbodyfont [mainface]
>
> \starttext
> substitution: \utfchar{"260E} %% black
> telephone \blank direct:
> \resolvedglyphdirect {name:marvosym}{n:Mobilefone} %% works
> \resolvedglyphdirect {name:marvosym}{n:PF003A} %% works
> \resolvedglyphdirect {name:marvosym}{n:Telefon} %% works
> \stoptext
Thanks, that works.
Marco
___________________________________________________________________________________
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] 5+ messages in thread
end of thread, other threads:[~2018-10-10 8:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 20:40 Addressing glyphs in Lua Marco Patzer
2018-10-09 21:36 ` Hans Hagen
2018-10-10 6:46 ` Marco Patzer
2018-10-10 8:26 ` Hans Hagen
2018-10-10 8:56 ` Marco Patzer
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).