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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 #ifndef SK_GAMMA_APPLY_TO_A8 | 687 #ifndef SK_GAMMA_APPLY_TO_A8 |
688 if (!isLCD(*rec)) { | 688 if (!isLCD(*rec)) { |
689 rec->ignorePreBlend(); | 689 rec->ignorePreBlend(); |
690 } | 690 } |
691 #endif | 691 #endif |
692 } | 692 } |
693 | 693 |
694 #ifdef SK_BUILD_FOR_ANDROID | 694 #ifdef SK_BUILD_FOR_ANDROID |
695 uint32_t SkFontHost::GetUnitsPerEm(SkFontID fontID) { | 695 uint32_t SkFontHost::GetUnitsPerEm(SkFontID fontID) { |
696 SkAutoMutexAcquire ac(gFTMutex); | 696 SkAutoMutexAcquire ac(gFTMutex); |
| 697 FT_Library libInit = NULL; |
| 698 if (gFTCount == 0) { |
| 699 if (!InitFreetype()) |
| 700 sk_throw(); |
| 701 libInit = gFTLibrary; |
| 702 } |
| 703 SkAutoTCallIProc<struct FT_LibraryRec_, FT_Done_FreeType> ftLib(libInit); |
697 SkFaceRec *rec = ref_ft_face(fontID); | 704 SkFaceRec *rec = ref_ft_face(fontID); |
698 uint16_t unitsPerEm = 0; | 705 uint16_t unitsPerEm = 0; |
699 | 706 |
700 if (rec != NULL && rec->fFace != NULL) { | 707 if (rec != NULL && rec->fFace != NULL) { |
701 unitsPerEm = rec->fFace->units_per_EM; | 708 unitsPerEm = rec->fFace->units_per_EM; |
702 unref_ft_face(rec->fFace); | 709 unref_ft_face(rec->fFace); |
703 } | 710 } |
704 | 711 |
705 return (uint32_t)unitsPerEm; | 712 return (uint32_t)unitsPerEm; |
706 } | 713 } |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 *style = (SkTypeface::Style) tempStyle; | 1366 *style = (SkTypeface::Style) tempStyle; |
1360 } | 1367 } |
1361 if (isFixedWidth) { | 1368 if (isFixedWidth) { |
1362 *isFixedWidth = FT_IS_FIXED_WIDTH(face); | 1369 *isFixedWidth = FT_IS_FIXED_WIDTH(face); |
1363 } | 1370 } |
1364 | 1371 |
1365 FT_Done_Face(face); | 1372 FT_Done_Face(face); |
1366 FT_Done_FreeType(library); | 1373 FT_Done_FreeType(library); |
1367 return true; | 1374 return true; |
1368 } | 1375 } |
OLD | NEW |