| OLD | NEW |
| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 true, /* immutable */ | 44 true, /* immutable */ |
| 45 | 45 |
| 46 NULL, /* reference_table_func */ | 46 NULL, /* reference_table_func */ |
| 47 NULL, /* user_data */ | 47 NULL, /* user_data */ |
| 48 NULL, /* destroy */ | 48 NULL, /* destroy */ |
| 49 | 49 |
| 50 0, /* index */ | 50 0, /* index */ |
| 51 1000, /* upem */ | 51 1000, /* upem */ |
| 52 0, /* num_glyphs */ | 52 0, /* num_glyphs */ |
| 53 | 53 |
| 54 hb_face_t::NOTHING, /* dirty */ |
| 55 |
| 54 { | 56 { |
| 55 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID, | 57 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID, |
| 56 #include "hb-shaper-list.hh" | 58 #include "hb-shaper-list.hh" |
| 57 #undef HB_SHAPER_IMPLEMENT | 59 #undef HB_SHAPER_IMPLEMENT |
| 58 }, | 60 }, |
| 59 | 61 |
| 60 NULL, /* shape_plans */ | 62 NULL, /* shape_plans */ |
| 61 }; | 63 }; |
| 62 | 64 |
| 63 | 65 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 166 |
| 165 hb_face_for_data_closure_t *closure = _hb_face_for_data_closure_create (OT::Sa
nitizer<OT::OpenTypeFontFile>::sanitize (hb_blob_reference (blob)), index); | 167 hb_face_for_data_closure_t *closure = _hb_face_for_data_closure_create (OT::Sa
nitizer<OT::OpenTypeFontFile>::sanitize (hb_blob_reference (blob)), index); |
| 166 | 168 |
| 167 if (unlikely (!closure)) | 169 if (unlikely (!closure)) |
| 168 return hb_face_get_empty (); | 170 return hb_face_get_empty (); |
| 169 | 171 |
| 170 face = hb_face_create_for_tables (_hb_face_for_data_reference_table, | 172 face = hb_face_create_for_tables (_hb_face_for_data_reference_table, |
| 171 closure, | 173 closure, |
| 172 (hb_destroy_func_t) _hb_face_for_data_closur
e_destroy); | 174 (hb_destroy_func_t) _hb_face_for_data_closur
e_destroy); |
| 173 | 175 |
| 174 hb_face_set_index (face, index); | 176 face->index = index; |
| 175 | 177 |
| 176 return face; | 178 return face; |
| 177 } | 179 } |
| 178 | 180 |
| 179 /** | 181 /** |
| 180 * hb_face_get_empty: | 182 * hb_face_get_empty: |
| 181 * | 183 * |
| 182 * | 184 * |
| 183 * | 185 * |
| 184 * Return value: (transfer full) | 186 * Return value: (transfer full) |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 * | 360 * |
| 359 * Since: 0.9.2 | 361 * Since: 0.9.2 |
| 360 **/ | 362 **/ |
| 361 void | 363 void |
| 362 hb_face_set_index (hb_face_t *face, | 364 hb_face_set_index (hb_face_t *face, |
| 363 unsigned int index) | 365 unsigned int index) |
| 364 { | 366 { |
| 365 if (face->immutable) | 367 if (face->immutable) |
| 366 return; | 368 return; |
| 367 | 369 |
| 370 if (face->index == index) |
| 371 return; |
| 372 |
| 373 face->dirty |= face->INDEX; |
| 374 |
| 368 face->index = index; | 375 face->index = index; |
| 369 } | 376 } |
| 370 | 377 |
| 371 /** | 378 /** |
| 372 * hb_face_get_index: | 379 * hb_face_get_index: |
| 373 * @face: a face. | 380 * @face: a face. |
| 374 * | 381 * |
| 375 * | 382 * |
| 376 * | 383 * |
| 377 * Return value: | 384 * Return value: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 393 * | 400 * |
| 394 * Since: 0.9.2 | 401 * Since: 0.9.2 |
| 395 **/ | 402 **/ |
| 396 void | 403 void |
| 397 hb_face_set_upem (hb_face_t *face, | 404 hb_face_set_upem (hb_face_t *face, |
| 398 unsigned int upem) | 405 unsigned int upem) |
| 399 { | 406 { |
| 400 if (face->immutable) | 407 if (face->immutable) |
| 401 return; | 408 return; |
| 402 | 409 |
| 410 if (face->upem == upem) |
| 411 return; |
| 412 |
| 413 face->dirty |= face->UPEM; |
| 414 |
| 403 face->upem = upem; | 415 face->upem = upem; |
| 404 } | 416 } |
| 405 | 417 |
| 406 /** | 418 /** |
| 407 * hb_face_get_upem: | 419 * hb_face_get_upem: |
| 408 * @face: a face. | 420 * @face: a face. |
| 409 * | 421 * |
| 410 * | 422 * |
| 411 * | 423 * |
| 412 * Return value: | 424 * Return value: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 437 * | 449 * |
| 438 * Since: 0.9.7 | 450 * Since: 0.9.7 |
| 439 **/ | 451 **/ |
| 440 void | 452 void |
| 441 hb_face_set_glyph_count (hb_face_t *face, | 453 hb_face_set_glyph_count (hb_face_t *face, |
| 442 unsigned int glyph_count) | 454 unsigned int glyph_count) |
| 443 { | 455 { |
| 444 if (face->immutable) | 456 if (face->immutable) |
| 445 return; | 457 return; |
| 446 | 458 |
| 459 if (face->num_glyphs == glyph_count) |
| 460 return; |
| 461 |
| 462 face->dirty |= face->NUM_GLYPHS; |
| 463 |
| 447 face->num_glyphs = glyph_count; | 464 face->num_glyphs = glyph_count; |
| 448 } | 465 } |
| 449 | 466 |
| 450 /** | 467 /** |
| 451 * hb_face_get_glyph_count: | 468 * hb_face_get_glyph_count: |
| 452 * @face: a face. | 469 * @face: a face. |
| 453 * | 470 * |
| 454 * | 471 * |
| 455 * | 472 * |
| 456 * Return value: | 473 * Return value: |
| 457 * | 474 * |
| 458 * Since: 0.9.7 | 475 * Since: 0.9.7 |
| 459 **/ | 476 **/ |
| 460 unsigned int | 477 unsigned int |
| 461 hb_face_get_glyph_count (hb_face_t *face) | 478 hb_face_get_glyph_count (hb_face_t *face) |
| 462 { | 479 { |
| 463 return face->get_num_glyphs (); | 480 return face->get_num_glyphs (); |
| 464 } | 481 } |
| 465 | 482 |
| 466 void | 483 void |
| 467 hb_face_t::load_num_glyphs (void) const | 484 hb_face_t::load_num_glyphs (void) const |
| 468 { | 485 { |
| 469 hb_blob_t *maxp_blob = OT::Sanitizer<OT::maxp>::sanitize (reference_table (HB_
OT_TAG_maxp)); | 486 hb_blob_t *maxp_blob = OT::Sanitizer<OT::maxp>::sanitize (reference_table (HB_
OT_TAG_maxp)); |
| 470 const OT::maxp *maxp_table = OT::Sanitizer<OT::maxp>::lock_instance (maxp_blob
); | 487 const OT::maxp *maxp_table = OT::Sanitizer<OT::maxp>::lock_instance (maxp_blob
); |
| 471 num_glyphs = maxp_table->get_num_glyphs (); | 488 num_glyphs = maxp_table->get_num_glyphs (); |
| 472 hb_blob_destroy (maxp_blob); | 489 hb_blob_destroy (maxp_blob); |
| 473 } | 490 } |
| 474 | 491 |
| 475 | 492 |
| OLD | NEW |