D13234: Fix bug with broken pdf export of worksheet
noreply at phabricator.kde.org
Thu May 31 15:49:02 UTC 2018
asemke added a comment.
The fix is ok in general. Though, I'd prefer to have the already rendered eps-file as a member of LabelEntry object so it is always available and can be directly used for rendering, for printing and for saving without the need to involve the latex render every time again and again.
If I see it correctly, when a project is saved only LatexEntry::latexCode() is saved. Saving the string only requires re-running latex every time the project file is opened. Also, on systems without latex installation we'll fail to show such a project with worksheets having latex entries. It would be better to save the rendered images in the project file - either as base64 encoded image byte array directly in the xml file (similar to LabPlot's TextLabel https://phabricator.kde.org/source/labplot/browse/master/src/backend/worksheet/TextLabel.cpp;0adab041ea9156243a5bde10f79bc96daeff86d8$691) or as a png or eps file stored in the zip-archive similar to how this is already done in Cantor for rendered plots.
So, we can submit this change now to fix the bug 330834 but I think we should re-factor this a bit later to address the issues mentioned above.
> + bool isEps = spectre_document_is_eps(doc);
> + if (!isEps)
why not to check the URL first with QUrl::isValid() either here or in LatexEntry::updateEntry() where?
> QTextCharFormat format=cursor.charFormat();
> - QUrl url=format.property(EpsRenderer::ImagePath).value<QUrl>();
> + QUrl url=QUrl::fromLocalFile(format.property(EpsRenderer::ImagePath).value<QString>());
> QSizeF s = worksheet()->epsRenderer()->renderToResource(m_textItem->document(), url);
this can be const reference.
To: sirgienko, asemke
Cc: kde-edu, asemke, narvaez, apol
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the kde-edu