[LPK] Diverse fixes (#622).

- Changed wcspy to strsafe function.
- Use GetCharWidthI instead of GetCharWidth32W if dealing with glyph indices.
This commit is contained in:
Baruch Rutman 2018-06-18 14:52:57 +03:00 committed by Hermès Bélusca-Maïto
parent 33d3e56cf4
commit 7fe6a14ede
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 4 additions and 3 deletions

View file

@ -145,7 +145,7 @@ LpkGetCharacterPlacement(
if (lpResults->lpGlyphs) if (lpResults->lpGlyphs)
{ {
if (lpGlyphs) if (lpGlyphs)
wcscpy(lpResults->lpGlyphs, lpGlyphs); StringCchCopyW(lpResults->lpGlyphs, cGlyphs, lpGlyphs);
else if (lpResults->lpOutString) else if (lpResults->lpOutString)
GetGlyphIndicesW(hdc, lpResults->lpOutString, nSet, lpResults->lpGlyphs, 0); GetGlyphIndicesW(hdc, lpResults->lpOutString, nSet, lpResults->lpGlyphs, 0);
@ -154,7 +154,7 @@ LpkGetCharacterPlacement(
if (lpResults->lpDx) if (lpResults->lpDx)
{ {
/* If glyph shaping was requested */ /* If glyph shaping was requested */
if(dwFlags & GCP_GLYPHSHAPE) if (dwFlags & GCP_GLYPHSHAPE)
{ {
int c; int c;
@ -162,7 +162,7 @@ LpkGetCharacterPlacement(
{ {
for (i = 0; i < lpResults->nGlyphs; i++) for (i = 0; i < lpResults->nGlyphs; i++)
{ {
if (GetCharWidth32W(hdc, lpResults->lpGlyphs[i], lpResults->lpGlyphs[i], &c)) if (GetCharWidthI(hdc, 0, 1, (WORD *)&lpResults->lpGlyphs[i], &c))
lpResults->lpDx[i] = c; lpResults->lpDx[i] = c;
} }
} }

View file

@ -17,6 +17,7 @@
#include <wingdi.h> #include <wingdi.h>
#include <winnls.h> #include <winnls.h>
#include <usp10.h> #include <usp10.h>
#include <strsafe.h>
/* FIXME USP10 api that does not have prototype in any include file */ /* FIXME USP10 api that does not have prototype in any include file */
VOID WINAPI LpkPresent(VOID); VOID WINAPI LpkPresent(VOID);