]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix for bug IPAL10893.
authormzn <mzn@opencascade.com>
Mon, 20 Mar 2006 12:39:05 +0000 (12:39 +0000)
committermzn <mzn@opencascade.com>
Mon, 20 Mar 2006 12:39:05 +0000 (12:39 +0000)
src/LightApp/LightApp_Application.cxx
src/LightApp/resources/LightApp.xml
src/SalomeApp/resources/SalomeApp.xml

index 051b1c314cd741433f6e6d7c171c1c6a7e2af588..0f2b882a0123ea704d0ab0af7b229e1afe6fe77e 100644 (file)
 #include <qcombobox.h>
 #include <qinputdialog.h>
 #include <qmessagebox.h>
+#include <qfontdatabase.h>
 
 #define FIRST_HELP_ID 1000000
 
@@ -965,10 +966,32 @@ void LightApp_Application::addWindow( QWidget* wid, const int flag, const int st
     if( resourceMgr()->hasValue( "PyConsole", "font" ) )
       f = resourceMgr()->fontValue( "PyConsole", "font" );
     else
-    {
-      f = ( ( PythonConsole* )wid )->font();
-      resourceMgr()->setValue( "PyConsole", "font", f );
-    }
+      {
+       f = ( ( PythonConsole* )wid )->font();
+       resourceMgr()->setValue( "PyConsole", "font", f );
+      }
+    
+    // Try to set one of additional families (if it exists in the font database)
+    QFontDatabase fdb;
+    QStringList aDatabaseFamilies = fdb.families();
+    
+    if ( !aDatabaseFamilies.contains(f.family()) && 
+        resourceMgr()->hasValue( "PyConsole", "additional_families" ) )
+      {
+       QStringList anAddFamilies = QStringList::split( ";", resourceMgr()->stringValue( "PyConsole", "additional_families" ) );
+       
+       QString aFamily;
+       for ( QStringList::Iterator it = anAddFamilies.begin(); it != anAddFamilies.end(); ++it )
+         {
+           aFamily = *it;
+           if ( !aDatabaseFamilies.contains(aFamily) )
+             continue;
+           
+           f.setFamily( aFamily );
+           resourceMgr()->setValue( "PyConsole", "font", f );
+           break;
+         }
+      }
   }
   else
 #endif
index cab85581e6453ed0713d7e19b093e101892b60b1..8bdd61f407460aa6a22f3208213a726bf49a9b36 100644 (file)
     <parameter name="name"       value="Light"/>
     <parameter name="icon"       value="LIGHT.png"/>
   </section>
+  <section name="PyConsole">
+    <parameter name="font" value="Helvetic,12" />
+    <parameter name="additional_families" value="Helvetic;Helvetica;Helvetica[Adobe];Times;Times[Adobe];Sans Serif;Serif;Monospace;Lucida"/>
+  </section>
 
 <!-- values below this line are just an example, they are not used  -->
   <section name="application">
index 3fa77b587fbd3d12c37de96fb63587d61f691dc6..fce6608bc925abe18ff5328d2a76cd2b8a8e7ca5 100644 (file)
@@ -57,6 +57,7 @@
   </section>
   <section name="PyConsole">
     <parameter name="font" value="Helvetic,12" />
+    <parameter name="additional_families" value="Helvetic;Helvetica;Helvetica[Adobe];Times;Times[Adobe];Sans Serif;Serif;Monospace;Lucida"/>
   </section>
   <section name="Study">
     <parameter name="store_positions"          value="false" />