dwrite: Ask freetype once about kerning pairs support and monospaced property.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-01-21 21:58:40 +03:00 committed by Alexandre Julliard
parent ed16704cea
commit ed3b5a42be
2 changed files with 9 additions and 5 deletions

View File

@ -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;

View File

@ -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;