Nikolay Sivov : dwrite: Ask freetype once about kerning pairs support and monospaced property.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Jan 22 08:30:20 CST 2016
Module: wine
Branch: master
Commit: ed3b5a42bea0271297ef6fca2cadcb598738c806
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ed3b5a42bea0271297ef6fca2cadcb598738c806
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Thu Jan 21 21:58:40 2016 +0300
dwrite: Ask freetype once about kerning pairs support and monospaced property.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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;
More information about the wine-cvs
mailing list