GetCharABCWidths returns the widths of unrotated glyphs like

GetCharWidth already does.
This commit is contained in:
Huw Davies 2004-02-12 20:05:47 +00:00 committed by Alexandre Julliard
parent 780667fe1e
commit 2cd9ee9528
3 changed files with 49 additions and 9 deletions

View File

@ -2376,6 +2376,31 @@ BOOL WineEngGetCharWidth(GdiFont font, UINT firstChar, UINT lastChar,
return TRUE; return TRUE;
} }
/*************************************************************
* WineEngGetCharABCWidths
*
*/
BOOL WineEngGetCharABCWidths(GdiFont font, UINT firstChar, UINT lastChar,
LPABC buffer)
{
UINT c;
GLYPHMETRICS gm;
FT_UInt glyph_index;
TRACE("%p, %d, %d, %p\n", font, firstChar, lastChar, buffer);
for(c = firstChar; c <= lastChar; c++) {
glyph_index = get_glyph_index(font, c);
WineEngGetGlyphOutline(font, glyph_index, GGO_METRICS | GGO_GLYPH_INDEX,
&gm, 0, NULL, NULL);
buffer[c - firstChar].abcA = font->gm[glyph_index].lsb;
buffer[c - firstChar].abcB = font->gm[glyph_index].bbx;
buffer[c - firstChar].abcC = font->gm[glyph_index].adv - font->gm[glyph_index].lsb -
font->gm[glyph_index].bbx;
}
return TRUE;
}
/************************************************************* /*************************************************************
* WineEngGetTextExtentPoint * WineEngGetTextExtentPoint
* *
@ -2557,6 +2582,13 @@ BOOL WineEngGetCharWidth(GdiFont font, UINT firstChar, UINT lastChar,
return FALSE; return FALSE;
} }
BOOL WineEngGetCharABCWidths(GdiFont font, UINT firstChar, UINT lastChar,
LPABC buffer)
{
ERR("called but we don't have FreeType\n");
return FALSE;
}
BOOL WineEngGetTextExtentPoint(GdiFont font, LPCWSTR wstr, INT count, BOOL WineEngGetTextExtentPoint(GdiFont font, LPCWSTR wstr, INT count,
LPSIZE size) LPSIZE size)
{ {

View File

@ -218,6 +218,8 @@ extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID);
extern GdiFont WineEngCreateFontInstance(DC*, HFONT); extern GdiFont WineEngCreateFontInstance(DC*, HFONT);
extern BOOL WineEngDestroyFontInstance(HFONT handle); extern BOOL WineEngDestroyFontInstance(HFONT handle);
extern DWORD WineEngEnumFonts(LPLOGFONTW, FONTENUMPROCW, LPARAM); extern DWORD WineEngEnumFonts(LPLOGFONTW, FONTENUMPROCW, LPARAM);
extern BOOL WineEngGetCharABCWidths(GdiFont font, UINT firstChar,
UINT lastChar, LPABC buffer);
extern BOOL WineEngGetCharWidth(GdiFont, UINT, UINT, LPINT); extern BOOL WineEngGetCharWidth(GdiFont, UINT, UINT, LPINT);
extern DWORD WineEngGetFontData(GdiFont, DWORD, DWORD, LPVOID, DWORD); extern DWORD WineEngGetFontData(GdiFont, DWORD, DWORD, LPVOID, DWORD);
extern DWORD WineEngGetGlyphIndices(GdiFont font, LPCWSTR lpstr, INT count, extern DWORD WineEngGetGlyphIndices(GdiFont font, LPCWSTR lpstr, INT count,

View File

@ -1668,19 +1668,25 @@ BOOL WINAPI GetCharABCWidthsW( HDC hdc, UINT firstChar, UINT lastChar,
LPABC abc ) LPABC abc )
{ {
DC *dc = DC_GetDCPtr(hdc); DC *dc = DC_GetDCPtr(hdc);
int i; int i;
GLYPHMETRICS gm;
BOOL ret = FALSE; BOOL ret = FALSE;
if(dc->gdiFont) { if(dc->gdiFont)
for (i=firstChar;i<=lastChar;i++) { ret = WineEngGetCharABCWidths( dc->gdiFont, firstChar, lastChar, abc );
GetGlyphOutlineW(hdc, i, GGO_METRICS, &gm, 0, NULL, NULL); else
abc[i-firstChar].abcA = gm.gmptGlyphOrigin.x; FIXME(": stub\n");
abc[i-firstChar].abcB = gm.gmBlackBoxX;
abc[i-firstChar].abcC = gm.gmCellIncX - gm.gmptGlyphOrigin.x - gm.gmBlackBoxX; if (ret)
{
/* convert device units to logical */
for( i = firstChar; i <= lastChar; 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; ret = TRUE;
} }
GDI_ReleaseObj(hdc); GDI_ReleaseObj(hdc);
return ret; return ret;
} }