void wxPostScriptDC::DoDrawText( const wxString& text, wxCoord x, wxCoord y )
{
wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
+
+ wxCoord text_w, text_h, text_descent;
+
+ GetTextExtent(text, &text_w, &text_h, &text_descent);
SetFont( m_font );
int size = m_font.GetPointSize();
- wxCoord by = y + (wxCoord)floor( double(size) * 2.0 / 3.0 ); // approximate baseline
+// wxCoord by = y + (wxCoord)floor( double(size) * 2.0 / 3.0 ); // approximate baseline
+// commented by V. Slavik and replaced by accurate version
+// - note that there is still rounding error in text_descent!
+ 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 */
if (m_font.GetUnderlined())
{
wxCoord uy = (wxCoord)(y + size - m_underlinePosition);
- wxCoord w, h;
- GetTextExtent(text, &w, &h);
fprintf( m_pstream,
"gsave\n"
"grestore\n",
XLOG2DEV(x), YLOG2DEV(uy),
(wxCoord)m_underlineThickness,
- XLOG2DEV(x + w), YLOG2DEV(uy) );
+ XLOG2DEV(x + text_w), YLOG2DEV(uy) );
}
CalcBoundingBox( x, y );
}
/* add descender to height (it is usually a negative value) */
- if (lastDescender != INT_MIN)
- {
- height += (wxCoord)(((-lastDescender)/1000.0F) * Size); /* MATTHEW: forgot scale */
- }
+ //if (lastDescender != INT_MIN)
+ //{
+ // height += (wxCoord)(((-lastDescender)/1000.0F) * Size); /* MATTHEW: forgot scale */
+ //}
+ // - commented by V. Slavik - height already contains descender in it
+ // (judging from few experiments)
/* return size values */
if ( x )
wxPrintSetupData *wxThePrintSetupData = (wxPrintSetupData *) NULL;
-#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxPrintSetupData, wxObject)
-#endif
// Redundant now I think
#if 1