In a previous blog article, I described how the Autodesk DWF Viewer and Autodesk Design Review will leverage the Microsoft ClearType technology if the text in the DWF file is actually stored as text. This evoked some questions. This posting is a follow up that demonstrates when text is stored as text.
For the purposes of this posting, I created a DWG that contained nothing but the letter "S." I then published a set of DWF files - changing some of the settings in my DWF6 ePlot pc3 file as I went. I used AutoCAD 2007 for this purpose. AutoCAD allows a user to capture: none, some, all, or all as geometry when working with fonts and creating DWF files.
If the letter "S" is inserted in the DWG using an SHX font, then the resulting DWF looks like:
(Text 2147475229,2261 S)
P 8 2147475229,2261 2147476498,992
In this case, the letter "S" is stored using a polyline as indicated by the "P" command. The polyline is visible because it appears after the visibility on ("V") attribute. Since the letter is represented using a polyline, it is not possible to perform a text search on this DWF file and find the letter "S" even though the letter appears in the parent DWG. To make it possible for Search Engines to find text in DWF files where text is specified using an SHX font, an invisible text string is also inserted into the DWF file. This is depicted as the "Text" item with an "S" that appears after the visibility off ("v") attribute. The invisible text has no impact on how the DWF file appears in the viewer, but it does allow the letter "S" to be found in the DWF file. Text in an SHX font is always represented as geometry regardless of what is set (e.g. Capture none) in the DWF6 ePlot pc3 file.
If the letter "S" is inserted in the DWG using the Arial font (a True Type font), and the "Capture none" or "Capture some" option is specified in the DWF6 ePlot pc3 file, then the resulting DWF looks like:
(FontExtension 'Arial' 'Arial')
(Font (Charset ANSI) (Family swiss)
(Height 10636) (Rotation 65535))
(Text 2147474751,862 S)
In this case, the Arial font is set as an attribute. The letter "S" is then specified using the Text primitive. Since Arial is one of the True Type fonts assumed to be on a DWF user's system, the font is NOT embedded in the DWF file when "Capture some" is specified. "When "Capture none" is specified, all True Type text is captured in the DWF file using the Text primitive, and all of the fonts are assumed to already be on the system viewing the DWF.
If the letter "S" is inserted in the DWG using the Georgia font (another True Type font), and the "Capture all" option is used, then the resulting DWF looks like:
(FontExtension 'Georgia' 'Georgia')
(Font (Name Georgia) (Charset ANSI)
(Height 10836) (Rotation 65535))
(Text 2147474732,928 S)
In this case, the letter "S" is handled similar to how it was in the "Capture some" case. The Text primitive is used to store the letter "S"; however, in addition, the sheet descriptor, which is like an XML table of contents for a sheet, also contains a reference to a font file that appears inside the DWF file.
<ePlot:FontResource role="font" mime="application/x-font" href="com.autodesk.dwf.ePlot_M_YZ+0FGokeDWbC7oEYfmA\NvYZ+0FGokeDWbC7oEYfmA.ef_" title="emb30B.tmp" size="8957" objectId="NvYZ+0FGokeDWbC7oEYfmA" request="268435461" privilege="installable" characterCode="unicode" logfontName="Georgia" canonicalName="Georgia" />
For this particular DWF, only the font data necessary to draw the letter "S" is stored in the DWF file. The other characters that make up the Georgia font are not stored. The tmp file inside the DWF file contains the actual subset of the Georgia font. Recall that a DWF file is actually like a ZIP file that contains other files. (Note: AutoCAD 2007 did not embed the Arial font even with Capture all.)
If the letter "S" is inserted in the DWG using the Arial font, and the "Capture all As geometry" option is used, then the resulting DWF looks like:
(Text 2147474751,862 S)
(Contour 1 591 2147475229,3308
...(a list of 587 other points)...
In this case an invisible "S" is stored to aid Search Engines. The visible ("V") letter "S" is represented using a Contour set primitive. This approach makes the DWF file larger but eliminates the need for the DWF user to have the Arial font on his system.
You can see how each of these options has an effect on what is stored in the DWF. Now let's talk about how the letters get displayed. There are two possible ways:
- Graphics primitives are drawn by the Autodesk graphics system (also known as Heidi).
- Text is drawn by the Windows Operating System.
ClearType is only applied by Windows when drawing text. Hence for our example DWF:
DWF File as
|SHX||Capture all (As geometry)||polyline||Heidi||NO|
|True Type||Capture none||text||Windows||YES|
|True Type||Capture some||text||Windows||YES|
|True Type||Capture all||text||Windows||YES|
|True Type||Capture all (As geometry)||contour set||Heidi||NO|
Hopefully this posting takes some of the mystery out of when ClearType applies to text in your DWF files and when it does not.