diff options
-rw-r--r-- | vcl/win/source/gdi/salgdi3.cxx | 7 | ||||
-rw-r--r-- | vcl/win/source/gdi/winlayout.cxx | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index a802158f14aa..b99914f8a73d 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -1471,6 +1471,13 @@ HFONT WinSalGraphics::ImplDoSetFont( FontSelectPattern* i_pFont, float& o_rFontS // Prefer the scalable 'Microsoft Sans Serif' to the old raster 'MS Sans Serif' if( ImplSalWICompareAscii( aLogFont.lfFaceName, "MS Sans Serif" ) == 0 ) wcscpy( aLogFont.lfFaceName, L"Microsoft Sans Serif" ); + // Script and Roman are Win 3.1 bitmap fonts using "FON" font format + // which is not supported with "Direct Write" so let's substitute them + // with a font that is supported and always available. + if (ImplSalWICompareAscii(aLogFont.lfFaceName, "Script") == 0) + wcscpy(aLogFont.lfFaceName, L"Times New Roman"); + if (ImplSalWICompareAscii(aLogFont.lfFaceName, "Roman") == 0) + wcscpy(aLogFont.lfFaceName, L"Times New Roman"); // #i47675# limit font requests to MAXFONTHEIGHT // TODO: share MAXFONTHEIGHT font instance diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index c693085a693f..776dee4522fc 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -370,6 +370,7 @@ bool ImplWinFontEntry::CacheGlyphToAtlas(bool bRealGlyphIndices, int nGlyphIndex if (!pTxt->BindFont(hDC)) { + SAL_WARN("vcl.gdi", "Binding of font failed. The font might not be supported by Direct Write."); SelectObject(hDC, hOrigFont); DeleteDC(hDC); return false; @@ -399,6 +400,11 @@ bool ImplWinFontEntry::CacheGlyphToAtlas(bool bRealGlyphIndices, int nGlyphIndex // Fetch the ink boxes and calculate the size of the atlas. if (!bRealGlyphIndices) { + if (!pTxt->GetFontFace()) + { + SAL_WARN("vcl.gdi", "Font face is not available."); + return false; + } if (!SUCCEEDED(pTxt->GetFontFace()->GetGlyphIndices(aCodePointsOrGlyphIndices.data(), aCodePointsOrGlyphIndices.size(), aGlyphIndices.data()))) { pTxt->ReleaseFont(); @@ -409,6 +415,7 @@ bool ImplWinFontEntry::CacheGlyphToAtlas(bool bRealGlyphIndices, int nGlyphIndex { aGlyphIndices[0] = aCodePointsOrGlyphIndices[0]; } + Rectangle bounds(0, 0, 0, 0); auto aInkBoxes = pTxt->GetGlyphInkBoxes(aGlyphIndices.data(), aGlyphIndices.data() + 1); for (auto &box : aInkBoxes) |