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

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

Issue 2824773002: Rename ScopedComPtr::get() to ScopedComPtr::Get() (Closed)
Patch Set: Update to 5293966 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
« no previous file with comments | « ui/base/win/shell.cc ('k') | ui/gfx/platform_font_win.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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 380
381 uint32_t mapped_length = 0; 381 uint32_t mapped_length = 0;
382 base::win::ScopedComPtr<IDWriteFont> mapped_font; 382 base::win::ScopedComPtr<IDWriteFont> mapped_font;
383 float scale = 0; 383 float scale = 0;
384 base::win::ScopedComPtr<IDWriteTextAnalysisSource> text_analysis; 384 base::win::ScopedComPtr<IDWriteTextAnalysisSource> text_analysis;
385 DWRITE_READING_DIRECTION reading_direction = 385 DWRITE_READING_DIRECTION reading_direction =
386 base::i18n::IsRTL() ? DWRITE_READING_DIRECTION_RIGHT_TO_LEFT 386 base::i18n::IsRTL() ? DWRITE_READING_DIRECTION_RIGHT_TO_LEFT
387 : DWRITE_READING_DIRECTION_LEFT_TO_RIGHT; 387 : DWRITE_READING_DIRECTION_LEFT_TO_RIGHT;
388 if (FAILED(Microsoft::WRL::MakeAndInitialize<gfx::win::TextAnalysisSource>( 388 if (FAILED(Microsoft::WRL::MakeAndInitialize<gfx::win::TextAnalysisSource>(
389 text_analysis.Receive(), text, locale.c_str(), 389 text_analysis.Receive(), text, locale.c_str(),
390 number_substitution.get(), reading_direction))) { 390 number_substitution.Get(), reading_direction))) {
391 return false; 391 return false;
392 } 392 }
393 base::string16 original_name = base::UTF8ToUTF16(font.GetFontName()); 393 base::string16 original_name = base::UTF8ToUTF16(font.GetFontName());
394 DWRITE_FONT_STYLE font_style = DWRITE_FONT_STYLE_NORMAL; 394 DWRITE_FONT_STYLE font_style = DWRITE_FONT_STYLE_NORMAL;
395 if (font.GetStyle() & Font::ITALIC) 395 if (font.GetStyle() & Font::ITALIC)
396 font_style = DWRITE_FONT_STYLE_ITALIC; 396 font_style = DWRITE_FONT_STYLE_ITALIC;
397 if (FAILED(fallback->MapCharacters( 397 if (FAILED(fallback->MapCharacters(
398 text_analysis.get(), 0, text_length, nullptr, original_name.c_str(), 398 text_analysis.Get(), 0, text_length, nullptr, original_name.c_str(),
399 static_cast<DWRITE_FONT_WEIGHT>(font.GetWeight()), font_style, 399 static_cast<DWRITE_FONT_WEIGHT>(font.GetWeight()), font_style,
400 DWRITE_FONT_STRETCH_NORMAL, &mapped_length, mapped_font.Receive(), 400 DWRITE_FONT_STRETCH_NORMAL, &mapped_length, mapped_font.Receive(),
401 &scale))) { 401 &scale))) {
402 return false; 402 return false;
403 } 403 }
404 404
405 if (mapped_font) { 405 if (mapped_font) {
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/base/win/shell.cc ('k') | ui/gfx/platform_font_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698