From 07767bfd28ba6fc3a2e6a8af2e9fd76a4e9f3864 Mon Sep 17 00:00:00 2001 From: Jeff Latimer Date: Wed, 19 Apr 2006 19:20:50 +1000 Subject: [PATCH] gdi: Added implementation of GetCharABCWidthsI. --- dlls/gdi/font.c | 49 ++++++++++++++++++++++++++++++++++++++++++ dlls/gdi/freetype.c | 38 ++++++++++++++++++++++++++++++++ dlls/gdi/gdi32.spec | 2 +- dlls/gdi/gdi_private.h | 2 ++ include/wingdi.h | 1 + 5 files changed, 91 insertions(+), 1 deletion(-) diff --git a/dlls/gdi/font.c b/dlls/gdi/font.c index adc7e97f86b..7d8782a1cf5 100644 --- a/dlls/gdi/font.c +++ b/dlls/gdi/font.c @@ -2358,6 +2358,55 @@ BOOL WINAPI GetCharABCWidthsW( HDC hdc, UINT firstChar, UINT lastChar, } +/****************************************************************************** + * GetCharABCWidthsI [GDI32.@] + * + * Retrieves widths of characters in range. + * + * PARAMS + * hdc [I] Handle of device context + * firstChar [I] First glyphs in range to query + * count [I] Last glyphs in range to query + * pgi [i] Array of glyphs to query + * abc [O] Address of character-width structure + * + * NOTES + * Only works with TrueType fonts + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ +BOOL WINAPI GetCharABCWidthsI( HDC hdc, UINT firstChar, UINT count, + LPWORD pgi, LPABC abc) +{ + DC *dc = DC_GetDCPtr(hdc); + unsigned int i; + BOOL ret = FALSE; + + if (!dc) return FALSE; + + if(dc->gdiFont) + ret = WineEngGetCharABCWidthsI( dc->gdiFont, firstChar, count, pgi, abc ); + else + FIXME(": stub\n"); + + if (ret) + { + /* convert device units to logical */ + for( i = firstChar; i <= count; i++, abc++ ) { + abc->abcA = INTERNAL_XDSTOWS(dc, abc->abcA); + abc->abcB = INTERNAL_XDSTOWS(dc, abc->abcB); + abc->abcC = INTERNAL_XDSTOWS(dc, abc->abcC); + } + ret = TRUE; + } + + GDI_ReleaseObj(hdc); + return ret; +} + + /*********************************************************************** * GetGlyphOutlineA (GDI32.@) */ diff --git a/dlls/gdi/freetype.c b/dlls/gdi/freetype.c index c0da05f1981..9546986ca24 100644 --- a/dlls/gdi/freetype.c +++ b/dlls/gdi/freetype.c @@ -3808,6 +3808,44 @@ BOOL WineEngGetCharABCWidths(GdiFont font, UINT firstChar, UINT lastChar, return TRUE; } +/************************************************************* + * WineEngGetCharABCWidthsI + * + */ +BOOL WineEngGetCharABCWidthsI(GdiFont font, UINT firstChar, UINT count, LPWORD pgi, + LPABC buffer) +{ + UINT c; + GLYPHMETRICS gm; + FT_UInt glyph_index; + GdiFont linked_font; + + if(!FT_IS_SCALABLE(font->ft_face)) + return FALSE; + + get_glyph_index_linked(font, 'a', &linked_font, &glyph_index); + if (!pgi) + for(c = firstChar; c < firstChar+count; c++) { + WineEngGetGlyphOutline(linked_font, c, GGO_METRICS | GGO_GLYPH_INDEX, + &gm, 0, NULL, NULL); + buffer[c - firstChar].abcA = linked_font->gm[c].lsb; + buffer[c - firstChar].abcB = linked_font->gm[c].bbx; + buffer[c - firstChar].abcC = linked_font->gm[c].adv - linked_font->gm[c].lsb + - linked_font->gm[c].bbx; + } + else + for(c = 0; c < count; c++) { + WineEngGetGlyphOutline(linked_font, pgi[c], GGO_METRICS | GGO_GLYPH_INDEX, + &gm, 0, NULL, NULL); + buffer[c].abcA = linked_font->gm[pgi[c]].lsb; + buffer[c].abcB = linked_font->gm[pgi[c]].bbx; + buffer[c].abcC = linked_font->gm[pgi[c]].adv + - linked_font->gm[pgi[c]].lsb - linked_font->gm[pgi[c]].bbx; + } + + return TRUE; +} + /************************************************************* * WineEngGetTextExtentPoint * diff --git a/dlls/gdi/gdi32.spec b/dlls/gdi/gdi32.spec index c71adc63eea..59c748d2e09 100644 --- a/dlls/gdi/gdi32.spec +++ b/dlls/gdi/gdi32.spec @@ -237,7 +237,7 @@ @ stdcall GetCharABCWidthsA(long long long ptr) @ stdcall GetCharABCWidthsFloatA(long long long ptr) @ stdcall GetCharABCWidthsFloatW(long long long ptr) -# @ stub GetCharABCWidthsI +@ stdcall GetCharABCWidthsI(long long long ptr ptr) @ stdcall GetCharABCWidthsW(long long long ptr) @ stdcall GetCharWidth32A(long long long long) @ stdcall GetCharWidth32W(long long long long) diff --git a/dlls/gdi/gdi_private.h b/dlls/gdi/gdi_private.h index dc85d352546..dfdb0085fe1 100644 --- a/dlls/gdi/gdi_private.h +++ b/dlls/gdi/gdi_private.h @@ -367,6 +367,8 @@ extern BOOL WineEngDestroyFontInstance(HFONT handle); extern DWORD WineEngEnumFonts(LPLOGFONTW, FONTENUMPROCW, LPARAM); extern BOOL WineEngGetCharABCWidths(GdiFont font, UINT firstChar, UINT lastChar, LPABC buffer); +extern BOOL WineEngGetCharABCWidthsI(GdiFont font, UINT firstChar, + UINT count, LPWORD pgi, LPABC buffer); extern BOOL WineEngGetCharWidth(GdiFont, UINT, UINT, LPINT); extern DWORD WineEngGetFontData(GdiFont, DWORD, DWORD, LPVOID, DWORD); extern DWORD WineEngGetGlyphIndices(GdiFont font, LPCWSTR lpstr, INT count, diff --git a/include/wingdi.h b/include/wingdi.h index b4ea1b57df1..9375ff9153b 100644 --- a/include/wingdi.h +++ b/include/wingdi.h @@ -3394,6 +3394,7 @@ BOOL WINAPI GetCharABCWidthsW(HDC,UINT,UINT,LPABC); BOOL WINAPI GetCharABCWidthsFloatA(HDC,UINT,UINT,LPABCFLOAT); BOOL WINAPI GetCharABCWidthsFloatW(HDC,UINT,UINT,LPABCFLOAT); #define GetCharABCWidthsFloat WINELIB_NAME_AW(GetCharABCWidthsFloat) +BOOL WINAPI GetCharABCWidthsI(HDC,UINT,UINT,LPWORD,LPABC); DWORD WINAPI GetCharacterPlacementA(HDC,LPCSTR,INT,INT,GCP_RESULTSA*,DWORD); DWORD WINAPI GetCharacterPlacementW(HDC,LPCWSTR,INT,INT,GCP_RESULTSW*,DWORD); #define GetCharacterPlacement WINELIB_NAME_AW(GetCharacterPlacement)