[cairo-commit] 4 commits - src/cairo-colr-glyph-render.c src/cairo-ft-font.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jan 17 20:22:52 UTC 2023
src/cairo-colr-glyph-render.c | 4 +++-
src/cairo-ft-font.c | 29 +++++++++++++++++++++++------
2 files changed, 26 insertions(+), 7 deletions(-)
New commits:
commit 1c544160b9a7445c948af09c79146648c7b88849
Merge: ec107d569 f64271447
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Tue Jan 17 20:22:50 2023 +0000
Merge branch 'colrv1-fixes' into 'master'
COLR v1 font render fixes
Closes #624 and #623
See merge request cairo/cairo!407
commit f6427144737a35e2e3389d99c533ec476cde516f
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Tue Jan 17 23:06:31 2023 +1030
colrv1: Fix palette alpha
Fixes #624
diff --git a/src/cairo-colr-glyph-render.c b/src/cairo-colr-glyph-render.c
index 2388d9e02..3278a76e8 100644
--- a/src/cairo-colr-glyph-render.c
+++ b/src/cairo-colr-glyph-render.c
@@ -235,15 +235,17 @@ get_palette_color (cairo_colr_glyph_render_t *render,
color->red = 0;
color->green = 0;
color->blue = 0;
+ color->alpha = 1;
foreground = TRUE;
} else {
FT_Color c = render->palette[ci->palette_index];
color->red = c.red / 255.0;
color->green = c.green / 255.0;
color->blue = c.blue / 255.0;
+ color->alpha = c.alpha / 255.0;
}
- color->alpha = double_from_2_14 (ci->alpha);
+ color->alpha *= double_from_2_14 (ci->alpha);
if (foreground)
*is_foreground_color = TRUE;
}
commit 4da39d34a73ff3b29ebc91e6157654620e574e64
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Tue Jan 17 22:57:59 2023 +1030
colrv1: Don't use EM size when hint metrics is off
Fixes #623
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 7bb7d953a..6ff142f76 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -3350,15 +3350,30 @@ _cairo_ft_scaled_glyph_init_metrics (cairo_ft_scaled_font_t *scaled_font,
scaled_glyph,
face,
&fs_metrics);
+ if (unlikely (status))
+ return status;
}
#endif
#if HAVE_FT_COLR_V1
if (glyph_priv->format == CAIRO_FT_GLYPH_TYPE_COLR_V1) {
+ if (!hint_metrics) {
+ status = _cairo_ft_scaled_glyph_load_glyph (scaled_font,
+ scaled_glyph,
+ face,
+ load_flags | color_flag,
+ FALSE,
+ vertical_layout);
+ if (unlikely (status))
+ return status;
+ }
+
status = (cairo_int_status_t)_cairo_ft_scaled_glyph_init_record_colr_v1_glyph (scaled_font,
scaled_glyph,
face,
&fs_metrics);
+ if (unlikely (status))
+ return status;
}
#endif
commit ded2092e209d766bf65b51679944968cbb917f7a
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Tue Jan 17 22:34:37 2023 +1030
Ensure outline font is used when CAIRO_COLOR_MODE_NO_COLOR is set
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 6db833c83..7bb7d953a 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -3295,6 +3295,7 @@ _cairo_ft_scaled_glyph_init_metrics (cairo_ft_scaled_font_t *scaled_font,
/* We need to load color to determine if this is a color format. */
int color_flag = 0;
+
#ifdef FT_LOAD_COLOR
if (scaled_font->unscaled->have_color && scaled_font->base.options.color_mode != CAIRO_COLOR_MODE_NO_COLOR)
color_flag = FT_LOAD_COLOR;
@@ -3317,12 +3318,13 @@ _cairo_ft_scaled_glyph_init_metrics (cairo_ft_scaled_font_t *scaled_font,
if (is_svg_format) {
glyph_priv->format = CAIRO_FT_GLYPH_TYPE_SVG;
} else if (face->glyph->format == FT_GLYPH_FORMAT_OUTLINE) {
- if (_cairo_ft_scaled_glyph_is_colr_v1 (scaled_font, scaled_glyph, face))
- glyph_priv->format = CAIRO_FT_GLYPH_TYPE_COLR_V1;
- else if (_cairo_ft_scaled_glyph_is_colr_v0 (scaled_font, scaled_glyph, face))
- glyph_priv->format = CAIRO_FT_GLYPH_TYPE_COLR_V0;
- else
- glyph_priv->format = CAIRO_FT_GLYPH_TYPE_OUTLINE;
+ glyph_priv->format = CAIRO_FT_GLYPH_TYPE_OUTLINE;
+ if (color_flag) {
+ if (_cairo_ft_scaled_glyph_is_colr_v1 (scaled_font, scaled_glyph, face))
+ glyph_priv->format = CAIRO_FT_GLYPH_TYPE_COLR_V1;
+ else if (_cairo_ft_scaled_glyph_is_colr_v0 (scaled_font, scaled_glyph, face))
+ glyph_priv->format = CAIRO_FT_GLYPH_TYPE_COLR_V0;
+ }
} else {
/* For anything else we let FreeType render a bitmap. */
glyph_priv->format = CAIRO_FT_GLYPH_TYPE_BITMAP;
More information about the cairo-commit
mailing list