310 likes | 458 Views
Details On The Longhorn Spool File Format. Outline. Metro Packages Reach Package Structure Reach Markup Other Topics. Goals. A better understanding of Metro and Reach Packages A better understanding of the XML markup utilized in Reach Packages Where to find the Metro Specification.
E N D
Outline • Metro Packages • Reach Package Structure • Reach Markup • Other Topics
Goals • A better understanding of Metro and Reach Packages • A better understanding of the XML markup utilized in Reach Packages • Where to find the Metro Specification
What is Metro? Print to printer (Metro spool file) Publish as fixed digital document Metro is a document format. The spool file and a page description language (PDL) are built on it. Word Document (.doc) Consumein driver or directly in printer as a PDL
More on Metro • A Metro package that conforms to the spool file format is called a Reach package • Reach packages are stored in ZIP containers • Reach packages include a fixed payload of XML or binary parts Metro Package Package Relationships Part Payload Generic Metro Package (ZIP container)
Simple Reach Package Composition • Parts are streams that include document content necessary to render the Reach package • Relationships define part dependencies Metro Package Package Relationships Part Fixed Payload Reach Package Document XML Parts Relationship Document Relationships Parts Resource Parts (e.g. Fonts, Images) Relationship
Parts • Parts are defined in streams in the container • Every part has a name and content type (MIME) • Like URIs, part names are hierarchically divided into segments, e.g. /markup/mypart.xml • Content types of parts are defined in a specially-named XML stream • The pack URI scheme addresses parts in a package • Composed as a specially-escaped container URI plus the part name, e.g.: pack://http:,,www.microsoft.com,mypackage.container/mypart.xml • The pack URI above refers to the part /mypart.xml within the container http://www.microsoft.com/mypackage.container
Relationships • Relationships explicitly identify relationships between parts • Parts may internally reference other parts without defining a relationship • Relationships are stored in relationship parts • A relationship part is attached to another part via naming convention • For example, /markup/_rels/mypart.xml.rels is the relationships part for /markup/mypart.xml • A relationship may be associated with the package as a whole
Relationship Markup • Example relationship declaration: <Relationships xmlns="http://schemas.microsoft.com/metro/2005/02/relationships"> <Relationship Target="../tickets/ticket1.xml" ID="A5FFC797514BC" Type="http://schemas.microsoft.com/metro/2005/02/rp/printticket"/> </Relationships> • Target defines the URI of the part referenced • ID uniquely identifies the relationship within the relationships part • Type specifies a namespace-like definition of the purpose of the relationship
Fixed Payload • The fixed payload contains all the parts needed to render the document and some optional parts: • FixedDocumentSequence – Root of the document • FixedDocument – Document XML markup • FixedPage – Page XML markup • Font – Embedded font • Image – Embedded image • Thumbnail – Page thumbnail images • PrintTicket – Printer settings for page/document • Annotations – Document annotations • Some key fixed payload relationships include: • StartPart – Points to the document root • RequiredResource – Image/font needed to render page • PrintTicket – Printer settings
Markup Syntax • Reach markup is XML based on WinFX XAML • Imaging model matches the Avalon display model, which provides screen to print fidelity • Fully compatible with WinFX markup, but does not require WinFX • All markup is specified in well-defined namespaces, primarily: http://schemas.microsoft.com/metro/2005/02/rp • All content is expressed as elements • Comments are allowed • Bare text between elements is not allowed • Content may be specified in element attributes • Markup is rendered with the painter’s model, with an alpha • Reach markup authors may define named resources, which appear in resource dictionaries and contain reusable element declarations
Property Syntax • Properties take 3 forms: • Property Attribute Syntax <SolidColorBrush Color="#FF0000"/> • Property Resource Reference Attribute Syntax <Path Fill="{StaticResource MyFillColor}"/> • Property Element Syntax <Path> <Path.Fill> <SolidColorBrush Color="#FF0000"/> </Path.Fill> … </Path>
Document Markup • Documents are composed of 3 core parts • The FixedDocumentSequence part is the root of the entire fixed payload and may roll up 1 or more FixedDocuments <FixedDocumentSequence xmlns="http://schemas.microsoft.com/metro/2005/02/rp"> <DocumentReference Source="/doc1/FixedDoc1.xml"/> <DocumentReference Source="/doc2/FixedDoc2.xml"/> </FixedDocumentSequence> • Each FixedDocument part is the root of an individual set of 1 or more FixedPages <FixedDocument xmlns="http://schemas.microsoft.com/metro/2005/02/rp"> <PageContent Source="/doc1/FixedPage1.xml"/> <PageContent Source="/doc1/FixedPage2.xml"/> </FixedDocument> • The FixedPage part contains all the markup necessary to render a single page
Page Markup • The FixedPage markup is expressed with 3 core elements: • The Canvaselement is used to group content • The Pathelement is used to render vectors or images • The Glyphs element is used to render text <FixedPage Height="1056" Width="816" xml:lang="en-US" xmlns="http://schemas.microsoft.com/metro/2005/02/rp"> <Canvas> <Path Fill="#0000FF" Data="M 10,10 L 125,10 L 125,50 L 10,50 Z" /> <Glyphs OriginX="25" OriginY="35" Fill="#FFFFFF" FontUri="/fonts/Times.TTF" FontRenderingEmSize="16" UnicodeString="This is page 1."/> </Canvas> </FixedPage>
Graphics • Vector graphics are specified in markup by use of the Path element • The Path element is defined by certain key properties: • Data – Geometric area the graphic occupies • Fill – Brush used to fill the geometry • Stroke – Brush used to fill the geometry’s edges • Opacity – Transparency (alpha) of the graphic • Clip – Clipping geometry to apply to the graphic • RenderTransform – Affine matrix transformation to apply • Some properties have both child property elements and an abbreviated syntax for simple attributes
Geometries • Geometries are defined by 3 elements: • PathGeometry – Simplest geometry definition • CombinedGeometry – Boolean geometry combination element • GeometryGroup – Aggregates multiple geometries into one • An individual geometry contains PathFigure elements, which are built as a sequence of line and curve segments: • StartSegment • CloseSegment • ArcSegment • BezierSegment • LineSegment • QuadraticBezierSegment • PolyBezierSegment • PolyLineSegment • PolyQuadraticBezierSegment
Graphics Example <Path Stroke="#000000" StrokeThickness="2"> <Path.Data> <PathGeometry> <PathFigure> <StartSegment Point="25,75"/> <PolyLineSegment Points="150,75 50,75"/> <PolyLineSegment Points="25,25 150,25 125,75"/> </PathFigure> </PathGeometry> </Path.Data> <Path.Fill> <LinearGradientBrush MappingMode="Absolute" StartPoint="35,0" EndPoint="87.5,0" SpreadMethod="Reflect"> <LinearGradientBrush.GradientStops> <GradientStop Color="#385970" Offset="0.0"/> <GradientStop Color="#5E91E4" Offset="1.0"/> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Path.Fill> </Path>
Brushes • Brushes are used to paint the interior and strokes of Path elements and the character shapes rendered by Glyphs elements • Reach packages include 5 brushes: • SolidColorBrush – Fills with a solid color • ImageBrush – Fills with a specified raster image • VisualBrush – Fills with vector graphics or text • LinearGradientBrush – Fills with a linear gradient • RadialGradientBrush – Fills with a radial gradient
Text • The Glyphs element specifies all text in a Reach package • The Glyphs element relies on a font part embedded, obfuscated, and optionally subsetted in the package • A few core Glyphs properties include: • FontUri – Font part used • OriginX, OriginY – Position of the baseline origin • FontRenderingEmSize – Size to render the glyphs • UnicodeString – Contains the text to be rendered • StyleSimulations – Simulates bold or italic treatments • Fill – Brush used to fill the glyphs • Indices – Specifies complex codepoint to glyph mappings, advance widths, and glyph offsets • The Glyphs element may also specify a device font ID to enable device fonts
Text Markup Example <Glyphs Fill="#000000" OriginX=“10" OriginY="40" Indices=";;;;;(2:1)191" UnicodeString="Open file" FontUri="/fonts/Times.ttf" FontRenderingEmSize="50"> </Glyphs>
Other Topics – Print Tickets • The PrintTicket part specifies user intent and device configuration information to printing consumers • Example settings: • JobDuplex • DocumentStaple • PageOrientation • PrintTickets have a hierarchy of settings associated with the fixed payload document elements: • Job Settings FixedDocumentSequence • Document Settings FixedDocument • Page Settings FixedPage • Exactly 1 PrintTicket part may be attached to each fixed payload document part • PrintTicket settings are inherited down the document hierarchy
Other Topics – Streaming Consumption • Authors may write Reach packages in an interleaved fashion • If interleaved, the following rules apply: • The content of each part may be broken into multiple pieces that may be interleaved with pieces of other parts • Content type must be placed before the part it describes • Relationship part must appear before the part it is attached to • Consumers may discard certain parts (e.g. FixedPage) after it has been fully processed • In Reach packages, authors may interleave DiscardControl parts to explicitly instruct consumers when named parts may be discarded
Color • Actively working on an end-to-end robust color solution • Our goal is to support: • sRGB color • scRGB color • CMYK color • N-Channel color • Named colors • Vector markup • Raster file formats • Details are not yet available in the Metro Specification
Call To Action • Review the Metro v.7 specification • http://www.microsoft.com/whdc/device/print/metro.mspx • Start implementation with Beta 1! • Understand Windows codenamed “Longhorn” Print Architecture • Identify strategic devices to target the Metro Print Path • Identify extension scenarios • Understand the Windows Color System • Convert GDI/DDI based drivers to MetroDrv drivers • Explore the sample filters in Longhorn Beta 2 WDK • Consider on-device rendering with a RIP implementation • A reference implementation is planned for Longhorn Beta 2 tools
Additional Resources • Community Sites • http://www.microsoft.com/communities/default.mspx • MSDN Developer Community Chats: • Printer Drivers -- Ask the Experts Online http://msdn.microsoft.com/chats/windows/windows_102402.asp • Windows Drivers: Printer Drivers http://msdn.microsoft.com/chats/windows/windows_101602.asp • Windows Drivers Printing and Networking http://msdn.microsoft.com/chats/windows/windows_022002.asp • Web resources • WS-Devices Profile: http://msdn.microsoft.com/webservices/understanding/specs/default.aspx?pull=/library/en-us/dnglobspec/html/devprof.asp • Printer Working Group http://www.pwg.org • WHDC Printing home page: http://www.microsoft.com/whdc/device/print/default.mspx • WHDC Still Imaging / WIA home page: http://www.microsoft.com/whdc/device/stillimage/default.mspx • Color Use Caseshttp://www.microsoft.com/whdc/device/display/color/WCS_cases.mspx • “Writing Effective Use Cases”, Alistair Cockburn, ISBN 0201702258
Additional Resources • E-mail • For developer print questions: prninfo @ microsoft.com • For developer scan questions: wiainfo @ microsoft.com • For developer color questions: mscolor @ microsoft.com • Developer kit references: • SDK for Print Schema User Manual and Keywords: http://winfx.msdn.microsoft.com/library/en-us/printschema/PrintSchema/Overviews/PrintSchema_entry.asp • WDK for PT/PC interfaces: Reference\Printer Driver and Spooler Component Interfaces\Printer Driver Functions and Structures\Unidrv and Pscript Interfaces\Methods for JobTicket Providers and Consumers • WinFX Print System Object • Documentation available in WinFX Beta 1 SDK
© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.