In luaotfload we can slant, extend or embolden a whole font by writing something like \font\x="xxx.otf:+slant=a;+extend=b;+embolden=c" at d pt. But what can I do when I would like to apply such changes only to one character or a range of characters?
Example: Let's get a slanted ∑ (\sum) as under the following link:
How do I get a slanted \sum symbol?
MWE:
\input luaotfload.sty
\font\mathfont="latinmodern-math.otf:mode=base;script=math;slant=.25" at 60 pt
\textfont1=\mathfont
\Umathcode∑="1"1∑ \let\sum=∑
$∑ab$% How to apply the slant only to the sum?
\bye
As mentioned this will slant the whole math font. What has to be done so that the slant is only applied to the \sum?
If yes, can this be written as a new OTF feature as in this question?:
How to manipulate selected letters in LuaTeX?
Edit: I found out that I can add PDF commands to tfmdata.characters[...].commands but it does not work as expected. The width of the glyph ist set to 0 (overprinting) and the spacing in the following paragraphs is wrong. What is happening here?
How to write the comamnds properly? Please help me.
MWE 2:
\input luaotfload.sty
\directlua{
local function slantedsum(tfmdata)
tfmdata.characters[8721].commands = {
{'pdf', 'origin', 'q 1.04 0 .2 1 0 0 cm'},
{'char', 8721},
{'pdf', 'origin', 'Q'},
}
end
fonts.constructors.features.otf.register{
name = 'ssum',
description = 'Slant sum symbol',
manipulators = {
base = slantedsum,
},
}
}
\font\mathfont="latinmodern-math.otf:mode=base;script=math;+ssum" at 10 pt
\textfont1=\mathfont
\font\1="lmroman10-regular.otf" at 10 pt
\1
\Umathcode∑="1"1∑ \let\sum=∑
abcd
$∑ab$% How to apply the slant only to the sum?
abcd
abcd
\bye
