Closed my88480 closed 1 year ago
It should be initialized with the default font "simplex.shx". In any case I would like to see a sample DXF that shows this problems, because if the code has reached that point it means the DXF is not well formatted. Your Text is pointing to a TextStyle that has not been defined.
the method new TextStyle(name) points to the following implementation: public TextStyle(string font) : this(Path.GetFileNameWithoutExtension(font), font) { } here, it means the parameter name is the font name ,not the text style name
to reoccur the problem i had, just choose a normal dxf file contains text entities,choose one text change the text style to one which it is not contains in the dxf file. for example: ... 0 SECTION 2 ENTITIES ..... 0 TEXT ..... 7 TextStyleNameNotContained ....
the excepltion occurs: Message:Only true type TTF fonts and ACAD compiled shape SHX fonts are allowed.
So i change the code line: return this.doc.TextStyles.Add(new TextStyle(name,"arial.ttf")); or: return this.doc.TextStyles.Add(new TextStyle(name,"simplex.shx"));
IO/dxfreader.cs: private Text ReadText()
the last code line should be:
return this.doc.TextStyles.Add(new TextStyle(name,fontname));
or you often got the excepltion: Message:Only true type TTF fonts and ACAD compiled shape SHX fonts are allowed.