static void appendFontData(SegmentedFontData* newFontData, PassRefPtr<SimpleFontData> prpFaceFontData, const CSSFontFace::UnicodeRangeSet& ranges) { RefPtr<SimpleFontData> faceFontData = prpFaceFontData; unsigned numRanges = ranges.size(); if (!numRanges) { newFontData->appendRange(FontDataRange(0, 0x7FFFFFFF, faceFontData)); return; } for (unsigned j = 0; j < numRanges; ++j) newFontData->appendRange(FontDataRange(ranges.rangeAt(j).from(), ranges.rangeAt(j).to(), faceFontData)); }
static void appendFontDataWithInvalidUnicodeRangeIfLoading(SegmentedFontData* newFontData, PassRefPtr<SimpleFontData> prpFaceFontData, const Vector<CSSFontFace::UnicodeRange>& ranges) { RefPtr<SimpleFontData> faceFontData = prpFaceFontData; if (faceFontData->isLoading()) { newFontData->appendRange(FontDataRange(0, 0, faceFontData)); return; } unsigned numRanges = ranges.size(); if (!numRanges) { newFontData->appendRange(FontDataRange(0, 0x7FFFFFFF, faceFontData)); return; } for (unsigned j = 0; j < numRanges; ++j) newFontData->appendRange(FontDataRange(ranges[j].from(), ranges[j].to(), faceFontData)); }
FontData* CSSSegmentedFontFace::getFontData(const FontDescription& fontDescription,bool woffEnabled) //SISO WOFF CHANGES (woffEnabled parameter added) { if (!isValid()) return 0; FontTraitsMask desiredTraitsMask = fontDescription.traitsMask(); unsigned hashKey = ((fontDescription.computedPixelSize() + 1) << (FontTraitsMaskWidth + 1)) | ((fontDescription.orientation() == Vertical ? 1 : 0) << FontTraitsMaskWidth) | desiredTraitsMask; SegmentedFontData* fontData = m_fontDataTable.get(hashKey); if (fontData) return fontData; fontData = new SegmentedFontData(); unsigned size = m_fontFaces.size(); for (unsigned i = 0; i < size; i++) { if (!m_fontFaces[i]->isValid()) continue; FontTraitsMask traitsMask = m_fontFaces[i]->traitsMask(); bool syntheticBold = !(traitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)) && (desiredTraitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)); bool syntheticItalic = !(traitsMask & FontStyleItalicMask) && (desiredTraitsMask & FontStyleItalicMask); if (const SimpleFontData* faceFontData = m_fontFaces[i]->getFontData(fontDescription, syntheticBold, syntheticItalic,woffEnabled)) { ASSERT(!faceFontData->isSegmented()); const Vector<CSSFontFace::UnicodeRange>& ranges = m_fontFaces[i]->ranges(); unsigned numRanges = ranges.size(); if (!numRanges) fontData->appendRange(FontDataRange(0, 0x7FFFFFFF, faceFontData)); else { for (unsigned j = 0; j < numRanges; ++j) fontData->appendRange(FontDataRange(ranges[j].from(), ranges[j].to(), faceFontData)); } } } if (fontData->numRanges()) m_fontDataTable.set(hashKey, fontData); else { delete fontData; fontData = 0; } return fontData; }
FontData* CSSSegmentedFontFace::getFontData(const FontDescription& fontDescription) { if (!isValid()) return 0; FontTraitsMask desiredTraitsMask = fontDescription.traitsMask(); //+EAWebKitChange //10/17/2011 - We need to take into account the effect data into the hash generation and the smoothing mode. #if PLATFORM(EA) // We need to take into account the effect data into the hash generation and the smoothing mode. const EA::WebKit::TextEffectData& effectData = fontDescription.getTextEffectData(); unsigned hashCodes[] = { ((fontDescription.computedPixelSize() + 1) << (FontTraitsMaskWidth + 1)) | ((fontDescription.orientation() == Vertical ? 1 : 0) << FontTraitsMaskWidth) | desiredTraitsMask, static_cast<unsigned> (effectData.mType), static_cast<unsigned> (effectData.mX), static_cast<unsigned> (effectData.mY), static_cast<unsigned> (effectData.mBlur), effectData.mC, effectData.mCBase, fontDescription.fontSmoothing() }; unsigned hashKey = StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes); #else unsigned hashKey = ((fontDescription.computedPixelSize() + 1) << (FontTraitsMaskWidth + 1)) | ((fontDescription.orientation() == Vertical ? 1 : 0) << FontTraitsMaskWidth) | desiredTraitsMask; #endif //-EAWebKitChange SegmentedFontData* fontData = m_fontDataTable.get(hashKey); if (fontData) return fontData; fontData = new SegmentedFontData(); unsigned size = m_fontFaces.size(); for (unsigned i = 0; i < size; i++) { if (!m_fontFaces[i]->isValid()) continue; FontTraitsMask traitsMask = m_fontFaces[i]->traitsMask(); bool syntheticBold = !(traitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)) && (desiredTraitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)); bool syntheticItalic = !(traitsMask & FontStyleItalicMask) && (desiredTraitsMask & FontStyleItalicMask); if (const SimpleFontData* faceFontData = m_fontFaces[i]->getFontData(fontDescription, syntheticBold, syntheticItalic)) { ASSERT(!faceFontData->isSegmented()); const Vector<CSSFontFace::UnicodeRange>& ranges = m_fontFaces[i]->ranges(); unsigned numRanges = ranges.size(); if (!numRanges) fontData->appendRange(FontDataRange(0, 0x7FFFFFFF, faceFontData)); else { for (unsigned j = 0; j < numRanges; ++j) fontData->appendRange(FontDataRange(ranges[j].from(), ranges[j].to(), faceFontData)); } } } if (fontData->numRanges()) m_fontDataTable.set(hashKey, fontData); else { delete fontData; fontData = 0; } return fontData; }