From 244e1384e8ef1fa170f42f61bf5122532ef102dd Mon Sep 17 00:00:00 2001 From: cxl Date: Fri, 31 Aug 2018 13:46:47 +0000 Subject: [PATCH] Draw: Font metrics simplified git-svn-id: svn://ultimatepp.org/upp/trunk@12211 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Draw/Draw.h | 4 ++-- uppsrc/Draw/FontFc.cpp | 4 +--- uppsrc/Draw/FontInt.h | 2 -- uppsrc/Draw/FontWin32.cpp | 2 -- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/uppsrc/Draw/Draw.h b/uppsrc/Draw/Draw.h index 1beafb114..861c94b03 100644 --- a/uppsrc/Draw/Draw.h +++ b/uppsrc/Draw/Draw.h @@ -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; } diff --git a/uppsrc/Draw/FontFc.cpp b/uppsrc/Draw/FontFc.cpp index 8db0561ee..8e6d12395 100644 --- a/uppsrc/Draw/FontFc.cpp +++ b/uppsrc/Draw/FontFc.cpp @@ -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; diff --git a/uppsrc/Draw/FontInt.h b/uppsrc/Draw/FontInt.h index fb73e2bed..90a882148 100644 --- a/uppsrc/Draw/FontInt.h +++ b/uppsrc/Draw/FontInt.h @@ -13,8 +13,6 @@ struct CommonFontInfo { int descent; int external; int internal; - int height; - int lineheight; int overhang; int avewidth; int maxwidth; diff --git a/uppsrc/Draw/FontWin32.cpp b/uppsrc/Draw/FontWin32.cpp index 8df9cc72d..2914c366f 100644 --- a/uppsrc/Draw/FontWin32.cpp +++ b/uppsrc/Draw/FontWin32.cpp @@ -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;