colorlettrine 仅支持少数字符

colorlettrine 仅支持少数字符

我正在尝试使用 colorlettrine 包。我安装了 EB Garamond 包,但很快发现它只支持几个字母。例如,如果我尝试 S,它会出现一个空框。

是否有其他方法可以尝试来实现类似的效果?

有人知道我可以做什么工作来添加更多角色吗?

答案1

欢迎来到 TeX.SE。之所以coloredlettrine与众不同,是因为每个字形都由两部分组成:正面(字母)和背面(装饰)。这为字母着色创造了机会,使其与装饰区分开来。但是,正如您所发现的,只有几个字母可用:A、F、G、L、N、O、Q 和 T。

有不少带有装饰性首字母的字体可用于制作字母。请参阅TUG 字体目录。我使用该GoudyIn包来访问 Goudy Initialen 字体。

lettrine软件包还提供了使用图形作为字母的选项。我使用这种方法来制作一些从网上找到的装饰字母。我很遗憾我没有注明来源。

在此处输入图片描述

% Compile with xelatex or lualatex
% The two EB Garamond Initials fonts must be installed to use \coloredlettrine.
% Graphics with the file names m.jpg, n.jpg and o.jpg, or any 
% other graphic file format must be available to use \lettrine[image...
\documentclass[10pt,a4paper]{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{graphicx}
\usepackage{fontspec}
%https://github.com/raphink/coloredlettrine; also on CTAN
\usepackage{coloredlettrine} %loads [svgnames]{xcolor} and {lettrine}
% Requires 2 fonts:
% EB Garamond Initials Fill1 Regular
% EB Garamond Initials Fill2 Regular
\setmainfont[RawFeature={+ss02,+cv01,+ss05,+dlig},
             ItalicFeatures={RawFeature=+cv04}]{EB Garamond}
\renewcommand{\EBLettrineBackColor}{NavyBlue}
\renewcommand{\EBLettrineFrontColor}{Maroon}

\usepackage{lettrine} 
\usepackage{GoudyIn}
\usepackage[svgnames]{xcolor}

\renewcommand\LettrineFontHook{\color{Maroon}\GoudyInfamily{}}%
\renewcommand{\LettrineTextFont}{}
\newcommand*{\mylettrine}[1]{\lettrine[lines=1,realheight=false,findent=3pt,nindent=0pt]{#1}{}}

\begin{document}

\coloredlettrine[lines=1,realheight=false,findent=3pt,nindent=0pt]{A}{apt}\linebreak
\coloredlettrine[lines=1,realheight=false,findent=3pt,nindent=0pt]{G}{apt}\linebreak
\coloredlettrine[lines=1,realheight=false,findent=3pt,nindent=0pt]{T}{apt}\linebreak

\renewcommand\LettrineFontHook{\color{Maroon}\GoudyInfamily{}}%
\renewcommand{\LettrineTextFont}{}

\mylettrine{A}{apt}
\mylettrine{B}{apt}
\mylettrine{C}{apt}

\lettrine[image,lines=1,realheight=false,findent=3pt,nindent=0pt]{M}{apt}
\lettrine[image,lines=1,realheight=false,findent=3pt,nindent=0pt]{N}{apt}
\lettrine[image,lines=1,realheight=false,findent=3pt,nindent=0pt]{O}{apt}
 
\end{document}

相关内容