Text resized when PDF is imported

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.

User avatar
DerekGove
Active Member
Posts: 41
Joined: Sat May 20, 2023 7:10 pm
Location: Cumbria

Text resized when PDF is imported

Post by DerekGove » Thu Jun 08, 2023 10:04 pm

I can't see any settings to adjust so I think this may be a bug of some kind.

I have a PDF of the frame and title block my employer uses. It is an A4 PDF. I can import it into QCAD fine, and the geometry/lines all come in the right weight, colour, etc, but the text is coming in slightly too large, and some lines of text are breaking out of the boxes they are supposed to be within.

Here is a screen grab of the original PDF. (It looks fine in both PDF Viewer and Illustrator)
Screenshot 2023-06-08 215653.png
Screenshot 2023-06-08 215653.png (47.28 KiB) Viewed 4425 times
And here is a screenshot of the same PDF placed in QCAD.
Screenshot 2023-06-08 215912.png
Screenshot 2023-06-08 215912.png (39.19 KiB) Viewed 4425 times
I gather PDF import is a fairly recent addition to QCAD. I suspect there may be a little tweaking required. Unless there is some setting hidden away somewhere.

Regards,

Derek
QCAD Version 3.29.4 : Windows 10

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

Re: Text resized when PDF is imported

Post by Husky » Thu Jun 08, 2023 11:05 pm

Hi,

I failed to reproduce the issue. Any chance that you post the pdf ...?
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..."

User avatar
DerekGove
Active Member
Posts: 41
Joined: Sat May 20, 2023 7:10 pm
Location: Cumbria

Re: Text resized when PDF is imported

Post by DerekGove » Thu Jun 08, 2023 11:50 pm

It's a document/template for work, so I'd rather not post it on an open forum, but if you PM me with an email, I could send it direct to you..?
QCAD Version 3.29.4 : Windows 10

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

Re: Text resized when PDF is imported

Post by Husky » Fri Jun 09, 2023 12:02 am

DerekGove wrote:
Thu Jun 08, 2023 11:50 pm
It's a document/template for work, so I'd rather not post it on an open forum, but if you PM me with an email, I could send it direct to you..?
Understandable! Please feel free to use my forum PM (Contact below avatar) and the file will stay confidential. :wink:
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..."

User avatar
DerekGove
Active Member
Posts: 41
Joined: Sat May 20, 2023 7:10 pm
Location: Cumbria

Re: Text resized when PDF is imported

Post by DerekGove » Fri Jun 09, 2023 12:36 am

Thanks
I realised after my last message that I could probably attach it to a PM, but by then I'd already switched my laptop off as it was past midnight. Doh!
I'll message you tomorrow with the PDF.

Cheers,
Derek
QCAD Version 3.29.4 : Windows 10

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

Re: Text resized when PDF is imported

Post by CVH » Fri Jun 09, 2023 4:23 am

Derek,

Remark that QCAD may fall-back on the nearest installed font available on your system for rendering.
Remark also that QCAD doesn't support all kinds of text formatting found in some other applications.

For that one needs to investigate the source and maybe the dxf source.

Regards,
CVH

User avatar
DerekGove
Active Member
Posts: 41
Joined: Sat May 20, 2023 7:10 pm
Location: Cumbria

Re: Text resized when PDF is imported

Post by DerekGove » Fri Jun 09, 2023 9:26 am

Hi CVH,

We are both using the same font, but I did consider that it may be that my font on my laptop may be different to the font on my colleague's computer, but that really shouldn't affect the size visibly as much as it is.

Good point about the text formatting that other software has. I don't know for certain if the original document has been done in Illustrator or a CAD program: I'm trying to establish that. Having said that, I could understand if the kerning or horizontal compression was all wrong, but the text is clearly too big overall.

I've sent Husky a PM with the file attached. I'll send you one too, just in case you have a moment to import it and see what it looks like on your screen.

Regards,

Derek
QCAD Version 3.29.4 : Windows 10

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

Re: Text resized when PDF is imported

Post by CVH » Fri Jun 09, 2023 9:47 pm

DerekGove wrote:
Fri Jun 09, 2023 9:26 am
We are both using the same font, but I did consider that it may be that my font on my laptop may be different to the font on my colleague's computer, but that really shouldn't affect the size visibly as much as it is.
Yes it does ... Fonts are very complex things.
https://en.wikipedia.org/wiki/TrueType ... To start with. :wink:
DerekGove wrote:
Fri Jun 09, 2023 9:26 am
I could understand if the kerning or horizontal compression was all wrong, but the text is clearly too big overall.
Here the rendered text matches Arial for 100%.
I don't have access to or any information over a font called 'ONZYPV+CenturyGothic'.

Regards,
CVH

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

Re: Text resized when PDF is imported

Post by Husky » Fri Jun 09, 2023 11:04 pm

Hi Derek,
DerekGove wrote:
Fri Jun 09, 2023 9:26 am
I've sent Husky a PM with the file attached.
The pdf loads on my machine the same way like on your machine.

The pdf has 2 stored fonts. Arial and CenturyGothic.
Inside the pdf those fonts are stored as IWZTJH+Arial and ONZYPV+CenturyGothic.
Those names are "correctly" read by QCAD as IWZTJH+Arial and ONZYPV+CenturyGothic. Correctly doesn't means it knows what to do with it ...
I have no idea where those pdf font names come from! Correct name would be Arial and CenturyGothic.

Note: Other programs are able to read the text correctly - QCAD not. :oops:

Easiest way to fix the issue would be to get that template as a dxf/dwg/svg. PDF is not really meant to provide those specific information.

If you need to stick to the pdf load it into QCAD, scale the Text Hight below Menu/Edit to 0.816, substitute those fonts and save it for further processing as dxf. Not perfect but close ...

Not sure if this is a QCAD or pdf problem. Me discovering those weird font names in the pdf makes me thinking it is a pdf problem ...
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: 3467
Joined: Wed Sep 27, 2017 4:17 pm

Re: Text resized when PDF is imported

Post by CVH » Fri Jun 09, 2023 11:37 pm

Scaling fonts scales the text width property too.
This was 1 and scales to 0.816, zero means no column width.

It is known that using a non-zero value for column width renders slower on viewports in combination with 'Text rendering as text'.

The solution is twofold:
- Render text as paths, see: menu Edit .. Application Preferences .. Graphic View .. Text Rendering.
- Select all text entities and set the text width property to zero.

Regards,
CVH

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

Re: Text resized when PDF is imported

Post by CVH » Sat Jun 10, 2023 6:54 am

Additionally:
A pdf created by QCAD using Arial & CenturyGothic imports just fine in QCAD ... :P

Regards,
CVH

User avatar
DerekGove
Active Member
Posts: 41
Joined: Sat May 20, 2023 7:10 pm
Location: Cumbria

Re: Text resized when PDF is imported

Post by DerekGove » Sat Jun 10, 2023 10:42 am

CVH wrote:
Fri Jun 09, 2023 9:47 pm
Fonts are very complex things.
I know. I worked in publishing for twenty years, and spent a lot of time dealing with typefaces. I have created a handful of fonts. The proportions of ascender/descender heights, the x height can vary wildly, and depending on how much space the typeface occupies between baselines different typefaces can be different sizes but Arial and Century Gothic have almost identical metrics, and there shouldn't be that amount of visible change (see image below).
CVH wrote:
Fri Jun 09, 2023 9:47 pm
Here the rendered text matches Arial for 100%.
I'm might be misunderstandign what you're meaning here, because the text on screen is most definitely Century Gothic, not Arial.
FontComparison.png
FontComparison.png (48.57 KiB) Viewed 4189 times
Cheers,
Derek
QCAD Version 3.29.4 : Windows 10

User avatar
DerekGove
Active Member
Posts: 41
Joined: Sat May 20, 2023 7:10 pm
Location: Cumbria

Re: Text resized when PDF is imported

Post by DerekGove » Sat Jun 10, 2023 11:19 am

Husky wrote:
Fri Jun 09, 2023 11:04 pm
The pdf loads on my machine the same way like on your machine.
That's a relief, Kind of. :)
Husky wrote:
Fri Jun 09, 2023 11:04 pm
Inside the pdf those fonts are stored as IWZTJH+Arial and ONZYPV+CenturyGothic.
Those names are "correctly" read by QCAD as IWZTJH+Arial and ONZYPV+CenturyGothic. Correctly doesn't means it knows what to do with it ...
I have no idea where those pdf font names come from! Correct name would be Arial and CenturyGothic.
I've no idea where those font names come from either. I'm wondering if when the PDF is generated, it is only embedding the glyphs used in the document rather than the entire font, and a 'subset' font is being generated. I'm going to dig into this with FontForge, as that can extract fonts from documents.
Husky wrote:
Fri Jun 09, 2023 11:04 pm
Note: Other programs are able to read the text correctly - QCAD not. :oops:
Puzzling.
Husky wrote:
Fri Jun 09, 2023 11:04 pm
If you need to stick to the pdf load it into QCAD, scale the Text Hight below Menu/Edit to 0.816, substitute those fonts and save it for further processing as dxf. Not perfect but close ...
Great tip. Scaling the text height is a decent solution because I can resize all the text in one go, instead of having to change every text element individually.


I have come across some other slightly odd behaviour with Century Gothic. I'll post it in a separate comment. It may be related, it may not be.

Cheers,

Derek
QCAD Version 3.29.4 : Windows 10

User avatar
DerekGove
Active Member
Posts: 41
Joined: Sat May 20, 2023 7:10 pm
Location: Cumbria

Re: Text resized when PDF is imported

Post by DerekGove » Sat Jun 10, 2023 11:49 am

CVH wrote:
Sat Jun 10, 2023 6:54 am
Additionally:
A pdf created by QCAD using Arial & CenturyGothic imports just fine in QCAD ... :P

Regards,
CVH
Well that's good news! I may well just end up creating it from scratch in QCAD...

:D
QCAD Version 3.29.4 : Windows 10

User avatar
DerekGove
Active Member
Posts: 41
Joined: Sat May 20, 2023 7:10 pm
Location: Cumbria

Re: Text resized when PDF is imported

Post by DerekGove » Sat Jun 10, 2023 12:23 pm

Okay, so here's the other thing I've noticed. (I'm not calling it a bug, just an observation.)

So I create a QCAD document, and add some text, using Century Gothic. (Just because that's one that I'm having issues with)
QCAD-Text-CenturyGothic.png
QCAD-Text-CenturyGothic.png (5.7 KiB) Viewed 4174 times

I export the document as a PDF, and open it in a PDF viewer.
QCAD-Text-CenturyGothic-inPDF.png
QCAD-Text-CenturyGothic-inPDF.png (23.08 KiB) Viewed 4174 times
All good.


Just out of curiosity, I open the PDF in Illustrator. Upon opening, I get the following message:
QCAD-CenturyGothic-Illustrator-error-.png
QCAD-CenturyGothic-Illustrator-error-.png (8.05 KiB) Viewed 4174 times
So despite being created using a font on my computer, there is a font that it can't find. It is looking for a font called CenturyGothicRegular, though it shouldn't be because I never used such a font. The possible font names on my PC are either 'Century Gothic' or 'Century Regular'.


I click 'OK/whatever', and it opens up substituting the default font (probably Arial) and it all looks wrong.
QCAD-CenturyGothicinIllustrator.png
QCAD-CenturyGothicinIllustrator.png (3.78 KiB) Viewed 4174 times

I highlight the text, and change it to Century Gothic, as it should be, and everything looks correct, although each character is now a separate element.
QCAD-CenturyGothicinIllustrator-fixed.png
QCAD-CenturyGothicinIllustrator-fixed.png (9.2 KiB) Viewed 4174 times

So... The exported PDF from QCAD looks right in a PDF viewer, but when opened in a different program that does more than just show the contents and allows for editing, there is clearly an issue. What I think is happening is that when exporting the PDF, QCAD is combining the name of the font which is 'Century Gothic' with the font weight, which is 'Regular'(seen in the above screengrab), and telling the document that there is a font called 'CenturyGothicRegular', which doesn't exist.

I'm pretty certain that this is what is happening with the other fonts, where the PDF I was initially having issues with was claiming to be using fonts called IWZTJH+Arial and ONZYPV+CenturyGothic. Clearly these fonts don't exist either, but whatever software is being used to export that PDF is doing similar to what QCAD is doing, but is prepending the actual font names with other seemingly random characters.
Century Gothic will not be the only font this behaviour occurs on. I suspect every font will be appended with 'Regular, Bold, etc.

Is it a bug? Possibly. But QCAD is clearly not alone in this behaviour. And I think this behaviour sheds a little light on my initial issue. Probably doesn't get me closer to a solution, but it is food for thought.

Also, with it being an issue present in software other than QCAD as well, it makes life difficult when transferring documents across sites, and having different users editing the PDFs. Getting a copy of that PDF document in a different format such as dxf is probably the best option, removing all the dodgy conversion stuff going on when PDFs are exported.

Regards,
Derek
QCAD Version 3.29.4 : Windows 10

Post Reply

Return to “QCAD Troubleshooting and Problems”