啥也不罗嗦,上代码:
Gdiplus::SolidBrush brush(Gdiplus::Color(124,25,28));
Gdiplus::RectF bound;
SIZE sz;
HDC hDC = gs.GetHDC();
SetTextCharacterExtra( hDC, 0 );
SetTextJustification( hDC, 0, 1 );
gs.ReleaseHDC( hDC );
gs.SetSmoothingMode( SmoothingModeAntiAlias );
gs.SetTextRenderingHint( TextRenderingHintAntiAliasGridFit );
int emSize = 20;
Gdiplus::StringFormat *strFmt = Gdiplus::StringFormat::GenericTypographic()->Clone();
FontFamily fontFamily(L"微软雅黑");
//行间距计算
REAL linespace = fontFamily.GetLineSpacing(FontStyleRegular);
REAL ascent = fontFamily.GetCellAscent(FontStyleRegular);
REAL descent = fontFamily.GetCellDescent(FontStyleRegular);
REAL emheight = fontFamily.GetEmHeight(FontStyleRegular);
Font font(&fontFamily, emSize, FontStyleRegular, UnitPixel);
REAL ftheight = font.GetHeight(&gs);
REAL ftsize = font.GetSize();
INT16 ascentp