当前位置: 首页>>代码示例>>Python>>正文


Python ParagraphStyle.fontSize方法代码示例

本文整理汇总了Python中reportlab.lib.styles.ParagraphStyle.fontSize方法的典型用法代码示例。如果您正苦于以下问题:Python ParagraphStyle.fontSize方法的具体用法?Python ParagraphStyle.fontSize怎么用?Python ParagraphStyle.fontSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在reportlab.lib.styles.ParagraphStyle的用法示例。


在下文中一共展示了ParagraphStyle.fontSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _prepare_styles

# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import fontSize [as 别名]
def _prepare_styles():
	styles = {}
	stylesheet = getSampleStyleSheet()

	style = ParagraphStyle("Normal", stylesheet['Normal'])
	style.alignment = TA_LEFT
	style.fontSize = 6
	style.fontName = 'FreeSans'
	style.leading = 8
	styles['Normal'] = style

	style = ParagraphStyle("ItemTitle", stylesheet['Heading1'])
	style.alignment = TA_LEFT
	style.fontSize = 8
	style.fontName = 'FreeSansBold'
	style.fontSize = 10
	styles['ItemTitle'] = style

	style = ParagraphStyle("Heading", stylesheet['Heading2'])
	style.alignment = TA_CENTER
	style.fontSize = 6
	style.fontName = 'FreeSansBold'
	styles['Heading'] = style

	style = ParagraphStyle("FieldHead", stylesheet['Heading2'])
	style.alignment = TA_LEFT
	style.fontSize = 6
	style.fontName = 'FreeSansBold'
	style.leading = 8
	styles['FieldHead'] = style

	return styles
开发者ID:KarolBedkowski,项目名称:alldb,代码行数:34,代码来源:pdf_support.py

示例2: _add_secondary_scale

# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import fontSize [as 别名]
    def _add_secondary_scale(self):
        """ add the secondary scale to the table (text + styles) """

        Y_pos = 1
        X_pos = 1

        # write the label
        ps = ParagraphStyle("secondary_scale_label")
        ps.alignment = TA_RIGHT
        ps.fontName = self.DEFAULT_FONT
        ps.fontSize = self.DEFAULT_FONT_SIZE

        title = Paragraph(self.data.scale.secondary_label, ps)
        self.table[Y_pos][0] = title

        ps = ParagraphStyle("secondary_scale")
        ps.alignment = TA_CENTER
        ps.fontName = self.DEFAULT_FONT
        ps.fontSize = self.DEFAULT_FONT_SIZE

        # the secondary scale is not define the same way as the primary scale.
        # it's defined by groups of same label. (start_pos, start_end, item)
        # see ScaleData._group_scale() for details
        for group in self.data.scale.secondary_scale_groups:
            pos_start, pos_end, item = group
            p = Paragraph(item, ps)

            # draw the label in the middle of the similar cells
            self.table[Y_pos][int((pos_start + pos_end) / 2) + 1] = p

            # draw light border arrounds items
            self.styles.append(("BOX", (pos_start + X_pos, Y_pos), (pos_end + X_pos, Y_pos), 0.2, "#bbbbbb"))
开发者ID:dxyuniesky,项目名称:openerp-extra-6.1,代码行数:34,代码来源:timebox_chart.py

示例3: drawText

# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import fontSize [as 别名]
	def drawText(self,txt,x,y,w,h,style={}):
		margin = 0
		self.canvas.saveState()
		path = self.canvas.beginPath()
		path.rect(x,y,w,h)
		self.canvas.clipPath(path,stroke=1)
		_s = styles['BodyText']
		_s = ParagraphStyle({})
		_s.fontSize = style['fontSize']*1.0
		# _s.fontSize = style['fontSize']
		_s.leading = style['fontSize']
		print _s
		print 'writing text',txt,x,y
		while _s.fontSize > 1.0:
			p = Paragraph(txt.strip(),_s)	
			aw,ah =  p.wrapOn(self.canvas,w-margin*2,h-margin*2)
			print aw,w-margin*2,ah,h-margin*2,_s.fontSize
			break
			if (aw > w-margin*2) or (ah > h-margin*2):
				_s.fontSize = _s.fontSize - 1
				_s.leading = _s.fontSize*1.9
			else:
				break
		p.drawOn(self.canvas,x+margin,y+margin)
		self.canvas.restoreState()
开发者ID:shivanan,项目名称:labelmaker,代码行数:27,代码来源:makelabels.py

示例4: render_card_pdf

# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import fontSize [as 别名]
def render_card_pdf(card, filename):
    # set up styles
    regular = ParagraphStyle('default')
    regular.fontName = 'Helvetica'
    regular.fontSize = 9
    regular.leading = 11
    
    small = ParagraphStyle('default')
    small.fontName = 'Helvetica'
    small.fontSize = 7
    small.leading = 9
    
    large = ParagraphStyle('default')
    large.fontName = 'Helvetica'
    large.fontSize = 11
    large.leading = 13
    
    text = []
    
    # generate content
    address_template = Template(address_format)
    
    # return address
    text.extend([Paragraph(address_template.render(Context({
        'name': card.sender_name,
        'address1': card.sender_address1,
        'address2': card.sender_address2,
        'city': card.sender_city,
        'state': card.sender_state,
        'zip': card.sender_zip,
    })), small), Spacer(10, 10)])
    
    text.append(Paragraph(strip_tags(card.message).replace('\n', '<br />'), regular))
        
    text.extend([Spacer(10, 10), HR(0.5), Spacer(10, 10)])
    text.append(Paragraph('The Sunlight Foundation is a non-partisan non-profit that uses cutting-edge technology and ideas to make government transparent and accountable. Visit SunlightFoundation.com to learn more.', small))
    
    canv = Canvas(filename)
    canv.setPageSize((6.25 * inch, 4.5 * inch))
    
    f = Frame(0.375 * inch, 0.75 * inch, 3.125 * inch, 3.375 * inch, showBoundary=0)
    
    f.addFromList(text, canv)
    
    address = Frame(3.75 * inch, 1 * inch, 2 * inch, 1.5 * inch, showBoundary=0)
    address.addFromList([Paragraph(address_template.render(Context({
        'name': card.recipient_name,
        'address1': card.recipient_address1,
        'address2': card.recipient_address2,
        'city': card.recipient_city,
        'state': card.recipient_state,
        'zip': card.recipient_zip,
    })), large)], canv)
    
    canv.save()
开发者ID:thefuturewasnow,项目名称:brisket,代码行数:57,代码来源:cards.py

示例5: drawHeader

# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import fontSize [as 别名]
	def drawHeader(self, canvas, doc):
		logo_path = os.path.join(settings.STATIC_ROOT, 'assets/escudo.jpg')
		logo = Image(logo_path, width=0.7*inch, height=0.7*inch)

		title_style = ParagraphStyle(name='Title')
		title_style.fontName = 'Helvetica-Bold'
		title_style.fontSize = 11
		title_style.alignment = TA_CENTER
		
		subtitle_style = ParagraphStyle(name='Subtitle')
		subtitle_style.fontName = 'Helvetica'
		subtitle_style.fontSize = 8
		subtitle_style.alignment = TA_CENTER

		subtitle2_style = ParagraphStyle(name='Subtitle2')
		subtitle2_style.fontName = 'Helvetica'
		subtitle2_style.fontSize = 8
		subtitle2_style.alignment = TA_CENTER

		subtitle3_style = ParagraphStyle(name='Subtitle3')
		subtitle3_style.fontName = 'Helvetica'
		subtitle3_style.fontSize = 8
		subtitle3_style.alignment = TA_CENTER

		subtitle4_style = ParagraphStyle(name='Subtitle4')
		subtitle4_style.fontName = 'Helvetica'
		subtitle4_style.fontSize = 8
		subtitle4_style.alignment = TA_CENTER

		data = [
			[logo, [
					Paragraph('INSTITUCION EDUCATIVA AUGUSTO ESPINOSA VALDERRAMA', title_style),
					Paragraph('Reconocido oficialmente por la Secretaría de Educación Municipal de Montería mediante resolución 0751 de junio 12 de 2009', subtitle_style),
					Paragraph('Corregimiento Santa Clara – Municipio de Montería', subtitle2_style),
					Paragraph('Tel. 7905949 Código DANE 223001005404', subtitle3_style),
					Paragraph('Nit 812007342', subtitle4_style)
				]
			]
		]
		LIST_STYLE = TableStyle([
			# ('INNERGRID', (0,0), (-1,-1), 0.25, colors.black),
			# ('BOX', (0,0), (-1,-1), 0.25, colors.black),
			('TEXTCOLOR',(0,0),(-1,-1),colors.black),
			('ALIGN', (0,0), (-1,-1), 'CENTER'),
			('FONTSIZE', (-1, -1), (-1, -1), 8),
			('VALIGN',(0,0),(-1,-1),'MIDDLE'),
			('TOPPADDING', (0, 0), (-1, -1), 0),
			('BOTTOMPADDING', (0, 0), (-1, -1), 0),
			('LEFTPADDING', (0, 0), (-1, -1), 0),
			('RIGHTPADDING', (0, 0), (-1, -1), 0),
		])
		colWidths = [0.7*inch, '*']
		table = Table(data, colWidths=colWidths, style=LIST_STYLE)
		w, h = table.wrap(doc.width, 0)
		table.drawOn(canvas, doc.leftMargin + 5, doc.height + 150)
开发者ID:dairdr,项目名称:notes,代码行数:57,代码来源:log.py

示例6: main_data

# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import fontSize [as 别名]
def main_data(tutor, academic_year, session_exam, styles, learning_unit_year, pgm, content):
    content.append(SMALL_INTER_LINE)
    p_structure = ParagraphStyle('entete_structure')
    p_structure.alignment = TA_LEFT
    p_structure.fontSize = 10

    p = ParagraphStyle('entete_droite')
    p.alignment = TA_RIGHT
    p.fontSize = 10

    content.append(Paragraph('%s : %s' % (_('Academic year'), str(academic_year)), p))
    content.append(Paragraph('Session : %d' % session_exam.number_session, p))
    content.append(BIG_INTER_LINE)

    if pgm.structure is not None:
        content.append(Paragraph('%s' % pgm.structure, p_structure))
        content.append(SMALL_INTER_LINE)

    content.append(Paragraph("<strong>%s : %s</strong>" % (learning_unit_year.acronym,learning_unit_year.title), styles["Normal"]) )
    content.append(SMALL_INTER_LINE)

    tutor = None
    if tutor is None:
        p_tutor = Paragraph(''' ''' , styles["Normal"])
    else:
        p_tutor = Paragraph('''<b>%s %s</b>''' % (tutor.person.last_name, tutor.person.first_name), styles["Normal"])

    data_tutor= [[p_tutor],
       [''],
       [''],
       ['']]
    table_tutor=Table(data_tutor)
    p_pgm = Paragraph('''<b>%s : %s</b>''' % (_('Program'),pgm.acronym), styles["Normal"])
    data_pgm= [[p_pgm],
               [_('Deliberation date') + ' : '],
               [_('Chair of the exam board') + ' : '],
               [_('Exam board secretary') + ' : '],
              ]
    table_pgm=Table(data_pgm)
    table_pgm.setStyle(TableStyle([
    ('LEFTPADDING',(0,0),(-1,-1), 0),
                         ('RIGHTPADDING',(0,0),(-1,-1), 0),
                       ('VALIGN',(0,0), (-1,-1), 'TOP')
                       ]))
    dataTT = [[table_pgm,table_tutor]]

    tt=Table(dataTT, colWidths='*')
    tt.setStyle(TableStyle([
        ('LEFTPADDING',(0,0),(-1,-1), 0),
                             ('RIGHTPADDING',(0,0),(-1,-1), 0),
                       ('VALIGN',(0,0), (-1,-1), 'TOP')
                       ]))
    content.append(tt)
    content.append(Spacer(1, 12))
开发者ID:fthuin,项目名称:osis,代码行数:56,代码来源:pdf_utils.py

示例7: tabla_detalle

# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import fontSize [as 别名]
 def tabla_detalle(self):
     requerimiento = self.requerimiento
     encabezados = ['Nro', 'Cantidad', 'Unidad', u'Descripción', 'Uso']
     detalles = DetalleRequerimiento.objects.filter(requerimiento=requerimiento)
     sp = ParagraphStyle('parrafos')
     sp.alignment = TA_JUSTIFY
     sp.fontSize = 8
     sp.fontName = "Times-Roman"
     lista_detalles = []
     for detalle in detalles:
         tupla_producto = [Paragraph(str(detalle.nro_detalle), sp),
                           Paragraph(str(detalle.cantidad), sp),
                           Paragraph(detalle.producto.unidad_medida.descripcion, sp),
                           Paragraph(detalle.producto.descripcion, sp),
                           Paragraph(detalle.uso, sp)]
         lista_detalles.append(tupla_producto)
     adicionales = [('', '', '', '', '')] * (15 - len(detalles))
     tabla_detalle = Table([encabezados] + lista_detalles, colWidths=[0.8 * cm, 2 * cm, 2.5 * cm, 7 * cm, 7.7 * cm])
     style = TableStyle(
         [
             ('ALIGN', (0, 0), (4, 0), 'CENTER'),
             ('GRID', (0, 0), (-1, -1), 1, colors.black),
             ('FONTSIZE', (0, 0), (-1, -1), 7),
             ('ALIGN', (4, 1), (-1, -1), 'LEFT'),
             ('VALIGN', (0, 0), (-1, -1), 'TOP'),
         ]
     )
     tabla_detalle.setStyle(style)
     return tabla_detalle
开发者ID:joseamaya,项目名称:tambox,代码行数:31,代码来源:reports.py

示例8: addStyle

# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import fontSize [as 别名]
 def addStyle(self, data):
     def addFont(fontfile):
         if not fontfile:
             return None
         elif fontfile.endswith(".ttf") or fontfile.endswith(".otf"):
             fontname = os.path.splitext(fontfile)[0]
             pdfmetrics.registerFont(TTFont(fontname, fontfile))
             print "Registered", fontfile
             return fontname
         else:
             return fontfile
     name = data.get('name', "")
     s = ParagraphStyle(name)
     normal = addFont(data.get('font', "Helvetica"))
     bold = addFont(data.get('bold', None))
     italic = addFont(data.get('italic', None))
     bolditalic = addFont(data.get('bolditalic', None))
     pdfmetrics.registerFontFamily(normal, normal=normal, bold=bold or normal, italic=italic or normal, boldItalic=bolditalic or normal)
     s.fontName = normal
     s.fontSize = data.get('size', 10)
     s.alignment = dict(center=TA_CENTER, left=TA_LEFT, right=TA_RIGHT)[data.get('align', 'left')]
     s.leading = data.get('leading', s.leading)
     s.valign = data.get('valign', "top")
     s.textColor = data.get('color', "#ff000000")
     self.styles[name] = s
开发者ID:mcccclean,项目名称:card-renderer,代码行数:27,代码来源:pdfcanvas.py

示例9: _add_Y_items

# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import fontSize [as 别名]
    def _add_Y_items(self):
        """ add Y items labels to the chart (Text and styles). Add also light grid for their lines """

        X_pos = 0
        Y_pos = 3

        # draw the items titles with the right indentation

        for i in self.data.items_order:

            item = self.data.items[i]

            ps = ParagraphStyle("indent")
            ps.fontName = self.DEFAULT_FONT
            ps.fontSize = self.DEFAULT_FONT_SIZE
            ps.leftIndent = item.indent * self.INDENT_SPACE

            p = Paragraph(self._encode_entities(item.label), ps)
            self.table[Y_pos + item.Y_pos][X_pos] = p

            # draw the inner grid for this lines
            start_X = X_pos
            end_X = -1
            start_Y = Y_pos + item.Y_pos
            end_Y = Y_pos + item.Y_pos + item.line_number
            self.styles.append(("LINEABOVE", (start_X, end_Y), (end_X, end_Y), 0.2, "#bbbbbb"))
            self.styles.append(("LINEAFTER", (start_X, start_Y), (end_X, end_Y), 0.2, "#bbbbbb"))

        # line that separate the Y items and the datas
        self.styles.append(("LINEAFTER", (X_pos, Y_pos - 2), (X_pos, -1), 1, colors.black))
开发者ID:dxyuniesky,项目名称:openerp-extra-6.1,代码行数:32,代码来源:timebox_chart.py

示例10: get_content

# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import fontSize [as 别名]
    def get_content(self, column_data, row_values, col_values):
        """ return the content formated as defined in the constructor or in the column object """
        value = self.value
        
        if value == None or value == False:
            return ""
        
        #should we trunc the text
        if self.truncate_length != None:
            value = c2c_helper.ellipsis(value, self.truncate_length, ellipsis="[...]")

        ps = ParagraphStyle('standard_text')
        ps.fontName = self.get_font(column_data)
        ps.fontSize = self.get_font_size(column_data)
        ps.alignment = self.get_align_code(column_data)

        
        #should we indent the content
        if self.indent != None:
            ps.leftIndent = self.indent * 2 * mm
        elif type(column_data) == TextColData and column_data.indent != None:
            ps.leftIndent = column_data.indent * 2 * mm
        
        p = Paragraph(c2c_helper.encode_entities(value), ps)
        return p
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:27,代码来源:table_elements.py

示例11: toParagraphStyle

# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import fontSize [as 别名]
 def toParagraphStyle(self, first, full=False):
     style = ParagraphStyle('default%d' % self.UID(), keepWithNext=first.keepWithNext)
     style.fontName = first.fontName
     style.fontSize = first.fontSize
     style.leading = max(first.leading, first.fontSize * 1.25)
     style.backColor = first.backColor
     style.spaceBefore = first.spaceBefore
     style.spaceAfter = first.spaceAfter
     style.leftIndent = first.leftIndent
     style.rightIndent = first.rightIndent
     style.firstLineIndent = first.firstLineIndent
     style.textColor = first.textColor
     style.alignment = first.alignment
     style.bulletFontName = first.bulletFontName or first.fontName 
     style.bulletFontSize = first.fontSize
     style.bulletIndent = first.bulletIndent
     # Border handling for Paragraph
     style.borderWidth = 0
     if getBorderStyle(first.borderTopStyle):
         style.borderWidth = max(first.borderLeftWidth, first.borderRightWidth, first.borderTopWidth, first.borderBottomWidth)
         style.borderPadding = first.borderPadding # + first.borderWidth
         style.borderColor = first.borderTopColor
         # If no border color is given, the text color is used (XXX Tables!)
         if (style.borderColor is None) and style.borderWidth:
             style.borderColor = first.textColor      
     if full:
         style.fontName = tt2ps(first.fontName, first.bold, first.italic)
     return style       
开发者ID:nbio,项目名称:frnda,代码行数:30,代码来源:pisa_context.py

示例12: test3

# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import fontSize [as 别名]
 def test3(self):
     '''compare CJK splitting in some edge cases'''
     from reportlab.pdfgen.canvas import Canvas
     from reportlab.platypus.paragraph import Paragraph
     from reportlab.lib.styles import ParagraphStyle
     from reportlab.pdfbase import pdfmetrics
     from reportlab.lib.enums import TA_LEFT
     sty = ParagraphStyle('A')
     sty.fontSize = 15
     sty.leading = sty.fontSize*1.2
     sty.fontName = 'Courier'
     sty.alignment = TA_LEFT
     sty.wordWrap = 'CJK'
     p0=Paragraph('ABCDEFGHIJKL]N',sty)
     p1=Paragraph('AB<font color="red">C</font>DEFGHIJKL]N',sty)
     canv = Canvas('test_platypus_paragraph_cjk3.pdf')
     ix = len(canv._code)
     aW = pdfmetrics.stringWidth('ABCD','Courier',15)
     w,h=p0.wrap(aW,1000000)
     y = canv._pagesize[1]-72-h
     p0.drawOn(canv,72,y)
     w,h=p1.wrap(aW,1000000)
     y -= h+10
     p1.drawOn(canv,72,y)
     w,h=p0.wrap(aW*0.25-2,1000000)
     y -= h+10
     p0.drawOn(canv,72,y)
     w,h=p1.wrap(aW/4.-2,1000000)
     y -= h+10
     p1.drawOn(canv,72,y)
     assert canv._code[ix:]==['q', '1 0 0 1 72 697.8898 cm', 'q', '0 0 0 rg', 'BT 1 0 0 1 0 57 Tm /F2 15 Tf 18 TL (ABCD) Tj T* (EFGH) Tj T* (IJKL]) Tj T* (N) Tj T* ET', 'Q', 'Q', 'q', '1 0 0 1 72 615.8898 cm', 'q', 'BT 1 0 0 1 0 57 Tm 18 TL /F2 15 Tf 0 0 0 rg (AB) Tj 1 0 0 rg (C) Tj 0 0 0 rg (D) Tj T* (EFGH) Tj T* (IJKL]) Tj T* (N) Tj T* ET', 'Q', 'Q', 'q', '1 0 0 1 72 353.8898 cm', 'q', '0 0 0 rg', 'BT 1 0 0 1 0 237 Tm /F2 15 Tf 18 TL (A) Tj T* (B) Tj T* (C) Tj T* (D) Tj T* (E) Tj T* (F) Tj T* (G) Tj T* (H) Tj T* (I) Tj T* (J) Tj T* (K) Tj T* (L) Tj T* (]) Tj T* (N) Tj T* ET', 'Q', 'Q', 'q', '1 0 0 1 72 91.88976 cm', 'q', 'BT 1 0 0 1 0 237 Tm 18 TL /F2 15 Tf 0 0 0 rg (A) Tj T* (B) Tj T* 1 0 0 rg (C) Tj T* 0 0 0 rg (D) Tj T* (E) Tj T* (F) Tj T* (G) Tj T* (H) Tj T* (I) Tj T* (J) Tj T* (K) Tj T* (L) Tj T* (]) Tj T* (N) Tj T* ET', 'Q', 'Q']
     canv.showPage()
     canv.save()
开发者ID:Jbaumotte,项目名称:web2py,代码行数:35,代码来源:test_platypus_paragraphs.py

示例13: _add_items

# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import fontSize [as 别名]
    def _add_items(self):
        """ add labels and color to the table """
        
        #X starting position
        X_pos = 0 
        if self.title != None:
            X_pos = 1
        Y_pos = 0 
        
        cpt = 0
        for i in self.items_order:


            #add the label
            txt = c2c_helper.encode_entities(self.items[i].label)
            ps = ParagraphStyle('color_legend')
            ps.alignment = TA_CENTER
            ps.fontName = self.DEFAULT_FONT
            ps.fontSize = self.DEFAULT_FONT_SIZE
            p = Paragraph(txt, ps)            
            self.table[0][cpt+X_pos] = p
            
            #add the color
            self.styles.append(('BACKGROUND', (cpt+X_pos,0), (cpt+X_pos,0), self.items[i].color))
            cpt+=1
开发者ID:Yajo,项目名称:c2c-rd-addons,代码行数:27,代码来源:color_legend.py

示例14: _build_table

# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import fontSize [as 别名]
 def _build_table(self):
     """ return the list of list that represent the table structure """
     
     line = []
     if self.title != None:
         txt = c2c_helper.encode_entities(self.title)
         ps = ParagraphStyle('color_legend')
         ps.alignment = TA_CENTER
         ps.fontName = self.DEFAULT_FONT
         ps.fontSize = self.DEFAULT_FONT_SIZE
         p = Paragraph(txt, ps)        
         line.append([p])
         
     for i in self.items_order:
         line.append('')
     self.table.append(line)
     #global font for the whole graphic
     self.styles.append(('FONT', (0,0), (-1,-1),self.DEFAULT_FONT, self.DEFAULT_FONT_SIZE))
     # main frame arround the whole table
     self.styles.append(('BOX', (0,0), (-1,-1), 1, "#000000"))
     #in cells, text start in the top left corner
     self.styles.append(('VALIGN', (0,0), (-1,-1), 'TOP'))
     
     if self.title != None:
         #background of the legend title
         self.styles.append(('BACKGROUND', (0,0), (0,0), "#cccccc"))
开发者ID:Yajo,项目名称:c2c-rd-addons,代码行数:28,代码来源:color_legend.py

示例15: build_datos_cliente

# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import fontSize [as 别名]
def build_datos_cliente(datos_cliente = []):
    """
    Devuelve una lista de Flowables con las líneas recibidas como texto.
    """
    datos_c = []
    estilo_datos_c = ParagraphStyle("Cliente", 
                                    parent = estilos["Heading3"])
    estilo_datos_c.alignment = enums.TA_RIGHT
    estilo_datos_c.spaceAfter = estilo_datos_c.spaceBefore = 2
    if datos_cliente:
        try:
            datos_cliente[0] = "<strong>%s</strong>" % datos_cliente[0]
        except TypeError:
            datos_cliente = ["<strong>%s</strong>" % datos_cliente[0]] \
                            + list(datos_cliente[1:])
    tamanno_predeterminado = estilo_datos_c.fontSize
    for linea in datos_cliente:
        # ¡Esto debería hacerlo ReportLab, pero no sé por qué el markup 
        # sólo funciona con el estilo normal!
        if "<strong>" in linea:
            estilo_datos_c.fontSize += 4
        else:
            estilo_datos_c.fontSize = tamanno_predeterminado
        p = Paragraph(escribe(linea), estilo_datos_c) 
        datos_c.append(p)
    return datos_c
开发者ID:pacoqueen,项目名称:upy,代码行数:28,代码来源:presupuesto.py


注:本文中的reportlab.lib.styles.ParagraphStyle.fontSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。