]> git.saurik.com Git - wxWidgets.git/commitdiff
AFM metrics were searched in /afm instead of /share/wx/afm ; did not try all AFM...
authorVáclav Slavík <vslavik@fastmail.fm>
Tue, 2 Nov 1999 23:23:24 +0000 (23:23 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Tue, 2 Nov 1999 23:23:24 +0000 (23:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4326 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/dcpsg.cpp

index 1f2153f36c013db4ea73b395cf7adb331c408219..ec088f18e7b309b301e72475fd4f9d444470a935 100644 (file)
@@ -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);