Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

crash upon IVS (TL2016) #357

Closed
dohyunkim opened this issue May 6, 2016 · 6 comments
Closed

crash upon IVS (TL2016) #357

dohyunkim opened this issue May 6, 2016 · 6 comments

Comments

@dohyunkim
Copy link

With luaotfload v2.7-fix-2, compiling an example which contains IVS (Ideographic Variation Sequence) gives me an error.

\input luaotfload.sty
\font\jpfont=ipaexm.ttf at 10pt
\jpfont
\char"5307
\char"5307\char"E0100
\char"5307\char"E0101
\bye

The error message is

error: ...xmf-dist/tex/luatex/luaotfload/fontloader-2016-05-04.lua:19524: attempt to compare number with nil
@phi-gamma
Copy link
Member

The error message is

error: ...xmf-dist/tex/luatex/luaotfload/fontloader-2016-05-04.lua:19524: attempt to compare number with nil

Thanks for the report. That’s inside code that the generic loader
does not (anymore) share with Context.

@dohyunkim
Copy link
Author

For the record.
After my private e-mail to Hans, he changed the code in font-gbn.lua, in my view, too aggressively.
My intention was:

diff --git a/font-gbn.lua.orig b/font-gbn.lua
index daa072b..b6df93c 100644
--- a/font-gbn.lua.orig
+++ b/font-gbn.lua
@@ -126,11 +126,11 @@ function nodes.handlers.nodepass(head)
                             local variant = hash[getchar(p)]
                             if variant then
                                 setchar(p,variant)
-                                if not redundant then
-                                    redundant = { n }
-                                else
-                                    redundant[#redundant+1] = n
-                                end
+                            end
+                            if not redundant then
+                                redundant = { n }
+                            else
+                                redundant[#redundant+1] = n
                             end
                         end
                     end

whereas the changes made by Hans is:

diff --git a/font-gbn.lua.orig b/../Downloads/font-gbn.lua
index daa072b..a02406b 100644
--- a/font-gbn.lua.orig
+++ b/../Downloads/font-gbn.lua
@@ -126,17 +126,19 @@ function nodes.handlers.nodepass(head)
                             local variant = hash[getchar(p)]
                             if variant then
                                 setchar(p,variant)
-                                if not redundant then
-                                    redundant = { n }
-                                else
-                                    redundant[#redundant+1] = n
-                                end
                             end
                         end
                     end
+                    -- per generic user request we always remove selectors
+                    if not redundant then
+                        redundant = { n }
+                    else
+                        redundant[#redundant+1] = n
+                    end
                 end
             end
         end

This aggressiveness would be no problem, until we happen to encounter in the future an abnormal font which uses Variation Selectors in OpenType feature processing. As far as I know from my experience, however, there exists no such font. So I think it would not be bad to wait until someone reports an issue regarding the disappearance of Variation Selectors.

@phi-gamma
Copy link
Member

···<date: 2016-05-07, Saturday>···<from: Dohyun Kim>···

After my private e-mail to Hans, he changed the code in
font-gbn.lua, in my view, too aggressively.

This aggressiveness would be no problem, until we happen to
encounter in the future an abnormal font which uses Variation
Selectors in OpenType feature processing. As far as I know from
my experience, however, there exists no such font. So I think it
would not be bad to wait until someone reports an issue regarding
the disappearance of Variation Selectors.

Agreed. Let’s just hope that font isn’t going to be a proprietary
one. As soon as we have a valid counterexample we can revisit the
matter.

Best,
Philipp

phi-gamma added a commit to phi-gamma/luaotfload that referenced this issue May 9, 2016
Fixes lualatex#349 and lualatex#357.

Also the new AFM code is due, let’s see what else we need to use it.
@aminophen
Copy link

As soon as we have a valid counterexample we can revisit the matter.

I'm also having trouble with IVS feature, and

we can use SourceHanSans-Regular.otf, which is freely available. My MWE:

\input luaotfload.sty
\font\jpfont=SourceHanSans-Regular.otf at 10pt
\jpfont
\char"5307
\char"5307\char"E0100
\char"5307\char"E0101
\bye
error: ...xmf-dist/tex/luatex/luaotfload/fontloader-2016-05-04.lua:19524: attempt to compare number with nil
.
\bye ->\par 
            \vfill \supereject \end 
l.7 \bye

@khaledhosny
Copy link

until we happen to encounter in the future an abnormal font which uses Variation Selectors in OpenType feature processing.

Many (may be most) Mongolian fonts handle variation selectors using GSUB substitutions instead of special cmap tables.

@dohyunkim
Copy link
Author

Current issue does not affect Mongolian variation selectors (U+180x);
only standard variation selectors (U+FE0x) and Ideographic variation selectors (U+E01xx) are affected.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants