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

PortabilityGHC
Stabilityunstable
Maintainerstephen.tetley@gmail.com

Wumpus.Core.GraphicProps

Contents

Description

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.

Synopsis

Stroke attributes

data StrokeAttr Source

Stroke attributes for drawing paths.

data LineCap Source

Line cap - default in output is butt.

Constructors

CapButt 
CapRound 
CapSquare 

data LineJoin Source

Line join - default in output is miter.

Constructors

JoinMiter 
JoinRound 
JoinBevel 

data DashPattern Source

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

Constructors

Solid 
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 on most platforms:

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

See the PostScript Language Reference Manual.

Constructors

FontAttr 

data FontFace Source

FontFace : postscript_name * svg_font_family * svg_font_style

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).

Instances

data LabelProps Source

Font rendering properties for a PrimLabel.

Constructors

LabelProps 

data EllipseProps Source

Ellipses and circles are always closed.

Defaults

default_stroke_attr :: StrokeAttrSource

Default stroke attributes.

defaultFont :: Int -> FontAttrSource

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.