ReactOS 0.4.16-dev-2332-g4cba65d
font.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS win32 kernel mode subsystem
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Font
5 * COPYRIGHT: Copyright (C) James Tabor <james.tabor@reactos.org>
6 * Copyright (C) Timo Kreuzer <timo.kreuzer@reactos.org>
7 * Copyright (C) Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
8 */
9
12#include <win32k.h>
13
14#define NDEBUG
15#include <debug.h>
16
17#define MAX_TEXT_BUFFER 0x2710000
18
21 _In_ const ENUMLOGFONTEXDVW *pelfw,
22 _In_ ULONG cjElfw,
23 _In_ LFTYPE lft,
25 _In_opt_ PVOID pvCliData);
26
31{
32 if (lplf)
33 {
34 ENUMLOGFONTEXDVW Logfont;
35
36 RtlCopyMemory( &Logfont.elfEnumLogfontEx.elfLogFont, lplf, sizeof(LOGFONTW));
38 sizeof(Logfont.elfEnumLogfontEx.elfFullName));
40 sizeof(Logfont.elfEnumLogfontEx.elfStyle));
42 sizeof(Logfont.elfEnumLogfontEx.elfScript));
43
44 Logfont.elfDesignVector.dvNumAxes = 0;
45
46 RtlZeroMemory( &Logfont.elfDesignVector, sizeof(DESIGNVECTOR));
47
48 return HfontCreate(&Logfont, 0, 0, 0, NULL);
49 }
50 else return NULL;
51}
52
56 _In_ HDC hDC,
57 _In_ ULONG NumPairs,
58 _Out_writes_(NumPairs) LPKERNINGPAIR krnpair)
59{
60 PDC dc;
61 PDC_ATTR pdcattr;
62 PTEXTOBJ TextObj;
63 PFONTGDI FontGDI;
65 KERNINGPAIR *pKP;
66
67 dc = DC_LockDc(hDC);
68 if (!dc)
69 {
71 return 0;
72 }
73
74 pdcattr = dc->pdcattr;
75 TextObj = RealizeFontInit(pdcattr->hlfntNew);
77
78 if (!TextObj)
79 {
81 return 0;
82 }
83
84 FontGDI = ObjToGDI(TextObj->Font, FONT);
85 TEXTOBJ_UnlockText(TextObj);
86
87 Count = ftGdiGetKerningPairs(FontGDI,0,NULL);
88
89 if ( Count && krnpair )
90 {
91 if (Count > NumPairs)
92 {
94 return 0;
95 }
97 if (!pKP)
98 {
100 return 0;
101 }
102 ftGdiGetKerningPairs(FontGDI,Count,pKP);
103
104 RtlCopyMemory(krnpair, pKP, Count * sizeof(KERNINGPAIR));
105
107 }
108 return Count;
109}
110
111/*
112 It is recommended that an application use the GetFontLanguageInfo function
113 to determine whether the GCP_DIACRITIC, GCP_DBCS, GCP_USEKERNING, GCP_LIGATE,
114 GCP_REORDER, GCP_GLYPHSHAPE, and GCP_KASHIDA values are valid for the
115 currently selected font. If not valid, GetCharacterPlacement ignores the
116 value.
117
118 MS must use a preset "compiled in" support for each language based releases.
119 ReactOS uses FreeType, this will need to be supported. ATM this is hard coded
120 for GCPCLASS_LATIN!
121 */
122#if 0
123DWORD
125GreGetCharacterPlacementW(
126 _In_ HDC hdc,
127 _In_reads_(nCount) PCWCH pwsz,
128 _In_ INT nCount,
129 _In_ INT nMaxExtent,
132{
133 GCP_RESULTSW gcpwSave;
134 UINT i, nSet, cSet;
135 INT *tmpDxCaretPos;
136 LONG Cx;
137 SIZE Size = {0,0};
138
139 DPRINT1("GreGCPW Start\n");
140
141 if (!pgcpw)
142 {
143 if (GreGetTextExtentW( hdc, pwsz, nCount, &Size, 1))
144 return MAKELONG(Size.cx, Size.cy);
145 return 0;
146 }
147
148 DPRINT1("GreGCPW 1\n");
149
150 RtlCopyMemory(&gcpwSave, pgcpw, sizeof(GCP_RESULTSW));
151
152 cSet = nSet = nCount;
153
154 if ( nCount > gcpwSave.nGlyphs ) cSet = gcpwSave.nGlyphs;
155
156 /* GCP_JUSTIFY may only be used in conjunction with GCP_MAXEXTENT. */
158
159 if ( !gcpwSave.lpDx && gcpwSave.lpCaretPos )
160 tmpDxCaretPos = gcpwSave.lpCaretPos;
161 else
162 tmpDxCaretPos = gcpwSave.lpDx;
163
165 pwsz,
166 cSet,
167 nMaxExtent,
168 ((dwFlags & GCP_MAXEXTENT) ? (PULONG) &cSet : NULL),
169 (PULONG) tmpDxCaretPos,
170 &Size,
171 0) )
172 {
173 return 0;
174 }
175
176 DPRINT1("GreGCPW 2\n");
177
178 nSet = cSet;
179
180 if ( tmpDxCaretPos && nSet > 0)
181 {
182 for (i = (nSet - 1); i > 0; i--)
183 {
184 tmpDxCaretPos[i] -= tmpDxCaretPos[i - 1];
185 }
186 }
187
188 if ( !(dwFlags & GCP_MAXEXTENT) || nSet )
189 {
190 if ( (dwFlags & GCP_USEKERNING) &&
191 ( gcpwSave.lpDx ||
192 gcpwSave.lpCaretPos ) &&
193 nSet >= 2 )
194 {
195 DWORD Count;
196 LPKERNINGPAIR pKP;
197
199 if (Count)
200 {
202 if (pKP)
203 {
204 if ( GreGetKerningPairs( hdc, Count, pKP) != Count)
205 {
207 return 0;
208 }
209
210 if ( (ULONG_PTR)(pKP) < ((ULONG_PTR)(pKP) + (ULONG_PTR)(Count * sizeof(KERNINGPAIR))) )
211 {
212 DPRINT1("We Need to Do Something HERE!\n");
213 }
214
216
217 if ( dwFlags & GCP_MAXEXTENT )
218 {
219 if ( Size.cx > nMaxExtent )
220 {
221 for (Cx = Size.cx; nSet > 0; nSet--)
222 {
223 Cx -= tmpDxCaretPos[nSet - 1];
224 Size.cx = Cx;
225 if ( Cx <= nMaxExtent ) break;
226 }
227 }
228 if ( !nSet )
229 {
230 pgcpw->nGlyphs = 0;
231 pgcpw->nMaxFit = 0;
232 return 0;
233 }
234 }
235 }
236 }
237 }
238
239 if ( (dwFlags & GCP_JUSTIFY) &&
240 ( gcpwSave.lpDx ||
241 gcpwSave.lpCaretPos ) &&
242 nSet )
243 {
244 DPRINT1("We Need to Do Something HERE 2!\n");
245 }
246
247 if ( gcpwSave.lpDx && gcpwSave.lpCaretPos )
248 RtlCopyMemory( gcpwSave.lpCaretPos, gcpwSave.lpDx, nSet * sizeof(LONG));
249
250 if ( gcpwSave.lpCaretPos )
251 {
252 int pos = 0;
253 i = 0;
254 if ( nSet > 0 )
255 {
256 do
257 {
258 Cx = gcpwSave.lpCaretPos[i];
259 gcpwSave.lpCaretPos[i] = pos;
260 pos += Cx;
261 ++i;
262 }
263 while ( i < nSet );
264 }
265 }
266
267 if ( gcpwSave.lpOutString )
268 RtlCopyMemory(gcpwSave.lpOutString, pwsz, nSet * sizeof(WCHAR));
269
270 if ( gcpwSave.lpClass )
271 RtlFillMemory(gcpwSave.lpClass, nSet, GCPCLASS_LATIN);
272
273 if ( gcpwSave.lpOrder )
274 {
275 for (i = 0; i < nSet; i++)
276 gcpwSave.lpOrder[i] = i;
277 }
278
279 if ( gcpwSave.lpGlyphs )
280 {
281 if ( GreGetGlyphIndicesW( hdc, pwsz, nSet, gcpwSave.lpGlyphs, 0, 0) == GDI_ERROR )
282 {
283 nSet = 0;
284 Size.cx = 0;
285 Size.cy = 0;
286 }
287 }
288 pgcpw->nGlyphs = nSet;
289 pgcpw->nMaxFit = nSet;
290 }
291 DPRINT1("GreGCPW Exit\n");
292 return MAKELONG(Size.cx, Size.cy);
293}
294#endif
295
296ULONG
299 _Inout_ PTEXTOBJ plfont,
301 _Out_ PVOID pvBuffer)
302{
303 ULONG cjMaxSize;
304 ENUMLOGFONTEXDVW *plf;
305
306 ASSERT(plfont);
307 plf = &plfont->logfont;
308
309 if (!(plfont->fl & TEXTOBJECT_INIT))
310 {
312 DPRINT("FontGetObject font not initialized!\n");
313
314 Status = TextIntRealizeFont(plfont->BaseObject.hHmgr, plfont);
315 if (!NT_SUCCESS(Status))
316 {
317 DPRINT1("FontGetObject(TextIntRealizeFont) Status = 0x%lx\n", Status);
318 }
319 }
320
321 /* If buffer is NULL, only the size is requested */
322 if (pvBuffer == NULL) return sizeof(LOGFONTW);
323
324 /* Calculate the maximum size according to number of axes */
325 cjMaxSize = FIELD_OFFSET(ENUMLOGFONTEXDVW,
326 elfDesignVector.dvValues[plf->elfDesignVector.dvNumAxes]);
327
328 if (cjBuffer > cjMaxSize) cjBuffer = cjMaxSize;
329
330 RtlCopyMemory(pvBuffer, plf, cjBuffer);
331
332 return cjBuffer;
333}
334
335DWORD
338 _In_ HDC hdc,
341{
342 PDC pdc;
343 PDC_ATTR pdcattr;
344 PTEXTOBJ TextObj;
345 SIZE sz;
346 TMW_INTERNAL tmwi;
347 BOOL Good;
348
349 static const WCHAR alphabet[] = {
350 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
351 'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H',
352 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0};
353
354 if(!ftGdiGetTextMetricsW(hdc, &tmwi)) return 0;
355
356 pdc = DC_LockDc(hdc);
357
358 if (!pdc) return 0;
359
360 pdcattr = pdc->pdcattr;
361
362 TextObj = RealizeFontInit(pdcattr->hlfntNew);
363 if ( !TextObj )
364 {
365 DC_UnlockDc(pdc);
366 return 0;
367 }
368 Good = TextIntGetTextExtentPoint(pdc, TextObj, alphabet, 52, 0, NULL, NULL, &sz, 0);
369 TEXTOBJ_UnlockText(TextObj);
370 DC_UnlockDc(pdc);
371
372 if (!Good) return 0;
373 if (ptm) *ptm = tmwi.TextMetric;
374 if (height) *height = tmwi.TextMetric.tmHeight;
375
376 return (sz.cx / 26 + 1) / 2;
377}
378
379
380DWORD
383{
384 PDC_ATTR pdcattr;
385 FONTSIGNATURE fontsig;
386 static const DWORD GCP_DBCS_MASK=0x003F0000,
387 GCP_DIACRITIC_MASK=0x00000000,
388 FLI_GLYPHS_MASK=0x00000000,
389 GCP_GLYPHSHAPE_MASK=0x00000040,
390 GCP_KASHIDA_MASK=0x00000000,
391 GCP_LIGATE_MASK=0x00000000,
392 GCP_USEKERNING_MASK=0x00000000,
393 GCP_REORDER_MASK=0x00000060;
394
395 DWORD result=0;
396
397 ftGdiGetTextCharsetInfo( Dc, &fontsig, 0 );
398
399 /* We detect each flag we return using a bitmask on the Codepage Bitfields */
400 if( (fontsig.fsCsb[0]&GCP_DBCS_MASK)!=0 )
402
403 if( (fontsig.fsCsb[0]&GCP_DIACRITIC_MASK)!=0 )
405
406 if( (fontsig.fsCsb[0]&FLI_GLYPHS_MASK)!=0 )
408
409 if( (fontsig.fsCsb[0]&GCP_GLYPHSHAPE_MASK)!=0 )
411
412 if( (fontsig.fsCsb[0]&GCP_KASHIDA_MASK)!=0 )
414
415 if( (fontsig.fsCsb[0]&GCP_LIGATE_MASK)!=0 )
417
418 if( (fontsig.fsCsb[0]&GCP_USEKERNING_MASK)!=0 )
420
421 pdcattr = Dc->pdcattr;
422
423 /* This might need a test for a HEBREW- or ARABIC_CHARSET as well */
424 if ( pdcattr->flTextAlign & TA_RTLREADING )
425 if( (fontsig.fsCsb[0]&GCP_REORDER_MASK)!=0 )
427
428 return result;
429}
430
434{
436 PTEXTOBJ pTextObj;
437
438 pTextObj = TEXTOBJ_LockText(hFont);
439
440 if ( pTextObj && !(pTextObj->fl & TEXTOBJECT_INIT))
441 {
442 Status = TextIntRealizeFont(hFont, pTextObj);
443 if (!NT_SUCCESS(Status))
444 {
445 TEXTOBJ_UnlockText(pTextObj);
446 return NULL;
447 }
448 }
449 return pTextObj;
450}
451
452static BOOL
454 _In_reads_(cwc) PCWCH pwcFiles,
455 _In_ ULONG cFiles,
456 _In_ ULONG cwc)
457{
458 ULONG ich, cRealFiles;
459
460 if (pwcFiles[cwc - 1] != UNICODE_NULL)
461 return FALSE;
462
463 for (ich = cRealFiles = 0; ich < cwc; ++ich)
464 {
465 if (!pwcFiles[ich])
466 ++cRealFiles;
467 }
468
469 return cRealFiles >= cFiles;
470}
471
474INT
477 _In_reads_(cwc) PCWCH pwcFiles,
478 _In_ ULONG cwc,
479 _In_ ULONG cFiles,
480 _In_ FLONG fl,
481 _In_ DWORD dwPidTid,
483{
484 UNICODE_STRING SafeFileName;
485 INT Ret;
486
489
490 DPRINT("NtGdiAddFontResourceW\n");
491
492 /* cwc = Length + trailing zero. */
493 if ((cwc <= 1) || (cwc > UNICODE_STRING_MAX_CHARS))
494 return 0;
495
496 SafeFileName.Length = (USHORT)((cwc - 1) * sizeof(WCHAR));
497 SafeFileName.MaximumLength = SafeFileName.Length + sizeof(UNICODE_NULL);
499 SafeFileName.MaximumLength,
500 TAG_STRING);
501 if (!SafeFileName.Buffer)
502 return 0;
503
505 {
506 ProbeForRead(pwcFiles, cwc * sizeof(WCHAR), sizeof(WCHAR));
507
508 if (!IntCheckFontPathNames(pwcFiles, cFiles, cwc))
509 return 0;
510
511 RtlCopyMemory(SafeFileName.Buffer, pwcFiles, SafeFileName.Length);
512 }
514 {
515 ExFreePoolWithTag(SafeFileName.Buffer, TAG_STRING);
516 _SEH2_YIELD(return 0);
517 }
518 _SEH2_END;
519
520 SafeFileName.Buffer[SafeFileName.Length / sizeof(WCHAR)] = UNICODE_NULL;
521
522 Ret = IntGdiAddFontResourceEx(&SafeFileName, cFiles, fl, 0);
523
524 ExFreePoolWithTag(SafeFileName.Buffer, TAG_STRING);
525 return Ret;
526}
527
528BOOL
531 _In_reads_(cwc) PCWCH pwszFiles,
532 _In_ ULONG cwc,
533 _In_ ULONG cFiles,
534 _In_ ULONG fl,
535 _In_ DWORD dwPidTid,
537{
538 UNICODE_STRING SafeFileName;
539 BOOL Ret;
540
543
544 DPRINT("NtGdiRemoveFontResourceW\n");
545
546 /* cwc = Length + trailing zero. */
547 if ((cwc <= 1) || (cwc > UNICODE_STRING_MAX_CHARS))
548 return FALSE;
549
550 SafeFileName.Length = (USHORT)((cwc - 1) * sizeof(WCHAR));
551 SafeFileName.MaximumLength = SafeFileName.Length + sizeof(UNICODE_NULL);
553 SafeFileName.MaximumLength,
554 TAG_STRING);
555 if (!SafeFileName.Buffer)
556 return FALSE;
557
559 {
560 ProbeForRead(pwszFiles, cwc * sizeof(WCHAR), sizeof(WCHAR));
561
562 if (!IntCheckFontPathNames(pwszFiles, cFiles, cwc))
563 return FALSE;
564
565 RtlCopyMemory(SafeFileName.Buffer, pwszFiles, SafeFileName.Length);
566 }
568 {
569 ExFreePoolWithTag(SafeFileName.Buffer, TAG_STRING);
570 _SEH2_YIELD(return FALSE);
571 }
572 _SEH2_END;
573
574 SafeFileName.Buffer[SafeFileName.Length / sizeof(WCHAR)] = UNICODE_NULL;
575
576 Ret = IntGdiRemoveFontResource(&SafeFileName, cFiles, fl);
577
578 ExFreePoolWithTag(SafeFileName.Buffer, TAG_STRING);
579 return Ret;
580}
581
582HANDLE
585 _In_reads_bytes_(cjBuffer) const VOID *pvBuffer,
588 _In_ ULONG cjDV,
589 _Out_ PDWORD pNumFonts)
590{
592 HANDLE Ret;
593 DWORD NumFonts = 0;
594
595 DPRINT("NtGdiAddFontMemResourceEx\n");
598
599 if (!pvBuffer || !cjBuffer)
600 return NULL;
601
603 {
604 ProbeForRead(pvBuffer, cjBuffer, sizeof(BYTE));
606 RtlCopyMemory(Buffer, pvBuffer, cjBuffer);
607 }
609 {
610 if (Buffer != NULL)
611 {
613 }
614 _SEH2_YIELD(return NULL);
615 }
616 _SEH2_END;
617
618 Ret = IntGdiAddFontMemResource(Buffer, cjBuffer, &NumFonts);
620
622 {
623 ProbeForWrite(pNumFonts, sizeof(NumFonts), 1);
624 *pNumFonts = NumFonts;
625 }
627 {
628 /* Leak it? */
629 _SEH2_YIELD(return NULL);
630 }
631 _SEH2_END;
632
633
634 return Ret;
635}
636
637
638BOOL
641 _In_ HANDLE hMMFont)
642{
643 return IntGdiRemoveFontMemResource(hMMFont);
644}
645
646
647 /*
648 * @unimplemented
649 */
650DWORD
653 _In_ HDC hdc,
654 _In_reads_(nCount) PCWCH pwsz,
655 _In_ INT nCount,
656 _In_ INT nMaxExtent,
659{
661 return 0;
662#if 0
663 return GreGetCharacterPlacementW( hdc,
664 pwsz,
665 nCount,
666 nMaxExtent,
667 pgcpw,
668 dwFlags);
669#endif
670}
671
672DWORD
675 _In_ HDC hDC,
680{
681 PDC Dc;
682 PDC_ATTR pdcattr;
683 HFONT hFont;
684 PTEXTOBJ TextObj;
685 PFONTGDI FontGdi;
688
689 if (Buffer && Size)
690 {
692 {
694 }
696 {
698 }
700 }
701
702 if (!NT_SUCCESS(Status)) return Result;
703
704 Dc = DC_LockDc(hDC);
705 if (Dc == NULL)
706 {
708 return GDI_ERROR;
709 }
710 pdcattr = Dc->pdcattr;
711
712 hFont = pdcattr->hlfntNew;
713 TextObj = RealizeFontInit(hFont);
714 DC_UnlockDc(Dc);
715
716 if (TextObj == NULL)
717 {
719 return GDI_ERROR;
720 }
721
722 FontGdi = ObjToGDI(TextObj->Font, FONT);
723
725
726 TEXTOBJ_UnlockText(TextObj);
727
728 return Result;
729}
730
731/* @implemented */
732DWORD
735 _In_ HDC hdc,
736 _Out_opt_ LPGLYPHSET pgs)
737{
738 PDC pDc;
739 PDC_ATTR pdcattr;
740 HFONT hFont;
741 PTEXTOBJ TextObj;
742 PFONTGDI FontGdi;
743 DWORD Size = 0;
744 PGLYPHSET pgsSafe;
746
747 pDc = DC_LockDc(hdc);
748 if (!pDc)
749 {
751 return 0;
752 }
753
754 pdcattr = pDc->pdcattr;
755
756 hFont = pdcattr->hlfntNew;
757 TextObj = RealizeFontInit(hFont);
758
759 if ( TextObj == NULL)
760 {
762 goto Exit;
763 }
764 FontGdi = ObjToGDI(TextObj->Font, FONT);
765
766 Size = ftGetFontUnicodeRanges( FontGdi, NULL);
767
768 if (Size && pgs)
769 {
771 if (!pgsSafe)
772 {
774 Size = 0;
775 goto Exit;
776 }
777
778 Size = ftGetFontUnicodeRanges( FontGdi, pgsSafe);
779
780 if (Size)
781 {
783 {
784 ProbeForWrite(pgs, Size, 1);
785 RtlCopyMemory(pgs, pgsSafe, Size);
786 }
788 {
790 }
792
793 if (!NT_SUCCESS(Status)) Size = 0;
794 }
796 }
797Exit:
798 TEXTOBJ_UnlockText(TextObj);
799 DC_UnlockDc(pDc);
800 return Size;
801}
802
803ULONG
806 _In_ HDC hdc,
807 _In_ WCHAR wch,
812 _In_opt_ const MAT2 *pmat2,
813 _In_ BOOL bIgnoreRotation)
814{
815 ULONG Ret = GDI_ERROR;
816 PDC dc;
817 PVOID pvBuf = NULL;
818 GLYPHMETRICS gm;
820
821 dc = DC_LockDc(hdc);
822 if (!dc)
823 {
825 return GDI_ERROR;
826 }
827
828 if (UnsafeBuf && cjBuf)
829 {
831 if (!pvBuf)
832 {
834 goto Exit;
835 }
836 }
837
839 wch,
840 iFormat,
841 pgm ? &gm : NULL,
842 cjBuf,
843 pvBuf,
844 pmat2,
845 bIgnoreRotation);
846
847 if (pvBuf)
848 {
850 {
851 ProbeForWrite(UnsafeBuf, cjBuf, 1);
852 RtlCopyMemory(UnsafeBuf, pvBuf, cjBuf);
853 }
855 {
857 }
859
861 }
862
863 if (pgm)
864 {
866 {
867 ProbeForWrite(pgm, sizeof(GLYPHMETRICS), 1);
868 RtlCopyMemory(pgm, &gm, sizeof(GLYPHMETRICS));
869 }
871 {
873 }
875 }
876
877 if (! NT_SUCCESS(Status))
878 {
880 Ret = GDI_ERROR;
881 }
882
883Exit:
885 return Ret;
886}
887
888DWORD
891 _In_ HDC hDC,
892 _In_ ULONG NumPairs,
893 _Out_writes_(NumPairs) LPKERNINGPAIR krnpair)
894{
895 PDC dc;
896 PDC_ATTR pdcattr;
897 PTEXTOBJ TextObj;
898 PFONTGDI FontGDI;
899 DWORD Count;
900 KERNINGPAIR *pKP;
902
903 dc = DC_LockDc(hDC);
904 if (!dc)
905 {
907 return 0;
908 }
909
910 pdcattr = dc->pdcattr;
911 TextObj = RealizeFontInit(pdcattr->hlfntNew);
913
914 if (!TextObj)
915 {
917 return 0;
918 }
919
920 FontGDI = ObjToGDI(TextObj->Font, FONT);
921 TEXTOBJ_UnlockText(TextObj);
922
923 Count = ftGdiGetKerningPairs(FontGDI,0,NULL);
924
925 if ( Count && krnpair )
926 {
927 if (Count > NumPairs)
928 {
930 return 0;
931 }
933 if (!pKP)
934 {
936 return 0;
937 }
938 ftGdiGetKerningPairs(FontGDI,Count,pKP);
940 {
941 ProbeForWrite(krnpair, Count * sizeof(KERNINGPAIR), 1);
942 RtlCopyMemory(krnpair, pKP, Count * sizeof(KERNINGPAIR));
943 }
945 {
947 }
949 if (!NT_SUCCESS(Status))
950 {
952 Count = 0;
953 }
955 }
956 return Count;
957}
958
959/*
960 From "Undocumented Windows 2000 Secrets" Appendix B, Table B-2, page
961 472, this is NtGdiGetOutlineTextMetricsInternalW.
962 */
963ULONG
966 _In_ HDC hDC,
969 _In_ PTMDIFF Tmd)
970{
971 PDC dc;
972 PDC_ATTR pdcattr;
973 PTEXTOBJ TextObj;
974 PFONTGDI FontGDI;
975 HFONT hFont = 0;
976 ULONG Size;
977 OUTLINETEXTMETRICW *potm;
979
980 dc = DC_LockDc(hDC);
981 if (!dc)
982 {
984 return 0;
985 }
986 pdcattr = dc->pdcattr;
987 hFont = pdcattr->hlfntNew;
988 TextObj = RealizeFontInit(hFont);
990 if (!TextObj)
991 {
993 return 0;
994 }
995 FontGDI = ObjToGDI(TextObj->Font, FONT);
996 if (!(FontGDI->flType & FO_TYPE_TRUETYPE))
997 {
998 TEXTOBJ_UnlockText(TextObj);
999 return 0;
1000 }
1001 TextIntUpdateSize(dc, TextObj, FontGDI, TRUE);
1002 TEXTOBJ_UnlockText(TextObj);
1003 Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL, FALSE);
1004 if (!otm) return Size;
1005 if (Size > Data)
1006 {
1008 return 0;
1009 }
1011 if (!potm)
1012 {
1014 return 0;
1015 }
1016 RtlZeroMemory(potm, Size);
1017 IntGetOutlineTextMetrics(FontGDI, Size, potm, FALSE);
1018
1019 _SEH2_TRY
1020 {
1021 ProbeForWrite(otm, Size, 1);
1022 RtlCopyMemory(otm, potm, Size);
1023 }
1025 {
1027 }
1028 _SEH2_END
1029
1030 if (!NT_SUCCESS(Status))
1031 {
1033 Size = 0;
1034 }
1035
1037 return Size;
1038}
1039
1040W32KAPI
1041BOOL
1044 _In_reads_(cwc) PCWCH pwszFiles,
1045 _In_ ULONG cwc,
1046 _In_ ULONG cFiles,
1047 _In_ UINT cjIn,
1050 _In_ DWORD dwType)
1051{
1053 DWORD dwBytes, dwBytesRequested;
1054 UNICODE_STRING SafeFileNames;
1055 BOOL bRet = FALSE;
1056 ULONG cbStringSize;
1057 LPVOID Buffer;
1058
1059 /* FIXME: Handle cFiles > 0 */
1060
1061 /* Check for valid dwType values */
1062 if (dwType > 5)
1063 {
1065 return FALSE;
1066 }
1067
1068 /* Allocate a safe unicode string buffer */
1069 cbStringSize = cwc * sizeof(WCHAR);
1070 SafeFileNames.MaximumLength = SafeFileNames.Length = (USHORT)cbStringSize - sizeof(WCHAR);
1071 SafeFileNames.Buffer = ExAllocatePoolWithTag(PagedPool,
1072 cbStringSize,
1073 TAG_USTR);
1074 if (!SafeFileNames.Buffer)
1075 {
1077 return FALSE;
1078 }
1079 RtlZeroMemory(SafeFileNames.Buffer, SafeFileNames.MaximumLength);
1080
1081 /* Check buffers and copy pwszFiles to safe unicode string */
1082 _SEH2_TRY
1083 {
1084 ProbeForRead(pwszFiles, cbStringSize, 1);
1085 ProbeForWrite(pdwBytes, sizeof(DWORD), 1);
1086 if (pvBuf)
1087 ProbeForWrite(pvBuf, cjIn, 1);
1088
1089 dwBytes = *pdwBytes;
1090 dwBytesRequested = dwBytes;
1091
1092 RtlCopyMemory(SafeFileNames.Buffer, pwszFiles, cbStringSize);
1093 if (dwBytes > 0)
1094 {
1096 }
1097 else
1098 {
1100 }
1101 }
1103 {
1105 }
1106 _SEH2_END
1107
1108 if(!NT_SUCCESS(Status))
1109 {
1111 /* Free the string buffer for the safe filename */
1112 ExFreePoolWithTag(SafeFileNames.Buffer, TAG_USTR);
1113 return FALSE;
1114 }
1115
1116 /* Do the actual call */
1117 bRet = IntGdiGetFontResourceInfo(&SafeFileNames,
1118 (pvBuf ? Buffer : NULL),
1119 &dwBytes, dwType);
1120
1121 /* Check if succeeded */
1122 if (bRet)
1123 {
1124 /* Copy the data back to caller */
1125 _SEH2_TRY
1126 {
1127 /* Buffers are already probed */
1128 if (pvBuf && dwBytesRequested > 0)
1129 RtlCopyMemory(pvBuf, Buffer, min(dwBytesRequested, dwBytes));
1130 *pdwBytes = dwBytes;
1131 }
1133 {
1135 }
1136 _SEH2_END
1137
1138 if(!NT_SUCCESS(Status))
1139 {
1141 bRet = FALSE;
1142 }
1143 }
1144
1146 /* Free the string for the safe filenames */
1147 ExFreePoolWithTag(SafeFileNames.Buffer, TAG_USTR);
1148
1149 return bRet;
1150}
1151
1152/* @unimplemented */
1153BOOL
1156 _In_ HDC hdc,
1158 _In_ HFONT hf)
1159{
1160 PDC pDc;
1161 PTEXTOBJ pTextObj;
1162 PFONTGDI pFontGdi;
1163 PDC_ATTR pdcattr;
1164 BOOL Ret = FALSE;
1165 INT i = 0;
1167
1168 pDc = DC_LockDc(hdc);
1169 if (!pDc)
1170 {
1172 return 0;
1173 }
1174 pdcattr = pDc->pdcattr;
1175 pTextObj = RealizeFontInit(pdcattr->hlfntNew);
1176 ASSERT(pTextObj != NULL);
1177 pFontGdi = ObjToGDI(pTextObj->Font, FONT);
1178 TEXTOBJ_UnlockText(pTextObj);
1179 DC_UnlockDc(pDc);
1180
1181 Ret = ftGdiRealizationInfo(pFontGdi, &ri);
1182 if (Ret)
1183 {
1184 if (pri)
1185 {
1187 _SEH2_TRY
1188 {
1189 ProbeForWrite(pri, sizeof(REALIZATION_INFO), 1);
1190 RtlCopyMemory(pri, &ri, sizeof(REALIZATION_INFO));
1191 }
1193 {
1195 }
1196 _SEH2_END
1197
1198 if(!NT_SUCCESS(Status))
1199 {
1201 return FALSE;
1202 }
1203 }
1204 do
1205 {
1206 if (GdiHandleTable->cfPublic[i].hf == hf)
1207 {
1208 GdiHandleTable->cfPublic[i].iTechnology = ri.iTechnology;
1209 GdiHandleTable->cfPublic[i].iUniq = ri.iUniq;
1210 GdiHandleTable->cfPublic[i].dwUnknown = ri.dwUnknown;
1211 GdiHandleTable->cfPublic[i].dwCFCount = GdiHandleTable->dwCFCount;
1212 GdiHandleTable->cfPublic[i].fl |= CFONT_REALIZATION;
1213 }
1214 i++;
1215 }
1216 while ( i < GDI_CFONT_MAX );
1217 }
1218 return Ret;
1219}
1220
1221HFONT
1224 const ENUMLOGFONTEXDVW *pelfw,
1225 _In_ ULONG cjElfw,
1226 _In_ LFTYPE lft,
1227 _In_ FLONG fl,
1228 _In_opt_ PVOID pvCliData)
1229{
1230 HFONT hNewFont;
1231 PLFONT plfont;
1232
1233 if (!pelfw)
1234 {
1235 return NULL;
1236 }
1237
1238 plfont = LFONT_AllocFontWithHandle();
1239 if (!plfont)
1240 {
1241 return NULL;
1242 }
1243 hNewFont = plfont->BaseObject.hHmgr;
1244
1245 plfont->lft = lft;
1246 plfont->fl = fl;
1247 RtlCopyMemory (&plfont->logfont, pelfw, sizeof(ENUMLOGFONTEXDVW));
1248 ExInitializePushLock(&plfont->lock);
1249
1252 {
1253 /* This should really depend on whether GM_ADVANCED is set */
1256 }
1257 LFONT_UnlockFont(plfont);
1258
1259 if (pvCliData && hNewFont)
1260 {
1261 // FIXME: Use GDIOBJ_InsertUserData
1263 {
1266 Entry->UserData = pvCliData;
1267 }
1269 }
1270
1271 return hNewFont;
1272}
1273
1274
1275HFONT
1278 _In_reads_bytes_(cjElfw) const ENUMLOGFONTEXDVW *pelfw,
1279 _In_ ULONG cjElfw,
1280 _In_ LFTYPE lft,
1281 _In_ FLONG fl,
1282 _In_opt_ PVOID pvCliData)
1283{
1284 ENUMLOGFONTEXDVW SafeLogfont;
1286
1287 /* Silence GCC warnings */
1290
1291 if (!pelfw)
1292 {
1293 return NULL;
1294 }
1295
1296 _SEH2_TRY
1297 {
1298 ProbeForRead(pelfw, sizeof(ENUMLOGFONTEXDVW), 1);
1299 RtlCopyMemory(&SafeLogfont, pelfw, sizeof(ENUMLOGFONTEXDVW));
1300 }
1302 {
1304 }
1305 _SEH2_END
1306
1307 if (!NT_SUCCESS(Status))
1308 {
1309 return NULL;
1310 }
1311
1312 return HfontCreate(&SafeLogfont, cjElfw, lft, fl, pvCliData);
1313}
1314
1315
1316/* This function is called from GetCharWidthA/W/I, GetCharWidth32A/W, and GetCharWidthFloatA/W. */
1317BOOL NTAPI
1319 _In_ HDC hDC,
1320 _In_ UINT FirstChar,
1321 _In_ UINT Count,
1322 _In_reads_opt_(Count) PCWCH UnSafepwc,
1323 _In_ FLONG fl,
1325{
1326 BOOL ret = FALSE;
1327 PVOID pTmpBuffer = NULL;
1328 PWCHAR pSafePwc = NULL;
1330 WCHAR StackPwc[40];
1331 INT StackBuffer[40];
1332
1333 if (!Count || Count > MAX_TEXT_BUFFER / sizeof(INT))
1334 return FALSE;
1335
1336 if (UnSafepwc)
1337 {
1338 if (Count <= _countof(StackPwc))
1339 pSafePwc = StackPwc;
1340 else
1341 pSafePwc = ExAllocatePoolWithTag(PagedPool, Count * sizeof(WCHAR), GDITAG_TEXT);
1342
1343 if (!pSafePwc)
1344 return FALSE;
1345
1346 Status = MmCopyFromCaller(pSafePwc, UnSafepwc, Count * sizeof(WCHAR));
1347 if (!NT_SUCCESS(Status))
1348 goto Cleanup;
1349 }
1350
1351 if (Count <= _countof(StackBuffer))
1352 pTmpBuffer = StackBuffer;
1353 else
1354 pTmpBuffer = ExAllocatePoolWithTag(PagedPool, Count * sizeof(INT), GDITAG_TEXT);
1355
1356 if (!pTmpBuffer)
1357 goto Cleanup;
1358
1359 ret = GreGetCharWidthW(hDC, FirstChar, Count, pSafePwc, fl, pTmpBuffer);
1360 if (ret)
1361 {
1362 Status = MmCopyToCaller(Buffer, pTmpBuffer, Count * sizeof(INT));
1364 }
1365
1366Cleanup:
1367 if (pTmpBuffer && pTmpBuffer != StackBuffer)
1368 ExFreePoolWithTag(pTmpBuffer, GDITAG_TEXT);
1369 if (pSafePwc && pSafePwc != StackPwc)
1370 ExFreePoolWithTag(pSafePwc, GDITAG_TEXT);
1371 return ret;
1372}
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)
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
HFONT hFont
Definition: main.c:53
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
Definition: bufpool.h:45
HDC dc
Definition: cylfrac.c:34
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#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 TAG_USTR
Definition: libsupp.c:997
#define APIENTRY
Definition: api.h:79
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
static const WCHAR Cleanup[]
Definition: register.c:80
return ret
Definition: mutex.c:146
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:184
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
#define ExInitializePushLock
Definition: ex.h:1016
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL FASTCALL TextIntUpdateSize(PDC dc, PTEXTOBJ TextObj, PFONTGDI FontGDI, BOOL bDoLock)
Definition: freetype.c:4219
BOOL FASTCALL TextIntGetTextExtentPoint(_In_ PDC dc, _In_ PTEXTOBJ TextObj, _In_reads_(Count) PCWCH String, _In_ INT Count, _In_ ULONG MaxExtent, _Out_ PINT Fit, _Out_writes_to_opt_(Count, *Fit) PINT Dx, _Out_ PSIZE Size, _In_ FLONG fl)
Definition: freetype.c:4956
DWORD FASTCALL ftGdiGetKerningPairs(PFONTGDI Font, DWORD cPairs, LPKERNINGPAIR pKerningPair)
Definition: freetype.c:6464
BOOL FASTCALL ftGdiGetTextMetricsW(HDC hDC, PTMW_INTERNAL ptmwi)
Definition: freetype.c:5265
BOOL FASTCALL IntGdiRemoveFontResource(_In_ PCUNICODE_STRING FileName, _In_ DWORD cFiles, _In_ DWORD dwFlags)
Definition: freetype.c:2340
BOOL FASTCALL IntGdiGetFontResourceInfo(PUNICODE_STRING FileName, PVOID pBuffer, DWORD *pdwBytes, DWORD dwType)
Definition: freetype.c:6177
DWORD FASTCALL ftGetFontUnicodeRanges(PFONTGDI Font, PGLYPHSET glyphset)
Definition: freetype.c:5191
INT FASTCALL IntGdiAddFontResourceEx(_In_ PCUNICODE_STRING FileName, _In_ DWORD cFiles, _In_ DWORD Characteristics, _In_ DWORD dwFlags)
Definition: freetype.c:2193
BOOL FASTCALL ftGdiRealizationInfo(PFONTGDI Font, PREALIZATION_INFO Info)
Definition: freetype.c:6445
BOOL APIENTRY GreGetCharWidthW(_In_ HDC hDC, _In_ UINT FirstChar, _In_ UINT Count, _In_reads_opt_(Count) PCWCH Safepwc, _In_ FLONG fl, _Out_writes_bytes_(Count *sizeof(INT)) PVOID Buffer)
Definition: freetype.c:7659
ULONG FASTCALL ftGdiGetGlyphOutline(PDC dc, WCHAR wch, UINT iFormat, LPGLYPHMETRICS pgm, ULONG cjBuf, PVOID pvBuf, const MAT2 *pmat2, BOOL bIgnoreRotation)
Definition: freetype.c:4428
BOOL FASTCALL IntGdiRemoveFontMemResource(HANDLE hMMFont)
Definition: freetype.c:2614
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
Definition: freetype.c:6061
HANDLE FASTCALL IntGdiAddFontMemResource(PVOID Buffer, DWORD dwSize, PDWORD pNumAdded)
Definition: freetype.c:2528
INT FASTCALL ftGdiGetTextCharsetInfo(PDC Dc, LPFONTSIGNATURE lpSig, DWORD dwFlags)
Definition: freetype.c:5078
DWORD FASTCALL ftGdiGetFontData(PFONTGDI FontGdi, DWORD Table, DWORD Offset, PVOID Buffer, DWORD Size)
Definition: freetype.c:5363
INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI FontGDI, UINT Size, OUTLINETEXTMETRICW *Otm, BOOL bLocked)
Definition: freetype.c:3139
#define GDI_HANDLE_GET_INDEX(h)
Definition: gdi.h:28
Status
Definition: gdiplustypes.h:25
ASMGENDATA Table[]
Definition: genincdata.c:61
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLuint64EXT * result
Definition: glext.h:11304
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 KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
static PWSTR PDWORD pdwBytes
Definition: layerapi.c:35
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
HDC hdc
Definition: main.c:9
FORCEINLINE PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
Definition: precomp.h:45
static HDC
Definition: imagelist.c:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define _In_reads_bytes_(s)
Definition: no_sal2.h:170
#define _In_reads_(s)
Definition: no_sal2.h:168
#define _Out_opt_
Definition: no_sal2.h:214
#define _Inout_
Definition: no_sal2.h:162
#define _Out_writes_bytes_opt_(s)
Definition: no_sal2.h:228
#define _Inout_opt_
Definition: no_sal2.h:216
#define _Out_writes_(s)
Definition: no_sal2.h:176
#define _Out_
Definition: no_sal2.h:160
#define _In_reads_opt_(s)
Definition: no_sal2.h:222
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define _Out_writes_bytes_(s)
Definition: no_sal2.h:178
#define _In_reads_bytes_opt_(s)
Definition: no_sal2.h:224
int Count
Definition: noreturn.cpp:7
#define FASTCALL
Definition: nt_native.h:50
unsigned long FLONG
Definition: ntbasedef.h:378
CONST WCHAR * PCWCH
Definition: ntbasedef.h:423
#define UNICODE_NULL
#define UNICODE_STRING_MAX_CHARS
#define DBG_UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:330
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
__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
__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 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 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
#define W32KAPI
Definition: ntgdi.h:9
__kernel_entry W32KAPI ULONG APIENTRY NtGdiGetOutlineTextMetricsInternalW(_In_ HDC hdc, _In_ ULONG cjotm, _Out_writes_bytes_opt_(cjotm) POUTLINETEXTMETRICW potmw, _Out_ PTMDIFF ptmd)
_In_ ULONG cjBuffer
Definition: ntgdi.h:2860
__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
#define GDI_CFONT_MAX
Definition: ntgdihdl.h:20
#define CFONT_REALIZATION
Definition: ntgdityp.h:430
DWORD LFTYPE
Definition: ntgdityp.h:189
#define TAG_STRING
Definition: oslist.h:22
DWORD * PDWORD
Definition: pedump.c:68
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define MmCopyFromCaller
Definition: polytest.cpp:29
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:603
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:181
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_VOLATILE
Definition: pseh2_64.h:185
#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
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
#define _countof(array)
Definition: sndvol32.h:70
static void Exit(void)
Definition: sock.c:1330
Definition: polytest.cpp:41
base of all file and directory entries
Definition: entries.h:83
HANDLE hlfntNew
Definition: ntgdihdl.h:330
FLONG flTextAlign
Definition: ntgdihdl.h:324
DWORD dvNumAxes
Definition: wingdi.h:3215
FLONG flType
Definition: engobjects.h:142
Definition: gdi.h:2
Definition: text.h:60
LFTYPE lft
Definition: text.h:64
BASEOBJECT BaseObject
Definition: text.h:63
FLONG fl
Definition: text.h:65
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
FONTOBJ * Font
Definition: text.h:66
EX_PUSH_LOCK lock
Definition: text.h:71
Definition: wingdi.h:2918
LONG cx
Definition: kdterminal.h:27
TEXTMETRICW TextMetric
Definition: ntgdityp.h:370
USHORT MaximumLength
Definition: env_spec_w32.h:370
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
DWORD fsCsb[2]
Definition: wingdi.h:1989
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
LONG lfOrientation
Definition: wingdi.h:2346
LONG lfEscapement
Definition: wingdi.h:2345
LONG tmHeight
Definition: wingdi.h:2829
uint32_t * PULONG
Definition: typedefs.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NTAPI
Definition: typedefs.h:36
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
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
#define GdiHandleTable
Definition: win32nt.h:37
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31
PTEXTOBJ FASTCALL RealizeFontInit(_In_ HFONT hFont)
Definition: font.c:433
HFONT FASTCALL GreCreateFontIndirectW(_In_ const LOGFONTW *lplf)
Definition: font.c:30
DWORD FASTCALL GreGetKerningPairs(_In_ HDC hDC, _In_ ULONG NumPairs, _Out_writes_(NumPairs) LPKERNINGPAIR krnpair)
Definition: font.c:55
#define MAX_TEXT_BUFFER
Definition: font.c:17
ULONG FASTCALL FontGetObject(_Inout_ PTEXTOBJ plfont, _In_ ULONG cjBuffer, _Out_ PVOID pvBuffer)
Definition: font.c:298
DWORD FASTCALL IntGetFontLanguageInfo(_In_ PDC Dc)
Definition: font.c:382
HFONT APIENTRY HfontCreate(_In_ const ENUMLOGFONTEXDVW *pelfw, _In_ ULONG cjElfw, _In_ LFTYPE lft, _In_ FLONG fl, _In_opt_ PVOID pvCliData)
BOOL APIENTRY NtGdiGetRealizationInfo(_In_ HDC hdc, _Out_ PREALIZATION_INFO pri, _In_ HFONT hf)
Definition: font.c:1155
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
DWORD FASTCALL IntGetCharDimensions(_In_ HDC hdc, _Out_opt_ PTEXTMETRICW ptm, _Out_opt_ PDWORD height)
Definition: font.c:337
W32KAPI BOOL APIENTRY NtGdiGetFontResourceInfoInternalW(_In_reads_(cwc) PCWCH pwszFiles, _In_ ULONG cwc, _In_ ULONG cFiles, _In_ UINT cjIn, _Inout_ PDWORD pdwBytes, _Out_writes_bytes_(*pdwBytes) PVOID pvBuf, _In_ DWORD dwType)
Definition: font.c:1043
static BOOL IntCheckFontPathNames(_In_reads_(cwc) PCWCH pwcFiles, _In_ ULONG cFiles, _In_ ULONG cwc)
Definition: font.c:453
DWORD APIENTRY NtGdiGetFontUnicodeRanges(_In_ HDC hdc, _Out_opt_ LPGLYPHSET pgs)
Definition: font.c:734
BOOL FASTCALL GreGetTextExtentW(_In_ HDC hDC, _In_reads_(cwc) PCWCH lpwsz, _In_ INT cwc, _Out_ PSIZE psize, _In_ UINT flOpts)
Definition: text.c:77
BOOL FASTCALL GreGetTextExtentExW(_In_ HDC hDC, _In_ PCWCH String, _In_ ULONG Count, _In_ ULONG MaxExtent, _Out_opt_ PULONG Fit, _Out_writes_to_opt_(Count, *Fit) PULONG Dx, _Out_ PSIZE pSize, _In_ FLONG fl)
Definition: text.c:133
#define TAG_FINF
Definition: text.h:3
#define LFONT_UnlockFont(plfnt)
Definition: text.h:79
FORCEINLINE PTEXTOBJ TEXTOBJ_LockText(HFONT hfont)
Definition: text.h:83
#define TEXTOBJECT_INIT
Definition: text.h:56
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define LFONT_AllocFontWithHandle()
Definition: text.h:76
#define TAG_FONT
Definition: tags.h:12
#define GDITAG_TEXT
Definition: tags.h:172
_In_ FLONG fl
Definition: winddi.h:1279
_In_ DWORD cjBuf
Definition: winddi.h:3827
#define FO_TYPE_TRUETYPE
Definition: winddi.h:737
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22
_In_ ULONG_PTR _In_opt_ DESIGNVECTOR * pdv
Definition: winddi.h:3723
_In_ SIZEL _In_ ULONG iFormat
Definition: winddi.h:3468
_In_ ULONG _In_ CLIPOBJ _In_ RECTL _In_ ULONG cjIn
Definition: winddi.h:3532
#define GCP_GLYPHSHAPE
Definition: wingdi.h:833
#define GCP_DIACRITIC
Definition: wingdi.h:831
#define GCP_LIGATE
Definition: wingdi.h:837
#define GCPCLASS_LATIN
Definition: wingdi.h:670
#define GCP_MAXEXTENT
Definition: wingdi.h:838
#define GCP_USEKERNING
Definition: wingdi.h:845
#define GCP_KASHIDA
Definition: wingdi.h:836
#define FLI_GLYPHS
Definition: wingdi.h:846
#define TA_RTLREADING
Definition: wingdi.h:934
#define GDI_ERROR
Definition: wingdi.h:1309
#define GCP_REORDER
Definition: wingdi.h:843
#define GCP_DBCS
Definition: wingdi.h:828
#define GCP_JUSTIFY
Definition: wingdi.h:834
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
#define ExAllocatePoolWithQuotaTag(a, b, c)
Definition: exfuncs.h:530
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193