text style table dxf codes

text style table dxf codes

Moshe-A
Mentor Mentor
2,062 Views
4 Replies
Message 1 of 5

text style table dxf codes

Moshe-A
Mentor
Mentor

Hi Guys,

 

Does dxf has a flag or bit code to identify the font file if it is a ttf or shx  (i'm referring to dxf code 3)

cause there are times it returns only the file name without extension.

 

Happy New Year 2018

Moshe

 

 

 

0 Likes
Accepted solutions (1)
2,063 Views
4 Replies
Replies (4)
Message 2 of 5

_gile
Consultant
Consultant
Accepted solution

Hi,

 

It seems to me TTF fonts have some xdata SHX haven't (a 1071 group code containing  flags specific to TTF fonts)

You can try this:

 

(defun getFontType (name / style)
  (cond
    ((null (setq style (tblobjname "style" name))) nil)
    ((assoc 1071 (cdadr (assoc -3 (entget style '("ACAD"))))) "TTF")
    (T "SHX")
  )
)

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 5

Moshe-A
Mentor
Mentor

Gilles,

 

thank you very much for that info

 

do you know what is the meanning of the value in 1071?

cause some text styles give me (1071 . 2)

others (1071 . 34)

 

can i always assume that if in has xdata then it is ttf?

 

Moshe

 

 

0 Likes
Message 4 of 5

_gile
Consultant
Consultant

The documentation about this DXF group is very poor.

From the few tests I did and this topic:

(< 0 (logand dxf1071 1)) => fixed pitch (monospace font)

(< 0 (logand dxf1071 2)) => variable pitch

(< 0 (logand dxf1071 16)) => roman family (serif)

(< 0 (logand dxf1071 32)) => swiss family (sans-serif)

(< 0 (logand dxf1071 16777216) => italic

(< 0 (logand dxf1071 33554432) => bold

(< 0 (logand dxf1071 50331648) => bold-italic

 

I think the presence of these xdata is a reliable criterion as it only concerns TTF fonts.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 5

Moshe-A
Mentor
Mentor

wow thanks for that

 

than we could say that presence of extended data means TTF?

 

tell you what i'm after...in my office we have an application that mess things with our specific shx font

lets say we have a specific font called "OurFont.shx", the application some how changes our text style

to use "OurFont.ttf, this put AutoCAD in a state it could not find "OurFont.shx" and evrey text in drawing appears gibrish

plus any currently opened drawing get's mess up even opening a new one get's messed ("OurFont.shx" is not english lettes)

so i wrote a program to purge this messed text style. the only problem i had is to identify that the text style is really using

a ttf cause some time dxf code 3 holds only the font name with out extension.

 

Moshe

 

 

 

 

0 Likes