예제 #1
0
int Fenetre::hauteurTexte(const char *texte) const {
    if (!existe) return -1;
    int lb,rb,w,as,de;
    gdk_string_extents (fonte, texte, &lb, &rb, &w, &as, &de);
    traiteEvenements();
    return as+de; // hauteur du texte en pixels
}
예제 #2
0
// Méthodes pour écrire du texte et des entiers dans une fenêtre
void Fenetre::ecrit(int x, int y, const char * texte) {
    if (existe) {
      gdk_gc_set_rgb_fg_color(fenetre->style->fg_gc[GTK_STATE_NORMAL],&stylo);
      int lb,rb,w,as,de;
      gdk_string_extents (fonte, texte, &lb, &rb, &w, &as, &de);
      gdk_draw_string (dessin, fonte,
        fenetre->style->fg_gc[GTK_WIDGET_STATE (fenetre)],x,y-de,texte); 
      gtk_widget_queue_draw(fenetre); // provoquer l'affichage
      traiteEvenements();
      }
}
예제 #3
0
파일: GtkVisual.c 프로젝트: ekoeppen/kino-2
void VisualTextExtents (KinoFont *font, char *text,
  int *width, int *lbearing, int *rbearing, int *ascent, int *descent)
{
  if (font)
  {
    gdk_string_extents ((GdkFont *) font, text,
      lbearing, rbearing, width, ascent, descent);
  }
  else
  {
    *width = 0;
    *lbearing = 0;
    *rbearing = 0;
    *ascent = 0;
    *descent = 0;
  }
}
예제 #4
0
파일: gdkfont.c 프로젝트: amery/clip-itk
/* Returns the metrics of a NULL-terminated string.

       font : a GdkFont.
     string : the NULL-terminated string to measure.
   lbearing : the left bearing of the string.
   rbearing : the right bearing of the string.
      width : the width of the string.
     ascent : the ascent of the string.
    descent : the descent of the string. */
int
clip_GDK_STRINGEXTENTS(ClipMachine * cm)
{
	C_object      *cfont = _fetch_co_opt(cm);
	gchar * string = _clip_parc(cm,2);
	gint lbearing, rbearing, width, ascent, descent;
	CHECKCOBJOPT(cfont,GDK_IS_FONT(cfont));
	CHECKARG(2,CHARACTER_t);
	LOCALE_TO_UTF(string);
	gdk_string_extents(GDK_FONT(cfont->object), string,
		&lbearing, &rbearing, &width, &ascent, &descent);
	FREE_TEXT(string);
	_clip_storni(cm,lbearing,3,0);
	_clip_storni(cm,rbearing,4,0);
	_clip_storni(cm,width,5,0);
	_clip_storni(cm,ascent,6,0);
	_clip_storni(cm,descent,7,0);
	return 0;
err:
	return 1;
}