[PATCH 2/2] dwrite: Added a helper to check for supported characters
Nikolay Sivov
nsivov at codeweavers.com
Thu Aug 10 00:52:15 CDT 2017
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/dwrite/font.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c
index 9002e7269c..f64caa77fd 100644
--- a/dlls/dwrite/font.c
+++ b/dlls/dwrite/font.c
@@ -1188,7 +1188,7 @@ static BOOL WINAPI dwritefontface3_HasCharacter(IDWriteFontFace4 *iface, UINT32
struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface);
UINT16 index;
- TRACE("(%p)->(0x%08x)\n", This, ch);
+ TRACE("(%p)->(0x%#x)\n", This, ch);
index = 0;
if (FAILED(fontface_get_glyphs(This, &ch, 1, &index)))
@@ -1562,31 +1562,37 @@ static void WINAPI dwritefont_GetMetrics(IDWriteFont3 *iface, DWRITE_FONT_METRIC
memcpy(metrics, &This->data->metrics, sizeof(*metrics));
}
-static HRESULT WINAPI dwritefont_HasCharacter(IDWriteFont3 *iface, UINT32 value, BOOL *exists)
+static HRESULT font_has_character(struct dwrite_font *font, UINT32 ch, BOOL *exists)
{
- struct dwrite_font *This = impl_from_IDWriteFont3(iface);
IDWriteFontFace4 *fontface;
UINT16 index;
HRESULT hr;
- TRACE("(%p)->(0x%08x %p)\n", This, value, exists);
-
*exists = FALSE;
- hr = get_fontface_from_font(This, &fontface);
+ hr = get_fontface_from_font(font, &fontface);
if (FAILED(hr))
return hr;
index = 0;
- hr = IDWriteFontFace4_GetGlyphIndices(fontface, &value, 1, &index);
+ hr = IDWriteFontFace4_GetGlyphIndices(fontface, &ch, 1, &index);
+ IDWriteFontFace4_Release(fontface);
if (FAILED(hr))
return hr;
- IDWriteFontFace4_Release(fontface);
*exists = index != 0;
return S_OK;
}
+static HRESULT WINAPI dwritefont_HasCharacter(IDWriteFont3 *iface, UINT32 ch, BOOL *exists)
+{
+ struct dwrite_font *This = impl_from_IDWriteFont3(iface);
+
+ TRACE("(%p)->(0x%#x %p)\n", This, ch, exists);
+
+ return font_has_character(This, ch, exists);
+}
+
static HRESULT WINAPI dwritefont_CreateFontFace(IDWriteFont3 *iface, IDWriteFontFace **fontface)
{
struct dwrite_font *This = impl_from_IDWriteFont3(iface);
@@ -1690,13 +1696,11 @@ static HRESULT WINAPI dwritefont3_GetFontFaceReference(IDWriteFont3 *iface, IDWr
static BOOL WINAPI dwritefont3_HasCharacter(IDWriteFont3 *iface, UINT32 ch)
{
struct dwrite_font *This = impl_from_IDWriteFont3(iface);
- HRESULT hr;
BOOL ret;
- TRACE("(%p)->(0x%x)\n", This, ch);
+ TRACE("(%p)->(0x%#x)\n", This, ch);
- hr = IDWriteFont_HasCharacter((IDWriteFont*)iface, ch, &ret);
- return hr == S_OK && ret;
+ return font_has_character(This, ch, &ret) == S_OK && ret;
}
static DWRITE_LOCALITY WINAPI dwritefont3_GetLocality(IDWriteFont3 *iface)
--
2.13.2
More information about the wine-patches
mailing list