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

Change smallcaps into an element function #3981

Merged
merged 5 commits into from May 6, 2024

Conversation

Coekjan
Copy link
Contributor

@Coekjan Coekjan commented Apr 22, 2024

Description

Different from upper and lower, smallcaps is not always supported by selected font (for example, default font in math equation). In my view, smallcaps is more like emph, strong, etc. so I suggest it should be element function (#3977 ).

This pr closes #3977 and maybe can help those who want to use smallcaps in math equations (#3138 ).

Usage

With this feature, users can customize smallcaps behavior with set/show rules:

#set align(center)

$ #smallcaps[SmallCaps] $

#show smallcaps: set text(font: "linux libertine", fill: blue)

$ #smallcaps[SmallCaps] $

#show math.equation: it => {
  show smallcaps: set text(font: "linux libertine", fill: red)
  it
}

$ #smallcaps[SmallCaps inside Math Equation] $

#smallcaps[SmallCaps outside Math Equation]

image

TODO?

  • Should I add some testcases to verify the behavior? If so, how can I add testcases?
  • Should documentation on smallcaps be changed? If so, I can add examples about the set/show rules on smallcaps.

Copy link
Member

@laurmaedje laurmaedje left a comment

Choose a reason for hiding this comment

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

Should I add some testcases to verify the behavior? If so, how can I add testcases?

The only existing smallcaps test is in tests/suite/text/smallcaps.typ. You can add a new test there by adding another --- smallcaps-... --- line there and adding your test code below. For instructions on how to run the tests, see the README.md in tests.

Should documentation on smallcaps be changed? If so, I can add examples about the set/show rules on smallcaps.

We could add a second example showing how to use a custom font, i.e. #show smallcaps: set text(font: "..") and adjust the Note in the docs.

crates/typst/src/text/smallcaps.rs Show resolved Hide resolved
@Coekjan Coekjan force-pushed the smallcaps-elem-fn branch 3 times, most recently from 03b64e7 to 1e4d24b Compare April 30, 2024 14:03
@Coekjan Coekjan requested a review from laurmaedje April 30, 2024 14:04
@Coekjan
Copy link
Contributor Author

Coekjan commented May 1, 2024

Hi @laurmaedje , I've made the requested changes to this PR and was hoping you could find time for another review when convenient. Thank you!

@Coekjan Coekjan changed the title Change smallcaps into element function Change smallcaps into an element function May 3, 2024
@laurmaedje laurmaedje enabled auto-merge May 6, 2024 12:53
@laurmaedje
Copy link
Member

Thanks for your contribution!

@laurmaedje laurmaedje added this pull request to the merge queue May 6, 2024
Merged via the queue into typst:main with commit 556979c May 6, 2024
6 checks passed
@Coekjan Coekjan deleted the smallcaps-elem-fn branch May 7, 2024 02:22
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

Successfully merging this pull request may close these issues.

Let smallcaps be element function
2 participants