2 * PROJECT: ReactOS win32 kernel mode subsystem
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: subsystems/win32/win32k/objects/font.c
9 /** Includes ******************************************************************/
16 /** Internal ******************************************************************/
23 LPKERNINGPAIR krnpair
)
35 EngSetLastError(ERROR_INVALID_HANDLE
);
39 pdcattr
= dc
->pdcattr
;
40 TextObj
= RealizeFontInit(pdcattr
->hlfntNew
);
45 EngSetLastError(ERROR_INVALID_HANDLE
);
49 FontGDI
= ObjToGDI(TextObj
->Font
, FONT
);
50 TEXTOBJ_UnlockText(TextObj
);
52 Count
= ftGdiGetKerningPairs(FontGDI
,0,NULL
);
54 if ( Count
&& krnpair
)
58 EngSetLastError(ERROR_INSUFFICIENT_BUFFER
);
61 pKP
= ExAllocatePoolWithTag(PagedPool
, Count
* sizeof(KERNINGPAIR
), GDITAG_TEXT
);
64 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
67 ftGdiGetKerningPairs(FontGDI
,Count
,pKP
);
69 RtlCopyMemory(krnpair
, pKP
, Count
* sizeof(KERNINGPAIR
));
71 ExFreePoolWithTag(pKP
,GDITAG_TEXT
);
78 It is recommended that an application use the GetFontLanguageInfo function
79 to determine whether the GCP_DIACRITIC, GCP_DBCS, GCP_USEKERNING, GCP_LIGATE,
80 GCP_REORDER, GCP_GLYPHSHAPE, and GCP_KASHIDA values are valid for the
81 currently selected font. If not valid, GetCharacterPlacement ignores the
84 M$ must use a preset "compiled in" support for each language based releases.
85 ReactOS uses FreeType, this will need to be supported. ATM this is hard coded
92 GreGetCharacterPlacementW(
100 GCP_RESULTSW gcpwSave
;
106 DPRINT1("GreGCPW Start\n");
110 if (GreGetTextExtentW( hdc
, pwsz
, nCount
, &Size
, 1))
111 return MAKELONG(Size
.cx
, Size
.cy
);
115 DPRINT1("GreGCPW 1\n");
117 RtlCopyMemory(&gcpwSave
, pgcpw
, sizeof(GCP_RESULTSW
));
119 cSet
= nSet
= nCount
;
121 if ( nCount
> gcpwSave
.nGlyphs
) cSet
= gcpwSave
.nGlyphs
;
123 /* GCP_JUSTIFY may only be used in conjunction with GCP_MAXEXTENT. */
124 if ( dwFlags
& GCP_JUSTIFY
) dwFlags
|= GCP_MAXEXTENT
;
126 if ( !gcpwSave
.lpDx
&& gcpwSave
.lpCaretPos
)
127 tmpDxCaretPos
= gcpwSave
.lpCaretPos
;
129 tmpDxCaretPos
= gcpwSave
.lpDx
;
131 if ( !GreGetTextExtentExW( hdc
,
135 ((dwFlags
& GCP_MAXEXTENT
) ? (PULONG
) &cSet
: NULL
),
136 (PULONG
) tmpDxCaretPos
,
143 DPRINT1("GreGCPW 2\n");
147 if ( tmpDxCaretPos
&& nSet
> 0)
149 for (i
= (nSet
- 1); i
> 0; i
--)
151 tmpDxCaretPos
[i
] -= tmpDxCaretPos
[i
- 1];
155 if ( !(dwFlags
& GCP_MAXEXTENT
) || nSet
)
157 if ( (dwFlags
& GCP_USEKERNING
) &&
159 gcpwSave
.lpCaretPos
) &&
165 Count
= GreGetKerningPairs( hdc
, 0, NULL
);
168 pKP
= ExAllocatePoolWithTag(PagedPool
, Count
* sizeof(KERNINGPAIR
), GDITAG_TEXT
);
171 if ( GreGetKerningPairs( hdc
, Count
, pKP
) != Count
)
173 ExFreePoolWithTag( pKP
, GDITAG_TEXT
);
177 if ( (ULONG_PTR
)(pKP
) < ((ULONG_PTR
)(pKP
) + (ULONG_PTR
)(Count
* sizeof(KERNINGPAIR
))) )
179 DPRINT1("We Need to Do Something HERE!\n");
182 ExFreePoolWithTag( pKP
, GDITAG_TEXT
);
184 if ( dwFlags
& GCP_MAXEXTENT
)
186 if ( Size
.cx
> nMaxExtent
)
188 for (Cx
= Size
.cx
; nSet
> 0; nSet
--)
190 Cx
-= tmpDxCaretPos
[nSet
- 1];
192 if ( Cx
<= nMaxExtent
) break;
206 if ( (dwFlags
& GCP_JUSTIFY
) &&
208 gcpwSave
.lpCaretPos
) &&
211 DPRINT1("We Need to Do Something HERE 2!\n");
214 if ( gcpwSave
.lpDx
&& gcpwSave
.lpCaretPos
)
215 RtlCopyMemory( gcpwSave
.lpCaretPos
, gcpwSave
.lpDx
, nSet
* sizeof(LONG
));
217 if ( gcpwSave
.lpCaretPos
)
225 Cx
= gcpwSave
.lpCaretPos
[i
];
226 gcpwSave
.lpCaretPos
[i
] = pos
;
234 if ( gcpwSave
.lpOutString
)
235 RtlCopyMemory(gcpwSave
.lpOutString
, pwsz
, nSet
* sizeof(WCHAR
));
237 if ( gcpwSave
.lpClass
)
238 RtlFillMemory(gcpwSave
.lpClass
, nSet
, GCPCLASS_LATIN
);
240 if ( gcpwSave
.lpOrder
)
242 for (i
= 0; i
< nSet
; i
++)
243 gcpwSave
.lpOrder
[i
] = i
;
246 if ( gcpwSave
.lpGlyphs
)
248 if ( GreGetGlyphIndicesW( hdc
, pwsz
, nSet
, gcpwSave
.lpGlyphs
, 0, 0) == GDI_ERROR
)
255 pgcpw
->nGlyphs
= nSet
;
256 pgcpw
->nMaxFit
= nSet
;
258 DPRINT1("GreGCPW Exit\n");
259 return MAKELONG(Size
.cx
, Size
.cy
);
265 FontGetObject(PTEXTOBJ plfont
, ULONG cjBuffer
, PVOID pvBuffer
)
268 ENUMLOGFONTEXDVW
*plf
= &plfont
->logfont
;
270 /* If buffer is NULL, only the size is requested */
271 if (pvBuffer
== NULL
) return sizeof(LOGFONTW
);
273 /* Calculate the maximum size according to number of axes */
274 cjMaxSize
= FIELD_OFFSET(ENUMLOGFONTEXDVW
,
275 elfDesignVector
.dvValues
[plf
->elfDesignVector
.dvNumAxes
]);
277 if (cjBuffer
> cjMaxSize
) cjBuffer
= cjMaxSize
;
279 RtlCopyMemory(pvBuffer
, plf
, cjBuffer
);
286 IntGetCharDimensions(HDC hdc
, PTEXTMETRICW ptm
, PDWORD height
)
295 static const WCHAR alphabet
[] = {
296 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
297 'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H',
298 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0};
300 if(!ftGdiGetTextMetricsW(hdc
, &tmwi
)) return 0;
302 pdc
= DC_LockDc(hdc
);
306 pdcattr
= pdc
->pdcattr
;
308 TextObj
= RealizeFontInit(pdcattr
->hlfntNew
);
314 Good
= TextIntGetTextExtentPoint(pdc
, TextObj
, alphabet
, 52, 0, NULL
, 0, &sz
, 0);
315 TEXTOBJ_UnlockText(TextObj
);
319 if (ptm
) *ptm
= tmwi
.TextMetric
;
320 if (height
) *height
= tmwi
.TextMetric
.tmHeight
;
322 return (sz
.cx
/ 26 + 1) / 2;
328 IntGetFontLanguageInfo(PDC Dc
)
331 FONTSIGNATURE fontsig
;
332 static const DWORD GCP_DBCS_MASK
=0x003F0000,
333 GCP_DIACRITIC_MASK
=0x00000000,
334 FLI_GLYPHS_MASK
=0x00000000,
335 GCP_GLYPHSHAPE_MASK
=0x00000040,
336 GCP_KASHIDA_MASK
=0x00000000,
337 GCP_LIGATE_MASK
=0x00000000,
338 GCP_USEKERNING_MASK
=0x00000000,
339 GCP_REORDER_MASK
=0x00000060;
343 ftGdiGetTextCharsetInfo( Dc
, &fontsig
, 0 );
345 /* We detect each flag we return using a bitmask on the Codepage Bitfields */
346 if( (fontsig
.fsCsb
[0]&GCP_DBCS_MASK
)!=0 )
349 if( (fontsig
.fsCsb
[0]&GCP_DIACRITIC_MASK
)!=0 )
350 result
|=GCP_DIACRITIC
;
352 if( (fontsig
.fsCsb
[0]&FLI_GLYPHS_MASK
)!=0 )
355 if( (fontsig
.fsCsb
[0]&GCP_GLYPHSHAPE_MASK
)!=0 )
356 result
|=GCP_GLYPHSHAPE
;
358 if( (fontsig
.fsCsb
[0]&GCP_KASHIDA_MASK
)!=0 )
361 if( (fontsig
.fsCsb
[0]&GCP_LIGATE_MASK
)!=0 )
364 if( (fontsig
.fsCsb
[0]&GCP_USEKERNING_MASK
)!=0 )
365 result
|=GCP_USEKERNING
;
367 pdcattr
= Dc
->pdcattr
;
369 /* This might need a test for a HEBREW- or ARABIC_CHARSET as well */
370 if ( pdcattr
->lTextAlign
& TA_RTLREADING
)
371 if( (fontsig
.fsCsb
[0]&GCP_REORDER_MASK
)!=0 )
379 RealizeFontInit(HFONT hFont
)
381 NTSTATUS Status
= STATUS_SUCCESS
;
384 pTextObj
= TEXTOBJ_LockText(hFont
);
386 if ( pTextObj
&& !(pTextObj
->fl
& TEXTOBJECT_INIT
))
388 Status
= TextIntRealizeFont(hFont
, pTextObj
);
389 if (!NT_SUCCESS(Status
))
391 TEXTOBJ_UnlockText(pTextObj
);
399 /** Functions ******************************************************************/
403 NtGdiAddFontResourceW(
409 IN OPTIONAL DESIGNVECTOR
*pdv
)
411 UNICODE_STRING SafeFileName
;
416 /* FIXME: Protect with SEH? */
417 RtlInitUnicodeString(&SafeFileName
, pwszFiles
);
419 /* Reserve for prepending '\??\' */
420 SafeFileName
.Length
+= 4 * sizeof(WCHAR
);
421 SafeFileName
.MaximumLength
+= 4 * sizeof(WCHAR
);
423 src
= SafeFileName
.Buffer
;
424 SafeFileName
.Buffer
= (PWSTR
)ExAllocatePoolWithTag(PagedPool
, SafeFileName
.MaximumLength
, TAG_STRING
);
425 if(!SafeFileName
.Buffer
)
427 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
432 RtlCopyMemory(SafeFileName
.Buffer
, L
"\\??\\", 4 * sizeof(WCHAR
));
434 Status
= MmCopyFromCaller(SafeFileName
.Buffer
+ 4, src
, SafeFileName
.MaximumLength
- (4 * sizeof(WCHAR
)));
435 if(!NT_SUCCESS(Status
))
437 ExFreePoolWithTag(SafeFileName
.Buffer
, TAG_STRING
);
438 SetLastNtError(Status
);
442 Ret
= IntGdiAddFontResource(&SafeFileName
, (DWORD
)fl
);
444 ExFreePoolWithTag(SafeFileName
.Buffer
, TAG_STRING
);
453 NtGdiGetCharacterPlacementW(
458 IN OUT LPGCP_RESULTSW pgcpw
,
464 return GreGetCharacterPlacementW( hdc
,
487 DWORD Result
= GDI_ERROR
;
488 NTSTATUS Status
= STATUS_SUCCESS
;
494 ProbeForRead(Buffer
, Size
, 1);
496 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
498 Status
= _SEH2_GetExceptionCode();
503 if (!NT_SUCCESS(Status
)) return Result
;
508 EngSetLastError(ERROR_INVALID_HANDLE
);
511 pdcattr
= Dc
->pdcattr
;
513 hFont
= pdcattr
->hlfntNew
;
514 TextObj
= RealizeFontInit(hFont
);
519 EngSetLastError(ERROR_INVALID_HANDLE
);
523 FontGdi
= ObjToGDI(TextObj
->Font
, FONT
);
525 Result
= ftGdiGetFontData(FontGdi
, Table
, Offset
, Buffer
, Size
);
527 TEXTOBJ_UnlockText(TextObj
);
537 NtGdiGetFontUnicodeRanges(
539 OUT OPTIONAL LPGLYPHSET pgs
)
548 NTSTATUS Status
= STATUS_SUCCESS
;
550 pDc
= DC_LockDc(hdc
);
553 EngSetLastError(ERROR_INVALID_HANDLE
);
557 pdcattr
= pDc
->pdcattr
;
559 hFont
= pdcattr
->hlfntNew
;
560 TextObj
= RealizeFontInit(hFont
);
562 if ( TextObj
== NULL
)
564 EngSetLastError(ERROR_INVALID_HANDLE
);
567 FontGdi
= ObjToGDI(TextObj
->Font
, FONT
);
569 Size
= ftGetFontUnicodeRanges( FontGdi
, NULL
);
573 pgsSafe
= ExAllocatePoolWithTag(PagedPool
, Size
, GDITAG_TEXT
);
576 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
581 Size
= ftGetFontUnicodeRanges( FontGdi
, pgsSafe
);
587 ProbeForWrite(pgs
, Size
, 1);
588 RtlCopyMemory(pgs
, pgsSafe
, Size
);
590 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
592 Status
= _SEH2_GetExceptionCode();
596 if (!NT_SUCCESS(Status
)) Size
= 0;
598 ExFreePoolWithTag(pgsSafe
, GDITAG_TEXT
);
601 TEXTOBJ_UnlockText(TextObj
);
608 NtGdiGetGlyphOutline(
612 OUT LPGLYPHMETRICS pgm
,
614 OUT OPTIONAL PVOID UnsafeBuf
,
616 IN BOOL bIgnoreRotation
)
618 ULONG Ret
= GDI_ERROR
;
622 NTSTATUS Status
= STATUS_SUCCESS
;
627 EngSetLastError(ERROR_INVALID_HANDLE
);
631 if (UnsafeBuf
&& cjBuf
)
633 pvBuf
= ExAllocatePoolWithTag(PagedPool
, cjBuf
, GDITAG_TEXT
);
636 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
641 Ret
= ftGdiGetGlyphOutline( dc
,
654 ProbeForWrite(UnsafeBuf
, cjBuf
, 1);
655 RtlCopyMemory(UnsafeBuf
, pvBuf
, cjBuf
);
657 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
659 Status
= _SEH2_GetExceptionCode();
663 ExFreePoolWithTag(pvBuf
, GDITAG_TEXT
);
670 ProbeForWrite(pgm
, sizeof(GLYPHMETRICS
), 1);
671 RtlCopyMemory(pgm
, &gm
, sizeof(GLYPHMETRICS
));
673 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
675 Status
= _SEH2_GetExceptionCode();
680 if (! NT_SUCCESS(Status
))
682 EngSetLastError(ERROR_INVALID_PARAMETER
);
693 NtGdiGetKerningPairs(HDC hDC
,
695 LPKERNINGPAIR krnpair
)
703 NTSTATUS Status
= STATUS_SUCCESS
;
708 EngSetLastError(ERROR_INVALID_HANDLE
);
712 pdcattr
= dc
->pdcattr
;
713 TextObj
= RealizeFontInit(pdcattr
->hlfntNew
);
718 EngSetLastError(ERROR_INVALID_HANDLE
);
722 FontGDI
= ObjToGDI(TextObj
->Font
, FONT
);
723 TEXTOBJ_UnlockText(TextObj
);
725 Count
= ftGdiGetKerningPairs(FontGDI
,0,NULL
);
727 if ( Count
&& krnpair
)
729 if (Count
> NumPairs
)
731 EngSetLastError(ERROR_INSUFFICIENT_BUFFER
);
734 pKP
= ExAllocatePoolWithTag(PagedPool
, Count
* sizeof(KERNINGPAIR
), GDITAG_TEXT
);
737 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
740 ftGdiGetKerningPairs(FontGDI
,Count
,pKP
);
743 ProbeForWrite(krnpair
, Count
* sizeof(KERNINGPAIR
), 1);
744 RtlCopyMemory(krnpair
, pKP
, Count
* sizeof(KERNINGPAIR
));
746 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
748 Status
= _SEH2_GetExceptionCode();
751 if (!NT_SUCCESS(Status
))
753 EngSetLastError(ERROR_INVALID_PARAMETER
);
756 ExFreePoolWithTag(pKP
,GDITAG_TEXT
);
762 From "Undocumented Windows 2000 Secrets" Appendix B, Table B-2, page
763 472, this is NtGdiGetOutlineTextMetricsInternalW.
767 NtGdiGetOutlineTextMetricsInternalW (HDC hDC
,
769 OUTLINETEXTMETRICW
*otm
,
778 OUTLINETEXTMETRICW
*potm
;
779 NTSTATUS Status
= STATUS_SUCCESS
;
784 EngSetLastError(ERROR_INVALID_HANDLE
);
787 pdcattr
= dc
->pdcattr
;
788 hFont
= pdcattr
->hlfntNew
;
789 TextObj
= RealizeFontInit(hFont
);
793 EngSetLastError(ERROR_INVALID_HANDLE
);
796 FontGDI
= ObjToGDI(TextObj
->Font
, FONT
);
797 TEXTOBJ_UnlockText(TextObj
);
798 Size
= IntGetOutlineTextMetrics(FontGDI
, 0, NULL
);
799 if (!otm
) return Size
;
802 EngSetLastError(ERROR_INSUFFICIENT_BUFFER
);
805 potm
= ExAllocatePoolWithTag(PagedPool
, Size
, GDITAG_TEXT
);
808 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
811 IntGetOutlineTextMetrics(FontGDI
, Size
, potm
);
816 ProbeForWrite(otm
, Size
, 1);
817 RtlCopyMemory(otm
, potm
, Size
);
819 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
821 Status
= _SEH2_GetExceptionCode();
825 if (!NT_SUCCESS(Status
))
827 EngSetLastError(ERROR_INVALID_PARAMETER
);
831 ExFreePoolWithTag(potm
,GDITAG_TEXT
);
838 NtGdiGetFontResourceInfoInternalW(
843 OUT LPDWORD pdwBytes
,
847 NTSTATUS Status
= STATUS_SUCCESS
;
849 UNICODE_STRING SafeFileNames
;
856 WCHAR FullName
[LF_FULLFACESIZE
];
859 /* FIXME: Handle cFiles > 0 */
861 /* Check for valid dwType values
862 dwType == 4 seems to be handled by gdi32 only */
863 if (dwType
== 4 || dwType
> 5)
865 EngSetLastError(ERROR_INVALID_PARAMETER
);
869 /* Allocate a safe unicode string buffer */
870 cbStringSize
= cwc
* sizeof(WCHAR
);
871 SafeFileNames
.MaximumLength
= SafeFileNames
.Length
= (USHORT
)cbStringSize
- sizeof(WCHAR
);
872 SafeFileNames
.Buffer
= ExAllocatePoolWithTag(PagedPool
,
875 if (!SafeFileNames
.Buffer
)
877 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
881 /* Check buffers and copy pwszFiles to safe unicode string */
884 ProbeForRead(pwszFiles
, cbStringSize
, 1);
885 ProbeForWrite(pdwBytes
, sizeof(DWORD
), 1);
886 ProbeForWrite(pvBuf
, cjIn
, 1);
888 RtlCopyMemory(SafeFileNames
.Buffer
, pwszFiles
, cbStringSize
);
890 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
892 Status
= _SEH2_GetExceptionCode();
896 if(!NT_SUCCESS(Status
))
898 SetLastNtError(Status
);
899 /* Free the string buffer for the safe filename */
900 ExFreePoolWithTag(SafeFileNames
.Buffer
,'RTSU');
904 /* Do the actual call */
905 bRet
= IntGdiGetFontResourceInfo(&SafeFileNames
, &Buffer
, &dwBytes
, dwType
);
907 /* Check if succeeded and the buffer is big enough */
908 if (bRet
&& cjIn
>= dwBytes
)
910 /* Copy the data back to caller */
913 /* Buffers are already probed */
914 RtlCopyMemory(pvBuf
, &Buffer
, dwBytes
);
917 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
919 Status
= _SEH2_GetExceptionCode();
923 if(!NT_SUCCESS(Status
))
925 SetLastNtError(Status
);
930 /* Free the string for the safe filenames */
931 ExFreePoolWithTag(SafeFileNames
.Buffer
,'RTSU');
941 NtGdiGetRealizationInfo(
943 OUT PREALIZATION_INFO pri
,
954 pDc
= DC_LockDc(hdc
);
957 EngSetLastError(ERROR_INVALID_HANDLE
);
960 pdcattr
= pDc
->pdcattr
;
961 pTextObj
= RealizeFontInit(pdcattr
->hlfntNew
);
962 pFontGdi
= ObjToGDI(pTextObj
->Font
, FONT
);
963 TEXTOBJ_UnlockText(pTextObj
);
966 Ret
= ftGdiRealizationInfo(pFontGdi
, &ri
);
971 NTSTATUS Status
= STATUS_SUCCESS
;
974 ProbeForWrite(pri
, sizeof(REALIZATION_INFO
), 1);
975 RtlCopyMemory(pri
, &ri
, sizeof(REALIZATION_INFO
));
977 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
979 Status
= _SEH2_GetExceptionCode();
983 if(!NT_SUCCESS(Status
))
985 SetLastNtError(Status
);
991 if (GdiHandleTable
->cfPublic
[i
].hf
== hf
)
993 GdiHandleTable
->cfPublic
[i
].iTechnology
= ri
.iTechnology
;
994 GdiHandleTable
->cfPublic
[i
].iUniq
= ri
.iUniq
;
995 GdiHandleTable
->cfPublic
[i
].dwUnknown
= ri
.dwUnknown
;
996 GdiHandleTable
->cfPublic
[i
].dwCFCount
= GdiHandleTable
->dwCFCount
;
997 GdiHandleTable
->cfPublic
[i
].fl
|= CFONT_REALIZATION
;
1001 while ( i
< GDI_CFONT_MAX
);
1009 IN PENUMLOGFONTEXDVW pelfw
,
1013 IN PVOID pvCliData
)
1015 ENUMLOGFONTEXDVW SafeLogfont
;
1018 NTSTATUS Status
= STATUS_SUCCESS
;
1020 /* Silence GCC warnings */
1021 SafeLogfont
.elfEnumLogfontEx
.elfLogFont
.lfEscapement
= 0;
1022 SafeLogfont
.elfEnumLogfontEx
.elfLogFont
.lfOrientation
= 0;
1031 ProbeForRead(pelfw
, sizeof(ENUMLOGFONTEXDVW
), 1);
1032 RtlCopyMemory(&SafeLogfont
, pelfw
, sizeof(ENUMLOGFONTEXDVW
));
1034 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
1036 Status
= _SEH2_GetExceptionCode();
1040 if (!NT_SUCCESS(Status
))
1045 plfont
= LFONT_AllocFontWithHandle();
1050 hNewFont
= plfont
->BaseObject
.hHmgr
;
1054 RtlCopyMemory (&plfont
->logfont
, &SafeLogfont
, sizeof(ENUMLOGFONTEXDVW
));
1055 ExInitializePushLock(&plfont
->lock
);
1057 if (SafeLogfont
.elfEnumLogfontEx
.elfLogFont
.lfEscapement
!=
1058 SafeLogfont
.elfEnumLogfontEx
.elfLogFont
.lfOrientation
)
1060 /* This should really depend on whether GM_ADVANCED is set */
1061 plfont
->logfont
.elfEnumLogfontEx
.elfLogFont
.lfOrientation
=
1062 plfont
->logfont
.elfEnumLogfontEx
.elfLogFont
.lfEscapement
;
1064 LFONT_UnlockFont(plfont
);
1066 if (pvCliData
&& hNewFont
)
1068 // FIXME: Use GDIOBJ_InsertUserData
1069 KeEnterCriticalRegion();
1071 INT Index
= GDI_HANDLE_GET_INDEX((HGDIOBJ
)hNewFont
);
1072 PGDI_TABLE_ENTRY Entry
= &GdiHandleTable
->Entries
[Index
];
1073 Entry
->UserData
= pvCliData
;
1075 KeLeaveCriticalRegion();