Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新 macOS 下的字体配置 #36

Closed
stone-zeng opened this issue May 15, 2018 · 13 comments
Closed

更新 macOS 下的字体配置 #36

stone-zeng opened this issue May 15, 2018 · 13 comments
Labels

Comments

@stone-zeng
Copy link
Owner

影响 cjk-font=mac 选项。参考 CTeX-org/ctex-kit#351

@Liam0205
Copy link

没用 CTeX 一套东西?

@zepinglee
Copy link

Pingfang 肯定要改成 Heiti SC 的

@stone-zeng
Copy link
Owner Author

当时的考虑是,模板把 fandol 设为了默认字体,但是 ctex 里面 fontset 作为宏包/文档类选项,会在调用时起作用,所以无论用户是不是修改了字体,fandol 总会调用的。如果用户没有装 fandol,那就没法编译了。而且额外调用字体可能还有一定开销(后来做过 benchmark,但基本可以忽略)。

另一方面,ctex 在不同系统下的处理略有不同,比如 Windows 里中易宋体的粗体就对应了中易黑体,而 macOS 里宋体本身就有粗体形式可以直接用。所以我就直接重定义了 \setmainfont\setCJKmainfont 等命令,让它们只负责处理字体信息,然后在 \begin{document} 的地方实际调入字体。

总感觉另起炉灶有一些画蛇添足,但也没想到更好的办法。

@Liam0205
Copy link

可以预先 fontset=none

@stone-zeng
Copy link
Owner Author

@zepinglee
Copy link

@zepinglee
Copy link

https://github.com/Stone-Zeng/fduthesis/blob/5f946620780fed1e5f7e2da7673d52a6aa5c8923/source/fduthesis.dtx#L3123

STZhongsong 不是 mac 下的默认字体,所以还是用 Songti SC 比较稳妥

stone-zeng added a commit that referenced this issue Jul 23, 2018
@stone-zeng
Copy link
Owner Author

@zepinglee 刚刚改过了(16a1371)。我手头没有 mac,要是可以的话能帮我测试一下效果吗?

@zepinglee
Copy link

看起来没什么问题;还有 xelatex 下 fontspec 只能按照文件名读取 texmf 的字体,比如像 TeX Gyre Termes 这样的字体配置就很麻烦:

\setmainfont[
  Extension      = .otf,
  UprightFont    = *-regular,
  BoldFont       = *-bold,
  ItalicFont     = *-italic,
  BoldItalicFont = *-bolditalic,
]{texgyretermes}

还有整个编译的 workflow 感觉让人很费解,配置了半天才搞定

@stone-zeng
Copy link
Owner Author

TeX Gyre Termes 不是可以直接用吗?你是不是没加空格……

\setmainfont{TeX Gyre Termes}

另外其实我是给了安装脚本的,但 master 里面的没有更新,有几个文件忘记放进来了,大概率是跑不起来的;phys 分支里面是好的,但一直没来得及合并。

@zepinglee
Copy link

fontspec 宏包 1.2 节讲 loading fonts by file name:

This technique is also necessary in XeTeX when loading OpenType fonts that are present within your TeX distribution, such as /usr/local/texlive/2013/texmf-dist/fonts/opentype/public. Fonts in such locations are visible to XeTeX but cannot be loaded by font name, only file name; LuaTeX does not have this restriction.

可能你是把这些字体配置到系统字体了吧?

@stone-zeng
Copy link
Owner Author

Windows 和 Linux 下都是用 fontconfig 机制调用字体的,可能有缓存之后就可以用字体名了(我并没有放到系统里面)。怀疑是 macOS 下面机制不一样,总之还是改掉更合适一些。

@zepinglee
Copy link

原来如此,Mac 系统提供了字体配置:Font Book,所以是没有 fontconfig;但是通常系统的字体配置不会读到 texmf 的路径(除非手动配置)

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

No branches or pull requests

3 participants