gucharmap r1744 - in branches/gnome-2-22: . gucharmap



Author: chpe
Date: Sun Mar 23 12:53:40 2008
New Revision: 1744
URL: http://svn.gnome.org/viewvc/gucharmap?rev=1744&view=rev

Log:
2008-03-23  Christian Persch  <chpe gnome org>

	* gucharmap/gucharmap-mini-fontsel.c:
	(gucharmap_mini_font_selection_set_font_name):
	* gucharmap/main.c: (main): Make --font work again. Bug #506752, patch
	by Jared Moore.

Modified:
   branches/gnome-2-22/ChangeLog
   branches/gnome-2-22/gucharmap/gucharmap-mini-fontsel.c
   branches/gnome-2-22/gucharmap/main.c

Modified: branches/gnome-2-22/gucharmap/gucharmap-mini-fontsel.c
==============================================================================
--- branches/gnome-2-22/gucharmap/gucharmap-mini-fontsel.c	(original)
+++ branches/gnome-2-22/gucharmap/gucharmap-mini-fontsel.c	Sun Mar 23 12:53:40 2008
@@ -320,10 +320,18 @@
 gucharmap_mini_font_selection_set_font_name (GucharmapMiniFontSelection *fontsel,
                                              const gchar *fontname)
 {
-  pango_font_description_free (fontsel->font_desc);
 
-  fontsel->font_desc = pango_font_description_from_string (fontname);
+  PangoFontDescription *fd = pango_font_description_from_string (fontname);
+  if (pango_font_description_get_family (fd) == NULL)
+    {
+      gchar *fam = pango_font_description_get_family (fontsel->font_desc);
+      pango_font_description_set_family (fd, fam);
+    }
 
+  pango_font_description_free (fontsel->font_desc);
+  
+  fontsel->font_desc = fd;
+  
   update_font_familiy_combo (fontsel);
     
   /* treat oblique and italic both as italic */

Modified: branches/gnome-2-22/gucharmap/main.c
==============================================================================
--- branches/gnome-2-22/gucharmap/main.c	(original)
+++ branches/gnome-2-22/gucharmap/main.c	Sun Mar 23 12:53:40 2008
@@ -35,6 +35,9 @@
   GdkRectangle rect;
   GError *error = NULL;
   gchar *new_font = NULL;
+  gint default_size = 0;
+  GucharmapMiniFontSelection *fontsel = NULL;
+
   GOptionEntry goptions[] =
   {
     { "font", 0, 0, G_OPTION_ARG_STRING, &new_font,
@@ -73,28 +76,30 @@
   /* make the starting font 50% bigger than the default font */
   if (new_font == NULL) /* new_font could be set by command line option */
     {
-      GucharmapMiniFontSelection *fontsel = gucharmap_window_get_mini_font_selection (GUCHARMAP_WINDOW (window));
-      gint default_size = PANGO_PIXELS (2.0 * pango_font_description_get_size (window->style->font_desc));
-      gucharmap_mini_font_selection_set_default_font_size (fontsel, default_size);
-
       new_font = gucharmap_settings_get_font ();
-      if (new_font)
-        {
-          PangoFontDescription *fd = pango_font_description_from_string (new_font);
-
-          /* revert to default font size */
-          if (0 == pango_font_description_get_size (fd))
-            gucharmap_mini_font_selection_reset_font_size (fontsel);
-	  else
-	    gucharmap_mini_font_selection_set_font_name (fontsel, new_font);
-
-          pango_font_description_free (fd);
-	  g_free (new_font);
-        }
-      else
-        gucharmap_mini_font_selection_reset_font_size (fontsel);
     }
 
+  fontsel = gucharmap_window_get_mini_font_selection (GUCHARMAP_WINDOW (window));
+  default_size = PANGO_PIXELS (2.0 * pango_font_description_get_size (window->style->font_desc));
+  gucharmap_mini_font_selection_set_default_font_size (fontsel, default_size);
+
+  if (new_font)
+  {
+    PangoFontDescription *fd = pango_font_description_from_string (new_font);
+
+    gucharmap_mini_font_selection_set_font_name (fontsel, new_font);
+
+    gint size = pango_font_description_get_size (fd);
+    if (0 != size)
+      gucharmap_mini_font_selection_set_default_font_size (fontsel, 
+      							 PANGO_PIXELS (size));
+
+    pango_font_description_free (fd);
+    g_free (new_font);
+  }
+  gucharmap_mini_font_selection_reset_font_size (fontsel);
+    
+
   g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL);
 
   gucharmap_table_grab_focus (GUCHARMAP_WINDOW (window)->charmap->chartable);



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