Textrenderinghint=antialiasing does not work with metafile

Posted on 2009-05-14
Last Modified: 2012-06-21
I created a metafile containing a chart in I set the TextRenderingHint to AntiAlias. When I display the metafile, the text quality is very poor. If I use the FillRectange to fill the bounds of the chart to White, the text looks great. Unfortunately, I cannot always fill the background with white. Is there an alternative way to display the metafile so the text looks good?
Question by:JerryHintze
  • 4
  • 2
LVL 39

Expert Comment

ID: 24390514
Did you use ImageFormat.Wmf? Because that's the old (from windows 3.0, 16 bit) format. The format you are probably after is ImageFormat.Emf, which works perhaps better.
LVL 39

Expert Comment

ID: 24391001
Not sure whether this is applicable or not, but from tthe EMF specs I get that it still depends (on whether the font supposrts it or not). This is what MS specs says if you use AntiAliased or ClearType:

ANTIALIASED_QUALITY: Specifies that anti-aliasing SHOULD be used when rendering text, if the font supports it.<10>
CLEARTYPE_QUALITY: Specifies that ClearType anti-aliasing SHOULD be used when rendering text, if the font supports it. <11>Fonts that do not support ClearType anti-aliasing include type 1 fonts, PostScript fonts, OpenType fonts without TrueType outlines, rasterized fonts, vector fonts, and device fonts.

Author Comment

ID: 24391119
I'm using the emf format, not the wmf. I'm using Arial, Times Roman, Tahoma fonts which shouldn't have a problem. The crazy thing is, if I fill the background with a white rectangle, it works. If I don't, it doesn't. I guess I just have to have a background for anti-aliasing to work.
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 39

Expert Comment

ID: 24391219
You are apparently not alone. It seems that some programs don't write the antialiased records, but even if, then there are many programs that do not read that record. You may try EMFExplorer to actually find out whether the records are available and how it looks using GDI or GDI+:

You may also check out this thread, which seems to express the same problem, but unfortunately without a solution:

Author Comment

ID: 24397107
I found that my problem occurred from using TextRendingHint = ClearTypeGridFit. When I set this option to AntiAlias, the text is displayed fine.
LVL 39

Accepted Solution

abel earned 500 total points
ID: 24397363
Ah, good. Interesting, because in your original question you said "Textrenderinghint=antialiasing" and I assumed normal antialiasing. ClearType must be supported by the font, and you use a TrueType font. Hence the situation.

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question