GNU TeXmacsUser manualReferenceAboutEnglish
The renderer interface

1.Introduction

All graphical output of TeXmacs goes through one abstract class, renderer_rep, declared in

Graphics/Renderer/renderer.hpp

. A renderer is a drawing surface: the screen (or rather a backing store of a window), an off-screen pixmap, an image in memory, a PostScript file or a PDF file. The typesetter produces a tree of boxes; every box knows how to paint itself on an arbitrary renderer, and it never needs to know which concrete device it is painting on. The same box_rep::redraw code is used for repainting a window, for printing, for exporting a document to PDF and for rasterizing a snippet into a png file.

The abstract class provides three things:

The type renderer is simply a plain pointer typedef renderer_rep* renderer; renderers are not reference counted. They are created with tm_new and destroyed with tm_delete or delete_renderer. For printers, destroying the renderer is what finishes and writes the output file.

The relevant source files are:

Graphics/Renderer/

The abstract class (

renderer.hpp

,

renderer.cpp

), the common base class of the screen renderers (

basic_renderer.hpp

,

basic_renderer.cpp

), the PostScript renderer (

printer.hpp

,

printer.cpp

), pencils (

pencil.hpp

), brushes (

brush.hpp

) and paper sizes (

page_type.hpp

).

Graphics/Pictures/

The picture abstraction (

picture.hpp

), portable raster pictures (

raster.hpp

,

raster_picture.hpp

), scalable images (

scalable.hpp

) and graphical effects (

effect.hpp

).

Plugins/Qt/

The Qt screen renderer (

qt_renderer.hpp

,

qt_renderer.cpp

) and Qt native pictures (

qt_picture.hpp

,

qt_picture.cpp

). The directory

Plugins/Qt6/

contains a slightly different copy of these files.

Plugins/Pdf/

The PDF renderer based on the PDFHummus library (

pdf_hummus_renderer.hpp

,

pdf_hummus_renderer.cpp

).

Other back-ends

The X11 renderer (

Plugins/X11/x_drawable.hpp

,

x_shadow.cpp

,

x_picture.cpp

), the MuPDF renderers of the SDL and Vue ports and of PDF export (

Plugins/MuPDF/

), the GPU renderer of Vue (

vue_gpu.cpp

), the Cocoa renderer (

ns_renderer.mm

), and the older Cairo renderer (

Plugins/Cairo/

).

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".