fixed rounding error problem in wxPostscriptDC::SetFont when DC's user scale was != 1 ; this fixes AFM problem with wxLayout

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4341 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
1999-11-03 15:33:25 +00:00
parent 385c54d720
commit ce7f10f2a6

View File

@@ -1004,11 +1004,11 @@ void wxPostScriptDC::SetFont( const wxFont& font )
fprintf( m_pstream, " reencodeISO def\n" ); fprintf( m_pstream, " reencodeISO def\n" );
fprintf( m_pstream, buffer ); fprintf( m_pstream, buffer );
fprintf( m_pstream, " findfont\n" ); fprintf( m_pstream, " findfont\n" );
#ifdef __WXMSW__
fprintf( m_pstream, "%d scalefont setfont\n", YLOG2DEVREL(m_font.GetPointSize()) ); fprintf( m_pstream, "%f scalefont setfont\n", YLOG2DEVREL(m_font.GetPointSize() * 1000) / 1000.0F);
#else // this is a hack - we must scale font size (in pts) according to m_scaleY but
fprintf( m_pstream, "%d scalefont setfont\n", YLOG2DEVREL(m_font.GetPointSize()) ); // YLOG2DEVREL works with wxCoord type (int or longint). Se we first convert font size
#endif // to 1/1000th of pt and then back.
} }
void wxPostScriptDC::SetPen( const wxPen& pen ) void wxPostScriptDC::SetPen( const wxPen& pen )
@@ -1854,22 +1854,6 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
<< name << ".afm"; << name << ".afm";
afmFile = fopen(afmName,"r"); afmFile = fopen(afmName,"r");
} }
#if 0
if (afmFile==NULL)
{
strcpy( afmName, "/usr/local/share/wx/afm/" );
strcat(afmName,name);
strcat(afmName,".afm");
afmFile = fopen(afmName,"r");
}
if (afmFile==NULL)
{
strcpy( afmName, "/usr/share/wx/afm/" );
strcat(afmName,name);
strcat(afmName,".afm");
afmFile = fopen(afmName,"r");
}
#endif
#endif #endif
if (afmFile==NULL) if (afmFile==NULL)
@@ -1993,11 +1977,11 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
if(lastWidths[*p]== INT_MIN) if(lastWidths[*p]== INT_MIN)
{ {
wxLogDebug(wxT("GetTextExtent: undefined width for character '%hc' (%d)\n"), *p,*p); wxLogDebug(wxT("GetTextExtent: undefined width for character '%hc' (%d)\n"), *p,*p);
widthSum += /*(wxCoord)*/(lastWidths[' ']/1000.0F * Size); /* assume space */ widthSum += (lastWidths[' ']/1000.0F * Size); /* assume space */
} }
else else
{ {
widthSum += /*(wxCoord)*/((lastWidths[*p]/1000.0F)*Size); widthSum += ((lastWidths[*p]/1000.0F)*Size);
} }
} }