Commit 88812e71 authored by Andreas Hartmetz's avatar Andreas Hartmetz Committed by Albert Astals Cid
Browse files

Add Hinting API to ArthurOutputDev

parent dc5ec466
......@@ -19,6 +19,7 @@
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com>
// Copyright (C) 2010 Matthias Fauconneau <matthias.fauconneau@gmail.com>
// Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
......@@ -86,7 +87,8 @@ private:
//------------------------------------------------------------------------
ArthurOutputDev::ArthurOutputDev(QPainter *painter):
m_painter(painter)
m_painter(painter),
m_fontHinting(NoHinting)
{
m_currentBrush = QBrush(Qt::SolidPattern);
m_fontEngine = 0;
......@@ -104,13 +106,18 @@ void ArthurOutputDev::startDoc(XRef *xrefA) {
xref = xrefA;
#ifdef HAVE_SPLASH
delete m_fontEngine;
const bool isHintingEnabled = m_fontHinting != NoHinting;
const bool isSlightHinting = m_fontHinting == SlightHinting;
m_fontEngine = new SplashFontEngine(
#if HAVE_T1LIB_H
globalParams->getEnableT1lib(),
#endif
#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
globalParams->getEnableFreeType(),
gFalse,
isHintingEnabled,
isSlightHinting,
#endif
m_painter->testRenderHint(QPainter::TextAntialiasing));
#endif
......
......@@ -16,7 +16,8 @@
// Copyright (C) 2005 Brad Hards <bradh@frogmouth.net>
// Copyright (C) 2005 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2010, 2010 Pino Toscano <pino@kde.org>
// Copyright (C) 2010 Pino Toscano <pino@kde.org>
// Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
......@@ -51,6 +52,15 @@ struct SplashGlyphBitmap;
class ArthurOutputDev: public OutputDev {
public:
/**
* Describes how fonts are distorted (aka hinted) to fit the pixel grid.
* More hinting means sharper edges and less adherence to the true letter shapes.
*/
enum FontHinting {
NoHinting = 0, ///< Font shapes are left unchanged
SlightHinting, ///< Font shapes are distorted vertically only
FullHinting ///< Font shapes are distorted horizontally and vertically
};
// Constructor.
ArthurOutputDev(QPainter *painter );
......@@ -58,6 +68,8 @@ public:
// Destructor.
virtual ~ArthurOutputDev();
void setFontHinting(FontHinting hinting) { m_fontHinting = hinting; }
//----- get info about output device
// Does this device use upside-down coordinates?
......@@ -147,6 +159,7 @@ public:
private:
QPainter *m_painter;
FontHinting m_fontHinting;
QFont m_currentFont;
QPen m_currentPen;
QBrush m_currentBrush;
......
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