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

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

Issue 1931393002: Introduce typeface cache in blink::FontCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip: others 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 Google Inc. All rights reserved. 2 * Copyright (c) 2012 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 { 343 {
344 #if OS(MACOSX) 344 #if OS(MACOSX)
345 hb_face_t* face = hb_coretext_face_create(m_platformData->cgFont()); 345 hb_face_t* face = hb_coretext_face_create(m_platformData->cgFont());
346 #else 346 #else
347 hb_face_t* face = hb_face_create_for_tables(harfBuzzSkiaGetTable, m_platform Data->typeface(), 0); 347 hb_face_t* face = hb_face_create_for_tables(harfBuzzSkiaGetTable, m_platform Data->typeface(), 0);
348 #endif 348 #endif
349 ASSERT(face); 349 ASSERT(face);
350 return face; 350 return face;
351 } 351 }
352 352
353 hb_font_t* HarfBuzzFace::createFont(PassRefPtr<UnicodeRangeSet> rangeSet) const 353 hb_font_t* HarfBuzzFace::createFont(float size, const FontRenderStyle& style, Pa ssRefPtr<UnicodeRangeSet> rangeSet) const
354 { 354 {
355 HarfBuzzFontData* hbFontData = new HarfBuzzFontData(m_glyphCacheForFaceCache Entry, m_face, rangeSet); 355 HarfBuzzFontData* hbFontData = new HarfBuzzFontData(m_glyphCacheForFaceCache Entry, m_face, rangeSet);
356 style.apply(&hbFontData->m_paint);
357 hbFontData->m_paint.setTextSize(SkFloatToScalar(size));
356 m_platformData->setupPaint(&hbFontData->m_paint); 358 m_platformData->setupPaint(&hbFontData->m_paint);
357 hbFontData->m_simpleFontData = FontCache::fontCache()->fontDataFromFontPlatf ormData(m_platformData); 359 hbFontData->m_simpleFontData = FontCache::fontCache()->fontDataFromFontPlatf ormData(m_platformData);
358 ASSERT(hbFontData->m_simpleFontData); 360 ASSERT(hbFontData->m_simpleFontData);
359 hb_font_t* font = hb_font_create(m_face); 361 hb_font_t* font = hb_font_create(m_face);
360 hb_font_set_funcs(font, harfBuzzSkiaGetFontFuncs(), hbFontData, destroyHarfB uzzFontData); 362 hb_font_set_funcs(font, harfBuzzSkiaGetFontFuncs(), hbFontData, destroyHarfB uzzFontData);
361 float size = m_platformData->size();
362 int scale = SkiaScalarToHarfBuzzPosition(size); 363 int scale = SkiaScalarToHarfBuzzPosition(size);
363 hb_font_set_scale(font, scale, scale); 364 hb_font_set_scale(font, scale, scale);
364 hb_font_make_immutable(font); 365 hb_font_make_immutable(font);
365 return font; 366 return font;
366 } 367 }
367 368
368 } // namespace blink 369 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698