On 1/26/2012 1:13 PM, Paul McNett wrote:
>> the problem when i tried the Report Designer arabic text becomes
>> squres when previewed...i think it's from ReportLab ...
> It is because by default reportlab (and dabo report designer) uses Type 1
> Times,
> Helvetica, and Courier fonts. These fonts don't have very many special
> characters
> defined at all, so they are only really useful as default fonts for American
> English
> countries.
>
> You'll have to find a TrueType font or fonts that support the characters you
> want to
> print, put them in your app's resources/ directory, and tell reportlab about
> them.
>
> Add a 'registerFonts.py' script in your application's home directory, with
> these
> contents:
>
> {{{
> import os
> from reportlab.pdfbase import pdfmetrics
> from reportlab.pdfbase.ttfonts import TTFont
>
> def registerFonts(homedir):
> for fname in os.listdir(os.path.join(homedir, "resources")):
> name, ext = os.path.splitext(fname)
> if ext == ".ttf":
> #print "registering %s..." % name
> pdfmetrics.registerFont(TTFont(name, os.path.join(homedir,
> "resources", fname)))
>
> }}}
>
> And somewhere in the initialization of your application (main.py file or dApp
> subclass, for instance) make the call:
>
> {{{
> from registerFonts import registerFonts
> registerFonts(app.HomeDirectory)
> }}}
>
> And now, in your reports, modify Reports.Defaults.FontName to be the name of
> the true
> type font you want your objects to use by default. Or, modify each string
> object
> individually.
Paul,
I suggest we integrate this script into dabo so in the future all you
have to do is drop the font into the resources directory.
Regards,
Nate
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]