We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Font Substitution

Does DocIO support font substitution? Is it possible, using DocIO, to permanently convert substituted fonts to a given font?

When we save a document that has substituted fonts (particularly when these fonts are used in styles) with DocIO the font is reverted to the default paragraph font instead of the font being used as the substitution.

5 Replies

RA Rajendran Syncfusion Team February 1, 2010 06:10 AM UTC

Hi Chris,

Thank you for your interest in Syncfusion products.

Yes it is possible to substitute a font to a paragraph and save changes. Please create a style with font name you want to substitute and then apply the style wherever you want to substitute the font to a paragraph using ApplyStyle(stylename) method. Please do find the sample in the following location which illustrates the same.

Sample link:
http://files.syncfusion.com/samples/DocIO.Web/FontSubstitution.zip

Regards
Rajendran


CL Chris Lindsay February 3, 2010 01:36 AM UTC

I think you may have misunderstood me. Font substitution is a feature of Word whereby fonts that are used in a document that don't exist on the machine on which the document is being opened are substituted for a font that Word thinks is similar. It does this so that the document can still be viewed and printed.

You identify substituted fonts in Word 2003 by going to Tools->Options, selecting the compatibility tab and then pressing the "Font Substitution" button. For example in the document you attached to your last post there is a font called "Bitstream Vera Serif". This font doesn't exist on my machine so Word substitutes it with Times New Roman (see the image I have attached).

My problem is that when I save this document with DocIO it applies the default paragraph font to the text that uses the substituted font. The results of this can be unpredictable since the font Word uses as the substitution may not be the same as the default paragraph font and so the document no longer looks as it did prior to saving with DocIO.

So my question is: does DocIO provide a facility to identify text ranges that are using substituted fonts and also a method by which I can permanently convert the substituted font to a given font just as I can in the font substitution dialog (shown in the attached image) by clicking the "Convert Permanently..." button.



FontSubstitution_7618e9fc.zip


CL Chris Lindsay February 3, 2010 03:14 AM UTC

A couple of days ago I installed a patch for 7.403.0.20 that we received for an unrelated issue and I just retested this issue I have found that it now works correctly. The formatting of text using the substituted font no longer changes when I save the document with DocIO.

I would still be interested to know if there is a way to permanently convert the substituted fonts using DocIO.


CL Chris Lindsay February 4, 2010 03:22 AM UTC

I've figured out what was going on here. Before saving the document with DocIO there must have been some information stored in the document about the font mappings for substituted fonts. This seems to be lost when saving with DocIO. I notice after saving a docx file with DocIO the fontTable.xml is missing (not sure if this is an issue or not).

However, I discovered a registry key that contains font mappings (HKEY_CURRENT_USER\Software\Microsoft\Shared Tools\Font Mapping\). When I add the missing font to here everything is good.

Just thought you might be interested to know the outcome.


RA Rajendran Syncfusion Team February 5, 2010 09:40 AM UTC

Hi Chris,

Thanks for the update.

You are right about that, currently we are not saving information on substituted fonts. In future we will update DocIO to support substituted fonts with relevant features.

Please let us know if you have any other questions.

Regards,
Rajendran

Loader.
Live Chat Icon For mobile
Up arrow icon