Add static GetLogFontHeightAtPPI() overload taking point size
This will be useful elsewhere too and makes SetFractionalPointSize() implementation less fragile as we don't have to be careful about changing pointSize member before setting lf.lfHeight any more.
This commit is contained in:
@@ -122,7 +122,16 @@ public:
|
||||
|
||||
// MSW-specific: get the height value in pixels using LOGFONT convention
|
||||
// (i.e. negative) corresponding to the given size in points and DPI.
|
||||
int GetLogFontHeightAtPPI(int ppi) const;
|
||||
static int GetLogFontHeightAtPPI(float size, int ppi)
|
||||
{
|
||||
return -wxRound(size * ppi / 72.0);
|
||||
}
|
||||
|
||||
// And the same thing for the size of this font.
|
||||
int GetLogFontHeightAtPPI(int ppi) const
|
||||
{
|
||||
return GetLogFontHeightAtPPI(pointSize, ppi);
|
||||
}
|
||||
|
||||
LOGFONT lf;
|
||||
|
||||
|
Reference in New Issue
Block a user