summaryrefslogtreecommitdiff
path: root/src/text.h
diff options
context:
space:
mode:
authorFabrice <fabrice@schaub-dev.xyz>2026-02-12 15:25:37 +0100
committerFabrice <fabrice@schaub-dev.xyz>2026-02-12 15:25:37 +0100
commit65ce5859ec10849fa71a42273038db2a820d3fb7 (patch)
tree394a23b37518b9b1e4fcfd1f9436c0e18fa4fc41 /src/text.h
parent716cccb220a9e2337320ac591d575a2f68b4ed2c (diff)
reworking text rendering
Diffstat (limited to 'src/text.h')
-rw-r--r--src/text.h78
1 files changed, 0 insertions, 78 deletions
diff --git a/src/text.h b/src/text.h
deleted file mode 100644
index 9ea7d0d..0000000
--- a/src/text.h
+++ /dev/null
@@ -1,78 +0,0 @@
-#pragma once
-
-#include "cglm/types.h"
-#include "freetype/freetype.h"
-#include "hash.h"
-#include "utils.h"
-
-typedef u32 codepoint_t;
-
-#define WAYC_LETTER_NTRIANGLES 2
-#define WAYC_LETTER_NVERTICES (WAYC_LETTER_NTRIANGLES * WAYC_TRIANGLE_NVERTS)
-
-struct text_vertex_s {
- vec2 pos;
- vec2 uv;
-};
-
-typedef u32 text_index_t;
-
-enum font_context_error_e {
- FONT_CONTEXT_ERROR_NONE,
- FONT_CONTEXT_ERROR_LIBRARY_LOADING,
- FONT_CONTEXT_ERROR_VAO_CREATION,
-};
-
-struct font_context_s {
- FT_Library library;
-};
-
-enum font_context_error_e wayc_font_context_init(struct font_context_s* ctx);
-void wayc_font_context_deinit(struct font_context_s* ctx);
-
-struct glyph_s {
- ivec2 uv0, uv1;
-
- i32 bearing_x, bearing_y;
- f32 advance;
-};
-
-enum font_error_e {
- FONT_ERROR_NONE,
- FONT_ERROR_FILE_LOAD,
- FONT_ERROR_FONT_LOAD,
- FONT_ERROR_NOT_MATCH,
- FONT_ERROR_ATLAS_FULL,
-};
-
-struct font_s {
- u8* data;
- FT_Face face;
- struct hashmap_s<codepoint_t, struct glyph_s> cache;
-};
-
-enum font_error_e wayc_font_init(struct font_s* font,
- struct font_context_s* ctx, u32 fsize,
- const char* path);
-enum font_error_e wayc_font_lookup(struct font_s* font, codepoint_t codepoint,
- struct glyph_s* out);
-void wayc_font_deinit(struct font_s* font);
-
-enum text_error_e {
- TEXT_ERROR_NONE,
- TEXT_ERROR_ATLAS,
-};
-
-struct text_s {
- struct font_s* font;
- struct atlas_s* atlas;
- struct atlas_packer_s* packer;
- struct string_s string;
-};
-
-#define WAYC_TEXT_INIT(font, atlas, packer, string) \
- text_s { font, atlas, packer, string }
-
-enum text_error_e wayc_text_assemble(struct text_s* text, usize* out_size,
- text_index_t** out_indices,
- struct text_vertex_s** out_verts);