[reportlab-users] RTL Patch Committed
    Hosam Aly 
    haly at centrivision.com
       
    Mon Nov 23 10:06:16 EST 2009
    
    
  
Robin Becker wrote:
> Hosam Aly wrote:
>> Robin Becker wrote:
>>
> ...........
>>
>> Hello Robin. I am thinking about using UTF-16 because, I guess, we 
>> would be writing character points instead of font code points. When 
>> we are using font code points, the reader has no option but to render 
>> the font glyphs that we wrote. I wanted to see, if we used character 
>> points instead, whether the reader would be smart enough to do the 
>> shaping itself.
>>
>>
> .........
> I think that is right, but then the font has somehow to be known to 
> Acrobat Reader. I know this works in the CJK case for the places where 
> pdfdoc encoding would normally be used. UTF16 is required because the 
> fonts for the standard document annotations are not declared so the 
> fonts have to be standard.
>
> If you modify the test_hello.py test file ie
>
> change line 19 to
>
> c.setAuthor(u'\u0643\u0644\u0627\u0645 \u0639\u0631\u0628\u064a')
>
> then in the document properties you will see that Acrobat Reader does 
> get the visual reversal and character shaping correct (tested in 
> ubuntu and windows).
>
> However, I haven't declared any font there so presumably Acrobat is 
> using some standard system font.
I have tried changing the author text, and it worked as you said, but 
that's probably irrelevant to PDF rendering. The text is being shown in 
a text box, which uses the platform's APIs (Windows, GTK, etc.) to do 
the rendering, and those APIs automatically handle bidirectionality and 
character shaping.
What I really want to do is to get a UTF-16 sequence of characters 
inside the brackets of a BT tag, to get something similar to this:
BT
    /F13 12 Tf
    288 720 Td
    (\xff\xfe-\x063\x06'\x06E\x06) Tj
ET
(using a font that supports Arabic characters)
So I was wondering how I could get ReportLab to write a similar string 
into the PDF. I wish to know which method(s) I should be calling, or 
where to edit in ReportLab's code to test my hypothesis.
Thank you,
Hosam Aly
Software Engineer
Centrivision
    
    
More information about the reportlab-users
mailing list