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
);
400 GreSelectFont( HDC hDC
, HFONT hFont
)
404 PTEXTOBJ pOrgFnt
, pNewFnt
= NULL
;
405 HFONT hOrgFont
= NULL
;
407 if (!hDC
|| !hFont
) return NULL
;
409 pdc
= DC_LockDc(hDC
);
415 if (NT_SUCCESS(TextIntRealizeFont((HFONT
)hFont
,NULL
)))
417 /* LFONTOBJ use share and locking. */
418 pNewFnt
= TEXTOBJ_LockText(hFont
);
419 pdcattr
= pdc
->pdcattr
;
420 pOrgFnt
= pdc
->dclevel
.plfnt
;
423 hOrgFont
= pOrgFnt
->BaseObject
.hHmgr
;
427 hOrgFont
= pdcattr
->hlfntNew
;
429 pdc
->dclevel
.plfnt
= pNewFnt
;
430 pdc
->hlfntCur
= hFont
;
431 pdcattr
->hlfntNew
= hFont
;
432 pdcattr
->ulDirty_
|= DIRTY_CHARSET
;
433 pdcattr
->ulDirty_
&= ~SLOW_WIDTHS
;
436 if (pNewFnt
) TEXTOBJ_UnlockText(pNewFnt
);
441 /** Functions ******************************************************************/
445 NtGdiAddFontResourceW(
451 IN OPTIONAL DESIGNVECTOR
*pdv
)
453 UNICODE_STRING SafeFileName
;
458 /* FIXME: Protect with SEH? */
459 RtlInitUnicodeString(&SafeFileName
, pwszFiles
);
461 /* Reserve for prepending '\??\' */
462 SafeFileName
.Length
+= 4 * sizeof(WCHAR
);
463 SafeFileName
.MaximumLength
+= 4 * sizeof(WCHAR
);
465 src
= SafeFileName
.Buffer
;
466 SafeFileName
.Buffer
= (PWSTR
)ExAllocatePoolWithTag(PagedPool
, SafeFileName
.MaximumLength
, TAG_STRING
);
467 if(!SafeFileName
.Buffer
)
469 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
474 RtlCopyMemory(SafeFileName
.Buffer
, L
"\\??\\", 4 * sizeof(WCHAR
));
476 Status
= MmCopyFromCaller(SafeFileName
.Buffer
+ 4, src
, SafeFileName
.MaximumLength
- (4 * sizeof(WCHAR
)));
477 if(!NT_SUCCESS(Status
))
479 ExFreePoolWithTag(SafeFileName
.Buffer
, TAG_STRING
);
480 SetLastNtError(Status
);
484 Ret
= IntGdiAddFontResource(&SafeFileName
, (DWORD
)fl
);
486 ExFreePoolWithTag(SafeFileName
.Buffer
, TAG_STRING
);
495 NtGdiGetCharacterPlacementW(
500 IN OUT LPGCP_RESULTSW pgcpw
,
506 return GreGetCharacterPlacementW( hdc
,
529 DWORD Result
= GDI_ERROR
;
530 NTSTATUS Status
= STATUS_SUCCESS
;
536 ProbeForRead(Buffer
, Size
, 1);
538 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
540 Status
= _SEH2_GetExceptionCode();
545 if (!NT_SUCCESS(Status
)) return Result
;
550 EngSetLastError(ERROR_INVALID_HANDLE
);
553 pdcattr
= Dc
->pdcattr
;
555 hFont
= pdcattr
->hlfntNew
;
556 TextObj
= RealizeFontInit(hFont
);
561 EngSetLastError(ERROR_INVALID_HANDLE
);
565 FontGdi
= ObjToGDI(TextObj
->Font
, FONT
);
567 Result
= ftGdiGetFontData(FontGdi
, Table
, Offset
, Buffer
, Size
);
569 TEXTOBJ_UnlockText(TextObj
);
579 NtGdiGetFontUnicodeRanges(
581 OUT OPTIONAL LPGLYPHSET pgs
)
590 NTSTATUS Status
= STATUS_SUCCESS
;
592 pDc
= DC_LockDc(hdc
);
595 EngSetLastError(ERROR_INVALID_HANDLE
);
599 pdcattr
= pDc
->pdcattr
;
601 hFont
= pdcattr
->hlfntNew
;
602 TextObj
= RealizeFontInit(hFont
);
604 if ( TextObj
== NULL
)
606 EngSetLastError(ERROR_INVALID_HANDLE
);
609 FontGdi
= ObjToGDI(TextObj
->Font
, FONT
);
611 Size
= ftGetFontUnicodeRanges( FontGdi
, NULL
);
615 pgsSafe
= ExAllocatePoolWithTag(PagedPool
, Size
, GDITAG_TEXT
);
618 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
623 Size
= ftGetFontUnicodeRanges( FontGdi
, pgsSafe
);
629 ProbeForWrite(pgs
, Size
, 1);
630 RtlCopyMemory(pgs
, pgsSafe
, Size
);
632 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
634 Status
= _SEH2_GetExceptionCode();
638 if (!NT_SUCCESS(Status
)) Size
= 0;
640 ExFreePoolWithTag(pgsSafe
, GDITAG_TEXT
);
643 TEXTOBJ_UnlockText(TextObj
);
650 NtGdiGetGlyphOutline(
654 OUT LPGLYPHMETRICS pgm
,
656 OUT OPTIONAL PVOID UnsafeBuf
,
658 IN BOOL bIgnoreRotation
)
660 ULONG Ret
= GDI_ERROR
;
664 NTSTATUS Status
= STATUS_SUCCESS
;
669 EngSetLastError(ERROR_INVALID_HANDLE
);
673 if (UnsafeBuf
&& cjBuf
)
675 pvBuf
= ExAllocatePoolWithTag(PagedPool
, cjBuf
, GDITAG_TEXT
);
678 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
683 Ret
= ftGdiGetGlyphOutline( dc
,
696 ProbeForWrite(UnsafeBuf
, cjBuf
, 1);
697 RtlCopyMemory(UnsafeBuf
, pvBuf
, cjBuf
);
699 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
701 Status
= _SEH2_GetExceptionCode();
705 ExFreePoolWithTag(pvBuf
, GDITAG_TEXT
);
712 ProbeForWrite(pgm
, sizeof(GLYPHMETRICS
), 1);
713 RtlCopyMemory(pgm
, &gm
, sizeof(GLYPHMETRICS
));
715 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
717 Status
= _SEH2_GetExceptionCode();
722 if (! NT_SUCCESS(Status
))
724 EngSetLastError(ERROR_INVALID_PARAMETER
);
735 NtGdiGetKerningPairs(HDC hDC
,
737 LPKERNINGPAIR krnpair
)
745 NTSTATUS Status
= STATUS_SUCCESS
;
750 EngSetLastError(ERROR_INVALID_HANDLE
);
754 pdcattr
= dc
->pdcattr
;
755 TextObj
= RealizeFontInit(pdcattr
->hlfntNew
);
760 EngSetLastError(ERROR_INVALID_HANDLE
);
764 FontGDI
= ObjToGDI(TextObj
->Font
, FONT
);
765 TEXTOBJ_UnlockText(TextObj
);
767 Count
= ftGdiGetKerningPairs(FontGDI
,0,NULL
);
769 if ( Count
&& krnpair
)
771 if (Count
> NumPairs
)
773 EngSetLastError(ERROR_INSUFFICIENT_BUFFER
);
776 pKP
= ExAllocatePoolWithTag(PagedPool
, Count
* sizeof(KERNINGPAIR
), GDITAG_TEXT
);
779 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
782 ftGdiGetKerningPairs(FontGDI
,Count
,pKP
);
785 ProbeForWrite(krnpair
, Count
* sizeof(KERNINGPAIR
), 1);
786 RtlCopyMemory(krnpair
, pKP
, Count
* sizeof(KERNINGPAIR
));
788 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
790 Status
= _SEH2_GetExceptionCode();
793 if (!NT_SUCCESS(Status
))
795 EngSetLastError(ERROR_INVALID_PARAMETER
);
798 ExFreePoolWithTag(pKP
,GDITAG_TEXT
);
804 From "Undocumented Windows 2000 Secrets" Appendix B, Table B-2, page
805 472, this is NtGdiGetOutlineTextMetricsInternalW.
809 NtGdiGetOutlineTextMetricsInternalW (HDC hDC
,
811 OUTLINETEXTMETRICW
*otm
,
820 OUTLINETEXTMETRICW
*potm
;
821 NTSTATUS Status
= STATUS_SUCCESS
;
826 EngSetLastError(ERROR_INVALID_HANDLE
);
829 pdcattr
= dc
->pdcattr
;
830 hFont
= pdcattr
->hlfntNew
;
831 TextObj
= RealizeFontInit(hFont
);
835 EngSetLastError(ERROR_INVALID_HANDLE
);
838 FontGDI
= ObjToGDI(TextObj
->Font
, FONT
);
839 TEXTOBJ_UnlockText(TextObj
);
840 Size
= IntGetOutlineTextMetrics(FontGDI
, 0, NULL
);
841 if (!otm
) return Size
;
844 EngSetLastError(ERROR_INSUFFICIENT_BUFFER
);
847 potm
= ExAllocatePoolWithTag(PagedPool
, Size
, GDITAG_TEXT
);
850 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
853 IntGetOutlineTextMetrics(FontGDI
, Size
, potm
);
858 ProbeForWrite(otm
, Size
, 1);
859 RtlCopyMemory(otm
, potm
, Size
);
861 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
863 Status
= _SEH2_GetExceptionCode();
867 if (!NT_SUCCESS(Status
))
869 EngSetLastError(ERROR_INVALID_PARAMETER
);
873 ExFreePoolWithTag(potm
,GDITAG_TEXT
);
880 NtGdiGetFontResourceInfoInternalW(
885 OUT LPDWORD pdwBytes
,
889 NTSTATUS Status
= STATUS_SUCCESS
;
891 UNICODE_STRING SafeFileNames
;
898 WCHAR FullName
[LF_FULLFACESIZE
];
901 /* FIXME: Handle cFiles > 0 */
903 /* Check for valid dwType values
904 dwType == 4 seems to be handled by gdi32 only */
905 if (dwType
== 4 || dwType
> 5)
907 EngSetLastError(ERROR_INVALID_PARAMETER
);
911 /* Allocate a safe unicode string buffer */
912 cbStringSize
= cwc
* sizeof(WCHAR
);
913 SafeFileNames
.MaximumLength
= SafeFileNames
.Length
= (USHORT
)cbStringSize
- sizeof(WCHAR
);
914 SafeFileNames
.Buffer
= ExAllocatePoolWithTag(PagedPool
,
917 if (!SafeFileNames
.Buffer
)
919 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
923 /* Check buffers and copy pwszFiles to safe unicode string */
926 ProbeForRead(pwszFiles
, cbStringSize
, 1);
927 ProbeForWrite(pdwBytes
, sizeof(DWORD
), 1);
928 ProbeForWrite(pvBuf
, cjIn
, 1);
930 RtlCopyMemory(SafeFileNames
.Buffer
, pwszFiles
, cbStringSize
);
932 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
934 Status
= _SEH2_GetExceptionCode();
938 if(!NT_SUCCESS(Status
))
940 SetLastNtError(Status
);
941 /* Free the string buffer for the safe filename */
942 ExFreePoolWithTag(SafeFileNames
.Buffer
,'RTSU');
946 /* Do the actual call */
947 bRet
= IntGdiGetFontResourceInfo(&SafeFileNames
, &Buffer
, &dwBytes
, dwType
);
949 /* Check if succeeded and the buffer is big enough */
950 if (bRet
&& cjIn
>= dwBytes
)
952 /* Copy the data back to caller */
955 /* Buffers are already probed */
956 RtlCopyMemory(pvBuf
, &Buffer
, dwBytes
);
959 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
961 Status
= _SEH2_GetExceptionCode();
965 if(!NT_SUCCESS(Status
))
967 SetLastNtError(Status
);
972 /* Free the string for the safe filenames */
973 ExFreePoolWithTag(SafeFileNames
.Buffer
,'RTSU');
983 NtGdiGetRealizationInfo(
985 OUT PREALIZATION_INFO pri
,
996 pDc
= DC_LockDc(hdc
);
999 EngSetLastError(ERROR_INVALID_HANDLE
);
1002 pdcattr
= pDc
->pdcattr
;
1003 pTextObj
= RealizeFontInit(pdcattr
->hlfntNew
);
1004 pFontGdi
= ObjToGDI(pTextObj
->Font
, FONT
);
1005 TEXTOBJ_UnlockText(pTextObj
);
1008 Ret
= ftGdiRealizationInfo(pFontGdi
, &ri
);
1013 NTSTATUS Status
= STATUS_SUCCESS
;
1016 ProbeForWrite(pri
, sizeof(REALIZATION_INFO
), 1);
1017 RtlCopyMemory(pri
, &ri
, sizeof(REALIZATION_INFO
));
1019 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
1021 Status
= _SEH2_GetExceptionCode();
1025 if(!NT_SUCCESS(Status
))
1027 SetLastNtError(Status
);
1033 if (GdiHandleTable
->cfPublic
[i
].hf
== hf
)
1035 GdiHandleTable
->cfPublic
[i
].iTechnology
= ri
.iTechnology
;
1036 GdiHandleTable
->cfPublic
[i
].iUniq
= ri
.iUniq
;
1037 GdiHandleTable
->cfPublic
[i
].dwUnknown
= ri
.dwUnknown
;
1038 GdiHandleTable
->cfPublic
[i
].dwCFCount
= GdiHandleTable
->dwCFCount
;
1039 GdiHandleTable
->cfPublic
[i
].fl
|= CFONT_REALIZATION
;
1043 while ( i
< GDI_CFONT_MAX
);
1051 IN PENUMLOGFONTEXDVW pelfw
,
1055 IN PVOID pvCliData
)
1057 ENUMLOGFONTEXDVW SafeLogfont
;
1060 NTSTATUS Status
= STATUS_SUCCESS
;
1062 /* Silence GCC warnings */
1063 SafeLogfont
.elfEnumLogfontEx
.elfLogFont
.lfEscapement
= 0;
1064 SafeLogfont
.elfEnumLogfontEx
.elfLogFont
.lfOrientation
= 0;
1073 ProbeForRead(pelfw
, sizeof(ENUMLOGFONTEXDVW
), 1);
1074 RtlCopyMemory(&SafeLogfont
, pelfw
, sizeof(ENUMLOGFONTEXDVW
));
1076 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
1078 Status
= _SEH2_GetExceptionCode();
1082 if (!NT_SUCCESS(Status
))
1087 plfont
= LFONT_AllocFontWithHandle();
1092 hNewFont
= plfont
->BaseObject
.hHmgr
;
1096 RtlCopyMemory (&plfont
->logfont
, &SafeLogfont
, sizeof(ENUMLOGFONTEXDVW
));
1097 ExInitializePushLock(&plfont
->lock
);
1099 if (SafeLogfont
.elfEnumLogfontEx
.elfLogFont
.lfEscapement
!=
1100 SafeLogfont
.elfEnumLogfontEx
.elfLogFont
.lfOrientation
)
1102 /* This should really depend on whether GM_ADVANCED is set */
1103 plfont
->logfont
.elfEnumLogfontEx
.elfLogFont
.lfOrientation
=
1104 plfont
->logfont
.elfEnumLogfontEx
.elfLogFont
.lfEscapement
;
1106 LFONT_UnlockFont(plfont
);
1108 if (pvCliData
&& hNewFont
)
1110 // FIXME: Use GDIOBJ_InsertUserData
1111 KeEnterCriticalRegion();
1113 INT Index
= GDI_HANDLE_GET_INDEX((HGDIOBJ
)hNewFont
);
1114 PGDI_TABLE_ENTRY Entry
= &GdiHandleTable
->Entries
[Index
];
1115 Entry
->UserData
= pvCliData
;
1117 KeLeaveCriticalRegion();
1132 return GreSelectFont(hDC
, hFont
);