summaryrefslogtreecommitdiff
path: root/test/unicodeText.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/unicodeText.py')
-rwxr-xr-xtest/unicodeText.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/unicodeText.py b/test/unicodeText.py
new file mode 100755
index 0000000..5ad50c7
--- /dev/null
+++ b/test/unicodeText.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+Test unicode text
+
+Functions/methods which accept unicode text:
+ Context.select_font_face()
+ Context.show_text()
+ Context.text_extents()
+ Context.text_path()
+ ToyFontFace()
+ ScaledFont.text_extents()
+"""
+
+import cairo
+
+width, height = 300,300
+surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
+ctx = cairo.Context(surface)
+
+ctx.scale(width, height)
+ctx.set_line_width(0.04)
+
+ctx.select_font_face("Sans",
+ cairo.FONT_SLANT_NORMAL,
+ cairo.FONT_WEIGHT_NORMAL)
+ctx.set_font_size(0.20)
+ctx.move_to(0.05, 0.5)
+ctx.show_text("ēxāmple.")
+
+surface.write_to_png("test-out.png")