X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5558ce7ce4cb13e0d5001f0961216ab09901d1ec..58b1642453c5858a4dd29425b065e9215cb8ec79:/src/generic/dcpsg.cpp diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index ec088f18e7..bf484f5b9e 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -1004,11 +1004,11 @@ void wxPostScriptDC::SetFont( const wxFont& font ) fprintf( m_pstream, " reencodeISO def\n" ); fprintf( m_pstream, buffer ); fprintf( m_pstream, " findfont\n" ); - #ifdef __WXMSW__ - fprintf( m_pstream, "%d scalefont setfont\n", YLOG2DEVREL(m_font.GetPointSize()) ); - #else - fprintf( m_pstream, "%d scalefont setfont\n", YLOG2DEVREL(m_font.GetPointSize()) ); - #endif + + fprintf( m_pstream, "%f scalefont setfont\n", YLOG2DEVREL(m_font.GetPointSize() * 1000) / 1000.0F); + // this is a hack - we must scale font size (in pts) according to m_scaleY but + // YLOG2DEVREL works with wxCoord type (int or longint). Se we first convert font size + // to 1/1000th of pt and then back. } void wxPostScriptDC::SetPen( const wxPen& pen ) @@ -1812,7 +1812,7 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, wxString afmName = wxEmptyString; if (!m_printData.GetFontMetricPath().IsEmpty()) { - afmName = m_printData.GetFontMetricPath().fn_str(); + afmName = m_printData.GetFontMetricPath(); } /* 2. open and process the file @@ -1831,43 +1831,29 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, /* new elements JC Sun Aug 25 23:21:44 MET DST 1996 */ - afmName << name << ".afm"; - FILE *afmFile = fopen(afmName,"r"); + afmName << name << wxT(".afm"); + FILE *afmFile = wxFopen(afmName,wxT("r")); if (afmFile==NULL) { afmName = wxThePrintSetupData->GetAFMPath(); - afmName << wxFILE_SEP_PATH << name << ".afm"; - afmFile = fopen(afmName,"r"); + afmName << wxFILE_SEP_PATH << name << wxT(".afm"); + afmFile = wxFopen(afmName,wxT("r")); } #ifdef __UNIX__ - if (afmFile==NULL) +#ifndef __VMS__ + if (afmFile==NULL) /* please do NOT change the line above to "else if (afmFile==NULL)" - - afmFile = fopen() may fail and in that case the next if branch MUST be executed - and it would not if there was "else" */ { afmName = wxINSTALL_PREFIX; afmName << wxFILE_SEP_PATH - << "share" << wxFILE_SEP_PATH - << "wx" << wxFILE_SEP_PATH - << "afm" << wxFILE_SEP_PATH - << name << ".afm"; - 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"); + << wxT("share") << wxFILE_SEP_PATH + << wxT("wx") << wxFILE_SEP_PATH + << wxT("afm") << wxFILE_SEP_PATH + << name << wxT(".afm"); + afmFile = wxFopen(afmName,wxT("r")); } #endif #endif @@ -1993,11 +1979,11 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, if(lastWidths[*p]== INT_MIN) { 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 { - widthSum += /*(wxCoord)*/((lastWidths[*p]/1000.0F)*Size); + widthSum += ((lastWidths[*p]/1000.0F)*Size); } }