Skip to content

Commit

Permalink
Parker/text fix (#151)
Browse files Browse the repository at this point in the history
* text extent calculation fixed

* removed useless layer references
  • Loading branch information
parkern342 committed May 5, 2023
1 parent 5d67617 commit ae1f6ae
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 66 deletions.
26 changes: 26 additions & 0 deletions backend/ontario/ontario/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,32 @@ def tileglass(self, width: int, height: int) -> "ImageBuilder":
self.__nodes.append(node)
return self

def text(self,
string: str,
font: str,
size: float,
color: tuple,
wrap_width: int,
wrap_height: int,
alignment: int,
vert_alignment: int):
"""
Produce text pixel buffer
"""

node = self.__parent.create_child("gegl:text")
node.set_property("string", string)
node.set_property("font", font)
node.set_property("size", size)
node.set_property("color", Gegl.Color.new(color))
node.set_property("wrap_width", wrap_width)
node.set_property("wrap_height", wrap_height)
node.set_property("alignment", alignment)
node.set_property("vert_alignment", vert_alignment)

self.__nodes.append(node)
return node.get_property("width"), node.get_property("height")

def perspective_transform(
self,
x0: float,
Expand Down

0 comments on commit ae1f6ae

Please sign in to comment.