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

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

Issue 1168793003: Remove attempted bug mitigation in Mac typeface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 context.getVerticalOffset(glyphID, &offset); 890 context.getVerticalOffset(glyphID, &offset);
891 subX += offset.fX; 891 subX += offset.fX;
892 subY += offset.fY; 892 subY += offset.fY;
893 } 893 }
894 894
895 CGPoint point = CGPointMake(-glyph.fLeft + subX, glyph.fTop + glyph.fHeight - subY); 895 CGPoint point = CGPointMake(-glyph.fLeft + subX, glyph.fTop + glyph.fHeight - subY);
896 // Prior to 10.10, CTFontDrawGlyphs acted like CGContextShowGlyphsAtPosition s and took 896 // Prior to 10.10, CTFontDrawGlyphs acted like CGContextShowGlyphsAtPosition s and took
897 // 'positions' which are in text space. The glyph location (in device space) must be 897 // 'positions' which are in text space. The glyph location (in device space) must be
898 // mapped into text space, so that CG can convert it back into device space. 898 // mapped into text space, so that CG can convert it back into device space.
899 // In 10.10.1, this is handled directly in CTFontDrawGlyphs. 899 // In 10.10.1, this is handled directly in CTFontDrawGlyphs.
900 900 //
901 // However, in 10.10.2 color glyphs no longer rotate based on the font trans form. 901 // However, in 10.10.2 color glyphs no longer rotate based on the font trans form.
902 // So always make the font transform identity and place the transform on the context. 902 // So always make the font transform identity and place the transform on the context.
903 point = CGPointApplyAffineTransform(point, context.fInvTransform); 903 point = CGPointApplyAffineTransform(point, context.fInvTransform);
904 904
905 // Attempt to keep on the stack a hard reference to the font tables.
906 // This is an experiment to see if this affects crbug.com/413332 .
907 // When 10.6 headers are no longer supported, 'sbix' can be replaced with kC TFontTableSbix.
908 AutoCFRelease<CFDataRef> sbix;
909 if (static_cast<SkTypeface_Mac*>(context.getTypeface())->fHasColorGlyphs) {
910 sbix.reset(CGFontCopyTableForTag(context.fCGFont, 'sbix'));
911 // Attempt to read from the sbix table data to determine if the returned data is valid.
912 const UInt8* sbixData = CFDataGetBytePtr(sbix);
913 CFIndex sbixLength = CFDataGetLength(sbix);
914 if (sbixLength > 0 && *sbixData > 0x80) {
915 // We need to actually do something to avoid this being optimized aw ay.
916 CFRetain(sbix);
917 CFRelease(sbix);
918 }
919 }
920 ctFontDrawGlyphs(context.fCTUnrotatedFont, &glyphID, &point, 1, fCG); 905 ctFontDrawGlyphs(context.fCTUnrotatedFont, &glyphID, &point, 1, fCG);
921 906
922 SkASSERT(rowBytesPtr); 907 SkASSERT(rowBytesPtr);
923 *rowBytesPtr = rowBytes; 908 *rowBytesPtr = rowBytes;
924 return image; 909 return image;
925 } 910 }
926 911
927 void SkScalerContext_Mac::getVerticalOffset(CGGlyph glyphID, SkPoint* offset) co nst { 912 void SkScalerContext_Mac::getVerticalOffset(CGGlyph glyphID, SkPoint* offset) co nst {
928 // Snow Leopard returns cgVertOffset in completely un-transformed FUnits (em space, y up). 913 // Snow Leopard returns cgVertOffset in completely un-transformed FUnits (em space, y up).
929 // Lion and Leopard return cgVertOffset in CG units (pixels, y up). 914 // Lion and Leopard return cgVertOffset in CG units (pixels, y up).
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
2480 } 2465 }
2481 return face; 2466 return face;
2482 } 2467 }
2483 }; 2468 };
2484 2469
2485 /////////////////////////////////////////////////////////////////////////////// 2470 ///////////////////////////////////////////////////////////////////////////////
2486 2471
2487 SkFontMgr* SkFontMgr::Factory() { 2472 SkFontMgr* SkFontMgr::Factory() {
2488 return SkNEW(SkFontMgr_Mac); 2473 return SkNEW(SkFontMgr_Mac);
2489 } 2474 }
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