pdf: text that names no colour comes out black, not the palette
A QTextDocument takes its default text colour from the application palette, and markdown names no colour at all: in a window running a dark palette -- which is what a phone in dark mode hands Qt -- every plain paragraph was laid out #eeeeee on a white page. Printed, that is a blank document; on screen it reads as "the font is oddly faint". The first PDFs off the phone were exactly that. - PdfTools: paperDocument() sets the default stylesheet (body colour #000000) before setHtml, and writePdf() lays that out. A colour the document does name still wins, so an .html handed to the tool keeps its own -- checked with a #cc0000 document under both palettes. - --uitest: draws that document on a white image under a dark palette and looks for ink (238 before the fix, 0 after). Verified on the NX789J: md_to_pdf on the device now writes CID TrueType NotoSansCJKHK-Regular/-Bold text whose page renders at min=0.
This commit is contained in:
@@ -19,6 +19,9 @@
|
||||
/* The engine wrapper of the front end (core/AgentCore.h). Only a pointer
|
||||
* travels through this header, so the class stays incomplete here. */
|
||||
class AgentCore;
|
||||
/* Same for the document md_to_pdf lays out (PdfTools.cpp): the caller owns
|
||||
* it, and the test in ui/UiTest.cpp inspects how it draws. */
|
||||
class QTextDocument;
|
||||
|
||||
namespace app {
|
||||
|
||||
@@ -48,6 +51,10 @@ int registerPlatformTools(AgentCore *core);
|
||||
* (they are Qt, not a platform API): today md_to_pdf, owned by "app:qt".
|
||||
* Called next to registerPlatformTools(). */
|
||||
int registerQtTools(AgentCore *core);
|
||||
/* The document md_to_pdf lays out from `html`: the page's own defaults
|
||||
* applied (text with no colour of its own is black, not the window's palette
|
||||
* colour). The caller owns the result. */
|
||||
QTextDocument *paperDocument(const QString &html);
|
||||
/* Drop them again (they belong to the owners "app:*"). */
|
||||
void unregisterPlatformTools(AgentCore *core);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user