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

Side by Side Diff: Source/platform/fonts/SimpleFontData.cpp

Issue 1201143002: Removing broken ideograph font variant (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updating TestExpectations Created 5 years, 6 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
« no previous file with comments | « Source/platform/fonts/SimpleFontData.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Alexey Proskuryakov 3 * Copyright (C) 2006 Alexey Proskuryakov
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #if OS(LINUX) || OS(ANDROID) 52 #if OS(LINUX) || OS(ANDROID)
53 // This is the largest VDMX table which we'll try to load and parse. 53 // This is the largest VDMX table which we'll try to load and parse.
54 static const size_t maxVDMXTableSize = 1024 * 1024; // 1 MB 54 static const size_t maxVDMXTableSize = 1024 * 1024; // 1 MB
55 #endif 55 #endif
56 56
57 SimpleFontData::SimpleFontData(const FontPlatformData& platformData, PassRefPtr< CustomFontData> customData, bool isTextOrientationFallback) 57 SimpleFontData::SimpleFontData(const FontPlatformData& platformData, PassRefPtr< CustomFontData> customData, bool isTextOrientationFallback)
58 : m_maxCharWidth(-1) 58 : m_maxCharWidth(-1)
59 , m_avgCharWidth(-1) 59 , m_avgCharWidth(-1)
60 , m_platformData(platformData) 60 , m_platformData(platformData)
61 , m_isTextOrientationFallback(isTextOrientationFallback) 61 , m_isTextOrientationFallback(isTextOrientationFallback)
62 , m_isBrokenIdeographFallback(false)
63 , m_verticalData(nullptr) 62 , m_verticalData(nullptr)
64 , m_hasVerticalGlyphs(false) 63 , m_hasVerticalGlyphs(false)
65 , m_customFontData(customData) 64 , m_customFontData(customData)
66 { 65 {
67 platformInit(); 66 platformInit();
68 platformGlyphInit(); 67 platformGlyphInit();
69 if (platformData.isVerticalAnyUpright() && !isTextOrientationFallback) { 68 if (platformData.isVerticalAnyUpright() && !isTextOrientationFallback) {
70 m_verticalData = platformData.verticalData(); 69 m_verticalData = platformData.verticalData();
71 m_hasVerticalGlyphs = m_verticalData.get() && m_verticalData->hasVertica lMetrics(); 70 m_hasVerticalGlyphs = m_verticalData.get() && m_verticalData->hasVertica lMetrics();
72 } 71 }
73 } 72 }
74 73
75 SimpleFontData::SimpleFontData(PassRefPtr<CustomFontData> customData, float font Size, bool syntheticBold, bool syntheticItalic) 74 SimpleFontData::SimpleFontData(PassRefPtr<CustomFontData> customData, float font Size, bool syntheticBold, bool syntheticItalic)
76 : m_platformData(FontPlatformData(fontSize, syntheticBold, syntheticItalic)) 75 : m_platformData(FontPlatformData(fontSize, syntheticBold, syntheticItalic))
77 , m_isTextOrientationFallback(false) 76 , m_isTextOrientationFallback(false)
78 , m_isBrokenIdeographFallback(false)
79 , m_verticalData(nullptr) 77 , m_verticalData(nullptr)
80 , m_hasVerticalGlyphs(false) 78 , m_hasVerticalGlyphs(false)
81 , m_customFontData(customData) 79 , m_customFontData(customData)
82 { 80 {
83 if (m_customFontData) 81 if (m_customFontData)
84 m_customFontData->initializeFontData(this, fontSize); 82 m_customFontData->initializeFontData(this, fontSize);
85 } 83 }
86 84
87 void SimpleFontData::platformInit() 85 void SimpleFontData::platformInit()
88 { 86 {
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 PassRefPtr<SimpleFontData> SimpleFontData::emphasisMarkFontData(const FontDescri ption& fontDescription) const 358 PassRefPtr<SimpleFontData> SimpleFontData::emphasisMarkFontData(const FontDescri ption& fontDescription) const
361 { 359 {
362 if (!m_derivedFontData) 360 if (!m_derivedFontData)
363 m_derivedFontData = DerivedFontData::create(isCustomFont()); 361 m_derivedFontData = DerivedFontData::create(isCustomFont());
364 if (!m_derivedFontData->emphasisMark) 362 if (!m_derivedFontData->emphasisMark)
365 m_derivedFontData->emphasisMark = createScaledFontData(fontDescription, emphasisMarkFontSizeMultiplier); 363 m_derivedFontData->emphasisMark = createScaledFontData(fontDescription, emphasisMarkFontSizeMultiplier);
366 364
367 return m_derivedFontData->emphasisMark; 365 return m_derivedFontData->emphasisMark;
368 } 366 }
369 367
370 PassRefPtr<SimpleFontData> SimpleFontData::brokenIdeographFontData() const
371 {
372 if (!m_derivedFontData)
373 m_derivedFontData = DerivedFontData::create(isCustomFont());
374 if (!m_derivedFontData->brokenIdeograph) {
375 m_derivedFontData->brokenIdeograph = create(m_platformData, isCustomFont () ? CustomFontData::create(): nullptr);
376 m_derivedFontData->brokenIdeograph->m_isBrokenIdeographFallback = true;
377 }
378 return m_derivedFontData->brokenIdeograph;
379 }
380
381 PassOwnPtr<SimpleFontData::DerivedFontData> SimpleFontData::DerivedFontData::cre ate(bool forCustomFont) 368 PassOwnPtr<SimpleFontData::DerivedFontData> SimpleFontData::DerivedFontData::cre ate(bool forCustomFont)
382 { 369 {
383 return adoptPtr(new DerivedFontData(forCustomFont)); 370 return adoptPtr(new DerivedFontData(forCustomFont));
384 } 371 }
385 372
386 SimpleFontData::DerivedFontData::~DerivedFontData() 373 SimpleFontData::DerivedFontData::~DerivedFontData()
387 { 374 {
388 if (!forCustomFont) 375 if (!forCustomFont)
389 return; 376 return;
390 377
391 if (smallCaps) 378 if (smallCaps)
392 GlyphPageTreeNode::pruneTreeCustomFontData(smallCaps.get()); 379 GlyphPageTreeNode::pruneTreeCustomFontData(smallCaps.get());
393 if (emphasisMark) 380 if (emphasisMark)
394 GlyphPageTreeNode::pruneTreeCustomFontData(emphasisMark.get()); 381 GlyphPageTreeNode::pruneTreeCustomFontData(emphasisMark.get());
395 if (brokenIdeograph)
396 GlyphPageTreeNode::pruneTreeCustomFontData(brokenIdeograph.get());
397 if (verticalRightOrientation) 382 if (verticalRightOrientation)
398 GlyphPageTreeNode::pruneTreeCustomFontData(verticalRightOrientation.get( )); 383 GlyphPageTreeNode::pruneTreeCustomFontData(verticalRightOrientation.get( ));
399 if (uprightOrientation) 384 if (uprightOrientation)
400 GlyphPageTreeNode::pruneTreeCustomFontData(uprightOrientation.get()); 385 GlyphPageTreeNode::pruneTreeCustomFontData(uprightOrientation.get());
401 } 386 }
402 387
403 PassRefPtr<SimpleFontData> SimpleFontData::createScaledFontData(const FontDescri ption& fontDescription, float scaleFactor) const 388 PassRefPtr<SimpleFontData> SimpleFontData::createScaledFontData(const FontDescri ption& fontDescription, float scaleFactor) const
404 { 389 {
405 return platformCreateScaledFontData(fontDescription, scaleFactor); 390 return platformCreateScaledFontData(fontDescription, scaleFactor);
406 } 391 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 if (glyphs[i]) { 493 if (glyphs[i]) {
509 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); 494 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this);
510 haveGlyphs = true; 495 haveGlyphs = true;
511 } 496 }
512 } 497 }
513 498
514 return haveGlyphs; 499 return haveGlyphs;
515 } 500 }
516 501
517 } // namespace blink 502 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/SimpleFontData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698