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 "SkTypes.h" // Keep this before any #ifdef ... | 9 #include "SkTypes.h" // Keep this before any #ifdef ... |
10 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 10 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
(...skipping 1024 matching lines...) Loading... | |
1035 CTFontGetAdvancesForGlyphs(fCTFont, kCTFontVerticalOrientation, | 1035 CTFontGetAdvancesForGlyphs(fCTFont, kCTFontVerticalOrientation, |
1036 &cgGlyph, &cgAdvance, 1); | 1036 &cgGlyph, &cgAdvance, 1); |
1037 // Vertical advances are returned as widths instead of heights. | 1037 // Vertical advances are returned as widths instead of heights. |
1038 SkTSwap(cgAdvance.height, cgAdvance.width); | 1038 SkTSwap(cgAdvance.height, cgAdvance.width); |
1039 cgAdvance.height = -cgAdvance.height; | 1039 cgAdvance.height = -cgAdvance.height; |
1040 } else { | 1040 } else { |
1041 CTFontGetAdvancesForGlyphs(fCTFont, kCTFontHorizontalOrientation, | 1041 CTFontGetAdvancesForGlyphs(fCTFont, kCTFontHorizontalOrientation, |
1042 &cgGlyph, &cgAdvance, 1); | 1042 &cgGlyph, &cgAdvance, 1); |
1043 } | 1043 } |
1044 cgAdvance = CGSizeApplyAffineTransform(cgAdvance, fTransform); | 1044 cgAdvance = CGSizeApplyAffineTransform(cgAdvance, fTransform); |
1045 glyph->fAdvanceX = SkFloatToFixed_Check(cgAdvance.width); | 1045 glyph->fAdvanceX = cgAdvance.width; |
bungeman-skia
2016/03/24 15:58:37
Might want to use something like CGToScalar here,
| |
1046 glyph->fAdvanceY = -SkFloatToFixed_Check(cgAdvance.height); | 1046 glyph->fAdvanceY = -cgAdvance.height; |
1047 | 1047 |
1048 // The following produces skBounds in SkGlyph units (pixels, y down), | 1048 // The following produces skBounds in SkGlyph units (pixels, y down), |
1049 // or returns early if skBounds would be empty. | 1049 // or returns early if skBounds would be empty. |
1050 SkRect skBounds; | 1050 SkRect skBounds; |
1051 | 1051 |
1052 // On Mountain Lion, CTFontGetBoundingRectsForGlyphs with kCTFontVerticalOri entation and | 1052 // On Mountain Lion, CTFontGetBoundingRectsForGlyphs with kCTFontVerticalOri entation and |
1053 // CTFontGetVerticalTranslationsForGlyphs do not agree when using OTF CFF fo nts. | 1053 // CTFontGetVerticalTranslationsForGlyphs do not agree when using OTF CFF fo nts. |
1054 // For TTF fonts these two do agree and we can use CTFontGetBoundingRectsFor Glyphs to get | 1054 // For TTF fonts these two do agree and we can use CTFontGetBoundingRectsFor Glyphs to get |
1055 // the bounding box and CTFontGetVerticalTranslationsForGlyphs to then draw the glyph | 1055 // the bounding box and CTFontGetVerticalTranslationsForGlyphs to then draw the glyph |
1056 // inside that bounding box. However, with OTF CFF fonts this does not work. It appears that | 1056 // inside that bounding box. However, with OTF CFF fonts this does not work. It appears that |
(...skipping 1567 matching lines...) Loading... | |
2624 } | 2624 } |
2625 return face; | 2625 return face; |
2626 } | 2626 } |
2627 }; | 2627 }; |
2628 | 2628 |
2629 /////////////////////////////////////////////////////////////////////////////// | 2629 /////////////////////////////////////////////////////////////////////////////// |
2630 | 2630 |
2631 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } | 2631 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } |
2632 | 2632 |
2633 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 2633 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
OLD | NEW |