If a QTextDocument is given html content, attempting to change the font family by calling QTextCursor::mergeCharFormat fails consistently in changing the family if the QTextCharFormat passed as an argument has a default QFont and the font family is set by calling QTextCharFormat::setFontFamily.
The issue is fixed by calling QTextCharFormat::setFont before passing it to mergeCharFormat.
Steps to reproduce:
- Run the attached project
- The sample project will attempt to change the font to jokerman
- Monitor the output html => the span containing "Hello world" will have a wrong font family set
- (optional) Pass "-workaround" as an arg to apply workaround for comparison.
Note: This problem does not appear in Qt 5.12.