question: public static String makeMarginTransform ( double owidth , double oheight , double iwidth , double iheight , double lmargin , double tmargin , double rmargin , double bmargin ) { double swidth = iwidth + lmargin + rmargin ; double sheight = iheight + tmargin + bmargin ; double scale = Math . max ( swidth / owidth , sheight / oheight ) ; double offx = ( scale * owidth - swidth ) * .5 + lmargin ; double offy = ( scale * oheight - sheight ) * .5 + tmargin ; return "scale(" + fmt ( 1 / scale ) + ") translate(" + fmt ( offx ) + " " + fmt ( offy ) + ")" ; }
target:  Make a transform string to add margins