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

Text metrics #13

Closed
deviator opened this issue Oct 2, 2018 · 8 comments
Closed

Text metrics #13

deviator opened this issue Oct 2, 2018 · 8 comments

Comments

@deviator
Copy link
Contributor

deviator commented Oct 2, 2018

I think base render api must provide functions for getting metrics of text with selected style (font, size etc) like a width and height of string (may be more metrics).

FreeType provides width, height, horiBearingX, horiBearingY, horiAdvance, vertBearingX, vertBearingY, vertAdvance about glyph.
https://www.freetype.org/freetype2/docs/tutorial/step2.html

It's useful for develop highlevel libraries for example for rendering TeX formulas, tables with text and etc.

@p0nce
Copy link
Collaborator

p0nce commented Oct 2, 2018

Yes indeed the rendering context should give back text metrics.
We should look at the Canvas API not FreeType imo, since PDF and SVG use the right bearing, horizontal advance between characters, also it would be inefficient to feed character by character instead of at least word by word.

@deviator
Copy link
Contributor Author

deviator commented Oct 2, 2018

I agree, I used feed by glyph as an example only.

@p0nce
Copy link
Collaborator

p0nce commented Dec 9, 2018

@p0nce
Copy link
Collaborator

p0nce commented Dec 9, 2018

Depends on #16

@p0nce p0nce mentioned this issue Feb 3, 2019
@p0nce
Copy link
Collaborator

p0nce commented Feb 3, 2019

Implemented width aka advance, further work depends on #17

@p0nce
Copy link
Collaborator

p0nce commented Feb 29, 2020

@p0nce
Copy link
Collaborator

p0nce commented Feb 13, 2022

For flow layout we need both horiAdvance and width.

@p0nce
Copy link
Collaborator

p0nce commented Feb 19, 2022

Fixed, though some values aren't good.

@p0nce p0nce closed this as completed Feb 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants