PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Arabic text draw problem
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1290
Page 1 of 1

Author:  jccapps [ Thu Aug 05, 2010 2:14 pm ]
Post subject:  Arabic text draw problem

I am currently having some problems drawing with Arabic text. If I use the DrawString() approach of drawing the text then everything looks correct (I can't read Arabic but it matches the bitmap of what the client said it should look like).

However, I also have the requirement of drawing a halo behind the text. To do this I add the text to a graphics path and then use DrawPath() to render the text. When I do this, the spacing between the characters are incorrect and the text is drawn backwards.

I believe read in another post that there is some problem with Arabic text. Is this part of the problem, or am I doing something wrong in the code?

//create the font
XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode);
XFont pdfFont = new XFont(faceName, height, fontStyle, options);

...

if (objHaloGMMPPenWrapper != null)
{
...

XGraphicsPath xgp = new XGraphicsPath();
xgp.AddString(text, pdfFont.FontFamily, pdfFont.Style, height, haloPoint, XStringFormats.Default);
xgp.FillMode = XFillMode.Winding;

//draw the halo
if (orientation != 0)
{
gfx.RotateAtTransform(orientation, pdfPoint);
gfx.DrawPath(haloPen, haloBrush, xgp);
//we will also have to take a glyph approach to drawing the actual text
//the PDF Text Rendering and Path Rending do not match if the text has a style
gfx.DrawPath(textPen, pdfBrush, xgp);
gfx.RotateAtTransform(-orientation, pdfPoint);
}
else
{
...
}
}

Thanks
Craig

Author:  () => true [ Sun Aug 08, 2010 8:52 am ]
Post subject:  Re: Arabic text draw problem

jccapps wrote:
I believe read in another post that there is some problem with Arabic text.

That's not my area of expertise.
PDFsharp doesn't yet support right-to-left character sets.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/