Kaydet (Commit) a07524de authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski

Qt5 initialize GlyphCache for PSP graphics

For whatever reason Calc uses a printer graphics context to
layout cell context. Without the initialized printer fonts,
you'll see broken cell content in Calc, until you edit them.

So now some part of the Qt5 GUI is painted by Cairo via the
psp::Printer graphics context.

Change-Id: Ib67c44abc952bc244f2c803d1dba8987ab618470
Reviewed-on: https://gerrit.libreoffice.org/66817
Tested-by: Jenkins
Reviewed-by: 's avatarJan-Marek Glogowski <glogow@fbihome.de>
üst a8a3928b
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <memory> #include <memory>
#include <vclpluginapi.h> #include <vclpluginapi.h>
class GlyphCache;
class QCursor; class QCursor;
class VCLPLUG_QT5_PUBLIC Qt5Data : public GenericUnixSalData class VCLPLUG_QT5_PUBLIC Qt5Data : public GenericUnixSalData
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#include <vcl/fontcharmap.hxx> #include <vcl/fontcharmap.hxx>
#include <unx/geninst.h> #include <unx/geninst.h>
#include <unx/fontmanager.hxx> #include <unx/fontmanager.hxx>
#include <unx/glyphcache.hxx>
#include <unx/genpspgraphics.h>
#include <sallayout.hxx> #include <sallayout.hxx>
#include <PhysicalFontCollection.hxx> #include <PhysicalFontCollection.hxx>
...@@ -96,19 +98,32 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC) ...@@ -96,19 +98,32 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
return; return;
QFontDatabase aFDB; QFontDatabase aFDB;
QStringList aFontFamilyList;
if (bUseFontconfig) if (bUseFontconfig)
aFontFamilyList = aFDB.families();
GlyphCache& rGC = GlyphCache::GetInstance();
psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
::std::vector<psp::fontID> aList;
psp::FastPrintFontInfo aInfo;
rMgr.getFontList(aList);
for (auto const& elem : aList)
{ {
const QStringList aFontFamilyList = aFDB.families(); if (!rMgr.getFontFastInfo(elem, aInfo))
::std::vector<psp::fontID> aList; continue;
psp::FastPrintFontInfo aInfo;
// normalize face number to the GlyphCache
int nFaceNum = rMgr.getFontFaceNumber(aInfo.m_nID);
// inform GlyphCache about this font provided by the PsPrint subsystem
FontAttributes aDFA = GenPspGraphics::Info2FontAttributes(aInfo);
aDFA.IncreaseQualityBy(4096);
const OString& rFileName = rMgr.getFontFileSysPath(aInfo.m_nID);
rGC.AddFontFile(rFileName, nFaceNum, aInfo.m_nID, aDFA);
psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); // register font files unknown to Qt
rMgr.getFontList(aList); if (bUseFontconfig)
for (auto const& elem : aList)
{ {
if (!rMgr.getFontFastInfo(elem, aInfo))
continue;
QString aFilename = toQString( QString aFilename = toQString(
OStringToOUString(rMgr.getFontFileSysPath(aInfo.m_nID), RTL_TEXTENCODING_UTF8)); OStringToOUString(rMgr.getFontFileSysPath(aInfo.m_nID), RTL_TEXTENCODING_UTF8));
QRawFont aRawFont(aFilename, 0.0); QRawFont aRawFont(aFilename, 0.0);
...@@ -117,9 +132,10 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC) ...@@ -117,9 +132,10 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
|| !aFDB.styles(aFamilyName).contains(aRawFont.styleName())) || !aFDB.styles(aFamilyName).contains(aRawFont.styleName()))
QFontDatabase::addApplicationFont(aFilename); QFontDatabase::addApplicationFont(aFilename);
} }
}
if (bUseFontconfig)
SalGenericInstance::RegisterFontSubstitutors(pPFC); SalGenericInstance::RegisterFontSubstitutors(pPFC);
}
for (auto& family : aFDB.families()) for (auto& family : aFDB.families())
for (auto& style : aFDB.styles(family)) for (auto& style : aFDB.styles(family))
......
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