FoscPostscript

Returns a FoscPostscript.


Description

Postscript commands


Attributes Summary

Instance Methods: Special Methods

++ (abjad: add)
illustrate
format
show
str Gets string representation of Postscript.

Instance Methods

asMarkup
arc (not in abjad)
charpath
closepath
curveto
fill
findfont
grestore
gsave
lineto
moveto
newpath
rcurveto
rlineto
rmoveto
rotate
scale
scalefont
setdash
setfont
setgray
setlinewidth
setrgbcolor
show • TODO: solve naming conflict with FoscObject::show
stroke
translate


Usage

  1. Example

    p = FoscPostscript();
    p.newpath();
    p.moveto(0, 0);
    p.rlineto(0, -10);
    p.rlineto(10, 0);
    p.rlineto(0, 10);
    p.rlineto(-10, 0);
    p.closepath();
    p.gsave();
    p.setrgbcolor(0.5, 1, 0.5);
    p.fill();
    p.grestore();
    p.setrgbcolor(1, 0, 0);
    p.setlinewidth(1);
    p.stroke();
    p.format;
    
    newpath
    0 0 moveto
    0 -10 rlineto
    10 0 rlineto
    0 10 rlineto
    -10 0 rlineto
    closepath
    gsave
    0.5 1 0.5 setrgbcolor
    fill
    grestore
    1 0 0 setrgbcolor
    1 setlinewidth
    stroke
    p.show;


Instance Methods: Special Methods


++

(abjad: add)

  1. Example

    p = FoscPostscript();
    p.newpath();
    p.moveto(0, 0);
    p.rlineto(0, -10);
    p.stroke();
    
    q = FoscPostscript();
    q.newpath();
    q.moveto(0, 10);
    q.rlineto(10, -20);
    q.stroke();
    
    (p ++ q).show;


illustrate

  1. Example

    p = FoscPostscript();
    p.moveto(1.0, 1.0);
    p.setlinewidth(2.5);
    p.lineto(3, -4);
    p.stroke;
    
    f = p.illustrate;
    f.format;
    \version "2.22.0"
    \language "english"
    
    \markup {
        \postscript
            #"
            1.0 1.0 moveto
            2.5 setlinewidth
            3 -4 lineto
            stroke
            "
    }


format

  1. Example

    p = FoscPostscript();
    p.moveto(1.0, 1.0);
    p.setlinewidth(2.5);
    p.lineto(3, -4);
    p.stroke;
    
    p.format;
    
    1.0 1.0 moveto
    2.5 setlinewidth
    3 -4 lineto
    stroke


show

  1. Example

    p = FoscPostscript();
    p.moveto(1.0, 1.0);
    p.setlinewidth(2.5);
    p.lineto(3, -4);
    p.stroke;
    
    p.show;


str

Gets string representation of Postscript.

Return string.

  1. Example

    p = FoscPostscript();
    p.moveto(1.0, 1.0);
    p.setlinewidth(2.5);
    p.lineto(3, -4);
    p.stroke;
    
    p.str;
    
    1.0 1.0 moveto
    2.5 setlinewidth
    3 -4 lineto
    stroke


Instance Methods


asMarkup


arc

(not in abjad)

  1. Example

    p = FoscPostscript();
    p.moveto(30, -20);
    p.arc(20, -20, 10, 0, 360);
    p.stroke;
    
    p.show;


charpath


closepath

  1. Example

    p = FoscPostscript();
    p.closepath;
    p.format;
    
    closepath


curveto

  1. Example

    p = FoscPostscript();
    p.curveto(10, -10, 20, -30, 30, 0);
    p.stroke;
    
    p.show;


fill

  1. Example

    p = FoscPostscript();
    p.fill;
    p.format;
    
    fill


findfont

  1. Example

    p = FoscPostscript();
    p.findfont('Times Roman');
    p.format;
    
    /Times-Roman findfont


grestore

  1. Example

    p = FoscPostscript();
    p.grestore;
    p.format;
    
    grestore


gsave

  1. Example

    p = FoscPostscript();
    p.gsave;
    p.format;
    
    gsave


lineto

  1. Example

    p = FoscPostscript();
    p.lineto(3.0, -4.0);
    p.stroke;
    
    p.show;


moveto

  1. Example

    p = FoscPostscript();
    p.moveto(3.0, -4.0);
    p.format;
    
    3.0 -4.0 moveto


newpath

  1. Example

    p = FoscPostscript();
    p.newpath;
    p.format;
    
    newpath


rcurveto

  1. Example

    p = FoscPostscript();
    p.rcurveto(0, 1, 1.5, 2, 3, 6);
    p.stroke;
    
    p.show;


rlineto

  1. Example

    p = FoscPostscript();
    p.rlineto(1.2, 2.0);
    p.stroke;
    
    p.show;


rmoveto

  1. Example

    p = FoscPostscript();
    p.rmoveto(1.2, 2.0);
    p.stroke;
    
    p.format;
    
    1.2 2.0 rmoveto
    stroke


rotate

  1. Example

    p = FoscPostscript();
    p.rotate(45);
    p.format;
    
    45 rotate


scale

  1. Example

    p = FoscPostscript();
    p.scale(2, 1);
    p.format;
    
    2 1 scale


scalefont

  1. Example

    p = FoscPostscript();
    p.scalefont(12);
    p.format;
    
    12 scalefont


setdash

  1. Example

    p = FoscPostscript();
    p.setdash([2, 1], 3);
    p.format;
    
    [ 2 1 ] 3 setdash
  2. Example

    p = FoscPostscript();
    p.setdash([2, 1]);
    p.format;
    
    [ 2 1 ] 0 setdash


setfont

  1. Example

    p = FoscPostscript();
    p.setfont;
    p.format;
    
    setfont


setgray

  1. Example

    p = FoscPostscript();
    p.setgray(0.75);
    p.format;
    
    0.75 setgray


setlinewidth

  1. Example

    p = FoscPostscript();
    p.setlinewidth(12.2);
    p.format;
    
    12.2 setlinewidth


setrgbcolor

  1. Example

    p = FoscPostscript();
    p.setrgbcolor(0.75, 1, 0.2);
    p.format;
    
    0.75 1 0.2 setrgbcolor


show

• TODO: solve naming conflict with FoscObject::show

  1. Example

    p = FoscPostscript();
    p.show("This is text.");
    p.format;
    
    (This is text.) show


stroke

  1. Example

    p = FoscPostscript();
    p.stroke;
    p.format;
    
    stroke


translate

  1. Example

    p = FoscPostscript();
    p.translate(100, 300);
    p.format;
    
    100 300 translate