FontMgrMatchGM() : fFM(SkFontMgr::RefDefault()) {
SkGraphics::SetFontCacheLimit(16 * 1024 * 1024);
}
-
+
protected:
virtual SkString onShortName() {
return SkString("fontmgr_match");
}
-
+
virtual SkISize onISize() {
return SkISize::Make(640, 1024);
}
}
}
}
-
+
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
SkPaint paint;
paint.setAntiAlias(true);
};
SkFontStyleSet* fset = NULL;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); ++i) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); ++i) {
fset = fFM->matchFamily(gNames[i]);
if (fset && fset->count() > 0) {
break;
}
}
-
+
if (NULL == fset) {
return;
}
canvas->translate(150, 0);
this->iterateFamily(canvas, paint, fset);
}
-
+
virtual uint32_t onGetFlags() const SK_OVERRIDE {
// fontdescriptors (and therefore serialization) don't yet understand
// these new styles, so skip tests that exercise that for now.
return kSkipPicture_Flag | kSkipPipe_Flag;
}
-
+
private:
typedef GM INHERITED;
};
}
};
-Offscreen::Offscreen() : fRGBSpace(NULL), fCG(NULL),
+Offscreen::Offscreen() : fRGBSpace(NULL), fCG(NULL),
fDoAA(false), fDoLCD(false) {
fSize.set(0, 0);
}
CTFontDescriptorRef findMatchingDesc(const SkFontStyle& pattern) const {
int bestMetric = SK_MaxS32;
CTFontDescriptorRef bestDesc = NULL;
-
+
for (int i = 0; i < fCount; ++i) {
CTFontDescriptorRef desc = (CTFontDescriptorRef)CFArrayGetValueAtIndex(fArray, i);
int metric = compute_metric(pattern, desc2fontstyle(desc));
CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks));
-
+
CFDictionaryAddValue(cfAttr, kCTFontFamilyNameAttribute, cfFamilyName);
-
+
AutoCFRelease<CTFontDescriptorRef> desc(
CTFontDescriptorCreateWithAttributes(cfAttr));
return SkNEW_ARGS(SkFontStyleSet_Mac, (cfFamilyName, desc));
}
-
+
public:
SkFontMgr_Mac() : fCount(0), fNames(NULL) {}
}
return CreateSet(this->stringAt(index));
}
-
+
virtual SkFontStyleSet* onMatchFamily(const char familyName[]) SK_OVERRIDE {
AutoCFRelease<CFStringRef> cfName(make_CFString(familyName));
return CreateSet(cfName);
}
-
+
virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
const SkFontStyle&) SK_OVERRIDE {
return NULL;