Repository navigation
Improve positioning of multiple accents and attachments - #3059
Merged
Merged
Conversation
Contributor
|
Nice! Does this fix #3043 ? If so, could you please add a test case for it as well? If not, don't let that issue block the PR. |
Contributor
Author
|
No, unfortunately it doesn't. As primes are attached with the As a workaround, you can use something like |
Member
|
Thank you! |
1 task done
Dikluwe
pushed a commit
to Dikluwe/typst-crystalline
that referenced
this pull request
Sep 12, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #1672
The accent attachment position and italics correction is now stored in the fragment, so that it can be preserved when new elements create a frame fragment around it. This happens in
accent,cancelandopelements, thus stacked accents are now properly aligned on top of each other.In #1129, the positioning of attachments for character boxes was fixed. However, that only worked for "pure" characters, so
accentorcancelelements were not considered as character boxes. To fix that, I introduced thetext_likeproperty for each math fragment, which replaces theis_character_boxcheck. This property is set to true forlayout_text(to keep current behavior of attachments for large operators like
sumandintegral)accent,cancelandopif the underlying fragment is text likeA more difficult contender is
MathRowas there is no single base fragment from where the property values can be inherited.There are some small differences, as previously all "atomic text frames" were character boxes, whereas now that is only the case for frame fragments with
text_likeset to true. This means that when wrapping a text-like fragment in a box or similar, the properties are not preserved. For example:renders as (left: old behavior, right: new behavior)
As can be seen, the boxed version is no longer considered a character box as the
text_likeproperty is lost with thebox, thus the top attachment is shifted up more.Maybe this solution is a bit too naive, but until a bigger refactor is planned, it should be alright.