QTextDocument seems to use the widget palette (or application
palette) when drawing text. That is, by default the palette's
foreground color is used when no special QTextCharFormat is
specified.
This patch changes applyFormat() such that the foreground color
is always set to avoid the fallback to the QPalette's foreground
color.
BUG: 406821
BUG: 406816
FIXED-IN: 5.59