views:

29

answers:

1

Are there any additional properties or parms in the DrawString to solve this problem. I have a Hebrew font with many zero-width characters so that two characters should render in the same location.

This example shows the .NET problem on the left, and what is should look like on the right:

http://hebrewresources.com/html5/images/rendering_issue.png

Word and Visual Studio text boxes render the same way, but in SumTotal'sToolbook, it renders correctly.

This is actually a very old true-type font from over 15 years ago, and it's not even right-to-left. I may switch to newer font, but then I would have to write a program to remap every character and vowel.

objGraphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
objGraphics.DrawString(text, objFont, Brushes.Black, border / 2, border / 2);
A: 

You will have to:

objGraphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
var stringFormat = new StringFormat(StringFormatFlags.DirectionRightToLeft);
float x = border / 2;
float y = border / 2;
objGraphics.DrawString(text, objFont, Brushes.Black, x, y, stringFormat);

If it doesn't work, you will have to try other flags:

http://msdn.microsoft.com/en-us/library/system.drawing.stringformatflags(v=VS.71).aspx

Jader Dias
Like I said, my font was really created before right-to-left fonts existed, I just now tried that option, and nothing printed at all. I also tried NoWrap, NoFontFallback, NoFit, and FitBlackBox. They all print letters, but looks same as in my original post.
NealWalters