-
Notifications
You must be signed in to change notification settings - Fork 331
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
font issue in typst tables with gt with strings containing numbers and letters #11683
Comments
Thanks. I was also not sure where to post this issue but just wanted to be sure that this is not on the quarto side. I will check what my system is doing. |
Let's keep this open at least for now - the behavior does feel unintuitive to me, so I'd like to understand it better. |
ReproOkay, I have a simple repro in Typst on macOS. #[
#set text(font: ("Apple Color Emoji") , size: 12pt); #table(
columns: 2,
align: (left,right,),
table.header(table.cell(align: bottom + left, fill: rgb("#ffffff"))[#set text(size: 1.0em , fill: rgb("#333333")); a], table.cell(align: bottom + right, fill: rgb("#ffffff"))[#set text(size: 1.0em , fill: rgb("#333333")); b],),
table.hline(),
table.cell(align: horizon + left, stroke: (top: (paint: rgb("#d3d3d3"), thickness: 0.75pt)))[aa111bbb], table.cell(align: horizon + right, stroke: (top: (paint: rgb("#d3d3d3"), thickness: 0.75pt)))[1],
table.cell(align: horizon + left, stroke: (top: (paint: rgb("#d3d3d3"), thickness: 0.75pt)))[abcdef], table.cell(align: horizon + right, stroke: (top: (paint: rgb("#d3d3d3"), thickness: 0.75pt)))[2],
)
] Root causeThe Apple Color Emoji font, installed on Macs, supports numbers but not letters. This is probably true of other emoji fonts. If the first available font in the list is an emoji font, then the numbers will be bigger than the rest of the text. because emoji fonts have large glyph sizes. The rest of the text will have a fallback font provided by Typst, unless disabled with #set text(fallback: false) If my theory is correct, then none of the fonts
are installed on @schochastics's machine, or they are not available to Typst. But at least one of the emoji fonts
is installed and available. ( Font stacksIf there is a Quarto issue here, it is we translate CSS font lists into Typst font lists verbatim. But "font stacks" like Conceivably, we could substitute lists of appropriate fonts for "font stacks", at the mild maintenance burden of having to maintain such lists. Our current behavior is surprising because the intent of the font list
is clearly "choose a nice looking or at least sans serif font for text, and one of these emoji fonts for emoji". Not "use an emoji font for the numbers and a fallback font for the text". For now I can add a note about this to the advanced docs on troubleshooting Typst fonts tracked in #11278. Similar to that issue, we again see that the letters have an unexpected serif font (the Typst default font). |
Bug description
When I render a gt table in typst that contains strings that mix letters and digits (e.g. "aaa111aaa") the font switches and the string renders weirdly.
Steps to reproduce
I get the following result:
The produced typst code for the gt table looks like this:
Expected behavior
When I remove
from the intermediate typ file, I get the correct table when I compile that file
after playing around a bit, setting the font explicitly via
gt::opt_table_font()
also removes the weird behavio.Actual behavior
No response
Your environment
Positron Version 2024.12.0 build 80
Quarto check output
The text was updated successfully, but these errors were encountered: