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

Make Adjust::apply, Placement::combine_distance and Placement::combine_anchor public #36

Open
fschutt opened this issue Dec 7, 2020 · 3 comments

Comments

@fschutt
Copy link
Contributor

fschutt commented Dec 7, 2020

In order to layout a text line from the Vec<gpos::Info> it would be nice to be able to calculate the glyph positions. The Adjust::apply, Placement::combine_distance and Placement::combine_anchor functions already do that, but they're not public functions, is this intentional?

@fschutt fschutt changed the title Make Adjust::apply public Make Adjust::apply, Placement::combine_distance and Placement::combine_anchor public Dec 7, 2020
@wezm
Copy link
Contributor

wezm commented Dec 7, 2020

These methods are internal and already run as part of gpos. They are used to update the placement field on gpos::Info as part of that process. I'll work on updating the shaping example to include positioning information.

We plan to roll positioning information into the the output of shape but haven't quite got there yet. I've been working on improving the API recently in preparation for a 0.5 release. You might like to check out the master branch of allsorts and the draft PR I have open on the allsorts-tools repo.

@fschutt
Copy link
Contributor Author

fschutt commented Dec 8, 2020

Yeah I'm currently just calling .get_horizontal_advance on every glyph and adding the kerning on top. As I understand it, there can be only one glyph -> multiple codepoints, right? HarfBuzz has extra "clusters" (where one glyph can be made up of multiple parts), I'm not sure whether control over clusters is exposed in the API right now.

Thanks for doing the work of porting font shaping, btw, I've had lots of people with problems installing my crates since they rely on HarfBuzz and HarfBuzz doesn't always compile out of the box (since you need cmake to build it, etc.). Also I can now run my crate on wasm32, so that's a plus.

@wezm
Copy link
Contributor

wezm commented Dec 8, 2020

I'm currently just calling .get_horizontal_advance on every glyph and adding the kerning on top.

Yes that will get you a lot of the way there.

As I understand it, there can be only one glyph -> multiple codepoints, right?

Yes that's right.

HarfBuzz has extra "clusters" (where one glyph can be made up of multiple parts), I'm not sure whether control over clusters is exposed in the API right now.

We don't have the concept of clusters. What they allow (mapping shaping output back to input text) is another one of the things that we plan to get to eventually. #31

Thanks for doing the work of porting font shaping, btw, I've had lots of people with problems installing my crates since they rely on HarfBuzz and HarfBuzz doesn't always compile out of the box (since you need cmake to build it, etc.). Also I can now run my crate on wasm32, so that's a plus.

This is really great to hear. Thanks for sharing 😀

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

No branches or pull requests

2 participants