Commit cc43c720 authored by Oliver Sander's avatar Oliver Sander Committed by Albert Astals Cid

Replace Splash font rendering by Qt font rendering

Previously, the Arthur backend would use Splash code to do
its font rendering.  That was not a satisfactory solution:
Qt can do font rendering directly.  Also, the Splash font
rendering in the Arthur code had a few bugs, which lead
to legible-but-not-pretty fonts.

This patch replaces the Splash font rendering by Qt font
rendering.  Some Splash code will have to remain, because
Qt seems unable to do the proper charcode-to-glyph-index

I took a lot of inspiration from Mihai Niculescu's patch at

That's why the patch adds Mihai's name in the copyright list.
parent da63c355
This diff is collapsed.
......@@ -19,6 +19,7 @@
// Copyright (C) 2010 Pino Toscano <>
// Copyright (C) 2011 Andreas Hartmetz <>
// Copyright (C) 2013 Thomas Freitag <>
// Copyright (C) 2013 Mihai Niculescu <>
// Copyright (C) 2017 Oliver Sander <>
// To see a description of the changes please see the Changelog file that
......@@ -33,6 +34,9 @@
#pragma interface
#include <memory>
#include <map>
#include "goo/gtypes.h"
#include "OutputDev.h"
#include "GfxState.h"
......@@ -44,9 +48,9 @@ class GfxPath;
class Gfx8BitFont;
struct GfxRGB;
class SplashFont;
class SplashFontEngine;
struct SplashGlyphBitmap;
class QRawFont;
// ArthurOutputDev - Qt 5 QPainter renderer
......@@ -167,8 +171,29 @@ private:
QBrush m_currentBrush;
GBool m_needFontUpdate; // set when the font needs to be updated
SplashFontEngine *m_fontEngine;
SplashFont *m_font; // current font
XRef *xref; // xref table for current document
// The current font in use
QRawFont* m_rawFont;
// Identify a font by its 'Ref' and its font size
struct ArthurFontID
Ref ref;
double fontSize;
bool operator<(const ArthurFontID& other) const
return (ref.num < other.ref.num)
|| ((ref.num == other.ref.num) && (fontSize < other.fontSize));
// Cache all fonts
std::map<ArthurFontID,std::unique_ptr<QRawFont> > m_rawFontCache;
// The table that maps character codes to glyph indexes
int* m_codeToGID;
......@@ -145,4 +145,8 @@ SplashFont *SplashFTFontFile::makeFont(SplashCoord *mat,
return font;
int *SplashFTFontFile::getCodeToGID() {
return codeToGID;
......@@ -62,6 +62,9 @@ public:
SplashFont *makeFont(SplashCoord *mat,
SplashCoord *textMat) override;
// Provide access to the code-to-GID map
int* getCodeToGID();
SplashFTFontFile(SplashFTFontEngine *engineA,
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