Draw: Font metrics simplified

git-svn-id: svn://ultimatepp.org/upp/trunk@12211 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2018-08-31 13:46:47 +00:00
parent 512dcc29bf
commit 244e1384e8
4 changed files with 3 additions and 9 deletions

View file

@ -155,10 +155,10 @@ public:
int GetAscent() const { return Fi().ascent; }
int GetDescent() const { return Fi().descent; }
int GetCy() const { return Fi().height; }
int GetCy() const { return GetAscent() + GetDescent(); }
int GetExternal() const { return Fi().external; }
int GetInternal() const { return Fi().internal; }
int GetLineHeight() const { return Fi().lineheight; }
int GetLineHeight() const { return GetCy() + GetExternal(); }
int GetOverhang() const { return Fi().overhang; }
int GetAveWidth() const { return Fi().avewidth; }
int GetMaxWidth() const { return Fi().maxwidth; }

View file

@ -144,9 +144,7 @@ CommonFontInfo GetFontInfoSys(Font font)
if(face) {
fi.ascent = face->size->metrics.ascender >> 6;
fi.descent = -(face->size->metrics.descender >> 6);
fi.height = fi.ascent + fi.descent;
fi.lineheight = face->size->metrics.height >> 6;
fi.external = 0;
fi.external = (face->size->metrics.height >> 6) - fi.ascent - fi.descent;
fi.internal = 0;
fi.overhang = 0;
fi.maxwidth = face->size->metrics.max_advance >> 6;

View file

@ -13,8 +13,6 @@ struct CommonFontInfo {
int descent;
int external;
int internal;
int height;
int lineheight;
int overhang;
int avewidth;
int maxwidth;

View file

@ -113,8 +113,6 @@ CommonFontInfo GetFontInfoSys(Font font)
fi.descent = tm.tmDescent;
fi.external = tm.tmExternalLeading;
fi.internal = tm.tmInternalLeading;
fi.height = fi.ascent + fi.descent;
fi.lineheight = fi.height + fi.external;
fi.overhang = tm.tmOverhang;
fi.avewidth = tm.tmAveCharWidth;
fi.maxwidth = tm.tmMaxCharWidth;