Replace one font with another

Please post any requests or ideas you may have for new features for the end User Version of PDF-Tools here.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, John - Tracker Supp, Ivan - Tracker Software, Tracker Supp-Stefan, Tracker - Clarion Support, moderators, Support Staff

Post Reply
fraggy
User
Posts: 2
Joined: Tue Jun 28, 2005 2:33 pm

Replace one font with another

Post by fraggy »

Don't know if this feature should be asked in the printer driver section or in the PDF Tools section or both:

To achieve the lowest possible weight of our PDF files while retaining max compatibility with all possible end-user systems, we want to use ARIAL only (so we don't have to embed any font.
However, our client gave us AutoCAD files that contained exotic letter types. So it would be nice if we could tell PDF Exchange to just replace all those fonts automatically with ARIAL, or as we found out after already having created all the PDF files, to be able to use PDF Tools to do a "search and replace" were all non-arial would be replaced by arial.

I don't know if other users think this would be a usefull feature, but we definately would have appreciated such a feature.

Right now we are talking to our client and we agreed to redefine their standards when creating autocad files, but also they will have to (manually) correct their whole autocad archive (unless there is a autocad plugin that lets them replace fonts in batch).

I'd like to hear some opinions on this.

JM.
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Post by John - Tracker Supp »

Hi,

Whilst your request on the face of things seems very reasonable and even desirable - there are a number of factors involved which make it (unfortunately) impossible to provide a general purpose function to achieve this - here are just a few :

Broadly speaking in a PDF there are two types of fonts - "simple" and "CID". The primary differences:

"Simple" fonts in most cases correspond to ASCII characters and some more additional characters (but for symbolic fonts this is not so!),

"CID" fonts usually represent characters outside the ASCII charset (for example Cyrillic, Japanese characters and so on).

In general both fonts types may use their own methods to encode character representation - simple fonts typically use character codes, CID fonts typically use glyph indexes.

To preserve the PDF for viewing as closely to the original as possible we must use the corresponding glyphs (a glyph is a visual character representation, actually set of drawing commands; each font uses its own glyphs to draw characters, and in different fonts glyphs may have a different order than in others).

So in case of simple the font set it is theoretically possible to replace one font with another (because we know how to map the character code from PDF to Unicode, and the font contains information on how to map Unicode to the glyph index)

However in the case of "CID" fonts this operation is impossible because we would not know how to map the glyph index to Unicode (because the mapping from Unicode to glyph and vice versa is font-specific).

Also, if we tried to replace one font with another - the text may became hard to read or unreadable at all (in different fonts the same characters potentially have a different width).

Therefore the formatting and pagination would be totally distorted and not represent the original at all.

That's not to say this would never be successful - but the success rate would be very very modest.

It would also not necessarily yield huge file size reductions.

A better bet is to try the new optimisation features in the new PDF-Tools (now in beta) which should yield far more advantageous results in terms of file size reduction without the draw backs and we will be working on this over the coming months to improve further.

To try the new beta please see :

https://www.pdf-xchange.com/news/show/47
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
fraggy
User
Posts: 2
Joined: Tue Jun 28, 2005 2:33 pm

Post by fraggy »

Thank you very much for your reply.

Our client will need to correct all their cad files anyway. The automatical replace of fonts in the PDFs would have been a temporary "patch" anyway, just a quick and dirty repair until their original cad files would get fixed.

I really didn't expect the font replacement thing to be so complex. Indeed it's not worth the troubles implementing when success would be unpredictable / low success rate.
Thank you for the details on the subject.

We've tried the beta-tools and indeed the compression is great. Our biggest PDF file (27Mb with distiller) now weighs only 9Mb... Still heavy, but already 3 times less than the original. Thumbs up for the good work :)

JM.
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Post by John - Tracker Supp »

Thanks and pleased you can appreciate the complexity.

Pleased you like the optimisation.

the next release will allow batch optimisation of multiple files in one operation.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
Post Reply