diff --git a/libobs/obs-properties.c b/libobs/obs-properties.c index a52fd0d62..ec8c6b59d 100644 --- a/libobs/obs-properties.c +++ b/libobs/obs-properties.c @@ -227,6 +227,7 @@ static inline size_t get_property_size(enum obs_property_type type) case OBS_PROPERTY_LIST: return sizeof(struct list_data); case OBS_PROPERTY_COLOR: return 0; case OBS_PROPERTY_BUTTON: return sizeof(struct button_data); + case OBS_PROPERTY_FONT: return 0; } return 0; @@ -386,6 +387,13 @@ obs_property_t obs_properties_add_button(obs_properties_t props, return p; } +obs_property_t obs_properties_add_font(obs_properties_t props, + const char *name, const char *desc) +{ + if (!props || has_prop(props, name)) return NULL; + return new_prop(props, name, desc, OBS_PROPERTY_FONT); +} + static inline bool is_combo(struct obs_property *p) { return p->type == OBS_PROPERTY_LIST; diff --git a/libobs/obs-properties.h b/libobs/obs-properties.h index 12b8c2401..1e288f874 100644 --- a/libobs/obs-properties.h +++ b/libobs/obs-properties.h @@ -34,6 +34,7 @@ enum obs_property_type { OBS_PROPERTY_LIST, OBS_PROPERTY_COLOR, OBS_PROPERTY_BUTTON, + OBS_PROPERTY_FONT, }; enum obs_combo_format { @@ -60,6 +61,11 @@ enum obs_text_type { OBS_TEXT_MULTILINE, }; +#define OBS_FONT_BOLD (1<<0) +#define OBS_FONT_ITALIC (1<<1) +#define OBS_FONT_UNDERLINE (1<<2) +#define OBS_FONT_STRIKEOUT (1<<3) + struct obs_properties; struct obs_property; typedef struct obs_properties *obs_properties_t; @@ -142,6 +148,18 @@ EXPORT obs_property_t obs_properties_add_button(obs_properties_t props, const char *name, const char *text, obs_property_clicked_t callback); +/** + * Adds a font selection property. + * + * A font is an obs_data sub-object which contains the following items: + * face: face name string + * style: style name string + * size: size integer + * flags: font flags integer (OBS_FONT_* defined above) + */ +EXPORT obs_property_t obs_properties_add_font(obs_properties_t props, + const char *name, const char *description); + /* ------------------------------------------------------------------------- */ /**