How to find real text width from dxf file ?

I am developing software that reads from dxf files and processes the results. I need to know the real height and width of text elements.

With height there is no problem since I can retrieve it. It appears with code 40 in the dxf file.

The problem is width. I find no means to know the real text width. I can read from the dxf file the "width / height ratio" ( code 41 ) , multiply this ratio by the the height and the number of characters, but I have been disappointed to see that this is not exact. I have seen for instance text elements with a "width / height ratio" of 1 with digits which have a height much greater than width. I usually handle text elements which display numbers, and their digits are usually drawn taller than wider, even if they show a width/height ratio of 1 or similar.

Any help would be appreciated, since I need to know what area these elements cover.

Thanks

Reply to
jmespinosabaviera
Loading thread data ...

If I recall correctly, only the very Ugly TXT font uses 'proportional' width for the characters. All other Fonts don't. So you are out of luck.

About the only thing you can do is to work out the width of each "Popular" font and build a data base that you can use (ie: If font = Simplex, then get the widths). A very horrible way to do it, but probably no other way.

Regards,

BruceF

Reply to
Mr. B

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.