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

C++ pango_attr_list_unref函数代码示例

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

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



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

示例1: _st_set_text_from_style

/**
 * _st_set_text_from_style:
 * @text: Target #ClutterText
 * @theme_node: Source #StThemeNode
 *
 * Set various GObject properties of the @text object using
 * CSS information from @theme_node.
 */
void
_st_set_text_from_style (ClutterText *text,
                         StThemeNode *theme_node)
{

  ClutterColor color;
  StTextDecoration decoration;
  PangoAttrList *attribs = NULL;
  const PangoFontDescription *font;
  StTextAlign align;

  st_theme_node_get_foreground_color (theme_node, &color);
  clutter_text_set_color (text, &color);

  font = st_theme_node_get_font (theme_node);
  clutter_text_set_font_description (text, (PangoFontDescription *) font);

  decoration = st_theme_node_get_text_decoration (theme_node);
  if (decoration)
    {
      attribs = pango_attr_list_new ();

      if (decoration & ST_TEXT_DECORATION_UNDERLINE)
        {
          PangoAttribute *underline = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
          pango_attr_list_insert (attribs, underline);
        }
      if (decoration & ST_TEXT_DECORATION_LINE_THROUGH)
        {
          PangoAttribute *strikethrough = pango_attr_strikethrough_new (TRUE);
          pango_attr_list_insert (attribs, strikethrough);
        }
      /* Pango doesn't have an equivalent attribute for _OVERLINE, and we deliberately
       * skip BLINK (for now...)
       */
    }

  clutter_text_set_attributes (text, attribs);

  if (attribs)
    pango_attr_list_unref (attribs);

  align = st_theme_node_get_text_align (theme_node);
  if (align == ST_TEXT_ALIGN_JUSTIFY)
    {
      clutter_text_set_justify (text, TRUE);
      clutter_text_set_line_alignment (text, PANGO_ALIGN_LEFT);
    }
  else
    {
      clutter_text_set_justify (text, FALSE);
      clutter_text_set_line_alignment (text, (PangoAlignment) align);
    }
}
开发者ID:Endika,项目名称:gnome-shell,代码行数:62,代码来源:st-private.c


示例2: go_pango_translate_attributes

PangoAttrList *
go_pango_translate_attributes (PangoAttrList *attrs)
{
	PangoAttrList *n_attrs, *filtered;

	if (attrs == NULL)
		return NULL;

	n_attrs = pango_attr_list_copy (attrs);
	filtered = pango_attr_list_filter (n_attrs, filter_func, NULL);

	if (filtered == NULL) {
		pango_attr_list_unref (n_attrs);
		return attrs;
	} else {
		PangoAttrIterator *iter, *f_iter;
		f_iter = pango_attr_list_get_iterator (filtered);
		do {
			gint f_range_start, f_range_end;
			gint range_start, range_end;
			/* We need to restart everytime since we are changing n_attrs */
			iter = pango_attr_list_get_iterator (n_attrs);
			pango_attr_iterator_range (f_iter, &f_range_start,
						   &f_range_end);
			pango_attr_iterator_range (iter, &range_start,
						   &range_end);
			while (range_end <= f_range_start) {
				if (!pango_attr_iterator_next (iter))
					break;
				pango_attr_iterator_range (iter, &range_start,
						   &range_end);
			}
			/* Now range_end > f_range_start >= range_start */
			go_pango_translate_here (iter, f_iter, n_attrs);
			pango_attr_iterator_destroy (iter);
		} while (pango_attr_iterator_next (f_iter));
		pango_attr_iterator_destroy (f_iter);
	}
	pango_attr_list_unref (filtered);
	return n_attrs;
}
开发者ID:UIKit0,项目名称:goffice,代码行数:41,代码来源:go-pango-extras.c


示例3: gtk_label_set_attribute_bold

void
gtk_label_set_attribute_bold(GtkLabel *label)
{
	PangoAttrList *Bold = pango_attr_list_new();
	PangoAttribute *Attribute = NULL;
	Attribute = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
	pango_attr_list_insert(Bold, Attribute);

	gtk_label_set_attributes(label, Bold);

	pango_attr_list_unref(Bold);
}
开发者ID:HuayraLinux,项目名称:huayra-accesibility-settings,代码行数:12,代码来源:huayra-hig.c


示例4: clear_pending_preedit

static void
clear_pending_preedit(struct text_entry *entry)
{
	memset(&entry->pending_commit, 0, sizeof entry->pending_commit);

	pango_attr_list_unref(entry->preedit_info.attr_list);

	entry->preedit_info.cursor = 0;
	entry->preedit_info.attr_list = NULL;

	memset(&entry->preedit_info, 0, sizeof entry->preedit_info);
}
开发者ID:bpeel,项目名称:weston,代码行数:12,代码来源:editor.c


示例5: cdfont

static int cdfont(cdCtxCanvas *ctxcanvas, const char *typeface, int style, int size)
{
  int is_italic = 0, is_bold = 0;   /* default is CD_PLAIN */
  int is_strikeout = 0, is_underline = 0;
  char font[256];
  PangoAttrList *attrs;

  if (cdStrEqualNoCase(typeface, "Courier") || cdStrEqualNoCase(typeface, "Courier New"))
    typeface = "Monospace";
  else if (cdStrEqualNoCase(typeface, "Times") || cdStrEqualNoCase(typeface, "Times New Roman"))
    typeface = "Serif";
  else if (cdStrEqualNoCase(typeface, "Helvetica") || cdStrEqualNoCase(typeface, "Arial"))
    typeface = "Sans";

  if (style & CD_BOLD)
    is_bold = 1;

  if (style & CD_ITALIC)
    is_italic = 1;

  if (style & CD_UNDERLINE)
    is_underline = 1;

  if (style & CD_STRIKEOUT)
    is_strikeout = 1;

  size = cdGetFontSizePoints(ctxcanvas->canvas, size);

  sprintf(font, "%s, %s%s%d", typeface, is_bold?"Bold ":"", is_italic?"Italic ":"", size);

  if (ctxcanvas->fontdesc) 
    pango_font_description_free(ctxcanvas->fontdesc);

  ctxcanvas->fontdesc = pango_font_description_from_string(font);

  if (!ctxcanvas->fontdesc)
    return 0;

  if (ctxcanvas->fontlayout)  
    g_object_unref(ctxcanvas->fontlayout);

  ctxcanvas->fontlayout = pango_layout_new(ctxcanvas->fontcontext);
  pango_layout_set_font_description(ctxcanvas->fontlayout, ctxcanvas->fontdesc);

  attrs = pango_attr_list_new();
  pango_attr_list_insert(attrs, pango_attribute_copy(pango_attr_strikethrough_new(is_strikeout ? TRUE : FALSE)));
  pango_attr_list_insert(attrs, pango_attribute_copy(pango_attr_underline_new(is_underline ? PANGO_UNDERLINE_SINGLE : PANGO_UNDERLINE_NONE)));
  pango_layout_set_attributes(ctxcanvas->fontlayout, attrs);

  pango_attr_list_unref(attrs);

  return 1;
}
开发者ID:LuaDist,项目名称:cd,代码行数:53,代码来源:cdgdk.c


示例6: pango_font_description_free

			void GuiSolidLabelElementRenderer::FinalizeInternal()
			{
				pango_font_description_free(pangoFontDesc);

				if(layout)
				{
					g_object_unref(layout);
					layout = NULL;
				}

				if(attrList)
					pango_attr_list_unref(attrList);
			}
开发者ID:Ikari2015,项目名称:XGac,代码行数:13,代码来源:GuiSolidLabelElementRenderer.cpp


示例7: scale_label

static void
scale_label(GtkEventBox *button, double scale)
{
  GtkWidget *label;
  PangoAttrList *attrs = pango_attr_list_new();
  PangoAttribute *attr = pango_attr_scale_new(scale);

  pango_attr_list_insert(attrs, attr);
  label = gtk_bin_get_child(GTK_BIN(button));
  if (GTK_IS_LABEL(label))
    gtk_label_set_attributes(GTK_LABEL(label), attrs);
  pango_attr_list_unref(attrs);
}
开发者ID:NgoHuy,项目名称:uim,代码行数:13,代码来源:uim-cand-win-horizontal-gtk.c


示例8: label_set_bold

static void
label_set_bold (GtkLabel *label,
                gboolean  bold)
{
        PangoAttrList *attrs;
        PangoAttribute *attr;

        attrs = pango_attr_list_new ();
        attr = pango_attr_weight_new (bold ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL);
        pango_attr_list_insert (attrs, attr);
        gtk_label_set_attributes (label, attrs);
        pango_attr_list_unref (attrs);
}
开发者ID:gauravjuvekar,项目名称:cinnamon-control-center,代码行数:13,代码来源:um-account-dialog.c


示例9: gtk_label_new

static GtkWidget *getTitleLabel() {
    GtkWidget *label = gtk_label_new (_("Home"));
    gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
    PangoAttrList *attr_list = pango_attr_list_new ();
    PangoAttribute *attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
    pango_attr_list_insert (attr_list, attr);
    gtk_label_set_attributes (GTK_LABEL (label), attr_list);
    pango_attr_list_unref (attr_list);
    gtk_widget_set_hexpand (label, TRUE);
    gtk_widget_set_vexpand (label, TRUE);
    gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
    return label;
}
开发者ID:lanoxx,项目名称:window-picker-applet,代码行数:14,代码来源:task-title.c


示例10: text_entry_reset_preedit

static void
text_entry_reset_preedit(struct text_entry *entry)
{
	entry->preedit.cursor = 0;

	free(entry->preedit.text);
	entry->preedit.text = NULL;

	free(entry->preedit.commit);
	entry->preedit.commit = NULL;

	pango_attr_list_unref(entry->preedit.attr_list);
	entry->preedit.attr_list = NULL;
}
开发者ID:etrunko,项目名称:weston,代码行数:14,代码来源:editor.c


示例11: cb_dialog_so_styled_text_widget_changed

static void
cb_dialog_so_styled_text_widget_changed (GnmTextView *gtv, DialogSOStyled *state)
{
	gchar *text;
	PangoAttrList *attr;

	g_object_get (gtv, "text", &text, NULL);
	g_object_set (state->so, "text", text, NULL);
	g_free (text);

	g_object_get (gtv, "attributes", &attr, NULL);
	g_object_set (state->so, "markup", attr, NULL);
	pango_attr_list_unref (attr);
}
开发者ID:nzinfo,项目名称:gnumeric,代码行数:14,代码来源:dialog-so-styled.c


示例12: gth_task_progress_init

static void
gth_task_progress_init (GthTaskProgress *self)
{
	GtkWidget     *vbox;
	PangoAttrList *attr_list;
	GtkWidget     *image;

	self->task = NULL;
	self->pulse_event = 0;

	vbox = gtk_vbox_new (FALSE, 3);
	gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
	gtk_widget_show (vbox);
	gtk_box_pack_start (GTK_BOX (self), vbox, TRUE, TRUE, 0);

	self->description_label = gtk_label_new ("");
	gtk_misc_set_alignment (GTK_MISC (self->description_label), 0.0, 0.5);
	gtk_widget_show (self->description_label);
	gtk_box_pack_start (GTK_BOX (vbox), self->description_label, FALSE, FALSE, 0);

	self->fraction_progressbar = gtk_progress_bar_new ();
	gtk_widget_set_size_request (self->fraction_progressbar, -1, 15);
	gtk_widget_show (self->fraction_progressbar);
	gtk_box_pack_start (GTK_BOX (vbox), self->fraction_progressbar, FALSE, FALSE, 0);

	self->details_label = gtk_label_new ("");
	attr_list = pango_attr_list_new ();
	pango_attr_list_insert (attr_list, pango_attr_size_new (8500));
	g_object_set (self->details_label, "attributes", attr_list, NULL);
	gtk_misc_set_alignment (GTK_MISC (self->details_label), 0.0, 0.5);
	gtk_widget_show (self->details_label);
	gtk_box_pack_start (GTK_BOX (vbox), self->details_label, FALSE, FALSE, 0);

	vbox = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox);
	gtk_box_pack_start (GTK_BOX (self), vbox, FALSE, FALSE, 0);

	self->cancel_button = gtk_button_new ();
	gtk_widget_show (self->cancel_button);
	g_signal_connect (self->cancel_button, "clicked", G_CALLBACK (cancel_button_clicked_cb), self);
	gtk_widget_set_tooltip_text (self->cancel_button, _("Cancel operation"));
	gtk_box_pack_start (GTK_BOX (vbox), self->cancel_button, TRUE, FALSE, 0);

	image = gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_MENU);
	gtk_widget_show (image);
	gtk_container_add (GTK_CONTAINER (self->cancel_button), image);

	pango_attr_list_unref (attr_list);
}
开发者ID:Peliadia,项目名称:gthumb,代码行数:49,代码来源:gth-progress-dialog.c


示例13: go_pango_translate_layout

void
go_pango_translate_layout (PangoLayout *layout)
{
	PangoAttrList *attrs, *n_attrs;

	g_return_if_fail (layout != NULL);

	attrs = pango_layout_get_attributes (layout);
	n_attrs = go_pango_translate_attributes (attrs);
	if (attrs != n_attrs) {
		pango_layout_set_attributes (layout, n_attrs);
		pango_attr_list_unref (n_attrs);
	}

}
开发者ID:UIKit0,项目名称:goffice,代码行数:15,代码来源:go-pango-extras.c


示例14: hippo_canvas_text_finalize

static void
hippo_canvas_text_finalize(GObject *object)
{
    HippoCanvasText *text = HIPPO_CANVAS_TEXT(object);

    g_free(text->text);
    text->text = NULL;

    if (text->attributes) {
        pango_attr_list_unref(text->attributes);
        text->attributes = NULL;
    }
    
    G_OBJECT_CLASS(hippo_canvas_text_parent_class)->finalize(object);
}
开发者ID:GNOME,项目名称:hippo-canvas,代码行数:15,代码来源:hippo-canvas-text.c


示例15: scim_bridge_client_imcontext_set_preedit_shown

void scim_bridge_client_imcontext_set_preedit_shown (ScimBridgeClientIMContext *imcontext, boolean preedit_shown)
{
    imcontext->preedit_shown = preedit_shown;
    if (!preedit_shown) {
        free (imcontext->preedit_string);
        imcontext->preedit_string = malloc (sizeof (char));
        imcontext->preedit_string[0] = '\0';
        imcontext->preedit_string_capacity = 0;
        imcontext->preedit_cursor_position = 0;
        if (imcontext->preedit_attributes != NULL) {
            pango_attr_list_unref (imcontext->preedit_attributes);
            imcontext->preedit_attributes = NULL;
        }
    }
}
开发者ID:joeangel,项目名称:scim,代码行数:15,代码来源:scim-bridge-client-imcontext-gtk.c


示例16: gimp_frame_label_widget_notify

static void
gimp_frame_label_widget_notify (GtkFrame *frame)
{
  GtkWidget *label_widget = gtk_frame_get_label_widget (frame);

  if (label_widget)
    {
      GtkLabel *label = NULL;

      if (GTK_IS_LABEL (label_widget))
        {
          gfloat xalign, yalign;

          label = GTK_LABEL (label_widget);

          gtk_frame_get_label_align (frame, &xalign, &yalign);
          gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
        }
      else if (GTK_IS_BIN (label_widget))
        {
          GtkWidget *child = gtk_bin_get_child (GTK_BIN (label_widget));

          if (GTK_IS_LABEL (child))
            label = GTK_LABEL (child);
        }

      if (label)
        {
          PangoAttrList  *attrs = pango_attr_list_new ();
          PangoAttribute *attr;
          gboolean        bold;

          gtk_widget_style_get (GTK_WIDGET (frame), "label_bold", &bold, NULL);

          attr = pango_attr_weight_new (bold ?
                                        PANGO_WEIGHT_BOLD :
                                        PANGO_WEIGHT_NORMAL);
          attr->start_index = 0;
          attr->end_index   = -1;
          pango_attr_list_insert (attrs, attr);

          gtk_label_set_attributes (label, attrs);

          pango_attr_list_unref (attrs);
        }
    }
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:47,代码来源:gimpframe.c


示例17: matchFont

GList *FontSupport::layoutText(const WFont& font,
			       const std::string& utf8,
			       std::vector<PangoGlyphString *>& glyphs,
			       int& width)
{
  PANGO_LOCK;

  enabledFontFormats = enabledFontFormats_;

  FontMatch match = matchFont(font);
  PangoAttrList *attrs = pango_attr_list_new();

  pango_context_set_font_description(context_, match.pangoFontDescription());
  GList *items
    = pango_itemize(context_, utf8.c_str(), 0, utf8.length(), attrs, nullptr);

  width = 0;

  for (GList *elem = items; elem; elem = elem->next) {
    PangoItem *item = (PangoItem *)elem->data;
    PangoAnalysis *analysis = &item->analysis;

    PangoGlyphString *gl = pango_glyph_string_new();

    pango_shape(utf8.c_str() + item->offset, item->length, analysis, gl);

    glyphs.push_back(gl);

    if (device_) {
      currentFont_ = analysis->font;

      WTextItem textItem
	= device_->measureText(WString::fromUTF8(utf8.substr(item->offset,
							     item->length)),
			       -1, false);

      width += pangoUnitsFromDouble(textItem.width());

      currentFont_ = nullptr;
    } else
      width += pango_glyph_string_get_width(gl);
  }

  pango_attr_list_unref(attrs);

  return items;
}
开发者ID:AlexanderKotliar,项目名称:wt,代码行数:47,代码来源:FontSupportPango.C


示例18: nautilus_trash_bar_init

static void
nautilus_trash_bar_init (NautilusTrashBar *bar)
{
	GtkWidget *content_area, *action_area, *w;
	GtkWidget *label;
	PangoAttrList *attrs;

	bar->priv = NAUTILUS_TRASH_BAR_GET_PRIVATE (bar);
	content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (bar));
	action_area = gtk_info_bar_get_action_area (GTK_INFO_BAR (bar));

	gtk_orientable_set_orientation (GTK_ORIENTABLE (action_area),
					GTK_ORIENTATION_HORIZONTAL);

	attrs = pango_attr_list_new ();
	pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
	label = gtk_label_new (_("Trash"));
	gtk_label_set_attributes (GTK_LABEL (label), attrs);
	pango_attr_list_unref (attrs);

	gtk_widget_show (label);
	gtk_container_add (GTK_CONTAINER (content_area), label);

	w = gtk_info_bar_add_button (GTK_INFO_BAR (bar),
				     _("_Restore"),
				     TRASH_BAR_RESPONSE_RESTORE);
	gtk_widget_set_tooltip_text (w,
				     _("Restore selected items to their original position"));

	w = gtk_info_bar_add_button (GTK_INFO_BAR (bar),
	/* Translators: "Empty" is an action (for the trash) , not a state */
				     _("_Empty"),
				     TRASH_BAR_RESPONSE_EMPTY);
	gtk_widget_set_tooltip_text (w,
				     _("Delete all items in the Trash"));

	g_signal_connect_object (nautilus_trash_monitor_get (),
				 "trash-state-changed",
				 G_CALLBACK (nautilus_trash_bar_trash_state_changed),
				 bar,
				 0);
	nautilus_trash_bar_trash_state_changed (nautilus_trash_monitor_get (),
						FALSE, bar);

	g_signal_connect (bar, "response",
			  G_CALLBACK (trash_bar_response_cb), bar);
}
开发者ID:Oliver-Luo,项目名称:nautilus,代码行数:47,代码来源:nautilus-trash-bar.c


示例19: chanview_pop_cb

static void
chanview_pop_cb (chanview *cv, GtkTreeIter *iter)
{
	chan *ch;
	char *name;
	PangoAttrList *attr;

	gtk_tree_model_get (GTK_TREE_MODEL (cv->store), iter,
							  COL_NAME, &name, COL_CHAN, &ch, COL_ATTR, &attr, -1);
	ch->impl = cv->func_add (cv, ch, name, NULL);
	if (attr)
	{
		cv->func_set_color (ch, attr);
		pango_attr_list_unref (attr);
	}
	g_free (name);
}
开发者ID:AlexTheRose,项目名称:hexchat,代码行数:17,代码来源:chanview.c


示例20: aw_map_view_title_cell_cb

static void
aw_map_view_title_cell_cb (GtkTreeViewColumn *column,
                           GtkCellRenderer   *cell,
                           GtkTreeModel      *model,
                           GtkTreeIter       *iter,
                           gpointer           user_data)
{
  GString        *text       = g_string_new (NULL);
  PangoAttrList  *attributes = NULL;
  AwStar         *star       = NULL;
  double          distance   = 0;
  AwTreeView     *view;

  gtk_tree_model_get (model, iter, 0, &star, -1);

  if (star)
    {
      view = AW_TREE_VIEW (gtk_tree_view_column_get_tree_view (column));

      distance = aw_point_get_distance (AW_MAP_VIEW (view)->priv->origin,
                                        aw_star_get_location (star));

      g_string_append (text, aw_star_get_name (star));
      g_string_append (text, "\n");

      attributes = aw_tree_view_insert_font (view, attributes,
                                             AW_TREE_VIEW_FONT_SECONDARY,
                                             text->len, G_MAXINT);
      attributes = aw_tree_view_insert_color (view, attributes,
                                              AW_TREE_VIEW_COLOR_SECONDARY,
                                              text->len, G_MAXINT);


      g_string_append        (text, _("Location"));
      g_string_append_printf (text, ": %d/%d, ",
                              aw_star_get_x (star),
                              aw_star_get_y (star));
      g_string_append        (text, _("Distance"));
      g_string_append_printf (text, ": %.1f pc", distance);
    }

  g_object_set (cell, "text", text->str, "attributes", attributes, NULL);
  pango_attr_list_unref (attributes);
  g_string_free (text, TRUE);
  aw_star_unref (star);
}
开发者ID:hasselmm,项目名称:awui,代码行数:46,代码来源:map-view.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ pango_cairo_show_layout函数代码示例发布时间:2022-05-30
下一篇:
C++ pango_attr_list_new函数代码示例发布时间: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