当前位置: 首页>>代码示例>>C++>>正文


C++ pango_font_description_set_size函数代码示例

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


在下文中一共展示了pango_font_description_set_size函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: dump_font_sizes

static void
dump_font_sizes (PangoContext *context, FILE *f, guint flags)
{
  PangoFont *font;
  PangoFontDescription *pfd;
  int nf;
  real height;

  fprintf (f, "height/cm");
  for (nf = 0; test_families[nf] != NULL; ++nf)
    fprintf (f, "\t%s", test_families[nf]);
  fprintf (f, "\n");

  for (height = 0.1; height <= 10.0; height += 0.1) {
    fprintf (f, "%g", height);
    for (nf = 0; test_families[nf] != NULL; ++nf) {
      pfd = pango_font_description_new ();
      pango_font_description_set_family (pfd, test_families[nf]);
      //pango_font_description_set_size (pfd, height * pixels_per_cm * PANGO_SCALE);
      if (flags & DUMP_ABSOLUTE)
        pango_font_description_set_absolute_size (pfd, height * pixels_per_cm * PANGO_SCALE);
      else
        pango_font_description_set_size (pfd, height * pixels_per_cm * PANGO_SCALE);

      font = pango_context_load_font (context, pfd);
      if (font) {
        PangoFontMetrics *metrics = pango_font_get_metrics (font, NULL);
	/* now make a font-size where the font/line-height matches the given pixel size */
	real total = ((double)pango_font_metrics_get_ascent (metrics)
	                    + pango_font_metrics_get_descent (metrics)) / PANGO_SCALE;
	real factor = height*pixels_per_cm/total;
	real line_height;

        if (flags & DUMP_ABSOLUTE)
          pango_font_description_set_absolute_size (pfd, factor * height * pixels_per_cm * PANGO_SCALE);
	else
          pango_font_description_set_size (pfd, factor * height * pixels_per_cm * PANGO_SCALE);
	pango_font_metrics_unref (metrics);
	g_object_unref (font);

	font = pango_context_load_font (context, pfd);
	metrics = pango_font_get_metrics (font, NULL);

	line_height = ((double)pango_font_metrics_get_ascent (metrics)
	                     + pango_font_metrics_get_descent (metrics)) / PANGO_SCALE;
        fprintf (f, "\t%.3g",  flags & DUMP_FACTORS ? factor : line_height);
	g_object_unref (font);
      }
      pango_font_description_free (pfd);
    }
    fprintf (f, "\n");
  }
}
开发者ID:GNOME,项目名称:dia,代码行数:53,代码来源:font-height.c

示例3: 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

示例4: 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

示例5: F1035_13194

/* {EV_FONT_IMP}.set_height_in_points */
void F1035_13194 (EIF_REFERENCE Current, EIF_INTEGER_32 arg1)
{
	GTCX
	EIF_POINTER tp1;
	EIF_REFERENCE tr1 = NULL;
	EIF_INTEGER_32 ti4_1;
	EIF_INTEGER_32 ti4_2;
	RTLD;
	
	RTLI(2);
	RTLR(0,Current);
	RTLR(1,tr1);
	
	RTGC;
	*(EIF_INTEGER_32 *)(Current+ _LNGOFF_3_2_0_2_) = (EIF_INTEGER_32) arg1;
	tr1 = RTOSCF(13229,F1035_13229,(Current));
	ti4_1 = F791_8091(RTCV(tr1), arg1);
	*(EIF_INTEGER_32 *)(Current+ _LNGOFF_3_2_0_3_) = (EIF_INTEGER_32) ti4_1;
	tp1 = *(EIF_POINTER *)(Current+ _PTROFF_3_2_0_8_0_0_);
	ti4_1 = *(EIF_INTEGER_32 *)(Current+ _LNGOFF_3_2_0_2_);
	ti4_2 = (EIF_INTEGER_32) PANGO_SCALE;
	pango_font_description_set_size((PangoFontDescription*) tp1, (gint) (EIF_INTEGER_32) (ti4_1 * ti4_2));
	F1035_13198(Current);
	RTLE;
}
开发者ID:yehongbing,项目名称:Eiffel-Projects,代码行数:26,代码来源:ev669.c

示例6: 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);
	
}
开发者ID:mdsmith,项目名称:OCLHYPHY,代码行数:34,代码来源:main-GTK.cpp

示例7: 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);
}
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:28,代码来源:gsttimeoverlay.c

示例8: get_font_description

/* Get the current font as a PangoFontDescription.
Must be freed with pango_font_description_free. */
PangoFontDescription *
get_font_description(void)
{
	PangoFontDescription *font = get_font_family();
	pango_font_description_set_size(font, get_font_size(font));
	return font;
}
开发者ID:BartMassey,项目名称:gnome-inform7,代码行数:9,代码来源:configfile.c

示例9: 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

示例10: 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

示例11: _pango_xft_Load

static int
_pango_xft_Load(TextState * ts, const char *name)
{
   FontCtxPangoXft    *fdc;
   PangoFontDescription *font;
   PangoFontMask       flags;

   if (!_pango_ctx)
      _pango_ctx = pango_xft_get_context(disp, Dpy.screen);
   if (!_pango_ctx)
      return -1;

   font = pango_font_description_from_string(name);
   if (!font)
      return -1;

   flags = pango_font_description_get_set_fields(font);
   if ((flags & PANGO_FONT_MASK_FAMILY) == 0)
      pango_font_description_set_family(font, "sans");
   if ((flags & PANGO_FONT_MASK_SIZE) == 0)
      pango_font_description_set_size(font, 10 * PANGO_SCALE);

   fdc = EMALLOC(FontCtxPangoXft, 1);
   if (!fdc)
      return -1;
   fdc->font = font;
   ts->fdc = fdc;
   ts->need_utf8 = 1;
   ts->type = FONT_TYPE_PANGO_XFT;
   ts->ops = &FontOps_pango;
   return 0;
}
开发者ID:burzumishi,项目名称:e16,代码行数:32,代码来源:text_pango.c

示例12: draw_valtext

/*!
  \brief draw_valtext() draws the dynamic values for the traces on 
  the left hand side of the logviewer. This is optimized so that if the value
  becomes temporarily static, it won't keep blindly updating the screen and
  wasting CPU time.
  \param force_draw when true to write the values to screen for
  all controls no matter if hte previous value is the same or not.
  */
G_MODULE_EXPORT void draw_valtext(gboolean force_draw)
{
	gint last_index = 0;
	gfloat val = 0.0;
	gfloat last_val = 0.0;
	gint val_x = 0;
	gint val_y = 0;
	gint info_ctr = 0;
	gint h = 0;
	gint i = 0;
	GArray *array = NULL;
	Viewable_Value *v_value = NULL;
	PangoLayout *layout;
	GdkPixmap *pixmap = lv_data->pixmap;
	GtkAllocation allocation;

	gtk_widget_get_allocation(lv_data->darea,&allocation);

	h = allocation.height;

	if (!lv_data->font_desc)
	{
		lv_data->font_desc = pango_font_description_from_string("courier");
		pango_font_description_set_size(lv_data->font_desc,(10)*PANGO_SCALE);
	}
	
	val_x = 7;
	for (i=0;i<lv_data->active_traces;i++)
	{
		v_value = (Viewable_Value *)g_list_nth_data(lv_data->tlist,i);
		info_ctr = (lv_data->spread * (i+1))- (lv_data->spread/2);
		val_y = info_ctr + 1;

		last_index = v_value->last_index;
		array = DATA_GET(v_value->object,v_value->data_source);
		val = g_array_index(array,gfloat,last_index);
		if (array->len > 1)
			last_val = g_array_index(array,gfloat,last_index-1);
		/* IF this value matches the last one,  don't bother
		 * updating the text as there's no point... */
		if ((val == last_val) && (!force_draw) && (!v_value->force_update))
			continue;
		
		v_value->force_update = FALSE;
		gdk_draw_rectangle(pixmap,
				gtk_widget_get_style(lv_data->darea)->black_gc,
				TRUE,
				v_value->ink_rect->x+val_x,
				v_value->ink_rect->y+val_y,
				lv_data->info_width-1-v_value->ink_rect->x-val_x,
				v_value->ink_rect->height);

		layout = gtk_widget_create_pango_layout(lv_data->darea,g_strdup_printf("%1$.*2$f",val,v_value->precision));

		pango_layout_set_font_description(layout,lv_data->font_desc);
		pango_layout_get_pixel_extents(layout,v_value->ink_rect,v_value->log_rect);
		gdk_draw_layout(pixmap,v_value->font_gc,val_x,val_y,layout);
	}

}
开发者ID:toxicgumbo,项目名称:MegaTunix,代码行数:68,代码来源:logviewer_gui.c

示例13: UT_return_if_fail

/*!
* \todo ROB parse more attributes like font-color, background-color
*/
void 		 
AP_UnixToolbar_StyleCombo::getPangoAttrs (PD_Style *pStyle, 
										  PangoFontDescription *desc) {

	UT_return_if_fail (pStyle);
	UT_LocaleTransactor t (LC_NUMERIC, "C");

	const gchar *value = NULL;

	if (pStyle->getPropertyExpand ("font-family", value)) {
		pango_font_description_set_family (desc, value);
	}

	if (pStyle->getPropertyExpand ("font-size", value)) {
		pango_font_description_set_size (desc, (gint)(UT_convertToDimension (value, DIM_PT) * PANGO_SCALE));
	}

	if (pStyle->getPropertyExpand ("font-style", value)) {
		PangoStyle style = PANGO_STYLE_NORMAL;
		if (!strcmp (value, "italic"))
			style = PANGO_STYLE_ITALIC;
		pango_font_description_set_style (desc, style);
	}

	if (pStyle->getPropertyExpand ("font-weight", value)) {
		PangoWeight weight = PANGO_WEIGHT_NORMAL;
		if (!strcmp (value, "bold"))
			weight = PANGO_WEIGHT_BOLD;
		pango_font_description_set_weight (desc, weight);
	}
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:34,代码来源:ap_UnixToolbar_StyleCombo.cpp

示例14: pango_load

static bool
pango_load (Lisp_Font *f)
{
    PangoLanguage *language;
    PangoFontDescription *fontdesc;
    PangoFont *font;
    PangoFontMetrics *metrics;

    if (pango_context)
    {
	language = pango_context_get_language (pango_context);
    }
    else
    {
	char *langname, *p;

#ifdef HAVE_PANGO_XFT
	pango_context = pango_xft_get_context (dpy, screen_num);
#endif

	langname = g_strdup (setlocale (LC_CTYPE, NULL));
	p = strchr (langname, '.');
	if (p)
	    *p = 0;
	p = strchr (langname, '@');
	if (p)
	    *p = 0;
	language = pango_language_from_string (langname);
	pango_context_set_language (pango_context, language);
	g_free (langname);
    }

    fontdesc = pango_font_description_from_string (rep_STR (f->name));

    if (!pango_font_description_get_family (fontdesc))
	pango_font_description_set_family (fontdesc, "Sans");
    if (pango_font_description_get_size (fontdesc) <= 0)
	pango_font_description_set_size (fontdesc, 12 * PANGO_SCALE);

    pango_context_set_font_description (pango_context, fontdesc);
    font = pango_context_load_font (pango_context, fontdesc);

    if (!font) {
        pango_font_description_free(fontdesc);
	return FALSE;
    }

    metrics = pango_font_get_metrics (font, language);

    f->ascent = metrics->ascent / PANGO_SCALE;
    f->descent = metrics->descent / PANGO_SCALE;

    pango_font_metrics_unref (metrics);

    f->font = fontdesc; /* We save the font description, not the font itself!
                        That's because it seems we can't recover it perfectly
                        later, and the layout routines want a description */

    return TRUE;
}
开发者ID:tkorvola,项目名称:sawfish,代码行数:60,代码来源:fonts.c

示例15: t_display_przerysuj

//		Narysowanie zawartosci calego okna (z legenda, opisami osi i charakterystykami)
void t_display_przerysuj(T_Display *w)
{
		int szer, wys ;
		double units_per_pixel_x ;
		//double units_per_pixel_y ;
		
		szer = w->canvas->allocation.width ;
		wys = w->canvas->allocation.height ;
		
		units_per_pixel_x = (double)w->time_range / ((double)szer) ;
		
		//PangoLayout *etykieta = gtk_widget_create_pango_layout (w->canvas, "");									
		PangoContext *pc = gtk_widget_get_pango_context (w->canvas) ;
		PangoFontDescription* pfd = pango_context_get_font_description (pc) ;
		//printf ("czcionka %d\n", pango_font_description_get_size(pfd)) ;
		pango_font_description_set_size (pfd, w->font_size * PANGO_SCALE) ;
		//pango_layout_context_changed(etykieta) ;
		
		
		t_display_draw_legend(w) ;
		t_display_calculate_borders(w) ;
		t_display_rysuj_siatke_czas(w) ;
		t_display_rysuj_siatke_temp(w) ;
		t_display_draw_plots(w) ;
		
} ;
开发者ID:BackupTheBerlios,项目名称:gtemp1w,代码行数:27,代码来源:t_display.c


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