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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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.
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

627 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