| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2009 The Android Open Source Project | 3 * Copyright 2009 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkHarfBuzzFont.h" | 10 #include "SkHarfBuzzFont.h" |
| 11 #include "SkFontHost.h" | 11 #include "SkFontHost.h" |
| 12 #include "SkPaint.h" | 12 #include "SkPaint.h" |
| 13 #include "SkPath.h" | 13 #include "SkPath.h" |
| 14 | 14 |
| 15 // HB_Fixed is a 26.6 fixed point format. | 15 // HB_Fixed is a 26.6 fixed point format. |
| 16 static inline HB_Fixed SkScalarToHarfbuzzFixed(SkScalar value) { | 16 static inline HB_Fixed SkScalarToHarfbuzzFixed(SkScalar value) { |
| 17 #ifdef SK_SCALAR_IS_FLOAT | |
| 18 return static_cast<HB_Fixed>(value * 64); | 17 return static_cast<HB_Fixed>(value * 64); |
| 19 #else | |
| 20 // convert .16 to .6 | |
| 21 return value >> (16 - 6); | |
| 22 #endif | |
| 23 } | 18 } |
| 24 | 19 |
| 25 static HB_Bool stringToGlyphs(HB_Font hbFont, const HB_UChar16* characters, | 20 static HB_Bool stringToGlyphs(HB_Font hbFont, const HB_UChar16* characters, |
| 26 hb_uint32 length, HB_Glyph* glyphs, | 21 hb_uint32 length, HB_Glyph* glyphs, |
| 27 hb_uint32* glyphsSize, HB_Bool isRTL) { | 22 hb_uint32* glyphsSize, HB_Bool isRTL) { |
| 28 SkHarfBuzzFont* font = reinterpret_cast<SkHarfBuzzFont*>(hbFont->userData); | 23 SkHarfBuzzFont* font = reinterpret_cast<SkHarfBuzzFont*>(hbFont->userData); |
| 29 SkPaint paint; | 24 SkPaint paint; |
| 30 | 25 |
| 31 paint.setTypeface(font->getTypeface()); | 26 paint.setTypeface(font->getTypeface()); |
| 32 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); | 27 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 return HB_Err_Ok; | 173 return HB_Err_Ok; |
| 179 } | 174 } |
| 180 | 175 |
| 181 if (*len < tableSize) { | 176 if (*len < tableSize) { |
| 182 // is this right, or should we just copy less than the full table? | 177 // is this right, or should we just copy less than the full table? |
| 183 return HB_Err_Invalid_Argument; | 178 return HB_Err_Invalid_Argument; |
| 184 } | 179 } |
| 185 typeface->getTableData(tag, 0, tableSize, buffer); | 180 typeface->getTableData(tag, 0, tableSize, buffer); |
| 186 return HB_Err_Ok; | 181 return HB_Err_Ok; |
| 187 } | 182 } |
| OLD | NEW |