r24731 by jghali - Code cleanup
scribus-commit
scribus-commit at lists.scribus.net
Sun Oct 3 21:54:51 UTC 2021
Author: jghali
Date: Sun Oct 3 21:53:10 2021
New Revision: 24731
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24731
Log:
Code cleanup
Modified:
trunk/Scribus/scribus/fonts/scfontmetrics.cpp
trunk/Scribus/scribus/fonts/scfontmetrics.h
trunk/Scribus/scribus/rawimage.cpp
trunk/Scribus/scribus/rawimage.h
trunk/Scribus/scribus/sampleitem.cpp
trunk/Scribus/scribus/sampleitem.h
trunk/Scribus/scribus/scclocale.cpp
trunk/Scribus/scribus/scclocale.h
trunk/Scribus/scribus/scfonts.cpp
trunk/Scribus/scribus/scfonts.h
Modified: trunk/Scribus/scribus/fonts/scfontmetrics.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24731&path=/trunk/Scribus/scribus/fonts/scfontmetrics.cpp
==============================================================================
--- trunk/Scribus/scribus/fonts/scfontmetrics.cpp (original)
+++ trunk/Scribus/scribus/fonts/scfontmetrics.cpp Sun Oct 3 21:53:10 2021
@@ -14,6 +14,7 @@
#include <QTransform>
#include <ft2build.h>
+#include <memory>
#include FT_FREETYPE_H
#include FT_TRUETYPE_TABLES_H
@@ -43,10 +44,6 @@
#endif
// private functions
-#if 0
-static void readAdobeGlyphNames();
-#endif
-//static QString adobeGlyphName(FT_ULong charcode);
static int traceMoveto( FT_Vector *to, FPointArray *composite );
static int traceLineto( FT_Vector *to, FPointArray *composite );
static int traceQuadraticBezier( FT_Vector *control, FT_Vector *to, FPointArray *composite );
@@ -243,10 +240,7 @@
int encode = setBestEncoding(face);
qreal uniEM = static_cast<qreal>(face->units_per_EM);
-// qreal m_descent = face->descender / uniEM;
qreal m_height = qMax(face->height / uniEM, (face->bbox.yMax - face->bbox.yMin) / uniEM);
-// if (m_height == 0)
-// m_height = (face->bbox.yMax - face->bbox.yMin) / uniEM;
int h = qRound(m_height * s) + 1;
qreal a = 0;//m_descent * s + 1;
@@ -258,13 +252,13 @@
QImage pm(w, h, QImage::Format_ARGB32_Premultiplied);
pen_x = 0;
ymax = 0.0;
- ScPainter *p = new ScPainter(&pm, pm.width(), pm.height());
+
+ std::unique_ptr<ScPainter> p = std::make_unique<ScPainter>(&pm, pm.width(), pm.height());
p->clear(back);
p->setFillMode(ScPainter::Solid);
p->setLineWidth(0.0);
-// p->setBrush(back);
-// p->drawRect(0.0, 0.0, static_cast<qreal>(w), static_cast<qreal>(h));
p->setBrush(Qt::black);
+
FPointArray gly;
ScFace::ucs4_type dv;
dv = ts[0];
@@ -315,88 +309,12 @@
}
}
p->end();
- QPixmap pmr;
- pmr=QPixmap::fromImage(pm.copy(0, 0, qMin(qRound(gp.x()), w), qMin(qRound(ymax), h)));
-// this one below gives some funny results
-// pmr.convertFromImage(pm.scaled(qMin(qRound(gp.x()), w), qMin(qRound(ymax), h), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
-// pmr.resize(qMin(qRound(gp.x()), w), qMin(qRound(ymax), h));
- delete p;
+
+ QPixmap pmr = QPixmap::fromImage(pm.copy(0, 0, qMin(qRound(gp.x()), w), qMin(qRound(ymax), h)));
+
FT_Done_FreeType( library );
return pmr;
}
-
-#if 0
-bool GlyphNames(const FtFace& fnt, FaceEncoding& GList)
-{
- char buf[50];
- FT_ULong charcode;
- FT_UInt gindex = 0;
-
- FT_Face face = fnt.ftFace();
- if (!face)
- return false;
-
- if (adobeGlyphNames.empty())
- readAdobeGlyphNames();
-
- // The glyph name table embedded in Truetype fonts is not reliable.
- // For those fonts we consequently use Adobe Glyph names whenever possible.
- const bool avoidFntNames = (fnt.formatCode != ScFace::TYPE42 && fnt.typeCode == ScFace::TTF) &&
- (face->charmap && face->charmap->encoding == FT_ENCODING_UNICODE && face->charmap->platform_id == TT_PLATFORM_MICROSOFT);
-
- const bool hasPSNames = FT_HAS_GLYPH_NAMES(face);
-
-// qDebug() << "reading metrics for" << face->family_name << face->style_name;
- charcode = FT_Get_First_Char(face, &gindex );
- while (gindex != 0)
- {
- bool notfound = true;
- if (hasPSNames && !avoidFntNames)
- notfound = FT_Get_Glyph_Name(face, gindex, &buf, 50);
-
- // just in case FT gives empty string or ".notdef"
- // no valid glyphname except ".notdef" starts with '.'
-// qDebug() << "\t" << gindex << " '" << charcode << "' --> '" << (notfound? "notfound" : buf) << "'";
- if (notfound || buf[0] == '\0' || buf[0] == '.')
- GList.insert(gindex, std::make_pair(static_cast<ucs4_type>(charcode), adobeGlyphName(charcode)));
- else
- GList.insert(gindex, std::make_pair(static_cast<ucs4_type>(charcode), QString(reinterpret_cast<char*>(buf))));
-
- charcode = FT_Get_Next_Char(face, charcode, &gindex );
- }
-
- if (!hasPSNames)
- return true;
-
- // Let's see if we can find some more...
- int maxSlot1 = face->num_glyphs;
- for (int gindex = 1; gindex < maxSlot1; ++gindex)
- {
- if (GList.contains(gindex))
- continue;
- if (FT_Get_Glyph_Name(face, gindex, &buf, 50))
- continue;
- QString glyphname(reinterpret_cast<char*>(buf));
-
- charcode = 0;
- faceEncoding::Iterator gli;
- for (gli = GList.begin(); gli != GList.end(); ++gli)
- {
- if (glyphname == gli.value().second)
- {
- charcode = gli.value().first.unicode();
- break;
- }
- }
-// qDebug() << "\tmore: " << gindex << " '" << charcode << "' --> '" << buf << "'";
- if (avoidFntNames && buf[0] != '.' && buf[0] != '\0')
- glyphname = adobeGlyphName(charcode);
- GList.insert(gindex, std::make_pair(static_cast<ucs4_type>(charcode), glyphname));
- }
-
- return true;
-}
-#endif
static int traceMoveto( FT_Vector *to, FPointArray *composite )
{
@@ -458,22 +376,6 @@
return 0;
}
-/// init the Adobe Glyph List
-#if 0
-void readAdobeGlyphNames()
-{
- adobeGlyphNames.clear();
- QRegExp pattern("(\\w*);([0-9A-Fa-f]{4})");
- for (uint i=0; table[i]; ++i) {
- if (pattern.indexIn(table[i]) >= 0) {
- FT_ULong unicode = pattern.cap(2).toULong(0, 16);
- qDebug() << QString("reading glyph name %1 for unicode %2(%3)").arg(pattern.cap(1)).arg(unicode).arg(pattern.cap(2));
- adobeGlyphNames.insert(unicode, pattern.cap(1));
- }
- }
-}
-#endif
-
/// if in AGL, use that name, else use "uni1234" or "u12345"
QString adobeGlyphName(FT_ULong charcode)
{
Modified: trunk/Scribus/scribus/fonts/scfontmetrics.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24731&path=/trunk/Scribus/scribus/fonts/scfontmetrics.h
==============================================================================
--- trunk/Scribus/scribus/fonts/scfontmetrics.h (original)
+++ trunk/Scribus/scribus/fonts/scfontmetrics.h Sun Oct 3 21:53:10 2021
@@ -34,6 +34,5 @@
FPointArray SCRIBUS_API traceChar(FT_Face face, ScFace::ucs4_type chr, int chs, qreal *x, qreal *y, bool *err);
FPointArray SCRIBUS_API traceGlyph(FT_Face face, ScFace::gid_type gl, int chs, qreal *x, qreal *y, bool *err);
QPixmap SCRIBUS_API FontSample(const ScFace& fnt, int s, QVector<uint> ts, const QColor& back, bool force = false);
-//bool SCRIBUS_API GlyphNames(const FtFace& fnt, ScFace::FaceEncoding& GList);
#endif
Modified: trunk/Scribus/scribus/rawimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24731&path=/trunk/Scribus/scribus/rawimage.cpp
==============================================================================
--- trunk/Scribus/scribus/rawimage.cpp (original)
+++ trunk/Scribus/scribus/rawimage.cpp Sun Oct 3 21:53:10 2021
@@ -49,12 +49,13 @@
QImage RawImage::convertToQImage(bool cmyk, bool raw)
{
+ QRgb* ptr;
+ const uchar* src;
+ uchar cr, cg, cb, ck, ca;
+
int chans = channels();
- QImage img = QImage(width(), height(), QImage::Format_ARGB32);
- QRgb *ptr;
- uchar *src;
- uchar cr, cg, cb, ck, ca;
-// img.create(width(), height(), 32);
+ QImage img(width(), height(), QImage::Format_ARGB32);
+
if (raw)
{
for (int i = 0; i < height(); i++)
@@ -70,7 +71,6 @@
}
else
{
-// img.setAlphaBuffer( true );
for (int i = 0; i < height(); i++)
{
ptr = (QRgb *)img.scanLine(i);
Modified: trunk/Scribus/scribus/rawimage.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24731&path=/trunk/Scribus/scribus/rawimage.h
==============================================================================
--- trunk/Scribus/scribus/rawimage.h (original)
+++ trunk/Scribus/scribus/rawimage.h Sun Oct 3 21:53:10 2021
@@ -18,6 +18,7 @@
RawImage();
RawImage( int width, int height, int channels);
~RawImage();
+
bool create( int width, int height, int channels);
int width() const { return m_width; };
int height() const { return m_height; };
@@ -26,6 +27,7 @@
uchar *scanLine(int row);
void setAlpha(int x, int y, int alpha);
QImage convertToQImage(bool cmyk, bool raw = false);
+
private:
int m_width {0};
int m_height {0};
Modified: trunk/Scribus/scribus/sampleitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24731&path=/trunk/Scribus/scribus/sampleitem.cpp
==============================================================================
--- trunk/Scribus/scribus/sampleitem.cpp (original)
+++ trunk/Scribus/scribus/sampleitem.cpp Sun Oct 3 21:53:10 2021
@@ -4,35 +4,39 @@
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
-#include "scribuscore.h"
-#include "sampleitem.h"
-#include "ui/loremipsum.h"
-#include "scpainter.h"
-#include "scribusdoc.h"
-#include "undomanager.h"
+
+#include <memory>
+
+#include <QColor>
+#include <QCursor>
+#include <QPixmap>
+#include <QString>
+
#include "commonstrings.h"
#include "pageitem_textframe.h"
#include "prefsmanager.h"
-#include <QColor>
-#include <QString>
-#include <QCursor>
-//Added by qt3to4:
-#include <QPixmap>
+#include "sampleitem.h"
+#include "scpainter.h"
+#include "scribuscore.h"
+#include "scribusdoc.h"
+#include "ui/loremipsum.h"
+#include "undomanager.h"
SampleItem::SampleItem()
-{
- m_Doc = new ScribusDoc();
+ : m_Doc(new ScribusDoc())
+{
if (!m_Doc)
return;
+
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(1, 1, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
m_Doc->setGUI(false, ScCore->primaryMainWindow(), nullptr);
- // tmp colors. to be removed in descrictor
+ // tmp colors. to be removed in destructor
m_Doc->PageColors.insert("__blackforpreview__", ScColor(0, 0, 0, 255));
m_Doc->PageColors.insert("__whiteforpreview__", ScColor(0, 0, 0, 0));
m_Doc->PageColors.insert("__whiteforpreviewbg__", ScColor(0, 0, 0, 0));
- m_bgShade = 100;
+
m_tmpStyle.setName("(preview temporary)");
m_tmpStyle.setLineSpacingMode(ParagraphStyle::FixedLineSpacing);
m_tmpStyle.setLineSpacing((m_Doc->itemToolPrefs().textSize / 10.0) * (static_cast<double>(m_Doc->typographicPrefs().autoLineSpacing) / 100));
@@ -44,7 +48,6 @@
m_tmpStyle.setGapAfter(0);
m_tmpStyle.charStyle().setFont(PrefsManager::instance().appPrefs.fontPrefs.AvailFonts[m_Doc->itemToolPrefs().textFont]);
m_tmpStyle.charStyle().setFontSize(m_Doc->itemToolPrefs().textSize);
-// tmpStyle.tabValues().clear();
m_tmpStyle.setHasDropCap(false);
m_tmpStyle.setHasBullet(false);
m_tmpStyle.setHasNum(false);
@@ -52,16 +55,16 @@
m_tmpStyle.setParEffectOffset(0);
m_tmpStyle.charStyle().setFeatures(QStringList(CharStyle::INHERIT));
m_tmpStyle.charStyle().setFillColor("__blackforpreview__");
- m_tmpStyle.charStyle().setFillShade(100); //m_Doc->toolSettings.dShade;
+ m_tmpStyle.charStyle().setFillShade(100);
m_tmpStyle.charStyle().setStrokeColor("__whiteforpreview__");
- m_tmpStyle.charStyle().setStrokeShade(100); //m_Doc->toolSettings.dShade2;
+ m_tmpStyle.charStyle().setStrokeShade(100);
m_tmpStyle.charStyle().setShadowXOffset(50);
m_tmpStyle.charStyle().setShadowYOffset(-50);
m_tmpStyle.charStyle().setOutlineWidth(10);
- m_tmpStyle.charStyle().setUnderlineOffset(0); //m_Doc->typographicSettings.valueUnderlinePos;
- m_tmpStyle.charStyle().setUnderlineWidth(0); //m_Doc->typographicSettings.valueUnderlineWidth;
- m_tmpStyle.charStyle().setStrikethruOffset(0); //m_Doc->typographicSettings.valueStrikeThruPos;
- m_tmpStyle.charStyle().setStrikethruWidth(0); //m_Doc->typographicSettings.valueStrikeThruPos;
+ m_tmpStyle.charStyle().setUnderlineOffset(0);
+ m_tmpStyle.charStyle().setUnderlineWidth(0);
+ m_tmpStyle.charStyle().setStrikethruOffset(0);
+ m_tmpStyle.charStyle().setStrikethruWidth(0);
m_tmpStyle.charStyle().setScaleH(1000);
m_tmpStyle.charStyle().setScaleV(1000);
m_tmpStyle.charStyle().setBaselineOffset(0);
@@ -80,11 +83,8 @@
void SampleItem::setLoremIpsum(int para)
{
- LoremParser *m = new LoremParser("loremipsum.xml");
- m_text = m->createLorem(para);
-// really needed ??
-// text = QString::fromUtf8(text);
- delete m;
+ auto loremParser = std::make_unique<LoremParser>("loremipsum.xml");
+ m_text = loremParser->createLorem(para);
}
void SampleItem::setStyle(const ParagraphStyle& aStyle)
@@ -117,12 +117,12 @@
m_tmpStyle.charStyle().setFillShade(c);
}
-void SampleItem::setLineSpaMode(int lineSpaMode)
+void SampleItem::setLineSpacingMode(int lineSpaMode)
{
m_tmpStyle.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(lineSpaMode));
}
-void SampleItem::setLineSpa(double lineSpa)
+void SampleItem::setLineSpacing(double lineSpa)
{
m_tmpStyle.setLineSpacing(lineSpa);
}
@@ -132,12 +132,17 @@
m_tmpStyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(textAlignment));
}
-void SampleItem::setIndent(double indent)
+void SampleItem::setLeftMargin(double indent)
{
m_tmpStyle.setLeftMargin(indent);
}
-void SampleItem::setFirst(double first)
+void SampleItem::setRightMargin(double indent)
+{
+ m_tmpStyle.setRightMargin(indent);
+}
+
+void SampleItem::setFirstIndent(double first)
{
m_tmpStyle.setFirstIndent(first);
}
@@ -174,7 +179,7 @@
m_tmpStyle.setHasDropCap(drop);
}
-void SampleItem::setDropLin(int dropLin)
+void SampleItem::setDropCapLines(int dropLin)
{
m_tmpStyle.setDropCapLines(dropLin);
}
@@ -199,29 +204,24 @@
m_tmpStyle.charStyle().setFeatures(static_cast<StyleFlag>(fontEffect).featureList());
}
-void SampleItem::setFColor(const QString& fColor)
+void SampleItem::setTxtFillColor(const QString& fColor)
{
m_tmpStyle.charStyle().setFillColor(fColor);
}
-void SampleItem::setFShade(int fShade)
+void SampleItem::setTxtFillShade(int fShade)
{
m_tmpStyle.charStyle().setFillShade(fShade);
}
-void SampleItem::setSColor(const QString& sColor)
+void SampleItem::setTxtStrokeColor(const QString& sColor)
{
m_tmpStyle.charStyle().setStrokeColor(sColor);
}
-void SampleItem::setSShade(int sShade)
+void SampleItem::setTxtStrokeShade(int sShade)
{
m_tmpStyle.charStyle().setStrokeShade(sShade);
-}
-
-void SampleItem::setBaseAdj(bool baseAdj)
-{
- m_tmpStyle.setLineSpacingMode(baseAdj ? ParagraphStyle::BaselineGridLineSpacing : ParagraphStyle::FixedLineSpacing);
}
void SampleItem::setTxtShadowX(int txtShadowX)
@@ -288,19 +288,17 @@
if (m_tmpStyle.charStyle().font().isNone())
return QPixmap();
- UndoManager::instance()->setUndoEnabled(false); // disable undo
+ UndoBlocker undoBlocker; // disable undo
int pmWidth = qRound(width * m_devicePixelRatio);
int pmHeight = qRound(height * m_devicePixelRatio);
double frameWidth = width / PrefsManager::instance().appPrefs.displayPrefs.displayScale;
double frameHeight = height / PrefsManager::instance().appPrefs.displayPrefs.displayScale;
- PageItem_TextFrame *previewItem = new PageItem_TextFrame(m_Doc, 0, 0, frameWidth, frameHeight, 0, "__whiteforpreviewbg__", "__whiteforpreview__");
-
QImage pm(pmWidth, pmHeight, QImage::Format_ARGB32);
pm.setDevicePixelRatio(m_devicePixelRatio);
- ScPainter *painter = new ScPainter(&pm, pmWidth, pmHeight, 1.0, 0);
+ auto painter = std::make_unique<ScPainter>(&pm, pmWidth, pmHeight, 1.0, 0);
painter->setZoomFactor(PrefsManager::instance().appPrefs.displayPrefs.displayScale);
if (m_Doc->UsedFonts.contains(m_tmpStyle.charStyle().font().scName()))
@@ -308,21 +306,23 @@
m_Doc->AddFont(m_tmpStyle.charStyle().font().scName(), qRound(m_Doc->itemToolPrefs().textSize / 10.0));
+ auto previewItem = std::make_unique<PageItem_TextFrame>(m_Doc, 0, 0, frameWidth, frameHeight, 0, "__whiteforpreviewbg__", "__whiteforpreview__");
+ m_text.replace(QChar(10), QChar(13)).replace(QChar(5), QChar(13));
+
previewItem->FrameType = PageItem::TextFrame;
previewItem->itemText.clear();
-// previewItem->setFont(tmpStyle.charStyle().font()->scName());
previewItem->m_columns = 1;
- m_text.replace(QChar(10),QChar(13)).replace(QChar(5),QChar(13));
previewItem->itemText.insertChars(0, m_text);
previewItem->itemText.setDefaultStyle(m_tmpStyle);
previewItem->setFillColor("__whiteforpreviewbg__");
previewItem->setFillShade(m_bgShade);
previewItem->SetRectFrame();
previewItem->setSampleItem(true);
- previewItem->DrawObj(painter, QRect(0, 0, frameWidth, frameHeight));
+ previewItem->DrawObj(painter.get(), QRect(0, 0, frameWidth, frameHeight));
painter->end();
- delete(painter);
- delete previewItem;
+
+ painter.reset();
+ previewItem.reset();
// cleanups and resets
if (!previouslyUsedFont)
@@ -331,8 +331,6 @@
(*m_Doc->AllFonts)[fontName].decreaseUsage(); // was increased by AddFont()
m_Doc->UsedFonts.remove(fontName);
}
-// m_Doc->docParagraphStyles.remove(tmpIndex);
- UndoManager::instance()->setUndoEnabled(true);
QPixmap pixmap = QPixmap::fromImage(pm);
return pixmap;
Modified: trunk/Scribus/scribus/sampleitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24731&path=/trunk/Scribus/scribus/sampleitem.h
==============================================================================
--- trunk/Scribus/scribus/sampleitem.h (original)
+++ trunk/Scribus/scribus/sampleitem.h Sun Oct 3 21:53:10 2021
@@ -55,12 +55,12 @@
\param aStyle Paragraph style to set.*/
void setStyle(const ParagraphStyle& aStyle);
/*! \brief Following methods set only one style characteristic */
- void setLineSpaMode(int lineSpaMode);
- void setLineSpa(double lineSpa);
+ void setLineSpacingMode(int lineSpaMode);
+ void setLineSpacing(double lineSpa);
void setTextAlignment(int textAlignment);
- void setIndent(double indent);
+ void setLeftMargin(double indent);
void setRightMargin(double indent);
- void setFirst(double first);
+ void setFirstIndent(double first);
void setGapBefore(double gapBefore);
void setGapAfter(double gapAfter);
void setFont(const QString& font);
@@ -72,14 +72,13 @@
void setDrop(bool drop);
void setBullet(bool bul);
void setNum(bool num);
- void setDropLin(int dropLin);
+ void setDropCapLines(int dropLin);
void setParEffectDist(double dropDist);
void setFontEffect(int fontEffect);
- void setFColor(const QString& fColor);
- void setFShade(int fShade);
- void setSColor(const QString& sColor);
- void setSShade(int sShade);
- void setBaseAdj(bool baseAdj);
+ void setTxtFillColor(const QString& fColor);
+ void setTxtFillShade(int fShade);
+ void setTxtStrokeColor(const QString& sColor);
+ void setTxtStrokeShade(int sShade);
void setTxtShadowX(int txtShadowX);
void setTxtShadowY(int txtShadowY);
void setTxtOutline(int txtOutline);
@@ -106,9 +105,9 @@
ParagraphStyle m_tmpStyle;
/*! \brief Reference to a document.
Existing or created one */
- ScribusDoc *m_Doc;
+ ScribusDoc* m_Doc { nullptr };
//! \brief Is the doc created used only? true = used
- int m_bgShade;
+ int m_bgShade { 100 };
//! \brief Device pixel ratio
double m_devicePixelRatio { 1.0 };
};
Modified: trunk/Scribus/scribus/scclocale.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24731&path=/trunk/Scribus/scribus/scclocale.cpp
==============================================================================
--- trunk/Scribus/scribus/scclocale.cpp (original)
+++ trunk/Scribus/scribus/scclocale.cpp Sun Oct 3 21:53:10 2021
@@ -20,7 +20,7 @@
ScCLocale * ScCLocale::m_instance = nullptr;
ScCLocale::ScCLocale()
- :qLocale(QLocale::C), cLocale(nullptr)
+ : qLocale(QLocale::C)
{
qLocale.setNumberOptions(QLocale::OmitGroupSeparator);
Modified: trunk/Scribus/scribus/scclocale.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24731&path=/trunk/Scribus/scribus/scclocale.h
==============================================================================
--- trunk/Scribus/scribus/scclocale.h (original)
+++ trunk/Scribus/scribus/scclocale.h Sun Oct 3 21:53:10 2021
@@ -43,7 +43,7 @@
~ScCLocale();
QLocale qLocale;
- XLocaleType cLocale;
+ XLocaleType cLocale { nullptr };
static ScCLocale * m_instance;
static ScCLocale * that();
Modified: trunk/Scribus/scribus/scfonts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24731&path=/trunk/Scribus/scribus/scfonts.cpp
==============================================================================
--- trunk/Scribus/scribus/scfonts.cpp (original)
+++ trunk/Scribus/scribus/scfonts.cpp Sun Oct 3 21:53:10 2021
@@ -82,12 +82,7 @@
SCFonts::SCFonts()
{
// insert("", ScFace::none()); // Wtf why inserting an empty entry here ????
- m_showFontInfo = false;
m_checkedFonts.clear();
-}
-
-SCFonts::~SCFonts()
-{
}
void SCFonts::updateFontMap()
@@ -157,7 +152,7 @@
if (!fi.exists()) // Sanity check for broken Symlinks
continue;
- qApp->processEvents();
+ QCoreApplication::processEvents();
bool symlink = fi.isSymLink();
if (symlink)
@@ -519,7 +514,7 @@
if (!fi.exists())
return t;
bool Subset = false;
- char *buf[50];
+ char buf[128];
QString glyName = "";
ScFace::FontFormat format;
ScFace::FontType type;
@@ -552,8 +547,8 @@
FT_Done_FreeType(library);
return t;
}
- FT_Get_Glyph_Name(face, gindex, buf, 50);
- QString newName = QString(reinterpret_cast<char*>(buf));
+ FT_Get_Glyph_Name(face, gindex, buf, 128);
+ QString newName(buf);
if (newName == glyName)
{
HasNames = false;
@@ -652,7 +647,7 @@
{
static bool firstRun;
bool Subset = false;
- char *buf[50];
+ char buf[128];
QString glyName = "";
ScFace::FontFormat format;
ScFace::FontType type;
@@ -740,8 +735,8 @@
m_checkedFonts.insert(filename, foCache);
return true;
}
- FT_Get_Glyph_Name(face, gindex, buf, 50);
- QString newName = QString(reinterpret_cast<char*>(buf));
+ FT_Get_Glyph_Name(face, gindex, buf, 128);
+ QString newName(buf);
if (newName == glyName)
{
HasNames = false;
@@ -784,8 +779,8 @@
m_checkedFonts.insert(filename, foCache);
return true;
}
- FT_Get_Glyph_Name(face, gindex, buf, 50);
- QString newName = QString(reinterpret_cast<char*>(buf));
+ FT_Get_Glyph_Name(face, gindex, buf, 128);
+ QString newName(buf);
if (newName == glyName)
{
HasNames = false;
@@ -1323,7 +1318,7 @@
addScalableFonts( ScPaths::instance().fontDir() );
//Add downloaded user fonts
- QString userFontDir(ScPaths::instance().userFontDir(false));
+ QString userFontDir(ScPaths::userFontDir(false));
if (QDir(userFontDir).exists())
addScalableFonts( userFontDir );
Modified: trunk/Scribus/scribus/scfonts.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24731&path=/trunk/Scribus/scribus/scfonts.h
==============================================================================
--- trunk/Scribus/scribus/scfonts.h (original)
+++ trunk/Scribus/scribus/scfonts.h Sun Oct 3 21:53:10 2021
@@ -39,7 +39,7 @@
{
public:
SCFonts();
- ~SCFonts();
+ ~SCFonts() = default;
void updateFontMap();
void getFonts(const QString& pf, bool showFontInfo=false);
@@ -85,7 +85,7 @@
QMap<QString, testCache> m_checkedFonts;
protected:
- bool m_showFontInfo;
+ bool m_showFontInfo { false };
};
struct SCFontsIterator
@@ -98,7 +98,8 @@
ScFace& next() { ++m_it; return current(); }
private:
- QMap<QString,ScFace>::Iterator m_it, m_end_it;
+ QMap<QString, ScFace>::Iterator m_it;
+ QMap<QString, ScFace>::Iterator m_end_it;
};
#endif
More information about the scribus-commit
mailing list