* @brief Returns the list of all available monospace fonts. */
| 333 | * @brief Returns the list of all available monospace fonts. |
| 334 | */ |
| 335 | QStringList Console::Handler::availableFonts() const |
| 336 | { |
| 337 | QStringList monospaceFonts; |
| 338 | const auto allFonts = QFontDatabase::families(); |
| 339 | auto defaultFamily = Misc::CommonFonts::instance().monoFont().family(); |
| 340 | for (const auto& family : allFonts) { |
| 341 | QFontInfo fontInfo(family); |
| 342 | if (fontInfo.fixedPitch() && !monospaceFonts.contains(family)) |
| 343 | monospaceFonts.append(family); |
| 344 | } |
| 345 | |
| 346 | monospaceFonts.sort(Qt::CaseInsensitive); |
| 347 | const int idx = monospaceFonts.indexOf(defaultFamily); |
| 348 | if (idx > 0) |
| 349 | monospaceFonts.move(idx, 0); |
| 350 | |
| 351 | return monospaceFonts; |
| 352 | } |
| 353 | |
| 354 | /** |
| 355 | * @brief Returns the character width for the default monospace font. |