[solved] chinese words missing

If you are having problems with QCAD, post here. Please report bugs through our Bug Tracker instead.

Always attach your original DXF or DWG file and mentions your QCAD version and the platform you are on.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
lloydzl
Newbie Member
Posts: 7
Joined: Thu Sep 09, 2021 12:23 am

[solved] chinese words missing

Post by lloydzl » Thu Sep 09, 2021 12:41 am

Hi,
I'm using dwg2pdf command to convert a drawing file.
But all the Chinese words couldn't be converted correctly.
-font-substitution not working either.
Attachments
chinese-issue.pdf
(737.91 KiB) Downloaded 386 times
chinese-issue.dwg
(328.94 KiB) Downloaded 376 times
Last edited by lloydzl on Fri Sep 10, 2021 11:09 am, edited 1 time in total.

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4939
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: chinese words missing

Post by Husky » Thu Sep 09, 2021 1:53 am

Hi,
lloydzl wrote:
Thu Sep 09, 2021 12:41 am
But all the Chinese words couldn't be converted correctly.
I assume that the in the dwg used font isn't installed on your machine.
lloydzl wrote:
Thu Sep 09, 2021 12:41 am
-font-substitution not working either.
As you can see it'll work if you have a font installed which can properly interpret the used characters. If not it will display an ? as a placeholder. BTW: I can't read Chinese - please consider my screenshot just as proof of concept. :wink:

Husky-2021.09.08-04.png
Husky-2021.09.08-04.png (90.68 KiB) Viewed 9247 times
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

lloydzl
Newbie Member
Posts: 7
Joined: Thu Sep 09, 2021 12:23 am

Re: chinese words missing

Post by lloydzl » Thu Sep 09, 2021 3:29 am

Thank you!
But I don't know which font the users use, how can I determine the font (or font name) the file uses? Then I can find and install it, or replace it with an existing one.

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4939
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: chinese words missing

Post by Husky » Thu Sep 09, 2021 6:02 am

lloydzl wrote:
Thu Sep 09, 2021 3:29 am
But I don't know which font the users use, how can I determine the font (or font name) the file uses? Then I can find and install it, or replace it with an existing one.
Good question! In a perfect world you just load the drawing. If you then notice that something went wrong with the text you just select the text and check the Property Editor to figure out which font was used. Then get the font, install it on your system and everything works as expected.

Husky-2021.09.08-05.png
Husky-2021.09.08-05.png (36.72 KiB) Viewed 9226 times
If I do that with your example drawing it will show that the "isocp" font was used. As we see that can't be correct what means this font is already an automatically substituted font during load or somebody who work previously on that drawing substitute the font and saved the drawing before you got it.

What I did to come close to a fix was just a try and error attempt. I know it has to be a font with Chinese characters, so I tried a Chinese font which I had on my system (HanWang KaiBold-Gb 5) and hoped for the best ...
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

lloydzl
Newbie Member
Posts: 7
Joined: Thu Sep 09, 2021 12:23 am

Re: chinese words missing

Post by lloydzl » Thu Sep 09, 2021 9:07 am

Great explanation! Thanks!
Another problem is I'm just using the command line tool on Linux, no GUI, like 'dwg2pdf -platform offscreen ...'
Is there any way to determine the font name so that I can use the option '-font-substitution FONT1 FONT2'?

CVH
Premier Member
Posts: 3468
Joined: Wed Sep 27, 2017 4:17 pm

Re: chinese words missing

Post by CVH » Thu Sep 09, 2021 9:20 am

Hi,

What is the most intriging is that:
- Specific Property Text field
- Specific Property Plain Text field
- Text dialog
All show chinese characters but the text in model space renders as '???'.

The Block List and the Layer List show chinese characters too.

I have ISOCP.ttf installed but the font dropdown field shows 'isocp' as last at the bottom.
Meaning that 'isocp' is not the same as ISOCP.ttf as that sits higher in my font list.

Another test is to alter the font and verify if 'isocp' is still listed at the bottom.
In this case it disappears meaning that the font is not present on the system.

My ISOCP.ttf only includes some 200 characters: about 75% Basic Latin & Latin-1 Supplement
https://en.m.fontke.com/font/10067045/charset/
There are numerous different ISOCP.ttf files out there.

I suppose 'isocp' in the dwg is reffering to isocp.shx, an AutoCAD Compiled Shape File.
That 'isocp' is also associated with TTF by the icon in front is wrong here (known Qt issue).
QCAD doesn't handle shx files.

If I copy a character from the Specific Property Text field and paste it in Notepad I get the same glyph.
The font that Notepad uses is Arial.ttf but I don't get chinese characters using Arial in QCAD.
Same story when I paste it to Notepad++ that uses Courier New.

All rather weird. :shock:

Regards,
CVH

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4939
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: chinese words missing

Post by Husky » Thu Sep 09, 2021 10:57 pm

lloydzl wrote:
Thu Sep 09, 2021 9:07 am
Another problem is I'm just using the command line tool on Linux, no GUI, like 'dwg2pdf -platform offscreen ...'
Is there any way to determine the font name so that I can use the option '-font-substitution FONT1 FONT2'?
Honestly - I don't know. :oops: Hopefully Andrew has an answer to your question.
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

CVH
Premier Member
Posts: 3468
Joined: Wed Sep 27, 2017 4:17 pm

Re: chinese words missing

Post by CVH » Fri Sep 10, 2021 6:59 am

lloydzl wrote:
Thu Sep 09, 2021 9:07 am
Is there any way to determine the font name
Don't know, dwg2csv can extract a list of used fonts in textbased entities ...

Regards,
CVH

User avatar
andrew
Site Admin
Posts: 9059
Joined: Fri Mar 30, 2007 6:07 am

Re: chinese words missing

Post by andrew » Fri Sep 10, 2021 9:11 am

You can list the main fonts used in your file with:

Code: Select all

dwg2csv -f -t Text -p "Font Name" myfile.dxf
Note that this will only list the main font of each text but not fonts that are used as part of the formatting.

For example if a text has its font name property set to "Arial" and the text contents is "ABC\fCourier|b0|i0|c0|p0;DEF", this command will list "Arial" but not "Courier". "Arial" is the font name property for the text whereas "Courier" is only used as part of its formatting.

CVH
Premier Member
Posts: 3468
Joined: Wed Sep 27, 2017 4:17 pm

Re: chinese words missing

Post by CVH » Fri Sep 10, 2021 9:23 am

andrew wrote:
Fri Sep 10, 2021 9:11 am
Note that ...
I think one could extract formatting fonts from the plain text with a simple Regex ...
All rather more complicated ... :wink:

Regards,
CVH

lloydzl
Newbie Member
Posts: 7
Joined: Thu Sep 09, 2021 12:23 am

Re: chinese words missing

Post by lloydzl » Fri Sep 10, 2021 10:39 am

Thank you!
I've tried this method, but it couldn't extract the font name with my attached files, both '.dwg' and '.dxf'...

Code: Select all

dwg2csv -f -t Text -p "Font Name" chinese-issue.dwg
dwg2csv -f -t Text -p "Font Name" chinese-issue.dxf


andrew wrote:
Fri Sep 10, 2021 9:11 am
You can list the main fonts used in your file with:

Code: Select all

dwg2csv -f -t Text -p "Font Name" myfile.dxf
Note that this will only list the main font of each text but not fonts that are used as part of the formatting.

For example if a text has its font name property set to "Arial" and the text contents is "ABC\fCourier|b0|i0|c0|p0;DEF", this command will list "Arial" but not "Courier". "Arial" is the font name property for the text whereas "Courier" is only used as part of its formatting.
Attachments
chinese-issue.dxf
(1.92 MiB) Downloaded 356 times
chinese-issue.dwg
(328.94 KiB) Downloaded 367 times

User avatar
andrew
Site Admin
Posts: 9059
Joined: Fri Mar 30, 2007 6:07 am

Re: chinese words missing

Post by andrew » Fri Sep 10, 2021 10:44 am

Can you attach your CSV file that was generated?

lloydzl
Newbie Member
Posts: 7
Joined: Thu Sep 09, 2021 12:23 am

Re: chinese words missing

Post by lloydzl » Fri Sep 10, 2021 11:08 am

Great! I found the font names in the csv file, thank you!
andrew wrote:
Fri Sep 10, 2021 10:44 am
Can you attach your CSV file that was generated?
Attachments
chinese-issue.csv
(1.16 KiB) Downloaded 377 times

Post Reply

Return to “QCAD Troubleshooting and Problems”