Open Kerollmops opened 3 years ago
Hi,
To use unscaled metrics, You can pass Font::units_per_em() to the px
parameter, but I couldn't find a way to get side bearing.
In my opinion, we cannot get the other values we need. For instance, the outline rectangle(a.k.a bounding box)*1 is (xMin,xMax,yMin,yMax) in the glyf table.
1) (advanceWidth, ascender - descender + lineGap) is the outside of bounding box.
In my opinion, we cannot get the other values we need. For instance, the outline rectangle(a.k.a bounding box)*1 is (xMin,xMax,yMin,yMax) in the glyf table.
@tasogare3710 This exists and is well documented https://docs.rs/fontdue/latest/fontdue/struct.Metrics.html
@Kerollmops What you want to do is achievable in the API, but you would need to provide your own layout. I don't have any intentions currently to add variably sized layouts, but it's definitely neat. Scale factoring is also well documented.
Hey,
I was trying your library, it seems to be very complete, thank you. I am trying to find the biggest scale of a text to make it fill a rectangle.
I found the
Layout
struct that outputs the list of glyphs positions, problem is thatappending
text to this layout requires apx
parameter.What I har in mind was that I could use the
Font
and my text to know the max ascent and max descent of the glyphs of my text, also using those glyphs to know the width it takes. Then, by using a simple calculus I could compute the scale my text needs to be to fit in height and width in my rectangle.What do you think? I am not even sure I can rely on a simple multiplication to compute the ideal scale.