blob: e662b7be1f832ef4a8157a5eeaf73e2e8f69be9c [file] [log] [blame]
Alexandre Julliard401710d1993-09-04 10:09:32 +00001/*
2 * GDI font objects
3 *
4 * Copyright 1993 Alexandre Julliard
Alexandre Julliard23946ad1997-06-16 17:43:53 +00005 * 1997 Alex Korobka
Alexandre Julliard7e56f681996-01-31 19:02:28 +00006 */
Alexandre Julliard401710d1993-09-04 10:09:32 +00007
Alexandre Julliard401710d1993-09-04 10:09:32 +00008#include <stdlib.h>
Alexandre Julliard8d24ae61994-04-05 21:42:43 +00009#include <string.h>
Marcus Meissner317af321999-02-17 13:51:06 +000010#include "wine/winestring.h"
Alexandre Julliard7cbe6571995-01-09 18:21:16 +000011#include "font.h"
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +000012#include "heap.h"
Alexandre Julliard234bc241994-12-10 13:02:28 +000013#include "metafile.h"
Alexandre Julliard7e56f681996-01-31 19:02:28 +000014#include "options.h"
Alexandre Julliard06c275a1999-05-02 14:32:27 +000015#include "debugtools.h"
Alexandre Julliard767e6f61998-08-09 12:47:43 +000016#include "winerror.h"
Huw D M Davies7603dea1999-04-25 09:24:23 +000017#include "dc.h"
Alexandre Julliard401710d1993-09-04 10:09:32 +000018
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +000019DEFAULT_DEBUG_CHANNEL(font)
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000020DECLARE_DEBUG_CHANNEL(gdi)
21
Alexandre Julliard23946ad1997-06-16 17:43:53 +000022#define ENUM_UNICODE 0x00000001
Alexandre Julliard401710d1993-09-04 10:09:32 +000023
Alexandre Julliard23946ad1997-06-16 17:43:53 +000024typedef struct
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +000025{
Alexandre Julliard23946ad1997-06-16 17:43:53 +000026 LPLOGFONT16 lpLogFontParam;
27 FONTENUMPROCEX16 lpEnumFunc;
28 LPARAM lpData;
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +000029
Alexandre Julliard23946ad1997-06-16 17:43:53 +000030 LPNEWTEXTMETRICEX16 lpTextMetric;
31 LPENUMLOGFONTEX16 lpLogFont;
32 SEGPTR segTextMetric;
33 SEGPTR segLogFont;
34} fontEnum16;
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +000035
Alexandre Julliard23946ad1997-06-16 17:43:53 +000036typedef struct
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +000037{
Alexandre Julliarda3960291999-02-26 11:11:13 +000038 LPLOGFONTW lpLogFontParam;
Ulrich Czekallae6ab9d31999-10-24 17:26:45 +000039 FONTENUMPROCEXW lpEnumFunc;
Alexandre Julliard23946ad1997-06-16 17:43:53 +000040 LPARAM lpData;
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +000041
Alexandre Julliarda3960291999-02-26 11:11:13 +000042 LPNEWTEXTMETRICEXW lpTextMetric;
43 LPENUMLOGFONTEXW lpLogFont;
Alexandre Julliard23946ad1997-06-16 17:43:53 +000044 DWORD dwFlags;
45} fontEnum32;
46
Douglas Ridgwayab9e8bc1999-01-01 18:41:22 +000047/*
48 * For TranslateCharsetInfo
49 */
50#define FS(x) {{0,0,0,0},{0x1<<(x),0}}
51#define MAXTCIINDEX 32
52static CHARSETINFO FONT_tci[MAXTCIINDEX] = {
53 /* ANSI */
54 { ANSI_CHARSET, 1252, FS(0)},
55 { EASTEUROPE_CHARSET, 1250, FS(1)},
56 { RUSSIAN_CHARSET, 1251, FS(2)},
57 { GREEK_CHARSET, 1253, FS(3)},
58 { TURKISH_CHARSET, 1254, FS(4)},
59 { HEBREW_CHARSET, 1255, FS(5)},
60 { ARABIC_CHARSET, 1256, FS(6)},
61 { BALTIC_CHARSET, 1257, FS(7)},
62 /* reserved by ANSI */
63 { DEFAULT_CHARSET, 0, FS(0)},
64 { DEFAULT_CHARSET, 0, FS(0)},
65 { DEFAULT_CHARSET, 0, FS(0)},
66 { DEFAULT_CHARSET, 0, FS(0)},
67 { DEFAULT_CHARSET, 0, FS(0)},
68 { DEFAULT_CHARSET, 0, FS(0)},
69 { DEFAULT_CHARSET, 0, FS(0)},
70 { DEFAULT_CHARSET, 0, FS(0)},
71 /* ANSI and OEM */
72 { THAI_CHARSET, 874, FS(16)},
73 { SHIFTJIS_CHARSET, 932, FS(17)},
74 { GB2312_CHARSET, 936, FS(18)},
75 { HANGEUL_CHARSET, 949, FS(19)},
76 { CHINESEBIG5_CHARSET, 950, FS(20)},
77 { JOHAB_CHARSET, 1361, FS(21)},
78 /* reserved for alternate ANSI and OEM */
79 { DEFAULT_CHARSET, 0, FS(0)},
80 { DEFAULT_CHARSET, 0, FS(0)},
81 { DEFAULT_CHARSET, 0, FS(0)},
82 { DEFAULT_CHARSET, 0, FS(0)},
83 { DEFAULT_CHARSET, 0, FS(0)},
84 { DEFAULT_CHARSET, 0, FS(0)},
85 { DEFAULT_CHARSET, 0, FS(0)},
86 { DEFAULT_CHARSET, 0, FS(0)},
87 /* reserved for system */
88 { DEFAULT_CHARSET, 0, FS(0)},
89 { DEFAULT_CHARSET, 0, FS(0)},
90};
91
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +000092/***********************************************************************
Alexandre Julliard23946ad1997-06-16 17:43:53 +000093 * LOGFONT conversion functions.
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +000094 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000095void FONT_LogFont32ATo16( const LOGFONTA* font32, LPLOGFONT16 font16 )
Alexandre Julliarde2991ea1995-07-29 13:09:43 +000096{
Ulrich Weigandd1682aa1999-11-21 02:21:17 +000097 font16->lfHeight = font32->lfHeight;
98 font16->lfWidth = font32->lfWidth;
99 font16->lfEscapement = font32->lfEscapement;
100 font16->lfOrientation = font32->lfOrientation;
101 font16->lfWeight = font32->lfWeight;
102 font16->lfItalic = font32->lfItalic;
103 font16->lfUnderline = font32->lfUnderline;
104 font16->lfStrikeOut = font32->lfStrikeOut;
105 font16->lfCharSet = font32->lfCharSet;
106 font16->lfOutPrecision = font32->lfOutPrecision;
107 font16->lfClipPrecision = font32->lfClipPrecision;
108 font16->lfQuality = font32->lfQuality;
109 font16->lfPitchAndFamily = font32->lfPitchAndFamily;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000110 lstrcpynA( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE );
Alexandre Julliardded30381995-07-06 17:18:27 +0000111}
Alexandre Julliarde2991ea1995-07-29 13:09:43 +0000112
Alexandre Julliarda3960291999-02-26 11:11:13 +0000113void FONT_LogFont32WTo16( const LOGFONTW* font32, LPLOGFONT16 font16 )
Alexandre Julliard21979011997-03-05 08:22:35 +0000114{
Ulrich Weigandd1682aa1999-11-21 02:21:17 +0000115 font16->lfHeight = font32->lfHeight;
116 font16->lfWidth = font32->lfWidth;
117 font16->lfEscapement = font32->lfEscapement;
118 font16->lfOrientation = font32->lfOrientation;
119 font16->lfWeight = font32->lfWeight;
120 font16->lfItalic = font32->lfItalic;
121 font16->lfUnderline = font32->lfUnderline;
122 font16->lfStrikeOut = font32->lfStrikeOut;
123 font16->lfCharSet = font32->lfCharSet;
124 font16->lfOutPrecision = font32->lfOutPrecision;
125 font16->lfClipPrecision = font32->lfClipPrecision;
126 font16->lfQuality = font32->lfQuality;
127 font16->lfPitchAndFamily = font32->lfPitchAndFamily;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000128 lstrcpynWtoA( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE );
Alexandre Julliard21979011997-03-05 08:22:35 +0000129}
130
Alexandre Julliarda3960291999-02-26 11:11:13 +0000131void FONT_LogFont16To32A( const LPLOGFONT16 font16, LPLOGFONTA font32 )
Alexandre Julliard21979011997-03-05 08:22:35 +0000132{
Ulrich Weigandd1682aa1999-11-21 02:21:17 +0000133 font32->lfHeight = font16->lfHeight;
134 font32->lfWidth = font16->lfWidth;
135 font32->lfEscapement = font16->lfEscapement;
136 font32->lfOrientation = font16->lfOrientation;
137 font32->lfWeight = font16->lfWeight;
138 font32->lfItalic = font16->lfItalic;
139 font32->lfUnderline = font16->lfUnderline;
140 font32->lfStrikeOut = font16->lfStrikeOut;
141 font32->lfCharSet = font16->lfCharSet;
142 font32->lfOutPrecision = font16->lfOutPrecision;
143 font32->lfClipPrecision = font16->lfClipPrecision;
144 font32->lfQuality = font16->lfQuality;
145 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000146 lstrcpynA( font32->lfFaceName, font16->lfFaceName, LF_FACESIZE );
Alexandre Julliard21979011997-03-05 08:22:35 +0000147}
148
Alexandre Julliarda3960291999-02-26 11:11:13 +0000149void FONT_LogFont16To32W( const LPLOGFONT16 font16, LPLOGFONTW font32 )
Alexandre Julliard21979011997-03-05 08:22:35 +0000150{
Ulrich Weigandd1682aa1999-11-21 02:21:17 +0000151 font32->lfHeight = font16->lfHeight;
152 font32->lfWidth = font16->lfWidth;
153 font32->lfEscapement = font16->lfEscapement;
154 font32->lfOrientation = font16->lfOrientation;
155 font32->lfWeight = font16->lfWeight;
156 font32->lfItalic = font16->lfItalic;
157 font32->lfUnderline = font16->lfUnderline;
158 font32->lfStrikeOut = font16->lfStrikeOut;
159 font32->lfCharSet = font16->lfCharSet;
160 font32->lfOutPrecision = font16->lfOutPrecision;
161 font32->lfClipPrecision = font16->lfClipPrecision;
162 font32->lfQuality = font16->lfQuality;
163 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000164 lstrcpynAtoW( font32->lfFaceName, font16->lfFaceName, LF_FACESIZE );
Alexandre Julliard21979011997-03-05 08:22:35 +0000165}
166
Ulrich Czekallae6ab9d31999-10-24 17:26:45 +0000167void FONT_EnumLogFontEx16To32A( const LPENUMLOGFONTEX16 font16, LPENUMLOGFONTEXA font32 )
168{
169 FONT_LogFont16To32A( (LPLOGFONT16)font16, (LPLOGFONTA)font32);
170 lstrcpynA( font32->elfFullName, font16->elfFullName, LF_FULLFACESIZE );
171 lstrcpynA( font32->elfStyle, font16->elfStyle, LF_FACESIZE );
172 lstrcpynA( font32->elfScript, font16->elfScript, LF_FACESIZE );
173}
174
175void FONT_EnumLogFontEx16To32W( const LPENUMLOGFONTEX16 font16, LPENUMLOGFONTEXW font32 )
176{
177 FONT_LogFont16To32W( (LPLOGFONT16)font16, (LPLOGFONTW)font32);
178 lstrcpynAtoW( font32->elfFullName, font16->elfFullName, LF_FULLFACESIZE );
179 lstrcpynAtoW( font32->elfStyle, font16->elfStyle, LF_FACESIZE );
180 lstrcpynAtoW( font32->elfScript, font16->elfScript, LF_FACESIZE );
181}
182
Alexandre Julliard21979011997-03-05 08:22:35 +0000183/***********************************************************************
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000184 * TEXTMETRIC conversion functions.
Alexandre Julliard21979011997-03-05 08:22:35 +0000185 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000186void FONT_TextMetric32Ato16(const LPTEXTMETRICA ptm32, LPTEXTMETRIC16 ptm16 )
Alexandre Julliarde2991ea1995-07-29 13:09:43 +0000187{
Alexandre Julliard491502b1997-11-01 19:08:16 +0000188 ptm16->tmHeight = ptm32->tmHeight;
189 ptm16->tmAscent = ptm32->tmAscent;
190 ptm16->tmDescent = ptm32->tmDescent;
191 ptm16->tmInternalLeading = ptm32->tmInternalLeading;
192 ptm16->tmExternalLeading = ptm32->tmExternalLeading;
193 ptm16->tmAveCharWidth = ptm32->tmAveCharWidth;
194 ptm16->tmMaxCharWidth = ptm32->tmMaxCharWidth;
195 ptm16->tmWeight = ptm32->tmWeight;
196 ptm16->tmOverhang = ptm32->tmOverhang;
197 ptm16->tmDigitizedAspectX = ptm32->tmDigitizedAspectX;
198 ptm16->tmDigitizedAspectY = ptm32->tmDigitizedAspectY;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000199 ptm16->tmFirstChar = ptm32->tmFirstChar;
200 ptm16->tmLastChar = ptm32->tmLastChar;
201 ptm16->tmDefaultChar = ptm32->tmDefaultChar;
202 ptm16->tmBreakChar = ptm32->tmBreakChar;
Alexandre Julliard491502b1997-11-01 19:08:16 +0000203 ptm16->tmItalic = ptm32->tmItalic;
204 ptm16->tmUnderlined = ptm32->tmUnderlined;
205 ptm16->tmStruckOut = ptm32->tmStruckOut;
206 ptm16->tmPitchAndFamily = ptm32->tmPitchAndFamily;
207 ptm16->tmCharSet = ptm32->tmCharSet;
Alexandre Julliardded30381995-07-06 17:18:27 +0000208}
Alexandre Julliard401710d1993-09-04 10:09:32 +0000209
Alexandre Julliarda3960291999-02-26 11:11:13 +0000210void FONT_TextMetric32Wto16(const LPTEXTMETRICW ptm32, LPTEXTMETRIC16 ptm16 )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000211{
Alexandre Julliard491502b1997-11-01 19:08:16 +0000212 ptm16->tmHeight = ptm32->tmHeight;
213 ptm16->tmAscent = ptm32->tmAscent;
214 ptm16->tmDescent = ptm32->tmDescent;
215 ptm16->tmInternalLeading = ptm32->tmInternalLeading;
216 ptm16->tmExternalLeading = ptm32->tmExternalLeading;
217 ptm16->tmAveCharWidth = ptm32->tmAveCharWidth;
218 ptm16->tmMaxCharWidth = ptm32->tmMaxCharWidth;
219 ptm16->tmWeight = ptm32->tmWeight;
220 ptm16->tmOverhang = ptm32->tmOverhang;
221 ptm16->tmDigitizedAspectX = ptm32->tmDigitizedAspectX;
222 ptm16->tmDigitizedAspectY = ptm32->tmDigitizedAspectY;
223 ptm16->tmFirstChar = ptm32->tmFirstChar;
224 ptm16->tmLastChar = ptm32->tmLastChar;
225 ptm16->tmDefaultChar = ptm32->tmDefaultChar;
226 ptm16->tmBreakChar = ptm32->tmBreakChar;
227 ptm16->tmItalic = ptm32->tmItalic;
228 ptm16->tmUnderlined = ptm32->tmUnderlined;
229 ptm16->tmStruckOut = ptm32->tmStruckOut;
230 ptm16->tmPitchAndFamily = ptm32->tmPitchAndFamily;
231 ptm16->tmCharSet = ptm32->tmCharSet;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000232}
233
Alexandre Julliarda3960291999-02-26 11:11:13 +0000234void FONT_TextMetric16to32A(const LPTEXTMETRIC16 ptm16, LPTEXTMETRICA ptm32 )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000235{
Alexandre Julliard491502b1997-11-01 19:08:16 +0000236 ptm32->tmHeight = ptm16->tmHeight;
237 ptm32->tmAscent = ptm16->tmAscent;
238 ptm32->tmDescent = ptm16->tmDescent;
239 ptm32->tmInternalLeading = ptm16->tmInternalLeading;
240 ptm32->tmExternalLeading = ptm16->tmExternalLeading;
241 ptm32->tmAveCharWidth = ptm16->tmAveCharWidth;
242 ptm32->tmMaxCharWidth = ptm16->tmMaxCharWidth;
243 ptm32->tmWeight = ptm16->tmWeight;
244 ptm32->tmOverhang = ptm16->tmOverhang;
245 ptm32->tmDigitizedAspectX = ptm16->tmDigitizedAspectX;
246 ptm32->tmDigitizedAspectY = ptm16->tmDigitizedAspectY;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000247 ptm32->tmFirstChar = ptm16->tmFirstChar;
248 ptm32->tmLastChar = ptm16->tmLastChar;
249 ptm32->tmDefaultChar = ptm16->tmDefaultChar;
250 ptm32->tmBreakChar = ptm16->tmBreakChar;
Alexandre Julliard491502b1997-11-01 19:08:16 +0000251 ptm32->tmItalic = ptm16->tmItalic;
252 ptm32->tmUnderlined = ptm16->tmUnderlined;
253 ptm32->tmStruckOut = ptm16->tmStruckOut;
254 ptm32->tmPitchAndFamily = ptm16->tmPitchAndFamily;
255 ptm32->tmCharSet = ptm16->tmCharSet;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000256}
257
Alexandre Julliarda3960291999-02-26 11:11:13 +0000258void FONT_TextMetric16to32W(const LPTEXTMETRIC16 ptm16, LPTEXTMETRICW ptm32 )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000259{
Alexandre Julliard491502b1997-11-01 19:08:16 +0000260 ptm32->tmHeight = ptm16->tmHeight;
261 ptm32->tmAscent = ptm16->tmAscent;
262 ptm32->tmDescent = ptm16->tmDescent;
263 ptm32->tmInternalLeading = ptm16->tmInternalLeading;
264 ptm32->tmExternalLeading = ptm16->tmExternalLeading;
265 ptm32->tmAveCharWidth = ptm16->tmAveCharWidth;
266 ptm32->tmMaxCharWidth = ptm16->tmMaxCharWidth;
267 ptm32->tmWeight = ptm16->tmWeight;
268 ptm32->tmOverhang = ptm16->tmOverhang;
269 ptm32->tmDigitizedAspectX = ptm16->tmDigitizedAspectX;
270 ptm32->tmDigitizedAspectY = ptm16->tmDigitizedAspectY;
271 ptm32->tmFirstChar = ptm16->tmFirstChar;
272 ptm32->tmLastChar = ptm16->tmLastChar;
273 ptm32->tmDefaultChar = ptm16->tmDefaultChar;
274 ptm32->tmBreakChar = ptm16->tmBreakChar;
275 ptm32->tmItalic = ptm16->tmItalic;
276 ptm32->tmUnderlined = ptm16->tmUnderlined;
277 ptm32->tmStruckOut = ptm16->tmStruckOut;
278 ptm32->tmPitchAndFamily = ptm16->tmPitchAndFamily;
279 ptm32->tmCharSet = ptm16->tmCharSet;
280}
281
Alexandre Julliarda3960291999-02-26 11:11:13 +0000282void FONT_TextMetric32Ato32W(const LPTEXTMETRICA ptm32A, LPTEXTMETRICW ptm32W )
Alexandre Julliard491502b1997-11-01 19:08:16 +0000283{
284 ptm32W->tmHeight = ptm32A->tmHeight;
285 ptm32W->tmAscent = ptm32A->tmAscent;
286 ptm32W->tmDescent = ptm32A->tmDescent;
287 ptm32W->tmInternalLeading = ptm32A->tmInternalLeading;
288 ptm32W->tmExternalLeading = ptm32A->tmExternalLeading;
289 ptm32W->tmAveCharWidth = ptm32A->tmAveCharWidth;
290 ptm32W->tmMaxCharWidth = ptm32A->tmMaxCharWidth;
291 ptm32W->tmWeight = ptm32A->tmWeight;
292 ptm32W->tmOverhang = ptm32A->tmOverhang;
293 ptm32W->tmDigitizedAspectX = ptm32A->tmDigitizedAspectX;
294 ptm32W->tmDigitizedAspectY = ptm32A->tmDigitizedAspectY;
295 ptm32W->tmFirstChar = ptm32A->tmFirstChar;
296 ptm32W->tmLastChar = ptm32A->tmLastChar;
297 ptm32W->tmDefaultChar = ptm32A->tmDefaultChar;
298 ptm32W->tmBreakChar = ptm32A->tmBreakChar;
299 ptm32W->tmItalic = ptm32A->tmItalic;
300 ptm32W->tmUnderlined = ptm32A->tmUnderlined;
301 ptm32W->tmStruckOut = ptm32A->tmStruckOut;
302 ptm32W->tmPitchAndFamily = ptm32A->tmPitchAndFamily;
303 ptm32W->tmCharSet = ptm32A->tmCharSet;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000304}
Alexandre Julliarde2991ea1995-07-29 13:09:43 +0000305
Alexandre Julliard401710d1993-09-04 10:09:32 +0000306/***********************************************************************
Alexandre Julliardca22b331996-07-12 19:02:39 +0000307 * CreateFontIndirect16 (GDI.57)
Alexandre Julliard401710d1993-09-04 10:09:32 +0000308 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000309HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *font )
Alexandre Julliard401710d1993-09-04 10:09:32 +0000310{
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000311 HFONT16 hFont = 0;
Alexandre Julliard0c126c71996-02-18 18:44:41 +0000312
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000313 if (font)
Alexandre Julliardca22b331996-07-12 19:02:39 +0000314 {
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000315 hFont = GDI_AllocObject( sizeof(FONTOBJ), FONT_MAGIC );
316 if( hFont )
317 {
318 FONTOBJ* fontPtr;
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000319 fontPtr = (FONTOBJ *) GDI_HEAP_LOCK( hFont );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000320 memcpy( &fontPtr->logfont, font, sizeof(LOGFONT16) );
Alexandre Julliard401710d1993-09-04 10:09:32 +0000321
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +0000322 TRACE("(%i %i %i %i) '%s' %s %s => %04x\n",
323 font->lfHeight, font->lfWidth,
324 font->lfEscapement, font->lfOrientation,
325 font->lfFaceName ? font->lfFaceName : "NULL",
326 font->lfWeight > 400 ? "Bold" : "",
327 font->lfItalic ? "Italic" : "", hFont);
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000328
329 if (font->lfEscapement != font->lfOrientation) {
330 /* this should really depend on whether GM_ADVANCED is set */
331 fontPtr->logfont.lfOrientation = fontPtr->logfont.lfEscapement;
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +0000332 WARN("orientation angle %f set to "
333 "escapement angle %f for new font %04x\n",
334 font->lfOrientation/10., font->lfEscapement/10., hFont);
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000335 }
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000336 GDI_HEAP_UNLOCK( hFont );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000337 }
338 }
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +0000339 else WARN("(NULL) => NULL\n");
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000340
341 return hFont;
342}
Alexandre Julliard401710d1993-09-04 10:09:32 +0000343
344/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000345 * CreateFontIndirectA (GDI32.44)
Alexandre Julliardca22b331996-07-12 19:02:39 +0000346 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000347HFONT WINAPI CreateFontIndirectA( const LOGFONTA *font )
Alexandre Julliardca22b331996-07-12 19:02:39 +0000348{
349 LOGFONT16 font16;
350
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000351 FONT_LogFont32ATo16( font, &font16 );
Alexandre Julliardca22b331996-07-12 19:02:39 +0000352 return CreateFontIndirect16( &font16 );
353}
354
Alexandre Julliardca22b331996-07-12 19:02:39 +0000355/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000356 * CreateFontIndirectW (GDI32.45)
Alexandre Julliardca22b331996-07-12 19:02:39 +0000357 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000358HFONT WINAPI CreateFontIndirectW( const LOGFONTW *font )
Alexandre Julliardca22b331996-07-12 19:02:39 +0000359{
360 LOGFONT16 font16;
361
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000362 FONT_LogFont32WTo16( font, &font16 );
Alexandre Julliardca22b331996-07-12 19:02:39 +0000363 return CreateFontIndirect16( &font16 );
364}
365
Alexandre Julliardca22b331996-07-12 19:02:39 +0000366/***********************************************************************
Alexandre Julliard18f92e71996-07-17 20:02:21 +0000367 * CreateFont16 (GDI.56)
Alexandre Julliard401710d1993-09-04 10:09:32 +0000368 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000369HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient,
370 INT16 weight, BYTE italic, BYTE underline,
371 BYTE strikeout, BYTE charset, BYTE outpres,
372 BYTE clippres, BYTE quality, BYTE pitch,
373 LPCSTR name )
Alexandre Julliard401710d1993-09-04 10:09:32 +0000374{
Patrik Stridvalla9a671d1999-04-25 19:01:52 +0000375 LOGFONT16 logfont;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000376
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +0000377 TRACE("('%s',%d,%d)\n", (name ? name : "(null)") , height, width);
Patrik Stridvalla9a671d1999-04-25 19:01:52 +0000378
379 logfont.lfHeight = height;
380 logfont.lfWidth = width;
381 logfont.lfEscapement = esc;
382 logfont.lfOrientation = orient;
383 logfont.lfWeight = weight;
384 logfont.lfItalic = italic;
385 logfont.lfUnderline = underline;
386 logfont.lfStrikeOut = strikeout;
387 logfont.lfCharSet = charset;
388 logfont.lfOutPrecision = outpres;
389 logfont.lfClipPrecision = clippres;
390 logfont.lfQuality = quality;
391 logfont.lfPitchAndFamily = pitch;
392
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000393 if (name)
Alexandre Julliarda3960291999-02-26 11:11:13 +0000394 lstrcpynA(logfont.lfFaceName,name,sizeof(logfont.lfFaceName));
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000395 else
396 logfont.lfFaceName[0] = '\0';
Patrik Stridvalla9a671d1999-04-25 19:01:52 +0000397
Alexandre Julliardca22b331996-07-12 19:02:39 +0000398 return CreateFontIndirect16( &logfont );
Alexandre Julliard401710d1993-09-04 10:09:32 +0000399}
400
Alexandre Julliard18f92e71996-07-17 20:02:21 +0000401/*************************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000402 * CreateFontA (GDI32.43)
Alexandre Julliard18f92e71996-07-17 20:02:21 +0000403 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000404HFONT WINAPI CreateFontA( INT height, INT width, INT esc,
405 INT orient, INT weight, DWORD italic,
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000406 DWORD underline, DWORD strikeout, DWORD charset,
407 DWORD outpres, DWORD clippres, DWORD quality,
408 DWORD pitch, LPCSTR name )
Alexandre Julliard18f92e71996-07-17 20:02:21 +0000409{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000410 return (HFONT)CreateFont16( height, width, esc, orient, weight, italic,
Alexandre Julliard18f92e71996-07-17 20:02:21 +0000411 underline, strikeout, charset, outpres,
412 clippres, quality, pitch, name );
413}
414
Alexandre Julliard18f92e71996-07-17 20:02:21 +0000415/*************************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000416 * CreateFontW (GDI32.46)
Alexandre Julliard18f92e71996-07-17 20:02:21 +0000417 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000418HFONT WINAPI CreateFontW( INT height, INT width, INT esc,
419 INT orient, INT weight, DWORD italic,
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000420 DWORD underline, DWORD strikeout, DWORD charset,
421 DWORD outpres, DWORD clippres, DWORD quality,
422 DWORD pitch, LPCWSTR name )
Alexandre Julliard18f92e71996-07-17 20:02:21 +0000423{
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000424 LPSTR namea = HEAP_strdupWtoA( GetProcessHeap(), 0, name );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000425 HFONT ret = (HFONT)CreateFont16( height, width, esc, orient, weight,
Alexandre Julliard18f92e71996-07-17 20:02:21 +0000426 italic, underline, strikeout, charset,
427 outpres, clippres, quality, pitch,
428 namea );
Alexandre Julliard491502b1997-11-01 19:08:16 +0000429 if (namea) HeapFree( GetProcessHeap(), 0, namea );
Alexandre Julliard18f92e71996-07-17 20:02:21 +0000430 return ret;
431}
432
433
Alexandre Julliard401710d1993-09-04 10:09:32 +0000434/***********************************************************************
Alexandre Julliard0e270f41996-08-24 18:26:35 +0000435 * FONT_GetObject16
Alexandre Julliard401710d1993-09-04 10:09:32 +0000436 */
Alexandre Julliard0e270f41996-08-24 18:26:35 +0000437INT16 FONT_GetObject16( FONTOBJ * font, INT16 count, LPSTR buffer )
Alexandre Julliard401710d1993-09-04 10:09:32 +0000438{
Alexandre Julliardd90840e1996-06-11 16:02:08 +0000439 if (count > sizeof(LOGFONT16)) count = sizeof(LOGFONT16);
Alexandre Julliard401710d1993-09-04 10:09:32 +0000440 memcpy( buffer, &font->logfont, count );
441 return count;
442}
443
Alexandre Julliard401710d1993-09-04 10:09:32 +0000444/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000445 * FONT_GetObjectA
Alexandre Julliard0e270f41996-08-24 18:26:35 +0000446 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000447INT FONT_GetObjectA( FONTOBJ *font, INT count, LPSTR buffer )
Alexandre Julliard0e270f41996-08-24 18:26:35 +0000448{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000449 LOGFONTA fnt32;
Alexandre Julliard0e270f41996-08-24 18:26:35 +0000450
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000451 FONT_LogFont16To32A( &font->logfont, &fnt32 );
Alexandre Julliard0e270f41996-08-24 18:26:35 +0000452
453 if (count > sizeof(fnt32)) count = sizeof(fnt32);
454 memcpy( buffer, &fnt32, count );
455 return count;
456}
Juergen Schmiedcba84881998-10-23 13:27:36 +0000457/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000458 * FONT_GetObjectW
Juergen Schmiedcba84881998-10-23 13:27:36 +0000459 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000460INT FONT_GetObjectW( FONTOBJ *font, INT count, LPSTR buffer )
Juergen Schmiedcba84881998-10-23 13:27:36 +0000461{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000462 LOGFONTW fnt32;
Juergen Schmiedcba84881998-10-23 13:27:36 +0000463
464 FONT_LogFont16To32W( &font->logfont, &fnt32 );
465
466 if (count > sizeof(fnt32)) count = sizeof(fnt32);
467 memcpy( buffer, &fnt32, count );
468 return count;
469}
Alexandre Julliard0e270f41996-08-24 18:26:35 +0000470
471
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000472/***********************************************************************
473 * FONT_EnumInstance16
474 *
475 * Called by the device driver layer to pass font info
476 * down to the application.
477 */
Ulrich Czekallae6ab9d31999-10-24 17:26:45 +0000478static INT FONT_EnumInstance16( LPENUMLOGFONTEX16 plf,
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000479 LPNEWTEXTMETRIC16 ptm, UINT16 fType, LPARAM lp )
480{
481#define pfe ((fontEnum16*)lp)
482 if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET ||
483 pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet )
484 {
485 memcpy( pfe->lpLogFont, plf, sizeof(ENUMLOGFONT16) );
486 memcpy( pfe->lpTextMetric, ptm, sizeof(NEWTEXTMETRIC16) );
487
488 return pfe->lpEnumFunc( pfe->segLogFont, pfe->segTextMetric, fType, (LPARAM)(pfe->lpData) );
489 }
490#undef pfe
491 return 1;
492}
493
494/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000495 * FONT_EnumInstance
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000496 */
Ulrich Czekallae6ab9d31999-10-24 17:26:45 +0000497static INT FONT_EnumInstance( LPENUMLOGFONTEX16 plf,
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000498 LPNEWTEXTMETRIC16 ptm, UINT16 fType, LPARAM lp )
499{
500 /* lfCharSet is at the same offset in both LOGFONT32A and LOGFONT32W */
501
502#define pfe ((fontEnum32*)lp)
503 if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET ||
504 pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet )
505 {
506 /* convert font metrics */
507
508 if( pfe->dwFlags & ENUM_UNICODE )
509 {
Ulrich Czekallae6ab9d31999-10-24 17:26:45 +0000510 FONT_EnumLogFontEx16To32W( plf, pfe->lpLogFont );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000511 FONT_TextMetric16to32W( (LPTEXTMETRIC16)ptm, (LPTEXTMETRICW)(pfe->lpTextMetric) );
Ulrich Czekallae6ab9d31999-10-24 17:26:45 +0000512
513 return pfe->lpEnumFunc( pfe->lpLogFont, pfe->lpTextMetric, fType, pfe->lpData );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000514 }
515 else
516 {
Ulrich Czekallae6ab9d31999-10-24 17:26:45 +0000517 ENUMLOGFONTEXA logfont;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000518
Ulrich Czekallae6ab9d31999-10-24 17:26:45 +0000519 FONT_EnumLogFontEx16To32A( plf, &logfont);
520 FONT_TextMetric16to32A( (LPTEXTMETRIC16)ptm, (LPTEXTMETRICA)pfe->lpTextMetric );
521
522 return pfe->lpEnumFunc( (LPENUMLOGFONTEXW)&logfont,
523 pfe->lpTextMetric, fType, pfe->lpData );
524 }
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000525 }
526#undef pfe
527 return 1;
528}
529
530/***********************************************************************
531 * EnumFontFamiliesEx16 (GDI.613)
532 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000533INT16 WINAPI EnumFontFamiliesEx16( HDC16 hDC, LPLOGFONT16 plf,
534 FONTENUMPROCEX16 efproc, LPARAM lParam,
535 DWORD dwFlags)
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000536{
537 INT16 retVal = 0;
538 DC* dc = (DC*) GDI_GetObjPtr( hDC, DC_MAGIC );
539
540 if( dc && dc->funcs->pEnumDeviceFonts )
541 {
542 LPNEWTEXTMETRICEX16 lptm16 = SEGPTR_ALLOC( sizeof(NEWTEXTMETRICEX16) );
543 if( lptm16 )
544 {
545 LPENUMLOGFONTEX16 lplf16 = SEGPTR_ALLOC( sizeof(ENUMLOGFONTEX16) );
546 if( lplf16 )
547 {
Patrik Stridvalla9a671d1999-04-25 19:01:52 +0000548 fontEnum16 fe16;
549
550 fe16.lpLogFontParam = plf;
551 fe16.lpEnumFunc = efproc;
552 fe16.lpData = lParam;
553
554 fe16.lpTextMetric = lptm16;
555 fe16.lpLogFont = lplf16;
556 fe16.segTextMetric = SEGPTR_GET(lptm16);
557 fe16.segLogFont = SEGPTR_GET(lplf16);
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000558
559 retVal = dc->funcs->pEnumDeviceFonts( dc, plf, FONT_EnumInstance16, (LPARAM)&fe16 );
560
561 SEGPTR_FREE(lplf16);
562 }
563 SEGPTR_FREE(lptm16);
564 }
565 }
566 return retVal;
567}
568
569/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000570 * FONT_EnumFontFamiliesEx
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000571 */
Ulrich Czekallae6ab9d31999-10-24 17:26:45 +0000572static INT FONT_EnumFontFamiliesEx( HDC hDC, LPLOGFONTW plf, FONTENUMPROCEXW efproc,
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000573 LPARAM lParam, DWORD dwUnicode)
574{
575 DC* dc = (DC*) GDI_GetObjPtr( hDC, DC_MAGIC );
576
577 if( dc && dc->funcs->pEnumDeviceFonts )
578 {
579 LOGFONT16 lf16;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000580 NEWTEXTMETRICEXW tm32w;
581 ENUMLOGFONTEXW lf32w;
Patrik Stridvalla9a671d1999-04-25 19:01:52 +0000582 fontEnum32 fe32;
583
584 fe32.lpLogFontParam = plf;
585 fe32.lpEnumFunc = efproc;
586 fe32.lpData = lParam;
587
588 fe32.lpTextMetric = &tm32w;
589 fe32.lpLogFont = &lf32w;
590 fe32.dwFlags = dwUnicode;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000591
592 /* the only difference between LOGFONT32A and LOGFONT32W is in the lfFaceName */
593
594 if( plf->lfFaceName[0] )
595 {
596 if( dwUnicode )
597 lstrcpynWtoA( lf16.lfFaceName, plf->lfFaceName, LF_FACESIZE );
598 else
Alexandre Julliarda3960291999-02-26 11:11:13 +0000599 lstrcpynA( lf16.lfFaceName, (LPCSTR)plf->lfFaceName, LF_FACESIZE );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000600 }
601 else lf16.lfFaceName[0] = '\0';
602 lf16.lfCharSet = plf->lfCharSet;
603
Alexandre Julliarda3960291999-02-26 11:11:13 +0000604 return dc->funcs->pEnumDeviceFonts( dc, &lf16, FONT_EnumInstance, (LPARAM)&fe32 );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000605 }
606 return 0;
607}
608
609/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000610 * EnumFontFamiliesExW (GDI32.82)
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000611 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000612INT WINAPI EnumFontFamiliesExW( HDC hDC, LPLOGFONTW plf,
613 FONTENUMPROCEXW efproc,
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000614 LPARAM lParam, DWORD dwFlags )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000615{
Ulrich Czekallae6ab9d31999-10-24 17:26:45 +0000616 return FONT_EnumFontFamiliesEx( hDC, plf, efproc, lParam, ENUM_UNICODE );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000617}
618
619/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000620 * EnumFontFamiliesExA (GDI32.81)
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000621 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000622INT WINAPI EnumFontFamiliesExA( HDC hDC, LPLOGFONTA plf,
623 FONTENUMPROCEXA efproc,
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000624 LPARAM lParam, DWORD dwFlags)
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000625{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000626 return FONT_EnumFontFamiliesEx( hDC, (LPLOGFONTW)plf,
Ulrich Czekallae6ab9d31999-10-24 17:26:45 +0000627 (FONTENUMPROCEXW)efproc, lParam, 0);
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000628}
629
630/***********************************************************************
631 * EnumFontFamilies16 (GDI.330)
632 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000633INT16 WINAPI EnumFontFamilies16( HDC16 hDC, LPCSTR lpFamily,
634 FONTENUMPROC16 efproc, LPARAM lpData )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000635{
636 LOGFONT16 lf;
637
638 lf.lfCharSet = DEFAULT_CHARSET;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000639 if( lpFamily ) lstrcpynA( lf.lfFaceName, lpFamily, LF_FACESIZE );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000640 else lf.lfFaceName[0] = '\0';
641
642 return EnumFontFamiliesEx16( hDC, &lf, (FONTENUMPROCEX16)efproc, lpData, 0 );
643}
644
645/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000646 * EnumFontFamiliesA (GDI32.80)
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000647 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000648INT WINAPI EnumFontFamiliesA( HDC hDC, LPCSTR lpFamily,
649 FONTENUMPROCA efproc, LPARAM lpData )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000650{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000651 LOGFONTA lf;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000652
653 lf.lfCharSet = DEFAULT_CHARSET;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000654 if( lpFamily ) lstrcpynA( lf.lfFaceName, lpFamily, LF_FACESIZE );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000655 else lf.lfFaceName[0] = lf.lfFaceName[1] = '\0';
656
Alexandre Julliarda3960291999-02-26 11:11:13 +0000657 return FONT_EnumFontFamiliesEx( hDC, (LPLOGFONTW)&lf,
Ulrich Czekallae6ab9d31999-10-24 17:26:45 +0000658 (FONTENUMPROCEXW)efproc, lpData, 0 );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000659}
660
661/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000662 * EnumFontFamiliesW (GDI32.83)
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000663 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000664INT WINAPI EnumFontFamiliesW( HDC hDC, LPCWSTR lpFamily,
665 FONTENUMPROCW efproc, LPARAM lpData )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000666{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000667 LOGFONTW lf;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000668
669 lf.lfCharSet = DEFAULT_CHARSET;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000670 if( lpFamily ) lstrcpynW( lf.lfFaceName, lpFamily, LF_FACESIZE );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000671 else lf.lfFaceName[0] = 0;
672
Ulrich Czekallae6ab9d31999-10-24 17:26:45 +0000673 return FONT_EnumFontFamiliesEx( hDC, &lf, (FONTENUMPROCEXW)efproc,
674 lpData, ENUM_UNICODE );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000675}
676
677/***********************************************************************
678 * EnumFonts16 (GDI.70)
679 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000680INT16 WINAPI EnumFonts16( HDC16 hDC, LPCSTR lpName, FONTENUMPROC16 efproc,
681 LPARAM lpData )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000682{
683 return EnumFontFamilies16( hDC, lpName, (FONTENUMPROCEX16)efproc, lpData );
684}
685
686/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000687 * EnumFontsA (GDI32.84)
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000688 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000689INT WINAPI EnumFontsA( HDC hDC, LPCSTR lpName, FONTENUMPROCA efproc,
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000690 LPARAM lpData )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000691{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000692 return EnumFontFamiliesA( hDC, lpName, efproc, lpData );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000693}
694
695/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000696 * EnumFontsW (GDI32.85)
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000697 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000698INT WINAPI EnumFontsW( HDC hDC, LPCWSTR lpName, FONTENUMPROCW efproc,
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000699 LPARAM lpData )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000700{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000701 return EnumFontFamiliesW( hDC, lpName, efproc, lpData );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000702}
Alexandre Julliard401710d1993-09-04 10:09:32 +0000703
704
705/***********************************************************************
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000706 * GetTextCharacterExtra16 (GDI.89)
Alexandre Julliard401710d1993-09-04 10:09:32 +0000707 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000708INT16 WINAPI GetTextCharacterExtra16( HDC16 hdc )
Alexandre Julliard401710d1993-09-04 10:09:32 +0000709{
710 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
711 if (!dc) return 0;
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000712 return abs( (dc->w.charExtra * dc->wndExtX + dc->vportExtX / 2)
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000713 / dc->vportExtX );
Alexandre Julliard401710d1993-09-04 10:09:32 +0000714}
715
716
717/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000718 * GetTextCharacterExtra (GDI32.225)
Alexandre Julliard401710d1993-09-04 10:09:32 +0000719 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000720INT WINAPI GetTextCharacterExtra( HDC hdc )
Alexandre Julliard401710d1993-09-04 10:09:32 +0000721{
Alexandre Julliard401710d1993-09-04 10:09:32 +0000722 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
723 if (!dc) return 0;
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000724 return abs( (dc->w.charExtra * dc->wndExtX + dc->vportExtX / 2)
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000725 / dc->vportExtX );
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000726}
727
728
729/***********************************************************************
730 * SetTextCharacterExtra16 (GDI.8)
731 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000732INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra )
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000733{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000734 return (INT16)SetTextCharacterExtra( hdc, extra );
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000735}
736
737
738/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000739 * SetTextCharacterExtra (GDI32.337)
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000740 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000741INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra )
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000742{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000743 INT prev;
Huw D M Davies7603dea1999-04-25 09:24:23 +0000744 DC * dc = DC_GetDCPtr( hdc );
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000745 if (!dc) return 0;
Huw D M Davies7603dea1999-04-25 09:24:23 +0000746 if (dc->funcs->pSetTextCharacterExtra)
747 return dc->funcs->pSetTextCharacterExtra( dc, extra );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000748 extra = (extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX;
Alexandre Julliard401710d1993-09-04 10:09:32 +0000749 prev = dc->w.charExtra;
750 dc->w.charExtra = abs(extra);
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000751 return (prev * dc->wndExtX + dc->vportExtX / 2) / dc->vportExtX;
Alexandre Julliard401710d1993-09-04 10:09:32 +0000752}
753
754
755/***********************************************************************
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000756 * SetTextJustification16 (GDI.10)
Alexandre Julliard401710d1993-09-04 10:09:32 +0000757 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000758INT16 WINAPI SetTextJustification16( HDC16 hdc, INT16 extra, INT16 breaks )
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000759{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000760 return SetTextJustification( hdc, extra, breaks );
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000761}
762
763
764/***********************************************************************
Huw D M Davies7603dea1999-04-25 09:24:23 +0000765 * SetTextJustification (GDI32.339)
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000766 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000767BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks )
Alexandre Julliard401710d1993-09-04 10:09:32 +0000768{
Huw D M Davies7603dea1999-04-25 09:24:23 +0000769 DC * dc = DC_GetDCPtr( hdc );
Alexandre Julliard401710d1993-09-04 10:09:32 +0000770 if (!dc) return 0;
Huw D M Davies7603dea1999-04-25 09:24:23 +0000771 if (dc->funcs->pSetTextJustification)
772 return dc->funcs->pSetTextJustification( dc, extra, breaks );
Alexandre Julliard401710d1993-09-04 10:09:32 +0000773
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000774 extra = abs((extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX);
Alexandre Julliard401710d1993-09-04 10:09:32 +0000775 if (!extra) breaks = 0;
776 dc->w.breakTotalExtra = extra;
777 dc->w.breakCount = breaks;
778 if (breaks)
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000779 {
780 dc->w.breakExtra = extra / breaks;
781 dc->w.breakRem = extra - (dc->w.breakCount * dc->w.breakExtra);
Alexandre Julliard401710d1993-09-04 10:09:32 +0000782 }
783 else
784 {
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000785 dc->w.breakExtra = 0;
786 dc->w.breakRem = 0;
Alexandre Julliard401710d1993-09-04 10:09:32 +0000787 }
788 return 1;
789}
790
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000791
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000792/***********************************************************************
793 * GetTextFace16 (GDI.92)
794 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000795INT16 WINAPI GetTextFace16( HDC16 hdc, INT16 count, LPSTR name )
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000796{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000797 return GetTextFaceA(hdc,count,name);
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000798}
Alexandre Julliard401710d1993-09-04 10:09:32 +0000799
800/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000801 * GetTextFaceA (GDI32.234)
Alexandre Julliardaca05781994-10-17 18:12:41 +0000802 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000803INT WINAPI GetTextFaceA( HDC hdc, INT count, LPSTR name )
Alexandre Julliardaca05781994-10-17 18:12:41 +0000804{
805 FONTOBJ *font;
806
807 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
808 if (!dc) return 0;
809 if (!(font = (FONTOBJ *) GDI_GetObjPtr( dc->w.hFont, FONT_MAGIC )))
810 return 0;
Alexandre Julliard829fe321998-07-26 14:27:39 +0000811 if (name)
Alexandre Julliarda3960291999-02-26 11:11:13 +0000812 lstrcpynA( name, font->logfont.lfFaceName, count );
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000813 GDI_HEAP_UNLOCK( dc->w.hFont );
Alexandre Julliard829fe321998-07-26 14:27:39 +0000814 if (name)
815 return strlen(name);
816 else
817 return strlen(font->logfont.lfFaceName) + 1;
Alexandre Julliardaca05781994-10-17 18:12:41 +0000818}
819
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000820/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000821 * GetTextFaceW (GDI32.235)
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000822 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000823INT WINAPI GetTextFaceW( HDC hdc, INT count, LPWSTR name )
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000824{
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000825 LPSTR nameA = HeapAlloc( GetProcessHeap(), 0, count );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000826 INT res = GetTextFaceA(hdc,count,nameA);
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000827 lstrcpyAtoW( name, nameA );
828 HeapFree( GetProcessHeap(), 0, nameA );
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000829 return res;
830}
831
Alexandre Julliardaca05781994-10-17 18:12:41 +0000832
833/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000834 * GetTextExtent16 (GDI.91)
Alexandre Julliard401710d1993-09-04 10:09:32 +0000835 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000836DWORD WINAPI GetTextExtent16( HDC16 hdc, LPCSTR str, INT16 count )
Alexandre Julliard401710d1993-09-04 10:09:32 +0000837{
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000838 SIZE16 size;
839 if (!GetTextExtentPoint16( hdc, str, count, &size )) return 0;
Alexandre Julliard234bc241994-12-10 13:02:28 +0000840 return MAKELONG( size.cx, size.cy );
Alexandre Julliard401710d1993-09-04 10:09:32 +0000841}
842
843
844/***********************************************************************
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000845 * GetTextExtentPoint16 (GDI.471)
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000846 *
847 * FIXME: Should this have a bug for compatibility?
848 * Original Windows versions of GetTextExtentPoint{A,W} have documented
Alexandre Julliard638f1691999-01-17 16:32:32 +0000849 * bugs (-> MSDN KB q147647.txt).
Alexandre Julliard401710d1993-09-04 10:09:32 +0000850 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000851BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count,
852 LPSIZE16 size )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000853{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000854 SIZE size32;
Huw D M Daviesc5539241999-12-26 00:47:03 +0000855 BOOL ret;
856 TRACE("%04x, %p (%s), %d, %p\n", hdc, str, debugstr_an(str, count), count,
857 size);
858 ret = GetTextExtentPoint32A( hdc, str, count, &size32 );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000859 CONV_SIZE32TO16( &size32, size );
860 return (BOOL16)ret;
861}
862
863
864/***********************************************************************
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000865 * GetTextExtentPoint32A (GDI32.230)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000866 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000867BOOL WINAPI GetTextExtentPoint32A( HDC hdc, LPCSTR str, INT count,
868 LPSIZE size )
Alexandre Julliard401710d1993-09-04 10:09:32 +0000869{
Huw D M Daviesc5539241999-12-26 00:47:03 +0000870 LPWSTR p;
871 BOOL ret;
Alexandre Julliard401710d1993-09-04 10:09:32 +0000872
Huw D M Daviesc5539241999-12-26 00:47:03 +0000873 /* str may not be 0 terminated so we can't use HEAP_strdupWtoA.
874 * We allocate one more than we need so that lstrcpynWtoA can write a
875 * trailing 0 if it wants.
876 */
Alexandre Julliard0e270f41996-08-24 18:26:35 +0000877
Huw D M Daviesc5539241999-12-26 00:47:03 +0000878 p = HeapAlloc( GetProcessHeap(), 0, (count+1) * sizeof(WCHAR) );
879 lstrcpynAtoW(p, str, count+1);
880 ret = GetTextExtentPoint32W( hdc, p, count, size );
881 HeapFree( GetProcessHeap(), 0, p );
882 return ret;
Alexandre Julliard401710d1993-09-04 10:09:32 +0000883}
884
885
886/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000887 * GetTextExtentPoint32W [GDI32.231] Computes width/height for a string
888 *
889 * Computes width and height of the specified string.
890 *
891 * RETURNS
892 * Success: TRUE
893 * Failure: FALSE
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000894 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000895BOOL WINAPI GetTextExtentPoint32W(
896 HDC hdc, /* [in] Handle of device context */
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000897 LPCWSTR str, /* [in] Address of text string */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000898 INT count, /* [in] Number of characters in string */
899 LPSIZE size) /* [out] Address of structure for string size */
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000900{
Huw D M Daviesc5539241999-12-26 00:47:03 +0000901 DC * dc = DC_GetDCPtr( hdc );
902 if (!dc || !dc->funcs->pGetTextExtentPoint ||
903 !dc->funcs->pGetTextExtentPoint( dc, str, count, size ))
904 return FALSE;
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000905
Huw D M Daviesc5539241999-12-26 00:47:03 +0000906 TRACE("(%08x %s %d %p): returning %d,%d\n",
907 hdc, debugstr_wn (str, count), count, size, size->cx, size->cy );
908 return TRUE;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000909}
910
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000911
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000912/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000913 * GetTextExtentPointA (GDI32.232)
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000914 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000915BOOL WINAPI GetTextExtentPointA( HDC hdc, LPCSTR str, INT count,
916 LPSIZE size )
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000917{
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +0000918 TRACE("not bug compatible.\n");
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000919 return GetTextExtentPoint32A( hdc, str, count, size );
920}
921
922/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000923 * GetTextExtentPointW (GDI32.233)
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000924 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000925BOOL WINAPI GetTextExtentPointW( HDC hdc, LPCWSTR str, INT count,
926 LPSIZE size )
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000927{
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +0000928 TRACE("not bug compatible.\n");
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000929 return GetTextExtentPoint32W( hdc, str, count, size );
930}
931
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000932
933/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +0000934 * GetTextExtentExPointA (GDI32.228)
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000935 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000936BOOL WINAPI GetTextExtentExPointA( HDC hdc, LPCSTR str, INT count,
Huw D M Daviesc5539241999-12-26 00:47:03 +0000937 INT maxExt, LPINT lpnFit,
938 LPINT alpDx, LPSIZE size )
939{
940 LPWSTR p;
941 BOOL ret;
942
943 /* Docs say str should be 0 terminated here, but we'll use count just in case
944 */
945
946 p = HeapAlloc( GetProcessHeap(), 0, (count+1) * sizeof(WCHAR) );
947 lstrcpynAtoW(p, str, count+1);
948 ret = GetTextExtentExPointW( hdc, p, count, maxExt, lpnFit, alpDx, size);
949 HeapFree( GetProcessHeap(), 0, p );
950 return ret;
951}
952
953
954/***********************************************************************
955 * GetTextExtentExPointW (GDI32.229)
956 */
957
958BOOL WINAPI GetTextExtentExPointW( HDC hdc, LPCWSTR str, INT count,
959 INT maxExt, LPINT lpnFit,
960 LPINT alpDx, LPSIZE size )
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000961{
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000962 int index, nFit, extent;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000963 SIZE tSize;
Huw D M Daviesc5539241999-12-26 00:47:03 +0000964 DC * dc = DC_GetDCPtr( hdc );
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000965
Huw D M Daviesc5539241999-12-26 00:47:03 +0000966 if (!dc || !dc->funcs->pGetTextExtentPoint) return FALSE;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000967
968 size->cx = size->cy = nFit = extent = 0;
969 for(index = 0; index < count; index++)
970 {
971 if(!dc->funcs->pGetTextExtentPoint( dc, str, 1, &tSize )) return FALSE;
972 if( extent+tSize.cx < maxExt )
973 {
974 extent+=tSize.cx;
975 nFit++;
976 str++;
977 if( alpDx ) alpDx[index] = extent;
978 if( tSize.cy > size->cy ) size->cy = tSize.cy;
979 }
980 else break;
981 }
982 size->cx = extent;
Huw D M Daviesc5539241999-12-26 00:47:03 +0000983 *lpnFit = nFit;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000984
Huw D M Daviesc5539241999-12-26 00:47:03 +0000985 TRACE("(%08x %s %d) returning %d %d %d\n",
986 hdc,debugstr_wn(str,count),maxExt,nFit, size->cx,size->cy);
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000987 return TRUE;
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000988}
989
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000990/***********************************************************************
Alexandre Julliard3051b641996-07-05 17:14:13 +0000991 * GetTextMetrics16 (GDI.93)
Alexandre Julliard401710d1993-09-04 10:09:32 +0000992 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000993BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *metrics )
Alexandre Julliard401710d1993-09-04 10:09:32 +0000994{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000995 TEXTMETRICA tm32;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000996
Alexandre Julliarda3960291999-02-26 11:11:13 +0000997 if (!GetTextMetricsA( (HDC)hdc, &tm32 )) return FALSE;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000998 FONT_TextMetric32Ato16( &tm32, metrics );
Alexandre Julliard3051b641996-07-05 17:14:13 +0000999 return TRUE;
1000}
1001
1002
1003/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001004 * GetTextMetricsA (GDI32.236)
Alexandre Julliard01d63461997-01-20 19:43:45 +00001005 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001006BOOL WINAPI GetTextMetricsA( HDC hdc, TEXTMETRICA *metrics )
Alexandre Julliard01d63461997-01-20 19:43:45 +00001007{
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001008 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
Alexandre Julliard01d63461997-01-20 19:43:45 +00001009 if (!dc)
1010 {
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001011 if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC )))
Alexandre Julliard01d63461997-01-20 19:43:45 +00001012 return FALSE;
1013 }
1014
1015 if (!dc->funcs->pGetTextMetrics ||
Alexandre Julliard77b99181997-09-14 17:17:23 +00001016 !dc->funcs->pGetTextMetrics( dc, metrics ))
Alexandre Julliard01d63461997-01-20 19:43:45 +00001017 return FALSE;
Alexandre Julliard77b99181997-09-14 17:17:23 +00001018
1019 /* device layer returns values in device units
1020 * therefore we have to convert them to logical */
1021
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001022#define WDPTOLP(x) ((x<0)? \
1023 (-abs((x)*dc->wndExtX/dc->vportExtX)): \
1024 (abs((x)*dc->wndExtX/dc->vportExtX)))
1025#define HDPTOLP(y) ((y<0)? \
1026 (-abs((y)*dc->wndExtY/dc->vportExtY)): \
1027 (abs((y)*dc->wndExtY/dc->vportExtY)))
1028
1029 metrics->tmHeight = HDPTOLP(metrics->tmHeight);
1030 metrics->tmAscent = HDPTOLP(metrics->tmAscent);
1031 metrics->tmDescent = HDPTOLP(metrics->tmDescent);
1032 metrics->tmInternalLeading = HDPTOLP(metrics->tmInternalLeading);
1033 metrics->tmExternalLeading = HDPTOLP(metrics->tmExternalLeading);
1034 metrics->tmAveCharWidth = WDPTOLP(metrics->tmAveCharWidth);
1035 metrics->tmMaxCharWidth = WDPTOLP(metrics->tmMaxCharWidth);
1036 metrics->tmOverhang = WDPTOLP(metrics->tmOverhang);
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001037
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001038 TRACE("text metrics:\n"
1039 " Weight = %03li\t FirstChar = %03i\t AveCharWidth = %li\n"
1040 " Italic = % 3i\t LastChar = %03i\t\t MaxCharWidth = %li\n"
1041 " UnderLined = %01i\t DefaultChar = %03i\t Overhang = %li\n"
1042 " StruckOut = %01i\t BreakChar = %03i\t CharSet = %i\n"
1043 " PitchAndFamily = %02x\n"
1044 " --------------------\n"
1045 " InternalLeading = %li\n"
1046 " Ascent = %li\n"
1047 " Descent = %li\n"
1048 " Height = %li\n",
1049 metrics->tmWeight, metrics->tmFirstChar, metrics->tmAveCharWidth,
1050 metrics->tmItalic, metrics->tmLastChar, metrics->tmMaxCharWidth,
1051 metrics->tmUnderlined, metrics->tmDefaultChar, metrics->tmOverhang,
1052 metrics->tmStruckOut, metrics->tmBreakChar, metrics->tmCharSet,
1053 metrics->tmPitchAndFamily,
1054 metrics->tmInternalLeading,
1055 metrics->tmAscent,
1056 metrics->tmDescent,
1057 metrics->tmHeight );
Alexandre Julliard01d63461997-01-20 19:43:45 +00001058 return TRUE;
1059}
1060
1061
1062/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001063 * GetTextMetricsW (GDI32.237)
Alexandre Julliard3051b641996-07-05 17:14:13 +00001064 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001065BOOL WINAPI GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics )
Alexandre Julliard3051b641996-07-05 17:14:13 +00001066{
Alexandre Julliarda3960291999-02-26 11:11:13 +00001067 TEXTMETRICA tm;
1068 if (!GetTextMetricsA( (HDC16)hdc, &tm )) return FALSE;
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001069 FONT_TextMetric32Ato32W( &tm, metrics );
Alexandre Julliard3051b641996-07-05 17:14:13 +00001070 return TRUE;
1071}
1072
1073
1074/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001075 * GetOutlineTextMetrics16 [GDI.308] Gets metrics for TrueType fonts.
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001076 *
1077 * NOTES
1078 * lpOTM should be LPOUTLINETEXTMETRIC
1079 *
1080 * RETURNS
1081 * Success: Non-zero or size of required buffer
1082 * Failure: 0
1083 */
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001084UINT16 WINAPI GetOutlineTextMetrics16(
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001085 HDC16 hdc, /* [in] Handle of device context */
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001086 UINT16 cbData, /* [in] Size of metric data array */
Moshe Vainer4a150e71998-10-14 18:15:43 +00001087 LPOUTLINETEXTMETRIC16 lpOTM) /* [out] Address of metric data array */
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001088{
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001089 FIXME("(%04x,%04x,%p): stub\n", hdc,cbData,lpOTM);
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001090 return 0;
1091}
1092
1093
1094/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001095 * GetOutlineTextMetricsA [GDI.207] Gets metrics for TrueType fonts.
Moshe Vainer4a150e71998-10-14 18:15:43 +00001096 *
1097 *
1098 * RETURNS
1099 * Success: Non-zero or size of required buffer
1100 * Failure: 0
1101 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001102UINT WINAPI GetOutlineTextMetricsA(
1103 HDC hdc, /* [in] Handle of device context */
1104 UINT cbData, /* [in] Size of metric data array */
1105 LPOUTLINETEXTMETRICA lpOTM) /* [out] Address of metric data array */
Moshe Vainer4a150e71998-10-14 18:15:43 +00001106{
1107
1108
Alexandre Julliarda3960291999-02-26 11:11:13 +00001109 UINT rtn = FALSE;
1110 LPTEXTMETRICA lptxtMetr;
Moshe Vainer4a150e71998-10-14 18:15:43 +00001111
1112
1113
1114 if (lpOTM == 0)
1115 {
1116
Alexandre Julliarda3960291999-02-26 11:11:13 +00001117 lpOTM = (LPOUTLINETEXTMETRICA)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(OUTLINETEXTMETRICA));
1118 rtn = sizeof(OUTLINETEXTMETRICA);
Moshe Vainer4a150e71998-10-14 18:15:43 +00001119 cbData = rtn;
1120 } else
1121 {
1122 cbData = sizeof(*lpOTM);
1123 rtn = cbData;
1124 };
1125
1126 lpOTM->otmSize = cbData;
1127
Alexandre Julliarda3960291999-02-26 11:11:13 +00001128 lptxtMetr =HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(TEXTMETRICA));
Moshe Vainer4a150e71998-10-14 18:15:43 +00001129
Alexandre Julliarda3960291999-02-26 11:11:13 +00001130 if (!GetTextMetricsA(hdc,lptxtMetr))
Moshe Vainer4a150e71998-10-14 18:15:43 +00001131 {
1132 return 0;
1133 } else
1134 {
Alexandre Julliarda3960291999-02-26 11:11:13 +00001135 memcpy(&(lpOTM->otmTextMetrics),lptxtMetr,sizeof(TEXTMETRICA));
Moshe Vainer4a150e71998-10-14 18:15:43 +00001136 };
1137
1138 HeapFree(GetProcessHeap(),HEAP_ZERO_MEMORY,lptxtMetr);
1139
1140 lpOTM->otmFilter = 0;
1141
1142 lpOTM->otmPanoseNumber.bFamilyType = 0;
1143 lpOTM->otmPanoseNumber.bSerifStyle = 0;
1144 lpOTM->otmPanoseNumber.bWeight = 0;
1145 lpOTM->otmPanoseNumber.bProportion = 0;
1146 lpOTM->otmPanoseNumber.bContrast = 0;
1147 lpOTM->otmPanoseNumber.bStrokeVariation = 0;
1148 lpOTM->otmPanoseNumber.bArmStyle = 0;
1149 lpOTM->otmPanoseNumber.bLetterform = 0;
1150 lpOTM->otmPanoseNumber.bMidline = 0;
1151 lpOTM->otmPanoseNumber.bXHeight = 0;
1152
1153 lpOTM->otmfsSelection = 0;
1154 lpOTM->otmfsType = 0;
1155
1156 /*
1157 Further fill of the structure not implemented,
1158 Needs real values for the structure members
1159 */
1160
1161 return rtn;
1162}
1163
Alexandre Julliard0c0e3be1998-12-10 15:49:22 +00001164/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001165 * GetOutlineTextMetricsW [GDI32.208]
Alexandre Julliard0c0e3be1998-12-10 15:49:22 +00001166 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001167UINT WINAPI GetOutlineTextMetricsW(
1168 HDC hdc, /* [in] Handle of device context */
1169 UINT cbData, /* [in] Size of metric data array */
1170 LPOUTLINETEXTMETRICW lpOTM) /* [out] Address of metric data array */
Alexandre Julliard0c0e3be1998-12-10 15:49:22 +00001171{
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001172 FIXME("(%d,%d,%p): stub\n", hdc, cbData, lpOTM);
Alexandre Julliard0c0e3be1998-12-10 15:49:22 +00001173 return 0;
1174}
Moshe Vainer4a150e71998-10-14 18:15:43 +00001175
1176/***********************************************************************
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001177 * GetCharWidth16 (GDI.350)
1178 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001179BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar,
1180 LPINT16 buffer )
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001181{
Alexandre Julliarda3960291999-02-26 11:11:13 +00001182 BOOL retVal = FALSE;
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001183
1184 if( firstChar != lastChar )
1185 {
Alexandre Julliarda3960291999-02-26 11:11:13 +00001186 LPINT buf32 = (LPINT)HeapAlloc(GetProcessHeap(), 0,
1187 sizeof(INT)*(1 + (lastChar - firstChar)));
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001188 if( buf32 )
1189 {
Alexandre Julliarda3960291999-02-26 11:11:13 +00001190 LPINT obuf32 = buf32;
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001191 int i;
1192
1193 retVal = GetCharWidth32A(hdc, firstChar, lastChar, buf32);
1194 if (retVal)
1195 {
1196 for (i = firstChar; i <= lastChar; i++)
1197 *buffer++ = *buf32++;
1198 }
Alexandre Julliard3db94ef1997-09-28 17:43:24 +00001199 HeapFree(GetProcessHeap(), 0, obuf32);
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001200 }
1201 }
Alexandre Julliard33072e11997-06-29 18:08:02 +00001202 else /* happens quite often to warrant a special treatment */
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001203 {
Alexandre Julliarda3960291999-02-26 11:11:13 +00001204 INT chWidth;
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001205 retVal = GetCharWidth32A(hdc, firstChar, lastChar, &chWidth );
Alexandre Julliard33072e11997-06-29 18:08:02 +00001206 *buffer = chWidth;
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001207 }
1208 return retVal;
1209}
1210
1211
1212/***********************************************************************
1213 * GetCharWidth32A (GDI32.155)
1214 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001215BOOL WINAPI GetCharWidth32A( HDC hdc, UINT firstChar, UINT lastChar,
1216 LPINT buffer )
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001217{
Alexandre Julliarda3960291999-02-26 11:11:13 +00001218 UINT i, extra;
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001219 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
1220 if (!dc)
1221 {
1222 if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC )))
1223 return FALSE;
1224 }
1225
1226 if (!dc->funcs->pGetCharWidth ||
1227 !dc->funcs->pGetCharWidth( dc, firstChar, lastChar, buffer))
1228 return FALSE;
1229
Alexandre Julliard33072e11997-06-29 18:08:02 +00001230 /* convert device units to logical */
1231
1232 extra = dc->vportExtX >> 1;
1233 for( i = firstChar; i <= lastChar; i++, buffer++ )
1234 *buffer = (*buffer * dc->wndExtX + extra) / dc->vportExtX;
1235
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001236 return TRUE;
1237}
1238
1239
1240/***********************************************************************
1241 * GetCharWidth32W (GDI32.158)
1242 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001243BOOL WINAPI GetCharWidth32W( HDC hdc, UINT firstChar, UINT lastChar,
1244 LPINT buffer )
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001245{
1246 return GetCharWidth32A( hdc, firstChar, lastChar, buffer );
1247}
1248
1249
1250
1251/* FIXME: all following APIs *******************************************
1252 *
1253 *
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001254 * SetMapperFlags16 (GDI.349)
Alexandre Julliard58199531994-04-21 01:20:00 +00001255 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001256DWORD WINAPI SetMapperFlags16( HDC16 hDC, DWORD dwFlag )
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001257{
Alexandre Julliarda3960291999-02-26 11:11:13 +00001258 return SetMapperFlags( hDC, dwFlag );
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001259}
1260
1261
1262/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001263 * SetMapperFlags (GDI32.322)
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001264 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001265DWORD WINAPI SetMapperFlags( HDC hDC, DWORD dwFlag )
Alexandre Julliard58199531994-04-21 01:20:00 +00001266{
Huw D M Davies7603dea1999-04-25 09:24:23 +00001267 DC *dc = DC_GetDCPtr( hDC );
1268 DWORD ret = 0;
1269 if(!dc) return 0;
1270 if(dc->funcs->pSetMapperFlags)
1271 ret = dc->funcs->pSetMapperFlags( dc, dwFlag );
1272 else
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001273 FIXME("(0x%04x, 0x%08lx): stub - harmless\n", hDC, dwFlag);
Huw D M Davies7603dea1999-04-25 09:24:23 +00001274 GDI_HEAP_UNLOCK( hDC );
1275 return ret;
Alexandre Julliard58199531994-04-21 01:20:00 +00001276}
1277
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001278/***********************************************************************
1279 * GetAspectRatioFilterEx16 (GDI.486)
1280 */
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001281BOOL16 WINAPI GetAspectRatioFilterEx16( HDC16 hdc, LPSIZE16 pAspectRatio )
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001282{
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001283 FIXME("(%04x, %p): -- Empty Stub !\n", hdc, pAspectRatio);
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001284 return FALSE;
1285}
1286
Paul Quinn1beaae51998-12-15 15:38:36 +00001287/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001288 * GetAspectRatioFilterEx (GDI32.142)
Paul Quinn1beaae51998-12-15 15:38:36 +00001289 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001290BOOL WINAPI GetAspectRatioFilterEx( HDC hdc, LPSIZE pAspectRatio )
Paul Quinn1beaae51998-12-15 15:38:36 +00001291{
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001292 FIXME("(%04x, %p): -- Empty Stub !\n", hdc, pAspectRatio);
Paul Quinn1beaae51998-12-15 15:38:36 +00001293 return FALSE;
1294}
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001295
Alexandre Julliard7d654eb1996-02-25 11:36:22 +00001296/***********************************************************************
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001297 * GetCharABCWidths16 (GDI.307)
Alexandre Julliard7d654eb1996-02-25 11:36:22 +00001298 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001299BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar,
1300 LPABC16 abc )
Alexandre Julliard7d654eb1996-02-25 11:36:22 +00001301{
Alexandre Julliarda3960291999-02-26 11:11:13 +00001302 ABC abc32;
1303 if (!GetCharABCWidthsA( hdc, firstChar, lastChar, &abc32 )) return FALSE;
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001304 abc->abcA = abc32.abcA;
1305 abc->abcB = abc32.abcB;
1306 abc->abcC = abc32.abcC;
1307 return TRUE;
1308}
Alexandre Julliard1e9ac791996-06-06 18:38:27 +00001309
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001310
1311/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001312 * GetCharABCWidthsA (GDI32.149)
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001313 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001314BOOL WINAPI GetCharABCWidthsA(HDC hdc, UINT firstChar, UINT lastChar,
1315 LPABC abc )
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001316{
Alexandre Julliarda3960291999-02-26 11:11:13 +00001317 return GetCharABCWidthsW( hdc, firstChar, lastChar, abc );
Alexandre Julliard7d654eb1996-02-25 11:36:22 +00001318}
Alexandre Julliard5f721f81994-01-04 20:14:34 +00001319
Alexandre Julliard5f721f81994-01-04 20:14:34 +00001320
Alexandre Julliard46ea8b31998-05-03 19:01:20 +00001321/******************************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001322 * GetCharABCWidthsW [GDI32.152] Retrieves widths of characters in range
Alexandre Julliard46ea8b31998-05-03 19:01:20 +00001323 *
1324 * PARAMS
1325 * hdc [I] Handle of device context
1326 * firstChar [I] First character in range to query
1327 * lastChar [I] Last character in range to query
1328 * abc [O] Address of character-width structure
1329 *
1330 * NOTES
1331 * Only works with TrueType fonts
1332 *
1333 * RETURNS
1334 * Success: TRUE
1335 * Failure: FALSE
Alexandre Julliard0e607781993-11-03 19:23:37 +00001336 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001337BOOL WINAPI GetCharABCWidthsW( HDC hdc, UINT firstChar, UINT lastChar,
1338 LPABC abc )
Alexandre Julliard0e607781993-11-03 19:23:37 +00001339{
Alexandre Julliard46ea8b31998-05-03 19:01:20 +00001340 /* No TrueType fonts in Wine so far */
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001341 FIXME("(%04x,%04x,%04x,%p): stub\n", hdc, firstChar, lastChar, abc);
Alexandre Julliard46ea8b31998-05-03 19:01:20 +00001342 return FALSE;
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001343}
1344
1345
1346/***********************************************************************
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001347 * GetGlyphOutline16 (GDI.309)
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001348 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001349DWORD WINAPI GetGlyphOutline16( HDC16 hdc, UINT16 uChar, UINT16 fuFormat,
1350 LPGLYPHMETRICS16 lpgm, DWORD cbBuffer,
1351 LPVOID lpBuffer, const MAT2 *lpmat2 )
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001352{
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001353 FIXME("(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
Alexandre Julliard54c27111998-03-29 19:44:57 +00001354 hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001355 return (DWORD)-1; /* failure */
Alexandre Julliard0e607781993-11-03 19:23:37 +00001356}
Alexandre Julliard58199531994-04-21 01:20:00 +00001357
Alexandre Julliard3ed37e01994-11-07 18:20:42 +00001358
1359/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001360 * GetGlyphOutlineA (GDI32.186)
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001361 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001362DWORD WINAPI GetGlyphOutlineA( HDC hdc, UINT uChar, UINT fuFormat,
1363 LPGLYPHMETRICS lpgm, DWORD cbBuffer,
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001364 LPVOID lpBuffer, const MAT2 *lpmat2 )
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001365{
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001366 FIXME("(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
Alexandre Julliard54c27111998-03-29 19:44:57 +00001367 hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001368 return (DWORD)-1; /* failure */
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001369}
1370
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001371/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001372 * GetGlyphOutlineW (GDI32.187)
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001373 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001374DWORD WINAPI GetGlyphOutlineW( HDC hdc, UINT uChar, UINT fuFormat,
1375 LPGLYPHMETRICS lpgm, DWORD cbBuffer,
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001376 LPVOID lpBuffer, const MAT2 *lpmat2 )
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001377{
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001378 FIXME("(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
Alexandre Julliard54c27111998-03-29 19:44:57 +00001379 hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001380 return (DWORD)-1; /* failure */
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001381}
1382
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +00001383/***********************************************************************
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001384 * CreateScalableFontResource16 (GDI.310)
Alexandre Julliard3ed37e01994-11-07 18:20:42 +00001385 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001386BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden,
1387 LPCSTR lpszResourceFile,
1388 LPCSTR fontFile, LPCSTR path )
Alexandre Julliard21979011997-03-05 08:22:35 +00001389{
Alexandre Julliarda3960291999-02-26 11:11:13 +00001390 return CreateScalableFontResourceA( fHidden, lpszResourceFile,
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001391 fontFile, path );
Alexandre Julliard21979011997-03-05 08:22:35 +00001392}
1393
Alexandre Julliard21979011997-03-05 08:22:35 +00001394/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001395 * CreateScalableFontResourceA (GDI32.62)
Alexandre Julliard21979011997-03-05 08:22:35 +00001396 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001397BOOL WINAPI CreateScalableFontResourceA( DWORD fHidden,
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001398 LPCSTR lpszResourceFile,
1399 LPCSTR lpszFontFile,
1400 LPCSTR lpszCurrentPath )
Alexandre Julliard3ed37e01994-11-07 18:20:42 +00001401{
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001402 /* fHidden=1 - only visible for the calling app, read-only, not
1403 * enumbered with EnumFonts/EnumFontFamilies
1404 * lpszCurrentPath can be NULL
1405 */
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001406 FIXME("(%ld,%s,%s,%s): stub\n",
Alexandre Julliard54c27111998-03-29 19:44:57 +00001407 fHidden, lpszResourceFile, lpszFontFile, lpszCurrentPath );
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001408 return FALSE; /* create failed */
Alexandre Julliard3ed37e01994-11-07 18:20:42 +00001409}
1410
Alexandre Julliard3ed37e01994-11-07 18:20:42 +00001411/***********************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001412 * CreateScalableFontResourceW (GDI32.63)
Alexandre Julliard3ed37e01994-11-07 18:20:42 +00001413 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001414BOOL WINAPI CreateScalableFontResourceW( DWORD fHidden,
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001415 LPCWSTR lpszResourceFile,
1416 LPCWSTR lpszFontFile,
1417 LPCWSTR lpszCurrentPath )
Alexandre Julliard21979011997-03-05 08:22:35 +00001418{
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001419 FIXME("(%ld,%p,%p,%p): stub\n",
Alexandre Julliard54c27111998-03-29 19:44:57 +00001420 fHidden, lpszResourceFile, lpszFontFile, lpszCurrentPath );
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001421 return FALSE; /* create failed */
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001422}
1423
1424
1425/*************************************************************************
Alexandre Julliard21979011997-03-05 08:22:35 +00001426 * GetRasterizerCaps16 (GDI.313)
Alexandre Julliardfa68b751995-04-03 16:55:37 +00001427 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001428BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes)
Alexandre Julliard21979011997-03-05 08:22:35 +00001429{
Alexandre Julliarda3960291999-02-26 11:11:13 +00001430 return GetRasterizerCaps( lprs, cbNumBytes );
Alexandre Julliard21979011997-03-05 08:22:35 +00001431}
Alexandre Julliard58199531994-04-21 01:20:00 +00001432
Alexandre Julliard21979011997-03-05 08:22:35 +00001433
1434/*************************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001435 * GetRasterizerCaps (GDI32.216)
Alexandre Julliard21979011997-03-05 08:22:35 +00001436 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001437BOOL WINAPI GetRasterizerCaps( LPRASTERIZER_STATUS lprs, UINT cbNumBytes)
Alexandre Julliardfa68b751995-04-03 16:55:37 +00001438{
Alexandre Julliard03468f71998-02-15 19:40:49 +00001439 lprs->nSize = sizeof(RASTERIZER_STATUS);
1440 lprs->wFlags = TT_AVAILABLE|TT_ENABLED;
1441 lprs->nLanguageID = 0;
Alexandre Julliard21979011997-03-05 08:22:35 +00001442 return TRUE;
Alexandre Julliardfa68b751995-04-03 16:55:37 +00001443}
Alexandre Julliardbd34d4f1995-06-20 19:08:12 +00001444
Alexandre Julliard21979011997-03-05 08:22:35 +00001445
Alexandre Julliardbd34d4f1995-06-20 19:08:12 +00001446/*************************************************************************
Alexandre Julliard21979011997-03-05 08:22:35 +00001447 * GetKerningPairs16 (GDI.332)
Alexandre Julliardbd34d4f1995-06-20 19:08:12 +00001448 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001449INT16 WINAPI GetKerningPairs16( HDC16 hDC, INT16 cPairs,
1450 LPKERNINGPAIR16 lpKerningPairs )
Alexandre Julliardbd34d4f1995-06-20 19:08:12 +00001451{
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001452 /* At this time kerning is ignored (set to 0) */
Alexandre Julliard339eefc1996-06-23 14:56:20 +00001453 int i;
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001454 FIXME("(%x,%d,%p): almost empty stub!\n", hDC, cPairs, lpKerningPairs);
Alexandre Julliard54c27111998-03-29 19:44:57 +00001455 for (i = 0; i < cPairs; i++)
1456 lpKerningPairs[i].iKernAmount = 0;
Alexandre Julliard339eefc1996-06-23 14:56:20 +00001457 return 0;
Alexandre Julliardbd34d4f1995-06-20 19:08:12 +00001458}
Alexandre Julliard349a9531997-02-02 19:01:52 +00001459
Alexandre Julliard21979011997-03-05 08:22:35 +00001460
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001461
Alexandre Julliard21979011997-03-05 08:22:35 +00001462/*************************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001463 * GetKerningPairsA (GDI32.192)
Alexandre Julliard21979011997-03-05 08:22:35 +00001464 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001465DWORD WINAPI GetKerningPairsA( HDC hDC, DWORD cPairs,
1466 LPKERNINGPAIR lpKerningPairs )
Alexandre Julliard21979011997-03-05 08:22:35 +00001467{
Alexandre Julliard21979011997-03-05 08:22:35 +00001468 int i;
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001469 FIXME("(%x,%ld,%p): almost empty stub!\n", hDC, cPairs, lpKerningPairs);
Alexandre Julliard54c27111998-03-29 19:44:57 +00001470 for (i = 0; i < cPairs; i++)
1471 lpKerningPairs[i].iKernAmount = 0;
Alexandre Julliard21979011997-03-05 08:22:35 +00001472 return 0;
1473}
1474
1475
1476/*************************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001477 * GetKerningPairsW (GDI32.193)
Alexandre Julliard21979011997-03-05 08:22:35 +00001478 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001479DWORD WINAPI GetKerningPairsW( HDC hDC, DWORD cPairs,
1480 LPKERNINGPAIR lpKerningPairs )
Alexandre Julliard21979011997-03-05 08:22:35 +00001481{
Alexandre Julliarda3960291999-02-26 11:11:13 +00001482 return GetKerningPairsA( hDC, cPairs, lpKerningPairs );
Alexandre Julliard21979011997-03-05 08:22:35 +00001483}
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001484
Alexandre Julliard642d3131998-07-12 19:29:36 +00001485/*************************************************************************
Douglas Ridgway4f7d9ed1998-12-18 17:38:39 +00001486 * TranslateCharsetInfo [GDI32.382]
1487 *
1488 * Fills a CHARSETINFO structure for a character set, code page, or
1489 * font. This allows making the correspondance between different labelings
1490 * (character set, Windows, ANSI, and OEM codepages, and Unicode ranges)
1491 * of the same encoding.
1492 *
1493 * Only one codepage will be set in lpCs->fs. If TCI_SRCFONTSIG is used,
1494 * only one codepage should be set in *lpSrc.
1495 *
1496 * RETURNS
1497 * TRUE on success, FALSE on failure.
1498 *
Alexandre Julliard642d3131998-07-12 19:29:36 +00001499 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001500BOOL WINAPI TranslateCharsetInfo(
Douglas Ridgway4f7d9ed1998-12-18 17:38:39 +00001501 LPDWORD lpSrc, /*
1502 if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE
1503 if flags == TCI_SRCCHARSET: a character set value
1504 if flags == TCI_SRCCODEPAGE: a code page value
1505 */
1506 LPCHARSETINFO lpCs, /* structure to receive charset information */
1507 DWORD flags /* determines interpretation of lpSrc */
1508) {
Douglas Ridgwayab9e8bc1999-01-01 18:41:22 +00001509 int index = 0;
1510 switch (flags) {
1511 case TCI_SRCFONTSIG:
1512 while (!(*lpSrc>>index & 0x0001) && index<MAXTCIINDEX) index++;
1513 break;
1514 case TCI_SRCCODEPAGE:
Alexandre Julliarda3960291999-02-26 11:11:13 +00001515 while ((UINT) (lpSrc) != FONT_tci[index].ciACP && index < MAXTCIINDEX) index++;
Douglas Ridgwayab9e8bc1999-01-01 18:41:22 +00001516 break;
1517 case TCI_SRCCHARSET:
Alexandre Julliarda3960291999-02-26 11:11:13 +00001518 while ((UINT) (lpSrc) != FONT_tci[index].ciCharset && index < MAXTCIINDEX) index++;
Douglas Ridgwayab9e8bc1999-01-01 18:41:22 +00001519 break;
1520 default:
1521 return FALSE;
1522 }
1523 if (index >= MAXTCIINDEX || FONT_tci[index].ciCharset == DEFAULT_CHARSET) return FALSE;
1524 memcpy(lpCs, &FONT_tci[index], sizeof(CHARSETINFO));
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001525 return TRUE;
1526}
1527
Alexandre Julliarde658d821997-11-30 17:45:40 +00001528/*************************************************************************
1529 * GetFontLanguageInfo (GDI32.182)
1530 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001531DWORD WINAPI GetFontLanguageInfo(HDC hdc) {
Alexandre Julliarde658d821997-11-30 17:45:40 +00001532 /* return value 0 is correct for most cases anyway */
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001533 FIXME("(%x):stub!\n", hdc);
Alexandre Julliarde658d821997-11-30 17:45:40 +00001534 return 0;
1535}
1536
1537/*************************************************************************
1538 * GetFontLanguageInfo (GDI.616)
1539 */
1540DWORD WINAPI GetFontLanguageInfo16(HDC16 hdc) {
1541 /* return value 0 is correct for most cases anyway */
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001542 FIXME("(%x):stub!\n",hdc);
Alexandre Julliarde658d821997-11-30 17:45:40 +00001543 return 0;
1544}
Alexandre Julliard642d3131998-07-12 19:29:36 +00001545
Alexandre Julliard767e6f61998-08-09 12:47:43 +00001546/*************************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001547 * GetFontData [GDI32.181] Retrieve data for TrueType font
Alexandre Julliard767e6f61998-08-09 12:47:43 +00001548 *
1549 * RETURNS
1550 *
1551 * success: Number of bytes returned
1552 * failure: GDI_ERROR
1553 *
1554 * NOTES
1555 *
1556 * Calls SetLastError()
1557 *
1558 * BUGS
1559 *
1560 * Unimplemented
1561 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001562DWORD WINAPI GetFontData(HDC hdc, DWORD table, DWORD offset,
Alexandre Julliard767e6f61998-08-09 12:47:43 +00001563 LPVOID buffer, DWORD length)
1564{
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001565 FIXME("(%x,%ld,%ld,%p,%ld): stub\n", hdc, table, offset, buffer, length);
Alexandre Julliard767e6f61998-08-09 12:47:43 +00001566 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1567 return GDI_ERROR;
1568}
Alexandre Julliard642d3131998-07-12 19:29:36 +00001569
1570/*************************************************************************
Huw D M Daviescdf191a1999-11-21 02:01:41 +00001571 * GetFontData16 [GDI.311]
1572 *
1573 */
1574DWORD WINAPI GetFontData16(HDC16 hdc, DWORD dwTable, DWORD dwOffset,
1575 LPVOID lpvBuffer, DWORD cbData)
1576{
1577 return GetFontData(hdc, dwTable, dwOffset, lpvBuffer, cbData);
1578}
1579
1580/*************************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001581 * GetCharacterPlacementA [GDI32.160]
Juergen Schmied2259e441999-08-15 14:22:48 +00001582 *
1583 * NOTES:
1584 * the web browser control of ie4 calls this with dwFlags=0
Alexandre Julliard642d3131998-07-12 19:29:36 +00001585 */
1586DWORD WINAPI
Alexandre Julliarda3960291999-02-26 11:11:13 +00001587GetCharacterPlacementA(HDC hdc, LPCSTR lpString, INT uCount,
1588 INT nMaxExtent, GCP_RESULTSA *lpResults,
Alexandre Julliard642d3131998-07-12 19:29:36 +00001589 DWORD dwFlags)
1590{
Juergen Schmied2259e441999-08-15 14:22:48 +00001591 DWORD ret=0;
1592 SIZE size;
1593
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001594 TRACE("%s 0x%08x 0x%08x 0x%08lx:stub!\n",
1595 debugstr_a(lpString), uCount, nMaxExtent, dwFlags);
Juergen Schmied2259e441999-08-15 14:22:48 +00001596
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001597 TRACE("lpOrder=%p lpDx=%p lpCaretPos=%p lpClass=%p "
1598 "lpOutString=%p lpGlyphs=%p\n",
1599 lpResults->lpOrder, lpResults->lpDx, lpResults->lpCaretPos,
1600 lpResults->lpClass, lpResults->lpOutString, lpResults->lpGlyphs);
Juergen Schmied2259e441999-08-15 14:22:48 +00001601
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001602 if(dwFlags) FIXME("flags 0x%08lx ignored\n", dwFlags);
1603 if(lpResults->lpOrder) FIXME("reordering not implemented\n");
1604 if(lpResults->lpCaretPos) FIXME("caret positions not implemented\n");
1605 if(lpResults->lpClass) FIXME("classes not implemented\n");
1606 if(lpResults->lpGlyphs) FIXME("glyphs not implemented\n");
Juergen Schmied2259e441999-08-15 14:22:48 +00001607
1608 /* copy will do if the GCP_REORDER flag is not set */
1609 if(lpResults->lpOutString)
1610 {
1611 lstrcpynA(lpResults->lpOutString, lpString, uCount);
1612 }
1613
1614 if (lpResults->lpDx)
1615 {
1616 int i, c;
1617 for (i=0; i<uCount;i++)
1618 {
1619 if (GetCharWidth32A(hdc, lpString[i], lpString[i], &c))
1620 lpResults->lpDx[i]= c;
1621 }
1622 }
1623
1624 if (GetTextExtentPoint32A(hdc, lpString, uCount, &size))
1625 ret = MAKELONG(size.cx, size.cy);
1626
1627 return ret;
Alexandre Julliard642d3131998-07-12 19:29:36 +00001628}
1629
1630/*************************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001631 * GetCharacterPlacementW [GDI32.161]
Alexandre Julliard642d3131998-07-12 19:29:36 +00001632 */
1633DWORD WINAPI
Alexandre Julliarda3960291999-02-26 11:11:13 +00001634GetCharacterPlacementW(HDC hdc, LPCWSTR lpString, INT uCount,
1635 INT nMaxExtent, GCP_RESULTSW *lpResults,
Alexandre Julliard642d3131998-07-12 19:29:36 +00001636 DWORD dwFlags)
1637{
1638 /* return value 0 is correct for most cases anyway */
Dimitrie O. Paundd03cc11999-12-08 03:56:23 +00001639 FIXME(":stub!\n");
Alexandre Julliard642d3131998-07-12 19:29:36 +00001640 return 0;
1641}
Paul Quinn1beaae51998-12-15 15:38:36 +00001642
1643/*************************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001644 * GetCharABCWidthsFloatA [GDI32.150]
Paul Quinn1beaae51998-12-15 15:38:36 +00001645 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001646BOOL WINAPI GetCharABCWidthsFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar,
Paul Quinn1beaae51998-12-15 15:38:36 +00001647 LPABCFLOAT lpABCF)
1648{
Alexandre Julliard06c275a1999-05-02 14:32:27 +00001649 FIXME_(gdi)("GetCharABCWidthsFloatA, stub\n");
Paul Quinn1beaae51998-12-15 15:38:36 +00001650 return 0;
1651}
1652
1653/*************************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001654 * GetCharABCWidthsFloatW [GDI32.151]
Paul Quinn1beaae51998-12-15 15:38:36 +00001655 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001656BOOL WINAPI GetCharABCWidthsFloatW(HDC hdc, UINT iFirstChar,
1657 UINT iLastChar, LPABCFLOAT lpABCF)
Paul Quinn1beaae51998-12-15 15:38:36 +00001658{
Alexandre Julliard06c275a1999-05-02 14:32:27 +00001659 FIXME_(gdi)("GetCharABCWidthsFloatW, stub\n");
Paul Quinn1beaae51998-12-15 15:38:36 +00001660 return 0;
1661}
1662
1663/*************************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001664 * GetCharWidthFloatA [GDI32.156]
Paul Quinn1beaae51998-12-15 15:38:36 +00001665 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001666BOOL WINAPI GetCharWidthFloatA(HDC hdc, UINT iFirstChar,
1667 UINT iLastChar, PFLOAT pxBuffer)
Paul Quinn1beaae51998-12-15 15:38:36 +00001668{
Alexandre Julliard06c275a1999-05-02 14:32:27 +00001669 FIXME_(gdi)("GetCharWidthFloatA, stub\n");
Paul Quinn1beaae51998-12-15 15:38:36 +00001670 return 0;
1671}
1672
1673/*************************************************************************
Huw D M Daviesaec373c1999-07-23 19:25:11 +00001674 * GetCharWidthFloatW [GDI32.157]
Paul Quinn1beaae51998-12-15 15:38:36 +00001675 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001676BOOL WINAPI GetCharWidthFloatW(HDC hdc, UINT iFirstChar,
1677 UINT iLastChar, PFLOAT pxBuffer)
Paul Quinn1beaae51998-12-15 15:38:36 +00001678{
Alexandre Julliard06c275a1999-05-02 14:32:27 +00001679 FIXME_(gdi)("GetCharWidthFloatW, stub\n");
Paul Quinn1beaae51998-12-15 15:38:36 +00001680 return 0;
1681}
1682