Re: [NTG-context] italic correction after math

2018-02-14 Thread Hans Hagen

On 2/14/2018 5:30 PM, Alan Braslau wrote:

On Wed, 14 Feb 2018 10:12:22 +0100
Ulrike Fischer  wrote:


⟂ U+27C2 \perp, for example. This is a "show-stopper" for me.


Works ok for me on latex + windows:

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Cambria Math}
\begin{document}\pagestyle{empty}
$ 27c2 blblb $
\end{document}

(the document only uses cambria.ttc, so the glyph must be from this
font).

The context code

\setupbodyfont[cambria]
\starttext
$\perp $
abc
\stoptext

works fine for me too.


As Hans points out, \perp is U+22A5 (UP TACK), not U+27C2
(PERPENDICULAR), and might differ (in weight) from U+2225 (PARALLEL) or
\parallel, although this may depend on the particular font design.
(UP/DOWN/RIGHT/LEFT TACK are a set)

Is the definition used in char-ent.lua the right choice?
char-ent.lua:["perp"] = "⊥", -- U+022A5

Perhaps the latex package unicode-math makes the substitution for you.

(Note that dejavu has U+27C2.)

MWE:

\setupbodyfont [cambria,20pt]
%\setupbodyfont [dejavu,20pt]
\startTEXpage
$⊥⟂∥$
\stopTEXpage
its no big deal to have some backup btu i don't want to cycle through 
preferences every few years so deal with it once (best in combination 
with other such things)


-
  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
___

Re: [NTG-context] italic correction after math

2018-02-14 Thread Alan Braslau
On Wed, 14 Feb 2018 10:12:22 +0100
Ulrike Fischer  wrote:

> > ⟂ U+27C2 \perp, for example. This is a "show-stopper" for me.  
> 
> Works ok for me on latex + windows:
> 
> \documentclass{article}
> \usepackage{unicode-math}
> \setmathfont{Cambria Math}
> \begin{document}\pagestyle{empty}
> $ 27c2 blblb $
> \end{document}
> 
> (the document only uses cambria.ttc, so the glyph must be from this
> font).
> 
> The context code
> 
> \setupbodyfont[cambria]
> \starttext
> $\perp $
> abc
> \stoptext
> 
> works fine for me too. 

As Hans points out, \perp is U+22A5 (UP TACK), not U+27C2
(PERPENDICULAR), and might differ (in weight) from U+2225 (PARALLEL) or
\parallel, although this may depend on the particular font design.
(UP/DOWN/RIGHT/LEFT TACK are a set)

Is the definition used in char-ent.lua the right choice?
char-ent.lua:["perp"] = "⊥", -- U+022A5

Perhaps the latex package unicode-math makes the substitution for you.

(Note that dejavu has U+27C2.)

MWE:

\setupbodyfont [cambria,20pt]
%\setupbodyfont [dejavu,20pt]
\startTEXpage
$⊥⟂∥$
\stopTEXpage

Alan
___
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
___

Re: [NTG-context] italic correction after math

2018-02-14 Thread Hans Hagen

On 2/14/2018 2:21 PM, Ulrike Fischer wrote:

Am Wed, 14 Feb 2018 10:34:49 +0100 schrieb Hans Hagen:


Looks good. And for the record: \strut works the other way round and
suppress the kern.


Yes, because a zwj is a real character and can be used to fool the mechanism


A bit to real ;-(. I get a sort of sign post (a rule with a x on
top) with cambria:

\setupbodyfont[cambria]
\starttext
$\cal{P}$x

$\cal{P}\Uchar"200D$x
\stoptext

then try \Uchar"200B, a zero width space char

-
  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
___

Re: [NTG-context] italic correction after math

2018-02-14 Thread Ulrike Fischer
Am Wed, 14 Feb 2018 10:34:49 +0100 schrieb Hans Hagen:

>> Looks good. And for the record: \strut works the other way round and
>> suppress the kern.
> 
> Yes, because a zwj is a real character and can be used to fool the mechanism

A bit to real ;-(. I get a sort of sign post (a rule with a x on
top) with cambria:

\setupbodyfont[cambria]
\starttext
$\cal{P}$x

$\cal{P}\Uchar"200D$x
\stoptext


-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/

___
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
___

Re: [NTG-context] italic correction after math

2018-02-14 Thread Hans Hagen

On 2/14/2018 10:22 AM, Ulrike Fischer wrote:

Am Tue, 13 Feb 2018 19:21:21 +0100 schrieb Hans Hagen:



But xits is in this case not lying about the italic. The cal-P has a
large overhang and one would like to take this somehow into account.


well, how should math (or whatever) know what comes after it ...


I wasn't looking for a completly automatic solution. Only something
that lets me retrieve the correct kern and insert it (or suppress it
if needed)


these things are always tricky and e.g. math-text boundaries can be
obscured by for instance boxing and so ... sometimes lua offers a way 
out but even then there are limits



only when it binds with a character

..

maybe inserting a zerowidthjoiner character helps

$  \Uchar"200D$


Looks good. And for the record: \strut works the other way round and
suppress the kern.


Yes, because a zwj is a real character and can be used to fool the mechanism


Btw: I found in the luatex manuel the options
 \mathoption nocharitalic 1
but it seems to do nothing (the example in the manual show imho
identical output).



these flags are just for testing (the mathoption ones will go away
eventually which is why we use \mathoption) .. there are other
\math*mode etc parameters


It would be good to mention this in the manual. It is rather
confusing to see examples that claim to show the effect of some
setting and then do nothing.
actually there can be an effect but one that is effectively zero: it can 
be that a italic kern is injected and then removed as in traditional ... 
these effects really depend on the font and character properties


(in a similar fashion an example exposing some property and 
demonstrating some trick can fail when a font gets updated)


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
___

Re: [NTG-context] italic correction after math

2018-02-14 Thread Ulrike Fischer
Am Tue, 13 Feb 2018 19:21:21 +0100 schrieb Hans Hagen:


>> But xits is in this case not lying about the italic. The cal-P has a
>> large overhang and one would like to take this somehow into account.
> 
> well, how should math (or whatever) know what comes after it ...

I wasn't looking for a completly automatic solution. Only something
that lets me retrieve the correct kern and insert it (or suppress it
if needed) 

> only when it binds with a character
..
> maybe inserting a zerowidthjoiner character helps
> 
> $  \Uchar"200D$

Looks good. And for the record: \strut works the other way round and
suppress the kern. 


>> Btw: I found in the luatex manuel the options
>> \mathoption nocharitalic 1
>> but it seems to do nothing (the example in the manual show imho
>> identical output).

> these flags are just for testing (the mathoption ones will go away 
> eventually which is why we use \mathoption) .. there are other 
> \math*mode etc parameters

It would be good to mention this in the manual. It is rather
confusing to see examples that claim to show the effect of some
setting and then do nothing.


-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/

___
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
___

Re: [NTG-context] italic correction after math

2018-02-14 Thread Ulrike Fischer
Am Tue, 13 Feb 2018 20:58:52 -0700 schrieb Alan Braslau:

>>> Cambria is missing math characters...
>> really? which ones (that the others do have .. afaik gyre have some
>> less than cambria)
> 
> ⟂ U+27C2 \perp, for example. This is a "show-stopper" for me.

Works ok for me on latex + windows:

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Cambria Math}
\begin{document}\pagestyle{empty}
$ 27c2 blblb $
\end{document}

(the document only uses cambria.ttc, so the glyph must be from this
font).

The context code

\setupbodyfont[cambria]
\starttext
$\perp $
abc
\stoptext

works fine for me too. 

-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/

___
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
___

Re: [NTG-context] italic correction after math

2018-02-13 Thread Alan Braslau
On Wed, 14 Feb 2018 00:13:16 +0100
Hans Hagen  wrote:

> > Cambria is missing math characters...
> really? which ones (that the others do have .. afaik gyre have some
> less than cambria)

⟂ U+27C2 \perp, for example. This is a "show-stopper" for me.

It does NOT get reported by \enabletrackers [fonts.missing] and a "?"
appears in the pdf.

Alan
___
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
___

Re: [NTG-context] italic correction after math

2018-02-13 Thread Hans Hagen

On 2/13/2018 10:41 PM, Alan Braslau wrote:

On Tue, 13 Feb 2018 16:26:10 +0100
Hans Hagen  wrote:


(so in practice for serious math i only use cambria or lucida)


Cambria is missing math characters...
really? which ones (that the others do have .. afaik gyre have some less 
than cambria)



-
  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
___

Re: [NTG-context] italic correction after math

2018-02-13 Thread Alan Braslau
On Tue, 13 Feb 2018 16:26:10 +0100
Hans Hagen  wrote:

> (so in practice for serious math i only use cambria or lucida)

Cambria is missing math characters...
___
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
___

Re: [NTG-context] italic correction after math

2018-02-13 Thread Hans Hagen

On 2/13/2018 6:51 PM, Ulrike Fischer wrote:

Am Tue, 13 Feb 2018 16:26:10 +0100 schrieb Hans Hagen:



basically it boils down to fonts being bad: traditional tex fonts cheat
about the width for italics and have lots or corrections that get always
added as a starter and removed in some cases (heuristics); opentype on
the other hand has proper widths and only applies italics in some cases


But xits is in this case not lying about the italic. The cal-P has a
large overhang and one would like to take this somehow into account.


well, how should math (or whatever) know what comes after it ... in 
fact, italic correction should be clever enough to decide if what comes 
after it is also italic



Actually the italic is taken into account *inside* math.
This here inserts \kern1.52 after the "F0151 and \kern2.45 after the
"1D4AB (the math.italic values of these glyphs):


only when it binds with a character


\tracingoutput1 \showboxbreadth\maxdimen \showboxdepth\maxdimen
\input luaotfload.sty

\font\xits={file:xits-math.otf} at 10pt
\textfont0=\xits
$\Umathchar"7"0"F0151 \Umathchar"7"0"1D4AB \Umathchar"7"0"78 $
\bye

The problem is the boundary between math and text. There seem to be
no way to insert automatically or manually the kern if the \cal P
(\Umathchar"7"0"1D4AB) is the last char in the math.


maybe inserting a zerowidthjoiner character helps

$  \Uchar"200D$


Btw: I found in the luatex manuel the options
\mathoption nocharitalic 1
but it seems to do nothing (the example in the manual show imho
identical output).
these flags are just for testing (the mathoption ones will go away 
eventually which is why we use \mathoption) .. there are other 
\math*mode etc parameters


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
___

Re: [NTG-context] italic correction after math

2018-02-13 Thread Ulrike Fischer
Am Tue, 13 Feb 2018 16:26:10 +0100 schrieb Hans Hagen:


> basically it boils down to fonts being bad: traditional tex fonts cheat 
> about the width for italics and have lots or corrections that get always 
> added as a starter and removed in some cases (heuristics); opentype on 
> the other hand has proper widths and only applies italics in some cases 

But xits is in this case not lying about the italic. The cal-P has a
large overhang and one would like to take this somehow into account.

Actually the italic is taken into account *inside* math.
This here inserts \kern1.52 after the "F0151 and \kern2.45 after the
"1D4AB (the math.italic values of these glyphs): 

\tracingoutput1 \showboxbreadth\maxdimen \showboxdepth\maxdimen
\input luaotfload.sty

\font\xits={file:xits-math.otf} at 10pt
\textfont0=\xits
$\Umathchar"7"0"F0151 \Umathchar"7"0"1D4AB \Umathchar"7"0"78 $
\bye

The problem is the boundary between math and text. There seem to be
no way to insert automatically or manually the kern if the \cal P
(\Umathchar"7"0"1D4AB) is the last char in the math.


Btw: I found in the luatex manuel the options 
   \mathoption nocharitalic 1
but it seems to do nothing (the example in the manual show imho
identical output).

-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/

___
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
___

Re: [NTG-context] italic correction after math

2018-02-13 Thread Hans Hagen

On 2/13/2018 4:11 PM, Ulrike Fischer wrote:

Am Tue, 13 Feb 2018 15:44:20 +0100 schrieb Hans Hagen:


hm, seems that i messed up a pointer ... i'll fix it ...


Thanks.

Will the fix be in the generic font loader or in some context-only
files? In the second case, what could be done for latex in such
cases?


no it's rather context specific (not related to the font handler) but 
you can try this:


\definefontfeature[mathextra][collapseitalics=yes]

basically it boils down to fonts being bad: traditional tex fonts cheat 
about the width for italics and have lots or corrections that get always 
added as a starter and removed in some cases (heuristics); opentype on 
the other hand has proper widths and only applies italics in some cases 
(we have some options in the engine to be a bit more tolerant, see 
manual) ... unfortunately only cambria and lucida are right and most 
other tex related fonts are kind of bad (hopefully that gets fixed, 
which is why in the meantime context has all kind of hacks dealing with 
this, which then of course need to be removed when a font gets fixed)


(so in practice for serious math i only use cambria or lucida)


(xetex inserts a kern of 2.45pt after the math in latex).


context inserts 2.938pt

Is this value glyph and font dependant? (the glyph has a
"math.italic" value of 245 so I thought that xetex gets it from
there).
if a font doesn't has it it can be guessed .. i don't know what xetex 
does (mkii supports it but i never really used xetex myself and i 
haven't used pdftex in a decade)


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
___

Re: [NTG-context] italic correction after math

2018-02-13 Thread Ulrike Fischer
Am Tue, 13 Feb 2018 15:44:20 +0100 schrieb Hans Hagen:

> hm, seems that i messed up a pointer ... i'll fix it ...

Thanks. 

Will the fix be in the generic font loader or in some context-only
files? In the second case, what could be done for latex in such
cases?

> (xetex inserts a kern of 2.45pt after the math in latex).

context inserts 2.938pt

Is this value glyph and font dependant? (the glyph has a
"math.italic" value of 245 so I thought that xetex gets it from
there).
 
-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/

___
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
___

Re: [NTG-context] italic correction after math

2018-02-13 Thread Hans Hagen

On 2/13/2018 12:12 PM, Ulrike Fischer wrote:

In the following example the calligraphic P bumps into the following
x.

After some searching in the archive I found some discussions from
2012 and had the impression that this either shouldn't happen or
that the behaviour could at least could be changed with
\setupmathematics[italics=n].

But in my examples \setupmathematics[italics=...] doesn't do
anything. Every line looks looks identical to me (the second example
is from the header of xits-math.lfg). Is this behaviour expected? If
yes, what should one do to get an italic correction is such cases?


\setupbodyfont[xits]

\starttext
x${\cal P}$x\par
\setupmathematics[italics=1]x${\cal P}$x\par
\setupmathematics[italics=2]x${\cal P}$x\par
\setupmathematics[italics=3]x${\cal P}$x\par
\setupmathematics[italics=4]x${\cal P}$x\par

\stoptext

\setupbodyfont[xits]
\starttext
test $a;b;a; b; f;$ test\par
  \setupmathematics[italics=1] test $a;b;a; b; f;$ test\par
%fontitalics
  \setupmathematics[italics=2] test $a;b;a; b; f;$ test\par
% fontdata
  \setupmathematics[italics=3] test $a;b;a; b; f;$ test\par
% quad based
  \setupmathematics[italics=4] test $a;b;a; b; f;$ test\par
% combination of 1 and 3

\stoptext


hm, seems that i messed up a pointer ... i'll fix it ...


(xetex inserts a kern of 2.45pt after the math in latex).


context inserts 2.938pt

(luatex uses the opentype route so it might be different than xetex and 
pdftex)


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
___

[NTG-context] italic correction after math

2018-02-13 Thread Ulrike Fischer
In the following example the calligraphic P bumps into the following
x.

After some searching in the archive I found some discussions from
2012 and had the impression that this either shouldn't happen or
that the behaviour could at least could be changed with
\setupmathematics[italics=n]. 

But in my examples \setupmathematics[italics=...] doesn't do
anything. Every line looks looks identical to me (the second example
is from the header of xits-math.lfg). Is this behaviour expected? If
yes, what should one do to get an italic correction is such cases?


\setupbodyfont[xits]

\starttext
x${\cal P}$x\par
\setupmathematics[italics=1]x${\cal P}$x\par
\setupmathematics[italics=2]x${\cal P}$x\par
\setupmathematics[italics=3]x${\cal P}$x\par
\setupmathematics[italics=4]x${\cal P}$x\par

\stoptext

\setupbodyfont[xits]
\starttext
test $a;b;a; b; f;$ test\par
 \setupmathematics[italics=1] test $a;b;a; b; f;$ test\par
%fontitalics
 \setupmathematics[italics=2] test $a;b;a; b; f;$ test\par 
% fontdata
 \setupmathematics[italics=3] test $a;b;a; b; f;$ test\par 
% quad based
 \setupmathematics[italics=4] test $a;b;a; b; f;$ test\par 
% combination of 1 and 3

\stoptext

(xetex inserts a kern of 2.45pt after the math in latex).
  
-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/

___
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
___