- Implement GetCharWidthA/W()

- Fix memory overwrite in NtGdiGetCharWidth32()
Fixes bug #258

svn path=/trunk/; revision=8845
This commit is contained in:
Gé van Geldorp 2004-03-23 07:59:47 +00:00
parent c718f507e9
commit 75543614da
6 changed files with 73 additions and 91 deletions

View file

@ -104,7 +104,6 @@ NtGdiGetBrushOrgEx 2
NtGdiGetCharABCWidths 4
NtGdiGetCharABCWidthsFloat 4
NtGdiGetCharacterPlacement 6
NtGdiGetCharWidth 4
NtGdiGetCharWidth32 4
NtGdiGetCharWidthFloat 4
NtGdiGetClipBox 2

View file

@ -99,13 +99,6 @@ NtGdiGetCharacterPlacement(HDC hDC,
LPGCP_RESULTSW Results,
DWORD Flags);
BOOL
STDCALL
NtGdiGetCharWidth(HDC hDC,
UINT FirstChar,
UINT LastChar,
LPINT Buffer);
BOOL
STDCALL
NtGdiGetCharWidth32(HDC hDC,

View file

@ -1,4 +1,4 @@
/* $Id: stubsa.c,v 1.28 2004/03/23 00:18:54 gvg Exp $
/* $Id: stubsa.c,v 1.29 2004/03/23 07:59:47 gvg Exp $
*
* reactos/lib/gdi32/misc/stubs.c
*
@ -208,40 +208,6 @@ EnumFontsA (
}
/*
* @unimplemented
*/
BOOL
STDCALL
GetCharWidthA (
HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer
)
{
/* FIXME what to do with iFirstChar and iLastChar ??? */
return NtGdiGetCharWidth ( hdc, iFirstChar, iLastChar, lpBuffer );
}
/*
* @unimplemented
*/
BOOL
STDCALL
GetCharWidth32A(
HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer
)
{
/* FIXME what to do with iFirstChar and iLastChar ??? */
return NtGdiGetCharWidth32 ( hdc, iFirstChar, iLastChar, lpBuffer );
}
/*
* @unimplemented
*/

View file

@ -1,4 +1,4 @@
/* $Id: stubsw.c,v 1.25 2004/03/23 00:18:54 gvg Exp $
/* $Id: stubsw.c,v 1.26 2004/03/23 07:59:47 gvg Exp $
*
* reactos/lib/gdi32/misc/stubs.c
*
@ -133,38 +133,6 @@ EnumFontsW(
}
/*
* @implemented
*/
BOOL
STDCALL
GetCharWidthW (
HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer
)
{
return NtGdiGetCharWidth ( hdc, iFirstChar, iLastChar, lpBuffer );
}
/*
* @implemented
*/
BOOL
STDCALL
GetCharWidth32W(
HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer
)
{
return NtGdiGetCharWidth32 ( hdc, iFirstChar, iLastChar, lpBuffer );
}
/*
* @implemented
*/

View file

@ -1,4 +1,4 @@
/* $Id: font.c,v 1.1 2004/03/23 00:18:54 gvg Exp $
/* $Id: font.c,v 1.2 2004/03/23 07:59:47 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -15,6 +15,7 @@
#include <windows.h>
#include <rosrtl/logfont.h>
#include <win32k/font.h>
#include <win32k/text.h>
#include <internal/font.h>
#define NDEBUG
@ -330,3 +331,69 @@ EnumFontFamiliesA(HDC Dc, LPCSTR Family, FONTENUMPROCA EnumFontFamProc,
return IntEnumFontFamilies(Dc, &LogFont, EnumFontFamProc, lParam, FALSE);
}
/*
* @implemented
*/
BOOL
STDCALL
GetCharWidthA (
HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer
)
{
/* FIXME what to do with iFirstChar and iLastChar ??? */
return NtGdiGetCharWidth32 ( hdc, iFirstChar, iLastChar, lpBuffer );
}
/*
* @implemented
*/
BOOL
STDCALL
GetCharWidth32A(
HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer
)
{
/* FIXME what to do with iFirstChar and iLastChar ??? */
return NtGdiGetCharWidth32 ( hdc, iFirstChar, iLastChar, lpBuffer );
}
/*
* @implemented
*/
BOOL
STDCALL
GetCharWidthW (
HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer
)
{
return NtGdiGetCharWidth32 ( hdc, iFirstChar, iLastChar, lpBuffer );
}
/*
* @implemented
*/
BOOL
STDCALL
GetCharWidth32W(
HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer
)
{
return NtGdiGetCharWidth32 ( hdc, iFirstChar, iLastChar, lpBuffer );
}

View file

@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: text.c,v 1.82 2004/03/23 00:18:54 gvg Exp $ */
/* $Id: text.c,v 1.83 2004/03/23 07:59:47 gvg Exp $ */
#undef WIN32_LEAN_AND_MEAN
@ -1892,17 +1892,6 @@ NtGdiGetCharacterPlacement(HDC hDC,
UNIMPLEMENTED;
}
BOOL
STDCALL
NtGdiGetCharWidth(HDC hDC,
UINT FirstChar,
UINT LastChar,
LPINT Buffer)
{
DPRINT1("NtGdiGetCharWidth isnt really unimplemented - keep going anyway\n");
return 1;
}
BOOL
STDCALL
NtGdiGetCharWidth32(HDC hDC,
@ -1924,7 +1913,7 @@ NtGdiGetCharWidth32(HDC hDC,
return FALSE;
}
BufferSize = (LastChar - FirstChar) * sizeof(INT);
BufferSize = (LastChar - FirstChar + 1) * sizeof(INT);
SafeBuffer = ExAllocatePoolWithTag(PagedPool, BufferSize, TAG_GDITEXT);
if (SafeBuffer == NULL)
{
@ -1982,7 +1971,7 @@ NtGdiGetCharWidth32(HDC hDC,
{
glyph_index = FT_Get_Char_Index(face, i);
FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
SafeBuffer[i] = face->glyph->advance.x >> 6;
SafeBuffer[i - FirstChar] = face->glyph->advance.x >> 6;
}
IntUnLockFreeType;
TEXTOBJ_UnlockText(dc->w.hFont);