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?



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.



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



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

\def\rgbtoarray#1,#2,#3\null{[#1 #2 #3]}%
%\fillstroke{<fill color>}{<contour color>}{<stroke width>}{<text>}
    \special{pdf:bcolor \csvtoarray{\colorvector} \csvtoarray{\strokevector}}%
    \special{pdf:literal direct #3 w 2 Tr}%
    \special{pdf:literal direct 0 Tr}%


%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}{चीनी}}%


Examples of outlining Devanagari in XeLaTeX

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.