我寻找一种方法来翻译以下 XeLaTeX 的声明(基于包unicode-math
)
\setmainfont{Linux Libertine G}
\setsansfont[Scale=MatchLowercase]{Liberation Sans}
\setmonofont[Scale=MatchLowercase,
ItalicFont=lmmono10-italic.otf,
BoldFont=lmmonolt10-bold.otf,
BoldItalicFont=lmmonolt10-boldoblique.otf,
SmallCapsFont=lmmonocaps10-regular]{lmmono10-regular.otf}
\setmathfont[Scale=MatchLowercase]{TeX Gyre Termes Math}
\setmathfont[Scale=MatchLowercase, range=\mathup]{linlibertine_r_g.ttf}
\setmathfont[Scale=MatchLowercase, range=\mathbfup]{linlibertine_rz_g.ttf}
\setmathfont[Scale=MatchLowercase, range=\mathsfup]{liberationsans-regular.ttf}
\setmathfont[Scale=MatchLowercase, range=\mathsfit]{liberationsans-italic.ttf}
\setmathfont[Scale=MatchLowercase, range=\mathbfsfup]{liberationsans-bold.ttf}
\setmathfont[Scale=MatchLowercase, range=\mathbfsfit]{liberationsans-bolditalic.ttf}
\setmathfont[Scale=MatchLowercase, range=\mathtt]{lmmono10-italic.otf}
\setmathfont[Scale=MatchLowercase, range=\mathscr]{asana-math.otf}
进入 ConTeXt 的打字稿。我成功设置了衬线、无衬线和单色字体;但我需要数学设置的帮助。
\startenvironment liberty
\starttypescript [liberty]
\definefontsynonym [Serif] [file:LinLibertine_R_G]
\definefontsynonym [SerifCaps] [Serif] [features=smallcaps]
\definefontsynonym [SerifItalic] [file:LinLibertine_RI_G]
\definefontsynonym [SerifSlanted] [SerifItalic]
\definefontsynonym [SerifBold] [file:LinLibertine_RZ_G]
\definefontsynonym [SerifBoldItalic] [file:LinLibertine_RZI_G]
\definefontsynonym [SerifBoldSlanted] [SerifBoldItalic]
\definefontsynonym [Sans] [file:LiberationSans-Regular]
\definefontsynonym [SansCaps] [Sans] [features=smallcaps]
\definefontsynonym [SansItalic] [file:LiberationSans-Italic]
\definefontsynonym [SansSlanted] [SansItalic]
\definefontsynonym [SansBold] [file:LiberationSans-Bold]
\definefontsynonym [SansBoldItalic] [file:LiberationSans-BoldItalic]
\definefontsynonym [SansBoldSlanted] [SansBoldItalic]
\definetypeface [liberty] [rm] [serif] [liberty] [default]
\definetypeface [liberty] [ss] [sans] [liberty] [default] [rscale=0.816]
\definetypeface [liberty] [tt] [mono] [modern] [default]
\definetypeface [liberty] [mm] [math] [times] [default] [rscale=0.958]
\stoptypescript
\setupbodyfont[liberty, 10pt]
\stopenvironment
提前致谢。
PS:有人知道 的等价物是什么吗Scale=MatchLowercase
?rscale
我使用的 s 来自 XeLaTeX 生成的日志文件。
编辑。正如评论中所建议的那样,这是一个基于后备的解决方案的开始,但令人惊讶的是,它不起作用。
\startenvironment liberty
\starttypescript [serif] [liberty]
\definefontsynonym [Serif] [file:LinLibertine_R]
\definefontsynonym [SerifCaps] [Serif] [features=smallcaps]
\definefontsynonym [SerifItalic] [file:LinLibertine_RI]
\definefontsynonym [SerifSlanted] [SerifItalic]
\definefontsynonym [SerifBold] [file:LinLibertine_RZ]
\definefontsynonym [SerifBoldItalic] [file:LinLibertine_RZI]
\definefontsynonym [SerifBoldSlanted] [SerifBoldItalic]
\stoptypescript
\starttypescript [sans] [liberty]
\definefontsynonym [Sans] [file:LiberationSans-Regular]
\definefontsynonym [SansCaps] [Sans] [features=smallcaps]
\definefontsynonym [SansItalic] [file:LiberationSans-Italic]
\definefontsynonym [SansSlanted] [SansItalic]
\definefontsynonym [SansBold] [file:LiberationSans-Bold]
\definefontsynonym [SansBoldItalic] [file:LiberationSans-BoldItalic]
\definefontsynonym [SansBoldSlanted] [SansBoldItalic]
\stoptypescript
\starttypescript [math] [liberty]
\definefontfallback [asserif] [Serif] [0x0030-0x0039] % Digits
\definefontfallback [asserif] [Serif] [0x0041-0x005a] % Latin capital letters
\definefontfallback [asserif] [Serif] [0x0061-0x007a] % Latin small letters
\definefontsynonym [MathRoman] [file:texgyretermes-math] [fallbacks=asserif]
\stoptypescript
\definetypeface [liberty] [rm] [serif] [liberty] [default]
\definetypeface [liberty] [ss] [sans] [liberty] [default] [rscale=0.816]
\definetypeface [liberty] [tt] [mono] [modern] [default]
\definetypeface [liberty] [mm] [math] [liberty] [default] %[rscale=0.958]
\setupbodyfont[liberty, 10pt]
\stopenvironment
答案1
对于 Libertine,已经有一个定义的 typescript。要获取与 Libertine 配合良好的 TeXGyre Pagella Math,请先加载 Pagella:
\setupbodyfont[pagella]
\setupbodyfont[libertine,12pt]
\starttext
foo $bar$
\stoptext
字体为:
voss@shania:~> pdffonts zz.pdf
name type encoding emb sub uni object ID
--------------------------------- ----------- -------------- --- --- ---------
RSSLOW+LinLibertineO CID Type 0C Identity-H yes yes yes 18 0
TQYEHR+TeXGyrePagellaMath-Regular CID Type 0C Identity-H yes yes yes 19 0
答案2
这是解决方案。请注意,您需要最新版本的 ConTeXt。在下面的示例中,我将使用 Baskervald、Corbel 和 Ubuntu Mono,而不是 Libertine、Liberation 和 Latin Modern Mono。我们的混合数学字体将基于 Pagella Math。
首先,应该知道 Opentype 数学字体中的数学字形代码。例如,它们位于 MS Word 的字符表中。对于 Pagella Math,我们有:
- 0x30-0x39 = 0-9
- 0x41-0x5A = 直立罗马 AZ
- 0x61-0x7A = 直立罗马字母 az
- 0x1D434-0x1D44D = 斜体罗马 AZ
- 0x1D44E-0x1D467 = 斜体罗马字母
- 0x1D400-0x1D419 = 直立粗体罗马 AZ
- 0x1D41A-0x1D433 = 直立粗体罗马字母 az
- 0x1D468-0x1D481 = 斜体粗体罗马 AZ
- 0x1D482-0x1D49B = 斜体粗体罗马字母 az
- 0x1D5A0-0x1D5B9 = 直立无衬线 AZ
- 0x1D5BA-0x1D5D3 = 直立无衬线 az
- 0x1D608-0x1D621 = 斜体无衬线 AZ
- 0x1D622-0x1D63B = 斜体无衬线 az
- 0x1D5D4-0x1D5ED = 直立粗体无衬线 AZ
- 0x1D5EE-0x1D607 = 直立粗体无衬线 az
- 0x1D63C-0x1D655 = 斜体粗体无衬线 AZ
- 0x1D656-0x1D66F = 斜体粗体无衬线 az
- 0x1D670-0x1D689 = 直立单声道 AZ
- 0x1D68A-0x1D6A3 = 直立单声道 az
现在我们使用 fallback 机制和 offset 选项来进行映射:
\startenvironment liberty
% 0x30-0x39 = 0-9 within both Pagella Math and Baskervald
\definefontfallback [baskervaldmath] [file:BaskervaldADFStd] [0x30-0x39] [force=yes]
% 0x41-0x5A = upright roman A-Z within both Pagella Math and Baskervald
\definefontfallback [baskervaldmath] [file:BaskervaldADFStd] [0x41-0x5A] [force=yes]
% 0x61-0x7A = upright roman a-z within both Pagella Math and Baskervald
\definefontfallback [baskervaldmath] [file:BaskervaldADFStd] [0x61-0x7A] [force=yes]
% 0x1D434-0x1D44D = italic roman A-Z
\definefontfallback [baskervaldmath] [file:BaskervaldADFStd-Italic] [0x41-0x5A] [offset=0x1D434-0x1D44D, force=yes]
% 0x1D44E-0x1D467 = italic roman a-z
\definefontfallback [baskervaldmath] [file:BaskervaldADFStd-Italic] [0x61-0x7A] [offset=0x1D44E-0x1D467, force=yes]
% 0x1D400-0x1D419 = upright bold roman A-Z
\definefontfallback [baskervaldmath] [file:BaskervaldADFStd-Bold] [0x41-0x5A] [offset=0x1D400-0x1D419, force=yes]
% etc.
% Type script
\starttypescript [serif] [liberty]
\definefontsynonym [Serif] [file:BaskervaldADFStd]
\definefontsynonym [SerifCaps] [Serif] [features=smallcaps]
\definefontsynonym [SerifItalic] [file:BaskervaldADFStd-Italic]
\definefontsynonym [SerifSlanted] [SerifItalic]
\definefontsynonym [SerifBold] [file:BaskervaldADFStd-Bold]
\definefontsynonym [SerifBoldItalic] [file:BaskervaldADFStd-BoldItalic]
\definefontsynonym [SerifBoldSlanted] [SerifBoldItalic]
\stoptypescript
\starttypescript [sans] [liberty]
\definefontsynonym [Sans] [file:corbel]
\definefontsynonym [SansCaps] [Sans] [features=smallcaps]
\definefontsynonym [SansItalic] [file:corbeli]
\definefontsynonym [SansSlanted] [SansItalic]
\definefontsynonym [SansBold] [file:corbelb]
\definefontsynonym [SansBoldItalic] [file:corbelz]
\definefontsynonym [SansBoldSlanted] [SansBoldItalic]
\stoptypescript
\starttypescript [mono] [liberty]
\definefontsynonym [Mono] [file:UbuntuMono-R]
\definefontsynonym [MonoCaps] [Mono] [features=smallcaps]
\definefontsynonym [MonoItalic] [file:UbuntuMono-RI]
\definefontsynonym [MonoSlanted] [MonoItalic]
\definefontsynonym [MonoBold] [file:UbuntuMono-B]
\definefontsynonym [MonoBoldItalic] [file:UbuntuMono-BI]
\definefontsynonym [MonoBoldSlanted] [MonoBoldItalic]
\stoptypescript
\starttypescript [math] [liberty]
\definefontsynonym [MathRoman] [file:texgyrepagella-math] [fallbacks=baskervaldmath]
\stoptypescript
\definetypeface [liberty] [rm] [serif] [liberty] [default] [features=default]
\definetypeface [liberty] [ss] [sans] [liberty] [default] [features=default, rscale=0.95]
\definetypeface [liberty] [tt] [mono] [liberty] [default] [features=default, rscale=0.88]
\definetypeface [liberty] [mm] [math] [liberty] [default] [features=default]
\setupbodyfont [liberty, 12pt]
\stopenvironment