Re: [NTG-context] issue with optical bounds (OpenType)

2018-12-10 Thread Pablo Rodriguez
On 12/10/18 10:51 AM, Hans Hagen wrote:
> On 12/9/2018 8:54 PM, Pablo Rodriguez wrote:
>> []
>> My own vectors wouldn’t solve the issue, because the variable would be:
>>
>> lfbd(Ὧ) = glyph.width(Ω) - glyph.width(Ὧ)
>>
>> I need to place glyphs accurately, not characters. Character dimensions
>> wouldn’t help to get hanging diacritics.
> 
> well, these dimensions are available so one could use them in 
> constructing additional lfbd feature specifications (add f eatures 
> runtime)

Many thanks for your reply, Hans.

In order to modify the fonts, it would be helpful to have a function
that can substract two glyph widths of a given font, such as:

function document.hanging_diacritics(char_one, char_two)
return (char_one.glyphwidth - char_two.glyphwidth)
end

I don’t have any idea about how to do it. This way I don’t have to
calculate the value for each glyph feature and I can simply add the
values to the font.

BTW, what kind of specifications you think can be constructed for the
lfbd feature (sorry, but I don’t get it).

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___
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] Spurious missing character reports

2018-12-10 Thread Hans Hagen

On 12/9/2018 10:35 PM, Rik Kabel wrote:

List,

I have one document that after the 2018-11-18 update (beginning with 
12-01 and continuing to the current 12-07) has generated hundreds of 
spurious missing character messages in the log. A short extract:


fonts   > start missing characters: 
C:/ConTeXt/tex/texmf/fonts/opentype/public/antt/AntykwaTorunskaCond-Regular.otf

fonts   >   72  U+00021  !  EXCLAMATION MARK
fonts   >  948  U+00022  "  QUOTATION MARK
fonts   > 1302  U+00026  &  AMPERSAND
fonts   > 345318  U+0002B  +  PLUS SIGN
fonts   >  216  U+00030  0  DIGIT ZERO
fonts   > 54270  U+00031  1  DIGIT ONE
fonts   > 28590  U+00036  6  DIGIT SIX
fonts   >  414  U+0003C  <  LESS-THAN SIGN
fonts   > 116712  U+00040  @  COMMERCIAL AT
fonts   > 1980  U+00042  B  LATIN CAPITAL LETTER B
fonts   > 373878  U+00046  F  LATIN CAPITAL LETTER F
fonts   >   48  U+00048  H  LATIN CAPITAL LETTER H
fonts   > 3282  U+00049  I  LATIN CAPITAL LETTER I
fonts   >   36  U+0004A  J  LATIN CAPITAL LETTER J
fonts   > 1560  U+0004B  K  LATIN CAPITAL LETTER K
fonts   >   12  U+0004C  L  LATIN CAPITAL LETTER L
fonts   > 3810  U+0004E  N  LATIN CAPITAL LETTER N
fonts   > 3402  U+00057  W  LATIN CAPITAL LETTER W
fonts   >   48  U+0005A  Z  LATIN CAPITAL LETTER Z
fonts   > 64206  U+0005B  [  LEFT SQUARE BRACKET
fonts   > 3420  U+00062  b  LATIN SMALL LETTER B
fonts   > 3888  U+00063  c  LATIN SMALL LETTER C
fonts   > 2880  U+00069  i  LATIN SMALL LETTER I
fonts   > 1284  U+0006B  k  LATIN SMALL LETTER K
fonts   >  336  U+00070  p  LATIN SMALL LETTER P
fonts   > 2118  U+0007B  {  LEFT CURLY BRACKET
fonts   >  258  U+0007C  |  VERTICAL LINE
fonts   >   12  U+0007E  ~  TILDE

fonts   > stop missing characters

There are similar reports for the other fonts used in the document 
(Antykwa Torunska is used for heads, EBGaramond with Libertinus fallback 
for the body).


I have pared down the files to the following example which demonstrates 
the problem. I do not understand now all the features interact to cause 
this, but the reports disappear upon removing any (such as the 
seemingly-redundant \definebodyfontenvironment or the 
\switchtobodyfont[small]).


\enabletrackers
   [fonts.missing]

\definebodyfontenvironment
   [11pt]
   [a=1]

\definefontfallback
   [fb:ebgr]
   [file:libertinusserif-regular]
   [0x204A]

\starttypescript   [serif] [ebgaramond]
 \definefontsynonym [Serif]
[file:ebgaramond-regular]
[fallbacks=fb:ebgr]
\stoptypescript

\define\Test{¡Missing!}

\setupbodyfont
   [ebgaramond,11pt]
\setupbodyfont
   [libertinus,11pt]

\starttext

\dorecurse{6}{
  \switchtobodyfont[small]
   \Test\par}

\stoptext

While the messages appear to be incorrect, there is no apparent problem 
associated with them. I do not know if they point to some problem I have 
not recognized, or are truly spurious. (And I can eliminate them by 
turning off the tracker when I am sure that I have the needed coverage 
in the fallbacks.)


Of course, if I am doing something wrong I would like to correct it.
It's ok ... the tracker just kicks in a checker in an early stage ... 
there is no need to use the tracker as you will get a report anyway when 
something is missing.


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] modifying kerning breaks opentype ligatures (and other features)

2018-12-10 Thread Hans Hagen

On 12/10/2018 6:16 PM, mf wrote:

yes, the ligature would not get the same shrinkage or stretch of the 
rest, but i don't modify the kerning that much (factor=.02 is the 
maximum value). It's still acceptable.
ok, then don't use this characterkerning but use expansion (hz) ... you 
can do that extreme (larg evalues) if needed (after all, big publishers 
do that too)


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] Drops Module

2018-12-10 Thread Aditya Mahajan

Hi Peter,

I noticed that the drops module recently stopping running with the error:

/home/adityam/texmf/tex/context/third/drops/t-drops.lua:1098: bad argument 
#3 to 'format' (number has no integer representation)

stack traceback:
[C]: in function 'string.format'
/home/adityam/texmf/tex/context/third/drops/t-drops.lua:1098: in 
upvalue 'get_IM_paths'
/home/adityam/texmf/tex/context/third/drops/t-drops.lua:1380: in field 
'shadow'

[ctxlua]:1: in main chunk

This is due to the change in Lua5.3 with respect to floating point 
numbers. The simplest solution is to change '%d' to '%.0f' at appropriate 
places.


Thanks,
Aditya
___
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] modifying kerning breaks opentype ligatures (and other features)

2018-12-10 Thread mf
character kerning is bad anyway ... 


I'm using it to get a paragraph one line shorter or longer, or to tune 
what in TeX is set with \parfillskip.


I'm using ConTeXt with a mindset developed on other typesetting 
softwares. That's not right, i know, but for now i'm finding easier to 
work with character kerning than with \looseness, \parfillskip and 
\emergencystretch.


\looseness=-1 quite never reduces the lines' number, because the 
inter-word spaces are already very well optimized.


\looseness=1 quite always produces a short last line, so that i often 
work on \emergencystretch and \parfillskip to make it wider. But this 
way i have to work on 3 parameters; with kerning you have only one: 
uglier for ligatures but easier.


I suspect TeX has better ways to deal with that problem, but i don't 
know them (hints are welcome).




effe

and this is

e ff e

you definitely don't want to kern like

e kern ff kern ff

but

e kern f kern f kern e

so, ligatures are pretty useless with intercharacter kerning (as per 
definecharacterning) ... just conceptually incomatible


(it is possible to turn it on but it really isnot what you want)

yes, the ligature would not get the same shrinkage or stretch of the 
rest, but i don't modify the kerning that much (factor=.02 is the 
maximum value). It's still acceptable.


But i should consider all the text parts with a modified kerning and 
disable kerning around character sequences like "ff", "ffi", "fl" and so 
on. Luckily, the XHTML markup "knows" where the kerning is modified:


A paragraph with a modified kerning

should become

A paragraph with a modified kerning

Where ... (dk=Disable Kerning) are tags to be inserted 
automatically before feeding the XHTML into ConTeXt.

I'm not very happy or proud about it, but it can be done.
Do you think it can be better done inside ConTeXt?

Massimiliano
___
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] modifying kerning breaks opentype ligatures (and other features)

2018-12-10 Thread Hans Hagen

On 12/10/2018 4:26 PM, mf wrote:

Hello list,
i noticed that setting a different kerning breaks some features of 
opentype fonts; that is true, for example, for ligatures and fractions 
(frac feature).


It looks like a modified kerning inserts something between two adjacent 
character, making them no more adjacent.

That way the lookup of opentype tables fails.

"f", "l"    => "fl" ligature glyph

"f", [kerning], "l" => distinct "f" and "l" glyphs

"1", "/", "4" => "¼" glyph (with "frac" feature switched on)

"1", [kerning], "/", [kerning], "4" => distinct "1", "/", "4" glyphs 
(always with "frac" feature switched on)


MWE:

\definecharacterkerning[narrow][factor=-.015]
\definecharacterkerning[wide][factor=.015]

\definefontfeature[frac][frac=yes]

\starttext
\feature[+][frac]%
Some ligatures: float, finance, affine; a fraction: 1/4.

\setcharacterkerning[narrow]Some ligatures: float, finance, affine; a 
fraction: 1/4.


\setcharacterkerning[wide]Some ligatures: float, finance, affine; a 
fraction: 1/4.


\stoptext

In my XML to PDF workflow, fractions are marked up, so it's easy to 
switch the kerning off only for them.


Instead i have no solution for ligatures: parts of text with a modified 
kerning loose ligatures, and i end up with the same words, once with 
ligatures, once without, even in the same page.

Is there a workaround for this?

character kerning is bad anyway ... say that we have:

effe

and this is

e ff e

you definitely don't want to kern like

e kern ff kern ff

but

e kern f kern f kern e

so, ligatures are pretty useless with intercharacter kerning (as per 
definecharacterning) ... just conceptually incomatible


(it is possible to turn it on but it really isnot what you want)


-
  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] modifying kerning breaks opentype ligatures (and other features)

2018-12-10 Thread mf

An example of local correction, but it's not automatic:

\definecharacterkerning[narrow][factor=-.02]
\definecharacterkerning[wide][factor=.02]

\definefontfeature[frac][frac=yes]

\def\Narrow#1{\bgroup\setcharacterkerning[narrow]#1\egroup}
\def\Wide#1{\bgroup\setcharacterkerning[wide]#1\egroup}
\def\NoKerning#1{\bgroup\resetcharacterkerning #1\egroup}

\starttext

\feature[+][frac]%
Some ligatures: float, finance, affine; a fraction: 1/4.

\blank

Modified kerning:

\Narrow{Some ligatures: float, finance, affine; a fraction: 1/4.}

\Wide{Some ligatures: float, finance, affine; a fraction: 1/4.}

\blank

Same as above, but locally corrected:

\Narrow{Some ligatures: \NoKerning{fl}oat, \NoKerning{fi}nance, 
a\NoKerning{ffi}ne; a fraction: \NoKerning{1/4}.}


\Wide{Some ligatures: \NoKerning{fl}oat, \NoKerning{fi}nance, 
a\NoKerning{ffi}ne; a fraction: \NoKerning{1/4}.}


\stoptext


PS: (errata corrige)



"1", "/", "4" => "¼" glyph (with "frac" feature switched on)



"1", "/", "4" => "smaller 1" glyph moved up, fraction line glyph, 
"smaller 4" glyph moved left and down

___
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] modifying kerning breaks opentype ligatures (and other features)

2018-12-10 Thread mf

Hello list,
i noticed that setting a different kerning breaks some features of 
opentype fonts; that is true, for example, for ligatures and fractions 
(frac feature).


It looks like a modified kerning inserts something between two adjacent 
character, making them no more adjacent.

That way the lookup of opentype tables fails.

"f", "l"=> "fl" ligature glyph

"f", [kerning], "l" => distinct "f" and "l" glyphs

"1", "/", "4" => "¼" glyph (with "frac" feature switched on)

"1", [kerning], "/", [kerning], "4" => distinct "1", "/", "4" glyphs 
(always with "frac" feature switched on)


MWE:

\definecharacterkerning[narrow][factor=-.015]
\definecharacterkerning[wide][factor=.015]

\definefontfeature[frac][frac=yes]

\starttext
\feature[+][frac]%
Some ligatures: float, finance, affine; a fraction: 1/4.

\setcharacterkerning[narrow]Some ligatures: float, finance, affine; a 
fraction: 1/4.


\setcharacterkerning[wide]Some ligatures: float, finance, affine; a 
fraction: 1/4.


\stoptext

In my XML to PDF workflow, fractions are marked up, so it's easy to 
switch the kerning off only for them.


Instead i have no solution for ligatures: parts of text with a modified 
kerning loose ligatures, and i end up with the same words, once with 
ligatures, once without, even in the same page.

Is there a workaround for this?

Massimiliano


___
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] Strange behaviour of TABLE with \currentTABLErow

2018-12-10 Thread Tomas Hala
Hi Wolfgang, 

thank you for your reply. 

The split=repeat -- my fault, sorry. But -- surprisingly -- this mistake
helped me along understanding the problem. I discovered -- if head
and next head are defined -- that the "line number 1" servers for the
opening head at the beginning of a table whereas "line number 2" 
is used for all "next heads" at all pages of the table. 

So the problem is reduced to substracting one or two for only heads
and head+next heads, respectively.

Best wishes,

Tomáš 

P. S.
One possible solution can be e.g.:

\newcount\myrow
\def\currentTABLEbodyrow{\def\takenumber##1{\myrow=##1\advance\myrow-2 
\the\myrow}\takenumber\currentTABLErow}



The number of rows is now determined by the number of all rows
# (including header and footer) and the counting starts also from the first
# row in the table independent of the type of the row.



Mon, Dec 03, 2018 ve 11:14:53PM +0100 Wolfgang Schuster napsal(a):
# Tomas Hala schrieb am 03.12.18 um 20:23:
# >Hi all,
# >
# >at https://wiki.contextgarden.net/Command/currentTABLEcolumn I learnt
# >about \currentTABLErow etc. for counting lines in natural tables.
# >
# >I have got the following two minimal non-working examples (on TeXlive 2018):
# >
# >\starttext\setupTABLE[split=yes]
# >   \bTABLE
# >   \bTABLEhead\bTR\bTH head  \eTH\eTR\eTABLEhead
# >   \bTABLEbody
# > \dorecurse{100}{\bTR\bTD \currentTABLErow xxx \eTD\eTR}
# >   \eTABLEbody
# >   \eTABLE
# >\stoptext
# >
# >In this case, the head-line is alse counted which makes no sense
# >and I do not know how to supress it.
# Even though this is not what you expect it makes sense because when ConTeXt
# creates the table the whole thing is only one huge part which the
# headers for
# the first and the following pages on top and the footer on the bottom.
# 
# The number of rows is now determined by the number of all rows
# (including header and footer) and the counting starts also from the first
# row in the table independent of the type of the row.
# 
# What you want is a counter which removes the header row from the value
# but to keep backwards compatibility this has to be a new command,
# e.g. \currentTABLEbodyrow
# >If I add \bTABLEnext (below), I receive very strange result -- both heads
# >are at the beginning of the table and both counted. Moreover, the "next"
# >head is not used on the following pages.
# >
# >\starttext\setupTABLE[split=yes]
# >   \bTABLE
# >   \bTABLEhead\bTR\bTH head  \eTH\eTR\eTABLEhead
# >   \bTABLEnext\bTR\bTH next head \eTH\eTR\eTABLEnext
# >   \bTABLEbody
# > \dorecurse{100}{\bTR\bTD \currentTABLErow xxx \eTD\eTR}
# >   \eTABLEbody
# >   \eTABLE
# >\stoptext
# >
# >I tried \TC and \TD instead of \TH, also without success.
# >What I am doing wrong?
# You need split=repeat.
# 
# The normal command to create a cell is \bTD, the \bTH command
# is usefull for the header because it changes the font style to bold
# and it also disables the character alignment for the current cell.
# 
# Wolfgang

 Tomáš Hála

Mendelova univerzita, Provozně ekonomická fakulta, ústav informatiky
Zemědělská 1, CZ-613 00 Brno,  tel. +420 545 13 22 28

http://akela.mendelu.cz/~thala
___
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] issue with optical bounds (OpenType)

2018-12-10 Thread Hans Hagen

On 12/9/2018 8:54 PM, Pablo Rodriguez wrote:

On 12/9/18 6:53 PM, Hans Hagen wrote:

On 12/9/2018 5:35 PM, Pablo Rodriguez wrote:

[...]
-Is there any way that I can apply pure raw lfbd/rtbd values to
protrusion with no other protrusion calculation at all in opbd?


you can create your own vectors if you want


My own vectors wouldn’t solve the issue, because the variable would be:

lfbd(Ὧ) = glyph.width(Ω) - glyph.width(Ὧ)

I need to place glyphs accurately, not characters. Character dimensions
wouldn’t help to get hanging diacritics.


well, these dimensions are available so one could use them in 
constructing additional lfbd feature specifications (add f eatures 
runtime)



-In order to avoid editing all the Greek fonts to get hanging
diacritics: is there any way to replicate the lfbd feature with
"fonts.handlers.otf.addfeature"?


probably with some lua magic one can do a lot but these are typical
things i do when i need them (also because one needs to check the whole
of unicode and cook up categories, this kind of stuff is: do it all
robust and well or don't do it; also one doesn't know how consistent
font designs are)


The variable is so simple that the glyph with diacritical marks should
be placed in the beginning of the line as it had no such marks.


the mechanism is more complex: the linebreak algorithm has to take this 
into account (both ends of a potential line) and also look over e.g. par 
starts and so


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
___