Programmatic way to detect the font issues for Metafile to Raster conversion

Hi Babar,
I am unable to understand where exactly the problem and how you people trying to recognize the problem. Is there any programmatic way to check that required font present or not. What i am feel that while conversion of wmf to png image they are not recognize a font.
FYI : we are also using Aspose.Words for java at the same environment for docx to html conversion there also we got the same problem that we were put into below thread. But after installing that symbol font which you provided, that issues seem to be solved. It working there properly. there was same problem that docx file contains embed wmf images and after conversion to html that seem into png as it is.

Thread : Docx conversion to html is not working properly on my Linux Enviorment

My question is if Your Aspose.word for java working properly at the same sharing environment then why not Aspose.imaging working.

Please try to identify that problem at our live environment through programmatically.

From
Nitin Chopkar

Hi Babar,

Please update us regarding my previous post.

From
Nitin Chopkar

Hi Nitin,

First of all, please note that I have split the existing thread to create a new one on your behalf because the title of the previous thread is irrelevant to the issue under discussion. Moreover, the thread was getting two long therefore it was hard to keep track of your inquiries/responses. Please also note that it is always best to create a new thread for each individual inquiry for better visibility.

nitinchopkar:

I am unable to understand where exactly the problem and how you people trying to recognize the problem. Is there any programmatic way to check that required font present or not. What i am feel that while conversion of wmf to png image they are not recognize a font.

Please try to identify that problem at our live environment through programmatically.

I am afraid, the current implementation Aspose.Imaging APIs do not provide any means to dynamically detect the font related issues therefore I have been testing the issue on different flavors of Linux by installing/removing the fonts and executing the conversion.

That said, I have discussed this matter with the product team and we have decided to provide some means to detect the font related problems with Aspose.Imaging APIs for better investigation & troubleshooting. A feature request with Id IMAGING-34977 has been logged in this reference where the ticket details are as follow.

  • Availability of the method that could return the list of fonts used in the metafile.
  • Availability of the method that could return the list of installed fonts or the ones that are accessible to Aspose.Imaging for Java API.
  • Availability of the method that could return the list of fonts that are missing on the machine (or not accessible to Aspose.Imaging for Java API) however, they are required for the conversion process.

Moreover, we are also discussing the possibility to provide a font substitution mechanism that could allow the API to substitute the required font with the one available without requiring manual installation of required fonts, however, the substituted font may have slight visual differences. This discussion is still in progress therefore we will update you once we conclude it.

nitinchopkar:

FYI : we are also using Aspose.Words for java at the same environment for docx to html conversion there also we got the same problem that we were put into below thread. But after installing that symbol font which you provided, that issues seem to be solved. It working there properly. there was same problem that docx file contains embed wmf images and after conversion to html that seem into png as it is.

Thread : https://forum.aspose.com/t/42332

My question is if Your Aspose.word for java working properly at the same sharing environment then why not Aspose.imaging working.

Your comparison of Aspose.Words with Aspose.Imaging APIs is not correct. Please note, in the above mentioned thread, you are converting the DOCX file to HTML where the Aspose.Words for Java API is rendering the text from the DOCX file to HTML. In case of Aspose.Imaging for Java API to convert metafiles to raster images, the API is actually drawing (not rendering) therefore the above mentioned two scenarios are entirely diverse and so does there font usage.

Hi Babar,
Thanks for the looking that issues. We are waiting for your updates on that issues.
From
Nitin Chopkar

Any updates on that issues.

Hi Nitin,


First of all, we are discussing a new feature request and it cannot be implemented over the night. You have to give us ample time to properly analyze the requirement and consequently provide the implementation so please spare us little time. Once we have made significant progress towards achieving the desired goals, we will let you know the release schedule for the fix.

That said, please note that the product team has agreed on providing the font substitution mechanism with Aspose.Imaging for Java APIs under the same ticket as attached to this thread.

Hi again,


This is to update you that we will try our best to provide the three methods discussed here during the upcoming week. Moreover, we are analyzing the request for the font substitution and may split the task if the implementation requires more time. We will keep you posted with updates in this regard.

Hi Babar,
Thanks to attending that problem. We are waiting for your updates on that problem. We expect that you defiantly providing real-able solution on that problem as soon as possible, so that we can move ahead with Aspose.Imaging for java.

From
NItin Chopkar

The issues you have found earlier (filed as IMAGING-34977) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
Hi Nitin,

Please, note that the issue has been fixed. You can download the latest version Aspose.Imaging for Java 3.0.2 from this link.

In case of any issues, please be sure to let us know. We will be more then happy to assist you.

I downloaded updated version and set into our project but still our problem is not resolved. We are getting same that square boxes in-place of math sign into the same environment.

From
Nitin Chopkar


Hi Nitin,

Sorry for the inconvenience caused.

Please, note that the issue has been fixed in the same way as discussed in this thread earlier. The functionality has been introduced to get the font information. Using this feature, you can get a list of fonts used in the metafile, list of fonts that are accessible to Aspose.Imaging API and a list of fonts that are missing with respect to metafile used.

Moreover, a feature has been introduced to specify the font folder. This specified font folder has priority over the default fonts on the system. Last but not the least; you can specify substitute fonts instead of original font. You need to tailor your code logic a bit according to the mentioned functionalities. For more information please visit the links given below.


Hope the above information helps. In case of any issues, please be sure to let us know. We will be glad to assist you.

Hi Babar,

I applied that code which gives font information and got below out put please check it out what is wrong their, i am not understanding that used and missed font.

1. Instruction :

 String[] allFontList = com.aspose.imaging.fileformats.metafile.FontSettings.getAllFonts();
Out put :

FATAL TP-Processor2 AsposeImageConverter - ------------------ All Font ------------
FATAL TP-Processor2 AsposeImageConverter - Andale Mono
FATAL TP-Processor2 AsposeImageConverter - Arial
FATAL TP-Processor2 AsposeImageConverter - Arial Black
FATAL TP-Processor2 AsposeImageConverter - Bitstream Charter
FATAL TP-Processor2 AsposeImageConverter - Bitstream Vera Sans
FATAL TP-Processor2 AsposeImageConverter - Bitstream Vera Sans Mono
FATAL TP-Processor2 AsposeImageConverter - Bitstream Vera Serif
FATAL TP-Processor2 AsposeImageConverter - Century Schoolbook L
FATAL TP-Processor2 AsposeImageConverter - Comic Sans MS
FATAL TP-Processor2 AsposeImageConverter - Courier New
FATAL TP-Processor2 AsposeImageConverter - Dialog
FATAL TP-Processor2 AsposeImageConverter - DialogInput
FATAL TP-Processor2 AsposeImageConverter - Dingbats
FATAL TP-Processor2 AsposeImageConverter - Georgia
FATAL TP-Processor2 AsposeImageConverter - Hershey
FATAL TP-Processor2 AsposeImageConverter - Impact
FATAL TP-Processor2 AsposeImageConverter - Lucida Bright
FATAL TP-Processor2 AsposeImageConverter - Lucida Sans
FATAL TP-Processor2 AsposeImageConverter - Lucida Sans Typewriter
FATAL TP-Processor2 AsposeImageConverter - Monospaced
FATAL TP-Processor2 AsposeImageConverter - Nimbus Mono L
FATAL TP-Processor2 AsposeImageConverter - Nimbus Roman No9 L
FATAL TP-Processor2 AsposeImageConverter - Nimbus Sans L
FATAL TP-Processor2 AsposeImageConverter - Nimbus Sans L Condensed
FATAL TP-Processor2 AsposeImageConverter - SansSerif
FATAL TP-Processor2 AsposeImageConverter - Serif
FATAL TP-Processor2 AsposeImageConverter - Standard Symbols L
FATAL TP-Processor2 AsposeImageConverter - Tahoma
FATAL TP-Processor2 AsposeImageConverter - Times New Roman
FATAL TP-Processor2 AsposeImageConverter - Trebuchet MS
FATAL TP-Processor2 AsposeImageConverter - URW Bookman L
FATAL TP-Processor2 AsposeImageConverter - URW Chancery L
FATAL TP-Processor2 AsposeImageConverter - URW Gothic L
FATAL TP-Processor2 AsposeImageConverter - URW Palladio L
FATAL TP-Processor2 AsposeImageConverter - Utopia
FATAL TP-Processor2 AsposeImageConverter - Verdana
FATAL TP-Processor2 AsposeImageConverter - Webdings

2.Instruction :
com.aspose.imaging.fileformats.metafile.MetafileImage metafile = new com.aspose.imaging.fileformats.metafile.WmfMetafileImage(WMFfilePath);
String[] usedList = metafile.getUsedFonts();
Out put:
FATAL TP-Processor2 AsposeImageConverter - ------------------ All Used Font ------------
FATAL TP-Processor2 AsposeImageConverter - Times New Roman
FATAL TP-Processor2 AsposeImageConverter - Symbol
FATAL TP-Processor2 AsposeImageConverter - System

3.Instruction:
com.aspose.imaging.fileformats.metafile.MetafileImage metafile = new com.aspose.imaging.fileformats.metafile.WmfMetafileImage(WMFfilePath);
String[] missedList = metafile.getMissedFonts();

Out Put:
FATAL TP-Processor2 AsposeImageConverter - ------------------ All Missed Font ------------
FATAL TP-Processor2 AsposeImageConverter - Symbol
FATAL TP-Processor2 AsposeImageConverter - System

Also help me out to understands Specifying Substitute Fonts what is that and how to specify substitute font and when to used that?.

From
Nitin Chopkar

Please update us on my previous post.

From
Nitin Chopkar

Hi Nitin,

All fonts part lists all of the fonts available on your server and can be used in the input WMF. If any of these fonts is used in the input document, it will be rendered correctly in the output document.

Used fonts part lists the fonts used in your input document (whether those are installed or not installed on your server). Missed fonts part lists the fonts which are used in your input document but not installed on your server. You need to install missed fonts on your server to render the documents correctly.

In short you can compare used fonts and missed fonts to check which required fonts are installed on your server and which are not to render your documents correctly.

As far as your second query is concerned, substitute fonts feature allows you to specify the replacement of missing fonts. Lets consider your example where Times New Roman, System and Symbol fonts are used in your input document but System and Symbol are not installed on your server. These two fonts will automatically be replaced with any other font installed on your system.

If you do not want to automatically replace System and Symbol fonts with other fonts, you can use this feature to ask Aspose.Imaging to use your specified font in place of missing System and Symbol fonts.

This feature is useful when you cannot install all required fonts (used in your documents) on your server. Sometimes it is not possible to install all fonts (specially paid fonts) and you want to replace them with some free open source fonts. You can install replacement fonts on your server and use this feature to replace any missing font with an installed font.

Best Regards,

Please guide us, what should we have to do to resolve our problem at live server.

From
Nitin Chopkar

Hi Nitin,

Note that Output of Font Information that you had provided (Link) shows that they are working fine. Use the newly exposed font features on the server where you have already resolved the issue by placing the Symbol.ttf. You will witness that the missing font list function will not list the Symbol font as missing.

There are two new APIs to substitute the font:

1) Font substitution (by font name):
In your particular case, the mathematical symbols such as “+, -, =” are not getting drawn correctly. These symbols are present in the Webdings font. Assuming that the Webdings font is available on your hosted server, your code will look like as follow.

String[] substituteFontName = {"Webdings"};
com.aspose.imaging.fileformats.metafile.FontSettings.addFontSubstitutes("Symbol", substituteFontName );

NOTE: A chart showing images included in Webdings font is attached for your reference

2) Specify Font folder name:
In your case, manually copy the “Symbol.ttf” from the server where you had fixed the issue to the problematic server. Now you can use the following statement.
String folderContainingSymbolFont =””;
com.aspose.imaging.fileformats.metafile.FontSettings.addFontsFolder(folderContainingSymbolFont);
Hope the above information Help, In case of any issues, please be sure to let us know. We will be glad to assist you.

Hi,
I done with below things which you mention in previous post in our problematic server. But still the problem is same. I am unable to understand what should i do? how to detect problem because whatever font you required that installed their. Why that fonts not recognizing by your code.

The things which you asked :

1) Font substitution (by font name):
In your
particular case, the mathematical symbols such as “+, -, =” are not
getting drawn correctly. These symbols are present in the Webdings font.
Assuming that the Webdings font is available on your hosted server,
your code will look like as follow.

String[] substituteFontName = {"Webdings"};
com.aspose.imaging.fileformats.metafile.FontSettings.addFontSubstitutes("Symbol", substituteFontName );

NOTE: A chart showing images included in Webdings font is attached for your reference

2) Specify Font folder name:
In your case, manually copy the “Symbol.ttf” from the server where you had fixed the issue to the problematic server. Now you can use the following statement.
String folderContainingSymbolFont =””;
com.aspose.imaging.fileformats.metafile.FontSettings.addFontsFolder(folderContainingSymbolFont);
Let us know other way to identify the problem.

From
NItin Chopkar
Hi Nitin,

Please, note that the issue is pretty much clear, The fonts are missing.

The information about the fonts that you had provided in this thread earlier show that there are three (3) different fonts namely “Times New Roman”, “Symbol” and “System” are used in your WMF meta file image. Fonts “Symbol” and “System” are missing on the system. You can copy these two (2) fonts from your other server where it is working fine and paste it on to problematic server. Now again run the getUsedFonts() routine and getMissedFonts() routine respectively and share the output with us. This will help us to further analyze the issue.

Hi,

As per your reply I have installed the missing fonts on problematic server.

But it’s still not working.

Out Put :
FATAL TP-Processor3 AsposeImageConverterServlet - com.aspose.imaging.BuildVersionInfo.ASSEMBLY_VERSION : 3.0.2.0
FATAL TP-Processor3 AsposeImageConverterServlet - Can Display + : : true
FATAL TP-Processor3 AsposeImageConverterServlet - Can Display - : : true
FATAL TP-Processor3 AsposeImageConverterServlet - Can Display = : : true
FATAL TP-Processor3 AsposeImageConverter - =========== Aspose Image license done ==========
FATAL TP-Processor3 AsposeImageConverter - ------------------ All Font ------------
FATAL TP-Processor3 AsposeImageConverter - Andale Mono
FATAL TP-Processor3 AsposeImageConverter - Arial
FATAL TP-Processor3 AsposeImageConverter - Arial Black
FATAL TP-Processor3 AsposeImageConverter - Bitstream Charter
FATAL TP-Processor3 AsposeImageConverter - Bitstream Vera Sans
FATAL TP-Processor3 AsposeImageConverter - Bitstream Vera Sans Mono
FATAL TP-Processor3 AsposeImageConverter - Bitstream Vera Serif
FATAL TP-Processor3 AsposeImageConverter - Century Schoolbook L
FATAL TP-Processor3 AsposeImageConverter - Comic Sans MS
FATAL TP-Processor3 AsposeImageConverter - Courier New
FATAL TP-Processor3 AsposeImageConverter - Dialog
FATAL TP-Processor3 AsposeImageConverter - DialogInput
FATAL TP-Processor3 AsposeImageConverter - Dingbats
FATAL TP-Processor3 AsposeImageConverter - Georgia
FATAL TP-Processor3 AsposeImageConverter - Hershey
FATAL TP-Processor3 AsposeImageConverter - Impact
FATAL TP-Processor3 AsposeImageConverter - Lucida Bright
FATAL TP-Processor3 AsposeImageConverter - Lucida Sans
FATAL TP-Processor3 AsposeImageConverter - Lucida Sans Typewriter
FATAL TP-Processor3 AsposeImageConverter - Monospaced
FATAL TP-Processor3 AsposeImageConverter - Nimbus Mono L
FATAL TP-Processor3 AsposeImageConverter - Nimbus Roman No9 L
FATAL TP-Processor3 AsposeImageConverter - Nimbus Sans L
FATAL TP-Processor3 AsposeImageConverter - Nimbus Sans L Condensed
FATAL TP-Processor3 AsposeImageConverter - SansSerif
FATAL TP-Processor3 AsposeImageConverter - Serif
FATAL TP-Processor3 AsposeImageConverter - Standard Symbols L
FATAL TP-Processor3 AsposeImageConverter - Tahoma
FATAL TP-Processor3 AsposeImageConverter - Times New Roman
FATAL TP-Processor3 AsposeImageConverter - Trebuchet MS
FATAL TP-Processor3 AsposeImageConverter - URW Bookman L
FATAL TP-Processor3 AsposeImageConverter - URW Chancery L
FATAL TP-Processor3 AsposeImageConverter - URW Gothic L
FATAL TP-Processor3 AsposeImageConverter - URW Palladio L
FATAL TP-Processor3 AsposeImageConverter - Utopia
FATAL TP-Processor3 AsposeImageConverter - Verdana
FATAL TP-Processor3 AsposeImageConverter - Webdings
FATAL TP-Processor3 AsposeImageConverter - ------------------ All Used Font ------------
FATAL TP-Processor3 AsposeImageConverter - Times New Roman
FATAL TP-Processor3 AsposeImageConverter - Symbol
FATAL TP-Processor3 AsposeImageConverter - System
FATAL TP-Processor3 AsposeImageConverter - ------------------ All Missed Font ------------
FATAL TP-Processor3 AsposeImageConverter - Symbol
FATAL TP-Processor3 AsposeImageConverter - System

Please help out from that problem.

Regards
Anup