• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pango_font_description_from_string函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pango_font_description_from_string函数的典型用法代码示例。如果您正苦于以下问题:C++ pango_font_description_from_string函数的具体用法?C++ pango_font_description_from_string怎么用?C++ pango_font_description_from_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pango_font_description_from_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: gtk_window_new

GtkWidget *tip_window_new_autocomp (gchar *tip)
{
	GtkWidget *win;
	GtkWidget *label;
	GtkWidget *eb;
	PangoFontDescription *pfd;

	win = gtk_window_new (GTK_WINDOW_POPUP);
	gtk_container_set_border_width (GTK_CONTAINER (win), 0);

	eb = gtk_event_box_new ();
	gtk_container_set_border_width (GTK_CONTAINER (eb), 1);
	gtk_container_add (GTK_CONTAINER (win), eb);

	label = gtk_label_new (tip);  
	gtk_container_add (GTK_CONTAINER (eb), label);

	pfd = pango_font_description_from_string ("courier");
	gtk_widget_modify_font (label, pfd);

	return win;
}
开发者ID:RobinWeng,项目名称:griffon-IDE,代码行数:22,代码来源:griffon_defs.c


示例2: draw_text

static void
draw_text (cairo_t *cr)
{
#define RADIUS 150
#define N_WORDS 10
#define FONT "Sans Bold 27"
  PangoLayout *layout;
  PangoFontDescription *desc;
  int i;
  /* Center coordinates on the middle of the region we are drawing
   */
  cairo_translate (cr, RADIUS, RADIUS);
  /* Create a PangoLayout, set the font and text */
  layout = pango_cairo_create_layout (cr);
  pango_layout_set_text (layout, "Text", -1);
  desc = pango_font_description_from_string (FONT);
  pango_layout_set_font_description (layout, desc);
  pango_font_description_free (desc);
  /* Draw the layout N_WORDS times in a circle */
  for (i = 0; i < N_WORDS; i++)
    {
      int width, height;
      double angle = (360. * i) / N_WORDS;
      double red;
      cairo_save (cr);
      /* Gradient from red at angle == 60 to blue at angle == 240 */
      red   = (1 + cos ((angle - 60) * G_PI / 180.)) / 2;
      cairo_set_source_rgb (cr, red, 0, 1.0 - red);
      cairo_rotate (cr, angle * G_PI / 180.);
      /* Inform Pango to re-layout the text with the new transformation */
      pango_cairo_update_layout (cr, layout);
      pango_layout_get_size (layout, &width, &height);
      cairo_move_to (cr, - ((double)width / PANGO_SCALE) / 2, - RADIUS);
      pango_cairo_show_layout (cr, layout);
      cairo_restore (cr);
    }
  /* free the layout object */
  g_object_unref (layout);
}
开发者ID:Anomalous-Software,项目名称:CMake,代码行数:39,代码来源:main.c


示例3: gtk_css_custom_property_create_initial_value

static GtkCssValue *
gtk_css_custom_property_create_initial_value (GParamSpec *pspec)
{
  GValue value = G_VALUE_INIT;
  GtkCssValue *result;

  g_value_init (&value, pspec->value_type);


G_GNUC_BEGIN_IGNORE_DEPRECATIONS
  if (pspec->value_type == GTK_TYPE_THEMING_ENGINE)
    g_value_set_object (&value, gtk_theming_engine_load (NULL));
  else if (pspec->value_type == PANGO_TYPE_FONT_DESCRIPTION)
    g_value_take_boxed (&value, pango_font_description_from_string ("Sans 10"));
  else if (pspec->value_type == GDK_TYPE_RGBA)
    {
      GdkRGBA color;
      gdk_rgba_parse (&color, "pink");
      g_value_set_boxed (&value, &color);
    }
  else if (pspec->value_type == g_type_from_name ("GdkColor"))
    {
      GdkColor color;
      gdk_color_parse ("pink", &color);
      g_value_set_boxed (&value, &color);
    }
  else if (pspec->value_type == GTK_TYPE_BORDER)
    {
      g_value_take_boxed (&value, gtk_border_new ());
    }
  else
    g_param_value_set_default (pspec, &value);
G_GNUC_END_IGNORE_DEPRECATIONS

  result = _gtk_css_typed_value_new (&value);
  g_value_unset (&value);

  return result;
}
开发者ID:endlessm,项目名称:gtk,代码行数:39,代码来源:gtkcsscustomproperty.c


示例4: pango_cairo_create_layout

PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, const char *text,
		int32_t scale, bool markup) {
	PangoLayout *layout = pango_cairo_create_layout(cairo);
	PangoAttrList *attrs;
	if (markup) {
		char *buf;
		pango_parse_markup(text, -1, 0, &attrs, &buf, NULL, NULL);
		pango_layout_set_markup(layout, buf, -1);
		free(buf);
	} else {
		attrs = pango_attr_list_new();
		pango_layout_set_text(layout, text, -1);
	}
	pango_attr_list_insert(attrs, pango_attr_scale_new(scale));
	PangoFontDescription *desc = pango_font_description_from_string(font);
	pango_layout_set_font_description(layout, desc);
	pango_layout_set_single_paragraph_mode(layout, 1);
	pango_layout_set_attributes(layout, attrs);
	pango_attr_list_unref(attrs);
	pango_font_description_free(desc);
	return layout;
}
开发者ID:SirCmpwn,项目名称:sway,代码行数:22,代码来源:pango.c


示例5: NSA_GET_PTR

JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkWidgetModifyFont
  (JNIEnv *env, jobject obj, jstring name, jint style, jint size)
{
  const char *font_name;
  void *ptr;
  GtkWidget *button;
  GtkWidget *label;
  PangoFontDescription *font_desc;

  ptr = NSA_GET_PTR (env, obj);

  button = GTK_WIDGET (ptr);
  label = gtk_bin_get_child (GTK_BIN(button));

  if (!label)
      return;

  font_name = (*env)->GetStringUTFChars (env, name, NULL);

  gdk_threads_enter();

  font_desc = pango_font_description_from_string (font_name);
  pango_font_description_set_size (font_desc, size * dpi_conversion_factor);

  if (style & AWT_STYLE_BOLD)
    pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);

  if (style & AWT_STYLE_ITALIC)
    pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
  
  gtk_widget_modify_font (GTK_WIDGET(label), font_desc);
  
  pango_font_description_free (font_desc);
  
  gdk_threads_leave();
  
  (*env)->ReleaseStringUTFChars (env, name, font_name);
}
开发者ID:BackupTheBerlios,项目名称:iphone-binutils-svn,代码行数:39,代码来源:gnu_java_awt_peer_gtk_GtkCheckboxPeer.c


示例6: gt_text_width_calculator_cairo_new

GtTextWidthCalculator* gt_text_width_calculator_cairo_new(cairo_t *context,
                                                          GtStyle *style,
                                                          GtError *err)
{
  GtTextWidthCalculatorCairo *twcc;
  GtTextWidthCalculator *twc;
  double theight = TEXT_SIZE_DEFAULT;
  char buf[64];
  twc = gt_text_width_calculator_create(gt_text_width_calculator_cairo_class());
  twcc = gt_text_width_calculator_cairo_cast(twc);
  if (style)
    twcc->style = gt_style_ref(style);
  if (!context)
  {
    twcc->mysurf = cairo_image_surface_create(GT_TWC_FORMAT, GT_TWC_WIDTH,
                                              GT_TWC_HEIGHT);
    twcc->context = cairo_create(twcc->mysurf);
    twcc->own_context = true;
  } else {
    twcc->context = context;
    twcc->own_context = false;
  }
  if (twcc->style)
  {
    if (gt_style_get_num(twcc->style,
                         "format", "block_caption_font_size",
                         &theight, NULL, err) == GT_STYLE_QUERY_ERROR) {
      gt_text_width_calculator_delete(twc);
      return NULL;
    }
    cairo_save(twcc->context);
  }
  twcc->layout = pango_cairo_create_layout(twcc->context);
  snprintf(buf, 64, "Sans %d", (int) theight);
  twcc->desc = pango_font_description_from_string(buf);
  pango_layout_set_font_description(twcc->layout, twcc->desc);
  pango_font_description_free(twcc->desc);
  return twc;
}
开发者ID:AlexWoroschilow,项目名称:uni_hamburg,代码行数:39,代码来源:text_width_calculator_cairo.c


示例7: main

int main (int argc,
          char *argv[])
{
    GtkWidget *window, *vbox, *button, *label;
    PangoFontDescription *initial_font;

    gtk_init (&argc, &argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (window), "Font Button");
    gtk_container_set_border_width (GTK_CONTAINER (window), 10);

    g_signal_connect (G_OBJECT (window), "destroy",
                      G_CALLBACK (destroy), NULL);

    label = gtk_label_new ("Look at the font!");
    initial_font = pango_font_description_from_string ("Sans Bold 12");
    gtk_widget_modify_font (label, initial_font);

    /* Create a new font selection button with the given default font. */
    button = gtk_font_button_new_with_font ("Sans Bold 12");
    gtk_font_button_set_title (GTK_FONT_BUTTON (button), "Choose a Font");

    /* Monitor for changes to the font chosen in the font button. */
    g_signal_connect (G_OBJECT (button), "font_set",
                      G_CALLBACK (font_changed),
                      (gpointer) label);

    vbox= gtk_vbox_new (FALSE, 5);
    gtk_box_pack_start_defaults (GTK_BOX (vbox), button);
    gtk_box_pack_start_defaults (GTK_BOX (vbox), label);

    gtk_container_add (GTK_CONTAINER (window), vbox);
    gtk_widget_show_all (window);

    gtk_main ();
    return 0;
}
开发者ID:kavinsivak,项目名称:sandbox,代码行数:38,代码来源:fontbuttons.c


示例8: begin_print

static void begin_print(GtkPrintOperation *operation, GtkPrintContext *context, gpointer user_data)
{
	DocInfo *dinfo = user_data;
	PangoFontDescription *desc;

	if (dinfo == NULL)
		return;

	gtk_widget_show(main_widgets.progressbar);

	/* init dinfo fields */

	/* setup printing scintilla object */
	dinfo->sci = editor_create_widget(dinfo->doc->editor);
	scintilla_send_message(dinfo->sci, SCI_SETDOCPOINTER, 0,
			scintilla_send_message(dinfo->doc->editor->sci, SCI_GETDOCPOINTER, 0, 0));
	highlighting_set_styles(dinfo->sci, dinfo->doc->file_type);
	sci_set_line_numbers(dinfo->sci, printing_prefs.print_line_numbers, 0);
	scintilla_send_message(dinfo->sci, SCI_SETVIEWWS, SCWS_INVISIBLE, 0);
	scintilla_send_message(dinfo->sci, SCI_SETVIEWEOL, FALSE, 0);
	scintilla_send_message(dinfo->sci, SCI_SETEDGEMODE, EDGE_NONE, 0);
	scintilla_send_message(dinfo->sci, SCI_SETPRINTMAGNIFICATION, (uptr_t) -2, 0); /* WTF? */
	scintilla_send_message(dinfo->sci, SCI_SETPRINTCOLOURMODE, SC_PRINT_COLOURONWHITE, 0);

	dinfo->pages = g_array_new(FALSE, FALSE, sizeof(gint));

	dinfo->print_time = time(NULL);
	/* create a PangoLayout to be commonly used in add_page_header() and draw_page() */
	desc = pango_font_description_from_string(interface_prefs.editor_font);
	dinfo->layout = setup_pango_layout(context, desc);
	pango_font_description_free(desc);
	get_text_dimensions(dinfo->layout, "|XMfjgq_" /* reasonably representative character set */,
		NULL, &dinfo->line_height);
	get_text_dimensions(dinfo->layout, "99999 " /* Scintilla resets the margin to the width of "99999" when printing */,
		&dinfo->margin_width, NULL);
	/* setup dinfo->fr */
	setup_range(dinfo, context);
}
开发者ID:fabiosje,项目名称:geany,代码行数:38,代码来源:printing.c


示例9: vte_config

static void
vte_config(VteTerminal* vte)
{
    GRegex* regex = g_regex_new(url_regex, G_REGEX_CASELESS, G_REGEX_MATCH_NOTEMPTY, NULL);

    vte_terminal_search_set_gregex(vte, regex, G_REGEX_MATCH_NOTEMPTY);
    vte_terminal_search_set_wrap_around     (vte, TINYTERM_SEARCH_WRAP_AROUND);
    vte_terminal_set_audible_bell           (vte, TINYTERM_AUDIBLE_BELL);
    vte_terminal_set_cursor_shape           (vte, TINYTERM_CURSOR_SHAPE);
    vte_terminal_set_cursor_blink_mode      (vte, TINYTERM_CURSOR_BLINK);
    vte_terminal_set_word_char_exceptions   (vte, TINYTERM_WORD_CHARS);
    vte_terminal_set_scrollback_lines       (vte, TINYTERM_SCROLLBACK_LINES);
    PangoFontDescription *font = pango_font_description_from_string(TINYTERM_FONT);
    vte_terminal_set_font(vte, font);

    GdkRGBA color_fg, color_bg;
    GdkRGBA color_palette[16];
    gdk_rgba_parse(&color_fg, TINYTERM_COLOR_FOREGROUND);
    gdk_rgba_parse(&color_bg, TINYTERM_COLOR_BACKGROUND);
    gdk_rgba_parse(&color_palette[0], TINYTERM_COLOR00);
    gdk_rgba_parse(&color_palette[1], TINYTERM_COLOR01);
    gdk_rgba_parse(&color_palette[2], TINYTERM_COLOR02);
    gdk_rgba_parse(&color_palette[3], TINYTERM_COLOR03);
    gdk_rgba_parse(&color_palette[4], TINYTERM_COLOR04);
    gdk_rgba_parse(&color_palette[5], TINYTERM_COLOR05);
    gdk_rgba_parse(&color_palette[6], TINYTERM_COLOR06);
    gdk_rgba_parse(&color_palette[7], TINYTERM_COLOR07);
    gdk_rgba_parse(&color_palette[8], TINYTERM_COLOR08);
    gdk_rgba_parse(&color_palette[9], TINYTERM_COLOR09);
    gdk_rgba_parse(&color_palette[10], TINYTERM_COLOR0A);
    gdk_rgba_parse(&color_palette[11], TINYTERM_COLOR0B);
    gdk_rgba_parse(&color_palette[12], TINYTERM_COLOR0C);
    gdk_rgba_parse(&color_palette[13], TINYTERM_COLOR0D);
    gdk_rgba_parse(&color_palette[14], TINYTERM_COLOR0E);
    gdk_rgba_parse(&color_palette[15], TINYTERM_COLOR0F);

    vte_terminal_set_colors(vte, &color_fg, &color_bg, &color_palette, 16);
}
开发者ID:nathan-hoad,项目名称:tinyterm,代码行数:38,代码来源:tinyterm.c


示例10: pango_font_description_free

bool wxNativeFontInfo::FromString(const wxString& s)
{
    if (description)
        pango_font_description_free( description );

    // there is a bug in at least pango <= 1.13 which makes it (or its backends)
    // segfault for very big point sizes and for negative point sizes.
    // To workaround that bug for pango <= 1.13
    // (see http://bugzilla.gnome.org/show_bug.cgi?id=340229)
    // we do the check on the size here using same (arbitrary) limits used by
    // pango > 1.13. Note that the segfault could happen also for pointsize
    // smaller than this limit !!
    wxString str(s);
    const size_t pos = str.find_last_of(_T(" "));
    double size;
    if ( pos != wxString::npos && wxString(str, pos + 1).ToDouble(&size) )
    {
        wxString sizeStr;
        if ( size < 1 )
            sizeStr = _T("1");
        else if ( size >= 1E6 )
            sizeStr = _T("1E6");

        if ( !sizeStr.empty() )
        {
            // replace the old size with the adjusted one
            str = wxString(s, 0, pos) + sizeStr;
        }
    }

    description = pango_font_description_from_string(wxPANGO_CONV(str));

    // ensure a valid facename is selected
    if (!wxFontEnumerator::IsValidFacename(GetFaceName()))
        SetFaceName(wxNORMAL_FONT->GetFaceName());

    return true;
}
开发者ID:EdgarTx,项目名称:wx,代码行数:38,代码来源:fontutil.cpp


示例11: setup_page

static GogPlot *
setup_page (GtkNotebook *notebook, const gchar *service_id)
{
	GtkWidget *child, *w;
	GogChart *chart;
	GogGraph *graph;
	GogLabel *label;
	GogPlot *plot;
	GOData *data;
	GOStyle *style;
	PangoFontDescription *desc;

	child = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_notebook_append_page (notebook, child, gtk_label_new (service_id));
	/* Create a graph widget and add it to the GtkVBox */
	w = go_graph_widget_new (NULL);
	gtk_box_pack_end (GTK_BOX (child), w, TRUE, TRUE, 0);
	/* Get the embedded graph */
	graph = go_graph_widget_get_graph (GO_GRAPH_WIDGET (w));
	/* Add a title */
	label = (GogLabel *) g_object_new (GOG_TYPE_LABEL, NULL);
	data = go_data_scalar_str_new (service_id, FALSE);
	gog_dataset_set_dim (GOG_DATASET (label), 0, data, NULL);
	gog_object_add_by_name (GOG_OBJECT (graph), "Title", GOG_OBJECT (label));
	/* Change the title font */
	style = go_styled_object_get_style (GO_STYLED_OBJECT (label));
	desc = pango_font_description_from_string ("Sans bold 16");
	go_style_set_font_desc (style, desc);
	/* Get the chart created by the widget initialization */
	chart = go_graph_widget_get_chart (GO_GRAPH_WIDGET (w));
	/* Create a plot and add it to the chart */
	plot = (GogPlot *) gog_plot_new_by_name (service_id);
	gog_object_add_by_name (GOG_OBJECT (chart), "Plot", GOG_OBJECT (plot));
	/* Add a legend to the chart */
	gog_object_add_by_name (GOG_OBJECT (chart), "Legend", NULL);

	return plot;
}
开发者ID:UIKit0,项目名称:goffice,代码行数:38,代码来源:go-demo.c


示例12: _draw_footer

static void
_draw_footer(GtkHTML * html, GtkPrintOperation * operation,
	     GtkPrintContext * context,
	     gint page_nr, PangoRectangle * rec, EDITOR * e)
{
	PangoFontDescription *desc;
	PangoLayout *layout;
	gdouble x, y;
	gint n_pages;
	gchar *text;
	cairo_t *cr;

	g_object_get(operation, "n-pages", &n_pages, NULL);
	text = g_strdup_printf(_("Page %d of %d"), page_nr + 1, n_pages);

	desc = pango_font_description_from_string("Sans Regular 10");
	layout = gtk_print_context_create_pango_layout(context);
	pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
	pango_layout_set_font_description(layout, desc);
	pango_layout_set_text(layout, text, -1);
	pango_layout_set_width(layout, rec->width);

	x = pango_units_to_double(rec->x);
	y = pango_units_to_double(rec->y);

	cr = gtk_print_context_get_cairo_context(context);

	cairo_save(cr);
	cairo_set_source_rgb(cr, .0, .0, .0);
	cairo_move_to(cr, x, y);
	pango_cairo_show_layout(cr, layout);
	cairo_restore(cr);

	g_object_unref(layout);
	pango_font_description_free(desc);

	g_free(text);
}
开发者ID:acli,项目名称:xiphos,代码行数:38,代码来源:slib-editor.c


示例13: gw_kanjipadwindow_initialize_candidates

//!
//! @brief To be written
//!
void gw_kanjipadwindow_initialize_candidates (GwKanjipadWindow *window)
{
    //Declarations
    GwKanjipadWindowPrivate *priv;
    gint mask;
    PangoFontDescription *desc;

    //Initializations
    priv = window->priv;
    mask = (GDK_EXPOSURE_MASK  | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
    desc = pango_font_description_from_string ("Sans 18");

    g_signal_connect (priv->candidates, "configure_event", G_CALLBACK (gw_kanjipadwindow_candidatearea_configure_event_cb), window);
    g_signal_connect (priv->candidates, "draw", G_CALLBACK (gw_kanjipadwindow_candidatearea_draw_cb), window);
    g_signal_connect (priv->candidates, "button_press_event", G_CALLBACK (gw_kanjipadwindow_candidatearea_button_press_event_cb), window);
    gtk_widget_add_events (GTK_WIDGET (priv->candidates), mask);

    if (desc != NULL)
    {
      gtk_widget_override_font (GTK_WIDGET (priv->candidates), desc);
      pango_font_description_free (desc);
    }
}
开发者ID:kyoushuu,项目名称:gwaei,代码行数:26,代码来源:kanjipad-candidatearea.c


示例14: write_chars

void write_chars(term_data* td, int x, int y, int n, byte a, const char* text)
{
	PangoLayout *layout;
	PangoFontDescription* font;
	cairo_t *cr;
	
	clear_chars(td, x, y, n);
	
	cr = cairo_create(td->surface);
	set_foreground_color(cr, a);
	
	layout = pango_cairo_create_layout(cr);
	font = pango_font_description_from_string(td->font.name);
	pango_layout_set_font_description (layout, font);
	pango_layout_set_text (layout, text, n);
	
	cairo_move_to(cr, x * td->font.w, y * td->font.h);
	pango_cairo_show_layout (cr, layout);

	g_object_unref (layout);
	pango_font_description_free(font);
	cairo_destroy(cr);
}
开发者ID:arcum42,项目名称:angband,代码行数:23,代码来源:gtk-drawing.c


示例15: select_font

void select_font(GtkWidget *widget, gpointer label)
{
	GtkResponseType result;

	GtkWidget *dialog = gtk_font_selection_dialog_new("Select Font");
	result = gtk_dialog_run(GTK_DIALOG(dialog));

	if( result == GTK_RESPONSE_OK || result == GTK_RESPONSE_APPLY)
	{
		PangoFontDescription *font_desc;
		gchar *fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(dialog));

		g_printf("%s\n", fontname);

		font_desc = pango_font_description_from_string(fontname);

		gtk_widget_modify_font(GTK_WIDGET(label), font_desc);

		g_free(fontname);
	}

	gtk_widget_destroy(dialog);
}
开发者ID:4179e1,项目名称:misc,代码行数:23,代码来源:main.c


示例16: chat_text_view_system_font_update

static void
chat_text_view_system_font_update (EmpathyChatTextView *view)
{
	EmpathyChatTextViewPriv *priv = GET_PRIV (view);
	PangoFontDescription *font_description = NULL;
	gchar                *font_name;

	font_name = g_settings_get_string (priv->gsettings_desktop,
			EMPATHY_PREFS_DESKTOP_INTERFACE_DOCUMENT_FONT_NAME);

	if (font_name != NULL) {
		font_description = pango_font_description_from_string (font_name);
		g_free (font_name);
	} else {
		font_description = NULL;
	}

	gtk_widget_override_font (GTK_WIDGET (view), font_description);

	if (font_description) {
		pango_font_description_free (font_description);
	}
}
开发者ID:JGulic,项目名称:empathy,代码行数:23,代码来源:empathy-chat-text-view.c


示例17: prepare_file_view

static void prepare_file_view(void)
{
	GtkCellRenderer *text_renderer;
	GtkTreeViewColumn *column;
	GtkTreeSelection *selection;
	PangoFontDescription *pfd;

	file_store = gtk_list_store_new(FILEVIEW_N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);

	gtk_tree_view_set_model(GTK_TREE_VIEW(file_view), GTK_TREE_MODEL(file_store));

	text_renderer = gtk_cell_renderer_text_new();
	column = gtk_tree_view_column_new();
	gtk_tree_view_column_pack_start(column, text_renderer, TRUE);
	gtk_tree_view_column_set_attributes(column, text_renderer, "text", FILEVIEW_COLUMN_NAME,
					    NULL);
	gtk_tree_view_append_column(GTK_TREE_VIEW(file_view), column);
	gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(file_view), FALSE);

	gtk_tree_view_set_enable_search(GTK_TREE_VIEW(file_view), TRUE);
	gtk_tree_view_set_search_column(GTK_TREE_VIEW(file_view), FILEVIEW_COLUMN_NAME);

	pfd = pango_font_description_from_string(geany_data->interface_prefs->tagbar_font);
	gtk_widget_modify_font(file_view, pfd);
	pango_font_description_free(pfd);

	/* selection handling */
	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(file_view));
	gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);

	g_signal_connect(G_OBJECT(file_view), "button-release-event",
			 G_CALLBACK(on_button_release), NULL);
	g_signal_connect(G_OBJECT(file_view), "button-press-event",
			 G_CALLBACK(on_button_press), NULL);

	g_signal_connect(G_OBJECT(file_view), "key-press-event", G_CALLBACK(on_key_press), NULL);
}
开发者ID:BYC,项目名称:geany-plugins,代码行数:37,代码来源:sidebar.c


示例18: create_gui

static void create_gui(struct application_info *app)
{
	PangoFontDescription *font_desc = NULL;

	/* Main window. */
	app->gui.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	g_signal_connect(G_OBJECT(app->gui.window), "delete_event",
	                 G_CALLBACK(gtk_main_quit), NULL);
	g_signal_connect(G_OBJECT(app->gui.window), "destroy",
	                 G_CALLBACK(gtk_main_quit), NULL);
	gtk_window_set_has_resize_grip(GTK_WINDOW(app->gui.window), FALSE);
	gtk_window_set_title(GTK_WINDOW(app->gui.window), "stopclock");

	/* The layout box. */
	app->gui.box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10);

	/* Create two labels and adjust their font. */
	app->gui.clock = gtk_label_new("00:00");
	app->gui.timer = gtk_label_new("00:00:00");
	update_labels(app);

	font_desc = pango_font_description_from_string(LABEL_FONT);
	gtk_widget_modify_font(app->gui.clock, font_desc);
	gtk_widget_modify_font(app->gui.timer, font_desc);
	pango_font_description_free(font_desc);

	/* Timeout callback. */
	g_timeout_add(500, (GSourceFunc)update_labels, app);

	/* Connect all the containers and show the window. */
	gtk_box_pack_start(GTK_BOX(app->gui.box), app->gui.clock,
	                   TRUE, TRUE, 0);
	gtk_box_pack_start(GTK_BOX(app->gui.box), app->gui.timer,
	                   TRUE, TRUE, 0);
	gtk_container_add(GTK_CONTAINER(app->gui.window), app->gui.box);
	gtk_widget_show_all(app->gui.window);
}
开发者ID:tohn,项目名称:slinp,代码行数:37,代码来源:stopclock.c


示例19: style_set

void style_set(const gchar *font, gint x, gint y, gint off_x, gint off_y,
               gint width, gint height, gdouble r, gdouble g, gdouble b,
               gdouble a, const gchar *bg, const gchar *border,
               gdouble border_width) {
    if (font) {
        pango_font_description_free(lualock.style.font_desc);
        lualock.style.font_desc = pango_font_description_from_string(font);
    }
    
    lualock.style.x = x;
    lualock.style.y = y;
    lualock.style.off_x = off_x;
    lualock.style.off_y = off_y;
    lualock.style.width = width;
    lualock.style.height = height;
    lualock.style.r = r;
    lualock.style.g = g;
    lualock.style.b = b;
    lualock.style.a = a;
    
    GdkRGBA bg_color, border_color;
    
    gdk_rgba_parse(&bg_color, bg ? bg : "white");
    
    lualock.style.bg_color = bg_color;
    
    gdk_rgba_parse(&border_color, border ? border : "rgba(0, 0, 0, 0.6)");
    
    lualock.style.border_color = border_color;
    
    lualock.style.border_width = border_width;
    
    cairo_surface_t *old_pw_surface = lualock.pw_surface;
    lualock.pw_surface = create_surface(width, height);
    cairo_surface_destroy(old_pw_surface);
}
开发者ID:Guff,项目名称:lualock,代码行数:36,代码来源:style.c


示例20: init_ui

static void init_ui( squidge_t *sq )
{
	GtkBuilder *builder;
	PangoFontDescription *pf;
	GtkAdjustment *v;

	builder = gtk_builder_new();
	g_assert( gtk_builder_add_from_string( builder, squidge_gtkbuilder, -1, NULL ) );

	obj( GTK_WINDOW, win );
	obj( GTK_NOTEBOOK, notebook );
	obj( GTK_IMAGE, splash );
	obj( GTK_TEXT_VIEW, log_textview );
	obj( GTK_SCROLLED_WINDOW, log_scroll );

	sq->ui.text_buffer = gtk_text_view_get_buffer(sq->ui.log_textview);
	load_splash(sq);
	camview_init( &sq->camview, builder );

	/* We want a monospace font */
	pf = pango_font_description_from_string("Monospace 10");
	g_assert( pf != NULL );
	gtk_widget_modify_font( GTK_WIDGET(sq->ui.log_textview), pf );
	pango_font_description_free( pf );

	/* We want the value-changed signal so we can stop following the bottom */
	v = gtk_scrolled_window_get_vadjustment( sq->ui.log_scroll );
	g_signal_connect( v, "value-changed",
			  G_CALLBACK(vert_value_changed), sq );
	g_signal_connect( v, "changed",
			  G_CALLBACK(vert_changed), sq );

	gtk_builder_connect_signals( builder, sq );
	g_object_unref( G_OBJECT(builder) );
	gtk_widget_show( GTK_WIDGET(sq->ui.win) );
}
开发者ID:shaywood,项目名称:srobo-squidge,代码行数:36,代码来源:squidge.c



注:本文中的pango_font_description_from_string函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pango_font_description_get_family函数代码示例发布时间:2022-05-30
下一篇:
C++ pango_font_description_free函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap