summaryrefslogtreecommitdiff
path: root/src/entry_backend/harfbuzz.h
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-06-08 23:14:38 +0100
committerPhil Jones <philj56@gmail.com>2022-06-09 16:51:44 +0100
commit05861ed6737f6b7b139895c4eeb26791edc333b4 (patch)
tree2f6af9e3038ec900f3968a1f2ee687f7a7238414 /src/entry_backend/harfbuzz.h
parent51bbf779ba2c9d5954e2c9470a8eae7c1ddd38a5 (diff)
Add Harfbuzz backend.
Another source of slow startup is initialising Pango. If the user supplies a ttf file, we can skip any Pango stuff and use Harfbuzz directly with Cairo to do our font rendering, providing a large speedup.
Diffstat (limited to 'src/entry_backend/harfbuzz.h')
-rw-r--r--src/entry_backend/harfbuzz.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/entry_backend/harfbuzz.h b/src/entry_backend/harfbuzz.h
new file mode 100644
index 0000000..0b07538
--- /dev/null
+++ b/src/entry_backend/harfbuzz.h
@@ -0,0 +1,26 @@
+#ifndef ENTRY_BACKEND_HARFBUZZ_H
+#define ENTRY_BACKEND_HARFBUZZ_H
+
+#include <cairo/cairo-ft.h>
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include <harfbuzz/hb.h>
+#include <pango/pangocairo.h>
+
+struct entry;
+
+struct entry_backend {
+ FT_Library ft_library;
+ FT_Face ft_face;
+
+ cairo_font_face_t *cairo_face;
+
+ hb_font_t *hb_font;
+ hb_buffer_t *hb_buffer;
+};
+
+void entry_backend_init(struct entry *entry, uint32_t width, uint32_t height, uint32_t scale);
+void entry_backend_destroy(struct entry *entry);
+void entry_backend_update(struct entry *entry);
+
+#endif /* ENTRY_BACKEND_HARFBUZZ_H */