media: Add an API to specify which font should be used for subtitles
Allow the user of the ClutterMedia interface to specify a Pango font description to display subtitles. Even if the underlying implementation of the interface does not natively use Pange, it must be capable of parsing the grammar that pango_font_description_from_string() accepts.
This commit is contained in:
parent
8e9f56c411
commit
4c1231c7fe
@ -123,6 +123,22 @@ clutter_media_base_init (gpointer g_iface)
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
g_object_interface_install_property (g_iface, pspec);
|
||||
|
||||
/**
|
||||
* ClutterMedia:subtitle-font-name:
|
||||
*
|
||||
* The font used to display subtitles. The font description has to
|
||||
* follow the same grammar as the one recognized by
|
||||
* pango_font_description_from_string().
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
pspec = g_param_spec_string ("subtitle-font-name",
|
||||
"Subtitle Font Name",
|
||||
"The font used to display subtitles",
|
||||
NULL,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
g_object_interface_install_property (g_iface, pspec);
|
||||
|
||||
/**
|
||||
* ClutterMedia:audio-volume:
|
||||
*
|
||||
@ -403,6 +419,54 @@ clutter_media_get_subtitle_uri (ClutterMedia *media)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_set_subtitle_font_name:
|
||||
* @media: a #ClutterMedia
|
||||
* @font_name: a font name, or %NULL to set the default font name
|
||||
*
|
||||
* Sets the font used by the subtitle renderer. The @font_name string must be
|
||||
* either %NULL, which means that the default font name of the underlying
|
||||
* implementation will be used; or must follow the grammar recognized by
|
||||
* pango_font_description_from_string() like:
|
||||
*
|
||||
* |[
|
||||
* clutter_media_set_subtitle_font_name (media, "Sans 24pt");
|
||||
* ]|
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
clutter_media_set_subtitle_font_name (ClutterMedia *media,
|
||||
const char *font_name)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_MEDIA (media));
|
||||
|
||||
g_object_set (G_OBJECT (media), "subtitle-font-name", font_name, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_get_subtitle_font_name:
|
||||
* @media: a #ClutterMedia
|
||||
*
|
||||
* Retrieves the font name currently used.
|
||||
*
|
||||
* Return value: a string containing the font name. Use g_free()
|
||||
* to free the returned string
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
gchar *
|
||||
clutter_media_get_subtitle_font_name (ClutterMedia *media)
|
||||
{
|
||||
gchar *retval = NULL;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), NULL);
|
||||
|
||||
g_object_get (G_OBJECT (media), "subtitle-font-name", &retval, NULL);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_media_set_audio_volume:
|
||||
* @media: a #ClutterMedia
|
||||
|
@ -62,29 +62,32 @@ struct _ClutterMediaIface
|
||||
const GError *error);
|
||||
};
|
||||
|
||||
GType clutter_media_get_type (void) G_GNUC_CONST;
|
||||
GType clutter_media_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void clutter_media_set_uri (ClutterMedia *media,
|
||||
const gchar *uri);
|
||||
gchar * clutter_media_get_uri (ClutterMedia *media);
|
||||
void clutter_media_set_filename (ClutterMedia *media,
|
||||
const gchar *filename);
|
||||
void clutter_media_set_uri (ClutterMedia *media,
|
||||
const gchar *uri);
|
||||
gchar * clutter_media_get_uri (ClutterMedia *media);
|
||||
void clutter_media_set_filename (ClutterMedia *media,
|
||||
const gchar *filename);
|
||||
|
||||
void clutter_media_set_playing (ClutterMedia *media,
|
||||
gboolean playing);
|
||||
gboolean clutter_media_get_playing (ClutterMedia *media);
|
||||
void clutter_media_set_progress (ClutterMedia *media,
|
||||
gdouble progress);
|
||||
gdouble clutter_media_get_progress (ClutterMedia *media);
|
||||
void clutter_media_set_subtitle_uri (ClutterMedia *media,
|
||||
const gchar *uri);
|
||||
gchar * clutter_media_get_subtitle_uri (ClutterMedia *media);
|
||||
void clutter_media_set_audio_volume (ClutterMedia *media,
|
||||
gdouble volume);
|
||||
gdouble clutter_media_get_audio_volume (ClutterMedia *media);
|
||||
gboolean clutter_media_get_can_seek (ClutterMedia *media);
|
||||
gdouble clutter_media_get_buffer_fill (ClutterMedia *media);
|
||||
gdouble clutter_media_get_duration (ClutterMedia *media);
|
||||
void clutter_media_set_playing (ClutterMedia *media,
|
||||
gboolean playing);
|
||||
gboolean clutter_media_get_playing (ClutterMedia *media);
|
||||
void clutter_media_set_progress (ClutterMedia *media,
|
||||
gdouble progress);
|
||||
gdouble clutter_media_get_progress (ClutterMedia *media);
|
||||
void clutter_media_set_subtitle_uri (ClutterMedia *media,
|
||||
const gchar *uri);
|
||||
gchar * clutter_media_get_subtitle_uri (ClutterMedia *media);
|
||||
void clutter_media_set_subtitle_font_name (ClutterMedia *media,
|
||||
const char *font_name);
|
||||
gchar * clutter_media_get_subtitle_font_name (ClutterMedia *media);
|
||||
void clutter_media_set_audio_volume (ClutterMedia *media,
|
||||
gdouble volume);
|
||||
gdouble clutter_media_get_audio_volume (ClutterMedia *media);
|
||||
gboolean clutter_media_get_can_seek (ClutterMedia *media);
|
||||
gdouble clutter_media_get_buffer_fill (ClutterMedia *media);
|
||||
gdouble clutter_media_get_duration (ClutterMedia *media);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -11,6 +11,8 @@ clutter_media_set_progress
|
||||
clutter_media_get_progress
|
||||
clutter_media_set_subtitle_uri
|
||||
clutter_media_get_subtitle_uri
|
||||
clutter_media_set_subtitle_font_name
|
||||
clutter_media_get_subtitle_font_name
|
||||
clutter_media_set_audio_volume
|
||||
clutter_media_get_audio_volume
|
||||
clutter_media_get_can_seek
|
||||
|
Loading…
Reference in New Issue
Block a user