Index: /trunk/SophyaPI/PI/Tests/pist.cc
===================================================================
--- /trunk/SophyaPI/PI/Tests/pist.cc	(revision 1850)
+++ /trunk/SophyaPI/PI/Tests/pist.cc	(revision 1851)
@@ -11,8 +11,4 @@
 #include PISTDWDG_H 
 #include PIBWDG_H
-#include "piscdrawwdg.h"
-#include "pievthandler.h"
-#include "parradapter.h"
-
 
 /*  Composante graphique de trace de chaine de caracteres  */
Index: /trunk/SophyaPI/PI/pidrawer.cc
===================================================================
--- /trunk/SophyaPI/PI/pidrawer.cc	(revision 1850)
+++ /trunk/SophyaPI/PI/pidrawer.cc	(revision 1851)
@@ -7,4 +7,5 @@
 #include <strings.h>
 #include <iostream.h>
+#include <typeinfo>
 #include "pidrawer.h"
 
@@ -63,4 +64,9 @@
   mRevCmap = false;
   mFName = PI_DefaultFont;
+
+  // Nom par defaut : Le nom de la classe
+  mName = typeid(*this).name();
+  // Par defaut, pas de fenetre de controle specifique
+  mFgSpecContWind = false;
 }
 
Index: /trunk/SophyaPI/PI/pidrawer.h
===================================================================
--- /trunk/SophyaPI/PI/pidrawer.h	(revision 1850)
+++ /trunk/SophyaPI/PI/pidrawer.h	(revision 1851)
@@ -92,8 +92,14 @@
 //  Methode permettant l'affichage d'une fenetre de controle specialisee 
   virtual void       ShowControlWindow(PIBaseWdgGen* wdg);
+  inline  bool       HasSpecificControlWindow() const { return mFgSpecContWind; }
+
 
 //   Methode permettant de decoder des options a partir de chaines
   virtual int        DecodeOptionString(vector<string> & opt);
 
+//   On peut donner un nom a un drawer (par defaut = nom de la classe)
+  inline string	     Nom() { return mName; } 
+  inline string&     Name() { return mName; }
+  inline void	     SetName(string const& name) { mName = name; } 
 //  --- Methode- static ----
 //  Calcul des Distances optimales des subdivisions 
@@ -144,4 +150,8 @@
 // Flag de control d'affichage en mode HighLight
   bool mFgHighLight;
+// Flag indiquant s'il y a une fenetre de controle specifique
+  bool mFgSpecContWind;
+// Nom du drawer
+  string mName;
 
   list<DrwBWId>  mBWdgList;
Index: /trunk/SophyaPI/PI/pidrwtools.cc
===================================================================
--- /trunk/SophyaPI/PI/pidrwtools.cc	(revision 1850)
+++ /trunk/SophyaPI/PI/pidrwtools.cc	(revision 1851)
@@ -57,5 +57,5 @@
 {
 if (cwdrwt == NULL)  cwdrwt = new PIDrwTools(PIApplicationGetApp());
-SetCurrentBaseWdg(cbw);
+mCurBW = cbw;
 cwdrwt->Show();
 }
@@ -80,14 +80,6 @@
 if (mCurBW == cbw) return;
 mCurBW = cbw;
-if (cwdrwt)  { 
-  if (mCurBW != NULL)  { 
-    cwdrwt->mNDr = mCurBW->GetActiveDrawerNum();
-    if (cwdrwt->mNDr < 0)  cwdrwt->mNDr = 0;
-    }
-  else cwdrwt->mNDr = 0;
-  char buff[32];
-  sprintf(buff,"%d", cwdrwt->mNDr);
-  cwdrwt->mNlb->SetLabel(buff);  
-  }
+cwdrwt->UpdateControlsFromDrawer(-1);
+cwdrwt->UpdateAttFromDrawer();
 }
 /* --Methode-- */
@@ -110,5 +102,5 @@
 
 int wszx = 5*spx+3.5*bsx; 
-int wszy = (1+5*0.85)*bsy+(6+5*0.85)*spy;
+int wszy = (2+5*0.85)*bsy+(7+5*0.85)*spy;
 SetSize(wszx, wszy);
 
@@ -258,37 +250,54 @@
 mOpt[7]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
 
+int kb;
 cpx = 2*spx;
 cpy += spy+bsyo;
 bsy = bsyo; spy = spyo;
-mButdr[0] = new PIButton(this, "-", 3501, bsy, bsy, cpx, cpy);
+mButdr[0] = new PIButton(this, "-", 1501, bsy, bsy, cpx, cpy);
 cpx += bsy+0.25*spy;
-mNlb = new PILabel(this,"NumDr", bsy, bsy, cpx, cpy);
-mNlb->SetLabel("0");
+mNlb = new PILabel(this,"NumDr", 1.5*bsy, bsy, cpx, cpy);
+mNlb->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
+mNlb->SetLabel("");
 mNDr = 0;
-cpx += bsy+0.25*spy;
-mButdr[1] = new PIButton(this, "+", 3502, bsy, bsy, cpx, cpy);
+cpx += 1.5*bsy+0.25*spy;
+mButdr[1] = new PIButton(this, "+", 1502, bsy, bsy, cpx, cpy);
 mButdr[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
 mButdr[1]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
-mNlb->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
-
-cpx = wszx-1.7*bsx-3*spx;
-mButcf[0] = new PIButton(this, "GetAtt", 2800, 0.85*bsx, bsy, cpx, cpy);
-cpx += 0.85*bsx+spx;
-mButcf[1] = new PIButton(this, "SetAtt", 2900, 0.85*bsx, bsy, cpx, cpy);
-mButcf[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
-mButcf[1]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
-
-cpx = (wszx-3.2*bsx-2*spx)/2;
+for(int kb=0; kb<2; kb++) {
+  mButdr[kb]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
+  mButdr[kb]->SetUnSensitive();
+}
+cpx += 2*spx; 
+mDrName = new PILabel(this,"DrName", wszx-2*spx-cpx, bsy, cpx, cpy);
+mDrName->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
+mDrName->SetLabel("No-Drawer");
+mDrName->SetBorderWidth(1);
+
+cpy += bsy+spy;
+cpx = 2*spx;
+int butszx = 0.8*bsx;
+mButcf[0] = new PIButton(this, "GetAtt", 2500, butszx, bsy, cpx, cpy);
+cpx += butszx+spx;
+mButcf[1] = new PIButton(this, "SetAtt", 2600, butszx, bsy, cpx, cpy);
+cpx += butszx+spx;
+mButcf[2] = new PIButton(this, "Select", 2700, butszx, bsy, cpx, cpy);
+mButcf[2]->ActivatePress(true);
+cpx += butszx+spx;
+butszx = wszx-cpx-2*spx;
+mButcf[3] = new PIButton(this, "ShowControl", 2800, butszx, bsy, cpx, cpy);
+
+butszx = 1.4*bsx;
+cpx = (wszx-2*butszx-4*spx)/2;
 cpy += 2*spy+bsy;
-mButcf[2] = new PIButton(this, "Refresh", 3100, bsx*1.2, bsyo, cpx, cpy);
-mButcf[2]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
-cpx += bsx*1.2+spx;
-mButcf[3] = new PIButton(this, "Select", 3200, bsx*0.8, bsyo, cpx, cpy);
-mButcf[3]->ActivatePress(true);
-mButcf[3]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
-cpx += bsx*0.8+spx;
-mButcf[4] = new PIButton(this, "Dismiss", 3777, bsx*1.2, bsyo, cpx, cpy);
-mButcf[4]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
-
+mButcf[4] = new PIButton(this, "Refresh", 3000, bsx*1.2, bsyo, cpx, cpy);
+cpx += butszx+2*spx;
+mButcf[5] = new PIButton(this, "Dismiss", 3777, butszx, bsyo, cpx, cpy);
+
+for(int kb=0; kb<6; kb++) 
+  mButcf[kb]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
+for(int kb=0; kb<5; kb++) 
+  mButcf[kb]->SetUnSensitive();
+
+mButSens = 0;
 cwdrwt = this;
 
@@ -300,9 +309,10 @@
 if (cwdrwt == this)  cwdrwt = NULL;
 int i;
-for(i=0; i<5; i++) delete mButcf[i]; 
+for(i=0; i<6; i++) delete mButcf[i]; 
 for(i=0; i<2; i++) delete mButdr[i]; 
 for(i=0; i<8; i++)  delete mOpt[i];
 for(i=0; i<2; i++)  delete mCasc[i];
 delete mNlb;
+delete mDrName;
 }
 
@@ -339,18 +349,66 @@
 {
 PIWindow::Show();
-
-mNDr = 0;
-if (mCurBW != NULL)  { 
-  mNDr = mCurBW->NbDrawers()-1;
-  if (mNDr < 0)  mNDr = 0;
-  }
-else mNDr = 0;
-char buff[32];
-sprintf(buff,"%d", mNDr);
-mNlb->SetLabel(buff);  
-
+UpdateControlsFromDrawer(-1);
 UpdateAttFromDrawer();
 return;
 }
+
+/* --Methode-- */
+void PIDrwTools::UpdateControlsFromDrawer(int numdr)
+{
+  string lstr;
+  int kb;
+  int butsensnew = 0;
+
+  PIDrawer * dr = NULL;
+  
+  if (mCurBW != NULL) {
+    if (numdr < 0) { 
+      if (mCurBW->NbDrawers() > 0)  mNDr = mCurBW->GetActiveDrawerNum();
+      else mNDr = -1;
+    }
+    else { 
+      if (mCurBW->NbDrawers() > 0) {
+	if (mNDr < 0)  mNDr = 0;
+	else if (mNDr >= mCurBW->NbDrawers()) mNDr = mCurBW->NbDrawers();
+      }
+      else mNDr = -1;
+    }
+    if (mNDr >= 0)   dr = mCurBW->GetDrawer(mNDr);
+    if (dr != NULL)  butsensnew = 2;
+    else butsensnew = 1;
+  }
+
+  if (butsensnew == 2) {
+    mDrName->SetLabel(dr->Name());
+    char strg[64];
+    sprintf(strg,"%d",mNDr);
+    mNlb->SetLabel(strg);
+  }
+  else if (mButSens != butsensnew) {
+    if(mButSens == 2)  mNlb->SetLabel("");
+    if (butsensnew == 1) 
+      mDrName->SetLabel("No-Drawer");
+    else  mDrName->SetLabel("No-BaseWdg");
+  }
+
+  if (butsensnew != mButSens) {
+    if (butsensnew < 2) {
+      for(kb=0; kb<2;kb++)  mButdr[kb]->SetUnSensitive();
+      for(kb=0; kb<4;kb++)  mButcf[kb]->SetUnSensitive();
+      if (butsensnew == 0) mButcf[4]->SetUnSensitive();
+      else mButcf[4]->SetSensitive();
+    }
+    else { 
+      for(kb=0; kb<2;kb++)  mButdr[kb]->SetSensitive();
+      for(kb=0; kb<3;kb++)  mButcf[kb]->SetSensitive();
+      mButcf[4]->SetSensitive();
+      if ((dr != NULL) && dr->HasSpecificControlWindow())
+	mButcf[3]->SetSensitive(); 
+      else mButcf[3]->SetUnSensitive(); 	
+    }
+  }
+  mButSens = butsensnew;
+}    
 
 /* --Methode-- */
@@ -457,17 +515,21 @@
 
   switch (msg) {
-    case 2800 :
+    case 1501 :
+    case 1502 :
+      if (mCurBW && (mCurBW->NbDrawers() > 0)) {
+	if (msg == 1501)  UpdateControlsFromDrawer(mNDr-1);
+	else UpdateControlsFromDrawer(mNDr+1);
+      }
+      break;
+
+    case 2500 :
       UpdateAttFromDrawer();
       break;
 
-    case 2900 :
+    case 2600 :
       SetGraphicAtt(false);
       break;
 
-    case 3100 :
-      SetGraphicAtt(true);
-      break;
-
-    case 3200 :
+    case 2700 :
       if ((mCurBW != NULL) && (mCurBW->GetDrawer(mNDr) != NULL) ) {
 	if (mod == PIMsg_Press)  { 
@@ -479,16 +541,17 @@
       break;
 
+    case 2800 :
+      if ((mCurBW != NULL) && (mCurBW->GetDrawer(mNDr) != NULL) ) 
+	mCurBW->GetDrawer(mNDr)->ShowControlWindow(mCurBW);
+      break;
+
+    case 3000 :
+      SetGraphicAtt(true);
+      break;
+
     case 3777 :
       Hide();
       break;
 
-    case 3501 :
-    case 3502 :
-      if (mCurBW) {
-	if (msg == 3501) {  mNDr--;   if (mNDr < 0)  mNDr = 0; }
-	else { mNDr++;  if (mNDr >= mCurBW->NbDrawers())  mNDr--; }
-	sprintf(strg, "%d", mNDr);
-	mNlb->SetLabel(strg);
-      }
       /*   On ne change pas les options choisies   Reza+cmv 2/10/98  
 	   mOpt[0]->SetValue(100);
Index: /trunk/SophyaPI/PI/pidrwtools.h
===================================================================
--- /trunk/SophyaPI/PI/pidrwtools.h	(revision 1850)
+++ /trunk/SophyaPI/PI/pidrwtools.h	(revision 1851)
@@ -32,4 +32,5 @@
 
 protected:
+  virtual void  UpdateControlsFromDrawer(int numdr);
   virtual void  UpdateAttFromDrawer();
   virtual void  SetGraphicAtt(bool fgref);
@@ -41,9 +42,12 @@
   PIMenu* mCasc[5];
   PILabel* mNlb;
+  PILabel* mDrName;
   PIButton* mButdr[2];
-  PIButton* mButcf[5];
+  PIButton* mButcf[6];
   int mNDr;
-  int mtyp, msz;
-//
+// mButSens  - Pour l'etat de sensibilite des boutons 
+// 0 NoBaseDrawer , 1 BaseDrawer - NoDrawer , 2= BaseDrawer+CurDrawer
+  int mButSens;  
+// ------------------------------------------------------
   static PIBaseWdgGen* mCurBW;
   static PIDrwTools* cwdrwt;
Index: /trunk/SophyaPI/PI/pigraphgen.cc
===================================================================
--- /trunk/SophyaPI/PI/pigraphgen.cc	(revision 1850)
+++ /trunk/SophyaPI/PI/pigraphgen.cc	(revision 1851)
@@ -298,5 +298,7 @@
     int posh = pos & PI_HorizontalPosition;
     int posv = pos & PI_VerticalPosition;
-    if ((posh == PI_HorizontalLeft)  && (posv == PI_VerticalBottom))
+    if ( ((posh == 0) &&  (posv == PI_VerticalBaseLine)) || 
+	 ((posh == PI_HorizontalLeft) && (posv == 0)) ||
+	 ((posh == PI_HorizontalLeft) && (posv == PI_VerticalBaseLine)) )
       return(false);
     if (posh != PI_HorizontalLeft) {
@@ -306,9 +308,10 @@
       else wx = 0;
     }
-    if (posv != PI_VerticalBottom) {
-      int a,d;
-      int wy = myFont.GetFontHeight(a, d);
-      if (posv == PI_VerticalCenter)  dy = -wy/2;
-      else if (posv == PI_VerticalTop)  dy = -wy;
+    if (posv != PI_VerticalBaseLine) {
+      int asc,desc;
+      int wy = myFont.GetFontHeight(asc, desc);
+      if (posv == PI_VerticalBottom) dy = desc;
+      else if (posv == PI_VerticalCenter)  dy = -wy/2+desc;
+      else if (posv == PI_VerticalTop)  dy = -wy+desc;
       else dy = 0;
     }
Index: /trunk/SophyaPI/PI/pigraphgen.h
===================================================================
--- /trunk/SophyaPI/PI/pigraphgen.h	(revision 1850)
+++ /trunk/SophyaPI/PI/pigraphgen.h	(revision 1851)
@@ -36,6 +36,7 @@
 enum PIGrPosVertical  // Flags de positionnement vertical
 // PI_VerticalPosition regroupe l'ensemble des bits utilisables
-     { PI_VerticalBottom = 0x10, PI_VerticalCenter = 0x20, 
-       PI_VerticalTop = 0x30, PI_VerticalPosition = 0xF0 };
+     { PI_VerticalBottom = 0x10, PI_VerticalBaseLine = 0x20, 
+       PI_VerticalCenter = 0x30, PI_VerticalTop = 0x40, 
+       PI_VerticalPosition = 0xF0 };
 
 // Les differents modes de trace graphique disponible
Index: /trunk/SophyaPI/PI/pigraphps.cc
===================================================================
--- /trunk/SophyaPI/PI/pigraphps.cc	(revision 1850)
+++ /trunk/SophyaPI/PI/pigraphps.cc	(revision 1851)
@@ -114,12 +114,14 @@
 void PIGraphicPS::DrawString(PIGrCoord x, PIGrCoord y, const char* s, int pos)
 {
-if(mPSOut)
-  //  mPSOut->DrawString((double)x,(double)y,s,mFCol,mFAtt,mFSize); /* $CHECK$ PIFontSize ?? */
-  mPSOut->DrawString((double)x,(double)y,s,mFCol, myFont.GetFontName(),
-                     myFont.GetFontAtt(),  myFont.GetFontSize(),
-		     pos); /* $CHECK$  x 0.9 - Reza 4/11/99  - enleve 3/01/2002 */
-// Calculez la taille de la boite occupe par la fonte
-//  myFont.GetFontHeight(int& asc, int& desc)  Tres proche de myFont.GetFontSize() en principe
-//  myFont.GetStringWidth(char const* s)  Largeur occupe par la chaine
+if(mPSOut) {
+  int posh = pos & PI_HorizontalPosition;
+  int posv = pos & PI_VerticalPosition;
+  int dx,dy;
+  double xd = x;
+  double yd = y;
+  if ( CalcStringPositionShift(s, posv, dx, dy) ) yd -= dy; 
+  mPSOut->DrawString(xd, yd, s, mFCol, myFont.GetFontName(), myFont.GetFontAtt(),
+		     myFont.GetFontSize(), posh); 
+}
 return;
 }
@@ -128,10 +130,14 @@
 void PIGraphicPS::DrawOpaqueString(PIGrCoord x, PIGrCoord y, const char* s, int pos)
 {
-if(mPSOut)
-  //  mPSOut->DrawString((double)x,(double)y,s,mFCol,mFAtt,mFSize); /* $CHECK$ PIFontSize ?? */
-  mPSOut->DrawString((double)x,(double)y,s,mFCol, myFont.GetFontName(), 
-                     myFont.GetFontAtt(),  myFont.GetFontSize(),
-		     pos);  /* $CHECK$  x 0.9 - Reza 4/11/99 */
-// Idem taille ici 
+if(mPSOut) {
+  int posh = pos & PI_HorizontalPosition;
+  int posv = pos & PI_VerticalPosition;
+  int dx,dy;
+  double xd = x;
+  double yd = y;
+  if ( CalcStringPositionShift(s, posv, dx, dy) ) yd -= dy; 
+  mPSOut->DrawString(xd, yd, s, mFCol, myFont.GetFontName(), myFont.GetFontAtt(),
+		     myFont.GetFontSize(), posh); 
+}
 return;
 }
Index: /trunk/SophyaPI/PI/psfile.cc
===================================================================
--- /trunk/SophyaPI/PI/psfile.cc	(revision 1850)
+++ /trunk/SophyaPI/PI/psfile.cc	(revision 1851)
@@ -132,7 +132,25 @@
 /rmv {rmoveto} bind def \n\
 %% Trace de chaine avec justification diverse \n\
+%% ------------------------------------------------- \n\
+%% hxshstr  stack: TheString \n\
+%% hx (x=r,c,l) Horizontal-X Right,Center,Left - Vertical: BaseLine \n\
+%% ------------------------------------------------- \n\
+/hlshstr   %% Horizontal-left Vertical-BaseLine justified \n\
+{ gs 1 -1 sc show gr } bind def \n\
+/hcshstr   %% Horizontal-Center Vertical-BaseLine justified \n\
+{ dup stringwidth pop 2 div neg  %% get minus(string length/2)  \n\
+  0 rmoveto gs 1 -1 sc show gr } bind def \n\
+/hrvbshstr   %% Horizontal-Right Vertical-BaseLine justified \n\
+{ dup stringwidth pop neg  %% get minus(string width)  \n\
+  0 rmoveto gs 1 -1 sc show gr } bind def \n\
+%% ------------------------------------------------- \n\
 %% hxvyshstr  stack: TheString \n\
 %% hx (x=r,c,l) Horizontal-X Right,Center,Left \n\
 %% vy (y=t,c,b) Vertical-Y Top,Center,Bottom \n\
+%% Ces procs (hxvyshstr) utilisent la variable curfntsz que l'on definit par defaut \n\
+%% hxshstr  stack: TheString \n\
+%% hx (x=r,c,l) Horizontal-X Right,Center,Left - Vertical: BaseLine \n\
+%% ------------------------------------------------- \n\
+/curfntsz 10 def \n\
 /hlvbshstr   %% Horizontal-left Vertical-Bottom justified \n\
 { gs 1 -1 sc show gr } bind def \n\
@@ -144,21 +162,21 @@
   0 rmoveto gs 1 -1 sc show gr } bind def \n\
 /hlvcshstr   %% Horizontal-left Vertical-Center justified \n\
-{ dup stringwidth exch pop 2 div   %% get (string height)/2  \n\
-  0 exch rmoveto gs 1 -1 sc show gr } bind def \n\
+{ 0 curfntsz 2 div   %% get (string height)/2  \n\
+  rmoveto gs 1 -1 sc show gr } bind def \n\
 /hcvcshstr   %% Horizontal-Center Vertical-Center justified \n\
-{ dup stringwidth 2 div exch 2 div neg   %% s_wy/2 -s_wx/2  \n\
-  exch rmoveto gs 1 -1 sc show gr } bind def \n\
+{ dup stringwidth pop 2 div neg curfntsz 2 div  %% s_wy/2 -s_wx/2  \n\
+  rmoveto gs 1 -1 sc show gr } bind def \n\
 /hrvcshstr   %% Horizontal-Right Vertical-Center justified \n\
-{ dup stringwidth 2 div exch neg   %% s_wy/2 -s_wx  \n\
-  exch rmoveto gs 1 -1 sc show gr } bind def \n\
+{ dup stringwidth pop neg curfntsz  %% s_wy/2 -s_wx  \n\
+  rmoveto gs 1 -1 sc show gr } bind def \n\
 /hlvtshstr   %% Horizontal-left Vertical-Top justified \n\
-{ dup stringwidth exch pop    %% get s_wy  \n\
-  0 exch rmoveto gs 1 -1 sc show gr } bind def \n\
+{ 0 curfntsz   %% get s_wy  \n\
+  rmoveto gs 1 -1 sc show gr } bind def \n\
 /hcvtshstr   %% Horizontal-Center Vertical-Top justified \n\
-{ dup stringwidth exch 2 div neg   %% s_wy -s_wx/2  \n\
-  exch rmoveto gs 1 -1 sc show gr } bind def \n\
+{ dup stringwidth pop 2 div neg curfntsz  %% s_wy -s_wx/2  \n\
+  rmoveto gs 1 -1 sc show gr } bind def \n\
 /hrvtshstr   %% Horizontal-Right Vertical-Top justified \n\
-{ dup stringwidth exch neg   %% s_wy -s_wx  \n\
-  exch rmoveto gs 1 -1 sc show gr } bind def \n\
+{ dup stringwidth pop neg curfntsz  %% s_wy -s_wx  \n\
+  rmoveto gs 1 -1 sc show gr } bind def \n\
 %% Tx Ty X0 Y0 box\n\
 /box {tr 0 3 1 roll neg exch 0 0 3 index neg 0 0 m rl rl rl c} bind def\n\
@@ -604,5 +622,5 @@
 	} /* BB */
 	/* facteur d'echelle pour les fontes*/
-	currentPage->FontScaleFactor = 1.1*scale; 
+	currentPage->FontScaleFactor = scale; 
 	//	  postscript_resolution/def_user_resolution*scale;
 	/*
@@ -688,5 +706,5 @@
 	} /* End if .Landscape */
 	/* facteur d'echelle pour les fontes*/
-	currentPage->FontScaleFactor = 1.2*scale*postscript_resolution;
+	currentPage->FontScaleFactor = scale*postscript_resolution;
 	/*
 	cout << " PS_DBG_FontScaleFactor = " << currentPage->FontScaleFactor
@@ -700,5 +718,6 @@
 mFontSize = 10;
 mFontName = PI_DefaultFont;
-fprintf(mPSFile, "/Courier ff %d FS \n", mFontSize) ; 
+double scaledFontSize = (double)mFontSize*currentPage->FontScaleFactor;
+fprintf(mPSFile, "/Courier ff %g FS /curfntsz %g def \n", scaledFontSize, scaledFontSize) ; 
 setFontDone = true;
 currentPage->tmp = ftell(mPSFile);
@@ -777,5 +796,7 @@
     mFontSize = 10;
     mFontName = PI_DefaultFont;
-    fprintf(mPSFile, "/Courier ff %d FS \n", mFontSize) ; 
+    double scaledFontSize = (double)mFontSize*currentPage->FontScaleFactor;
+    fprintf(mPSFile, "/Courier ff %g FS /curfntsz %g def \n", 
+	    scaledFontSize, scaledFontSize) ; 
     setFontDone = true;
     currentBloc->tmp = ftell(mPSFile) ;
@@ -830,5 +851,4 @@
     bool change = false;
 
-    FontSize = (float)FontSize*currentPage->FontScaleFactor;
     /* Couleurs */
     if ( (DrawColor != PI_NotDefColor) && (DrawColor != mDrawColor) ) {
@@ -890,5 +910,6 @@
 	break ; 	
       } // endsw 
-      fprintf(mPSFile, " ff %d FS ", FontSize) ; 
+      double scaledFontSize = (double)FontSize*currentPage->FontScaleFactor;
+      fprintf(mPSFile, " ff %g FS /curfntsz %g def \n", scaledFontSize, scaledFontSize);
       setFontDone = true ;   // $CHECK$ - doit etre fait uniquement a ce moment
     }
@@ -898,6 +919,7 @@
       int posh = pos & PI_HorizontalPosition;
       int posv = pos & PI_VerticalPosition;
-      if ((posh == PI_HorizontalLeft)  && (posv == PI_VerticalBottom))
-	fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) hlvbshstr gr\n", 
+      if ((posh == PI_HorizontalLeft)  && 
+	  ((posv == PI_VerticalBaseLine) || (posv == 0)) )
+	fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) hlshstr gr\n", 
 		x, y, s) ; 
       else {
@@ -909,12 +931,17 @@
 	  else sshp = 'l';
 	}
-	if (posv != PI_VerticalBottom) {
+	if (posv == 0) 
+	  fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) h%cshstr gr\n", 
+		  x, y, s, sshp) ;
+	else {
 	  if (posv == PI_VerticalCenter)  ssvp = 'c';
 	  else if (posv == PI_VerticalTop)  ssvp = 't';
+	  else ssvp = 'b';
 	}
 	fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) h%cv%cshstr gr\n", 
-		x, y, s, sshp, ssvp) ; 
+		  x, y, s, sshp, ssvp) ; 
       }
     }
+
 }
 
