Many recent blog postings have covered the topic of DWF files and fonts:
Avoiding AutoCAD DWF font woes enumerated the DWF6 ePlot pc3 options available for embedding fonts in a DWF file published from AutoCAD.
Avoiding Inventor DWF font woes enumerated a list of TrueType fonts that when used in Autodesk Inventor, could be substituted for by the Autodesk DWF Viewer or Autodesk Design Review, if the font is not present on the system.
When does ClearType apply to my DWF? documented when the Autodesk DWF Viewer and Autodesk Design Review leverage the Microsoft ClearType technology. This depends on how the text is displayed. Text display is related to font embedding where fonts can be captured as geometry.
DWF display obeys ClearType setting presented how to enable the Microsoft ClearType technology.
Embedding Fonts in a DWF using C++ presented developer information on how to store fonts in a DWF file using a C++ program.
This posting is a follow up to "Embedding Fonts in DWF using C++" and is intended for DWF Toolkit programmers; however, it may be of general interest to the non-C++ programmer, since this post is not very technical. The basic anatomy of a DWF file is covered.
In the "When does ClearType apply to my DWF?" posting, I created a DWG that contained only the letter "S." One of the cases I presented was where the "S" appeared using the Georgia TrueType font, and the option to embed the font in the DWF was enabled.
A DWF file is actually a zip file. One can rename a DWF file from its .dwf extension to .zip and view the contents using utilities like PKZIP or Windows tools for compressed folders.
Inside the DWF, you will see XML, 2D streams, 3D streams, image files, etc. In the case of the DWF file used in the ClearType posting, one will find:
There are several files of interest inside the DWF file:
manifest.xml: This is the XML table of contents for the DWF file. It contains a list of sections (think sheets) and the resources for those sections. The entry <dwf:Resource role="font" mime="application/x-font" href="com.autodesk.dwf.ePlot_jEct1U0CkU+JuKUfQNQP_w\
j0ct1U0CkU+JuKUfQNQP_w.ef_" /> is a reference to the data for the Georgia font. This font file only contains data for the letter "S."
kUct1U0CkUJuKUfQNQP_w.png: This is the PNG file for the thumbnail image.
kEct1U0CkUJuKUfQNQP_w.png: This is the PNG file for the preview image.
descriptor.xml (section): This is the XML description of the section. There is a one to one correspondence between a layout in a DWG and a section in a DWF. In this example, the section descriptor makes a reference to the font file in <ePlot:FontResource role="font" mime="application/x-font" href="com.autodesk.dwf.ePlot_jEct1U0CkU+JuKUfQNQP_w\
j0ct1U0CkU+JuKUfQNQP_w.ef_" title="emb56B.tmp" size="8957" objectId="owlWJf4Exkar_wqJeqHqFg" request="268435461" privilege="installable" characterCode="unicode" logfontName="Georgia" canonicalName="Georgia" />.
jUct1U0CkU+JuKUfQNQP_w.dsd: This is the DSD (Drawing Set Description) file. DSD files are found in DWF files created by AutoCAD. A DSD provides table of contents information for round tripping with AutoCAD. It resembles a Windows INI file. This is what allows AutoCAD to line up the markups made in a DWF using Autodesk Design Review with the original geometry in the source DWG.
j0ct1U0CkU+JuKUfQNQP_w.ef_: This is the embedded font file. The extension is EF_ for embedded font. It is created using an API from Microsoft. The data is in binary form.
jkct1U0CkU+JuKUfQNQP_w.w2d: This is the 2D stream. This file contains the 2D geometry for the section. For this particular DWF file, the geometry for the line around the border is included. The letter S appears as (Text 2147474732,928 S). The embedded font is referenced as (Font (Name Georgia) (Charset ANSI) (Height 10836) (Rotation 65535)). The image above was taken after converting the 2D binary stream to ASCII.
Although vector data with precision to allow accurate measurements is essential to DWF, words provide context and information about the geometry. Architects and engineers want all of their design information, geometry and text, to look the same in DWF as in the design authoring software. As such, font handling is also a key aspect of DWF.