How to find real text width from dxf file ?

Discussion in 'AutoCAD' started by jmespinosabaviera, Feb 5, 2006.

  1. 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
     
    jmespinosabaviera, Feb 5, 2006
    #1
  2. jmespinosabaviera

    Mr. B Guest

    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
     
    Mr. B, Feb 6, 2006
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.