Fix LOGFONT conversion in CreateFontIndirectA()

svn path=/trunk/; revision=8892
This commit is contained in:
Gé van Geldorp 2004-03-27 21:07:33 +00:00
parent 014d8e9588
commit ac44e25672
3 changed files with 8 additions and 17 deletions

View file

@ -7,10 +7,10 @@ extern "C"
#endif #endif
void void
RosRtlLogFontA2W ( LPLOGFONTW pW, const LPLOGFONTA pA ); RosRtlLogFontA2W ( LPLOGFONTW pW, const LOGFONTA *pA );
void void
RosRtlLogFontW2A ( LPLOGFONTA pA, const LPLOGFONTW pW ); RosRtlLogFontW2A ( LPLOGFONTA pA, const LOGFONTW *pW );
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -8,6 +8,7 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <win32k/kapi.h> #include <win32k/kapi.h>
#include <internal/font.h> #include <internal/font.h>
#include <rosrtl/logfont.h>
/* /*
@ -260,21 +261,11 @@ CreateFontIndirectA(
CONST LOGFONTA *lf CONST LOGFONTA *lf
) )
{ {
ANSI_STRING StringA; LOGFONTW tlf;
UNICODE_STRING StringU;
HFONT ret;
LOGFONTW tlf;
RtlInitAnsiString(&StringA, (LPSTR)lf->lfFaceName); RosRtlLogFontA2W(&tlf, lf);
RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
memcpy(&tlf, lf, sizeof(LOGFONTA));
memcpy(&tlf.lfFaceName, &StringU.Buffer, StringU.Length);
ret = CreateFontIndirectW(&tlf); return NtGdiCreateFontIndirect(&tlf);
RtlFreeUnicodeString(&StringU);
return ret;
} }

View file

@ -3,7 +3,7 @@
#include <rosrtl/logfont.h> #include <rosrtl/logfont.h>
void void
RosRtlLogFontA2W ( LPLOGFONTW pW, const LPLOGFONTA pA ) RosRtlLogFontA2W ( LPLOGFONTW pW, const LOGFONTA *pA )
{ {
#define COPYS(f,len) MultiByteToWideChar ( CP_THREAD_ACP, 0, pA->f, len, pW->f, len ) #define COPYS(f,len) MultiByteToWideChar ( CP_THREAD_ACP, 0, pA->f, len, pW->f, len )
#define COPYN(f) pW->f = pA->f #define COPYN(f) pW->f = pA->f
@ -28,7 +28,7 @@ RosRtlLogFontA2W ( LPLOGFONTW pW, const LPLOGFONTA pA )
} }
void void
RosRtlLogFontW2A ( LPLOGFONTA pA, const LPLOGFONTW pW ) RosRtlLogFontW2A ( LPLOGFONTA pA, const LOGFONTW *pW )
{ {
#define COPYS(f,len) WideCharToMultiByte ( CP_THREAD_ACP, 0, pW->f, len, pA->f, len, NULL, NULL ) #define COPYS(f,len) WideCharToMultiByte ( CP_THREAD_ACP, 0, pW->f, len, pA->f, len, NULL, NULL )
#define COPYN(f) pA->f = pW->f #define COPYN(f) pA->f = pW->f