我已經提到過蟬的解決方案讓吠陀 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
但我沒有找到任何在「這是日誌檔案中的錯誤之一」itrans-dvn2*
下命名的地圖或 tec 檔案。 /usr/local/texlive/texmf-local/fonts/misc/xetex/fontmapping/xetex-itrans/
@Cicada 從未說過任何關於生成此文件的事情,我也沒有在 git 存儲庫中看到它。
我將字體名稱從 更改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)。
當我使用 lualatex-dev 在當前的 texlive 中編譯以下內容時(因此啟用了 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}
我得到這個輸出: