I have referred to Cicada's solution to get vedic swara markings working on my osx. To test my MWE on your system, you will have to install fonts Shobhika and Sanskrit 2003 - sorry about that!
The MWE I used is the same as what Cicada posted:
\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}
I prepared my system thus:
$ 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.
The pdf file resulting from running xelatex swara.tex shows that the itrans text is not converted to devanagari:
I found a few errors in the log file (swara.log) generated from xelatex. The entire log file is uploaded here
.................................................
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.:
.................................................
I verified that the Shobhika font is indeed installed on my mac by running xetex opentype-info.tex after setting myfontname to Shobhika Regular:
The font features directive in the fontspec in my source (swara.tex) refers to Mapping=itrans-dvn2 but I don't find any map or tec files named itrans-dvn2* under /usr/local/texlive/texmf-local/fonts/misc/xetex/fontmapping/xetex-itrans/ This is one of the errors in the log file. @Cicada never said anything about generating this file and I don't see it in the git repo either.
I changed the font name from Shobhika to Sanskrit 2003 in my source and that failed too. Entire log is here
Update 1
Without relying on the .tec files to provide swara markings, I inserted the them manually into my document (as was suggested in another post):
\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}
This gives me text with swara markings, with one exception that I have pointed out with a red arrow:
If there's a way to get rid of the weird circle between नम and ः, my problem would be resolved.
Update 2
Output with font Siddhanta





Mapping=itrans-dvn2toMapping=itrans-dvnand used the macros foranudattaetc. and can now see swara markings in my document. There is a weird character between the svarita marking andHinnama{\svarita}H. How can it be fixed? – linuxfan Feb 02 '20 at 22:43itrans-iast2is distribution fileitrans-iastwith two lines added:svarita > U+0951 anudatta > U+0952anditrans-dvn2is distribution fileiast-dvnwith the equivalent:svarita > vstroke anudatta > hstrokeif I recall correctly.\svaritawith a \ is a macro - a mapped font converts the input characters into the output characters according to the conversion rules specified in the mapping file. Macro names are not part of that process. Just like you type the charactersna(not\na) and they are mapped toन. – Cicada Feb 03 '20 at 12:51\svaritamacro is not defined in the MWE posted above, so it gives the error! Undefined control sequence. – Cicada Feb 03 '20 at 12:52itrans-dvn2? Since your reply to the other post said nothing about generating it, I continued to use itrans-dvn. Links to my source and logfile: https://www.dropbox.com/s/b7xlkr0f1a3q8p7/new-swara.tex?dl=0 https://www.dropbox.com/s/q4sxx35heds2e7i/new-swara.pdf?dl=0 – linuxfan Feb 03 '20 at 13:52.mapfile into a.tecfile. What to edit in the map files is described in prior comment. It's the same edit in both, in fact. If you want to add double svarita, similar syntax. The map files are converted into regex, as I understand. I recommend @ShreevatsaR 's advice to edit your own, or use direct input. The shipped iast ones are unworkable as they are for Vedic as you can see from the linked question. – Cicada Feb 04 '20 at 11:29\newcommand\svarita{^^^^0951} \newcommand\anudatta{^^^^0952} \newcommand\doublesvarita{^^^^1cda}illustrate how theitransmapping file cannot handle some combinations in the devanagari: compare the mapped output (नम॑ः displays wrong in my browser also) with the unmapped one (that uses the\fplainfont and produces the correct shape). The macros do not rely on mapping, in any case; so you can use them in place of direct input if you do not have a Vedic IME. Similarly with all the other accents. – Cicada Feb 04 '20 at 11:48Shobhika RegulartoSiddhantain the example I posted in Update 1. The weirdness with visarga after swarita marking still exists. Please check the question for Update 2 that shows the output with Siddhanta. – linuxfan Feb 10 '20 at 01:06