diff --git a/dlls/wineps/font.c b/dlls/wineps/font.c index e19034759d3daaed49e7f4a598bde3cb2e1b99b0..1367e35105fb08e2ff7c334f203b1e1a79d5822f 100644 --- a/dlls/wineps/font.c +++ b/dlls/wineps/font.c @@ -18,11 +18,11 @@ DEFAULT_DEBUG_CHANNEL(psdrv); * PSDRV_FONT_SelectObject */ HFONT16 PSDRV_FONT_SelectObject( DC * dc, HFONT16 hfont, - FONTOBJ *font ) + FONTOBJ *font ) { HFONT16 prevfont = dc->hFont; PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; - LOGFONT16 *lf = &(font->logfont); + LOGFONTW *lf = &(font->logfont); BOOL bd = FALSE, it = FALSE; AFMLISTENTRY *afmle; AFM *afm; @@ -30,8 +30,9 @@ HFONT16 PSDRV_FONT_SelectObject( DC * dc, HFONT16 hfont, char FaceName[LF_FACESIZE]; - TRACE("FaceName = '%s' Height = %d Italic = %d Weight = %d\n", - lf->lfFaceName, lf->lfHeight, lf->lfItalic, lf->lfWeight); + TRACE("FaceName = '%s' Height = %ld Italic = %d Weight = %ld\n", + debugstr_w(lf->lfFaceName), lf->lfHeight, lf->lfItalic, + lf->lfWeight); dc->hFont = hfont; @@ -39,7 +40,8 @@ HFONT16 PSDRV_FONT_SelectObject( DC * dc, HFONT16 hfont, it = TRUE; if(lf->lfWeight > 550) bd = TRUE; - strcpy(FaceName, lf->lfFaceName); + WideCharToMultiByte(CP_ACP, 0, lf->lfFaceName, -1, + FaceName, sizeof(FaceName), NULL, NULL); if(FaceName[0] == '\0') { switch(lf->lfPitchAndFamily & 0xf0) { @@ -270,8 +272,8 @@ BOOL PSDRV_SetFont( DC *dc ) /*********************************************************************** * PSDRV_GetFontMetric */ -static UINT PSDRV_GetFontMetric(HDC hdc, AFM *pafm, NEWTEXTMETRIC16 *pTM, - ENUMLOGFONTEX16 *pLF, INT16 size) +static UINT PSDRV_GetFontMetric(HDC hdc, AFM *pafm, NEWTEXTMETRICEXW *pTM, + ENUMLOGFONTEXW *pLF, INT16 size) { DC *dc = DC_GetDCPtr( hdc ); @@ -282,52 +284,55 @@ static UINT PSDRV_GetFontMetric(HDC hdc, AFM *pafm, NEWTEXTMETRIC16 *pTM, memset( pLF, 0, sizeof(*pLF) ); memset( pTM, 0, sizeof(*pTM) ); -#define plf ((LPLOGFONT16)pLF) - plf->lfHeight = pTM->tmHeight = size; - plf->lfWidth = pTM->tmAveCharWidth = pafm->CharWidths[120] * scale; - plf->lfWeight = pTM->tmWeight = pafm->Weight; - plf->lfItalic = pTM->tmItalic = pafm->ItalicAngle != 0.0; - plf->lfUnderline = pTM->tmUnderlined = 0; - plf->lfStrikeOut = pTM->tmStruckOut = 0; - plf->lfCharSet = pTM->tmCharSet = ANSI_CHARSET; +#define plf ((LPLOGFONTW)pLF) +#define ptm ((LPNEWTEXTMETRICW)pTM) + plf->lfHeight = ptm->tmHeight = size; + plf->lfWidth = ptm->tmAveCharWidth = pafm->CharWidths[120] * scale; + plf->lfWeight = ptm->tmWeight = pafm->Weight; + plf->lfItalic = ptm->tmItalic = pafm->ItalicAngle != 0.0; + plf->lfUnderline = ptm->tmUnderlined = 0; + plf->lfStrikeOut = ptm->tmStruckOut = 0; + plf->lfCharSet = ptm->tmCharSet = ANSI_CHARSET; /* convert pitch values */ - pTM->tmPitchAndFamily = pafm->IsFixedPitch ? 0 : TMPF_FIXED_PITCH; - pTM->tmPitchAndFamily |= TMPF_DEVICE; + ptm->tmPitchAndFamily = pafm->IsFixedPitch ? 0 : TMPF_FIXED_PITCH; + ptm->tmPitchAndFamily |= TMPF_DEVICE; plf->lfPitchAndFamily = 0; - lstrcpynA( plf->lfFaceName, pafm->FamilyName, LF_FACESIZE ); + MultiByteToWideChar(CP_ACP, 0, pafm->FamilyName, -1, + plf->lfFaceName, LF_FACESIZE); #undef plf - pTM->tmAscent = pafm->FullAscender * scale; - pTM->tmDescent = -pafm->Descender * scale; - pTM->tmInternalLeading = (pafm->FullAscender - pafm->Ascender) * scale; - pTM->tmMaxCharWidth = pafm->CharWidths[77] * scale; - pTM->tmDigitizedAspectX = dc->devCaps->logPixelsY; - pTM->tmDigitizedAspectY = dc->devCaps->logPixelsX; + ptm->tmAscent = pafm->FullAscender * scale; + ptm->tmDescent = -pafm->Descender * scale; + ptm->tmInternalLeading = (pafm->FullAscender - pafm->Ascender) * scale; + ptm->tmMaxCharWidth = pafm->CharWidths[77] * scale; + ptm->tmDigitizedAspectX = dc->devCaps->logPixelsY; + ptm->tmDigitizedAspectY = dc->devCaps->logPixelsX; - *(INT*)&pTM->tmFirstChar = 32; + *(INT*)&ptm->tmFirstChar = 32; GDI_ReleaseObj( hdc ); /* return font type */ - return DEVICE_FONTTYPE; + return DEVICE_FONTTYPE; +#undef ptm } /*********************************************************************** * PSDRV_EnumDeviceFonts */ -BOOL PSDRV_EnumDeviceFonts( HDC hdc, LPLOGFONT16 plf, - DEVICEFONTENUMPROC proc, LPARAM lp ) +BOOL PSDRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, + DEVICEFONTENUMPROC proc, LPARAM lp ) { - ENUMLOGFONTEX16 lf; - NEWTEXTMETRIC16 tm; + ENUMLOGFONTEXW lf; + NEWTEXTMETRICEXW tm; BOOL b, bRet = 0; AFMLISTENTRY *afmle; FONTFAMILY *family; PSDRV_PDEVICE *physDev; - + char FaceName[LF_FACESIZE]; DC *dc = DC_GetDCPtr( hdc ); if (!dc) return FALSE; @@ -336,9 +341,11 @@ BOOL PSDRV_EnumDeviceFonts( HDC hdc, LPLOGFONT16 plf, GDI_ReleaseObj( hdc ); if( plf->lfFaceName[0] ) { - TRACE("lfFaceName = '%s'\n", plf->lfFaceName); + WideCharToMultiByte(CP_ACP, 0, plf->lfFaceName, -1, + FaceName, sizeof(FaceName), NULL, NULL); + TRACE("lfFaceName = '%s'\n", FaceName); for(family = physDev->pi->Fonts; family; family = family->next) { - if(!strncmp(plf->lfFaceName, family->FamilyName, + if(!strncmp(FaceName, family->FamilyName, strlen(family->FamilyName))) break; } diff --git a/dlls/wineps/psdrv.h b/dlls/wineps/psdrv.h index 14b465fba1bc86e749d65b5efd300e0b0dae6d05..21a18a05a99d6b72739a20facc0d2a68049ac8c4 100644 --- a/dlls/wineps/psdrv.h +++ b/dlls/wineps/psdrv.h @@ -36,7 +36,7 @@ typedef struct _tagAFM { char *FullName; char *FamilyName; char *EncodingScheme; - int Weight; /* FW_NORMAL etc. */ + LONG Weight; /* FW_NORMAL etc. */ float ItalicAngle; BOOL IsFixedPitch; float UnderlinePosition; @@ -271,7 +271,6 @@ extern void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor, COLORREF wincolor ); extern char PSDRV_UnicodeToANSI(int u); - extern INT PSDRV_WriteHeader( DC *dc, LPCSTR title ); extern INT PSDRV_WriteFooter( DC *dc ); extern INT PSDRV_WriteNewPage( DC *dc ); @@ -329,8 +328,8 @@ extern BOOL PSDRV_Ellipse( DC *dc, INT left, INT top, INT right, INT bottom ); extern INT PSDRV_EndDoc( DC *dc ); extern INT PSDRV_EndPage( DC *dc ); -extern BOOL PSDRV_EnumDeviceFonts( HDC hdc, LPLOGFONT16 plf, - DEVICEFONTENUMPROC proc, LPARAM lp ); +extern BOOL PSDRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, + DEVICEFONTENUMPROC proc, LPARAM lp ); extern INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, SEGPTR lpInData, SEGPTR lpOutData ); extern BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, diff --git a/graphics/enhmetafiledrv/objects.c b/graphics/enhmetafiledrv/objects.c index 8e8b29e27f61ba37b47444406d4896b85e8bd2eb..56132a9e5a3ed5283eb12b9c547f6ef287ed03fc 100644 --- a/graphics/enhmetafiledrv/objects.c +++ b/graphics/enhmetafiledrv/objects.c @@ -147,7 +147,7 @@ static BOOL EMFDRV_CreateFontIndirect(DC *dc, HFONT hFont ) emr.emr.iType = EMR_EXTCREATEFONTINDIRECTW; emr.emr.nSize = (sizeof(emr) + 3) / 4 * 4; emr.ihFont = index = EMFDRV_AddHandleDC( dc ); - FONT_LogFont16To32W( &(fontObj->logfont), &(emr.elfw.elfLogFont) ); + memcpy( &(emr.elfw.elfLogFont), &(fontObj->logfont), sizeof(LOGFONTW) ); emr.elfw.elfFullName[0] = '\0'; emr.elfw.elfStyle[0] = '\0'; emr.elfw.elfVersion = 0; diff --git a/graphics/metafiledrv/objects.c b/graphics/metafiledrv/objects.c index 2756d2a6272ca3efa6ed3d26a476a74db10d46c1..eab7e847a96f7329d45012cca2b4cda442cc74f1 100644 --- a/graphics/metafiledrv/objects.c +++ b/graphics/metafiledrv/objects.c @@ -185,7 +185,9 @@ static HFONT16 MFDRV_FONT_SelectObject( DC * dc, HFONT16 hfont, FONTOBJ * font ) { HFONT16 prevHandle = dc->hFont; - if (MFDRV_CreateFontIndirect(dc, hfont, &(font->logfont))) + LOGFONT16 lf16; + FONT_LogFontWTo16(&(font->logfont), &lf16); + if (MFDRV_CreateFontIndirect(dc, hfont, &lf16)) return prevHandle; return 0; } diff --git a/graphics/win16drv/font.c b/graphics/win16drv/font.c index 78eaad9a8560e8fdb01997a29a9a4d5345bf222f..ab40f8622761b1cf5cec5c2af8f37afc267ca61e 100644 --- a/graphics/win16drv/font.c +++ b/graphics/win16drv/font.c @@ -56,7 +56,7 @@ BOOL WIN16DRV_GetTextMetrics( DC *dc, TEXTMETRICA *metrics ) TRACE("%04x \n", dc->hSelf); - FONT_TextMetric16to32A( &physDev->tm, metrics ); + FONT_TextMetric16ToA( &physDev->tm, metrics ); TRACE( "H %ld, A %ld, D %ld, Int %ld, Ext %ld, AW %ld, MW %ld, W %ld\n", @@ -80,8 +80,8 @@ HFONT WIN16DRV_FONT_SelectObject( DC * dc, HFONT hfont, FONTOBJ * font) dc->hFont = hfont; - TRACE("WIN16DRV_FONT_SelectObject '%s' h=%d\n", - font->logfont.lfFaceName, font->logfont.lfHeight); + TRACE("WIN16DRV_FONT_SelectObject '%s' h=%ld\n", + debugstr_w(font->logfont.lfFaceName), font->logfont.lfHeight); if( physDev->FontInfo ) @@ -92,7 +92,7 @@ HFONT WIN16DRV_FONT_SelectObject( DC * dc, HFONT hfont, FONTOBJ * font) physDev->FontInfo, 0); } - memcpy(&physDev->lf, &font->logfont, sizeof(LOGFONT16)); + FONT_LogFontWTo16(&font->logfont, &physDev->lf); nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_FONT, &physDev->lf, 0, 0); @@ -150,7 +150,7 @@ HFONT WIN16DRV_FONT_SelectObject( DC * dc, HFONT hfont, FONTOBJ * font) } /*********************************************************************** - * GetCharWidth32A (GDI32.155) + * GetCharWidth32A (GDI32.@) */ BOOL WIN16DRV_GetCharWidth( DC *dc, UINT firstChar, UINT lastChar, LPINT buffer ) @@ -181,14 +181,15 @@ BOOL WIN16DRV_GetCharWidth( DC *dc, UINT firstChar, UINT lastChar, * WIN16DRV_EnumDeviceFonts */ -BOOL WIN16DRV_EnumDeviceFonts( HDC hdc, LPLOGFONT16 plf, - DEVICEFONTENUMPROC proc, LPARAM lp ) +BOOL WIN16DRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, + DEVICEFONTENUMPROC proc, LPARAM lp ) { WIN16DRV_PDEVICE *physDev; WORD wRet; WEPFC wepfc; DC *dc; - /* EnumDFontCallback is GDI.158 */ + char *FaceNameA = NULL; + /* EnumDFontCallback is GDI.158 */ FARPROC16 pfnCallback = GetProcAddress16( GetModuleHandle16("GDI"), (LPCSTR)158 ); if (!(dc = DC_GetDCPtr( hdc ))) return 0; @@ -196,11 +197,20 @@ BOOL WIN16DRV_EnumDeviceFonts( HDC hdc, LPLOGFONT16 plf, /* FIXME!! */ GDI_ReleaseObj( hdc ); - wepfc.proc = (int (*)(LPENUMLOGFONT16,LPNEWTEXTMETRIC16,UINT16,LPARAM))proc; + wepfc.proc = proc; wepfc.lp = lp; - wRet = PRTDRV_EnumDFonts(physDev->segptrPDEVICE, plf->lfFaceName[0] ? - plf->lfFaceName : NULL , pfnCallback , &wepfc ); + if(plf->lfFaceName[0]) { + INT len; + len = WideCharToMultiByte(CP_ACP, 0, plf->lfFaceName, -1, NULL, 0, + NULL, NULL); + FaceNameA = HeapAlloc(GetProcessHeap(), 0, len); + WideCharToMultiByte(CP_ACP, 0, plf->lfFaceName, -1, FaceNameA, len, + NULL, NULL); + } + wRet = PRTDRV_EnumDFonts(physDev->segptrPDEVICE, FaceNameA, pfnCallback, + &wepfc ); + if(FaceNameA) HeapFree(GetProcessHeap(), 0, FaceNameA); return wRet; } @@ -218,8 +228,27 @@ WORD WINAPI EnumCallback16(LPENUMLOGFONT16 lpLogFont, LPNEWTEXTMETRIC16 lpTextMetrics, WORD wFontType, LONG lpClientData) { + ENUMLOGFONTEXW lfW; + ENUMLOGFONTEX16 lf16; + + NEWTEXTMETRICEXW tmW; + NEWTEXTMETRICEX16 tm16; + TRACE("In EnumCallback16 plf=%p\n", lpLogFont); - return (*(((WEPFC *)lpClientData)->proc))( lpLogFont, lpTextMetrics, - wFontType, ((WEPFC *)lpClientData)->lp ); + + /* we have a ENUMLOGFONT16 which is a subset of ENUMLOGFONTEX16, + so we copy it into one of these and then convert to ENUMLOGFONTEXW */ + + memset(&lf16, 0, sizeof(lf16)); + memcpy(&lf16, lpLogFont, sizeof(*lpLogFont)); + FONT_EnumLogFontEx16ToW(&lf16, &lfW); + + /* and a similar idea for NEWTEXTMETRIC16 */ + memset(&tm16, 0, sizeof(tm16)); + memcpy(&tm16, lpTextMetrics, sizeof(*lpTextMetrics)); + FONT_NewTextMetricEx16ToW(&tm16, &tmW); + + return (*(((WEPFC *)lpClientData)->proc))( &lfW, &tmW, wFontType, + ((WEPFC *)lpClientData)->lp ); } diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c index 3ab0e96aa448a3b5edb80f8b7d0f6eeb142d6a3c..b47d43b39316ad5ca5e786df8b1efbecae379a91 100644 --- a/graphics/x11drv/xfont.c +++ b/graphics/x11drv/xfont.c @@ -1156,50 +1156,61 @@ static void XFONT_SetFontMetric(fontInfo* fi, const fontResource* fr, XFontStruc * * Retrieve font metric info (enumeration). */ -static UINT XFONT_GetFontMetric( const fontInfo* pfi, const LPENUMLOGFONTEX16 pLF, - const LPNEWTEXTMETRIC16 pTM ) +static UINT XFONT_GetFontMetric( const fontInfo* pfi, + const LPENUMLOGFONTEXW pLF, + const LPNEWTEXTMETRICEXW pTM ) { memset( pLF, 0, sizeof(*pLF) ); memset( pTM, 0, sizeof(*pTM) ); -#define plf ((LPLOGFONT16)pLF) - plf->lfHeight = pTM->tmHeight = pfi->df.dfPixHeight; - plf->lfWidth = pTM->tmAveCharWidth = pfi->df.dfAvgWidth; - plf->lfWeight = pTM->tmWeight = pfi->df.dfWeight; - plf->lfItalic = pTM->tmItalic = pfi->df.dfItalic; - plf->lfUnderline = pTM->tmUnderlined = pfi->df.dfUnderline; - plf->lfStrikeOut = pTM->tmStruckOut = pfi->df.dfStrikeOut; - plf->lfCharSet = pTM->tmCharSet = pfi->df.dfCharSet; +#define plf ((LPLOGFONTW)pLF) +#define ptm ((LPNEWTEXTMETRICW)pTM) + plf->lfHeight = ptm->tmHeight = pfi->df.dfPixHeight; + plf->lfWidth = ptm->tmAveCharWidth = pfi->df.dfAvgWidth; + plf->lfWeight = ptm->tmWeight = pfi->df.dfWeight; + plf->lfItalic = ptm->tmItalic = pfi->df.dfItalic; + plf->lfUnderline = ptm->tmUnderlined = pfi->df.dfUnderline; + plf->lfStrikeOut = ptm->tmStruckOut = pfi->df.dfStrikeOut; + plf->lfCharSet = ptm->tmCharSet = pfi->df.dfCharSet; /* convert pitch values */ - pTM->tmPitchAndFamily = pfi->df.dfPitchAndFamily; + ptm->tmPitchAndFamily = pfi->df.dfPitchAndFamily; plf->lfPitchAndFamily = (pfi->df.dfPitchAndFamily & 0xF1) + 1; - lstrcpynA( plf->lfFaceName, pfi->df.dfFace, LF_FACESIZE ); -#undef plf + MultiByteToWideChar(CP_ACP, 0, pfi->df.dfFace, -1, + plf->lfFaceName, LF_FACESIZE); - /* FIXME: fill in rest of plF values - lstrcpynA(plF->elfFullName, , LF_FULLFACESIZE); - lstrcpynA(plF->elfStyle, , LF_FACESIZE); - lstrcpynA(plF->elfScript, , LF_FACESIZE); - */ + /* FIXME: fill in rest of plF values */ + strcpyW(pLF->elfFullName, plf->lfFaceName); + MultiByteToWideChar(CP_ACP, 0, "Regular", -1, + pLF->elfStyle, LF_FACESIZE); + MultiByteToWideChar(CP_ACP, 0, plf->lfCharSet == SYMBOL_CHARSET ? + "Symbol" : "Roman", -1, + pLF->elfScript, LF_FACESIZE); - pTM->tmAscent = pfi->df.dfAscent; - pTM->tmDescent = pTM->tmHeight - pTM->tmAscent; - pTM->tmInternalLeading = pfi->df.dfInternalLeading; - pTM->tmMaxCharWidth = pfi->df.dfMaxWidth; - pTM->tmDigitizedAspectX = pfi->df.dfHorizRes; - pTM->tmDigitizedAspectY = pfi->df.dfVertRes; +#undef plf - pTM->tmFirstChar = pfi->df.dfFirstChar; - pTM->tmLastChar = pfi->df.dfLastChar; - pTM->tmDefaultChar = pfi->df.dfDefaultChar; - pTM->tmBreakChar = pfi->df.dfBreakChar; + ptm->tmAscent = pfi->df.dfAscent; + ptm->tmDescent = ptm->tmHeight - ptm->tmAscent; + ptm->tmInternalLeading = pfi->df.dfInternalLeading; + ptm->tmMaxCharWidth = pfi->df.dfMaxWidth; + ptm->tmDigitizedAspectX = pfi->df.dfHorizRes; + ptm->tmDigitizedAspectY = pfi->df.dfVertRes; + + ptm->tmFirstChar = pfi->df.dfFirstChar; + ptm->tmLastChar = pfi->df.dfLastChar; + ptm->tmDefaultChar = pfi->df.dfDefaultChar; + ptm->tmBreakChar = pfi->df.dfBreakChar; + + TRACE("Calling Enum proc with FaceName '%s' FullName '%s'\n", + debugstr_w(pLF->elfLogFont.lfFaceName), + debugstr_w(pLF->elfFullName)); + TRACE("CharSet = %d type = %d\n", ptm->tmCharSet, pfi->df.dfType); /* return font type */ - return pfi->df.dfType; +#undef ptm } @@ -3049,7 +3060,7 @@ HFONT X11DRV_FONT_SelectObject( DC* dc, HFONT hfont, FONTOBJ* font ) if( CHECK_PFONT(physDev->font) ) XFONT_ReleaseCacheEntry( __PFONT(physDev->font) ); - lf = font->logfont; + FONT_LogFontWTo16(&font->logfont, &lf); /* Make sure we don't change the sign when converting to device coords */ /* FIXME - check that the other drivers do this correctly */ @@ -3085,9 +3096,11 @@ HFONT X11DRV_FONT_SelectObject( DC* dc, HFONT hfont, FONTOBJ* font ) * so that GetTextFace can get the correct face name */ if (alias && !strcmp(faceMatched, lf.lfFaceName)) - strcpy( font->logfont.lfFaceName, alias ); + MultiByteToWideChar(CP_ACP, 0, alias, -1, + font->logfont.lfFaceName, LF_FACESIZE); else - strcpy( font->logfont.lfFaceName, faceMatched ); + MultiByteToWideChar(CP_ACP, 0, faceMatched, -1, + font->logfont.lfFaceName, LF_FACESIZE); /* * In X, some encodings may have the same lfFaceName. @@ -3112,18 +3125,22 @@ HFONT X11DRV_FONT_SelectObject( DC* dc, HFONT hfont, FONTOBJ* font ) * * X11DRV_EnumDeviceFonts */ -BOOL X11DRV_EnumDeviceFonts( HDC hdc, LPLOGFONT16 plf, - DEVICEFONTENUMPROC proc, LPARAM lp ) +BOOL X11DRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, + DEVICEFONTENUMPROC proc, LPARAM lp ) { - ENUMLOGFONTEX16 lf; - NEWTEXTMETRIC16 tm; + ENUMLOGFONTEXW lf; + NEWTEXTMETRICEXW tm; fontResource* pfr = fontList; BOOL b, bRet = 0; + LOGFONT16 lf16; - if( plf->lfFaceName[0] ) + + FONT_LogFontWTo16(plf, &lf16); + + if( lf16.lfFaceName[0] ) { /* enum all entries in this resource */ - pfr = XFONT_FindFIList( pfr, plf->lfFaceName ); + pfr = XFONT_FindFIList( pfr, lf16.lfFaceName ); if( pfr ) { fontInfo* pfi; @@ -3133,10 +3150,13 @@ BOOL X11DRV_EnumDeviceFonts( HDC hdc, LPLOGFONT16 plf, release the crit section, font list will have to be retraversed on return */ - if( (b = (*proc)( &lf, &tm, - XFONT_GetFontMetric( pfi, &lf, &tm ), lp )) ) - bRet = b; - else break; + if(lf16.lfCharSet == DEFAULT_CHARSET || + lf16.lfCharSet == pfi->df.dfCharSet) { + if( (b = (*proc)( &lf, &tm, + XFONT_GetFontMetric( pfi, &lf, &tm ), lp )) ) + bRet = b; + else break; + } } } } @@ -3145,9 +3165,9 @@ BOOL X11DRV_EnumDeviceFonts( HDC hdc, LPLOGFONT16 plf, { if(pfr->fi) { - if( (b = (*proc)( &lf, &tm, - XFONT_GetFontMetric( pfr->fi, &lf, &tm ), lp )) ) - bRet = b; + if( (b = (*proc)( &lf, &tm, + XFONT_GetFontMetric( pfr->fi, &lf, &tm ), lp )) ) + bRet = b; else break; } } diff --git a/include/font.h b/include/font.h index 90a0069312add043928d237688746c5c38234cbf..184db4083c36c48597a32a430140c543b21e6449 100644 --- a/include/font.h +++ b/include/font.h @@ -15,7 +15,7 @@ typedef struct { GDIOBJHDR header; - LOGFONT16 logfont WINE_PACKED; + LOGFONTW logfont; } FONTOBJ; typedef struct { @@ -59,16 +59,18 @@ extern BOOL FONT_Init( UINT16* pTextCaps ); extern INT16 FONT_GetObject16( FONTOBJ * font, INT16 count, LPSTR buffer ); extern INT FONT_GetObjectA( FONTOBJ * font, INT count, LPSTR buffer ); extern INT FONT_GetObjectW( FONTOBJ * font, INT count, LPSTR buffer ); -extern void FONT_LogFont32ATo16( const LOGFONTA* font32, LPLOGFONT16 font16 ); -extern void FONT_LogFont32WTo16( const LOGFONTW* font32, LPLOGFONT16 font16 ); -extern void FONT_LogFont16To32A( const LPLOGFONT16 font16, LPLOGFONTA font32 ); -extern void FONT_LogFont16To32W( const LPLOGFONT16 font16, LPLOGFONTW font32 ); -extern void FONT_TextMetric32Ato16(const LPTEXTMETRICA ptm32, LPTEXTMETRIC16 ptm16 ); -extern void FONT_TextMetric32Wto16(const LPTEXTMETRICW ptm32, LPTEXTMETRIC16 ptm16 ); -extern void FONT_TextMetric16to32A(const LPTEXTMETRIC16 ptm16, LPTEXTMETRICA ptm32 ); -extern void FONT_TextMetric16to32W(const LPTEXTMETRIC16 ptm16, LPTEXTMETRICW ptm32 ); -extern void FONT_TextMetric32Ato32W(const LPTEXTMETRICA ptm32A, LPTEXTMETRICW ptm32W ); - +extern void FONT_LogFontATo16( const LOGFONTA* font32, LPLOGFONT16 font16 ); +extern void FONT_LogFontWTo16( const LOGFONTW* font32, LPLOGFONT16 font16 ); +extern void FONT_LogFont16ToA( const LOGFONT16* font16, LPLOGFONTA font32 ); +extern void FONT_LogFont16ToW( const LOGFONT16* font16, LPLOGFONTW font32 ); +extern void FONT_TextMetricATo16(const TEXTMETRICA *ptm32, LPTEXTMETRIC16 ptm16 ); +extern void FONT_TextMetricWTo16(const TEXTMETRICW *ptm32, LPTEXTMETRIC16 ptm16 ); +extern void FONT_TextMetric16ToA(const TEXTMETRIC16 *ptm16, LPTEXTMETRICA ptm32 ); +extern void FONT_TextMetric16ToW(const TEXTMETRIC16 *ptm16, LPTEXTMETRICW ptm32 ); +extern void FONT_TextMetricAToW(const TEXTMETRICA *ptm32A, LPTEXTMETRICW ptm32W ); +extern void FONT_NewTextMetricEx16ToW(const NEWTEXTMETRICEX16*, LPNEWTEXTMETRICEXW); +extern void FONT_EnumLogFontEx16ToW(const ENUMLOGFONTEX16*, LPENUMLOGFONTEXW); +extern BOOL ENGINE_InitFonts(void); #endif /* __WINE_FONT_H */ diff --git a/include/gdi.h b/include/gdi.h index b0f6ccd6e905a6b1101f364702764e2816672408..53a0c2c08a4ab193d795a3270569338e2b7796c1 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -155,7 +155,8 @@ typedef struct tagDC /* Device functions for the Wine driver interface */ -typedef INT (*DEVICEFONTENUMPROC)(LPENUMLOGFONTEX16,LPNEWTEXTMETRIC16,UINT16,LPARAM); +typedef INT (*DEVICEFONTENUMPROC)(LPENUMLOGFONTEXW,LPNEWTEXTMETRICEXW,DWORD, + LPARAM); typedef struct tagDC_FUNCS { @@ -184,7 +185,7 @@ typedef struct tagDC_FUNCS INT (*pEndDoc)(DC*); INT (*pEndPage)(DC*); BOOL (*pEndPath)(DC*); - BOOL (*pEnumDeviceFonts)(HDC,LPLOGFONT16,DEVICEFONTENUMPROC,LPARAM); + BOOL (*pEnumDeviceFonts)(HDC,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM); INT (*pEscape)(DC*,INT,INT,SEGPTR,SEGPTR); INT (*pExcludeClipRect)(DC*,INT,INT,INT,INT); INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA, diff --git a/include/win16drv.h b/include/win16drv.h index 231c1aae68a106dd5e6cab45d2f72eba6cbe437d..2a5306b87fdba853fefba3e39a2823210a367f9a 100644 --- a/include/win16drv.h +++ b/include/win16drv.h @@ -137,7 +137,7 @@ typedef struct DRAWMODE typedef struct WINE_ENUM_PRINTER_FONT_CALLBACK { - int (*proc)(LPENUMLOGFONT16, LPNEWTEXTMETRIC16, UINT16, LPARAM); + DEVICEFONTENUMPROC proc; LPARAM lp; } WEPFC; @@ -224,8 +224,8 @@ extern HGDIOBJ WIN16DRV_SelectObject( DC *dc, HGDIOBJ handle ); extern BOOL WIN16DRV_PatBlt( struct tagDC *dc, INT left, INT top, INT width, INT height, DWORD rop ); extern BOOL WIN16DRV_Ellipse(DC *dc, INT left, INT top, INT right, INT bottom); -extern BOOL WIN16DRV_EnumDeviceFonts( HDC hdc, LPLOGFONT16 plf, - DEVICEFONTENUMPROC proc, LPARAM lp ); +extern BOOL WIN16DRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, + DEVICEFONTENUMPROC proc, LPARAM lp ); extern INT WIN16DRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, LPDEVMODEA lpdmOutput, diff --git a/include/x11drv.h b/include/x11drv.h index 5ad0d6a82c8e36b4ad314d0e100d0b4391a2189c..1ee3826b4e7ef295fa721d4456b9a9ddfd24af8a 100644 --- a/include/x11drv.h +++ b/include/x11drv.h @@ -92,8 +92,8 @@ extern const DC_FUNCTIONS X11DRV_DC_Funcs; extern BOOL X11DRV_BitBlt( struct tagDC *dcDst, INT xDst, INT yDst, INT width, INT height, struct tagDC *dcSrc, INT xSrc, INT ySrc, DWORD rop ); -extern BOOL X11DRV_EnumDeviceFonts( HDC hdc, LPLOGFONT16 plf, - DEVICEFONTENUMPROC dfeproc, LPARAM lp ); +extern BOOL X11DRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, + DEVICEFONTENUMPROC dfeproc, LPARAM lp ); extern BOOL X11DRV_GetCharWidth( struct tagDC *dc, UINT firstChar, UINT lastChar, LPINT buffer ); extern BOOL X11DRV_GetDCOrgEx( struct tagDC *dc, LPPOINT lpp ); diff --git a/objects/font.c b/objects/font.c index f1cfedd464eaf89f60b5bff2d1ee40b20d432dfe..1bedfdad89c9328baf9f5d32cffeab35255845e5 100644 --- a/objects/font.c +++ b/objects/font.c @@ -37,10 +37,8 @@ typedef struct { LPLOGFONTW lpLogFontParam; FONTENUMPROCEXW lpEnumFunc; - LPARAM lpData; + LPARAM lpData; - LPNEWTEXTMETRICEXW lpTextMetric; - LPENUMLOGFONTEXW lpLogFont; DWORD dwFlags; } fontEnum32; @@ -92,7 +90,7 @@ static CHARSETINFO FONT_tci[MAXTCIINDEX] = { /*********************************************************************** * LOGFONT conversion functions. */ -void FONT_LogFont32ATo16( const LOGFONTA* font32, LPLOGFONT16 font16 ) +void FONT_LogFontATo16( const LOGFONTA* font32, LPLOGFONT16 font16 ) { font16->lfHeight = font32->lfHeight; font16->lfWidth = font32->lfWidth; @@ -110,7 +108,7 @@ void FONT_LogFont32ATo16( const LOGFONTA* font32, LPLOGFONT16 font16 ) lstrcpynA( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE ); } -void FONT_LogFont32WTo16( const LOGFONTW* font32, LPLOGFONT16 font16 ) +void FONT_LogFontWTo16( const LOGFONTW* font32, LPLOGFONT16 font16 ) { font16->lfHeight = font32->lfHeight; font16->lfWidth = font32->lfWidth; @@ -130,7 +128,7 @@ void FONT_LogFont32WTo16( const LOGFONTW* font32, LPLOGFONT16 font16 ) font16->lfFaceName[LF_FACESIZE-1] = 0; } -void FONT_LogFont16To32A( const LPLOGFONT16 font16, LPLOGFONTA font32 ) +void FONT_LogFont16ToA( const LOGFONT16 *font16, LPLOGFONTA font32 ) { font32->lfHeight = font16->lfHeight; font32->lfWidth = font16->lfWidth; @@ -148,7 +146,7 @@ void FONT_LogFont16To32A( const LPLOGFONT16 font16, LPLOGFONTA font32 ) lstrcpynA( font32->lfFaceName, font16->lfFaceName, LF_FACESIZE ); } -void FONT_LogFont16To32W( const LPLOGFONT16 font16, LPLOGFONTW font32 ) +void FONT_LogFont16ToW( const LOGFONT16 *font16, LPLOGFONTW font32 ) { font32->lfHeight = font16->lfHeight; font32->lfWidth = font16->lfWidth; @@ -167,17 +165,31 @@ void FONT_LogFont16To32W( const LPLOGFONT16 font16, LPLOGFONTW font32 ) font32->lfFaceName[LF_FACESIZE-1] = 0; } -void FONT_EnumLogFontEx16To32A( const LPENUMLOGFONTEX16 font16, LPENUMLOGFONTEXA font32 ) +void FONT_LogFontAToW( const LOGFONTA *fontA, LPLOGFONTW fontW ) { - FONT_LogFont16To32A( (LPLOGFONT16)font16, (LPLOGFONTA)font32); + memcpy(fontW, fontA, sizeof(LOGFONTA) - LF_FACESIZE); + MultiByteToWideChar(CP_ACP, 0, fontA->lfFaceName, -1, fontW->lfFaceName, + LF_FACESIZE); +} + +void FONT_LogFontWToA( const LOGFONTW *fontW, LPLOGFONTA fontA ) +{ + memcpy(fontA, fontW, sizeof(LOGFONTA) - LF_FACESIZE); + WideCharToMultiByte(CP_ACP, 0, fontW->lfFaceName, -1, fontA->lfFaceName, + LF_FACESIZE, NULL, NULL); +} + +void FONT_EnumLogFontEx16ToA( const ENUMLOGFONTEX16 *font16, LPENUMLOGFONTEXA font32 ) +{ + FONT_LogFont16ToA( (LPLOGFONT16)font16, (LPLOGFONTA)font32); lstrcpynA( font32->elfFullName, font16->elfFullName, LF_FULLFACESIZE ); lstrcpynA( font32->elfStyle, font16->elfStyle, LF_FACESIZE ); lstrcpynA( font32->elfScript, font16->elfScript, LF_FACESIZE ); } -void FONT_EnumLogFontEx16To32W( const LPENUMLOGFONTEX16 font16, LPENUMLOGFONTEXW font32 ) +void FONT_EnumLogFontEx16ToW( const ENUMLOGFONTEX16 *font16, LPENUMLOGFONTEXW font32 ) { - FONT_LogFont16To32W( (LPLOGFONT16)font16, (LPLOGFONTW)font32); + FONT_LogFont16ToW( (LPLOGFONT16)font16, (LPLOGFONTW)font32); MultiByteToWideChar( CP_ACP, 0, font16->elfFullName, -1, font32->elfFullName, LF_FULLFACESIZE ); font32->elfFullName[LF_FULLFACESIZE-1] = 0; @@ -187,10 +199,40 @@ void FONT_EnumLogFontEx16To32W( const LPENUMLOGFONTEX16 font16, LPENUMLOGFONTEXW font32->elfScript[LF_FACESIZE-1] = 0; } +void FONT_EnumLogFontExWTo16( const ENUMLOGFONTEXW *fontW, LPENUMLOGFONTEX16 font16 ) +{ + FONT_LogFontWTo16( (LPLOGFONTW)fontW, (LPLOGFONT16)font16); + + WideCharToMultiByte( CP_ACP, 0, fontW->elfFullName, -1, + font16->elfFullName, LF_FULLFACESIZE, NULL, NULL ); + font16->elfFullName[LF_FULLFACESIZE-1] = '\0'; + WideCharToMultiByte( CP_ACP, 0, fontW->elfStyle, -1, + font16->elfStyle, LF_FACESIZE, NULL, NULL ); + font16->elfStyle[LF_FACESIZE-1] = '\0'; + WideCharToMultiByte( CP_ACP, 0, fontW->elfScript, -1, + font16->elfScript, LF_FACESIZE, NULL, NULL ); + font16->elfScript[LF_FACESIZE-1] = '\0'; +} + +void FONT_EnumLogFontExWToA( const ENUMLOGFONTEXW *fontW, LPENUMLOGFONTEXA fontA ) +{ + FONT_LogFontWToA( (LPLOGFONTW)fontW, (LPLOGFONTA)fontA); + + WideCharToMultiByte( CP_ACP, 0, fontW->elfFullName, -1, + fontA->elfFullName, LF_FULLFACESIZE, NULL, NULL ); + fontA->elfFullName[LF_FULLFACESIZE-1] = '\0'; + WideCharToMultiByte( CP_ACP, 0, fontW->elfStyle, -1, + fontA->elfStyle, LF_FACESIZE, NULL, NULL ); + fontA->elfStyle[LF_FACESIZE-1] = '\0'; + WideCharToMultiByte( CP_ACP, 0, fontW->elfScript, -1, + fontA->elfScript, LF_FACESIZE, NULL, NULL ); + fontA->elfScript[LF_FACESIZE-1] = '\0'; +} + /*********************************************************************** * TEXTMETRIC conversion functions. */ -void FONT_TextMetric32Ato16(const LPTEXTMETRICA ptm32, LPTEXTMETRIC16 ptm16 ) +void FONT_TextMetricATo16(const TEXTMETRICA *ptm32, LPTEXTMETRIC16 ptm16 ) { ptm16->tmHeight = ptm32->tmHeight; ptm16->tmAscent = ptm32->tmAscent; @@ -214,7 +256,7 @@ void FONT_TextMetric32Ato16(const LPTEXTMETRICA ptm32, LPTEXTMETRIC16 ptm16 ) ptm16->tmCharSet = ptm32->tmCharSet; } -void FONT_TextMetric32Wto16(const LPTEXTMETRICW ptm32, LPTEXTMETRIC16 ptm16 ) +void FONT_TextMetricWTo16(const TEXTMETRICW *ptm32, LPTEXTMETRIC16 ptm16 ) { ptm16->tmHeight = ptm32->tmHeight; ptm16->tmAscent = ptm32->tmAscent; @@ -238,7 +280,7 @@ void FONT_TextMetric32Wto16(const LPTEXTMETRICW ptm32, LPTEXTMETRIC16 ptm16 ) ptm16->tmCharSet = ptm32->tmCharSet; } -void FONT_TextMetric16to32A(const LPTEXTMETRIC16 ptm16, LPTEXTMETRICA ptm32 ) +void FONT_TextMetric16ToA(const TEXTMETRIC16 *ptm16, LPTEXTMETRICA ptm32 ) { ptm32->tmHeight = ptm16->tmHeight; ptm32->tmAscent = ptm16->tmAscent; @@ -262,7 +304,7 @@ void FONT_TextMetric16to32A(const LPTEXTMETRIC16 ptm16, LPTEXTMETRICA ptm32 ) ptm32->tmCharSet = ptm16->tmCharSet; } -void FONT_TextMetric16to32W(const LPTEXTMETRIC16 ptm16, LPTEXTMETRICW ptm32 ) +void FONT_TextMetric16ToW(const TEXTMETRIC16 *ptm16, LPTEXTMETRICW ptm32 ) { ptm32->tmHeight = ptm16->tmHeight; ptm32->tmAscent = ptm16->tmAscent; @@ -286,7 +328,7 @@ void FONT_TextMetric16to32W(const LPTEXTMETRIC16 ptm16, LPTEXTMETRICW ptm32 ) ptm32->tmCharSet = ptm16->tmCharSet; } -void FONT_TextMetric32Ato32W(const LPTEXTMETRICA ptm32A, LPTEXTMETRICW ptm32W ) +void FONT_TextMetricAToW(const TEXTMETRICA *ptm32A, LPTEXTMETRICW ptm32W ) { ptm32W->tmHeight = ptm32A->tmHeight; ptm32W->tmAscent = ptm32A->tmAscent; @@ -310,33 +352,123 @@ void FONT_TextMetric32Ato32W(const LPTEXTMETRICA ptm32A, LPTEXTMETRICW ptm32W ) ptm32W->tmCharSet = ptm32A->tmCharSet; } +void FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA ) +{ + ptmA->tmHeight = ptmW->tmHeight; + ptmA->tmAscent = ptmW->tmAscent; + ptmA->tmDescent = ptmW->tmDescent; + ptmA->tmInternalLeading = ptmW->tmInternalLeading; + ptmA->tmExternalLeading = ptmW->tmExternalLeading; + ptmA->tmAveCharWidth = ptmW->tmAveCharWidth; + ptmA->tmMaxCharWidth = ptmW->tmMaxCharWidth; + ptmA->tmWeight = ptmW->tmWeight; + ptmA->tmOverhang = ptmW->tmOverhang; + ptmA->tmDigitizedAspectX = ptmW->tmDigitizedAspectX; + ptmA->tmDigitizedAspectY = ptmW->tmDigitizedAspectY; + ptmA->tmFirstChar = ptmW->tmFirstChar; + ptmA->tmLastChar = ptmW->tmLastChar; + ptmA->tmDefaultChar = ptmW->tmDefaultChar; + ptmA->tmBreakChar = ptmW->tmBreakChar; + ptmA->tmItalic = ptmW->tmItalic; + ptmA->tmUnderlined = ptmW->tmUnderlined; + ptmA->tmStruckOut = ptmW->tmStruckOut; + ptmA->tmPitchAndFamily = ptmW->tmPitchAndFamily; + ptmA->tmCharSet = ptmW->tmCharSet; +} + + +void FONT_NewTextMetricExWTo16(const NEWTEXTMETRICEXW *ptmW, LPNEWTEXTMETRICEX16 ptm16 ) +{ + FONT_TextMetricWTo16((LPTEXTMETRICW)ptmW, (LPTEXTMETRIC16)ptm16); + ptm16->ntmetm.ntmFlags = ptmW->ntmetm.ntmFlags; + ptm16->ntmetm.ntmSizeEM = ptmW->ntmetm.ntmSizeEM; + ptm16->ntmetm.ntmCellHeight = ptmW->ntmetm.ntmCellHeight; + ptm16->ntmetm.ntmAvgWidth = ptmW->ntmetm.ntmAvgWidth; + memcpy(&ptm16->ntmeFontSignature, &ptmW->ntmeFontSignature, + sizeof(FONTSIGNATURE)); +} + +void FONT_NewTextMetricExWToA(const NEWTEXTMETRICEXW *ptmW, LPNEWTEXTMETRICEXA ptmA ) +{ + FONT_TextMetricWToA((LPTEXTMETRICW)ptmW, (LPTEXTMETRICA)ptmA); + ptmA->ntmetm.ntmFlags = ptmW->ntmetm.ntmFlags; + ptmA->ntmetm.ntmSizeEM = ptmW->ntmetm.ntmSizeEM; + ptmA->ntmetm.ntmCellHeight = ptmW->ntmetm.ntmCellHeight; + ptmA->ntmetm.ntmAvgWidth = ptmW->ntmetm.ntmAvgWidth; + memcpy(&ptmA->ntmeFontSignature, &ptmW->ntmeFontSignature, + sizeof(FONTSIGNATURE)); +} + +void FONT_NewTextMetricEx16ToW(const NEWTEXTMETRICEX16 *ptm16, LPNEWTEXTMETRICEXW ptmW ) +{ + FONT_TextMetric16ToW((LPTEXTMETRIC16)ptm16, (LPTEXTMETRICW)ptmW); + ptmW->ntmetm.ntmFlags = ptm16->ntmetm.ntmFlags; + ptmW->ntmetm.ntmSizeEM = ptm16->ntmetm.ntmSizeEM; + ptmW->ntmetm.ntmCellHeight = ptm16->ntmetm.ntmCellHeight; + ptmW->ntmetm.ntmAvgWidth = ptm16->ntmetm.ntmAvgWidth; + memcpy(&ptmW->ntmeFontSignature, &ptm16->ntmeFontSignature, + sizeof(FONTSIGNATURE)); +} + + /*********************************************************************** * CreateFontIndirect16 (GDI.57) */ -HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *font ) +HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *plf16 ) +{ + LOGFONTW lfW; + + if(plf16) { + FONT_LogFont16ToW( plf16, &lfW ); + return CreateFontIndirectW( &lfW ); + } else { + return CreateFontIndirectW( NULL ); + } +} + + +/*********************************************************************** + * CreateFontIndirectA (GDI32.@) + */ +HFONT WINAPI CreateFontIndirectA( const LOGFONTA *plfA ) +{ + LOGFONTW lfW; + + if (plfA) { + FONT_LogFontAToW( plfA, &lfW ); + return CreateFontIndirectW( &lfW ); + } else + return CreateFontIndirectW( NULL ); + +} + +/*********************************************************************** + * CreateFontIndirectW (GDI32.@) + */ +HFONT WINAPI CreateFontIndirectW( const LOGFONTW *plf ) { HFONT hFont = 0; - if (font) + if (plf) { - FONTOBJ* fontPtr; + FONTOBJ* fontPtr; if ((fontPtr = GDI_AllocObject( sizeof(FONTOBJ), FONT_MAGIC, &hFont ))) { - memcpy( &fontPtr->logfont, font, sizeof(LOGFONT16) ); + memcpy( &fontPtr->logfont, plf, sizeof(LOGFONTW) ); - TRACE("(%i %i %i %i) '%s' %s %s => %04x\n", - font->lfHeight, font->lfWidth, - font->lfEscapement, font->lfOrientation, - font->lfFaceName ? font->lfFaceName : "NULL", - font->lfWeight > 400 ? "Bold" : "", - font->lfItalic ? "Italic" : "", hFont); + TRACE("(%ld %ld %ld %ld) '%s' %s %s => %04x\n", + plf->lfHeight, plf->lfWidth, + plf->lfEscapement, plf->lfOrientation, + debugstr_w(plf->lfFaceName), + plf->lfWeight > 400 ? "Bold" : "", + plf->lfItalic ? "Italic" : "", hFont); - if (font->lfEscapement != font->lfOrientation) { + if (plf->lfEscapement != plf->lfOrientation) { /* this should really depend on whether GM_ADVANCED is set */ fontPtr->logfont.lfOrientation = fontPtr->logfont.lfEscapement; WARN("orientation angle %f set to " "escapement angle %f for new font %04x\n", - font->lfOrientation/10., font->lfEscapement/10., hFont); + plf->lfOrientation/10., plf->lfEscapement/10., hFont); } GDI_ReleaseObj( hFont ); } @@ -346,35 +478,6 @@ HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *font ) return hFont; } -/*********************************************************************** - * CreateFontIndirectA (GDI32.44) - */ -HFONT WINAPI CreateFontIndirectA( const LOGFONTA *font ) -{ - LOGFONT16 font16; - - if (font) { - FONT_LogFont32ATo16( font, &font16 ); - return CreateFontIndirect16( &font16 ); - } else - return CreateFontIndirect16( NULL ); - -} - -/*********************************************************************** - * CreateFontIndirectW (GDI32.45) - */ -HFONT WINAPI CreateFontIndirectW( const LOGFONTW *font ) -{ - LOGFONT16 font16; - - if (font) { - FONT_LogFont32WTo16( font, &font16 ); - return CreateFontIndirect16( &font16 ); - } else - return CreateFontIndirect16( NULL ); -} - /*********************************************************************** * CreateFont16 (GDI.56) */ @@ -386,8 +489,6 @@ HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient, { LOGFONT16 logfont; - TRACE("('%s',%d,%d)\n", (name ? name : "(null)") , height, width); - logfont.lfHeight = height; logfont.lfWidth = width; logfont.lfEscapement = esc; @@ -411,7 +512,7 @@ HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient, } /************************************************************************* - * CreateFontA (GDI32.43) + * CreateFontA (GDI32.@) */ HFONT WINAPI CreateFontA( INT height, INT width, INT esc, INT orient, INT weight, DWORD italic, @@ -419,13 +520,32 @@ HFONT WINAPI CreateFontA( INT height, INT width, INT esc, DWORD outpres, DWORD clippres, DWORD quality, DWORD pitch, LPCSTR name ) { - return (HFONT)CreateFont16( height, width, esc, orient, weight, italic, - underline, strikeout, charset, outpres, - clippres, quality, pitch, name ); + LOGFONTA logfont; + + logfont.lfHeight = height; + logfont.lfWidth = width; + logfont.lfEscapement = esc; + logfont.lfOrientation = orient; + logfont.lfWeight = weight; + logfont.lfItalic = italic; + logfont.lfUnderline = underline; + logfont.lfStrikeOut = strikeout; + logfont.lfCharSet = charset; + logfont.lfOutPrecision = outpres; + logfont.lfClipPrecision = clippres; + logfont.lfQuality = quality; + logfont.lfPitchAndFamily = pitch; + + if (name) + lstrcpynA(logfont.lfFaceName,name,sizeof(logfont.lfFaceName)); + else + logfont.lfFaceName[0] = '\0'; + + return CreateFontIndirectA( &logfont ); } /************************************************************************* - * CreateFontW (GDI32.46) + * CreateFontW (GDI32.@) */ HFONT WINAPI CreateFontW( INT height, INT width, INT esc, INT orient, INT weight, DWORD italic, @@ -433,13 +553,29 @@ HFONT WINAPI CreateFontW( INT height, INT width, INT esc, DWORD outpres, DWORD clippres, DWORD quality, DWORD pitch, LPCWSTR name ) { - LPSTR namea = HEAP_strdupWtoA( GetProcessHeap(), 0, name ); - HFONT ret = (HFONT)CreateFont16( height, width, esc, orient, weight, - italic, underline, strikeout, charset, - outpres, clippres, quality, pitch, - namea ); - if (namea) HeapFree( GetProcessHeap(), 0, namea ); - return ret; + LOGFONTW logfont; + + logfont.lfHeight = height; + logfont.lfWidth = width; + logfont.lfEscapement = esc; + logfont.lfOrientation = orient; + logfont.lfWeight = weight; + logfont.lfItalic = italic; + logfont.lfUnderline = underline; + logfont.lfStrikeOut = strikeout; + logfont.lfCharSet = charset; + logfont.lfOutPrecision = outpres; + logfont.lfClipPrecision = clippres; + logfont.lfQuality = quality; + logfont.lfPitchAndFamily = pitch; + + if (name) + lstrcpynW(logfont.lfFaceName, name, + sizeof(logfont.lfFaceName) / sizeof(WCHAR)); + else + logfont.lfFaceName[0] = '\0'; + + return CreateFontIndirectW( &logfont ); } @@ -448,8 +584,12 @@ HFONT WINAPI CreateFontW( INT height, INT width, INT esc, */ INT16 FONT_GetObject16( FONTOBJ * font, INT16 count, LPSTR buffer ) { + LOGFONT16 lf16; + + FONT_LogFontWTo16( &font->logfont, &lf16 ); + if (count > sizeof(LOGFONT16)) count = sizeof(LOGFONT16); - memcpy( buffer, &font->logfont, count ); + memcpy( buffer, &lf16, count ); return count; } @@ -458,12 +598,12 @@ INT16 FONT_GetObject16( FONTOBJ * font, INT16 count, LPSTR buffer ) */ INT FONT_GetObjectA( FONTOBJ *font, INT count, LPSTR buffer ) { - LOGFONTA fnt32; + LOGFONTA lfA; - FONT_LogFont16To32A( &font->logfont, &fnt32 ); + FONT_LogFontWToA( &font->logfont, &lfA ); - if (count > sizeof(fnt32)) count = sizeof(fnt32); - memcpy( buffer, &fnt32, count ); + if (count > sizeof(lfA)) count = sizeof(lfA); + memcpy( buffer, &lfA, count ); return count; } /*********************************************************************** @@ -471,12 +611,8 @@ INT FONT_GetObjectA( FONTOBJ *font, INT count, LPSTR buffer ) */ INT FONT_GetObjectW( FONTOBJ *font, INT count, LPSTR buffer ) { - LOGFONTW fnt32; - - FONT_LogFont16To32W( &font->logfont, &fnt32 ); - - if (count > sizeof(fnt32)) count = sizeof(fnt32); - memcpy( buffer, &fnt32, count ); + if (count > sizeof(LOGFONTW)) count = sizeof(LOGFONTW); + memcpy( buffer, &font->logfont, count ); return count; } @@ -487,17 +623,17 @@ INT FONT_GetObjectW( FONTOBJ *font, INT count, LPSTR buffer ) * Called by the device driver layer to pass font info * down to the application. */ -static INT FONT_EnumInstance16( LPENUMLOGFONTEX16 plf, - LPNEWTEXTMETRIC16 ptm, UINT16 fType, LPARAM lp ) +static INT FONT_EnumInstance16( LPENUMLOGFONTEXW plf, LPNEWTEXTMETRICEXW ptm, + DWORD fType, LPARAM lp ) { #define pfe ((fontEnum16*)lp) if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET || pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet ) { - memcpy( pfe->lpLogFont, plf, sizeof(ENUMLOGFONT16) ); - memcpy( pfe->lpTextMetric, ptm, sizeof(NEWTEXTMETRIC16) ); - - return pfe->lpEnumFunc( pfe->segLogFont, pfe->segTextMetric, fType, (LPARAM)(pfe->lpData) ); + FONT_EnumLogFontExWTo16(plf, pfe->lpLogFont); + FONT_NewTextMetricExWTo16(ptm, pfe->lpTextMetric); + return pfe->lpEnumFunc( pfe->segLogFont, pfe->segTextMetric, + (UINT16)fType, (LPARAM)(pfe->lpData) ); } #undef pfe return 1; @@ -506,8 +642,8 @@ static INT FONT_EnumInstance16( LPENUMLOGFONTEX16 plf, /*********************************************************************** * FONT_EnumInstance */ -static INT FONT_EnumInstance( LPENUMLOGFONTEX16 plf, - LPNEWTEXTMETRIC16 ptm, UINT16 fType, LPARAM lp ) +static INT FONT_EnumInstance( LPENUMLOGFONTEXW plf, LPNEWTEXTMETRICEXW ptm, + DWORD fType, LPARAM lp ) { /* lfCharSet is at the same offset in both LOGFONTA and LOGFONTW */ @@ -519,20 +655,19 @@ static INT FONT_EnumInstance( LPENUMLOGFONTEX16 plf, if( pfe->dwFlags & ENUM_UNICODE ) { - FONT_EnumLogFontEx16To32W( plf, pfe->lpLogFont ); - FONT_TextMetric16to32W( (LPTEXTMETRIC16)ptm, (LPTEXTMETRICW)(pfe->lpTextMetric) ); - - return pfe->lpEnumFunc( pfe->lpLogFont, pfe->lpTextMetric, fType, pfe->lpData ); + return pfe->lpEnumFunc( plf, ptm, fType, pfe->lpData ); } else { ENUMLOGFONTEXA logfont; + NEWTEXTMETRICEXA tmA; - FONT_EnumLogFontEx16To32A( plf, &logfont); - FONT_TextMetric16to32A( (LPTEXTMETRIC16)ptm, (LPTEXTMETRICA)pfe->lpTextMetric ); + FONT_EnumLogFontExWToA( plf, &logfont); + FONT_NewTextMetricExWToA( ptm, &tmA ); return pfe->lpEnumFunc( (LPENUMLOGFONTEXW)&logfont, - pfe->lpTextMetric, fType, pfe->lpData ); + (LPNEWTEXTMETRICEXW)&tmA, fType, + pfe->lpData ); } } #undef pfe @@ -546,7 +681,7 @@ INT16 WINAPI EnumFontFamiliesEx16( HDC16 hDC, LPLOGFONT16 plf, FONTENUMPROCEX16 efproc, LPARAM lParam, DWORD dwFlags) { - BOOL (*enum_func)(HDC,LPLOGFONT16,DEVICEFONTENUMPROC,LPARAM); + BOOL (*enum_func)(HDC,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM); INT16 retVal = 0; DC* dc = DC_GetDCPtr( hDC ); @@ -556,13 +691,15 @@ INT16 WINAPI EnumFontFamiliesEx16( HDC16 hDC, LPLOGFONT16 plf, if (enum_func) { - LPNEWTEXTMETRICEX16 lptm16 = SEGPTR_ALLOC( sizeof(NEWTEXTMETRICEX16) ); + LPNEWTEXTMETRICEX16 lptm16 = SEGPTR_ALLOC( sizeof(NEWTEXTMETRICEX16) ); if( lptm16 ) { - LPENUMLOGFONTEX16 lplf16 = SEGPTR_ALLOC( sizeof(ENUMLOGFONTEX16) ); + LPENUMLOGFONTEX16 lplf16 = SEGPTR_ALLOC( sizeof(ENUMLOGFONTEX16) ); if( lplf16 ) { fontEnum16 fe16; + LOGFONTW lfW; + FONT_LogFont16ToW(plf, &lfW); fe16.lpLogFontParam = plf; fe16.lpEnumFunc = efproc; @@ -573,7 +710,8 @@ INT16 WINAPI EnumFontFamiliesEx16( HDC16 hDC, LPLOGFONT16 plf, fe16.segTextMetric = SEGPTR_GET(lptm16); fe16.segLogFont = SEGPTR_GET(lplf16); - retVal = enum_func( hDC, plf, FONT_EnumInstance16, (LPARAM)&fe16 ); + retVal = enum_func( hDC, &lfW, FONT_EnumInstance16, + (LPARAM)&fe16 ); SEGPTR_FREE(lplf16); } SEGPTR_FREE(lptm16); @@ -585,10 +723,11 @@ INT16 WINAPI EnumFontFamiliesEx16( HDC16 hDC, LPLOGFONT16 plf, /*********************************************************************** * FONT_EnumFontFamiliesEx */ -static INT FONT_EnumFontFamiliesEx( HDC hDC, LPLOGFONTW plf, FONTENUMPROCEXW efproc, - LPARAM lParam, DWORD dwUnicode) +static INT FONT_EnumFontFamiliesEx( HDC hDC, LPLOGFONTW plf, + FONTENUMPROCEXW efproc, + LPARAM lParam, DWORD dwUnicode) { - BOOL (*enum_func)(HDC,LPLOGFONT16,DEVICEFONTENUMPROC,LPARAM); + BOOL (*enum_func)(HDC,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM); INT ret = 0; DC *dc = DC_GetDCPtr( hDC ); @@ -598,42 +737,21 @@ static INT FONT_EnumFontFamiliesEx( HDC hDC, LPLOGFONTW plf, FONTENUMPROCEXW efp if (enum_func) { - LOGFONT16 lf16; - NEWTEXTMETRICEXW tm32w; - ENUMLOGFONTEXW lf32w; - fontEnum32 fe32; + fontEnum32 fe32; fe32.lpLogFontParam = plf; fe32.lpEnumFunc = efproc; fe32.lpData = lParam; - fe32.lpTextMetric = &tm32w; - fe32.lpLogFont = &lf32w; fe32.dwFlags = dwUnicode; - /* the only difference between LOGFONT32A and LOGFONT32W is in the lfFaceName */ - - if( plf->lfFaceName[0] ) - { - if( dwUnicode ) - { - WideCharToMultiByte( CP_ACP, 0, plf->lfFaceName, -1, - lf16.lfFaceName, LF_FACESIZE, NULL, NULL ); - lf16.lfFaceName[LF_FACESIZE-1] = 0; - } - else - lstrcpynA( lf16.lfFaceName, (LPCSTR)plf->lfFaceName, LF_FACESIZE ); - } - else lf16.lfFaceName[0] = '\0'; - lf16.lfCharSet = plf->lfCharSet; - - ret = enum_func( hDC, &lf16, FONT_EnumInstance, (LPARAM)&fe32 ); + ret = enum_func( hDC, plf, FONT_EnumInstance, (LPARAM)&fe32 ); } return ret; } /*********************************************************************** - * EnumFontFamiliesExW (GDI32.82) + * EnumFontFamiliesExW (GDI32.@) */ INT WINAPI EnumFontFamiliesExW( HDC hDC, LPLOGFONTW plf, FONTENUMPROCEXW efproc, @@ -643,14 +761,17 @@ INT WINAPI EnumFontFamiliesExW( HDC hDC, LPLOGFONTW plf, } /*********************************************************************** - * EnumFontFamiliesExA (GDI32.81) + * EnumFontFamiliesExA (GDI32.@) */ INT WINAPI EnumFontFamiliesExA( HDC hDC, LPLOGFONTA plf, FONTENUMPROCEXA efproc, LPARAM lParam, DWORD dwFlags) { - return FONT_EnumFontFamiliesEx( hDC, (LPLOGFONTW)plf, - (FONTENUMPROCEXW)efproc, lParam, 0); + LOGFONTW lfW; + FONT_LogFontAToW( plf, &lfW ); + + return FONT_EnumFontFamiliesEx( hDC, &lfW, + (FONTENUMPROCEXW)efproc, lParam, 0); } /*********************************************************************** @@ -669,7 +790,7 @@ INT16 WINAPI EnumFontFamilies16( HDC16 hDC, LPCSTR lpFamily, } /*********************************************************************** - * EnumFontFamiliesA (GDI32.80) + * EnumFontFamiliesA (GDI32.@) */ INT WINAPI EnumFontFamiliesA( HDC hDC, LPCSTR lpFamily, FONTENUMPROCA efproc, LPARAM lpData ) @@ -680,12 +801,11 @@ INT WINAPI EnumFontFamiliesA( HDC hDC, LPCSTR lpFamily, if( lpFamily ) lstrcpynA( lf.lfFaceName, lpFamily, LF_FACESIZE ); else lf.lfFaceName[0] = lf.lfFaceName[1] = '\0'; - return FONT_EnumFontFamiliesEx( hDC, (LPLOGFONTW)&lf, - (FONTENUMPROCEXW)efproc, lpData, 0 ); + return EnumFontFamiliesExA( hDC, &lf, (FONTENUMPROCEXA)efproc, lpData, 0 ); } /*********************************************************************** - * EnumFontFamiliesW (GDI32.83) + * EnumFontFamiliesW (GDI32.@) */ INT WINAPI EnumFontFamiliesW( HDC hDC, LPCWSTR lpFamily, FONTENUMPROCW efproc, LPARAM lpData ) @@ -696,8 +816,7 @@ INT WINAPI EnumFontFamiliesW( HDC hDC, LPCWSTR lpFamily, if( lpFamily ) lstrcpynW( lf.lfFaceName, lpFamily, LF_FACESIZE ); else lf.lfFaceName[0] = 0; - return FONT_EnumFontFamiliesEx( hDC, &lf, (FONTENUMPROCEXW)efproc, - lpData, ENUM_UNICODE ); + return EnumFontFamiliesExW( hDC, &lf, (FONTENUMPROCEXW)efproc, lpData, 0 ); } /*********************************************************************** @@ -710,7 +829,7 @@ INT16 WINAPI EnumFonts16( HDC16 hDC, LPCSTR lpName, FONTENUMPROC16 efproc, } /*********************************************************************** - * EnumFontsA (GDI32.84) + * EnumFontsA (GDI32.@) */ INT WINAPI EnumFontsA( HDC hDC, LPCSTR lpName, FONTENUMPROCA efproc, LPARAM lpData ) @@ -719,7 +838,7 @@ INT WINAPI EnumFontsA( HDC hDC, LPCSTR lpName, FONTENUMPROCA efproc, } /*********************************************************************** - * EnumFontsW (GDI32.85) + * EnumFontsW (GDI32.@) */ INT WINAPI EnumFontsW( HDC hDC, LPCWSTR lpName, FONTENUMPROCW efproc, LPARAM lpData ) @@ -738,7 +857,7 @@ INT16 WINAPI GetTextCharacterExtra16( HDC16 hdc ) /*********************************************************************** - * GetTextCharacterExtra (GDI32.225) + * GetTextCharacterExtra (GDI32.@) */ INT WINAPI GetTextCharacterExtra( HDC hdc ) { @@ -762,7 +881,7 @@ INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra ) /*********************************************************************** - * SetTextCharacterExtra (GDI32.337) + * SetTextCharacterExtra (GDI32.@) */ INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra ) { @@ -792,7 +911,7 @@ INT16 WINAPI SetTextJustification16( HDC16 hdc, INT16 extra, INT16 breaks ) /*********************************************************************** - * SetTextJustification (GDI32.339) + * SetTextJustification (GDI32.@) */ BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks ) { @@ -832,9 +951,27 @@ INT16 WINAPI GetTextFace16( HDC16 hdc, INT16 count, LPSTR name ) } /*********************************************************************** - * GetTextFaceA (GDI32.234) + * GetTextFaceA (GDI32.@) */ INT WINAPI GetTextFaceA( HDC hdc, INT count, LPSTR name ) +{ + INT res = GetTextFaceW(hdc, 0, NULL); + LPWSTR nameW = HeapAlloc( GetProcessHeap(), 0, res * 2 ); + GetTextFaceW( hdc, res, nameW ); + + if (name) + res = WideCharToMultiByte( CP_ACP, 0, nameW, -1, name, count, + NULL, NULL); + else + res = WideCharToMultiByte( CP_ACP, 0, nameW, -1, NULL, 0, NULL, NULL); + HeapFree( GetProcessHeap(), 0, nameW ); + return res; +} + +/*********************************************************************** + * GetTextFaceW (GDI32.@) + */ +INT WINAPI GetTextFaceW( HDC hdc, INT count, LPWSTR name ) { FONTOBJ *font; INT ret = 0; @@ -846,28 +983,16 @@ INT WINAPI GetTextFaceA( HDC hdc, INT count, LPSTR name ) { if (name) { - lstrcpynA( name, font->logfont.lfFaceName, count ); - ret = strlen(name); + lstrcpynW( name, font->logfont.lfFaceName, count ); + ret = strlenW(name); } - else ret = strlen(font->logfont.lfFaceName) + 1; + else ret = strlenW(font->logfont.lfFaceName) + 1; GDI_ReleaseObj( dc->hFont ); } GDI_ReleaseObj( hdc ); return ret; } -/*********************************************************************** - * GetTextFaceW (GDI32.235) - */ -INT WINAPI GetTextFaceW( HDC hdc, INT count, LPWSTR name ) -{ - LPSTR nameA = HeapAlloc( GetProcessHeap(), 0, count ); - INT res = GetTextFaceA(hdc,count,nameA); - if (name) res = MultiByteToWideChar( CP_ACP, 0, nameA, -1, name, count ); - HeapFree( GetProcessHeap(), 0, nameA ); - return res; -} - /*********************************************************************** * GetTextExtent16 (GDI.91) @@ -901,7 +1026,7 @@ BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count, /*********************************************************************** - * GetTextExtentPoint32A (GDI32.230) + * GetTextExtentPoint32A (GDI32.@) */ BOOL WINAPI GetTextExtentPoint32A( HDC hdc, LPCSTR str, INT count, LPSIZE size ) @@ -934,7 +1059,7 @@ BOOL WINAPI GetTextExtentPoint32A( HDC hdc, LPCSTR str, INT count, /*********************************************************************** - * GetTextExtentPoint32W [GDI32.231] Computes width/height for a string + * GetTextExtentPoint32W [GDI32.@] Computes width/height for a string * * Computes width and height of the specified string. * @@ -963,7 +1088,7 @@ BOOL WINAPI GetTextExtentPoint32W( /*********************************************************************** - * GetTextExtentPointA (GDI32.232) + * GetTextExtentPointA (GDI32.@) */ BOOL WINAPI GetTextExtentPointA( HDC hdc, LPCSTR str, INT count, LPSIZE size ) @@ -973,7 +1098,7 @@ BOOL WINAPI GetTextExtentPointA( HDC hdc, LPCSTR str, INT count, } /*********************************************************************** - * GetTextExtentPointW (GDI32.233) + * GetTextExtentPointW (GDI32.@) */ BOOL WINAPI GetTextExtentPointW( HDC hdc, LPCWSTR str, INT count, LPSIZE size ) @@ -984,7 +1109,7 @@ BOOL WINAPI GetTextExtentPointW( HDC hdc, LPCWSTR str, INT count, /*********************************************************************** - * GetTextExtentExPointA (GDI32.228) + * GetTextExtentExPointA (GDI32.@) */ BOOL WINAPI GetTextExtentExPointA( HDC hdc, LPCSTR str, INT count, INT maxExt, LPINT lpnFit, @@ -1002,7 +1127,7 @@ BOOL WINAPI GetTextExtentExPointA( HDC hdc, LPCSTR str, INT count, /*********************************************************************** - * GetTextExtentExPointW (GDI32.229) + * GetTextExtentExPointW (GDI32.@) */ BOOL WINAPI GetTextExtentExPointW( HDC hdc, LPCWSTR str, INT count, @@ -1051,13 +1176,13 @@ BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *metrics ) TEXTMETRICA tm32; if (!GetTextMetricsA( (HDC)hdc, &tm32 )) return FALSE; - FONT_TextMetric32Ato16( &tm32, metrics ); + FONT_TextMetricATo16( &tm32, metrics ); return TRUE; } /*********************************************************************** - * GetTextMetricsA (GDI32.236) + * GetTextMetricsA (GDI32.@) */ BOOL WINAPI GetTextMetricsA( HDC hdc, TEXTMETRICA *metrics ) { @@ -1114,13 +1239,13 @@ BOOL WINAPI GetTextMetricsA( HDC hdc, TEXTMETRICA *metrics ) /*********************************************************************** - * GetTextMetricsW (GDI32.237) + * GetTextMetricsW (GDI32.@) */ BOOL WINAPI GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics ) { TEXTMETRICA tm; if (!GetTextMetricsA( (HDC16)hdc, &tm )) return FALSE; - FONT_TextMetric32Ato32W( &tm, metrics ); + FONT_TextMetricAToW( &tm, metrics ); return TRUE; } @@ -1146,7 +1271,9 @@ UINT16 WINAPI GetOutlineTextMetrics16( /*********************************************************************** - * GetOutlineTextMetricsA [GDI.207] Gets metrics for TrueType fonts. + * GetOutlineTextMetrics (GDI.207) + * GetOutlineTextMetricsA (GDI32.@) + * Gets metrics for TrueType fonts. * * * RETURNS @@ -1216,7 +1343,7 @@ UINT WINAPI GetOutlineTextMetricsA( } /*********************************************************************** - * GetOutlineTextMetricsW [GDI32.208] + * GetOutlineTextMetricsW [GDI32.@] */ UINT WINAPI GetOutlineTextMetricsW( HDC hdc, /* [in] Handle of device context */ @@ -1229,6 +1356,7 @@ UINT WINAPI GetOutlineTextMetricsW( /*********************************************************************** * GetCharWidth16 (GDI.350) + * GetCharWidth16 (DISPLAY.350) */ BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPINT16 buffer ) @@ -1264,7 +1392,7 @@ BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, /*********************************************************************** - * GetCharWidth32A (GDI32.155) + * GetCharWidth32A (GDI32.@) */ BOOL WINAPI GetCharWidth32A( HDC hdc, UINT firstChar, UINT lastChar, LPINT buffer ) @@ -1289,7 +1417,7 @@ BOOL WINAPI GetCharWidth32A( HDC hdc, UINT firstChar, UINT lastChar, /*********************************************************************** - * GetCharWidth32W (GDI32.158) + * GetCharWidth32W (GDI32.@) */ BOOL WINAPI GetCharWidth32W( HDC hdc, UINT firstChar, UINT lastChar, LPINT buffer ) @@ -1311,7 +1439,7 @@ DWORD WINAPI SetMapperFlags16( HDC16 hDC, DWORD dwFlag ) /*********************************************************************** - * SetMapperFlags (GDI32.322) + * SetMapperFlags (GDI32.@) */ DWORD WINAPI SetMapperFlags( HDC hDC, DWORD dwFlag ) { @@ -1336,7 +1464,7 @@ BOOL16 WINAPI GetAspectRatioFilterEx16( HDC16 hdc, LPSIZE16 pAspectRatio ) } /*********************************************************************** - * GetAspectRatioFilterEx (GDI32.142) + * GetAspectRatioFilterEx (GDI32.@) */ BOOL WINAPI GetAspectRatioFilterEx( HDC hdc, LPSIZE pAspectRatio ) { @@ -1360,7 +1488,7 @@ BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, /*********************************************************************** - * GetCharABCWidthsA (GDI32.149) + * GetCharABCWidthsA (GDI32.@) */ BOOL WINAPI GetCharABCWidthsA(HDC hdc, UINT firstChar, UINT lastChar, LPABC abc ) @@ -1370,7 +1498,7 @@ BOOL WINAPI GetCharABCWidthsA(HDC hdc, UINT firstChar, UINT lastChar, /****************************************************************************** - * GetCharABCWidthsW [GDI32.152] Retrieves widths of characters in range + * GetCharABCWidthsW [GDI32.@] Retrieves widths of characters in range * * PARAMS * hdc [I] Handle of device context @@ -1408,7 +1536,7 @@ DWORD WINAPI GetGlyphOutline16( HDC16 hdc, UINT16 uChar, UINT16 fuFormat, /*********************************************************************** - * GetGlyphOutlineA (GDI32.186) + * GetGlyphOutlineA (GDI32.@) */ DWORD WINAPI GetGlyphOutlineA( HDC hdc, UINT uChar, UINT fuFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, @@ -1420,7 +1548,7 @@ DWORD WINAPI GetGlyphOutlineA( HDC hdc, UINT uChar, UINT fuFormat, } /*********************************************************************** - * GetGlyphOutlineW (GDI32.187) + * GetGlyphOutlineW (GDI32.@) */ DWORD WINAPI GetGlyphOutlineW( HDC hdc, UINT uChar, UINT fuFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, @@ -1443,7 +1571,7 @@ BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden, } /*********************************************************************** - * CreateScalableFontResourceA (GDI32.62) + * CreateScalableFontResourceA (GDI32.@) */ BOOL WINAPI CreateScalableFontResourceA( DWORD fHidden, LPCSTR lpszResourceFile, @@ -1460,7 +1588,7 @@ BOOL WINAPI CreateScalableFontResourceA( DWORD fHidden, } /*********************************************************************** - * CreateScalableFontResourceW (GDI32.63) + * CreateScalableFontResourceW (GDI32.@) */ BOOL WINAPI CreateScalableFontResourceW( DWORD fHidden, LPCWSTR lpszResourceFile, @@ -1483,7 +1611,7 @@ BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes) /************************************************************************* - * GetRasterizerCaps (GDI32.216) + * GetRasterizerCaps (GDI32.@) */ BOOL WINAPI GetRasterizerCaps( LPRASTERIZER_STATUS lprs, UINT cbNumBytes) { @@ -1511,7 +1639,7 @@ INT16 WINAPI GetKerningPairs16( HDC16 hDC, INT16 cPairs, /************************************************************************* - * GetKerningPairsA (GDI32.192) + * GetKerningPairsA (GDI32.@) */ DWORD WINAPI GetKerningPairsA( HDC hDC, DWORD cPairs, LPKERNINGPAIR lpKerningPairs ) @@ -1525,7 +1653,7 @@ DWORD WINAPI GetKerningPairsA( HDC hDC, DWORD cPairs, /************************************************************************* - * GetKerningPairsW (GDI32.193) + * GetKerningPairsW (GDI32.@) */ DWORD WINAPI GetKerningPairsW( HDC hDC, DWORD cPairs, LPKERNINGPAIR lpKerningPairs ) @@ -1534,7 +1662,7 @@ DWORD WINAPI GetKerningPairsW( HDC hDC, DWORD cPairs, } /************************************************************************* - * TranslateCharsetInfo [GDI32.382] + * TranslateCharsetInfo [GDI32.@] * * Fills a CHARSETINFO structure for a character set, code page, or * font. This allows making the correspondance between different labelings @@ -1577,7 +1705,7 @@ BOOL WINAPI TranslateCharsetInfo( } /************************************************************************* - * GetFontLanguageInfo (GDI32.182) + * GetFontLanguageInfo (GDI32.@) */ DWORD WINAPI GetFontLanguageInfo(HDC hdc) { /* return value 0 is correct for most cases anyway */ @@ -1595,7 +1723,7 @@ DWORD WINAPI GetFontLanguageInfo16(HDC16 hdc) { } /************************************************************************* - * GetFontData [GDI32.181] Retrieve data for TrueType font + * GetFontData [GDI32.@] Retrieve data for TrueType font * * RETURNS * @@ -1629,7 +1757,7 @@ DWORD WINAPI GetFontData16(HDC16 hdc, DWORD dwTable, DWORD dwOffset, } /************************************************************************* - * GetCharacterPlacementA [GDI32.160] + * GetCharacterPlacementA [GDI32.@] * * NOTES: * the web browser control of ie4 calls this with dwFlags=0 @@ -1679,7 +1807,7 @@ GetCharacterPlacementA(HDC hdc, LPCSTR lpString, INT uCount, } /************************************************************************* - * GetCharacterPlacementW [GDI32.161] + * GetCharacterPlacementW [GDI32.@] */ DWORD WINAPI GetCharacterPlacementW(HDC hdc, LPCWSTR lpString, INT uCount, @@ -1692,7 +1820,7 @@ GetCharacterPlacementW(HDC hdc, LPCWSTR lpString, INT uCount, } /************************************************************************* - * GetCharABCWidthsFloatA [GDI32.150] + * GetCharABCWidthsFloatA [GDI32.@] */ BOOL WINAPI GetCharABCWidthsFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, LPABCFLOAT lpABCF) @@ -1702,7 +1830,7 @@ BOOL WINAPI GetCharABCWidthsFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, } /************************************************************************* - * GetCharABCWidthsFloatW [GDI32.151] + * GetCharABCWidthsFloatW [GDI32.@] */ BOOL WINAPI GetCharABCWidthsFloatW(HDC hdc, UINT iFirstChar, UINT iLastChar, LPABCFLOAT lpABCF) @@ -1712,7 +1840,7 @@ BOOL WINAPI GetCharABCWidthsFloatW(HDC hdc, UINT iFirstChar, } /************************************************************************* - * GetCharWidthFloatA [GDI32.156] + * GetCharWidthFloatA [GDI32.@] */ BOOL WINAPI GetCharWidthFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBuffer) @@ -1722,7 +1850,7 @@ BOOL WINAPI GetCharWidthFloatA(HDC hdc, UINT iFirstChar, } /************************************************************************* - * GetCharWidthFloatW [GDI32.157] + * GetCharWidthFloatW [GDI32.@] */ BOOL WINAPI GetCharWidthFloatW(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBuffer) @@ -1756,7 +1884,7 @@ INT16 WINAPI AddFontResource16( LPCSTR filename ) /*********************************************************************** - * AddFontResourceA (GDI32.2) + * AddFontResourceA (GDI32.@) */ INT WINAPI AddFontResourceA( LPCSTR str ) { @@ -1767,7 +1895,7 @@ INT WINAPI AddFontResourceA( LPCSTR str ) /*********************************************************************** - * AddFontResourceW (GDI32.4) + * AddFontResourceW (GDI32.@) */ INT WINAPI AddFontResourceW( LPCWSTR str ) { @@ -1787,7 +1915,7 @@ BOOL16 WINAPI RemoveFontResource16( LPCSTR str ) /*********************************************************************** - * RemoveFontResourceA (GDI32.284) + * RemoveFontResourceA (GDI32.@) */ BOOL WINAPI RemoveFontResourceA( LPCSTR str ) { @@ -1819,7 +1947,7 @@ BOOL WINAPI RemoveFontResourceA( LPCSTR str ) /*********************************************************************** - * RemoveFontResourceW (GDI32.286) + * RemoveFontResourceW (GDI32.@) */ BOOL WINAPI RemoveFontResourceW( LPCWSTR str ) { diff --git a/objects/gdiobj.c b/objects/gdiobj.c index e938de84a552b41c7547706506d91447fc977c3e..73730af9488a7b6ae6fd780418e3d868c000298a 100644 --- a/objects/gdiobj.c +++ b/objects/gdiobj.c @@ -96,61 +96,54 @@ static FONTOBJ OEMFixedFont = { { 0, FONT_MAGIC, 1 }, /* header */ { 0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, OEM_CHARSET, - 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, "" } + 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, {'\0'} } }; -/* Filler to make the location counter dword aligned again. This is necessary - since (a) FONTOBJ is packed, (b) gcc places initialised variables in the code - segment, and (c) Solaris assembler is stupid. */ -static UINT16 align_OEMFixedFont = 1; static FONTOBJ AnsiFixedFont = { { 0, FONT_MAGIC, 1 }, /* header */ { 0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, - 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, "" } + 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, {'\0'} } }; -static UINT16 align_AnsiFixedFont = 1; static FONTOBJ AnsiVarFont = { { 0, FONT_MAGIC, 1 }, /* header */ { 0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, - 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, "MS Sans Serif" } + 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, + {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} } }; -static UINT16 align_AnsiVarFont = 1; static FONTOBJ SystemFont = { { 0, FONT_MAGIC, 1 }, { 0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, - 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, "System" } + 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, + {'S','y','s','t','e','m','\0'} } }; -static UINT16 align_SystemFont = 1; static FONTOBJ DeviceDefaultFont = { { 0, FONT_MAGIC, 1 }, /* header */ { 0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, - 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, "" } + 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, {'\0'} } }; -static UINT16 align_DeviceDefaultFont = 1; static FONTOBJ SystemFixedFont = { { 0, FONT_MAGIC, 1 }, /* header */ { 0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, - 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, "" } + 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, {'\0'} } }; -static UINT16 align_SystemFixedFont = 1; /* FIXME: Is this correct? */ static FONTOBJ DefaultGuiFont = { { 0, FONT_MAGIC, 1 }, /* header */ { 0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, - 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, "MS Sans Serif" } + 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, + {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} } }; -static UINT16 align_DefaultGuiFont = 1; static GDIOBJHDR * StockObjects[NB_STOCK_OBJECTS] = @@ -329,15 +322,6 @@ BOOL GDI_Init(void) if ((instance = LoadLibrary16( "GDI.EXE" )) < 32) return FALSE; GDI_HeapSel = GlobalHandleToSel16( instance ); - /* Kill some warnings. */ - (void)align_OEMFixedFont; - (void)align_AnsiFixedFont; - (void)align_AnsiVarFont; - (void)align_SystemFont; - (void)align_DeviceDefaultFont; - (void)align_SystemFixedFont; - (void)align_DefaultGuiFont; - /* TWEAK: Initialize font hints */ ReadFontInformation("OEMFixed", &OEMFixedFont, 0, 0, 0, 0, 0); ReadFontInformation("AnsiFixed", &AnsiFixedFont, 0, 0, 0, 0, 0); @@ -551,7 +535,7 @@ void GDI_ReleaseObj( HGDIOBJ handle ) /*********************************************************************** - * DeleteObject16 (GDI.69) + * DeleteObject16 (GDI.605) */ BOOL16 WINAPI DeleteObject16( HGDIOBJ16 obj ) { @@ -560,7 +544,7 @@ BOOL16 WINAPI DeleteObject16( HGDIOBJ16 obj ) /*********************************************************************** - * DeleteObject (GDI32.70) + * DeleteObject (GDI32.@) */ BOOL WINAPI DeleteObject( HGDIOBJ obj ) { @@ -619,7 +603,7 @@ HGDIOBJ16 WINAPI GetStockObject16( INT16 obj ) /*********************************************************************** - * GetStockObject (GDI32.220) + * GetStockObject (GDI32.@) */ HGDIOBJ WINAPI GetStockObject( INT obj ) { @@ -675,7 +659,7 @@ INT16 WINAPI GetObject16( HANDLE16 handle, INT16 count, LPVOID buffer ) /*********************************************************************** - * GetObjectA (GDI32.204) + * GetObjectA (GDI32.@) */ INT WINAPI GetObjectA( HANDLE handle, INT count, LPVOID buffer ) { @@ -731,7 +715,7 @@ INT WINAPI GetObjectA( HANDLE handle, INT count, LPVOID buffer ) } /*********************************************************************** - * GetObjectW (GDI32.206) + * GetObjectW (GDI32.@) */ INT WINAPI GetObjectW( HANDLE handle, INT count, LPVOID buffer ) { @@ -775,7 +759,7 @@ INT WINAPI GetObjectW( HANDLE handle, INT count, LPVOID buffer ) } /*********************************************************************** - * GetObjectType (GDI32.205) + * GetObjectType (GDI32.@) */ DWORD WINAPI GetObjectType( HANDLE handle ) { @@ -832,7 +816,7 @@ DWORD WINAPI GetObjectType( HANDLE handle ) } /*********************************************************************** - * GetCurrentObject (GDI32.166) + * GetCurrentObject (GDI32.@) */ HANDLE WINAPI GetCurrentObject(HDC hdc,UINT type) { @@ -868,7 +852,7 @@ HGDIOBJ16 WINAPI SelectObject16( HDC16 hdc, HGDIOBJ16 handle ) /*********************************************************************** - * SelectObject (GDI32.299) + * SelectObject (GDI32.@) */ HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ handle ) { @@ -893,7 +877,7 @@ BOOL16 WINAPI UnrealizeObject16( HGDIOBJ16 obj ) /*********************************************************************** - * UnrealizeObject (GDI32.358) + * UnrealizeObject (GDI32.@) */ BOOL WINAPI UnrealizeObject( HGDIOBJ obj ) { @@ -1002,7 +986,7 @@ INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 nObjType, /*********************************************************************** - * EnumObjects (GDI32.89) + * EnumObjects (GDI32.@) */ INT WINAPI EnumObjects( HDC hdc, INT nObjType, GOBJENUMPROC lpEnumFunc, LPARAM lParam ) @@ -1106,7 +1090,7 @@ void WINAPI SetObjectOwner16( HGDIOBJ16 handle, HANDLE16 owner ) /*********************************************************************** - * SetObjectOwner (GDI32.386) + * SetObjectOwner (GDI32.@) */ void WINAPI SetObjectOwner( HGDIOBJ handle, HANDLE owner ) { @@ -1138,7 +1122,7 @@ void WINAPI MakeObjectPrivate16( HGDIOBJ16 handle, BOOL16 private ) /*********************************************************************** - * GdiFlush (GDI32.128) + * GdiFlush (GDI32.@) */ BOOL WINAPI GdiFlush(void) { @@ -1147,7 +1131,7 @@ BOOL WINAPI GdiFlush(void) /*********************************************************************** - * GdiGetBatchLimit (GDI32.129) + * GdiGetBatchLimit (GDI32.@) */ DWORD WINAPI GdiGetBatchLimit(void) { @@ -1156,7 +1140,7 @@ DWORD WINAPI GdiGetBatchLimit(void) /*********************************************************************** - * GdiSetBatchLimit (GDI32.139) + * GdiSetBatchLimit (GDI32.@) */ DWORD WINAPI GdiSetBatchLimit( DWORD limit ) { @@ -1240,7 +1224,7 @@ INT16 WINAPI MulDiv16( /******************************************************************* - * GetColorAdjustment [GDI32.164] + * GetColorAdjustment [GDI32.@] * * */ @@ -1251,7 +1235,7 @@ BOOL WINAPI GetColorAdjustment(HDC hdc, LPCOLORADJUSTMENT lpca) } /******************************************************************* - * GetMiterLimit [GDI32.201] + * GetMiterLimit [GDI32.@] * * */ @@ -1262,7 +1246,7 @@ BOOL WINAPI GetMiterLimit(HDC hdc, PFLOAT peLimit) } /******************************************************************* - * SetMiterLimit [GDI32.325] + * SetMiterLimit [GDI32.@] * * */ @@ -1273,7 +1257,7 @@ BOOL WINAPI SetMiterLimit(HDC hdc, FLOAT eNewLimit, PFLOAT peOldLimit) } /******************************************************************* - * GdiComment [GDI32.109] + * GdiComment [GDI32.@] * * */ @@ -1283,7 +1267,7 @@ BOOL WINAPI GdiComment(HDC hdc, UINT cbSize, const BYTE *lpData) return 0; } /******************************************************************* - * SetColorAdjustment [GDI32.309] + * SetColorAdjustment [GDI32.@] * * */