| 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 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 FT_Set_Transform( fFace, &fMatrix22, NULL); | 954 FT_Set_Transform( fFace, &fMatrix22, NULL); |
| 955 } | 955 } |
| 956 return err; | 956 return err; |
| 957 } | 957 } |
| 958 | 958 |
| 959 unsigned SkScalerContext_FreeType::generateGlyphCount() { | 959 unsigned SkScalerContext_FreeType::generateGlyphCount() { |
| 960 return fFace->num_glyphs; | 960 return fFace->num_glyphs; |
| 961 } | 961 } |
| 962 | 962 |
| 963 uint16_t SkScalerContext_FreeType::generateCharToGlyph(SkUnichar uni) { | 963 uint16_t SkScalerContext_FreeType::generateCharToGlyph(SkUnichar uni) { |
| 964 SkAutoMutexAcquire ac(gFTMutex); |
| 964 return SkToU16(FT_Get_Char_Index( fFace, uni )); | 965 return SkToU16(FT_Get_Char_Index( fFace, uni )); |
| 965 } | 966 } |
| 966 | 967 |
| 967 SkUnichar SkScalerContext_FreeType::generateGlyphToChar(uint16_t glyph) { | 968 SkUnichar SkScalerContext_FreeType::generateGlyphToChar(uint16_t glyph) { |
| 969 SkAutoMutexAcquire ac(gFTMutex); |
| 968 // iterate through each cmap entry, looking for matching glyph indices | 970 // iterate through each cmap entry, looking for matching glyph indices |
| 969 FT_UInt glyphIndex; | 971 FT_UInt glyphIndex; |
| 970 SkUnichar charCode = FT_Get_First_Char( fFace, &glyphIndex ); | 972 SkUnichar charCode = FT_Get_First_Char( fFace, &glyphIndex ); |
| 971 | 973 |
| 972 while (glyphIndex != 0) { | 974 while (glyphIndex != 0) { |
| 973 if (glyphIndex == glyph) { | 975 if (glyphIndex == glyph) { |
| 974 return charCode; | 976 return charCode; |
| 975 } | 977 } |
| 976 charCode = FT_Get_Next_Char( fFace, charCode, &glyphIndex ); | 978 charCode = FT_Get_Next_Char( fFace, charCode, &glyphIndex ); |
| 977 } | 979 } |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1523 *style = (SkTypeface::Style) tempStyle; | 1525 *style = (SkTypeface::Style) tempStyle; |
| 1524 } | 1526 } |
| 1525 if (isFixedPitch) { | 1527 if (isFixedPitch) { |
| 1526 *isFixedPitch = FT_IS_FIXED_WIDTH(face); | 1528 *isFixedPitch = FT_IS_FIXED_WIDTH(face); |
| 1527 } | 1529 } |
| 1528 | 1530 |
| 1529 FT_Done_Face(face); | 1531 FT_Done_Face(face); |
| 1530 FT_Done_FreeType(library); | 1532 FT_Done_FreeType(library); |
| 1531 return true; | 1533 return true; |
| 1532 } | 1534 } |
| OLD | NEW |