Enumerated list with circle around using tikz

#enumeratetikz-pgf

I want to make a enumerated list in Bangla. I am using babel package for Bangla support. My code is given below:

\documentclass{book}

\usepackage[english]{babel}
\babelprovide[import, onchar = fonts ids]{bengali}
% \babelfont[bengali]{rm}[Renderer=Harfbuzz]{FreeSerif}
\babelfont[bengali]{rm}[Renderer=Harfbuzz,AutoFakeBold,AutoFakeSlant=0.3]{Kalpurush}
\babelcharproperty{`।}{locale}{bengali}

% draw figures
\usepackage{tikz}

% circled numbering
\usepackage{enumitem}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{%
            \node[shape=circle,fill=black!20,inner sep=2pt] (char) {#1};}}
            
% bangla numerals
\babelprovide[maparabic,alph=alphabetic]{bengali}


\begin{document}

\subsubsection*{গণিতের চারটি নিয়ম}

\begin{enumerate}[label=\protect\circled{\arabic*}]
    \item যোগের জন্য দেওয়া সংখ্যাগুলোর যেকোন একটিকে অথবা দুটিকেই কাছাকাছি কোন রাউন্ড ফিগার করে নিই। কোন সংখ্যাকে রাউন্ড করতে হলে তার সাথে অন্য একটি ছোট সংখ্যা যোগ বা বিয়োগ করে তাকে ১০ এর গুণিতক আকারে লিখি। 
    \item এবার রাউন্ড করা সংখ্যার সাথে অন্য সংখ্যাটি সহজেই যোগ করে ফেলি। যোগের সময় রাউন্ড করতে নেওয়া অতিরিক্ত সংখ্যাটি আলাদা রাখি।
    \item এখন প্রাপ্ত যোগফলের সাথে অতিরিক্ত সংখ্যাটি যোগ বা বিয়োগ (যেখানে যেটা লাগবে) করে দিই। তাহলে, আমরা পেয়ে গেলাম আমাদের নির্ণেয় যোগফল।
\end{enumerate}

\end{document}

Using this code I got the following output. You will see the text is not showing.

enter image description here

But I want something like this:

enter image description here

How can I achieve my desired output?

Best Answer

Edited. I’ve extended point 2 with a full example, and revised point 1 because it poses a problem. Anyway, for large spans of text, selecting explicitly the language is better.

My guess in the comments above was correct. It’s related to a hack in tikz/pgf, which switches to a null font. There are two options:

1. I’m not sure why the following workaround (which is basically what @JasperHabicht suggested) shows the font, and at the same time renders incorrectly some characters.

\begin{enumerate}[label=\foreignlanguage{bengali}\protect\circled{\arabic*}}]

It might work with other scripts, but in this case it’s not the solution.

2. Write the following piece of code just before \begin{document}:

\makeatletter
\AtBeginDocument{%
 \def\bbl@mapdir#1{%
   {\def\languagename{#1}%
    \let\bbl@ifrestoring\@firstoftwo % To avoid font warning
    \bbl@switchfont
    \ifnum\fontid\font>\z@
      \directlua{
        Babel.locale_props[\the\csname bbl@id@@#1\endcsname]%
              ['/\bbl@prefontid'] = \fontid\font\space}%
    \fi}}}%
\makeatother

Here is the full example:

\documentclass{book}

\usepackage[english]{babel}
\babelprovide[import, onchar = fonts ids]{bengali}
% \babelfont[bengali]{rm}[Renderer=Harfbuzz]{FreeSerif}
\babelfont[bengali]{rm}[Renderer=Harfbuzz,AutoFakeBold,AutoFakeSlant=0.3]{Kalpurush}
\babelcharproperty{`।}{locale}{bengali}

% draw figures
\usepackage{tikz}

% circled numbering
\usepackage{enumitem}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{%
            \node[shape=circle,fill=black!20,inner sep=2pt] (char) {#1};}}

% bangla numerals
\babelprovide[maparabic,alph=alphabetic]{bengali}

\makeatletter
\AtBeginDocument{%
 \def\bbl@mapdir#1{%
   {\def\languagename{#1}%
    \let\bbl@ifrestoring\@firstoftwo % To avoid font warning
    \bbl@switchfont
    \ifnum\fontid\font>\z@
      \directlua{
        Babel.locale_props[\the\csname bbl@id@@#1\endcsname]%
              ['/\bbl@prefontid'] = \fontid\font\space}%
    \fi}}}%
\makeatother

\begin{document}

\subsubsection*{গণিতের চারটি নিয়ম}

\begin{enumerate}[label=\protect\circled{\arabic*}]
    \item যোগের জন্য দেওয়া সংখ্যাগুলোর যেকোন একটিকে অথবা দুটিকেই কাছাকাছি কোন রাউন্ড ফিগার করে নিই। কোন সংখ্যাকে রাউন্ড করতে হলে তার সাথে অন্য একটি ছোট সংখ্যা যোগ বা বিয়োগ করে তাকে ১০ এর গুণিতক আকারে লিখি। 
    \item এবার রাউন্ড করা সংখ্যার সাথে অন্য সংখ্যাটি সহজেই যোগ করে ফেলি। যোগের সময় রাউন্ড করতে নেওয়া অতিরিক্ত সংখ্যাটি আলাদা রাখি।
    \item এখন প্রাপ্ত যোগফলের সাথে অতিরিক্ত সংখ্যাটি যোগ বা বিয়োগ (যেখানে যেটা লাগবে) করে দিই। তাহলে, আমরা পেয়ে গেলাম আমাদের নির্ণেয় যোগফল।
\end{enumerate}

\end{document}

enter image description here

Related Question