Kaydet (Commit) 133c8c08 authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski Kaydeden (comit) Thorsten Behrens

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>
(cherry picked from commit a07524de)
Reviewed-on: https://gerrit.libreoffice.org/67408Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 98b7cf19
......@@ -26,7 +26,6 @@
#include <memory>
#include <vclpluginapi.h>
class GlyphCache;
class QCursor;
class VCLPLUG_QT5_PUBLIC Qt5Data : public GenericUnixSalData
......
......@@ -25,6 +25,8 @@
#include <vcl/fontcharmap.hxx>
#include <unx/geninst.h>
#include <unx/fontmanager.hxx>
#include <unx/glyphcache.hxx>
#include <unx/genpspgraphics.h>
#include <sallayout.hxx>
#include <PhysicalFontCollection.hxx>
......@@ -95,19 +97,32 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
return;
QFontDatabase aFDB;
QStringList aFontFamilyList;
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();
::std::vector<psp::fontID> aList;
psp::FastPrintFontInfo aInfo;
if (!rMgr.getFontFastInfo(elem, aInfo))
continue;
// 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();
rMgr.getFontList(aList);
for (auto const& elem : aList)
// register font files unknown to Qt
if (bUseFontconfig)
{
if (!rMgr.getFontFastInfo(elem, aInfo))
continue;
QString aFilename = toQString(
OStringToOUString(rMgr.getFontFileSysPath(aInfo.m_nID), RTL_TEXTENCODING_UTF8));
QRawFont aRawFont(aFilename, 0.0);
......@@ -116,9 +131,10 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
|| !aFDB.styles(aFamilyName).contains(aRawFont.styleName()))
QFontDatabase::addApplicationFont(aFilename);
}
}
if (bUseFontconfig)
SalGenericInstance::RegisterFontSubstitutors(pPFC);
}
for (auto& family : aFDB.families())
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