Index: third_party/harfbuzz-ng/src/hb-font.cc |
diff --git a/third_party/harfbuzz-ng/src/hb-font.cc b/third_party/harfbuzz-ng/src/hb-font.cc |
index ea455012684f16f6347c9ed95e5740c12b2c8780..e900bd3f65aedd47a7a38448395a938809ae1ab1 100644 |
--- a/third_party/harfbuzz-ng/src/hb-font.cc |
+++ b/third_party/harfbuzz-ng/src/hb-font.cc |
@@ -1196,6 +1196,8 @@ hb_font_get_empty (void) |
NULL, /* user_data */ |
NULL, /* destroy */ |
+ hb_font_t::NOTHING, /* dirty */ |
+ |
{ |
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID, |
#include "hb-shaper-list.hh" |
@@ -1348,6 +1350,11 @@ hb_font_set_parent (hb_font_t *font, |
if (!parent) |
parent = hb_font_get_empty (); |
+ if (parent == font->parent) |
+ return; |
+ |
+ font->dirty |= font->PARENT; |
+ |
hb_font_t *old = font->parent; |
font->parent = hb_font_reference (parent); |
@@ -1372,6 +1379,37 @@ hb_font_get_parent (hb_font_t *font) |
} |
/** |
+ * hb_font_set_face: |
+ * @font: a font. |
+ * @face: new face. |
+ * |
+ * Sets font-face of @font. |
+ * |
+ * Since: 1.4.3 |
+ **/ |
+void |
+hb_font_set_face (hb_font_t *font, |
+ hb_face_t *face) |
+{ |
+ if (font->immutable) |
+ return; |
+ |
+ if (unlikely (!face)) |
+ face = hb_face_get_empty (); |
+ |
+ if (font->face == face) |
+ return; |
+ |
+ font->dirty |= font->FACE; |
+ |
+ hb_face_t *old = font->face; |
+ |
+ font->face = hb_face_reference (face); |
+ |
+ hb_face_destroy (old); |
+} |
+ |
+/** |
* hb_font_get_face: |
* @font: a font. |
* |
@@ -1417,6 +1455,8 @@ hb_font_set_funcs (hb_font_t *font, |
if (!klass) |
klass = hb_font_funcs_get_empty (); |
+ font->dirty |= font->FUNCS; |
+ |
hb_font_funcs_reference (klass); |
hb_font_funcs_destroy (font->klass); |
font->klass = klass; |
@@ -1472,6 +1512,11 @@ hb_font_set_scale (hb_font_t *font, |
if (font->immutable) |
return; |
+ if (font->x_scale == x_scale && font->y_scale == y_scale) |
+ return; |
+ |
+ font->dirty |= font->SCALE; |
+ |
font->x_scale = x_scale; |
font->y_scale = y_scale; |
} |
@@ -1513,6 +1558,11 @@ hb_font_set_ppem (hb_font_t *font, |
if (font->immutable) |
return; |
+ if (font->x_ppem == x_ppem && font->y_ppem == y_ppem) |
+ return; |
+ |
+ font->dirty |= font->PPEM; |
+ |
font->x_ppem = x_ppem; |
font->y_ppem = y_ppem; |
} |
@@ -1545,6 +1595,16 @@ _hb_font_adopt_var_coords_normalized (hb_font_t *font, |
int *coords, /* 2.14 normalized */ |
unsigned int coords_length) |
{ |
+ if (font->num_coords == coords_length && |
+ (coords_length == 0 || |
+ 0 == memcmp (font->coords, coords, coords_length * sizeof (coords[0])))) |
+ { |
+ free (coords); |
+ return; |
+ } |
+ |
+ font->dirty |= font->VARIATIONS; |
+ |
free (font->coords); |
font->coords = coords; |
@@ -1627,7 +1687,7 @@ hb_font_set_var_coords_normalized (hb_font_t *font, |
} |
/** |
- * hb_font_set_var_coords_normalized: |
+ * hb_font_get_var_coords_normalized: |
* |
* Return value is valid as long as variation coordinates of the font |
* are not modified. |