# XeLaTeX and black Outline characters in Devanagari?

I'd like to make some practice worksheets for Devanagari in Outline characters but can't.

I've perused the archive and have not been successful in finding a MWE that works.

Could someone help?

TIA

Most of the examples that do outlining in XeLaTeX either require contour, tikz, pstricks, or utilizing the \special{} command. Contour doesn't seem to work for Devanagari (at least for me). tikz/pstricks require extra processing/package loading. And most of the examples using \special{} are somewhat cryptic and difficult to understand...

Luckily, I found this answer which makes the process much easier, thanks to @phelype-oleinik

To make this easier for future users, I've taken the outlining (for XeLaTeX) in the link above and combined the use of polyglossia to show examples of outlining Devanagari.

\documentclass{article}

\usepackage{fontspec}

\newfontfamily\hindifont[Scale=MatchUppercase,Script=Devanagari]{Noto Sans Devanagari}

\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguages{hindi}

\usepackage{xcolor}

%SEE: https://tex.stackexchange.com/a/421980/78866
%for explanation and usage

\def\rgbtoarray#1,#2,#3\null{[#1 #2 #3]}%
\def\csvtoarray#1{%
\expandafter\rgbtoarray#1\null%
}%
\newcommand{\extractrgb}[2]{%
\extractcolorspecs{#1}{\model}{\mycolor}%
\convertcolorspec{\model}{\mycolor}{rgb}{\printcol}%
\edef#2{\printcol}%
}%
%\fillstroke{<fill color>}{<contour color>}{<stroke width>}{<text>}
\newcommand*{\fillstroke}[4]{%
\extractrgb{#1}{\colorvector}%
\extractrgb{#2}{\strokevector}%
\special{pdf:bcolor \csvtoarray{\colorvector} \csvtoarray{\strokevector}}%
\special{pdf:literal direct #3 w 2 Tr}%
#4%
\special{pdf:ecolor}%
\special{pdf:literal direct 0 Tr}%
}%

\begin{document}

%Example of default
\foreignlanguage{hindi}{चीनी} (cheenee)

%Black text, yellow outline, 0.5 (outline) thickness
\fillstroke{black}{yellow}{0.5}{\Huge \foreignlanguage{hindi}{चीनी}}%

%White text, black outline, 0.5 (outline) thickness
\fillstroke{white}{black}{0.5}{\Huge \foreignlanguage{hindi}{चीनी}}%

%Black text, red outline, 0.75 (outline) thickness
\fillstroke{black}{red}{0.75}{\Huge \foreignlanguage{hindi}{चीनी}}%

%Red text, green outline, 0.25 (outline) thickness
\fillstroke{red}{green}{0.25}{\Huge \foreignlanguage{hindi}{चीनी}}%

%Blue text, gray outline, 1.5 (outline) thickness
\fillstroke{blue}{gray}{1.5}{\Huge \foreignlanguage{hindi}{चीनी}}%

\end{document}


EDIT: I'm using Noto Sans Devanagari in this example. You should be able to replace this font with whatever font you are using already. No other changes should be necessary.