[Bug 1100433] [NEW] string containing ampersand generates ParaFrag in Paragraph.breakLines().lines

Elena Williams ele.wil at gmail.com
Wed Jan 16 19:39:58 UTC 2013


Public bug reported:

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

** Affects: python-reportlab (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python-reportlab in Ubuntu.
https://bugs.launchpad.net/bugs/1100433

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

Status in “python-reportlab” package in Ubuntu:
  New

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 manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-reportlab/+bug/1100433/+subscriptions




More information about the foundations-bugs mailing list