Padding in paragraphs.

svn: r2974
This commit is contained in:
Alex Roitman 2004-03-06 02:29:20 +00:00
parent 9b3a933ec4
commit 20406b943c
2 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,7 @@
2004-03-04 Alex Roitman <shura@alex.neuro.umn.edu> 2004-03-04 Alex Roitman <shura@alex.neuro.umn.edu>
* src/docgen/LPRDoc.py: Support for paragraph's margins and * src/docgen/LPRDoc.py: Support for paragraph's margins and
the first indent properties. Font-specific line spacing. the first indent properties. Font-specific line spacing.
Padding in paragraphs.
2004-03-04 Alex Roitman <shura@alex.neuro.umn.edu> 2004-03-04 Alex Roitman <shura@alex.neuro.umn.edu>
* src/docgen/LPRDoc.py: New paragraph formatting algorithm. * src/docgen/LPRDoc.py: New paragraph formatting algorithm.

View File

@ -322,7 +322,8 @@ class GnomePrintParagraph:
end_word = len(textlist) end_word = len(textlist)
self.lines.append((start_piece,start_word,end_piece,end_word,avail_width)) self.lines.append((start_piece,start_word,end_piece,end_word,avail_width))
self.height = nlines * self.fontstyle.get_size() self.height = nlines * self.fontstyle.get_size() \
+ 2 * cm2u(self.style.get_padding())
def get_lines(self): def get_lines(self):
""" """
@ -437,7 +438,7 @@ class LPRDoc(BaseDoc.BaseDoc):
self.__x, self.__y = self.write_paragraph(self.paragraph, self.__x, self.__y = self.write_paragraph(self.paragraph,
self.__x, self.__y, self.__x, self.__y,
self.right_margin - self.left_margin) self.right_margin - self.left_margin)
self.__y = self.__advance_line(self.__y) #self.__y = self.__advance_line(self.__y)
self.paragraph = None self.paragraph = None
def start_bold(self): def start_bold(self):
@ -693,6 +694,9 @@ class LPRDoc(BaseDoc.BaseDoc):
x = left_margin x = left_margin
y = self.__y y = self.__y
if y != self.top_margin:
y = y - cm2u(paragraph.style.get_padding())
# Loop over lines which were assembled by paragraph.format() # Loop over lines which were assembled by paragraph.format()
for (start_piece,start_word,end_piece,end_word,avail_width) \ for (start_piece,start_word,end_piece,end_word,avail_width) \
in paragraph.get_lines(): in paragraph.get_lines():
@ -761,6 +765,7 @@ class LPRDoc(BaseDoc.BaseDoc):
x = left_margin x = left_margin
x = x - cm2u(paragraph.style.get_left_margin()) x = x - cm2u(paragraph.style.get_left_margin())
y = y - cm2u(paragraph.style.get_padding())
return (x,y) return (x,y)
def __output_table(self): def __output_table(self):