@JosephWright As for the bounding box setting command for l3draw, it seems that metapost and PGF have a different approach: metapost has a special command for creating a rectangle explicitly while PGF seems to provide use as bounding box as option similary to clip, draw, fill etc. While the former is a more straight-forward approach in my opinion (a bounding box is a rectangle), the latter is interesting as you can create a bounding box around whatever path ...
@JosephWright Yes, I think using a path is nice. In the end, the bounding box is always created fitting a path, right? So ... maybe a hybrid solution might be a good idea
@JosephWright Currently you can use \l_draw_bb_update_bool to switch on and off whether the following path will update the box, right? That's about it ...
Well, I leave it to you as I am not that much into the question which programming level you are using (and I don't even know that well which drawing commands would belong to which level) =)
@mickep Oh, so there is a similar command as well. I thought that I found another command that sets the corners of a rectangle or so, maybe I am mistaken
@mickep You are right! I am wrong. I was refering to setbounds ⟨picture variable⟩ to ⟨path expression⟩.
@mickep, @JasperHabicht Something like \draw_path_set_bb:? 'Sets the bounding box of the drawing to contain the path, ignoring any existing content and discarding the path'
@JosephWright Yes, I also thought of such an implementation. It should not draw the path. \draw_path_set_bb: or \draw_path_bb_set: (because \l_draw_bb_update_bool)?
@mickep No, the \draw_ part is the name of the module
@JosephWright Right, it should ignore previously drawn paths, but of course later drawn paths would again affect the bbox ...
I think others should probably also give their input =D Maybe David, since he has a golden TikZ badge ...
@JasperHabicht Broadly, yes: I followed pgf, which nicely divides up stuff - if you look at the sources, you'll see for example that \draw_path_... all come from one file
@JosephWright I see. Yes, that's a good idea. So, it starts ffrom the bigger concept. Then, it should start with \draw_bb_... and maybe from_path is not bad. or use_path? But use means: put into output stream / typeset, so might be not a good choice.
@JasperHabicht Just took a look at pgf: I think the docs could be tightened up there :) They have effectively \draw_path_use:n { bb } - feels slightly odd to me as it's not really using the path in that sense at all
@JasperHabicht OK, for the present I think I'll go with \draw_bb_from_path:n - this module remember is experimental, so it could all change - implementation a bit later today, but within the l3draw-path source as it's 'path-like' and comes from the pgf path 'area'
@JosephWright but can be computationally hard if the path is a curve hence sometimes nice to give it a rectanglem as it has to be a rectangle in the end.
In expl3, literate programming would suggest I should favor \g_teepeemm_fooinbar_bool instead of the scratch \g_tmpa_bool % is foo in bar?. Using the scratch would save a single definition, but my memory is more of a problem than the computer's memory. Are there considerations that would make me want to lean toward using the global scratch variables?
@Teepeemm scratch macros \@tempa were designed to save a few dozen csnames in latex2.09 and 2e, when the csname hash table was almost always nearly full. But now, by the time you've loaded expl3 and unicode-math and tikz and ... worrying about one extra csname probably is not worth the worry:-)
@mickep not that that would absolve you of blame, but I guess I'd better check....
@UlrikeFischer well you need a more complicated example as the italic correction is used or not used so to show 4 diffeent outcomes you need an example with potentially two italic corrections
@JasperHabicht (@mickep) I've been reading over he pgf code, and I think the way it does relevant for bounding box is basically just what I've provided as \l_draw_bb_update_bool, i.e. you just draw your path then set that false
pgf makes it 'internal' but as l3draw is more 'programmatic' I think on reflection it's OK as it is
@JosephWright Well the point is that if you use TikZ's \path(without draw or fill), it will still affect the bounding box. But if you use \draw_path_use(_clear):n { }, it does not affect the bounding box. So, with the l3draw package, it is currently not possible to "use" a path to affect the bounding box.
@JosephWright Hm, I did not check this. So, \path(without draw) won't take into account previously set line width is what you mean? Or maybe I can't follow
@JasperHabicht Well you could use it after - feels a bit odd as \draw_path_use:n already sets the bb, and you could simply turn off updating before that ... but up to yu
@JasperHabicht \draw_path_use:n always involves the path data ending up in the output: stroke or fill or a clip path - the bb is something that only exists at the macro/box level, it's not a path construct in that sense