#include <qcombobox.h>
#include <qinputdialog.h>
#include <qmessagebox.h>
+#include <qfontdatabase.h>
#define FIRST_HELP_ID 1000000
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
<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">
</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" />