我曾提到Cicada 的解决方案让 Vedic Swara 标记在我的 OSX 上运行。要在您的系统上测试我的 MWE,您必须安装字体索比卡和梵文 2003- 对于那个很抱歉!
我使用的 MWE 与 Cicada 发布的相同:
\documentclass[12pt,varwidth,border=6pt]{standalone}
\usepackage{fontspec}
\newcommand\mysktfont{Shobhika Regular}
\newfontface\fplain{\mysktfont}% no mapping
\newcommand\devtext{
\fontspec[Script=Devanagari,Mapping=itrans-dvn2]{\mysktfont}}%mapping transliteration to Devanagari
\newcommand\iast{
\fontspec[Mapping=itrans-iast2]{\mysktfont}} %mapping transliteration to IAST transliteration scheme
\newcommand{\Paragraph}[1]{\devtext{#1}
\par\medskip
{\iast{#1}}}
\begin{document}
\fplain
नम॑ः
\Paragraph{
nama!ste^^^^1cda rudra ma-nyava! u-tota- iSha!ve- namaH. \\
nama!ste^^^^1cda astu- dhanva!ne bA-hubhyA!mu-ta te- nama!H
}
\end{document}
我这样准备了我的系统:
$ git clone https://github.com/Shreeshrii/xetex-itrans.git
$ cp itrans-iast.map itrans-iast2.map
$ # Edit itrans-iast2.map
$ Teckit_compile itrans-iast2
$ diff -du itrans-iast.map itrans-iast2.map
--- itrans-iast.map 2020-02-02 05:58:51.000000000 -0800
+++ itrans-iast2.map 2020-02-02 06:00:15.000000000 -0800
@@ -153,6 +153,9 @@
pass(Unicode)
+svarita > U+0951
+anudatta > U+0952
+
a > asvara
a a > Asvara
A > Asvara
$ cp *.tec *.map /usr/local/texlive/texmf-local/fonts/misc/xetex/fontmapping/xetex-itrans/
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
$ sudo mkdir -p !$
$ sudo mkdir -p /usr/local/texlive/texmf-local/fonts/misc/xetex/fontmapping/xetex-itrans/
Password:
$ sudo cp *.tec *.map /usr/local/texlive/texmf-local/fonts/misc/xetex/fontmapping/xetex-itrans/
$ sudo mktexlsr
mktexlsr: Updating /usr/local/texlive/2016/texmf-config/ls-R...
mktexlsr: Updating /usr/local/texlive/2016/texmf-dist/ls-R...
mktexlsr: Updating /usr/local/texlive/2016/texmf-var/ls-R...
mktexlsr: Updating /usr/local/texlive/texmf-local/ls-R...
mktexlsr: Done.
运行得到的pdf文件xelatex swara.tex
显示itrans文本没有转换成天城文:
swara.log
我发现日志文件 ( ) 中存在一些错误xelatex
。整个日志文件已上传这里
.................................................
Font mapping `itrans-dvn2.tec' for font `Shobhika Regular' not found.
.................................................
. fontspec info: "no-font-shape"
.
. Could not resolve font Shobhika Regular/I (it probably doesn't exist).
.................................................
.................................................
. fontspec info: "defining-font"
.
. Font family 'ShobhikaRegular(2)' created for font 'Shobhika Regular' with
. options [Mapping=itrans-iast2].
.
. This font family consists of the following NFSS series/shapes:
. - 'normal' (m/n) with NFSS spec.: <->"Shobhika
. Regular/OT:script=latn;language=DFLT;mapping=itrans-iast2;"
. - 'small caps' (m/sc) with NFSS spec.: - 'bold' (bx/n) with NFSS spec.:
. <->"Shobhika Regular/B/OT:script=latn;language=DFLT;mapping=itrans-iast2;"
. - 'bold small caps' (bx/sc) with NFSS spec.: - 'bold italic' (bx/it) with
. NFSS spec.: <->"Shobhika
. Regular/BI/OT:script=latn;language=DFLT;mapping=itrans-iast2;"
. - 'bold italic small caps' (bx/itsc) with NFSS spec.:
.................................................
我通过设置后运行验证了字体确实Shobhika
安装在我的 Mac 上:xetex opentype-info.tex
myfontname
Shobhika Regular
我的源代码 () 中的 fontspec 中的字体功能指令swara.tex
指的是,Mapping=itrans-dvn2
但我没有找到名为This is the log fileitrans-dvn2*
下的任何 map 或 tec 文件/usr/local/texlive/texmf-local/fonts/misc/xetex/fontmapping/xetex-itrans/
。@Cicada 从来没有说过要生成这个文件,我也没有在 git repo 中看到它。
Shobhika
我在源代码中将字体名称从 改为Sanskrit 2003
,但还是失败了。整个日志如下这里
更新 1
不依赖.tec
文件来提供 swara 标记,我将它们手动插入到我的文档中(如另一篇文章所建议的那样):
\documentclass[12pt,varwidth,border=6pt]{standalone}
\usepackage{fontspec}
\newcommand\mysktfont{Shobhika Regular}
\newfontface\fplain{\mysktfont}% no mapping
\newcommand\devtext{
\fontspec[Script=Devanagari,Mapping=itrans-dvn]{\mysktfont}}%mapping transliteration to Devanagari
\newcommand\iast{
\fontspec[Mapping=itrans-iast]{\mysktfont}} %mapping transliteration to IAST transliteration scheme
\newcommand\svarita{^^^^0951}
\newcommand\anudatta{^^^^0952}
\newcommand\doublesvarita{^^^^1cda}
\newcommand{\Paragraph}[1]{\devtext{#1}
\par\medskip
{\iast{#1}}}
\begin{document}
\fplain
नम॑ः
\Paragraph{nama\svarita ste\doublesvarita\ rudra ma\anudatta nyava\svarita\ u\anudatta tota\anudatta\ iSha\svarita ve\anudatta\ namaH. \\
nama\svarita ste\doublesvarita\ astu\anudatta\ dhanva\svarita ne bA\anudatta hubhyA\svarita mu\anudatta ta te\anudatta\ nama\svarita H}
\end{document}
这给了我带有 swara 标记的文本,但有一个例外,我用红色箭头指出了这一点:
如果有办法消除नम
和之间的奇怪圆圈ः
,我的问题就解决了。
更新 2
带字体输出Siddhanta
答案1
我对天城文一无所知,但重音符号 UDATTA (U+0951) 和 VISARGA (U+0903) 的输入顺序似乎很重要。这里有关于输入顺序的讨论:https://github.com/harfbuzz/harfbuzz/issues/2017
看起来,noto 字体也存在小问题,而 siddhanta 字体更好一些。(https://github.com/googlefonts/noto-fonts/issues/1551)。
当我在当前 texlive 中使用 lualatex-dev(并启用 harfbuzz)编译以下内容时(之所以出现 ^^^^ 符号,是因为它更容易让我输入)
\documentclass{article}
\usepackage{fontspec}
\setmainfont{NotosansDevanagari}[Renderer=Harfbuzz,Script=Devanagari]
\setsansfont{siddhanta}[Renderer=Harfbuzz,Script=Devanagari]
\begin{document}
^^^^0928^^^^092e^^^^0951^^^^0903 नम॑ः
^^^^0928^^^^092e^^^^0903^^^^0951 नमः॑
\sffamily
^^^^0928^^^^092e^^^^0951^^^^0903 नम॑ः
^^^^0928^^^^092e^^^^0903^^^^0951 नमः॑
\end{document}
我得到这个输出: