Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\textbigcircle does not work with LuaLaTeX out of the box. #1656

Open
randolf-scholz opened this issue Feb 10, 2025 · 12 comments
Open

\textbigcircle does not work with LuaLaTeX out of the box. #1656

randolf-scholz opened this issue Feb 10, 2025 · 12 comments

Comments

@randolf-scholz
Copy link

Brief outline of the bug

Apologies if this is off-topic due to being font-related, but I noticed that luatex does not work with the \textbigcircle native command. If this is not the right issue tracker for that, where should I report it?

Minimal example showing the bug

\RequirePackage{latexbug}
\documentclass{article}
\tracinglostchars=3% error if a glyph is missing
\begin{document}
Circle: \textbigcircle
\end{document}

Missing character: There is no ◯ (U+25EF) in font [lmroman10-regular]:+tlig;!

Log file (required) and possibly PDF file

demo_textbigcircle.log

@muzimuzhi
Copy link
Contributor

Interesting, although there is no \textbigcircle (U+25EF) in the default font set for Xe- and Lua-LaTeX, the Latin Modern Roman font, \textcircled always works, which seems inconsistent to me.

@randolf-scholz
Copy link
Author

randolf-scholz commented Feb 10, 2025

One more note: If one adds \usepackage[T1]{fontenc}, then it does compile with lualatex, but I thought this package is superfluous / not necessary when using lualatex? (https://tex.stackexchange.com/questions/412757/)

@davidcarlisle
Copy link
Member

One more note: If one adds \usepackage[T1]{fontenc}, then it does compile with lualatex, but I thought this package is superfluous / not necessary when using lualatex? (https://tex.stackexchange.com/questions/412757/)

if you switch to T1 encoding you are using legacy TeX fonts and disable the Unicode font handling, so then U+25EF is not relevant as you are using characters with maximum character slot 00FF

@u-fischer
Copy link
Member

The command tries to use the unicode code point U+25EF and the font doesn't have this char. There is nothing we can do to fix that (apart from removing the command).

@FrankMittelbach
Copy link
Member

It could perhaps be defined to fall back to OMS (like \textcircled), but the right solution is certainly to request that symbol to be added to the font (ie have what is in OMS also in the TU font).

@randolf-scholz
Copy link
Author

I went through the characters in Table 3-12 in fntguide (former symbols from textcomp that are now part of the $\LaTeX$ kernel) and it seems the following 6 characters are missing from the default font in lualatex:

  1. \capitalcedilla: ◌̧ (U+0327)
  2. \capitalcedilla: ◌̨ (U+0328)
  3. \textbigcircle: (U+25EF)
  4. \texttildelow: ˷ (U+02F7)
  5. \textgravedbl: ˵ (U+02F5)
  6. \textguarani: (U+20B2)
TEST FILE
\documentclass{standalone}
\tracinglostchars=2% error if a glyph is missing
\usepackage{booktabs}
% SEE: fntguide, Table 2: Text symbols formerly from the textcomp package
\begin{document}
\begin{tabular}{lll}
\toprule
	Command & Symbol & Code
\\	\midrule
\midrule  % Table 3: Symbols available in all TS1 sub-encodings
\verb|\textquotestraightbase|     & \textquotestraightbase     & 13  \\
\verb|\textquotestraightdblbase|  & \textquotestraightdblbase  & 18  \\
\verb|\textcapitalcompwordmark|   & \textcapitalcompwordmark   & 23  \\
\verb|\textascendercompwordmark|  & \textascendercompwordmark  & 31  \\
\verb|\textdollar|                & \textdollar                & 36  \\
\verb|\textquotesingle|           & \textquotesingle           & 39  \\
\verb|\textasteriskcentered|      & \textasteriskcentered      & 42  \\
\verb|\textdagger|                & \textdagger                & 132 \\
\verb|\textdaggerdbl|             & \textdaggerdbl             & 133 \\
\verb|\textperthousand|           & \textperthousand           & 135 \\
\verb|\textbullet|                & \textbullet                & 136 \\
\verb|\texttrademark|             & \texttrademark             & 151 \\
\verb|\textcent|                  & \textcent                  & 162 \\
\verb|\textsterling|              & \textsterling              & 163 \\
\verb|\textyen|                   & \textyen                   & 165 \\
\verb|\textbrokenbar|             & \textbrokenbar             & 166 \\
\verb|\textsection|               & \textsection               & 167 \\
\verb|\textcopyright|             & \textcopyright             & 169 \\
\verb|\textordfeminine|           & \textordfeminine           & 170 \\
\verb|\textlnot|                  & \textlnot                  & 172 \\
\verb|\textregistered|            & \textregistered            & 174 \\
\verb|\textdegree|                & \textdegree                & 176 \\
\verb|\textpm|                    & \textpm                    & 177 \\
\verb|\textparagraph|             & \textparagraph             & 182 \\
\verb|\textperiodcentered|        & \textperiodcentered        & 183 \\
\verb|\textordmasculine|          & \textordmasculine          & 186 \\
\verb|\textonequarter|            & \textonequarter            & 188 \\
\verb|\textonehalf|               & \textonehalf               & 189 \\
\verb|\textthreequarters|         & \textthreequarters         & 190 \\
\verb|\texttimes|                 & \texttimes                 & 214 \\
\verb|\textdiv|                   & \textdiv                   & 246 \\
\midrule  % Table 5: Symbols unavailable in TS1 sub-encoding 2 and higher
\verb|\capitalcedilla|       & \capitalcedilla{}       & acc \\
\verb|\capitalogonek|        & \capitalogonek{}        & acc \\
\verb|\capitalgrave|         & \capitalgrave{}         & 0   \\
\verb|\capitalacute|         & \capitalacute{}         & 1   \\
\verb|\capitalcircumflex|    & \capitalcircumflex{}    & 2   \\
\verb|\capitaltilde|         & \capitaltilde{}         & 3   \\
\verb|\capitaldieresis|      & \capitaldieresis{}      & 4   \\
\verb|\capitalhungarumlaut|  & \capitalhungarumlaut{}  & 5   \\
\verb|\capitalring|          & \capitalring{}          & 6   \\
\verb|\capitalcaron|         & \capitalcaron{}         & 7   \\
\verb|\capitalbreve|         & \capitalbreve{}         & 8   \\
\verb|\capitalmacron|        & \capitalmacron{}        & 9   \\
\verb|\capitaldotaccent|     & \capitaldotaccent{}     & 10  \\
\verb|\capitaltie|           & \capitaltie{}           & 27  \\
\verb|\newtie|               & \newtie{}               & 28  \\
\verb|\capitalnewtie{}|      & \capitalnewtie{}        & 29  \\
\verb|\textdblhyphen|        & \textdblhyphen          & 45  \\
\verb|\textzerooldstyle|     & \textzerooldstyle       & 48  \\
\verb|\textoneoldstyle|      & \textoneoldstyle        & 49  \\
\verb|\texttwooldstyle|      & \texttwooldstyle        & 50  \\
\verb|\textthreeoldstyle|    & \textthreeoldstyle      & 51  \\
\verb|\textfouroldstyle|     & \textfouroldstyle       & 52  \\
\verb|\textfiveoldstyle|     & \textfiveoldstyle       & 53  \\
\verb|\textsixoldstyle|      & \textsixoldstyle        & 54  \\
\verb|\textsevenoldstyle|    & \textsevenoldstyle      & 55  \\
\verb|\texteightoldstyle|    & \texteightoldstyle      & 56  \\
\verb|\textnineoldstyle|     & \textnineoldstyle       & 57  \\
\verb|\textmho|              & \textmho                & 77  \\
\verb|\textbigcircle|        & \textbigcircle          & 79  \\
\verb|\textlbrackdbl|        & \textlbrackdbl          & 91  \\
\verb|\textrbrackdbl|        & \textrbrackdbl          & 93  \\
\verb|\textasciigrave|       & \textasciigrave         & 96  \\
\verb|\textborn|             & \textborn               & 98  \\
\verb|\textdivorced|         & \textdivorced           & 99  \\
\verb|\textdied|             & \textdied               & 100 \\
\verb|\textleaf|             & \textleaf               & 108 \\
\verb|\textmarried|          & \textmarried            & 109 \\
\verb|\textmusicalnote|      & \textmusicalnote        & 110 \\
\verb|\texttildelow|         & \texttildelow           & 126 \\
\verb|\textdblhyphenchar|    & \textdblhyphenchar      & 127 \\
\verb|\textasciibreve|       & \textasciibreve         & 128 \\
\verb|\textasciicaron|       & \textasciicaron         & 129 \\
\verb|\textacutedbl|         & \textacutedbl           & 130 \\
\verb|\textgravedbl|         & \textgravedbl           & 131 \\
\verb|\textdollaroldstyle|   & \textdollaroldstyle     & 138 \\
\verb|\textcentoldstyle|     & \textcentoldstyle       & 139 \\
\verb|\textnaira|            & \textnaira              & 143 \\
\verb|\textguarani|          & \textguarani            & 144 \\
\verb|\textpeso|             & \textpeso               & 145 \\
\verb|\textrecipe|           & \textrecipe             & 147 \\
\verb|\textpertenthousand|   & \textpertenthousand     & 152 \\
\verb|\textpilcrow|          & \textpilcrow            & 153 \\
\verb|\textbaht|             & \textbaht               & 154 \\
\verb|\textdiscount|         & \textdiscount           & 156 \\
\verb|\textopenbullet|       & \textopenbullet         & 158 \\
\verb|\textservicemark|      & \textservicemark        & 159 \\
\verb|\textlquill|           & \textlquill             & 160 \\
\verb|\textrquill|           & \textrquill             & 161 \\
\verb|\textasciidieresis|    & \textasciidieresis      & 168 \\
\verb|\textcopyleft|         & \textcopyleft           & 171 \\
\verb|\textcircledP|         & \textcircledP           & 173 \\
\verb|\textasciimacron|      & \textasciimacron        & 175 \\
\verb|\textasciiacute|       & \textasciiacute         & 180 \\
\verb|\textreferencemark|    & \textreferencemark      & 184 \\
\verb|\textsurd|             & \textsurd               & 187 \\
\midrule % Table 6: Symbols unavailable in TS1 sub-encoding 3 and higher
\verb|textlangle|                & \textlangle               & 60 \\
\verb|\textrangle|               & \textrangle               & 62 \\
\midrule % Table 7: Symbols unavailable in TS1 sub-encoding 4 and higher
\verb|\textleftarrow|            & \textleftarrow            & 24 \\
\verb|\textrightarrow|           & \textrightarrow           & 25 \\
\verb|\textuparrow|              & \textuparrow              & 94 \\
\verb|\textdownarrow|            & \textdownarrow            & 95 \\
\verb|\textcolonmonetary|        & \textcolonmonetary        & 141 \\
\verb|\textwon|                  & \textwon                  & 142 \\
\verb|\textlira|                 & \textlira                 & 146 \\
\verb|\textdong|                 & \textdong                 & 150 \\
\midrule % Table 8: Symbols unavailable in TS1 sub-encoding 5 and higher
\verb|\textnumero|               & \textnumero               & 155 \\
\verb|\textestimated|            & \textestimated            & 157 \\
\midrule % Table 9: Symbols unavailable in TS1 sub-encoding 6 and higher
\verb|\textflorin|               & \textflorin               & 140 \\
\verb|\textcurrency|             & \textcurrency             & 164 \\
\midrule % Table 10: Symbols unavailable in TS1 sub-encoding 7 and higher
\verb|\textfractionsolidus|      & \textfractionsolidus      & 47 \\
\verb|\textminus|                & \textminus                & 61 \\
\verb|\textohm|                  & \textohm                  & 87 \\
\verb|\textmu|                   & \textmu                   & 181 \\
\midrule % Table 11: Symbols unavailable in TS1 sub-encoding 8 and higher
\verb|\textblank|                & \textblank                & 32 \\
\verb|\textinterrobang|          & \textinterrobang          & 148 \\
% \verb|\textinterrobangdown|      & \textinterrobangdown      & 149 \\
\midrule % Table 12: Symbols unavailable in TS1 sub-encoding 9
\verb|\texttwelveudash|          & \texttwelveudash          & 21  \\
\verb|\textthreequartersemdash|  & \textthreequartersemdash  & 22  \\
\verb|\textbardbl|               & \textbardbl               & 134 \\
\verb|\textcelsius|              & \textcelsius              & 137 \\
\verb|\texttwosuperior|          & \texttwosuperior          & 178 \\
\verb|\textthreesuperior|        & \textthreesuperior        & 179 \\
\verb|\textonesuperior|          & \textonesuperior          & 185 \\
\null \\
\bottomrule
\end{tabular}
\end{document}

@FrankMittelbach
Copy link
Member

Maybe something along these lines?

% assumption is that the TS1 encoding subsets reflect what is really available 
% also with the TU encoded fonts, which I trhink is not unrealistic
\makeatletter
\def\tc@check@TU@accent#1{\CheckEncodingSubset\UseTextAccent
                                           {TS1}{#1}}
\DeclareTextCommandDefault{\capitalcedilla}
                            {\tc@check@TU@accent{\c}2\capitalcedilla}
\DeclareTextCommandDefault{\capitalogonek}
                            {\tc@check@TU@accent{\k}2\capitalogonek}
                            
% not sure yet what to do in case of symbols                            
\DeclareTextCommandDefault{\textbigcircle}
   {\CheckEncodingSubset\UseTextSymbol{TS1}\tc@subst\tc@check@symbol2\textbigcircle}
\def\tc@subst{????}
\makeatother

@u-fischer
Copy link
Member

@FrankMittelbach that doesn't work: One still doesn't get a circle, and the cedilla loops.

\documentclass{article}
\makeatletter
\def\tc@check@TU@accent#1{\CheckEncodingSubset\UseTextAccent
                                           {TS1}{#1}}
\DeclareTextCommandDefault{\capitalcedilla}
                            {\tc@check@TU@accent{\c}2\capitalcedilla}
\DeclareTextCommandDefault{\capitalogonek}
                            {\tc@check@TU@accent{\k}2\capitalogonek}
                            
%% not sure yet what to do in case of symbols                            
\DeclareTextCommandDefault{\textbigcircle}
   {\CheckEncodingSubset\UseTextSymbol{TS1}\tc@subst\tc@check@symbol2\textbigcircle}
\def\tc@subst{????}
\makeatother

\usepackage{fontspec}
\setmainfont{TeXGyreHeros}
\begin{document}
\textbigcircle 
%\capitalcedilla x % loops

\end{document}

@muzimuzhi
Copy link
Contributor

How about using the pattern \iffontchar \font<slot> \char<slot>\else <fallback>\fi found in text dash commands like \textnonbreakinghyphen? (They were added by df6e2ba (Merge pull request #508 from latex3/gh404, 2021-02-20).)

latex2e/base/ltoutenc.dtx

Lines 3257 to 3271 in d205f0e

% Unfortunately some fonts do not implement \texttt{"2011}, \texttt{"2012} and/or
% \texttt{"2015} (including the \LaTeX{} default fonts for Unicode
% engines) so we provide some approximations if the glyph is
% missing, like we do for \texttt{OT1} and \texttt{T1}.
%
% The \verb=\nobreak\hskip\z@= is there to prevent a break after
% the hyphen but allow later breaks in the remainder of the word.
% \begin{macrocode}
\DeclareUnicodeCommand{\textnonbreakinghyphen}
{\iffontchar\font "2011 \char "2011 \else \mbox{-}\nobreak\hskip\z@ \fi}
\DeclareUnicodeCommand{\textfiguredash}
{\iffontchar\font "2012 \char "2012 \else \char "2013 \fi}
\DeclareUnicodeCommand{\texthorizontalbar}
{\iffontchar\font "2015 \char "2015 \else \char "2014 \fi}
% \end{macrocode}

@FrankMittelbach
Copy link
Member

FrankMittelbach commented Feb 10, 2025

@FrankMittelbach that doesn't work: One still doesn't get a circle, and the cedilla loops.

hmm, there is no working definition for circle, so that is no surprised, but for me cedilla didn't loop, strange.

@muzimuzhi yes we could do something like that, but that still begs the question, what kind of fallback should be provided (unless we make it an error)

@davidcarlisle
Copy link
Member

for bigcircle you could fall back to math \ensuremath{\bigcirc} for \capitalcedilla and friends could fall back to the standard accents.

@FrankMittelbach
Copy link
Member

yes, but what about the others?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants