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


Python Pen.text方法代码示例

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


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

示例1: handle_letter

# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import text [as 别名]
def handle_letter(letter, mode):
    letter_paper = draw_letter(
        letter,
        mode,
        fixed_width=30.0,
        show_template=True,
        fuse=False,
    )
    letter_paper.translate((5, 0), bounds=False)

    p = Pen()
    p.move_to((-8, 3))
    p.text(
        letter.case,
        6.0,
        font,
        gray,
        centered=True,
    )
    p.move_to((-8, -3))
    p.text(
        ', '.join(lookup(letter.case)),
        6.0,
        font,
        gray,
        centered=True,
    )
    letter_paper.merge(p.paper)

    return letter_paper
开发者ID:christian-oudard,项目名称:ithkuil,代码行数:32,代码来源:primary_characters.py

示例2: test_text

# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import text [as 别名]
def test_text():
    p = Pen()
    p.move_to((0, 0))
    p.text('abcd', 1, 'sans-serif')
    svg_data = p.paper.format_svg(0)
    assert (
        '<text x="0" y="0" font-family="sans-serif" font-size="1" '
        'fill="#000000">abcd</text>'
    ) in svg_data
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:11,代码来源:test_text.py

示例3: test_text_centered

# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import text [as 别名]
def test_text_centered():
    p = Pen()
    p.move_to((0, 0))
    p.text('abcd', 1, 'sans-serif', centered=True)
    svg_data = p.paper.format_svg(0)
    assert (
        '<text x="0" y="0" font-family="sans-serif" font-size="1" '
        'fill="#000000" text-anchor="middle">abcd</text>'
    ) in svg_data
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:11,代码来源:test_text.py

示例4: test_text_translate

# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import text [as 别名]
def test_text_translate():
    p = Pen()
    p.move_to((0, 0))
    p.text('abcd', 1)
    paper = p.paper

    paper.translate((2, 3))
    svg_data = paper.format_svg(0)
    assert (
        '<text x="2" y="-3" font-family="sans-serif" font-size="1" '
        'fill="#000000">abcd</text>'
    ) in svg_data
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:14,代码来源:test_text.py

示例5: test_text_merge

# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import text [as 别名]
def test_text_merge():
    p = Pen()
    p.move_to((0, 0))
    p.text('abcd', 1)
    paper1 = p.paper
    assert '<text' in paper1.format_svg(0)

    paper2 = Paper()
    paper2.merge(paper1)
    assert '<text' in paper2.format_svg(0)

    paper3 = Paper()
    paper3.merge_under(paper1)
    assert '<text' in paper3.format_svg(0)
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:16,代码来源:test_text.py

示例6: StrokeOutlineMode

# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import text [as 别名]
from canoepaddle import Pen, StrokeOutlineMode

from ithkuil.writing.consonant import consonants
from ithkuil.writing.typeset import draw_letter, typeset
from ithkuil.phonology import convert_ascii_to_html
import ithkuil.writing.side_ending as se
import ithkuil.writing.bottom_ending as be

font = "Caudex"
font_size = 8
red = "#d6041a"
black = "#260003"
gray = "#233042"
mode = StrokeOutlineMode(1.0, 0.2, red, black)

papers = []
for consonant_class in consonants:
    letter = consonant_class(se.Normal, be.Normal)
    letter_paper = draw_letter(letter, mode, fixed_width=27.0, show_template=True)
    letter_paper.translate((5, 0), bounds=False)

    p = Pen()
    p.move_to((-5, 0))
    p.text(convert_ascii_to_html(consonant_class.pronunciation), 8.0, "Caudex", "#233042", centered=True)
    letter_paper.merge(p.paper)
    papers.append(letter_paper)

page = typeset(papers, letter_spacing=1.0, letters_per_line=6, line_spacing=3.5, page_margin=5.0)

print(page.format_svg(4, resolution=1000 / page.bounds().width))
开发者ID:christian-oudard,项目名称:ithkuil,代码行数:32,代码来源:consonant_characters.py

示例7: Pen

# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import text [as 别名]
    paper.override_bounds(bounds)
    paper.translate((-0.5, 0))

    # Generate text indicating pattern and stem.
    pen = Pen()
    pen.paper = paper
    if letter.side_ending_class.relation == 'UNFRAMED':
        pen.move_to((2, 9.5))
    else:
        pen.move_to((2, 11.5))

    text = '{} {}'.format(
        letter.side_ending_class.pattern,
        letter.side_ending_class.stem,
    )
    pen.text(text, font_size, font, gray, centered=True)

    papers.append(paper)


page = typeset(
    papers,
    letter_spacing=4.0,
    letters_per_line=9,
    line_spacing=5.0,
    page_margin=5.0,
)

# Add row text.
page_bounds = page.bounds()
pen = Pen()
开发者ID:christian-oudard,项目名称:ithkuil,代码行数:33,代码来源:side_ending_chart.py


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