mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 15:01:41 +00:00
[ui] Move font loading into new gui library
Font and text handling is very much part of user interface and at least partially independent of rendering, but does fit it better with GUI than genera UI (ie, both graphics and text mode), thus libQFgui as well as libQFui are built in the ui directory. The existing font related builtins have been moved into the ruamoko client library.
This commit is contained in:
parent
46967dbc05
commit
136bf882f6
23 changed files with 186 additions and 84 deletions
|
@ -29,7 +29,7 @@
|
|||
#define __gl_draw_h
|
||||
|
||||
struct qpic_s;
|
||||
struct rfont_s;
|
||||
struct font_s;
|
||||
struct draw_charbuffer_s;
|
||||
|
||||
void gl_Draw_Init (void);
|
||||
|
@ -58,7 +58,7 @@ void gl_Draw_Pic (int x, int y, struct qpic_s *pic);
|
|||
void gl_Draw_Picf (float x, float y, struct qpic_s *pic);
|
||||
void gl_Draw_SubPic(int x, int y, struct qpic_s *pic,
|
||||
int srcx, int srcy, int width, int height);
|
||||
int gl_Draw_AddFont (struct rfont_s *font);
|
||||
int gl_Draw_AddFont (struct font_s *font);
|
||||
void gl_Draw_FontString (int x, int y, int fontid, const char *str);
|
||||
|
||||
void GL_Set2D (void);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#define __QF_GLSL_qf_draw_h
|
||||
|
||||
struct qpic_s;
|
||||
struct rfont_s;
|
||||
struct font_s;
|
||||
struct draw_charbuffer_s;
|
||||
|
||||
void glsl_Draw_Init (void);
|
||||
|
@ -59,7 +59,7 @@ void glsl_Draw_Pic (int x, int y, struct qpic_s *pic);
|
|||
void glsl_Draw_Picf (float x, float y, struct qpic_s *pic);
|
||||
void glsl_Draw_SubPic(int x, int y, struct qpic_s *pic,
|
||||
int srcx, int srcy, int width, int height);
|
||||
int glsl_Draw_AddFont (struct rfont_s *font);
|
||||
int glsl_Draw_AddFont (struct font_s *font);
|
||||
void glsl_Draw_FontString (int x, int y, int fontid, const char *str);
|
||||
|
||||
void GLSL_Set2D (void);
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef enum {
|
|||
struct vulkan_ctx_s;
|
||||
struct qfv_renderframe_s;
|
||||
struct qpic_s;
|
||||
struct rfont_s;
|
||||
struct font_s;
|
||||
struct draw_charbuffer_s;
|
||||
|
||||
void Vulkan_Draw_CharBuffer (int x, int y, struct draw_charbuffer_s *buffer,
|
||||
|
@ -81,7 +81,7 @@ void Vulkan_Draw_Picf (float x, float y, struct qpic_s *pic,
|
|||
void Vulkan_Draw_SubPic(int x, int y, struct qpic_s *pic,
|
||||
int srcx, int srcy, int width, int height,
|
||||
struct vulkan_ctx_s *ctx);
|
||||
int Vulkan_Draw_AddFont (struct rfont_s *font, struct vulkan_ctx_s *ctx);
|
||||
int Vulkan_Draw_AddFont (struct font_s *font, struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Draw_FontString (int x, int y, int fontid, const char *str,
|
||||
struct vulkan_ctx_s *ctx);
|
||||
|
||||
|
|
|
@ -267,8 +267,8 @@ void Draw_Picf (float x, float y, qpic_t *pic);
|
|||
*/
|
||||
void Draw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height);
|
||||
|
||||
struct rfont_s;
|
||||
int Draw_AddFont (struct rfont_s *font);
|
||||
struct font_s;
|
||||
int Draw_AddFont (struct font_s *font);
|
||||
void Draw_FontString (int x, int y, int fontid, const char *str);
|
||||
|
||||
///@}
|
||||
|
|
|
@ -80,7 +80,7 @@ typedef struct vid_model_funcs_s {
|
|||
} vid_model_funcs_t;
|
||||
|
||||
struct tex_s;
|
||||
struct rfont_s;
|
||||
struct font_s;
|
||||
struct draw_charbuffer_s;
|
||||
|
||||
typedef void (*capfunc_t) (struct tex_s *screencap, void *data);
|
||||
|
@ -110,7 +110,7 @@ typedef struct vid_render_funcs_s {
|
|||
void (*Draw_Pic) (int x, int y, qpic_t *pic);
|
||||
void (*Draw_Picf) (float x, float y, qpic_t *pic);
|
||||
void (*Draw_SubPic) (int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height);
|
||||
int (*Draw_AddFont) (struct rfont_s *font);
|
||||
int (*Draw_AddFont) (struct font_s *font);
|
||||
void (*Draw_FontString) (int x, int y, int fontid, const char *str);
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
r_font.h
|
||||
font.h
|
||||
|
||||
Renderer font management
|
||||
Font management
|
||||
|
||||
Copyright (C) 2022 Bill Currie <bill@taniwha.org>
|
||||
|
||||
|
@ -28,8 +28,8 @@
|
|||
|
||||
*/
|
||||
|
||||
#ifndef __r_font_h
|
||||
#define __r_font_h
|
||||
#ifndef __QF_ui_font_h
|
||||
#define __QF_ui_font_h
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
@ -43,7 +43,7 @@ typedef struct fontent_s {
|
|||
uint32_t id;
|
||||
} fontent_t;
|
||||
|
||||
typedef struct rfont_s {
|
||||
typedef struct font_s {
|
||||
void *font_resource;
|
||||
FT_Face face;
|
||||
rscrap_t scrap;
|
||||
|
@ -51,10 +51,10 @@ typedef struct rfont_s {
|
|||
FT_Long num_glyphs;
|
||||
vrect_t *glyph_rects;
|
||||
vec2i_t *glyph_bearings;
|
||||
} rfont_t;
|
||||
} font_t;
|
||||
|
||||
void R_FontInit (void);
|
||||
void R_FontFree (rfont_t *font);
|
||||
rfont_t *R_FontLoad (QFile *font_file, int size);
|
||||
void Font_Init (void);
|
||||
void Font_Free (font_t *font);
|
||||
font_t *Font_Load (QFile *font_file, int size);
|
||||
|
||||
#endif//__r_font_h
|
||||
#endif//__QF_ui_font_h
|
|
@ -44,6 +44,11 @@ typedef struct script_component_s {
|
|||
hb_direction_t direction;
|
||||
} script_component_t;
|
||||
|
||||
typedef struct glyph_component_s {
|
||||
int id;
|
||||
int x, y;
|
||||
} glyph_component_t;
|
||||
|
||||
typedef struct rtext_s {
|
||||
const char *text;
|
||||
const char *language;
|
||||
|
@ -53,12 +58,12 @@ typedef struct rtext_s {
|
|||
|
||||
typedef struct r_hb_featureset_s DARRAY_TYPE (hb_feature_t) r_hb_featureset_t;
|
||||
|
||||
struct rfont_s;
|
||||
struct font_s;
|
||||
struct rglyph_s;
|
||||
typedef void rtext_render_t (uint32_t glyphid, int x, int y, void *data);
|
||||
|
||||
typedef struct rshaper_s {
|
||||
struct rfont_s *rfont;
|
||||
struct font_s *rfont;
|
||||
hb_font_t *font;
|
||||
hb_buffer_t *buffer;
|
||||
r_hb_featureset_t features;
|
||||
|
@ -71,7 +76,7 @@ extern hb_feature_t KerningOn;
|
|||
extern hb_feature_t CligOff;
|
||||
extern hb_feature_t CligOn;
|
||||
|
||||
rshaper_t *RText_NewShaper (struct rfont_s *font);
|
||||
rshaper_t *RText_NewShaper (struct font_s *font);
|
||||
void RText_DeleteShaper (rshaper_t *shaper);
|
||||
void RText_AddFeature (rshaper_t *shaper, hb_feature_t feature);
|
||||
void RText_ShapeText (rshaper_t *shaper, rtext_t *text);
|
||||
|
|
|
@ -60,6 +60,7 @@ int QFile_AllocHandle (struct progs_s *pr, QFile *file);
|
|||
QFile *QFile_GetFile (struct progs_s *pr, int handle);
|
||||
struct plitem_s *Plist_GetItem (struct progs_s *pr, int handle);
|
||||
|
||||
void RUA_GUI_Init (struct progs_s *pr, int secure);
|
||||
void RUA_Input_Init (struct progs_s *pr, int secure);
|
||||
void RUA_Mersenne_Init (struct progs_s *pr, int secure);
|
||||
void RUA_Model_Init (struct progs_s *pr, int secure);
|
||||
|
|
|
@ -30,12 +30,15 @@ libs_ruamoko_libQFruamoko_la_SOURCES= \
|
|||
|
||||
libs_ruamoko_libQFruamoko_client_la_LDFLAGS= $(lib_ldflags)
|
||||
libs_ruamoko_libQFruamoko_client_la_LIBADD= \
|
||||
libs/ruamoko/libQFruamoko.la
|
||||
libs/ruamoko/libQFruamoko.la \
|
||||
libs/ui/libQFgui.la
|
||||
libs_ruamoko_libQFruamoko_client_la_DEPENDENCIES= \
|
||||
libs/ruamoko/libQFruamoko.la \
|
||||
libs/ui/libQFgui.la \
|
||||
$(ruamoko_rua_libs)
|
||||
libs_ruamoko_libQFruamoko_client_la_SOURCES= \
|
||||
libs/ruamoko/rua_game_init.c \
|
||||
libs/ruamoko/rua_gui.c \
|
||||
libs/ruamoko/rua_input.c \
|
||||
libs/ruamoko/rua_mersenne.c \
|
||||
libs/ruamoko/rua_model.c \
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "rua_internal.h"
|
||||
|
||||
static void (*init_funcs[])(progs_t *, int) = {
|
||||
RUA_GUI_Init,
|
||||
RUA_Input_Init,
|
||||
RUA_Mersenne_Init,
|
||||
RUA_Model_Init,
|
||||
|
|
105
libs/ruamoko/rua_gui.c
Normal file
105
libs/ruamoko/rua_gui.c
Normal file
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
r_gui.c
|
||||
|
||||
Ruamoko GUI support functions
|
||||
|
||||
Copyright (C) 2022 Bill Currie <bill@taniwha.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "QF/draw.h"
|
||||
#include "QF/progs.h"
|
||||
#include "QF/quakefs.h"
|
||||
#include "QF/render.h"
|
||||
|
||||
#include "QF/ui/font.h"
|
||||
#include "QF/ui/view.h"
|
||||
|
||||
#include "QF/plugin/vid_render.h"
|
||||
|
||||
#include "rua_internal.h"
|
||||
|
||||
typedef struct {
|
||||
} gui_resources_t;
|
||||
|
||||
#define bi(x) static void bi_##x (progs_t *pr, void *_res)
|
||||
|
||||
bi (Font_Load)
|
||||
{
|
||||
const char *font_path = P_GSTRING (pr, 0);
|
||||
int font_size = P_INT (pr, 1);
|
||||
|
||||
QFile *font_file = QFS_FOpenFile (font_path);
|
||||
font_t *font = Font_Load (font_file, font_size);
|
||||
R_INT (pr) = r_funcs->Draw_AddFont (font);
|
||||
}
|
||||
|
||||
bi (Font_String)
|
||||
{
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
int fontid = P_INT (pr, 2);
|
||||
const char *str = P_GSTRING (pr, 3);
|
||||
r_funcs->Draw_FontString (x, y, fontid, str);
|
||||
}
|
||||
|
||||
#undef bi
|
||||
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
|
||||
#define p(type) PR_PARAM(type)
|
||||
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
|
||||
static builtin_t builtins[] = {
|
||||
bi(Font_Load, 2, p(string), p(int)),
|
||||
bi(Font_String, 4, p(int), p(int), p(int), p(string)),
|
||||
|
||||
{0}
|
||||
};
|
||||
|
||||
static void
|
||||
bi_gui_clear (progs_t *pr, void *_res)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
bi_gui_destroy (progs_t *pr, void *_res)
|
||||
{
|
||||
gui_resources_t *res = _res;
|
||||
free (res);
|
||||
}
|
||||
|
||||
void
|
||||
RUA_GUI_Init (progs_t *pr, int secure)
|
||||
{
|
||||
gui_resources_t *res = calloc (1, sizeof (gui_resources_t));
|
||||
|
||||
PR_Resources_Register (pr, "Draw", res, bi_gui_clear, bi_gui_destroy);
|
||||
PR_RegisterBuiltins (pr, builtins, res);
|
||||
}
|
|
@ -1,11 +1,22 @@
|
|||
include libs/ui/test/Makemodule.am
|
||||
|
||||
lib_LTLIBRARIES += libs/ui/libQFui.la
|
||||
lib_LTLIBRARIES += \
|
||||
libs/ui/libQFgui.la \
|
||||
libs/ui/libQFui.la
|
||||
|
||||
gui_deps = \
|
||||
libs/ui/libQFui.la
|
||||
|
||||
ui_deps = \
|
||||
libs/ecs/libQFecs.la \
|
||||
libs/util/libQFutil.la
|
||||
|
||||
libs_ui_libQFgui_la_LDFLAGS= $(lib_ldflags)
|
||||
libs_ui_libQFgui_la_LIBADD= $(gui_deps) $(ui_deps)
|
||||
libs_ui_libQFgui_la_DEPENDENCIES= $(gui_deps) $(ui_deps)
|
||||
libs_ui_libQFgui_la_SOURCES= \
|
||||
libs/ui/font.c
|
||||
|
||||
libs_ui_libQFui_la_LDFLAGS= $(lib_ldflags)
|
||||
libs_ui_libQFui_la_LIBADD= $(ui_deps)
|
||||
libs_ui_libQFui_la_DEPENDENCIES= $(ui_deps)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
r_font.c
|
||||
font.c
|
||||
|
||||
Renderer font management management
|
||||
Font management
|
||||
|
||||
Copyright (C) 2022 Bill Currie <bill@taniwha.org>
|
||||
|
||||
|
@ -36,14 +36,14 @@
|
|||
#include "QF/sys.h"
|
||||
#include "QF/math/bitop.h"
|
||||
|
||||
#include "r_font.h"
|
||||
#include "QF/ui/font.h"
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
static FT_Library ft;
|
||||
|
||||
static void
|
||||
copy_glyph (vrect_t *rect, FT_GlyphSlot src_glyph, rfont_t *font)
|
||||
copy_glyph (vrect_t *rect, FT_GlyphSlot src_glyph, font_t *font)
|
||||
{
|
||||
int dst_pitch = font->scrap.width;
|
||||
byte *dst = font->scrap_bitmap + rect->x + rect->y * dst_pitch;
|
||||
|
@ -58,7 +58,7 @@ copy_glyph (vrect_t *rect, FT_GlyphSlot src_glyph, rfont_t *font)
|
|||
}
|
||||
|
||||
VISIBLE void
|
||||
R_FontInit (void)
|
||||
Font_Init (void)
|
||||
{
|
||||
if (FT_Init_FreeType (&ft)) {
|
||||
Sys_Error ("Could not init FreeType library");
|
||||
|
@ -66,7 +66,7 @@ R_FontInit (void)
|
|||
}
|
||||
|
||||
VISIBLE void
|
||||
R_FontFree (rfont_t *font)
|
||||
Font_Free (font_t *font)
|
||||
{
|
||||
if (font->face) {
|
||||
FT_Done_Face (font->face);
|
||||
|
@ -81,18 +81,18 @@ R_FontFree (rfont_t *font)
|
|||
free (font);
|
||||
}
|
||||
|
||||
VISIBLE rfont_t *
|
||||
R_FontLoad (QFile *font_file, int size)
|
||||
VISIBLE font_t *
|
||||
Font_Load (QFile *font_file, int size)
|
||||
{
|
||||
byte *font_data = QFS_LoadFile (font_file, 0);
|
||||
if (!font_data) {
|
||||
return 0;
|
||||
}
|
||||
size_t font_size = qfs_filesize;
|
||||
rfont_t *font = calloc (1, sizeof (rfont_t));
|
||||
font_t *font = calloc (1, sizeof (font_t));
|
||||
font->font_resource = font_data;
|
||||
if (FT_New_Memory_Face (ft, font_data, font_size, 0, &font->face)) {
|
||||
R_FontFree (font);
|
||||
Font_Free (font);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -53,7 +53,6 @@ libs_video_renderer_libQFrenderer_la_SOURCES=\
|
|||
libs/video/renderer/r_cvar.c \
|
||||
libs/video/renderer/r_draw.c \
|
||||
libs/video/renderer/r_fog.c \
|
||||
libs/video/renderer/r_font.c \
|
||||
libs/video/renderer/r_graph.c \
|
||||
libs/video/renderer/r_init.c \
|
||||
libs/video/renderer/r_light.c \
|
||||
|
|
|
@ -56,10 +56,10 @@
|
|||
#include "QF/GL/qf_textures.h"
|
||||
#include "QF/GL/qf_vid.h"
|
||||
#include "QF/GL/types.h"
|
||||
#include "QF/ui/font.h"
|
||||
#include "QF/ui/view.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "r_font.h"
|
||||
#include "r_text.h"
|
||||
#include "r_internal.h"
|
||||
#include "varrays.h"
|
||||
|
@ -120,7 +120,7 @@ static byte menuplyr_pixels[4096];
|
|||
static int gl_2d_scale = 1;
|
||||
|
||||
typedef struct glfont_s {
|
||||
rfont_t *font;
|
||||
font_t *font;
|
||||
GLuint texid;
|
||||
} glfont_t;
|
||||
|
||||
|
@ -1059,7 +1059,7 @@ gl_Draw_BlendScreen (quat_t color)
|
|||
}
|
||||
|
||||
int
|
||||
gl_Draw_AddFont (struct rfont_s *rfont)
|
||||
gl_Draw_AddFont (font_t *rfont)
|
||||
{
|
||||
int fontid = gl_fonts.size;
|
||||
DARRAY_OPEN_AT (&gl_fonts, fontid, 1);
|
||||
|
@ -1087,7 +1087,7 @@ gl_render_glyph (uint32_t glyphid, int x, int y, void *_rgctx)
|
|||
{
|
||||
glrgctx_t *rgctx = _rgctx;
|
||||
glfont_t *font = &gl_fonts.a[rgctx->fontid];
|
||||
rfont_t *rfont = font->font;
|
||||
font_t *rfont = font->font;
|
||||
vrect_t *rect = &rfont->glyph_rects[glyphid];
|
||||
|
||||
float w = rect->width;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "QF/quakefs.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/vid.h"
|
||||
#include "QF/ui/font.h"
|
||||
#include "QF/ui/view.h"
|
||||
|
||||
#include "QF/GLSL/defines.h"
|
||||
|
@ -54,7 +55,6 @@
|
|||
#include "QF/GLSL/qf_textures.h"
|
||||
#include "QF/GLSL/qf_vid.h"
|
||||
|
||||
#include "r_font.h"
|
||||
#include "r_text.h"
|
||||
#include "r_internal.h"
|
||||
|
||||
|
@ -70,7 +70,7 @@ typedef struct {
|
|||
} drawvert_t;
|
||||
|
||||
typedef struct glslfont_s {
|
||||
rfont_t *font;
|
||||
font_t *font;
|
||||
GLuint texid;
|
||||
} glslfont_t;
|
||||
|
||||
|
@ -913,7 +913,7 @@ glsl_Draw_BlendScreen (quat_t color)
|
|||
}
|
||||
|
||||
int
|
||||
glsl_Draw_AddFont (struct rfont_s *rfont)
|
||||
glsl_Draw_AddFont (font_t *rfont)
|
||||
{
|
||||
int fontid = glsl_fonts.size;
|
||||
DARRAY_OPEN_AT (&glsl_fonts, fontid, 1);
|
||||
|
@ -992,7 +992,7 @@ glsl_Draw_FontString (int x, int y, int fontid, const char *str)
|
|||
return;
|
||||
}
|
||||
glslfont_t *font = &glsl_fonts.a[fontid];
|
||||
rfont_t *rfont = font->font;
|
||||
font_t *rfont = font->font;
|
||||
glslrgctx_t rgctx = {
|
||||
.glyph_rects = rfont->glyph_rects,
|
||||
.batch = glyph_queue,
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "QF/ui/view.h"
|
||||
|
||||
#include "r_internal.h"
|
||||
#include "r_font.h"
|
||||
|
||||
typedef struct {
|
||||
pr_int_t width;
|
||||
|
@ -382,27 +381,6 @@ bi_Draw_Height (progs_t *pr, void *_res)
|
|||
R_INT (pr) = r_data->vid->height;
|
||||
}
|
||||
|
||||
static void
|
||||
bi_Font_Load (progs_t *pr, void *_res)
|
||||
{
|
||||
const char *font_path = P_GSTRING (pr, 0);
|
||||
int font_size = P_INT (pr, 1);
|
||||
|
||||
QFile *font_file = QFS_FOpenFile (font_path);
|
||||
rfont_t *font = R_FontLoad (font_file, font_size);
|
||||
R_INT (pr) = r_funcs->Draw_AddFont (font);
|
||||
}
|
||||
|
||||
static void
|
||||
bi_Font_String (progs_t *pr, void *_res)
|
||||
{
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
int fontid = P_INT (pr, 2);
|
||||
const char *str = P_GSTRING (pr, 3);
|
||||
r_funcs->Draw_FontString (x, y, fontid, str);
|
||||
}
|
||||
|
||||
static void
|
||||
bi_Draw_CreateBuffer (progs_t *pr, void *_res)
|
||||
{
|
||||
|
@ -537,9 +515,6 @@ static builtin_t builtins[] = {
|
|||
bi(Draw_Line, 5, p(int), p(int), p(int), p(int), p(int)),
|
||||
bi(Draw_Crosshair, 5, p(int), p(int), p(int), p(int)),
|
||||
|
||||
bi(Font_Load, 2, p(string), p(int)),
|
||||
bi(Font_String, 4, p(int), p(int), p(int), p(string)),
|
||||
|
||||
bi(Draw_CreateBuffer, 2, p(int), p(int)),
|
||||
bi(Draw_DestroyBuffer, 1, p(ptr)),
|
||||
bi(Draw_ClearBuffer, 1, p(ptr)),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
r_font.c
|
||||
r_text.c
|
||||
|
||||
Renderer font management management
|
||||
Renderer font text management
|
||||
|
||||
Copyright (C) 2022 Bill Currie <bill@taniwha.org>
|
||||
|
||||
|
@ -35,13 +35,14 @@
|
|||
#include "QF/quakefs.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "r_font.h"
|
||||
#include "QF/ui/font.h"
|
||||
|
||||
#include "r_text.h"
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
rshaper_t *
|
||||
RText_NewShaper (rfont_t *font)
|
||||
RText_NewShaper (font_t *font)
|
||||
{
|
||||
rshaper_t *shaper = malloc (sizeof (rshaper_t));
|
||||
shaper->rfont = font;
|
||||
|
@ -96,7 +97,7 @@ RText_RenderText (rshaper_t *shaper, rtext_t *text, int x, int y,
|
|||
__auto_type glyphPos = hb_buffer_get_glyph_positions (shaper->buffer,
|
||||
&count);
|
||||
|
||||
rfont_t *font = shaper->rfont;
|
||||
font_t *font = shaper->rfont;
|
||||
for (unsigned i = 0; i < count; i++) {
|
||||
vec2i_t bearing = font->glyph_bearings[glyphInfo[i].codepoint];
|
||||
|
||||
|
|
|
@ -38,17 +38,17 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "QF/quakefs.h"
|
||||
#include "QF/ui/font.h"
|
||||
#include "QF/ui/view.h"
|
||||
|
||||
#include "d_iface.h"
|
||||
#include "d_local.h"
|
||||
#include "r_font.h"
|
||||
#include "r_text.h"
|
||||
#include "r_internal.h"
|
||||
#include "vid_internal.h"
|
||||
|
||||
typedef struct swfont_s {
|
||||
rfont_t *font;
|
||||
font_t *font;
|
||||
} swfont_t;
|
||||
|
||||
typedef struct swfontset_s
|
||||
|
@ -1003,7 +1003,7 @@ Draw_BlendScreen (quat_t color)
|
|||
}
|
||||
|
||||
int
|
||||
Draw_AddFont (struct rfont_s *rfont)
|
||||
Draw_AddFont (struct font_s *rfont)
|
||||
{
|
||||
int fontid = sw_fonts.size;
|
||||
DARRAY_OPEN_AT (&sw_fonts, fontid, 1);
|
||||
|
@ -1054,7 +1054,7 @@ Draw_FontString (int x, int y, int fontid, const char *str)
|
|||
return;
|
||||
}
|
||||
swfont_t *font = &sw_fonts.a[fontid];
|
||||
rfont_t *rfont = font->font;
|
||||
font_t *rfont = font->font;
|
||||
swrgctx_t rgctx = {
|
||||
.glyph_rects = rfont->glyph_rects,
|
||||
.bitmap = rfont->scrap_bitmap,
|
||||
|
|
|
@ -285,7 +285,7 @@ vulkan_Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width, in
|
|||
}
|
||||
|
||||
static int
|
||||
vulkan_Draw_AddFont (struct rfont_s *font)
|
||||
vulkan_Draw_AddFont (struct font_s *font)
|
||||
{
|
||||
return Vulkan_Draw_AddFont (font, vulkan_ctx);
|
||||
}
|
||||
|
|
|
@ -66,9 +66,9 @@
|
|||
#include "QF/Vulkan/resource.h"
|
||||
#include "QF/Vulkan/scrap.h"
|
||||
#include "QF/Vulkan/staging.h"
|
||||
#include "QF/ui/font.h"
|
||||
#include "QF/ui/view.h"
|
||||
|
||||
#include "r_font.h"
|
||||
#include "r_text.h"
|
||||
#include "r_internal.h"
|
||||
#include "vid_vulkan.h"
|
||||
|
@ -169,7 +169,7 @@ typedef struct drawfontres_s {
|
|||
typedef struct drawfont_s {
|
||||
VkDescriptorSet set;
|
||||
drawfontres_t *resource;
|
||||
rfont_t *font;
|
||||
font_t *font;
|
||||
} drawfont_t;
|
||||
|
||||
typedef struct drawfontset_s
|
||||
|
@ -1377,7 +1377,7 @@ Vulkan_Draw_BlendScreen (quat_t color, vulkan_ctx_t *ctx)
|
|||
}
|
||||
|
||||
int
|
||||
Vulkan_Draw_AddFont (rfont_t *rfont, vulkan_ctx_t *ctx)
|
||||
Vulkan_Draw_AddFont (font_t *rfont, vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
|
|
|
@ -110,6 +110,7 @@ qwaq_x11_libs= \
|
|||
$(qwaq_cl_plugin_libs) \
|
||||
${top_builddir}/libs/gib/libQFgib.la \
|
||||
${top_builddir}/libs/ruamoko/libQFruamoko_client.la \
|
||||
$(top_builddir)/libs/ui/libQFgui.la \
|
||||
$(top_builddir)/libs/video/renderer/libQFrenderer.la \
|
||||
$(top_builddir)/libs/models/libQFmodels.la \
|
||||
$(top_builddir)/libs/video/targets/libQFx11.la \
|
||||
|
|
|
@ -56,9 +56,9 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
|
|||
|
||||
#include "QF/plugin/console.h"
|
||||
#include "QF/plugin/vid_render.h"
|
||||
#include "QF/ui/font.h"
|
||||
|
||||
#include "rua_internal.h"
|
||||
#include "r_font.h"
|
||||
|
||||
#include "ruamoko/qwaq/qwaq.h"
|
||||
|
||||
|
@ -344,7 +344,7 @@ BI_Graphics_Init (progs_t *pr)
|
|||
IN_Init ();
|
||||
Mod_Init ();
|
||||
R_Init ();
|
||||
R_FontInit ();
|
||||
Font_Init ();
|
||||
|
||||
R_Progs_Init (pr);
|
||||
RUA_Game_Init (pr, thread->rua_security);
|
||||
|
|
Loading…
Reference in a new issue