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

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

Issue 1408003004: Roll harfbuzz-ng to 1.0.5 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2526
Patch Set: Created 5 years, 2 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 }; 229 };
230 230
231 231
232 /** 232 /**
233 * hb_font_funcs_create: (Xconstructor) 233 * hb_font_funcs_create: (Xconstructor)
234 * 234 *
235 * 235 *
236 * 236 *
237 * Return value: (transfer full): 237 * Return value: (transfer full):
238 * 238 *
239 * Since: 1.0 239 * Since: 0.9.2
240 **/ 240 **/
241 hb_font_funcs_t * 241 hb_font_funcs_t *
242 hb_font_funcs_create (void) 242 hb_font_funcs_create (void)
243 { 243 {
244 hb_font_funcs_t *ffuncs; 244 hb_font_funcs_t *ffuncs;
245 245
246 if (!(ffuncs = hb_object_create<hb_font_funcs_t> ())) 246 if (!(ffuncs = hb_object_create<hb_font_funcs_t> ()))
247 return hb_font_funcs_get_empty (); 247 return hb_font_funcs_get_empty ();
248 248
249 ffuncs->get = _hb_font_funcs_nil.get; 249 ffuncs->get = _hb_font_funcs_nil.get;
250 250
251 return ffuncs; 251 return ffuncs;
252 } 252 }
253 253
254 /** 254 /**
255 * hb_font_funcs_get_empty: 255 * hb_font_funcs_get_empty:
256 * 256 *
257 * 257 *
258 * 258 *
259 * Return value: (transfer full): 259 * Return value: (transfer full):
260 * 260 *
261 * Since: 1.0 261 * Since: 0.9.2
262 **/ 262 **/
263 hb_font_funcs_t * 263 hb_font_funcs_t *
264 hb_font_funcs_get_empty (void) 264 hb_font_funcs_get_empty (void)
265 { 265 {
266 return const_cast<hb_font_funcs_t *> (&_hb_font_funcs_nil); 266 return const_cast<hb_font_funcs_t *> (&_hb_font_funcs_nil);
267 } 267 }
268 268
269 /** 269 /**
270 * hb_font_funcs_reference: (skip) 270 * hb_font_funcs_reference: (skip)
271 * @ffuncs: font functions. 271 * @ffuncs: font functions.
272 * 272 *
273 * 273 *
274 * 274 *
275 * Return value: 275 * Return value:
276 * 276 *
277 * Since: 1.0 277 * Since: 0.9.2
278 **/ 278 **/
279 hb_font_funcs_t * 279 hb_font_funcs_t *
280 hb_font_funcs_reference (hb_font_funcs_t *ffuncs) 280 hb_font_funcs_reference (hb_font_funcs_t *ffuncs)
281 { 281 {
282 return hb_object_reference (ffuncs); 282 return hb_object_reference (ffuncs);
283 } 283 }
284 284
285 /** 285 /**
286 * hb_font_funcs_destroy: (skip) 286 * hb_font_funcs_destroy: (skip)
287 * @ffuncs: font functions. 287 * @ffuncs: font functions.
288 * 288 *
289 * 289 *
290 * 290 *
291 * Since: 1.0 291 * Since: 0.9.2
292 **/ 292 **/
293 void 293 void
294 hb_font_funcs_destroy (hb_font_funcs_t *ffuncs) 294 hb_font_funcs_destroy (hb_font_funcs_t *ffuncs)
295 { 295 {
296 if (!hb_object_destroy (ffuncs)) return; 296 if (!hb_object_destroy (ffuncs)) return;
297 297
298 #define HB_FONT_FUNC_IMPLEMENT(name) if (ffuncs->destroy.name) \ 298 #define HB_FONT_FUNC_IMPLEMENT(name) if (ffuncs->destroy.name) \
299 ffuncs->destroy.name (ffuncs->user_data.name); 299 ffuncs->destroy.name (ffuncs->user_data.name);
300 HB_FONT_FUNCS_IMPLEMENT_CALLBACKS 300 HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
301 #undef HB_FONT_FUNC_IMPLEMENT 301 #undef HB_FONT_FUNC_IMPLEMENT
302 302
303 free (ffuncs); 303 free (ffuncs);
304 } 304 }
305 305
306 /** 306 /**
307 * hb_font_funcs_set_user_data: (skip) 307 * hb_font_funcs_set_user_data: (skip)
308 * @ffuncs: font functions. 308 * @ffuncs: font functions.
309 * @key: 309 * @key:
310 * @data: 310 * @data:
311 * @destroy: 311 * @destroy:
312 * @replace: 312 * @replace:
313 * 313 *
314 * 314 *
315 * 315 *
316 * Return value: 316 * Return value:
317 * 317 *
318 * Since: 1.0 318 * Since: 0.9.2
319 **/ 319 **/
320 hb_bool_t 320 hb_bool_t
321 hb_font_funcs_set_user_data (hb_font_funcs_t *ffuncs, 321 hb_font_funcs_set_user_data (hb_font_funcs_t *ffuncs,
322 hb_user_data_key_t *key, 322 hb_user_data_key_t *key,
323 void * data, 323 void * data,
324 hb_destroy_func_t destroy, 324 hb_destroy_func_t destroy,
325 hb_bool_t replace) 325 hb_bool_t replace)
326 { 326 {
327 return hb_object_set_user_data (ffuncs, key, data, destroy, replace); 327 return hb_object_set_user_data (ffuncs, key, data, destroy, replace);
328 } 328 }
329 329
330 /** 330 /**
331 * hb_font_funcs_get_user_data: (skip) 331 * hb_font_funcs_get_user_data: (skip)
332 * @ffuncs: font functions. 332 * @ffuncs: font functions.
333 * @key: 333 * @key:
334 * 334 *
335 * 335 *
336 * 336 *
337 * Return value: (transfer none): 337 * Return value: (transfer none):
338 * 338 *
339 * Since: 1.0 339 * Since: 0.9.2
340 **/ 340 **/
341 void * 341 void *
342 hb_font_funcs_get_user_data (hb_font_funcs_t *ffuncs, 342 hb_font_funcs_get_user_data (hb_font_funcs_t *ffuncs,
343 hb_user_data_key_t *key) 343 hb_user_data_key_t *key)
344 { 344 {
345 return hb_object_get_user_data (ffuncs, key); 345 return hb_object_get_user_data (ffuncs, key);
346 } 346 }
347 347
348 348
349 /** 349 /**
350 * hb_font_funcs_make_immutable: 350 * hb_font_funcs_make_immutable:
351 * @ffuncs: font functions. 351 * @ffuncs: font functions.
352 * 352 *
353 * 353 *
354 * 354 *
355 * Since: 1.0 355 * Since: 0.9.2
356 **/ 356 **/
357 void 357 void
358 hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs) 358 hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs)
359 { 359 {
360 if (unlikely (hb_object_is_inert (ffuncs))) 360 if (unlikely (hb_object_is_inert (ffuncs)))
361 return; 361 return;
362 362
363 ffuncs->immutable = true; 363 ffuncs->immutable = true;
364 } 364 }
365 365
366 /** 366 /**
367 * hb_font_funcs_is_immutable: 367 * hb_font_funcs_is_immutable:
368 * @ffuncs: font functions. 368 * @ffuncs: font functions.
369 * 369 *
370 * 370 *
371 * 371 *
372 * Return value: 372 * Return value:
373 * 373 *
374 * Since: 1.0 374 * Since: 0.9.2
375 **/ 375 **/
376 hb_bool_t 376 hb_bool_t
377 hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs) 377 hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs)
378 { 378 {
379 return ffuncs->immutable; 379 return ffuncs->immutable;
380 } 380 }
381 381
382 382
383 #define HB_FONT_FUNC_IMPLEMENT(name) \ 383 #define HB_FONT_FUNC_IMPLEMENT(name) \
384 \ 384 \
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 * hb_font_get_glyph: 418 * hb_font_get_glyph:
419 * @font: a font. 419 * @font: a font.
420 * @unicode: 420 * @unicode:
421 * @variation_selector: 421 * @variation_selector:
422 * @glyph: (out): 422 * @glyph: (out):
423 * 423 *
424 * 424 *
425 * 425 *
426 * Return value: 426 * Return value:
427 * 427 *
428 * Since: 1.0 428 * Since: 0.9.2
429 **/ 429 **/
430 hb_bool_t 430 hb_bool_t
431 hb_font_get_glyph (hb_font_t *font, 431 hb_font_get_glyph (hb_font_t *font,
432 hb_codepoint_t unicode, hb_codepoint_t variation_selector, 432 hb_codepoint_t unicode, hb_codepoint_t variation_selector,
433 hb_codepoint_t *glyph) 433 hb_codepoint_t *glyph)
434 { 434 {
435 return font->get_glyph (unicode, variation_selector, glyph); 435 return font->get_glyph (unicode, variation_selector, glyph);
436 } 436 }
437 437
438 /** 438 /**
439 * hb_font_get_glyph_h_advance: 439 * hb_font_get_glyph_h_advance:
440 * @font: a font. 440 * @font: a font.
441 * @glyph: 441 * @glyph:
442 * 442 *
443 * 443 *
444 * 444 *
445 * Return value: 445 * Return value:
446 * 446 *
447 * Since: 1.0 447 * Since: 0.9.2
448 **/ 448 **/
449 hb_position_t 449 hb_position_t
450 hb_font_get_glyph_h_advance (hb_font_t *font, 450 hb_font_get_glyph_h_advance (hb_font_t *font,
451 hb_codepoint_t glyph) 451 hb_codepoint_t glyph)
452 { 452 {
453 return font->get_glyph_h_advance (glyph); 453 return font->get_glyph_h_advance (glyph);
454 } 454 }
455 455
456 /** 456 /**
457 * hb_font_get_glyph_v_advance: 457 * hb_font_get_glyph_v_advance:
458 * @font: a font. 458 * @font: a font.
459 * @glyph: 459 * @glyph:
460 * 460 *
461 * 461 *
462 * 462 *
463 * Return value: 463 * Return value:
464 * 464 *
465 * Since: 1.0 465 * Since: 0.9.2
466 **/ 466 **/
467 hb_position_t 467 hb_position_t
468 hb_font_get_glyph_v_advance (hb_font_t *font, 468 hb_font_get_glyph_v_advance (hb_font_t *font,
469 hb_codepoint_t glyph) 469 hb_codepoint_t glyph)
470 { 470 {
471 return font->get_glyph_v_advance (glyph); 471 return font->get_glyph_v_advance (glyph);
472 } 472 }
473 473
474 /** 474 /**
475 * hb_font_get_glyph_h_origin: 475 * hb_font_get_glyph_h_origin:
476 * @font: a font. 476 * @font: a font.
477 * @glyph: 477 * @glyph:
478 * @x: (out): 478 * @x: (out):
479 * @y: (out): 479 * @y: (out):
480 * 480 *
481 * 481 *
482 * 482 *
483 * Return value: 483 * Return value:
484 * 484 *
485 * Since: 1.0 485 * Since: 0.9.2
486 **/ 486 **/
487 hb_bool_t 487 hb_bool_t
488 hb_font_get_glyph_h_origin (hb_font_t *font, 488 hb_font_get_glyph_h_origin (hb_font_t *font,
489 hb_codepoint_t glyph, 489 hb_codepoint_t glyph,
490 hb_position_t *x, hb_position_t *y) 490 hb_position_t *x, hb_position_t *y)
491 { 491 {
492 return font->get_glyph_h_origin (glyph, x, y); 492 return font->get_glyph_h_origin (glyph, x, y);
493 } 493 }
494 494
495 /** 495 /**
496 * hb_font_get_glyph_v_origin: 496 * hb_font_get_glyph_v_origin:
497 * @font: a font. 497 * @font: a font.
498 * @glyph: 498 * @glyph:
499 * @x: (out): 499 * @x: (out):
500 * @y: (out): 500 * @y: (out):
501 * 501 *
502 * 502 *
503 * 503 *
504 * Return value: 504 * Return value:
505 * 505 *
506 * Since: 1.0 506 * Since: 0.9.2
507 **/ 507 **/
508 hb_bool_t 508 hb_bool_t
509 hb_font_get_glyph_v_origin (hb_font_t *font, 509 hb_font_get_glyph_v_origin (hb_font_t *font,
510 hb_codepoint_t glyph, 510 hb_codepoint_t glyph,
511 hb_position_t *x, hb_position_t *y) 511 hb_position_t *x, hb_position_t *y)
512 { 512 {
513 return font->get_glyph_v_origin (glyph, x, y); 513 return font->get_glyph_v_origin (glyph, x, y);
514 } 514 }
515 515
516 /** 516 /**
517 * hb_font_get_glyph_h_kerning: 517 * hb_font_get_glyph_h_kerning:
518 * @font: a font. 518 * @font: a font.
519 * @left_glyph: 519 * @left_glyph:
520 * @right_glyph: 520 * @right_glyph:
521 * 521 *
522 * 522 *
523 * 523 *
524 * Return value: 524 * Return value:
525 * 525 *
526 * Since: 1.0 526 * Since: 0.9.2
527 **/ 527 **/
528 hb_position_t 528 hb_position_t
529 hb_font_get_glyph_h_kerning (hb_font_t *font, 529 hb_font_get_glyph_h_kerning (hb_font_t *font,
530 hb_codepoint_t left_glyph, hb_codepoint_t right_gly ph) 530 hb_codepoint_t left_glyph, hb_codepoint_t right_gly ph)
531 { 531 {
532 return font->get_glyph_h_kerning (left_glyph, right_glyph); 532 return font->get_glyph_h_kerning (left_glyph, right_glyph);
533 } 533 }
534 534
535 /** 535 /**
536 * hb_font_get_glyph_v_kerning: 536 * hb_font_get_glyph_v_kerning:
537 * @font: a font. 537 * @font: a font.
538 * @top_glyph: 538 * @top_glyph:
539 * @bottom_glyph: 539 * @bottom_glyph:
540 * 540 *
541 * 541 *
542 * 542 *
543 * Return value: 543 * Return value:
544 * 544 *
545 * Since: 1.0 545 * Since: 0.9.2
546 **/ 546 **/
547 hb_position_t 547 hb_position_t
548 hb_font_get_glyph_v_kerning (hb_font_t *font, 548 hb_font_get_glyph_v_kerning (hb_font_t *font,
549 hb_codepoint_t top_glyph, hb_codepoint_t bottom_gly ph) 549 hb_codepoint_t top_glyph, hb_codepoint_t bottom_gly ph)
550 { 550 {
551 return font->get_glyph_v_kerning (top_glyph, bottom_glyph); 551 return font->get_glyph_v_kerning (top_glyph, bottom_glyph);
552 } 552 }
553 553
554 /** 554 /**
555 * hb_font_get_glyph_extents: 555 * hb_font_get_glyph_extents:
556 * @font: a font. 556 * @font: a font.
557 * @glyph: 557 * @glyph:
558 * @extents: (out): 558 * @extents: (out):
559 * 559 *
560 * 560 *
561 * 561 *
562 * Return value: 562 * Return value:
563 * 563 *
564 * Since: 1.0 564 * Since: 0.9.2
565 **/ 565 **/
566 hb_bool_t 566 hb_bool_t
567 hb_font_get_glyph_extents (hb_font_t *font, 567 hb_font_get_glyph_extents (hb_font_t *font,
568 hb_codepoint_t glyph, 568 hb_codepoint_t glyph,
569 hb_glyph_extents_t *extents) 569 hb_glyph_extents_t *extents)
570 { 570 {
571 return font->get_glyph_extents (glyph, extents); 571 return font->get_glyph_extents (glyph, extents);
572 } 572 }
573 573
574 /** 574 /**
575 * hb_font_get_glyph_contour_point: 575 * hb_font_get_glyph_contour_point:
576 * @font: a font. 576 * @font: a font.
577 * @glyph: 577 * @glyph:
578 * @point_index: 578 * @point_index:
579 * @x: (out): 579 * @x: (out):
580 * @y: (out): 580 * @y: (out):
581 * 581 *
582 * 582 *
583 * 583 *
584 * Return value: 584 * Return value:
585 * 585 *
586 * Since: 1.0 586 * Since: 0.9.2
587 **/ 587 **/
588 hb_bool_t 588 hb_bool_t
589 hb_font_get_glyph_contour_point (hb_font_t *font, 589 hb_font_get_glyph_contour_point (hb_font_t *font,
590 hb_codepoint_t glyph, unsigned int point_index, 590 hb_codepoint_t glyph, unsigned int point_index,
591 hb_position_t *x, hb_position_t *y) 591 hb_position_t *x, hb_position_t *y)
592 { 592 {
593 return font->get_glyph_contour_point (glyph, point_index, x, y); 593 return font->get_glyph_contour_point (glyph, point_index, x, y);
594 } 594 }
595 595
596 /** 596 /**
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 /** 641 /**
642 * hb_font_get_glyph_advance_for_direction: 642 * hb_font_get_glyph_advance_for_direction:
643 * @font: a font. 643 * @font: a font.
644 * @glyph: 644 * @glyph:
645 * @direction: 645 * @direction:
646 * @x: (out): 646 * @x: (out):
647 * @y: (out): 647 * @y: (out):
648 * 648 *
649 * 649 *
650 * 650 *
651 * Since: 1.0 651 * Since: 0.9.2
652 **/ 652 **/
653 void 653 void
654 hb_font_get_glyph_advance_for_direction (hb_font_t *font, 654 hb_font_get_glyph_advance_for_direction (hb_font_t *font,
655 hb_codepoint_t glyph, 655 hb_codepoint_t glyph,
656 hb_direction_t direction, 656 hb_direction_t direction,
657 hb_position_t *x, hb_position_t *y) 657 hb_position_t *x, hb_position_t *y)
658 { 658 {
659 return font->get_glyph_advance_for_direction (glyph, direction, x, y); 659 return font->get_glyph_advance_for_direction (glyph, direction, x, y);
660 } 660 }
661 661
662 /** 662 /**
663 * hb_font_get_glyph_origin_for_direction: 663 * hb_font_get_glyph_origin_for_direction:
664 * @font: a font. 664 * @font: a font.
665 * @glyph: 665 * @glyph:
666 * @direction: 666 * @direction:
667 * @x: (out): 667 * @x: (out):
668 * @y: (out): 668 * @y: (out):
669 * 669 *
670 * 670 *
671 * 671 *
672 * Since: 1.0 672 * Since: 0.9.2
673 **/ 673 **/
674 void 674 void
675 hb_font_get_glyph_origin_for_direction (hb_font_t *font, 675 hb_font_get_glyph_origin_for_direction (hb_font_t *font,
676 hb_codepoint_t glyph, 676 hb_codepoint_t glyph,
677 hb_direction_t direction, 677 hb_direction_t direction,
678 hb_position_t *x, hb_position_t *y) 678 hb_position_t *x, hb_position_t *y)
679 { 679 {
680 return font->get_glyph_origin_for_direction (glyph, direction, x, y); 680 return font->get_glyph_origin_for_direction (glyph, direction, x, y);
681 } 681 }
682 682
683 /** 683 /**
684 * hb_font_add_glyph_origin_for_direction: 684 * hb_font_add_glyph_origin_for_direction:
685 * @font: a font. 685 * @font: a font.
686 * @glyph: 686 * @glyph:
687 * @direction: 687 * @direction:
688 * @x: (out): 688 * @x: (out):
689 * @y: (out): 689 * @y: (out):
690 * 690 *
691 * 691 *
692 * 692 *
693 * Since: 1.0 693 * Since: 0.9.2
694 **/ 694 **/
695 void 695 void
696 hb_font_add_glyph_origin_for_direction (hb_font_t *font, 696 hb_font_add_glyph_origin_for_direction (hb_font_t *font,
697 hb_codepoint_t glyph, 697 hb_codepoint_t glyph,
698 hb_direction_t direction, 698 hb_direction_t direction,
699 hb_position_t *x, hb_position_t *y) 699 hb_position_t *x, hb_position_t *y)
700 { 700 {
701 return font->add_glyph_origin_for_direction (glyph, direction, x, y); 701 return font->add_glyph_origin_for_direction (glyph, direction, x, y);
702 } 702 }
703 703
704 /** 704 /**
705 * hb_font_subtract_glyph_origin_for_direction: 705 * hb_font_subtract_glyph_origin_for_direction:
706 * @font: a font. 706 * @font: a font.
707 * @glyph: 707 * @glyph:
708 * @direction: 708 * @direction:
709 * @x: (out): 709 * @x: (out):
710 * @y: (out): 710 * @y: (out):
711 * 711 *
712 * 712 *
713 * 713 *
714 * Since: 1.0 714 * Since: 0.9.2
715 **/ 715 **/
716 void 716 void
717 hb_font_subtract_glyph_origin_for_direction (hb_font_t *font, 717 hb_font_subtract_glyph_origin_for_direction (hb_font_t *font,
718 hb_codepoint_t glyph, 718 hb_codepoint_t glyph,
719 hb_direction_t direction, 719 hb_direction_t direction,
720 hb_position_t *x, hb_position_t *y) 720 hb_position_t *x, hb_position_t *y)
721 { 721 {
722 return font->subtract_glyph_origin_for_direction (glyph, direction, x, y); 722 return font->subtract_glyph_origin_for_direction (glyph, direction, x, y);
723 } 723 }
724 724
725 /** 725 /**
726 * hb_font_get_glyph_kerning_for_direction: 726 * hb_font_get_glyph_kerning_for_direction:
727 * @font: a font. 727 * @font: a font.
728 * @first_glyph: 728 * @first_glyph:
729 * @second_glyph: 729 * @second_glyph:
730 * @direction: 730 * @direction:
731 * @x: (out): 731 * @x: (out):
732 * @y: (out): 732 * @y: (out):
733 * 733 *
734 * 734 *
735 * 735 *
736 * Since: 1.0 736 * Since: 0.9.2
737 **/ 737 **/
738 void 738 void
739 hb_font_get_glyph_kerning_for_direction (hb_font_t *font, 739 hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
740 hb_codepoint_t first_glyph, hb_codepoin t_t second_glyph, 740 hb_codepoint_t first_glyph, hb_codepoin t_t second_glyph,
741 hb_direction_t direction, 741 hb_direction_t direction,
742 hb_position_t *x, hb_position_t *y) 742 hb_position_t *x, hb_position_t *y)
743 { 743 {
744 return font->get_glyph_kerning_for_direction (first_glyph, second_glyph, direc tion, x, y); 744 return font->get_glyph_kerning_for_direction (first_glyph, second_glyph, direc tion, x, y);
745 } 745 }
746 746
747 /** 747 /**
748 * hb_font_get_glyph_extents_for_origin: 748 * hb_font_get_glyph_extents_for_origin:
749 * @font: a font. 749 * @font: a font.
750 * @glyph: 750 * @glyph:
751 * @direction: 751 * @direction:
752 * @extents: (out): 752 * @extents: (out):
753 * 753 *
754 * 754 *
755 * 755 *
756 * Return value: 756 * Return value:
757 * 757 *
758 * Since: 1.0 758 * Since: 0.9.2
759 **/ 759 **/
760 hb_bool_t 760 hb_bool_t
761 hb_font_get_glyph_extents_for_origin (hb_font_t *font, 761 hb_font_get_glyph_extents_for_origin (hb_font_t *font,
762 hb_codepoint_t glyph, 762 hb_codepoint_t glyph,
763 hb_direction_t direction, 763 hb_direction_t direction,
764 hb_glyph_extents_t *extents) 764 hb_glyph_extents_t *extents)
765 { 765 {
766 return font->get_glyph_extents_for_origin (glyph, direction, extents); 766 return font->get_glyph_extents_for_origin (glyph, direction, extents);
767 } 767 }
768 768
769 /** 769 /**
770 * hb_font_get_glyph_contour_point_for_origin: 770 * hb_font_get_glyph_contour_point_for_origin:
771 * @font: a font. 771 * @font: a font.
772 * @glyph: 772 * @glyph:
773 * @point_index: 773 * @point_index:
774 * @direction: 774 * @direction:
775 * @x: (out): 775 * @x: (out):
776 * @y: (out): 776 * @y: (out):
777 * 777 *
778 * 778 *
779 * 779 *
780 * Return value: 780 * Return value:
781 * 781 *
782 * Since: 1.0 782 * Since: 0.9.2
783 **/ 783 **/
784 hb_bool_t 784 hb_bool_t
785 hb_font_get_glyph_contour_point_for_origin (hb_font_t *font, 785 hb_font_get_glyph_contour_point_for_origin (hb_font_t *font,
786 hb_codepoint_t glyph, unsigned int p oint_index, 786 hb_codepoint_t glyph, unsigned int p oint_index,
787 hb_direction_t direction, 787 hb_direction_t direction,
788 hb_position_t *x, hb_position_t *y) 788 hb_position_t *x, hb_position_t *y)
789 { 789 {
790 return font->get_glyph_contour_point_for_origin (glyph, point_index, direction , x, y); 790 return font->get_glyph_contour_point_for_origin (glyph, point_index, direction , x, y);
791 } 791 }
792 792
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 */ 838 */
839 839
840 /** 840 /**
841 * hb_font_create: (Xconstructor) 841 * hb_font_create: (Xconstructor)
842 * @face: a face. 842 * @face: a face.
843 * 843 *
844 * 844 *
845 * 845 *
846 * Return value: (transfer full): 846 * Return value: (transfer full):
847 * 847 *
848 * Since: 1.0 848 * Since: 0.9.2
849 **/ 849 **/
850 hb_font_t * 850 hb_font_t *
851 hb_font_create (hb_face_t *face) 851 hb_font_create (hb_face_t *face)
852 { 852 {
853 hb_font_t *font; 853 hb_font_t *font;
854 854
855 if (unlikely (!face)) 855 if (unlikely (!face))
856 face = hb_face_get_empty (); 856 face = hb_face_get_empty ();
857 if (!(font = hb_object_create<hb_font_t> ())) 857 if (!(font = hb_object_create<hb_font_t> ()))
858 return hb_font_get_empty (); 858 return hb_font_get_empty ();
859 859
860 hb_face_make_immutable (face); 860 hb_face_make_immutable (face);
861 font->face = hb_face_reference (face); 861 font->face = hb_face_reference (face);
862 font->klass = hb_font_funcs_get_empty (); 862 font->klass = hb_font_funcs_get_empty ();
863 863
864 font->x_scale = font->y_scale = hb_face_get_upem (face);
865
864 return font; 866 return font;
865 } 867 }
866 868
867 /** 869 /**
868 * hb_font_create_sub_font: 870 * hb_font_create_sub_font:
869 * @parent: parent font. 871 * @parent: parent font.
870 * 872 *
871 * 873 *
872 * 874 *
873 * Return value: (transfer full): 875 * Return value: (transfer full):
874 * 876 *
875 * Since: 1.0 877 * Since: 0.9.2
876 **/ 878 **/
877 hb_font_t * 879 hb_font_t *
878 hb_font_create_sub_font (hb_font_t *parent) 880 hb_font_create_sub_font (hb_font_t *parent)
879 { 881 {
880 if (unlikely (!parent)) 882 if (unlikely (!parent))
881 parent = hb_font_get_empty (); 883 parent = hb_font_get_empty ();
882 884
883 hb_font_t *font = hb_font_create (parent->face); 885 hb_font_t *font = hb_font_create (parent->face);
884 886
885 if (unlikely (hb_object_is_inert (font))) 887 if (unlikely (hb_object_is_inert (font)))
886 return font; 888 return font;
887 889
888 hb_font_make_immutable (parent);
889 font->parent = hb_font_reference (parent); 890 font->parent = hb_font_reference (parent);
890 891
891 font->x_scale = parent->x_scale; 892 font->x_scale = parent->x_scale;
892 font->y_scale = parent->y_scale; 893 font->y_scale = parent->y_scale;
893 font->x_ppem = parent->x_ppem; 894 font->x_ppem = parent->x_ppem;
894 font->y_ppem = parent->y_ppem; 895 font->y_ppem = parent->y_ppem;
895 896
896 return font; 897 return font;
897 } 898 }
898 899
899 /** 900 /**
900 * hb_font_get_empty: 901 * hb_font_get_empty:
901 * 902 *
902 * 903 *
903 * 904 *
904 * Return value: (transfer full) 905 * Return value: (transfer full)
905 * 906 *
906 * Since: 1.0 907 * Since: 0.9.2
907 **/ 908 **/
908 hb_font_t * 909 hb_font_t *
909 hb_font_get_empty (void) 910 hb_font_get_empty (void)
910 { 911 {
911 static const hb_font_t _hb_font_nil = { 912 static const hb_font_t _hb_font_nil = {
912 HB_OBJECT_HEADER_STATIC, 913 HB_OBJECT_HEADER_STATIC,
913 914
914 true, /* immutable */ 915 true, /* immutable */
915 916
916 NULL, /* parent */ 917 NULL, /* parent */
(...skipping 20 matching lines...) Expand all
937 } 938 }
938 939
939 /** 940 /**
940 * hb_font_reference: (skip) 941 * hb_font_reference: (skip)
941 * @font: a font. 942 * @font: a font.
942 * 943 *
943 * 944 *
944 * 945 *
945 * Return value: (transfer full): 946 * Return value: (transfer full):
946 * 947 *
947 * Since: 1.0 948 * Since: 0.9.2
948 **/ 949 **/
949 hb_font_t * 950 hb_font_t *
950 hb_font_reference (hb_font_t *font) 951 hb_font_reference (hb_font_t *font)
951 { 952 {
952 return hb_object_reference (font); 953 return hb_object_reference (font);
953 } 954 }
954 955
955 /** 956 /**
956 * hb_font_destroy: (skip) 957 * hb_font_destroy: (skip)
957 * @font: a font. 958 * @font: a font.
958 * 959 *
959 * 960 *
960 * 961 *
961 * Since: 1.0 962 * Since: 0.9.2
962 **/ 963 **/
963 void 964 void
964 hb_font_destroy (hb_font_t *font) 965 hb_font_destroy (hb_font_t *font)
965 { 966 {
966 if (!hb_object_destroy (font)) return; 967 if (!hb_object_destroy (font)) return;
967 968
968 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_DESTROY(shaper, font); 969 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_DESTROY(shaper, font);
969 #include "hb-shaper-list.hh" 970 #include "hb-shaper-list.hh"
970 #undef HB_SHAPER_IMPLEMENT 971 #undef HB_SHAPER_IMPLEMENT
971 972
(...skipping 12 matching lines...) Expand all
984 * @font: a font. 985 * @font: a font.
985 * @key: 986 * @key:
986 * @data: 987 * @data:
987 * @destroy: 988 * @destroy:
988 * @replace: 989 * @replace:
989 * 990 *
990 * 991 *
991 * 992 *
992 * Return value: 993 * Return value:
993 * 994 *
994 * Since: 1.0 995 * Since: 0.9.2
995 **/ 996 **/
996 hb_bool_t 997 hb_bool_t
997 hb_font_set_user_data (hb_font_t *font, 998 hb_font_set_user_data (hb_font_t *font,
998 hb_user_data_key_t *key, 999 hb_user_data_key_t *key,
999 void * data, 1000 void * data,
1000 hb_destroy_func_t destroy, 1001 hb_destroy_func_t destroy,
1001 hb_bool_t replace) 1002 hb_bool_t replace)
1002 { 1003 {
1003 return hb_object_set_user_data (font, key, data, destroy, replace); 1004 return hb_object_set_user_data (font, key, data, destroy, replace);
1004 } 1005 }
1005 1006
1006 /** 1007 /**
1007 * hb_font_get_user_data: (skip) 1008 * hb_font_get_user_data: (skip)
1008 * @font: a font. 1009 * @font: a font.
1009 * @key: 1010 * @key:
1010 * 1011 *
1011 * 1012 *
1012 * 1013 *
1013 * Return value: (transfer none): 1014 * Return value: (transfer none):
1014 * 1015 *
1015 * Since: 1.0 1016 * Since: 0.9.2
1016 **/ 1017 **/
1017 void * 1018 void *
1018 hb_font_get_user_data (hb_font_t *font, 1019 hb_font_get_user_data (hb_font_t *font,
1019 hb_user_data_key_t *key) 1020 hb_user_data_key_t *key)
1020 { 1021 {
1021 return hb_object_get_user_data (font, key); 1022 return hb_object_get_user_data (font, key);
1022 } 1023 }
1023 1024
1024 /** 1025 /**
1025 * hb_font_make_immutable: 1026 * hb_font_make_immutable:
1026 * @font: a font. 1027 * @font: a font.
1027 * 1028 *
1028 * 1029 *
1029 * 1030 *
1030 * Since: 1.0 1031 * Since: 0.9.2
1031 **/ 1032 **/
1032 void 1033 void
1033 hb_font_make_immutable (hb_font_t *font) 1034 hb_font_make_immutable (hb_font_t *font)
1034 { 1035 {
1035 if (unlikely (hb_object_is_inert (font))) 1036 if (unlikely (hb_object_is_inert (font)))
1036 return; 1037 return;
1037 1038
1039 if (font->parent)
1040 hb_font_make_immutable (font->parent);
1041
1038 font->immutable = true; 1042 font->immutable = true;
1039 } 1043 }
1040 1044
1041 /** 1045 /**
1042 * hb_font_is_immutable: 1046 * hb_font_is_immutable:
1043 * @font: a font. 1047 * @font: a font.
1044 * 1048 *
1045 * 1049 *
1046 * 1050 *
1047 * Return value: 1051 * Return value:
1048 * 1052 *
1049 * Since: 1.0 1053 * Since: 0.9.2
1050 **/ 1054 **/
1051 hb_bool_t 1055 hb_bool_t
1052 hb_font_is_immutable (hb_font_t *font) 1056 hb_font_is_immutable (hb_font_t *font)
1053 { 1057 {
1054 return font->immutable; 1058 return font->immutable;
1055 } 1059 }
1056 1060
1057 /** 1061 /**
1062 * hb_font_set_parent:
1063 * @font: a font.
1064 * @parent: new parent.
1065 *
1066 * Sets parent font of @font.
1067 *
1068 * Since: 1.0.5
1069 **/
1070 void
1071 hb_font_set_parent (hb_font_t *font,
1072 hb_font_t *parent)
1073 {
1074 if (font->immutable)
1075 return;
1076
1077 if (!parent)
1078 parent = hb_font_get_empty ();
1079
1080 hb_font_t *old = font->parent;
1081
1082 font->parent = hb_font_reference (parent);
1083
1084 hb_font_destroy (old);
1085 }
1086
1087 /**
1058 * hb_font_get_parent: 1088 * hb_font_get_parent:
1059 * @font: a font. 1089 * @font: a font.
1060 * 1090 *
1061 * 1091 *
1062 * 1092 *
1063 * Return value: (transfer none): 1093 * Return value: (transfer none):
1064 * 1094 *
1065 * Since: 1.0 1095 * Since: 0.9.2
1066 **/ 1096 **/
1067 hb_font_t * 1097 hb_font_t *
1068 hb_font_get_parent (hb_font_t *font) 1098 hb_font_get_parent (hb_font_t *font)
1069 { 1099 {
1070 return font->parent; 1100 return font->parent;
1071 } 1101 }
1072 1102
1073 /** 1103 /**
1074 * hb_font_get_face: 1104 * hb_font_get_face:
1075 * @font: a font. 1105 * @font: a font.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 1184
1155 1185
1156 /** 1186 /**
1157 * hb_font_set_scale: 1187 * hb_font_set_scale:
1158 * @font: a font. 1188 * @font: a font.
1159 * @x_scale: 1189 * @x_scale:
1160 * @y_scale: 1190 * @y_scale:
1161 * 1191 *
1162 * 1192 *
1163 * 1193 *
1164 * Since: 1.0 1194 * Since: 0.9.2
1165 **/ 1195 **/
1166 void 1196 void
1167 hb_font_set_scale (hb_font_t *font, 1197 hb_font_set_scale (hb_font_t *font,
1168 int x_scale, 1198 int x_scale,
1169 int y_scale) 1199 int y_scale)
1170 { 1200 {
1171 if (font->immutable) 1201 if (font->immutable)
1172 return; 1202 return;
1173 1203
1174 font->x_scale = x_scale; 1204 font->x_scale = x_scale;
1175 font->y_scale = y_scale; 1205 font->y_scale = y_scale;
1176 } 1206 }
1177 1207
1178 /** 1208 /**
1179 * hb_font_get_scale: 1209 * hb_font_get_scale:
1180 * @font: a font. 1210 * @font: a font.
1181 * @x_scale: (out): 1211 * @x_scale: (out):
1182 * @y_scale: (out): 1212 * @y_scale: (out):
1183 * 1213 *
1184 * 1214 *
1185 * 1215 *
1186 * Since: 1.0 1216 * Since: 0.9.2
1187 **/ 1217 **/
1188 void 1218 void
1189 hb_font_get_scale (hb_font_t *font, 1219 hb_font_get_scale (hb_font_t *font,
1190 int *x_scale, 1220 int *x_scale,
1191 int *y_scale) 1221 int *y_scale)
1192 { 1222 {
1193 if (x_scale) *x_scale = font->x_scale; 1223 if (x_scale) *x_scale = font->x_scale;
1194 if (y_scale) *y_scale = font->y_scale; 1224 if (y_scale) *y_scale = font->y_scale;
1195 } 1225 }
1196 1226
1197 /** 1227 /**
1198 * hb_font_set_ppem: 1228 * hb_font_set_ppem:
1199 * @font: a font. 1229 * @font: a font.
1200 * @x_ppem: 1230 * @x_ppem:
1201 * @y_ppem: 1231 * @y_ppem:
1202 * 1232 *
1203 * 1233 *
1204 * 1234 *
1205 * Since: 1.0 1235 * Since: 0.9.2
1206 **/ 1236 **/
1207 void 1237 void
1208 hb_font_set_ppem (hb_font_t *font, 1238 hb_font_set_ppem (hb_font_t *font,
1209 unsigned int x_ppem, 1239 unsigned int x_ppem,
1210 unsigned int y_ppem) 1240 unsigned int y_ppem)
1211 { 1241 {
1212 if (font->immutable) 1242 if (font->immutable)
1213 return; 1243 return;
1214 1244
1215 font->x_ppem = x_ppem; 1245 font->x_ppem = x_ppem;
1216 font->y_ppem = y_ppem; 1246 font->y_ppem = y_ppem;
1217 } 1247 }
1218 1248
1219 /** 1249 /**
1220 * hb_font_get_ppem: 1250 * hb_font_get_ppem:
1221 * @font: a font. 1251 * @font: a font.
1222 * @x_ppem: (out): 1252 * @x_ppem: (out):
1223 * @y_ppem: (out): 1253 * @y_ppem: (out):
1224 * 1254 *
1225 * 1255 *
1226 * 1256 *
1227 * Since: 1.0 1257 * Since: 0.9.2
1228 **/ 1258 **/
1229 void 1259 void
1230 hb_font_get_ppem (hb_font_t *font, 1260 hb_font_get_ppem (hb_font_t *font,
1231 unsigned int *x_ppem, 1261 unsigned int *x_ppem,
1232 unsigned int *y_ppem) 1262 unsigned int *y_ppem)
1233 { 1263 {
1234 if (x_ppem) *x_ppem = font->x_ppem; 1264 if (x_ppem) *x_ppem = font->x_ppem;
1235 if (y_ppem) *y_ppem = font->y_ppem; 1265 if (y_ppem) *y_ppem = font->y_ppem;
1236 } 1266 }
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