conditionals for older freetype2 without color font feature

Submitted by suzuki toshiya on April 3, 2018, 1:34 a.m.

Details

Message ID 5AC2DA1C.7030501@hiroshima-u.ac.jp
State New
Series "conditionals for older freetype2 without color font feature"
Headers show

Commit Message

suzuki toshiya April 3, 2018, 1:34 a.m.
Hi,

FT_HAS_COLOR() macro is unavailable in older freetype2
without color font feature. attached is a quick fix.

or, something like

#ifndef FT_HAS_COLOR
# define FT_HAS_COLOR(x) ( 0 )
#endif

in config header is better?

--

it seems that fontconfig decided to drop old freetype2,
but I wish if cairo can provide (limited) support for
older freetype2.

Regards,
mpsuzuki

Patch hide | download patch | download mbox

diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 79aef78..c1cac17 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -448,7 +448,11 @@  _cairo_ft_unscaled_font_init (cairo_ft_unscaled_font_t *unscaled,
 	_cairo_ft_unscaled_font_init_key (unscaled, TRUE, NULL, face->face_index, face);
 
 
+#ifdef FT_HAS_COLOR
         unscaled->have_color = FT_HAS_COLOR (face) != 0;
+#else
+        unscaled->have_color = FALSE;
+#endif
         unscaled->have_color_set = TRUE;
 
 #ifdef HAVE_FT_GET_VAR_DESIGN_COORDINATES
@@ -744,7 +748,11 @@  _cairo_ft_unscaled_font_lock_face (cairo_ft_unscaled_font_t *unscaled)
 
     unscaled->face = face;
 
+#ifdef FT_HAS_COLOR
     unscaled->have_color = FT_HAS_COLOR (face) != 0;
+#else
+    unscaled->have_color = FALSE;
+#endif
     unscaled->have_color_set = TRUE;
 
     font_map->num_open_faces++;

Comments

Bryce Harrington April 3, 2018, 3:30 a.m.
On Tue, Apr 03, 2018 at 10:34:20AM +0900, suzuki toshiya wrote:
> Hi,
> 
> FT_HAS_COLOR() macro is unavailable in older freetype2
> without color font feature. attached is a quick fix.
> 
> or, something like
> 
> #ifndef FT_HAS_COLOR
> # define FT_HAS_COLOR(x) ( 0 )
> #endif
> 
> in config header is better?

Offhand I prefer this latter approach, just feels a bit cleaner.  Would
you mind respinning your patch with this approach?

> it seems that fontconfig decided to drop old freetype2,
> but I wish if cairo can provide (limited) support for
> older freetype2.

Sounds ok, I don't see a problem with doing this.

Thanks,
Bryce
suzuki toshiya April 3, 2018, 3:33 a.m.
Dear Bryce,

Thank you for prompt review!

 >> #ifndef FT_HAS_COLOR
 >> # define FT_HAS_COLOR(x) ( 0 )
 >> #endif
 >>
 >> in config header is better?
 >
 > Offhand I prefer this latter approach, just feels a bit cleaner.  Would
 > you mind respinning your patch with this approach?

OK! I would revise and resubmit.

Regards,
mpsuzuki

On 4/3/2018 12:30 PM, Bryce Harrington wrote:
> On Tue, Apr 03, 2018 at 10:34:20AM +0900, suzuki toshiya wrote:
>> Hi,
>>
>> FT_HAS_COLOR() macro is unavailable in older freetype2
>> without color font feature. attached is a quick fix.
>>
>> or, something like
>>
>> #ifndef FT_HAS_COLOR
>> # define FT_HAS_COLOR(x) ( 0 )
>> #endif
>>
>> in config header is better?
> 
> Offhand I prefer this latter approach, just feels a bit cleaner.  Would
> you mind respinning your patch with this approach?
> 
>> it seems that fontconfig decided to drop old freetype2,
>> but I wish if cairo can provide (limited) support for
>> older freetype2.
> 
> Sounds ok, I don't see a problem with doing this.
> 
> Thanks,
> Bryce
>