[gnome-font-viewer] font-thumbnailer: Extract face index from URI



commit 920c834af317ce3342bf08d215c6ea53f2931b3f
Author: Peng Wu <alexepico gmail com>
Date:   Fri Jan 22 17:39:07 2016 +0900

    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

 src/font-thumbnailer.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/font-thumbnailer.c b/src/font-thumbnailer.c
index d22f9d5..ba2e495 100644
--- a/src/font-thumbnailer.c
+++ b/src/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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]