OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Koji Ishii <kojiishi@gmail.com> | 2 * Copyright (C) 2012 Koji Ishii <kojiishi@gmail.com> |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // No vertical info in the font file; use height as advance. | 238 // No vertical info in the font file; use height as advance. |
239 return font->GetFontMetrics().Height(); | 239 return font->GetFontMetrics().Height(); |
240 } | 240 } |
241 | 241 |
242 void OpenTypeVerticalData::GetVerticalTranslationsForGlyphs( | 242 void OpenTypeVerticalData::GetVerticalTranslationsForGlyphs( |
243 const SimpleFontData* font, | 243 const SimpleFontData* font, |
244 const Glyph* glyphs, | 244 const Glyph* glyphs, |
245 size_t count, | 245 size_t count, |
246 float* out_xy_array) const { | 246 float* out_xy_array) const { |
247 size_t count_widths = advance_widths_.size(); | 247 size_t count_widths = advance_widths_.size(); |
248 ASSERT(count_widths > 0); | 248 DCHECK_GT(count_widths, 0u); |
249 const FontMetrics& metrics = font->GetFontMetrics(); | 249 const FontMetrics& metrics = font->GetFontMetrics(); |
250 float size_per_unit = font->SizePerUnit(); | 250 float size_per_unit = font->SizePerUnit(); |
251 float ascent = metrics.Ascent(); | 251 float ascent = metrics.Ascent(); |
252 bool use_vorg = HasVORG(); | 252 bool use_vorg = HasVORG(); |
253 size_t count_top_side_bearings = top_side_bearings_.size(); | 253 size_t count_top_side_bearings = top_side_bearings_.size(); |
254 float default_vert_origin_y = std::numeric_limits<float>::quiet_NaN(); | 254 float default_vert_origin_y = std::numeric_limits<float>::quiet_NaN(); |
255 for (float *end = &(out_xy_array[count * 2]); out_xy_array != end; | 255 for (float *end = &(out_xy_array[count * 2]); out_xy_array != end; |
256 ++glyphs, out_xy_array += 2) { | 256 ++glyphs, out_xy_array += 2) { |
257 Glyph glyph = *glyphs; | 257 Glyph glyph = *glyphs; |
258 uint16_t width_f_unit = | 258 uint16_t width_f_unit = |
(...skipping 27 matching lines...) Expand all Loading... |
286 out_xy_array[1] = bounds.Y() - top_side_bearing; | 286 out_xy_array[1] = bounds.Y() - top_side_bearing; |
287 continue; | 287 continue; |
288 } | 288 } |
289 | 289 |
290 // No vertical info in the font file; use ascent as vertical origin. | 290 // No vertical info in the font file; use ascent as vertical origin. |
291 out_xy_array[1] = -ascent; | 291 out_xy_array[1] = -ascent; |
292 } | 292 } |
293 } | 293 } |
294 | 294 |
295 } // namespace blink | 295 } // namespace blink |
OLD | NEW |