r17757 by jghali - #11026: Speed up some font routines
scribus-commit
scribus-commit at lists.scribus.net
Tue Aug 14 16:01:04 UTC 2012
Author: jghali
Date: Tue Aug 14 16:01:04 2012
New Revision: 17757
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17757
Log:
#11026: Speed up some font routines
Modified:
trunk/Scribus/scribus/fonts/scface.h
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/pageitem_textframe.cpp
Modified: trunk/Scribus/scribus/fonts/scface.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17757&path=/trunk/Scribus/scribus/fonts/scface.h
==============================================================================
--- trunk/Scribus/scribus/fonts/scface.h (original)
+++ trunk/Scribus/scribus/fonts/scface.h Tue Aug 14 16:01:04 2012
@@ -20,10 +20,9 @@
virtual: dispatch to constituents, handle embedding (-)
*/
+#include <QHash>
+#include <QMap>
#include <QString>
-//#include <QVector>
-#include <QMap>
-//#include <QArray>
#include <utility>
#include "fpointarray.h"
@@ -133,9 +132,9 @@
Status cachedStatus;
// caches
- mutable QMap<uint,qreal> m_glyphWidth;
- mutable QMap<uint,GlyphData> m_glyphOutline;
- mutable QMap<uint, uint> m_cMap;
+ mutable QHash<uint, qreal> m_glyphWidth;
+ mutable QHash<uint, GlyphData> m_glyphOutline;
+ mutable QHash<uint, uint> m_cMap;
// fill caches & members
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17757&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Tue Aug 14 16:01:04 2012
@@ -2302,7 +2302,8 @@
double PageItem::layoutGlyphs(const CharStyle& style, const QString& chars, GlyphLayout& layout)
{
double retval = 0.0;
- double asce = style.font().ascent(style.fontSize() / 10.0);
+ const ScFace font = style.font();
+ double asce = font.ascent(style.fontSize() / 10.0);
int chst = style.effects() & 1919;
/* if (chars[0] == SpecialChars::ZWSPACE ||
chars[0] == SpecialChars::ZWNBSPACE ||
@@ -2319,7 +2320,7 @@
}
else */
{
- layout.glyph = style.font().char2CMap(chars[0].unicode());
+ layout.glyph = font.char2CMap(chars[0].unicode());
}
double tracking = 0.0;
if ( (style.effects() & ScStyle_StartOfLine) == 0)
@@ -2348,7 +2349,7 @@
layout.scaleV *= style.scaleV() / 1000.0;
if (chst & ScStyle_AllCaps)
{
- layout.glyph = style.font().char2CMap(chars[0].toUpper().unicode());
+ layout.glyph = font.char2CMap(chars[0].toUpper().unicode());
}
if (chst & ScStyle_SmallCaps)
{
@@ -2356,7 +2357,7 @@
QChar uc = chars[0].toUpper();
if (uc != chars[0])
{
- layout.glyph = style.font().char2CMap(chars[0].toUpper().unicode());
+ layout.glyph = font.char2CMap(chars[0].toUpper().unicode());
layout.scaleV *= smallcapsScale;
layout.scaleH *= smallcapsScale;
}
@@ -2368,14 +2369,14 @@
}
/* if (layout.glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBSPACE.unicode())) {
- uint replGlyph = style.font().char2CMap(QChar(' '));
- layout.xadvance = style.font().glyphWidth(replGlyph, style.fontSize() / 10) * layout.scaleH;
- layout.yadvance = style.font().glyphBBox(replGlyph, style.fontSize() / 10).ascent * layout.scaleV;
+ uint replGlyph = font.char2CMap(QChar(' '));
+ layout.xadvance = font.glyphWidth(replGlyph, style.fontSize() / 10) * layout.scaleH;
+ layout.yadvance = font.glyphBBox(replGlyph, style.fontSize() / 10).ascent * layout.scaleV;
}
else if (layout.glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBHYPHEN.unicode())) {
- uint replGlyph = style.font().char2CMap(QChar('-'));
- layout.xadvance = style.font().glyphWidth(replGlyph, style.fontSize() / 10) * layout.scaleH;
- layout.yadvance = style.font().glyphBBox(replGlyph, style.fontSize() / 10).ascent * layout.scaleV;
+ uint replGlyph = font.char2CMap(QChar('-'));
+ layout.xadvance = font.glyphWidth(replGlyph, style.fontSize() / 10) * layout.scaleH;
+ layout.yadvance = font.glyphBBox(replGlyph, style.fontSize() / 10).ascent * layout.scaleV;
}
else if (layout.glyph >= ScFace::CONTROL_GLYPHS) {
layout.xadvance = 0;
@@ -2383,8 +2384,8 @@
}
else */
{
- layout.xadvance = style.font().glyphWidth(layout.glyph, style.fontSize() / 10) * layout.scaleH;
- layout.yadvance = style.font().glyphBBox(layout.glyph, style.fontSize() / 10).ascent * layout.scaleV;
+ layout.xadvance = font.glyphWidth(layout.glyph, style.fontSize() / 10) * layout.scaleH;
+ layout.yadvance = font.glyphBBox(layout.glyph, style.fontSize() / 10).ascent * layout.scaleV;
}
if (layout.xadvance > 0)
layout.xadvance += tracking;
@@ -2392,7 +2393,7 @@
if (chars.length() > 1) {
layout.grow();
layoutGlyphs(style, chars.mid(1), *layout.more);
- layout.xadvance += style.font().glyphKerning(layout.glyph, layout.more->glyph, style.fontSize() / 10) * layout.scaleH;
+ layout.xadvance += font.glyphKerning(layout.glyph, layout.more->glyph, style.fontSize() / 10) * layout.scaleH;
if (layout.more->yadvance > layout.yadvance)
layout.yadvance = layout.more->yadvance;
}
@@ -2405,8 +2406,9 @@
void PageItem::drawGlyphs(ScPainter *p, const CharStyle& style, GlyphLayout& glyphs)
{
uint glyph = glyphs.glyph;
+ const ScFace font = style.font();
if ((m_Doc->guidesPrefs().showControls) &&
- (glyph == style.font().char2CMap(QChar(' ')) || glyph >= ScFace::CONTROL_GLYPHS))
+ (glyph == font.char2CMap(QChar(' ')) || glyph >= ScFace::CONTROL_GLYPHS))
{
bool stroke = false;
if (glyph >= ScFace::CONTROL_GLYPHS)
@@ -2449,7 +2451,7 @@
}
else if (glyph == SpecialChars::NBHYPHEN.unicode())
{
- points = style.font().glyphOutline(style.font().char2CMap(QChar('-')), style.fontSize() / 100);
+ points = font.glyphOutline(font.char2CMap(QChar('-')), style.fontSize() / 100);
chma4.translate(glyphs.xoffset, glyphs.yoffset-((style.fontSize() / 10.0) * glyphs.scaleV));
}
else if (glyph == SpecialChars::SHYPHEN.unicode())
@@ -2495,9 +2497,9 @@
}
else if (glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBSPACE.unicode()) ||
glyph == (ScFace::CONTROL_GLYPHS + 32))
- glyph = style.font().char2CMap(QChar(' '));
+ glyph = font.char2CMap(QChar(' '));
else if (glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBHYPHEN.unicode()))
- glyph = style.font().char2CMap(QChar('-'));
+ glyph = font.char2CMap(QChar('-'));
if (glyph >= ScFace::CONTROL_GLYPHS || (style.effects() & ScStyle_SuppressSpace)) {
// qDebug("drawGlyphs: skipping %d", glyph);
@@ -2509,29 +2511,29 @@
}
return;
}
-// if (style.font().canRender(QChar(glyph)))
- {
- FPointArray gly = style.font().glyphOutline(glyph);
+// if (font.canRender(QChar(glyph)))
+ {
+ FPointArray gly = font.glyphOutline(glyph);
// Do underlining first so you can get typographically correct
// underlines when drawing a white outline
- if (((style.effects() & ScStyle_Underline) || ((style.effects() & ScStyle_UnderlineWords) && glyph != style.font().char2CMap(QChar(' ')))) && (style.strokeColor() != CommonStrings::None))
+ if (((style.effects() & ScStyle_Underline) || ((style.effects() & ScStyle_UnderlineWords) && glyph != font.char2CMap(QChar(' ')))) && (style.strokeColor() != CommonStrings::None))
{
double st, lw;
if ((style.underlineOffset() != -1) || (style.underlineWidth() != -1))
{
if (style.underlineOffset() != -1)
- st = (style.underlineOffset() / 1000.0) * (style.font().descent(style.fontSize() / 10.0));
+ st = (style.underlineOffset() / 1000.0) * (font.descent(style.fontSize() / 10.0));
else
- st = style.font().underlinePos(style.fontSize() / 10.0);
+ st = font.underlinePos(style.fontSize() / 10.0);
if (style.underlineWidth() != -1)
lw = (style.underlineWidth() / 1000.0) * (style.fontSize() / 10.0);
else
- lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
+ lw = qMax(font.strokeWidth(style.fontSize() / 10.0), 1.0);
}
else
{
- st = style.font().underlinePos(style.fontSize() / 10.0);
- lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
+ st = font.underlinePos(style.fontSize() / 10.0);
+ lw = qMax(font.strokeWidth(style.fontSize() / 10.0), 1.0);
}
if (style.baselineOffset() != 0)
st += (style.fontSize() / 10.0) * glyphs.scaleV * (style.baselineOffset() / 1000.0);
@@ -2597,7 +2599,7 @@
p->setLineWidth(style.fontSize() * glyphs.scaleV * style.outlineWidth() * 2 / 10000.0);
p->strokePath();
}
- else if ((style.font().isStroked()) && (style.strokeColor() != CommonStrings::None) && ((style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0) != 0))
+ else if ((font.isStroked()) && (style.strokeColor() != CommonStrings::None) && ((style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0) != 0))
{
QColor tmp = p->brush();
p->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
@@ -2638,18 +2640,18 @@
if ((style.strikethruOffset() != -1) || (style.strikethruWidth() != -1))
{
if (style.strikethruOffset() != -1)
- st = (style.strikethruOffset() / 1000.0) * (style.font().ascent(style.fontSize() / 10.0));
+ st = (style.strikethruOffset() / 1000.0) * (font.ascent(style.fontSize() / 10.0));
else
- st = style.font().strikeoutPos(style.fontSize() / 10.0);
+ st = font.strikeoutPos(style.fontSize() / 10.0);
if (style.strikethruWidth() != -1)
lw = (style.strikethruWidth() / 1000.0) * (style.fontSize() / 10.0);
else
- lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
+ lw = qMax(font.strokeWidth(style.fontSize() / 10.0), 1.0);
}
else
{
- st = style.font().strikeoutPos(style.fontSize() / 10.0);
- lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
+ st = font.strikeoutPos(style.fontSize() / 10.0);
+ lw = qMax(font.strokeWidth(style.fontSize() / 10.0), 1.0);
}
if (style.baselineOffset() != 0)
st += (style.fontSize() / 10.0) * glyphs.scaleV * (style.baselineOffset() / 1000.0);
Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17757&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Tue Aug 14 16:01:04 2012
@@ -970,17 +970,18 @@
// measure natural widths for glyphs and spaces
for (int sof = line.firstItem; sof <= line.lastItem; ++sof)
{
- if (!SpecialChars::isExpandingSpace(itemText.text(sof)))
- {
- glyphNatural += itemText.item(sof)->glyph.wide();
- }
- else if ( (itemText.item(sof)->effects() & ScStyle_SuppressSpace) == 0)
- {
- spaceNatural += itemText.item(sof)->glyph.wide();
- if (imSpace < 0.0 || imSpace > itemText.item(sof)->glyph.wide())
- imSpace = itemText.item(sof)->glyph.wide();
- }
- if (sof != line.firstItem && implicitSpace(itemText.item(sof - 1), itemText.item(sof))) {
+ ScText* hl = itemText.item(sof);
+ if (!SpecialChars::isExpandingSpace(hl->ch))
+ {
+ glyphNatural += hl->glyph.wide();
+ }
+ else if ( (hl->effects() & ScStyle_SuppressSpace) == 0)
+ {
+ spaceNatural += hl->glyph.wide();
+ if (imSpace < 0.0 || imSpace > hl->glyph.wide())
+ imSpace = hl->glyph.wide();
+ }
+ if (sof != line.firstItem && implicitSpace(itemText.item(sof - 1), hl)) {
spaceInsertion += 1;
}
}
@@ -1041,11 +1042,12 @@
// distribute whitespace on spaces and glyphs
for (int yof = startItem; yof <= line.lastItem; ++yof)
{
- double wide = itemText.item(yof)->glyph.wide();
- if (!SpecialChars::isExpandingSpace(itemText.text(yof)))
- {
- itemText.item(yof)->glyph.last()->xadvance += wide * glyphExtension;
- GlyphLayout* glyph = &(itemText.item(yof)->glyph);
+ ScText* hl = itemText.item(yof);
+ double wide = hl->glyph.wide();
+ if (!SpecialChars::isExpandingSpace(hl->ch))
+ {
+ hl->glyph.last()->xadvance += wide * glyphExtension;
+ GlyphLayout* glyph = &(hl->glyph);
while (glyph)
{
glyph->xoffset *= glyphScale;
@@ -1053,11 +1055,11 @@
glyph = glyph->more;
}
}
- else if ((itemText.item(yof)->effects() & ScStyle_SuppressSpace) == 0)
- {
- itemText.item(yof)->glyph.last()->xadvance += wide * spaceExtension;
- }
- if (yof != line.firstItem && implicitSpace(itemText.item(yof - 1), itemText.item(yof))) {
+ else if ((hl->effects() & ScStyle_SuppressSpace) == 0)
+ {
+ hl->glyph.last()->xadvance += wide * spaceExtension;
+ }
+ if (yof != line.firstItem && implicitSpace(itemText.item(yof - 1), hl)) {
itemText.item(yof - 1)->glyph.last()->xadvance += imSpace;
}
}
@@ -1127,10 +1129,11 @@
--b;
if (b >= line.firstItem)
{
- double chs = itemText.charStyle(b).fontSize() * (itemText.charStyle(b).scaleH() / 1000.0);
+ const CharStyle& chStyle(itemText.charStyle(b));
+ double chs = chStyle.fontSize() * (chStyle.scaleH() / 1000.0);
QChar chr = (itemText.item(b)->effects() & ScStyle_SoftHyphenVisible) ?
QChar('-') : itemText.text(b);
- double rightCorr = itemText.charStyle(b).font().realCharWidth(chr, chs / 10.0);
+ double rightCorr = chStyle.font().realCharWidth(chr, chs / 10.0);
if (QString("-,.`´'~").indexOf(chr) >= 0
|| chr == QChar(0x2018)
|| chr == QChar(0x2019)
@@ -1153,8 +1156,8 @@
)
rightCorr *= 0.5;
else {
- rightCorr = itemText.charStyle(b).font().charWidth(chr, chs / 10.0);
- rightCorr -= itemText.charStyle(b).font().charWidth(chr, chs / 10.0, QChar('.'));
+ rightCorr = chStyle.font().charWidth(chr, chs / 10.0);
+ rightCorr -= chStyle.font().charWidth(chr, chs / 10.0, QChar('.'));
}
return rightCorr;
}
@@ -1524,6 +1527,8 @@
}
}
+ const ScFace font = charStyle.font();
+
{ // local block for 'fl'
StyleFlag fl = hl->effects();
fl &= ~ScStyle_DropCap;
@@ -1601,11 +1606,11 @@
// FIXME : we should ensure that fonts are loaded before calls to layout()
// ScFace::realCharHeight()/Ascent() ensure font is loaded thanks to an indirect call to char2CMap()
// ScFace::ascent() can be called safely afterwards
- double realCharHeight = charStyle.font().realCharHeight(chstr[0], 1);
- double realCharAscent = charStyle.font().realCharAscent(chstr[0], 1);
- double fontAscent = charStyle.font().ascent(style.charStyle().fontSize() / 10.0);
+ double realCharHeight = font.realCharHeight(chstr[0], 1);
+ double realCharAscent = font.realCharAscent(chstr[0], 1);
+ double fontAscent = font.ascent(style.charStyle().fontSize() / 10.0);
if (realCharHeight == 0.0)
- realCharHeight = charStyle.font().height(style.charStyle().fontSize() / 10.0);
+ realCharHeight = font.height(style.charStyle().fontSize() / 10.0);
if (realCharAscent == 0.0)
realCharAscent = fontAscent;
chsd = (10 * ((DropCapDrop + fontAscent) / realCharHeight));
@@ -1650,8 +1655,8 @@
// apply kerning
if (a+1 < itemText.length())
{
- uint glyph2 = charStyle.font().char2CMap(itemText.text(a+1));
- double kern= charStyle.font().glyphKerning(hl->glyph.glyph, glyph2, chs / 10.0) * hl->glyph.scaleH;
+ uint glyph2 = font.char2CMap(itemText.text(a+1));
+ double kern= font.glyphKerning(hl->glyph.glyph, glyph2, chs / 10.0) * hl->glyph.scaleH;
wide += kern;
hl->glyph.xadvance += kern;
// change xadvance, xoffset according to JIS X4051
@@ -1739,7 +1744,7 @@
{
double itemHeight = hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth();
if (itemHeight == 0)
- itemHeight = charStyle.font().height(style.charStyle().fontSize() / 10.0);
+ itemHeight = font.height(style.charStyle().fontSize() / 10.0);
wide = hl->getItem(m_Doc)->width() + hl->getItem(m_Doc)->lineWidth();
asce = hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth();
realAsce = calculateLineSpacing (style, this) * DropLines;
@@ -1749,12 +1754,12 @@
}
else
{
- double realCharHeight = charStyle.font().realCharHeight(chstr[0], charStyle.fontSize() / 10.0);
+ double realCharHeight = font.realCharHeight(chstr[0], charStyle.fontSize() / 10.0);
if (realCharHeight == 0)
- realCharHeight = charStyle.font().height(style.charStyle().fontSize() / 10.0);
- wide = (charStyle.font().realCharWidth(chstr[0], chsd / 10.0) * scaleH) + (1 - scaleH); //dropcaps are to close to next glyphs if glyphs are hard scaled
- realAsce = charStyle.font().realCharHeight(chstr[0], chsd / 10.0) * scaleV + offset;
- asce = charStyle.font().ascent(hlcsize10);
+ realCharHeight = font.height(style.charStyle().fontSize() / 10.0);
+ wide = (font.realCharWidth(chstr[0], chsd / 10.0) * scaleH) + (1 - scaleH); //dropcaps are to close to next glyphs if glyphs are hard scaled
+ realAsce = font.realCharHeight(chstr[0], chsd / 10.0) * scaleV + offset;
+ asce = font.ascent(hlcsize10);
// qDebug() QString("dropcaps pre: chsd=%1 realCharHeight = %2 chstr=%3").arg(chsd).arg(asce).arg(chstr2[0]);
hl->glyph.scaleH /= hl->glyph.scaleV;
hl->glyph.scaleV = (realAsce / realCharHeight);
@@ -1777,8 +1782,8 @@
desc = realDesc = 0;
else
{
- desc = -charStyle.font().descent(hlcsize10);
- realDesc = charStyle.font().realCharDescent(chstr[0], hlcsize10) * scaleV - offset;
+ desc = -font.descent(hlcsize10);
+ realDesc = font.realCharDescent(chstr[0], hlcsize10) * scaleV - offset;
current.rememberShrinkStretch(hl->ch, wide, style);
}
if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(m_Doc)))
@@ -1788,8 +1793,8 @@
}
else
{
- asce = charStyle.font().ascent(hlcsize10);
- realAsce = charStyle.font().realCharAscent(chstr[0], hlcsize10) * scaleV + offset;
+ asce = font.ascent(hlcsize10);
+ realAsce = font.realCharAscent(chstr[0], hlcsize10) * scaleV + offset;
}
}
@@ -2017,7 +2022,7 @@
if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(m_Doc)))
diff = (hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth()) * scaleV + offset - (current.yPos - lastLineY);
else
- diff = charStyle.font().realCharAscent(QChar('l'), hlcsize10) * scaleV + offset - (current.yPos - lastLineY);
+ diff = font.realCharAscent(QChar('l'), hlcsize10) * scaleV + offset - (current.yPos - lastLineY);
}
else
{
@@ -2118,7 +2123,7 @@
if (tglyph)
{
tglyph->fillChar = tabs.fillChar;
- tglyph->glyph = charStyle.font().char2CMap(tabs.fillChar);
+ tglyph->glyph = font.char2CMap(tabs.fillChar);
tglyph->yoffset = hl->glyph.yoffset;
tglyph->scaleV = tglyph->scaleH = chs / charStyle.fontSize();
tglyph->xadvance = 0;
@@ -2134,7 +2139,7 @@
// remember y pos
if (DropCmode)
- hl->glyph.yoffset -= charStyle.font().realCharHeight(chstr[0], chsd / 10.0) - charStyle.font().realCharAscent(chstr[0], chsd / 10.0);
+ hl->glyph.yoffset -= font.realCharHeight(chstr[0], chsd / 10.0) - font.realCharAscent(chstr[0], chsd / 10.0);
// remember x pos
double breakPos = current.xPos;
@@ -2190,7 +2195,7 @@
double hyphWidth = 0.0;
bool inOverflow = false;
if (hl->effects() & ScStyle_HyphenationPossible || hl->ch == SpecialChars::SHYPHEN)
- hyphWidth = charStyle.font().charWidth('-', hlcsize10) * (charStyle.scaleH() / 1000.0);
+ hyphWidth = font.charWidth('-', hlcsize10) * (charStyle.scaleH() / 1000.0);
if ((current.isEndOfLine(style.rightMargin() + hyphWidth)) || current.isEndOfCol(realDesc) || SpecialChars::isBreak(hl->ch, Cols > 1) || (current.xPos - current.maxShrink + hyphWidth) >= current.mustLineEnd)
{
//end of row reached - right column, end of column, break char or line must end
@@ -2508,7 +2513,7 @@
// go back to last break position
style = itemText.paragraphStyle(a);
if (style.lineSpacingMode() == ParagraphStyle::AutomaticLineSpacing)
- style.setLineSpacing(charStyle.font().height(hlcsize10) * autoLS);
+ style.setLineSpacing(font.height(hlcsize10) * autoLS);
else if (style.lineSpacingMode() == ParagraphStyle::BaselineGridLineSpacing)
style.setLineSpacing(m_Doc->guidesPrefs().valueBaselineGrid);
@@ -2532,8 +2537,8 @@
current.hyphenCount++;
hl->setEffects(hl->effects() | ScStyle_SoftHyphenVisible);
hl->glyph.grow();
- hl->glyph.more->glyph = charStyle.font().char2CMap(QChar('-'));
- hl->glyph.more->xadvance = charStyle.font().charWidth('-', itemText.charStyle(a).fontSize() / 10.0) * scaleH; //FIX ME - hyphen is not rendered with proper width - check yhis with large glyphs horizontal scaling eg. 20%
+ hl->glyph.more->glyph = font.char2CMap(QChar('-'));
+ hl->glyph.more->xadvance = font.charWidth('-', itemText.charStyle(a).fontSize() / 10.0) * scaleH; //FIX ME - hyphen is not rendered with proper width - check yhis with large glyphs horizontal scaling eg. 20%
hyphWidth = hl->glyph.more->xadvance;
}
else
@@ -3021,8 +3026,10 @@
xcoZli -= hls->glyph.xoffset;
}
}
- desc = - charStyleS.font().descent(charStyleS.fontSize() / 10.0);
- asce = charStyleS.font().ascent(charStyleS.fontSize() / 10.0);
+ const ScFace font = charStyleS.font();
+ double fontSize = charStyleS.fontSize() / 10.0;
+ desc = - font.descent(fontSize);
+ asce = font.ascent(fontSize);
wide = hls->glyph.wide();
QRectF scr;
if ((hls->ch == SpecialChars::OBJECT) && (hls->hasObject(m_Doc)))
@@ -3088,8 +3095,10 @@
if (!m_Doc->RePos)
{
- desc = - charStyle.font().descent(charStyle.fontSize() / 10.0);
- asce = charStyle.font().ascent(charStyle.fontSize() / 10.0);
+ const ScFace font = charStyle.font();
+ double fontSize = charStyle.fontSize() / 10.0;
+ desc = - font.descent(fontSize);
+ asce = font.ascent(fontSize);
if (((selected && Select) || ((NextBox != 0 || BackBox != 0) && selected)) && (m_Doc->appMode == modeEdit || m_Doc->appMode == modeEditTable))
{
// set text color to highlight if its selected
More information about the scribus-commit
mailing list