使用 Zallman Caps 以装饰性首字下沉字体添加重音字符

使用 Zallman Caps 以装饰性首字下沉字体添加重音字符

我想使用 Zallman Caps 和 lettrine 包来实现装饰性首字下沉。但是 Zallman Caps 并没有我感兴趣的所有字符。特别是,当第一个字符不可用时,我想在第一个字符的上方和下方放置重音符号。我尝试过使用预组合的 unicode 字符以及使用组合变音符号,但到目前为止,这两种方法都没有奏效。

这是我的代码:

\documentclass[11pt]{article}
\usepackage{fontspec,lettrine}

\newfontfamily\zallman[Scale=4.2]{ZallmanCaps}
\renewcommand*{\LettrineFont}{\zallman}
\begin{document}

\lettrine[lines=3]{S}ecunderabad popularly known as the twin city of Hyderabad is located in the Indian state of Telangana. Named after Sikandar Jah, the third Nizam of the Asaf Jahi dynasty, Secunderabad was founded in 1806 as a British cantonment.

\lettrine[lines=3]{Ś}ecunderabad popularly known as the twin city of Hyderabad is located in the Indian state of Telangana. Named after Sikandar Jah, the third Nizam of the Asaf Jahi dynasty, Secunderabad was founded in 1806 as a British cantonment.

\lettrine[lines=3]{\'{S}}ecunderabad popularly known as the twin city of Hyderabad is located in the Indian state of Telangana. Named after Sikandar Jah, the third Nizam of the Asaf Jahi dynasty, Secunderabad was founded in 1806 as a British cantonment.
\end{document}

这是我得到的输出:

在此处输入图片描述

而我希望得到类似这样的结果:

在此处输入图片描述

有没有办法使用乳胶中的位置黑客来实现这一点,或者是否有我可以使用的其他装饰字体来实现这一点?

答案1

如果你愿意购买字体,有些网站会让你搜索特定字符的存在(例如,myfonts.com)。但您不会发现很多包含 Ś 的装饰性首字母组合。

如果您有带组合锐音符的字体,那就没问题了。下面是免费字体 Eadui 的示例。

\documentclass[12pt,a5paper]{book}
\usepackage{fontspec,lettrine,xcolor}
\newfontface\eadui{Eadui}[
  Color=2F6D83]
\newfontface\eaduifill{Eadui Fill}[
  Color=CFC598]
\renewcommand{\LettrineFontHook}{\eadui}
\setcounter{DefaultLines}{3}
\renewcommand{\DefaultLoversize}{.15}
\begin{document}
% type S followed by U+0301, the combining acute accent
\lettrine{Ś\llap{\eaduifill S}}{ecunderabad} popularly known as
the twin city of Hyderabad is located in the Indian state of
Telangana. Named after Sikandar Jah, the third Nizam of the Asaf Jahi
dynasty, Secunderabad was founded in 1806 as a British cantonment.
\end{document}

输出

这不是适合您段落主题的字体,但它说明了技巧。

使用 ZallmanCaps,您可以调用newunicodechar,但您必须手动进行一些调整,因为拉丁现代尖音符没有落在 ZallmanCaps 的正确位置:

\documentclass[12pt,a5paper]{book}
\usepackage{fontspec,lettrine,newunicodechar}
\newunicodechar{́}{{\normalfont ́}}
\newfontface\zallman{ZallmanCaps}
\renewcommand{\LettrineFontHook}{\zallman}
\setcounter{DefaultLines}{3}
\renewcommand{\DefaultLoversize}{.15}
\begin{document}
% type S followed by U+0301, the combining acute accent
\lettrine{Ś}{ecunderabad} popularly known as the twin city of
Hyderabad is located in the Indian state of Telangana. Named after
Sikandar Jah, the third Nizam of the Asaf Jahi dynasty, Secunderabad
was founded in 1806 as a British cantonment.

\lettrine[findent=.6em]{S\hspace{-.175em}\raisebox{.7ex}{́}}{ecunderabad}
popularly known as the twin city of Hyderabad is located in the Indian
state of Telangana. Named after Sikandar Jah, the third Nizam of the
Asaf Jahi dynasty, Secunderabad was founded in 1806 as a British
cantonment.
\end{document}

输出

请注意,\lettrine有两个参数;仅使用一个参数就是为什么字母后的第一个字母会变成小写的原因。顺便说一句,尽管这种方法需要进行调整,但可以pdftotext正确地从 PDF 中提取 Ś。

答案2

在这里,我堆叠了一个包含口音再现的框。我引入了\accentletter[\accentbox]{letter}完成任务的方法,用户可以在其中创建各种\accentbox口音来满足自己的需求。

我使用了\smash我的\accentbox定义以免干扰行距,但这是一个由用户喜好决定的选择。

\documentclass[11pt]{article}
\usepackage{fontspec,lettrine,stackengine}

\newfontfamily\zallman[Scale=4.2]{ZallmanCaps}
\renewcommand*{\LettrineFont}{\zallman}
\newsavebox\primebox
\savebox\primebox{\smash{\scalebox{3}[1]{$\prime$}}}
\newsavebox\circbox
\savebox\circbox{\smash{\scalebox{1.3}[1.3]{$\circ$}}}
\newcommand\accentletter[2][\primebox]{\stackon[1pt]{#2}{\usebox{#1}}}
\begin{document}

\lettrine[lines=3]{S}{ecunderabad} popularly known as the twin city of Hyderabad is located in the Indian state of Telangana. Named after Sikandar Jah, the third Nizam of the Asaf Jahi dynasty, Secunderabad was founded in 1806 as a British cantonment.

\lettrine[lines=3]{\accentletter{S}}{ecunderabad} popularly known as the twin city of Hyderabad is located in the Indian state of Telangana. Named after Sikandar Jah, the third Nizam of the Asaf Jahi dynasty, Secunderabad was founded in 1806 as a British cantonment.

\lettrine[lines=3]{\accentletter[\circbox]{A}}{lso} Secunderabad popularly known as the twin city of Hyderabad is located in the Indian state of Telangana. Named after Sikandar Jah, the third Nizam of the Asaf Jahi dynasty, Secunderabad was founded in 1806 as a British cantonment.
\end{document}

在此处输入图片描述

答案3

Zallman Caps 以 type1 字体的形式作为 TeX Live 的一部分安装。没有.sty文件,但用于 LaTeX 的支持文件都在那里,而且很.sty容易编写。

这是我使用 pdfLaTeX 编译的版本:

\documentclass[11pt]{article}
\begin{filecontents}{Zallman.sty}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{Zallman}[2007/11/24 v1.0 Zallman CFR]

\input Zallman.fd

\DeclareRobustCommand{\Zallmanfamily}{%
        \fontencoding{U}%
        \fontseries{xl}%
        \fontshape{n}%
        \fontfamily{Zallman}%
        \selectfont}
\DeclareTextFontCommand{\zall}{\Zallmanfamily}

\endinput
%% end Zallman.sty
\end{filecontents}
\usepackage[utf8]{inputenc}
\usepackage{lettrine,Zallman}


\renewcommand{\LettrineFontHook}{\Zallmanfamily}
\begin{document}

  \lettrine[lines=3]{S}{ecunderabad} popularly known as the twin city of Hyderabad is located in the Indian state of Telangana. Named after Sikandar Jah, the third Nizam of the Asaf Jahi dynasty, Secunderabad was founded in 1806 as a British cantonment.

  \lettrine[lines=3]{Ś}{ecunderabad} popularly known as the twin city of Hyderabad is located in the Indian state of Telangana. Named after Sikandar Jah, the third Nizam of the Asaf Jahi dynasty, Secunderabad was founded in 1806 as a British cantonment.

  \lettrine[lines=3]{\'{S}}{ecunderabad} popularly known as the twin city of Hyderabad is located in the Indian state of Telangana. Named after Sikandar Jah, the third Nizam of the Asaf Jahi dynasty, Secunderabad was founded in 1806 as a British cantonment.
\end{document}

扎尔曼带口音

请注意,包上的文件日期是正确的 -.sty当我学习如何为 (pdf)LaTeX 进行字体安装时,我为 TeX Live 提供的装饰首字母编写了文件。

相关内容