* Change kerning between math characters (prime and left parenthesis) @ 2017-06-02 8:59 Mikael P. Sundqvist 2017-06-02 9:39 ` Mathias Schickel 2017-06-02 14:24 ` Hans Hagen 0 siblings, 2 replies; 8+ messages in thread From: Mikael P. Sundqvist @ 2017-06-02 8:59 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1: Type: text/plain, Size: 1315 bytes --] Hi! Now that the bug with primes is fixed in ConTeXt, I wonder if there is a way to change the kerning between certain characters in mathematics (in case one is not happy with the output from the font)? After reading in fonts-mkiv.pdf this is what I came up with: \startluacode fonts.handlers.otf.addfeature { name = "kerntest", type = "kern", data = { [0x61] = { [0x62] = -150 }, -- a and b in text [0x1d44e] = { [0x1d44f] = -150 }, -- mathematical italic small a and b [0x02032] = { [0x00028] = -150 }, -- prime and left parenthesis } } \stopluacode \definefontfeature[kerntest][kerntest=yes] \definefontfamily[lucidaopentype][rm][Lucida Bright OT] \definefontfamily[lucidaopentype][mm][Lucida Bright Math OT] \setupbodyfont[lucidaopentype,10pt] \startTEXpage[offset=3pt] abba $abba f'(x)$ \addff{kerntest} abba $abba f'(x)$ I prefer $f'\mkern-3mu(x)$ \stopTEXpage The output is attached as a png file. As you see the kerning works as expected in text mode, but not at all in math mode, even not for the a and b (which I hope I entered correctly). Something like the third line is what I'm after, but not having to use \mkern in all places. Is it possible? /Mikael PS: This is a cross post of the question https://tex.stackexchange.com/q/372857/52406, where I got the suggestion to ask on the list. [-- Attachment #2: ctx-example20.png --] [-- Type: image/png, Size: 40825 bytes --] [-- Attachment #3: Type: text/plain, Size: 492 bytes --] ___________________________________________________________________________________ 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] 8+ messages in thread
* Re: Change kerning between math characters (prime and left parenthesis) 2017-06-02 8:59 Change kerning between math characters (prime and left parenthesis) Mikael P. Sundqvist @ 2017-06-02 9:39 ` Mathias Schickel 2017-06-02 11:39 ` Mikael P. Sundqvist 2017-06-02 14:24 ` Hans Hagen 1 sibling, 1 reply; 8+ messages in thread From: Mathias Schickel @ 2017-06-02 9:39 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1: Type: text/plain, Size: 701 bytes --] Hi Mikael, math fonts are a bit different from text fonts. This means that you need special methods to influence them. Because I once had a similar concern like you I asked Hans to implement a way to influence kerning in math fonts between certain glyphs. I have attached an lfg-file that shows how to use it. To enable a goodie file like the one attached you have to define your typescript like \starttypescript [\s!math][cambriaown][\s!all] \loadfontgoodies[cambriaown-math] \definefontsynonym[\s!MathRoman] [Cambria-Math] [\s!features={\s!math\mathsizesuffix},\s!designsize=\s!auto,\s!goodies=cambriaown-math] \stoptypescript I hope this helps! Best Mathias [-- Attachment #2: cambriaown-math.lfg --] [-- Type: application/octet-stream, Size: 2061 bytes --] local kern_100 = { bottomright = { { kern = -10000 } } } local kern_150 = { bottomright = { { kern = -15000 } } } local kern_200 = { bottomright = { { kern = -20000 } } } local patches = fonts.handlers.otf.enhancers.patches local function patch(data,filename,threshold) local m = data.metadata.math if m then local d = m.DisplayOperatorMinHeight or 0 if d < threshold then patches.report("DisplayOperatorMinHeight(%s -> %s)",d,threshold) m.DisplayOperatorMinHeight = threshold end end end patches.register("after","analyze math","cambria", function(data,filename) patch(data,filename,2800) end) patches.register("after","analyze math","cambmath",function(data,filename) patch(data,filename,2800) end) -- This is a runtime fix, but then we need to explicitly set -- the goodies parameter for the font. As a demonstration we -- we do both. local function FixDisplayOperatorMinHeight(value,target,original) local o = original.mathparameters.DisplayOperatorMinHeight if o < 2800 then return 2800 * target.parameters.factor else return value -- already scaled end end return { name = "cambriaown-math", version = "1.00", comment = "Goodies that complement Cambria fonts.", author = "Mathias Schickel", copyright = "Mathias Schickel", designsizes = { ["Cambria-Math"] = { ["11pt"] = "file:cambria.ttc(Cambria Math)", default = "file:cambria.ttc(Cambria Math)", }, }, mathematics = { parameters = { DisplayOperatorMinHeight = FixDisplayOperatorMinHeight, }, kerns = { [0x1D449] = kern_200, -- 𝑉 }, kernpairs = { [0x2207] = { -- \nabla [0x1D453] = -200, -- f }, [0x2202] = { -- \partial [0x1D465] = -30, -- x [0x1D466] = -80, -- y }, }, }, } [-- Attachment #3: Type: text/plain, Size: 2084 bytes --] > Am 02.06.2017 um 10:59 schrieb Mikael P. Sundqvist <mickep@gmail.com>: > > Hi! > > Now that the bug with primes is fixed in ConTeXt, I wonder if there is > a way to change the kerning between certain characters in mathematics > (in case one is not happy with the output from the font)? After > reading in fonts-mkiv.pdf this is what I came up with: > > \startluacode > fonts.handlers.otf.addfeature { > name = "kerntest", > type = "kern", > data = { > [0x61] = { [0x62] = -150 }, -- a and b in text > [0x1d44e] = { [0x1d44f] = -150 }, -- mathematical italic small a and b > [0x02032] = { [0x00028] = -150 }, -- prime and left parenthesis > } > } > \stopluacode > > \definefontfeature[kerntest][kerntest=yes] > > \definefontfamily[lucidaopentype][rm][Lucida Bright OT] > \definefontfamily[lucidaopentype][mm][Lucida Bright Math OT] > > \setupbodyfont[lucidaopentype,10pt] > > > \startTEXpage[offset=3pt] > abba $abba f'(x)$ > > \addff{kerntest} > > abba $abba f'(x)$ > > I prefer $f'\mkern-3mu(x)$ > \stopTEXpage > > The output is attached as a png file. As you see the kerning works as > expected in text mode, but not at all in math mode, even not for the a > and b (which I hope I entered correctly). > > Something like the third line is what I'm after, but not having to use > \mkern in all places. Is it possible? > > /Mikael > > PS: This is a cross post of the question > https://tex.stackexchange.com/q/372857/52406, where I got the > suggestion to ask on the list. > <ctx-example20.png>___________________________________________________________________________________ > 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 > ___________________________________________________________________________________ [-- Attachment #4: Type: text/plain, Size: 492 bytes --] ___________________________________________________________________________________ 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] 8+ messages in thread
* Re: Change kerning between math characters (prime and left parenthesis) 2017-06-02 9:39 ` Mathias Schickel @ 2017-06-02 11:39 ` Mikael P. Sundqvist 2017-06-02 12:36 ` Mikael P. Sundqvist 0 siblings, 1 reply; 8+ messages in thread From: Mikael P. Sundqvist @ 2017-06-02 11:39 UTC (permalink / raw) To: mailing list for ConTeXt users On Fri, Jun 2, 2017 at 11:39 AM, Mathias Schickel <msch@fa.uni-tuebingen.de> wrote: > Hi Mikael, > > math fonts are a bit different from text fonts. This means that you need special methods to influence them. Because I once had a similar concern like you I asked Hans to implement a way to influence kerning in math fonts between certain glyphs. I have attached an lfg-file that shows how to use it. > > To enable a goodie file like the one attached you have to define your typescript like > > \starttypescript [\s!math][cambriaown][\s!all] > \loadfontgoodies[cambriaown-math] > \definefontsynonym[\s!MathRoman] [Cambria-Math] [\s!features={\s!math\mathsizesuffix},\s!designsize=\s!auto,\s!goodies=cambriaown-math] > \stoptypescript > > I hope this helps! > > Best > Mathias > > > > > >> Am 02.06.2017 um 10:59 schrieb Mikael P. Sundqvist <mickep@gmail.com>: >> >> Hi! >> >> Now that the bug with primes is fixed in ConTeXt, I wonder if there is >> a way to change the kerning between certain characters in mathematics >> (in case one is not happy with the output from the font)? After >> reading in fonts-mkiv.pdf this is what I came up with: >> >> \startluacode >> fonts.handlers.otf.addfeature { >> name = "kerntest", >> type = "kern", >> data = { >> [0x61] = { [0x62] = -150 }, -- a and b in text >> [0x1d44e] = { [0x1d44f] = -150 }, -- mathematical italic small a and b >> [0x02032] = { [0x00028] = -150 }, -- prime and left parenthesis >> } >> } >> \stopluacode >> >> \definefontfeature[kerntest][kerntest=yes] >> >> \definefontfamily[lucidaopentype][rm][Lucida Bright OT] >> \definefontfamily[lucidaopentype][mm][Lucida Bright Math OT] >> >> \setupbodyfont[lucidaopentype,10pt] >> >> >> \startTEXpage[offset=3pt] >> abba $abba f'(x)$ >> >> \addff{kerntest} >> >> abba $abba f'(x)$ >> >> I prefer $f'\mkern-3mu(x)$ >> \stopTEXpage >> >> The output is attached as a png file. As you see the kerning works as >> expected in text mode, but not at all in math mode, even not for the a >> and b (which I hope I entered correctly). >> >> Something like the third line is what I'm after, but not having to use >> \mkern in all places. Is it possible? >> >> /Mikael >> >> PS: This is a cross post of the question >> https://tex.stackexchange.com/q/372857/52406, where I got the >> suggestion to ask on the list. >> <ctx-example20.png>___________________________________________________________________________________ >> 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 >> ___________________________________________________________________________________ > > > ___________________________________________________________________________________ > 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 > ___________________________________________________________________________________ Thank you very much for your reply, Mathias! I'm not sure I get it, though. I find that there is already a file lucida-opentype-math.lfg in the distribution. Just experimenting, I added to this file an entry with kernpairs (see below), to see if I could make a change with a and b (if I cannot manage that, I don't see how I could get the prime and parenthesis case to work). %%% start of my new lucida-opentype-math.lfg ----- kern_250 = { bottomright = { { kern = -250 } }, force = true } return { name = "lucida-opentype-math", version = "1.00", comment = "Goodies that complement lucida opentype.", author = "Hans Hagen", copyright = "ConTeXt development team", mathematics = { alternates = { italic = { feature = 'ss01', value = 1, comment = "Mathematical Alternative Lowercase Italic" }, arrow = { feature = 'ss02', value = 1, comment = "Mathematical Alternative Smaller Arrows" }, operator = { feature = 'ss03', value = 1, comment = "Mathematical Alternative Smaller Operators" }, calligraphic = { feature = 'ss04', value = 1, comment = "Mathematical Alternative Calligraphic Characters" }, zero = { feature = 'ss05', value = 1, comment = "Mathematical Alternative Zero" }, partial = { feature = 'ss20', value = 1, comment = "Mathematical Alternative Upright Partial Differential" }, }, -- kerns = { -- [0x1D449] = kern_250, -- -- [0x1D44A] = kern_250, -- 𝑊 -- }, kernpairs = { [0x1D44E] = { -- a [0x1D44F] = -200,} -- b }, dimensions = { default = { -- experimental values [0x2044] = { xoffset = 275, width = 600 }, -- [0x2032] = { yoffset = -10 }, }, }, }, } %%% end of lucida-opentype-math.lfg but in the output of \setupbodyfont[lucidaot,10pt] \startTEXpage[offset=3pt] $ab$ \stopTEXpage I see no changes in the spacing between a and b. Any ideas? /Mikael ___________________________________________________________________________________ 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] 8+ messages in thread
* Re: Change kerning between math characters (prime and left parenthesis) 2017-06-02 11:39 ` Mikael P. Sundqvist @ 2017-06-02 12:36 ` Mikael P. Sundqvist 0 siblings, 0 replies; 8+ messages in thread From: Mikael P. Sundqvist @ 2017-06-02 12:36 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1: Type: text/plain, Size: 6804 bytes --] On Fri, Jun 2, 2017 at 1:39 PM, Mikael P. Sundqvist <mickep@gmail.com> wrote: > On Fri, Jun 2, 2017 at 11:39 AM, Mathias Schickel > <msch@fa.uni-tuebingen.de> wrote: >> Hi Mikael, >> >> math fonts are a bit different from text fonts. This means that you need special methods to influence them. Because I once had a similar concern like you I asked Hans to implement a way to influence kerning in math fonts between certain glyphs. I have attached an lfg-file that shows how to use it. >> >> To enable a goodie file like the one attached you have to define your typescript like >> >> \starttypescript [\s!math][cambriaown][\s!all] >> \loadfontgoodies[cambriaown-math] >> \definefontsynonym[\s!MathRoman] [Cambria-Math] [\s!features={\s!math\mathsizesuffix},\s!designsize=\s!auto,\s!goodies=cambriaown-math] >> \stoptypescript >> >> I hope this helps! >> >> Best >> Mathias >> >> >> >> >> >>> Am 02.06.2017 um 10:59 schrieb Mikael P. Sundqvist <mickep@gmail.com>: >>> >>> Hi! >>> >>> Now that the bug with primes is fixed in ConTeXt, I wonder if there is >>> a way to change the kerning between certain characters in mathematics >>> (in case one is not happy with the output from the font)? After >>> reading in fonts-mkiv.pdf this is what I came up with: >>> >>> \startluacode >>> fonts.handlers.otf.addfeature { >>> name = "kerntest", >>> type = "kern", >>> data = { >>> [0x61] = { [0x62] = -150 }, -- a and b in text >>> [0x1d44e] = { [0x1d44f] = -150 }, -- mathematical italic small a and b >>> [0x02032] = { [0x00028] = -150 }, -- prime and left parenthesis >>> } >>> } >>> \stopluacode >>> >>> \definefontfeature[kerntest][kerntest=yes] >>> >>> \definefontfamily[lucidaopentype][rm][Lucida Bright OT] >>> \definefontfamily[lucidaopentype][mm][Lucida Bright Math OT] >>> >>> \setupbodyfont[lucidaopentype,10pt] >>> >>> >>> \startTEXpage[offset=3pt] >>> abba $abba f'(x)$ >>> >>> \addff{kerntest} >>> >>> abba $abba f'(x)$ >>> >>> I prefer $f'\mkern-3mu(x)$ >>> \stopTEXpage >>> >>> The output is attached as a png file. As you see the kerning works as >>> expected in text mode, but not at all in math mode, even not for the a >>> and b (which I hope I entered correctly). >>> >>> Something like the third line is what I'm after, but not having to use >>> \mkern in all places. Is it possible? >>> >>> /Mikael >>> >>> PS: This is a cross post of the question >>> https://tex.stackexchange.com/q/372857/52406, where I got the >>> suggestion to ask on the list. >>> <ctx-example20.png>___________________________________________________________________________________ >>> 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 >>> ___________________________________________________________________________________ >> >> >> ___________________________________________________________________________________ >> 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 >> ___________________________________________________________________________________ > > Thank you very much for your reply, Mathias! > > I'm not sure I get it, though. I find that there is already a file > lucida-opentype-math.lfg in the distribution. > > Just experimenting, I added to this file an entry with kernpairs (see > below), to see if I could make a change with a and b (if I cannot > manage that, I don't see how I could get the prime and parenthesis > case to work). > > %%% start of my new lucida-opentype-math.lfg > ----- kern_250 = { bottomright = { { kern = -250 } }, force = true } > > return { > name = "lucida-opentype-math", > version = "1.00", > comment = "Goodies that complement lucida opentype.", > author = "Hans Hagen", > copyright = "ConTeXt development team", > mathematics = { > alternates = { > italic = { feature = 'ss01', value = 1, comment = > "Mathematical Alternative Lowercase Italic" }, > arrow = { feature = 'ss02', value = 1, comment = > "Mathematical Alternative Smaller Arrows" }, > operator = { feature = 'ss03', value = 1, comment = > "Mathematical Alternative Smaller Operators" }, > calligraphic = { feature = 'ss04', value = 1, comment = > "Mathematical Alternative Calligraphic Characters" }, > zero = { feature = 'ss05', value = 1, comment = > "Mathematical Alternative Zero" }, > partial = { feature = 'ss20', value = 1, comment = > "Mathematical Alternative Upright Partial Differential" }, > }, > -- kerns = { > -- [0x1D449] = kern_250, -- > -- [0x1D44A] = kern_250, -- 𝑊 > -- }, > kernpairs = { > [0x1D44E] = { -- a > [0x1D44F] = -200,} -- b > }, > dimensions = { > default = { -- experimental values > [0x2044] = { xoffset = 275, width = 600 }, > -- [0x2032] = { yoffset = -10 }, > }, > }, > }, > } > %%% end of lucida-opentype-math.lfg > > but in the output of > > \setupbodyfont[lucidaot,10pt] > \startTEXpage[offset=3pt] > $ab$ > \stopTEXpage > > I see no changes in the spacing between a and b. > > Any ideas? > > /Mikael If I change the dimensions tag in the lucida-opentype-math.lfg into dimensions = { default = { -- experimental values [0x2044] = { xoffset = 275, width = 600 }, [0x2032] = { xoffset = 40, width = 290 }, -- prime [0x2033] = { xoffset = 40, width = 690 }, -- double prime [0x2034] = { xoffset = 40, width = 1090 }, -- triple prime [0x2057] = { xoffset = 40, width = 1490 }, -- quadruple prime -- [0x2032] = { yoffset = -10 }, }, I get something that looks better (look at the attached pdf file). But I don't know the side-effects of changing the offset and with of glyphs like that. It might break something at some other place, I guess. Hans, is there a way to work only on the pair between the prime and the parenthesis? /Mikael [-- Attachment #2: ctx-example21.pdf --] [-- Type: application/pdf, Size: 6719 bytes --] [-- Attachment #3: Type: text/plain, Size: 492 bytes --] ___________________________________________________________________________________ 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] 8+ messages in thread
* Re: Change kerning between math characters (prime and left parenthesis) 2017-06-02 8:59 Change kerning between math characters (prime and left parenthesis) Mikael P. Sundqvist 2017-06-02 9:39 ` Mathias Schickel @ 2017-06-02 14:24 ` Hans Hagen 2017-06-02 15:08 ` Mikael P. Sundqvist 1 sibling, 1 reply; 8+ messages in thread From: Hans Hagen @ 2017-06-02 14:24 UTC (permalink / raw) To: ntg-context On 6/2/2017 10:59 AM, Mikael P. Sundqvist wrote: > Hi! > > Now that the bug with primes is fixed in ConTeXt, I wonder if there is > a way to change the kerning between certain characters in mathematics > (in case one is not happy with the output from the font)? After > reading in fonts-mkiv.pdf this is what I came up with: you can also play withj: return { name = "cambria-math", mathematics = { kerns = { [0x1D453] = { force = true, topright = { { kern = 1000, }, }, bottomright = { { kern = 1000, }, }, }, }, }, } currently you need to enable this: \enabledirectives[fontgoodies.mathkerning] keep in mind that some cambria (not all) have such staircase kerns which is why force is needed in order to overload > \startluacode > fonts.handlers.otf.addfeature { > name = "kerntest", > type = "kern", > data = { > [0x61] = { [0x62] = -150 }, -- a and b in text > [0x1d44e] = { [0x1d44f] = -150 }, -- mathematical italic small a and b > [0x02032] = { [0x00028] = -150 }, -- prime and left parenthesis > } > } > \stopluacode > > \definefontfeature[kerntest][kerntest=yes] > > \definefontfamily[lucidaopentype][rm][Lucida Bright OT] > \definefontfamily[lucidaopentype][mm][Lucida Bright Math OT] > > \setupbodyfont[lucidaopentype,10pt] > > > \startTEXpage[offset=3pt] > abba $abba f'(x)$ > > \addff{kerntest} > > abba $abba f'(x)$ > > I prefer $f'\mkern-3mu(x)$ > \stopTEXpage > > The output is attached as a png file. As you see the kerning works as > expected in text mode, but not at all in math mode, even not for the a > and b (which I hope I entered correctly). > > Something like the third line is what I'm after, but not having to use > \mkern in all places. Is it possible? > > /Mikael > > PS: This is a cross post of the question > https://tex.stackexchange.com/q/372857/52406, where I got the > suggestion to ask on the list. > > > > ___________________________________________________________________________________ > 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 > ___________________________________________________________________________________ > -- ----------------------------------------------------------------- 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] 8+ messages in thread
* Re: Change kerning between math characters (prime and left parenthesis) 2017-06-02 14:24 ` Hans Hagen @ 2017-06-02 15:08 ` Mikael P. Sundqvist 2017-06-02 15:56 ` Hans Hagen 0 siblings, 1 reply; 8+ messages in thread From: Mikael P. Sundqvist @ 2017-06-02 15:08 UTC (permalink / raw) To: mailing list for ConTeXt users On Fri, Jun 2, 2017 at 4:24 PM, Hans Hagen <pragma@wxs.nl> wrote: > On 6/2/2017 10:59 AM, Mikael P. Sundqvist wrote: >> >> Hi! >> >> Now that the bug with primes is fixed in ConTeXt, I wonder if there is >> a way to change the kerning between certain characters in mathematics >> (in case one is not happy with the output from the font)? After >> reading in fonts-mkiv.pdf this is what I came up with: > > > you can also play withj: > > return { > name = "cambria-math", > mathematics = { > kerns = { > [0x1D453] = { > force = true, > topright = { > { > kern = 1000, > }, > }, > bottomright = { > { > kern = 1000, > }, > }, > }, > }, > }, > } > > currently you need to enable this: > > \enabledirectives[fontgoodies.mathkerning] > > keep in mind that some cambria (not all) have such staircase kerns which is > why force is needed in order to overload > >> \startluacode >> fonts.handlers.otf.addfeature { >> name = "kerntest", >> type = "kern", >> data = { >> [0x61] = { [0x62] = -150 }, -- a and b in text >> [0x1d44e] = { [0x1d44f] = -150 }, -- mathematical italic small a and b >> [0x02032] = { [0x00028] = -150 }, -- prime and left parenthesis >> } >> } >> \stopluacode >> >> \definefontfeature[kerntest][kerntest=yes] >> >> \definefontfamily[lucidaopentype][rm][Lucida Bright OT] >> \definefontfamily[lucidaopentype][mm][Lucida Bright Math OT] >> >> \setupbodyfont[lucidaopentype,10pt] >> >> >> \startTEXpage[offset=3pt] >> abba $abba f'(x)$ >> >> \addff{kerntest} >> >> abba $abba f'(x)$ >> >> I prefer $f'\mkern-3mu(x)$ >> \stopTEXpage >> >> The output is attached as a png file. As you see the kerning works as >> expected in text mode, but not at all in math mode, even not for the a >> and b (which I hope I entered correctly). >> >> Something like the third line is what I'm after, but not having to use >> \mkern in all places. Is it possible? >> >> /Mikael >> >> PS: This is a cross post of the question >> https://tex.stackexchange.com/q/372857/52406, where I got the >> suggestion to ask on the list. >> >> >> >> >> ___________________________________________________________________________________ >> 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 >> >> ___________________________________________________________________________________ >> > > > -- > > ----------------------------------------------------------------- > 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 > ___________________________________________________________________________________ Thank you Hans, that works. Is there also a similar way to use the "kernpairs" instead of "kerns"? I get no effect, even after adding force = true and \enabledirectives[fontgoodies.mathkerning]. /Mikael ___________________________________________________________________________________ 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] 8+ messages in thread
* Re: Change kerning between math characters (prime and left parenthesis) 2017-06-02 15:08 ` Mikael P. Sundqvist @ 2017-06-02 15:56 ` Hans Hagen 2017-06-02 16:01 ` Mikael P. Sundqvist 0 siblings, 1 reply; 8+ messages in thread From: Hans Hagen @ 2017-06-02 15:56 UTC (permalink / raw) To: ntg-context On 6/2/2017 5:08 PM, Mikael P. Sundqvist wrote: > Is there also a similar way to use the "kernpairs" instead of "kerns"? > I get no effect, even after adding force = true and > \enabledirectives[fontgoodies.mathkerning]. it depends ... math is a tree of noades and not all nodes are a sequence of characters 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] 8+ messages in thread
* Re: Change kerning between math characters (prime and left parenthesis) 2017-06-02 15:56 ` Hans Hagen @ 2017-06-02 16:01 ` Mikael P. Sundqvist 0 siblings, 0 replies; 8+ messages in thread From: Mikael P. Sundqvist @ 2017-06-02 16:01 UTC (permalink / raw) To: mailing list for ConTeXt users On Fri, Jun 2, 2017 at 5:56 PM, Hans Hagen <pragma@wxs.nl> wrote: > On 6/2/2017 5:08 PM, Mikael P. Sundqvist wrote: > >> Is there also a similar way to use the "kernpairs" instead of "kerns"? >> I get no effect, even after adding force = true and >> \enabledirectives[fontgoodies.mathkerning]. > > it depends ... math is a tree of noades and not all nodes are a sequence of > characters > > 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 > ___________________________________________________________________________________ Indeed, it seems that I get it working between a and b but not between ' and ( with the following: kernpairs = { [0x1D44E] = {[0x1D44F] = -200,}, -- a and b [0x2032] = {[0x0028] = -1000, }, -- prime and ( }, together with \setupmathematics[kernpairs=yes] in the file. I guess I will stick with the dimension parameters mentioned earlier for now. It seems to work well in my bigger file. /Mikael ___________________________________________________________________________________ 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] 8+ messages in thread
end of thread, other threads:[~2017-06-02 16:01 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-06-02 8:59 Change kerning between math characters (prime and left parenthesis) Mikael P. Sundqvist 2017-06-02 9:39 ` Mathias Schickel 2017-06-02 11:39 ` Mikael P. Sundqvist 2017-06-02 12:36 ` Mikael P. Sundqvist 2017-06-02 14:24 ` Hans Hagen 2017-06-02 15:08 ` Mikael P. Sundqvist 2017-06-02 15:56 ` Hans Hagen 2017-06-02 16:01 ` Mikael P. Sundqvist
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).