Index: trunk/SophyaPI/PI/pibwdgx.cc
===================================================================
--- trunk/SophyaPI/PI/pibwdgx.cc	(revision 314)
+++ trunk/SophyaPI/PI/pibwdgx.cc	(revision 316)
@@ -149,5 +149,5 @@
 printf("PIBaseWdgX::ActivateMove %d \n \n", bid);
 #endif
-unsigned long evtmask ;
+unsigned long evtmask = 0;
 
 // bid == 0  -> PointerMove sans bouton 
Index: trunk/SophyaPI/PI/picmapview.cc
===================================================================
--- trunk/SophyaPI/PI/picmapview.cc	(revision 314)
+++ trunk/SophyaPI/PI/picmapview.cc	(revision 316)
@@ -117,5 +117,5 @@
     sprintf(buff, "%.2f", vmax);
     int fa, fd;
-    g->DrawString(4, g->GetFontHeight(fa,fd)+4, buff);
+    g->DrawString(4, g->GetFont().GetFontHeight(fa,fd)+4, buff);
     } 
     
Index: trunk/SophyaPI/PI/pigraphgen.cc
===================================================================
--- trunk/SophyaPI/PI/pigraphgen.cc	(revision 314)
+++ trunk/SophyaPI/PI/pigraphgen.cc	(revision 316)
@@ -24,4 +24,5 @@
 // Links	Voir aussi
 // PIGrCoord
+// PIFont
 // PIColorMap
 //--
@@ -191,10 +192,4 @@
 // void  SelGOMode(PIGOMode mod=PI_GOCopy) 
 //	Choix du mode de tracé graphique: "PI_GOCopy" ou "PI_GOXOR" ou 	"PI_GOInvert"
-// void  SelFont(PIFontSize sz=PI_NormalSizeFont, PIFontAtt att=PI_RomanFont)
-//	Choix de la fonte pour le tracé de texte
-//|	PI_SmallSizeFont , PI_NormalSizeFont , PI_BigSizeFont, PI_HugeSizeFont
-//|	PI_RomanFont , PI_BoldFont , PI_ItalicFont 
-// void  SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont)
-//	Choix de la fonte avec spécification de taille en points (pixels sur l'écran)
 // void  SelLine(PILineAtt att=PI_NormalLine)
 //	Choix du type de ligne pour le tracé des lignes et contours
@@ -208,4 +203,20 @@
 //|	PI_TriangleMarker , PI_FTriangleMarker , PI_StarMarker , PI_FStarMarker
 //	(Les "StarMaker" ne sont pas encore implémentés  11/98) 
+//--
+
+//++
+// Titre	Changement de fontes
+//--
+//++
+// void  SelFont(PIFont & fnt)
+//	Choix de fonte courant.
+// void  SelFont(PIFontSize sz=PI_NormalSizeFont, PIFontAtt att=PI_RomanFont)
+//	Changement de taille et attribut de fonte
+//|	PI_SmallSizeFont , PI_NormalSizeFont , PI_BigSizeFont, PI_HugeSizeFont
+//|	PI_RomanFont , PI_BoldFont , PI_ItalicFont 
+// void  SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont)
+//	Choix de taille de fonte avec spécification de taille en points 
+//	(pixels sur l'écran)
+// 
 //--
 
@@ -241,11 +252,29 @@
 // int GetMarkerSize()
 //	Renvoie la taille des signes (Marker) pour le marker courant
-// int GetFontHeight(int& asc, int& desc) 
+// PIFont  GetFont()
+//	Retourne une copie de l'objet "PIFont" courant.
+// PIGrCoord  GetFontHeight(PIGrCoord& asc, PIGrCoord& desc);
 //	Renvoie la hauteur des caractères, ainsi que la taille au dessus
 //	et en-dessous de la ligne de base ("asc , desc") pour la fonte courante
+//	dans le système de coordonnées courant (Fenêtre ou UC).
 // PIGrCoord CalcStringWidth(char const* s)
 //	Renvoie la largeur occupé par un texte s'il était affiché dans le 
 //	système de coordonnées courant (Fenêtre ou UC).
 //--
+
+/* --Methode-- */
+PIGrCoord PIGraphicGen::GetFontHeight(PIGrCoord& asc, PIGrCoord& desc)
+{
+int t,a,d;
+t = myFont.GetFontHeight(a, d);
+asc = a;   desc = d;
+return(t);
+}
+
+/* --Methode-- */
+PIGrCoord PIGraphicGen::CalcStringWidth(char const* s)
+{
+return (myFont.GetStringWidth(s));
+}
 
 //++
@@ -267,6 +296,5 @@
   sBCol = GetBackground();
   sGOm = GetGOMode();
-  sFAtt = GetFontAtt();   
-  sFSize = GetFontSize();
+  sFont = GetFont();   
   sLAtt = GetLineAtt();
   sMrk = GetMarker();   
@@ -281,5 +309,5 @@
   SelBackground(sBCol);
   SelGOMode(sGOm);
-  SelFontSzPt(sFSize, sFAtt);
+  SelFont(sFont);
   SelLine(sLAtt);
   SelMarker(sMrkSz, sMrk);
Index: trunk/SophyaPI/PI/pigraphgen.h
===================================================================
--- trunk/SophyaPI/PI/pigraphgen.h	(revision 314)
+++ trunk/SophyaPI/PI/pigraphgen.h	(revision 316)
@@ -11,4 +11,5 @@
 #include PIWDG_H
 #include PICMAP_H
+#include PIFONT_H
 
 
@@ -22,10 +23,4 @@
                  PI_ColorAllBits0 = 16, PI_ColorAllBits1 = 17 };
 
-enum PIFontSize { PI_NotDefFontSize = -1, 
-                  PI_SmallSizeFont = 1, PI_NormalSizeFont = 2, 
-                  PI_BigSizeFont = 3, PI_HugeSizeFont = 4 };
-
-enum PIFontAtt { PI_NotDefFontAtt = -1,
-                 PI_RomanFont = 1, PI_BoldFont = 2, PI_ItalicFont = 4 };
 
 enum PILineAtt { PI_NotDefLineAtt = -1,
@@ -112,9 +107,11 @@
   virtual void       SelBackground(PIColorMap& cmap, int cid)                  = 0;
   virtual void       SelGOMode(PIGOMode mod=PI_GOCopy)                         = 0;
-  virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont, 
-                             PIFontAtt att=PI_RomanFont)                       = 0;
-  virtual void       SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont)       = 0; 
   virtual void       SelLine(PILineAtt att=PI_NormalLine)                      = 0;
   virtual void       SelMarker(int msz=3, PIMarker mrk=PI_DotMarker)           = 0;
+// Modifications de fonte
+  virtual void	     SelFont(PIFont & fnt)				       = 0; 
+  virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont, 
+                             PIFontAtt att=PI_RomanFont)		       = 0;
+  virtual void       SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont)       = 0; 
 
 // Selection de zone de trace (clip)
@@ -126,12 +123,12 @@
   virtual PIColors   GetBackground()    = 0;
   virtual PIGOMode   GetGOMode()        = 0;
-  virtual PIFontAtt  GetFontAtt()       = 0;
-  virtual int        GetFontSize()      = 0;
   virtual PILineAtt  GetLineAtt()       = 0;
   virtual PIMarker   GetMarker()        = 0;
   virtual int        GetMarkerSize()    = 0;
 
-  virtual int        GetFontHeight(int& asc, int& desc)      = 0;
-  virtual PIGrCoord  CalcStringWidth(char const* s)          = 0;
+// Acces a la fonte et ses attributs
+  inline  PIFont     GetFont() { return (myFont) ; }
+  virtual PIGrCoord  GetFontHeight(PIGrCoord& asc, PIGrCoord& desc);
+  virtual PIGrCoord  CalcStringWidth(char const* s);
 
 // Sauvegarde des attributs graphiques 
@@ -144,7 +141,8 @@
   PIScreenBuffer* myGrb;
 
+  PIFont myFont;
   PIColors  sFCol, sBCol;
   PIGOMode sGOm;
-  PIFontAtt sFAtt;
+  PIFont sFont;
   PILineAtt sLAtt;
   int sFSize;
@@ -152,6 +150,4 @@
   int sMrkSz;
 };
-
-#endif
 
 typedef PIGraphicGen PIGraphic;
@@ -162,2 +158,4 @@
 //     PIGraphicPS
 //     PIGraphicUC
+
+#endif      // PIGRAPHGEN_H_SEEN
Index: trunk/SophyaPI/PI/pigraphps.cc
===================================================================
--- trunk/SophyaPI/PI/pigraphps.cc	(revision 314)
+++ trunk/SophyaPI/PI/pigraphps.cc	(revision 316)
@@ -327,8 +327,17 @@
 return;
 }
+/* --Methode-- */
+void PIGraphicPS::SelFont(PIFont & fnt)
+{
+//  $CHECK$   -  Reza 13/06/99
+SelFontSzPt(fnt.GetFontSize(), fnt.GetFontAtt());
+}
 
 /* --Methode-- */
 void PIGraphicPS::SelFontSzPt(int npt, PIFontAtt att)
 {
+//  $CHECK$   -  Reza 13/06/99
+myFont.SetFontSzPt(npt);
+myFont.SetFontAtt(att);
 mFSize = npt;
 mFAtt = att;
@@ -341,4 +350,5 @@
 void PIGraphicPS::SelFont(PIFontSize sz, PIFontAtt att)
 {
+//  $CHECK$   -  Reza 13/06/99
 int i;
 switch (sz) {
@@ -356,4 +366,6 @@
     break;
   }
+myFont.SetFontSz(sz);
+myFont.SetFontAtt(att);
 mFSize = fntsz[i];
 mFAtt = att;
@@ -413,15 +425,4 @@
 }
 
-/* --Methode-- */
-PIFontAtt  PIGraphicPS::GetFontAtt()
-{
-return (mFAtt);
-}
-
-/* --Methode-- */
-int        PIGraphicPS::GetFontSize()
-{
-return (mFSize);
-}
 
 /* --Methode-- */
@@ -443,18 +444,22 @@
 }
 
-/* --Methode-- */
+/* --Methode-- 
 int        PIGraphicPS::GetFontHeight(int& asc, int& desc)   
 {
-/*  $CHECK$  A refaire , voir Nicolas  */
+  $CHECK$  A refaire , voir Nicolas  
 asc = mFSize; desc = 0; 
 return(asc+desc);
-}
-
-
-/* --Methode-- */
+} 
+*/
+
+
+/* --Methode-- 
 PIGrCoord PIGraphicPS::CalcStringWidth(char const* s)
 {
-return((double)(mFSize*strlen(s)*0.5));   /*  facteur 0.5 ad'hoc $CHECK$  Voir Nicolas ! */
-}
+return((double)(mFSize*strlen(s)*0.5));   
+//  facteur 0.5 ad hoc $CHECK$  Voir Nicolas 
+}
+*/
+ 
 
 /* --Methode-- */
@@ -464,5 +469,5 @@
 sFCol = mFCol;    sBCol = mBCol;
 sGOm = mGOm;
-sFAtt = mFAtt;   sFSize = mFSize;
+sFont = myFont; 
 sMrk = mMrk;   sMrkSz = mMrkSz;
 return;
@@ -478,5 +483,5 @@
 // else    A faire Nicolas  
   SelGOMode(sGOm);
-  SelFontSzPt(sFSize, sFAtt);
+  SelFont(sFont);
   SelLine(sLAtt);
   SelMarker(sMrkSz, sMrk);
Index: trunk/SophyaPI/PI/pigraphps.h
===================================================================
--- trunk/SophyaPI/PI/pigraphps.h	(revision 314)
+++ trunk/SophyaPI/PI/pigraphps.h	(revision 316)
@@ -46,9 +46,11 @@
   virtual void       SelBackground(PIColorMap& cmap, int cid);
   virtual void       SelGOMode(PIGOMode mod=PI_GOCopy);
+  virtual void       SelLine(PILineAtt att=PI_NormalLine);
+  virtual void       SelMarker(int msz=3, PIMarker mrk=PI_DotMarker);
+
+  virtual void       SelFont(PIFont & fnt);
   virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont, 
                              PIFontAtt att=PI_RomanFont);
   virtual void       SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont);
-  virtual void       SelLine(PILineAtt att=PI_NormalLine);
-  virtual void       SelMarker(int msz=3, PIMarker mrk=PI_DotMarker);
 
 // Selection de zone de trace (clip)
@@ -60,12 +62,10 @@
   virtual PIColors   GetBackground();
   virtual PIGOMode   GetGOMode();
-  virtual PIFontAtt  GetFontAtt();
-  virtual int        GetFontSize();
   virtual PILineAtt  GetLineAtt();
   virtual PIMarker   GetMarker();
   virtual int        GetMarkerSize();
 
-  virtual int        GetFontHeight(int& asc, int& desc);
-  virtual PIGrCoord  CalcStringWidth(char const* s);
+  //  virtual PIGrCoord  GetFontHeight(PIGrCoord& asc, PIGrCoord& desc);
+  //  virtual PIGrCoord  CalcStringWidth(char const* s);
 
 // Sauvegarde des attributs graphiques 
Index: trunk/SophyaPI/PI/pigraphuc.cc
===================================================================
--- trunk/SophyaPI/PI/pigraphuc.cc	(revision 314)
+++ trunk/SophyaPI/PI/pigraphuc.cc	(revision 316)
@@ -583,4 +583,12 @@
 
 /* --Methode-- */
+void PIGraphicUC::SelFont(PIFont & fnt)
+{
+  if (!mGrC) return;
+  mGrC->SelFont(fnt);
+  return;  
+}
+
+/* --Methode-- */
 void PIGraphicUC::SelFont(PIFontSize sz, PIFontAtt att)
 {
@@ -671,17 +679,4 @@
 }
 
-/* --Methode-- */
-PIFontAtt PIGraphicUC::GetFontAtt()
-{
-  if (!mGrC) return(PI_NotDefFontAtt);
-  return(mGrC->GetFontAtt());
-}
-
-/* --Methode-- */
-int PIGraphicUC::GetFontSize()
-{
-  if (!mGrC) return(0);
-  return(mGrC->GetFontSize());
-}
 
 /* --Methode-- */
@@ -706,5 +701,5 @@
 }
 /* --Methode-- */
-PIGrCoord PIGraphicUC::GetFontHeightUC(PIGrCoord& asc, PIGrCoord& desc)
+PIGrCoord PIGraphicUC::GetFontHeight(PIGrCoord& asc, PIGrCoord& desc)
 {
   asc = desc = 0;
@@ -712,5 +707,5 @@
   int h,a,d;
   double fh, fa, fd, x;
-  h = mGrC->GetFontHeight(a, d) ;
+  h = myFont.GetFontHeight(a, d) ;
   DGrC2UC(0., h, x, fh);
   DGrC2UC(0., a, x, fa);
@@ -720,11 +715,4 @@
 }
 
-/* --Methode-- */
-int PIGraphicUC::GetFontHeight(int& asc, int& desc)
-{
-  asc = desc = 0;
-  if (!mGrC) return(0);
-  return( mGrC->GetFontHeight(asc, desc) );
-}
 
 /* --Methode-- */
@@ -732,5 +720,5 @@
 {
   if (!mGrC) return(0.);
-  double dx = mGrC->CalcStringWidth(s);
+  double dx = myFont.GetStringWidth(s);
   double dxx, dxy;
   DGrC2UC(dx, dx, dxx, dxy);
Index: trunk/SophyaPI/PI/pigraphuc.h
===================================================================
--- trunk/SophyaPI/PI/pigraphuc.h	(revision 314)
+++ trunk/SophyaPI/PI/pigraphuc.h	(revision 316)
@@ -64,14 +64,15 @@
   virtual void       SelBackground(PIColorMap& cmap, int cid);
   virtual void       SelGOMode(PIGOMode mod=PI_GOCopy);
+  virtual void       SelLine(PILineAtt att=PI_NormalLine);
+  virtual void       SelMarker(int msz=3, PIMarker mrk=PI_DotMarker);
+
+// Modification de fonte
+  virtual void       SelFont(PIFont & fnt);
   virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont, 
                              PIFontAtt att=PI_RomanFont);
   virtual void       SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont);
-  virtual void       SelLine(PILineAtt att=PI_NormalLine);
-  virtual void       SelMarker(int msz=3, PIMarker mrk=PI_DotMarker);
-
 //  Fonctions specifiques a PIGraphicUC :
   virtual void       SelFontSz(PIGrCoord sz, PIFontAtt att=PI_RomanFont);
   virtual void       SelMarkerSz(PIGrCoord msz, PIMarker mrk=PI_DotMarker);
-  virtual PIGrCoord  GetFontHeightUC(PIGrCoord& asc, PIGrCoord& desc);
 
 // Selection de zone de trace (clip)
@@ -83,12 +84,11 @@
   virtual PIColors   GetBackground();
   virtual PIGOMode   GetGOMode();
-  virtual PIFontAtt  GetFontAtt();
-  virtual int        GetFontSize();
   virtual PILineAtt  GetLineAtt();
   virtual PIMarker   GetMarker();
   virtual int        GetMarkerSize();
 
-  virtual int	     GetFontHeight(int& asc, int& desc);
+  virtual PIGrCoord  GetFontHeight(PIGrCoord& asc, PIGrCoord& desc);
   virtual PIGrCoord  CalcStringWidth(char const* s);
+
 
 // Sauvegarde des attributs graphiques 
Index: trunk/SophyaPI/PI/pigraphx.cc
===================================================================
--- trunk/SophyaPI/PI/pigraphx.cc	(revision 314)
+++ trunk/SophyaPI/PI/pigraphx.cc	(revision 316)
@@ -12,12 +12,4 @@
 
 /*  Variables globales pour modifier les GC  */
-#define NMAXFONTSZ  7
-static XFontStruct * fntst[NMAXFONTSZ][3];
-static int fntsz[NMAXFONTSZ] = {8,10,12,14,18,24,36};
-static int SmallFontIndex = 1; 
-static int NormalFontIndex = 3;
-static int BigFontIndex = 5;
-static int HugeFontIndex = 6;
-static  PIFontAtt fntatt[3] = { PI_RomanFont, PI_BoldFont, PI_ItalicFont }; 
 #define NMAXCOL  18
 static  PIXColor colpix[NMAXCOL];
@@ -74,7 +66,6 @@
 SelBackground(PI_White);
 mLAtt = PI_ThinLine;
+ XSetFont(mDisp, DefGC(), myFont.GetXFontId());  // Pour initialiser la fonte ds le GC 
 SelLine();
-mFAtt = PI_BoldFont;  mFSize = 0;
-SelFont();
 SelMarker(1, PI_DotMarker);  
 mFCfMap = colpix[PI_Black];  mBCfMap = colpix[PI_White];
@@ -430,54 +421,25 @@
 
 /* --Methode-- */
+void PIGraphicX::SelFont(PIFont & fnt)
+{
+if (myFont == fnt)  return;
+myFont = fnt;
+XSetFont(mDisp, DefGC(), myFont.GetXFontId());
+}
+
+/* --Methode-- */
+void PIGraphicX::SelFont(PIFontSize sz, PIFontAtt att)
+{
+PIFont fnt(myFont.GetFontName());
+fnt.SetFontAtt(att);
+fnt.SetFontSz(sz);
+SelFont(fnt);
+}
+
+/* --Methode-- */
 void PIGraphicX::SelFontSzPt(int npt, PIFontAtt att)
 {
-int dsz,i,isel, j;
-
-if ((npt == mFSize) && (att == mFAtt))  return;
-isel = 0;
-dsz = 9999;
-for(i=0; i<NMAXFONTSZ; i++)
-  {
-  j = npt - fntsz[i];   if (j < 0)  j = -j;
-  if (j < dsz)  {  isel = i; dsz = j; }
-  }
-
-j = 0;
-if (att & PI_RomanFont) j = 0;
-if (att & PI_BoldFont) j = 1;
-if (att & PI_ItalicFont) j = 2;
-SelectFont(isel, j);
-
-}
-
-/* --Methode-- */
-void PIGraphicX::SelFont(PIFontSize sz, PIFontAtt att)
-{
-int i,j;
-switch (sz)
-  {
-  case PI_SmallSizeFont:
-    i = SmallFontIndex;
-    break;
-  case PI_NormalSizeFont:
-    i = NormalFontIndex;
-    break;
-  case PI_BigSizeFont:
-    i = BigFontIndex;
-    break;
-  case PI_HugeSizeFont:
-    i = HugeFontIndex;
-    break;
-  default:
-    i = NormalFontIndex;
-    break;
-  }
-
-j = 0;
-if (att & PI_RomanFont) j = 0;
-if (att & PI_BoldFont) j = 1;
-if (att & PI_ItalicFont) j = 2;
-
-SelectFont(i, j);
+PIFont fnt(npt, myFont.GetFontName(), att);
+SelFont(fnt);
 }
 
@@ -632,20 +594,4 @@
 }
 
-/* --Methode-- */
-int        PIGraphicX::GetFontHeight(int& asc, int& desc)   
-{
-char a[2];
-XCharStruct  ovr;
-int hd, fa, fd;
-XTextExtents(mFSt, a, 0, &hd, &fa, &fd, &ovr);
-asc = fa; desc = fd; 
-return(fa+fd);
-}
-
-/* --Methode-- */
-PIGrCoord PIGraphicX::CalcStringWidth(char const* s)
-{
-return(XTextWidth(mFSt, s, strlen(s)));
-}
 
 /* --Methode-- */
@@ -655,5 +601,5 @@
 sFCol = mFCol;    sBCol = mBCol;
 sGOm = mGOm;
-sFAtt = mFAtt;   sFSize = mFSize;
+sFont = myFont;   
 sMrk = mMrk;   sMrkSz = mMrkSz;
 sFCfMap = mFCfMap; sBCfMap = mBCfMap; 
@@ -669,5 +615,5 @@
   else SelectBCol(sBCfMap);
   SelGOMode(sGOm);
-  SelFontSzPt(sFSize, sFAtt);
+  SelFont(sFont);
   SelLine(sLAtt);
   SelMarker(sMrkSz, sMrk);
@@ -684,23 +630,5 @@
 
 
-static bool fggrcx = false ;
-
-// Le bazar pour recuperer des resources de .Xdefault et autres 
-typedef struct 
-  {
-  String fntFam;
-  } myAppData;
-static myAppData  apd;
-
-static XtResource resources[] = {
-  { "fontFamilyName", "FontFamilyName", XtRString, sizeof(String),
-    /*XtOffset(apdp, fntFam)*/ 0, XtRString, "*-courier" }
-};
- 
-static char * fnbi_b[4] = { "medium-r-normal", "bold-r-normal", 
-                          "medium-o-normal", "medium-i-normal" };
-
-static XFontStruct * defnt = NULL;
-static char * fnbi[3];
+static bool fggrcx = false ;  // Flag init done
 
 
@@ -708,8 +636,4 @@
 void PIGraphicX::GlInit()
 {
-char buff[256];
-int i,j,count;
-char **list;
-
 if (fggrcx)  return;
 fggrcx = true;
@@ -723,84 +647,8 @@
 scr = XDefaultScreen(mdsp);
 
-XtGetApplicationResources(PIXtTopWdg(), &apd, resources, 
-                          XtNumber(resources), NULL, 0);
-sprintf(buff,"-%s-*-*-*-*-*-*-*-*-*-*-*-*", apd.fntFam);
-list = XListFonts(mdsp, buff, 15, &count);
-XFreeFontNames(list);
-if (count < 5)
-  { 
-  printf("PIGraphicX::Init %d fonts found for %s , switching to courier\n",
-         count, apd.fntFam);
-  apd.fntFam = "*-courier";
-  }
-sprintf(buff,"-%s-%s-*-*-*-*-*-*-*-*-*", apd.fntFam, fnbi_b[0]);
-list = XListFonts(mdsp, buff, 10, &count);
-XFreeFontNames(list);
-if (count < 2) fnbi[0] = "*-*-*";
-else  fnbi[0] = fnbi_b[0];
-sprintf(buff,"-%s-%s-*-*-*-*-*-*-*-*-*", apd.fntFam, fnbi_b[1]);
-list = XListFonts(mdsp, buff, 10, &count);
-XFreeFontNames(list);
-if (count < 2) fnbi[1] = "*-*-*";
-else  fnbi[1] = fnbi_b[1];
-sprintf(buff,"-%s-%s-*-*-*-*-*-*-*-*-*", apd.fntFam, fnbi_b[2]);
-list = XListFonts(mdsp, buff, 10, &count);
-XFreeFontNames(list);
-fnbi[2] = fnbi_b[2];
-if (count < 2) 
-  {
-  sprintf(buff,"-%s-%s-*-*-*-*-*-*-*-*-*", apd.fntFam, fnbi_b[3]);
-  list = XListFonts(mdsp, buff, 10, &count);
-  XFreeFontNames(list);
-  fnbi[2] = fnbi_b[3];
-  }
-if (count < 2) fnbi[2] = "*-*-*";
-
-sprintf(buff,"-*-fixed-*-*-*-*-14-*-*-*-*-*-*-*");
-list = XListFonts(mdsp, buff, 10, &count);
-XFreeFontNames(list);
-if (count < 1) 
-  {  
-  sprintf(buff,"fixed");
-  list = XListFonts(mdsp, buff, 10, &count);
-  XFreeFontNames(list);
-  }
-if (count < 1) 
-  {  
-  strcpy(buff,"");
-  list = XListFonts(mdsp, buff, 10, &count);
-  XFreeFontNames(list);
-  printf("PIGraphicX::Init/ Erreur, no font found ... \n");
-  defnt = NULL;
-  }
-else defnt = XLoadQueryFont(mdsp, buff);
-
-for (i=0; i<NMAXFONTSZ; i++)
-  for (j=0; j<3; j++)  fntst[i][j] = NULL;
-
-// Choix des trois tailles de fontes standard en fonction de 
-// la taille de fonte par defaut des composantes standard
-int szx, szy, szf;
-PIXtAppCtx(szx, szy, szf);
-int kkk, kkj, kksel, kkdsz = 9999;  
-kksel = NMAXFONTSZ/2;
-for(kkk=NMAXFONTSZ-1; kkk>=0; kkk--) {
-  kkj = szf - fntsz[kkk];   if (kkj < 0)  kkj = -kkj;
-  if (kkj < kkdsz)  {  kksel = kkk;  kkdsz = kkj; }
-  }
-if (kksel == NMAXFONTSZ-1)  kksel = NMAXFONTSZ-2;
-NormalFontIndex = kksel;
-SmallFontIndex = (kksel > 1) ? kksel-2 : 0 ;
-BigFontIndex =  NMAXFONTSZ-2 ;
-if (BigFontIndex < NormalFontIndex)  BigFontIndex = NormalFontIndex;
-HugeFontIndex = NMAXFONTSZ-1;
-
-//printf("PIGraphicX::Init()-DBG- FontIndex= %d %d %d (%d) \n", 
-//       SmallFontIndex, NormalFontIndex, BigFontIndex, szf);
-
 /*  Les couleurs  */
 cmap = XDefaultColormap (mdsp, scr);
 
-for(i=0; i<NMAXCOL; i++)  colpix[i] = XWhitePixel(mdsp, scr);
+for(int i=0; i<NMAXCOL; i++)  colpix[i] = XWhitePixel(mdsp, scr);
 colpix[PI_Black] = XBlackPixel(mdsp, scr);
 colpix[PI_White] = XWhitePixel(mdsp, scr);
@@ -847,35 +695,4 @@
 
 
-/* --Methode-- */
-void PIGraphicX::SelectFont(int isz, int jat)
-{
-
-if (!fntst[isz][jat])  // Il faut charger la fonte
-  {
-  char buff[256];
-  int count,k;
-  Display * mdsp = PIXDisplay();
-  char **list;
-
-  for (k=0; k<5; k++)    // Recherche de la fonte pour tailles croissantes
-    {
-    sprintf(buff,"-%s-%s-*-%d-*-*-*-*-*-*-*", apd.fntFam, fnbi[jat], fntsz[isz]+k);
-    list = XListFonts(mdsp, buff, 10, &count);
-    XFreeFontNames(list);
-    if (count > 0)  break;
-    }
-  if (count > 0) 
-    fntst[isz][jat] = XLoadQueryFont(mdsp, buff);
-  else
-    { printf("PIGraphicX::SelectFont/ Pb font %s - Using default \n", buff);    
-    fntst[isz][jat] = defnt; }
-  }
-
-mFAtt = fntatt[jat];
-mFSize = fntsz[isz];
-mFSt = fntst[isz][jat];
-XSetFont(mDisp, DefGC(), fntst[isz][jat]->fid);
-return;
-}
-
-
+
+
Index: trunk/SophyaPI/PI/pigraphx.h
===================================================================
--- trunk/SophyaPI/PI/pigraphx.h	(revision 314)
+++ trunk/SophyaPI/PI/pigraphx.h	(revision 316)
@@ -47,9 +47,12 @@
   virtual void       SelBackground(PIColorMap& cmap, int cid);
   virtual void       SelGOMode(PIGOMode mod=PI_GOCopy);
+  virtual void       SelLine(PILineAtt att=PI_NormalLine);
+  virtual void       SelMarker(int msz=3, PIMarker mrk=PI_DotMarker);
+
+// Modifications de fonte
+  virtual void	     SelFont(PIFont & fnt);
   virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont, 
                              PIFontAtt att=PI_RomanFont);
   virtual void       SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont);
-  virtual void       SelLine(PILineAtt att=PI_NormalLine);
-  virtual void       SelMarker(int msz=3, PIMarker mrk=PI_DotMarker);
 
 // Selection de zone de trace (clip)
@@ -66,7 +69,4 @@
   virtual PIMarker   GetMarker();
   virtual int        GetMarkerSize();
-
-  virtual int        GetFontHeight(int& asc, int& desc);
-  virtual PIGrCoord  CalcStringWidth(char const* s);
 
 // Sauvegarde des attributs graphiques 
Index: trunk/SophyaPI/PI/piimage.cc
===================================================================
--- trunk/SophyaPI/PI/piimage.cc	(revision 314)
+++ trunk/SophyaPI/PI/piimage.cc	(revision 316)
@@ -673,5 +673,5 @@
 void PIImage::Ptr2Move(int x, int y)
 {
-int xp, yp, tmp;
+int xp, yp;
 if (img == NULL)  return;
 if (xmv0 < 0)  return;
@@ -1102,5 +1102,5 @@
 else {
   int a,d,h;
-  h = g->GetFontHeight(a, d);
+  h = g->GetFont().GetFontHeight(a, d);
   if (g->kind() != PI_PSFileGraphics )   PIPixmap::Draw(g, 0, YSize()-10-h, XSize(), h+10); 
   }
Index: trunk/SophyaPI/PI/piimgtools.cc
===================================================================
--- trunk/SophyaPI/PI/piimgtools.cc	(revision 314)
+++ trunk/SophyaPI/PI/piimgtools.cc	(revision 316)
@@ -30,5 +30,6 @@
 spy = bsy/4;
 
-int wszx = 8*spx+3*bsx+2*bsy; 
+// int wszx = 8*spx+3*bsx+2*bsy; 
+int wszx = 8*spx+3.5*bsx; 
 int wszy = 9*spy+9*bsy;
 SetSize(wszx, wszy);
@@ -46,8 +47,8 @@
 cpy = spy*2;
 cpx += spx+bsx; 
-mText[0] = new PIText(this, "MinVal", 1.75*bsx, bsy, cpx, cpy);
+mText[0] = new PIText(this, "MinVal", 1.5*bsx, bsy, cpx, cpy);
 mText[0]->SetText("1");
 cpy += spy+bsy; 
-mText[1] = new PIText(this, "MaxVal", 1.75*bsx, bsy, cpx, cpy);
+mText[1] = new PIText(this, "MaxVal", 1.5*bsx, bsy, cpx, cpy);
 mText[1]->SetText("32000");
 mText[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
@@ -58,5 +59,5 @@
 mOlb[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
 cpx += spx+bsx; 
-mOpt[0] = new PIOptMenu(this, "imglut-opt-1", 1.75*bsx, bsy, cpx, cpy);
+mOpt[0] = new PIOptMenu(this, "imglut-opt-1", 1.5*bsx, bsy, cpx, cpy);
 mOpt[0]->AppendItem("Linear", 1100);
 mOpt[0]->AppendItem("Log.", 1101);
@@ -69,5 +70,5 @@
 mOlb[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
 cpx += spx+bsx; 
-mOpt[1] = new PIOptMenu(this, "imglut-opt-2", 1.75*bsx, bsy, cpx, cpy);
+mOpt[1] = new PIOptMenu(this, "imglut-opt-2", 1.5*bsx, bsy, cpx, cpy);
 mOpt[1]->AppendItem("+3 Sig", 1203);
 mOpt[1]->AppendItem("+2 Sig", 1202);
@@ -81,7 +82,7 @@
 
 cpy += 2*spy+bsy; 
-cpx = bsx/2;
+cpx = 3*spx;
 mBut[0] = new PIButton(this, "Apply", 2500, bsx*1.75, bsy, cpx, cpy);
-cpx += bsx*2;
+cpx += bsx*1.75+2*spx;
 mBut[1] = new PIButton(this, "Dismiss", 2600,  bsx*1.75, bsy, cpx, cpy);
 mBut[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
@@ -91,9 +92,10 @@
 // printf("-DBG- PIImgTools()  SzX,Y= %d %d , ButPos= %d %d (off=%d)\n", wszx, wszy, cpx, cpy, offy);
 
-cpx = 4*spx+2.75*bsx;
+// cpx = 4*spx+2.75*bsx;
+cpx = wszx-bsx-3*spx;
 cpy = 2*spy;
-mSc[0] = new PIScale(this, "sc-offset-lut", 2700, kSDirDownUp, 1.25*bsy, 4.5*bsy, cpx, cpy); 
-cpx += 1.50*bsy;
-mSc[1] = new PIScale(this, "sc-dyn-lut", 2800, kSDirDownUp, 1.25*bsy, 4.5*bsy, cpx, cpy); 
+mSc[0] = new PIScale(this, "sc-offset-lut", 2700, kSDirDownUp, 0.5*bsx, 4.5*bsy, cpx, cpy); 
+cpx += 0.50*bsx+spx;
+mSc[1] = new PIScale(this, "sc-dyn-lut", 2800, kSDirDownUp, 0.55*bsx, 4.5*bsy, cpx, cpy); 
 mSc[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
 mSc[0]->SetMinMax(-50, 50);
@@ -104,5 +106,5 @@
 
 //  Option-Menu  Couleur/Zoom
-cpx = bsx/2;
+cpx = 3*spx;
 cpy = offy;
 mOptzc[0] = new PIOptMenu(this, "imglut-opt-3", bsx*1.75, bsy, cpx, cpy);
@@ -120,5 +122,5 @@
 mOptzc[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
 
-cpx += bsx*2;
+cpx += bsx*1.75+2*spx;
 mOptzc[1] = new PIOptMenu(this, "imglut-opt-4", bsx*1.75, bsy, cpx, cpy);
 mOptzc[1]->AppendItem("Agr. x10", 110);
@@ -145,5 +147,5 @@
 int pspy = spy;
 
-cpx = 2*pspx;
+cpx = 2*spx;
 cpy += pbsy+2*spy;
 mButsz[0] = new PIButton(this, "1x1", 3201,  pbsx, pbsy, cpx, cpy);
@@ -162,5 +164,6 @@
 mButsz[4]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
 
-cpx += pbsx+10*pspx;
+//cpx += pbsx+10*pspx;
+cpx = wszx-3.0*pbsx-2*spx-pspx;
 mButoa[0] = new PIButton(this, "+Info", 5311,  1.5*pbsx, pbsy, cpx, cpy);
 mButoa[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
@@ -170,5 +173,5 @@
 
 
-cpx = 2*pspx;
+cpx = 2*spx;
 cpy += pbsy+pspy;
 mButcax[0] = new PIButton(this, "-X", 5201,  pbsx, pbsy, cpx, cpy);
@@ -181,5 +184,6 @@
 mButcax[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
 
-cpx += 1.5*pbsx+pspx+10*pspx;
+// cpx += 1.5*pbsx+pspx+10*pspx;
+cpx = wszx-4.5*pbsx-2*spx-2*pspx;
 mButoa[2] = new PIButton(this, "-All", 5300,  1.5*pbsx, pbsy, cpx, cpy);
 mButoa[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
Index: trunk/SophyaPI/PI/pisysdep.h
===================================================================
--- trunk/SophyaPI/PI/pisysdep.h	(revision 314)
+++ trunk/SophyaPI/PI/pisysdep.h	(revision 316)
@@ -15,12 +15,13 @@
 
   #define PIAPP_H "piapplmac.h"
+  #define PIPERIODIC_H "piperiodmac.h"
   
-  #define PIBWDG_H "pibwdgmac.h"
+  #define PIFONT_H "pifontmac.h"
   #define PIGRAPHIC_H "pigraphmac.h"
-
   #define PICMAPNTV_H "picmapmac.h"
   #define PICMAP_H "picmap.h"
+
+  #define PIBWDG_H "pibwdgmac.h"
   #define PIPIXMAP_H "pipixmapmac.h"
-
 
 #else                  // XWindow
@@ -36,13 +37,13 @@
 
   #define PIAPP_H "piapplx.h"
+  #define PIPERIODIC_H "piperiodx.h"
+
+  #define PIFONT_H "pifontx.h"
+  #define PIGRAPHIC_H "pigraphx.h"
+  #define PICMAPNTV_H "picmapx.h"
+  #define PICMAP_H "picmap.h"
 
   #define PIBWDG_H "pibwdgx.h"
-  #define PIGRAPHIC_H "pigraphx.h"
-
-  #define PICMAPNTV_H "picmapx.h"
-  #define PICMAP_H "picmap.h"
   #define PIPIXMAP_H "pipixmapx.h"
-
-  #define PIPERIODIC_H "piperiodx.h"
 
 #endif
Index: trunk/SophyaPI/PI/piwdgx.cc
===================================================================
--- trunk/SophyaPI/PI/piwdgx.cc	(revision 314)
+++ trunk/SophyaPI/PI/piwdgx.cc	(revision 316)
@@ -555,5 +555,5 @@
 
 // Ressources X si non definis 
-static const String fallback_res[22] = {
+static const String fallback_res[24] = {
 "PeidaInt*default*background:                 LightGrey" ,
 "PeidaInt*background:                         LightGrey" ,
@@ -576,8 +576,10 @@
 // "PeidaInt*DefMenubar*XtNheight:               30",
 "PeidaInt*fontList:           -*-courier-bold-r-normal-*-12-*-*-*-*-*-ISO8859-1",
-"PeidaInt*default*fontList:   -*-courier-bold-r-normal-*-12-*-*-*-*-*-ISO8859-1"
+"PeidaInt*default*fontList:   -*-courier-bold-r-normal-*-12-*-*-*-*-*-ISO8859-1",
 "PeidaInt*fontFamilyName:                     *-courier",   // Pas de blanc apres le nom de font
+"PeidaInt*courierfontFamilyName:              *-courier",   //           "        " 
+"PeidaInt*symbolfontFamilyName:               *-symbol",    //           "        " 
 "PeidaInt*XmToggleButton*selectColor:         Red",
-""
+NULL
 };
 
@@ -595,6 +597,10 @@
 //  strncpy(appname, ppc[0], 63); appname[63] = '\0';
 strncpy(appclass,"PeidaInt",63);  appclass[63] = '\0';     
-//  top = XtAppInitialize(&appctx, appclass, NULL, 0, &n, ppc);
-top = XtVaAppInitialize(&appctx, appclass, NULL, 0, &n, ppc, const_cast<String*>(fallback_res), NULL);
+//-----  XtAppInitialize obsolete (X11/R6 , remplace par XtOpenApplication   -  Reza 14/06/99  -----
+//  top = XtAppInitialize(&appctx, appclass, NULL, 0, &n, ppc, 
+//                      const_cast<String*>(fallback_res), NULL, 0 );
+//BUG ? - DEL top = XtVaAppInitialize(&appctx, appclass, NULL, 0, &n, ppc, const_cast<String*>(fallback_res));
+top = XtOpenApplication(&appctx, appclass, NULL, 0, &n, ppc, const_cast<String*>(fallback_res), 
+                          applicationShellWidgetClass, NULL, 0);
 if (top == NULL) {
   fprintf(stderr, "PIWdgX::InitXt()/ Error XtVaAppInitialize() -> Exit \n");
@@ -627,8 +633,32 @@
 strcpy(buff, fntname);
 list = XListFonts(dpy, buff, 15, &count);
-XFreeFontNames(list);
-if (count < 1)  strcpy(buff,"-*-*-*-*-*-*-*-*-*-*-*-*-*-*" );
+if (count < 1)  { 
+  strcpy(buff,"-*-*-*-*-*-*-*-*-*-*-*-*-*-*" );
+  XFreeFontNames(list);
+  list = XListFonts(dpy, buff, 15, &count);
+  }
 stdfnt = XLoadQueryFont(dpy, buff);
-
+char * myfntname = "???";
+// Recherche du champ taille en pixel de la fonte : apres le 7eme tiret
+int mySzFont = 12;
+if (count > 0) {
+  myfntname = list[0];
+  int kt = 0;
+  int kdx = 0;
+  char * pcf = list[0];
+  //  printf("DBG-X1 : %s \n ", pcf);
+  while (kt < 7)  {
+    if (pcf[kdx] == '-')  kt++;
+    if (pcf[kdx] == '\0')  break;
+    kdx++;
+    }
+  //  printf("DBG-X2 : %s \n ", pcf+kdx);
+  int iii = 0;
+  while ( (pcf[kdx+iii] != '-') && (pcf[kdx+iii] != '\0') )
+     { buff[iii] = pcf[kdx+iii];  iii++; }
+  buff[iii] = '\0';
+  mySzFont = atoi(buff);
+  //  printf("*DBG*X3* %s -> %d \n", buff, mySzFont);
+}
 // On calcule la taille de la chaine CANCEL (6 caracteres)
 char a[2];
@@ -637,14 +667,15 @@
 XTextExtents(stdfnt, a, 0, &hd, &fa, &fd, &ovr);
 len = XTextWidth(stdfnt, "CANCEL", 6);
-appSzY = (float)(fa+fd)*1.4+10;  // pour les shadow
+appSzY = (float)(fa+fd)*1.5+8;  // pour les shadow  $CHECK$ - a ameliorer peut-etre 
 appSzX = (float)len*1.5;
-appSzFont = fa+fd;
-// Taille multiple de 5 pixels 
+appSzFont =  mySzFont ;
+// Taille X multiple de 5 pixels, Y mult 2 pixels 
 if ( (appSzX % 5) != 0 )   appSzX = 5*(appSzX/5 + 1);
-if ( (appSzY % 5) != 0 )   appSzY = 5*(appSzY/5 + 1);
+if ( (appSzY % 2) != 0 )   appSzY = 2*(appSzY/2 + 1);
 if(appSzY < 10) appSzY = 10;
 if(appSzX < 30) appSzX = 30;
 
-// printf("PIWdgX::InitXt(Font=%s- %d %d , %d ) SzX,Y= %d %d \n", buff, fa,fd,len,appSzX, appSzY);
+// printf("PIWdgX::InitXt(Font=%s- %d %d , %d ) SzX,Y= %d %d - FSz= %d \n", myfntname, fa,fd,len,appSzX, appSzY, appSzFont);
+XFreeFontNames(list);
 return(0);
 }
