[cairo-commit] 2 commits - src/cairo-font-options.c src/cairoint.h src/win32

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 27 10:44:33 UTC 2023


 src/cairo-font-options.c        |    1 +
 src/cairoint.h                  |    1 +
 src/win32/cairo-dwrite-font.cpp |   11 ++++++++++-
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 407bb0a478890c2640c326fab0642d8595407ba1
Merge: 22d0cd1ec 75d876ee2
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Fri Jan 27 10:44:31 2023 +0000

    Merge branch 'dwrite-custom-palette' into 'master'
    
    dwrite: use custom palette when rendering COLRv0
    
    See merge request cairo/cairo!424

commit 75d876ee2966d7c35e35234382e3842be3b40935
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Thu Jan 26 13:14:59 2023 +1030

    dwrite: use custom palette when rendering COLRv0

diff --git a/src/cairo-font-options.c b/src/cairo-font-options.c
index 4eac64da9..458f2c77d 100644
--- a/src/cairo-font-options.c
+++ b/src/cairo-font-options.c
@@ -830,3 +830,4 @@ cairo_font_options_get_custom_palette_color (cairo_font_options_t *options,
 
     return CAIRO_STATUS_INVALID_INDEX;
 }
+slim_hidden_def (cairo_font_options_get_custom_palette_color);
diff --git a/src/cairoint.h b/src/cairoint.h
index 65bc16f53..bd97853d6 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1971,6 +1971,7 @@ slim_hidden_proto (cairo_font_face_get_user_data);
 slim_hidden_proto_no_warn (cairo_font_face_reference);
 slim_hidden_proto (cairo_font_face_set_user_data);
 slim_hidden_proto (cairo_font_options_equal);
+slim_hidden_proto (cairo_font_options_get_custom_palette_color);
 slim_hidden_proto (cairo_font_options_hash);
 slim_hidden_proto (cairo_font_options_merge);
 slim_hidden_proto (cairo_font_options_set_antialias);
diff --git a/src/win32/cairo-dwrite-font.cpp b/src/win32/cairo-dwrite-font.cpp
index 764835bc8..e5e4efdb3 100644
--- a/src/win32/cairo-dwrite-font.cpp
+++ b/src/win32/cairo-dwrite-font.cpp
@@ -1036,7 +1036,16 @@ _cairo_dwrite_scaled_font_init_glyph_color_surface(cairo_dwrite_scaled_font_t *s
 		    color_brush->SetColor(&color);
 		    uses_foreground_color = TRUE;
 		} else {
-		    color_brush->SetColor(color_run->runColor);
+		    double red, green, blue, alpha;
+		    cairo_status_t status;
+		    status = cairo_font_options_get_custom_palette_color (&scaled_font->base.options,
+									  color_run->paletteIndex,
+									  &red, &blue, &green, &alpha);
+		    if (status == CAIRO_STATUS_SUCCESS) {
+			color_brush->SetColor(D2D1::ColorF(red, blue, green, alpha));
+		    } else {
+			color_brush->SetColor(color_run->runColor);
+		    }
 		}
 
 		dc4->DrawGlyphRun(origin,


More information about the cairo-commit mailing list