dwrite: Implement GetGlyphCount().
This commit is contained in:
parent
9d93af793d
commit
c949ff5d24
|
@ -160,6 +160,7 @@ extern HRESULT freetype_get_design_glyph_metrics(IDWriteFontFace2*,UINT16,UINT16
|
|||
extern void freetype_notify_cacheremove(IDWriteFontFace2*) DECLSPEC_HIDDEN;
|
||||
extern BOOL freetype_is_monospaced(IDWriteFontFace2*) DECLSPEC_HIDDEN;
|
||||
extern HRESULT freetype_get_glyph_outline(IDWriteFontFace2*,FLOAT,UINT16,USHORT,struct glyph_outline**) DECLSPEC_HIDDEN;
|
||||
extern UINT16 freetype_get_glyphcount(IDWriteFontFace2*) DECLSPEC_HIDDEN;
|
||||
|
||||
/* Glyph shaping */
|
||||
enum SCRIPT_JUSTIFY
|
||||
|
|
|
@ -349,8 +349,8 @@ static void WINAPI dwritefontface_GetMetrics(IDWriteFontFace2 *iface, DWRITE_FON
|
|||
static UINT16 WINAPI dwritefontface_GetGlyphCount(IDWriteFontFace2 *iface)
|
||||
{
|
||||
struct dwrite_fontface *This = impl_from_IDWriteFontFace2(iface);
|
||||
FIXME("(%p): stub\n", This);
|
||||
return 0;
|
||||
TRACE("(%p)\n", This);
|
||||
return freetype_get_glyphcount(iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI dwritefontface_GetDesignGlyphMetrics(IDWriteFontFace2 *iface,
|
||||
|
|
|
@ -375,6 +375,19 @@ HRESULT freetype_get_glyph_outline(IDWriteFontFace2 *fontface, FLOAT emSize, UIN
|
|||
return hr;
|
||||
}
|
||||
|
||||
UINT16 freetype_get_glyphcount(IDWriteFontFace2 *fontface)
|
||||
{
|
||||
UINT16 count = 0;
|
||||
FT_Face face;
|
||||
|
||||
EnterCriticalSection(&freetype_cs);
|
||||
if (pFTC_Manager_LookupFace(cache_manager, fontface, &face) == 0)
|
||||
count = face->num_glyphs;
|
||||
LeaveCriticalSection(&freetype_cs);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
#else /* HAVE_FREETYPE */
|
||||
|
||||
BOOL init_freetype(void)
|
||||
|
@ -406,4 +419,9 @@ HRESULT freetype_get_glyph_outline(IDWriteFontFace2 *fontface, FLOAT emSize, UIN
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
UINT16 freetype_get_glyphcount(IDWriteFontFace2 *fontface)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* HAVE_FREETYPE */
|
||||
|
|
|
@ -75,7 +75,7 @@ static void create_testfontfile(const WCHAR *filename)
|
|||
HRSRC res;
|
||||
void *ptr;
|
||||
file = CreateFileW(filename, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0 );
|
||||
ok( file != INVALID_HANDLE_VALUE, "file creation failed\n" );
|
||||
ok(file != INVALID_HANDLE_VALUE, "file creation failed, error %d\n", GetLastError());
|
||||
|
||||
res = FindResourceA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(1), (LPCSTR)RT_RCDATA);
|
||||
ok( res != 0, "couldn't find resource\n" );
|
||||
|
@ -2994,8 +2994,10 @@ static void test_GetCaretMetrics(void)
|
|||
ok(caret.slopeRun == 0, "got %d\n", caret.slopeRun);
|
||||
ok(caret.offset == 0, "got %d\n", caret.offset);
|
||||
IDWriteFontFace1_Release(fontface1);
|
||||
IDWriteFactory_Release(factory);
|
||||
|
||||
/* now with Tahoma Normal */
|
||||
factory = create_factory();
|
||||
font = get_tahoma_instance(factory, DWRITE_FONT_STYLE_NORMAL);
|
||||
hr = IDWriteFont_CreateFontFace(font, &fontface);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
@ -3033,6 +3035,32 @@ static void test_GetCaretMetrics(void)
|
|||
DeleteFileW(test_fontfile);
|
||||
}
|
||||
|
||||
static void test_GetGlyphCount(void)
|
||||
{
|
||||
IDWriteFontFace *fontface;
|
||||
IDWriteFactory *factory;
|
||||
IDWriteFontFile *file;
|
||||
HRESULT hr;
|
||||
UINT16 count;
|
||||
|
||||
create_testfontfile(test_fontfile);
|
||||
factory = create_factory();
|
||||
|
||||
hr = IDWriteFactory_CreateFontFileReference(factory, test_fontfile, NULL, &file);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
hr = IDWriteFactory_CreateFontFace(factory, DWRITE_FONT_FACE_TYPE_TRUETYPE, 1, &file, 0, DWRITE_FONT_SIMULATIONS_NONE, &fontface);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
IDWriteFontFile_Release(file);
|
||||
|
||||
count = IDWriteFontFace_GetGlyphCount(fontface);
|
||||
ok(count == 7, "got %u\n", count);
|
||||
|
||||
IDWriteFontFace_Release(fontface);
|
||||
IDWriteFactory_Release(factory);
|
||||
DeleteFileW(test_fontfile);
|
||||
}
|
||||
|
||||
START_TEST(font)
|
||||
{
|
||||
IDWriteFactory *factory;
|
||||
|
@ -3072,6 +3100,7 @@ START_TEST(font)
|
|||
test_GetGlyphRunOutline();
|
||||
test_GetEudcFontCollection();
|
||||
test_GetCaretMetrics();
|
||||
test_GetGlyphCount();
|
||||
|
||||
IDWriteFactory_Release(factory);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue