本文整理汇总了Python中gramps.gen.plug.docgen.FontStyle.get_size方法的典型用法代码示例。如果您正苦于以下问题:Python FontStyle.get_size方法的具体用法?Python FontStyle.get_size怎么用?Python FontStyle.get_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.gen.plug.docgen.FontStyle
的用法示例。
在下文中一共展示了FontStyle.get_size方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_default_style
# 需要导入模块: from gramps.gen.plug.docgen import FontStyle [as 别名]
# 或者: from gramps.gen.plug.docgen.FontStyle import get_size [as 别名]
def make_default_style(self, default_style):
"""Make the default output style for the Person Everything Report."""
font = FontStyle()
font.set(face=FONT_SANS_SERIF, size=12, bold=1)
para = ParagraphStyle()
para.set_header_level(1)
para.set_bottom_border(1)
para.set_top_margin(ReportUtils.pt2cm(3))
para.set_bottom_margin(ReportUtils.pt2cm(3))
para.set_font(font)
para.set_alignment(PARA_ALIGN_CENTER)
para.set_description(_("The style used for the title of the page."))
default_style.add_paragraph_style("PE-Title", para)
font = FontStyle()
font.set(face=FONT_SERIF, size=10)
for i in range(1, 33):
para = ParagraphStyle()
para.set_font(font)
para.set_top_margin(ReportUtils.pt2cm(font.get_size()*0.125))
para.set_bottom_margin(ReportUtils.pt2cm(font.get_size()*0.125))
para.set_left_margin(min(10.0, float(i-1.0)))
para.set_description(_("The style used for the "
"level %d display.") % i)
default_style.add_paragraph_style("PE-Level%d" % min(i, 32), para)
add_endnote_styles(default_style)
示例2: get_optimized_font_size
# 需要导入模块: from gramps.gen.plug.docgen import FontStyle [as 别名]
# 或者: from gramps.gen.plug.docgen.FontStyle import get_size [as 别名]
def get_optimized_font_size(self, line, font, max_width):
"""
for a given width, guess the best font size which is equals
or smaller than font which make line fit into max_width
"""
test_font = FontStyle(font)
width = utils.pt2cm(self.doc.string_width(test_font, line))
while width > max_width and test_font.get_size() > 1:
test_font.set_size(test_font.get_size() -1)
width = utils.pt2cm(self.doc.string_width(test_font, line))
return test_font.get_size()
示例3: make_default_style
# 需要导入模块: from gramps.gen.plug.docgen import FontStyle [as 别名]
# 或者: from gramps.gen.plug.docgen.FontStyle import get_size [as 别名]
def make_default_style(self, default_style):
"""Make the default output style for the Descendant Report."""
f = FontStyle()
f.set(face=FONT_SANS_SERIF, size=12, bold=1)
p = ParagraphStyle()
p.set_header_level(1)
p.set_bottom_border(1)
p.set_top_margin(ReportUtils.pt2cm(3))
p.set_bottom_margin(ReportUtils.pt2cm(3))
p.set_font(f)
p.set_description(_("The style used for the title of the page."))
default_style.add_paragraph_style("DR-Title", p)
f = FontStyle()
f.set(face=FONT_SANS_SERIF, size=12, italic=1)
p = ParagraphStyle()
p.set_font(f)
p.set_header_level(2)
p.set_top_margin(ReportUtils.pt2cm(3))
p.set_bottom_margin(ReportUtils.pt2cm(3))
p.set_description(_('The style used for the table of contents header.'))
default_style.add_paragraph_style("DR-TOC-Title", p)
f = FontStyle()
f.set_size(10)
p = ParagraphStyle()
p.set_font(f)
p.set_top_margin(0.25)
p.set_bottom_margin(0.25)
p.set_first_indent(1.0)
p.set_description(_("The style used for the table of contents detail."))
default_style.add_paragraph_style("DR-TOC-Detail", p)
f = FontStyle()
f.set_size(10)
for i in range(1, 33):
p = ParagraphStyle()
p.set_font(f)
p.set_top_margin(ReportUtils.pt2cm(f.get_size()*0.125))
p.set_bottom_margin(ReportUtils.pt2cm(f.get_size()*0.125))
p.set_first_indent(-0.8)
p.set_left_margin(min(10.0, float(i-0.5)))
p.set_description(_("The style used for the "
"level %d display.") % i)
default_style.add_paragraph_style("DR-Level%d" % min(i, 32), p)
p = ParagraphStyle()
p.set_font(f)
p.set_top_margin(ReportUtils.pt2cm(f.get_size()*0.125))
p.set_bottom_margin(ReportUtils.pt2cm(f.get_size()*0.125))
p.set_left_margin(min(10.0, float(i-0.5)))
p.set_description(_("The style used for the "
"spouse level %d display.") % i)
default_style.add_paragraph_style("DR-Spouse%d" % min(i, 32), p)
示例4: make_default_style
# 需要导入模块: from gramps.gen.plug.docgen import FontStyle [as 别名]
# 或者: from gramps.gen.plug.docgen.FontStyle import get_size [as 别名]
def make_default_style(self, default_style):
"""Make the default output style for the Ancestor Tree."""
## Paragraph Styles:
font = FontStyle()
font.set_size(9)
font.set_type_face(FONT_SANS_SERIF)
para_style = ParagraphStyle()
para_style.set_font(font)
para_style.set_description(_('The basic style used for the '
'text display.'))
default_style.add_paragraph_style("AC2-Normal", para_style)
box_shadow = PT2CM(font.get_size()) * .6
font = FontStyle()
font.set_size(9)
font.set_type_face(FONT_SANS_SERIF)
para_style = ParagraphStyle()
para_style.set_font(font)
para_style.set_description(_('The basic style used for the '
'note display.'))
default_style.add_paragraph_style("AC2-Note", para_style)
font = FontStyle()
font.set_size(16)
font.set_type_face(FONT_SANS_SERIF)
para_style = ParagraphStyle()
para_style.set_font(font)
para_style.set_alignment(PARA_ALIGN_CENTER)
para_style.set_description(_('The basic style used for the '
'title display.'))
default_style.add_paragraph_style("AC2-Title", para_style)
## Draw styles
graph_style = GraphicsStyle()
graph_style.set_paragraph_style("AC2-Normal")
graph_style.set_shadow(1, box_shadow) #shadow set by text size
graph_style.set_fill_color((255, 255, 255))
default_style.add_draw_style("AC2-box", graph_style)
graph_style = GraphicsStyle()
graph_style.set_paragraph_style("AC2-Normal")
#graph_style.set_shadow(0, PT2CM(9)) #shadow set by text size
graph_style.set_fill_color((255, 255, 255))
default_style.add_draw_style("AC2-fam-box", graph_style)
graph_style = GraphicsStyle()
graph_style.set_paragraph_style("AC2-Note")
graph_style.set_fill_color((255, 255, 255))
default_style.add_draw_style("AC2-note-box", graph_style)
graph_style = GraphicsStyle()
graph_style.set_paragraph_style("AC2-Title")
graph_style.set_color((0, 0, 0))
graph_style.set_fill_color((255, 255, 255))
graph_style.set_line_width(0)
default_style.add_draw_style("AC2-Title", graph_style)
graph_style = GraphicsStyle()
default_style.add_draw_style("AC2-line", graph_style)
示例5: add_endnote_styles
# 需要导入模块: from gramps.gen.plug.docgen import FontStyle [as 别名]
# 或者: from gramps.gen.plug.docgen.FontStyle import get_size [as 别名]
def add_endnote_styles(style_sheet):
"""
Add paragraph styles to a style sheet to be used for displaying endnotes.
@param style_sheet: Style sheet
@type style_sheet: L{docgen.StyleSheet}
"""
font = FontStyle()
font.set(face=FONT_SERIF, size=10)
para = ParagraphStyle()
para.set_font(font)
para.set(first_indent=-0.75, lmargin=1.00)
para.set_top_margin(ReportUtils.pt2cm(font.get_size()*0.125))
para.set_bottom_margin(ReportUtils.pt2cm(font.get_size()*0.125))
para.set_description(_('The basic style used for the endnotes source display.'))
style_sheet.add_paragraph_style("Endnotes-Source", para)
示例6: make_default_style
# 需要导入模块: from gramps.gen.plug.docgen import FontStyle [as 别名]
# 或者: from gramps.gen.plug.docgen.FontStyle import get_size [as 别名]
def make_default_style(self, default_style):
"""Make the default output style for the Descendant Report."""
fstyle = FontStyle()
fstyle.set_size(12)
fstyle.set_type_face(FONT_SANS_SERIF)
fstyle.set_bold(1)
pstyle = ParagraphStyle()
pstyle.set_header_level(1)
pstyle.set_bottom_border(1)
pstyle.set_top_margin(utils.pt2cm(3))
pstyle.set_bottom_margin(utils.pt2cm(3))
pstyle.set_font(fstyle)
pstyle.set_alignment(PARA_ALIGN_CENTER)
pstyle.set_description(_("The style used for the title."))
default_style.add_paragraph_style("DR-Title", pstyle)
fstyle = FontStyle()
fstyle.set_size(10)
for i in range(1, 33):
pstyle = ParagraphStyle()
pstyle.set_font(fstyle)
pstyle.set_top_margin(utils.pt2cm(fstyle.get_size()*0.125))
pstyle.set_bottom_margin(
utils.pt2cm(fstyle.get_size()*0.125))
pstyle.set_first_indent(-0.5)
pstyle.set_left_margin(min(10.0, float(i-0.5)))
pstyle.set_description(
_("The style used for the level %d display.") % i)
default_style.add_paragraph_style("DR-Level%d" % min(i, 32),
pstyle)
pstyle = ParagraphStyle()
pstyle.set_font(fstyle)
pstyle.set_top_margin(utils.pt2cm(fstyle.get_size()*0.125))
pstyle.set_bottom_margin(
utils.pt2cm(fstyle.get_size()*0.125))
pstyle.set_left_margin(min(10.0, float(i-0.5)))
pstyle.set_description(
_("The style used for the spouse level %d display.") % i)
default_style.add_paragraph_style("DR-Spouse%d" % min(i, 32),
pstyle)