ReactOS 0.4.16-dev-2332-g4cba65d
font.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS GDI32
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Font manipulation API
5 * COPYRIGHT: Copyright 2019 James Tabor
6 * Copyright 2019 Pierre Schweitzer (heis_spiter@hotmail.com)
7 * Copyright 2019-2021 Hermes Belusca-Maito (hermes.belusca-maito@reactos.org)
8 * Copyright 2018 Baruch Rutman (peterooch@gmail.com)
9 * Copyright 2025 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
10 */
11
12#include <precomp.h>
13
14#include <math.h>
15#include <strsafe.h>
16
17#define NDEBUG
18#include <debug.h>
19
20/* Rounds a floating point number to integer. The world-to-viewport
21 * transformation process is done in floating point internally. This function
22 * is then used to round these coordinates to integer values.
23 */
25{
26 return (int)floor(val + 0.5);
27}
28
29/*
30 * For TranslateCharsetInfo
31 */
32#define MAXTCIINDEX 32
34{
35 /* ANSI */
36 { ANSI_CHARSET, 1252, {{0,0,0,0},{FS_LATIN1,0}} },
37 { EASTEUROPE_CHARSET, 1250, {{0,0,0,0},{FS_LATIN2,0}} },
38 { RUSSIAN_CHARSET, 1251, {{0,0,0,0},{FS_CYRILLIC,0}} },
39 { GREEK_CHARSET, 1253, {{0,0,0,0},{FS_GREEK,0}} },
40 { TURKISH_CHARSET, 1254, {{0,0,0,0},{FS_TURKISH,0}} },
41 { HEBREW_CHARSET, 1255, {{0,0,0,0},{FS_HEBREW,0}} },
42 { ARABIC_CHARSET, 1256, {{0,0,0,0},{FS_ARABIC,0}} },
43 { BALTIC_CHARSET, 1257, {{0,0,0,0},{FS_BALTIC,0}} },
44 { VIETNAMESE_CHARSET, 1258, {{0,0,0,0},{FS_VIETNAMESE,0}} },
45 /* reserved by ANSI */
46 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
47 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
48 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
49 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
50 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
51 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
52 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
53 /* ANSI and OEM */
54 { THAI_CHARSET, 874, {{0,0,0,0},{FS_THAI,0}} },
55 { SHIFTJIS_CHARSET, 932, {{0,0,0,0},{FS_JISJAPAN,0}} },
56 { GB2312_CHARSET, 936, {{0,0,0,0},{FS_CHINESESIMP,0}} },
57 { HANGEUL_CHARSET, 949, {{0,0,0,0},{FS_WANSUNG,0}} },
58 { CHINESEBIG5_CHARSET, 950, {{0,0,0,0},{FS_CHINESETRAD,0}} },
59 { JOHAB_CHARSET, 1361, {{0,0,0,0},{FS_JOHAB,0}} },
60 /* reserved for alternate ANSI and OEM */
61 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
62 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
63 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
64 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
65 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
66 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
67 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
68 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
69 /* reserved for system */
70 { DEFAULT_CHARSET, 0, {{0,0,0,0},{FS_LATIN1,0}} },
71 { SYMBOL_CHARSET, CP_SYMBOL, {{0,0,0,0},{FS_SYMBOL,0}} }
72};
73
74#define INITIAL_FAMILY_COUNT 64
75
76/***********************************************************************
77 * TEXTMETRIC conversion functions.
78 */
79VOID
82{
83 ptmA->tmHeight = ptmW->tmHeight;
84 ptmA->tmAscent = ptmW->tmAscent;
85 ptmA->tmDescent = ptmW->tmDescent;
88 ptmA->tmAveCharWidth = ptmW->tmAveCharWidth;
89 ptmA->tmMaxCharWidth = ptmW->tmMaxCharWidth;
90 ptmA->tmWeight = ptmW->tmWeight;
91 ptmA->tmOverhang = ptmW->tmOverhang;
94 ptmA->tmFirstChar = min(ptmW->tmFirstChar, 255);
95 if (ptmW->tmCharSet == SYMBOL_CHARSET)
96 {
97 ptmA->tmFirstChar = 0x1e;
98 ptmA->tmLastChar = 0xff; /* win9x behaviour - we need the OS2 table data to calculate correctly */
99 }
100 else
101 {
102 ptmA->tmFirstChar = ptmW->tmDefaultChar - 1;
103 ptmA->tmLastChar = min(ptmW->tmLastChar, 0xff);
104 }
105 ptmA->tmDefaultChar = (CHAR)ptmW->tmDefaultChar;
106 ptmA->tmBreakChar = (CHAR)ptmW->tmBreakChar;
107 ptmA->tmItalic = ptmW->tmItalic;
108 ptmA->tmUnderlined = ptmW->tmUnderlined;
109 ptmA->tmStruckOut = ptmW->tmStruckOut;
111 ptmA->tmCharSet = ptmW->tmCharSet;
112}
113
114/***********************************************************************
115 * FONT_mbtowc
116 *
117 * Returns a Unicode translation of str using the charset of the
118 * currently selected font in hdc. If count is -1 then str is assumed
119 * to be '\0' terminated, otherwise it contains the number of bytes to
120 * convert. If plenW is non-NULL, on return it will point to the
121 * number of WCHARs that have been written. If pCP is non-NULL, on
122 * return it will point to the codepage used in the conversion. The
123 * caller should free the returned LPWSTR from the process heap
124 * itself.
125 */
127{
129 INT lenW;
130 LPWSTR strW;
131
132 if(count == -1) count = strlen(str);
133 lenW = MultiByteToWideChar(cp, 0, str, count, NULL, 0);
134 strW = HeapAlloc(GetProcessHeap(), 0, lenW*sizeof(WCHAR));
135 if (!strW)
136 return NULL;
137 if(!MultiByteToWideChar(cp, 0, str, count, strW, lenW))
138 {
140 return NULL;
141 }
142 DPRINT("mapped %s -> %S\n", str, strW);
143 if(plenW) *plenW = lenW;
144 if(pCP) *pCP = cp;
145 return strW;
146}
147
148static LPSTR FONT_GetCharsByRangeA(HDC hdc, UINT firstChar, UINT lastChar, PINT pByteLen)
149{
150 INT i, count = lastChar - firstChar + 1;
151 UINT c;
152 LPSTR str;
153
154 if (count <= 0)
155 return NULL;
156
157 switch (GdiGetCodePage(hdc))
158 {
159 case 932:
160 case 936:
161 case 949:
162 case 950:
163 case 1361:
164 if (lastChar > 0xffff)
165 return NULL;
166 if ((firstChar ^ lastChar) > 0xff)
167 return NULL;
168 break;
169 default:
170 if (lastChar > 0xff)
171 return NULL;
172 break;
173 }
174
175 str = HeapAlloc(GetProcessHeap(), 0, count * 2 + 1);
176 if (str == NULL)
177 return NULL;
178
179 for(i = 0, c = firstChar; c <= lastChar; i++, c++)
180 {
181 if (c > 0xff)
182 str[i++] = (BYTE)(c >> 8);
183 str[i] = (BYTE)c;
184 }
185 str[i] = '\0';
186
187 *pByteLen = i;
188
189 return str;
190}
191
194{
196 tma->ntmFlags = tmw->ntmFlags;
197 tma->ntmSizeEM = tmw->ntmSizeEM;
198 tma->ntmCellHeight = tmw->ntmCellHeight;
199 tma->ntmAvgWidth = tmw->ntmAvgWidth;
200}
201
204{
205 NewTextMetricW2A(&tma->ntmTm, &tmw->ntmTm);
206 tma->ntmFontSig = tmw->ntmFontSig;
207}
208
209// IntFontFamilyCompareEx's flags
210#define IFFCX_CHARSET 1
211#define IFFCX_STYLE 2
212
215 const FONTFAMILYINFO *ffi2, DWORD dwCompareFlags)
216{
217 const LOGFONTW *plf1 = &ffi1->EnumLogFontEx.elfLogFont;
218 const LOGFONTW *plf2 = &ffi2->EnumLogFontEx.elfLogFont;
219 ULONG WeightDiff1, WeightDiff2;
220 int cmp = _wcsicmp(plf1->lfFaceName, plf2->lfFaceName);
221 if (cmp)
222 return cmp;
223 if (dwCompareFlags & IFFCX_CHARSET)
224 {
225 if (plf1->lfCharSet < plf2->lfCharSet)
226 return -1;
227 if (plf1->lfCharSet > plf2->lfCharSet)
228 return 1;
229 }
230 if (dwCompareFlags & IFFCX_STYLE)
231 {
232 WeightDiff1 = labs(plf1->lfWeight - FW_NORMAL);
233 WeightDiff2 = labs(plf2->lfWeight - FW_NORMAL);
234 if (WeightDiff1 < WeightDiff2)
235 return -1;
236 if (WeightDiff1 > WeightDiff2)
237 return 1;
238 if (plf1->lfItalic < plf2->lfItalic)
239 return -1;
240 if (plf1->lfItalic > plf2->lfItalic)
241 return 1;
242 }
243 return 0;
244}
245
246static int __cdecl
247IntFontFamilyCompare(const void *ffi1, const void *ffi2)
248{
250}
251
252// IntEnumFontFamilies' flags:
253#define IEFF_UNICODE 1
254#define IEFF_EXTENDED 2
255
256int FASTCALL
258 const LOGFONTW *plf, DWORD dwFlags)
259{
261 DWORD dwCompareFlags = 0;
262
263 if (plf->lfFaceName[0])
264 dwCompareFlags |= IFFCX_STYLE;
265
267 dwCompareFlags |= IFFCX_CHARSET;
268
269 first = InfoList;
270 last = &InfoList[nCount];
271
272 /* std::unique(first, last, IntFontFamilyCompareEx); */
273 if (first == last)
274 return 0;
275
276 result = first;
277 while (++first != last)
278 {
279 if (IntFontFamilyCompareEx(result, first, dwCompareFlags) != 0)
280 {
281 *(++result) = *first;
282 }
283 }
284 nCount = (int)(++result - InfoList);
285
286 return nCount;
287}
288
289static int FASTCALL
292{
293 int FontFamilyCount;
295 int Ret = 1;
296 int i;
297 ENUMLOGFONTEXA EnumLogFontExA;
298 NEWTEXTMETRICEXA NewTextMetricExA;
299 LOGFONTW lfW;
300 LONG InfoCount;
303
306 if (Info == NULL)
307 {
308 return 1;
309 }
310
311 /* Initialize the LOGFONT structure */
312 ZeroMemory(&lfW, sizeof(lfW));
313 if (!LogFont)
314 {
316 }
317 else
318 {
319 lfW.lfCharSet = LogFont->lfCharSet;
320 lfW.lfPitchAndFamily = LogFont->lfPitchAndFamily;
321 StringCbCopyW(lfW.lfFaceName, sizeof(lfW.lfFaceName), LogFont->lfFaceName);
322 }
323
324 /* Retrieve the font information */
325 InfoCount = INITIAL_FAMILY_COUNT;
326 FontFamilyCount = NtGdiGetFontFamilyInfo(Dc, &lfW, Info, &InfoCount);
327 if (FontFamilyCount < 0)
328 {
330 return 1;
331 }
332
333 /* Resize the buffer if the buffer is too small */
334 if (INITIAL_FAMILY_COUNT < InfoCount)
335 {
337
338 Status = RtlULongMult(InfoCount, sizeof(FONTFAMILYINFO), &DataSize);
340 {
341 DPRINT1("Overflowed.\n");
342 return 1;
343 }
345 if (Info == NULL)
346 {
347 return 1;
348 }
349 FontFamilyCount = NtGdiGetFontFamilyInfo(Dc, &lfW, Info, &InfoCount);
350 if (FontFamilyCount < 0 || FontFamilyCount < InfoCount)
351 {
353 return 1;
354 }
355 }
356
357 /* Sort and remove redundant information */
358 qsort(Info, FontFamilyCount, sizeof(*Info), IntFontFamilyCompare);
359 FontFamilyCount = IntFontFamilyListUnique(Info, FontFamilyCount, &lfW, dwFlags);
360
361 /* call the callback */
362 for (i = 0; i < FontFamilyCount; i++)
363 {
364 if (dwFlags & IEFF_UNICODE)
365 {
366 Ret = ((FONTENUMPROCW) EnumProc)(
367 (VOID*)&Info[i].EnumLogFontEx,
368 (VOID*)&Info[i].NewTextMetricEx,
369 Info[i].FontType, lParam);
370 }
371 else
372 {
373 // Could use EnumLogFontExW2A here?
374 LogFontW2A(&EnumLogFontExA.elfLogFont, &Info[i].EnumLogFontEx.elfLogFont);
375 WideCharToMultiByte(CP_THREAD_ACP, 0, Info[i].EnumLogFontEx.elfFullName, -1,
376 (LPSTR)EnumLogFontExA.elfFullName, LF_FULLFACESIZE, NULL, NULL);
377 WideCharToMultiByte(CP_THREAD_ACP, 0, Info[i].EnumLogFontEx.elfStyle, -1,
378 (LPSTR)EnumLogFontExA.elfStyle, LF_FACESIZE, NULL, NULL);
379 WideCharToMultiByte(CP_THREAD_ACP, 0, Info[i].EnumLogFontEx.elfScript, -1,
380 (LPSTR)EnumLogFontExA.elfScript, LF_FACESIZE, NULL, NULL);
381 NewTextMetricExW2A(&NewTextMetricExA,
382 &Info[i].NewTextMetricEx);
383 Ret = ((FONTENUMPROCA) EnumProc)(
384 (VOID*)&EnumLogFontExA,
385 (VOID*)&NewTextMetricExA,
386 Info[i].FontType, lParam);
387 }
388
389 if(Ret == 0)
390 break;
391 }
392
394
395 return Ret;
396}
397
398/*
399 * @implemented
400 */
401int WINAPI
402EnumFontFamiliesExW(HDC hdc, LPLOGFONTW lpLogfont, FONTENUMPROCW lpEnumFontFamExProc,
404{
405 if (lpLogfont)
406 {
407 DPRINT("EnumFontFamiliesExW(%p, %p(%S, %u, %u), %p, %p, 0x%08lX)\n",
408 hdc, lpLogfont, lpLogfont->lfFaceName, lpLogfont->lfCharSet,
409 lpLogfont->lfPitchAndFamily, lpEnumFontFamExProc, lParam, dwFlags);
410 }
411 else
412 {
413 DPRINT("EnumFontFamiliesExW(%p, NULL, %p, %p, 0x%08lX)\n",
414 hdc, lpEnumFontFamExProc, lParam, dwFlags);
415 }
416 return IntEnumFontFamilies(hdc, lpLogfont, lpEnumFontFamExProc, lParam,
418}
419
420
421/*
422 * @implemented
423 */
424int WINAPI
425EnumFontFamiliesW(HDC hdc, LPCWSTR lpszFamily, FONTENUMPROCW lpEnumFontFamProc,
427{
428 LOGFONTW LogFont;
429
430 DPRINT("EnumFontFamiliesW(%p, %S, %p, %p)\n",
431 hdc, lpszFamily, lpEnumFontFamProc, lParam);
432
433 ZeroMemory(&LogFont, sizeof(LOGFONTW));
434 LogFont.lfCharSet = DEFAULT_CHARSET;
435 if (NULL != lpszFamily)
436 {
437 if (!*lpszFamily) return 1;
438 lstrcpynW(LogFont.lfFaceName, lpszFamily, LF_FACESIZE);
439 }
440
441 return IntEnumFontFamilies(hdc, &LogFont, lpEnumFontFamProc, lParam, IEFF_UNICODE);
442}
443
444
445/*
446 * @implemented
447 */
448int WINAPI
449EnumFontFamiliesExA (HDC hdc, LPLOGFONTA lpLogfont, FONTENUMPROCA lpEnumFontFamExProc,
451{
452 LOGFONTW LogFontW, *pLogFontW;
453
454 if (lpLogfont)
455 {
456 DPRINT("EnumFontFamiliesExA(%p, %p(%s, %u, %u), %p, %p, 0x%08lX)\n",
457 hdc, lpLogfont, lpLogfont->lfFaceName, lpLogfont->lfCharSet,
458 lpLogfont->lfPitchAndFamily, lpEnumFontFamExProc, lParam, dwFlags);
459 }
460 else
461 {
462 DPRINT("EnumFontFamiliesExA(%p, NULL, %p, %p, 0x%08lX)\n",
463 hdc, lpEnumFontFamExProc, lParam, dwFlags);
464 }
465
466 if (lpLogfont)
467 {
468 LogFontA2W(&LogFontW,lpLogfont);
469 pLogFontW = &LogFontW;
470 }
471 else pLogFontW = NULL;
472
473 /* no need to convert LogFontW back to lpLogFont b/c it's an [in] parameter only */
474 return IntEnumFontFamilies(hdc, pLogFontW, lpEnumFontFamExProc, lParam, IEFF_EXTENDED);
475}
476
477
478/*
479 * @implemented
480 */
481int WINAPI
482EnumFontFamiliesA(HDC hdc, LPCSTR lpszFamily, FONTENUMPROCA lpEnumFontFamProc,
484{
485 LOGFONTW LogFont;
486
487 DPRINT("EnumFontFamiliesA(%p, %s, %p, %p)\n",
488 hdc, lpszFamily, lpEnumFontFamProc, lParam);
489
490 ZeroMemory(&LogFont, sizeof(LOGFONTW));
491 LogFont.lfCharSet = DEFAULT_CHARSET;
492 if (NULL != lpszFamily)
493 {
494 if (!*lpszFamily) return 1;
495 MultiByteToWideChar(CP_THREAD_ACP, 0, lpszFamily, -1, LogFont.lfFaceName, LF_FACESIZE);
496 }
497
498 return IntEnumFontFamilies(hdc, &LogFont, lpEnumFontFamProc, lParam, 0);
499}
500
501
502/*
503 * @implemented
504 */
505DWORD
506WINAPI
508 HDC hdc,
509 LPCSTR lpString,
510 INT uCount,
511 INT nMaxExtent,
512 GCP_RESULTSA *lpResults,
514{
515 WCHAR *lpStringW;
516 INT uCountW;
517 GCP_RESULTSW resultsW;
518 DWORD ret;
519 UINT font_cp;
520
521 if ( !lpString || uCount <= 0 || !lpResults || (nMaxExtent < 0 && nMaxExtent != -1 ) )
522 {
524 return 0;
525 }
526 /* TRACE("%s, %d, %d, 0x%08x\n",
527 debugstr_an(lpString, uCount), uCount, nMaxExtent, dwFlags);
528 */
529 /* both structs are equal in size */
530 memcpy(&resultsW, lpResults, sizeof(resultsW));
531
532 lpStringW = FONT_mbtowc(hdc, lpString, uCount, &uCountW, &font_cp);
533 if (lpStringW == NULL)
534 {
535 return 0;
536 }
537 if(lpResults->lpOutString)
538 {
539 resultsW.lpOutString = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*uCountW);
540 if (resultsW.lpOutString == NULL)
541 {
542 HeapFree(GetProcessHeap(), 0, lpStringW);
543 return 0;
544 }
545 }
546
547 ret = GetCharacterPlacementW(hdc, lpStringW, uCountW, nMaxExtent, &resultsW, dwFlags);
548
549 lpResults->nGlyphs = resultsW.nGlyphs;
550 lpResults->nMaxFit = resultsW.nMaxFit;
551
552 if(lpResults->lpOutString)
553 {
554 WideCharToMultiByte(font_cp, 0, resultsW.lpOutString, uCountW,
555 lpResults->lpOutString, uCount, NULL, NULL );
556 }
557
558 HeapFree(GetProcessHeap(), 0, lpStringW);
559 HeapFree(GetProcessHeap(), 0, resultsW.lpOutString);
560
561 return ret;
562}
563
564
565/*
566 * @implemented
567 */
568DWORD
569WINAPI
571 HDC hdc,
572 LPCWSTR lpString,
573 INT uCount,
574 INT nMaxExtent,
575 GCP_RESULTSW *lpResults,
577)
578{
579 DWORD ret=0;
580 SIZE size;
581 UINT i, nSet;
582 DPRINT("GetCharacterPlacementW\n");
583
584 if (dwFlags&(~GCP_REORDER)) DPRINT("flags 0x%08lx ignored\n", dwFlags);
585 if (lpResults->lpClass) DPRINT("classes not implemented\n");
586
587 nSet = (UINT)uCount;
588 if (nSet > lpResults->nGlyphs)
589 nSet = lpResults->nGlyphs;
590
591 /* return number of initialized fields */
592 lpResults->nGlyphs = nSet;
593
594 if (dwFlags & GCP_REORDER)
595 {
596 if (LoadLPK(LPK_GCP))
597 return LpkGetCharacterPlacement(hdc, lpString, uCount, nMaxExtent, lpResults, dwFlags, 0);
598 }
599
600 /* Treat the case where no special handling was requested in a fastpath way */
601 /* copy will do if the GCP_REORDER flag is not set */
602 if (lpResults->lpOutString)
603 lstrcpynW( lpResults->lpOutString, lpString, nSet );
604
605 if (lpResults->lpOrder)
606 {
607 for (i = 0; i < nSet; i++)
608 lpResults->lpOrder[i] = i;
609 }
610
611 /* FIXME: Will use the placement chars */
612 if (lpResults->lpDx)
613 {
614 int c;
615 for (i = 0; i < nSet; i++)
616 {
617 if (GetCharWidth32W(hdc, lpString[i], lpString[i], &c))
618 lpResults->lpDx[i]= c;
619 }
620 }
621
622 if (lpResults->lpCaretPos && !(dwFlags & GCP_REORDER))
623 {
624 int pos = 0;
625
626 lpResults->lpCaretPos[0] = 0;
627 for (i = 1; i < nSet; i++)
628 if (GetTextExtentPoint32W(hdc, &(lpString[i - 1]), 1, &size))
629 lpResults->lpCaretPos[i] = (pos += size.cx);
630 }
631
632 if (lpResults->lpGlyphs)
633 NtGdiGetGlyphIndicesW(hdc, lpString, nSet, lpResults->lpGlyphs, 0);
634
635 if (GetTextExtentPoint32W(hdc, lpString, uCount, &size))
636 ret = MAKELONG(size.cx, size.cy);
637
638 return ret;
639}
640
641DWORD
642WINAPI
644 HDC hdc,
645 LPCWSTR lpString,
646 INT uCount,
647 INT nMaxExtent,
648 GCP_RESULTSW *lpResults,
650)
651{
652 ULONG nSet;
653 SIZE Size = {0,0};
654
655 if ( !lpString || uCount <= 0 || (nMaxExtent < 0 && nMaxExtent != -1 ) )
656 {
658 return 0;
659 }
660
661 if ( !lpResults )
662 {
663 if ( GetTextExtentPointW(hdc, lpString, uCount, &Size) )
664 {
665 return MAKELONG(Size.cx, Size.cy);
666 }
667 return 0;
668 }
669
670 nSet = uCount;
671 if ( nSet > lpResults->nGlyphs )
672 nSet = lpResults->nGlyphs;
673
675 lpString,
676 nSet,
677 nMaxExtent,
678 lpResults,
679 dwFlags);
680}
681
682/*
683 * @implemented
684 *
685 */
686BOOL
687WINAPI
689 UINT FirstChar,
690 UINT LastChar,
691 LPABCFLOAT abcF)
692{
693 DPRINT("GetCharABCWidthsFloatW\n");
694 if ((!abcF) || (FirstChar > LastChar))
695 {
697 return FALSE;
698 }
700 FirstChar,
701 (ULONG)(LastChar - FirstChar + 1),
702 NULL,
703 0,
704 abcF);
705}
706
707/*
708 * @implemented
709 */
710BOOL
711WINAPI
713 UINT iFirstChar,
714 UINT iLastChar,
715 PFLOAT pxBuffer)
716{
717 DPRINT("GetCharWidthsFloatW\n");
718 if ((!pxBuffer) || (iFirstChar > iLastChar) || HIWORD(iLastChar) ||
720 {
722 return FALSE;
723 }
724 return NtGdiGetCharWidthW( hdc,
725 iFirstChar,
726 (ULONG)(iLastChar - iFirstChar + 1),
727 NULL,
728 0,
729 pxBuffer);
730}
731
732/*
733 * @implemented
734 */
735BOOL
736WINAPI
738 UINT iFirstChar,
739 UINT iLastChar,
741{
742 DPRINT("GetCharWidthsW\n");
743 if ((!lpBuffer) || (iFirstChar > iLastChar) || HIWORD(iLastChar) ||
745 {
747 return FALSE;
748 }
749 return NtGdiGetCharWidthW( hdc,
750 iFirstChar,
751 (ULONG)(iLastChar - iFirstChar + 1),
752 NULL,
754 lpBuffer);
755}
756
757/*
758 * @implemented
759 */
760BOOL
761WINAPI
763 UINT iFirstChar,
764 UINT iLastChar,
766{
767 DPRINT("GetCharWidths32W\n");
768 if ((!lpBuffer) || (iFirstChar > iLastChar) || HIWORD(iLastChar) ||
770 {
772 return FALSE;
773 }
774 return NtGdiGetCharWidthW( hdc,
775 iFirstChar,
776 (ULONG)(iLastChar - iFirstChar + 1),
777 NULL,
779 lpBuffer);
780}
781
782/*
783 * @implemented
784 */
785BOOL
786WINAPI
788 UINT FirstChar,
789 UINT LastChar,
790 LPABC lpabc)
791{
792 DPRINT("GetCharABCWidthsW\n");
793 if ((!lpabc) || (FirstChar > LastChar))
794 {
796 return FALSE;
797 }
799 FirstChar,
800 (ULONG)(LastChar - FirstChar + 1),
801 NULL,
803 lpabc);
804}
805
806/*
807 * @implemented
808 */
809BOOL
810WINAPI
812 HDC hdc,
813 UINT iFirstChar,
814 UINT iLastChar,
816{
817 INT wlen, count = 0;
818 LPSTR str;
819 LPWSTR wstr;
820 BOOL ret = TRUE;
821
822 DPRINT("GetCharWidthsA\n");
823
825 {
827 return FALSE;
828 }
829
830 str = FONT_GetCharsByRangeA(hdc, iFirstChar, iLastChar, &count);
831 if (!str)
832 return FALSE;
833
834 wstr = FONT_mbtowc(hdc, str, count+1, &wlen, NULL);
835 if (!wstr)
836 {
838 return FALSE;
839 }
840
842 wstr[0],
843 count,
844 wstr,
846 lpBuffer);
847
849 HeapFree(GetProcessHeap(), 0, wstr);
850
851 return ret;
852}
853
854/*
855 * @implemented
856 */
857BOOL
858WINAPI
860 HDC hdc,
861 UINT iFirstChar,
862 UINT iLastChar,
864{
865 INT wlen, count = 0;
866 LPSTR str;
867 LPWSTR wstr;
868 BOOL ret = TRUE;
869
870 DPRINT("GetCharWidths32A\n");
871
873 {
875 return FALSE;
876 }
877
878 str = FONT_GetCharsByRangeA(hdc, iFirstChar, iLastChar, &count);
879 if (!str)
880 return FALSE;
881
882 wstr = FONT_mbtowc(hdc, str, count+1, &wlen, NULL);
883 if (!wstr)
884 {
886 return FALSE;
887 }
888
890 wstr[0],
891 count,
892 wstr,
894 lpBuffer);
895
897 HeapFree(GetProcessHeap(), 0, wstr);
898
899 return ret;
900}
901
902/*
903 * @implemented
904 */
905BOOL
908 HDC hdc,
909 UINT iFirstChar,
910 UINT iLastChar,
911 PFLOAT pxBuffer)
912{
913 INT wlen, count = 0;
914 LPSTR str;
915 LPWSTR wstr;
916 BOOL ret = TRUE;
917
918 DPRINT("GetCharWidthsFloatA\n");
919
921 {
923 return FALSE;
924 }
925
926 str = FONT_GetCharsByRangeA(hdc, iFirstChar, iLastChar, &count);
927 if (!str)
928 return FALSE;
929
930 wstr = FONT_mbtowc(hdc, str, count+1, &wlen, NULL);
931 if (!wstr)
932 {
934 return FALSE;
935 }
936 ret = NtGdiGetCharWidthW(hdc, wstr[0], count, wstr, 0, pxBuffer);
937
939 HeapFree(GetProcessHeap(), 0, wstr);
940
941 return ret;
942}
943
944/*
945 * @implemented
946 */
947BOOL
950 HDC hdc,
951 UINT iFirstChar,
952 UINT iLastChar,
953 LPABC lpabc
954)
955{
956 INT wlen, count = 0;
957 LPSTR str;
958 LPWSTR wstr;
959 BOOL ret = TRUE;
960
961 DPRINT("GetCharABCWidthsA\n");
962
963 str = FONT_GetCharsByRangeA(hdc, iFirstChar, iLastChar, &count);
964 if (!str)
965 return FALSE;
966
967 wstr = FONT_mbtowc(hdc, str, count+1, &wlen, NULL);
968 if (!wstr)
969 {
971 return FALSE;
972 }
973
975 wstr[0],
976 wlen - 1,
977 (PWCHAR)wstr,
979 (PVOID)lpabc);
980
982 HeapFree(GetProcessHeap(), 0, wstr);
983
984 return ret;
985}
986
987/*
988 * @implemented
989 */
990BOOL
993 HDC hdc,
994 UINT iFirstChar,
995 UINT iLastChar,
996 LPABCFLOAT lpABCF
997)
998{
999 INT wlen, count = 0;
1000 LPSTR str;
1001 LPWSTR wstr;
1002 BOOL ret = TRUE;
1003
1004 DPRINT("GetCharABCWidthsFloatA\n");
1005
1006 str = FONT_GetCharsByRangeA(hdc, iFirstChar, iLastChar, &count);
1007 if (!str)
1008 return FALSE;
1009
1010 wstr = FONT_mbtowc( hdc, str, count+1, &wlen, NULL );
1011 if (!wstr)
1012 {
1013 HeapFree( GetProcessHeap(), 0, str );
1014 return FALSE;
1015 }
1016 ret = NtGdiGetCharABCWidthsW(hdc, wstr[0], count, wstr, 0, lpABCF);
1017
1018 HeapFree( GetProcessHeap(), 0, str );
1019 HeapFree( GetProcessHeap(), 0, wstr );
1020
1021 return ret;
1022}
1023
1024/*
1025 * @implemented
1026 */
1027BOOL
1028WINAPI
1030 UINT giFirst,
1031 UINT cgi,
1032 LPWORD pgi,
1033 LPABC lpabc)
1034{
1035 DPRINT("GetCharABCWidthsI\n");
1037 giFirst,
1038 (ULONG) cgi,
1039 (PWCHAR) pgi,
1041 (PVOID)lpabc);
1042}
1043
1044/*
1045 * @implemented
1046 */
1047BOOL
1048WINAPI
1050 UINT giFirst,
1051 UINT cgi,
1052 LPWORD pgi,
1054{
1055 DPRINT("GetCharWidthsI\n");
1056
1057 if (!lpBuffer || (!pgi && HIWORD(giFirst)))
1058 {
1060 return FALSE;
1061 }
1062
1063 if (!cgi)
1064 return TRUE;
1065
1066 return NtGdiGetCharWidthW( hdc,
1067 giFirst,
1068 cgi,
1069 (PWCHAR) pgi,
1071 (PVOID) lpBuffer );
1072}
1073
1074/*
1075 * @implemented
1076 */
1077DWORD
1078WINAPI
1080 HDC hDc
1081)
1082{
1083 DWORD Gcp = 0, Ret = 0;
1084 if (gbLpk)
1085 {
1086 Ret = NtGdiGetTextCharsetInfo(hDc, NULL, 0);
1087 if ((Ret == ARABIC_CHARSET) || (Ret == HEBREW_CHARSET))
1089 }
1091 if ( Gcp == GCP_ERROR)
1092 return Gcp;
1093 else
1094 Ret = Gcp | Ret;
1095 return Ret;
1096}
1097
1098/*
1099 * @implemented
1100 */
1101DWORD
1102WINAPI
1104 HDC hdc,
1105 LPCSTR lpstr,
1106 INT count,
1107 LPWORD pgi,
1108 DWORD flags
1109)
1110{
1111 DWORD Ret;
1112 WCHAR *lpstrW;
1113 INT countW;
1114
1115 lpstrW = FONT_mbtowc(hdc, lpstr, count, &countW, NULL);
1116
1117 if (lpstrW == NULL)
1118 return GDI_ERROR;
1119
1120 Ret = NtGdiGetGlyphIndicesW(hdc, lpstrW, countW, pgi, flags);
1121 HeapFree(GetProcessHeap(), 0, lpstrW);
1122 return Ret;
1123}
1124
1125/*
1126 * @implemented
1127 */
1128DWORD
1129WINAPI
1131 HDC hdc,
1132 UINT uChar,
1133 UINT uFormat,
1134 LPGLYPHMETRICS lpgm,
1135 DWORD cbBuffer,
1136 LPVOID lpvBuffer,
1137 CONST MAT2 *lpmat2
1138)
1139{
1140
1141 LPWSTR p = NULL;
1142 DWORD ret;
1143 UINT c;
1144 DPRINT("GetGlyphOutlineA uChar %x\n", uChar);
1145 if (!lpgm || !lpmat2) return GDI_ERROR;
1146 if(!(uFormat & GGO_GLYPH_INDEX))
1147 {
1148 int len;
1149 char mbchs[2];
1150 if(uChar > 0xff) /* but, 2 bytes character only */
1151 {
1152 len = 2;
1153 mbchs[0] = (uChar & 0xff00) >> 8;
1154 mbchs[1] = (uChar & 0xff);
1155 }
1156 else
1157 {
1158 len = 1;
1159 mbchs[0] = (uChar & 0xff);
1160 }
1161 p = FONT_mbtowc(hdc, mbchs, len, NULL, NULL);
1162 if(!p)
1163 return GDI_ERROR;
1164 c = p[0];
1165 }
1166 else
1167 c = uChar;
1168 ret = NtGdiGetGlyphOutline(hdc, c, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2, TRUE);
1169 HeapFree(GetProcessHeap(), 0, p);
1170 return ret;
1171}
1172
1173
1174/*
1175 * @implemented
1176 */
1177DWORD
1178WINAPI
1180 HDC hdc,
1181 UINT uChar,
1182 UINT uFormat,
1183 LPGLYPHMETRICS lpgm,
1184 DWORD cbBuffer,
1185 LPVOID lpvBuffer,
1186 CONST MAT2 *lpmat2
1187)
1188{
1189 DPRINT("GetGlyphOutlineW uChar %x\n", uChar);
1190 if (!lpgm || !lpmat2) return GDI_ERROR;
1191 if (!lpvBuffer) cbBuffer = 0;
1192 return NtGdiGetGlyphOutline ( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2, TRUE);
1193}
1194
1195/*
1196 * @unimplemented
1197 */
1198DWORD
1199WINAPI
1201 DWORD a0,
1202 DWORD a1,
1203 DWORD a2,
1204 DWORD a3,
1205 DWORD a4,
1206 DWORD a5,
1207 DWORD a6
1208)
1209{
1212 return 0;
1213}
1214
1215/*
1216 * @implemented
1217 */
1218UINT
1221 HDC hdc,
1222 UINT cbData,
1224)
1225{
1226 char buf[512], *ptr;
1227 UINT ret, needed;
1229 OUTLINETEXTMETRICA *output = lpOTM;
1230 INT left, len;
1231
1232 if((ret = GetOutlineTextMetricsW(hdc, 0, NULL)) == 0)
1233 return 0;
1234 if(ret > sizeof(buf))
1235 {
1236 lpOTMW = HeapAlloc(GetProcessHeap(), 0, ret);
1237 if (lpOTMW == NULL)
1238 {
1239 return 0;
1240 }
1241 }
1242 GetOutlineTextMetricsW(hdc, ret, lpOTMW);
1243
1244 needed = sizeof(OUTLINETEXTMETRICA);
1245 if(lpOTMW->otmpFamilyName)
1246 needed += WideCharToMultiByte(CP_ACP, 0,
1247 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFamilyName), -1,
1248 NULL, 0, NULL, NULL);
1249 if(lpOTMW->otmpFaceName)
1250 needed += WideCharToMultiByte(CP_ACP, 0,
1251 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFaceName), -1,
1252 NULL, 0, NULL, NULL);
1253 if(lpOTMW->otmpStyleName)
1254 needed += WideCharToMultiByte(CP_ACP, 0,
1255 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpStyleName), -1,
1256 NULL, 0, NULL, NULL);
1257 if(lpOTMW->otmpFullName)
1258 needed += WideCharToMultiByte(CP_ACP, 0,
1259 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFullName), -1,
1260 NULL, 0, NULL, NULL);
1261
1262 if(!lpOTM)
1263 {
1264 ret = needed;
1265 goto end;
1266 }
1267
1268 DPRINT("needed = %u\n", needed);
1269 if(needed > cbData)
1270 {
1271 /* Since the supplied buffer isn't big enough, we'll alloc one
1272 that is and memcpy the first cbData bytes into the lpOTM at
1273 the end. */
1274 output = HeapAlloc(GetProcessHeap(), 0, needed);
1275 if (output == NULL)
1276 {
1277 goto end;
1278 }
1279 }
1280
1281 ret = output->otmSize = min(needed, cbData);
1283 output->otmFiller = 0;
1284 output->otmPanoseNumber = lpOTMW->otmPanoseNumber;
1285 output->otmfsSelection = lpOTMW->otmfsSelection;
1286 output->otmfsType = lpOTMW->otmfsType;
1287 output->otmsCharSlopeRise = lpOTMW->otmsCharSlopeRise;
1288 output->otmsCharSlopeRun = lpOTMW->otmsCharSlopeRun;
1289 output->otmItalicAngle = lpOTMW->otmItalicAngle;
1290 output->otmEMSquare = lpOTMW->otmEMSquare;
1291 output->otmAscent = lpOTMW->otmAscent;
1292 output->otmDescent = lpOTMW->otmDescent;
1293 output->otmLineGap = lpOTMW->otmLineGap;
1294 output->otmsCapEmHeight = lpOTMW->otmsCapEmHeight;
1295 output->otmsXHeight = lpOTMW->otmsXHeight;
1296 output->otmrcFontBox = lpOTMW->otmrcFontBox;
1297 output->otmMacAscent = lpOTMW->otmMacAscent;
1298 output->otmMacDescent = lpOTMW->otmMacDescent;
1299 output->otmMacLineGap = lpOTMW->otmMacLineGap;
1300 output->otmusMinimumPPEM = lpOTMW->otmusMinimumPPEM;
1301 output->otmptSubscriptSize = lpOTMW->otmptSubscriptSize;
1305 output->otmsStrikeoutSize = lpOTMW->otmsStrikeoutSize;
1307 output->otmsUnderscoreSize = lpOTMW->otmsUnderscoreSize;
1309
1310
1311 ptr = (char*)(output + 1);
1312 left = needed - sizeof(*output);
1313
1314 if(lpOTMW->otmpFamilyName)
1315 {
1316 output->otmpFamilyName = (LPSTR)(ptr - (char*)output);
1318 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFamilyName), -1,
1319 ptr, left, NULL, NULL);
1320 left -= len;
1321 ptr += len;
1322 }
1323 else
1324 output->otmpFamilyName = 0;
1325
1326 if(lpOTMW->otmpFaceName)
1327 {
1328 output->otmpFaceName = (LPSTR)(ptr - (char*)output);
1330 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFaceName), -1,
1331 ptr, left, NULL, NULL);
1332 left -= len;
1333 ptr += len;
1334 }
1335 else
1336 output->otmpFaceName = 0;
1337
1338 if(lpOTMW->otmpStyleName)
1339 {
1340 output->otmpStyleName = (LPSTR)(ptr - (char*)output);
1342 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpStyleName), -1,
1343 ptr, left, NULL, NULL);
1344 left -= len;
1345 ptr += len;
1346 }
1347 else
1348 output->otmpStyleName = 0;
1349
1350 if(lpOTMW->otmpFullName)
1351 {
1352 output->otmpFullName = (LPSTR)(ptr - (char*)output);
1354 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFullName), -1,
1355 ptr, left, NULL, NULL);
1356 left -= len;
1357 }
1358 else
1359 output->otmpFullName = 0;
1360
1361 ASSERT(left == 0);
1362
1363 if(output != lpOTM)
1364 {
1365 memcpy(lpOTM, output, cbData);
1366 HeapFree(GetProcessHeap(), 0, output);
1367
1368 /* check if the string offsets really fit into the provided size */
1369 /* FIXME: should we check string length as well? */
1370 if ((UINT_PTR)lpOTM->otmpFamilyName >= lpOTM->otmSize)
1371 lpOTM->otmpFamilyName = 0; /* doesn't fit */
1372
1373 if ((UINT_PTR)lpOTM->otmpFaceName >= lpOTM->otmSize)
1374 lpOTM->otmpFaceName = 0; /* doesn't fit */
1375
1376 if ((UINT_PTR)lpOTM->otmpStyleName >= lpOTM->otmSize)
1377 lpOTM->otmpStyleName = 0; /* doesn't fit */
1378
1379 if ((UINT_PTR)lpOTM->otmpFullName >= lpOTM->otmSize)
1380 lpOTM->otmpFullName = 0; /* doesn't fit */
1381 }
1382
1383end:
1384 if(lpOTMW != (OUTLINETEXTMETRICW *)buf)
1385 HeapFree(GetProcessHeap(), 0, lpOTMW);
1386
1387 return ret;
1388}
1389
1390/* Performs a device to world transformation on the specified size (which
1391 * is in integer format).
1392 */
1393static inline INT INTERNAL_YDSTOWS(XFORM *xForm, INT height)
1394{
1395 double floatHeight;
1396
1397 /* Perform operation with floating point */
1398 floatHeight = (double)height * xForm->eM22;
1399 /* Round to integers */
1400 return GDI_ROUND(floatHeight);
1401}
1402
1403/* scale width and height but don't mirror them */
1404static inline INT width_to_LP( XFORM *xForm, INT width )
1405{
1406 return GDI_ROUND( (double)width * fabs( xForm->eM11));
1407}
1408
1409static inline INT height_to_LP( XFORM *xForm, INT height )
1410{
1411 return GDI_ROUND( (double)height * fabs( xForm->eM22 ));
1412}
1413
1414/*
1415 * @implemented
1416 */
1417UINT
1420 HDC hdc,
1421 UINT cbData,
1423)
1424{
1425 TMDIFF Tmd; // Should not be zero.
1426 UINT Size, AvailableSize = 0, StringSize;
1427 XFORM DevToWorld;
1428 OUTLINETEXTMETRICW* LocalOTM;
1429 WCHAR* Str;
1430 BYTE* Ptr;
1431
1432 /* Get the structure */
1434 if (!Size)
1435 return 0;
1436 if (!lpOTM || (cbData < sizeof(*lpOTM)))
1437 return Size;
1438
1439 LocalOTM = HeapAlloc(GetProcessHeap(), 0, Size);
1440 LocalOTM->otmSize = Size;
1442 if (!Size)
1443 {
1444 HeapFree(GetProcessHeap(), 0, LocalOTM);
1445 return 0;
1446 }
1447
1449 {
1450 DPRINT1("NtGdiGetTransform failed!\n");
1451 HeapFree(GetProcessHeap(), 0, LocalOTM);
1453 return 0;
1454 }
1455
1456 /* Fill in DC specific data */
1459 LocalOTM->otmTextMetrics.tmHeight = height_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmHeight );
1460 LocalOTM->otmTextMetrics.tmAscent = height_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmAscent );
1461 LocalOTM->otmTextMetrics.tmDescent = height_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmDescent );
1464 LocalOTM->otmTextMetrics.tmAveCharWidth = width_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmAveCharWidth );
1465 LocalOTM->otmTextMetrics.tmMaxCharWidth = width_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmMaxCharWidth );
1466 LocalOTM->otmTextMetrics.tmOverhang = width_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmOverhang );
1467 LocalOTM->otmAscent = height_to_LP( &DevToWorld, LocalOTM->otmAscent);
1468 LocalOTM->otmDescent = height_to_LP( &DevToWorld, LocalOTM->otmDescent);
1469 LocalOTM->otmLineGap = abs(INTERNAL_YDSTOWS(&DevToWorld,LocalOTM->otmLineGap));
1470 LocalOTM->otmsCapEmHeight = abs(INTERNAL_YDSTOWS(&DevToWorld,LocalOTM->otmsCapEmHeight));
1471 LocalOTM->otmsXHeight = abs(INTERNAL_YDSTOWS(&DevToWorld,LocalOTM->otmsXHeight));
1472 LocalOTM->otmrcFontBox.top = height_to_LP( &DevToWorld, LocalOTM->otmrcFontBox.top);
1473 LocalOTM->otmrcFontBox.bottom = height_to_LP( &DevToWorld, LocalOTM->otmrcFontBox.bottom);
1474 LocalOTM->otmrcFontBox.left = width_to_LP( &DevToWorld, LocalOTM->otmrcFontBox.left);
1475 LocalOTM->otmrcFontBox.right = width_to_LP( &DevToWorld, LocalOTM->otmrcFontBox.right);
1476 LocalOTM->otmMacAscent = height_to_LP( &DevToWorld, LocalOTM->otmMacAscent);
1477 LocalOTM->otmMacDescent = height_to_LP( &DevToWorld, LocalOTM->otmMacDescent);
1478 LocalOTM->otmMacLineGap = abs(INTERNAL_YDSTOWS(&DevToWorld,LocalOTM->otmMacLineGap));
1479 LocalOTM->otmptSubscriptSize.x = width_to_LP( &DevToWorld, LocalOTM->otmptSubscriptSize.x);
1480 LocalOTM->otmptSubscriptSize.y = height_to_LP( &DevToWorld, LocalOTM->otmptSubscriptSize.y);
1481 LocalOTM->otmptSubscriptOffset.x = width_to_LP( &DevToWorld, LocalOTM->otmptSubscriptOffset.x);
1482 LocalOTM->otmptSubscriptOffset.y = height_to_LP( &DevToWorld, LocalOTM->otmptSubscriptOffset.y);
1483 LocalOTM->otmptSuperscriptSize.x = width_to_LP( &DevToWorld, LocalOTM->otmptSuperscriptSize.x);
1484 LocalOTM->otmptSuperscriptSize.y = height_to_LP( &DevToWorld, LocalOTM->otmptSuperscriptSize.y);
1485 LocalOTM->otmptSuperscriptOffset.x = width_to_LP( &DevToWorld, LocalOTM->otmptSuperscriptOffset.x);
1486 LocalOTM->otmptSuperscriptOffset.y = height_to_LP( &DevToWorld, LocalOTM->otmptSuperscriptOffset.y);
1487 LocalOTM->otmsStrikeoutSize = abs(INTERNAL_YDSTOWS(&DevToWorld,LocalOTM->otmsStrikeoutSize));
1488 LocalOTM->otmsStrikeoutPosition = height_to_LP( &DevToWorld, LocalOTM->otmsStrikeoutPosition);
1489 LocalOTM->otmsUnderscoreSize = height_to_LP( &DevToWorld, LocalOTM->otmsUnderscoreSize);
1490 LocalOTM->otmsUnderscorePosition = height_to_LP( &DevToWorld, LocalOTM->otmsUnderscorePosition);
1491
1492 /* Copy what we can */
1493 CopyMemory(lpOTM, LocalOTM, min(Size, cbData));
1494
1495 lpOTM->otmpFamilyName = NULL;
1496 lpOTM->otmpFaceName = NULL;
1497 lpOTM->otmpStyleName = NULL;
1498 lpOTM->otmpFullName = NULL;
1499
1500 Size = sizeof(*lpOTM);
1501 AvailableSize = cbData - Size;
1502 Ptr = (BYTE*)lpOTM + sizeof(*lpOTM);
1503
1504 /* Fix string values up */
1505 if (LocalOTM->otmpFamilyName)
1506 {
1507 Str = (WCHAR*)((char*)LocalOTM + (ptrdiff_t)LocalOTM->otmpFamilyName);
1508 StringSize = (wcslen(Str) + 1) * sizeof(WCHAR);
1509 if (AvailableSize >= StringSize)
1510 {
1511 CopyMemory(Ptr, Str, StringSize);
1512 lpOTM->otmpFamilyName = (PSTR)(Ptr - (BYTE*)lpOTM);
1513 Ptr += StringSize;
1514 AvailableSize -= StringSize;
1515 Size += StringSize;
1516 }
1517 }
1518
1519 if (LocalOTM->otmpFaceName)
1520 {
1521 Str = (WCHAR*)((char*)LocalOTM + (ptrdiff_t)LocalOTM->otmpFaceName);
1522 StringSize = (wcslen(Str) + 1) * sizeof(WCHAR);
1523 if (AvailableSize >= StringSize)
1524 {
1525 CopyMemory(Ptr, Str, StringSize);
1526 lpOTM->otmpFaceName = (PSTR)(Ptr - (BYTE*)lpOTM);
1527 Ptr += StringSize;
1528 AvailableSize -= StringSize;
1529 Size += StringSize;
1530 }
1531 }
1532
1533 if (LocalOTM->otmpStyleName)
1534 {
1535 Str = (WCHAR*)((char*)LocalOTM + (ptrdiff_t)LocalOTM->otmpStyleName);
1536 StringSize = (wcslen(Str) + 1) * sizeof(WCHAR);
1537 if (AvailableSize >= StringSize)
1538 {
1539 CopyMemory(Ptr, Str, StringSize);
1540 lpOTM->otmpStyleName = (PSTR)(Ptr - (BYTE*)lpOTM);
1541 Ptr += StringSize;
1542 AvailableSize -= StringSize;
1543 Size += StringSize;
1544 }
1545 }
1546
1547 if (LocalOTM->otmpFullName)
1548 {
1549 Str = (WCHAR*)((char*)LocalOTM + (ptrdiff_t)LocalOTM->otmpFullName);
1550 StringSize = (wcslen(Str) + 1) * sizeof(WCHAR);
1551 if (AvailableSize >= StringSize)
1552 {
1553 CopyMemory(Ptr, Str, StringSize);
1554 lpOTM->otmpFullName = (PSTR)(Ptr - (BYTE*)lpOTM);
1555 Ptr += StringSize;
1556 AvailableSize -= StringSize;
1557 Size += StringSize;
1558 }
1559 }
1560
1561 lpOTM->otmSize = Size;
1562
1563 HeapFree(GetProcessHeap(), 0, LocalOTM);
1564
1565 return Size;
1566}
1567
1568/*
1569 * @implemented
1570 */
1571DWORD
1572WINAPI
1574 ULONG cPairs,
1575 LPKERNINGPAIR pkpDst)
1576{
1577 if ((cPairs != 0) || (pkpDst == 0))
1578 {
1579 return NtGdiGetKerningPairs(hdc,cPairs,pkpDst);
1580 }
1581 else
1582 {
1584 return 0;
1585 }
1586}
1587
1588/*
1589 * @implemented
1590 */
1591DWORD
1592WINAPI
1594 DWORD cPairs,
1595 LPKERNINGPAIR kern_pairA )
1596{
1597 INT charset;
1598 CHARSETINFO csi;
1599 CPINFO cpi;
1600 DWORD i, total_kern_pairs, kern_pairs_copied = 0;
1601 KERNINGPAIR *kern_pairW;
1602
1603 if (!cPairs && kern_pairA)
1604 {
1606 return 0;
1607 }
1608
1611 {
1612 DPRINT1("Can't find codepage for charset %d\n", charset);
1613 return 0;
1614 }
1615 /* GetCPInfo() will fail on CP_SYMBOL, and WideCharToMultiByte is supposed
1616 * to fail on an invalid character for CP_SYMBOL.
1617 */
1618 cpi.DefaultChar[0] = 0;
1619 if (csi.ciACP != CP_SYMBOL && !GetCPInfo(csi.ciACP, &cpi))
1620 {
1621 DPRINT1("Can't find codepage %u info\n", csi.ciACP);
1622 return 0;
1623 }
1624 DPRINT("charset %d => codepage %u\n", charset, csi.ciACP);
1625
1626 total_kern_pairs = NtGdiGetKerningPairs(hDC, 0, NULL);
1627 if (!total_kern_pairs) return 0;
1628
1629 if (!cPairs && !kern_pairA) return total_kern_pairs;
1630
1631 kern_pairW = HeapAlloc(GetProcessHeap(), 0, total_kern_pairs * sizeof(*kern_pairW));
1632 if (kern_pairW == NULL)
1633 {
1634 return 0;
1635 }
1636 GetKerningPairsW(hDC, total_kern_pairs, kern_pairW);
1637
1638 for (i = 0; i < total_kern_pairs; i++)
1639 {
1640 char first, second;
1641
1642 if (!WideCharToMultiByte(csi.ciACP, 0, &kern_pairW[i].wFirst, 1, &first, 1, NULL, NULL))
1643 continue;
1644
1645 if (!WideCharToMultiByte(csi.ciACP, 0, &kern_pairW[i].wSecond, 1, &second, 1, NULL, NULL))
1646 continue;
1647
1648 if (first == cpi.DefaultChar[0] || second == cpi.DefaultChar[0])
1649 continue;
1650
1651 if (kern_pairA)
1652 {
1653 if (kern_pairs_copied >= cPairs) break;
1654
1655 kern_pairA->wFirst = (BYTE)first;
1656 kern_pairA->wSecond = (BYTE)second;
1657 kern_pairA->iKernAmount = kern_pairW[i].iKernAmount;
1658 kern_pairA++;
1659 }
1660 kern_pairs_copied++;
1661 }
1662
1663 HeapFree(GetProcessHeap(), 0, kern_pairW);
1664
1665 return kern_pairs_copied;
1666}
1667
1668
1669
1670/*
1671 * @implemented
1672 */
1673HFONT
1674WINAPI
1676{
1677 if (elfexd)
1678 {
1679 ENUMLOGFONTEXDVW Logfont;
1680
1682 &Logfont.elfEnumLogfontEx );
1683
1685 &elfexd->elfDesignVector,
1686 sizeof(DESIGNVECTOR));
1687
1688 return NtGdiHfontCreate( &Logfont, 0, 0, 0, NULL);
1689 }
1690 else return NULL;
1691}
1692
1693
1694/*
1695 * @implemented
1696 */
1697HFONT
1698WINAPI
1700{
1701 /* Msdn: Note, this function ignores the elfDesignVector member in
1702 ENUMLOGFONTEXDV.
1703 */
1704 if ( elfexd )
1705 {
1706 return NtGdiHfontCreate((PENUMLOGFONTEXDVW) elfexd, 0, 0, 0, NULL );
1707 }
1708 else return NULL;
1709}
1710
1711
1712/*
1713 * @implemented
1714 */
1715HFONT
1716WINAPI
1718 CONST LOGFONTA *lplf
1719)
1720{
1721 if (lplf)
1722 {
1723 LOGFONTW tlf;
1724
1725 LogFontA2W(&tlf, lplf);
1726 return CreateFontIndirectW(&tlf);
1727 }
1728 else return NULL;
1729}
1730
1731
1732#if DBG
1733VOID DumpFamilyInfo(const FONTFAMILYINFO *Info, LONG Count)
1734{
1735 LONG i;
1736 const LOGFONTW *plf;
1737
1738 DPRINT1("---\n");
1739 DPRINT1("Count: %d\n", Count);
1740 for (i = 0; i < Count; ++i)
1741 {
1742 plf = &Info[i].EnumLogFontEx.elfLogFont;
1743 DPRINT1("%d: '%S',%u,'%S', %ld:%ld, %ld, %d, %d\n", i,
1744 plf->lfFaceName, plf->lfCharSet, Info[i].EnumLogFontEx.elfFullName,
1745 plf->lfHeight, plf->lfWidth, plf->lfWeight, plf->lfItalic, plf->lfPitchAndFamily);
1746 }
1747}
1748
1749VOID DoFontSystemUnittest(VOID)
1750{
1751#ifndef RTL_SOFT_ASSERT
1752#define RTL_SOFT_ASSERT(exp) \
1753 (void)((!(exp)) ? \
1754 DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n", __FILE__, __LINE__, #exp), FALSE : TRUE)
1755#define RTL_SOFT_ASSERT_defined
1756#endif
1757
1758 LOGFONTW LogFont;
1760 UNICODE_STRING Str1, Str2;
1761 LONG ret, InfoCount;
1762
1763 //DumpFontInfo(TRUE);
1764
1765 /* L"" DEFAULT_CHARSET */
1766 RtlZeroMemory(&LogFont, sizeof(LogFont));
1767 LogFont.lfCharSet = DEFAULT_CHARSET;
1768 InfoCount = RTL_NUMBER_OF(Info);
1769 ret = NtGdiGetFontFamilyInfo(NULL, &LogFont, Info, &InfoCount);
1770 DPRINT1("ret: %ld, InfoCount: %ld\n", ret, InfoCount);
1771 DumpFamilyInfo(Info, ret);
1773 RTL_SOFT_ASSERT(InfoCount > 32);
1774
1775 /* L"Microsoft Sans Serif" ANSI_CHARSET */
1776 RtlZeroMemory(&LogFont, sizeof(LogFont));
1777 LogFont.lfCharSet = ANSI_CHARSET;
1778 StringCbCopyW(LogFont.lfFaceName, sizeof(LogFont.lfFaceName), L"Microsoft Sans Serif");
1779 InfoCount = RTL_NUMBER_OF(Info);
1780 ret = NtGdiGetFontFamilyInfo(NULL, &LogFont, Info, &InfoCount);
1781 DPRINT1("ret: %ld, InfoCount: %ld\n", ret, InfoCount);
1782 DumpFamilyInfo(Info, ret);
1783 RTL_SOFT_ASSERT(ret != -1);
1784 RTL_SOFT_ASSERT(InfoCount > 0);
1785 RTL_SOFT_ASSERT(InfoCount < 16);
1786
1787 RtlInitUnicodeString(&Str1, Info[0].EnumLogFontEx.elfLogFont.lfFaceName);
1788 RtlInitUnicodeString(&Str2, L"Microsoft Sans Serif");
1789 ret = RtlCompareUnicodeString(&Str1, &Str2, TRUE);
1790 RTL_SOFT_ASSERT(ret == 0);
1791
1792 RtlInitUnicodeString(&Str1, Info[0].EnumLogFontEx.elfFullName);
1793 RtlInitUnicodeString(&Str2, L"Tahoma");
1794 ret = RtlCompareUnicodeString(&Str1, &Str2, TRUE);
1795 RTL_SOFT_ASSERT(ret == 0);
1796
1797 /* L"Non-Existent" DEFAULT_CHARSET */
1798 RtlZeroMemory(&LogFont, sizeof(LogFont));
1799 LogFont.lfCharSet = ANSI_CHARSET;
1800 StringCbCopyW(LogFont.lfFaceName, sizeof(LogFont.lfFaceName), L"Non-Existent");
1801 InfoCount = RTL_NUMBER_OF(Info);
1802 ret = NtGdiGetFontFamilyInfo(NULL, &LogFont, Info, &InfoCount);
1803 DPRINT1("ret: %ld, InfoCount: %ld\n", ret, InfoCount);
1804 DumpFamilyInfo(Info, ret);
1805 RTL_SOFT_ASSERT(ret == 0);
1806 RTL_SOFT_ASSERT(InfoCount == 0);
1807
1808#ifdef RTL_SOFT_ASSERT_defined
1809#undef RTL_SOFT_ASSERT_defined
1810#undef RTL_SOFT_ASSERT
1811#endif
1812}
1813#endif
1814
1815/* EOF */
1816/*
1817 * @implemented
1818 */
1819HFONT
1820WINAPI
1822 CONST LOGFONTW *lplf
1823)
1824{
1825#if 0
1826 static BOOL bDidTest = FALSE;
1827 if (!bDidTest)
1828 {
1829 bDidTest = TRUE;
1830 DoFontSystemUnittest();
1831 }
1832#endif
1833 if (lplf)
1834 {
1835 ENUMLOGFONTEXDVW Logfont;
1836
1837 RtlCopyMemory( &Logfont.elfEnumLogfontEx.elfLogFont, lplf, sizeof(LOGFONTW));
1838 // Need something other than just cleaning memory here.
1839 // Guess? Use caller data to determine the rest.
1841 sizeof(Logfont.elfEnumLogfontEx.elfFullName));
1843 sizeof(Logfont.elfEnumLogfontEx.elfStyle));
1845 sizeof(Logfont.elfEnumLogfontEx.elfScript));
1846
1847 Logfont.elfDesignVector.dvNumAxes = 0; // No more than MM_MAX_NUMAXES
1848
1849 RtlZeroMemory( &Logfont.elfDesignVector, sizeof(DESIGNVECTOR));
1850
1851 return CreateFontIndirectExW(&Logfont);
1852 }
1853 else return NULL;
1854}
1855
1856
1857/*
1858 * @implemented
1859 */
1860HFONT
1861WINAPI
1863 int nHeight,
1864 int nWidth,
1865 int nEscapement,
1866 int nOrientation,
1867 int fnWeight,
1868 DWORD fdwItalic,
1869 DWORD fdwUnderline,
1870 DWORD fdwStrikeOut,
1871 DWORD fdwCharSet,
1872 DWORD fdwOutputPrecision,
1873 DWORD fdwClipPrecision,
1874 DWORD fdwQuality,
1875 DWORD fdwPitchAndFamily,
1876 LPCSTR lpszFace
1877)
1878{
1879 ANSI_STRING StringA;
1880 UNICODE_STRING StringU;
1881 HFONT ret;
1882
1883 RtlInitAnsiString(&StringA, lpszFace);
1884 RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
1885
1886 ret = CreateFontW(nHeight,
1887 nWidth,
1888 nEscapement,
1889 nOrientation,
1890 fnWeight,
1891 fdwItalic,
1892 fdwUnderline,
1893 fdwStrikeOut,
1894 fdwCharSet,
1895 fdwOutputPrecision,
1896 fdwClipPrecision,
1897 fdwQuality,
1898 fdwPitchAndFamily,
1899 StringU.Buffer);
1900
1901 RtlFreeUnicodeString(&StringU);
1902
1903 return ret;
1904}
1905
1906
1907/*
1908 * @implemented
1909 */
1910HFONT
1911WINAPI
1913 int nHeight,
1914 int nWidth,
1915 int nEscapement,
1916 int nOrientation,
1917 int nWeight,
1918 DWORD fnItalic,
1919 DWORD fdwUnderline,
1920 DWORD fdwStrikeOut,
1921 DWORD fdwCharSet,
1922 DWORD fdwOutputPrecision,
1923 DWORD fdwClipPrecision,
1924 DWORD fdwQuality,
1925 DWORD fdwPitchAndFamily,
1926 LPCWSTR lpszFace
1927)
1928{
1929 LOGFONTW logfont;
1930
1931 logfont.lfHeight = nHeight;
1932 logfont.lfWidth = nWidth;
1933 logfont.lfEscapement = nEscapement;
1934 logfont.lfOrientation = nOrientation;
1935 logfont.lfWeight = nWeight;
1936 logfont.lfItalic = (BYTE)fnItalic;
1937 logfont.lfUnderline = (BYTE)fdwUnderline;
1938 logfont.lfStrikeOut = (BYTE)fdwStrikeOut;
1939 logfont.lfCharSet = (BYTE)fdwCharSet;
1940 logfont.lfOutPrecision = (BYTE)fdwOutputPrecision;
1941 logfont.lfClipPrecision = (BYTE)fdwClipPrecision;
1942 logfont.lfQuality = (BYTE)fdwQuality;
1943 logfont.lfPitchAndFamily = (BYTE)fdwPitchAndFamily;
1944
1945 if (NULL != lpszFace)
1946 {
1947 int Size = sizeof(logfont.lfFaceName) / sizeof(WCHAR);
1948 wcsncpy((wchar_t *)logfont.lfFaceName, lpszFace, Size - 1);
1949 /* Be 101% sure to have '\0' at end of string */
1950 logfont.lfFaceName[Size - 1] = '\0';
1951 }
1952 else
1953 {
1954 logfont.lfFaceName[0] = L'\0';
1955 }
1956
1957 return CreateFontIndirectW(&logfont);
1958}
1959
1960// Convert single or multiple font path(s)
1961PWSTR
1964 _In_ PCWSTR pszFiles,
1965 _Out_ PDWORD pcFiles,
1966 _Out_ PDWORD pcwc,
1967 _Inout_ PDWORD pfl,
1968 _In_ BOOL bFlag)
1969{
1970 // FIXME: pfl
1971 // FIXME: bFlag
1972
1973 *pcwc = *pcFiles = 0;
1974
1975 if (!*pszFiles)
1976 {
1978 return NULL;
1979 }
1980
1981 // Build "Fonts" path
1982 WCHAR szFontsDir[MAX_PATH];
1983 GetWindowsDirectoryW(szFontsDir, _countof(szFontsDir));
1984 StringCchCatW(szFontsDir, _countof(szFontsDir), L"\\Fonts");
1985
1986 // Count the number of paths separated by '|'.
1987 ULONG pathCount = 1;
1988 for (PCWSTR pch1 = pszFiles; *pch1; ++pch1)
1989 {
1990 if (*pch1 == L'|')
1991 pathCount++;
1992 }
1993
1994 // Allocate memory for the paths.
1995 SIZE_T cchBuff = pathCount * MAX_PATH;
1996 PWSTR pszBuff = HEAP_alloc(cchBuff * sizeof(WCHAR));
1997 if (!pszBuff)
1998 return NULL;
1999
2000 pszBuff[0] = UNICODE_NULL;
2001 *pcFiles = pathCount;
2002
2003 // Convert paths
2004 DWORD dwError = ERROR_SUCCESS;
2005 PCWSTR pch1, pch1Prev;
2006 BOOL bFirst = TRUE;
2007 for (pch1 = pch1Prev = pszFiles;; ++pch1)
2008 {
2009 if (*pch1 && *pch1 != L'|')
2010 continue;
2011
2012 UINT_PTR spanLen = pch1 - pch1Prev;
2013 if (spanLen < _countof(L".ttf") || spanLen >= MAX_PATH)
2014 {
2015 dwError = ERROR_INVALID_FUNCTION;
2016 break;
2017 }
2018
2019 WCHAR szFileName[MAX_PATH], szFullPath[MAX_PATH];
2020 StringCchCopyNW(szFileName, _countof(szFileName), pch1Prev, spanLen);
2021
2022 // Search file
2023 if (!SearchPathW(L".", szFileName, NULL, _countof(szFullPath), szFullPath, NULL) &&
2024 !SearchPathW(szFontsDir, szFileName, NULL, _countof(szFullPath), szFullPath, NULL))
2025 {
2026 dwError = ERROR_FILE_NOT_FOUND;
2027 break;
2028 }
2029
2030 if (bFirst)
2031 {
2032 bFirst = FALSE;
2033 }
2034 else
2035 {
2036 SIZE_T cch = wcslen(szFullPath);
2037 if (cch < _countof(L".pfb"))
2038 {
2039 dwError = ERROR_INVALID_FUNCTION;
2040 break;
2041 }
2042
2043 // Check filename extension
2044 PCWSTR pchDotExt = &szFullPath[cch - 4];
2045 if (_wcsicmp(pchDotExt, L".pfb") != 0 &&
2046 _wcsicmp(pchDotExt, L".mmm") != 0)
2047 {
2048 dwError = ERROR_INVALID_FUNCTION;
2049 break;
2050 }
2051 }
2052
2053 // Convert to an NT path
2054 UNICODE_STRING NtAbsPath;
2055 if (!RtlDosPathNameToNtPathName_U(szFullPath, &NtAbsPath, NULL, NULL))
2056 {
2057 dwError = ERROR_OUTOFMEMORY;
2058 break;
2059 }
2060
2061 // Append a path and '|' to pszBuff
2062 if (StringCchCatW(pszBuff, cchBuff, NtAbsPath.Buffer) != S_OK ||
2063 StringCchCatW(pszBuff, cchBuff, L"|") != S_OK)
2064 {
2065 RtlFreeUnicodeString(&NtAbsPath);
2066 dwError = ERROR_INVALID_FUNCTION;
2067 break;
2068 }
2069
2070 RtlFreeUnicodeString(&NtAbsPath);
2071
2072 if (!*pch1)
2073 break;
2074
2075 pch1Prev = pch1 + 1;
2076 }
2077
2078 if (dwError != ERROR_SUCCESS)
2079 {
2080 HEAP_free(pszBuff);
2081 *pcwc = *pcFiles = 0;
2082 if (dwError != ERROR_INVALID_FUNCTION)
2083 SetLastError(dwError);
2084 return NULL;
2085 }
2086
2087 *pcwc = (DWORD)wcslen(pszBuff);
2088
2089 // Convert '|' to '\0'
2090 for (PWSTR pch2 = pszBuff; *pch2; ++pch2)
2091 {
2092 if (*pch2 == L'|')
2093 *pch2 = UNICODE_NULL;
2094 }
2095
2096 return pszBuff;
2097}
2098
2099/*
2100 * @unimplemented
2101 */
2102BOOL
2103WINAPI
2105 DWORD fdwHidden,
2106 LPCSTR lpszFontRes,
2107 LPCSTR lpszFontFile,
2108 LPCSTR lpszCurrentPath
2109)
2110{
2111 return FALSE;
2112}
2113
2114/* @implemented */
2115INT
2116WINAPI
2118 _In_ LPCWSTR lpszFilename,
2119 _In_ DWORD fl,
2121{
2122 if (fl & ~(FR_PRIVATE | FR_NOT_ENUM))
2123 {
2125 return 0;
2126 }
2127
2128 return GdiAddFontResourceW(lpszFilename, fl, NULL);
2129}
2130
2131/* @implemented */
2132INT
2133WINAPI
2135 _In_ LPCSTR lpszFilename,
2136 _In_ DWORD fl,
2138{
2139 if (fl & ~(FR_PRIVATE | FR_NOT_ENUM))
2140 {
2142 return 0;
2143 }
2144
2145 if (!lpszFilename)
2146 return 0;
2147
2148 PWSTR FilenameW;
2149 WCHAR szBuff[MAX_PATH];
2150
2151 _SEH2_TRY
2152 {
2153 FilenameW = HEAP_strdupA2W_buf(lpszFilename, szBuff, _countof(szBuff));
2154 }
2156 {
2157 _SEH2_YIELD(return 0);
2158 }
2159 _SEH2_END;
2160
2161 if (!FilenameW)
2162 {
2164 return 0;
2165 }
2166
2167 INT ret = GdiAddFontResourceW(FilenameW, fl, NULL);
2168 HEAP_strdupA2W_buf_free(FilenameW, szBuff);
2169 return ret;
2170}
2171
2172/* @implemented */
2173INT
2174WINAPI
2176{
2177 return AddFontResourceExA(lpszFilename, 0, NULL);
2178}
2179
2180/* @implemented */
2181INT
2182WINAPI
2184{
2185 return GdiAddFontResourceW(lpszFilename, 0, NULL);
2186}
2187
2188/* @implemented */
2189BOOL
2190WINAPI
2192{
2194}
2195
2196/* @implemented */
2197BOOL
2198WINAPI
2200{
2202}
2203
2204/* @implemented */
2205BOOL
2206WINAPI
2209 _In_ DWORD fl,
2211{
2212 if (fl & ~(FR_PRIVATE | FR_NOT_ENUM))
2213 {
2215 return FALSE;
2216 }
2217
2218 if (!lpFileName)
2219 return FALSE;
2220
2221 WCHAR szBuff[MAX_PATH];
2222 PWSTR FilenameW;
2223
2224 _SEH2_TRY
2225 {
2226 FilenameW = HEAP_strdupA2W_buf(lpFileName, szBuff, _countof(szBuff));
2227 }
2229 {
2230 FilenameW = NULL;
2231 }
2232 _SEH2_END;
2233
2234 if (!FilenameW)
2235 {
2237 return FALSE;
2238 }
2239
2240 BOOL result = RemoveFontResourceExW(FilenameW, fl, pdv);
2241 HEAP_strdupA2W_buf_free(FilenameW, szBuff);
2242 return result;
2243}
2244
2245/* @implemented */
2246BOOL
2247WINAPI
2250 _In_ DWORD fl,
2252{
2253 DPRINT("RemoveFontResourceExW\n");
2254
2255 if (fl & ~(FR_PRIVATE | FR_NOT_ENUM))
2256 {
2258 return FALSE;
2259 }
2260
2261 if (!lpFileName)
2262 return FALSE;
2263
2264 ULONG cFiles, cwc;
2265 PWSTR pszConverted = IntConvertFontPaths(lpFileName, &cFiles, &cwc, &fl, TRUE);
2266 if (!pszConverted)
2267 return FALSE;
2268
2269 BOOL ret = NtGdiRemoveFontResourceW(pszConverted, cwc, cFiles, fl, 0, NULL);
2270 HEAP_free(pszConverted);
2271 return ret;
2272}
2273
2274/***********************************************************************
2275 * GdiGetCharDimensions
2276 *
2277 * Gets the average width of the characters in the English alphabet.
2278 *
2279 * PARAMS
2280 * hdc [I] Handle to the device context to measure on.
2281 * lptm [O] Pointer to memory to store the text metrics into.
2282 * height [O] On exit, the maximum height of characters in the English alphabet.
2283 *
2284 * RETURNS
2285 * The average width of characters in the English alphabet.
2286 *
2287 * NOTES
2288 * This function is used by the dialog manager to get the size of a dialog
2289 * unit. It should also be used by other pieces of code that need to know
2290 * the size of a dialog unit in logical units without having access to the
2291 * window handle of the dialog.
2292 * Windows caches the font metrics from this function, but we don't and
2293 * there doesn't appear to be an immediate advantage to do so.
2294 *
2295 * SEE ALSO
2296 * GetTextExtentPointW, GetTextMetricsW, MapDialogRect.
2297 *
2298 * Despite most of MSDN insisting that the horizontal base unit is
2299 * tmAveCharWidth it isn't. Knowledge base article Q145994
2300 * "HOWTO: Calculate Dialog Units When Not Using the System Font",
2301 * says that we should take the average of the 52 English upper and lower
2302 * case characters.
2303 */
2304/*
2305 * @implemented
2306 */
2307LONG
2308WINAPI
2310{
2311 SIZE sz;
2313 static const WCHAR alphabet[] =
2314 {
2315 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
2316 'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H',
2317 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0
2318 };
2319
2320 if(!GetTextMetricsW(hdc, &tm)) return 0;
2321
2322 if(!GetTextExtentPointW(hdc, alphabet, 52, &sz)) return 0;
2323
2324 if (lptm) *lptm = tm;
2325 if (height) *height = tm.tmHeight;
2326
2327 return (sz.cx / 26 + 1) / 2;
2328}
2329
2330/*************************************************************************
2331 * TranslateCharsetInfo [GDI32.@]
2332 *
2333 * Fills a CHARSETINFO structure for a character set, code page, or
2334 * font. This allows making the correspondance between different labelings
2335 * (character set, Windows, ANSI, and OEM codepages, and Unicode ranges)
2336 * of the same encoding.
2337 *
2338 * Only one codepage will be set in lpCs->fs. If TCI_SRCFONTSIG is used,
2339 * only one codepage should be set in *lpSrc.
2340 *
2341 * RETURNS
2342 * TRUE on success, FALSE on failure.
2343 *
2344 */
2345/*
2346 * @implemented
2347 */
2348BOOL
2349WINAPI
2351 LPDWORD lpSrc, /* [in]
2352 if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE
2353 if flags == TCI_SRCCHARSET: a character set value
2354 if flags == TCI_SRCCODEPAGE: a code page value
2355 */
2356 LPCHARSETINFO lpCs, /* [out] structure to receive charset information */
2357 DWORD flags /* [in] determines interpretation of lpSrc */)
2358{
2359 int index = 0;
2360 switch (flags)
2361 {
2362 case TCI_SRCFONTSIG:
2363 while (index < MAXTCIINDEX && !(*lpSrc>>index & 0x0001)) index++;
2364 break;
2365 case TCI_SRCCODEPAGE:
2366 while (index < MAXTCIINDEX && PtrToUlong(lpSrc) != FONT_tci[index].ciACP) index++;
2367 break;
2368 case TCI_SRCCHARSET:
2369 while (index < MAXTCIINDEX && PtrToUlong(lpSrc) != FONT_tci[index].ciCharset) index++;
2370 break;
2371 case TCI_SRCLOCALE:
2372 {
2373 LCID lCid = (LCID)PtrToUlong(lpSrc);
2374 LOCALESIGNATURE LocSig;
2375 INT Ret = GetLocaleInfoW(lCid, LOCALE_FONTSIGNATURE, (LPWSTR)&LocSig, 0);
2376 if ( GetLocaleInfoW(lCid, LOCALE_FONTSIGNATURE, (LPWSTR)&LocSig, Ret))
2377 {
2378 while (index < MAXTCIINDEX && !(LocSig.lsCsbDefault[0]>>index & 0x0001)) index++;
2379 break;
2380 }
2381 }
2382 default:
2384 return FALSE;
2385 }
2386 if (index >= MAXTCIINDEX || FONT_tci[index].ciCharset == DEFAULT_CHARSET) return FALSE;
2387 DPRINT("Index %d Charset %u CodePage %u FontSig %lu\n",
2388 index,FONT_tci[index].ciCharset,FONT_tci[index].ciACP,FONT_tci[index].fs.fsCsb[0]);
2389 memcpy(lpCs, &FONT_tci[index], sizeof(CHARSETINFO));
2390 return TRUE;
2391}
2392
2393
2394/*
2395 * @implemented
2396 */
2397DWORD
2398WINAPI
2400 HDC hDC,
2401 DWORD flags
2402)
2403{
2404 DWORD Ret = GDI_ERROR;
2405 PDC_ATTR Dc_Attr;
2406
2407 /* Get the DC attribute */
2408 Dc_Attr = GdiGetDcAttr(hDC);
2409 if (Dc_Attr == NULL)
2410 {
2412 return GDI_ERROR;
2413 }
2414
2415 if (NtCurrentTeb()->GdiTebBatch.HDC == hDC)
2416 {
2417 if (Dc_Attr->ulDirty_ & DC_FONTTEXT_DIRTY)
2418 {
2419 NtGdiFlush();
2421 }
2422 }
2423
2424 if ( flags & ~1 )
2426 else
2427 {
2428 Ret = Dc_Attr->flFontMapper;
2429 Dc_Attr->flFontMapper = flags;
2430 }
2431 return Ret;
2432}
2433
2434
2435/*
2436 * @unimplemented
2437 */
2438int
2439WINAPI
2441 HDC hDC,
2442 LPCWSTR lpFaceName,
2443 FONTENUMPROCW FontFunc,
2445)
2446{
2447#if 0
2448 return NtGdiEnumFonts ( hDC, lpFaceName, FontFunc, lParam );
2449#else
2450 return EnumFontFamiliesW( hDC, lpFaceName, FontFunc, lParam );
2451#endif
2452}
2453
2454/*
2455 * @unimplemented
2456 */
2457int
2458WINAPI
2460 HDC hDC,
2461 LPCSTR lpFaceName,
2462 FONTENUMPROCA FontFunc,
2464)
2465{
2466#if 0
2468 LPWSTR lpFaceNameW;
2469 int rc = 0;
2470
2471 Status = HEAP_strdupA2W ( &lpFaceNameW, lpFaceName );
2472 if (!NT_SUCCESS (Status))
2474 else
2475 {
2476 rc = NtGdiEnumFonts ( hDC, lpFaceNameW, FontFunc, lParam );
2477
2478 HEAP_free ( lpFaceNameW );
2479 }
2480 return rc;
2481#else
2482 return EnumFontFamiliesA( hDC, lpFaceName, FontFunc, lParam );
2483#endif
2484}
2485
2486#define EfdFontFamilies 3
2487
2488INT
2489WINAPI
2491 HDC hDC,
2492 LPLOGFONTW lpLogfont,
2493 FONTENUMPROCW lpEnumFontFamExProcW,
2494 LPARAM lParam,
2495 DWORD dwFlags)
2496{
2497 ULONG_PTR idEnum;
2498 ULONG cbDataSize, cbRetSize;
2499 PENUMFONTDATAW pEfdw;
2500 PBYTE pBuffer;
2501 PBYTE pMax;
2502 INT ret = 1;
2503
2504 /* Open enumeration handle and find out how much memory we need */
2505 idEnum = NtGdiEnumFontOpen(hDC,
2507 0,
2509 (lpLogfont && lpLogfont->lfFaceName[0])? lpLogfont->lfFaceName : NULL,
2510 lpLogfont? lpLogfont->lfCharSet : DEFAULT_CHARSET,
2511 &cbDataSize);
2512 if (idEnum == 0)
2513 {
2514 return 0;
2515 }
2516 if (cbDataSize == 0)
2517 {
2518 NtGdiEnumFontClose(idEnum);
2519 return 0;
2520 }
2521
2522 /* Allocate memory */
2523 pBuffer = HeapAlloc(GetProcessHeap(), 0, cbDataSize);
2524 if (pBuffer == NULL)
2525 {
2527 NtGdiEnumFontClose(idEnum);
2528 return 0;
2529 }
2530
2531 /* Do the enumeration */
2532 if (!NtGdiEnumFontChunk(hDC, idEnum, cbDataSize, &cbRetSize, (PVOID)pBuffer))
2533 {
2535 NtGdiEnumFontClose(idEnum);
2536 return 0;
2537 }
2538
2539 /* Get start and end address */
2540 pEfdw = (PENUMFONTDATAW)pBuffer;
2541 pMax = pBuffer + cbDataSize;
2542
2543 /* Iterate through the structures */
2544 while ((PBYTE)pEfdw < pMax && ret)
2545 {
2546 PNTMW_INTERNAL pNtmwi = (PNTMW_INTERNAL)((ULONG_PTR)pEfdw + pEfdw->ulNtmwiOffset);
2547
2548 ret = lpEnumFontFamExProcW((VOID*)&pEfdw->elfexdv.elfEnumLogfontEx,
2549 (VOID*)&pNtmwi->ntmw,
2550 pEfdw->dwFontType,
2551 lParam);
2552
2553 pEfdw = (PENUMFONTDATAW)((ULONG_PTR)pEfdw + pEfdw->cbSize);
2554 }
2555
2556 /* Release the memory and close handle */
2558 NtGdiEnumFontClose(idEnum);
2559
2560 return ret;
2561}
2562
2563/* @implemented */
2564INT
2565WINAPI
2567 LPCWSTR lpszFilename,
2568 FLONG fl,
2570{
2571 ULONG cFiles, cwc;
2572 PWSTR pszConverted = IntConvertFontPaths(lpszFilename, &cFiles, &cwc, &fl, FALSE);
2573 if (!pszConverted)
2574 return 0;
2575
2576 INT ret = NtGdiAddFontResourceW(pszConverted, cwc, cFiles, fl, 0, pdv);
2577 HEAP_free(pszConverted);
2578 if (ret)
2579 return ret;
2580
2581 pszConverted = IntConvertFontPaths(lpszFilename, &cFiles, &cwc, &fl, TRUE);
2582 if (!pszConverted)
2583 return 0;
2584
2585 ret = NtGdiAddFontResourceW(pszConverted, cwc, cFiles, fl, 0, pdv);
2586 HEAP_free(pszConverted);
2587 if (!ret)
2589 return ret;
2590}
2591
2592/*
2593 * @implemented
2594 */
2595HANDLE
2596WINAPI
2598 PVOID pbFont,
2599 DWORD cbFont,
2600 PVOID pdv,
2601 DWORD *pcFonts
2602)
2603{
2604 if ( pbFont && cbFont && pcFonts)
2605 {
2606 return NtGdiAddFontMemResourceEx(pbFont, cbFont, NULL, 0, pcFonts);
2607 }
2609 return NULL;
2610}
2611
2612/*
2613 * @implemented
2614 */
2615BOOL
2616WINAPI
2618{
2619 if (fh)
2620 {
2622 }
2624 return FALSE;
2625}
2626
2627
2628/*
2629 * @unimplemented
2630 */
2631int
2632WINAPI
2634 LPCSTR lpString,
2635 int unknown
2636)
2637{
2640 return 0;
2641}
2642
2643/*
2644 * @unimplemented
2645 */
2646int
2647WINAPI
2649{
2652 return 0;
2653}
2654
2655BOOL
2656WINAPI
2658 DWORD fdwHidden,
2659 LPCWSTR lpszFontRes,
2660 LPCWSTR lpszFontFile,
2661 LPCWSTR lpszCurrentPath
2662)
2663{
2664 HANDLE f;
2665
2667
2668 /* fHidden=1 - only visible for the calling app, read-only, not
2669 * enumerated with EnumFonts/EnumFontFamilies
2670 * lpszCurrentPath can be NULL
2671 */
2672
2673 /* If the output file already exists, return the ERROR_FILE_EXISTS error as specified in MSDN */
2674 if ((f = CreateFileW(lpszFontRes, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)) != INVALID_HANDLE_VALUE)
2675 {
2676 CloseHandle(f);
2678 return FALSE;
2679 }
2680 return FALSE; /* create failed */
2681}
2682
2683/*
2684 * @unimplemented
2685 */
2686BOOL
2687WINAPI
2689{
2692 return 0;
2693}
2694
2695/*
2696 * @unimplemented
2697 */
2698BOOL
2699WINAPI
2700EudcLoadLinkW(LPCWSTR pBaseFaceName,LPCWSTR pEudcFontPath,INT iPriority,INT iFontLinkType)
2701{
2704 return 0;
2705}
2706
2707/*
2708 * @unimplemented
2709 */
2710BOOL
2711WINAPI
2712EudcUnloadLinkW(LPCWSTR pBaseFaceName,LPCWSTR pEudcFontPath)
2713{
2716 return 0;
2717}
2718
2719/*
2720 * @implemented
2721 */
2722ULONG
2723WINAPI
2725{
2727}
2728
2729/*
2730 * @implemented
2731 */
2732DWORD
2733WINAPI
2735{
2736 DWORD retValue = 0;
2737
2738 if (!lpBaseFaceName)
2739 {
2740 retValue = NtGdiGetEudcTimeStampEx(NULL,0,FALSE);
2741 }
2742 else
2743 {
2744 retValue = NtGdiGetEudcTimeStampEx(lpBaseFaceName, wcslen(lpBaseFaceName), FALSE);
2745 }
2746
2747 return retValue;
2748}
2749
2750/*
2751 * @implemented
2752 */
2753ULONG
2754WINAPI
2756{
2757 ULONG retValue = 0;
2758
2759 if (hdc)
2760 {
2761 retValue = NtGdiQueryFontAssocInfo(hdc);
2762 }
2763
2764 return retValue;
2765}
2766
2767/*
2768 * @unimplemented
2769 */
2770DWORD
2771WINAPI
2773{
2776 return 0;
2777}
2778
2779/*
2780 * @unimplemented
2781 */
2782VOID
2783WINAPI
2785{
2788}
2789
2790/*
2791 * @implemented
2792 *
2793 */
2794DWORD
2795WINAPI
2797 DWORD dwTable,
2799 LPVOID lpvBuffer,
2800 DWORD cbData)
2801{
2802 if (!lpvBuffer)
2803 {
2804 cbData = 0;
2805 }
2806 return NtGdiGetFontData(hdc, dwTable, dwOffset, lpvBuffer, cbData);
2807}
2808
2809DWORD
2810WINAPI
2812{
2815 return 0;
2816}
static HDC hDC
Definition: 3dtext.c:33
INT APIENTRY NtGdiAddFontResourceW(_In_reads_(cwc) WCHAR *pwszFiles, _In_ ULONG cwc, _In_ ULONG cFiles, _In_ FLONG f, _In_ DWORD dwPidTid, _In_opt_ DESIGNVECTOR *pdv)
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
static BOOL CALLBACK EnumProc(_In_ HWND hWnd, _In_ LPARAM lParam)
Definition: SetParent.c:53
#define __inline
Definition: _wctype.cpp:15
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define CHAR(Char)
#define ULongToPtr(ul)
Definition: basetsd.h:86
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:616
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:634
CFF_Charset charset
Definition: cffcmap.c:137
LPARAM lParam
Definition: combotst.c:139
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define ERROR_SUCCESS
Definition: deptool.c:10
#define LF_FACESIZE
Definition: dimm.idl:39
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define APIENTRY
Definition: api.h:79
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrcpynW
Definition: compat.h:738
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
Definition: path.c:1298
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2271
BOOL WINAPI GetCPInfo(UINT codepage, LPCPINFO cpinfo)
Definition: locale.c:2146
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1675
int intptr_t
Definition: corecrt.h:176
#define __cdecl
Definition: corecrt.h:121
int ptrdiff_t
Definition: corecrt.h:194
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:159
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
#define LONG_MAX
Definition: limits.h:30
_ACRTIMP double __cdecl fabs(double)
_ACRTIMP double __cdecl floor(double)
Definition: floor.c:18
_ACRTIMP void __cdecl qsort(void *, size_t, size_t, int(__cdecl *)(const void *, const void *))
_ACRTIMP __msvcrt_long __cdecl labs(__msvcrt_long)
Definition: math.c:680
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
#define PtrToUlong(u)
Definition: config.h:107
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG NTAPI NtGdiGetFontFamilyInfo(_In_ HDC Dc, _In_ const LOGFONTW *UnsafeLogFont, _Out_ PFONTFAMILYINFO UnsafeInfo, _Inout_ PLONG UnsafeInfoCount)
Definition: freetype.c:6555
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
VOID WINAPI EnumLogFontExW2A(LPENUMLOGFONTEXA fontA, CONST ENUMLOGFONTEXW *fontW)
Definition: utils.c:402
BOOL WINAPI GdiValidateHandle(HGDIOBJ)
Definition: misc.c:712
VOID NTAPI LogFontA2W(LPLOGFONTW pW, CONST LOGFONTA *pA)
Definition: utils.c:348
BOOL gbLpk
Definition: dllmain.c:12
LPKGCP LpkGetCharacterPlacement
Definition: utils.c:6
VOID NTAPI LogFontW2A(LPLOGFONTA pA, CONST LOGFONTW *pW)
Definition: utils.c:375
PWSTR FASTCALL HEAP_strdupA2W_buf(_In_ PCSTR lpszA, _In_ PWSTR pszStaticBuff, _In_ SIZE_T cchStaticBuff)
Definition: heap.c:53
DWORD WINAPI GetDCDWord(_In_ HDC hdc, _In_ UINT u, _In_ DWORD dwError)
Definition: dc.c:787
#define LPK_GCP
Definition: gdi32p.h:83
BOOL WINAPI LoadLPK(INT LpkFunctionID)
Definition: utils.c:423
static VOID FASTCALL HEAP_free(_In_ __drv_freesMem(Mem) PVOID memory)
Definition: gdi32p.h:226
VOID WINAPI GdiSetLastError(DWORD dwErrCode)
Definition: misc.c:873
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:477
NTSTATUS FASTCALL HEAP_strdupA2W(_Outptr_ PWSTR *ppszW, _In_ PCSTR lpszA)
Definition: heap.c:34
static VOID FASTCALL HEAP_strdupA2W_buf_free(_In_opt_ PWSTR pszDynamicBuff, _In_ PWSTR pszStaticBuff)
Definition: gdi32p.h:244
#define GDI_OBJECT_TYPE_DC
Definition: gdi.h:46
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
BOOL APIENTRY NtGdiGetTransform(_In_ HDC hdc, _In_ DWORD iXform, _Out_ LPXFORM pxf)
Status
Definition: gdiplustypes.h:25
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
const GLubyte * c
Definition: glext.h:8905
GLuint index
Definition: glext.h:6031
GLfloat f
Definition: glext.h:7540
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLint left
Definition: glext.h:7726
GLbitfield flags
Definition: glext.h:7161
const GLint * first
Definition: glext.h:5794
GLuint GLfloat * val
Definition: glext.h:7180
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define S_OK
Definition: intsafe.h:52
#define NtCurrentTeb
#define f
Definition: ke_i.h:83
#define c
Definition: ke_i.h:80
POINT cp
Definition: magnifier.c:59
#define ZeroMemory
Definition: minwinbase.h:31
#define CopyMemory
Definition: minwinbase.h:29
LONG_PTR LPARAM
Definition: minwindef.h:175
int * LPINT
Definition: minwindef.h:151
FLOAT * PFLOAT
Definition: minwindef.h:147
int * PINT
Definition: minwindef.h:150
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ASSERT(a)
Definition: mode.c:44
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static PVOID ptr
Definition: dispmode.c:27
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static const struct update_accum a1
Definition: msg.c:534
static const struct update_accum a2
Definition: msg.c:542
static const struct update_accum a3
Definition: msg.c:556
static const struct update_accum a4
Definition: msg.c:2188
static LPCWSTR LPVOID pvReserved
Definition: asmcache.c:749
static LPCSTR lpstr
Definition: font.c:51
static UINT first
Definition: font.c:44
static LPTEXTMETRICW lptm
Definition: font.c:42
static UINT UINT last
Definition: font.c:45
static LPCSTR INT LPWORD pgi
Definition: font.c:51
static LPCSTR INT LPWORD DWORD flags
Definition: font.c:51
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:91
#define cmp(status, error)
Definition: error.c:114
static float int float int float int x3
Definition: server.c:79
static float int float int float int float int x4
Definition: server.c:79
static float int float int float int float int float int x5
Definition: server.c:79
static float int float int float int float int float int float int x6
Definition: server.c:79
static double int double int double int double int double int double int double int x7
Definition: server.c:82
WCHAR strW[12]
Definition: clipboard.c:2025
#define min(a, b)
Definition: monoChain.cc:55
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4755
unsigned int UINT
Definition: ndis.h:50
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
_Out_ LPWSTR lpBuffer
Definition: netsh.h:68
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
int Count
Definition: noreturn.cpp:7
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define FASTCALL
Definition: nt_native.h:50
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define DWORD
Definition: nt_native.h:44
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
unsigned long FLONG
Definition: ntbasedef.h:378
#define UNICODE_NULL
__kernel_entry W32KAPI DWORD APIENTRY NtGdiGetGlyphIndicesW(_In_ HDC hdc, _In_reads_opt_(cwc) PCWCH pwc, _In_ INT cwc, _Out_writes_opt_(cwc) PWORD pgi, _In_ DWORD iMode)
Definition: freetype.c:7804
__kernel_entry W32KAPI BOOL APIENTRY NtGdiGetCharWidthW(_In_ HDC hdc, _In_ UINT wcFirst, _In_ UINT cwc, _In_reads_opt_(cwc) PCWCH pwc, _In_ FLONG fl, _Out_writes_bytes_(cwc *sizeof(ULONG)) PVOID pvBuf)
__kernel_entry W32KAPI ULONG APIENTRY NtGdiGetKerningPairs(_In_ HDC hdc, _In_ ULONG cPairs, _Out_writes_to_opt_(cPairs, return) KERNINGPAIR *pkpDst)
__kernel_entry W32KAPI HFONT APIENTRY NtGdiHfontCreate(_In_reads_bytes_(cjElfw) const ENUMLOGFONTEXDVW *pelfw, _In_ ULONG cjElfw, _In_ LFTYPE lft, _In_ FLONG fl, _In_opt_ PVOID pvCliData)
Definition: font.c:1277
_In_ DWORD _In_ DWORD dwOffset
Definition: ntgdi.h:2033
__kernel_entry W32KAPI BOOL APIENTRY NtGdiEnumFontChunk(_In_ HDC hdc, _In_ ULONG_PTR idEnum, _In_ ULONG cjEfdw, _Out_ ULONG *pcjEfdw, _Out_ PENUMFONTDATAW pefdw)
__kernel_entry W32KAPI NTSTATUS APIENTRY NtGdiFlush(VOID)
Definition: gdibatch.c:471
__kernel_entry W32KAPI ULONG APIENTRY NtGdiGetGlyphOutline(_In_ HDC hdc, _In_ WCHAR wch, _In_ UINT iFormat, _Out_ LPGLYPHMETRICS pgm, _In_ ULONG cjBuf, _Out_writes_bytes_opt_(cjBuf) PVOID pvBuf, _In_ const MAT2 *pmat2, _In_ BOOL bIgnoreRotation)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiEnumFontClose(_In_ ULONG_PTR idEnum)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiRemoveFontResourceW(_In_reads_(cwc) PCWCH pwszFiles, _In_ ULONG cwc, _In_ ULONG cFiles, _In_ ULONG fl, _In_ DWORD dwPidTid, _In_opt_ const DESIGNVECTOR *pdv)
Definition: font.c:530
__kernel_entry W32KAPI INT APIENTRY NtGdiGetTextCharsetInfo(_In_ HDC hdc, _Out_opt_ LPFONTSIGNATURE lpSig, _In_ DWORD dwFlags)
Definition: text.c:265
__kernel_entry W32KAPI BOOL APIENTRY NtGdiEnumFonts(_In_ HDC hdc, _In_ ULONG iEnumType, _In_ FLONG flWin31Compat, _In_ ULONG cchFaceName, _In_reads_opt_(cchFaceName) LPCWSTR pwszFaceName, _In_ ULONG lfCharSet, _Inout_ ULONG *pulCount, _Out_writes_bytes_opt_(*pulCount) PVOID pvUserModeBuffer)
__kernel_entry W32KAPI ULONG_PTR APIENTRY NtGdiEnumFontOpen(_In_ HDC hdc, _In_ ULONG iEnumType, _In_ FLONG flWin31Compat, _In_ ULONG cwchMax, _In_opt_ LPWSTR pwszFaceName, _In_ ULONG lfCharSet, _Out_ ULONG *pulCount)
__kernel_entry W32KAPI DWORD APIENTRY NtGdiGetCharacterPlacementW(_In_ HDC hdc, _In_reads_(nCount) PCWCH pwsz, _In_ INT nCount, _In_ INT nMaxExtent, _Inout_opt_ LPGCP_RESULTSW pgcpw, _In_ DWORD dwFlags)
Definition: font.c:652
__kernel_entry W32KAPI BOOL APIENTRY NtGdiGetCharABCWidthsW(_In_ HDC hdc, _In_ UINT wchFirst, _In_ ULONG cwch, _In_reads_opt_(cwch) PCWCH pwch, _In_ FLONG fl, _Out_writes_bytes_(cwch *sizeof(ABC)) PVOID pvBuf)
__kernel_entry W32KAPI ULONG APIENTRY NtGdiQueryFontAssocInfo(_In_ HDC hdc)
__kernel_entry W32KAPI ULONG APIENTRY NtGdiGetOutlineTextMetricsInternalW(_In_ HDC hdc, _In_ ULONG cjotm, _Out_writes_bytes_opt_(cjotm) POUTLINETEXTMETRICW potmw, _Out_ PTMDIFF ptmd)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiRemoveFontMemResourceEx(_In_ HANDLE hMMFont)
Definition: font.c:640
__kernel_entry W32KAPI HANDLE APIENTRY NtGdiAddFontMemResourceEx(_In_reads_bytes_(cjBuffer) const VOID *pvBuffer, _In_ DWORD cjBuffer, _In_reads_bytes_opt_(cjDV) const DESIGNVECTOR *pdv, _In_ ULONG cjDV, _Out_ PDWORD pNumFonts)
Definition: font.c:584
_In_ DWORD dwTable
Definition: ntgdi.h:2032
__kernel_entry W32KAPI ULONG APIENTRY NtGdiGetEudcTimeStampEx(_In_reads_opt_(cwcBaseFaceName) LPWSTR lpBaseFaceName, _In_ ULONG cwcBaseFaceName, _In_ BOOL bSystemTimeStamp)
struct tagFONTFAMILYINFO FONTFAMILYINFO
#define DC_FONTTEXT_DIRTY
Definition: ntgdihdl.h:145
#define DC_MODE_DIRTY
Definition: ntgdihdl.h:144
#define GCW_WIN32
Definition: ntgdityp.h:204
#define GCW_INDICES
Definition: ntgdityp.h:206
#define GCW_NOFLOAT
Definition: ntgdityp.h:205
@ GdiGetFontLanguageInfo
Definition: ntgdityp.h:54
struct _ENUMFONTDATAW * PENUMFONTDATAW
#define GCABCW_INDICES
Definition: ntgdityp.h:210
struct _NTMW_INTERNAL * PNTMW_INTERNAL
#define GdiDeviceSpaceToWorldSpace
Definition: ntgdityp.h:185
#define GCABCW_NOFLOAT
Definition: ntgdityp.h:209
#define CONST
Definition: pedump.c:81
BYTE * PBYTE
Definition: pedump.c:66
DWORD * PDWORD
Definition: pedump.c:68
long LONG
Definition: pedump.c:60
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:184
PVOID pBuffer
const WCHAR * str
DWORD LCID
Definition: nls.h:13
wcsncpy
_In_ UINT _In_ UINT cch
Definition: shellapi.h:432
#define DPRINT
Definition: sndvol32.h:73
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
BYTE lfOutPrecision
Definition: dimm.idl:68
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
LONG lfOrientation
Definition: dimm.idl:62
LONG lfWidth
Definition: dimm.idl:60
BYTE lfUnderline
Definition: dimm.idl:65
BYTE lfClipPrecision
Definition: dimm.idl:69
LONG lfEscapement
Definition: dimm.idl:61
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfQuality
Definition: dimm.idl:70
BYTE lfPitchAndFamily
Definition: dimm.idl:71
Definition: wingdi.h:1856
ULONG ulDirty_
Definition: ntgdihdl.h:294
FLONG flFontMapper
Definition: ntgdihdl.h:316
DWORD dvNumAxes
Definition: wingdi.h:3215
ULONG cbSize
Definition: ntgdityp.h:382
DWORD dwFontType
Definition: ntgdityp.h:384
ENUMLOGFONTEXDVW elfexdv
Definition: ntgdityp.h:385
ULONG ulNtmwiOffset
Definition: ntgdityp.h:383
Definition: wingdi.h:2918
NEWTEXTMETRICEXW ntmw
Definition: ntgdityp.h:377
int otmsStrikeoutPosition
Definition: wingdi.h:2950
POINT otmptSuperscriptOffset
Definition: wingdi.h:2948
POINT otmptSubscriptSize
Definition: wingdi.h:2945
PANOSE otmPanoseNumber
Definition: wingdi.h:2928
POINT otmptSubscriptOffset
Definition: wingdi.h:2946
TEXTMETRICA otmTextMetrics
Definition: wingdi.h:2926
POINT otmptSuperscriptSize
Definition: wingdi.h:2947
int otmsUnderscorePosition
Definition: wingdi.h:2952
UINT otmsStrikeoutSize
Definition: wingdi.h:2949
PANOSE otmPanoseNumber
Definition: wingdi.h:2962
POINT otmptSuperscriptOffset
Definition: wingdi.h:2982
POINT otmptSuperscriptSize
Definition: wingdi.h:2981
POINT otmptSubscriptSize
Definition: wingdi.h:2979
int otmsStrikeoutPosition
Definition: wingdi.h:2984
int otmsUnderscorePosition
Definition: wingdi.h:2986
TEXTMETRICW otmTextMetrics
Definition: wingdi.h:2960
POINT otmptSubscriptOffset
Definition: wingdi.h:2980
UINT otmsStrikeoutSize
Definition: wingdi.h:2983
LONG cx
Definition: kdterminal.h:27
FLOAT eM11
Definition: wingdi.h:2167
FLOAT eM22
Definition: wingdi.h:2170
BYTE DefaultChar[MAX_DEFAULTCHAR]
Definition: winnls.h:651
Definition: ffs.h:70
LOGFONTA elfLogFont
Definition: wingdi.h:3142
BYTE elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:3143
BYTE elfScript[LF_FACESIZE]
Definition: wingdi.h:3145
BYTE elfStyle[LF_FACESIZE]
Definition: wingdi.h:3144
DESIGNVECTOR elfDesignVector
Definition: wingdi.h:3226
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:3225
WCHAR elfStyle[LF_FACESIZE]
Definition: wingdi.h:3150
LOGFONTW elfLogFont
Definition: wingdi.h:3148
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:3149
WCHAR elfScript[LF_FACESIZE]
Definition: wingdi.h:3151
ENUMLOGFONTEXW EnumLogFontEx
Definition: ntgdibad.h:47
LPSTR lpOutString
Definition: wingdi.h:2867
INT * lpCaretPos
Definition: wingdi.h:2881
LPWSTR lpClass
Definition: wingdi.h:2882
LPWSTR lpOutString
Definition: wingdi.h:2878
UINT * lpOrder
Definition: wingdi.h:2879
LPWSTR lpGlyphs
Definition: wingdi.h:2883
WORD wSecond
Definition: wingdi.h:2911
int iKernAmount
Definition: wingdi.h:2912
DWORD lsCsbDefault[2]
Definition: wingdi.h:3058
BYTE lfCharSet
Definition: wingdi.h:2335
BYTE lfPitchAndFamily
Definition: wingdi.h:2339
CHAR lfFaceName[LF_FACESIZE]
Definition: wingdi.h:2340
BYTE lfCharSet
Definition: wingdi.h:2351
WCHAR lfFaceName[LF_FACESIZE]
Definition: wingdi.h:2356
BYTE lfPitchAndFamily
Definition: wingdi.h:2355
UINT ntmCellHeight
Definition: wingdi.h:3086
NEWTEXTMETRICA ntmTm
Definition: wingdi.h:3117
FONTSIGNATURE ntmFontSig
Definition: wingdi.h:3118
NEWTEXTMETRICW ntmTm
Definition: wingdi.h:3121
FONTSIGNATURE ntmFontSig
Definition: wingdi.h:3122
UINT ntmCellHeight
Definition: wingdi.h:3112
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
BYTE tmStruckOut
Definition: wingdi.h:2824
BYTE tmPitchAndFamily
Definition: wingdi.h:2825
BYTE tmCharSet
Definition: wingdi.h:2826
LONG tmDescent
Definition: wingdi.h:2809
LONG tmDigitizedAspectX
Definition: wingdi.h:2816
BYTE tmFirstChar
Definition: wingdi.h:2818
LONG tmExternalLeading
Definition: wingdi.h:2811
LONG tmWeight
Definition: wingdi.h:2814
BYTE tmBreakChar
Definition: wingdi.h:2821
LONG tmInternalLeading
Definition: wingdi.h:2810
BYTE tmLastChar
Definition: wingdi.h:2819
BYTE tmUnderlined
Definition: wingdi.h:2823
LONG tmMaxCharWidth
Definition: wingdi.h:2813
LONG tmAveCharWidth
Definition: wingdi.h:2812
BYTE tmDefaultChar
Definition: wingdi.h:2820
LONG tmAscent
Definition: wingdi.h:2808
LONG tmOverhang
Definition: wingdi.h:2815
LONG tmHeight
Definition: wingdi.h:2807
BYTE tmItalic
Definition: wingdi.h:2822
LONG tmDigitizedAspectY
Definition: wingdi.h:2817
WCHAR tmFirstChar
Definition: wingdi.h:2840
LONG tmDigitizedAspectX
Definition: wingdi.h:2838
LONG tmDigitizedAspectY
Definition: wingdi.h:2839
LONG tmOverhang
Definition: wingdi.h:2837
LONG tmAveCharWidth
Definition: wingdi.h:2834
LONG tmAscent
Definition: wingdi.h:2830
LONG tmMaxCharWidth
Definition: wingdi.h:2835
BYTE tmItalic
Definition: wingdi.h:2844
BYTE tmStruckOut
Definition: wingdi.h:2846
LONG tmInternalLeading
Definition: wingdi.h:2832
BYTE tmUnderlined
Definition: wingdi.h:2845
LONG tmExternalLeading
Definition: wingdi.h:2833
BYTE tmPitchAndFamily
Definition: wingdi.h:2847
LONG tmWeight
Definition: wingdi.h:2836
WCHAR tmBreakChar
Definition: wingdi.h:2843
WCHAR tmDefaultChar
Definition: wingdi.h:2842
BYTE tmCharSet
Definition: wingdi.h:2848
WCHAR tmLastChar
Definition: wingdi.h:2841
LONG tmHeight
Definition: wingdi.h:2829
LONG tmDescent
Definition: wingdi.h:2831
uint16_t * PWSTR
Definition: typedefs.h:56
char * PSTR
Definition: typedefs.h:51
const uint16_t * PCWSTR
Definition: typedefs.h:57
float FLOAT
Definition: typedefs.h:69
uint16_t * LPWORD
Definition: typedefs.h:56
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t * LPDWORD
Definition: typedefs.h:59
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define MAKELONG(a, b)
Definition: typedefs.h:249
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
#define FORCEINLINE
Definition: wdftypes.h:67
VOID FASTCALL NewTextMetricExW2A(NEWTEXTMETRICEXA *tma, NEWTEXTMETRICEXW *tmw)
Definition: font.c:203
BOOL WINAPI RemoveFontResourceW(_In_ LPCWSTR lpFileName)
Definition: font.c:2191
FORCEINLINE int FASTCALL IntFontFamilyCompareEx(const FONTFAMILYINFO *ffi1, const FONTFAMILYINFO *ffi2, DWORD dwCompareFlags)
Definition: font.c:214
BOOL WINAPI GetCharWidthFloatW(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBuffer)
Definition: font.c:712
HFONT WINAPI CreateFontIndirectExW(const ENUMLOGFONTEXDVW *elfexd)
Definition: font.c:1699
static const CHARSETINFO FONT_tci[MAXTCIINDEX]
Definition: font.c:33
DWORD WINAPI GetKerningPairsA(HDC hDC, DWORD cPairs, LPKERNINGPAIR kern_pairA)
Definition: font.c:1593
static INT width_to_LP(XFORM *xForm, INT width)
Definition: font.c:1404
BOOL WINAPI GetCharWidth32A(HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer)
Definition: font.c:859
DWORD WINAPI GetGlyphOutlineWow(DWORD a0, DWORD a1, DWORD a2, DWORD a3, DWORD a4, DWORD a5, DWORD a6)
Definition: font.c:1200
VOID FASTCALL NewTextMetricW2A(NEWTEXTMETRICA *tma, NEWTEXTMETRICW *tmw)
Definition: font.c:193
DWORD WINAPI SetMapperFlags(HDC hDC, DWORD flags)
Definition: font.c:2399
#define MAXTCIINDEX
Definition: font.c:32
BOOL WINAPI CreateScalableFontResourceW(DWORD fdwHidden, LPCWSTR lpszFontRes, LPCWSTR lpszFontFile, LPCWSTR lpszCurrentPath)
Definition: font.c:2657
BOOL WINAPI RemoveFontResourceExW(_In_ LPCWSTR lpFileName, _In_ DWORD fl, _In_opt_ PVOID pdv)
Definition: font.c:2248
DWORD WINAPI GetFontLanguageInfo(HDC hDc)
Definition: font.c:1079
DWORD WINAPI GetFontData(HDC hdc, DWORD dwTable, DWORD dwOffset, LPVOID lpvBuffer, DWORD cbData)
Definition: font.c:2796
static int __cdecl IntFontFamilyCompare(const void *ffi1, const void *ffi2)
Definition: font.c:247
BOOL APIENTRY GetCharWidthFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBuffer)
Definition: font.c:907
int FASTCALL IntFontFamilyListUnique(FONTFAMILYINFO *InfoList, INT nCount, const LOGFONTW *plf, DWORD dwFlags)
Definition: font.c:257
BOOL WINAPI GetCharABCWidthsFloatW(HDC hdc, UINT FirstChar, UINT LastChar, LPABCFLOAT abcF)
Definition: font.c:688
PWSTR FASTCALL IntConvertFontPaths(_In_ PCWSTR pszFiles, _Out_ PDWORD pcFiles, _Out_ PDWORD pcwc, _Inout_ PDWORD pfl, _In_ BOOL bFlag)
Definition: font.c:1963
INT WINAPI NewEnumFontFamiliesExW(HDC hDC, LPLOGFONTW lpLogfont, FONTENUMPROCW lpEnumFontFamExProcW, LPARAM lParam, DWORD dwFlags)
Definition: font.c:2490
BOOL WINAPI EudcLoadLinkW(LPCWSTR pBaseFaceName, LPCWSTR pEudcFontPath, INT iPriority, INT iFontLinkType)
Definition: font.c:2700
static LPSTR FONT_GetCharsByRangeA(HDC hdc, UINT firstChar, UINT lastChar, PINT pByteLen)
Definition: font.c:148
#define IFFCX_STYLE
Definition: font.c:211
int WINAPI RemoveFontResourceTracking(LPCSTR lpString, int unknown)
Definition: font.c:2648
static __inline INT GDI_ROUND(FLOAT val)
Definition: font.c:24
static LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP)
Definition: font.c:126
LONG WINAPI GdiGetCharDimensions(HDC hdc, LPTEXTMETRICW lptm, LONG *height)
Definition: font.c:2309
HFONT WINAPI CreateFontIndirectExA(const ENUMLOGFONTEXDVA *elfexd)
Definition: font.c:1675
BOOL APIENTRY GetCharABCWidthsFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, LPABCFLOAT lpABCF)
Definition: font.c:992
VOID FASTCALL FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA)
Definition: font.c:81
INT WINAPI AddFontResourceA(_In_ LPCSTR lpszFilename)
Definition: font.c:2175
BOOL WINAPI RemoveFontResourceExA(_In_ LPCSTR lpFileName, _In_ DWORD fl, _In_opt_ PVOID pdv)
Definition: font.c:2207
static INT INTERNAL_YDSTOWS(XFORM *xForm, INT height)
Definition: font.c:1393
DWORD WINAPI NewGetCharacterPlacementW(HDC hdc, LPCWSTR lpString, INT uCount, INT nMaxExtent, GCP_RESULTSW *lpResults, DWORD dwFlags)
Definition: font.c:643
int WINAPI EnumFontsA(HDC hDC, LPCSTR lpFaceName, FONTENUMPROCA FontFunc, LPARAM lParam)
Definition: font.c:2459
#define IEFF_EXTENDED
Definition: font.c:254
BOOL WINAPI RemoveFontMemResourceEx(HANDLE fh)
Definition: font.c:2617
#define INITIAL_FAMILY_COUNT
Definition: font.c:74
#define IFFCX_CHARSET
Definition: font.c:210
BOOL WINAPI GetCharWidthW(HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer)
Definition: font.c:737
INT WINAPI AddFontResourceW(_In_ LPCWSTR lpszFilename)
Definition: font.c:2183
#define EfdFontFamilies
Definition: font.c:2486
int WINAPI AddFontResourceTracking(LPCSTR lpString, int unknown)
Definition: font.c:2633
static INT height_to_LP(XFORM *xForm, INT height)
Definition: font.c:1409
ULONG WINAPI GetFontAssocStatus(HDC hdc)
Definition: font.c:2755
BOOL WINAPI RemoveFontResourceA(_In_ LPCSTR lpFileName)
Definition: font.c:2199
DWORD WINAPI GetEUDCTimeStampExW(LPWSTR lpBaseFaceName)
Definition: font.c:2734
VOID WINAPI UnloadNetworkFonts(DWORD unknown)
Definition: font.c:2784
BOOL WINAPI GetCharWidth32W(HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer)
Definition: font.c:762
DWORD WINAPI QueryFontAssocStatus(VOID)
Definition: font.c:2772
DWORD WINAPI cGetTTFFromFOT(DWORD x1, DWORD x2, DWORD x3, DWORD x4, DWORD x5, DWORD x6, DWORD x7)
Definition: font.c:2811
INT WINAPI GdiAddFontResourceW(LPCWSTR lpszFilename, FLONG fl, DESIGNVECTOR *pdv)
Definition: font.c:2566
int WINAPI EnumFontsW(HDC hDC, LPCWSTR lpFaceName, FONTENUMPROCW FontFunc, LPARAM lParam)
Definition: font.c:2440
INT WINAPI AddFontResourceExW(_In_ LPCWSTR lpszFilename, _In_ DWORD fl, _In_opt_ PVOID pvReserved)
Definition: font.c:2117
BOOL WINAPI bInitSystemAndFontsDirectoriesW(LPWSTR *SystemDir, LPWSTR *FontsDir)
Definition: font.c:2688
ULONG WINAPI GetEUDCTimeStamp(VOID)
Definition: font.c:2724
#define IEFF_UNICODE
Definition: font.c:253
BOOL WINAPI EudcUnloadLinkW(LPCWSTR pBaseFaceName, LPCWSTR pEudcFontPath)
Definition: font.c:2712
static int FASTCALL IntEnumFontFamilies(HDC Dc, const LOGFONTW *LogFont, PVOID EnumProc, LPARAM lParam, DWORD dwFlags)
Definition: font.c:290
DWORD APIENTRY NtGdiGetFontData(_In_ HDC hDC, _In_ DWORD Table, _In_ DWORD Offset, _Out_writes_bytes_(Size) PVOID Buffer, _In_ DWORD Size)
Definition: font.c:674
_In_ LPCSTR lpFileName
Definition: winbase.h:2824
_In_ FLONG fl
Definition: winddi.h:1279
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
_In_ ULONG_PTR _In_opt_ DESIGNVECTOR * pdv
Definition: winddi.h:3723
#define WINAPI
Definition: msvc.h:6
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define ERROR_FILE_EXISTS
Definition: winerror.h:287
#define FS_TURKISH
Definition: wingdi.h:564
#define GCP_GLYPHSHAPE
Definition: wingdi.h:833
#define GCP_DIACRITIC
Definition: wingdi.h:831
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
#define GCP_LIGATE
Definition: wingdi.h:837
#define RUSSIAN_CHARSET
Definition: wingdi.h:396
#define FS_JOHAB
Definition: wingdi.h:574
BOOL WINAPI GetCharABCWidthsA(_In_ HDC hdc, _In_ UINT wFirst, _In_ UINT wLast, _Out_writes_(wLast - wFirst+1) LPABC lpABC)
UINT WINAPI GetOutlineTextMetricsA(_In_ HDC hdc, _In_ UINT cjCopy, _Out_writes_bytes_opt_(cjCopy) LPOUTLINETEXTMETRICA potm)
BOOL WINAPI GetCharWidthI(_In_ HDC hdc, _In_ UINT giFirst, _In_ UINT cgi, _In_reads_opt_(cgi) LPWORD pgi, _Out_writes_(cgi) LPINT piWidths)
#define FS_THAI
Definition: wingdi.h:569
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define FS_ARABIC
Definition: wingdi.h:566
#define FS_WANSUNG
Definition: wingdi.h:572
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
DWORD WINAPI GetCharacterPlacementW(_In_ HDC hdc, _In_reads_(nCount) LPCWSTR lpString, _In_ int nCount, _In_ int nMexExtent, _Inout_ LPGCP_RESULTSW lpResults, _In_ DWORD dwFlags)
int WINAPI EnumFontFamiliesExW(_In_ HDC, _In_ PLOGFONTW, _In_ FONTENUMPROCW, _In_ LPARAM, _In_ DWORD)
struct _OUTLINETEXTMETRICA OUTLINETEXTMETRICA
#define LOGPIXELSY
Definition: wingdi.h:719
FARPROC FONTENUMPROCW
Definition: wingdi.h:3343
#define FS_LATIN2
Definition: wingdi.h:561
#define FS_VIETNAMESE
Definition: wingdi.h:568
#define ARABIC_CHARSET
Definition: wingdi.h:394
#define HANGEUL_CHARSET
Definition: wingdi.h:387
BOOL WINAPI GetTextExtentPointW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE lpsz)
int WINAPI EnumFontFamiliesExA(_In_ HDC, _In_ PLOGFONTA, _In_ FONTENUMPROCA, _In_ LPARAM, _In_ DWORD)
#define FS_GREEK
Definition: wingdi.h:563
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define THAI_CHARSET
Definition: wingdi.h:397
int WINAPI EnumFontFamiliesW(_In_ HDC, _In_opt_ LPCWSTR, _In_ FONTENUMPROCW, _In_ LPARAM)
int WINAPI GetTextCharset(_In_ HDC)
Definition: text.c:187
#define GREEK_CHARSET
Definition: wingdi.h:391
#define GCP_KASHIDA
Definition: wingdi.h:836
FARPROC FONTENUMPROCA
Definition: wingdi.h:3342
#define JOHAB_CHARSET
Definition: wingdi.h:401
#define TCI_SRCLOCALE
Definition: wingdi.h:964
#define FS_HEBREW
Definition: wingdi.h:565
#define FS_SYMBOL
Definition: wingdi.h:575
int WINAPI EnumFontFamiliesA(_In_ HDC, _In_opt_ LPCSTR, _In_ FONTENUMPROCA, _In_ LPARAM)
#define CHINESEBIG5_CHARSET
Definition: wingdi.h:390
#define GGO_GLYPH_INDEX
Definition: wingdi.h:855
#define ANSI_CHARSET
Definition: wingdi.h:383
BOOL WINAPI GetCharABCWidthsI(_In_ HDC hdc, _In_ UINT giFirst, _In_ UINT cgi, _In_reads_opt_(cgi) LPWORD pgi, _Out_writes_(cgi) LPABC pabc)
HFONT WINAPI CreateFontW(_In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_opt_ LPCWSTR)
#define FS_LATIN1
Definition: wingdi.h:560
#define GDI_ERROR
Definition: wingdi.h:1309
#define TCI_SRCCHARSET
Definition: wingdi.h:961
#define FS_JISJAPAN
Definition: wingdi.h:570
#define FS_CHINESETRAD
Definition: wingdi.h:573
#define FS_CHINESESIMP
Definition: wingdi.h:571
UINT WINAPI GetOutlineTextMetricsW(_In_ HDC hdc, _In_ UINT cjCopy, _Out_writes_bytes_opt_(cjCopy) LPOUTLINETEXTMETRICW potm)
DWORD WINAPI GdiGetCodePage(HDC)
#define FW_NORMAL
Definition: wingdi.h:373
#define LOGPIXELSX
Definition: wingdi.h:718
#define VIETNAMESE_CHARSET
Definition: wingdi.h:402
#define GCP_ERROR
Definition: wingdi.h:829
DWORD WINAPI GetGlyphIndicesA(_In_ HDC hdc, _In_reads_(c) LPCSTR lpstr, _In_ int c, _Out_writes_(c) LPWORD pgi, _In_ DWORD fl)
HFONT WINAPI CreateFontA(_In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_opt_ LPCSTR)
DWORD WINAPI GetKerningPairsW(_In_ HDC hdc, _In_ DWORD nPairs, _Out_writes_to_opt_(nPairs, return) LPKERNINGPAIR lpKernPair)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define GCP_REORDER
Definition: wingdi.h:843
BOOL WINAPI CreateScalableFontResourceA(_In_ DWORD, _In_ LPCSTR, _In_ LPCSTR, _In_opt_ LPCSTR)
DWORD WINAPI GetCharacterPlacementA(_In_ HDC hdc, _In_reads_(nCount) LPCSTR lpString, _In_ int nCount, _In_ int nMexExtent, _Inout_ LPGCP_RESULTSA lpResults, _In_ DWORD dwFlags)
INT WINAPI AddFontResourceExA(_In_ LPCSTR pszFilename, _In_ DWORD fl, _Reserved_ PVOID pvReserved)
#define HEBREW_CHARSET
Definition: wingdi.h:393
#define SHIFTJIS_CHARSET
Definition: wingdi.h:386
#define FS_BALTIC
Definition: wingdi.h:567
BOOL WINAPI TranslateCharsetInfo(_Inout_ PDWORD, _Out_ LPCHARSETINFO, _In_ DWORD)
DWORD WINAPI GetGlyphOutlineW(_In_ HDC hdc, _In_ UINT uChar, _In_ UINT fuFormat, _Out_ LPGLYPHMETRICS lpgm, _In_ DWORD cjBuffer, _Out_writes_bytes_opt_(cjBuffer) LPVOID pvBuffer, _In_ CONST MAT2 *lpmat2)
#define SYMBOL_CHARSET
Definition: wingdi.h:385
#define EASTEUROPE_CHARSET
Definition: wingdi.h:399
BOOL WINAPI GetCharWidthA(_In_ HDC hdc, _In_ UINT iFirst, _In_ UINT iLast, _Out_writes_(iLast+1 - iFirst) LPINT lpBuffer)
#define GB2312_CHARSET
Definition: wingdi.h:389
#define LF_FULLFACESIZE
Definition: wingdi.h:41
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
#define TCI_SRCFONTSIG
Definition: wingdi.h:963
#define FS_CYRILLIC
Definition: wingdi.h:562
DWORD WINAPI GetGlyphOutlineA(_In_ HDC hdc, _In_ UINT uChar, _In_ UINT fuFormat, _Out_ LPGLYPHMETRICS lpgm, _In_ DWORD cjBuffer, _Out_writes_bytes_opt_(cjBuffer) LPVOID pvBuffer, _In_ CONST MAT2 *lpmat2)
#define BALTIC_CHARSET
Definition: wingdi.h:395
BOOL WINAPI GetCharABCWidthsW(_In_ HDC hdc, _In_ UINT wFirst, _In_ UINT wLast, _Out_writes_(wLast - wFirst+1) LPABC lpABC)
#define TCI_SRCCODEPAGE
Definition: wingdi.h:962
#define TURKISH_CHARSET
Definition: wingdi.h:392
HANDLE WINAPI AddFontMemResourceEx(_In_reads_bytes_(cjSize) PVOID pvFileView, _In_ DWORD cjSize, _Reserved_ PVOID pvResrved, _In_ DWORD *pNumFonts)
#define CP_THREAD_ACP
Definition: winnls.h:251
#define CP_SYMBOL
Definition: winnls.h:252
#define LOCALE_FONTSIGNATURE
Definition: winnls.h:132
#define RTL_SOFT_ASSERT(exp)
Definition: rtlfuncs.h:3295
const char * LPCSTR
Definition: xmlstorage.h:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
char * LPSTR
Definition: xmlstorage.h:182
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193