Nikolay Sivov : dwrite: Store text format properties.
Alexandre Julliard
julliard at winehq.org
Fri Oct 12 11:37:45 CDT 2012
Module: wine
Branch: master
Commit: 2c0c4132247b670f964e6aba99b4f7515653024c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2c0c4132247b670f964e6aba99b4f7515653024c
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Oct 12 09:12:57 2012 -0400
dwrite: Store text format properties.
---
dlls/dwrite/dwrite_private.h | 3 ++-
dlls/dwrite/layout.c | 21 ++++++++++++++++++++-
dlls/dwrite/main.c | 8 ++++++--
3 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h
index c569495..d5890bb 100644
--- a/dlls/dwrite/dwrite_private.h
+++ b/dlls/dwrite/dwrite_private.h
@@ -54,7 +54,8 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
}
extern HRESULT create_font_from_logfont(const LOGFONTW*, IDWriteFont**) DECLSPEC_HIDDEN;
-extern HRESULT create_textformat(IDWriteTextFormat**) DECLSPEC_HIDDEN;
+extern HRESULT create_textformat(const WCHAR*,DWRITE_FONT_WEIGHT,DWRITE_FONT_STYLE,DWRITE_FONT_STRETCH,
+ FLOAT,const WCHAR*,IDWriteTextFormat**) DECLSPEC_HIDDEN;
extern HRESULT create_textlayout(IDWriteTextLayout**) DECLSPEC_HIDDEN;
extern HRESULT create_gdiinterop(IDWriteGdiInterop**) DECLSPEC_HIDDEN;
extern HRESULT create_localizedstrings(IDWriteLocalizedStrings**) DECLSPEC_HIDDEN;
diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c
index bb48a51..64f3c0d 100644
--- a/dlls/dwrite/layout.c
+++ b/dlls/dwrite/layout.c
@@ -40,6 +40,15 @@ struct dwrite_textlayout {
struct dwrite_textformat {
IDWriteTextFormat IDWriteTextFormat_iface;
LONG ref;
+
+ WCHAR *family_name;
+ WCHAR *locale;
+
+ DWRITE_FONT_WEIGHT weight;
+ DWRITE_FONT_STYLE style;
+ DWRITE_FONT_STRETCH stretch;
+
+ FLOAT size;
};
static inline struct dwrite_textlayout *impl_from_IDWriteTextLayout(IDWriteTextLayout *iface)
@@ -689,7 +698,11 @@ static ULONG WINAPI dwritetextformat_Release(IDWriteTextFormat *iface)
TRACE("(%p)->(%d)\n", This, ref);
if (!ref)
+ {
+ heap_free(This->family_name);
+ heap_free(This->locale);
heap_free(This);
+ }
return S_OK;
}
@@ -904,7 +917,8 @@ static const IDWriteTextFormatVtbl dwritetextformatvtbl = {
dwritetextformat_GetLocaleName
};
-HRESULT create_textformat(IDWriteTextFormat **format)
+HRESULT create_textformat(const WCHAR *family_name, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STYLE style,
+ DWRITE_FONT_STRETCH stretch, FLOAT size, const WCHAR *locale, IDWriteTextFormat **format)
{
struct dwrite_textformat *This;
@@ -913,6 +927,11 @@ HRESULT create_textformat(IDWriteTextFormat **format)
This->IDWriteTextFormat_iface.lpVtbl = &dwritetextformatvtbl;
This->ref = 1;
+ This->family_name = heap_strdupW(family_name);
+ This->locale = heap_strdupW(locale);
+ This->weight = weight;
+ This->style = style;
+ This->size = size;
*format = &This->IDWriteTextFormat_iface;
diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c
index 7b54710..20aed56 100644
--- a/dlls/dwrite/main.c
+++ b/dlls/dwrite/main.c
@@ -479,9 +479,13 @@ static HRESULT WINAPI dwritefactory_CreateTextFormat(IDWriteFactory *iface, WCHA
IDWriteFontCollection *collection, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STYLE style,
DWRITE_FONT_STRETCH stretch, FLOAT size, WCHAR const *locale, IDWriteTextFormat **format)
{
- FIXME("(%s %p %d %d %d %f %s %p): semi-stub\n", debugstr_w(family_name), collection, weight, style, stretch,
+ TRACE("(%s %p %d %d %d %f %s %p)\n", debugstr_w(family_name), collection, weight, style, stretch,
size, debugstr_w(locale), format);
- return create_textformat(format);
+
+ if (collection)
+ FIXME("font collection not supported\n");
+
+ return create_textformat(family_name, weight, style, stretch, size, locale, format);
}
static HRESULT WINAPI dwritefactory_CreateTypography(IDWriteFactory *iface, IDWriteTypography **typography)
More information about the wine-cvs
mailing list