无衬线标题,衬线正文

无衬线标题,衬线正文

我正在使用 ConTeXt 和 XeTex。因此,我正在编译我的文档:texexec --xetex foo.tex

我想遵循转换,将标题全部转换为 Sans Serif,将正文转换为 Serif。我想用自己的字体来实现这一点:

%&context
\definetypeface[BerlinSSDB][ss][sans][Berlin Sans FB Demi]
\definetypeface[Minion][rm][Xserif][Minion Pro]
\setupbodyfont[Minion, 12pt]

\setuphead[chapter][
    style=\ss,
    sectionnumber=yes
    ]

\setuphead[section][
    style=\ss,
    sectionnumber=no
    ]

\starttext

\chapter{Welcome}
A well known text, used to fill space.

\section{H. Rackham 1914}
But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness... But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?

\stoptext

Minion Pro 中会出现所有内容,包括标题、正文等。这似乎是合理的,因为我没有告诉它要使用什么字体,除了说“使用 Minion”。(我认为\setupbodyfont,使用的正文一词的含义与我这里的意思不同。)

答案1

答案出奇的简单:在你的例子中,行中的第一个项

\definetypeface[BerlinSSDB][ss][sans][Berlin Sans FB Demi]

只是一个标识符,可以是任何东西。如果您想要一整套 (rm + sans),则需要使用相同的标识符,以便 ConTeXt 知道这些字体形成一个集合。所以这是重写的示例(我已经用其他字体进行了测试,因为我没有您使用的字体;最好为您的 MWE 使用通用字体):

\definetypeface [Oxinabox] [rm] [Xserif] [Minion Pro]
\definetypeface [Oxinabox] [ss] [Xsans]  [Berlin Sans FB Demi]
\setupbodyfont  [Oxinabox, 12pt]

\setuphead[chapter][
    style=\ss,
sectionnumber=yes
]

\setuphead[section][
style=\ss,
sectionnumber=no
]

\starttext

\chapter{Welcome}
A well known text, used to fill space.

\section{H. Rackham 1914}
But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness... But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?

\stoptext

但正如其他人所说的,如果你真的想使用 ConTeXt,最好看看 luatex/mkiv。它几乎可以完成 XeTeX 的所有功能,甚至更多。

答案2

由于您刚开始使用 ConTeXt,我建议您使用 LuaTeX 后端而不是 XeTeX。

借助 luatex 支持(称为 Context MkIV),您可以使用 simplefonts 模块,该模块可以轻松加载 Opentype/Truetype 字体。例如(我将字体更改为通用字体)并进行了一些样式更改。使用 编译文档context <filename>

\usemodule[simplefonts][size=12pt]
\setmainfont[Linux Libertine O]
\setsansfont[Dejavu Sans]

\setuphead
  [chapter]
  [
    style=\ssb, % Same as \ss but uses bigger font size
    sectionnumber=yes, % Note the comma!
  ]

\setuphead
  [section]
  [
    style=\ssa, % Same as \ss but uses bigger font size
    sectionnumber=no, % Note the comma!
  ]

\starttext

\chapter{Welcome}
A well known text, used to fill space.

\section{H. Rackham 1914}
But I must explain to you how all this mistaken idea of denouncing pleasure
and praising pain was born and I will give you a complete account of the
system, and expound the actual teachings of the great explorer of the truth,
the master-builder of human happiness... But who has any right to find fault
with a man who chooses to enjoy a pleasure that has no annoying
consequences, or one who avoids a pain that produces no resultant pleasure?

\stoptext

相关内容