latex3 / latex2e

The LaTeX2e kernel
https://www.latex-project.org/
LaTeX Project Public License v1.3c
1.87k stars 262 forks source link

documentation for graphics backend? #362

Open kberry opened 4 years ago

kberry commented 4 years ago

Is there a specification (however informal) of what a LaTeX graphics backend needs to implement? So Martin Ruckert knows what he has to implement for the viewers in his HINT project. drivers.pdf has the implementation of some drivers, but it is not exactly easy to figure out what is being implemented, at least for me. Just thought I'd ask ...

davidcarlisle commented 4 years ago

Other than "do what dvips.def does", not a lot really.

The original drivers.dtx/drivers.pdf is mostly confusing now as back then the drivers were more "interesting" so looking what we did for emtex or textures etc isn't going to help much.

The place to start is the graphics-def collection.

https://github.com/latex3/graphics-def

or the matching place on ctan.

The naming scheme for the top level commands that need to be implemented tried to be more or less coherent

so, for color

For each color model supported you need to define a command such as

\def\color@gray#1#2{...

\def\color@cmyk#1#2{...

and you need to define the low level commands for setting and restoring the colour

\def\set@color{...

\def\reset@color{...

and if you support page background colours then you need

\def\set@page@color{...

For graphics

For each supported filetype (say png) you need

a command that determines the original image dimensions

\def\Gread@png{...

and a command that actually does the image inclusion

\def\Ginclude@png{...

Also define the default file extensions that you can handle:

\def\Gin@extensions{...

For scaling

You need to define a command to insert the specials at each end

\def\Gscale@start{..

\def\Gscale@end{...

and Rotation is similar.

\def\Grot@start{...

\def\Grot@end{...


Frank and I did comment in the Q&A session after the HINT talk at TUG that we could help make this file if there was a spec of what was needed:-)

josephwright commented 4 years ago

Do you mean in terms of macros or in terms of fundamental primitive abilities, possibly as specials?

kberry commented 4 years ago

Thanks for the replies. I will point Martin to this info. Yes, he will surely be in touch when the time comes. Was just editing his paper and this question came up, so thought I'd try to discern what was out there.

Joseph, it is about the graphics primitives he has to implement, so that you-all (presumably) can easily make the .def file for hint so graphics will be supported. I'm guessing pdftex might be the best model rather dvipdfmx/dvips, i.e., not actual specials.

Perhaps the above text, or something along those lines, could be added to the top of drivers.dtx. It's certainly a lot more comprehensible to have an overview like this than just diving into the details of all the implementations.

u-fischer commented 4 years ago

I'm guessing pdftex might be the best model rather dvipdfmx/dvips,

well there is not much difference here. Both write something at the start of the color and at the end. But in the description of the HINT format he wrote that the main problem ist, that a start/stop model doesn't work for him: if the viewer opens a page in the middle of color it doesn't see the color start marker. So he probably needs either colored fonts or attributes to the nodes. This is not a latex or driver problem but at first a problem with the file specification itself.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity.

josephwright commented 10 months ago

I think this one should go to the latex3 repo

github-actions[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity.