summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2017-03-08 13:45:32 +0100
committerraveit65 <[email protected]>2017-03-08 16:08:00 +0100
commit224684d1ba9cc7583992746adbce3b2273bc112e (patch)
tree72d639bef9f8fa793aae63e21c25d619f519a33b
parent35f3012334a832a83878bfee21ec4324d2662def (diff)
downloadmate-control-center-224684d1ba9cc7583992746adbce3b2273bc112e.tar.bz2
mate-control-center-224684d1ba9cc7583992746adbce3b2273bc112e.tar.xz
font-viewer font-thumbnailer: Extract face index from URI
The URI passed to gnome-thumbnail-font can now have a face index, embedded as a URI fragment. The fragment part is parsed as a 32-bit integer, and it may include a "0x" prefix, to support FreeType extension for GX fonts: http://freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Open_Face https://bugzilla.gnome.org/show_bug.cgi?id=752005 taken from: https://git.gnome.org/browse/gnome-font-viewer/commit/?id=920c834
-rw-r--r--font-viewer/font-thumbnailer.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/font-viewer/font-thumbnailer.c b/font-viewer/font-thumbnailer.c
index 74b135d0..e2a2d3be 100644
--- a/font-viewer/font-thumbnailer.c
+++ b/font-viewer/font-thumbnailer.c
@@ -183,6 +183,8 @@ main (int argc,
cairo_font_face_t *font;
gchar *str = NULL;
gdouble scale, scale_x, scale_y;
+ gint face_index = 0;
+ gchar *fragment;
const GOptionEntry options[] = {
{ "text", 't', 0, G_OPTION_ARG_STRING, &thumbstr_utf8,
@@ -233,11 +235,15 @@ main (int argc,
totem_resources_monitor_start (arguments[0], 30 * G_USEC_PER_SEC);
+ fragment = strrchr (arguments[0], '#');
+ if (fragment)
+ face_index = strtol (fragment + 1, NULL, 0);
+
file = g_file_new_for_commandline_arg (arguments[0]);
uri = g_file_get_uri (file);
g_object_unref (file);
- face = sushi_new_ft_face_from_uri (library, uri, 0, &contents, &gerror);
+ face = sushi_new_ft_face_from_uri (library, uri, face_index, &contents, &gerror);
if (gerror) {
g_printerr ("Could not load face '%s': %s\n", uri,
gerror->message);