Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I compute the bounding box of a text string without loading its glyphs before?

0
10 Posted

How can I compute the bounding box of a text string without loading its glyphs before?

0
10

This is not possible in general. Reason is that hinting distorts the glyph shape for optimal rasterization, and this process sometimes creates outlines which have considerably different metrics. The TrueType format provides the (optional) ‘hdmx’ table which contains device horizontal metrics for selected pixel sizes, but even here the vertical metrics are missing. It is probably best to use both a glyph and a metrics cache to avoid recomputation.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123