Open Bug 1507975 Opened 6 years ago Updated 2 years ago

Bake spacing information into gfxShapedText

Categories

(Core :: Graphics: Text, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: jrmuizel, Unassigned)

References

(Blocks 3 open bugs)

Details

As I understand it we currently build the spacing information for a text run everytime we draw it by calling gfxTextRun::GetAdjustedSpacingArray. Instead of this it seems like we should be able to adjust for the spacing while we're doing shaping. This is the approach that Chrome takes.

Doing this will saves time gathering the spacing information as well as adjusting the advances during paint. It also move gfxTextRun more towards being immutable which will be useful for when we want to cache the glyph areas with WebRender.
Blocks: 1422039
Blocks: text-caching
Jonathan, can you think of reasons we wouldn't want to do this?
Flags: needinfo?(jfkthame)
It seems like this could also speed up MeasureCharClippedText which accounts 6.7% of webrender text painting time.
I'm not sure "while we're doing shaping" would be the right time to adjust for spacing, as we have to consider spacing generated by justification or tab-stops, which isn't known until after we've shaped text and constructed textruns (in order to measure the "unspaced" text and figure out what spacing to add).

But I can imagine that caching the computed spacing somehow might be worthwhile, or "applying" it to the shaped textrun (if we can be sure that the textrun will be refreshed if something changes that would affect the spacing we computed). Doing all the work of GetAdjustedSpacingArray every time we draw does seem excessive.
Flags: needinfo?(jfkthame)
Blocks: 1509158
Priority: -- → P3
No longer blocks: 1422039
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.