r23163 by craig - Code cleanups across the board
scribus-commit
scribus-commit at lists.scribus.net
Mon Aug 26 05:52:00 UTC 2019
Author: craig
Date: Mon Aug 26 05:52:00 2019
New Revision: 23163
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23163
Log:
Code cleanups across the board
Modified:
trunk/Scribus/scribus/actionsearch.cpp
trunk/Scribus/scribus/actionsearch.h
trunk/Scribus/scribus/cmsettings.cpp
trunk/Scribus/scribus/cmsettings.h
trunk/Scribus/scribus/colorblind.h
trunk/Scribus/scribus/colorsetmanager.cpp
trunk/Scribus/scribus/desaxe/saxiohelper.cpp
trunk/Scribus/scribus/desaxe/simple_actions.h
trunk/Scribus/scribus/desaxe/uniqueid.h
trunk/Scribus/scribus/docinfo.h
trunk/Scribus/scribus/documentchecker.cpp
trunk/Scribus/scribus/documentinformation.h
trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
trunk/Scribus/scribus/downloadmanager/scdlmgr.h
trunk/Scribus/scribus/downloadmanager/scdlthread.cpp
trunk/Scribus/scribus/downloadmanager/scdlthread.h
trunk/Scribus/scribus/fontlistmodel.h
trunk/Scribus/scribus/fonts/cff.h
trunk/Scribus/scribus/fonts/scface.cpp
trunk/Scribus/scribus/fonts/scface.h
trunk/Scribus/scribus/fonts/scface_ps.cpp
trunk/Scribus/scribus/fonts/scface_ps.h
trunk/Scribus/scribus/fonts/scface_ttf.cpp
trunk/Scribus/scribus/fpointarray.h
trunk/Scribus/scribus/marks.h
trunk/Scribus/scribus/scfonts.cpp
Modified: trunk/Scribus/scribus/actionsearch.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/actionsearch.cpp
==============================================================================
--- trunk/Scribus/scribus/actionsearch.cpp (original)
+++ trunk/Scribus/scribus/actionsearch.cpp Mon Aug 26 05:52:00 2019
@@ -30,7 +30,7 @@
readMenuActions(menuAction->menu());
}
-void ActionSearch::execute(QString actionName)
+void ActionSearch::execute(const QString& actionName)
{
if (!m_actions.contains(actionName))
return;
Modified: trunk/Scribus/scribus/actionsearch.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/actionsearch.h
==============================================================================
--- trunk/Scribus/scribus/actionsearch.h (original)
+++ trunk/Scribus/scribus/actionsearch.h Mon Aug 26 05:52:00 2019
@@ -23,12 +23,12 @@
{
public:
ActionSearch(QMenuBar *menuBar);
- ~ActionSearch() {}
+ ~ActionSearch() = default;
QList<QString> getActionNames() const { return m_actions.keys(); }
void update();
- void execute(QString actionName);
+ void execute(const QString& actionName);
private:
QMenuBar* menuBar;
Modified: trunk/Scribus/scribus/cmsettings.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/cmsettings.cpp
==============================================================================
--- trunk/Scribus/scribus/cmsettings.cpp (original)
+++ trunk/Scribus/scribus/cmsettings.cpp Mon Aug 26 05:52:00 2019
@@ -28,12 +28,9 @@
#include "scribusdoc.h"
CMSettings::CMSettings(ScribusDoc* doc, const QString& profileName, eRenderIntent intent) :
-m_Doc(doc),
-m_colorManagementAllowed(true),
-m_softProofingAllowed(false),
-m_useEmbeddedProfile(false),
-m_ProfileName(profileName),
-m_Intent(intent)
+ m_Doc(doc),
+ m_ProfileName(profileName),
+ m_Intent(intent)
{
}
Modified: trunk/Scribus/scribus/cmsettings.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/cmsettings.h
==============================================================================
--- trunk/Scribus/scribus/cmsettings.h (original)
+++ trunk/Scribus/scribus/cmsettings.h Mon Aug 26 05:52:00 2019
@@ -91,9 +91,9 @@
protected:
ScribusDoc* m_Doc;
- bool m_colorManagementAllowed;
- bool m_softProofingAllowed;
- bool m_useEmbeddedProfile;
+ bool m_colorManagementAllowed {true};
+ bool m_softProofingAllowed {false};
+ bool m_useEmbeddedProfile {false};
QString m_ProfileName;
eRenderIntent m_Intent;
ScColorProfile m_outputProfile;
Modified: trunk/Scribus/scribus/colorblind.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/colorblind.h
==============================================================================
--- trunk/Scribus/scribus/colorblind.h (original)
+++ trunk/Scribus/scribus/colorblind.h Mon Aug 26 05:52:00 2019
@@ -70,7 +70,7 @@
VisionDefectColor();
/*! \brief Actual defect type. One of the 'defectMode' */
- int deficiency;
+ int deficiency {0};
/*! \brief Perform conversion itself.
Gama removing, RGB2LSM, matrix operation for selected deficiency,
@@ -104,21 +104,27 @@
private:
/*! \brief Convert matrix */
- double m_rgb2lms[9];
+ double m_rgb2lms[9] {0.0};
/*! \brief Convert matrix */
- double m_lms2rgb[9];
+ double m_lms2rgb[9] {0.0};
/*! \brief Gamma matrix */
- double m_gammaRGB[3];
+ double m_gammaRGB[3] {0.0};
/*! \brief cross products with transform matrixes for actual defect */
- double m_a1, m_b1, m_c1;
+ double m_a1 {0.0};
+ double m_b1 {0.0};
+ double m_c1 {0.0};
/*! \brief cross products with transform matrixes for actual defect */
- double m_a2, m_b2, m_c2;
+ double m_a2 {0.0};
+ double m_b2 {0.0};
+ double m_c2 {0.0};
/*! \brief Inflection border line */
- double m_inflection;
+ double m_inflection {0.0};
/*! \brief Internal RGB color parts */
- double m_red, m_green, m_blue;
+ double m_red {0.0};
+ double m_green {0.0};
+ double m_blue {0.0};
/*! \brief original color */
QColor m_originalColor;
Modified: trunk/Scribus/scribus/colorsetmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/colorsetmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/colorsetmanager.cpp (original)
+++ trunk/Scribus/scribus/colorsetmanager.cpp Mon Aug 26 05:52:00 2019
@@ -147,9 +147,9 @@
void ColorSetManager::findPaletteLocations()
{
paletteLocations.clear();
- QStringList locations=ScPaths::instance().systemCreatePalettesDirs();
+ QStringList locations=ScPaths::systemCreatePalettesDirs();
locations << ScPaths::instance().shareDir()+"swatches/";
- locations << ScPaths::instance().dirsFromEnvVar("XDG_DATA_HOME", "scribus/swatches/");
+ locations << ScPaths::dirsFromEnvVar("XDG_DATA_HOME", "scribus/swatches/");
for ( QStringList::Iterator it = locations.begin(); it != locations.end(); ++it )
{
QFileInfo paletteDir(*it);
@@ -159,7 +159,7 @@
paletteLocationLocks.insert((*it), !paletteDir.isWritable());
}
}
- QStringList xdgSysLocations=ScPaths::instance().dirsFromEnvVar("XDG_DATA_DIRS", "scribus/swatches/");
+ QStringList xdgSysLocations=ScPaths::dirsFromEnvVar("XDG_DATA_DIRS", "scribus/swatches/");
for ( QStringList::Iterator it = xdgSysLocations.begin(); it != xdgSysLocations.end(); ++it )
{
QFile paletteDir(*it);
Modified: trunk/Scribus/scribus/desaxe/saxiohelper.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/desaxe/saxiohelper.cpp
==============================================================================
--- trunk/Scribus/scribus/desaxe/saxiohelper.cpp (original)
+++ trunk/Scribus/scribus/desaxe/saxiohelper.cpp Mon Aug 26 05:52:00 2019
@@ -116,9 +116,9 @@
}
-Xml_string toXMLString(bool what)
-{
- return what? "yes" : "no";
+Xml_string toXMLString(bool val)
+{
+ return val ? "yes" : "no";
}
Modified: trunk/Scribus/scribus/desaxe/simple_actions.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/desaxe/simple_actions.h
==============================================================================
--- trunk/Scribus/scribus/desaxe/simple_actions.h (original)
+++ trunk/Scribus/scribus/desaxe/simple_actions.h Mon Aug 26 05:52:00 2019
@@ -55,8 +55,8 @@
public:
typedef Obj_Type* (*FunType)();
- Factory_body()
- : create_(NULL)
+ Factory_body()
+ : create_(nullptr)
{}
Factory_body(FunType create)
Modified: trunk/Scribus/scribus/desaxe/uniqueid.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/desaxe/uniqueid.h
==============================================================================
--- trunk/Scribus/scribus/desaxe/uniqueid.h (original)
+++ trunk/Scribus/scribus/desaxe/uniqueid.h Mon Aug 26 05:52:00 2019
@@ -18,15 +18,16 @@
/**
* This filter suppresses the output of
*/
-class UniqueID : public SaxFilter {
+class UniqueID : public SaxFilter
+{
public:
- UniqueID(SaxHandler* delegate) : SaxFilter(delegate), m_seenIDs(), m_level(0) {}
- virtual void begin(const Xml_string& tag, Xml_attr attr);
- virtual void end(const Xml_string& tag);
- virtual void chars(const Xml_string& text);
+ UniqueID(SaxHandler* delegate) : SaxFilter(delegate) {}
+ void begin(const Xml_string& tag, Xml_attr attr) override;
+ void end(const Xml_string& tag) override;
+ void chars(const Xml_string& text) override;
private:
std::set<Xml_string> m_seenIDs;
- int m_level;
+ int m_level {0};
};
#endif
Modified: trunk/Scribus/scribus/docinfo.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/docinfo.h
==============================================================================
--- trunk/Scribus/scribus/docinfo.h (original)
+++ trunk/Scribus/scribus/docinfo.h Mon Aug 26 05:52:00 2019
@@ -28,7 +28,7 @@
public:
DocInfos( QWidget* parent, DocumentInformation& docInfo );
- ~DocInfos() {};
+ ~DocInfos() = default;
/*! \brief Class wide DocumentInformation& docInfo reference. */
DocumentInformation infos;
Modified: trunk/Scribus/scribus/documentchecker.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/documentchecker.cpp
==============================================================================
--- trunk/Scribus/scribus/documentchecker.cpp (original)
+++ trunk/Scribus/scribus/documentchecker.cpp Mon Aug 26 05:52:00 2019
@@ -43,7 +43,7 @@
// const TextLayout& m_textLayout;
public:
- MissingGlyphsPainter(errorCodes& itemError, const TextLayout& textLayout)
+ MissingGlyphsPainter(errorCodes& itemError, const TextLayout& /*textLayout*/)
: m_itemError(itemError)
// , m_textLayout(textLayout)
{ }
Modified: trunk/Scribus/scribus/documentinformation.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/documentinformation.h
==============================================================================
--- trunk/Scribus/scribus/documentinformation.h (original)
+++ trunk/Scribus/scribus/documentinformation.h Mon Aug 26 05:52:00 2019
@@ -29,7 +29,7 @@
{
public:
DocumentInformation();
- ~DocumentInformation() {};
+ ~DocumentInformation() = default;
const QString& author();
const QString& comments();
const QString& contrib();
Modified: trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
==============================================================================
--- trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp (original)
+++ trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp Mon Aug 26 05:52:00 2019
@@ -14,7 +14,6 @@
ScDLManager::ScDLManager(QObject *parent)
: QObject(parent)
{
- m_dlID=0;
m_thread=new ScDLThread();
connect(m_thread, SIGNAL(fileReceived(const QString &)), this, SLOT(dlReceived(const QString&)));
connect(m_thread, SIGNAL(fileFailed(const QString &)), this, SLOT(dlFailed(const QString&)));
Modified: trunk/Scribus/scribus/downloadmanager/scdlmgr.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/downloadmanager/scdlmgr.h
==============================================================================
--- trunk/Scribus/scribus/downloadmanager/scdlmgr.h (original)
+++ trunk/Scribus/scribus/downloadmanager/scdlmgr.h Mon Aug 26 05:52:00 2019
@@ -19,7 +19,7 @@
{
Q_OBJECT
public:
- ScDLManager(QObject *parent = 0);
+ ScDLManager(QObject *parent = nullptr);
~ScDLManager();
//TODO: Add download groups so different parts of Scribus can be downloading at the same time
@@ -44,7 +44,7 @@
private:
ScDLThread *m_thread;
- int m_dlID;
+ int m_dlID {0};
QList <DownloadData> m_fileList;
};
Modified: trunk/Scribus/scribus/downloadmanager/scdlthread.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/downloadmanager/scdlthread.cpp
==============================================================================
--- trunk/Scribus/scribus/downloadmanager/scdlthread.cpp (original)
+++ trunk/Scribus/scribus/downloadmanager/scdlthread.cpp Mon Aug 26 05:52:00 2019
@@ -11,10 +11,8 @@
#include <QUrl>
-ScDLThread::ScDLThread(QObject *parent) : QThread(parent),
- m_downloadedCount(0), m_totalCount(0)
-{
- m_currentDownload = nullptr;
+ScDLThread::ScDLThread(QObject *parent) : QThread(parent)
+{
connect(this, SIGNAL(runSignal()), this, SLOT(runSlot()));
}
Modified: trunk/Scribus/scribus/downloadmanager/scdlthread.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/downloadmanager/scdlthread.h
==============================================================================
--- trunk/Scribus/scribus/downloadmanager/scdlthread.h (original)
+++ trunk/Scribus/scribus/downloadmanager/scdlthread.h Mon Aug 26 05:52:00 2019
@@ -14,7 +14,7 @@
{
Q_OBJECT
public:
- ScDLThread(QObject * parent = 0);
+ ScDLThread(QObject * parent = nullptr);
~ScDLThread();
void run();
@@ -43,9 +43,9 @@
QStringList m_urlList;
QFile m_output;
QQueue<QPair<QUrl, QString> > m_downloadQueue;
- int m_downloadedCount;
- int m_totalCount;
- QNetworkReply *m_currentDownload;
+ int m_downloadedCount {0};
+ int m_totalCount {0};
+ QNetworkReply *m_currentDownload {nullptr};
QNetworkAccessManager m_manager;
};
#endif
Modified: trunk/Scribus/scribus/fontlistmodel.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/fontlistmodel.h
==============================================================================
--- trunk/Scribus/scribus/fontlistmodel.h (original)
+++ trunk/Scribus/scribus/fontlistmodel.h Mon Aug 26 05:52:00 2019
@@ -32,7 +32,7 @@
Q_OBJECT
public:
- FontListModel(QObject * parent = 0, ScribusDoc * doc = 0, bool includeDisabled = false);
+ FontListModel(QObject * parent = nullptr, ScribusDoc * doc = nullptr, bool includeDisabled = false);
enum ColumnTypes {
FontUsable = 0,
Modified: trunk/Scribus/scribus/fonts/cff.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/fonts/cff.h
==============================================================================
--- trunk/Scribus/scribus/fonts/cff.h (original)
+++ trunk/Scribus/scribus/fonts/cff.h Mon Aug 26 05:52:00 2019
@@ -152,13 +152,13 @@
struct CFF_Number
{
- long long card;
- int exponent;
- uchar type;
+ long long card {0};
+ int exponent {0};
+ uchar type {0};
bool isCardinal() const;
double toDouble() const;
int toCardinal() const;
- CFF_Number() : card(0),exponent(0),type(0) {};
+ CFF_Number() {};
};
@@ -167,8 +167,8 @@
uchar type;
QList<CFF_Number> array;
CFF_Variant() : type(cff_varnt_Error) {}
- CFF_Variant(CFF_Number val) : type(val.type), array() { array.append(val); }
- CFF_Variant(QList<CFF_Number> arr) : type(cff_varnt_Array), array(arr) {}
+ CFF_Variant(CFF_Number val) : type(val.type) { array.append(val); }
+ CFF_Variant(const QList<CFF_Number>& arr) : type(cff_varnt_Array), array(arr) {}
};
Modified: trunk/Scribus/scribus/fonts/scface.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/fonts/scface.cpp
==============================================================================
--- trunk/Scribus/scribus/fonts/scface.cpp (original)
+++ trunk/Scribus/scribus/fonts/scface.cpp Mon Aug 26 05:52:00 2019
@@ -19,25 +19,12 @@
static const QString NONE_LITERAL("(None)");
-ScFace::ScFaceData::ScFaceData() :
- refs(0),
- usage(0),
+ScFace::ScFaceData::ScFaceData() :
fontFile(NONE_LITERAL),
- faceIndex(-1),
status(ScFace::NULLFACE),
typeCode(ScFace::UNKNOWN_TYPE),
formatCode(ScFace::UNKNOWN_FORMAT),
- usable(false),
- embedPs(false),
- subset(false),
- outline(false),
- isCIDFont(false),
- isStroked(false),
- isFixedPitch(false),
- hasGlyphNames(false),
- maxGlyph(0),
- m_cachedStatus(ScFace::UNKNOWN),
- m_hbFont(nullptr)
+ m_cachedStatus(ScFace::UNKNOWN)
{
}
@@ -154,27 +141,27 @@
}
-FPointArray ScFace::ScFaceData::glyphOutline(gid_type gl, qreal sz) const
+FPointArray ScFace::ScFaceData::glyphOutline(gid_type gl, qreal size) const
{
if (gl >= CONTROL_GLYPHS)
return FPointArray();
if (! m_glyphWidth.contains(gl))
loadGlyph(gl);
FPointArray res = m_glyphOutline[gl].Outlines.copy();
- if (sz != 1.0)
- res.scale(sz, sz);
+ if (size != 1.0)
+ res.scale(size, size);
return res;
}
-FPoint ScFace::ScFaceData::glyphOrigin(gid_type gl, qreal sz) const
+FPoint ScFace::ScFaceData::glyphOrigin(gid_type gl, qreal size) const
{
if (gl >= CONTROL_GLYPHS)
return FPoint(0,0);
if (! m_glyphWidth.contains(gl))
loadGlyph(gl);
const struct GlyphData & res(m_glyphOutline[gl]);
- return FPoint(res.x, res.y) * sz;
+ return FPoint(res.x, res.y) * size;
}
Modified: trunk/Scribus/scribus/fonts/scface.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/fonts/scface.h
==============================================================================
--- trunk/Scribus/scribus/fonts/scface.h (original)
+++ trunk/Scribus/scribus/fonts/scface.h Mon Aug 26 05:52:00 2019
@@ -99,13 +99,13 @@
struct GlyphData {
FPointArray Outlines;
- qreal x;
- qreal y;
- qreal bbox_width;
- qreal bbox_ascent;
- qreal bbox_descent;
- bool broken;
- GlyphData() : Outlines(), x(0), y(0), bbox_width(1), bbox_ascent(1), bbox_descent(0), broken(true) {}
+ qreal x {0.0};
+ qreal y {0.0};
+ qreal bbox_width {1.0};
+ qreal bbox_ascent {1.0};
+ qreal bbox_descent {0.0};
+ bool broken {true};
+ GlyphData() {}
};
@@ -113,13 +113,13 @@
class ScFaceData {
public:
/// controls destruction
- mutable int refs;
+ mutable int refs {0};
/// controls load()
- mutable int usage;
+ mutable int usage {0};
QString scName;
QString fontFile;
- int faceIndex;
+ int faceIndex {-1};
QString psName;
QString family;
QString style;
@@ -132,16 +132,16 @@
ScFace::FontType typeCode;
ScFace::FontFormat formatCode;
- bool usable;
- bool embedPs;
- bool subset;
- bool outline;
-
- bool isCIDFont;
- bool isStroked;
- bool isFixedPitch;
- bool hasGlyphNames;
- gid_type maxGlyph;
+ bool usable {false};
+ bool embedPs {false};
+ bool subset {false};
+ bool outline {false};
+
+ bool isCIDFont {false};
+ bool isStroked {false};
+ bool isFixedPitch {false};
+ bool hasGlyphNames {false};
+ gid_type maxGlyph {0};
ScFaceData();
virtual ~ScFaceData();
@@ -154,7 +154,7 @@
mutable QHash<gid_type, qreal> m_glyphWidth;
mutable QHash<gid_type, GlyphData> m_glyphOutline;
//mutable QHash<gid_type, uint> m_cMap;
- void* m_hbFont;
+ void* m_hbFont {nullptr};
// fill caches & members
@@ -209,9 +209,9 @@
virtual bool glyphNames(ScFace::FaceEncoding& gList) const;
// these use the cache:
- virtual qreal glyphWidth(gid_type gl, qreal sz) const;
- virtual FPointArray glyphOutline(gid_type gl, qreal sz) const;
- virtual FPoint glyphOrigin (gid_type gl, qreal sz) const;
+ virtual qreal glyphWidth(gid_type gl, qreal size) const;
+ virtual FPointArray glyphOutline(gid_type gl, qreal size) const;
+ virtual FPoint glyphOrigin (gid_type gl, qreal size) const;
virtual bool isSymbolic() const { return false; }
};
@@ -272,7 +272,7 @@
return result;
}
- void chReplacementTo(ScFace& other, QString doc) {
+ void chReplacementTo(ScFace& other, const QString& doc) {
QString oldName = m_replacedName;
(*this) = other;
m_replacedName = oldName;
Modified: trunk/Scribus/scribus/fonts/scface_ps.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/fonts/scface_ps.cpp
==============================================================================
--- trunk/Scribus/scribus/fonts/scface_ps.cpp (original)
+++ trunk/Scribus/scribus/fonts/scface_ps.cpp Mon Aug 26 05:52:00 2019
@@ -13,7 +13,14 @@
-QStringList ScFace_postscript::findFontMetrics(const QString& fontPath) const
+ScFace_PostScript::ScFace_PostScript(const QString& fam, const QString& sty, const QString& alt, const QString& scname, const QString& psname, const QString& path, int face, const QStringList& features) :
+ FtFace(fam,sty,alt,scname,psname,path,face,features)
+{
+ isFixedPitch = false;
+ typeCode = ScFace::TYPE1;
+}
+
+QStringList ScFace_PostScript::findFontMetrics(const QString& fontPath) const
{
QStringList metricsFiles;
QFileInfo fi(fontPath);
@@ -39,7 +46,7 @@
return metricsFiles;
}
-QStringList ScFace_postscript::findFontMetrics(const QString& baseDir, const QString& baseName) const
+QStringList ScFace_PostScript::findFontMetrics(const QString& baseDir, const QString& baseName) const
{
QStringList metricsFiles;
QString afnm = baseDir + "/" + baseName + ".";
@@ -78,7 +85,7 @@
return metricsFiles;
}
-bool ScFace_postscript::loadFontMetrics(FT_Face face, const QString& fontPath) const
+bool ScFace_PostScript::loadFontMetrics(FT_Face face, const QString& fontPath) const
{
bool metricsFound = false;
QStringList fontMetrics = findFontMetrics(fontPath);
@@ -107,3 +114,158 @@
qDebug() << QObject::tr("No metrics found for font %1, ignoring font").arg(fontPath);
return metricsFound;
}
+
+void ScFace_PostScript::load() const // routine by Franz Schmid - modified by Alastair M. Robinson
+{
+ FtFace::load();
+ // bool error;
+ FT_Face face = ftFace();
+ if (!face)
+ {
+ const_cast<ScFace_PostScript*>(this)->usable = false;
+ qDebug("%s", QObject::tr("Font %1 is broken (no Face), discarding it").arg(fontFile).toLocal8Bit().constData());
+ return;
+ }
+ if (loadFontMetrics(face, fontFile))
+ {
+ // re-initialize: ScFaceData::load() just clears caches,
+ // FtFace::load() skips FT_New_Face if m_face is already defined.
+ // don't mind checking glyphs again for now (PS files have only 255 glyphs max, anyway)
+ FtFace::load();
+ }
+ // Ascent = tmp.setNum(face->ascender);
+ // Descender = tmp.setNum(face->descender);
+ // CapHeight = Ascent;
+ // ItalicAngle = "0";
+ // FontBBox = tmp.setNum(face->bbox.xMin)+" "+tmp2.setNum(face->bbox.yMin)+" "+tmp3.setNum(face->bbox.xMax)+" "+tmp4.setNum(face->bbox.yMax);
+ /*
+ setBestEncoding(face);
+ gindex = 0;
+ charcode = FT_Get_First_Char( face, &gindex );
+ int goodGlyph = 0;
+ int invalidGlyph = 0;
+ while ( gindex != 0 )
+ {
+ error = FT_Load_Glyph( face, gindex, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP );
+ if (error)
+ {
+ ++invalidGlyph;
+ sDebug(QObject::tr("Font %1 has broken glyph %2 (charcode %3)").arg(fontPath()).arg(gindex).arg(charcode));
+ charcode = FT_Get_Next_Char( face, charcode, &gindex );
+ continue;
+ }
+ ++goodGlyph;
+ qreal ww = face->glyph->metrics.horiAdvance / uniEM;
+ if (face->glyph->format == FT_GLYPH_FORMAT_PLOTTER)
+ isStroked = true;
+ error = false;
+ outlines = traceChar(face, charcode, 10, &x, &y, &error);
+ if (!error)
+ {
+ CharWidth.insert(charcode, ww);
+ GRec.Outlines = outlines.copy();
+ GRec.x = x;
+ GRec.y = y;
+ GlyphArray.insert(charcode, GRec);
+ }
+ charcode = FT_Get_Next_Char( face, charcode, &gindex );
+ }
+ */
+}
+
+ScFace_PFB::ScFace_PFB(const QString& fam, const QString& sty, const QString& alt, const QString& scname, const QString& psname, const QString& path, int face, const QStringList& features) :
+ ScFace_PostScript(fam,sty,alt,scname,psname,path,face,features)
+{
+ formatCode = ScFace::PFB;
+}
+
+bool ScFace_PFB::embedFont(QByteArray& str) const
+{
+ QByteArray bb;
+ rawData(bb);
+ if ((bb.size() > 2) && (bb[0] == char(0x80)) && (static_cast<int>(bb[1]) == 1))
+ {
+ int posi,cxxc=0;
+ for (posi = 6; posi < bb.size(); ++posi)
+ {
+ if ((bb[posi] == char(0x80)) && (posi+1 < bb.size()) && (static_cast<int>(bb[posi+1]) == 2))
+ break;
+ str += bb[posi];
+ }
+ int ulen;
+ if (posi+6 < bb.size())
+ {
+ ulen = bb[posi+2] & 0xff;
+ ulen |= (bb[posi+3] << 8) & 0xff00;
+ ulen |= (bb[posi+4] << 16) & 0xff0000;
+ ulen |= (bb[posi+5] << 24) & 0xff000000;
+ posi += 6;
+ if (posi + ulen > bb.size())
+ ulen = bb.size() - posi - 1;
+ char linebuf[80];
+ cxxc=0;
+ for (int j = 0; j < ulen; ++j)
+ {
+ unsigned char u = bb[posi];
+ linebuf[cxxc] = ((u >> 4) & 15) + '0';
+ if (u>0x9f)
+ linebuf[cxxc] += 'a'-':';
+ ++cxxc;
+ u&=15;
+ linebuf[cxxc]=u + '0';
+ if (u>0x9)
+ linebuf[cxxc] += 'a'-':';
+ ++posi;
+ ++cxxc;
+ if (cxxc > 72)
+ {
+ linebuf[cxxc++] = '\n';
+ linebuf[cxxc++] = 0;
+ str += linebuf;
+ cxxc = 0;
+ }
+ }
+ linebuf[cxxc]=0;
+ str += linebuf;
+ str += "\n";
+ }
+ posi += 6;
+ for (int j = posi; j < bb.size(); ++j)
+ {
+ if ((bb[j] == static_cast<char>(0x80)) && (j+1 < bb.size()) && (static_cast<int>(bb[j+1]) == 3))
+ break;
+ if (bb[j]=='\r')
+ str+="\n";
+ else
+ str += bb[j];
+ }
+ str += "\n";
+ cxxc = 0;
+ return true;
+ }
+ else
+ {
+ qDebug("%s", QObject::tr("Font %1 cannot be read, no embedding").arg(fontFile).toLatin1().constData());
+ return false;
+ }
+}
+
+ScFace_PFA::ScFace_PFA(const QString& fam, const QString& sty, const QString& alt, const QString& scname, const QString& psname, const QString& path, int face, const QStringList& features) :
+ ScFace_PostScript(fam,sty,alt,scname,psname,path,face,features)
+{
+ formatCode = ScFace::PFA;
+}
+
+bool ScFace_PFA::embedFont(QByteArray& str) const
+{
+ QByteArray bb;
+ rawData(bb);
+ if (bb.size() > 2 && bb[0] == '%' && bb[1] == '!')
+ {
+ // this is ok since bb will not contain '\0'
+ str.append(bb);
+ return true;
+ }
+ qDebug("%s", QObject::tr("Font %1 cannot be read, no embedding").arg(fontFile).toLatin1().constData());
+ return false;
+}
Modified: trunk/Scribus/scribus/fonts/scface_ps.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/fonts/scface_ps.h
==============================================================================
--- trunk/Scribus/scribus/fonts/scface_ps.h (original)
+++ trunk/Scribus/scribus/fonts/scface_ps.h Mon Aug 26 05:52:00 2019
@@ -28,77 +28,15 @@
associated with them for metrics information.
*/
-class ScFace_postscript : public FtFace
+class ScFace_PostScript : public FtFace
{
public:
- ScFace_postscript(QString fam, QString sty, QString alt, QString scname, QString psname, QString path, int face, QStringList features) :
- FtFace(fam,sty,alt,scname,psname,path,face,features)
- {
- isFixedPitch = false;
- typeCode = ScFace::TYPE1;
- }
+ ScFace_PostScript(const QString& fam, const QString& sty, const QString& alt, const QString& scname, const QString& psname, const QString& path, int face, const QStringList& features);
virtual QStringList findFontMetrics(const QString& fontPath) const;
virtual QStringList findFontMetrics(const QString& baseDir, const QString& baseName) const;
- virtual bool loadFontMetrics(FT_Face face, const QString& fontPath) const;
-
- virtual void load() const // routine by Franz Schmid - modified by Alastair M. Robinson
- {
- FtFace::load();
-// bool error;
- FT_Face face = ftFace();
- if (!face)
- {
- const_cast<ScFace_postscript*>(this)->usable = false;
- qDebug("%s", QObject::tr("Font %1 is broken (no Face), discarding it").arg(fontFile).toLocal8Bit().constData());
- return;
- }
- if (loadFontMetrics(face, fontFile))
- {
- // re-initialize: ScFaceData::load() just clears caches,
- // FtFace::load() skips FT_New_Face if m_face is already defined.
- // don't mind checking glyphs again for now (PS files have only 255 glyphs max, anyway)
- FtFace::load();
- }
-// Ascent = tmp.setNum(face->ascender);
-// Descender = tmp.setNum(face->descender);
-// CapHeight = Ascent;
-// ItalicAngle = "0";
-// FontBBox = tmp.setNum(face->bbox.xMin)+" "+tmp2.setNum(face->bbox.yMin)+" "+tmp3.setNum(face->bbox.xMax)+" "+tmp4.setNum(face->bbox.yMax);
-/*
- setBestEncoding(face);
- gindex = 0;
- charcode = FT_Get_First_Char( face, &gindex );
- int goodGlyph = 0;
- int invalidGlyph = 0;
- while ( gindex != 0 )
- {
- error = FT_Load_Glyph( face, gindex, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP );
- if (error)
- {
- ++invalidGlyph;
- sDebug(QObject::tr("Font %1 has broken glyph %2 (charcode %3)").arg(fontPath()).arg(gindex).arg(charcode));
- charcode = FT_Get_Next_Char( face, charcode, &gindex );
- continue;
- }
- ++goodGlyph;
- qreal ww = face->glyph->metrics.horiAdvance / uniEM;
- if (face->glyph->format == FT_GLYPH_FORMAT_PLOTTER)
- isStroked = true;
- error = false;
- outlines = traceChar(face, charcode, 10, &x, &y, &error);
- if (!error)
- {
- CharWidth.insert(charcode, ww);
- GRec.Outlines = outlines.copy();
- GRec.x = x;
- GRec.y = y;
- GlyphArray.insert(charcode, GRec);
- }
- charcode = FT_Get_Next_Char( face, charcode, &gindex );
- }
- */
- }
+ virtual bool loadFontMetrics(FT_Face face, const QString& fontPath) const;
+ virtual void load() const;
};
/*
@@ -107,88 +45,11 @@
Implements: realName() and embedFont().
*/
-class ScFace_pfb : public ScFace_postscript
+class ScFace_PFB : public ScFace_PostScript
{
public:
- ScFace_pfb(QString fam, QString sty, QString alt, QString scname, QString psname, QString path, int face, QStringList features) :
- ScFace_postscript(fam,sty,alt,scname,psname,path,face,features)
- {
- formatCode = ScFace::PFB;
- }
-
- virtual bool embedFont(QByteArray &str) const
- {
- QByteArray bb;
- rawData(bb);
-// QString tmp2 = "";
- if ((bb.size() > 2) && (bb[0] == char(0x80)) && (static_cast<int>(bb[1]) == 1))
- {
-// QString tmp3="";
-// QString tmp4 = "";
- int posi,cxxc=0;
- for (posi = 6; posi < bb.size(); ++posi)
- {
- if ((bb[posi] == char(0x80)) && (posi+1 < bb.size()) && (static_cast<int>(bb[posi+1]) == 2))
- break;
- str += bb[posi];
- }
- int ulen;
- if (posi+6 < bb.size())
- {
- ulen = bb[posi+2] & 0xff;
- ulen |= (bb[posi+3] << 8) & 0xff00;
- ulen |= (bb[posi+4] << 16) & 0xff0000;
- ulen |= (bb[posi+5] << 24) & 0xff000000;
- posi += 6;
- if (posi + ulen > bb.size())
- ulen = bb.size() - posi - 1;
- char linebuf[80];
- cxxc=0;
- for (int j = 0; j < ulen; ++j)
- {
- unsigned char u = bb[posi];
- linebuf[cxxc] = ((u >> 4) & 15) + '0';
- if (u>0x9f)
- linebuf[cxxc] += 'a'-':';
- ++cxxc;
- u&=15;
- linebuf[cxxc]=u + '0';
- if (u>0x9)
- linebuf[cxxc] += 'a'-':';
- ++posi;
- ++cxxc;
- if (cxxc > 72)
- {
- linebuf[cxxc++] = '\n';
- linebuf[cxxc++] = 0;
- str += linebuf;
- cxxc = 0;
- }
- }
- linebuf[cxxc]=0;
- str += linebuf;
- str += "\n";
- }
- posi += 6;
- for (int j = posi; j < bb.size(); ++j)
- {
- if ((bb[j] == static_cast<char>(0x80)) && (j+1 < bb.size()) && (static_cast<int>(bb[j+1]) == 3))
- break;
- if (bb[j]=='\r')
- str+="\n";
- else
- str += bb[j];
- }
- str += "\n";
- cxxc = 0;
- return true;
- }
- else
- {
- qDebug("%s", QObject::tr("Font %1 cannot be read, no embedding").arg(fontFile).toLatin1().constData());
- return false;
- }
- }
+ ScFace_PFB(const QString& fam, const QString& sty, const QString& alt, const QString& scname, const QString& psname, const QString& path, int face, const QStringList& features);
+ virtual bool embedFont(QByteArray &str) const;
};
/*
@@ -197,27 +58,11 @@
Implements: realName() and embedFont().
*/
-class ScFace_pfa : public ScFace_postscript
+class ScFace_PFA : public ScFace_PostScript
{
public:
- ScFace_pfa(QString fam, QString sty, QString alt, QString scname, QString psname, QString path, int face, QStringList features) :
- ScFace_postscript(fam,sty,alt,scname,psname,path,face,features)
- {
- formatCode = ScFace::PFA;
- }
- virtual bool embedFont(QByteArray &str) const
- {
- QByteArray bb;
- rawData(bb);
- if (bb.size() > 2 && bb[0] == '%' && bb[1] == '!')
- {
- // this is ok since bb will not contain '\0'
- str.append(bb);
- return true;
- }
- qDebug("%s", QObject::tr("Font %1 cannot be read, no embedding").arg(fontFile).toLatin1().constData());
- return false;
- }
+ ScFace_PFA(const QString& fam, const QString& sty, const QString& alt, const QString& scname, const QString& psname, const QString& path, int face, const QStringList& features);
+ virtual bool embedFont(QByteArray &str) const;
};
Modified: trunk/Scribus/scribus/fonts/scface_ttf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/fonts/scface_ttf.cpp
==============================================================================
--- trunk/Scribus/scribus/fonts/scface_ttf.cpp (original)
+++ trunk/Scribus/scribus/fonts/scface_ttf.cpp Mon Aug 26 05:52:00 2019
@@ -27,9 +27,7 @@
formatCode = ScFace::SFNT;
}
-ScFace_ttf::~ ScFace_ttf()
-{
-}
+ScFace_ttf::~ScFace_ttf() = default;
bool ScFace_ttf::isSymbolic() const
{
Modified: trunk/Scribus/scribus/fpointarray.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/fpointarray.h
==============================================================================
--- trunk/Scribus/scribus/fpointarray.h (original)
+++ trunk/Scribus/scribus/fpointarray.h Mon Aug 26 05:52:00 2019
@@ -42,12 +42,12 @@
class SCRIBUS_API FPointArray : public QVector<FPoint>
{
public:
- FPointArray() : m_svgState(nullptr) {};
- FPointArray(int size) : QVector<FPoint>(size), m_svgState(nullptr) {};
- FPointArray(const FPointArray &a) : QVector<FPoint>(a), m_svgState(nullptr) {};
+ FPointArray() {};
+ FPointArray(int size) : QVector<FPoint>(size) {};
+ FPointArray(const FPointArray &a) : QVector<FPoint>(a) {};
~FPointArray();
- int size() const { return QVector<FPoint>::count(); }
+ int size() const { return QVector<FPoint>::count(); }
bool resize(int newCount);
void reverse();
void setPoint(int i, double x, double y) { FPoint& p = QVector<FPoint>::operator[](i); p.xp = x; p.yp = y; };
@@ -93,7 +93,7 @@
void fromQPainterPath(QPainterPath &path, bool close = false);
private:
- SVGState * m_svgState;
+ SVGState *m_svgState {nullptr};
};
#endif
Modified: trunk/Scribus/scribus/marks.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/marks.h
==============================================================================
--- trunk/Scribus/scribus/marks.h (original)
+++ trunk/Scribus/scribus/marks.h Mon Aug 26 05:52:00 2019
@@ -26,15 +26,15 @@
struct MarkData
{
QString strtxt;
- PageItem* itemPtr;
+ PageItem* itemPtr {nullptr};
QString destmarkName;
- MarkType destmarkType;
- TextNote* notePtr;
+ MarkType destmarkType {MARKNoType};
+ TextNote* notePtr {nullptr};
//fields used for resolving to pointers for load and copy
QString itemName;
- MarkType markTyp;
+ MarkType markTyp {MARKNoType};
- MarkData() : itemPtr(nullptr), destmarkType(MARKNoType), notePtr(nullptr), markTyp(MARKNoType) {}
+ MarkData() {}
};
class SCRIBUS_API Mark
@@ -44,12 +44,12 @@
friend class BulNumMark;
//only ScribusDoc && ScribusMainWindow can create and delete marks
private:
- Mark() : OwnPage(-1), typ(MARKNoType), data() {}
+ Mark() : data() {}
Mark(const Mark& other);
public:
QString label;
- int OwnPage;
+ int OwnPage {-1};
void setValues(const QString& l, int p, MarkType t, const MarkData& d);
MarkType getType() { return typ; }
@@ -95,7 +95,7 @@
virtual ~Mark() {}
protected:
- MarkType typ;
+ MarkType typ {MARKNoType};
MarkData data;
};
Modified: trunk/Scribus/scribus/scfonts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23163&path=/trunk/Scribus/scribus/scfonts.cpp
==============================================================================
--- trunk/Scribus/scribus/scfonts.cpp (original)
+++ trunk/Scribus/scribus/scfonts.cpp Mon Aug 26 05:52:00 2019
@@ -580,11 +580,11 @@
switch (format)
{
case ScFace::PFA:
- t = ScFace(new ScFace_pfa(fam, sty, "", ts, qpsName, filename, faceIndex, features));
+ t = ScFace(new ScFace_PFA(fam, sty, "", ts, qpsName, filename, faceIndex, features));
t.subset(Subset);
break;
case ScFace::PFB:
- t = ScFace(new ScFace_pfb(fam, sty, "", ts, qpsName, filename, faceIndex, features));
+ t = ScFace(new ScFace_PFB(fam, sty, "", ts, qpsName, filename, faceIndex, features));
t.subset(Subset);
break;
case ScFace::SFNT:
@@ -825,11 +825,11 @@
switch (format)
{
case ScFace::PFA:
- t = ScFace(new ScFace_pfa(fam, sty, "", ts, qpsName, filename, faceIndex, features));
+ t = ScFace(new ScFace_PFA(fam, sty, "", ts, qpsName, filename, faceIndex, features));
t.subset(Subset);
break;
case ScFace::PFB:
- t = ScFace(new ScFace_pfb(fam, sty, "", ts, qpsName, filename, faceIndex, features));
+ t = ScFace(new ScFace_PFB(fam, sty, "", ts, qpsName, filename, faceIndex, features));
t.subset(Subset);
break;
case ScFace::SFNT:
More information about the scribus-commit
mailing list