Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libraries/corevector/corevector.ndbx
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@
</port>
<port name="position" range="value" type="point" value="0.00,0.00" widget="point" description="The center point of the text."/>
<port min="0.0" name="width" range="value" type="float" value="0.0" widget="float" description="The maximum width of the text."/>
<port name="line_height" range="value" type="float" value="1.2" widget="float" description="The height of the line."/>
</node>
<node description="Move the shape, changing its position." function="pyvector/translate" handle="corevector/translateHandle" image="translate.png" name="translate" position="7.00,12.00" prototype="filter">
<port name="translate" range="value" type="point" value="0.00,0.00" widget="point" description="The amount of translation."/>
Expand Down
6 changes: 3 additions & 3 deletions libraries/corevector/pyvector.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,10 +849,10 @@ def text_on_path(text, shape, font_name, font_size, alignment, margin, baseline_
p.add(contour)

return p
def textpath(text, font_name="Verdana", font_size=24, align="CENTER", position=Point.ZERO, width=0, height=0):

def textpath(text, font_name="Verdana", font_size=24, line_height=1.2, align="CENTER", position=Point.ZERO, width=0, height=0):
"""Create a path out of text."""
t = Text(unicode(text), position.x, position.y, width, height)
t = Text(unicode(text), position.x, position.y, width, height, line_height)
t.fontName = font_name
t.fontSize = font_size
# valueOf requires a correct value: LEFT, CENTER, RIGHT or JUSTIFY. Anything else will
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/nodebox/function/CoreVectorFunctions.java
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ public static List<Path> ungroup(IGeometry shape) {
*
* @return A new Path.
*/
public static Path textpath(String text, String fontName, double fontSize, String alignment, Point position, double width) {
public static Path textpath(String text, String fontName, double fontSize, String alignment, Point position, double width, double lineHeight) {
Text.Align align;
try {
align = Text.Align.valueOf(alignment);
Expand All @@ -573,6 +573,7 @@ public static Path textpath(String text, String fontName, double fontSize, Strin
t.setFontName(fontName);
t.setFontSize(fontSize);
t.setAlign(align);
t.setLineHeight(lineHeight);

return t.getPath();
}
Expand Down