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 )
}
/* get the directory of the AFM files */
- char afmName[256];
- afmName[0] = 0;
-
+ wxString afmName = wxEmptyString;
if (!m_printData.GetFontMetricPath().IsEmpty())
{
- strcpy( afmName, m_printData.GetFontMetricPath().fn_str() );
+ afmName = m_printData.GetFontMetricPath();
}
/* 2. open and process the file
/* new elements JC Sun Aug 25 23:21:44 MET DST 1996 */
- strcat(afmName,name);
- strcat(afmName,".afm");
- FILE *afmFile = fopen(afmName,"r");
+ afmName << name << wxT(".afm");
+ FILE *afmFile = wxFopen(afmName,wxT("r"));
if (afmFile==NULL)
{
- strcpy( afmName, wxThePrintSetupData->GetAFMPath() );
- strcat(afmName, wxString(wxFILE_SEP_PATH));
- strcat(afmName,name);
- strcat(afmName,".afm");
- afmFile = fopen(afmName,"r");
+ afmName = wxThePrintSetupData->GetAFMPath();
+ afmName << wxFILE_SEP_PATH << name << wxT(".afm");
+ afmFile = wxFopen(afmName,wxT("r"));
}
#ifdef __UNIX__
- else 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" */
{
- strcpy( afmName, "/usr/local/share/wx/afm/" );
- strcat(afmName,name);
- strcat(afmName,".afm");
- afmFile = fopen(afmName,"r");
- }
- else if (afmFile==NULL)
- {
- strcpy( afmName, "/usr/share/wx/afm/" );
- strcat(afmName,name);
- strcat(afmName,".afm");
- afmFile = fopen(afmName,"r");
+ afmName = wxINSTALL_PREFIX;
+ afmName << wxFILE_SEP_PATH
+ << 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
+
if (afmFile==NULL)
{
- wxLogDebug( wxT("GetTextExtent: can't open AFM file '%hs'\n"), afmName );
+ wxLogDebug( wxT("GetTextExtent: can't open AFM file '%hs'\n"), afmName.c_str() );
wxLogDebug( wxT(" using approximate values\n"));
for (int i=0; i<256; i++) lastWidths[i] = 500; /* an approximate value */
lastDescender = -150; /* dito. */
if ((sscanf(line,"%s%d",descString,&lastDescender)!=2) ||
(strcmp(descString,"Descender")!=0))
{
- wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad descender)\n"), afmName,line );
+ wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad descender)\n"), afmName.c_str(),line );
}
}
/* JC 1.) check for UnderlinePosition */
if ((sscanf(line,"%s%lf",upString,&UnderlinePosition)!=2) ||
(strcmp(upString,"UnderlinePosition")!=0))
{
- wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad UnderlinePosition)\n"), afmName, line );
+ wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad UnderlinePosition)\n"), afmName.c_str(), line );
}
}
/* JC 2.) check for UnderlineThickness */
if ((sscanf(line,"%s%lf",utString,&UnderlineThickness)!=2) ||
(strcmp(utString,"UnderlineThickness")!=0))
{
- wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad UnderlineThickness)\n"), afmName, line );
+ wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad UnderlineThickness)\n"), afmName.c_str(), line );
}
}
/* JC 3.) check for EncodingScheme */
if ((sscanf(line,"%s%s",utString,encString)!=2) ||
(strcmp(utString,"EncodingScheme")!=0))
{
- wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad EncodingScheme)\n"), afmName, line );
+ wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad EncodingScheme)\n"), afmName.c_str(), line );
}
else if (strncmp(encString, "AdobeStandardEncoding", 21))
{
wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (unsupported EncodingScheme %hs)\n"),
- afmName,line, encString);
+ afmName.c_str(),line, encString);
}
}
/* B.) check for char-width */
{
if (sscanf(line,"%s%d%s%s%d",cString,&ascii,semiString,WXString,&cWidth)!=5)
{
- wxLogDebug(wxT("AFM-file '%hs': line '%hs' has an error (bad character width)\n"),afmName,line);
+ wxLogDebug(wxT("AFM-file '%hs': line '%hs' has an error (bad character width)\n"),afmName.c_str(),line);
}
if(strcmp(cString,"C")!=0 || strcmp(semiString,";")!=0 || strcmp(WXString,"WX")!=0)
{
- wxLogDebug(wxT("AFM-file '%hs': line '%hs' has a format error\n"),afmName,line);
+ wxLogDebug(wxT("AFM-file '%hs': line '%hs' has a format error\n"),afmName.c_str(),line);
}
/* printf(" char '%c'=%d has width '%d'\n",ascii,ascii,cWidth); */
if (ascii>=0 && ascii<256)
else
{
/* MATTHEW: this happens a lot; don't print an error */
- /* wxLogDebug("AFM-file '%s': ASCII value %d out of range\n",afmName,ascii); */
+ /* wxLogDebug("AFM-file '%s': ASCII value %d out of range\n",afmName.c_str(),ascii); */
}
}
/* C.) ignore other entries. */
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);
}
}