Export unicode text in dxf file into pdf #967
Replies: 5 comments 6 replies
-
Hi! You did everything right, but you didn't rebuild the font cache, see Rebuild Font Cache. The font cache is created once when You should also create a permanent configuration file in your home directory, otherwise you will rebuild the font cache on every launch, which defeats the purpose of the cache: ezdxf config --home The config file is located at: You can also create the config file in your current work directory: ezdxf config --print > ezdxf.ini see also Config Files And also note, the text rendering engine was not designed with active support for Right-To-Left languages, as I have no idea how that works. |
Beta Was this translation helpful? Give feedback.
-
Thanks @mozman for your quick and complete response. import ezdxf
from ezdxf.fonts import fonts
fonts.build_system_font_cache() and gives me this errors:
It created a json file in {
"version": 1,
"font-faces": [
[
"C:\\Users\\ebrahim\\AppData\\Local\\Microsoft\\Windows\\Fonts\\2ASEMAN.TTF",
"2 Aseman",
"Regular",
400,
5
],
[
"C:\\Users\\ebrahim\\AppData\\Local\\Microsoft\\Windows\\Fonts\\2ASEMANI.TTF",
"2 Aseman",
"Italic",
400,
5
],
.... Then I created pdf again and it only shows the rectangle around the text: my configuration: cfg = config.Configuration(
background_policy=config.BackgroundPolicy.CUSTOM,
custom_bg_color="#ffffff00",
min_lineweight=.1,
lineweight_scaling=0,
color_policy=config.ColorPolicy.BLACK,
) Thanks again. |
Beta Was this translation helpful? Give feedback.
-
Wow! Thanks.
Then when I export dxf file to pdf this error appears:
BTW, this time the English text don't appear in most cases: before: with new version: Thanks a lot. |
Beta Was this translation helpful? Give feedback.
-
Yes, you are right. I attached my dxf file with naskhd.shx persian font: Thanks again. |
Beta Was this translation helpful? Give feedback.
-
The missing text has the text style You can replace the import ezdxf
doc = ezdxf.readfile("persian_text.dxf")
style = doc.styles.get("SAZE_STYLE")
style.dxf.font = "romans.shx"
doc.saveas("fixed_persian_text.dxf ") There is another error without an easy fix. When I add the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello. First thanks a lot for such interesting project. I use it in my workflow.
I have some persian text in my dxf file and wanted to export it to pdf with backend.
but when I export it, it did not show unicode text correctly.
Also I identify fonts folder:
Beta Was this translation helpful? Give feedback.
All reactions