text-freetype2: Change default size of text to 256
This commit is contained in:
parent
fd1a107436
commit
b5d2d26b5b
@ -35,16 +35,33 @@ MODULE_EXPORT const char *obs_module_description(void)
|
||||
|
||||
uint32_t texbuf_w = 2048, texbuf_h = 2048;
|
||||
|
||||
static struct obs_source_info freetype2_source_info = {
|
||||
static struct obs_source_info freetype2_source_info_v1 = {
|
||||
.id = "text_ft2_source",
|
||||
.type = OBS_SOURCE_TYPE_INPUT,
|
||||
.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CAP_OBSOLETE |
|
||||
OBS_SOURCE_CUSTOM_DRAW,
|
||||
.get_name = ft2_source_get_name,
|
||||
.create = ft2_source_create_v1,
|
||||
.destroy = ft2_source_destroy,
|
||||
.update = ft2_source_update,
|
||||
.get_width = ft2_source_get_width,
|
||||
.get_height = ft2_source_get_height,
|
||||
.video_render = ft2_source_render,
|
||||
.video_tick = ft2_video_tick,
|
||||
.get_properties = ft2_source_properties,
|
||||
.icon_type = OBS_ICON_TYPE_TEXT,
|
||||
};
|
||||
|
||||
static struct obs_source_info freetype2_source_info_v2 = {
|
||||
.id = "text_ft2_source_v2",
|
||||
.type = OBS_SOURCE_TYPE_INPUT,
|
||||
.output_flags = OBS_SOURCE_VIDEO |
|
||||
#ifdef _WIN32
|
||||
OBS_SOURCE_DEPRECATED |
|
||||
#endif
|
||||
OBS_SOURCE_CUSTOM_DRAW,
|
||||
.get_name = ft2_source_get_name,
|
||||
.create = ft2_source_create,
|
||||
.create = ft2_source_create_v2,
|
||||
.destroy = ft2_source_destroy,
|
||||
.update = ft2_source_update,
|
||||
.get_width = ft2_source_get_width,
|
||||
@ -83,7 +100,8 @@ bool obs_module_load()
|
||||
bfree(config_dir);
|
||||
}
|
||||
|
||||
obs_register_source(&freetype2_source_info);
|
||||
obs_register_source(&freetype2_source_info_v1);
|
||||
obs_register_source(&freetype2_source_info_v2);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -469,7 +487,8 @@ error:
|
||||
#define DEFAULT_FACE "Sans Serif"
|
||||
#endif
|
||||
|
||||
static void *ft2_source_create(obs_data_t *settings, obs_source_t *source)
|
||||
static void *ft2_source_create(obs_data_t *settings, obs_source_t *source,
|
||||
int ver)
|
||||
{
|
||||
struct ft2_source *srcdata = bzalloc(sizeof(struct ft2_source));
|
||||
obs_data_t *font_obj = obs_data_create();
|
||||
@ -477,10 +496,12 @@ static void *ft2_source_create(obs_data_t *settings, obs_source_t *source)
|
||||
|
||||
init_plugin();
|
||||
|
||||
srcdata->font_size = 32;
|
||||
const uint16_t font_size = ver == 1 ? 32 : 256;
|
||||
|
||||
srcdata->font_size = font_size;
|
||||
|
||||
obs_data_set_default_string(font_obj, "face", DEFAULT_FACE);
|
||||
obs_data_set_default_int(font_obj, "size", 32);
|
||||
obs_data_set_default_int(font_obj, "size", font_size);
|
||||
obs_data_set_default_obj(settings, "font", font_obj);
|
||||
|
||||
obs_data_set_default_int(settings, "log_lines", 6);
|
||||
@ -494,3 +515,13 @@ static void *ft2_source_create(obs_data_t *settings, obs_source_t *source)
|
||||
|
||||
return srcdata;
|
||||
}
|
||||
|
||||
static void *ft2_source_create_v1(obs_data_t *settings, obs_source_t *source)
|
||||
{
|
||||
return ft2_source_create(settings, source, 1);
|
||||
}
|
||||
|
||||
static void *ft2_source_create_v2(obs_data_t *settings, obs_source_t *source)
|
||||
{
|
||||
return ft2_source_create(settings, source, 2);
|
||||
}
|
||||
|
@ -69,7 +69,8 @@ struct ft2_source {
|
||||
|
||||
extern FT_Library ft2_lib;
|
||||
|
||||
static void *ft2_source_create(obs_data_t *settings, obs_source_t *source);
|
||||
static void *ft2_source_create_v1(obs_data_t *settings, obs_source_t *source);
|
||||
static void *ft2_source_create_v2(obs_data_t *settings, obs_source_t *source);
|
||||
static void ft2_source_destroy(void *data);
|
||||
static void ft2_source_update(void *data, obs_data_t *settings);
|
||||
static void ft2_source_render(void *data, gs_effect_t *effect);
|
||||
|
Loading…
x
Reference in New Issue
Block a user