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.
Unfortunately, activation email could not send to your email. Please try again.

Font Substitution

Thread ID:

Created:

Updated:

Platform:

Replies:

92659 Jan 28,2010 08:35 PM Feb 5,2010 04:40 AM ASP.NET Web Forms (Classic) 5
loading
Tags: DocIO
Chris Lindsay
Asked On January 28, 2010 08:35 PM

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.

Rajendran [Syncfusion]
Replied On February 1, 2010 01:10 AM

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

Chris Lindsay
Replied On February 2, 2010 08:36 PM

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

Chris Lindsay
Replied On February 2, 2010 10:14 PM

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.

Chris Lindsay
Replied On February 3, 2010 10:22 PM

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.

Rajendran [Syncfusion]
Replied On February 5, 2010 04:40 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;