Printer’s Apprentice 8.0 – Progress Update
September 7th, 2007 by
Bryan Kinkel
Work on Printer’s Apprentice is moving along at a good clip. I just got finished porting another sample sheet from the old code to the new code. The Font Information sheet, pictured below, prints the descriptive information embedded in font files. Some vendors provide the data, other don’t include any at all.
In Printer’s Apprentice 7.5, the layouts for Font Catalogs and Sample Sheets are actually embedded in the source code. Each layout has dozens of lines of set font commands, page coordinates, lines and rectangles.
With Printer’s Apprentice 8.0, we use a different approach. The layouts are stored in XML files. The XML file defines fonts and layout elements. The code then reads the XML data follows the instructions to render a page.
For example, the page might have a font defined as follows.
<font Key="PointSize10" FontName="@font" FontSize="10" FontBold="False" FontItalic="False" />
The @font identifier tells the code to substitute in the name of the current font that will be used.
Then an individual text element looks like this:
<element Key="10ptLine1" Type="Text" FontKey="PointSize10" Text="@sampletext1" x1="0" y1="214" x2="675" y2="214" Align="left" Valign="baseline" />
Again, the @sampletext1 identifier tells the code to use whatever sample text the user has defined in the Options dialog.
It is all quite flexible. Until I have to build a sample sheet that requires a feature not supported by the rendering engine. The data in the Font Information sheet is of a variable length. For example, the font Description text can be anywhere from ten to 300 or more characters. So I had to add support for making sample sheet element positions relative to another.
This element is relative to the DescData element, and offset by 30 units below.
<element Key="CopyrightTrademarkTitle" Type="Text" FontKey="TitleFont9Bold" Text="Copyright & Trademarks"
RelativeToKey="DescData" OffsetX ="0" OffsetY ="30"
x1="0" y1="0" x2="675" y2="0" Align="left" Valign="baseline" />
The long term goal is to document the page description language so users can modify existing sheets or create new ones.
But first we have get the product out the door. Stay tuned for information about beta testing.
– Bryan
Posted in Printer's Apprentice |
2 Comments »