diff options
author | jaseg <git@jaseg.de> | 2023-07-21 14:38:09 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2023-07-21 14:38:09 +0200 |
commit | 21ca5f7f5c2e5425f9a142961bf86b39af825bf7 (patch) | |
tree | c4a02c5487a52b5fef5f7faec4e3f514f7e2eae4 /gerbonara/newstroke.py | |
parent | a39af853c833c524a43b8a953cce60e07bb14dfb (diff) | |
download | gerbonara-21ca5f7f5c2e5425f9a142961bf86b39af825bf7.tar.gz gerbonara-21ca5f7f5c2e5425f9a142961bf86b39af825bf7.tar.bz2 gerbonara-21ca5f7f5c2e5425f9a142961bf86b39af825bf7.zip |
WIP
Diffstat (limited to 'gerbonara/newstroke.py')
-rw-r--r-- | gerbonara/newstroke.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gerbonara/newstroke.py b/gerbonara/newstroke.py index 247b674..d0ed951 100644 --- a/gerbonara/newstroke.py +++ b/gerbonara/newstroke.py @@ -58,9 +58,9 @@ class Newstroke: raise ValueError(f'Invalid h_align value "{h_align}"') if v_align == 'top': - aly = -1.2*size + aly = sy*1.2*size elif v_align == 'middle': - aly = -1.2*size/2 + aly = sy*1.2*size/2 elif v_align != 'bottom': raise ValueError(f'Invalid v_align value "{v_align}"') @@ -77,7 +77,7 @@ class Newstroke: x += glyph_w*size - def render_svg(self, text, size=1.0, x0=0, y0=0, rotation=0, h_align='left', v_align='bottom', space_width=DEFAULT_SPACE_WIDTH, char_gap=DEFAULT_CHAR_GAP, **svg_attrs): + def render_svg(self, text, size=1.0, x0=0, y0=0, rotation=0, h_align='left', v_align='bottom', space_width=DEFAULT_SPACE_WIDTH, char_gap=DEFAULT_CHAR_GAP, scale=(1, -1), **svg_attrs): if 'stroke_linecap' not in svg_attrs: svg_attrs['stroke_linecap'] = 'round' if 'stroke_linejoin' not in svg_attrs: @@ -89,7 +89,7 @@ class Newstroke: strokes = ['M ' + ' L '.join(f'{x:.3f} {y:.3f}' for x, y in stroke) for stroke in self.render(text, size=size, x0=x0, y0=y0, rotation=rotation, h_align=h_align, v_align=v_align, space_width=space_width, char_gap=char_gap, - scale=(1, -1))] + scale=scale)] return Tag('path', d=' '.join(strokes), **svg_attrs) def bounding_box(self, text, size=1.0, space_width=DEFAULT_SPACE_WIDTH, char_gap=DEFAULT_CHAR_GAP): |