r22507 by jghali - replace more Qt's foreach by c++11 range-based for()
scribus-commit
scribus-commit at lists.scribus.net
Tue May 1 14:42:20 UTC 2018
Author: jghali
Date: Tue May 1 14:42:20 2018
New Revision: 22507
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22507
Log:
replace more Qt's foreach by c++11 range-based for()
Modified:
trunk/Scribus/scribus/collapsedtablepainter.cpp
trunk/Scribus/scribus/collapsedtablepainterex.cpp
trunk/Scribus/scribus/pageitem_pathtext.cpp
trunk/Scribus/scribus/pageitem_table.cpp
trunk/Scribus/scribus/pageitem_table.h
trunk/Scribus/scribus/pdflib_core.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
trunk/Scribus/scribus/pslib.cpp
trunk/Scribus/scribus/text/boxes.cpp
trunk/Scribus/scribus/text/glyphcluster.cpp
trunk/Scribus/scribus/text/screenpainter.cpp
Modified: trunk/Scribus/scribus/collapsedtablepainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22507&path=/trunk/Scribus/scribus/collapsedtablepainter.cpp
==============================================================================
--- trunk/Scribus/scribus/collapsedtablepainter.cpp (original)
+++ trunk/Scribus/scribus/collapsedtablepainter.cpp Tue May 1 14:42:20 2018
@@ -488,7 +488,7 @@
QColor lineColor;
QPointF lineStart, lineEnd;
- foreach (const TableBorderLine& line, border.borderLines())
+ for (const TableBorderLine& line : border.borderLines())
{
// Adjust line start and ends by line width multiplied by offset factors.
lineStart.setX(start.x() + line.width() * startOffsetFactors.x());
Modified: trunk/Scribus/scribus/collapsedtablepainterex.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22507&path=/trunk/Scribus/scribus/collapsedtablepainterex.cpp
==============================================================================
--- trunk/Scribus/scribus/collapsedtablepainterex.cpp (original)
+++ trunk/Scribus/scribus/collapsedtablepainterex.cpp Tue May 1 14:42:20 2018
@@ -464,7 +464,7 @@
p->setFillMode(ScPainterExBase::None);
QPointF lineStart, lineEnd;
- foreach (const TableBorderLine& line, border.borderLines())
+ for (const TableBorderLine& line : border.borderLines())
{
// Adjust line start and ends by line width multiplied by offset factors.
lineStart.setX(start.x() + line.width() * startOffsetFactors.x());
Modified: trunk/Scribus/scribus/pageitem_pathtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22507&path=/trunk/Scribus/scribus/pageitem_pathtext.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_pathtext.cpp (original)
+++ trunk/Scribus/scribus/pageitem_pathtext.cpp Tue May 1 14:42:20 2018
@@ -168,11 +168,11 @@
double wordExtra = 0;
TextShaper textShaper(this, itemText, firstChar, true);
- QList<GlyphCluster> glyphRuns = textShaper.shape(0, itemText.length()).glyphs();
+ const QList<GlyphCluster> glyphRuns = textShaper.shape(0, itemText.length()).glyphs();
if (glyphRuns.isEmpty())
return;
- foreach (const GlyphCluster& run, glyphRuns)
+ for (const GlyphCluster& run : glyphRuns)
{
totalTextLen += run.width();
if (run.hasFlag(ScLayout_ExpandingSpace))
Modified: trunk/Scribus/scribus/pageitem_table.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22507&path=/trunk/Scribus/scribus/pageitem_table.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_table.cpp (original)
+++ trunk/Scribus/scribus/pageitem_table.cpp Tue May 1 14:42:20 2018
@@ -105,7 +105,7 @@
void PageItem_Table::getNamedResources(ResourceCollection& lists) const
{
TableBorder lborder = leftBorder();
- foreach (const TableBorderLine& line, lborder.borderLines())
+ for (const TableBorderLine& line : lborder.borderLines())
{
if (line.color() == CommonStrings::None)
continue;
@@ -113,7 +113,7 @@
}
TableBorder rborder = rightBorder();
- foreach (const TableBorderLine& line, rborder.borderLines())
+ for (const TableBorderLine& line : rborder.borderLines())
{
if (line.color() == CommonStrings::None)
continue;
@@ -121,7 +121,7 @@
}
TableBorder bborder = bottomBorder();
- foreach (const TableBorderLine& line, bborder.borderLines())
+ for (const TableBorderLine& line : bborder.borderLines())
{
if (line.color() == CommonStrings::None)
continue;
@@ -129,7 +129,7 @@
}
TableBorder tborder = topBorder();
- foreach (const TableBorderLine& line, tborder.borderLines())
+ for (const TableBorderLine& line : tborder.borderLines())
{
if (line.color() == CommonStrings::None)
continue;
@@ -158,7 +158,7 @@
lists.collectColor(cellFill);
lborder = cell.leftBorder();
- foreach (const TableBorderLine& line, lborder.borderLines())
+ for (const TableBorderLine& line : lborder.borderLines())
{
if (line.color() == CommonStrings::None)
continue;
@@ -166,7 +166,7 @@
}
rborder = cell.rightBorder();
- foreach (const TableBorderLine& line, rborder.borderLines())
+ for (const TableBorderLine& line : rborder.borderLines())
{
if (line.color() == CommonStrings::None)
continue;
@@ -174,7 +174,7 @@
}
bborder = cell.bottomBorder();
- foreach (const TableBorderLine& line, bborder.borderLines())
+ for (const TableBorderLine& line : bborder.borderLines())
{
if (line.color() == CommonStrings::None)
continue;
@@ -182,7 +182,7 @@
}
tborder = cell.topBorder();
- foreach (const TableBorderLine& line, tborder.borderLines())
+ for (const TableBorderLine& line : tborder.borderLines())
{
if (line.color() == CommonStrings::None)
continue;
@@ -714,7 +714,7 @@
QSet<int> PageItem_Table::selectedRows() const
{
QSet<int> rows;
- foreach (const TableCell& cell, selectedCells())
+ for (const TableCell& cell : selectedCells())
{
const int startRow = cell.row();
const int endRow = startRow + cell.rowSpan() - 1;
@@ -727,7 +727,7 @@
QSet<int> PageItem_Table::selectedColumns() const
{
QSet<int> columns;
- foreach (const TableCell& cell, selectedCells())
+ for (const TableCell& cell : selectedCells())
{
const int startColumn = cell.column();
const int endColumn = startColumn + cell.columnSpan() - 1;
@@ -1444,8 +1444,8 @@
qDebug() << "m_rowHeights: " << m_rowHeights;
qDebug() << "m_cellAreas: " << m_cellAreas;
qDebug() << "m_cellRows: ";
- foreach(const QList<TableCell>& cellRow, m_cellRows)
- foreach(const TableCell& cell, cellRow)
+ for (const QList<TableCell>& cellRow : m_cellRows)
+ for (const TableCell& cell : cellRow)
qDebug() << cell.asString();
qDebug() << "-------------------------------------------------";
}
@@ -1458,7 +1458,7 @@
Q_ASSERT(columns() == m_columnPositions.size());
Q_ASSERT(columns() == m_columnWidths.size());
Q_ASSERT(rows() == m_cellRows.size());
- foreach (QList<TableCell> cellRow, m_cellRows)
+ for (const QList<TableCell>& cellRow : m_cellRows)
Q_ASSERT(columns() == cellRow.size());
for (int row = 0; row < rows(); ++row)
@@ -1491,13 +1491,13 @@
Q_ASSERT(validCell(m_activeCell.row(), m_activeCell.column()));
// Check that selected cells are valid.
- foreach (const TableCell& cell, m_selection)
+ for (const TableCell& cell : m_selection)
{
Q_ASSERT(cell.isValid());
Q_ASSERT(validCell(cell.row(), cell.column()));
}
- foreach (const CellArea& cellArea, m_cellAreas)
+ for (const CellArea& cellArea : m_cellAreas)
{
// Check that the active cell is not covered.
if (cellArea.contains(m_activeCell.row(), m_activeCell.column()))
Modified: trunk/Scribus/scribus/pageitem_table.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22507&path=/trunk/Scribus/scribus/pageitem_table.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_table.h (original)
+++ trunk/Scribus/scribus/pageitem_table.h Tue May 1 14:42:20 2018
@@ -178,7 +178,7 @@
/**
* Returns the list of row heights for the table.
*/
- QList<double> rowHeights() const { return m_rowHeights; }
+ const QList<double>& rowHeights() const { return m_rowHeights; }
/**
* Resizes @a row to @a height using resize strategy @a strategy.
@@ -205,7 +205,7 @@
/**
* Returns the list of row positions for the table.
*/
- QList<double> rowPositions() const { return m_rowPositions; }
+ const QList<double>& rowPositions() const { return m_rowPositions; }
/**
* Inserts @a numColumns columns before the column at @a index.
@@ -233,7 +233,7 @@
/**
* Returns the list of column widths for the table.
*/
- QList<double> columnWidths() const { return m_columnWidths; }
+ const QList<double>& columnWidths() const { return m_columnWidths; }
/**
* Resizes @a column to @a width using resize strategy @a strategy.
@@ -260,7 +260,7 @@
/**
* Returns the list of column positions for the table.
*/
- QList<double> columnPositions() const { return m_columnPositions; }
+ const QList<double>& columnPositions() const { return m_columnPositions; }
/**
* Merges the cell at the specified @a row and @a column with the adjacent cells into
@@ -284,7 +284,7 @@
/**
* Returns the set of selected cells.
*/
- QSet<TableCell> selectedCells() const { return m_selection; }
+ const QSet<TableCell>& selectedCells() const { return m_selection; }
/**
* Returns the set of selected rows.
@@ -483,10 +483,10 @@
virtual QString infoDescription() { return QString(); }
/// Returns the Cell Areas from this table
- QList<CellArea> cellAreas() const { return m_cellAreas; }
+ const QList<CellArea>& cellAreas() const { return m_cellAreas; }
/// Returns the rows of the table for writing to SLA
- QList<QList<TableCell> > cellRows() const { return m_cellRows; }
+ const QList<QList<TableCell> >& cellRows() const { return m_cellRows; }
/// Set the layer for the item
virtual void setLayer(int layerId);
Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22507&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Tue May 1 14:42:20 2018
@@ -148,7 +148,8 @@
return;
double current_x = 0.0;
- foreach (const GlyphLayout& gl, gc.glyphs()) {
+ for (const GlyphLayout& gl : gc.glyphs())
+ {
PdfFont pdfFont = m_pdf->UsedFontsP[font().replacementName()];
QByteArray StrokeColor;
QByteArray FillColor;
@@ -250,7 +251,8 @@
return;
double current_x = 0.0;
- foreach (const GlyphLayout& gl, gc.glyphs()) {
+ for (const GlyphLayout& gl : gc.glyphs())
+ {
PdfFont pdfFont = m_pdf->UsedFontsP[font().replacementName()];
QByteArray StrokeColor;
QByteArray FillColor;
@@ -1386,18 +1388,18 @@
return Pdf::toPdfDocEncoding(fn.replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" ));
}
-static QList<Pdf::Resource> asColorSpace(QList<PdfICCD> iccCSlist)
+static QList<Pdf::Resource> asColorSpace(const QList<PdfICCD>& iccCSlist)
{
QList<Pdf::Resource> result;
- foreach (const Pdf::Resource& r, iccCSlist)
+ for (const Pdf::Resource& r : iccCSlist)
result.append(r);
return result;
}
-static QList<Pdf::Resource> asColorSpace(QList<PdfSpotC> spotMapValues)
+static QList<Pdf::Resource> asColorSpace(const QList<PdfSpotC>& spotMapValues)
{
QList<Pdf::Resource> result;
- foreach (const Pdf::Resource& r, spotMapValues)
+ for (const Pdf::Resource& r : spotMapValues)
result.append(r);
return result;
}
@@ -5393,7 +5395,7 @@
tmp += "q\n";
QPointF lineStart, lineEnd;
QVector<double> DashValues;
- foreach (const TableBorderLine& line, border.borderLines())
+ for (const TableBorderLine& line : border.borderLines())
{
if (line.color() == CommonStrings::None)
continue;
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22507&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Tue May 1 14:42:20 2018
@@ -911,7 +911,7 @@
{
TableBorder tbLeft = style.leftBorder();
docu.writeStartElement("TableBorderLeft");
- foreach (const TableBorderLine& tbl, tbLeft.borderLines())
+ for (const TableBorderLine& tbl : tbLeft.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -926,7 +926,7 @@
{
TableBorder tbRight = style.rightBorder();
docu.writeStartElement("TableBorderRight");
- foreach (const TableBorderLine& tbl, tbRight.borderLines())
+ for (const TableBorderLine& tbl : tbRight.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -941,7 +941,7 @@
{
TableBorder tbTop = style.topBorder();
docu.writeStartElement("TableBorderTop");
- foreach (const TableBorderLine& tbl, tbTop.borderLines())
+ for (const TableBorderLine& tbl : tbTop.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -956,7 +956,7 @@
{
TableBorder tbBottom = style.bottomBorder();
docu.writeStartElement("TableBorderBottom");
- foreach (const TableBorderLine& tbl, tbBottom.borderLines())
+ for (const TableBorderLine& tbl : tbBottom.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -993,7 +993,7 @@
{
TableBorder tbLeft = style.leftBorder();
docu.writeStartElement("TableBorderLeft");
- foreach (const TableBorderLine& tbl, tbLeft.borderLines())
+ for (const TableBorderLine& tbl : tbLeft.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -1008,7 +1008,7 @@
{
TableBorder tbRight = style.rightBorder();
docu.writeStartElement("TableBorderRight");
- foreach (const TableBorderLine& tbl, tbRight.borderLines())
+ for (const TableBorderLine& tbl : tbRight.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -1023,7 +1023,7 @@
{
TableBorder tbTop = style.topBorder();
docu.writeStartElement("TableBorderTop");
- foreach (const TableBorderLine& tbl, tbTop.borderLines())
+ for (const TableBorderLine& tbl : tbTop.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -1038,7 +1038,7 @@
{
TableBorder tbBottom = style.bottomBorder();
docu.writeStartElement("TableBorderBottom");
- foreach (const TableBorderLine& tbl, tbBottom.borderLines())
+ for (const TableBorderLine& tbl : tbBottom.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -2281,7 +2281,7 @@
{
TableBorder tbLeft = tableItem->leftBorder();
docu.writeStartElement("TableBorderLeft");
- foreach (const TableBorderLine& tbl, tbLeft.borderLines())
+ for (const TableBorderLine& tbl : tbLeft.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -2296,7 +2296,7 @@
{
TableBorder tbRight = tableItem->rightBorder();
docu.writeStartElement("TableBorderRight");
- foreach (const TableBorderLine& tbl, tbRight.borderLines())
+ for (const TableBorderLine& tbl : tbRight.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -2311,7 +2311,7 @@
{
TableBorder tbTop = tableItem->topBorder();
docu.writeStartElement("TableBorderTop");
- foreach (const TableBorderLine& tbl, tbTop.borderLines())
+ for (const TableBorderLine& tbl : tbTop.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -2326,7 +2326,7 @@
{
TableBorder tbBottom = tableItem->bottomBorder();
docu.writeStartElement("TableBorderBottom");
- foreach (const TableBorderLine& tbl, tbBottom.borderLines())
+ for (const TableBorderLine& tbl : tbBottom.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -2380,7 +2380,7 @@
TableBorder tbLeft = cell.leftBorder();
docu.writeStartElement("TableBorderLeft");
docu.writeAttribute("Width", tbLeft.width());
- foreach (const TableBorderLine& tbl, tbLeft.borderLines())
+ for (const TableBorderLine& tbl : tbLeft.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -2396,7 +2396,7 @@
TableBorder tbRight = cell.rightBorder();
docu.writeStartElement("TableBorderRight");
docu.writeAttribute("Width", tbRight.width());
- foreach (const TableBorderLine& tbl, tbRight.borderLines())
+ for (const TableBorderLine& tbl : tbRight.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -2412,7 +2412,7 @@
TableBorder tbTop = cell.topBorder();
docu.writeStartElement("TableBorderTop");
docu.writeAttribute("Width", tbTop.width());
- foreach (const TableBorderLine& tbl, tbTop.borderLines())
+ for (const TableBorderLine& tbl : tbTop.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -2428,7 +2428,7 @@
TableBorder tbBottom = cell.bottomBorder();
docu.writeStartElement("TableBorderBottom");
docu.writeAttribute("Width", tbBottom.width());
- foreach (const TableBorderLine& tbl, tbBottom.borderLines())
+ for (const TableBorderLine& tbl : tbBottom.borderLines())
{
docu.writeStartElement("TableBorderLine");
docu.writeAttribute("Width", tbl.width());
@@ -2739,29 +2739,29 @@
QString outputData;
//Row Positions
- foreach(qreal value, tableItem->rowPositions())
+ for (double value : tableItem->rowPositions())
outputData += tmp.setNum(value) + " ";
docu.writeAttribute("RowPositions", outputData.simplified());
outputData.clear();
//Row Heights
- foreach(qreal value, tableItem->rowHeights())
+ for (double value : tableItem->rowHeights())
outputData += tmp.setNum(value) + " ";
docu.writeAttribute("RowHeights", outputData.simplified());
outputData.clear();
//Column Positions
- foreach(qreal value, tableItem->columnPositions())
+ for (double value : tableItem->columnPositions())
outputData += tmp.setNum(value) + " ";
docu.writeAttribute("ColumnPositions", outputData.simplified());
outputData.clear();
//Column Widths
- foreach(qreal value, tableItem->columnWidths())
+ for (double value : tableItem->columnWidths())
outputData += tmp.setNum(value) + " ";
docu.writeAttribute("ColumnWidths", outputData.simplified());
outputData.clear();
//Cell Areas
//TODO Is this the best format to write these out?
QString tmp1,tmp2,tmp3,tmp4;
- foreach(CellArea ca, tableItem->cellAreas())
+ for (const CellArea& ca : tableItem->cellAreas())
outputData += tmp1.setNum(ca.row()) + " " + tmp2.setNum(ca.column()) + " " + tmp3.setNum(ca.height()) + " " + tmp4.setNum(ca.width()) + " ";
docu.writeAttribute("CellAreas", outputData.simplified());
outputData.clear();
Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22507&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp (original)
+++ trunk/Scribus/scribus/pslib.cpp Tue May 1 14:42:20 2018
@@ -109,7 +109,8 @@
applyTransform();
m_ps->PS_translate(x(), -(y() - fontSize()));
double current_x = 0.0;
- foreach (const GlyphLayout& gl, gc.glyphs()) {
+ for (const GlyphLayout& gl : gc.glyphs())
+ {
m_ps->PS_save();
m_ps->PS_translate(gl.xoffset + current_x, -(fontSize() - fontSize() * gl.scaleV) - gl.yoffset);
if (gl.scaleH != 1.0 || (gl.scaleV != 1.0))
@@ -141,7 +142,8 @@
m_ps->PS_setdash(Qt::SolidLine, 0, dum);
m_ps->PS_translate(x(), -(y() - fontSize()));
double current_x = 0.0;
- foreach (const GlyphLayout& gl, gc.glyphs()) {
+ for (const GlyphLayout& gl : gc.glyphs())
+ {
m_ps->PS_save();
FPointArray gly = font().glyphOutline(gl.glyph);
QTransform chma;
@@ -2531,7 +2533,7 @@
PS_save();
QPointF lineStart, lineEnd;
QVector<double> DashValues;
- foreach (const TableBorderLine& line, border.borderLines())
+ for (const TableBorderLine& line : border.borderLines())
{
if (line.color() == CommonStrings::None)
continue;
Modified: trunk/Scribus/scribus/text/boxes.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22507&path=/trunk/Scribus/scribus/text/boxes.cpp
==============================================================================
--- trunk/Scribus/scribus/text/boxes.cpp (original)
+++ trunk/Scribus/scribus/text/boxes.cpp Tue May 1 14:42:20 2018
@@ -99,7 +99,7 @@
double GroupBox::naturalHeight() const
{
double nH = 0;
- foreach (const Box* box, boxes()) {
+ for (const Box* box : boxes()) {
if (m_direction == D_Horizontal)
nH = qMax(m_naturalHeight, box->naturalHeight());
else
@@ -126,7 +126,7 @@
void GroupBox::update()
{
m_naturalHeight = m_naturalWidth = 0;
- foreach (const Box* box, boxes()) {
+ for (const Box* box : boxes()) {
m_firstChar = qMin(m_firstChar, box->firstChar());
m_lastChar = qMax(m_lastChar, box->lastChar());
if (m_direction == D_Horizontal)
Modified: trunk/Scribus/scribus/text/glyphcluster.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22507&path=/trunk/Scribus/scribus/text/glyphcluster.cpp
==============================================================================
--- trunk/Scribus/scribus/text/glyphcluster.cpp (original)
+++ trunk/Scribus/scribus/text/glyphcluster.cpp Tue May 1 14:42:20 2018
@@ -25,7 +25,7 @@
double GlyphCluster::width() const
{
double width = 0;
- foreach (const GlyphLayout gl, m_glyphs)
+ for (const GlyphLayout gl : m_glyphs)
{
width += gl.xadvance * m_scaleH;
}
@@ -36,7 +36,8 @@
{
const ScFace &font = m_style->font();
double asc = 0;
- foreach (const GlyphLayout gl, m_glyphs) {
+ for (const GlyphLayout gl : m_glyphs)
+ {
GlyphMetrics gm = font.glyphBBox(gl.glyph, m_style->fontSize() / 10.0);
asc = qMax(asc, gm.ascent * m_scaleV);
}
@@ -47,7 +48,8 @@
{
const ScFace &font = m_style->font();
double des = 0;
- foreach (const GlyphLayout gl, m_glyphs) {
+ for (const GlyphLayout gl : m_glyphs)
+ {
GlyphMetrics gm = font.glyphBBox(gl.glyph, m_style->fontSize() / 10.0);
des = qMax(des, gm.descent * m_scaleV);
}
@@ -171,7 +173,8 @@
{
QVector<FPointArray> outline;
const ScFace& face = m_style->font();
- foreach (const GlyphLayout& gl, m_glyphs) {
+ for (const GlyphLayout& gl : m_glyphs)
+ {
outline.append(face.glyphOutline(gl.glyph));
}
return outline;
Modified: trunk/Scribus/scribus/text/screenpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22507&path=/trunk/Scribus/scribus/text/screenpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/text/screenpainter.cpp (original)
+++ trunk/Scribus/scribus/text/screenpainter.cpp Tue May 1 14:42:20 2018
@@ -82,7 +82,7 @@
cairo_set_font_size(cr, fontSize());
double current_x = 0.0;
- foreach (const GlyphLayout& gl, gc.glyphs()) {
+ for (const GlyphLayout& gl : gc.glyphs()) {
cairo_scale(cr, gl.scaleH, gl.scaleV);
cairo_glyph_t glyph = { gl.glyph, gl.xoffset + current_x, gl.yoffset };
cairo_show_glyphs(cr, &glyph, 1);
@@ -245,7 +245,8 @@
setupState(false);
double current_x = 0.0;
- foreach (const GlyphLayout& gl, gc.glyphs()) {
+ for (const GlyphLayout& gl : gc.glyphs())
+ {
m_painter->save();
m_painter->translate(gl.xoffset + current_x, - (fontSize() * gl.scaleV) + gl.yoffset );
FPointArray outline = font().glyphOutline(gl.glyph);
More information about the scribus-commit
mailing list