4 * Copyright 2012 Nikolay Sivov for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "dwrite_private.h"
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
31 IDWriteFont IDWriteFont_iface;
34 DWRITE_FONT_STYLE style;
37 static inline struct dwrite_font *impl_from_IDWriteFont(IDWriteFont *iface)
39 return CONTAINING_RECORD(iface, struct dwrite_font, IDWriteFont_iface);
42 static HRESULT WINAPI dwritefont_QueryInterface(IDWriteFont *iface, REFIID riid, void **obj)
44 struct dwrite_font *This = impl_from_IDWriteFont(iface);
46 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
48 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDWriteFont))
51 IDWriteFont_AddRef(iface);
59 static ULONG WINAPI dwritefont_AddRef(IDWriteFont *iface)
61 struct dwrite_font *This = impl_from_IDWriteFont(iface);
62 ULONG ref = InterlockedIncrement(&This->ref);
63 TRACE("(%p)->(%d)\n", This, ref);
67 static ULONG WINAPI dwritefont_Release(IDWriteFont *iface)
69 struct dwrite_font *This = impl_from_IDWriteFont(iface);
70 ULONG ref = InterlockedDecrement(&This->ref);
72 TRACE("(%p)->(%d)\n", This, ref);
80 static HRESULT WINAPI dwritefont_GetFontFamily(IDWriteFont *iface, IDWriteFontFamily **family)
82 struct dwrite_font *This = impl_from_IDWriteFont(iface);
83 FIXME("(%p)->(%p): stub\n", This, family);
87 static DWRITE_FONT_WEIGHT WINAPI dwritefont_GetWeight(IDWriteFont *iface)
89 struct dwrite_font *This = impl_from_IDWriteFont(iface);
90 FIXME("(%p): stub\n", This);
94 static DWRITE_FONT_STRETCH WINAPI dwritefont_GetStretch(IDWriteFont *iface)
96 struct dwrite_font *This = impl_from_IDWriteFont(iface);
97 FIXME("(%p): stub\n", This);
98 return DWRITE_FONT_STRETCH_UNDEFINED;
101 static DWRITE_FONT_STYLE WINAPI dwritefont_GetStyle(IDWriteFont *iface)
103 struct dwrite_font *This = impl_from_IDWriteFont(iface);
104 TRACE("(%p)\n", This);
108 static BOOL WINAPI dwritefont_IsSymbolFont(IDWriteFont *iface)
110 struct dwrite_font *This = impl_from_IDWriteFont(iface);
111 FIXME("(%p): stub\n", This);
115 static HRESULT WINAPI dwritefont_GetFaceNames(IDWriteFont *iface, IDWriteLocalizedStrings **names)
117 struct dwrite_font *This = impl_from_IDWriteFont(iface);
118 FIXME("(%p)->(%p): stub\n", This, names);
122 static HRESULT WINAPI dwritefont_GetInformationalStrings(IDWriteFont *iface,
123 DWRITE_INFORMATIONAL_STRING_ID stringid, IDWriteLocalizedStrings **strings, BOOL *exists)
125 struct dwrite_font *This = impl_from_IDWriteFont(iface);
126 FIXME("(%p)->(%d %p %p): stub\n", This, stringid, strings, exists);
130 static DWRITE_FONT_SIMULATIONS WINAPI dwritefont_GetSimulations(IDWriteFont *iface)
132 struct dwrite_font *This = impl_from_IDWriteFont(iface);
133 FIXME("(%p): stub\n", This);
134 return DWRITE_FONT_SIMULATIONS_NONE;
137 static void WINAPI dwritefont_GetMetrics(IDWriteFont *iface, DWRITE_FONT_METRICS *metrics)
139 struct dwrite_font *This = impl_from_IDWriteFont(iface);
140 FIXME("(%p)->(%p): stub\n", This, metrics);
143 static HRESULT WINAPI dwritefont_HasCharacter(IDWriteFont *iface, UINT32 value, BOOL *exists)
145 struct dwrite_font *This = impl_from_IDWriteFont(iface);
146 FIXME("(%p)->(0x%08x %p): stub\n", This, value, exists);
150 static HRESULT WINAPI dwritefont_CreateFontFace(IDWriteFont *iface, IDWriteFontFace **face)
152 struct dwrite_font *This = impl_from_IDWriteFont(iface);
153 FIXME("(%p)->(%p): stub\n", This, face);
157 static const IDWriteFontVtbl dwritefontvtbl = {
158 dwritefont_QueryInterface,
161 dwritefont_GetFontFamily,
162 dwritefont_GetWeight,
163 dwritefont_GetStretch,
165 dwritefont_IsSymbolFont,
166 dwritefont_GetFaceNames,
167 dwritefont_GetInformationalStrings,
168 dwritefont_GetSimulations,
169 dwritefont_GetMetrics,
170 dwritefont_HasCharacter,
171 dwritefont_CreateFontFace
174 HRESULT create_font_from_logfont(const LOGFONTW *logfont, IDWriteFont **font)
176 struct dwrite_font *This;
180 This = heap_alloc(sizeof(struct dwrite_font));
181 if (!This) return E_OUTOFMEMORY;
183 This->IDWriteFont_iface.lpVtbl = &dwritefontvtbl;
186 This->style = logfont->lfItalic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL;
188 *font = &This->IDWriteFont_iface;