Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 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 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 722 } | 722 } |
| 723 #endif | 723 #endif |
| 724 } | 724 } |
| 725 | 725 |
| 726 int SkTypeface_FreeType::onGetUPEM() const { | 726 int SkTypeface_FreeType::onGetUPEM() const { |
| 727 AutoFTAccess fta(this); | 727 AutoFTAccess fta(this); |
| 728 FT_Face face = fta.face(); | 728 FT_Face face = fta.face(); |
| 729 return face ? face->units_per_EM : 0; | 729 return face ? face->units_per_EM : 0; |
| 730 } | 730 } |
| 731 | 731 |
| 732 bool SkTypeface_FreeType::onGetKerningPairAdjustments(const uint16_t glyphs[], | |
| 733 int count, int32_t adjustments[]) const { | |
| 734 AutoFTAccess fta(this); | |
| 735 FT_Face face = fta.face(); | |
|
bungeman-skia
2013/10/29 21:38:41
I think you want a test around FT_HAS_KERNING(face
reed1
2013/10/30 13:59:37
Done.
| |
| 736 | |
| 737 for (int i = 0; i < count - 1; ++i) { | |
| 738 FT_Vector delta; | |
| 739 FT_Error err = FT_Get_Kerning(face, glyphs[i], glyphs[i+1], | |
| 740 FT_KERNING_UNSCALED, &delta); | |
| 741 if (err) { | |
| 742 return false; | |
|
bungeman-skia
2013/10/29 21:38:41
Hey, the documentation implies that adjustments wo
reed1
2013/10/30 13:59:37
Done.
| |
| 743 } | |
| 744 if (adjustments) { | |
| 745 adjustments[i] = delta.x; | |
| 746 } | |
| 747 } | |
| 748 return true; | |
| 749 } | |
| 750 | |
| 732 SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, | 751 SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, |
| 733 const SkDescriptor* desc) | 752 const SkDescriptor* desc) |
| 734 : SkScalerContext_FreeType_Base(typeface, desc) { | 753 : SkScalerContext_FreeType_Base(typeface, desc) { |
| 735 SkAutoMutexAcquire ac(gFTMutex); | 754 SkAutoMutexAcquire ac(gFTMutex); |
| 736 | 755 |
| 737 if (gFTCount == 0) { | 756 if (gFTCount == 0) { |
| 738 if (!InitFreetype()) { | 757 if (!InitFreetype()) { |
| 739 sk_throw(); | 758 sk_throw(); |
| 740 } | 759 } |
| 741 } | 760 } |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1501 *style = (SkTypeface::Style) tempStyle; | 1520 *style = (SkTypeface::Style) tempStyle; |
| 1502 } | 1521 } |
| 1503 if (isFixedPitch) { | 1522 if (isFixedPitch) { |
| 1504 *isFixedPitch = FT_IS_FIXED_WIDTH(face); | 1523 *isFixedPitch = FT_IS_FIXED_WIDTH(face); |
| 1505 } | 1524 } |
| 1506 | 1525 |
| 1507 FT_Done_Face(face); | 1526 FT_Done_Face(face); |
| 1508 FT_Done_FreeType(library); | 1527 FT_Done_FreeType(library); |
| 1509 return true; | 1528 return true; |
| 1510 } | 1529 } |
| OLD | NEW |