[PATCH 1/2 v2] dwrite: Ask freetype once about kerning pairs support and monospaced property
Nikolay Sivov
nsivov at codeweavers.com
Thu Jan 21 12:58:40 CST 2016
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
v2: fixed implementation to return 0/1 for these properties
dlls/dwrite/font.c | 10 +++++++---
dlls/dwrite/freetype.c | 4 ++--
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c
index 4640de9..dab7322 100644
--- a/dlls/dwrite/font.c
+++ b/dlls/dwrite/font.c
@@ -2,7 +2,7 @@
* Font and collections
*
* Copyright 2011 Huw Davies
- * Copyright 2012, 2014-2015 Nikolay Sivov for CodeWeavers
+ * Copyright 2012, 2014-2016 Nikolay Sivov for CodeWeavers
* Copyright 2014 Aric Stewart for CodeWeavers
*
* This library is free software; you can redistribute it and/or
@@ -202,6 +202,8 @@ struct dwrite_fontface {
DWRITE_CARET_METRICS caret;
INT charmap;
BOOL is_symbol;
+ BOOL has_kerning_pairs : 1;
+ BOOL is_monospaced : 1;
struct dwrite_fonttable cmap;
struct dwrite_fonttable vdmx;
@@ -808,7 +810,7 @@ static BOOL WINAPI dwritefontface1_IsMonospacedFont(IDWriteFontFace2 *iface)
{
struct dwrite_fontface *This = impl_from_IDWriteFontFace2(iface);
TRACE("(%p)\n", This);
- return freetype_is_monospaced(iface);
+ return This->is_monospaced;
}
static HRESULT WINAPI dwritefontface1_GetDesignGlyphAdvances(IDWriteFontFace2 *iface,
@@ -889,7 +891,7 @@ static BOOL WINAPI dwritefontface1_HasKerningPairs(IDWriteFontFace2 *iface)
{
struct dwrite_fontface *This = impl_from_IDWriteFontFace2(iface);
TRACE("(%p)\n", This);
- return freetype_has_kerning_pairs(iface);
+ return This->has_kerning_pairs;
}
static HRESULT WINAPI dwritefontface1_GetRecommendedRenderingMode(IDWriteFontFace2 *iface,
@@ -3623,6 +3625,8 @@ HRESULT create_fontface(DWRITE_FONT_FACE_TYPE facetype, UINT32 files_number, IDW
}
}
fontface->charmap = freetype_get_charmap_index(&fontface->IDWriteFontFace2_iface, &fontface->is_symbol);
+ fontface->has_kerning_pairs = freetype_has_kerning_pairs(&fontface->IDWriteFontFace2_iface);
+ fontface->is_monospaced = freetype_is_monospaced(&fontface->IDWriteFontFace2_iface);
*ret = &fontface->IDWriteFontFace2_iface;
return S_OK;
diff --git a/dlls/dwrite/freetype.c b/dlls/dwrite/freetype.c
index f4b824c..ba946a8 100644
--- a/dlls/dwrite/freetype.c
+++ b/dlls/dwrite/freetype.c
@@ -263,7 +263,7 @@ BOOL freetype_is_monospaced(IDWriteFontFace2 *fontface)
EnterCriticalSection(&freetype_cs);
if (pFTC_Manager_LookupFace(cache_manager, fontface, &face) == 0)
- is_monospaced = FT_IS_FIXED_WIDTH(face);
+ is_monospaced = !!FT_IS_FIXED_WIDTH(face);
LeaveCriticalSection(&freetype_cs);
return is_monospaced;
@@ -520,7 +520,7 @@ BOOL freetype_has_kerning_pairs(IDWriteFontFace2 *fontface)
EnterCriticalSection(&freetype_cs);
if (pFTC_Manager_LookupFace(cache_manager, fontface, &face) == 0)
- has_kerning_pairs = FT_HAS_KERNING(face);
+ has_kerning_pairs = !!FT_HAS_KERNING(face);
LeaveCriticalSection(&freetype_cs);
return has_kerning_pairs;
--
2.7.0.rc3
More information about the wine-patches
mailing list