• Little idioms and conventions

    From luser droog@21:1/5 to All on Wed Apr 5 10:58:40 2023
    One little convention I've used a lot in PostScript code is to
    use the variables /x /y /X /Y to hold the bounds. This can
    look a little weird if you're used to using /x /y to hold some
    notion of a "current point", but if you're using the `currentpoint`
    for that then that frees up /x /y for this usage.

    0 0 612 792 {Y X y x}{exch def}forall
    /+= {exch 1 index load add store} def
    /margin {dup neg /Y += dup neg /X += dup /y += /x +=} def

    Then you can set text down the page by first subtracting the
    linewidth or leading from Y and then showing a line at x,Y.


    Another convention I've used for small illustrations is to
    follow the model of a glyph in a font. Encapsulate the
    drawing in a procedure which expects the currentpoint
    to be the lower left on entry and leaves the currentpoint
    at the lower right on exit. This makes it easy to place
    several of them in a row.

    [I thought I'd come up with more while typing these 2, but I
    only had these 2 coming in.]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From jdaw1@21:1/5 to luser droog on Tue Jul 4 15:01:33 2023
    On Wednesday, 5 April 2023 at 18:58:54 UTC+1, luser droog wrote:
    One little convention I've used a lot in PostScript code is to
    use the variables /x /y /X /Y to hold the bounds.

    My convention is L R B T for bounds left tight bottom top.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)