Issue #3039 - Extend cairo API with an explicit font_get_hint_metrics function.

This extension allows us to get font hint metrics without having to create and
destroy cairo font options structs. Since this is used in loops, this will
improve performance, especially in documents which have many text segments.
This commit is contained in:
Moonchild 2021-11-20 16:58:45 +00:00 committed by roytam1
commit 517a6b90a3
5 changed files with 26 additions and 4 deletions

View file

@ -591,11 +591,8 @@ gfxFontShaper::GetRoundOffsetsToPixels(DrawTarget* aDrawTarget,
}
// Sometimes hint metrics gets set for us, most notably for printing.
cairo_font_options_t *font_options = cairo_font_options_create();
cairo_scaled_font_get_font_options(scaled_font, font_options);
cairo_hint_metrics_t hint_metrics =
cairo_font_options_get_hint_metrics(font_options);
cairo_font_options_destroy(font_options);
cairo_scaled_font_get_hint_metrics(scaled_font);
switch (hint_metrics) {
case CAIRO_HINT_METRICS_OFF: