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

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

Issue 684463004: Remove !typeFace early return in fontFamilyName (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | 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) 2011 Brent Fulgham 2 * Copyright (C) 2011 Brent Fulgham
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 && m_widthVariant == a.m_widthVariant; 308 && m_widthVariant == a.m_widthVariant;
309 } 309 }
310 310
311 SkFontID FontPlatformData::uniqueID() const 311 SkFontID FontPlatformData::uniqueID() const
312 { 312 {
313 return typeface()->uniqueID(); 313 return typeface()->uniqueID();
314 } 314 }
315 315
316 String FontPlatformData::fontFamilyName() const 316 String FontPlatformData::fontFamilyName() const
317 { 317 {
318 // FIXME(crbug.com/326582): come up with a proper way of handling SVG. 318 ASSERT(this->typeface());
319 if (!this->typeface())
320 return "";
321 SkTypeface::LocalizedStrings* fontFamilyIterator = this->typeface()->createF amilyNameIterator(); 319 SkTypeface::LocalizedStrings* fontFamilyIterator = this->typeface()->createF amilyNameIterator();
322 SkTypeface::LocalizedString localizedString; 320 SkTypeface::LocalizedString localizedString;
323 while (fontFamilyIterator->next(&localizedString) && !localizedString.fStrin g.size()) { } 321 while (fontFamilyIterator->next(&localizedString) && !localizedString.fStrin g.size()) { }
324 fontFamilyIterator->unref(); 322 fontFamilyIterator->unref();
325 return String(localizedString.fString.c_str()); 323 return String(localizedString.fString.c_str());
326 } 324 }
327 325
328 bool FontPlatformData::isFixedPitch() const 326 bool FontPlatformData::isFixedPitch() const
329 { 327 {
330 return typeface() && typeface()->isFixedPitch(); 328 return typeface() && typeface()->isFixedPitch();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 if (tableSize) { 389 if (tableSize) {
392 Vector<char> tableBuffer(tableSize); 390 Vector<char> tableBuffer(tableSize);
393 m_typeface->getTableData(tag, 0, tableSize, &tableBuffer[0]); 391 m_typeface->getTableData(tag, 0, tableSize, &tableBuffer[0]);
394 buffer = SharedBuffer::adoptVector(tableBuffer); 392 buffer = SharedBuffer::adoptVector(tableBuffer);
395 } 393 }
396 return buffer.release(); 394 return buffer.release();
397 } 395 }
398 #endif 396 #endif
399 397
400 } // namespace blink 398 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698