diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2017-01-21 15:05:00 -0800 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2017-01-21 15:05:00 -0800 |
commit | 8b2a58047095604dcdc576ecbe3e8c2ebb8f48f0 (patch) | |
tree | 75520ae7e2a7eef54b1de48492176dbe78fcaec4 | |
parent | 0dcc7b49a830e2680d3e6d86d953efab85cef6ff (diff) | |
download | harfbuzz_ng-8b2a58047095604dcdc576ecbe3e8c2ebb8f48f0.tar.gz |
[var] Add hb_font_set_var_coords_design()
-rw-r--r-- | src/hb-font.cc | 21 | ||||
-rw-r--r-- | src/hb-font.h | 7 |
2 files changed, 25 insertions, 3 deletions
diff --git a/src/hb-font.cc b/src/hb-font.cc index e2a0a5f0f..e7f57529d 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -1543,10 +1543,27 @@ hb_font_get_ppem (hb_font_t *font, if (y_ppem) *y_ppem = font->y_ppem; } +/* + * Variations + */ + +void +hb_font_set_var_coords_design (hb_font_t *font, + float *coords, + unsigned int coords_length) +{ + int normalized[coords_length]; // XXX Remove variable-length array use... + + hb_face_t *face = font->face; + for (unsigned int i = 0; i < coords_length; i++) + normalized[i] = hb_ot_var_normalize_axis_value (face, i, coords[i]); + + hb_font_set_var_coords_normalized (font, normalized, coords_length); +} void hb_font_set_var_coords_normalized (hb_font_t *font, - int *coords, /* XXX 2.14 normalized */ + int *coords, /* 2.14 normalized */ unsigned int coords_length) { if (font->immutable) @@ -1570,7 +1587,7 @@ hb_font_get_var_coords_normalized (hb_font_t *font, unsigned int *length) { if (length) - *length = font->coords_length; + *length = font->num_coords; return font->coords; } diff --git a/src/hb-font.h b/src/hb-font.h index 5f22331b6..31e5971b1 100644 --- a/src/hb-font.h +++ b/src/hb-font.h @@ -605,8 +605,13 @@ hb_font_get_ppem (hb_font_t *font, HB_EXTERN void +hb_font_set_var_coords_design (hb_font_t *font, + float *coords, + unsigned int coords_length); + +HB_EXTERN void hb_font_set_var_coords_normalized (hb_font_t *font, - int *coords, /* XXX 2.14 normalized */ + int *coords, /* 2.14 normalized */ unsigned int coords_length); HB_EXTERN int * |