Question

I'm writing DXF files from a Delphi application and trying to understand text styles.
I have text styles working in general, but i'm struggling to find information in the DXF reference literature out there about how the 1071 group code works.
The 1071 Group Code is followed by a long value which contains a truetype font’s pitch and family, charset, and italic and bold flags. I cannot find any documentation on how to create this value. I've got sample DXF files produced with a CAD program and in comparing them this value changes, but I cannot make sense of the differences. It looks like each bit in the 4 bytes has a specific meaning. Would appreciate any help. Thanks.

Was it helpful?

Solution

Disclaimer: This answer is my interpretation of findings on a random test. Use at own risk!

Here a screen shot of test results gotten from a DXF file with random text style definitions:

enter image description here

So, it should be safe to assume that:

  • Italic style has the $01000000 bit set,
  • Bold style has the $02000000 bit set,
  • The 1st Word of the value designates the family charset.

Then the challenge left seems to be to get the family charset value. You could try to omit it since it is defined by the font name and filename. However, a test with deleting the whole 1071 group also clears the font style, although that is even so defined by the font filename.

OTHER TIPS

The DXF specification says that group code 1071 is "A long value which contains a truetype font’s pitch and family, charset, and italic and bold flags". As NGLN has pointed out, the bit masks 0x1000000 and 0x2000000 identify italic and bold text respectively.

Pitch, family and charset are properties of the Windows GDI LOGFONT struct; the actual values are given in the WMF specification (pitch, family, charset). From what I can tell, the rightmost four bits represent pitch, the next four bits represent family, and the next eight bits represent charset.

Here's a typical 1071 value:

0000 0000 0000 0000 0000 0000 0010 0010
       BI           _charset_ fmly ptch

This font is non-bold, non-italic, ANSI charset (pretty meaningless these days), Swiss family (i.e. sans-serif), and variable pitch (i.e. not monospaced).

As for writing DXF files, AutoCAD seems happy to accept 1071 values with pitch, charset and family all zero.

AutoCAD text styles do not contain information on underline and strikethrough.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top