Use default QTD font size for mono font when importing markdown
QFontDatabase::systemFont(FixedFont) determines the font for inline code and code blocks in a markdown document. Now we change the size of that font to the same size as QTextDocument::defaultFont() so that the user has the ability to customize the font size in each document instead of only system-wide. Change-Id: Ief7367336f7613e88695dbb08bcb7e9f50db8961 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
8693c07a80
commit
3641606008
@ -160,6 +160,10 @@ void QTextMarkdownImporter::import(QTextDocument *doc, const QString &markdown)
|
|||||||
m_paragraphMargin = m_doc->defaultFont().pointSize() * 2 / 3;
|
m_paragraphMargin = m_doc->defaultFont().pointSize() * 2 / 3;
|
||||||
m_cursor = new QTextCursor(doc);
|
m_cursor = new QTextCursor(doc);
|
||||||
doc->clear();
|
doc->clear();
|
||||||
|
if (doc->defaultFont().pointSize() != -1)
|
||||||
|
m_monoFont.setPointSize(doc->defaultFont().pointSize());
|
||||||
|
else
|
||||||
|
m_monoFont.setPixelSize(doc->defaultFont().pixelSize());
|
||||||
qCDebug(lcMD) << "default font" << doc->defaultFont() << "mono font" << m_monoFont;
|
qCDebug(lcMD) << "default font" << doc->defaultFont() << "mono font" << m_monoFont;
|
||||||
QByteArray md = markdown.toUtf8();
|
QByteArray md = markdown.toUtf8();
|
||||||
md_parse(md.constData(), MD_SIZE(md.size()), &callbacks, this);
|
md_parse(md.constData(), MD_SIZE(md.size()), &callbacks, this);
|
||||||
|
Loading…
Reference in New Issue
Block a user