Kaydet (Commit) bf495a37 authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski Kaydeden (comit) Katarina Behrens

Qt5 fix font drawing

The main problem was the memory management of the harfbuzz memory
blob. Now we copy the font data tables into the blob, as the
QByteArray memory will be freed at the end of the function.

Change-Id: If5a5a4b1a235e66ba472b28a156e16be1b82bf2e
üst 564150f6
......@@ -41,7 +41,8 @@ static hb_blob_t* getFontTable(hb_face_t*, hb_tag_t nTableTag, void* pUserData)
hb_blob_t* pBlob = nullptr;
if (nLength > 0)
pBlob = hb_blob_create(aTable.data(), nLength, HB_MEMORY_MODE_DUPLICATE, nullptr, nullptr);
pBlob = hb_blob_create(aTable.data(), nLength,
HB_MEMORY_MODE_DUPLICATE, nullptr, nullptr);
return pBlob;
}
......
......@@ -28,6 +28,7 @@
#include <PhysicalFontCollection.hxx>
#include <QtGui/QFont>
#include <QtGui/QFontInfo>
#include <QtGui/QRawFont>
using namespace vcl;
......
......@@ -131,7 +131,20 @@ void Qt5Graphics::GetGlyphWidths(const PhysicalFontFace* /*pPFF*/, bool /*bVerti
{
}
bool Qt5Graphics::GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&) { return false; }
bool Qt5Graphics::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& rRect)
{
const int nLevel = rGlyph.mnFallbackLevel;
if( nLevel >= MAX_FALLBACK )
return false;
Qt5Font* pFont = m_pTextStyle[ nLevel ];
if( !pFont )
return false;
QRawFont aRawFont(QRawFont::fromFont( *pFont ));
rRect = toRectangle(aRawFont.boundingRect(rGlyph.maGlyphId).toAlignedRect());
return true;
}
bool Qt5Graphics::GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) { return false; }
......
......@@ -46,6 +46,11 @@ inline QRect toQRect(const tools::Rectangle& rRect)
return QRect(rRect.Left(), rRect.Top(), rRect.GetWidth(), rRect.GetHeight());
}
inline tools::Rectangle toRectangle(const QRect& rRect)
{
return tools::Rectangle(rRect.left(), rRect.top(), rRect.width(), rRect.height());
}
inline QSize toQSize(const Size& rSize) { return QSize(rSize.Width(), rSize.Height()); }
inline Size toSize(const QSize& rSize) { return Size(rSize.width(), rSize.height()); }
......
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