本文整理汇总了C++中pango_font_description_new函数的典型用法代码示例。如果您正苦于以下问题:C++ pango_font_description_new函数的具体用法?C++ pango_font_description_new怎么用?C++ pango_font_description_new使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pango_font_description_new函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pango_font_description_new
_HYPlatformButton::_HYPlatformButton (void)
{
_HYButton * parent = (_HYButton*)this;
buttonControl = nil;
buttonRect = (GdkRectangle){0,0,100,100};
buttonFontDesc = pango_font_description_new ();
}
示例2: get_pango_font_description_from_info
static PangoFontDescription *
get_pango_font_description_from_info (gchar *font_family, gchar *font_weight, gint font_size)
{
PangoFontDescription *description = NULL;
PangoWeight pw = PANGO_WEIGHT_NORMAL;
g_assert(font_family);
g_assert(font_weight);
g_assert(font_size > 0);
description = pango_font_description_new();
pango_font_description_set_family(description, font_family);
if (!g_strcmp0(font_weight, "bold")) {
pw = PANGO_WEIGHT_BOLD;
} else {
pw = PANGO_WEIGHT_NORMAL;
}
pango_font_description_set_weight(description, pw);
pango_font_description_set_size(description,
font_size * PANGO_SCALE);
return description;
}
示例3: create_welcome_dialog
GtkWidget *
create_welcome_dialog(void)
{
I7App *theapp = i7_app_get();
GFile *file = i7_app_get_data_file_va(theapp, "ui", "welcomedialog.ui", NULL);
GtkBuilder *builder = create_new_builder(file, theapp);
g_object_unref(file);
GtkWidget *retval = GTK_WIDGET(load_object(builder, "welcomedialog"));
/* Set the background pixmap for this window */
GtkRcStyle *newstyle = gtk_widget_get_modifier_style(retval);
file = i7_app_get_data_file_va(theapp, "Resources", "Welcome Background.png", NULL);
newstyle->bg_pixmap_name[GTK_STATE_NORMAL] = g_file_get_path(file); /* take ownership */
g_object_unref(file);
gtk_widget_modify_style(retval, newstyle);
/* Set the font size to 12 pixels for the widgets in this window */
PangoFontDescription *font = pango_font_description_new();
pango_font_description_set_absolute_size(font, 12.0 * PANGO_SCALE);
gtk_widget_modify_font(GTK_WIDGET(load_object(builder, "welcome_label")), font);
pango_font_description_free(font);
/* If there is no "last project", make the reopen button inactive */
GFile *last_project = i7_app_get_last_opened_project(theapp);
if(last_project) {
gtk_widget_set_sensitive(GTK_WIDGET(load_object(builder, "welcome_reopen_button")), TRUE);
g_object_unref(last_project);
}
g_object_unref(builder);
return retval;
}
示例4: add_text
static void add_text(cairo_surface_t* surface, int x, int y, int size, const char* text)
{
cairo_t* cr = cairo_create(surface);
cairo_set_source_rgb(cr, 1., 1., 1.);
PangoLayout* layout = pango_cairo_create_layout(cr);
pango_layout_set_text(layout, text, -1);
PangoFontDescription* desc = pango_font_description_new();
pango_font_description_set_family(desc, "sans");
pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD);
pango_font_description_set_absolute_size(desc, size * PANGO_SCALE);
pango_layout_set_font_description(layout, desc);
pango_font_description_free(desc);
int w = 0;
int h = 0;
pango_layout_get_pixel_size(layout, &w, &h);
cairo_move_to(cr, (x >= 0) ? x : -(x + (double)w),
(y >= 0) ? y : -(y + (double)h));
pango_cairo_show_layout(cr, layout);
g_object_unref(layout);
cairo_destroy(cr);
}
示例5: _ml_init
/* ml_init */
static MailerPlugin * _ml_init(MailerPluginHelper * helper)
{
MailingLists * ml;
PangoFontDescription * bold;
if((ml = malloc(sizeof(*ml))) == NULL)
return NULL;
ml->helper = helper;
/* widgets */
bold = pango_font_description_new();
pango_font_description_set_weight(bold, PANGO_WEIGHT_BOLD);
ml->vbox = gtk_vbox_new(FALSE, 4);
ml->folder = gtk_label_new("");
gtk_widget_modify_font(ml->folder, bold);
gtk_misc_set_alignment(GTK_MISC(ml->folder), 0.0, 0.5);
gtk_box_pack_start(GTK_BOX(ml->vbox), ml->folder, FALSE, TRUE, 0);
ml->message = gtk_label_new("");
gtk_misc_set_alignment(GTK_MISC(ml->message), 0.0, 0.5);
gtk_box_pack_start(GTK_BOX(ml->vbox), ml->message, FALSE, TRUE, 0);
ml->name = gtk_label_new("");
gtk_misc_set_alignment(GTK_MISC(ml->name), 0.0, 0.5);
gtk_box_pack_start(GTK_BOX(ml->vbox), ml->name, FALSE, TRUE, 0);
pango_font_description_free(bold);
return ml;
}
示例6: gst_time_overlay_class_init
static void
gst_time_overlay_class_init (GstTimeOverlayClass * klass)
{
GstTextOverlayClass *gsttextoverlay_class;
PangoContext *context;
PangoFontDescription *font_description;
gsttextoverlay_class = (GstTextOverlayClass *) klass;
gsttextoverlay_class->get_text = gst_time_overlay_get_text;
g_mutex_lock (GST_TEXT_OVERLAY_CLASS (klass)->pango_lock);
context = GST_TEXT_OVERLAY_CLASS (klass)->pango_context;
pango_context_set_language (context, pango_language_from_string ("en_US"));
pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);
font_description = pango_font_description_new ();
pango_font_description_set_family_static (font_description, "Monospace");
pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
pango_font_description_set_variant (font_description, PANGO_VARIANT_NORMAL);
pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
pango_font_description_set_stretch (font_description, PANGO_STRETCH_NORMAL);
pango_font_description_set_size (font_description, 18 * PANGO_SCALE);
pango_context_set_font_description (context, font_description);
pango_font_description_free (font_description);
g_mutex_unlock (GST_TEXT_OVERLAY_CLASS (klass)->pango_lock);
}
示例7: SetUpStatusBarStuff
void SetUpStatusBarStuff (GtkWidget* aWindow)
{
_String fName = baseDirectory & "GTKResources/striped.xpm";
statusBarLayout = pango_layout_new (screenPContext);
statusBarFontDesc = pango_font_description_new ();
stripedFill = gdk_pixmap_create_from_xpm (GDK_DRAWABLE(aWindow->window), NULL, NULL, fName.sData);
stripedFillGC = gdk_gc_new (GDK_DRAWABLE(aWindow->window));
if (stripedFill)
{
gdk_gc_set_fill (stripedFillGC,GDK_TILED);
gdk_gc_set_tile (stripedFillGC,stripedFill);
}
else
{
printf ("Failed to load a status bar .xpm from %s\n", fName.sData);
}
gdk_gc_set_line_attributes (stripedFillGC, 1, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
GdkColor saveFG = {0,0,0,0};
gdk_gc_set_foreground (stripedFillGC, &saveFG);
pango_font_description_set_family (statusBarFontDesc, statusBarFont.face.sData);
pango_font_description_set_style (statusBarFontDesc, (statusBarFont.style & HY_FONT_ITALIC) ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL);
pango_font_description_set_weight (statusBarFontDesc, (statusBarFont.style & HY_FONT_BOLD) ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL);
pango_font_description_set_size (statusBarFontDesc, statusBarFont.size*PANGO_SCALE);
pango_layout_set_font_description (statusBarLayout, statusBarFontDesc ); // ref ?
pango_layout_set_width (statusBarLayout, -1);
redButtonIcon = (GdkPixbuf*)ProcureIconResource(4000);
yellowButtonIcon = (GdkPixbuf*)ProcureIconResource(4001);
greenButtonIcon = (GdkPixbuf*)ProcureIconResource(4002);
orangeButtonIcon = (GdkPixbuf*)ProcureIconResource(4003);
}
示例8: rg_font
static VALUE
rg_font(VALUE self)
{
PangoFontDescription* desc;
PangoLanguage* lang;
GSList* extra_attrs;
VALUE ary, ret;
desc = pango_font_description_new();
pango_attr_iterator_get_font(_SELF(self), desc, &lang, &extra_attrs);
ary = rb_ary_new();
while(extra_attrs) {
rb_ary_push(ary, ATTR2RVAL(extra_attrs->data));
extra_attrs = extra_attrs->next;
}
ret = rb_ary_new3(3, PANGOFONTDESCRIPTION2RVAL(desc),
PANGOLANGUAGE2RVAL(lang),
ary);
pango_font_description_free(desc);
return ret;
}
示例9: WXUNUSED
void wxFontRefData::Init(int pointSize,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
bool strikethrough,
const wxString& faceName,
wxFontEncoding WXUNUSED(encoding))
{
if (family == wxFONTFAMILY_DEFAULT)
family = wxFONTFAMILY_SWISS;
m_underlined = underlined;
m_strikethrough = strikethrough;
// Create native font info
m_nativeFontInfo.description = pango_font_description_new();
// And set its values
if (!faceName.empty())
{
pango_font_description_set_family( m_nativeFontInfo.description,
wxGTK_CONV_SYS(faceName) );
}
else
{
SetFamily(family);
}
SetStyle( style == wxDEFAULT ? wxFONTSTYLE_NORMAL : style );
SetPointSize( (pointSize == wxDEFAULT || pointSize == -1)
? wxDEFAULT_FONT_SIZE
: pointSize );
SetWeight( weight == wxDEFAULT ? wxFONTWEIGHT_NORMAL : weight );
}
示例10: GetVisibleStringWidth
//________________________________________________________
long GetVisibleStringWidth (_String& s, _HYFont& f)
{
static PangoLayout* textLayout = pango_layout_new (screenPContext);
static PangoFontDescription * fd = pango_font_description_new ();
static _HYFont stashedFont;
if (s.sLength) {
if (stashedFont.size!=f.size || stashedFont.style != f.style || stashedFont.face != f.face) {
HYFont2PangoFontDesc(f,fd);
pango_layout_set_width (textLayout,-1);
pango_layout_set_font_description(textLayout,fd);
stashedFont = f;
}
pango_layout_set_text (textLayout, s.sData,s.sLength);
//PangoRectangle charPos;
//pango_layout_index_to_pos (textLayout,s.sLength-1,&charPos);
//return PANGO_PIXELS(charPos.x+charPos.width);
PangoRectangle extents,
logical_ext;
pango_layout_get_pixel_extents (textLayout,&extents,&logical_ext);
return logical_ext.width;
} else {
return 0;
}
}
示例11: pixbuf_render_text
GdkPixbuf *
pixbuf_render_text(GtkWidget *da, const char *str, int point_size, int r, int g, int b,
int *w, int *h)
{
int width;
int height;
PangoLayout *layout = gtk_widget_create_pango_layout(da, NULL);
PangoFontDescription *desc = pango_font_description_new();
pango_font_description_set_size(desc, point_size * PANGO_SCALE);
pango_layout_set_font_description(layout, desc);
pango_font_description_free(desc);
pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
pango_layout_set_text(layout, str, -1);
pango_layout_get_pixel_size(layout, &width, &height);
GdkPixbuf *pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height);
pixbuf_set_rect_fill(pixbuf, 0, 0, width, height, 0, 0, 0, 0);
pixbuf_draw_layout(pixbuf, layout, da, 0, 0, r, g, b, 255);
//gdk_draw_layout(da->window, da->style->fg_gc[GTK_STATE_NORMAL], 0, 0, layout);
g_object_unref(G_OBJECT(layout));
*w = width;
*h = height;
return pixbuf;
}
示例12: main
int main(int argc, char **argv)
{
GtkWidget *win;
GtkButton *button;
PangoFontDescription *pd;
gtk_init(&argc, &argv);
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(win), "Basic Animation");
g_signal_connect(G_OBJECT(win), "delete-event", gtk_main_quit, NULL);
label = (GtkLabel *)gtk_label_new(hello);
// since we shift a whole character per time, it's better to use
// a monospace font, so that the shifting seems done at the same pace
pd = pango_font_description_new();
pango_font_description_set_family(pd, "monospace");
gtk_widget_modify_font(GTK_WIDGET(label), pd);
button = (GtkButton *)gtk_button_new();
gtk_container_add(GTK_CONTAINER(button), GTK_WIDGET(label));
gtk_container_add(GTK_CONTAINER(win), GTK_WIDGET(button));
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(change_dir), NULL);
slen = strlen(hello);
g_timeout_add(125, scroll_it, NULL);
gtk_widget_show_all(GTK_WIDGET(win));
gtk_main();
return 0;
}
示例13: gtk_combo_new
_HYPlatformPullDown::_HYPlatformPullDown(void)
{
_HYPullDown * parent = (_HYPullDown*)this;
theMenu = gtk_combo_new ();
backFill = HYColorToGDKColor((_HYColor) {
255,255,255
});
gtk_combo_set_value_in_list (GTK_COMBO(theMenu),true,false);
gtk_container_add(GTK_CONTAINER(parent->parentWindow),theMenu);
gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(theMenu)->entry),false);
GList* children = gtk_container_get_children(GTK_CONTAINER(theMenu));
g_signal_connect (GTK_WIDGET(children->next->data),"event",(GCallback)hy_pulldown_selection_start_callback_event,(_HYPullDown*)this);
g_signal_connect (GTK_COMBO(theMenu)->entry,"changed",(GCallback)hy_pulldown_selection_callback,(_HYPullDown*)this);
g_signal_connect (GTK_COMBO(theMenu)->popwin,"hide",(GCallback)hy_pulldown_unmap_event,(_HYPullDown*)this);
g_list_free (children);
//gtk_container_set_resize_mode(GTK_CONTAINER(theMenu), GTK_RESIZE_IMMEDIATE);
selection = 0;
cbSelection = -1;
if (!defaultPullDownFontPD) {
defaultPullDownFontPD = pango_font_description_new();
defaultPullDownFont.size = defaultPullDownFont.size*fontConversionFactor;
HYFont2PangoFontDesc (defaultPullDownFont,defaultPullDownFontPD);
}
gtk_widget_modify_font (theMenu, defaultPullDownFontPD);
gtk_widget_modify_font (GTK_COMBO(theMenu)->entry, defaultPullDownFontPD);
gtk_widget_show (theMenu);
//g_signal_connect (GTK_COMBO(theMenu)->entry,"changed",hy_pulldown_selection_callback,(_HYPullDown*)this);
}
示例14: _title_init
/* title_init */
static Title * _title_init(PanelAppletHelper * helper, GtkWidget ** widget)
{
Title * title;
PangoFontDescription * bold;
if((title = malloc(sizeof(*title))) == NULL)
return NULL;
title->helper = helper;
bold = pango_font_description_new();
pango_font_description_set_weight(bold, PANGO_WEIGHT_BOLD);
title->widget = gtk_label_new("");
gtk_widget_modify_font(title->widget, bold);
pango_font_description_free(bold);
g_signal_connect(G_OBJECT(title->widget), "screen-changed", G_CALLBACK(
_on_screen_changed), title);
title->display = NULL;
title->screen = NULL;
title->root = NULL;
title->atom_active = 0;
title->atom_name = 0;
title->atom_visible_name = 0;
gtk_widget_show(title->widget);
*widget = title->widget;
return title;
}
示例15: pango_font_description_free
void wxFontRefData::Init(int pointSize,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
{
m_family = family == wxFONTFAMILY_DEFAULT ? wxFONTFAMILY_SWISS : family;
m_faceName = faceName;
// we accept both wxDEFAULT and wxNORMAL here - should we?
m_style = style == wxDEFAULT ? wxFONTSTYLE_NORMAL : style;
m_weight = weight == wxDEFAULT ? wxFONTWEIGHT_NORMAL : weight;
m_underlined = underlined;
m_encoding = encoding;
#if wxUSE_UNICODE
if ( m_nativeFontInfo.description )
pango_font_description_free(m_nativeFontInfo.description);
// Create native font info
m_nativeFontInfo.description = pango_font_description_new();
// if a face name is specified, use it if it's available, otherwise use
// just the family
if ( faceName.empty() || !wxFontEnumerator::IsValidFacename(faceName) )
{
// TODO: scan system for valid fonts matching the given family instead
// of hardcoding them here
switch ( m_family )
{
case wxFONTFAMILY_TELETYPE:
m_faceName = wxT("monospace");
break;
case wxFONTFAMILY_ROMAN:
m_faceName = wxT("serif");
break;
default:
m_faceName = wxT("sans");
}
}
else // specified face name is available, use it
{
m_faceName = faceName;
}
m_nativeFontInfo.SetFaceName(m_faceName);
m_nativeFontInfo.SetWeight((wxFontWeight)m_weight);
m_nativeFontInfo.SetStyle((wxFontStyle)m_style);
#endif // wxUSE_UNICODE
SetPointSize(pointSize);
}