r14366 by fschmid - Xara Importer: Implemented text kerning.
scribus-commit
scribus-commit at lists.scribus.net
Sat Nov 28 11:40:24 CET 2009
Revision: 14366
Author: fschmid
Date: 2009-11-28T01:05:39.878522Z
Commit message: Xara Importer: Implemented text kerning.
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 14365)
+++ scribus/plugins/import/xar/importxar.cpp (revision 14366)
@@ -655,6 +655,8 @@
handleTextChar(ts);
else if (tag == 2203)
endTextLine();
+ else if (tag == 2204)
+ handleTextKerning(ts);
else if (tag == 2206)
handleLineInfo(ts);
else if ((tag == 2902) || (tag == 2903) || (tag == 2904))
@@ -801,53 +803,51 @@
text.FontFamily = gc->FontFamily;
text.FontSize = gc->FontSize;
text.FontStretch = gc->FontStretch;
+ text.FontKerning = gc->FontKerning;
text.FontBold = gc->FontBold;
text.FontUnderline = gc->FontUnderline;
text.FontItalic = gc->FontItalic;
+ text.FillCol = gc->FillCol;
+ text.FillOpacity = gc->FillOpacity;
+ text.FillBlend = gc->FillBlend;
+ text.StrokeOpacity = gc->StrokeOpacity;
+ text.LWidth = gc->LWidth;
+ text.StrokeCol = gc->StrokeCol;
+ text.PLineJoin = gc->PLineJoin;
+ text.PLineEnd = gc->PLineEnd;
+ text.fillPattern = gc->fillPattern;
+ text.patternScaleX = gc->patternScaleX;
+ text.patternScaleY = gc->patternScaleY;
+ text.patternOffsetX = gc->patternOffsetX;
+ text.patternOffsetY = gc->patternOffsetY;
+ text.patternRotation = gc->patternRotation;
+ text.patternSkewX = gc->patternSkewX;
+ text.patternSkewY = gc->patternSkewY;
+ text.FillGradientType = gc->FillGradientType;
+ text.FillGradient = gc->FillGradient;
+ text.GradFillX1 = gc->GradFillX1;
+ text.GradFillY1 = gc->GradFillY1;
+ text.GradFillX2 = gc->GradFillX2;
+ text.GradFillY2 = gc->GradFillY2;
+ text.GrScale = gc->GrScale;
+ text.GrSkew = gc->GrSkew;
+ text.GradMask = gc->GradMask;
+ text.MaskGradient = gc->MaskGradient;
+ text.GradMaskX1 = gc->GradMaskX1;
+ text.GradMaskY1 = gc->GradMaskY1;
+ text.GradMaskX2 = gc->GradMaskX2;
+ text.GradMaskY2 = gc->GradMaskY2;
+ text.GradMaskScale = gc->GradMaskScale;
+ text.GradMaskSkew = gc->GradMaskSkew;
+ text.patternMaskScaleX = gc->patternMaskScaleX;
+ text.patternMaskScaleY = gc->patternMaskScaleY;
+ text.patternMaskOffsetX = gc->patternMaskOffsetX;
+ text.patternMaskOffsetY = gc->patternMaskOffsetY;
+ text.patternMaskRotation = gc->patternMaskRotation;
+ text.patternMaskSkewX = gc->patternMaskSkewX;
+ text.patternMaskSkewY = gc->patternMaskSkewY;
+ text.maskPattern = gc->maskPattern;
textData.append(text);
- if (textData.count() > 0)
- {
- textData.last().FillCol = gc->FillCol;
- textData.last().FillOpacity = gc->FillOpacity;
- textData.last().FillBlend = gc->FillBlend;
- textData.last().StrokeOpacity = gc->StrokeOpacity;
- textData.last().LWidth = gc->LWidth;
- textData.last().StrokeCol = gc->StrokeCol;
- textData.last().PLineJoin = gc->PLineJoin;
- textData.last().PLineEnd = gc->PLineEnd;
- textData.last().fillPattern = gc->fillPattern;
- textData.last().patternScaleX = gc->patternScaleX;
- textData.last().patternScaleY = gc->patternScaleY;
- textData.last().patternOffsetX = gc->patternOffsetX;
- textData.last().patternOffsetY = gc->patternOffsetY;
- textData.last().patternRotation = gc->patternRotation;
- textData.last().patternSkewX = gc->patternSkewX;
- textData.last().patternSkewY = gc->patternSkewY;
- textData.last().FillGradientType = gc->FillGradientType;
- textData.last().FillGradient = gc->FillGradient;
- textData.last().GradFillX1 = gc->GradFillX1;
- textData.last().GradFillY1 = gc->GradFillY1;
- textData.last().GradFillX2 = gc->GradFillX2;
- textData.last().GradFillY2 = gc->GradFillY2;
- textData.last().GrScale = gc->GrScale;
- textData.last().GrSkew = gc->GrSkew;
- textData.last().GradMask = gc->GradMask;
- textData.last().MaskGradient = gc->MaskGradient;
- textData.last().GradMaskX1 = gc->GradMaskX1;
- textData.last().GradMaskY1 = gc->GradMaskY1;
- textData.last().GradMaskX2 = gc->GradMaskX2;
- textData.last().GradMaskY2 = gc->GradMaskY2;
- textData.last().GradMaskScale = gc->GradMaskScale;
- textData.last().GradMaskSkew = gc->GradMaskSkew;
- textData.last().patternMaskScaleX = gc->patternMaskScaleX;
- textData.last().patternMaskScaleY = gc->patternMaskScaleY;
- textData.last().patternMaskOffsetX = gc->patternMaskOffsetX;
- textData.last().patternMaskOffsetY = gc->patternMaskOffsetY;
- textData.last().patternMaskRotation = gc->patternMaskRotation;
- textData.last().patternMaskSkewX = gc->patternMaskSkewX;
- textData.last().patternMaskSkewY = gc->patternMaskSkewY;
- textData.last().maskPattern = gc->maskPattern;
- }
// qDebug() << "String" << text.itemText;
}
@@ -861,53 +861,51 @@
text.FontFamily = gc->FontFamily;
text.FontSize = gc->FontSize;
text.FontStretch = gc->FontStretch;
+ text.FontKerning = gc->FontKerning;
text.FontBold = gc->FontBold;
text.FontUnderline = gc->FontUnderline;
text.FontItalic = gc->FontItalic;
+ text.FillCol = gc->FillCol;
+ text.FillOpacity = gc->FillOpacity;
+ text.FillBlend = gc->FillBlend;
+ text.StrokeOpacity = gc->StrokeOpacity;
+ text.LWidth = gc->LWidth;
+ text.StrokeCol = gc->StrokeCol;
+ text.PLineJoin = gc->PLineJoin;
+ text.PLineEnd = gc->PLineEnd;
+ text.fillPattern = gc->fillPattern;
+ text.patternScaleX = gc->patternScaleX;
+ text.patternScaleY = gc->patternScaleY;
+ text.patternOffsetX = gc->patternOffsetX;
+ text.patternOffsetY = gc->patternOffsetY;
+ text.patternRotation = gc->patternRotation;
+ text.patternSkewX = gc->patternSkewX;
+ text.patternSkewY = gc->patternSkewY;
+ text.FillGradientType = gc->FillGradientType;
+ text.FillGradient = gc->FillGradient;
+ text.GradFillX1 = gc->GradFillX1;
+ text.GradFillY1 = gc->GradFillY1;
+ text.GradFillX2 = gc->GradFillX2;
+ text.GradFillY2 = gc->GradFillY2;
+ text.GrScale = gc->GrScale;
+ text.GrSkew = gc->GrSkew;
+ text.GradMask = gc->GradMask;
+ text.MaskGradient = gc->MaskGradient;
+ text.GradMaskX1 = gc->GradMaskX1;
+ text.GradMaskY1 = gc->GradMaskY1;
+ text.GradMaskX2 = gc->GradMaskX2;
+ text.GradMaskY2 = gc->GradMaskY2;
+ text.GradMaskScale = gc->GradMaskScale;
+ text.GradMaskSkew = gc->GradMaskSkew;
+ text.patternMaskScaleX = gc->patternMaskScaleX;
+ text.patternMaskScaleY = gc->patternMaskScaleY;
+ text.patternMaskOffsetX = gc->patternMaskOffsetX;
+ text.patternMaskOffsetY = gc->patternMaskOffsetY;
+ text.patternMaskRotation = gc->patternMaskRotation;
+ text.patternMaskSkewX = gc->patternMaskSkewX;
+ text.patternMaskSkewY = gc->patternMaskSkewY;
+ text.maskPattern = gc->maskPattern;
textData.append(text);
- if (textData.count() > 0)
- {
- textData.last().FillCol = gc->FillCol;
- textData.last().FillOpacity = gc->FillOpacity;
- textData.last().FillBlend = gc->FillBlend;
- textData.last().StrokeOpacity = gc->StrokeOpacity;
- textData.last().LWidth = gc->LWidth;
- textData.last().StrokeCol = gc->StrokeCol;
- textData.last().PLineJoin = gc->PLineJoin;
- textData.last().PLineEnd = gc->PLineEnd;
- textData.last().fillPattern = gc->fillPattern;
- textData.last().patternScaleX = gc->patternScaleX;
- textData.last().patternScaleY = gc->patternScaleY;
- textData.last().patternOffsetX = gc->patternOffsetX;
- textData.last().patternOffsetY = gc->patternOffsetY;
- textData.last().patternRotation = gc->patternRotation;
- textData.last().patternSkewX = gc->patternSkewX;
- textData.last().patternSkewY = gc->patternSkewY;
- textData.last().FillGradientType = gc->FillGradientType;
- textData.last().FillGradient = gc->FillGradient;
- textData.last().GradFillX1 = gc->GradFillX1;
- textData.last().GradFillY1 = gc->GradFillY1;
- textData.last().GradFillX2 = gc->GradFillX2;
- textData.last().GradFillY2 = gc->GradFillY2;
- textData.last().GrScale = gc->GrScale;
- textData.last().GrSkew = gc->GrSkew;
- textData.last().GradMask = gc->GradMask;
- textData.last().MaskGradient = gc->MaskGradient;
- textData.last().GradMaskX1 = gc->GradMaskX1;
- textData.last().GradMaskY1 = gc->GradMaskY1;
- textData.last().GradMaskX2 = gc->GradMaskX2;
- textData.last().GradMaskY2 = gc->GradMaskY2;
- textData.last().GradMaskScale = gc->GradMaskScale;
- textData.last().GradMaskSkew = gc->GradMaskSkew;
- textData.last().patternMaskScaleX = gc->patternMaskScaleX;
- textData.last().patternMaskScaleY = gc->patternMaskScaleY;
- textData.last().patternMaskOffsetX = gc->patternMaskOffsetX;
- textData.last().patternMaskOffsetY = gc->patternMaskOffsetY;
- textData.last().patternMaskRotation = gc->patternMaskRotation;
- textData.last().patternMaskSkewX = gc->patternMaskSkewX;
- textData.last().patternMaskSkewY = gc->patternMaskSkewY;
- textData.last().maskPattern = gc->maskPattern;
- }
// qDebug() << "Char" << QChar(val);
}
@@ -939,6 +937,17 @@
// qDebug() << "Tracking" << val;
}
+void XarPlug::handleTextKerning(QDataStream &ts)
+{
+ qint32 valX, valY;
+ ts >> valX >> valY;
+ XarStyle *gc = m_gc.top();
+ gc->FontKerning = valX / 1000.0;
+ if (textData.count() > 0)
+ textData.last().FontKerning = gc->FontKerning;
+// qDebug() << "Kerning" << valX / 1000.0 << valY / 1000.0;
+}
+
void XarPlug::handleTextAspectRatio(QDataStream &ts)
{
quint32 val;
@@ -979,6 +988,7 @@
{
XarText txDat;
txDat = textData.at(a);
+ xpos += txDat.FontKerning * (txDat.FontSize * 72.0 / 96.0);
txDat.FontSize *= 10;
QFont textFont = QFont(txDat.FontFamily, txDat.FontSize);
if (txDat.FontSize >= 1)
@@ -1089,6 +1099,7 @@
XarText txDat;
painterPath = QPainterPath();
txDat = textData.at(a);
+ xpos += txDat.FontKerning * txDat.FontSize;
txDat.FontSize *= 10;
QFont textFont = QFont(txDat.FontFamily, txDat.FontSize);
if (txDat.FontSize >= 1)
Index: scribus/plugins/import/xar/importxar.h
===================================================================
--- scribus/plugins/import/xar/importxar.h (revision 14365)
+++ scribus/plugins/import/xar/importxar.h (revision 14366)
@@ -37,6 +37,7 @@
LineHeight(15.0),
LineWidth(0.0),
FontStretch(1.0),
+ FontKerning(0.0),
FontBold(false),
FontUnderline(false),
FontItalic(false),
@@ -101,6 +102,7 @@
double LineHeight;
double LineWidth;
double FontStretch;
+ double FontKerning;
bool FontBold;
bool FontUnderline;
bool FontItalic;
@@ -201,6 +203,7 @@
void handleLineInfo(QDataStream &ts);
void handleTextAlignment(quint32 tag);
void handleTextTracking(QDataStream &ts);
+ void handleTextKerning(QDataStream &ts);
void handleTextAspectRatio(QDataStream &ts);
void handleTextBaseline(QDataStream &ts);
void startTextLine();
@@ -294,6 +297,7 @@
QString itemText;
double FontSize;
double FontStretch;
+ double FontKerning;
bool FontBold;
bool FontUnderline;
bool FontItalic;
More information about the scribus-commit
mailing list