Repository navigation
Add warning when glyph is not found - #6989
Closed
Andrew15-5 wants to merge 1 commit into
Closed
Andrew15-5 wants to merge 1 commit into
Andrew15-5 wants to merge 1 commit into
Conversation
Andrew15-5
marked this pull request as draft
October 6, 2025 01:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5137.
I was about to ask how hard is it to implement #5137, but then I looked inside, and there is a clear place where compiler knows that font family is not found and there is even access to
engineto collect the warning. So it's really easy.However,
engineis under a shared reference and I don't know how to get span for the warned text/glyph. So I changedengineto be a mutable reference as well as I added missing spans to the function body. I only then realized thatPreparationhas the needed spans inside, so the change reduced a little.I still don't know how to get accurate spans, like in the
ShapedText::build. But offset 0 works not that bad for a simple example:The warning text can be so many things, so I have no idea what to print. Also being able to check for
--font-pathand--ignore-system-fontsflags can improve hint precision. Also can't add native hints inwarning!.Anyway, looks like it's pretty much ready, other than engine/span/message issues. I mean, it works, which is nice to see.
Since it's unreasonable to go through almost hundred pages in a PDF to see if there are any tofus in it (search doesn't work), this warning is a life savior, making sure that Typst uses your specified fonts/system fonts, but you will not have any oopsie-daisy when you want to print or share the PDF. It takes yet another hard task off your shoulders. I just tried it on a big document, and no warnings. I guess I'm good.