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 HFONT APIENTRY
HfontCreate( IN PENUMLOGFONTEXDVW pelfw
,IN ULONG cjElfw
,IN LFTYPE lft
,IN FLONG fl
,IN PVOID pvCliData
);
18 /** Internal ******************************************************************/
21 GreCreateFontIndirectW( LOGFONTW
*lplf
)
25 ENUMLOGFONTEXDVW Logfont
;
27 RtlCopyMemory( &Logfont
.elfEnumLogfontEx
.elfLogFont
, lplf
, sizeof(LOGFONTW
));
28 RtlZeroMemory( &Logfont
.elfEnumLogfontEx
.elfFullName
,
29 sizeof(Logfont
.elfEnumLogfontEx
.elfFullName
));
30 RtlZeroMemory( &Logfont
.elfEnumLogfontEx
.elfStyle
,
31 sizeof(Logfont
.elfEnumLogfontEx
.elfStyle
));
32 RtlZeroMemory( &Logfont
.elfEnumLogfontEx
.elfScript
,
33 sizeof(Logfont
.elfEnumLogfontEx
.elfScript
));
35 Logfont
.elfDesignVector
.dvNumAxes
= 0;
37 RtlZeroMemory( &Logfont
.elfDesignVector
, sizeof(DESIGNVECTOR
));
39 return HfontCreate((PENUMLOGFONTEXDVW
)&Logfont
, 0, 0, 0, NULL
);
49 LPKERNINGPAIR krnpair
)
61 EngSetLastError(ERROR_INVALID_HANDLE
);
65 pdcattr
= dc
->pdcattr
;
66 TextObj
= RealizeFontInit(pdcattr
->hlfntNew
);
71 EngSetLastError(ERROR_INVALID_HANDLE
);
75 FontGDI
= ObjToGDI(TextObj
->Font
, FONT
);
76 TEXTOBJ_UnlockText(TextObj
);
78 Count
= ftGdiGetKerningPairs(FontGDI
,0,NULL
);
80 if ( Count
&& krnpair
)
84 EngSetLastError(ERROR_INSUFFICIENT_BUFFER
);
87 pKP
= ExAllocatePoolWithTag(PagedPool
, Count
* sizeof(KERNINGPAIR
), GDITAG_TEXT
);
90 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
93 ftGdiGetKerningPairs(FontGDI
,Count
,pKP
);
95 RtlCopyMemory(krnpair
, pKP
, Count
* sizeof(KERNINGPAIR
));
97 ExFreePoolWithTag(pKP
,GDITAG_TEXT
);
104 It is recommended that an application use the GetFontLanguageInfo function
105 to determine whether the GCP_DIACRITIC, GCP_DBCS, GCP_USEKERNING, GCP_LIGATE,
106 GCP_REORDER, GCP_GLYPHSHAPE, and GCP_KASHIDA values are valid for the
107 currently selected font. If not valid, GetCharacterPlacement ignores the
110 M$ must use a preset "compiled in" support for each language based releases.
111 ReactOS uses FreeType, this will need to be supported. ATM this is hard coded
118 GreGetCharacterPlacementW(
123 LPGCP_RESULTSW pgcpw
,
126 GCP_RESULTSW gcpwSave
;
132 DPRINT1("GreGCPW Start\n");
136 if (GreGetTextExtentW( hdc
, pwsz
, nCount
, &Size
, 1))
137 return MAKELONG(Size
.cx
, Size
.cy
);
141 DPRINT1("GreGCPW 1\n");
143 RtlCopyMemory(&gcpwSave
, pgcpw
, sizeof(GCP_RESULTSW
));
145 cSet
= nSet
= nCount
;
147 if ( nCount
> gcpwSave
.nGlyphs
) cSet
= gcpwSave
.nGlyphs
;
149 /* GCP_JUSTIFY may only be used in conjunction with GCP_MAXEXTENT. */
150 if ( dwFlags
& GCP_JUSTIFY
) dwFlags
|= GCP_MAXEXTENT
;
152 if ( !gcpwSave
.lpDx
&& gcpwSave
.lpCaretPos
)
153 tmpDxCaretPos
= gcpwSave
.lpCaretPos
;
155 tmpDxCaretPos
= gcpwSave
.lpDx
;
157 if ( !GreGetTextExtentExW( hdc
,
161 ((dwFlags
& GCP_MAXEXTENT
) ? (PULONG
) &cSet
: NULL
),
162 (PULONG
) tmpDxCaretPos
,
169 DPRINT1("GreGCPW 2\n");
173 if ( tmpDxCaretPos
&& nSet
> 0)
175 for (i
= (nSet
- 1); i
> 0; i
--)
177 tmpDxCaretPos
[i
] -= tmpDxCaretPos
[i
- 1];
181 if ( !(dwFlags
& GCP_MAXEXTENT
) || nSet
)
183 if ( (dwFlags
& GCP_USEKERNING
) &&
185 gcpwSave
.lpCaretPos
) &&
191 Count
= GreGetKerningPairs( hdc
, 0, NULL
);
194 pKP
= ExAllocatePoolWithTag(PagedPool
, Count
* sizeof(KERNINGPAIR
), GDITAG_TEXT
);
197 if ( GreGetKerningPairs( hdc
, Count
, pKP
) != Count
)
199 ExFreePoolWithTag( pKP
, GDITAG_TEXT
);
203 if ( (ULONG_PTR
)(pKP
) < ((ULONG_PTR
)(pKP
) + (ULONG_PTR
)(Count
* sizeof(KERNINGPAIR
))) )
205 DPRINT1("We Need to Do Something HERE!\n");
208 ExFreePoolWithTag( pKP
, GDITAG_TEXT
);
210 if ( dwFlags
& GCP_MAXEXTENT
)
212 if ( Size
.cx
> nMaxExtent
)
214 for (Cx
= Size
.cx
; nSet
> 0; nSet
--)
216 Cx
-= tmpDxCaretPos
[nSet
- 1];
218 if ( Cx
<= nMaxExtent
) break;
232 if ( (dwFlags
& GCP_JUSTIFY
) &&
234 gcpwSave
.lpCaretPos
) &&
237 DPRINT1("We Need to Do Something HERE 2!\n");
240 if ( gcpwSave
.lpDx
&& gcpwSave
.lpCaretPos
)
241 RtlCopyMemory( gcpwSave
.lpCaretPos
, gcpwSave
.lpDx
, nSet
* sizeof(LONG
));
243 if ( gcpwSave
.lpCaretPos
)
251 Cx
= gcpwSave
.lpCaretPos
[i
];
252 gcpwSave
.lpCaretPos
[i
] = pos
;
260 if ( gcpwSave
.lpOutString
)
261 RtlCopyMemory(gcpwSave
.lpOutString
, pwsz
, nSet
* sizeof(WCHAR
));
263 if ( gcpwSave
.lpClass
)
264 RtlFillMemory(gcpwSave
.lpClass
, nSet
, GCPCLASS_LATIN
);
266 if ( gcpwSave
.lpOrder
)
268 for (i
= 0; i
< nSet
; i
++)
269 gcpwSave
.lpOrder
[i
] = i
;
272 if ( gcpwSave
.lpGlyphs
)
274 if ( GreGetGlyphIndicesW( hdc
, pwsz
, nSet
, gcpwSave
.lpGlyphs
, 0, 0) == GDI_ERROR
)
281 pgcpw
->nGlyphs
= nSet
;
282 pgcpw
->nMaxFit
= nSet
;
284 DPRINT1("GreGCPW Exit\n");
285 return MAKELONG(Size
.cx
, Size
.cy
);
291 FontGetObject(PTEXTOBJ plfont
, ULONG cjBuffer
, PVOID pvBuffer
)
294 ENUMLOGFONTEXDVW
*plf
= &plfont
->logfont
;
296 /* If buffer is NULL, only the size is requested */
297 if (pvBuffer
== NULL
) return sizeof(LOGFONTW
);
299 /* Calculate the maximum size according to number of axes */
300 cjMaxSize
= FIELD_OFFSET(ENUMLOGFONTEXDVW
,
301 elfDesignVector
.dvValues
[plf
->elfDesignVector
.dvNumAxes
]);
303 if (cjBuffer
> cjMaxSize
) cjBuffer
= cjMaxSize
;
305 RtlCopyMemory(pvBuffer
, plf
, cjBuffer
);
312 IntGetCharDimensions(HDC hdc
, PTEXTMETRICW ptm
, PDWORD height
)
321 static const WCHAR alphabet
[] = {
322 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
323 'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H',
324 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0};
326 if(!ftGdiGetTextMetricsW(hdc
, &tmwi
)) return 0;
328 pdc
= DC_LockDc(hdc
);
332 pdcattr
= pdc
->pdcattr
;
334 TextObj
= RealizeFontInit(pdcattr
->hlfntNew
);
340 Good
= TextIntGetTextExtentPoint(pdc
, TextObj
, alphabet
, 52, 0, NULL
, 0, &sz
, 0);
341 TEXTOBJ_UnlockText(TextObj
);
345 if (ptm
) *ptm
= tmwi
.TextMetric
;
346 if (height
) *height
= tmwi
.TextMetric
.tmHeight
;
348 return (sz
.cx
/ 26 + 1) / 2;
354 IntGetFontLanguageInfo(PDC Dc
)
357 FONTSIGNATURE fontsig
;
358 static const DWORD GCP_DBCS_MASK
=0x003F0000,
359 GCP_DIACRITIC_MASK
=0x00000000,
360 FLI_GLYPHS_MASK
=0x00000000,
361 GCP_GLYPHSHAPE_MASK
=0x00000040,
362 GCP_KASHIDA_MASK
=0x00000000,
363 GCP_LIGATE_MASK
=0x00000000,
364 GCP_USEKERNING_MASK
=0x00000000,
365 GCP_REORDER_MASK
=0x00000060;
369 ftGdiGetTextCharsetInfo( Dc
, &fontsig
, 0 );
371 /* We detect each flag we return using a bitmask on the Codepage Bitfields */
372 if( (fontsig
.fsCsb
[0]&GCP_DBCS_MASK
)!=0 )
375 if( (fontsig
.fsCsb
[0]&GCP_DIACRITIC_MASK
)!=0 )
376 result
|=GCP_DIACRITIC
;
378 if( (fontsig
.fsCsb
[0]&FLI_GLYPHS_MASK
)!=0 )
381 if( (fontsig
.fsCsb
[0]&GCP_GLYPHSHAPE_MASK
)!=0 )
382 result
|=GCP_GLYPHSHAPE
;
384 if( (fontsig
.fsCsb
[0]&GCP_KASHIDA_MASK
)!=0 )
387 if( (fontsig
.fsCsb
[0]&GCP_LIGATE_MASK
)!=0 )
390 if( (fontsig
.fsCsb
[0]&GCP_USEKERNING_MASK
)!=0 )
391 result
|=GCP_USEKERNING
;
393 pdcattr
= Dc
->pdcattr
;
395 /* This might need a test for a HEBREW- or ARABIC_CHARSET as well */
396 if ( pdcattr
->lTextAlign
& TA_RTLREADING
)
397 if( (fontsig
.fsCsb
[0]&GCP_REORDER_MASK
)!=0 )
405 RealizeFontInit(HFONT hFont
)
407 NTSTATUS Status
= STATUS_SUCCESS
;
410 pTextObj
= TEXTOBJ_LockText(hFont
);
412 if ( pTextObj
&& !(pTextObj
->fl
& TEXTOBJECT_INIT
))
414 Status
= TextIntRealizeFont(hFont
, pTextObj
);
415 if (!NT_SUCCESS(Status
))
417 TEXTOBJ_UnlockText(pTextObj
);
425 /** Functions ******************************************************************/
429 NtGdiAddFontResourceW(
435 IN OPTIONAL DESIGNVECTOR
*pdv
)
437 UNICODE_STRING SafeFileName
;
442 /* FIXME: Protect with SEH? */
443 RtlInitUnicodeString(&SafeFileName
, pwszFiles
);
445 /* Reserve for prepending '\??\' */
446 SafeFileName
.Length
+= 4 * sizeof(WCHAR
);
447 SafeFileName
.MaximumLength
+= 4 * sizeof(WCHAR
);
449 src
= SafeFileName
.Buffer
;
450 SafeFileName
.Buffer
= (PWSTR
)ExAllocatePoolWithTag(PagedPool
, SafeFileName
.MaximumLength
, TAG_STRING
);
451 if(!SafeFileName
.Buffer
)
453 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
458 RtlCopyMemory(SafeFileName
.Buffer
, L
"\\??\\", 4 * sizeof(WCHAR
));
460 Status
= MmCopyFromCaller(SafeFileName
.Buffer
+ 4, src
, SafeFileName
.MaximumLength
- (4 * sizeof(WCHAR
)));
461 if(!NT_SUCCESS(Status
))
463 ExFreePoolWithTag(SafeFileName
.Buffer
, TAG_STRING
);
464 SetLastNtError(Status
);
468 Ret
= IntGdiAddFontResource(&SafeFileName
, (DWORD
)fl
);
470 ExFreePoolWithTag(SafeFileName
.Buffer
, TAG_STRING
);
479 NtGdiGetCharacterPlacementW(
484 IN OUT LPGCP_RESULTSW pgcpw
,
490 return GreGetCharacterPlacementW( hdc
,
513 DWORD Result
= GDI_ERROR
;
514 NTSTATUS Status
= STATUS_SUCCESS
;
520 ProbeForRead(Buffer
, Size
, 1);
522 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
524 Status
= _SEH2_GetExceptionCode();
529 if (!NT_SUCCESS(Status
)) return Result
;
534 EngSetLastError(ERROR_INVALID_HANDLE
);
537 pdcattr
= Dc
->pdcattr
;
539 hFont
= pdcattr
->hlfntNew
;
540 TextObj
= RealizeFontInit(hFont
);
545 EngSetLastError(ERROR_INVALID_HANDLE
);
549 FontGdi
= ObjToGDI(TextObj
->Font
, FONT
);
551 Result
= ftGdiGetFontData(FontGdi
, Table
, Offset
, Buffer
, Size
);
553 TEXTOBJ_UnlockText(TextObj
);
563 NtGdiGetFontUnicodeRanges(
565 OUT OPTIONAL LPGLYPHSET pgs
)
574 NTSTATUS Status
= STATUS_SUCCESS
;
576 pDc
= DC_LockDc(hdc
);
579 EngSetLastError(ERROR_INVALID_HANDLE
);
583 pdcattr
= pDc
->pdcattr
;
585 hFont
= pdcattr
->hlfntNew
;
586 TextObj
= RealizeFontInit(hFont
);
588 if ( TextObj
== NULL
)
590 EngSetLastError(ERROR_INVALID_HANDLE
);
593 FontGdi
= ObjToGDI(TextObj
->Font
, FONT
);
595 Size
= ftGetFontUnicodeRanges( FontGdi
, NULL
);
599 pgsSafe
= ExAllocatePoolWithTag(PagedPool
, Size
, GDITAG_TEXT
);
602 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
607 Size
= ftGetFontUnicodeRanges( FontGdi
, pgsSafe
);
613 ProbeForWrite(pgs
, Size
, 1);
614 RtlCopyMemory(pgs
, pgsSafe
, Size
);
616 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
618 Status
= _SEH2_GetExceptionCode();
622 if (!NT_SUCCESS(Status
)) Size
= 0;
624 ExFreePoolWithTag(pgsSafe
, GDITAG_TEXT
);
627 TEXTOBJ_UnlockText(TextObj
);
634 NtGdiGetGlyphOutline(
638 OUT LPGLYPHMETRICS pgm
,
640 OUT OPTIONAL PVOID UnsafeBuf
,
642 IN BOOL bIgnoreRotation
)
644 ULONG Ret
= GDI_ERROR
;
648 NTSTATUS Status
= STATUS_SUCCESS
;
653 EngSetLastError(ERROR_INVALID_HANDLE
);
657 if (UnsafeBuf
&& cjBuf
)
659 pvBuf
= ExAllocatePoolWithTag(PagedPool
, cjBuf
, GDITAG_TEXT
);
662 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
667 Ret
= ftGdiGetGlyphOutline( dc
,
680 ProbeForWrite(UnsafeBuf
, cjBuf
, 1);
681 RtlCopyMemory(UnsafeBuf
, pvBuf
, cjBuf
);
683 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
685 Status
= _SEH2_GetExceptionCode();
689 ExFreePoolWithTag(pvBuf
, GDITAG_TEXT
);
696 ProbeForWrite(pgm
, sizeof(GLYPHMETRICS
), 1);
697 RtlCopyMemory(pgm
, &gm
, sizeof(GLYPHMETRICS
));
699 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
701 Status
= _SEH2_GetExceptionCode();
706 if (! NT_SUCCESS(Status
))
708 EngSetLastError(ERROR_INVALID_PARAMETER
);
719 NtGdiGetKerningPairs(HDC hDC
,
721 LPKERNINGPAIR krnpair
)
729 NTSTATUS Status
= STATUS_SUCCESS
;
734 EngSetLastError(ERROR_INVALID_HANDLE
);
738 pdcattr
= dc
->pdcattr
;
739 TextObj
= RealizeFontInit(pdcattr
->hlfntNew
);
744 EngSetLastError(ERROR_INVALID_HANDLE
);
748 FontGDI
= ObjToGDI(TextObj
->Font
, FONT
);
749 TEXTOBJ_UnlockText(TextObj
);
751 Count
= ftGdiGetKerningPairs(FontGDI
,0,NULL
);
753 if ( Count
&& krnpair
)
755 if (Count
> NumPairs
)
757 EngSetLastError(ERROR_INSUFFICIENT_BUFFER
);
760 pKP
= ExAllocatePoolWithTag(PagedPool
, Count
* sizeof(KERNINGPAIR
), GDITAG_TEXT
);
763 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
766 ftGdiGetKerningPairs(FontGDI
,Count
,pKP
);
769 ProbeForWrite(krnpair
, Count
* sizeof(KERNINGPAIR
), 1);
770 RtlCopyMemory(krnpair
, pKP
, Count
* sizeof(KERNINGPAIR
));
772 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
774 Status
= _SEH2_GetExceptionCode();
777 if (!NT_SUCCESS(Status
))
779 EngSetLastError(ERROR_INVALID_PARAMETER
);
782 ExFreePoolWithTag(pKP
,GDITAG_TEXT
);
788 From "Undocumented Windows 2000 Secrets" Appendix B, Table B-2, page
789 472, this is NtGdiGetOutlineTextMetricsInternalW.
793 NtGdiGetOutlineTextMetricsInternalW (HDC hDC
,
795 OUTLINETEXTMETRICW
*otm
,
804 OUTLINETEXTMETRICW
*potm
;
805 NTSTATUS Status
= STATUS_SUCCESS
;
810 EngSetLastError(ERROR_INVALID_HANDLE
);
813 pdcattr
= dc
->pdcattr
;
814 hFont
= pdcattr
->hlfntNew
;
815 TextObj
= RealizeFontInit(hFont
);
819 EngSetLastError(ERROR_INVALID_HANDLE
);
822 FontGDI
= ObjToGDI(TextObj
->Font
, FONT
);
823 TEXTOBJ_UnlockText(TextObj
);
824 Size
= IntGetOutlineTextMetrics(FontGDI
, 0, NULL
);
825 if (!otm
) return Size
;
828 EngSetLastError(ERROR_INSUFFICIENT_BUFFER
);
831 potm
= ExAllocatePoolWithTag(PagedPool
, Size
, GDITAG_TEXT
);
834 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
837 IntGetOutlineTextMetrics(FontGDI
, Size
, potm
);
842 ProbeForWrite(otm
, Size
, 1);
843 RtlCopyMemory(otm
, potm
, Size
);
845 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
847 Status
= _SEH2_GetExceptionCode();
851 if (!NT_SUCCESS(Status
))
853 EngSetLastError(ERROR_INVALID_PARAMETER
);
857 ExFreePoolWithTag(potm
,GDITAG_TEXT
);
864 NtGdiGetFontResourceInfoInternalW(
869 OUT LPDWORD pdwBytes
,
873 NTSTATUS Status
= STATUS_SUCCESS
;
875 UNICODE_STRING SafeFileNames
;
882 WCHAR FullName
[LF_FULLFACESIZE
];
885 /* FIXME: Handle cFiles > 0 */
887 /* Check for valid dwType values
888 dwType == 4 seems to be handled by gdi32 only */
889 if (dwType
== 4 || dwType
> 5)
891 EngSetLastError(ERROR_INVALID_PARAMETER
);
895 /* Allocate a safe unicode string buffer */
896 cbStringSize
= cwc
* sizeof(WCHAR
);
897 SafeFileNames
.MaximumLength
= SafeFileNames
.Length
= (USHORT
)cbStringSize
- sizeof(WCHAR
);
898 SafeFileNames
.Buffer
= ExAllocatePoolWithTag(PagedPool
,
901 if (!SafeFileNames
.Buffer
)
903 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
907 /* Check buffers and copy pwszFiles to safe unicode string */
910 ProbeForRead(pwszFiles
, cbStringSize
, 1);
911 ProbeForWrite(pdwBytes
, sizeof(DWORD
), 1);
912 ProbeForWrite(pvBuf
, cjIn
, 1);
914 RtlCopyMemory(SafeFileNames
.Buffer
, pwszFiles
, cbStringSize
);
916 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
918 Status
= _SEH2_GetExceptionCode();
922 if(!NT_SUCCESS(Status
))
924 SetLastNtError(Status
);
925 /* Free the string buffer for the safe filename */
926 ExFreePoolWithTag(SafeFileNames
.Buffer
,'RTSU');
930 /* Do the actual call */
931 bRet
= IntGdiGetFontResourceInfo(&SafeFileNames
, &Buffer
, &dwBytes
, dwType
);
933 /* Check if succeeded and the buffer is big enough */
934 if (bRet
&& cjIn
>= dwBytes
)
936 /* Copy the data back to caller */
939 /* Buffers are already probed */
940 RtlCopyMemory(pvBuf
, &Buffer
, dwBytes
);
943 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
945 Status
= _SEH2_GetExceptionCode();
949 if(!NT_SUCCESS(Status
))
951 SetLastNtError(Status
);
956 /* Free the string for the safe filenames */
957 ExFreePoolWithTag(SafeFileNames
.Buffer
,'RTSU');
967 NtGdiGetRealizationInfo(
969 OUT PREALIZATION_INFO pri
,
980 pDc
= DC_LockDc(hdc
);
983 EngSetLastError(ERROR_INVALID_HANDLE
);
986 pdcattr
= pDc
->pdcattr
;
987 pTextObj
= RealizeFontInit(pdcattr
->hlfntNew
);
988 pFontGdi
= ObjToGDI(pTextObj
->Font
, FONT
);
989 TEXTOBJ_UnlockText(pTextObj
);
992 Ret
= ftGdiRealizationInfo(pFontGdi
, &ri
);
997 NTSTATUS Status
= STATUS_SUCCESS
;
1000 ProbeForWrite(pri
, sizeof(REALIZATION_INFO
), 1);
1001 RtlCopyMemory(pri
, &ri
, sizeof(REALIZATION_INFO
));
1003 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
1005 Status
= _SEH2_GetExceptionCode();
1009 if(!NT_SUCCESS(Status
))
1011 SetLastNtError(Status
);
1017 if (GdiHandleTable
->cfPublic
[i
].hf
== hf
)
1019 GdiHandleTable
->cfPublic
[i
].iTechnology
= ri
.iTechnology
;
1020 GdiHandleTable
->cfPublic
[i
].iUniq
= ri
.iUniq
;
1021 GdiHandleTable
->cfPublic
[i
].dwUnknown
= ri
.dwUnknown
;
1022 GdiHandleTable
->cfPublic
[i
].dwCFCount
= GdiHandleTable
->dwCFCount
;
1023 GdiHandleTable
->cfPublic
[i
].fl
|= CFONT_REALIZATION
;
1027 while ( i
< GDI_CFONT_MAX
);
1036 IN PENUMLOGFONTEXDVW pelfw
,
1040 IN PVOID pvCliData
)
1050 plfont
= LFONT_AllocFontWithHandle();
1055 hNewFont
= plfont
->BaseObject
.hHmgr
;
1059 RtlCopyMemory (&plfont
->logfont
, pelfw
, sizeof(ENUMLOGFONTEXDVW
));
1060 ExInitializePushLock(&plfont
->lock
);
1062 if (pelfw
->elfEnumLogfontEx
.elfLogFont
.lfEscapement
!=
1063 pelfw
->elfEnumLogfontEx
.elfLogFont
.lfOrientation
)
1065 /* This should really depend on whether GM_ADVANCED is set */
1066 plfont
->logfont
.elfEnumLogfontEx
.elfLogFont
.lfOrientation
=
1067 plfont
->logfont
.elfEnumLogfontEx
.elfLogFont
.lfEscapement
;
1069 LFONT_UnlockFont(plfont
);
1071 if (pvCliData
&& hNewFont
)
1073 // FIXME: Use GDIOBJ_InsertUserData
1074 KeEnterCriticalRegion();
1076 INT Index
= GDI_HANDLE_GET_INDEX((HGDIOBJ
)hNewFont
);
1077 PGDI_TABLE_ENTRY Entry
= &GdiHandleTable
->Entries
[Index
];
1078 Entry
->UserData
= pvCliData
;
1080 KeLeaveCriticalRegion();
1090 IN PENUMLOGFONTEXDVW pelfw
,
1094 IN PVOID pvCliData
)
1096 ENUMLOGFONTEXDVW SafeLogfont
;
1097 NTSTATUS Status
= STATUS_SUCCESS
;
1099 /* Silence GCC warnings */
1100 SafeLogfont
.elfEnumLogfontEx
.elfLogFont
.lfEscapement
= 0;
1101 SafeLogfont
.elfEnumLogfontEx
.elfLogFont
.lfOrientation
= 0;
1110 ProbeForRead(pelfw
, sizeof(ENUMLOGFONTEXDVW
), 1);
1111 RtlCopyMemory(&SafeLogfont
, pelfw
, sizeof(ENUMLOGFONTEXDVW
));
1113 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
1115 Status
= _SEH2_GetExceptionCode();
1119 if (!NT_SUCCESS(Status
))
1124 return HfontCreate(&SafeLogfont
, cjElfw
, lft
, fl
, pvCliData
);