r14354 by fschmid - Xara Importer: More bits of text handling, esp more correct handling of font sizes and complex text.
scribus-commit
scribus-commit at lists.scribus.net
Wed Nov 25 22:55:24 CET 2009
Revision: 14354
Author: fschmid
Date: 2009-11-25T12:35:20.960695Z
Commit message: Xara Importer: More bits of text handling, esp more correct handling of font sizes and complex text.
Changeset:
M /trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
M /trunk/Scribus/scribus/plugins/import/xar/importxar.h
Diffs:
Index: scribus/plugins/import/xar/importxar.cpp
===================================================================
--- scribus/plugins/import/xar/importxar.cpp (revision 14353)
+++ scribus/plugins/import/xar/importxar.cpp (revision 14354)
@@ -775,11 +775,16 @@
TextY += gc->LineHeight;
QPainterPath painterPath;
QFont textFont = QFont(gc->FontFamily, gc->FontSize);
- textFont.setPixelSize(gc->FontSize);
- painterPath.addText( TextX, TextY, textFont, gc->itemText);
+ if (gc->FontSize >= 1)
+ textFont.setPixelSize(gc->FontSize);
+ else
+ textFont.setPointSizeF(gc->FontSize * 72.0 / 96.0);
+ painterPath.addText( 0, 0, textFont, gc->itemText);
QRectF bound = painterPath.boundingRect();
Coords.resize(0);
Coords.fromQPainterPath(painterPath);
+ Coords.map(textMatrix);
+ Coords.translate(TextX, TextY);
if (gc->TextAlignment == 1)
Coords.translate(-bound.width() / 2.0, 0);
else if (gc->TextAlignment == 2)
@@ -804,6 +809,7 @@
gc->itemText = "";
TextX = textX;
TextY = docHeight - textY;
+ textMatrix = QTransform();
// qDebug() << "Simple Text at" << textX << docHeight - textY;
}
@@ -814,17 +820,18 @@
double transX, transY;
ts >> scX >> skX >> skY >> scY;
readCoords(ts, transX, transY);
-/* double scaleX = decodeFixed16(scX);
+ double scaleX = decodeFixed16(scX);
double scaleY = decodeFixed16(scY);
double skewX = decodeFixed16(skX);
- double skewY = decodeFixed16(skY); */
+ double skewY = decodeFixed16(skY);
if (dataLen > 24)
ts >> flag;
XarStyle *gc = m_gc.top();
gc->itemText = "";
TextX = transX;
TextY = docHeight - transY;
-// qDebug() << "Complex Text at" << transX << docHeight - transY;
+ textMatrix = QTransform(scaleX, -skewX, -skewY, scaleY, 0, 0);
+// qDebug() << "Complex Text at" << transX << docHeight - transY << "Matrix" << scaleX << skewX << skewY << scaleY;
}
void XarPlug::handleFillRule(QDataStream &ts)
Index: scribus/plugins/import/xar/importxar.h
===================================================================
--- scribus/plugins/import/xar/importxar.h (revision 14353)
+++ scribus/plugins/import/xar/importxar.h (revision 14354)
@@ -253,11 +253,12 @@
double baseX, baseY;
double docWidth;
double docHeight;
- bool firstLayer;
double TextX;
double TextY;
+ bool firstLayer;
bool interactive;
bool cancel;
+ QTransform textMatrix;
struct XarColor
{
quint32 colorType;
More information about the scribus-commit
mailing list