Bug with complex contextual opentype feature
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*default at 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
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*default at 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 -----------------------------------------------------------------
participants (2)
-
Georg Duffner
-
Hans Hagen