Skip to content

ImageFont.truetype problem #50

@paapu88

Description

@paapu88

Dear Developers,
I have Ubuntu 20.04
python 3.8.5
pycoast==1.4.0

I followed:
https://github.com/pytroll/pycoast/blob/master/docs/source/graticule.rst

This did work fine:

 img = Image.open(os.path.join(outDir, outFileName))
 cw = ContourWriterAGG('/home/hu-mka/git/cyclonesatpy/cyclonesatpy/dev/shapefiles/')
 font=aggdraw.Font('black', '/usr/share/fonts/truetype/ubuntu/Ubuntu-B.ttf',opacity=127, size=16)
 cw.add_coastlines(img, areadef, resolution='l', level=4, outline=(255, 0, 0))
 cw.add_grid(img, areadef, (2.0, 2.0), (1.0, 1.0), font, fill='blue',
 outline = 'blue', minor_outline = 'blue')

But if i replace font by:
font = ImageFont.truetype('/usr/share/fonts/truetype/freefont/FreeSans.ttf', 16)
I get:

TypeError: text() argument 2 must be Font, not FreeTypeFont
Terveisin, Markus

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions