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 Synthetic Bold Support #1653

Closed
Gankra opened this issue Sep 1, 2017 · 2 comments
Closed

Implement Synthetic Bold Support #1653

Gankra opened this issue Sep 1, 2017 · 2 comments

Comments

@Gankra
Copy link
Contributor

@Gankra Gankra commented Sep 1, 2017

Some fonts don't natively support bold, and force the browser to synthesize them. The synthesis is fairly simple: draw each glyph multiple times, with horizontal offset. In fact servo/gecko could just feed us multiple copies of each char to do it for us... except that wouldn't produce the correct result for transparent text. Requiring the browser to generate a stacking context with transparency would be wasteful, I think.

"synthetic bold" should be made a font instance key, as introduced in #1602

Sadly, I don't have a good synthetic-bold-needing example yet.

@Gankra
Copy link
Contributor Author

@Gankra Gankra commented Sep 1, 2017

Ah found an example by grabbing something from adobe's free font collection:

<script src="http://use.edgefonts.net/basic.js"></script>
<p style="font-weight: bold">
Native Bold
<span style='color: rgba(0,0,0, 0.5)'>
Native Transparent Bold
</span>
<span style='font-family: "basic"'>
Synthetic Bold
</span>
<span style='font-family: "basic"; color: rgba(0,0,0, 0.5)'>
Synthetic Transparent Bold
</span>
</p>
@Gankra
Copy link
Contributor Author

@Gankra Gankra commented Sep 1, 2017

Gecko+webrender today does everything right except the last one, because it sends us double glyphs to emulate the bold, but in that case expects transparency to be implemented by the DrawTarget.

bors-servo added a commit that referenced this issue Dec 4, 2017
fake bold for Mac font backend

Mac is the only platform that did not yet support synthetic bold. This solves it by using multi-striking in the same way Gecko does. This resolves #1653 and https://bugzilla.mozilla.org/show_bug.cgi?id=1394570

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2155)
<!-- 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.

1 participant
You can’t perform that action at this time.