font problems with DXF import

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

font problems with DXF import

Walter Lapchynski
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Desperately trying to remove our business' dependence on AutoCAD here.
 Need to import DXFs that we have created and share with our vendors,
who sometimes modify them as well.

The problem is that it seems that our templates in AutoCAD (Windows, w
hich we're trying to remove dependence on, as well) specify an Arial f
ont for the headings. They appear with "{\fArial|b0|i0|c0|p0;}" append
ed to them. Also, tabs appear as "^I."

I've gone so far as using ttf2lff to convert the fonts (from the Ubunt
u ttf-mscorefonts-installer package) to lff and dropping them into /us
r/share/librecad/fonts/. Though they are loaded correctly, still the p
roblems remain.

Naturally, I can simply edit the DXF, remove the extra text, and chang
e the font to whatever I want and everything will be peachy keen. Ther
e are two problems with this, though:
 1. It's a lot of work. We've got a huge folder of drawings to deal wi
th.
 2. It will have to be redone any time one of our vendors makes a revi
sion, as they use AutoCAD and I doubt I can get them to use LibreCAD j
ust for us, especially given the problem above.

I should add that the problem persists in a freshly compiled git clone
 (@757c3c124abe0c607d9a991b52219a6c69dbb91d) from yesterday, so it's n
ot simply an issue with packaging lagging behind the latest developmen
t.

Thanks in advance,

- --
Walter Lapchynski
Information Services Assistant
Project Management Facilitator

Green Gear Cycling dba Bike Friday
800-777-0258 | +1 541-687-0487
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQEcBAEBCAAGBQJVce6dAAoJEC/Sz6G3AJ2T7MAH/jjhWRbRS8/uO8DJOF0avKM8
oHR/rRGzHQ6OkpLK1mrl1rg4Slz6QKjjKmicu9hAWvbK+2SYihwO3T9Xx0aw19xQ
RXYkKef/aXAtqLcDkrmHFwimd8nqffftzH5EixPCYEFRGGQQGBhXn4VWihJBf9E8
W9+WYY5doei1xGbZUqRTksq3wErx0vMlun+LkYJTx1K8igkFBFvMaIWBnn1/TUJn
CxrSWAgXX50Kpd1z6EZt0SMgq6zF6tElyDrTuO0Hm0UKbZntb+KKTXpejJA8oeu0
AgMpHG2TarfZPHaRXD5rSo7XMFE8ExbCm4RS9eHeQHcyded5XHeIrY4z+OWacDA=
=l2vF
-----END PGP SIGNATURE-----

0xB7009D93.asc (1K) Download Attachment
0xB7009D93.asc.sig (394 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: font problems with DXF import

dxli
can you supply a test case dxf file to show this font problem?
Reply | Threaded
Open this post in threaded view
|

Re: font problems with DXF import

stranger573
In reply to this post by Walter Lapchynski
Hi,

To librecad could use your font, file name must not contain uppercase letters and spaces.
After converting a ttf font in lff, characters will be unfilled, as shown below.


Reply | Threaded
Open this post in threaded view
|

Re: font problems with DXF import

Walter Lapchynski
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

> To librecad could use your font, file name must not contain
> uppercase letters and spaces.

I sort of gathered that already. I can't say I necessarily perceive th
at to be a feature, but no matter ;)

> After converting a ttf font in lff, characters will be unfilled,
> as shown below.

And indeed I do get that behavior with the arial.lff, but I seem to ha
ve to specify it.

I hope that the attached DXF highlights the issue. I should also point
 out there are some issues with the non-text items, too, when I compar
e it to the original print out from AutoCAD (also attached). Long stor
y short, I'd like the result in LibreCAD to be essentially the same.

Thanks again!

- --
Walter Lapchynski
Information Services Assistant
Project Management Facilitator

Green Gear Cycling dba Bike Friday
800-777-0258 | +1 541-687-0487
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQEcBAEBCAAGBQJVddUEAAoJEC/Sz6G3AJ2TRiYH/iV7IBv5/IwpVGVa6Fe2LHe4
HWIj82OEqPzaJvfGudeTNcOG96GCp0RH9k5gxHfwe7snZo10ohua03xqMsavuHxm
FzVkQlh4C/hEtoH1sHPys+688+1goiaE+k7A9CjzF0ntb6C0gWIfbFfoG73A7kT2
R3MHQi2jKlW+eBs5OgPcrnqo1oPq3ivCis2+cj/gLwsQ6Xzx7j0l9uq11hPsVSi7
KQEA2jMGsDdt+QrRoU5Yg9AMLZP0DUjGD5osbiP7RdgC1PCa2eiAFrRXom2Uu9S6
UwzshyU1yn1VE26k33+A0EGuvrQ1wSEqzIQ1j2VAOiAzHDPo4OtJ0Jhu/9NcsE0=
=umPb
-----END PGP SIGNATURE-----

16990.pdf (278K) Download Attachment
16990b 1.25 headset locking cone.dxf (303K) Download Attachment
0xB7009D93.asc (1K) Download Attachment
16990.pdf.sig (394 bytes) Download Attachment
16990b 1.25 headset locking cone.dxf.sig (394 bytes) Download Attachment
0xB7009D93.asc.sig (394 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: font problems with DXF import

Rallaz
Hi Walter,

Your attached dxf file have a string inside a font tag and immediately after another font tag wihtout text.
I found a bug which causes it to fail if there are two tags immediately one after another.

I patched the code to solve this issue and added code to handle severals sizes and colors.

About tabs "^I" are unsuppoted at this point in LibreCad I patched to change "^I" for 4 spaces (more correct I supose)

About "issues with the non-text items" can be more specific? like screen capture or entity type and coordinates.

Made a new git pull & complile it to check the patch.

And please, comment the result.

Cheers,
Rallaz
Reply | Threaded
Open this post in threaded view
|

Re: font problems with DXF import

Walter Lapchynski
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

First off, I should warn you guys that I'm not an engineer. I don't us
e CAD, but I'm acting in this case as a technical liason to our engine
er. That being said, if I say anything goofy, that's why. :)

As for the patch, it worked wonderfully. Thank you so much!

There is one remaining error in the "Third angle projection" which see
ms to be specified in the original DXF as:
{\fArial|b0|i0|c0|p0;Third angle projection}{\fArial|b0|i0|c0|p0;\H0.9
x;\P}{\fArial|b0|i0|c0|p0;\H0.9x;\P}{\fArial|b0|i0|c0|p0;\H0.9x;}


It renders as:
Third angle projection\H0.9x;\H0.9x;\H0.9x;

Since the oringal "APPROVED" was specified as:
{\fArial|b0|i0|c0|p0;APPROVED}{\fArial|b0|i0|c0|p0;}


…then it seems that this should be correct, but perhaps this is some p
roprietary AutoCAD thing where the backslash is some sort of delimiter
? It's also interesting that it stops rendering after the second semi-
colon, thus interpreting the "\P" as a new line of sorts.

Also, the arial.lff is not being applied to the text that is supposedl
y Arial.

The other thing I wonder about is how to make it render so that the te
xt does not run off the page. I suspect this is a matter of choosing t
he right standard font, since it does not seem that the formatting is
specified, as it is with the headings you fixed, but I'm not sure how
to solve this besides just guessing. Do you have any clues as to what
might be appropriate?

> About "issues with the non-text items" can be more specific?
> like screen capture or entity type and coordinates.

Perhaps this should be a new topic, but if you compare the previously
attached PDF, you can see how AutoCAD plots the drawing. If you look a
t the large figure near the top, at the bottom, the radius is shown as
 "R20 [R.787]" whereas LibreCAD shows it as "20.0000," kind of far awa
y from the arrow that indicates where that measurement exists. This su
ggests several problems, such as the number of significant digits, the
 displayed units, and a clear connection between the measurement and w
hat is being measured. Additionally, the diameter symbols are missing.

Not being a user of CAD software, I may be missing something, but it a
ppears that there's a lot of variables, some of which appear to be spe
cific to AutoCAD, that are in the head of the DXF. Perhaps there is so
mething here that's not being transferred over when opening in LibreCA
D? Or perhaps these represent systemwide plotter settings? I'm not sur
e, which, and frankly, I'm grasping at straws, so any help would be mo
st appreciated.

Thank you again, very much!
- --
Walter Lapchynski
Information Services Assistant
Project Management Facilitator

Green Gear Cycling dba Bike Friday
800-777-0258 | +1 541-687-0487
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQEcBAEBCAAGBQJVd0+jAAoJEC/Sz6G3AJ2TgyEIAMKHJxu/Pq+V/FcSitNboocc
khpsN3FXpjj6Kl+RdK3gaywPFm+dtVA8/9FSrCJxjUfPxBt5wQupY6hOfS020MQQ
5ntEvOFcja/Ld7JTQQbgIwWM1/3wRxYfHTkKhMmFQZJ9azw4ESAwOPbTxsFawS95
YmsnFLon4hmz29aldCK2FCafdqdTmXjKfs/+LMHv8ucML6WHrQzwhXflNKOoCc07
H1YYmc00sF4RFLoXRgRxIfZxLdil+yCq49+JfvqMxShvDaGR7j2/zfHLNIM6b/J3
/8xkkcDUa6mTbbOcTl78ZbSKXpeN3rit8XgJ1YMUdarsOTI5sgCglrebqmHLVG8=
=qWDW
-----END PGP SIGNATURE-----

0xB7009D93.asc (1K) Download Attachment
0xB7009D93.asc.sig (394 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: font problems with DXF import

Rallaz
I'm no engineer but a autocad power user with bad english .

< irritate mode on >
your drawing is full of garbage due to abuse of the advanced features of the mtext (multiline text)
probably because of the misuse of text styles (fixed size)
Instead of use text styles have the font "hardcoded" in mtext with the disadvantage that to change the font you need to edit one by one each mtext instead of edit the style and all mtexts with these style are changed automatically.
< irritate mode off >

Solutions:

The remaining error
\f = font tag follow
\H = height tag follow
\C = color tag follow
and \P = new line (the same as '\n' in C/C++)

{\fArial|b0|i0|c0|p0;Third angle projection}{\fArial|b0|i0|c0|p0;\H0.9
x;\P}{\fArial|b0|i0|c0|p0;\H0.9x;\P}{\fArial|b0|i0|c0|p0;\H0.9x;}
can be translated as:
(arial font)Third angle projection + (arial font, height 0.9)\n + (arial font, height 0.9)\n
and removing unneeded data: {\fArial|b0|i0|c0|p0;Third angle projection}

But I added a patch solving this remaninig issue, you can test it.


> Also, the arial.lff is not being applied to the text that is supposedly Arial.
No, all the mtext have style "standard" (if no style set in dxf is "standard")
the arial font is hardcoded inside mtext, and is not supported by LC (you can open a "feature request")
Solution by "brute force":
rename "standard.lff" to "standard-org.lff" and copy "arial.lff" to "standard.lff"

The "good" solution is in autocad create a text style called arial and set it in all mtext
and the "good" solution is another "feature request" (add support to text styles)

More stuff about text formatting:

Tabs '^I' is a bad option, the best is 1 mtext for column
See this screen capture of your drawing opened with autocad 2010

The tab code are incompatible from several ACAD version/languages
Attached a modified vession of your file whith arial style, mtext by columns and garbage removed

16990B1.DWG
16990B1.DXF

And ending:
Yes "issues with the non-text items" is a new topic related with dimmensions
Only a tip, menu "edit->current drawing preferences" in tab units change the precision for "0.00"

Cheers,
Rallaz
Reply | Threaded
Open this post in threaded view
|

Re: font problems with DXF import

Walter Lapchynski
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

> < irritate mode on > your drawing is full of garbage due to abuse
> of the advanced features of the mtext (multiline text)

Hey, I only try to open the drawings, not make them, but yes, I agree!
 :)

> < irritate mode off > But I added a patch solving this remaninig
> issue, you can test it.

As usual, works wonderful, thanks!

> No, all the mtext have style "standard" (if no style set in dxf
> is "standard") the arial font is hardcoded inside mtext, and is
> not supported by LC (you can open a "feature request")

Is this true of regular text as well as mtext?

> Yes "issues with the non-text items" is a new topic related with
> dimmensions

I'll create a new topic, then, but meanwhile, thank you so much for yo
ur highly detailed help!

- --
Walter Lapchynski
Information Services Assistant
Project Management Facilitator

Green Gear Cycling dba Bike Friday
800-777-0258 | +1 541-687-0487
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQEcBAEBCAAGBQJVegSnAAoJEC/Sz6G3AJ2TTrsH/1aglz8t6NbAOB6xnPjVaFJV
Ye3RltpxgOfYOd6NrzgSHAWXg6s0zhY+ejBSqtH1Tuwmv+/5W+EWX4/aTE4tsKYf
1WfT+sBm3BhvrZlOHML9CHca+sy9TxyLC5aNGR2KLC04cr5rTCa2MyxKBCkgxfti
TubyKvcZ1oIDofDaxO2EyqsAHVlyrPHZ6/utVaFfRZ5B6eudg8Xx+hEO72pjKkO7
UbRj2ZRLLkDcgvaXAUILbSo6BYJy+JzuNvF3bx+qJ5agsrwRHcd+Er49QTgXmCX9
ga0BVTdQPhPjLpbFVJo2cHSnFV5TZy2o4eylqX/qXiCIwgCkBJJEb6AUdZiR7zc=
=lxFP
-----END PGP SIGNATURE-----

0xB7009D93.asc (1K) Download Attachment
0xB7009D93.asc.sig (394 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: font problems with DXF import

Rallaz
> Is this true of regular text as well as mtext?

if no style set in dxf is "standard" are true for both

Data defining mtext in a dxf file:
http://www.autodesk.com/techpubs/autocad/acad2000/dxf/mtext_dxf_06.htm 

and text:
http://www.autodesk.com/techpubs/autocad/acad2000/dxf/text_dxf_06.htm

Cheers,
Rallaz