Open Bug 1744523 Opened 3 years ago Updated 3 years ago

Consider making access to font metrics more granular

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement

Tracking

()

People

(Reporter: jfkthame, Unassigned)

References

Details

Currently, Gecko_GetFontMetrics returns a structure containing all the font metrics that are potentially needed to resolve font-relative CSS units.

Previously, this just meant the 'ch' and 'ex' values, which are reasonably cheap to retrieve from the pres-context via an nsFontMetrics. However, the 'ic' value (introduced in bug 1531223) may be significantly more expensive, because it will frequently require a font fallback search to determine what font would be used to render the U+6C34 ideograph; it can't just read a metric from the first available font.

As many pages will make use of ch or ex units, but never refer to ic, it is unfortunate to always perform that font search/additional instantiation, just to get a metric that is likely to be redundant.

Therefore, we should probably separate the GeckoFontMetrics struct into individual fields, or at least split off the mIcWidth field, so that it can be retrieved only if actually needed.

You need to log in before you can comment on or make changes to this bug.