Main index Other Papers index About author


The Union Jack in PostScript

Julian D. A. Wiseman

Contents: HTML description of the correct rendering of the Union Jack, The EPS file unionjack.eps.txt, PDF version, /Path-StGeorge, /Path-StAndrew, /Path-StPatrick, /Paint-UnionJack, /Path-UnionJackWhiteSpace, Invoking Paint-UnionJack

Publication history: only here. Usual disclaimer and copyright terms apply.


It is assumed that readers are already familiar with the HTML description of the correct rendering of the Union Jack.

The file unionjack.eps.txt contains the postscript required to draw the Union Jack. If converted to portable document format with the Acrobat Distiller (after removing the ".txt" from the filename), the resulting PDF file contains a 10 inch by 5 inch Union Jack, correctly rendered in shape (but not in colour).

Those using a Macintosh or UNIX system for typesetting, who prefer EPS files to have a preview, should print the PDF file to a preview-containing EPS format. Those typesetting under Windows are wished the best of luck.

The encapsulated postscript contains a number of procedures to draw the various pieces of the flag. The procedure Path-StGeorge renders the bounding path of the cross of St George.

/Path-StGeorge
{
	-30 -15 30 15 setbbox
	30 3 moveto
	3 3 lineto
	3 15 lineto
	-3 15 lineto
	-3 3 lineto
	-30 3 lineto
	-30 -3 lineto
	-3 -3 lineto
	-3 -15 lineto
	3 -15 lineto
	3 -3 lineto
	30 -3 lineto
	closepath
} def

The procedures Path-StAndrew and Path-StPatrick are similar in design, except that the paths drawn by these procedures consist of a number of disjoint pieces.

/Path-StAndrew 
{
	-30 -15 30 15 setbbox
	5 15 moveto
	5 5.854101966249684544613761 lineto
	23.29179606750063091077248 15 lineto
	closepath
	-5 15 moveto
	-5 5.854101966249684544613761 lineto
	-23.29179606750063091077248 15 lineto
	closepath
	5 -15 moveto
	5 -5.854101966249684544613761 lineto
	23.29179606750063091077248 -15 lineto
	closepath
	-5 -15 moveto
	-5 -5.854101966249684544613761 lineto
	-23.29179606750063091077248 -15 lineto
	closepath
	30 5 moveto
	30 11.64589803375031545538624 lineto
	16.70820393249936908922752 5 lineto
	closepath
	-30 5 moveto
	-30 11.64589803375031545538624 lineto
	-16.70820393249936908922752 5 lineto
	closepath
	30 -5 moveto
	30 -11.64589803375031545538624 lineto
	16.70820393249936908922752 -5 lineto
	closepath
	-30 -5 moveto
	-30 -11.64589803375031545538624 lineto
	-16.70820393249936908922752 -5 lineto
	closepath
} def

and

/Path-StPatrick 
{
	-30 -15 30 15 setbbox
	10 5 moveto
	5.527864045000420607181653 5 lineto
	25.52786404500042060718165 15 lineto
	30 15 lineto
	closepath
	-10 -5 moveto
	-5.527864045000420607181653 -5 lineto
	-25.52786404500042060718165 -15 lineto
	-30 -15 lineto
	closepath
	-10 5 moveto
	-14.47213595499957939281835 5 lineto
	-30 12.76393202250021030359083 lineto
	-30 15 lineto
	closepath
	10 -5 moveto
	14.47213595499957939281835 -5 lineto
	30 -12.76393202250021030359083 lineto
	30 -15 lineto
	closepath
} def

The flag itself is painted (in a bounding box llx -30, lly -15, urx +30, ury +15) by the procedure Paint-UnionJack, which fills a rectangle white, and then fills the red and blue pieces. Note that, in the following code, no attempt has been made to render the correct colours.

/Paint-UnionJack
{
	gsave newpath
	1 setgray
	-30 -15 60 30 rectfill
	0.8 0 0 setrgbcolor         % Should be Pantone 186
	Path-StGeorge fill
	Path-StPatrick fill
	0 0 0.4 setrgbcolor         % Should be Pantone 280
	Path-StAndrew fill
	grestore
} def

Though the paths rendered by Path-StGeorge, Path-StAndrew and Path-StPatrick are used for filling, they can also be used for stroking or clipping. Indeed, it might be that a user wishes, for some purpose, to have defined the white space of the Union Jack. This path is rendered by the procedure Path-UnionJackWhiteSpace.

/Path-UnionJackWhiteSpace
{
	-30 -15 30 15 setbbox
	30 3 moveto
	30 5 lineto
	16.70820393249936908922752 5 lineto
	30 11.64589803375031545538624 lineto
	30 15 lineto
	10 5 lineto
	5.527864045000420607181653 5 lineto
	25.52786404500042060718165 15 lineto
	23.29179606750063091077248 15 lineto
	5 5.854101966249684544613761 lineto
	5 15 lineto
	3 15 lineto
	3 3 lineto
	closepath
	-30 -3 moveto
	-30 -5 lineto
	-16.70820393249936908922752 -5 lineto
	-30 -11.64589803375031545538624 lineto
	-30 -15 lineto
	-10 -5 lineto
	-5.527864045000420607181653 -5 lineto
	-25.52786404500042060718165 -15 lineto
	-23.29179606750063091077248 -15 lineto
	-5 -5.854101966249684544613761 lineto
	-5 -15 lineto
	-3 -15 lineto
	-3 -3 lineto
	closepath
	30 -3 moveto
	30 -5 lineto
	16.70820393249936908922752 -5 lineto
	30 -11.64589803375031545538624 lineto
	30 -12.76393202250021030359083 lineto
	14.47213595499957939281835 -5 lineto
	10 -5 lineto
	30 -15 lineto
	23.29179606750063091077248 -15 lineto
	5 -5.854101966249684544613761 lineto
	5 -15 lineto
	3 -15 lineto
	3 -3 lineto
	closepath
	-30 3 moveto
	-30 5 lineto
	-16.70820393249936908922752 5 lineto
	-30 11.64589803375031545538624 lineto
	-30 12.76393202250021030359083 lineto
	-14.47213595499957939281835 5 lineto
	-10 5 lineto
	-30 15 lineto
	-23.29179606750063091077248 15 lineto
	-5 5.854101966249684544613761 lineto
	-5 15 lineto
	-3 15 lineto
	-3 3 lineto
	closepath
} def

The file unionjack.eps.txt also contains an EPS header, and a call to Paint-UnionJack:

/ScalingFactor 12 def
ScalingFactor 30 mul 72 add  ScalingFactor 15 mul 72 add  translate
ScalingFactor dup scale
Paint-UnionJack

to draw a flag ten inches across and five inches high. Further, all the definitions are wrapped within a 6 dict begin … end, and the paths can be used as user paths.


Main index Top About author