Skip to content
This repository has been archived by the owner. It is now read-only.

conflict of \fontname (auto_font_shape fails with TTC fonts) #57

Closed
dohyunkim opened this issue May 10, 2013 · 9 comments
Closed

conflict of \fontname (auto_font_shape fails with TTC fonts) #57

dohyunkim opened this issue May 10, 2013 · 9 comments

Comments

@dohyunkim
Copy link

@dohyunkim dohyunkim commented May 10, 2013

see wspr/fontspec#152

So, how about patching fontdata.name like this:

luatexbase.add_to_callback("luaotfload.patch_font",
function(fontdata)
fontdata.name = fontdata.fullname or fontdata.psname or fontdata.name
end,
"luaotfload.tex_fontname_patch")

@phi-gamma
Copy link
Member

@phi-gamma phi-gamma commented May 10, 2013

This would patch all fonts regardless of their type which has been the cause of trouble in the past. Here is my proposal: phi-gamma@ce418e1 Can you test it? I don‘t have a Mac, nor the Optima font, nor do I understand the fontspec code, so I won’t be much of help here.

@dohyunkim
Copy link
Author

@dohyunkim dohyunkim commented May 11, 2013

Then, how about this one?

luatexbase.add_to_callback("luaotfload.patch_font",
function(fontdata)
fontdata.name = (
fontdata.shared
and fontdata.shared.rawdata
and fontdata.shared.rawdata.metadata
and fontdata.shared.rawdata.metadata.origname
) or fontdata.name
end,
"luaotfload.tex_fontname_patch")

@phi-gamma
Copy link
Member

@phi-gamma phi-gamma commented May 11, 2013

I’ve added it like this: ff293e5 in the compatibility callback.

@dohyunkim
Copy link
Author

@dohyunkim dohyunkim commented May 11, 2013

Works well now. Thanks a lot.

@phi-gamma phi-gamma closed this May 11, 2013
@dohyunkim
Copy link
Author

@dohyunkim dohyunkim commented May 14, 2013

\documentclass{article}
\usepackage{fontspec}
\setmainfont[AutoFakeSlant]{Optima}
\begin{document}
\textsl{slanted}normal
\end{document}

This tex source breaks the process with error:

! LuaTeX error ./luaotfload-merged.lua:2972: bad argument #2 to 'find_file' (invalid option 'ttc(0)').

So please revert the "fontdata.name" for the time being. We need more digging into this issue.

@phi-gamma
Copy link
Member

@phi-gamma phi-gamma commented May 14, 2013

@dohyunkim as you have more experience with TTC subfonts, do you happen to know what is the maximum number of subfonts permitted?

@dohyunkim
Copy link
Author

@dohyunkim dohyunkim commented May 14, 2013

@phi-gamma I don't know whether there is any limit to the number of subfonts. On my Mac, "Avenir Next Condensed.ttc" has twelve subfonts, that is from 0 to 11.

@khaledhosny
Copy link

@khaledhosny khaledhosny commented May 14, 2013

The numFonts field of the TTC header is a 32 bit unsigned integer.

@phi-gamma
Copy link
Member

@phi-gamma phi-gamma commented May 14, 2013

Thanks @dohyunkim, @khaledhosny. I’ve added a less strict test for subfonts.

eroux added a commit that referenced this issue May 14, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants