| 239 | } |
| 240 | |
| 241 | void MainAdaptix::ApplyApplicationFont() const |
| 242 | { |
| 243 | if (!qlementineStyle) |
| 244 | return; |
| 245 | |
| 246 | QString appFontFamily = settings->data.FontFamily; |
| 247 | if (appFontFamily.contains(" - ")) |
| 248 | appFontFamily = appFontFamily.split("-")[1].trimmed(); |
| 249 | |
| 250 | appFontFamily = FontManager::instance().resolveFamily(appFontFamily); |
| 251 | |
| 252 | QFont testFont(appFontFamily); |
| 253 | QFontInfo testInfo(testFont); |
| 254 | if (testInfo.family() != appFontFamily && !testInfo.family().startsWith(appFontFamily)) { |
| 255 | appFontFamily = FontManager::instance().resolveFamily("JetBrains Mono"); |
| 256 | } |
| 257 | |
| 258 | int appFontSize = settings->data.FontSize; |
| 259 | |
| 260 | auto theme = qlementineStyle->theme(); |
| 261 | |
| 262 | theme.fontRegular.setFamily(appFontFamily); |
| 263 | theme.fontRegular.setPointSize(appFontSize); |
| 264 | |
| 265 | theme.fontBold.setFamily(appFontFamily); |
| 266 | theme.fontBold.setPointSize(appFontSize); |
| 267 | |
| 268 | theme.fontH1.setFamily(appFontFamily); |
| 269 | theme.fontH2.setFamily(appFontFamily); |
| 270 | theme.fontH3.setFamily(appFontFamily); |
| 271 | theme.fontH4.setFamily(appFontFamily); |
| 272 | theme.fontH5.setFamily(appFontFamily); |
| 273 | |
| 274 | theme.fontCaption.setFamily(appFontFamily); |
| 275 | |
| 276 | theme.fontMonospace.setFamily(appFontFamily); |
| 277 | theme.fontMonospace.setPointSize(appFontSize); |
| 278 | |
| 279 | qlementineStyle->setTheme(theme); |
| 280 | QApplication::setFont(theme.fontRegular); |
| 281 | } |
no test coverage detected