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

Embolden #4097

Merged
merged 22 commits into from Feb 10, 2023
Merged

Embolden #4097

merged 22 commits into from Feb 10, 2023

Conversation

behdad
Copy link
Member

@behdad behdad commented Feb 1, 2023

Fixes #3883

@behdad behdad marked this pull request as draft February 1, 2023 23:32
@behdad
Copy link
Member Author

behdad commented Feb 1, 2023

Todo:

  • Relicense the code from FreeType authors (contacted),
  • Docs.
  • Add hb_font_t API and hook it up. Currently embolden amount hardcoded.
  • Adapt advances
  • Adapt shaping to it. No one else does. Ignore for now.
  • Figure out if parent-draw adapter needs any changes; well. We probably are not going to change bolding between parent/child... Or maybe we do. Humm. Emboldening happens at the hb-ot-font layer; seems like it wouldn't need any changes there.
  • Glyph extents.
  • Font extents. The rest of metrics we're not going to try.

@matthiasclasen
Copy link
Collaborator

I've added some docs.

@behdad
Copy link
Member Author

behdad commented Feb 2, 2023

@khaledhosny rightly pointed out that adjusting the advance-widths unfortunately breaks Arabic fonts that use rounded edges for their connecting strokes. We can't ignore that unfortunately. So I'm stuck as to how to proceed. Khaled also mentioned that in LibreOffice he uses unadjusted advance-widths and so far no one complained.

If using unadjusted advance-widths though, I think we should NOT shift the glyph shape horizontally then. Which I can do. But then we should also unshift the FreeType outlines in hb-ft. I think we should still shift them vertically such that they sit on the baseline.

All of this ends up who knows where in vertical writing....

@behdad

This comment was marked as outdated.

@khaledhosny
Copy link
Collaborator

@khaledhosny rightly pointed out that adjusting the advance-widths unfortunately breaks Arabic fonts that use rounded edges for their connecting strokes. We can't ignore that unfortunately. So I'm stuck as to how to proceed. Khaled also mentioned that in LibreOffice he uses unadjusted advance-widths and so far no one complained.

If using unadjusted advance-widths though, I think we should NOT shift the glyph shape horizontally then. Which I can do. But then we should also unshift the FreeType outlines in hb-ft. I think we should still shift them vertically such that they sit on the baseline.

All of this ends up who knows where in vertical writing....

There are other cases where keeping advance width is desired like monospace fonts or using emboldening to achieve something like grade. I think it might be worth while to add an option or a flag to control advance adjustment and shift in both directions.

@behdad
Copy link
Member Author

behdad commented Feb 3, 2023

There are other cases where keeping advance width is desired like monospace fonts or using emboldening to achieve something like grade. I think it might be worth while to add an option or a flag to control advance adjustment and shift in both directions.

Matthias had the same idea. Okay I'm convinced.

@behdad
Copy link
Member Author

behdad commented Feb 7, 2023

Okay so then to hb-view I'll add --font-bold and --font-grade?

@behdad behdad force-pushed the embolden branch 2 times, most recently from 5beb94f to ce3abac Compare February 7, 2023 18:47
Adds --font-grade to hb-view and hb-shape.
@behdad
Copy link
Member Author

behdad commented Feb 7, 2023

@khaledhosny @matthiasclasen How does this look?

@behdad behdad marked this pull request as ready for review February 7, 2023 18:57
@behdad
Copy link
Member Author

behdad commented Feb 7, 2023

  • Glyph extents.
  • Font extents. The rest of metrics we're not going to try.

Working on these.

@behdad
Copy link
Member Author

behdad commented Feb 7, 2023

Should grade shift glyphs up or not? Currently it does. @khaledhosny @davelab6

@behdad
Copy link
Member Author

behdad commented Feb 7, 2023

  • Glyph extents.
  • Font extents. The rest of metrics we're not going to try.

Working on these.

Done. I think this is good to land now. I can work on hb-ot-metrics later.

src/hb-font.cc Outdated Show resolved Hide resolved
@matthiasclasen
Copy link
Collaborator

Looks good to me apart from those two comments.

@matthiasclasen
Copy link
Collaborator

Thanks for the explanation!

@behdad behdad merged commit 8302da8 into main Feb 10, 2023
22 checks passed
@behdad behdad deleted the embolden branch February 10, 2023 19:50
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.

[draw] embolden outlines?
3 participants