[NTG-context] Bug with complex contextual opentype feature

2014-07-18 Thread Georg Duffner
Hello All,

I’ve recently been experimenting with contextual features in EB Garamond
and LuaTeX’s output is puzzling. As a showcase, I tried to implement the
famous TeX logos with opentype. This is realized in a feature xtex
with GSUB and GPOS lookup tables for substituting some glyphs and for
positioning them horizontally and vertically:

# OT feature code for TeX logos

lookup xtex_sub1 {
sub X e' T e X by e.xtex2;  # e.xtex2 is a reversed copy of E
sub X e' L a T e X by e.xtex2;
sub L a' T e X by a.sc;
sub T e' X by e.xtex1;  # e.xtex1 is a copy of E
sub L a.sc T e.xtex1 X [two two.lnum two.taboldstyle two.tablining]
e' by e.xtex3;  # e.xtex3 is a copy of epsilon
} xtex_sub1;

lookup xtex_pos1 {
pos X e.xtex2' -130 -180 -320 0 T;
pos X e.xtex2' -130 -180 -200 0 L;
pos X [two two.lnum two.taboldstyle two.tablining] e.xtex3' 0 -180
0 0;
pos L a.sc' -330 210 -490 0 T e.xtex1 X;
pos T e.xtex1' -180 -180 -280 0 X;
}xtex_pos1;

feature xtex {
lookup xtex_sub1;
lookup xtex_pos1;
} xtex;

#

LuaTeX only processes the sequence XeTeX where it substitutes the
first e by e.xtex1 instead of e.xtex2. Then it positions it with
respect to X but not to T. All the other parts of the lookups are
ignored as well. The font file can be downloaded from
http://www.georgduffner.at/ebgaramond/fonts/EBGaramond12-Regular.otf.
The expected output can be seen at the bottom of this page:
http://www.georgduffner.at/ebgaramond/design.html with Firefox and
Chrome/Chromium and in the attached screenshot (from SortsmillEditor).
Like the browsers, XeLaTeX’s output is correct. My LuaTeX and ConTeXt
versions are:

This is LuaTeX, Version beta-0.79.1 (TeX Live 2014/dev) (rev 4972)

ConTeXt  ver: 2014.07.17 13:24 MKIV beta  fmt: 2014.7.17  int:
english/english

% ConTeXt test

\definefontfeature[xtex]   [default][xtex=yes]

\definefontsynonym[ebg][file:EBGaramond12-Regular.otf]

\def\sample{XeTeX LuaLaTeX XeLaTeX TeX LaTeX2e}

\definefontfeature
  [experiment]
  [default]
  [xtex=yes]

\usemodule[fnt-20]
\usemodule[art-01]

\setupbodyfont[dejavu]

\starttext

\startTEXpage
\hbox{{\definedfont[ebg*defaultat 12pt]\sample}
{\definedfont[ebg*default at 12pt]\sample}}\par
\hbox{{\definedfont[ebg*xtex   at 12pt]\sample}
{\definedfont[ebg*default at 12pt]\feature[+][xtex]\sample}}\par
\stopTEXpage


\def\sample{XeTeX LuaLaTeX XeLaTeX TeX LaTeX2e}
\setvariables
  [otftracker]
  [font=file:EBGaramond12-Regular.otf,
   size=24pt,
   features=experiment,
   title=Feature Check,
   sample=\sample]
\stoptext

%

Best regards,
Georg
___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] \head: broken?

2014-07-18 Thread Rob Heusdens
Thanks. I think I could have figured out that one myself. I guess it's my
own head a bit broken atm...
But I should mention that the contextgarden article mentions only one
option for \startitemize, perhaps that is why I got misleaded there.

(http://wiki.contextgarden.net/Command/startitemize)

Greetings,

Rob


 You can’t mix keywords and assignment in the same argument of a
 setup-command, e.g.

 \staritemize[packed,headstyle=bold]

 but some commands have multiple arguments which you use for both types,
 e.g.

 \startitemize[packed][headstyle=bold]

 BTW: A minimal example should be compilable (i.e. you need \starttext and
 \stoptext) which isn’t the case with your example.

 Wolfgang
 ___
 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://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Fonthandling/protrusion question: handling of left margin

2014-07-18 Thread Rob Heusdens
Short question about the font feature protrusion. This handles certain
characters that get shifted into the right margin to make a more visable
straight right margin. But can this font feature also handle left margin?
For example, sentences that start in the left margin and begin with a
quotation, there you would want the same effect also in the left margin.
I currently use \kern-1ex to achieve the same effect for a sentence that
commences on the left margin and starts with a quotation.

Greetings,

Rob

___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Bug with complex contextual opentype feature

2014-07-18 Thread Hans Hagen

On 7/18/2014 12:03 PM, Georg Duffner wrote:

Hello All,

I’ve recently been experimenting with contextual features in EB Garamond
and LuaTeX’s output is puzzling. As a showcase, I tried to implement the
famous TeX logos with opentype. This is realized in a feature xtex
with GSUB and GPOS lookup tables for substituting some glyphs and for
positioning them horizontally and vertically:

# OT feature code for TeX logos

lookup xtex_sub1 {
 sub X e' T e X by e.xtex2;  # e.xtex2 is a reversed copy of E
 sub X e' L a T e X by e.xtex2;
 sub L a' T e X by a.sc;
 sub T e' X by e.xtex1;  # e.xtex1 is a copy of E
 sub L a.sc T e.xtex1 X [two two.lnum two.taboldstyle two.tablining]
e' by e.xtex3;  # e.xtex3 is a copy of epsilon
} xtex_sub1;

lookup xtex_pos1 {
 pos X e.xtex2' -130 -180 -320 0 T;
 pos X e.xtex2' -130 -180 -200 0 L;
 pos X [two two.lnum two.taboldstyle two.tablining] e.xtex3' 0 -180
0 0;
 pos L a.sc' -330 210 -490 0 T e.xtex1 X;
 pos T e.xtex1' -180 -180 -280 0 X;
}xtex_pos1;

feature xtex {
 lookup xtex_sub1;
 lookup xtex_pos1;
} xtex;

#

LuaTeX only processes the sequence XeTeX where it substitutes the
first e by e.xtex1 instead of e.xtex2. Then it positions it with
respect to X but not to T. All the other parts of the lookups are
ignored as well. The font file can be downloaded from
http://www.georgduffner.at/ebgaramond/fonts/EBGaramond12-Regular.otf.
The expected output can be seen at the bottom of this page:
http://www.georgduffner.at/ebgaramond/design.html with Firefox and
Chrome/Chromium and in the attached screenshot (from SortsmillEditor).
Like the browsers, XeLaTeX’s output is correct. My LuaTeX and ConTeXt
versions are:

This is LuaTeX, Version beta-0.79.1 (TeX Live 2014/dev) (rev 4972)

ConTeXt  ver: 2014.07.17 13:24 MKIV beta  fmt: 2014.7.17  int:
english/english

% ConTeXt test

\definefontfeature[xtex]   [default][xtex=yes]

\definefontsynonym[ebg][file:EBGaramond12-Regular.otf]

\def\sample{XeTeX LuaLaTeX XeLaTeX TeX LaTeX2e}

\definefontfeature
   [experiment]
   [default]
   [xtex=yes]

\usemodule[fnt-20]
\usemodule[art-01]

\setupbodyfont[dejavu]

\starttext

\startTEXpage
 \hbox{{\definedfont[ebg*defaultat 12pt]\sample}
{\definedfont[ebg*default at 12pt]\sample}}\par
 \hbox{{\definedfont[ebg*xtex   at 12pt]\sample}
{\definedfont[ebg*default at 12pt]\feature[+][xtex]\sample}}\par
\stopTEXpage


\def\sample{XeTeX LuaLaTeX XeLaTeX TeX LaTeX2e}
\setvariables
   [otftracker]
   [font=file:EBGaramond12-Regular.otf,
size=24pt,
features=experiment,
title=Feature Check,
sample=\sample]
\stoptext

%


fixed

(back and fore were swapped - at some point i merged two handlers as 
there is no conceptual difference between before/current/after and 
fore/names/back apart from some efficiency in the otf file)


thanks for noticing,

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] question about unwanted locations of pagebreaks

2014-07-18 Thread Hans Hagen

On 7/18/2014 1:27 PM, Rob Heusdens wrote:

The very last thing to do when finalizing a multi-page document is
checking where the page breaks occur, and make corrections accordingly, if
the pagebreak occurs at a location you do not want.

Of course, you can take all kind of measures on before hand to avoid 'bad'
places, like avoiding pagebreaks directly after a new section and before
any of the body text, etc. But the degrees of freedom for context to
handle this and to avoid (typographically) 'bad' pagebreak locations are I
suppose limited.

Is there a way (already implemented) in Context in which one can add some
degrees of freedom to avoid bad pagebreak locations. For instance with
elements that can vertically stretch (between some minimum and maximum
value) and can be placed optionally (and which could for instance include
a fancy decoration, like fancybreak module provides)?

(I guess this is also the way in which typesetters in the past dealt with
this problem).


you can play with this (rather old) feature:

\adaptlayout[height=5mm]
\adaptlayout[lines=2]

\adaptlayout[123][height=5mm]
\adaptlayout[5,9,42][lines=2]

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Fonthandling/protrusion question: handling of left margin

2014-07-18 Thread Hans Hagen

On 7/18/2014 1:11 PM, Rob Heusdens wrote:

Short question about the font feature protrusion. This handles certain
characters that get shifted into the right margin to make a more visable
straight right margin. But can this font feature also handle left margin?
For example, sentences that start in the left margin and begin with a
quotation, there you would want the same effect also in the left margin.
I currently use \kern-1ex to achieve the same effect for a sentence that
commences on the left margin and starts with a quotation.


\setupfontprotrusion[mine][vector=quality,right=10,left=40]
\definefontfeature[default][default][protrusion=mine]
\setupalign[hanging]

\showframe

\starttext
\input tufte
\stoptext

... wondering why only the first and last line

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Fonthandling/protrusion question: handling of left margin

2014-07-18 Thread Wolfgang Schuster

Am 18.07.2014 um 14:57 schrieb Hans Hagen pra...@wxs.nl:

 On 7/18/2014 2:52 PM, Wolfgang Schuster wrote:
 
 Am 18.07.2014 um 14:37 schrieb Hans Hagen pra...@wxs.nl:
 
 On 7/18/2014 1:11 PM, Rob Heusdens wrote:
 Short question about the font feature protrusion. This handles certain
 characters that get shifted into the right margin to make a more visable
 straight right margin. But can this font feature also handle left margin?
 For example, sentences that start in the left margin and begin with a
 quotation, there you would want the same effect also in the left margin.
 I currently use \kern-1ex to achieve the same effect for a sentence that
 commences on the left margin and starts with a quotation.
 
 \setupfontprotrusion[mine][vector=quality,right=10,left=40]
 \definefontfeature[default][default][protrusion=mine]
 \setupalign[hanging]
 
 \showframe
 
 \starttext
\input tufte
 \stoptext
 
 ... wondering why only the first and last line
 
 On the first and last line are shifted because you don’t have protrusion 
 values for letters
 at the begin of the other lines as can be seen in this table (from 
 font-ext.lua):
 
 vectors['alpha'] = {
 
 [byte(A)] = { .05, .05 },
 [byte(F)] = {   0, .05 },
 [byte(J)] = { .05,   0 },
 [byte(K)] = {   0, .05 },
 [byte(L)] = {   0, .05 },
 [byte(T)] = { .05, .05 },
 [byte(V)] = { .05, .05 },
 [byte(W)] = { .05, .05 },
 [byte(X)] = { .05, .05 },
 [byte(Y)] = { .05, .05 },
 
 [byte(k)] = {   0, .05 },
 [byte(r)] = {   0, .05 },
 [byte(t)] = {   0, .05 },
 [byte(v)] = { .05, .05 },
 [byte(w)] = { .05, .05 },
 [byte(x)] = { .05, .05 },
 [byte(y)] = { .05, .05 },
 
 }
 
 ah, yes, those tables are probably flushed from my memory by now

BTW, is it intended that protrusion doesn’t work for indented lines?

\setupfontprotrusion[mine][vector=punctuation,left=2]
\definefontfeature[default][default][protrusion=mine]

\setupalign[hanging]

\starttext

“Text”

Text

\blank \setupindenting[yes,medium]

“Text”

Text

\stoptext

Wolfgang
___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Fonthandling/protrusion question: handling of left margin

2014-07-18 Thread Hans Hagen

On 7/18/2014 3:10 PM, Wolfgang Schuster wrote:


Am 18.07.2014 um 14:57 schrieb Hans Hagen pra...@wxs.nl:


On 7/18/2014 2:52 PM, Wolfgang Schuster wrote:


Am 18.07.2014 um 14:37 schrieb Hans Hagen pra...@wxs.nl:


On 7/18/2014 1:11 PM, Rob Heusdens wrote:

Short question about the font feature protrusion. This handles certain
characters that get shifted into the right margin to make a more visable
straight right margin. But can this font feature also handle left margin?
For example, sentences that start in the left margin and begin with a
quotation, there you would want the same effect also in the left margin.
I currently use \kern-1ex to achieve the same effect for a sentence that
commences on the left margin and starts with a quotation.


\setupfontprotrusion[mine][vector=quality,right=10,left=40]
\definefontfeature[default][default][protrusion=mine]
\setupalign[hanging]

\showframe

\starttext
\input tufte
\stoptext

... wondering why only the first and last line


On the first and last line are shifted because you don’t have protrusion values 
for letters
at the begin of the other lines as can be seen in this table (from 
font-ext.lua):

vectors['alpha'] = {

 [byte(A)] = { .05, .05 },
 [byte(F)] = {   0, .05 },
 [byte(J)] = { .05,   0 },
 [byte(K)] = {   0, .05 },
 [byte(L)] = {   0, .05 },
 [byte(T)] = { .05, .05 },
 [byte(V)] = { .05, .05 },
 [byte(W)] = { .05, .05 },
 [byte(X)] = { .05, .05 },
 [byte(Y)] = { .05, .05 },

 [byte(k)] = {   0, .05 },
 [byte(r)] = {   0, .05 },
 [byte(t)] = {   0, .05 },
 [byte(v)] = { .05, .05 },
 [byte(w)] = { .05, .05 },
 [byte(x)] = { .05, .05 },
 [byte(y)] = { .05, .05 },

}


ah, yes, those tables are probably flushed from my memory by now


BTW, is it intended that protrusion doesn’t work for indented lines?

\setupfontprotrusion[mine][vector=punctuation,left=2]
\definefontfeature[default][default][protrusion=mine]

\setupalign[hanging]

\starttext

“Text”

Text

\blank \setupindenting[yes,medium]

“Text”

Text

\stoptext


probably intended (not sure about hanging)

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Fonthandling/protrusion question: handling of left margin

2014-07-18 Thread Jan Tosovsky
On 2014-07-18 Hans Hagen wrote:
 On 7/18/2014 3:10 PM, Wolfgang Schuster wrote:
 
  BTW, is it intended that protrusion doesn't work for indented lines?
 
  \setupfontprotrusion[mine][vector=punctuation,left=2]
  \definefontfeature[default][default][protrusion=mine]
 
  \setupalign[hanging]
 
  \starttext
 
  Text
 
  Text
 
  \blank \setupindenting[yes,medium]
 
  Text
 
  Text
 
  \stoptext
 
 probably intended (not sure about hanging)

I've reported something related some time ago:
http://tracker.luatex.org/view.php?id=884

Jan

___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___