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

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

Issue 1580513002: Roll HarfBuzz to 1.1.3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix Created 4 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 27 matching lines...) Expand all
38 #include "hb-cache-private.hh" 38 #include "hb-cache-private.hh"
39 39
40 #include <string.h> 40 #include <string.h>
41 41
42 42
43 /* 43 /*
44 * hb_font_funcs_t 44 * hb_font_funcs_t
45 */ 45 */
46 46
47 static hb_bool_t 47 static hb_bool_t
48 hb_font_get_font_h_extents_nil (hb_font_t *font,
49 void *font_data HB_UNUSED,
50 hb_font_extents_t *metrics,
51 void *user_data HB_UNUSED)
52 {
53 memset (metrics, 0, sizeof (*metrics));
54 return false;
55 }
56 static hb_bool_t
57 hb_font_get_font_h_extents_parent (hb_font_t *font,
58 void *font_data HB_UNUSED,
59 hb_font_extents_t *metrics,
60 void *user_data HB_UNUSED)
61 {
62 hb_bool_t ret = font->parent->get_font_h_extents (metrics);
63 if (ret) {
64 metrics->ascender = font->parent_scale_y_distance (metrics->ascender);
65 metrics->descender = font->parent_scale_y_distance (metrics->descender);
66 metrics->line_gap = font->parent_scale_y_distance (metrics->line_gap);
67 }
68 return ret;
69 }
70
71 static hb_bool_t
72 hb_font_get_font_v_extents_nil (hb_font_t *font,
73 void *font_data HB_UNUSED,
74 hb_font_extents_t *metrics,
75 void *user_data HB_UNUSED)
76 {
77 memset (metrics, 0, sizeof (*metrics));
78 return false;
79 }
80 static hb_bool_t
81 hb_font_get_font_v_extents_parent (hb_font_t *font,
82 void *font_data HB_UNUSED,
83 hb_font_extents_t *metrics,
84 void *user_data HB_UNUSED)
85 {
86 hb_bool_t ret = font->parent->get_font_v_extents (metrics);
87 if (ret) {
88 metrics->ascender = font->parent_scale_x_distance (metrics->ascender);
89 metrics->descender = font->parent_scale_x_distance (metrics->descender);
90 metrics->line_gap = font->parent_scale_x_distance (metrics->line_gap);
91 }
92 return ret;
93 }
94
95 static hb_bool_t
48 hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED, 96 hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED,
49 void *font_data HB_UNUSED, 97 void *font_data HB_UNUSED,
50 hb_codepoint_t unicode, 98 hb_codepoint_t unicode,
51 hb_codepoint_t variation_selector, 99 hb_codepoint_t variation_selector,
52 hb_codepoint_t *glyph, 100 hb_codepoint_t *glyph,
53 void *user_data HB_UNUSED) 101 void *user_data HB_UNUSED)
54 { 102 {
55 *glyph = 0; 103 *glyph = 0;
56 return false; 104 return false;
57 } 105 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 150
103 static hb_bool_t 151 static hb_bool_t
104 hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED, 152 hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED,
105 void *font_data HB_UNUSED, 153 void *font_data HB_UNUSED,
106 hb_codepoint_t glyph, 154 hb_codepoint_t glyph,
107 hb_position_t *x, 155 hb_position_t *x,
108 hb_position_t *y, 156 hb_position_t *y,
109 void *user_data HB_UNUSED) 157 void *user_data HB_UNUSED)
110 { 158 {
111 *x = *y = 0; 159 *x = *y = 0;
112 return false; 160 return true;
113 } 161 }
114 static hb_bool_t 162 static hb_bool_t
115 hb_font_get_glyph_h_origin_parent (hb_font_t *font, 163 hb_font_get_glyph_h_origin_parent (hb_font_t *font,
116 void *font_data HB_UNUSED, 164 void *font_data HB_UNUSED,
117 hb_codepoint_t glyph, 165 hb_codepoint_t glyph,
118 hb_position_t *x, 166 hb_position_t *x,
119 hb_position_t *y, 167 hb_position_t *y,
120 void *user_data HB_UNUSED) 168 void *user_data HB_UNUSED)
121 { 169 {
122 hb_bool_t ret = font->parent->get_glyph_h_origin (glyph, x, y); 170 hb_bool_t ret = font->parent->get_glyph_h_origin (glyph, x, y);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 static hb_bool_t 321 static hb_bool_t
274 hb_font_get_glyph_from_name_parent (hb_font_t *font, 322 hb_font_get_glyph_from_name_parent (hb_font_t *font,
275 void *font_data HB_UNUSED, 323 void *font_data HB_UNUSED,
276 const char *name, int len, /* -1 means nul-t erminated */ 324 const char *name, int len, /* -1 means nul-t erminated */
277 hb_codepoint_t *glyph, 325 hb_codepoint_t *glyph,
278 void *user_data HB_UNUSED) 326 void *user_data HB_UNUSED)
279 { 327 {
280 return font->parent->get_glyph_from_name (name, len, glyph); 328 return font->parent->get_glyph_from_name (name, len, glyph);
281 } 329 }
282 330
283
284 static const hb_font_funcs_t _hb_font_funcs_nil = { 331 static const hb_font_funcs_t _hb_font_funcs_nil = {
285 HB_OBJECT_HEADER_STATIC, 332 HB_OBJECT_HEADER_STATIC,
286 333
287 true, /* immutable */ 334 true, /* immutable */
288 335
289 { 336 {
290 #define HB_FONT_FUNC_IMPLEMENT(name) NULL, 337 #define HB_FONT_FUNC_IMPLEMENT(name) NULL,
291 HB_FONT_FUNCS_IMPLEMENT_CALLBACKS 338 HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
292 #undef HB_FONT_FUNC_IMPLEMENT 339 #undef HB_FONT_FUNC_IMPLEMENT
293 }, 340 },
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 hb_font_t::has_func (unsigned int i) 562 hb_font_t::has_func (unsigned int i)
516 { 563 {
517 if (parent && parent != hb_font_get_empty () && parent->has_func (i)) 564 if (parent && parent != hb_font_get_empty () && parent->has_func (i))
518 return true; 565 return true;
519 return this->klass->get.array[i] != _hb_font_funcs_parent.get.array[i]; 566 return this->klass->get.array[i] != _hb_font_funcs_parent.get.array[i];
520 } 567 }
521 568
522 /* Public getters */ 569 /* Public getters */
523 570
524 /** 571 /**
572 * hb_font_get_h_extents:
573 * @font: a font.
574 * @extents: (out):
575 *
576 *
577 *
578 * Return value:
579 *
580 * Since: 1.1.3
581 **/
582 hb_bool_t
583 hb_font_get_h_extents (hb_font_t *font,
584 hb_font_extents_t *extents)
585 {
586 return font->get_font_h_extents (extents);
587 }
588
589 /**
590 * hb_font_get_v_extents:
591 * @font: a font.
592 * @extents: (out):
593 *
594 *
595 *
596 * Return value:
597 *
598 * Since: 1.1.3
599 **/
600 hb_bool_t
601 hb_font_get_v_extents (hb_font_t *font,
602 hb_font_extents_t *extents)
603 {
604 return font->get_font_v_extents (extents);
605 }
606
607 /**
525 * hb_font_get_glyph: 608 * hb_font_get_glyph:
526 * @font: a font. 609 * @font: a font.
527 * @unicode: 610 * @unicode:
528 * @variation_selector: 611 * @variation_selector:
529 * @glyph: (out): 612 * @glyph: (out):
530 * 613 *
531 * 614 *
532 * 615 *
533 * Return value: 616 * Return value:
534 * 617 *
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 const char *name, int len, /* -1 means nul-terminat ed */ 822 const char *name, int len, /* -1 means nul-terminat ed */
740 hb_codepoint_t *glyph) 823 hb_codepoint_t *glyph)
741 { 824 {
742 return font->get_glyph_from_name (name, len, glyph); 825 return font->get_glyph_from_name (name, len, glyph);
743 } 826 }
744 827
745 828
746 /* A bit higher-level, and with fallback */ 829 /* A bit higher-level, and with fallback */
747 830
748 /** 831 /**
832 * hb_font_get_extents_for_direction:
833 * @font: a font.
834 * @direction:
835 * @extents:
836 *
837 *
838 *
839 * Since: 1.1.3
840 **/
841 void
842 hb_font_get_extents_for_direction (hb_font_t *font,
843 hb_direction_t direction,
844 hb_font_extents_t *extents)
845 {
846 return font->get_extents_for_direction (direction, extents);
847 }
848 /**
749 * hb_font_get_glyph_advance_for_direction: 849 * hb_font_get_glyph_advance_for_direction:
750 * @font: a font. 850 * @font: a font.
751 * @glyph: 851 * @glyph:
752 * @direction: 852 * @direction:
753 * @x: (out): 853 * @x: (out):
754 * @y: (out): 854 * @y: (out):
755 * 855 *
756 * 856 *
757 * 857 *
758 * Since: 0.9.2 858 * Since: 0.9.2
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 * Since: 0.9.2 1465 * Since: 0.9.2
1366 **/ 1466 **/
1367 void 1467 void
1368 hb_font_get_ppem (hb_font_t *font, 1468 hb_font_get_ppem (hb_font_t *font,
1369 unsigned int *x_ppem, 1469 unsigned int *x_ppem,
1370 unsigned int *y_ppem) 1470 unsigned int *y_ppem)
1371 { 1471 {
1372 if (x_ppem) *x_ppem = font->x_ppem; 1472 if (x_ppem) *x_ppem = font->x_ppem;
1373 if (y_ppem) *y_ppem = font->y_ppem; 1473 if (y_ppem) *y_ppem = font->y_ppem;
1374 } 1474 }
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