Skip to content
This repository has been archived by the owner on Sep 27, 2019. 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

see latex3/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

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

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

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

@dohyunkim
Copy link
Author

Works well now. Thanks a lot.

@dohyunkim
Copy link
Author

\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

@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

@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

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

@phi-gamma
Copy link
Member

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
Development

No branches or pull requests

3 participants