diff options
author | Tim Eves <tim_eves@sil.org> | 2016-03-11 18:31:02 +0700 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2016-03-11 13:39:12 +0200 |
commit | 7bc54e59fb6afe3d59938be6ac8cbb2d346e6ec5 (patch) | |
tree | ddd3b863520967d07de205fec4fe9670506f7a5f | |
parent | 441cecb82d79cda21d325ebba7a6eb1ddda7598b (diff) |
Handle the non-real glyph case for AddChunkOfGlyphs
Convert UTF16 to UTF32 and turn codepoints into glyph indices with
DWrite.
Change-Id: I79c6e534e8e99416fc2c5a75c49e7c0a983954bb
-rw-r--r-- | vcl/win/gdi/winlayout.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index 3d5262951472..21fd76816a61 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -421,6 +421,16 @@ bool WinFontInstance::AddChunkOfGlyphs(bool bRealGlyphIndices, int nGlyphIndex, pTxt->BindFont(hDC); // Fetch the ink boxes and calculate the size of the atlas. + if (!bRealGlyphIndices) + { + // FIXME First convert from UTF16 to utf32 + std::vector<uint32_t> aCodePoints(aGlyphIndices.begin(), aGlyphIndices.end()); + if (!SUCCEEDED(pTxt->GetFontFace()->GetGlyphIndices(aCodePoints.data(), aCodePoints.size(), aGlyphIndices.data()))) + { + pTxt->ReleaseFont(); + return false; + } + } Rectangle bounds(0, 0, 0, 0); auto aInkBoxes = pTxt->GetGlyphInkBoxes(aGlyphIndices.data(), aGlyphIndices.data() + nCount); for (auto &box : aInkBoxes) @@ -519,7 +529,10 @@ bool WinFontInstance::AddChunkOfGlyphs(bool bRealGlyphIndices, int nGlyphIndex, ID2D1SolidColorBrush* pBrush = nullptr; if (!SUCCEEDED(pRT->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Black), &pBrush))) + { + pTxt->ReleaseFont(); return false; + } D2D1_POINT_2F baseline = { 0.0f, bounds.Bottom() - nY }; DWRITE_GLYPH_RUN glyphs = { |