本文整理汇总了C++中pango_attr_list_unref函数的典型用法代码示例。如果您正苦于以下问题:C++ pango_attr_list_unref函数的具体用法?C++ pango_attr_list_unref怎么用?C++ pango_attr_list_unref使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pango_attr_list_unref函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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;
}
}
}