Add font property

Adds the following function:
------------------------------
obs_properties_add_font

This function creates a 'font' property to allow selection of a system
font.  Implementation by the UI should treat the setting as an obs_data
sub-object with four sub-items:
 - face:   face name (string)
 - style:  style name (string)
 - size:   size (integer)
 - flags:  font flags (integer)

'flags' can be any combination of the following values:
 - OBS_FONT_BOLD
 - OBS_FONT_ITALIC
 - OBS_FONT_UNDERLINE
 - OBS_FONT_STRIKEOUT
This commit is contained in:
jp9000 2014-08-17 05:43:37 -07:00
parent e1611b431c
commit 0bf9736ddd
2 changed files with 26 additions and 0 deletions

View File

@ -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;

View File

@ -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);
/* ------------------------------------------------------------------------- */
/**