Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: third_party/harfbuzz-ng/src/hb-font.cc

Issue 2622553002: Roll HarfBuzz to 1.4.1 (Closed)
Patch Set: Linux rebaselines Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-font.h ('k') | third_party/harfbuzz-ng/src/hb-font-private.hh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright © 2009 Red Hat, Inc. 2 * Copyright © 2009 Red Hat, Inc.
3 * Copyright © 2012 Google, Inc. 3 * Copyright © 2012 Google, Inc.
4 * 4 *
5 * This is part of HarfBuzz, a text shaping library. 5 * This is part of HarfBuzz, a text shaping library.
6 * 6 *
7 * Permission is hereby granted, without written agreement and without 7 * Permission is hereby granted, without written agreement and without
8 * license or royalty fees, to use, copy, modify, and distribute this 8 * license or royalty fees, to use, copy, modify, and distribute this
9 * software and its documentation for any purpose, provided that the 9 * software and its documentation for any purpose, provided that the
10 * above copyright notice and the following two paragraphs appear in 10 * above copyright notice and the following two paragraphs appear in
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 if (unlikely (hb_object_is_inert (font))) 1158 if (unlikely (hb_object_is_inert (font)))
1159 return font; 1159 return font;
1160 1160
1161 font->parent = hb_font_reference (parent); 1161 font->parent = hb_font_reference (parent);
1162 1162
1163 font->x_scale = parent->x_scale; 1163 font->x_scale = parent->x_scale;
1164 font->y_scale = parent->y_scale; 1164 font->y_scale = parent->y_scale;
1165 font->x_ppem = parent->x_ppem; 1165 font->x_ppem = parent->x_ppem;
1166 font->y_ppem = parent->y_ppem; 1166 font->y_ppem = parent->y_ppem;
1167 1167
1168 /* TODO: copy variation coordinates. */
1169
1168 return font; 1170 return font;
1169 } 1171 }
1170 1172
1171 /** 1173 /**
1172 * hb_font_get_empty: 1174 * hb_font_get_empty:
1173 * 1175 *
1174 * 1176 *
1175 * 1177 *
1176 * Return value: (transfer full) 1178 * Return value: (transfer full)
1177 * 1179 *
1178 * Since: 0.9.2 1180 * Since: 0.9.2
1179 **/ 1181 **/
1180 hb_font_t * 1182 hb_font_t *
1181 hb_font_get_empty (void) 1183 hb_font_get_empty (void)
1182 { 1184 {
1183 static const hb_font_t _hb_font_nil = { 1185 static const hb_font_t _hb_font_nil = {
1184 HB_OBJECT_HEADER_STATIC, 1186 HB_OBJECT_HEADER_STATIC,
1185 1187
1186 true, /* immutable */ 1188 true, /* immutable */
1187 1189
1188 NULL, /* parent */ 1190 NULL, /* parent */
1189 const_cast<hb_face_t *> (&_hb_face_nil), 1191 const_cast<hb_face_t *> (&_hb_face_nil),
1190 1192
1191 1000, /* x_scale */ 1193 1000, /* x_scale */
1192 1000, /* y_scale */ 1194 1000, /* y_scale */
1193 1195
1194 0, /* x_ppem */ 1196 0, /* x_ppem */
1195 0, /* y_ppem */ 1197 0, /* y_ppem */
1196 1198
1199 0, /* num_coords */
1200 NULL, /* coords */
1201
1197 const_cast<hb_font_funcs_t *> (&_hb_font_funcs_nil), /* klass */ 1202 const_cast<hb_font_funcs_t *> (&_hb_font_funcs_nil), /* klass */
1198 NULL, /* user_data */ 1203 NULL, /* user_data */
1199 NULL, /* destroy */ 1204 NULL, /* destroy */
1200 1205
1201 { 1206 {
1202 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID, 1207 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
1203 #include "hb-shaper-list.hh" 1208 #include "hb-shaper-list.hh"
1204 #undef HB_SHAPER_IMPLEMENT 1209 #undef HB_SHAPER_IMPLEMENT
1205 } 1210 }
1206 }; 1211 };
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 #include "hb-shaper-list.hh" 1246 #include "hb-shaper-list.hh"
1242 #undef HB_SHAPER_IMPLEMENT 1247 #undef HB_SHAPER_IMPLEMENT
1243 1248
1244 if (font->destroy) 1249 if (font->destroy)
1245 font->destroy (font->user_data); 1250 font->destroy (font->user_data);
1246 1251
1247 hb_font_destroy (font->parent); 1252 hb_font_destroy (font->parent);
1248 hb_face_destroy (font->face); 1253 hb_face_destroy (font->face);
1249 hb_font_funcs_destroy (font->klass); 1254 hb_font_funcs_destroy (font->klass);
1250 1255
1256 free (font->coords);
1257
1251 free (font); 1258 free (font);
1252 } 1259 }
1253 1260
1254 /** 1261 /**
1255 * hb_font_set_user_data: (skip) 1262 * hb_font_set_user_data: (skip)
1256 * @font: a font. 1263 * @font: a font.
1257 * @key: 1264 * @key:
1258 * @data: 1265 * @data:
1259 * @destroy: 1266 * @destroy:
1260 * @replace: 1267 * @replace:
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 void 1537 void
1531 hb_font_get_ppem (hb_font_t *font, 1538 hb_font_get_ppem (hb_font_t *font,
1532 unsigned int *x_ppem, 1539 unsigned int *x_ppem,
1533 unsigned int *y_ppem) 1540 unsigned int *y_ppem)
1534 { 1541 {
1535 if (x_ppem) *x_ppem = font->x_ppem; 1542 if (x_ppem) *x_ppem = font->x_ppem;
1536 if (y_ppem) *y_ppem = font->y_ppem; 1543 if (y_ppem) *y_ppem = font->y_ppem;
1537 } 1544 }
1538 1545
1539 1546
1547 void
1548 hb_font_set_var_coords_normalized (hb_font_t *font,
1549 int *coords, /* XXX 2.14 normalized */
1550 unsigned int coords_length)
1551 {
1552 if (font->immutable)
1553 return;
1554
1555 /* Skip tail zero entries. */
1556 while (coords_length && !coords[coords_length - 1])
1557 coords_length--;
1558
1559 int *copy = coords_length ? (int *) calloc (coords_length, sizeof (coords[0])) : NULL;
1560 if (unlikely (coords_length && !copy))
1561 return;
1562
1563 free (font->coords);
1564
1565 if (coords_length)
1566 memcpy (copy, coords, coords_length * sizeof (coords[0]));
1567
1568 font->coords = copy;
1569 font->num_coords = coords_length;
1570 }
1571
1572
1540 #ifndef HB_DISABLE_DEPRECATED 1573 #ifndef HB_DISABLE_DEPRECATED
1541 1574
1542 /* 1575 /*
1543 * Deprecated get_glyph_func(): 1576 * Deprecated get_glyph_func():
1544 */ 1577 */
1545 1578
1546 struct hb_trampoline_closure_t 1579 struct hb_trampoline_closure_t
1547 { 1580 {
1548 void *user_data; 1581 void *user_data;
1549 hb_destroy_func_t destroy; 1582 hb_destroy_func_t destroy;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 trampoline_destroy); 1689 trampoline_destroy);
1657 1690
1658 trampoline_reference (&trampoline->closure); 1691 trampoline_reference (&trampoline->closure);
1659 hb_font_funcs_set_variation_glyph_func (ffuncs, 1692 hb_font_funcs_set_variation_glyph_func (ffuncs,
1660 hb_font_get_variation_glyph_trampoline , 1693 hb_font_get_variation_glyph_trampoline ,
1661 trampoline, 1694 trampoline,
1662 trampoline_destroy); 1695 trampoline_destroy);
1663 } 1696 }
1664 1697
1665 #endif /* HB_DISABLE_DEPRECATED */ 1698 #endif /* HB_DISABLE_DEPRECATED */
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-font.h ('k') | third_party/harfbuzz-ng/src/hb-font-private.hh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698