Invalid DXF attribute "align" for entity TEXT and fail to define font for TEXT wrote #857
Unanswered
puppybrown
asked this question in
Q&A
Replies: 1 comment
-
Please read the tutorial for TEXT ( and the docs in general): https://ezdxf.mozman.at/docs/tutorials/text.html |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
①I am trying to add text element to an existing dxf file. Here is the code I am using:
msp.add_text(text, dxfattribs={'layer': 'testData', 'insert': insert_point,'align': 'CENTER','rotation': angle, 'height': 2000})
Before I didn't include the part of 'align' and it works just fine. However after I added 'align' it gaves me the error of Invalid DXF attribute "align" for entity TEXT. I checked the profile for class TEXT and it does include the part of align. I don't know what caused this so I tried another way to write it:
msp.add_text(text, insert=insert_point, height=2000, align="CENTER", rotation=angle, layer="testData")
which also didn't work and shows error add_text() got an unexpected keyword argument for any keywork in this sentence. I am quite confused and have to ask for help.
②Another question is when I tried to add text it has default font of "Arial'. I want to define the text's font as times new roman, and here are several methods I tried:
msp.add_text(text, dxfattribs={'layer': 'testData', 'insert': insert_point,'oblique': angle, 'height': 2000,'font':'times.ttf'})
if "testData" not in ez.layers:
ez.layers.add(name="testData", color=7, font = 'times.ttf')
they all didn't work. the first one gives error of invalide attribute 'font' for entity TEXT. the second one didn't report error but the font are still the default arial.
I would really appreciate any help with this. Thank you for your time.
Beta Was this translation helpful? Give feedback.
All reactions