Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Textrenderinghint=antialiasing does not work with metafile

Posted on 2009-05-14
6
Medium Priority
?
801 Views
Last Modified: 2012-06-21
I created a metafile containing a chart in vb.net. 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?
0
Comment
Question by:JerryHintze
  • 4
  • 2
6 Comments
 
LVL 39

Expert Comment

by:abel
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.
0
 
LVL 39

Expert Comment

by:abel
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.
source: http://msdn.microsoft.com/en-us/library/cc215212.aspx.
0
 

Author Comment

by:JerryHintze
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.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 39

Expert Comment

by:abel
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+: http://frazmitic.free.fr/emfexplorer/

You may also check out this thread, which seems to express the same problem, but unfortunately without a solution: http://www.eggheadcafe.com/conversation.aspx?messageid=29400144&threadid=29400136
0
 

Author Comment

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

Accepted Solution

by:
abel earned 2000 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.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Integration Management Part 2
Screencast - Getting to Know the Pipeline

569 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