コード例 #1
0
ファイル: DesktopOptions.cpp プロジェクト: AlanCal/rstudio
QString Options::fixedWidthFont() const
{
   static QString detectedFont;

   QString font =
         settings_.value(QString::fromUtf8("font.fixedWidth")).toString();
   if (!font.isEmpty())
   {
      return QString::fromUtf8("\"") + font + QString::fromUtf8("\"");
   }

   if (!detectedFont.isEmpty())
      return detectedFont;

   QStringList fontList;
   fontList <<
#if defined(Q_OS_MAC)
           QString::fromUtf8("Monaco")
#elif defined (Q_OS_LINUX)
           QString::fromUtf8("Ubuntu Mono") << QString::fromUtf8("Droid Sans Mono") << QString::fromUtf8("DejaVu Sans Mono") << QString::fromUtf8("Monospace")
#else
           QString::fromUtf8("Lucida Console") << QString::fromUtf8("Consolas") // Windows;
#endif
           ;

   // The fallback font is Courier, not monospace, because QtWebKit doesn't
   // actually provide a monospace font (appears to use Helvetica)

   return detectedFont = QString::fromUtf8("\"") +
         findFirstMatchingFont(fontList, QString::fromUtf8("Courier"), true) +
         QString::fromUtf8("\"");
}
コード例 #2
0
ファイル: DesktopOptions.cpp プロジェクト: gdberrio/rstudio
QString Options::fixedWidthFont() const
{
   // NB: Windows has "Lucida Console" and "Consolas" reversed vs.
   // the list in WebThemeFontLoader (in the GWT codebase). This is
   // because Consolas is more attractive but has a spacing issue
   // in Win/Desktop mode (U+200B shows up as a space, and we use it
   // in the History pane).
   QStringList fontList;
   fontList <<
           "Droid Sans Mono" << "DejaVu Sans Mono" << // Linux
           "Monaco" <<                      // Mac
           "Lucida Console" << "Consolas"   // Windows;
           ;
   return "\"" + findFirstMatchingFont(fontList, "monospace") + "\"";
}
コード例 #3
0
ファイル: DesktopOptions.cpp プロジェクト: tierney/rstudio
QString Options::proportionalFont() const
{
   static QString detectedFont;

   QString font =
         settings_.value(QString::fromAscii("font.proportional")).toString();
   if (!font.isEmpty())
   {
      return font;
   }

   if (!detectedFont.isEmpty())
      return detectedFont;

   QStringList fontList;
#if defined(_WIN32)
   fontList <<
           QString::fromAscii("Segoe UI") << QString::fromAscii("Verdana") <<  // Windows
           QString::fromAscii("Lucida Sans") << QString::fromAscii("DejaVu Sans") <<  // Linux
           QString::fromAscii("Lucida Grande") <<          // Mac
           QString::fromAscii("Helvetica");
#elif defined(__APPLE__)
   fontList <<
           QString::fromAscii("Lucida Grande") <<          // Mac
           QString::fromAscii("Lucida Sans") << QString::fromAscii("DejaVu Sans") <<  // Linux
           QString::fromAscii("Segoe UI") << QString::fromAscii("Verdana") <<  // Windows
           QString::fromAscii("Helvetica");
#else
   fontList <<
           QString::fromAscii("Ubuntu") << // Ubuntu
           QString::fromAscii("Lucida Sans") << QString::fromAscii("DejaVu Sans") <<  // Linux
           QString::fromAscii("Lucida Grande") <<          // Mac
           QString::fromAscii("Segoe UI") << QString::fromAscii("Verdana") <<  // Windows
           QString::fromAscii("Helvetica");
#endif
   return QString::fromAscii("\"") +
         findFirstMatchingFont(fontList, QString::fromAscii("sans-serif"), false) +
         QString::fromAscii("\"");
}
コード例 #4
0
ファイル: DesktopOptions.cpp プロジェクト: tierney/rstudio
QString Options::fixedWidthFont() const
{
   static QString detectedFont;

   QString font =
         settings_.value(QString::fromAscii("font.fixedWidth")).toString();
   if (!font.isEmpty())
   {
      return font;
   }

   if (!detectedFont.isEmpty())
      return detectedFont;

   // NB: Windows has "Lucida Console" and "Consolas" reversed vs.
   // the list in WebThemeFontLoader (in the GWT codebase). This is
   // because Consolas is more attractive but has a spacing issue
   // in Win/Desktop mode (U+200B shows up as a space, and we use it
   // in the History pane).
   QStringList fontList;
   fontList <<
#if defined(Q_WS_MACX)
           QString::fromAscii("Monaco")
#elif defined (Q_WS_X11)
           QString::fromAscii("Ubuntu Mono") << QString::fromAscii("Droid Sans Mono") << QString::fromAscii("DejaVu Sans Mono") << QString::fromAscii("Monospace")
#else
           QString::fromAscii("Lucida Console") << QString::fromAscii("Consolas")   // Windows;
#endif
           ;

   // The fallback font is Courier, not monospace, because QtWebKit doesn't
   // actually provide a monospace font (appears to use Helvetica)

   return detectedFont = QString::fromAscii("\"") +
         findFirstMatchingFont(fontList, QString::fromAscii("Courier"), true) +
         QString::fromAscii("\"");
}
コード例 #5
0
ファイル: DesktopOptions.cpp プロジェクト: gdberrio/rstudio
QString Options::proportionalFont() const
{
   QStringList fontList;
#if defined(_WIN32)
   fontList <<
           "Segoe UI" << "Verdana" <<  // Windows
           "Lucida Sans" << "DejaVu Sans" <<  // Linux
           "Lucida Grande" <<          // Mac
           "Helvetica";
#elif defined(__APPLE__)
   fontList <<
           "Lucida Grande" <<          // Mac
           "Lucida Sans" << "DejaVu Sans" <<  // Linux
           "Segoe UI" << "Verdana" <<  // Windows
           "Helvetica";
#else
   fontList <<
           "Lucida Sans" << "DejaVu Sans" <<  // Linux
           "Lucida Grande" <<          // Mac
           "Segoe UI" << "Verdana" <<  // Windows
           "Helvetica";
#endif
   return "\"" + findFirstMatchingFont(fontList, "sans-serif") + "\"";
}