ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Bug with complex contextual opentype feature
@ 2014-07-18 10:03 Georg Duffner
  2014-07-18 12:17 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Georg Duffner @ 2014-07-18 10:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 2738 bytes --]

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

[-- Attachment #2: Screenshot.png --]
[-- Type: image/png, Size: 34737 bytes --]

[-- Attachment #3: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug with complex contextual opentype feature
  2014-07-18 10:03 Bug with complex contextual opentype feature Georg Duffner
@ 2014-07-18 12:17 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2014-07-18 12:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-18 12:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-18 10:03 Bug with complex contextual opentype feature Georg Duffner
2014-07-18 12:17 ` Hans Hagen

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).