Folio List: DXF Export long text corrected and

Alignment changed for Title: Center aligned for heading 
and left aligned for entries


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2842 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
abhishekm71
2014-02-09 17:47:18 +00:00
parent a43d3ae67e
commit 23970c9473
4 changed files with 41 additions and 24 deletions

View File

@@ -489,7 +489,7 @@ void Createdxf::drawText(QString fileName, QString text,double x, double y, doub
/* draw aligned text in DXF Format */
void Createdxf::drawTextAligned(QString fileName, QString text,double x, double y, double height, double rotation, double oblique,int hAlign, int vAlign, double xAlign,int colour,
float scale)
bool leftAlign, float scale)
{
if (!fileName.isEmpty()) {
QFile file(fileName);
@@ -520,19 +520,21 @@ void Createdxf::drawTextAligned(QString fileName, QString text,double x, double
To_Dxf << text << "\r\n"; // Text Value
To_Dxf << 50 << "\r\n";
To_Dxf << rotation << "\r\n"; // Text Rotation
// If "Fit to width", then check if width of text < width specified then change it "center align or left align"
if (hAlign == 5) {
int xDiff = xAlign - x;
if (text.length() < xDiff/height && !leftAlign) {
hAlign = 1;
xAlign = (x+xAlign) / 2;
} else if (text.length() < xDiff/height && leftAlign) {
file.close();
return;
}
}
To_Dxf << 51 << "\r\n";
To_Dxf << oblique << "\r\n"; // Text Obliqueness
To_Dxf << 72 << "\r\n";
// If "Fit to width", then check if width of text < width specified then change it "center align"
if (hAlign == 5) {
int xDiff = xAlign - x;
if (text.length() < xDiff/height) {
hAlign = 1;
xAlign = (x+xAlign) / 2;
}
}
To_Dxf << 72 << "\r\n";
To_Dxf << hAlign << "\r\n"; // Text Horizontal Alignment
To_Dxf << 73 << "\r\n";
To_Dxf << vAlign << "\r\n"; // Text Vertical Alignment