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

Uppercase strings rather than chars for small-caps #5938

Open
SimonSapin opened this issue May 4, 2015 · 0 comments
Open

Uppercase strings rather than chars for small-caps #5938

SimonSapin opened this issue May 4, 2015 · 0 comments

Comments

@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented May 4, 2015

Currently, font-variant: small-caps is implemented with synthesized small caps: transform the text to upper case and use a smaller font size. gfx::font::glyph_index contains code like codepoint.to_uppercase().next().unwrap() to find the upper case of a single code point. .next().unwrap() takes the first char in the iterator returned by char::to_uppercase and drops the rest.

This is OK at the moment since the iterator always of length 1. But in the future, it will do complex case mapping and may yield more than one char, and the rest should not be dropped. See rust-lang/rust#23126

The small-caps implementation should probably use str::to_uppercase earlier in the code, before considering individual chars.

However it may not be as easy as upper-casing entire text nodes, we only want to reduce the font size of things that were previously lower-case.

bors-servo added a commit that referenced this issue Jan 4, 2018
Uppercase strings rather than chars for small-caps

<!-- Please describe your changes on the following line: -->
use `str::to_uppercase` earlier in the code, rather than doing individual chars.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix  #5938(github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19678)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.