[config] Add HB_NO_COLOR to HB_LEAN
authorBehdad Esfahbod <behdad@behdad.org>
Sat, 11 May 2019 07:53:52 +0000 (00:53 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Sat, 11 May 2019 07:53:52 +0000 (00:53 -0700)
Part of https://github.com/harfbuzz/harfbuzz/issues/1652

src/hb-config.hh
src/hb-ot-color.cc
src/hb-ot-color.h
src/hb-ot-layout.h

index 6393f56..ae7ca17 100644 (file)
@@ -45,6 +45,7 @@
 #define HB_NO_ATEXIT
 #define HB_NO_BITMAP
 #define HB_NO_CFF
+#define HB_NO_COLOR
 #define HB_NO_GETENV
 #define HB_NO_MATH
 #define HB_NO_OT_LAYOUT_UNUSED
index 791135b..5341a53 100644 (file)
@@ -66,6 +66,9 @@
 hb_bool_t
 hb_ot_color_has_palettes (hb_face_t *face)
 {
+#ifdef HB_NO_COLOR
+  return false;
+#endif
   return face->table.CPAL->has_data ();
 }
 
@@ -81,6 +84,9 @@ hb_ot_color_has_palettes (hb_face_t *face)
 unsigned int
 hb_ot_color_palette_get_count (hb_face_t *face)
 {
+#ifdef HB_NO_COLOR
+  return 0;
+#endif
   return face->table.CPAL->get_palette_count ();
 }
 
@@ -101,6 +107,9 @@ hb_ot_name_id_t
 hb_ot_color_palette_get_name_id (hb_face_t *face,
                                 unsigned int palette_index)
 {
+#ifdef HB_NO_COLOR
+  return HB_OT_NAME_ID_INVALID;
+#endif
   return face->table.CPAL->get_palette_name_id (palette_index);
 }
 
@@ -117,6 +126,9 @@ hb_ot_name_id_t
 hb_ot_color_palette_color_get_name_id (hb_face_t *face,
                                       unsigned int color_index)
 {
+#ifdef HB_NO_COLOR
+  return HB_OT_NAME_ID_INVALID;
+#endif
   return face->table.CPAL->get_color_name_id (color_index);
 }
 
@@ -133,6 +145,9 @@ hb_ot_color_palette_flags_t
 hb_ot_color_palette_get_flags (hb_face_t *face,
                               unsigned int palette_index)
 {
+#ifdef HB_NO_COLOR
+  return HB_OT_COLOR_PALETTE_FLAG_DEFAULT;
+#endif
   return face->table.CPAL->get_palette_flags (palette_index);
 }
 
@@ -167,6 +182,11 @@ hb_ot_color_palette_get_colors (hb_face_t     *face,
                                unsigned int  *colors_count  /* IN/OUT.  May be NULL. */,
                                hb_color_t    *colors        /* OUT.     May be NULL. */)
 {
+#ifdef HB_NO_COLOR
+  if (colors_count)
+    *colors_count = 0;
+  return 0;
+#endif
   return face->table.CPAL->get_palette_colors (palette_index, start_offset, colors_count, colors);
 }
 
@@ -186,6 +206,9 @@ hb_ot_color_palette_get_colors (hb_face_t     *face,
 hb_bool_t
 hb_ot_color_has_layers (hb_face_t *face)
 {
+#ifdef HB_NO_COLOR
+  return false;
+#endif
   return face->table.COLR->has_data ();
 }
 
@@ -194,9 +217,9 @@ hb_ot_color_has_layers (hb_face_t *face)
  * @face:         a font face.
  * @glyph:        a layered color glyph id.
  * @start_offset: starting offset of layers.
- * @count:  (inout) (optional): gets number of layers available to be written on buffer
+ * @layer_count:  (inout) (optional): gets number of layers available to be written on buffer
  *                             and returns number of written layers.
- * @layers: (array length=count) (out) (optional): layers buffer to buffer.
+ * @layers: (array length=layer_count) (out) (optional): layers buffer to buffer.
  *
  * Returns: Total number of layers a layered color glyph have.
  *
@@ -206,10 +229,15 @@ unsigned int
 hb_ot_color_glyph_get_layers (hb_face_t           *face,
                              hb_codepoint_t       glyph,
                              unsigned int         start_offset,
-                             unsigned int        *count, /* IN/OUT.  May be NULL. */
+                             unsigned int        *layer_count, /* IN/OUT.  May be NULL. */
                              hb_ot_color_layer_t *layers /* OUT.     May be NULL. */)
 {
-  return face->table.COLR->get_glyph_layers (glyph, start_offset, count, layers);
+#ifdef HB_NO_COLOR
+  if (layer_count)
+    *layer_count = 0;
+  return 0;
+#endif
+  return face->table.COLR->get_glyph_layers (glyph, start_offset, layer_count, layers);
 }
 
 
@@ -230,6 +258,9 @@ hb_ot_color_glyph_get_layers (hb_face_t           *face,
 hb_bool_t
 hb_ot_color_has_svg (hb_face_t *face)
 {
+#ifdef HB_NO_COLOR
+  return false;
+#endif
   return face->table.SVG->has_data ();
 }
 
@@ -247,6 +278,9 @@ hb_ot_color_has_svg (hb_face_t *face)
 hb_blob_t *
 hb_ot_color_glyph_reference_svg (hb_face_t *face, hb_codepoint_t glyph)
 {
+#ifdef HB_NO_COLOR
+  return hb_blob_get_empty ();
+#endif
   return face->table.SVG->reference_blob_for_glyph (glyph);
 }
 
@@ -268,6 +302,9 @@ hb_ot_color_glyph_reference_svg (hb_face_t *face, hb_codepoint_t glyph)
 hb_bool_t
 hb_ot_color_has_png (hb_face_t *face)
 {
+#ifdef HB_NO_COLOR
+  return false;
+#endif
   return face->table.CBDT->has_data () || face->table.sbix->has_data ();
 }
 
@@ -287,6 +324,10 @@ hb_ot_color_has_png (hb_face_t *face)
 hb_blob_t *
 hb_ot_color_glyph_reference_png (hb_font_t *font, hb_codepoint_t  glyph)
 {
+#ifdef HB_NO_COLOR
+  return hb_blob_get_empty ();
+#endif
+
   hb_blob_t *blob = hb_blob_get_empty ();
 
   if (font->face->table.sbix->has_data ())
index 49646bf..0d7daa5 100644 (file)
@@ -110,7 +110,7 @@ HB_EXTERN unsigned int
 hb_ot_color_glyph_get_layers (hb_face_t           *face,
                              hb_codepoint_t       glyph,
                              unsigned int         start_offset,
-                             unsigned int        *count, /* IN/OUT.  May be NULL. */
+                             unsigned int        *layer_count, /* IN/OUT.  May be NULL. */
                              hb_ot_color_layer_t *layers /* OUT.     May be NULL. */);
 
 /*
index 359ee1b..3b9a78e 100644 (file)
@@ -94,7 +94,7 @@ HB_EXTERN hb_bool_t
 hb_ot_layout_has_glyph_classes (hb_face_t *face);
 
 /**
- * hb_ot_layout_get_glyph_class:
+ * hb_ot_layout_glyph_class_t:
  * @HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED: Glyphs not matching the other classifications
  * @HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH: Spacing, single characters, capable of accepting marks
  * @HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE: Glyphs that represent ligation of multiple characters