本文整理汇总了C++中FontDescription::isSpecifiedFont方法的典型用法代码示例。如果您正苦于以下问题:C++ FontDescription::isSpecifiedFont方法的具体用法?C++ FontDescription::isSpecifiedFont怎么用?C++ FontDescription::isSpecifiedFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontDescription
的用法示例。
在下文中一共展示了FontDescription::isSpecifiedFont方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: familyNameFromSettings
static AtomicString familyNameFromSettings(const GenericFontFamilySettings& settings, const FontDescription& fontDescription, const AtomicString& genericFamilyName)
{
UScriptCode script = fontDescription.script();
if (fontDescription.genericFamily() == FontDescription::StandardFamily && !fontDescription.isSpecifiedFont())
return settings.standard(script);
#if OS(ANDROID)
return FontCache::getGenericFamilyNameForScript(genericFamilyName, script);
#else
if (genericFamilyName == FontFamilyNames::webkit_serif)
return settings.serif(script);
if (genericFamilyName == FontFamilyNames::webkit_sans_serif)
return settings.sansSerif(script);
if (genericFamilyName == FontFamilyNames::webkit_cursive)
return settings.cursive(script);
if (genericFamilyName == FontFamilyNames::webkit_fantasy)
return settings.fantasy(script);
if (genericFamilyName == FontFamilyNames::webkit_monospace)
return settings.fixed(script);
if (genericFamilyName == FontFamilyNames::webkit_pictograph)
return settings.pictograph(script);
if (genericFamilyName == FontFamilyNames::webkit_standard)
return settings.standard(script);
#endif
return emptyAtom;
}
示例2: setFontFamilyInherit
void FontBuilder::setFontFamilyInherit(const FontDescription& parentFontDescription)
{
FontDescriptionChangeScope scope(this);
scope.fontDescription().setGenericFamily(parentFontDescription.genericFamily());
scope.fontDescription().setFamily(parentFontDescription.family());
scope.fontDescription().setIsSpecifiedFont(parentFontDescription.isSpecifiedFont());
}
示例3: fontDataForGenericFamily
PassRefPtr<FontData> CSSFontSelector::getFontData(const FontDescription& fontDescription, const AtomicString& familyName)
{
if (m_fontFaces.isEmpty()) {
if (familyName.startsWith("-webkit-"))
return fontDataForGenericFamily(m_document, fontDescription, familyName);
if (fontDescription.genericFamily() == FontDescription::StandardFamily && !fontDescription.isSpecifiedFont())
return fontDataForGenericFamily(m_document, fontDescription, "-webkit-standard");
return 0;
}
CSSSegmentedFontFace* face = getFontFace(fontDescription, familyName);
// If no face was found, then return 0 and let the OS come up with its best match for the name.
if (!face) {
// If we were handed a generic family, but there was no match, go ahead and return the correct font based off our
// settings.
if (fontDescription.genericFamily() == FontDescription::StandardFamily && !fontDescription.isSpecifiedFont())
return fontDataForGenericFamily(m_document, fontDescription, "-webkit-standard");
return fontDataForGenericFamily(m_document, fontDescription, familyName);
}
// We have a face. Ask it for a font data. If it cannot produce one, it will fail, and the OS will take over.
return face->getFontData(fontDescription);
}
示例4: converterType
FontTranscoder::ConverterType FontTranscoder::converterType(const FontDescription& fontDescription, const TextEncoding* encoding) const
{
const AtomicString& fontFamily = fontDescription.family().family().string();
if (!fontFamily.isNull()) {
HashMap<AtomicString, ConverterType>::const_iterator found = m_converterTypes.find(fontFamily);
if (found != m_converterTypes.end())
return found->second;
}
// IE's default fonts for Japanese encodings change backslashes into yen signs.
// We emulate this behavior only when no font is explicitly specified.
if (encoding && encoding->backslashAsCurrencySymbol() != '\\' && !fontDescription.isSpecifiedFont())
return BackslashToYenSign;
return NoConversion;
}
示例5: resolvesFamilyFor
bool CSSFontSelector::resolvesFamilyFor(const FontDescription& description) const
{
for (unsigned i = 0; i < description.familyCount(); ++i) {
const AtomicString& familyName = description.familyAt(i);
if (description.genericFamily() == FontDescription::StandardFamily && !description.isSpecifiedFont())
return true;
if (familyName.isEmpty())
continue;
if (m_fontFaces.contains(familyName))
return true;
DEFINE_STATIC_LOCAL(String, webkitPrefix, ("-webkit-"));
if (familyName.startsWith(webkitPrefix))
return true;
}
return false;
}
示例6: fontDataForGenericFamily
PassRefPtr<FontData> CSSFontSelector::getFontData(const FontDescription& fontDescription, const AtomicString& familyName)
{
if (m_fontFaces.isEmpty()) {
if (familyName.startsWith("-webkit-"))
return fontDataForGenericFamily(m_document, fontDescription, familyName);
if (fontDescription.genericFamily() == FontDescription::StandardFamily && !fontDescription.isSpecifiedFont())
return fontDataForGenericFamily(m_document, fontDescription, "-webkit-standard");
return 0;
}
String family = familyName.string();
Vector<RefPtr<CSSFontFace> >* familyFontFaces = m_fontFaces.get(family);
// If no face was found, then return 0 and let the OS come up with its best match for the name.
if (!familyFontFaces || familyFontFaces->isEmpty()) {
// If we were handed a generic family, but there was no match, go ahead and return the correct font based off our
// settings.
if (fontDescription.genericFamily() == FontDescription::StandardFamily && !fontDescription.isSpecifiedFont())
return fontDataForGenericFamily(m_document, fontDescription, "-webkit-standard");
return fontDataForGenericFamily(m_document, fontDescription, familyName);
}
OwnPtr<HashMap<unsigned, RefPtr<CSSSegmentedFontFace> > >& segmentedFontFaceCache = m_fonts.add(family, nullptr).iterator->value;
if (!segmentedFontFaceCache)
segmentedFontFaceCache = adoptPtr(new HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >);
FontTraitsMask traitsMask = fontDescription.traitsMask();
RefPtr<CSSSegmentedFontFace>& face = segmentedFontFaceCache->add(traitsMask, 0).iterator->value;
if (!face) {
face = CSSSegmentedFontFace::create(this);
// Collect all matching faces and sort them in order of preference.
Vector<CSSFontFace*, 32> candidateFontFaces;
for (int i = familyFontFaces->size() - 1; i >= 0; --i) {
CSSFontFace* candidate = familyFontFaces->at(i).get();
unsigned candidateTraitsMask = candidate->traitsMask();
if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & FontStyleNormalMask))
continue;
if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMask & FontVariantNormalMask))
continue;
#if ENABLE(SVG_FONTS)
// For SVG Fonts that specify that they only support the "normal" variant, we will assume they are incapable
// of small-caps synthesis and just ignore the font face as a candidate.
if (candidate->hasSVGFontFaceSource() && (traitsMask & FontVariantSmallCapsMask) && !(candidateTraitsMask & FontVariantSmallCapsMask))
continue;
#endif
candidateFontFaces.append(candidate);
}
if (Vector<RefPtr<CSSFontFace> >* familyLocallyInstalledFontFaces = m_locallyInstalledFontFaces.get(family)) {
unsigned numLocallyInstalledFontFaces = familyLocallyInstalledFontFaces->size();
for (unsigned i = 0; i < numLocallyInstalledFontFaces; ++i) {
CSSFontFace* candidate = familyLocallyInstalledFontFaces->at(i).get();
unsigned candidateTraitsMask = candidate->traitsMask();
if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & FontStyleNormalMask))
continue;
if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMask & FontVariantNormalMask))
continue;
candidateFontFaces.append(candidate);
}
}
desiredTraitsMaskForComparison = traitsMask;
stable_sort(candidateFontFaces.begin(), candidateFontFaces.end(), compareFontFaces);
unsigned numCandidates = candidateFontFaces.size();
for (unsigned i = 0; i < numCandidates; ++i)
face->appendFontFace(candidateFontFaces[i]);
}
// We have a face. Ask it for a font data. If it cannot produce one, it will fail, and the OS will take over.
return face->getFontData(fontDescription);
}