如何在 Open Sans 上獲得備用“g”字形?

如何在 Open Sans 上獲得備用“g”字形?

我試圖指定opensans(using pdflatex) 提供的備用“g”字形,但在文檔中找不到有關如何執行此操作的說明。我想在整個文件中使用替代。

答案1

pdflatex你不能,除非你從 TrueType 版本建立一組新的字型。字體pdflatex只有 256 個槽位,並且無法定義變體。原則上,我們可以只建立新.pfb檔案並使用「正常 g」的指標,但這將是一項非常艱鉅的工作。

使用 XeLaTeX 或 LuaLaTeX 很容易,因為替代的「g」位於風格集 2 中:

\documentclass{article}
\usepackage{fontspec}

\setmainfont[Ligatures=TeX,StylisticSet=2]{OpenSans}
\newfontfamily{\normalg}[Ligatures=TeX]{OpenSans} % the same font without the normal g

\begin{document}

A g \textbf{g} \textit{g}

\normalg % show the normal g

A g \textbf{g} \textit{g}

\end{document}

在此輸入影像描述

相關內容