Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp

Issue 1806363002: Revert of Shape unicode-range: font faces in only one iteration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // for only 128 out of 256 characters. 238 // for only 128 out of 256 characters.
239 bool haveGlyphs; 239 bool haveGlyphs;
240 if (!fontData->isSegmented()) { 240 if (!fontData->isSegmented()) {
241 m_page = GlyphPage::createForSingleFontData(this, toSimpleFontData(fontD ata)); 241 m_page = GlyphPage::createForSingleFontData(this, toSimpleFontData(fontD ata));
242 haveGlyphs = fill(m_page.get(), 0, GlyphPage::size, buffer, bufferLength , toSimpleFontData(fontData)); 242 haveGlyphs = fill(m_page.get(), 0, GlyphPage::size, buffer, bufferLength , toSimpleFontData(fontData));
243 } else { 243 } else {
244 m_page = GlyphPage::createForMixedFontData(this); 244 m_page = GlyphPage::createForMixedFontData(this);
245 haveGlyphs = false; 245 haveGlyphs = false;
246 246
247 const SegmentedFontData* segmentedFontData = toSegmentedFontData(fontDat a); 247 const SegmentedFontData* segmentedFontData = toSegmentedFontData(fontDat a);
248 for (int i = segmentedFontData->numFaces() - 1; i >= 0; i--) { 248 for (int i = segmentedFontData->numRanges() - 1; i >= 0; i--) {
249 const FontDataForRangeSet& fontDataForRangeSet = segmentedFontData-> faceAt(i); 249 const FontDataRange& range = segmentedFontData->rangeAt(i);
250 RefPtr<UnicodeRangeSet> ranges = fontDataForRangeSet.ranges(); 250 // all this casting is to ensure all the parameters to min and max h ave the same type,
251 for (size_t i = 0; i < ranges->size(); ++i) { 251 // to avoid ambiguous template parameter errors on Windows
252 const UnicodeRange& range = ranges->rangeAt(i); 252 int from = max(0, static_cast<int>(range.from()) - static_cast<int>( start));
253 // all this casting is to ensure all the parameters to min and m ax have the same type, 253 int to = 1 + min(static_cast<int>(range.to()) - static_cast<int>(sta rt), static_cast<int>(GlyphPage::size) - 1);
254 // to avoid ambiguous template parameter errors on Windows 254 if (from >= static_cast<int>(GlyphPage::size) || to <= 0)
255 int from = max(0, static_cast<int>(range.from()) - static_cast<i nt>(start)); 255 continue;
256 int to = 1 + min(static_cast<int>(range.to()) - static_cast<int> (start), static_cast<int>(GlyphPage::size) - 1);
257 if (from >= static_cast<int>(GlyphPage::size) || to <= 0)
258 continue;
259 256
260 // If this is a custom font needs to be loaded, do not fill 257 // If this is a custom font needs to be loaded, do not fill
261 // the page so that font fallback is used while loading. 258 // the page so that font fallback is used while loading.
262 RefPtr<CustomFontData> customData = fontDataForRangeSet.fontData ()->customFontData(); 259 RefPtr<CustomFontData> customData = range.fontData()->customFontData ();
263 if (customData && customData->isLoadingFallback()) { 260 if (customData && customData->isLoadingFallback()) {
264 for (int j = from; j < to; j++) { 261 for (int j = from; j < to; j++) {
265 m_page->setCustomFontToLoad(j, customData.get()); 262 m_page->setCustomFontToLoad(j, customData.get());
266 haveGlyphs = true; 263 haveGlyphs = true;
267 }
268 continue;
269 } 264 }
265 continue;
266 }
270 267
271 haveGlyphs |= fill(m_page.get(), from, to - from, buffer + from * (start < 0x10000 ? 1 : 2), (to - from) * (start < 0x10000 ? 1 : 2), fontDataFo rRangeSet.fontData().get()); 268 haveGlyphs |= fill(m_page.get(), from, to - from, buffer + from * (s tart < 0x10000 ? 1 : 2), (to - from) * (start < 0x10000 ? 1 : 2), range.fontData ().get());
272 }
273 } 269 }
274 } 270 }
275 271
276 if (!haveGlyphs) 272 if (!haveGlyphs)
277 m_page = nullptr; 273 m_page = nullptr;
278 } 274 }
279 275
280 void GlyphPageTreeNode::initializeOverridePage(const FontData* fontData, unsigne d pageNumber) 276 void GlyphPageTreeNode::initializeOverridePage(const FontData* fontData, unsigne d pageNumber)
281 { 277 {
282 GlyphPage* parentPage = m_parent->page(); 278 GlyphPage* parentPage = m_parent->page();
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 // entries may use different fonts depending on character. If the Font 437 // entries may use different fonts depending on character. If the Font
442 // ever finds it needs a glyph out of the system fallback page, it will 438 // ever finds it needs a glyph out of the system fallback page, it will
443 // ask the system for the best font to use and fill that glyph in for us. 439 // ask the system for the best font to use and fill that glyph in for us.
444 if (GlyphPage* parentPage = m_parent->page()) 440 if (GlyphPage* parentPage = m_parent->page())
445 return parentPage->createCopiedSystemFallbackPage(this); 441 return parentPage->createCopiedSystemFallbackPage(this);
446 return GlyphPage::createForMixedFontData(this); 442 return GlyphPage::createForMixedFontData(this);
447 } 443 }
448 444
449 } // namespace blink 445 } // namespace blink
450 446
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698