ruuda / pris

A language for designing slides

Home Page:https://docs.ruuda.nl/pris/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow custom dimensions

tvincent2 opened this issue · comments

Hello,

If I understand correctly, the dimensions of the generated pdf files are currently hard-coded to 1920×1080 (e.g. in pris.rs).
It would be nice to allow the user to set custom dimensions, for instance using command line parameters or, even better, in .pris files themselves.

Thanks a lot for making pris!
Thomas

Yes, the canvas dimensions are currently hard-coded to 1920x1080 pixels. The absolute dimensions are not relevant for screen use (they are for printing), but the aspect ratio is.

I was thinking about exposing a top-level variable like this:

canvas_size = (1080, 1920)

One tricky thing here is that with Cairo all pages in the document have the same size, so only the last write to the variable would be meaningful, but it would still affect what 1w and 1h mean. Perhaps that is not so much of an issue; users should just set the canvas size at the beginning of the document and not change it mid-way. What do you think?

Your idea for canvas_size looks perfect. Just a noob question: Since the absolute dimensions are only relevant for printing, maybe an other unit could be proposed instead of/along pixels?

About the issue of multiple occurrences of canvas_size, that's typically the kind of setting that is declared at the beginning of the document, so I would not expect users to change it. Could it be enforced that the variables appears once at most?

Implemented in abc05bc...72a5c9d. See also the new example.

Just a noob question: Since the absolute dimensions are only relevant for printing, maybe an other unit could be proposed instead of/along pixels?

Yes, that would make sense. For now I am only focusing on screen media though, so canvas_size has no units for now.