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

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 build error 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
« no previous file with comments | « content/browser/browser_main_runner.cc ('k') | ui/gfx/platform_font_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..eaed10cc68db1e98cf35834c4f4c0b4b16af8b70 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:
@@ -150,10 +150,10 @@ class GFX_EXPORT PlatformFontWin : public PlatformFont {
// UI thread.
static HFontRef* GetBaseFontRef();
- // Creates and returns a new HFONTRef from the specified HFONT.
+ // Creates and returns a new HFontRef from the specified HFONT.
static HFontRef* CreateHFontRef(HFONT font);
- // Creates and returns a new HFONTRef from the specified HFONT. Uses provided
+ // Creates and returns a new HFontRef from the specified HFONT. Uses provided
// |font_metrics| instead of calculating new one.
static HFontRef* CreateHFontRef(HFONT font, const TEXTMETRIC& font_metrics);
@@ -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
+ // 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);
};
« no previous file with comments | « content/browser/browser_main_runner.cc ('k') | ui/gfx/platform_font_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698