Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: src/ports/SkFontHost_mac.cpp

Issue 1360663002: Use only one CGFont/CTFont per scaler context on Mac. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make 10.6 work-around easier to remove in the future. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 bool generateBBoxes(); 677 bool generateBBoxes();
678 678
679 /** Converts from FUnits (em space, y up) to SkGlyph units (pixels, y down). 679 /** Converts from FUnits (em space, y up) to SkGlyph units (pixels, y down).
680 * 680 *
681 * Used on Snow Leopard to correct CTFontGetVerticalTranslationsForGlyphs. 681 * Used on Snow Leopard to correct CTFontGetVerticalTranslationsForGlyphs.
682 * Used on Lion to correct CTFontGetBoundingRectsForGlyphs. 682 * Used on Lion to correct CTFontGetBoundingRectsForGlyphs.
683 */ 683 */
684 SkMatrix fFUnitMatrix; 684 SkMatrix fFUnitMatrix;
685 685
686 Offscreen fOffscreen; 686 Offscreen fOffscreen;
687 AutoCFRelease<CTFontRef> fCTFont;
688 CGAffineTransform fTransform;
689 CGAffineTransform fInvTransform;
690 687
691 /** Unrotated variant of fCTFont. 688 /** Unrotated variant of fCTFont.
692 * 689 *
693 * In 10.10.1 CTFontGetAdvancesForGlyphs applies the font transform to the width of the 690 * In 10.10.1 CTFontGetAdvancesForGlyphs applies the font transform to the width of the
694 * advances, but always sets the height to 0. This font is used to get the advances of the 691 * advances, but always sets the height to 0. This font is used to get the advances of the
695 * unrotated glyph, and then the rotation is applied separately. 692 * unrotated glyph, and then the rotation is applied separately.
696 * 693 *
697 * CT vertical metrics are pre-rotated (in em space, before transform) 90de g clock-wise. 694 * CT vertical metrics are pre-rotated (in em space, before transform) 90de g clock-wise.
698 * This makes kCTFontDefaultOrientation dangerous, because the metrics from 695 * This makes kCTFontDefaultOrientation dangerous, because the metrics from
699 * kCTFontHorizontalOrientation are in a different space from kCTFontVertic alOrientation. 696 * kCTFontHorizontalOrientation are in a different space from kCTFontVertic alOrientation.
700 * With kCTFontVerticalOrientation the advances must be unrotated. 697 * With kCTFontVerticalOrientation the advances must be unrotated.
698 *
699 * Sometimes, creating a copy of a CTFont with the same size but different trasform will select
700 * different underlying font data. As a result, avoid ever creating more th an one CTFont per
701 * SkScalerContext to ensure that only one CTFont is used.
702 *
703 * As a result of the above (and other constraints) this font contains the size, but not the
704 * transform. The transform must always be applied separately.
701 */ 705 */
702 AutoCFRelease<CTFontRef> fCTUnrotatedFont; 706 AutoCFRelease<CTFontRef> fCTFont;
707
708 /** The transform without the font size. */
709 CGAffineTransform fTransform;
710 CGAffineTransform fInvTransform;
703 711
704 AutoCFRelease<CGFontRef> fCGFont; 712 AutoCFRelease<CGFontRef> fCGFont;
705 SkAutoTMalloc<GlyphRect> fFBoundingBoxes; 713 SkAutoTMalloc<GlyphRect> fFBoundingBoxes;
706 uint16_t fFBoundingBoxesGlyphOffset; 714 uint16_t fFBoundingBoxesGlyphOffset;
707 uint16_t fGlyphCount; 715 uint16_t fGlyphCount;
708 bool fGeneratedFBoundingBoxes; 716 bool fGeneratedFBoundingBoxes;
709 const bool fDoSubPosition; 717 const bool fDoSubPosition;
710 const bool fVertical; 718 const bool fVertical;
711 719
712 friend class Offscreen; 720 friend class Offscreen;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 SkVector scale; 765 SkVector scale;
758 SkMatrix skTransform; 766 SkMatrix skTransform;
759 fRec.computeMatrices(SkScalerContextRec::kVertical_PreMatrixScale, &scale, & skTransform, 767 fRec.computeMatrices(SkScalerContextRec::kVertical_PreMatrixScale, &scale, & skTransform,
760 nullptr, nullptr, &fFUnitMatrix); 768 nullptr, nullptr, &fFUnitMatrix);
761 fTransform = MatrixToCGAffineTransform(skTransform); 769 fTransform = MatrixToCGAffineTransform(skTransform);
762 fInvTransform = CGAffineTransformInvert(fTransform); 770 fInvTransform = CGAffineTransformInvert(fTransform);
763 771
764 // The transform contains everything except the requested text size. 772 // The transform contains everything except the requested text size.
765 // Some properties, like 'trak', are based on the text size (before applying the matrix). 773 // Some properties, like 'trak', are based on the text size (before applying the matrix).
766 CGFloat textSize = ScalarToCG(scale.y()); 774 CGFloat textSize = ScalarToCG(scale.y());
767 775 fCTFont.reset(ctfont_create_exact_copy(ctFont, textSize, nullptr));
768 fCTFont.reset(ctfont_create_exact_copy(ctFont, textSize, &fTransform));
769 fCGFont.reset(CTFontCopyGraphicsFont(fCTFont, nullptr)); 776 fCGFont.reset(CTFontCopyGraphicsFont(fCTFont, nullptr));
770 fCTUnrotatedFont.reset(ctfont_create_exact_copy(ctFont, textSize, nullptr));
771 777
772 // The fUnitMatrix includes the text size (and em) as it is used to scale th e raw font data. 778 // The fUnitMatrix includes the text size (and em) as it is used to scale th e raw font data.
773 SkScalar emPerFUnit = SkScalarInvert(SkIntToScalar(CGFontGetUnitsPerEm(fCGFo nt))); 779 SkScalar emPerFUnit = SkScalarInvert(SkIntToScalar(CGFontGetUnitsPerEm(fCGFo nt)));
774 fFUnitMatrix.preScale(emPerFUnit, -emPerFUnit); 780 fFUnitMatrix.preScale(emPerFUnit, -emPerFUnit);
775 } 781 }
776 782
777 /** This is an implementation of CTFontDrawGlyphs for 10.6; it was introduced in 10.7. */ 783 /** This is an implementation of CTFontDrawGlyphs for 10.6; it was introduced in 10.7. */
778 static void legacy_CTFontDrawGlyphs(CTFontRef, const CGGlyph glyphs[], const CGP oint points[], 784 static void legacy_CTFontDrawGlyphs(CTFontRef, const CGGlyph glyphs[], const CGP oint points[],
779 size_t count, CGContextRef cg) { 785 size_t count, CGContextRef cg) {
780 CGContextShowGlyphsAtPositions(cg, glyphs, points, count); 786 CGContextShowGlyphsAtPositions(cg, glyphs, points, count);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 CGPoint point = CGPointMake(-glyph.fLeft + subX, glyph.fTop + glyph.fHeight - subY); 913 CGPoint point = CGPointMake(-glyph.fLeft + subX, glyph.fTop + glyph.fHeight - subY);
908 // Prior to 10.10, CTFontDrawGlyphs acted like CGContextShowGlyphsAtPosition s and took 914 // Prior to 10.10, CTFontDrawGlyphs acted like CGContextShowGlyphsAtPosition s and took
909 // 'positions' which are in text space. The glyph location (in device space) must be 915 // 'positions' which are in text space. The glyph location (in device space) must be
910 // mapped into text space, so that CG can convert it back into device space. 916 // mapped into text space, so that CG can convert it back into device space.
911 // In 10.10.1, this is handled directly in CTFontDrawGlyphs. 917 // In 10.10.1, this is handled directly in CTFontDrawGlyphs.
912 // 918 //
913 // However, in 10.10.2 color glyphs no longer rotate based on the font trans form. 919 // However, in 10.10.2 color glyphs no longer rotate based on the font trans form.
914 // So always make the font transform identity and place the transform on the context. 920 // So always make the font transform identity and place the transform on the context.
915 point = CGPointApplyAffineTransform(point, context.fInvTransform); 921 point = CGPointApplyAffineTransform(point, context.fInvTransform);
916 922
917 ctFontDrawGlyphs(context.fCTUnrotatedFont, &glyphID, &point, 1, fCG); 923 ctFontDrawGlyphs(context.fCTFont, &glyphID, &point, 1, fCG);
918 924
919 SkASSERT(rowBytesPtr); 925 SkASSERT(rowBytesPtr);
920 *rowBytesPtr = rowBytes; 926 *rowBytesPtr = rowBytes;
921 return image; 927 return image;
922 } 928 }
923 929
924 void SkScalerContext_Mac::getVerticalOffset(CGGlyph glyphID, SkPoint* offset) co nst { 930 void SkScalerContext_Mac::getVerticalOffset(CGGlyph glyphID, SkPoint* offset) co nst {
925 // Snow Leopard returns cgVertOffset in completely un-transformed FUnits (em space, y up). 931 // Snow Leopard returns cgVertOffset in completely un-transformed FUnits (em space, y up).
926 // Lion and Leopard return cgVertOffset in CG units (pixels, y up). 932 // Lion and Leopard return cgVertOffset in CG units (pixels, y up).
927 CGSize cgVertOffset; 933 CGSize cgVertOffset;
928 CTFontGetVerticalTranslationsForGlyphs(fCTFont, &glyphID, &cgVertOffset, 1); 934 CTFontGetVerticalTranslationsForGlyphs(fCTFont, &glyphID, &cgVertOffset, 1);
929
930 SkPoint skVertOffset = { CGToScalar(cgVertOffset.width), CGToScalar(cgVertOf fset.height) };
931 if (isSnowLeopard()) { 935 if (isSnowLeopard()) {
936 SkPoint skVertOffset = { CGToScalar(cgVertOffset.width), CGToScalar(cgVe rtOffset.height) };
937 skVertOffset = { CGToScalar(cgVertOffset.width), CGToScalar(cgVertOffset .height) };
reed1 2015/10/29 15:44:23 are these two lines the same?
bungeman-skia 2015/10/29 15:52:13 Done.
932 // From FUnits (em space, y up) to SkGlyph units (pixels, y down). 938 // From FUnits (em space, y up) to SkGlyph units (pixels, y down).
933 fFUnitMatrix.mapPoints(&skVertOffset, 1); 939 fFUnitMatrix.mapPoints(&skVertOffset, 1);
934 } else { 940 *offset = skVertOffset;
935 // From CG units (pixels, y up) to SkGlyph units (pixels, y down). 941 return;
936 skVertOffset.fY = -skVertOffset.fY;
937 } 942 }
938 943 cgVertOffset = CGSizeApplyAffineTransform(cgVertOffset, fTransform);
944 SkPoint skVertOffset = { CGToScalar(cgVertOffset.width), CGToScalar(cgVertOf fset.height) };
945 // From CG units (pixels, y up) to SkGlyph units (pixels, y down).
946 skVertOffset.fY = -skVertOffset.fY;
939 *offset = skVertOffset; 947 *offset = skVertOffset;
940 } 948 }
941 949
942 uint16_t SkScalerContext_Mac::getFBoundingBoxesGlyphOffset() { 950 uint16_t SkScalerContext_Mac::getFBoundingBoxesGlyphOffset() {
943 if (fFBoundingBoxesGlyphOffset) { 951 if (fFBoundingBoxesGlyphOffset) {
944 return fFBoundingBoxesGlyphOffset; 952 return fFBoundingBoxesGlyphOffset;
945 } 953 }
946 fFBoundingBoxesGlyphOffset = fGlyphCount; // fallback for all fonts 954 fFBoundingBoxesGlyphOffset = fGlyphCount; // fallback for all fonts
947 AutoCGTable<SkOTTableHorizontalHeader> hheaTable(fCGFont); 955 AutoCGTable<SkOTTableHorizontalHeader> hheaTable(fCGFont);
948 if (hheaTable.fData) { 956 if (hheaTable.fData) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 1025
1018 void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) { 1026 void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
1019 AUTO_CG_LOCK(); 1027 AUTO_CG_LOCK();
1020 1028
1021 const CGGlyph cgGlyph = (CGGlyph) glyph->getGlyphID(); 1029 const CGGlyph cgGlyph = (CGGlyph) glyph->getGlyphID();
1022 glyph->zeroMetrics(); 1030 glyph->zeroMetrics();
1023 1031
1024 // The following block produces cgAdvance in CG units (pixels, y up). 1032 // The following block produces cgAdvance in CG units (pixels, y up).
1025 CGSize cgAdvance; 1033 CGSize cgAdvance;
1026 if (fVertical) { 1034 if (fVertical) {
1027 CTFontGetAdvancesForGlyphs(fCTUnrotatedFont, kCTFontVerticalOrientation, 1035 CTFontGetAdvancesForGlyphs(fCTFont, kCTFontVerticalOrientation,
1028 &cgGlyph, &cgAdvance, 1); 1036 &cgGlyph, &cgAdvance, 1);
1029 // Vertical advances are returned as widths instead of heights. 1037 // Vertical advances are returned as widths instead of heights.
1030 SkTSwap(cgAdvance.height, cgAdvance.width); 1038 SkTSwap(cgAdvance.height, cgAdvance.width);
1031 cgAdvance.height = -cgAdvance.height; 1039 cgAdvance.height = -cgAdvance.height;
1032 } else { 1040 } else {
1033 CTFontGetAdvancesForGlyphs(fCTUnrotatedFont, kCTFontHorizontalOrientatio n, 1041 CTFontGetAdvancesForGlyphs(fCTFont, kCTFontHorizontalOrientation,
1034 &cgGlyph, &cgAdvance, 1); 1042 &cgGlyph, &cgAdvance, 1);
1035 } 1043 }
1036 cgAdvance = CGSizeApplyAffineTransform(cgAdvance, CTFontGetMatrix(fCTFont)); 1044 cgAdvance = CGSizeApplyAffineTransform(cgAdvance, fTransform);
1037 glyph->fAdvanceX = SkFloatToFixed_Check(cgAdvance.width); 1045 glyph->fAdvanceX = SkFloatToFixed_Check(cgAdvance.width);
1038 glyph->fAdvanceY = -SkFloatToFixed_Check(cgAdvance.height); 1046 glyph->fAdvanceY = -SkFloatToFixed_Check(cgAdvance.height);
1039 1047
1040 // The following produces skBounds in SkGlyph units (pixels, y down), 1048 // The following produces skBounds in SkGlyph units (pixels, y down),
1041 // or returns early if skBounds would be empty. 1049 // or returns early if skBounds would be empty.
1042 SkRect skBounds; 1050 SkRect skBounds;
1043 1051
1044 // On Mountain Lion, CTFontGetBoundingRectsForGlyphs with kCTFontVerticalOri entation and 1052 // On Mountain Lion, CTFontGetBoundingRectsForGlyphs with kCTFontVerticalOri entation and
1045 // CTFontGetVerticalTranslationsForGlyphs do not agree when using OTF CFF fo nts. 1053 // CTFontGetVerticalTranslationsForGlyphs do not agree when using OTF CFF fo nts.
1046 // 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
(...skipping 24 matching lines...) Expand all
1071 } 1079 }
1072 skBounds = SkRect::MakeLTRB(gRect.fMinX, gRect.fMinY, gRect.fMaxX, gRect .fMaxY); 1080 skBounds = SkRect::MakeLTRB(gRect.fMinX, gRect.fMinY, gRect.fMaxX, gRect .fMaxY);
1073 // From FUnits (em space, y up) to SkGlyph units (pixels, y down). 1081 // From FUnits (em space, y up) to SkGlyph units (pixels, y down).
1074 fFUnitMatrix.mapRect(&skBounds); 1082 fFUnitMatrix.mapRect(&skBounds);
1075 1083
1076 } else { 1084 } else {
1077 // CTFontGetBoundingRectsForGlyphs produces cgBounds in CG units (pixels , y up). 1085 // CTFontGetBoundingRectsForGlyphs produces cgBounds in CG units (pixels , y up).
1078 CGRect cgBounds; 1086 CGRect cgBounds;
1079 CTFontGetBoundingRectsForGlyphs(fCTFont, kCTFontHorizontalOrientation, 1087 CTFontGetBoundingRectsForGlyphs(fCTFont, kCTFontHorizontalOrientation,
1080 &cgGlyph, &cgBounds, 1); 1088 &cgGlyph, &cgBounds, 1);
1089 cgBounds = CGRectApplyAffineTransform(cgBounds, fTransform);
1081 1090
1082 // BUG? 1091 // BUG?
1083 // 0x200B (zero-advance space) seems to return a huge (garbage) bounds, when 1092 // 0x200B (zero-advance space) seems to return a huge (garbage) bounds, when
1084 // it should be empty. So, if we see a zero-advance, we check if it has an 1093 // it should be empty. So, if we see a zero-advance, we check if it has an
1085 // empty path or not, and if so, we jam the bounds to 0. Hopefully a zer o-advance 1094 // empty path or not, and if so, we jam the bounds to 0. Hopefully a zer o-advance
1086 // is rare, so we won't incur a big performance cost for this extra chec k. 1095 // is rare, so we won't incur a big performance cost for this extra chec k.
1087 if (0 == cgAdvance.width && 0 == cgAdvance.height) { 1096 if (0 == cgAdvance.width && 0 == cgAdvance.height) {
1088 AutoCFRelease<CGPathRef> path(CTFontCreatePathForGlyph(fCTFont, cgGl yph, nullptr)); 1097 AutoCFRelease<CGPathRef> path(CTFontCreatePathForGlyph(fCTFont, cgGl yph, nullptr));
1089 if (nullptr == path || CGPathIsEmpty(path)) { 1098 if (nullptr == path || CGPathIsEmpty(path)) {
1090 return; 1099 return;
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 /* 1338 /*
1330 * Our subpixel resolution is only 2 bits in each direction, so a scale of 4 1339 * Our subpixel resolution is only 2 bits in each direction, so a scale of 4
1331 * seems sufficient, and possibly even correct, to allow the hinted outline 1340 * seems sufficient, and possibly even correct, to allow the hinted outline
1332 * to be subpixel positioned. 1341 * to be subpixel positioned.
1333 */ 1342 */
1334 #define kScaleForSubPixelPositionHinting (4.0f) 1343 #define kScaleForSubPixelPositionHinting (4.0f)
1335 1344
1336 void SkScalerContext_Mac::generatePath(const SkGlyph& glyph, SkPath* path) { 1345 void SkScalerContext_Mac::generatePath(const SkGlyph& glyph, SkPath* path) {
1337 AUTO_CG_LOCK(); 1346 AUTO_CG_LOCK();
1338 1347
1339 CTFontRef font = fCTFont;
1340 SkScalar scaleX = SK_Scalar1; 1348 SkScalar scaleX = SK_Scalar1;
1341 SkScalar scaleY = SK_Scalar1; 1349 SkScalar scaleY = SK_Scalar1;
1342 1350
1351 CGAffineTransform xform = fTransform;
1343 /* 1352 /*
1344 * For subpixel positioning, we want to return an unhinted outline, so it 1353 * For subpixel positioning, we want to return an unhinted outline, so it
1345 * can be positioned nicely at fractional offsets. However, we special-case 1354 * can be positioned nicely at fractional offsets. However, we special-case
1346 * if the baseline of the (horizontal) text is axis-aligned. In those cases 1355 * if the baseline of the (horizontal) text is axis-aligned. In those cases
1347 * we want to retain hinting in the direction orthogonal to the baseline. 1356 * we want to retain hinting in the direction orthogonal to the baseline.
1348 * e.g. for horizontal baseline, we want to retain hinting in Y. 1357 * e.g. for horizontal baseline, we want to retain hinting in Y.
1349 * The way we remove hinting is to scale the font by some value (4) in that 1358 * The way we remove hinting is to scale the font by some value (4) in that
1350 * direction, ask for the path, and then scale the path back down. 1359 * direction, ask for the path, and then scale the path back down.
1351 */ 1360 */
1352 if (fDoSubPosition) { 1361 if (fDoSubPosition) {
1353 SkMatrix m; 1362 SkMatrix m;
1354 fRec.getSingleMatrix(&m); 1363 fRec.getSingleMatrix(&m);
1355 1364
1356 // start out by assuming that we want no hining in X and Y 1365 // start out by assuming that we want no hining in X and Y
1357 scaleX = scaleY = kScaleForSubPixelPositionHinting; 1366 scaleX = scaleY = kScaleForSubPixelPositionHinting;
1358 // now see if we need to restore hinting for axis-aligned baselines 1367 // now see if we need to restore hinting for axis-aligned baselines
1359 switch (SkComputeAxisAlignmentForHText(m)) { 1368 switch (SkComputeAxisAlignmentForHText(m)) {
1360 case kX_SkAxisAlignment: 1369 case kX_SkAxisAlignment:
1361 scaleY = SK_Scalar1; // want hinting in the Y direction 1370 scaleY = SK_Scalar1; // want hinting in the Y direction
1362 break; 1371 break;
1363 case kY_SkAxisAlignment: 1372 case kY_SkAxisAlignment:
1364 scaleX = SK_Scalar1; // want hinting in the X direction 1373 scaleX = SK_Scalar1; // want hinting in the X direction
1365 break; 1374 break;
1366 default: 1375 default:
1367 break; 1376 break;
1368 } 1377 }
1369 1378
1370 CGAffineTransform xform = MatrixToCGAffineTransform(m, scaleX, scaleY); 1379 CGAffineTransform scale(CGAffineTransformMakeScale(ScalarToCG(scaleX), S calarToCG(scaleY)));
mtklein 2015/10/05 21:58:12 I feel like this diff is confusing, but I'm not su
1371 font = ctfont_create_exact_copy(fCTFont, 1, &xform); 1380 xform = CGAffineTransformConcat(fTransform, scale);
1372 } 1381 }
1373 1382
1374 CGGlyph cgGlyph = (CGGlyph)glyph.getGlyphID(); 1383 CGGlyph cgGlyph = (CGGlyph)glyph.getGlyphID();
1375 AutoCFRelease<CGPathRef> cgPath(CTFontCreatePathForGlyph(font, cgGlyph, null ptr)); 1384 AutoCFRelease<CGPathRef> cgPath(CTFontCreatePathForGlyph(fCTFont, cgGlyph, & xform));
1376 1385
1377 path->reset(); 1386 path->reset();
1378 if (cgPath != nullptr) { 1387 if (cgPath != nullptr) {
1379 CGPathApply(cgPath, path, SkScalerContext_Mac::CTPathElement); 1388 CGPathApply(cgPath, path, SkScalerContext_Mac::CTPathElement);
1380 } 1389 }
1381 1390
1382 if (fDoSubPosition) { 1391 if (fDoSubPosition) {
1383 SkMatrix m; 1392 SkMatrix m;
1384 m.setScale(SkScalarInvert(scaleX), SkScalarInvert(scaleY)); 1393 m.setScale(SkScalarInvert(scaleX), SkScalarInvert(scaleY));
1385 path->transform(m); 1394 path->transform(m);
1386 // balance the call to ctfont_create_exact_copy
1387 CFSafeRelease(font);
1388 } 1395 }
1389 if (fVertical) { 1396 if (fVertical) {
1390 SkPoint offset; 1397 SkPoint offset;
1391 getVerticalOffset(cgGlyph, &offset); 1398 getVerticalOffset(cgGlyph, &offset);
1392 path->offset(offset.fX, offset.fY); 1399 path->offset(offset.fX, offset.fY);
1393 } 1400 }
1394 } 1401 }
1395 1402
1396 void SkScalerContext_Mac::generateFontMetrics(SkPaint::FontMetrics* metrics) { 1403 void SkScalerContext_Mac::generateFontMetrics(SkPaint::FontMetrics* metrics) {
1397 if (nullptr == metrics) { 1404 if (nullptr == metrics) {
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
2478 face->ref(); 2485 face->ref();
2479 } 2486 }
2480 } 2487 }
2481 return face; 2488 return face;
2482 } 2489 }
2483 }; 2490 };
2484 2491
2485 /////////////////////////////////////////////////////////////////////////////// 2492 ///////////////////////////////////////////////////////////////////////////////
2486 2493
2487 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } 2494 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698