OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkTypes.h" // Keep this before any #ifdef ... | 8 #include "SkTypes.h" // Keep this before any #ifdef ... |
9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
10 | 10 |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 | 811 |
812 CTFontRef ctFont = typeface->fFontRef.get(); | 812 CTFontRef ctFont = typeface->fFontRef.get(); |
813 CFIndex numGlyphs = CTFontGetGlyphCount(ctFont); | 813 CFIndex numGlyphs = CTFontGetGlyphCount(ctFont); |
814 SkASSERT(numGlyphs >= 1 && numGlyphs <= 0xFFFF); | 814 SkASSERT(numGlyphs >= 1 && numGlyphs <= 0xFFFF); |
815 fGlyphCount = SkToU16(numGlyphs); | 815 fGlyphCount = SkToU16(numGlyphs); |
816 | 816 |
817 // CT on (at least) 10.9 will size color glyphs down from the requested size
, but not up. | 817 // CT on (at least) 10.9 will size color glyphs down from the requested size
, but not up. |
818 // As a result, it is necessary to know the actual device size and request t
hat. | 818 // As a result, it is necessary to know the actual device size and request t
hat. |
819 SkVector scale; | 819 SkVector scale; |
820 SkMatrix skTransform; | 820 SkMatrix skTransform; |
821 bool invertable = fRec.computeMatrices(SkScalerContextRec::kVertical_PreMatr
ixScale, | 821 bool invertible = fRec.computeMatrices(SkScalerContextRec::kVertical_PreMatr
ixScale, |
822 &scale, &skTransform, nullptr, nullpt
r, &fFUnitMatrix); | 822 &scale, &skTransform, nullptr, nullpt
r, &fFUnitMatrix); |
823 fTransform = MatrixToCGAffineTransform(skTransform); | 823 fTransform = MatrixToCGAffineTransform(skTransform); |
824 // CGAffineTransformInvert documents that if the transform is non-invertible
it will return the | 824 // CGAffineTransformInvert documents that if the transform is non-invertible
it will return the |
825 // passed transform unchanged. It does so, but then also prints a message to
stdout. Avoid this. | 825 // passed transform unchanged. It does so, but then also prints a message to
stdout. Avoid this. |
826 if (invertable) { | 826 if (invertible) { |
827 fInvTransform = CGAffineTransformInvert(fTransform); | 827 fInvTransform = CGAffineTransformInvert(fTransform); |
828 } else { | 828 } else { |
829 fInvTransform = fTransform; | 829 fInvTransform = fTransform; |
830 } | 830 } |
831 | 831 |
832 // The transform contains everything except the requested text size. | 832 // The transform contains everything except the requested text size. |
833 // Some properties, like 'trak', are based on the text size (before applying
the matrix). | 833 // Some properties, like 'trak', are based on the text size (before applying
the matrix). |
834 CGFloat textSize = ScalarToCG(scale.y()); | 834 CGFloat textSize = ScalarToCG(scale.y()); |
835 fCTFont.reset(ctfont_create_exact_copy(ctFont, textSize, nullptr)); | 835 fCTFont.reset(ctfont_create_exact_copy(ctFont, textSize, nullptr)); |
836 fCGFont.reset(CTFontCopyGraphicsFont(fCTFont, nullptr)); | 836 fCGFont.reset(CTFontCopyGraphicsFont(fCTFont, nullptr)); |
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2628 | 2628 |
2629 return SkSafeRef(GetDefaultFace()); | 2629 return SkSafeRef(GetDefaultFace()); |
2630 } | 2630 } |
2631 }; | 2631 }; |
2632 | 2632 |
2633 /////////////////////////////////////////////////////////////////////////////// | 2633 /////////////////////////////////////////////////////////////////////////////// |
2634 | 2634 |
2635 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } | 2635 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } |
2636 | 2636 |
2637 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 2637 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
OLD | NEW |