示例#1
0
文件: print.c 项目: laubstein/pw3270
 static void load_font(GtkWidget *widget, GtkPrintOperation *prt)
 {
 	gchar *fontname = g_object_get_data(G_OBJECT(prt),"3270FontName");

 	Trace("Loading font \"%s\"",fontname);

	gtk_font_selection_set_font_name(GTK_FONT_SELECTION(widget),fontname);

 	if(!gtk_font_selection_get_size(GTK_FONT_SELECTION(widget)))
	{
		// Font size is 0, set it to 10
		gchar *ptr = g_strdup_printf("%s 10",fontname);
		gtk_font_selection_set_font_name(GTK_FONT_SELECTION(widget),ptr);
		g_free(ptr);
	}

 }
示例#2
0
文件: font.c 项目: BunsenLabs/yad
void
font_print_result (void)
{
  if (options.font_data.separate_output)
    {
      PangoFontFace *face;
      PangoFontFamily *family;
      gint size;

      face = gtk_font_selection_get_face (GTK_FONT_SELECTION (font));
      family = gtk_font_selection_get_family (GTK_FONT_SELECTION (font));
      size = gtk_font_selection_get_size (GTK_FONT_SELECTION (font));

      if (options.common_data.quoted_output)
        {
          gchar *q1 = g_shell_quote (pango_font_family_get_name (family));
          gchar *q2 = g_shell_quote (pango_font_face_get_face_name (face));

          g_printf ("%s%s%s%s%d\n", q1, options.common_data.separator, q2,
                    options.common_data.separator, size / 1000);

          g_free (q1);
          g_free (q2);
        }
      else
        {
          g_printf ("%s%s%s%s%d\n", pango_font_family_get_name (family), options.common_data.separator,
                    pango_font_face_get_face_name (face), options.common_data.separator, size / 1000);
        }
    }
  else
    {
      gchar *fn = gtk_font_selection_get_font_name (GTK_FONT_SELECTION (font));

      if (options.common_data.quoted_output)
        {
          gchar *buf = g_shell_quote (fn);
          g_printf ("%s\n", buf);
          g_free (buf);
        }
      else
        g_printf ("%s\n", fn);

      g_free (fn);
    }
}