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

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

Issue 9223010: Update harfbuzz-ng to 1a5a91dc0d8bf4b72a2f22dc6300b06ad7000b79. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't use -M option for 'git diff' to patch correctly Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-shape.cc ('k') | third_party/harfbuzz-ng/src/hb-unicode.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright © 2011 Google, Inc.
3 *
4 * This is part of HarfBuzz, a text shaping library.
5 *
6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software.
11 *
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16 * DAMAGE.
17 *
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23 *
24 * Google Author(s): Behdad Esfahbod
25 */
26
27 #include "hb-open-type-private.hh"
28
29 #include "hb-ot-hhea-table.hh"
30 #include "hb-ot-hmtx-table.hh"
31
32 #include "hb-font-private.hh"
33 #include "hb-blob.h"
34
35 #include <string.h>
36
37
38
39 #if 0
40 struct hb_tt_font_t
41 {
42 const struct hhea *hhea;
43 hb_blob_t *hhea_blob;
44 };
45
46
47 static hb_tt_font_t *
48 _hb_tt_font_create (hb_font_t *font)
49 {
50 /* TODO Remove this object altogether */
51 hb_tt_font_t *tt = (hb_tt_font_t *) calloc (1, sizeof (hb_tt_font_t));
52
53 tt->hhea_blob = Sanitizer<hhea>::sanitize (hb_face_reference_table (font->face , HB_OT_TAG_hhea));
54 tt->hhea = Sanitizer<hhea>::lock_instance (tt->hhea_blob);
55
56 return tt;
57 }
58
59 static void
60 _hb_tt_font_destroy (hb_tt_font_t *tt)
61 {
62 hb_blob_destroy (tt->hhea_blob);
63
64 free (tt);
65 }
66
67 static inline const hhea&
68 _get_hhea (hb_face_t *face)
69 {
70 // return likely (face->tt && face->tt->hhea) ? *face->tt->hhea : Null(hhea);
71 }
72
73
74 /*
75 * hb_tt_font_funcs_t
76 */
77
78 static hb_bool_t
79 hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED,
80 void *font_data HB_UNUSED,
81 hb_codepoint_t unicode,
82 hb_codepoint_t variation_selector,
83 hb_codepoint_t *glyph,
84 void *user_data HB_UNUSED)
85 {
86 if (font->parent)
87 return hb_font_get_glyph (font->parent, unicode, variation_selector, glyph);
88
89 *glyph = 0;
90 return FALSE;
91 }
92
93 static hb_position_t
94 hb_font_get_glyph_h_advance_nil (hb_font_t *font HB_UNUSED,
95 void *font_data HB_UNUSED,
96 hb_codepoint_t glyph,
97 void *user_data HB_UNUSED)
98 {
99 if (font->parent)
100 return font->parent_scale_x_distance (hb_font_get_glyph_h_advance (font->par ent, glyph));
101
102 return font->x_scale;
103 }
104
105 static hb_position_t
106 hb_font_get_glyph_v_advance_nil (hb_font_t *font HB_UNUSED,
107 void *font_data HB_UNUSED,
108 hb_codepoint_t glyph,
109 void *user_data HB_UNUSED)
110 {
111 if (font->parent)
112 return font->parent_scale_y_distance (hb_font_get_glyph_v_advance (font->par ent, glyph));
113
114 return font->y_scale;
115 }
116
117 static hb_bool_t
118 hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED,
119 void *font_data HB_UNUSED,
120 hb_codepoint_t glyph,
121 hb_position_t *x,
122 hb_position_t *y,
123 void *user_data HB_UNUSED)
124 {
125 if (font->parent) {
126 hb_bool_t ret = hb_font_get_glyph_h_origin (font->parent,
127 glyph,
128 x, y);
129 if (ret)
130 font->parent_scale_position (x, y);
131 return ret;
132 }
133
134 *x = *y = 0;
135 return FALSE;
136 }
137
138 static hb_bool_t
139 hb_font_get_glyph_v_origin_nil (hb_font_t *font HB_UNUSED,
140 void *font_data HB_UNUSED,
141 hb_codepoint_t glyph,
142 hb_position_t *x,
143 hb_position_t *y,
144 void *user_data HB_UNUSED)
145 {
146 if (font->parent) {
147 hb_bool_t ret = hb_font_get_glyph_v_origin (font->parent,
148 glyph,
149 x, y);
150 if (ret)
151 font->parent_scale_position (x, y);
152 return ret;
153 }
154
155 *x = *y = 0;
156 return FALSE;
157 }
158
159 static hb_position_t
160 hb_font_get_glyph_h_kerning_nil (hb_font_t *font HB_UNUSED,
161 void *font_data HB_UNUSED,
162 hb_codepoint_t left_glyph,
163 hb_codepoint_t right_glyph,
164 void *user_data HB_UNUSED)
165 {
166 if (font->parent)
167 return font->parent_scale_x_distance (hb_font_get_glyph_h_kerning (font->par ent, left_glyph, right_glyph));
168
169 return 0;
170 }
171
172 static hb_position_t
173 hb_font_get_glyph_v_kerning_nil (hb_font_t *font HB_UNUSED,
174 void *font_data HB_UNUSED,
175 hb_codepoint_t top_glyph,
176 hb_codepoint_t bottom_glyph,
177 void *user_data HB_UNUSED)
178 {
179 if (font->parent)
180 return font->parent_scale_y_distance (hb_font_get_glyph_v_kerning (font->par ent, top_glyph, bottom_glyph));
181
182 return 0;
183 }
184
185 static hb_bool_t
186 hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
187 void *font_data HB_UNUSED,
188 hb_codepoint_t glyph,
189 hb_glyph_extents_t *extents,
190 void *user_data HB_UNUSED)
191 {
192 if (font->parent) {
193 hb_bool_t ret = hb_font_get_glyph_extents (font->parent,
194 glyph,
195 extents);
196 if (ret) {
197 font->parent_scale_position (&extents->x_bearing, &extents->y_bearing);
198 font->parent_scale_distance (&extents->width, &extents->height);
199 }
200 return ret;
201 }
202
203 memset (extents, 0, sizeof (*extents));
204 return FALSE;
205 }
206
207 static hb_bool_t
208 hb_font_get_glyph_contour_point_nil (hb_font_t *font HB_UNUSED,
209 void *font_data HB_UNUSED,
210 hb_codepoint_t glyph,
211 unsigned int point_index,
212 hb_position_t *x,
213 hb_position_t *y,
214 void *user_data HB_UNUSED)
215 {
216 if (font->parent) {
217 hb_bool_t ret = hb_font_get_glyph_contour_point (font->parent,
218 glyph, point_index,
219 x, y);
220 if (ret)
221 font->parent_scale_position (x, y);
222 return ret;
223 }
224
225 *x = *y = 0;
226 return FALSE;
227 }
228
229
230 static hb_font_funcs_t _hb_font_funcs_nil = {
231 HB_OBJECT_HEADER_STATIC,
232
233 TRUE, /* immutable */
234
235 {
236 #define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_nil,
237 HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
238 #undef HB_FONT_FUNC_IMPLEMENT
239 }
240 };
241 #endif
242
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-shape.cc ('k') | third_party/harfbuzz-ng/src/hb-unicode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698