Hi,I'm trying to use a metapost based font in combination with a substitution font feature which doesn't work.
As can be seen in the attached test file ligatures work but substitutions fail.
Wolfgang
test.pdf
Description: Adobe PDF document
\startMPcalculation{simplefun}
def TestfontLetterA =
draw unitsquare scaled 7 shifted (1,0) ;
enddef ;
def TestfontLetterKA =
draw unitcircle scaled 7 shifted (1,0) ;
enddef ;
lmt_registerglyphs [
name = "testfont",
units = 9,
width = 7,
height = 7,
depth = 0,
usecolor = true,
] ;
% lmt_registerglyph [ category = "testfont", unicode = "0x0061", code =
"TestfontLetterA" ] ; % metapost font works!
lmt_registerglyph [ category = "testfont", unicode = "0x3042", code =
"TestfontLetterA" ] ;
lmt_registerglyph [ category = "testfont", unicode = "0x304B", code =
"TestfontLetterKA" ] ;
\stopMPcalculation
\startluacode
fonts.handlers.otf.addfeature {
name = "testfont:sub",
type = "substitution",
data = {
[0x0061] = 0x3042,
-- [0x0061] = 0x0041, -- substitution works!
}
}
fonts.handlers.otf.addfeature {
name = "testfont:lig",
type = "ligature",
data = {
[0x304B] = { 0x006B, 0x0061 },
}
}
\stopluacode
\definefontfeature [testfont:sub] [testfont:sub=yes,metapost=testfont]
\definefontfeature [testfont:lig] [testfont:lig=yes,metapost=testfont]
\definefontsynonym [TestFont] [file:notoserifcjkjpregular]
\starttext
{\definedfont[TestFont]a} = {\definedfont[TestFont*testfont:sub]a}
{\definedfont[TestFont]あ} = {\definedfont[TestFont*testfont:sub]あ}
{\definedfont[TestFont]ka} = {\definedfont[TestFont*testfont:lig]ka}
{\definedfont[TestFont]か} = {\definedfont[TestFont*testfont:lig]か}
\stoptext
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
