我最近刚买了 PF Goudy Pro Initials 字体,正在 LaTeX 上试用。这种字体是一种分层首字母字体,其中同一个字符的六个迭代,排版在六个不同的“面”(实际上是层),可以堆叠在一起形成一个漂亮的首字母。
文档字体有更多关于此过程如何运作的信息。
我用了\llap
“堆叠”这些字形,它对我尝试过的每个字符(所有拉丁字母 AZ,以及几个希腊字母和西里尔字母)都表现出色除了拉丁字母 C 和西里尔字母 С。在这种情况下,不仅第五层和第六层未对齐,而且这些字形旁边的字符也存在对齐问题。
这些对齐问题显然与有关\llap
,但我不知道为什么特别与 C 及其同形文字有关。
我首先想到的自然是字体本身存在缺陷。然而,当我在 Adobe Illustrator 和 Adobe InDesign 中“堆叠”C 的图层时,结果非常完美,所有图层都按预期对齐。因此,问题似乎不在于字符缺陷。
我的 MWE 如下(我重命名了字体,这样我可以更容易地调用它们;原生名称不是 PFX):
\documentclass[12pt]{article}
\usepackage{fontspec}
\newfontface\firstlayer{PF1.otf}[Scale=10]
\newfontface\secondlayer{PF2.otf}[Scale=10]
\newfontface\thirdlayer{PF3.otf}[Scale=10]
\newfontface\fourthlayer{PF4.otf}[Scale=10]
\newfontface\fifthlayer{PF5.otf}[Scale=10]
\newfontface\sixthlayer{PF6.otf}[Scale=10]
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\newlength\tindent
\setlength{\tindent}{\parindent}
\setlength{\parindent}{0pt}
\renewcommand{\indent}{\hspace*{\tindent}}
\newcommand{\initialmaker}[1]{\firstlayer{#1}\llap{\textcolor{Goldenrod}{\secondlayer{#1}}}\llap{\textcolor{blue}{\thirdlayer{#1}}}\llap{\textcolor{Goldenrod}{\fourthlayer{#1}}}\llap{\textcolor{Goldenrod}{\fifthlayer{#1}}}\llap{\textcolor{Goldenrod}{\sixthlayer{#1}}}}
\begin{document}
\initialmaker{C}
\initialmaker{ABCBA}
\initialmaker{DEF}
\end{document}
答案1
这不是一个答案,而是一个信息(对于评论来说太长),它可能帮助没有字体的人看到发生了什么。
这是示例的简化版,采用了可怕的色彩方案,以便每一层都显示得清晰可见:第四层和第六层未对齐。
\RequirePackage{luatex85}
\documentclass{standalone}
\usepackage{xcolor,fontspec}
\newfontface\firstlayer{PFGoudyInitialsPro-Layer1.otf}[Color=darkgray]
\newfontface\secondlayer{PFGoudyInitialsPro-Layer2.otf}[Color=cyan]
\newfontface\thirdlayer{PFGoudyInitialsPro-Layer3.otf}[Color=green]
\newfontface\fourthlayer{PFGoudyInitialsPro-Layer4.otf}[Color=red]
\newfontface\fifthlayer{PFGoudyInitialsPro-Layer5.otf}[Color=brown]
\newfontface\sixthlayer{PFGoudyInitialsPro-Layer6.otf}[Color=yellow]
\newcommand{\initialmaker}[1]{%
\firstlayer{#1}%
\llap{\secondlayer{#1}}%
\llap{\thirdlayer{#1}}%
\llap{\fourthlayer{#1}}%
\llap{\fifthlayer{#1}}%
\llap{\sixthlayer{#1}}%
}
\begin{document}
\fontsize{132}{0}\selectfont
\initialmaker{C}
\end{document}
我不知道如何解释缓存中的信息,但它在Dropbox。
增加 egreg
\documentclass{article}
\usepackage{xcolor,fontspec}
\newfontface\firstlayer{PFGoudyInitialsPro-Layer1.otf}[Color=gray]
\newfontface\secondlayer{PFGoudyInitialsPro-Layer2.otf}[Color=cyan]
\newfontface\thirdlayer{PFGoudyInitialsPro-Layer3.otf}[Color=green]
\newfontface\fourthlayer{PFGoudyInitialsPro-Layer4.otf}[Color=red]
\newfontface\fifthlayer{PFGoudyInitialsPro-Layer5.otf}[Color=brown]
\newfontface\sixthlayer{PFGoudyInitialsPro-Layer6.otf}[Color=orange]
% egreg’s code at https://tex.stackexchange.com/a/57860:
\makeatletter
\def\showboxes#1{%
\begingroup\fboxrule=.1pt \fboxsep=-\fboxrule
\@showboxes#1\@showboxes\@empty
\endgroup}
\def\@showboxes#1#2{%
\ifx#2\@showboxes
\fbox{\color{gray}#1}\expandafter\@gobble
\else
\setbox0=\hbox{#1\kern0pt#2}\setbox2=\hbox{#1#2}%
\dimen0=\wd0 \advance\dimen0 -\wd2
\fbox{\color{gray}#1}\kern-\dimen0
\expandafter\@showboxes
\fi#2}
\begin{document}
\fontsize{132}{0}\selectfont
\firstlayer\showboxes{C}
\secondlayer\showboxes{C}
\thirdlayer\showboxes{C}
\fourthlayer\showboxes{C}
\fifthlayer\showboxes{C}
\sixthlayer\showboxes{C}
\end{document}
为真正想要使用此字体的人提供修复
这个错误可以手动修复,就像这样,但可能有比反复试验和目测更智能的解决方案:
\RequirePackage{luatex85}
\documentclass{standalone}
\usepackage{xcolor,fontspec}
\newfontface\firstlayer{PFGoudyInitialsPro-Layer1.otf}[Color=darkgray]
\newfontface\secondlayer{PFGoudyInitialsPro-Layer2.otf}[Color=cyan]
\newfontface\thirdlayer{PFGoudyInitialsPro-Layer3.otf}[Color=green]
\newfontface\fourthlayer{PFGoudyInitialsPro-Layer4.otf}[Color=red]
\newfontface\fifthlayer{PFGoudyInitialsPro-Layer5.otf}[Color=brown]
\newfontface\sixthlayer{PFGoudyInitialsPro-Layer6.otf}[Color=yellow]
\newcommand{\Cinit}[1]{%
\firstlayer{#1}%
\llap{\secondlayer{#1}}%
\llap{\thirdlayer{#1}}%
\llap{\fourthlayer{#1}\hspace*{6.5pt}}% seems right at 132 points
\llap{\fifthlayer{#1}}%
\llap{\sixthlayer{#1}\hspace*{6.5pt}}%
}
\newcommand{\initialmaker}[1]{%
\firstlayer{#1}%
\llap{\secondlayer{#1}}%
\llap{\thirdlayer{#1}}%
\llap{\fourthlayer{#1}}%
\llap{\fifthlayer{#1}}%
\llap{\sixthlayer{#1}}%
}
\begin{document}
\fontsize{132}{0}\selectfont
\initialmaker{A}\Cinit{C}\initialmaker{T}
\end{document}