本文整理汇总了C++中SkTypeface::createScalerContext方法的典型用法代码示例。如果您正苦于以下问题:C++ SkTypeface::createScalerContext方法的具体用法?C++ SkTypeface::createScalerContext怎么用?C++ SkTypeface::createScalerContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkTypeface
的用法示例。
在下文中一共展示了SkTypeface::createScalerContext方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GlyphGenerator
GlyphGenerator(const SkTypeface& typeface, const SkScalerContextEffects& effects,
const SkDescriptor& desc)
: fScalerContext(typeface.createScalerContext(effects, &desc))
#ifdef SK_DEBUG
, fDesc(desc.copy())
#endif
{}
示例2: allocNextContext
// Return the context associated with the next logical typeface, or NULL if
// there are no more entries in the fallback chain.
SkScalerContext* SkScalerContext::allocNextContext() const {
#ifdef SK_BUILD_FOR_ANDROID
SkTypeface* newFace = SkAndroidNextLogicalTypeface(fRec.fFontID,
fRec.fOrigFontID,
fPaintOptionsAndroid);
if (0 == newFace) {
return NULL;
}
SkAutoTUnref<SkTypeface> aur(newFace);
uint32_t newFontID = newFace->uniqueID();
SkOrderedWriteBuffer androidBuffer(128);
fPaintOptionsAndroid.flatten(androidBuffer);
SkAutoDescriptor ad(sizeof(fRec) + androidBuffer.size() + SkDescriptor::ComputeOverhead(2));
SkDescriptor* desc = ad.getDesc();
desc->init();
SkScalerContext::Rec* newRec =
(SkScalerContext::Rec*)desc->addEntry(kRec_SkDescriptorTag,
sizeof(fRec), &fRec);
androidBuffer.writeToMemory(desc->addEntry(kAndroidOpts_SkDescriptorTag,
androidBuffer.size(), NULL));
newRec->fFontID = newFontID;
desc->computeChecksum();
return newFace->createScalerContext(desc);
#else
return NULL;
#endif
}
示例3:
std::unique_ptr<SkScalerContext> SkGlyphCache::CreateScalerContext(
const SkDescriptor& desc,
const SkScalerContextEffects& effects,
const SkTypeface& typeface) {
auto scaler = typeface.createScalerContext(effects, &desc, true /* can fail */);
// Check if we can create a scaler-context before creating the glyphcache.
// If not, we may have exhausted OS/font resources, so try purging the
// cache once and try again
// pass true the first time, to notice if the scalercontext failed,
if (scaler == nullptr) {
get_globals().purgeAll();
scaler = typeface.createScalerContext(effects, &desc, false /* must succeed */);
}
return scaler;
}
示例4: GlyphGenerator
GlyphGenerator(const SkTypeface& typeface, const SkDescriptor& desc)
: fScalerContext(typeface.createScalerContext(&desc))
#ifdef SK_DEBUG
, fDesc(desc.copy())
#endif
{
fFlipMatrix.setScale(1, -1);
}