From: Václav Slavík Date: Tue, 2 Nov 1999 23:23:24 +0000 (+0000) Subject: AFM metrics were searched in /afm instead of /share/wx/afm ; did not try all AFM... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5558ce7ce4cb13e0d5001f0961216ab09901d1ec AFM metrics were searched in /afm instead of /share/wx/afm ; did not try all AFM locations correctly git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4326 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index 1f2153f36c..ec088f18e7 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -1809,7 +1809,7 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, } /* get the directory of the AFM files */ - wxString afmName; + wxString afmName = wxEmptyString; if (!m_printData.GetFontMetricPath().IsEmpty()) { afmName = m_printData.GetFontMetricPath().fn_str(); @@ -1841,24 +1841,28 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, } #ifdef __UNIX__ - else if (afmFile==NULL) + 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 - else if (afmFile==NULL) + if (afmFile==NULL) { strcpy( afmName, "/usr/local/share/wx/afm/" ); strcat(afmName,name); strcat(afmName,".afm"); afmFile = fopen(afmName,"r"); } - else if (afmFile==NULL) + if (afmFile==NULL) { strcpy( afmName, "/usr/share/wx/afm/" ); strcat(afmName,name);