Commit 6be3f24a253dd91f22e1d71fe9199a358da26d95

Thomas de Grivel 2023-11-28T00:43:18

wip cairo_font

diff --git a/.gitmodules b/.gitmodules
index 2117c12..a0b0c7f 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -10,3 +10,6 @@
 	path = libffi
 	url = https://git.kmx.io/c3-lang/libffi.git
 	branch = master
+[submodule "fonts"]
+	path = fonts
+	url = git@git.kmx.io:c3-lang/fonts.git
diff --git a/fonts b/fonts
new file mode 160000
index 0000000..7056e50
--- /dev/null
+++ b/fonts
@@ -0,0 +1 @@
+Subproject commit 7056e50f1a1ddc85afe465caa55ae4bd415f16ff
diff --git a/libc3/window/cairo/cairo_font.c b/libc3/window/cairo/cairo_font.c
index 520d1e6..53ebbba 100644
--- a/libc3/window/cairo/cairo_font.c
+++ b/libc3/window/cairo/cairo_font.c
@@ -60,3 +60,8 @@ s_cairo_font * cairo_font_init (s_cairo_font *font, s_str *path)
     (font->ft_face, 0);
   return font;
 }
+
+void cairo_font_set (const s_cairo_font *font, cairo_t *cr)
+{
+  cairo_set_font_face(cr, font->cairo_font_face);
+}
diff --git a/libc3/window/cairo/cairo_font.h b/libc3/window/cairo/cairo_font.h
index a1af2c2..573bf6f 100644
--- a/libc3/window/cairo/cairo_font.h
+++ b/libc3/window/cairo/cairo_font.h
@@ -20,6 +20,9 @@
 /* Stack-allocation compatible functions, call cairo_font_clean after
    use. */
 void           cairo_font_clean (s_cairo_font *font);
-s_cairo_font * cairo_font_init (s_cairo_font *font, s_str *path);
+s_cairo_font * cairo_font_init (s_cairo_font *font, const s_str *path);
+
+/* Observers */
+void cairo_font_set (const s_cairo_font *font, cairo_t *cr);
 
 #endif /* LIBC3_WINDOW_CAIRO_CAIRO_FONT_H */