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

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

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.cc ('k') | third_party/harfbuzz-ng/src/hb-ft.cc » ('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 © 2011 Google, Inc. 3 * Copyright © 2011 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 hb_font_t *parent; 102 hb_font_t *parent;
103 hb_face_t *face; 103 hb_face_t *face;
104 104
105 int x_scale; 105 int x_scale;
106 int y_scale; 106 int y_scale;
107 107
108 unsigned int x_ppem; 108 unsigned int x_ppem;
109 unsigned int y_ppem; 109 unsigned int y_ppem;
110 110
111 /* Font variation coordinates. */
112 unsigned int num_coords;
113 int *coords;
114
111 hb_font_funcs_t *klass; 115 hb_font_funcs_t *klass;
112 void *user_data; 116 void *user_data;
113 hb_destroy_func_t destroy; 117 hb_destroy_func_t destroy;
114 118
115 struct hb_shaper_data_t shaper_data; 119 struct hb_shaper_data_t shaper_data;
116 120
117 121
118 /* Convert from font-space to user-space */ 122 /* Convert from font-space to user-space */
119 inline int dir_scale (hb_direction_t direction) 123 inline int dir_scale (hb_direction_t direction)
120 { return HB_DIRECTION_IS_VERTICAL(direction) ? y_scale : x_scale; } 124 { return HB_DIRECTION_IS_VERTICAL(direction) ? y_scale : x_scale; }
121 inline hb_position_t em_scale_x (int16_t v) { return em_scale (v, x_scale); } 125 inline hb_position_t em_scale_x (int16_t v) { return em_scale (v, x_scale); }
122 inline hb_position_t em_scale_y (int16_t v) { return em_scale (v, y_scale); } 126 inline hb_position_t em_scale_y (int16_t v) { return em_scale (v, y_scale); }
127 inline hb_position_t em_scalef_x (float v) { return em_scalef (v, this->x_scal e); }
128 inline hb_position_t em_scalef_y (float v) { return em_scalef (v, this->y_scal e); }
123 inline hb_position_t em_scale_dir (int16_t v, hb_direction_t direction) 129 inline hb_position_t em_scale_dir (int16_t v, hb_direction_t direction)
124 { return em_scale (v, dir_scale (direction)); } 130 { return em_scale (v, dir_scale (direction)); }
125 131
126 /* Convert from parent-font user-space to our user-space */ 132 /* Convert from parent-font user-space to our user-space */
127 inline hb_position_t parent_scale_x_distance (hb_position_t v) { 133 inline hb_position_t parent_scale_x_distance (hb_position_t v) {
128 if (unlikely (parent && parent->x_scale != x_scale)) 134 if (unlikely (parent && parent->x_scale != x_scale))
129 return (hb_position_t) (v * (int64_t) this->x_scale / this->parent->x_scal e); 135 return (hb_position_t) (v * (int64_t) this->x_scale / this->parent->x_scal e);
130 return v; 136 return v;
131 } 137 }
132 inline hb_position_t parent_scale_y_distance (hb_position_t v) { 138 inline hb_position_t parent_scale_y_distance (hb_position_t v) {
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 return false; 530 return false;
525 } 531 }
526 532
527 inline hb_position_t em_scale (int16_t v, int scale) 533 inline hb_position_t em_scale (int16_t v, int scale)
528 { 534 {
529 int upem = face->get_upem (); 535 int upem = face->get_upem ();
530 int64_t scaled = v * (int64_t) scale; 536 int64_t scaled = v * (int64_t) scale;
531 scaled += scaled >= 0 ? upem/2 : -upem/2; /* Round. */ 537 scaled += scaled >= 0 ? upem/2 : -upem/2; /* Round. */
532 return (hb_position_t) (scaled / upem); 538 return (hb_position_t) (scaled / upem);
533 } 539 }
540 inline hb_position_t em_scalef (float v, int scale)
541 {
542 return (hb_position_t) (v * scale / face->get_upem ());
543 }
534 }; 544 };
535 545
536 #define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS 546 #define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
537 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_PROTOTYPE(shaper, font); 547 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_PROTOTYPE(shaper, font);
538 #include "hb-shaper-list.hh" 548 #include "hb-shaper-list.hh"
539 #undef HB_SHAPER_IMPLEMENT 549 #undef HB_SHAPER_IMPLEMENT
540 #undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS 550 #undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
541 551
542 552
543 #endif /* HB_FONT_PRIVATE_HH */ 553 #endif /* HB_FONT_PRIVATE_HH */
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-font.cc ('k') | third_party/harfbuzz-ng/src/hb-ft.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698