| Summary: | wrong BoundingBox values in EPS output | ||
|---|---|---|---|
| Product: | [Applications] kst | Reporter: | Falk-Florian Henrich <henrich> |
| Component: | general | Assignee: | kst |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 1.3.1 | ||
| Target Milestone: | --- | ||
| Platform: | Fedora RPMs | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Falk-Florian Henrich
2007-01-02 11:43:28 UTC
SVN commit 619695 by arwalker:
BUG:139495 Set the BoundingBox values correctly for an EPS file
M +17 -4 kstviewwindow.cpp
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewwindow.cpp #619694:619695
@@ -234,7 +234,9 @@
if (!view()->children().isEmpty()) {
QString filenameNew;
QString filenameNewEps;
-
+ int right;
+ int bottom;
+
{
QPrinter printer(QPrinter::HighResolution);
QString dotFormat = QString(".eps");
@@ -251,13 +253,16 @@
if ( size.height() / 8 > resolution ) {
resolution = size.height() / 8;
}
-
+ right = ( 72 * size.height() ) / resolution;
+ bottom = ( 72 * size.width() ) / resolution;
+
+ printer.setMargins(0, 0, 0, 0);
printer.setResolution(resolution);
printer.setPageSize(QPrinter::Letter);
printer.setOrientation(QPrinter::Landscape);
printer.setOutputToFile(true);
printer.setOutputFileName(filenameNew);
-
+
KstPainter paint(KstPainter::P_PRINT);
paint.begin(&printer);
QPaintDeviceMetrics metrics(&printer);
@@ -279,7 +284,7 @@
if (fileEPS.open(IO_WriteOnly | IO_Truncate)) {
QTextStream streamPS(&filePS);
QTextStream streamEPS(&fileEPS);
-
+
line = streamPS.readLine();
if (!line.isNull()) {
if (line.left(11) == "%!PS-Adobe-") {
@@ -287,6 +292,14 @@
// we have a ps file, so do the conversion...
//
streamEPS << "%!PS-Adobe-2.0 EPSF-2.0\n";
+
+ line = streamPS.readLine();
+ if (!line.isNull() && line.left(14) == "%%BoundingBox:") {
+ streamEPS << "%%BoundingBox: 0 0 " << right << " " << bottom << "\n";
+ } else {
+ streamEPS << line << "\n";
+ }
+
while (!streamPS.atEnd()) {
line = streamPS.readLine();
streamEPS << line << "\n";
|