dwrite: Create IDWriteFontFace2 instance for IDWriteFont.

This commit is contained in:
Nikolay Sivov 2014-10-16 09:47:43 +04:00 committed by Alexandre Julliard
parent 460363535e
commit d02d35a7b1
9 changed files with 16 additions and 30 deletions

View File

@ -21,8 +21,6 @@
#define COBJMACROS
#include "dwrite.h"
#include "dwrite_2.h"
#include "dwrite_private.h"
#include "scripts.h"

View File

@ -48,7 +48,6 @@
#include "wine/debug.h"
#include "wine/list.h"
#include "dwrite_1.h"
#include "dwrite_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(bidi);

View File

@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "dwrite_2.h"
#include "wine/debug.h"
#include "wine/unicode.h"
@ -103,7 +105,7 @@ extern HRESULT get_system_fontcollection(IDWriteFontCollection**) DECLSPEC_HIDDE
extern HRESULT get_textanalyzer(IDWriteTextAnalyzer**) DECLSPEC_HIDDEN;
extern HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *reference_key, UINT32 key_size, IDWriteFontFile **font_file) DECLSPEC_HIDDEN;
extern HRESULT create_localfontfileloader(IDWriteLocalFontFileLoader** iface) DECLSPEC_HIDDEN;
extern HRESULT font_create_fontface(IDWriteFactory *iface, DWRITE_FONT_FACE_TYPE facetype, UINT32 files_number, IDWriteFontFile* const* font_files, UINT32 index, DWRITE_FONT_SIMULATIONS sim_flags, IDWriteFontFace **font_face) DECLSPEC_HIDDEN;
extern HRESULT font_create_fontface(IDWriteFactory*,DWRITE_FONT_FACE_TYPE,UINT32,IDWriteFontFile* const*,UINT32,DWRITE_FONT_SIMULATIONS,IDWriteFontFace2 **) DECLSPEC_HIDDEN;
/* Opentype font table functions */
extern HRESULT opentype_analyze_font(IDWriteFontFileStream*,UINT32*,DWRITE_FONT_FILE_TYPE*,DWRITE_FONT_FACE_TYPE*,BOOL*) DECLSPEC_HIDDEN;

View File

@ -20,8 +20,6 @@
#define COBJMACROS
#include "dwrite.h"
#include "dwrite_2.h"
#include "dwrite_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
@ -93,7 +91,7 @@ struct dwrite_font {
BOOL is_system;
IDWriteFontFamily *family;
IDWriteFontFace *face;
IDWriteFontFace2 *face;
struct dwrite_font_data *data;
};
@ -689,7 +687,7 @@ static const IDWriteFontFace2Vtbl dwritefontfacevtbl = {
dwritefontface2_GetRecommendedRenderingMode
};
static HRESULT create_system_fontface(struct dwrite_font *font, IDWriteFontFace **face)
static HRESULT create_system_fontface(struct dwrite_font *font, IDWriteFontFace2 **face)
{
struct dwrite_fontface *This;
@ -722,7 +720,7 @@ static HRESULT create_system_fontface(struct dwrite_font *font, IDWriteFontFace
This->logfont.lfWeight = font->data->weight;
strcpyW(This->logfont.lfFaceName, font->data->facename);
*face = (IDWriteFontFace*)&This->IDWriteFontFace2_iface;
*face = &This->IDWriteFontFace2_iface;
return S_OK;
}
@ -736,7 +734,7 @@ HRESULT convert_fontface_to_logfont(IDWriteFontFace *face, LOGFONTW *logfont)
return S_OK;
}
static HRESULT get_fontface_from_font(struct dwrite_font *font, IDWriteFontFace **fontface)
static HRESULT get_fontface_from_font(struct dwrite_font *font, IDWriteFontFace2 **fontface)
{
*fontface = NULL;
@ -788,7 +786,7 @@ static ULONG WINAPI dwritefont_Release(IDWriteFont2 *iface)
if (!ref)
{
if (This->face) IDWriteFontFace_Release(This->face);
if (This->face) IDWriteFontFace2_Release(This->face);
if (This->family) IDWriteFontFamily_Release(This->family);
_free_font_data(This->data);
heap_free(This);
@ -868,7 +866,7 @@ static void WINAPI dwritefont_GetMetrics(IDWriteFont2 *iface, DWRITE_FONT_METRIC
static HRESULT WINAPI dwritefont_HasCharacter(IDWriteFont2 *iface, UINT32 value, BOOL *exists)
{
struct dwrite_font *This = impl_from_IDWriteFont2(iface);
IDWriteFontFace *fontface;
IDWriteFontFace2 *fontface;
UINT16 index;
HRESULT hr;
@ -881,7 +879,7 @@ static HRESULT WINAPI dwritefont_HasCharacter(IDWriteFont2 *iface, UINT32 value,
return hr;
index = 0;
hr = IDWriteFontFace_GetGlyphIndices(fontface, &value, 1, &index);
hr = IDWriteFontFace2_GetGlyphIndices(fontface, &value, 1, &index);
if (FAILED(hr))
return hr;
@ -896,7 +894,7 @@ static HRESULT WINAPI dwritefont_CreateFontFace(IDWriteFont2 *iface, IDWriteFont
TRACE("(%p)->(%p)\n", This, face);
hr = get_fontface_from_font(This, face);
hr = get_fontface_from_font(This, (IDWriteFontFace2**)face);
if (hr == S_OK)
IDWriteFontFace_AddRef(*face);
@ -918,8 +916,7 @@ static void WINAPI dwritefont1_GetPanose(IDWriteFont2 *iface, DWRITE_PANOSE *pan
static HRESULT WINAPI dwritefont1_GetUnicodeRanges(IDWriteFont2 *iface, UINT32 max_count, DWRITE_UNICODE_RANGE *ranges, UINT32 *count)
{
struct dwrite_font *This = impl_from_IDWriteFont2(iface);
IDWriteFontFace2 *fontface2;
IDWriteFontFace *fontface;
IDWriteFontFace2 *fontface;
HRESULT hr;
TRACE("(%p)->(%u %p %p)\n", This, max_count, ranges, count);
@ -928,11 +925,7 @@ static HRESULT WINAPI dwritefont1_GetUnicodeRanges(IDWriteFont2 *iface, UINT32 m
if (FAILED(hr))
return hr;
IDWriteFontFace_QueryInterface(fontface, &IID_IDWriteFontFace2, (void**)&fontface2);
hr = IDWriteFontFace2_GetUnicodeRanges(fontface2, max_count, ranges, count);
IDWriteFontFace2_Release(fontface2);
return hr;
return IDWriteFontFace2_GetUnicodeRanges(fontface, max_count, ranges, count);
}
static HRESULT WINAPI dwritefont1_IsMonospacedFont(IDWriteFont2 *iface)
@ -1652,7 +1645,7 @@ HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *reference_ke
return S_OK;
}
HRESULT font_create_fontface(IDWriteFactory *iface, DWRITE_FONT_FACE_TYPE facetype, UINT32 files_number, IDWriteFontFile* const* font_files, UINT32 index, DWRITE_FONT_SIMULATIONS sim_flags, IDWriteFontFace **font_face)
HRESULT font_create_fontface(IDWriteFactory *iface, DWRITE_FONT_FACE_TYPE facetype, UINT32 files_number, IDWriteFontFile* const* font_files, UINT32 index, DWRITE_FONT_SIMULATIONS sim_flags, IDWriteFontFace2 **font_face)
{
int i;
struct dwrite_fontface *This;
@ -1706,7 +1699,7 @@ HRESULT font_create_fontface(IDWriteFactory *iface, DWRITE_FONT_FACE_TYPE facety
This->data->simulations = sim_flags;
This->is_system = FALSE;
*font_face = (IDWriteFontFace*)&This->IDWriteFontFace2_iface;
*font_face = &This->IDWriteFontFace2_iface;
return S_OK;
}

View File

@ -25,7 +25,6 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "dwrite_1.h"
#include "dwrite_private.h"
#include "wine/debug.h"

View File

@ -25,7 +25,6 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "dwrite_2.h"
#include "dwrite_private.h"
#include "wine/list.h"

View File

@ -27,8 +27,6 @@
#include "winuser.h"
#include "initguid.h"
#include "dwrite.h"
#include "dwrite_2.h"
#include "dwrite_private.h"
#include "wine/debug.h"
@ -609,7 +607,7 @@ static HRESULT WINAPI dwritefactory_CreateFontFace(IDWriteFactory *iface,
{
struct dwritefactory *This = impl_from_IDWriteFactory(iface);
TRACE("(%p)->(%d %u %p %u 0x%x %p)\n", This, facetype, files_number, font_files, index, sim_flags, font_face);
return font_create_fontface(iface, facetype, files_number, font_files, index, sim_flags, font_face);
return font_create_fontface(iface, facetype, files_number, font_files, index, sim_flags, (IDWriteFontFace2**)font_face);
}
static HRESULT WINAPI dwritefactory_CreateRenderingParams(IDWriteFactory *iface, IDWriteRenderingParams **params)

View File

@ -20,7 +20,6 @@
#define COBJMACROS
#include "dwrite_1.h"
#include "dwrite_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dwrite);

View File

@ -21,7 +21,6 @@
#define COBJMACROS
#include "dwrite_1.h"
#include "dwrite_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dwrite);