Nobody? > On 4 Apr 2020, at 22:58, Gerben Wierda <gerben.wie...@rna.nl> wrote: > > I have this METAPOST macro: > > vardef makeTeXLabel( expr w, h, name) = > if debugProgram or debugLabels: show "NAME makeTeXLabel:", name, tostring > 0.8w, tostring 0.8h; fi > save p; picture p; > p := textext( "\startframedtext[middle]" & > "[align=middle,frame=on" & > ",width=" & tostring 0.8w & "bp" & > ",height=" & tostring 0.8h & "bp]" & > name & "\stopframedtext"); > save b; path b; b := boundingbox p; > save dim; pair dim; > dim := (urcorner b) - (llcorner b); > save width, height; numeric width, height; > width := xpart dim; > height = ypart dim; > if debugLabels: show "PLACE:", w, h, width, height; fi > if (width > 0.8w) or (height > 0.8h): > if (width > height): > if debugLabels: show "XSCALING:", (0.8w/width,0.8w/width); fi > p:= p xyscaled (0.8w/width,0.8w/width); > else: > if debugLabels: show "YSCALING:", (0.8h/height,0.8h/height); fi > p:= p xyscaled (0.8h/height,0.8h/height); > fi > fi > p > enddef; > > It gets called with w=133 and h=53 (I am working in METAPOST native units, so > bp) > > So, the textext() command gets something like 106bp x 42bp, which seems to be > the case: > > metapost log > >> "NAME makeTeXLabel:" > metapost log > >> "My 'Application' Function" > metapost log > >> "106.40000000000001" > cld > tex > w : - : \MPLIBsetNtextX{1}{\startframedtext > [middle][align=middle,frame=on,width=106.40000000000001bp,height=42.400000000000006bp]My > 'Application' Function\stopframedtext } > cld > tex > F : - : \startblankhandling > cld > tex > w : - : \setblankcategory{6} > cld > tex > F : - : \flushblankhandling > cld > tex > F : - : \stopblankhandling > metapost log > >> "42.400000000000006" > metapost log > >> "PLACE:" > metapost log > >> 133 > metapost log > >> 53 > metapost log > >> 511.08659908200002 > metapost log > >> 42.399990514000002 > > But the bounding box is 511bp wide (something like 7in or 18cm, probably > textwidth) but I’m asking for a box that is 106bp wide. > > What happens here? And how do I get it right? > > G > > > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___________________________________________________________________________________
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________