r13945 by jghali - #8385: tab fill characters are printed incorrectly to PDF and to PS
scribus-commit
scribus-commit at lists.scribus.net
Tue Sep 1 14:50:23 CEST 2009
Revision: 13945
Author: jghali
Date: 2009-09-01T12:49:15.198525Z
Commit message: #8385: tab fill characters are printed incorrectly to PDF and to PS
Changeset:
M /branches/Version135/Scribus/scribus/pdflib_core.cpp
M /branches/Version135/Scribus/scribus/pslib.cpp
M /branches/Version135/Scribus/scribus/pageitem_textframe.cpp
M /branches/Version135/Scribus/scribus/sctextstruct.cpp
M /branches/Version135/Scribus/scribus/sctextstruct.h
Diffs:
Index: scribus/pageitem_textframe.cpp
===================================================================
--- scribus/pageitem_textframe.cpp (revision 13944)
+++ scribus/pageitem_textframe.cpp (revision 13945)
@@ -1447,12 +1447,16 @@
// remember fill char
// qDebug() << QString("tab: %1 '%2'").arg(tCurX).arg(tabs.fillChar);
if (!tabs.fillChar.isNull()) {
- hl->glyph.grow();
- GlyphLayout * tglyph = hl->glyph.more;
- tglyph->glyph = charStyle.font().char2CMap(tabs.fillChar);
- tglyph->yoffset = hl->glyph.yoffset;
- tglyph->scaleV = tglyph->scaleH = chs / charStyle.fontSize();
- tglyph->xadvance = 0;
+ hl->glyph.growWithTabLayout();
+ TabLayout * tglyph = dynamic_cast<TabLayout*>(hl->glyph.more);
+ if (tglyph)
+ {
+ tglyph->fillChar = tabs.fillChar;
+ tglyph->glyph = charStyle.font().char2CMap(tabs.fillChar);
+ tglyph->yoffset = hl->glyph.yoffset;
+ tglyph->scaleV = tglyph->scaleH = chs / charStyle.fontSize();
+ tglyph->xadvance = 0;
+ }
}
}
current.xPos -= (legacy ? 1.0 : 0.0);
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp (revision 13944)
+++ scribus/pdflib_core.cpp (revision 13945)
@@ -3973,12 +3973,9 @@
if ((ch == SpecialChars::TAB) && (tTabValues.count() != 0))
{
QChar tabFillChar;
- double tCurX = CurX - colLeft + 1;
- for (int yg = static_cast<int>(tTabValues.count()-1); yg > -1; yg--)
- {
- if (tCurX < tTabValues[yg].tabPosition)
- tabFillChar = tTabValues[yg].tabFillChar;
- }
+ const TabLayout* tabLayout = dynamic_cast<const TabLayout*>(hl->glyph.more);
+ if (tabLayout)
+ tabFillChar = tabLayout->fillChar;
if (!tabFillChar.isNull())
{
ScText hl2;
@@ -3990,7 +3987,7 @@
int coun = static_cast<int>(len / wt);
// #6728 : update code according to fillInTabLeaders() and PageItem::layout() - JG
double sPos = 0.0 /*CurX - len + chstyle.fontSize() / 10.0 * 0.7 + 1*/;
- hl2.ch = tTabValues[tabCc].tabFillChar;
+ hl2.ch = tabFillChar;
hl2.setTracking(0);
hl2.setScaleH(1000);
hl2.setScaleV(1000);
Index: scribus/sctextstruct.cpp
===================================================================
--- scribus/sctextstruct.cpp (revision 13944)
+++ scribus/sctextstruct.cpp (revision 13945)
@@ -13,6 +13,12 @@
#include "pageitem.h"
#include "scribusdoc.h"
+void GlyphLayout::growWithTabLayout()
+{
+ if (more)
+ shrink();
+ more = new TabLayout();
+}
struct InlineFrameData
{
Index: scribus/sctextstruct.h
===================================================================
--- scribus/sctextstruct.h (revision 13944)
+++ scribus/sctextstruct.h (revision 13945)
@@ -88,9 +88,14 @@
more = new GlyphLayout();
}
}
-
+ virtual void growWithTabLayout();
};
+struct SCRIBUS_API TabLayout : public GlyphLayout
+{
+ QChar fillChar;
+};
+
struct InlineFrameData;
class SCRIBUS_API InlineFrame
Index: scribus/pslib.cpp
===================================================================
--- scribus/pslib.cpp (revision 13944)
+++ scribus/pslib.cpp (revision 13945)
@@ -3521,12 +3521,9 @@
if ((hl->ch == SpecialChars::TAB) && (tTabValues.count() != 0))
{
QChar tabFillChar;
- double tCurX = CurX - colLeft + 1;
- for (int yg = static_cast<int>(tTabValues.count()-1); yg > -1; yg--)
- {
- if (tCurX < tTabValues[yg].tabPosition)
- tabFillChar = tTabValues[yg].tabFillChar;
- }
+ const TabLayout* tabLayout = dynamic_cast<const TabLayout*>(hl->glyph.more);
+ if (tabLayout)
+ tabFillChar = tabLayout->fillChar;
if (!tabFillChar.isNull())
{
ScText hl2;
More information about the scribus-commit
mailing list