aboutsummaryrefslogtreecommitdiff
path: root/src/layout.h
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2024-07-09 14:29:54 +0200
committerFederico Angelilli <code@fedang.net>2024-07-09 14:29:54 +0200
commit28adc6b395d2fb7545189636cec3651b9c2a5f73 (patch)
tree8b7124f6534beab94ba1ea163bfc86b8ff7aec41 /src/layout.h
parent748613db7a794be69def5f008e2e2eea428d8541 (diff)
Add layouts
Diffstat (limited to 'src/layout.h')
-rw-r--r--src/layout.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/layout.h b/src/layout.h
new file mode 100644
index 0000000..4b8cddd
--- /dev/null
+++ b/src/layout.h
@@ -0,0 +1,34 @@
+#ifndef COMET_LAYOUT_H
+#define COMET_LAYOUT_H
+
+#include <cairo.h>
+#include <pango/pangocairo.h>
+#include <pango/pango-types.h>
+
+#include "block.h"
+
+typedef struct {
+ PangoFontDescription *fontdesc;
+ PangoContext *context;
+ int x_offset;
+ int width, height;
+} layout_info_t;
+
+typedef struct layout {
+ block_t *block;
+ int x, y;
+ int x_padding, y_padding;
+ int width, height;
+ int text_width, text_height;
+ PangoLayout *pl;
+ int n_children;
+ struct layout **children;
+} layout_t;
+
+layout_t *layout_create(block_t *block, layout_info_t info);
+
+void layout_render(layout_t *layout, cairo_t *cr);
+
+void layout_free(layout_t *layout);
+
+#endif