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

Side by Side Diff: ui/gfx/font_fallback_win.cc

Issue 2927953003: Use CTFontCreateForString for RenderTextHarfbuzz on Mac (Closed)
Patch Set: Fix views::Label tests Created 3 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 | « ui/gfx/font_fallback_win.h ('k') | ui/gfx/render_text_harfbuzz.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/font_fallback_win.h" 5 #include "ui/gfx/font_fallback_win.h"
6 6
7 #include <dwrite_2.h> 7 #include <dwrite_2.h>
8 #include <usp10.h> 8 #include <usp10.h>
9 #include <wrl.h> 9 #include <wrl.h>
10 10
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // LinkedFontsIterator doesn't care about the font size, so we always pass 10. 334 // LinkedFontsIterator doesn't care about the font size, so we always pass 10.
335 internal::LinkedFontsIterator linked_fonts(Font(font_family, 10)); 335 internal::LinkedFontsIterator linked_fonts(Font(font_family, 10));
336 std::vector<Font> fallback_fonts; 336 std::vector<Font> fallback_fonts;
337 Font current; 337 Font current;
338 while (linked_fonts.NextFont(&current)) 338 while (linked_fonts.NextFont(&current))
339 fallback_fonts.push_back(current); 339 fallback_fonts.push_back(current);
340 return fallback_fonts; 340 return fallback_fonts;
341 } 341 }
342 342
343 bool GetFallbackFont(const Font& font, 343 bool GetFallbackFont(const Font& font,
344 const wchar_t* text, 344 const base::char16* text,
345 int text_length, 345 int text_length,
346 Font* result) { 346 Font* result) {
347 // Creating a DirectWrite font fallback can be expensive. It's ok in the 347 // Creating a DirectWrite font fallback can be expensive. It's ok in the
348 // browser process because we can use the shared system fallback, but in the 348 // browser process because we can use the shared system fallback, but in the
349 // renderer this can cause hangs. Code that needs font fallback in the 349 // renderer this can cause hangs. Code that needs font fallback in the
350 // renderer should instead use the font proxy. 350 // renderer should instead use the font proxy.
351 DCHECK(base::MessageLoopForUI::IsCurrent()); 351 DCHECK(base::MessageLoopForUI::IsCurrent());
352 352
353 // Check that we have at least as much text as was claimed. If we have less 353 // Check that we have at least as much text as was claimed. If we have less
354 // text than expected then DirectWrite will become confused and crash. This 354 // text than expected then DirectWrite will become confused and crash. This
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 base::string16 name; 406 base::string16 name;
407 if (FAILED(GetFamilyNameFromDirectWriteFont(mapped_font.Get(), &name))) 407 if (FAILED(GetFamilyNameFromDirectWriteFont(mapped_font.Get(), &name)))
408 return false; 408 return false;
409 *result = Font(base::UTF16ToUTF8(name), font.GetFontSize() * scale); 409 *result = Font(base::UTF16ToUTF8(name), font.GetFontSize() * scale);
410 return true; 410 return true;
411 } 411 }
412 return false; 412 return false;
413 } 413 }
414 414
415 } // namespace gfx 415 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/font_fallback_win.h ('k') | ui/gfx/render_text_harfbuzz.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698