aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-03-10 04:02:30 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-03-10 04:02:30 +0000
commit590ef3fd3a39ff1aa08746e323da41cbd2928f49 (patch)
tree9a80ce6ba1cd98aec88fa48780a064020a3bcf6b /src/ports
parent330578d67d466f97c47aecdbdda9d69aa2aa7569 (diff)
remember to specify the bloody font tag in the constructor!
git-svn-id: http://skia.googlecode.com/svn/trunk@118 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/ports')
-rwxr-xr-xsrc/ports/SkFontHost_mac.cpp35
1 files changed, 28 insertions, 7 deletions
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 56f52f7b71..6b8f9a3b2e 100755
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -124,11 +124,32 @@ SkScalerContext_Mac::SkScalerContext_Mac(const SkDescriptor* desc)
SkScalarToFloat(m[SkMatrix::kMTransX]),
SkScalarToFloat(m[SkMatrix::kMTransY]));
-
- Fixed fixedSize = SK_Fixed1; //SkScalarToFixed(fRec.fTextSize);
- static const ATSUAttributeTag tags[] = { kATSUSizeTag, kATSUFontMatrixTag };
- static const ByteCount sizes[] = { sizeof(Fixed), sizeof(fTransform) };
- const ATSUAttributeValuePtr values[] = { &fixedSize, &fTransform };
+ ATSStyleRenderingOptions renderOpts = kATSStyleApplyAntiAliasing;
+ switch (fRec.fHints) {
+ case kNo_Hints:
+ renderOpts |= kATSStyleNoHinting;
+ break;
+ case kSubpixel_Hints:
+ // hmmm, need to support subpixel... from path?
+ renderOpts |= kATSStyleNoHinting;
+ break;
+ case kNormal_Hints:
+ renderOpts |= kATSStyleApplyHints;
+ break;
+ }
+
+ ATSUFontID fontID = FMGetFontFromATSFontRef(fRec.fFontID);
+ // we put everything in the matrix, so our pt size is just 1.0
+ Fixed fixedSize = SK_Fixed1;
+ static const ATSUAttributeTag tags[] = {
+ kATSUFontTag, kATSUSizeTag, kATSUFontMatrixTag, kATSUStyleRenderingOptionsTag
+ };
+ static const ByteCount sizes[] = {
+ sizeof(fontID), sizeof(fixedSize), sizeof(fTransform), sizeof(renderOpts)
+ };
+ const ATSUAttributeValuePtr values[] = {
+ &fontID, &fixedSize, &fTransform, &renderOpts
+ };
err = ::ATSUSetAttributes(fStyle, SK_ARRAY_COUNT(tags),
tags, sizes, values);
SkASSERT(0 == err);
@@ -199,7 +220,7 @@ void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
set_glyph_metrics_on_error(glyph);
return;
}
-
+
if (kNormal_Hints == fRec.fHints) {
glyph->fAdvanceX = SkFloatToFixed(screenMetrics.deviceAdvance.x);
glyph->fAdvanceY = -SkFloatToFixed(screenMetrics.deviceAdvance.y);
@@ -234,7 +255,7 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph)
::CGContextSetGrayFillColor(contextRef, 1.0, 1.0);
::CGContextSetTextDrawingMode(contextRef, kCGTextFill);
- CGGlyph glyphID = glyph.getGlyphID();
+ CGGlyph glyphID = glyph.getGlyphID(fBaseGlyphCount);
CGFontRef fontRef = CGFontCreateWithPlatformFont(&fRec.fFontID);
CGContextSetFont(contextRef, fontRef);
CGContextSetFontSize(contextRef, 1);