Kaydet (Commit) ba815705 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Error handling

Change-Id: I46e5463aaa5cab41cd69c13314ee98a0c73e7ba2
üst dc0167c2
......@@ -271,6 +271,8 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, const WinLayout& rLayou
if (!GetCharABCWidthsI(hDC, 0, nCount, aGlyphIndices.data(), aABC.data()))
{
SAL_WARN("vcl.gdi", "GetCharABCWidthsI failed: " << WindowsErrorString(GetLastError()));
SelectObject(hDC, hOrigFont);
DeleteDC(hDC);
return false;
}
......@@ -296,10 +298,24 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, const WinLayout& rLayou
}
TEXTMETRICW aTextMetric;
GetTextMetricsW(hDC, &aTextMetric);
if (!GetTextMetricsW(hDC, &aTextMetric))
{
SAL_WARN("vcl.gdi", "GetTextMetrics failed: " << WindowsErrorString(GetLastError()));
SelectObject(hDC, hOrigFont);
DeleteDC(hDC);
return false;
}
aChunk.mnAscentPlusIntLeading = aTextMetric.tmAscent + aTextMetric.tmInternalLeading;
UINT nAlign = GetTextAlign(hDC);
if (nAlign == GDI_ERROR)
{
SAL_WARN("vcl.gdi", "GetTextAlign failed: " << WindowsErrorString(GetLastError()));
SelectObject(hDC, hOrigFont);
DeleteDC(hDC);
return false;
}
OUString sAlign;
switch ((TA_LEFT|TA_CENTER|TA_RIGHT) & nAlign)
{
......@@ -339,10 +355,24 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, const WinLayout& rLayou
sAlign += "NOUPDATECP";
LOGFONTW aLogfont;
GetObjectW(rLayout.mhFont, sizeof(aLogfont), &aLogfont);
if (!GetObjectW(rLayout.mhFont, sizeof(aLogfont), &aLogfont))
{
SAL_WARN("vcl.gdi", "GetObject failed: " << WindowsErrorString(GetLastError()));
SelectObject(hDC, hOrigFont);
DeleteDC(hDC);
return false;
}
wchar_t sFaceName[200];
int nFaceNameLen = GetTextFaceW(hDC, SAL_N_ELEMENTS(sFaceName), sFaceName);
if (!nFaceNameLen)
{
SAL_WARN("vcl.gdi", "GetTextFace failed: " << WindowsErrorString(GetLastError()));
SelectObject(hDC, hOrigFont);
DeleteDC(hDC);
return false;
}
SAL_INFO("vcl.gdi.opengl", OUString(sFaceName, nFaceNameLen) <<
": " << sAlign <<
" Escapement=" << aLogfont.lfEscapement <<
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment