[cairo] Set extra_flags for embolden and hint metrics

Deokjin Kim deokjin81.kim at samsung.com
Thu Dec 15 20:40:43 PST 2011


Hello all,

I think cairo needs API which sets extra_flags in order to use embolden and hint metrics.
For use of embolden and hint metrics, below modification is needed. (cairo-ft.h and cairo-ft-font.c)

--- a/src/cairo-ft.h 2011-12-16 13:19:52.704791837 +0900
+++ b/src/cairo-ft.h 2011-12-16 13:18:02.907493893 +0900
@@ -73,6 +73,14 @@
 
 #endif
 
+typedef enum _cairo_ft_extra_flags {
+    CAIRO_FT_OPTIONS_HINT_METRICS = (1 << 0),
+    CAIRO_FT_OPTIONS_EMBOLDEN = (1 << 1)
+} cairo_ft_extra_flags_t;
+
+cairo_public void cairo_ft_font_option_set_extra_flags (cairo_font_face_t * font_face,
+    cairo_ft_extra_flags_t extra_flags);
+
 CAIRO_END_DECLS
 
 #else  /* CAIRO_HAS_FT_FONT */

--- a/src/cairo-ft-font.c 2011-12-16 13:19:35.173968748 +0900
+++ b/src/cairo-ft-font.c 2011-12-16 13:18:56.297968869 +0900
@@ -169,11 +169,6 @@
 static void
 _cairo_ft_unscaled_font_fini (cairo_ft_unscaled_font_t *unscaled);
 
-typedef enum _cairo_ft_extra_flags {
-    CAIRO_FT_OPTIONS_HINT_METRICS = (1 << 0),
-    CAIRO_FT_OPTIONS_EMBOLDEN = (1 << 1)
-} cairo_ft_extra_flags_t;
-
 typedef struct _cairo_ft_options {
     cairo_font_options_t    base;
     int       load_flags;  /* flags for FT_Load_Glyph */
@@ -3394,3 +3389,15 @@
 {
     _cairo_ft_unscaled_font_map_destroy ();
 }
+
+void
+cairo_ft_font_option_set_extra_flags (cairo_font_face_t * font_face,
+    cairo_ft_extra_flags_t extra_flags)
+{
+    cairo_ft_font_face_t *ft_font_face =(cairo_ft_font_face_t *) font_face;
+
+    if (extra_flags & CAIRO_FT_OPTIONS_HINT_METRICS)
+        ft_font_face->ft_options.extra_flags |= CAIRO_FT_OPTIONS_HINT_METRICS;
+    if (extra_flags & CAIRO_FT_OPTIONS_EMBOLDEN)
+        ft_font_face->ft_options.extra_flags |= CAIRO_FT_OPTIONS_EMBOLDEN;
+}

Please give me some feedback.
Thank you in advance.

BR,
Deokjin Kim


More information about the cairo mailing list