[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Texmacs-dev] pdf & texmacs
From: |
Massimiliano Gubinelli |
Subject: |
[Texmacs-dev] pdf & texmacs |
Date: |
Thu, 3 Feb 2022 21:20:03 +0100 |
Dear all,
I start to think that TeXmacs should not depend on GUI libraries for handling
PDF or image formats, nor for creating a bitmap representation of a document.
There are several issues in the current way we handle things:
1) We cannot use PDF images in a TeXmacs document in a reliable way (see a
recent comment in the forum with bugs in the import of PDF image).
2) We need a way to rasterize our documents to show them on the screen
(currently we let Qt do it for us)
3) We depend on Qt also for non-ui or non-cross-platform related stuff: this
make it difficult to port TeXmacs to other platforms and moreover make our
document rendering depend on Qt.
4) On webasm I would really like not to depend on Qt at all, and just drop it,
but then I need a way to render our documents anyway.
Considering these problems I start to realize that TeXmacs need to have a pdf
renderer built-in. I have in mind to import in our codebase a library like
poppler, mupdf or pdfium (the library in Google Chrome). This will come with
several advantages:
1) Such libraries come with a sub-library which can render onto a bitmap vector
graphics (because they need to render PDF), so we can also use these libraries
to render TeXmacs documents to a bitmap which then the UI library can put on
screen (and we can use Qt for this or any other library).
2) We will be able to read PDF images.
3) We have already PDF output, so we can share some code, e.g. freetype or
libpng and libjpeg with it. This will allow us to support in a cross-platform
way these basic image formats.
4) we would be able to run TeXmacs without a GUI interface, e.g. to have a
batch program.
I've come across a nice blog post which compare some libraries:
https://hub.alfresco.com/t5/alfresco-content-services-blog/pdf-rendering-engine-performance-and-fidelity-comparison/ba-p/287618
and pdfium (https://pdfium.googlesource.com) and mupdf (https://mupdf.com) are
clear winners.
For example, these are compact enough to be able to be run in webasm (see e.g.
https://mupdf.com/wasm/index.html) with very good results. This is an
indication that speed is very good (even if this is not a bit issue for us).
I'm thinking to try to embed one of these two libraries in TeXmacs and use it
also to render our document on screen. Comments are welcome.
Best regards,
Massimiliano
- [Texmacs-dev] pdf & texmacs,
Massimiliano Gubinelli <=