pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Lehmkuehler <andr...@lehmi.de>
Subject Re: Help needed to resolve issue with converting Arabic characters to presentation forms
Date Sat, 18 Feb 2012 19:28:27 GMT
Hi,

Am 18.02.2012 18:52, schrieb Hamed Iravanchi:
> Hi again.
>
> Thanks for ur attention to the issue.
> I actually checked,  and saw that the font itself (ttf stream) contains the
> correct cmap. If we can draw the text using glyph ID instead of
> characters,  the font knows the right characters to draw.
>
> I checked the Font class instance in the debugger,  it contains a cmap
> which is exactly right. First I was looking for ways to take the mapping
> from the font (since it is private member,  specific to Sun impl).
>
> But I realized we could ask the font to draw glyphs instead of characters.
> But i couldn't still find a right way to draw a glyph on graphics.
That's exactly what I'm doing. It somehow lokks like the following:

Create the needed glyphs:

FontRenderContext frc = new FontRenderContext(null, true, true);
int stringLength = CIDstring.length();
int[] codePoints = new int[stringLength];
for (int i=0;i<stringLength;i++)
    codePoints[i] = CIDstring.codePointAt(i);
GlyphVector glyphs = awtFont.createGlyphVector(frc, codePoints);

...

Draw the glyphs:

g2d.drawGlyphVector(glyphs, x, y);

> BTW,  I also can do the implementation and send u a patch once I realize
> what to do. Thanks for ur encouragement :-)
Thanks for the offer, I'm already on that, I just have to clean up the code and 
to run some tests to avoid unwanted side effects.
Once my code is available you might want to doublecheck it.

> - Hamed
>   On Feb 18, 2012 7:05 PM, "Andreas Lehmkuehler"<andreas@lehmi.de>  wrote:
>
<SNIP>

BR
Andreas Lehmkühler

Mime
View raw message