Umlaut Bug with Adobe Reader and Arial
Volker Haas <[email protected]>
| Newsgroups | gmane.comp.python.reportlab.user |
|---|---|
| Message-ID | <[email protected]> |
Hi, I discovered a problem which only occurs under very specific circumstances. Umlaut dots are "shifted" notably when using *bold* Arial font and viewing the PDF with Adobe Reader (Version 11.0.06 in Windows 7). Even more strange is the fact that the rendering is fine when magnifying the PDF to 800%. The PDF looks good with other PDF Viewers. Rendering was done with the latest reportlab version in Linux(Ubuntu) with the attached script (the Arial font was pulled from a Windows Installation). I have uploaded the resulting/faulty PDF to http://pediapress.com/files/rl/broken_umlauts.pdf I have no idea if this is a bug in reportlab, but I would expect Arial to work fine in PDFs in general. Does anybody have any thoughts on this? (google wasn't helpful) Best Regards, Volker -- PGP Key: http://pool.sks-keyservers.net:11371/pks/[email protected]&fingerprint=on Volker Haas Senior Developer brainbot technologies ag Taunusstraße 61 55120 Mainz Phone: +49 (0)6131 2116394
broken_umlauts.py
(text/x-python, 1.1 KB)
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from reportlab.platypus import Paragraph, SimpleDocTemplate
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfbase import pdfmetrics
styles = getSampleStyleSheet()
style = styles['Normal']
pdfmetrics.registerFont(TTFont('Arial', 'arial/Arial.ttf'))
pdfmetrics.registerFont(TTFont('ArialBold', 'arial/Arial_Bold.ttf'))
pdfmetrics.registerFont(TTFont('ArialItalic', 'arial/Arial_Italic.ttf'))
pdfmetrics.registerFont(TTFont('ArialBoldItalic', 'arial/Arial_Bold_Italic.ttf'))
pdfmetrics.registerFontFamily('Arial',
normal='Arial',
bold='ArialBold',
italic='ArialItalic',
boldItalic='ArialBoldItalic')
style.fontName = 'Arial'
doc = SimpleDocTemplate('broken_umlauts.pdf')
story = [Paragraph('test öäü', style),
Paragraph('<b>test öäü</b>', style),
Paragraph('<i>test öäü</i>', style),
Paragraph('<b><i>test öäü</i></b>', style)
]
doc.build(story)