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

Implement under/over parens/shells, refactor code #3869

Closed
wants to merge 1 commit into from

Conversation

frozolotl
Copy link
Contributor

@frozolotl frozolotl commented Apr 4, 2024

I decided to use the word shell instead of turtle or tortoise because I think it is a bit clearer, the word reads nicer (“overshell” vs “overturtle”), and there is no associated discussion (they are called “tortoise shells” in Unicode):

tortoises and turtles are not the same thing!
~ @Enivex

There will be a sibling PR to rename the symbols too.

Additionally, I refactored some code to make it more readable.
I also fixed a bug introduced in #3262 where the wrong script style was being used.

Closes #3856.

frozolotl added a commit to frozolotl/typst that referenced this pull request Apr 4, 2024
frozolotl added a commit to frozolotl/typst that referenced this pull request Apr 4, 2024
@frozolotl frozolotl mentioned this pull request Apr 4, 2024
frozolotl added a commit to frozolotl/typst that referenced this pull request Apr 4, 2024
I decided to use the word `shell` instead of turtle or tortoise because I
think it is a bit clearer, the word reads nicer (“overshell” vs “overturtle”),
and there is no associated discussion (they are called “tortoise shells” in
Unicode):

> tortoises and turtles are not the same thing!
~ @Enivex

There will be a sibling PR to rename the symbols too.

Additionally, I refactored some code to make it more readable.
I also fixed a bug introduced in typst#3262 where the wrong script style was being used.

Closes typst#3856.
let (above_style, below_style);
let annot_styles = match position {
Position::Above => {
above_style = style_for_subscript(styles);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the annotation is above, it should use superscript style, if it is below, it should use subscript style.

} else {
sub_style = style_for_subscript(styles);
styles.chain(&sub_style)
let baseline = match position {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, at the cost of duplicating the ctx.layout_into_run(annotation, annot_styles)?, we could put everything into one match and simplify things a bit. no need to do the let (above_style, below_style); lifetime dance and we can use insert directly rather than reverse.

@laurmaedje laurmaedje added the waiting-on-author Pull request waits on author label Apr 13, 2024
@laurmaedje
Copy link
Member

Closing due to inactivity. Feel free to reopen if you still want to work on this!

@laurmaedje laurmaedje closed this May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-author Pull request waits on author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add missing over/under-delimiters
2 participants