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

C++ pango_font_description_get_size函数代码示例

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

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



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

示例1: key_press_cb

/* callback to react to key press events */
static gboolean
key_press_cb(VteTerminal* vte, GdkEventKey* event)
{
    if ((event->state & (TINYTERM_MODIFIER)) == (TINYTERM_MODIFIER)) {
        switch (gdk_keyval_to_upper(event->keyval)) {
            case TINYTERM_KEY_FONTSIZE_INCREASE:
            {
                const PangoFontDescription *font = vte_terminal_get_font(vte);
                pango_font_description_set_size(font, (pango_font_description_get_size(font) / PANGO_SCALE + 1) * PANGO_SCALE);
                vte_terminal_set_font(vte, font);
                return TRUE;
            }
            case TINYTERM_KEY_FONTSIZE_DECREASE:
            {
                const PangoFontDescription *font = vte_terminal_get_font(vte);
                const gint size = pango_font_description_get_size(font) / PANGO_SCALE - 1;
                if (size > 0) {
                    pango_font_description_set_size(font, size * PANGO_SCALE);
                    vte_terminal_set_font(vte, font);
                }
                return TRUE;
            }
        }
    }
    return FALSE;
}
开发者ID:nathan-hoad,项目名称:tinyterm,代码行数:27,代码来源:tinyterm.c


示例2: clock_init_fonts

void clock_init_fonts()
{
    if (!time1_font_desc) {
        time1_font_desc = pango_font_description_from_string(get_default_font());
        pango_font_description_set_weight(time1_font_desc, PANGO_WEIGHT_BOLD);
        pango_font_description_set_size(time1_font_desc, pango_font_description_get_size(time1_font_desc));
    }
    if (!time2_font_desc) {
        time2_font_desc = pango_font_description_from_string(get_default_font());
        pango_font_description_set_size(time2_font_desc,
                                        pango_font_description_get_size(time2_font_desc) - PANGO_SCALE);
    }
}
开发者ID:BunsenLabs,项目名称:tint2,代码行数:13,代码来源:clock.c


示例3: get_font_size

/* Return the font size in Pango units for the font size setting */
gint
get_font_size(PangoFontDescription *font)
{
	I7App *theapp = i7_app_get();
	double size = pango_font_description_get_size(font);

	if(pango_font_description_get_size_is_absolute(font))
		size *= 96.0 / 72.0; /* a guess; not likely to be absolute anyway */
	if(size == 0.0)
		size = DEFAULT_SIZE_STANDARD * PANGO_SCALE;

	switch(g_settings_get_enum(i7_app_get_prefs(theapp), PREFS_FONT_SIZE)) {
		case FONT_SIZE_MEDIUM:
			size *= RELATIVE_SIZE_MEDIUM;
			break;
		case FONT_SIZE_LARGE:
			size *= RELATIVE_SIZE_LARGE;
			break;
		case FONT_SIZE_HUGE:
			size *= RELATIVE_SIZE_HUGE;
			break;
		default:
			size *= RELATIVE_SIZE_STANDARD;
	}
	return size;
}
开发者ID:BartMassey,项目名称:gnome-inform7,代码行数:27,代码来源:configfile.c


示例4: gkbd_indicator_config_get_font_for_widget

void
gkbd_indicator_config_get_font_for_widget (GkbdIndicatorConfig *
					   ind_config, GtkWidget * widget,
					   gchar ** font_family,
					   int *font_size)
{
	GtkStyleContext *context;
	const PangoFontDescription *fd = NULL;

	g_return_if_fail (GTK_IS_WIDGET (widget));

	if (ind_config->font_family != NULL &&
	    ind_config->font_family[0] != '\0') {
		if (font_family)
			*font_family = g_strdup (ind_config->font_family);
		if (font_size)
			*font_size = ind_config->font_size;

		return;
	}

	context = gtk_widget_get_style_context (widget);
	fd = gtk_style_context_get_font (context, GTK_STATE_FLAG_NORMAL);

	if (font_family)
		*font_family =
		    g_strdup (pango_font_description_get_family (fd));
	if (font_size)
		*font_size =
		    pango_font_description_get_size (fd) / PANGO_SCALE;
}
开发者ID:Ariozo,项目名称:libgnomekbd,代码行数:31,代码来源:gkbd-indicator-config.c


示例5: util_split_font_string

static gboolean
util_split_font_string(const gchar *font_name, gchar **name, gint *size)
{
	PangoFontDescription *desc;
	PangoFontMask         mask;
	gboolean              retval = FALSE;

	if (font_name == NULL) {
		return FALSE;
	}

	mask = (PangoFontMask) (PANGO_FONT_MASK_FAMILY | PANGO_FONT_MASK_SIZE);

	desc = pango_font_description_from_string(font_name);
	if (!desc) {
		return FALSE;
	}

	if ((pango_font_description_get_set_fields(desc) & mask) == mask) {
		*size = PANGO_PIXELS(pango_font_description_get_size (desc));
		*name = g_strdup(pango_font_description_get_family (desc));
		retval = TRUE;
	}

	pango_font_description_free(desc);

	return retval;
}
开发者ID:WangGL1985,项目名称:chmsee,代码行数:28,代码来源:gecko_utils.cpp


示例6: apply_subtitle_style_to_layout

static void
apply_subtitle_style_to_layout (GtkStyleContext *context,
                                PangoLayout     *layout,
                                GtkStateFlags    flags)
{
  PangoFontDescription *desc;
  PangoAttrList *layout_attr;
  PangoAttribute *attr_alpha;

  gtk_style_context_save (context);
  gtk_style_context_set_state (context, flags);
  gtk_style_context_get (context, gtk_style_context_get_state (context),
                         "font", &desc,
                         NULL);
  gtk_style_context_restore (context);

  /* Set the font size */
  pango_font_description_set_size (desc, pango_font_description_get_size (desc) * SUBTITLE_SIZE_PERCENTAGE);
  pango_layout_set_font_description (layout, desc);
  pango_font_description_free (desc);

  /* Set the font alpha */
  layout_attr = pango_attr_list_new ();
  attr_alpha = pango_attr_foreground_alpha_new (SUBTITLE_DIM_PERCENTAGE * 65535);
  pango_attr_list_insert (layout_attr, attr_alpha);

  pango_layout_set_attributes (layout, layout_attr);
  pango_attr_list_unref (layout_attr);
}
开发者ID:Ahimta,项目名称:epiphany,代码行数:29,代码来源:gd-two-lines-renderer.c


示例7: g_object_get

bool GtkToolkitUiSettings::GetDefaultFont(FontDetails& font)
{
	gchararray font_face = 0;
	g_object_get(m_settings, "gtk-font-name", &font_face, NULL);
	PangoFontDescription* font_desc = pango_font_description_from_string(font_face);
	g_free(font_face);
	if (!font_desc)
		return false; 

	const char* family = pango_font_description_get_family(font_desc);

	if (family)
	{
		if (strcmp(family, "Sans") == 0)
			font.type = SANSSERIF;
		else if (strcmp(family, "Serif") == 0)
			font.type = SERIF;
		else if (strcmp(family, "Monospace") == 0)
			font.type = MONOSPACE;

		font.family = strdup(family);
	}
	font.weight = pango_font_description_get_weight(font_desc) / 100;
	font.italic = pango_font_description_get_style(font_desc) == PANGO_STYLE_ITALIC;
	font.smallcaps = pango_font_description_get_variant(font_desc) == PANGO_VARIANT_SMALL_CAPS;
	
	double size = pango_font_description_get_size(font_desc) / PANGO_SCALE;
	font.size = size;

	pango_font_description_free(font_desc);

	return true;
}
开发者ID:prestocore,项目名称:browser,代码行数:33,代码来源:GtkToolkitUiSettings.cpp


示例8: gm_cell_renderer_bitext_update_style

static void
gm_cell_renderer_bitext_update_style (GmCellRendererBitext* renderer,
				      GtkWidget* widget)
{
  GtkStyleContext *style = NULL;
  GtkStateFlags state;
  PangoAttrList *attr_list = NULL;
  PangoAttribute *attr_size = NULL;
  const PangoFontDescription* font = NULL;

  style = gtk_widget_get_style_context (widget);
  state = gtk_widget_get_state_flags (widget);

  attr_list = pango_attr_list_new ();

  /* we want the secondary text smaller */
  gtk_style_context_get (style, state,
			 "font", &font,
			 NULL);
  attr_size = pango_attr_size_new ((int) (pango_font_description_get_size (font) * 0.8));
  attr_size->start_index = strlen (renderer->priv->primary_text) + 1;
  attr_size->end_index = (guint) - 1;
  pango_attr_list_insert (attr_list, attr_size);

  g_object_set (renderer,
		"visible", TRUE,
		"weight", PANGO_WEIGHT_NORMAL,
		"attributes", attr_list,
		NULL);
  pango_attr_list_unref (attr_list);
}
开发者ID:UIKit0,项目名称:ekiga,代码行数:31,代码来源:gm-cell-renderer-bitext.c


示例9: NSA_GET_G2D_PTR

JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFont 
   (JNIEnv *env, jobject obj, jobject font)
{
  struct graphics2d *gr = NULL;
  struct peerfont *pfont = NULL;
  cairo_font_t *ft = NULL;
  FT_Face face = NULL;

  gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
  g_assert (gr != NULL);

  pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
  g_assert (pfont != NULL);

  gdk_threads_enter ();

  face = pango_ft2_font_get_face (pfont->font);
  g_assert (face != NULL);

  ft = cairo_ft_font_create_for_ft_face (face);
  g_assert (ft != NULL);

  if (gr->debug) printf ("cairo_set_font '%s'\n", face->family_name);
  
  cairo_set_font (gr->cr, ft);

  cairo_scale_font (gr->cr, 
		    pango_font_description_get_size (pfont->desc) / 
		    (double)PANGO_SCALE);

  cairo_font_destroy (ft);

  gdk_threads_leave ();
}
开发者ID:zylin,项目名称:zpugcc,代码行数:34,代码来源:gnu_java_awt_peer_gtk_GdkGraphics2D.c


示例10: reverse_engineer_spin_button

/* This function is based on reverse_engineer_stepper_box
 * (and gtk2 sources) except it is for getting spin button 
 * size instead. It is not always right, and only returns 
 * a (hopefully more accurate) arrow box, not the entire
 * button box, as the button box is passed correctly
 * to paint_box and so only paint_arrow needs this.
 */
void
reverse_engineer_spin_button (GtkWidget    *widget,
			      GtkArrowType  arrow_type,
			      gint         *x,
			      gint         *y,
			      gint         *width,
			      gint         *height)
{
#ifdef GTK2
  gint size = pango_font_description_get_size (widget->style->font_desc);
  gint realheight, realwidth;

  realwidth = MIN(PANGO_PIXELS (size), 30);

  realwidth -= realwidth % 2; /* force even */
  
  realwidth -= 2 * xthickness(widget->style);
  
  realheight = ((widget->requisition.height) - 2 * ythickness(widget->style)) / 2;
      
  realheight -= 1;
  realwidth += 1;
  *x += ((*width - realwidth) / 2);
  *y += ((*height - realheight) / 2) + (arrow_type==GTK_ARROW_DOWN?1:-1);
  *width = realwidth;
  *height = realheight;
#endif
}
开发者ID:huangming,项目名称:configs,代码行数:35,代码来源:misc_functions.c


示例11: pango_font_description_get_size

JNIEXPORT jint JNICALL
Java_org_gnome_pango_PangoFontDescription_pango_1font_1description_1get_1size
(
	JNIEnv* env,
	jclass cls,
	jlong _self
)
{
	gint result;
	jint _result;
	PangoFontDescription* self;

	// convert parameter self
	self = (PangoFontDescription*) _self;

	// call function
	result = pango_font_description_get_size(self);

	// cleanup parameter self

	// translate return value to JNI type
	_result = (jint) result;

	// and finally
	return _result;
}
开发者ID:cyberpython,项目名称:java-gnome,代码行数:26,代码来源:PangoFontDescription.c


示例12: Clear

bool PangoFontInfo::ParseFontDescription(const PangoFontDescription *desc) {
  Clear();
  const char* family = pango_font_description_get_family(desc);
  if (!family) {
    char* desc_str = pango_font_description_to_string(desc);
    tprintf("WARNING: Could not parse family name from description: '%s'\n",
            desc_str);
    g_free(desc_str);
    return false;
  }
  family_name_ = string(family);
  desc_ = pango_font_description_copy(desc);
  is_monospace_ = IsMonospaceFontFamily(family);

  // Set font size in points
  font_size_ = pango_font_description_get_size(desc);
  if (!pango_font_description_get_size_is_absolute(desc)) {
    font_size_ /= PANGO_SCALE;
  }

  PangoStyle style = pango_font_description_get_style(desc);
  is_italic_ = (PANGO_STYLE_ITALIC == style ||
                PANGO_STYLE_OBLIQUE == style);
  is_smallcaps_ = (pango_font_description_get_variant(desc)
                   == PANGO_VARIANT_SMALL_CAPS);

  is_bold_ = (pango_font_description_get_weight(desc) >= PANGO_WEIGHT_BOLD);
  // We dont have a way to detect whether a font is of type Fraktur. The fonts
  // we currently use all have "Fraktur" in their family name, so we do a
  // fragile but functional check for that here.
  is_fraktur_ = (strcasestr(family, "Fraktur") != NULL);
  return true;
}
开发者ID:11110101,项目名称:tess-two,代码行数:33,代码来源:pango_font_info.cpp


示例13: webkit_get_font_size

static gboolean
webkit_get_font_size (GValue *value,
    GVariant *variant,
    gpointer user_data)
{
  PangoFontDescription *font = pango_font_description_from_string (
      g_variant_get_string (variant, NULL));
  int size;

  if (font == NULL)
    return FALSE;

  size = pango_font_description_get_size (font) / PANGO_SCALE;

  if (pango_font_description_get_size_is_absolute (font))
    {
      GdkScreen *screen = gdk_screen_get_default ();
      double dpi;

      if (screen != NULL)
        dpi = gdk_screen_get_resolution (screen);
      else
        dpi = BORING_DPI_DEFAULT;

      size = (gint) (size / (dpi / 72));
    }

  g_value_set_int (value, size);
  pango_font_description_free (font);

  return TRUE;
}
开发者ID:DylanMcCall,项目名称:Empathy---Hide-contact-groups,代码行数:32,代码来源:empathy-webkit-utils.c


示例14: gwy_graph_label_new

/**
 * gwy_graph_label_new:
 *
 * Creates a new graph label.
 *
 * Returns: A new graph label widget as a #GtkWidget.
 **/
GtkWidget*
gwy_graph_label_new()
{
    GwyGraphLabel *label;
    PangoFontDescription *description;
    PangoContext *context;
    gint size;

    gwy_debug("");

    label = g_object_new(GWY_TYPE_GRAPH_LABEL, NULL);

    context = gtk_widget_get_pango_context(GTK_WIDGET(label));
    description = pango_context_get_font_description(context);

    /* Make major font a bit smaller */
    label->font_desc = pango_font_description_copy(description);
    size = pango_font_description_get_size(label->font_desc);
    size = MAX(1, size*10/11);
    pango_font_description_set_size(label->font_desc, size);

    gtk_widget_set_events(GTK_WIDGET(label), 0);

    return GTK_WIDGET(label);
}
开发者ID:svn2github,项目名称:gwyddion,代码行数:32,代码来源:gwygraphlabel.c


示例15: gimp_scale_combo_box_style_set

static void
gimp_scale_combo_box_style_set (GtkWidget *widget,
                                GtkStyle  *prev_style)
{
  GtkWidget  *entry;
  GtkRcStyle *rc_style;
  gint        font_size;
  gdouble     scale;

  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);

  gtk_widget_style_get (widget, "label-scale", &scale, NULL);

  entry = gtk_bin_get_child (GTK_BIN (widget));

  rc_style = gtk_widget_get_modifier_style (GTK_WIDGET (entry));

  if (! rc_style->font_desc)
    {
      PangoContext         *context;
      PangoFontDescription *font_desc;

      context = gtk_widget_get_pango_context (widget);
      font_desc = pango_context_get_font_description (context);

      rc_style->font_desc = pango_font_description_copy (font_desc);
    }

  font_size = pango_font_description_get_size (rc_style->font_desc);
  pango_font_description_set_size (rc_style->font_desc, scale * font_size);

  gtk_widget_modify_style (GTK_WIDGET (entry), rc_style);
}
开发者ID:Distrotech,项目名称:gimp,代码行数:33,代码来源:gimpscalecombobox.c


示例16: adjust_font_size

static void
adjust_font_size(GtkWidget *widget, gpointer data, gint howmuch)
{
	VteTerminal *terminal;
	PangoFontDescription *desired;
	gint newsize;
	gint columns, rows, owidth, oheight;

	/* Read the screen dimensions in cells. */
	terminal = VTE_TERMINAL(widget);
	columns = terminal->column_count;
	rows = terminal->row_count;

	/* Take into account padding and border overhead. */
	gtk_window_get_size(GTK_WINDOW(data), &owidth, &oheight);
	owidth -= terminal->char_width * terminal->column_count;
	oheight -= terminal->char_height * terminal->row_count;

	/* Calculate the new font size. */
	desired = pango_font_description_copy(vte_terminal_get_font(terminal));
	newsize = pango_font_description_get_size(desired) / PANGO_SCALE;
	newsize += howmuch;
	pango_font_description_set_size(desired,
					CLAMP(newsize, 4, 144) * PANGO_SCALE);

	/* Change the font, then resize the window so that we have the same
	 * number of rows and columns. */
	vte_terminal_set_font(terminal, desired);
	gtk_window_resize(GTK_WINDOW(data),
			  columns * terminal->char_width + owidth,
			  rows * terminal->char_height + oheight);

	pango_font_description_free(desired);
}
开发者ID:MihirKulkarni,项目名称:vte_indic,代码行数:34,代码来源:vteapp.c


示例17: defined

void MapPainterSVG::GetTextDimension(const Projection& projection,
                                     const MapParameter& parameter,
                                     double fontSize,
                                     const std::string& text,
                                     double& xOff,
                                     double& yOff,
                                     double& width,
                                     double& height)
{
#if defined(OSMSCOUT_MAP_SVG_HAVE_LIB_PANGO)
    PangoFontDescription *font;
    PangoLayout          *layout=pango_layout_new(pangoContext);
    PangoRectangle       extends;

    font=GetFont(projection,
                 parameter,
                 fontSize);

    pango_layout_set_font_description(layout,font);
    pango_layout_set_text(layout,text.c_str(),text.length());

    pango_layout_get_pixel_extents(layout,&extends,NULL);

    xOff=extends.x;
    yOff=extends.y;
    width=extends.width;
    height=pango_font_description_get_size(font)/PANGO_SCALE;

    g_object_unref(layout);
#endif
}
开发者ID:OgreTransporter,项目名称:libosmscout,代码行数:31,代码来源:MapPainterSVG.cpp


示例18: gtk_settings_get_default

void RenderThemeGtk::systemFont(CSSValueID, FontDescription& fontDescription) const
{
    GtkSettings* settings = gtk_settings_get_default();
    if (!settings)
        return;

    // This will be a font selection string like "Sans 10" so we cannot use it as the family name.
    GUniqueOutPtr<gchar> fontName;
    g_object_get(settings, "gtk-font-name", &fontName.outPtr(), NULL);

    PangoFontDescription* pangoDescription = pango_font_description_from_string(fontName.get());
    if (!pangoDescription)
        return;

    fontDescription.setOneFamily(pango_font_description_get_family(pangoDescription));

    int size = pango_font_description_get_size(pangoDescription) / PANGO_SCALE;
    // If the size of the font is in points, we need to convert it to pixels.
    if (!pango_font_description_get_size_is_absolute(pangoDescription))
        size = size * (getScreenDPI() / 72.0);

    fontDescription.setSpecifiedSize(size);
    fontDescription.setIsAbsoluteSize(true);
    fontDescription.setGenericFamily(FontDescription::NoFamily);
    fontDescription.setWeight(FontWeightNormal);
    fontDescription.setItalic(false);
    pango_font_description_free(pangoDescription);
}
开发者ID:Wrichik1999,项目名称:webkit,代码行数:28,代码来源:RenderThemeGtk.cpp


示例19: dia_font_get_size

real
dia_font_get_size(const DiaFont* font)
{
  if (!pango_font_description_get_size_is_absolute (font->pfd))
    g_warning ("dia_font_get_size() : no absolute size");
  return pdu_to_dcm(pango_font_description_get_size(font->pfd));
}
开发者ID:yjdwbj,项目名称:c_struct_gui,代码行数:7,代码来源:font.c


示例20: get_font_size

/* Taken from the Gtk+ file gtkfilechooserdefault.c
 * Copyright (C) 2003, Red Hat, Inc.
 *
 * Changed by File-Roller authors
 *
 * Guesses a size based upon font sizes */
static int
get_font_size (GtkWidget *widget)
{
	GtkStyleContext      *context;
	GtkStateFlags         state;
	int                   font_size;
	GdkScreen            *screen;
	double                resolution;
	PangoFontDescription *font;

	context = gtk_widget_get_style_context (widget);
	state = gtk_widget_get_state_flags (widget);

	screen = gtk_widget_get_screen (widget);
	if (screen) {
		resolution = gdk_screen_get_resolution (screen);
		if (resolution < 0.0) /* will be -1 if the resolution is not defined in the GdkScreen */
			resolution = 96.0;
	}
	else
		resolution = 96.0; /* wheeee */

	gtk_style_context_get (context, state, "font", &font, NULL);
	font_size = pango_font_description_get_size (font);
	font_size = PANGO_PIXELS (font_size) * resolution / 72.0;

	return font_size;
}
开发者ID:UIKit0,项目名称:file-roller,代码行数:34,代码来源:fr-file-selector-dialog.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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