GetTextExtent(text, &text_w, &text_h, &text_descent);
- SetFont( m_font );
+ // VZ: this seems to be unnecessary, so taking it out for now, if it
+ // doesn't create any problems, remove this comment entirely
+ //SetFont( m_font );
if (m_textForegroundColour.Ok())
{
wxCoord by = y + size - text_descent; // baseline
fprintf( m_pstream, "%d %d moveto\n", XLOG2DEV(x), YLOG2DEV(by) );
- /* I don't know how to write char to a stream, so I use a mini string */
- char tmpbuf[2];
- tmpbuf[1] = 0;
-
fprintf( m_pstream, "(" );
const wxWX2MBbuf textbuf = text.mb_str();
int len = strlen(textbuf);
{
/* Cope with special characters */
fprintf( m_pstream, "\\" );
- tmpbuf[0] = (char) c;
- fprintf( m_pstream, tmpbuf );
+ fputc(c, m_pstream);
}
else if ( c >= 128 )
{
}
else
{
- tmpbuf[0] = (char) c;
- fprintf( m_pstream, tmpbuf );
+ fputc(c, m_pstream);
}
}
if (buffer[i] == ',') buffer[i] = '.';
fprintf(m_pstream, buffer);
- /* I don't know how to write char to a stream, so I use a mini string */
- char tmpbuf[2];
- tmpbuf[1] = 0;
-
fprintf( m_pstream, "(" );
const wxWX2MBbuf textbuf = text.mb_str();
int len = strlen(textbuf);
{
/* Cope with special characters */
fprintf( m_pstream, "\\" );
- tmpbuf[0] = (char) c;
- fprintf( m_pstream, tmpbuf );
+ fputc(c, m_pstream);
}
else if ( c >= 128 )
{
}
else
{
- tmpbuf[0] = (char) c;
- fprintf( m_pstream, tmpbuf );
+ fputc(c, m_pstream);
}
}
// Compute the bounding box. Note that it is in the default user
// coordinate system, thus we have to convert the values.
- wxCoord llx = (wxCoord) ((XLOG2DEV(m_minX)+wx_printer_translate_x)*wx_printer_scale_x);
- wxCoord lly = (wxCoord) ((YLOG2DEV(m_minY)+wx_printer_translate_y)*wx_printer_scale_y);
- wxCoord urx = (wxCoord) ((XLOG2DEV(m_maxX)+wx_printer_translate_x)*wx_printer_scale_x);
- wxCoord ury = (wxCoord) ((YLOG2DEV(m_maxY)+wx_printer_translate_y)*wx_printer_scale_y);
+ wxCoord minX = (wxCoord) XLOG2DEV(m_minX);
+ wxCoord minY = (wxCoord) YLOG2DEV(m_minY);
+ wxCoord maxX = (wxCoord) XLOG2DEV(m_maxX);
+ wxCoord maxY = (wxCoord) YLOG2DEV(m_maxY);
+
+ // LOG2DEV may have changed the minimum to maximum vice versa
+ if ( minX > maxX ) { wxCoord tmp = minX; minX = maxX; maxX = tmp; }
+ if ( minY > maxY ) { wxCoord tmp = minY; minY = maxY; maxY = tmp; }
+
+ // account for used scaling (boundingbox is before scaling in ps-file)
+ double scale_x = m_printData.GetPrinterScaleX() / ms_PSScaleFactor;
+ double scale_y = m_printData.GetPrinterScaleY() / ms_PSScaleFactor;
+
+ wxCoord llx, lly, urx, ury;
+ llx = (wxCoord) ((minX+wx_printer_translate_x)*scale_x);
+ lly = (wxCoord) ((minY+wx_printer_translate_y)*scale_y);
+ urx = (wxCoord) ((maxX+wx_printer_translate_x)*scale_x);
+ ury = (wxCoord) ((maxY+wx_printer_translate_y)*scale_y);
+ // (end of bounding box computation)
+
// If we're landscape, our sense of "x" and "y" is reversed.
if (m_printData.GetOrientation() == wxLANDSCAPE)