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

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

Issue 1939203002: Reland: Move glyph lookup to hb-ot-font and remove glyph cache in HarfBuzzFace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.h » ('j') | 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 0); 274 0);
275 if (hb_set_has(glyphs, space)) 275 if (hb_set_has(glyphs, space))
276 return true; 276 return true;
277 } 277 }
278 return false; 278 return false;
279 } 279 }
280 280
281 bool FontPlatformData::hasSpaceInLigaturesOrKerning( 281 bool FontPlatformData::hasSpaceInLigaturesOrKerning(
282 TypesettingFeatures features) const 282 TypesettingFeatures features) const
283 { 283 {
284 const HarfBuzzFace* hbFace = harfBuzzFace(); 284 HarfBuzzFace* hbFace = harfBuzzFace();
285 if (!hbFace) 285 if (!hbFace)
286 return false; 286 return false;
287 287
288 hb_face_t* face = hbFace->face(); 288 hb_face_t* face = hbFace->face();
289 ASSERT(face); 289 ASSERT(face);
290 OwnPtr<hb_font_t> font = adoptPtr(hbFace->createFont()); 290 hb_font_t* font = hbFace->getScaledFont();
291 ASSERT(font); 291 ASSERT(font);
292 292
293 hb_codepoint_t space; 293 hb_codepoint_t space;
294 // If the space glyph isn't present in the font then each space character 294 // If the space glyph isn't present in the font then each space character
295 // will be rendering using a fallback font, which grantees that it cannot 295 // will be rendering using a fallback font, which grantees that it cannot
296 // affect the shape of the preceding word. 296 // affect the shape of the preceding word.
297 if (!hb_font_get_glyph(font.get(), spaceCharacter, 0, &space)) 297 if (!hb_font_get_glyph(font, spaceCharacter, 0, &space))
298 return false; 298 return false;
299 299
300 if (!hb_ot_layout_has_substitution(face) 300 if (!hb_ot_layout_has_substitution(face)
301 && !hb_ot_layout_has_positioning(face)) { 301 && !hb_ot_layout_has_positioning(face)) {
302 return false; 302 return false;
303 } 303 }
304 304
305 bool foundSpaceInTable = false; 305 bool foundSpaceInTable = false;
306 hb_set_t* glyphs = hb_set_create(); 306 hb_set_t* glyphs = hb_set_create();
307 if (features & Kerning) 307 if (features & Kerning)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 const size_t tableSize = m_typeface->getTableSize(tag); 355 const size_t tableSize = m_typeface->getTableSize(tag);
356 if (tableSize) { 356 if (tableSize) {
357 Vector<char> tableBuffer(tableSize); 357 Vector<char> tableBuffer(tableSize);
358 m_typeface->getTableData(tag, 0, tableSize, &tableBuffer[0]); 358 m_typeface->getTableData(tag, 0, tableSize, &tableBuffer[0]);
359 buffer = SharedBuffer::adoptVector(tableBuffer); 359 buffer = SharedBuffer::adoptVector(tableBuffer);
360 } 360 }
361 return buffer.release(); 361 return buffer.release();
362 } 362 }
363 363
364 } // namespace blink 364 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698