Volker Joseph

July 2009

Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

AutoCAD Exchange

DWF Links

« Océ Print Exec Department supports DWF | Main | Measurement Disabled DWF files from Autodesk Inventor R11 DWF Extension (Part 1 of 3) »

July 07, 2006

Determining DWF text attributes in C++

One of our DWF Partner developers sent in the following question:

I am reading a 2D DWF file using DWF (Whip) toolkit. I have a class derived from WT_FileExt and registered various processing actions (including WT_Font and WT_Text). In testing my application, I received a DWF file with four text variants: simple, mirrored, upside down, and backward). In my process_text/process_font callback function - how can I find if the text is mirrored (or upside down or backward)?

Our newest Software Engineer and DWF Technical Evangelist, Gyorgy Ordody, provided the answer:

The answer is in the WHIP! Format specification: You have to set the font flags. The "Flags" paragraph of the "Set Font" function specification indicates that Flag bits reserved for the DWF data generator's use. For example, the AutoCAD DWF ePlot driver uses the Flags field to set one or more of the following flags:

AttributeBit maskComment
VERTICAL 0x0001 // TVERT
MIRROR_X 0x0002 // TXMIR
MIRROR_Y 0x0004 // TYMIR
UNDERSCORE 0x0008 // TUNDER
OVERSCORE 0x0010 // TOVER
MTEXT_START 0x0020 // TMSTART
MTEXT_END 0x0040 // TMEND
MTEXT 0x0080 // TMTEXT
GREEK_TEXT 0x1000 // Whip and GDI font engine only
PATH_TEXT 0x2000 // Whip and GDI font engine only
OUTLINE_TEXT 0x4000 // Outline Text Only

This means that you have to set the font flags as in this example:

// let's mirror
whip_file.desired_rendition().font().flags().set(0x0002);
text = WT_Text(WT_Logical_Point(2147482677,2714), WT_String("Testing
Mirrored Test")); WD_CHECK(text.serialize(whip_file));

// upside down:
whip_file.desired_rendition().font().flags().set(0x0004);
text = WT_Text(WT_Logical_Point(2147481079,2123), WT_String("Upside
Down Test")); WD_CHECK(text.serialize(whip_file));

// upside down and backwards
whip_file.desired_rendition().font().flags().set(0x0006);
text = WT_Text(WT_Logical_Point(2147482772,1237), WT_String("Upside
down and backwards")); WD_CHECK(text.serialize(whip_file));

// Straight text
whip_file.desired_rendition().font().flags().set(0);
whip_file.desired_rendition().font().height() = 151; text =
WT_Text(WT_Logical_Point(2147482772,1237), WT_String("Straight
Text")); WD_CHECK(text.serialize(whip_file));

As mentioned in previous blog postings on fonts, text processing is an important part of DWF.

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341c3ba053ef00d8352e179653ef

Listed below are links to weblogs that reference Determining DWF text attributes in C++:

RSS Feed

Search