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

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

Issue 2807913002: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/fonts (Closed)
Patch Set: rebase Created 3 years, 8 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) 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 && style_ == a.style_ 216 && style_ == a.style_
217 #endif 217 #endif
218 && orientation_ == a.orientation_; 218 && orientation_ == a.orientation_;
219 } 219 }
220 220
221 SkFontID FontPlatformData::UniqueID() const { 221 SkFontID FontPlatformData::UniqueID() const {
222 return Typeface()->uniqueID(); 222 return Typeface()->uniqueID();
223 } 223 }
224 224
225 String FontPlatformData::FontFamilyName() const { 225 String FontPlatformData::FontFamilyName() const {
226 ASSERT(this->Typeface()); 226 DCHECK(this->Typeface());
227 SkTypeface::LocalizedStrings* font_family_iterator = 227 SkTypeface::LocalizedStrings* font_family_iterator =
228 this->Typeface()->createFamilyNameIterator(); 228 this->Typeface()->createFamilyNameIterator();
229 SkTypeface::LocalizedString localized_string; 229 SkTypeface::LocalizedString localized_string;
230 while (font_family_iterator->next(&localized_string) && 230 while (font_family_iterator->next(&localized_string) &&
231 !localized_string.fString.size()) { 231 !localized_string.fString.size()) {
232 } 232 }
233 font_family_iterator->unref(); 233 font_family_iterator->unref();
234 return String(localized_string.fString.c_str()); 234 return String(localized_string.fString.c_str());
235 } 235 }
236 236
(...skipping 22 matching lines...) Expand all
259 return false; 259 return false;
260 } 260 }
261 261
262 bool FontPlatformData::HasSpaceInLigaturesOrKerning( 262 bool FontPlatformData::HasSpaceInLigaturesOrKerning(
263 TypesettingFeatures features) const { 263 TypesettingFeatures features) const {
264 HarfBuzzFace* hb_face = GetHarfBuzzFace(); 264 HarfBuzzFace* hb_face = GetHarfBuzzFace();
265 if (!hb_face) 265 if (!hb_face)
266 return false; 266 return false;
267 267
268 hb_font_t* font = hb_face->GetScaledFont(); 268 hb_font_t* font = hb_face->GetScaledFont();
269 ASSERT(font); 269 DCHECK(font);
270 hb_face_t* face = hb_font_get_face(font); 270 hb_face_t* face = hb_font_get_face(font);
271 ASSERT(face); 271 DCHECK(face);
272 272
273 hb_codepoint_t space; 273 hb_codepoint_t space;
274 // If the space glyph isn't present in the font then each space character 274 // If the space glyph isn't present in the font then each space character
275 // will be rendering using a fallback font, which grantees that it cannot 275 // will be rendering using a fallback font, which grantees that it cannot
276 // affect the shape of the preceding word. 276 // affect the shape of the preceding word.
277 if (!hb_font_get_glyph(font, kSpaceCharacter, 0, &space)) 277 if (!hb_font_get_glyph(font, kSpaceCharacter, 0, &space))
278 return false; 278 return false;
279 279
280 if (!hb_ot_layout_has_substitution(face) && 280 if (!hb_ot_layout_has_substitution(face) &&
281 !hb_ot_layout_has_positioning(face)) { 281 !hb_ot_layout_has_positioning(face)) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 const size_t table_size = typeface_->getTableSize(tag); 336 const size_t table_size = typeface_->getTableSize(tag);
337 if (table_size) { 337 if (table_size) {
338 Vector<char> table_buffer(table_size); 338 Vector<char> table_buffer(table_size);
339 typeface_->getTableData(tag, 0, table_size, &table_buffer[0]); 339 typeface_->getTableData(tag, 0, table_size, &table_buffer[0]);
340 buffer = SharedBuffer::AdoptVector(table_buffer); 340 buffer = SharedBuffer::AdoptVector(table_buffer);
341 } 341 }
342 return buffer.Release(); 342 return buffer.Release();
343 } 343 }
344 344
345 } // namespace blink 345 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698