diff options
author | John Ralls <jralls@ceridwen.us> | 2022-04-23 14:36:15 -0700 |
---|---|---|
committer | John Ralls <jralls@ceridwen.us> | 2022-04-25 11:30:10 -0700 |
commit | 2784159d0e57b409477cfcb25ddcce3227379a6f (patch) | |
tree | efb9f27951255999935a61cc3266f03e89caa004 | |
parent | c755e48c2e5da7f10956de1c3560180510e84d1f (diff) |
[quartz] Adjust x_extents metric.
CoreText uses different advances depending on the font size, with very
small point sizes sometimes getting advances that are smaller than the
glyph's width. This is manifested in the Apple Color Emoji font with the
Emoji glyphs having a width of 1.25 and an advance width of 1.0. That
results in overlapping emoji when they're in a string.
The small spacing difference also affects 3 tests so updated reference
images are included in this commit.
# Please enter the commit message for your changes. Lines starting
-rw-r--r-- | src/cairo-quartz-font.c | 7 | ||||
-rw-r--r-- | test/reference/inverse-text.quartz.ref.png | bin | 2565 -> 2602 bytes | |||
-rw-r--r-- | test/reference/pdf-operators-text.quartz.ref.png | bin | 0 -> 8226 bytes | |||
-rw-r--r-- | test/reference/select-font-face.quartz.ref.png | bin | 2645 -> 2691 bytes |
4 files changed, 6 insertions, 1 deletions
diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c index 000a0e237..641a2dfc7 100644 --- a/src/cairo-quartz-font.c +++ b/src/cairo-quartz-font.c @@ -412,7 +412,12 @@ _cairo_quartz_init_glyph_metrics (cairo_quartz_scaled_font_t *font, extents.y_bearing = - ymax; extents.width = xmax - xmin; extents.height = ymax - ymin; - extents.x_advance = advance.width; +/* At the necessary 1.0pt ctFont size some glyphs get a reduced + * advance that causes overlaps when scaled up. We can avoid that by + * using the width instead if it's wider. Since cairo doesn't support + * vertical font layout we don't do the same for y_advance. + */ + extents.x_advance = MAX(extents.width, advance.width); extents.y_advance = advance.height; #ifdef DEBUG diff --git a/test/reference/inverse-text.quartz.ref.png b/test/reference/inverse-text.quartz.ref.png Binary files differindex df0ea57ea..f57f45035 100644 --- a/test/reference/inverse-text.quartz.ref.png +++ b/test/reference/inverse-text.quartz.ref.png diff --git a/test/reference/pdf-operators-text.quartz.ref.png b/test/reference/pdf-operators-text.quartz.ref.png Binary files differnew file mode 100644 index 000000000..ecfa7cc5d --- /dev/null +++ b/test/reference/pdf-operators-text.quartz.ref.png diff --git a/test/reference/select-font-face.quartz.ref.png b/test/reference/select-font-face.quartz.ref.png Binary files differindex 69fd2e239..1100fe28c 100644 --- a/test/reference/select-font-face.quartz.ref.png +++ b/test/reference/select-font-face.quartz.ref.png |