string containing ampersand generates ParaFrag in Paragraph.breakLines().lines

Bug #1100433 reported by Elena Williams
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-reportlab (Ubuntu)
New
Undecided
Unassigned

Bug Description

from reportlab.platypus import Paragraph
from reportlab.lib.styles import ParagraphStyle

## Expected behaviour:

STRING_GOOD = 'x x'
para = Paragraph(STRING_GOOD, ParagraphStyle('default'))
para.width = 500

plines = para.breakLines(500)
plines.lines
# Out: [(487.22, ['x', 'x'])]

## Unexpected behaviour:

STRING_ODD = 'x & x'
para2 = Paragraph(STRING_ODD, ParagraphStyle('default'))
para2.width = 500

plines2 = para2.breakLines(500)
plines2.lines
# Out: [ParaLines(ascent=7.18, descent=-2.07, extraSpace=487.22, fontSize=10, wordCount=2, words=[ParaFrag(bold=0, bulletText=None, fontName='Helvetica', fontSize=10, greek=0, italic=0, link=None, rise=0, strike=0, sub=0, super=0, text='x x', textColor=Color(0,0,0,1), underline=0)])]

---

#: para
# Out: Paragraph('style': <ParagraphStyle 'default'>
'bulletText': None 'text': 'x x' 'encoding': 'utf8' 'height': 0 'caseSensitive': 1 'debug': 0
'frags': [ParaFrag(bold=0, fontName='Helvetica', fontSize=10, greek=0, italic=0, link=None, rise=0, strike=0, sub=0, super=0, text='x x', textColor=Color(0,0,0,1), underline=0)]
'width': 500) #Paragraph

#: para2
# Out: Paragraph('style': <ParagraphStyle 'default'>
'bulletText': None 'text': 'x & x' 'encoding': 'utf8' 'height': 0 'caseSensitive': 1 'debug': 0
'frags': [ParaFrag(bold=0, fontName='Helvetica', fontSize=10, greek=0, italic=0, link=None, rise=0, strike=0, sub=0, super=0, text='x ', textColor=Color(0,0,0,1), underline=0),
ParaFrag(bold=0, fontName='Helvetica', fontSize=10, greek=0, italic=0, link=None, rise=0, strike=0, sub=0, super=0, text=' x', textColor=Color(0,0,0,1), underline=0)]
'width': 500) #Paragraph

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.