This part in the Dissecting XPS series will take off were we ended part 3, by looking into how the actual content is marked up.
The content is contained in the FixedPage element and it is marked up by three different elements
- the Path element which specified a geometry filled with a brush
- the Glyphs element which represents text
- the Canvas element which groups elements together
The Path element
1: Path Stroke="#000000" StrokeThickness="10">
3: LinearGradientBrush MappingMode="Absolute" StartPoint="0,0" EndPoint="0,8" SpreadMethod="Reflect">
5: GradientStop Color="#333311" Offset="0.0" />
6: GradientStop Color="#3333FF" Offset="1.0" />
12: PathFigure StartPoint="50,50" IsClosed="true">
13: PolyLineSegment Points="250,50 150,250" />
The Path element syntax contains several advanced features and allows you to create advanced vector graphics including lines, curves, arcs, beziers etc. Read more in the XPS Specification  or at Feng Yuans blog (here an example of radial gradient brushes). If you are familiar with the XAML elements then this will be a piece of cake .
The Glyph element
1: Glyphs Fill="#000000" FontRenderingEmSize="48"
4: UnicodeString="Hello World!"
5: FontUri="../../../Resources/Fonts/arial.ttf" />
The sample above also requires that we have a Font part (the .TTF file), a relationship to the Font part in the FixedPage and that the TTF Content Type is present in the [Content_Types].xml file.
As the Path element the Glyph element is very powerful and allows you to do really advanced typing in any kind of written language. You may also apply any kind of brush to fill the glyphs.
The Canvas element
The Canvas element groups other elements (Paths, Glyphs or other Canvas elements) together to either group the elements into units or to apply properties to each child or ancestor of the unit, for example opacity.
By now you should be able to create your own XPS file using just Notepad and a ZIP program. Up next in the series is some more information on the XPS document properties.
Further reading and references
 XPS Specification Dissecting XPS - part 1 - The basics Dissecting XPS - part 2 - Inside the XPS document Dissecting XPS - part 3 - the Fixed Document The blog of Feng Yuan - master of XPS  WPF/XAML Graphics
Side note: Windows Vista uses XPS as it's internal printer spooling.