void TextEditorPlugin::updateSearchResultsFont(const FontSettings &settings)
{
    if (auto window = SearchResultWindow::instance()) {
        window->setTextEditorFont(QFont(settings.family(), settings.fontSize() * settings.fontZoom() / 100),
                                  settings.formatFor(C_TEXT).foreground(),
                                  settings.formatFor(C_TEXT).background(),
                                  settings.formatFor(C_SEARCH_RESULT).foreground(),
                                  settings.formatFor(C_SEARCH_RESULT).background());
    }
}
void UnifiedDiffEditorWidget::setFontSettings(const FontSettings &fontSettings)
{
    baseTextDocument()->setFontSettings(fontSettings);

    m_fileLineFormat  = fontSettings.toTextCharFormat(C_DIFF_FILE_LINE);
    m_chunkLineFormat = fontSettings.toTextCharFormat(C_DIFF_CONTEXT_LINE);
    m_leftLineFormat  = fontSettings.toTextCharFormat(C_DIFF_SOURCE_LINE);
    m_leftCharFormat  = fontSettings.toTextCharFormat(C_DIFF_SOURCE_CHAR);
    m_rightLineFormat = fontSettings.toTextCharFormat(C_DIFF_DEST_LINE);
    m_rightCharFormat = fontSettings.toTextCharFormat(C_DIFF_DEST_CHAR);

    update();
}
void PlainTextEditorWidget::setFontSettings(const FontSettings &fs)
{
    BaseTextEditorWidget::setFontSettings(fs);

    if (baseTextDocument()->syntaxHighlighter()) {
        Highlighter *highlighter =
            static_cast<Highlighter *>(baseTextDocument()->syntaxHighlighter());

        highlighter->configureFormat(Highlighter::VisualWhitespace, fs.toTextCharFormat(C_VISUAL_WHITESPACE));
        highlighter->configureFormat(Highlighter::Keyword, fs.toTextCharFormat(C_KEYWORD));
        highlighter->configureFormat(Highlighter::DataType, fs.toTextCharFormat(C_TYPE));
        highlighter->configureFormat(Highlighter::Comment, fs.toTextCharFormat(C_COMMENT));
        // Using C_NUMBER for all kinds of numbers.
        highlighter->configureFormat(Highlighter::Decimal, fs.toTextCharFormat(C_NUMBER));
        highlighter->configureFormat(Highlighter::BaseN, fs.toTextCharFormat(C_NUMBER));
        highlighter->configureFormat(Highlighter::Float, fs.toTextCharFormat(C_NUMBER));
        // Using C_STRING for strings and chars.
        highlighter->configureFormat(Highlighter::Char, fs.toTextCharFormat(C_STRING));
        highlighter->configureFormat(Highlighter::String, fs.toTextCharFormat(C_STRING));

        highlighter->rehighlight();
    }
}