Merge pull request #4045 from harfbuzz/custom-palette-cairo
Custom palette cairo
diff --git a/src/hb-cairo-utils.cc b/src/hb-cairo-utils.cc
index ad0627c..10a811b 100644
--- a/src/hb-cairo-utils.cc
+++ b/src/hb-cairo-utils.cc
@@ -723,8 +723,9 @@
}
//assert (angles[0] + k * span <= 0 && 0 < angles[n_stops - 1] + k * span);
+ span = fabs (span);
- for (unsigned l = k; 1; l++)
+ for (unsigned l = k; l < 1000; l++)
{
for (unsigned i = 1; i < n_stops; i++)
{
diff --git a/src/hb-cairo.cc b/src/hb-cairo.cc
index 6a5c6b4..a228b78 100644
--- a/src/hb-cairo.cc
+++ b/src/hb-cairo.cc
@@ -840,7 +840,7 @@
* cairo_user_scaled_font_text_to_glyphs_func_t.
*
* The @num_glyphs argument should be preset to the number of glyph entries available
- * in the @glyphs buffer. If the @glyphs buffer is %NULL, the value of
+ * in the @glyphs buffer. If the @glyphs buffer is `NULL`, the value of
* @num_glyphs must be zero. If the provided glyph array is too short for
* the conversion (or for convenience), a new glyph array may be allocated
* using cairo_glyph_allocate() and placed in @glyphs. Upon return,
@@ -849,11 +849,11 @@
* allocated glyph array using cairo_glyph_free(). The caller will also free
* the original value of @glyphs, so this function shouldn't do so.
*
- * If @clusters is not %NULL, then @num_clusters and @cluster_flags
+ * If @clusters is not `NULL`, then @num_clusters and @cluster_flags
* should not be either, and @utf8 must be provided, and cluster
* mapping will be computed. The semantics of how
* cluster array allocation works is similar to the glyph array. That is,
- * if @clusters initially points to a non-%NULL value, that array may be used
+ * if @clusters initially points to a non-`NULL` value, that array may be used
* as a cluster buffer, and @num_clusters points to the number of cluster
* entries available there. If the provided cluster array is too short for
* the conversion (or for convenience), a new cluster array may be allocated
diff --git a/src/hb-face.cc b/src/hb-face.cc
index 97582fa..6fcec29 100644
--- a/src/hb-face.cc
+++ b/src/hb-face.cc
@@ -604,7 +604,7 @@
* hb_face_collect_nominal_glyph_mapping:
* @face: A face object
* @mapping: (out): The map to add Unicode-to-glyph mapping to
- * @unicodes: (nullable) (out): The set to add Unicode characters to, or %NULL
+ * @unicodes: (nullable) (out): The set to add Unicode characters to, or `NULL`
*
* Collects the mapping from Unicode characters to nominal glyphs of the @face,
* and optionally all of the Unicode characters covered by @face.
diff --git a/util/hb-info.cc b/util/hb-info.cc
index a88063a..7d56846 100644
--- a/util/hb-info.cc
+++ b/util/hb-info.cc
@@ -964,19 +964,26 @@
char name[64];
unsigned name_len = sizeof name;
+
hb_ot_name_get_utf8 (face, name_id,
language,
&name_len, name);
-
- printf ("%u ", i);
+ const char *type = "";
if (flags)
{
if (flags & HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_LIGHT_BACKGROUND)
- printf ("Light");
- if (flags & HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND)
- printf ("Dark");
+ {
+ if (flags & HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND)
+ type = "Both";
+ else
+ type = "Light";
+ }
+ else {
+ type = "Dark";
+ }
}
- printf ("%s\n", name);
+
+ printf ("%u %-*s %s\n", i, (int)strlen ("Light"), type, name);
}
}