summaryrefslogtreecommitdiff
path: root/vcl/win/gdi/winlayout.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/win/gdi/winlayout.cxx')
-rw-r--r--vcl/win/gdi/winlayout.cxx36
1 files changed, 17 insertions, 19 deletions
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 6f5538140a2e..d5bbc048da43 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -139,9 +139,7 @@ WinFontInstance::~WinFontInstance()
::DeleteFont(m_hFont);
if (m_hVerticalFont)
- {
::DeleteFont(m_hVerticalFont);
- }
}
float WinFontInstance::getHScale() const
@@ -156,28 +154,28 @@ void WinFontInstance::ImplInitHbFont(hb_font_t* /*pHbFont*/)
{
assert(m_pGraphics);
// Calculate the AverageWidthFactor, see LogicalFontInstance::GetScale().
- if (GetFontSelectPattern().mnWidth)
- {
- double nUPEM = GetFontFace()->UnitsPerEm();
+ if (!GetFontSelectPattern().mnWidth)
+ return;
- LOGFONTW aLogFont;
- GetObjectW(m_hFont, sizeof(LOGFONTW), &aLogFont);
+ double nUPEM = GetFontFace()->UnitsPerEm();
- // Set the height (font size) to EM to minimize rounding errors.
- aLogFont.lfHeight = -nUPEM;
- // Set width to the default to get the original value in the metrics.
- aLogFont.lfWidth = 0;
+ LOGFONTW aLogFont;
+ GetObjectW(m_hFont, sizeof(LOGFONTW), &aLogFont);
- TEXTMETRICW aFontMetric;
- {
- // Get the font metrics.
- HDC hDC = m_pGraphics->getHDC();
- ScopedSelectedHFONT hFont(hDC, CreateFontIndirectW(&aLogFont));
- GetTextMetricsW(hDC, &aFontMetric);
- }
+ // Set the height (font size) to EM to minimize rounding errors.
+ aLogFont.lfHeight = -nUPEM;
+ // Set width to the default to get the original value in the metrics.
+ aLogFont.lfWidth = 0;
- SetAverageWidthFactor(nUPEM / aFontMetric.tmAveCharWidth);
+ TEXTMETRICW aFontMetric;
+ {
+ // Get the font metrics.
+ HDC hDC = m_pGraphics->getHDC();
+ ScopedSelectedHFONT hFont(hDC, CreateFontIndirectW(&aLogFont));
+ GetTextMetricsW(hDC, &aFontMetric);
}
+
+ SetAverageWidthFactor(nUPEM / aFontMetric.tmAveCharWidth);
}
void WinFontInstance::SetGraphics(WinSalGraphics* pGraphics)