[reportlab-users] Verdana font

Tim Roberts reportlab-users@reportlab.com
Tue, 02 Dec 2003 09:19:26 -0800

On Mon, 1 Dec 2003 19:03:23 -0800 (PST), Donny Marthen Sitompul
<dmarthen@yahoo.com> wrote:
>Has anyone been successful in setFont("Verdana",size)
>I have done commenting out the verdana mapping in
>fonts.py and have manually do
>'verdana.ttf') and addMapping('Verdana',0,0,'Verdana')
>after I copied the verdana.ttf file from my fonts dir
>in Win root to reportlab/fonts.
>The result was :
>FutureWarnings in line 309 and 162 out of ttfonts.py 

FutureWarnings are just that: warnings.  They do not affect the execution
of the code.

In this case, the warnings are caused by bit manipulations that assume
32-bit integers.  There are a couple of ways to eliminate the warnings, if
you really want to.  One way is to convert the computation to a long
integer by appending an "L" to one of the constant operands.  Another way
(probably the better way) is to use the struct.pack and struct.unpack
calls.  For example, the function at line 306 could be written this way:

def read_ulong(self):
    self._pos = self._pos + 4
    return struct.unpack(">4B",self._data[self._pos-4:self._pos])[0]

The same kind of thing should be applied to get_ulong.

- Tim Roberts, timr@probo.com
  Providenza & Boekelheide, Inc.