wumpus-core-0.51.0: Pure Haskell PostScript and SVG generation.





Data types for stroke and label styles corresponding to the styles provided by PostScript / SVG (StrokeAttr, etc.).

Data types for annotating Primitives with their drawing style (PathProps, etc.). Wumpus represents pictures as trees and decorates all elements (paths, text-labels) with their drawing style. This is boardly similar to how SVG handles attributes. For PostScript output, Wumpus renders attribute changes as graphics state updates.


Stroke attributes

data StrokeAttr Source

Stroke attributes for drawing paths.

data LineCap Source

Line cap - default in output is butt.

  Cap Butt:
  Cap Round:
 ( ======= )
  Cap Square:
  | ======= |



data LineJoin Source

Line join - default in output is miter.

  Join Miter:
   /./  \.\
  /./    \.\
 Join Round:
 Join Bevel:
   /./  \.\
  /./    \.\



data DashPattern Source

Dash pattern - either a solid line or a list of on-off pairs together with an offset into the dashes.

 Dash offset [(on,off )..]


Dash Int [(Int, Int)] 

Font attributes

data FontAttr Source

Font face and size. Equivalent fonts have different names in PostScript and SVG. A PostScript font name includes the font style (e.g. Times-BoldItalic) whereas an SVG font has a name (the font-family attribute) and a style.

For PostScript, the following fonts are expected to exist:

 Times-Roman  Times-Italic  Times-Bold  Times-BoldOtalic
 Helvetica  Helvetica-Oblique  Helvetica-Bold  Helvetica-Bold-Oblique
 Courier  Courier-Oblique  Courier-Bold  Courier-Bold-Oblique

See the PostScript Language Reference Manual.



data FontFace Source

FontFace : postscript_name * svg_font_family * svg_font_style * encoding_vector

For the writing fonts in the Core 14 set the definitions are:

 "Times-Roman"       "Times New Roman" SVG_REGULAR     standard_encoding
 "Times-Italic"      "Times New Roman" SVG_ITALIC      standard_encoding
 "Times-Bold"        "Times New Roman" SVG_BOLD        standard_encoding
 "Times-BoldItalic"  "Times New Roman" SVG_BOLD_ITALIC standard_encoding
 "Helvetica"              "Helvetica" SVG_REGULAR      standard_encoding
 "Helvetica-Oblique"      "Helvetica" SVG_OBLIQUE      standard_encoding
 "Helvetica-Bold"         "Helvetica" SVG_BOLD         standard_encoding
 "Helvetica-Bold-Oblique" "Helvetica" SVG_BOLD_OBLIQUE standard_encoding

 "Courier"              "Courier New"    SVG_REGULAR      standard_encoding
 "Courier-Oblique"      "Courier New"    SVG_OBLIQUE      standard_encoding
 "Courier-Bold"         "Courier New"    SVG_BOLD         standard_encoding
 "Courier-Bold-Oblique" "Courier New"    SVG_BOLD_OBLIQUE standard_encoding

data SVGFontStyle Source

SVG font styles - potentially a style may generate both font-weight and font-style attributes in the SVG output.

Drawing styles for Primitives

data PathProps Source

Note when drawn filled and drawn stroked the same polygon will have (slightly) different size:

  • A filled shape fills within the boundary of the shape
  • A stroked shape draws a pen line around the boundary of the shape. The actual size depends on the thickness of the line (stroke width).
 CFill - closed path filled with the colour.
 CStroke - closed path, stroked with the colour.
 OStroke - open path, stroked with the colour.
 CFillStroke - closed path, filled with the first colour, 
 stroked with the stroke attributes and second colour.

data LabelProps Source

Font rendering properties for a PrimLabel.



data EllipseProps Source

Ellipses and circles are always closed.

 EFill - filled ellipse.
 EStroke - stroked ellipse.
 EFillStroke - ellipse filled with the first colour and stroked 
 with the stroke attributes and second colour.


default_stroke_attr :: StrokeAttrSource

Default stroke attributes.

 line_width      = 1
 miter_limit     = 1
 line_cap        = CapButt
 line_join       = JoinMiter
 dash_pattern    = Solid

defaultFont :: Int -> FontAttrSource

defaultFont : font_size -> FontAttr

Constructor for the default font, which is Courier (aliased to Courier New for SVG) at the supplied size.

Note - the font uses the Standard encoding - this is common to fonts but uses different indices to the more common Latin1.

For instance 232 is Lslash not egrave.

Both GhostScript and the standard AFM Core 14 metrics supplied by Adobe use Standard Encoding but include further characters (e.g. egrave) in the non-indexed higher-region.

wumpus_default_font :: FontAttrSource

Constant for the default font (Courier) at 14 point.