예제 #1
0
bool QgsFontUtils::fontFamilyHasStyle( const QString& family, const QString& style )
{
  QFontDatabase fontDB;
  if ( !fontFamilyOnSystem( family ) )
    return false;

  if ( fontDB.styles( family ).contains( style ) )
    return true;

#ifdef Q_OS_WIN
  QString modified( style );
  if ( style == "Roman" )
    modified = "Normal";
  if ( style == "Oblique" )
    modified = "Italic";
  if ( style == "Bold Oblique" )
    modified = "Bold Italic";
  if ( fontDB.styles( family ).contains( modified ) )
    return true;
#endif

  return false;
}
예제 #2
0
bool QgsFontUtils::fontFamilyHasStyle( const QString& family, const QString& style )
{
  QFontDatabase fontDB;
  return ( fontFamilyOnSystem( family ) && fontDB.styles( family ).contains( style ) );
}