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

Unified Diff: ui/gfx/platform_font_win.h

Issue 696913002: Retrieve font metrics from skia if DirectWrite is enabled for font metrics calculations in the chro… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comment Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/platform_font_win.h
diff --git a/ui/gfx/platform_font_win.h b/ui/gfx/platform_font_win.h
index 7bce9ac7c07097346b3f62bac7a59c353ddc1b0a..7172c236cae788a45fbc93eac9d1415c52231d26 100644
--- a/ui/gfx/platform_font_win.h
+++ b/ui/gfx/platform_font_win.h
@@ -5,7 +5,6 @@
#ifndef UI_GFX_PLATFORM_FONT_WIN_H_
#define UI_GFX_PLATFORM_FONT_WIN_H_
-#include <dwrite.h>
#include <string>
#include "base/compiler_specific.h"
@@ -68,9 +67,10 @@ class GFX_EXPORT PlatformFontWin : public PlatformFont {
virtual const FontRenderParams& GetFontRenderParams() const override;
virtual NativeFont GetNativeFont() const override;
- // Called once during initialization if we are using DirectWrite for fonts.
- static void set_direct_write_factory(IDWriteFactory* factory) {
- direct_write_factory_ = factory;
+ // Called once during initialization if should be retrieving font metrics
+ // from skia.
+ static void set_use_skia_for_font_metrics(bool use_skia_for_font_metrics) {
+ use_skia_for_font_metrics_ = use_skia_for_font_metrics;
}
private:
@@ -161,12 +161,11 @@ class GFX_EXPORT PlatformFontWin : public PlatformFont {
// |base_font|.
static Font DeriveWithCorrectedSize(HFONT base_font);
- // Converts the GDI font identified by the |gdi_font| parameter to a
- // DirectWrite compatible HFONT, i.e with metrics compatible with
- // DirectWrite.
- // Returns the HFONT which is created from DirectWrite compatible font
+ // Creates and returns a new HFONTRef from the specified HFONT using metrics
scottmg 2014/11/01 00:39:15 nit; HFONTRef -> HFontRef
ananta 2014/11/01 00:56:13 Cutpasted this from the other functions. Fixed eve
+ // from skia. Currently this is only used if we use DirectWrite for font
// metrics.
- static HFONT ConvertGDIFontToDirectWriteFont(HFONT gdi_font);
+ static PlatformFontWin::HFontRef* CreateHFontRefFromSkia(
+ HFONT gdi_font);
// Creates a new PlatformFontWin with the specified HFontRef. Used when
// constructing a Font from a HFONT we don't want to copy.
@@ -178,9 +177,9 @@ class GFX_EXPORT PlatformFontWin : public PlatformFont {
// Indirect reference to the HFontRef, which references the underlying HFONT.
scoped_refptr<HFontRef> font_ref_;
- // Pointer to the global IDWriteFactory interface. This is only set if we are
- // using DirectWrite for fonts. Defaults to NULL.
- static IDWriteFactory* direct_write_factory_;
+ // Set to true if font metrics are to be retrieved from skia. Defaults to
+ // false.
+ static bool use_skia_for_font_metrics_;
DISALLOW_COPY_AND_ASSIGN(PlatformFontWin);
};

Powered by Google App Engine
This is Rietveld 408576698