We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Small fonts blurry when rendering RTF

Hi,

When rendering RTF, some font sizes seem to be much more blurrier than others.

Attached is an example when almost all text is of size 8.5pt and the blurry text is of size 8pt.

The first picture shows the text rendered by MS Word 2013 and the second by Aspose.Words. The last file is the source document.

How is it possible to improve the rendering?

Thanks for help,

Jaro

Hi Jaro,

Thanks for your inquiry. I have converted the shared document to Pdf and Tiff output and have not found the shared issue. Perhaps, you are using older version of Aspose.Words. I suggest you please use latest version of Aspose.Words for .NET 15.8.0. I have attached the output Pdf document with this post for your kind reference.

Hi,

Sorry, my fault that I haven’t posted also any code snippet. It seems you converted the RTF into PDF, which is then visualized correctly. What we are attempting to do is RTF rasterization into PNG (specific page). Here is a code snippet from our code:

string output = @"c:\temptest";
string file = @"c:\Users\someone\Documents\zle_lorem_ipsum.rtf";
using (Stream s = new FileStream(file, FileMode.Open, FileAccess.Read))
{
    Aspose.Words.License lic = new Aspose.Words.License();
    lic.SetLicense(@"c:\Users\someone\Documents\Aspose.Words.lic");
    // Open the document.
    Aspose.Words.Document doc = new Aspose.Words.Document(s);
    //Create an ImageSaveOptions object to pass to the Save method
    int pageNum = 0;
    ImageSaveOptions options = new ImageSaveOptions(Aspose.Words.SaveFormat.Png);
    options.PageIndex = pageNum;
    options.PageCount = 1;
    options.Resolution = 96;
    options.UseAntiAliasing = true;
    options.UseHighQualityRendering = true;
    doc.Save(Path.Combine(output, Path.ChangeExtension(Path.GetFileName(file), pageNum.ToString() + ".png")), options);
}

We have also downloaded and tried the suggested version and the result was exactly the same as before.

Thanks,

Jaro

Hi Jaro,

Thanks for sharing the detail. I
have converted the shared document to Png using the shared code example. I have not found the shared issue. I have attached the output Png with this post for your kind reference. I have used the ImageSaveOptions.Resolution as 300.

Please let us know if you have any more queries.

Hi Tahir,

Pls, try other image resolutions… we have used 96, as it is displayed on the monitor.

This problem still persists. We have already bought the full version. Currently using version Aspose.Wrods 15.8.0.0.

Thanks and regards,
Jaro

Hi Jaro,

Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for .NET 15.10.0 and have not found the shared issue. Please use Aspose.Words for .NET 15.10.0. We have attached the output png with this post for your kind reference.

Please let us know if you have any more queries.

Hello,

We have tried hard to reproduce both behaviors on several OSes and came to this conclusion:

The error (our case and example picture) is reproducible only on Windows 8+, that is Win 8, Win 8.1, Win 10. The text is rendered normaly (your case and example picture) on Win 7 and Win XP.

We have used Aspose.Words 15.10 in the latest tests.

Can you please try to reproduce it on Win8+ system?

Thanks and regards,
Jaro

Hi Jaro,

Thanks for sharing the detail. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-12767. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Jaro,

Thanks for your patience. It is to inform you that our product team has completed the work on this issue (WORDSNET-12767) and has come to a conclusion that this issue and the undesired behavior you’re observing is actually not a bug in Aspose.Words. So, we have closed this issue as ‘Not a Bug’. We are quoting developer’s comments here for your reference.

We just call default GDI+ function DrawString with some parameters, do not scale them or do something special. Since the problem is not reproducible on systems before Windows 8, I think it’s some bug in new version GDI+ not in Aspose.Words.

You may increase the resolution to get better output. Hope this helps you.

Hi Tahir,

This is very nice, but, sorry, this provides absolutely no resolution to our problem. And the problem is still there. Maybe the “some parameters” are not the right ones for newer systems? The problem is reproducible on newer systems (now/soon the majority of Windows systems used), so please try to find a solution.

Now to your suggestion: Should we tell the user to use 1-inch letters on his/her monitor just to be able to read the text normally? This isn’t the way either…

Please, provide us at least some kind of workaround (like Windows tweak) so that it behaves consistently.

Thanks and regards,
Jaro

Hi Jaro,

Thanks for your inquiry. As shared in my previous post that this issue is not related to Aspose.Words. Please read the detail in my previous post.

We have converted the shared Rtf to Png with 300 resolution at Windows 10 and have not found the shared blurry issue. Please check the attached output png for your kind reference.

Document doc = new Document(MyDir + "in.rtf");
ImageSaveOptions options = new ImageSaveOptions(Aspose.Words.SaveFormat.Png);
options.PageIndex = 0;
options.PageCount = 1;
options.Resolution = 300;
options.UseAntiAliasing = true;
options.UseHighQualityRendering = true;
doc.Save(MyDir + "Out.png", options);

Hello Tahir,

Again, 300dpi won’t help us… We need 96, which is the default form most monitors.

Here are some very good articles which describe the merit of the problem and possible solutions and comparisons of results using different techniques:

http://theartofdev.com/2014/03/02/blurryfuzzy-gdi-text-rendering-using-antialias-and-floating-point-y-coordinates/

http://theartofdev.com/2014/04/21/text-rendering-methods-comparison-or-gdi-vs-gdi-revised/

Hope this helps your developers to make the visual quality much better…

Regards,

Jaro

Hi Jaro,

Thanks for your inquiry. Our product team completed the analysis of this issue and come to conclusion that this is not a bug in Aspose.Words. We just call default GDI+ function DrawString with some parameters. The problematic text has lower font size and this is how GDI+ renders it. This issue does not reproduce on systems before Windows 8. So, it is related to new GDI+ version.

Please let us know if you have any more queries.

Hi Tahir,

Again, send these articles to your dev team:
https://theartofdev.com/2014/03/02/blurryfuzzy-gdi-text-rendering-using-antialias-and-floating-point-y-coordinates/

That’s a long title that perfectly captures another issue I have found with GDI+ text rendering. While checking Kris’s claim on text rendering using GraphicsPath1 I have noticed th…
https://theartofdev.com/2014/04/21/text-rendering-methods-comparison-or-gdi-vs-gdi-revised/

In this post, hopefully the last on this subject1, I’m going to compare the different text rending methods available for Windows .NET application for standard resolution devices2. I dec…

to let them reevaluate this issue. This is not closed for us.

Thanks,
Jaro

Hi Jaro,

Thanks for your inquiry. We have shared this detail with our product team. Once we have any information about your issue, we will update you via this forum thread.

Hi Jaro,

Thanks for your patience. We have received response from our product team. Please check attached output images and let us know if you are satisfied with one of this outputs.

Will it be good for you if we add two new options (SmoothingMode and text rendering method) to ImageSaveOptions class for control of string drawing? Please share your feedback.

Hi Tahir,

Oh, nice. Yes, it will help us greatly. And not only to us, I believe…

I would suggest to add it to all rendering (even on screen or for printing).

Thanks and regards,
Jaro

Hi Jaro,

Thanks for your feedback. We will update you via this forum thread once this new feature is available. Thanks for your patience and understanding.

Hello Tahir,

Can you please let us know when is this feature planned for release?

Thanks,
Jaro

Hi Jaro,

Thanks for your inquiry. The issue (WORDSNET-13010) is under development phase. Hopefully, the fix of this issue will be available in April 2016 release. Please note that this estimate is not final at the moment. We will be sure to inform you via this forum thread as soon as this issue is resolved.

We appreciate your patience.