Re: New .dxf to .elmt Conversion Program
Hallo plc-user,
I noticed something similar with the imperial DXF from your American compatriot.!
I can double check, but I believe this extra scaling factor for the imperial unit drawing was fixed in the last commit.
If we focus on the 20 mm font:
In LibreCAD (black background) it is good to see that both texts are the same size - I expect the same for the element.
In the element (white background), the polygon 20 mm are 40px high, but the 20 mm text has a font size of 57.
So there is still a factor of about 1.4 somewhere in there that doesn't belong.
The scaling for the font is handled separately from the rest of the drawing. This is because dxf stores text height in whatever unit the drawing is in (ie mm, inches, etc) and QET uses your stand font points. A font point is defined as 1pt = 1/72 inches, which comes out to 1pt = 0.3528mm.
Based on this conversion the values that are being generated are "correct", because text height in mm would be multiplied by a factor of roughly 2.83. instead of the 2 used to convert mm to pixels.
I checked a couple of online unit conversion calculators to verify my math and 20mm comes out to 56.692913386pt font, rounded to 57 in the element.
You are right though that this clearly isn't correct in the element file. Doing a quick hacky test of modifying the text element font size to try and match the polygon size, it looks like the factor in your sample file should be 2.1. (for the 20mm text, a font size of 42pts). It's not clear to me where this 2.1 comes from...but it is close to the 2px per mm we use in the conversion of this drawing. Perhaps multiplying the text height in real world units by the same as the rest of the drawing instead of "properly" converting between font points and real world units would be better? I'll need to try and do more testing and see what I can come up with, and test it against some other drawings.