Changeset 1851 in Sophya


Ignore:
Timestamp:
Jan 11, 2002, 7:53:14 PM (24 years ago)
Author:
ansari
Message:
  • Fin (?) d'amelioration de la fidelite de trace de chaine de caracteres

ds psfile.cc + positionnement de trace de chaine (vertical-Horizontal)

  • Ajout d'attribut de nom ds PIDrawer + Amelioration de PIDrawerTools
  • Amelioration du programme de test de trace de chaine (Tests/pist.cc)

Reza 11/01/2002

Location:
trunk/SophyaPI/PI
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/Tests/pist.cc

    r1847 r1851  
    1111#include PISTDWDG_H
    1212#include PIBWDG_H
    13 #include "piscdrawwdg.h"
    14 #include "pievthandler.h"
    15 #include "parradapter.h"
    16 
    1713
    1814/*  Composante graphique de trace de chaine de caracteres  */
  • trunk/SophyaPI/PI/pidrawer.cc

    r1827 r1851  
    77#include <strings.h>
    88#include <iostream.h>
     9#include <typeinfo>
    910#include "pidrawer.h"
    1011
     
    6364  mRevCmap = false;
    6465  mFName = PI_DefaultFont;
     66
     67  // Nom par defaut : Le nom de la classe
     68  mName = typeid(*this).name();
     69  // Par defaut, pas de fenetre de controle specifique
     70  mFgSpecContWind = false;
    6571}
    6672
  • trunk/SophyaPI/PI/pidrawer.h

    r1827 r1851  
    9292//  Methode permettant l'affichage d'une fenetre de controle specialisee
    9393  virtual void       ShowControlWindow(PIBaseWdgGen* wdg);
     94  inline  bool       HasSpecificControlWindow() const { return mFgSpecContWind; }
     95
    9496
    9597//   Methode permettant de decoder des options a partir de chaines
    9698  virtual int        DecodeOptionString(vector<string> & opt);
    9799
     100//   On peut donner un nom a un drawer (par defaut = nom de la classe)
     101  inline string      Nom() { return mName; }
     102  inline string&     Name() { return mName; }
     103  inline void        SetName(string const& name) { mName = name; }
    98104//  --- Methode- static ----
    99105//  Calcul des Distances optimales des subdivisions
     
    144150// Flag de control d'affichage en mode HighLight
    145151  bool mFgHighLight;
     152// Flag indiquant s'il y a une fenetre de controle specifique
     153  bool mFgSpecContWind;
     154// Nom du drawer
     155  string mName;
    146156
    147157  list<DrwBWId>  mBWdgList;
  • trunk/SophyaPI/PI/pidrwtools.cc

    r1827 r1851  
    5757{
    5858if (cwdrwt == NULL)  cwdrwt = new PIDrwTools(PIApplicationGetApp());
    59 SetCurrentBaseWdg(cbw);
     59mCurBW = cbw;
    6060cwdrwt->Show();
    6161}
     
    8080if (mCurBW == cbw) return;
    8181mCurBW = cbw;
    82 if (cwdrwt)  {
    83   if (mCurBW != NULL)  {
    84     cwdrwt->mNDr = mCurBW->GetActiveDrawerNum();
    85     if (cwdrwt->mNDr < 0)  cwdrwt->mNDr = 0;
    86     }
    87   else cwdrwt->mNDr = 0;
    88   char buff[32];
    89   sprintf(buff,"%d", cwdrwt->mNDr);
    90   cwdrwt->mNlb->SetLabel(buff); 
    91   }
     82cwdrwt->UpdateControlsFromDrawer(-1);
     83cwdrwt->UpdateAttFromDrawer();
    9284}
    9385/* --Methode-- */
     
    110102
    111103int wszx = 5*spx+3.5*bsx;
    112 int wszy = (1+5*0.85)*bsy+(6+5*0.85)*spy;
     104int wszy = (2+5*0.85)*bsy+(7+5*0.85)*spy;
    113105SetSize(wszx, wszy);
    114106
     
    258250mOpt[7]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    259251
     252int kb;
    260253cpx = 2*spx;
    261254cpy += spy+bsyo;
    262255bsy = bsyo; spy = spyo;
    263 mButdr[0] = new PIButton(this, "-", 3501, bsy, bsy, cpx, cpy);
     256mButdr[0] = new PIButton(this, "-", 1501, bsy, bsy, cpx, cpy);
    264257cpx += bsy+0.25*spy;
    265 mNlb = new PILabel(this,"NumDr", bsy, bsy, cpx, cpy);
    266 mNlb->SetLabel("0");
     258mNlb = new PILabel(this,"NumDr", 1.5*bsy, bsy, cpx, cpy);
     259mNlb->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     260mNlb->SetLabel("");
    267261mNDr = 0;
    268 cpx += bsy+0.25*spy;
    269 mButdr[1] = new PIButton(this, "+", 3502, bsy, bsy, cpx, cpy);
     262cpx += 1.5*bsy+0.25*spy;
     263mButdr[1] = new PIButton(this, "+", 1502, bsy, bsy, cpx, cpy);
    270264mButdr[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    271265mButdr[1]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    272 mNlb->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    273 
    274 cpx = wszx-1.7*bsx-3*spx;
    275 mButcf[0] = new PIButton(this, "GetAtt", 2800, 0.85*bsx, bsy, cpx, cpy);
    276 cpx += 0.85*bsx+spx;
    277 mButcf[1] = new PIButton(this, "SetAtt", 2900, 0.85*bsx, bsy, cpx, cpy);
    278 mButcf[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    279 mButcf[1]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    280 
    281 cpx = (wszx-3.2*bsx-2*spx)/2;
     266for(int kb=0; kb<2; kb++) {
     267  mButdr[kb]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     268  mButdr[kb]->SetUnSensitive();
     269}
     270cpx += 2*spx;
     271mDrName = new PILabel(this,"DrName", wszx-2*spx-cpx, bsy, cpx, cpy);
     272mDrName->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     273mDrName->SetLabel("No-Drawer");
     274mDrName->SetBorderWidth(1);
     275
     276cpy += bsy+spy;
     277cpx = 2*spx;
     278int butszx = 0.8*bsx;
     279mButcf[0] = new PIButton(this, "GetAtt", 2500, butszx, bsy, cpx, cpy);
     280cpx += butszx+spx;
     281mButcf[1] = new PIButton(this, "SetAtt", 2600, butszx, bsy, cpx, cpy);
     282cpx += butszx+spx;
     283mButcf[2] = new PIButton(this, "Select", 2700, butszx, bsy, cpx, cpy);
     284mButcf[2]->ActivatePress(true);
     285cpx += butszx+spx;
     286butszx = wszx-cpx-2*spx;
     287mButcf[3] = new PIButton(this, "ShowControl", 2800, butszx, bsy, cpx, cpy);
     288
     289butszx = 1.4*bsx;
     290cpx = (wszx-2*butszx-4*spx)/2;
    282291cpy += 2*spy+bsy;
    283 mButcf[2] = new PIButton(this, "Refresh", 3100, bsx*1.2, bsyo, cpx, cpy);
    284 mButcf[2]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    285 cpx += bsx*1.2+spx;
    286 mButcf[3] = new PIButton(this, "Select", 3200, bsx*0.8, bsyo, cpx, cpy);
    287 mButcf[3]->ActivatePress(true);
    288 mButcf[3]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    289 cpx += bsx*0.8+spx;
    290 mButcf[4] = new PIButton(this, "Dismiss", 3777, bsx*1.2, bsyo, cpx, cpy);
    291 mButcf[4]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    292 
     292mButcf[4] = new PIButton(this, "Refresh", 3000, bsx*1.2, bsyo, cpx, cpy);
     293cpx += butszx+2*spx;
     294mButcf[5] = new PIButton(this, "Dismiss", 3777, butszx, bsyo, cpx, cpy);
     295
     296for(int kb=0; kb<6; kb++)
     297  mButcf[kb]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     298for(int kb=0; kb<5; kb++)
     299  mButcf[kb]->SetUnSensitive();
     300
     301mButSens = 0;
    293302cwdrwt = this;
    294303
     
    300309if (cwdrwt == this)  cwdrwt = NULL;
    301310int i;
    302 for(i=0; i<5; i++) delete mButcf[i];
     311for(i=0; i<6; i++) delete mButcf[i];
    303312for(i=0; i<2; i++) delete mButdr[i];
    304313for(i=0; i<8; i++)  delete mOpt[i];
    305314for(i=0; i<2; i++)  delete mCasc[i];
    306315delete mNlb;
     316delete mDrName;
    307317}
    308318
     
    339349{
    340350PIWindow::Show();
    341 
    342 mNDr = 0;
    343 if (mCurBW != NULL)  {
    344   mNDr = mCurBW->NbDrawers()-1;
    345   if (mNDr < 0)  mNDr = 0;
    346   }
    347 else mNDr = 0;
    348 char buff[32];
    349 sprintf(buff,"%d", mNDr);
    350 mNlb->SetLabel(buff); 
    351 
     351UpdateControlsFromDrawer(-1);
    352352UpdateAttFromDrawer();
    353353return;
    354354}
     355
     356/* --Methode-- */
     357void PIDrwTools::UpdateControlsFromDrawer(int numdr)
     358{
     359  string lstr;
     360  int kb;
     361  int butsensnew = 0;
     362
     363  PIDrawer * dr = NULL;
     364 
     365  if (mCurBW != NULL) {
     366    if (numdr < 0) {
     367      if (mCurBW->NbDrawers() > 0)  mNDr = mCurBW->GetActiveDrawerNum();
     368      else mNDr = -1;
     369    }
     370    else {
     371      if (mCurBW->NbDrawers() > 0) {
     372        if (mNDr < 0)  mNDr = 0;
     373        else if (mNDr >= mCurBW->NbDrawers()) mNDr = mCurBW->NbDrawers();
     374      }
     375      else mNDr = -1;
     376    }
     377    if (mNDr >= 0)   dr = mCurBW->GetDrawer(mNDr);
     378    if (dr != NULL)  butsensnew = 2;
     379    else butsensnew = 1;
     380  }
     381
     382  if (butsensnew == 2) {
     383    mDrName->SetLabel(dr->Name());
     384    char strg[64];
     385    sprintf(strg,"%d",mNDr);
     386    mNlb->SetLabel(strg);
     387  }
     388  else if (mButSens != butsensnew) {
     389    if(mButSens == 2)  mNlb->SetLabel("");
     390    if (butsensnew == 1)
     391      mDrName->SetLabel("No-Drawer");
     392    else  mDrName->SetLabel("No-BaseWdg");
     393  }
     394
     395  if (butsensnew != mButSens) {
     396    if (butsensnew < 2) {
     397      for(kb=0; kb<2;kb++)  mButdr[kb]->SetUnSensitive();
     398      for(kb=0; kb<4;kb++)  mButcf[kb]->SetUnSensitive();
     399      if (butsensnew == 0) mButcf[4]->SetUnSensitive();
     400      else mButcf[4]->SetSensitive();
     401    }
     402    else {
     403      for(kb=0; kb<2;kb++)  mButdr[kb]->SetSensitive();
     404      for(kb=0; kb<3;kb++)  mButcf[kb]->SetSensitive();
     405      mButcf[4]->SetSensitive();
     406      if ((dr != NULL) && dr->HasSpecificControlWindow())
     407        mButcf[3]->SetSensitive();
     408      else mButcf[3]->SetUnSensitive();         
     409    }
     410  }
     411  mButSens = butsensnew;
     412}   
    355413
    356414/* --Methode-- */
     
    457515
    458516  switch (msg) {
    459     case 2800 :
     517    case 1501 :
     518    case 1502 :
     519      if (mCurBW && (mCurBW->NbDrawers() > 0)) {
     520        if (msg == 1501)  UpdateControlsFromDrawer(mNDr-1);
     521        else UpdateControlsFromDrawer(mNDr+1);
     522      }
     523      break;
     524
     525    case 2500 :
    460526      UpdateAttFromDrawer();
    461527      break;
    462528
    463     case 2900 :
     529    case 2600 :
    464530      SetGraphicAtt(false);
    465531      break;
    466532
    467     case 3100 :
    468       SetGraphicAtt(true);
    469       break;
    470 
    471     case 3200 :
     533    case 2700 :
    472534      if ((mCurBW != NULL) && (mCurBW->GetDrawer(mNDr) != NULL) ) {
    473535        if (mod == PIMsg_Press)  {
     
    479541      break;
    480542
     543    case 2800 :
     544      if ((mCurBW != NULL) && (mCurBW->GetDrawer(mNDr) != NULL) )
     545        mCurBW->GetDrawer(mNDr)->ShowControlWindow(mCurBW);
     546      break;
     547
     548    case 3000 :
     549      SetGraphicAtt(true);
     550      break;
     551
    481552    case 3777 :
    482553      Hide();
    483554      break;
    484555
    485     case 3501 :
    486     case 3502 :
    487       if (mCurBW) {
    488         if (msg == 3501) {  mNDr--;   if (mNDr < 0)  mNDr = 0; }
    489         else { mNDr++;  if (mNDr >= mCurBW->NbDrawers())  mNDr--; }
    490         sprintf(strg, "%d", mNDr);
    491         mNlb->SetLabel(strg);
    492       }
    493556      /*   On ne change pas les options choisies   Reza+cmv 2/10/98 
    494557           mOpt[0]->SetValue(100);
  • trunk/SophyaPI/PI/pidrwtools.h

    r1827 r1851  
    3232
    3333protected:
     34  virtual void  UpdateControlsFromDrawer(int numdr);
    3435  virtual void  UpdateAttFromDrawer();
    3536  virtual void  SetGraphicAtt(bool fgref);
     
    4142  PIMenu* mCasc[5];
    4243  PILabel* mNlb;
     44  PILabel* mDrName;
    4345  PIButton* mButdr[2];
    44   PIButton* mButcf[5];
     46  PIButton* mButcf[6];
    4547  int mNDr;
    46   int mtyp, msz;
    47 //
     48// mButSens  - Pour l'etat de sensibilite des boutons
     49// 0 NoBaseDrawer , 1 BaseDrawer - NoDrawer , 2= BaseDrawer+CurDrawer
     50  int mButSens; 
     51// ------------------------------------------------------
    4852  static PIBaseWdgGen* mCurBW;
    4953  static PIDrwTools* cwdrwt;
  • trunk/SophyaPI/PI/pigraphgen.cc

    r1849 r1851  
    298298    int posh = pos & PI_HorizontalPosition;
    299299    int posv = pos & PI_VerticalPosition;
    300     if ((posh == PI_HorizontalLeft)  && (posv == PI_VerticalBottom))
     300    if ( ((posh == 0) &&  (posv == PI_VerticalBaseLine)) ||
     301         ((posh == PI_HorizontalLeft) && (posv == 0)) ||
     302         ((posh == PI_HorizontalLeft) && (posv == PI_VerticalBaseLine)) )
    301303      return(false);
    302304    if (posh != PI_HorizontalLeft) {
     
    306308      else wx = 0;
    307309    }
    308     if (posv != PI_VerticalBottom) {
    309       int a,d;
    310       int wy = myFont.GetFontHeight(a, d);
    311       if (posv == PI_VerticalCenter)  dy = -wy/2;
    312       else if (posv == PI_VerticalTop)  dy = -wy;
     310    if (posv != PI_VerticalBaseLine) {
     311      int asc,desc;
     312      int wy = myFont.GetFontHeight(asc, desc);
     313      if (posv == PI_VerticalBottom) dy = desc;
     314      else if (posv == PI_VerticalCenter)  dy = -wy/2+desc;
     315      else if (posv == PI_VerticalTop)  dy = -wy+desc;
    313316      else dy = 0;
    314317    }
  • trunk/SophyaPI/PI/pigraphgen.h

    r1848 r1851  
    3636enum PIGrPosVertical  // Flags de positionnement vertical
    3737// PI_VerticalPosition regroupe l'ensemble des bits utilisables
    38      { PI_VerticalBottom = 0x10, PI_VerticalCenter = 0x20,
    39        PI_VerticalTop = 0x30, PI_VerticalPosition = 0xF0 };
     38     { PI_VerticalBottom = 0x10, PI_VerticalBaseLine = 0x20,
     39       PI_VerticalCenter = 0x30, PI_VerticalTop = 0x40,
     40       PI_VerticalPosition = 0xF0 };
    4041
    4142// Les differents modes de trace graphique disponible
  • trunk/SophyaPI/PI/pigraphps.cc

    r1848 r1851  
    114114void PIGraphicPS::DrawString(PIGrCoord x, PIGrCoord y, const char* s, int pos)
    115115{
    116 if(mPSOut)
    117   //  mPSOut->DrawString((double)x,(double)y,s,mFCol,mFAtt,mFSize); /* $CHECK$ PIFontSize ?? */
    118   mPSOut->DrawString((double)x,(double)y,s,mFCol, myFont.GetFontName(),
    119                      myFont.GetFontAtt(),  myFont.GetFontSize(),
    120                      pos); /* $CHECK$  x 0.9 - Reza 4/11/99  - enleve 3/01/2002 */
    121 // Calculez la taille de la boite occupe par la fonte
    122 //  myFont.GetFontHeight(int& asc, int& desc)  Tres proche de myFont.GetFontSize() en principe
    123 //  myFont.GetStringWidth(char const* s)  Largeur occupe par la chaine
     116if(mPSOut) {
     117  int posh = pos & PI_HorizontalPosition;
     118  int posv = pos & PI_VerticalPosition;
     119  int dx,dy;
     120  double xd = x;
     121  double yd = y;
     122  if ( CalcStringPositionShift(s, posv, dx, dy) ) yd -= dy;
     123  mPSOut->DrawString(xd, yd, s, mFCol, myFont.GetFontName(), myFont.GetFontAtt(),
     124                     myFont.GetFontSize(), posh);
     125}
    124126return;
    125127}
     
    128130void PIGraphicPS::DrawOpaqueString(PIGrCoord x, PIGrCoord y, const char* s, int pos)
    129131{
    130 if(mPSOut)
    131   //  mPSOut->DrawString((double)x,(double)y,s,mFCol,mFAtt,mFSize); /* $CHECK$ PIFontSize ?? */
    132   mPSOut->DrawString((double)x,(double)y,s,mFCol, myFont.GetFontName(),
    133                      myFont.GetFontAtt(),  myFont.GetFontSize(),
    134                      pos);  /* $CHECK$  x 0.9 - Reza 4/11/99 */
    135 // Idem taille ici
     132if(mPSOut) {
     133  int posh = pos & PI_HorizontalPosition;
     134  int posv = pos & PI_VerticalPosition;
     135  int dx,dy;
     136  double xd = x;
     137  double yd = y;
     138  if ( CalcStringPositionShift(s, posv, dx, dy) ) yd -= dy;
     139  mPSOut->DrawString(xd, yd, s, mFCol, myFont.GetFontName(), myFont.GetFontAtt(),
     140                     myFont.GetFontSize(), posh);
     141}
    136142return;
    137143}
  • trunk/SophyaPI/PI/psfile.cc

    r1848 r1851  
    132132/rmv {rmoveto} bind def \n\
    133133%% Trace de chaine avec justification diverse \n\
     134%% ------------------------------------------------- \n\
     135%% hxshstr  stack: TheString \n\
     136%% hx (x=r,c,l) Horizontal-X Right,Center,Left - Vertical: BaseLine \n\
     137%% ------------------------------------------------- \n\
     138/hlshstr   %% Horizontal-left Vertical-BaseLine justified \n\
     139{ gs 1 -1 sc show gr } bind def \n\
     140/hcshstr   %% Horizontal-Center Vertical-BaseLine justified \n\
     141{ dup stringwidth pop 2 div neg  %% get minus(string length/2)  \n\
     142  0 rmoveto gs 1 -1 sc show gr } bind def \n\
     143/hrvbshstr   %% Horizontal-Right Vertical-BaseLine justified \n\
     144{ dup stringwidth pop neg  %% get minus(string width)  \n\
     145  0 rmoveto gs 1 -1 sc show gr } bind def \n\
     146%% ------------------------------------------------- \n\
    134147%% hxvyshstr  stack: TheString \n\
    135148%% hx (x=r,c,l) Horizontal-X Right,Center,Left \n\
    136149%% vy (y=t,c,b) Vertical-Y Top,Center,Bottom \n\
     150%% Ces procs (hxvyshstr) utilisent la variable curfntsz que l'on definit par defaut \n\
     151%% hxshstr  stack: TheString \n\
     152%% hx (x=r,c,l) Horizontal-X Right,Center,Left - Vertical: BaseLine \n\
     153%% ------------------------------------------------- \n\
     154/curfntsz 10 def \n\
    137155/hlvbshstr   %% Horizontal-left Vertical-Bottom justified \n\
    138156{ gs 1 -1 sc show gr } bind def \n\
     
    144162  0 rmoveto gs 1 -1 sc show gr } bind def \n\
    145163/hlvcshstr   %% Horizontal-left Vertical-Center justified \n\
    146 { dup stringwidth exch pop 2 div   %% get (string height)/2  \n\
    147   0 exch rmoveto gs 1 -1 sc show gr } bind def \n\
     164{ 0 curfntsz 2 div   %% get (string height)/2  \n\
     165  rmoveto gs 1 -1 sc show gr } bind def \n\
    148166/hcvcshstr   %% Horizontal-Center Vertical-Center justified \n\
    149 { dup stringwidth 2 div exch 2 div neg   %% s_wy/2 -s_wx/2  \n\
    150   exch rmoveto gs 1 -1 sc show gr } bind def \n\
     167{ dup stringwidth pop 2 div neg curfntsz 2 div  %% s_wy/2 -s_wx/2  \n\
     168  rmoveto gs 1 -1 sc show gr } bind def \n\
    151169/hrvcshstr   %% Horizontal-Right Vertical-Center justified \n\
    152 { dup stringwidth 2 div exch neg   %% s_wy/2 -s_wx  \n\
    153   exch rmoveto gs 1 -1 sc show gr } bind def \n\
     170{ dup stringwidth pop neg curfntsz  %% s_wy/2 -s_wx  \n\
     171  rmoveto gs 1 -1 sc show gr } bind def \n\
    154172/hlvtshstr   %% Horizontal-left Vertical-Top justified \n\
    155 { dup stringwidth exch pop    %% get s_wy  \n\
    156   0 exch rmoveto gs 1 -1 sc show gr } bind def \n\
     173{ 0 curfntsz   %% get s_wy  \n\
     174  rmoveto gs 1 -1 sc show gr } bind def \n\
    157175/hcvtshstr   %% Horizontal-Center Vertical-Top justified \n\
    158 { dup stringwidth exch 2 div neg   %% s_wy -s_wx/2  \n\
    159   exch rmoveto gs 1 -1 sc show gr } bind def \n\
     176{ dup stringwidth pop 2 div neg curfntsz  %% s_wy -s_wx/2  \n\
     177  rmoveto gs 1 -1 sc show gr } bind def \n\
    160178/hrvtshstr   %% Horizontal-Right Vertical-Top justified \n\
    161 { dup stringwidth exch neg   %% s_wy -s_wx  \n\
    162   exch rmoveto gs 1 -1 sc show gr } bind def \n\
     179{ dup stringwidth pop neg curfntsz  %% s_wy -s_wx  \n\
     180  rmoveto gs 1 -1 sc show gr } bind def \n\
    163181%% Tx Ty X0 Y0 box\n\
    164182/box {tr 0 3 1 roll neg exch 0 0 3 index neg 0 0 m rl rl rl c} bind def\n\
     
    604622        } /* BB */
    605623        /* facteur d'echelle pour les fontes*/
    606         currentPage->FontScaleFactor = 1.1*scale;
     624        currentPage->FontScaleFactor = scale;
    607625        //        postscript_resolution/def_user_resolution*scale;
    608626        /*
     
    688706        } /* End if .Landscape */
    689707        /* facteur d'echelle pour les fontes*/
    690         currentPage->FontScaleFactor = 1.2*scale*postscript_resolution;
     708        currentPage->FontScaleFactor = scale*postscript_resolution;
    691709        /*
    692710        cout << " PS_DBG_FontScaleFactor = " << currentPage->FontScaleFactor
     
    700718mFontSize = 10;
    701719mFontName = PI_DefaultFont;
    702 fprintf(mPSFile, "/Courier ff %d FS \n", mFontSize) ;
     720double scaledFontSize = (double)mFontSize*currentPage->FontScaleFactor;
     721fprintf(mPSFile, "/Courier ff %g FS /curfntsz %g def \n", scaledFontSize, scaledFontSize) ;
    703722setFontDone = true;
    704723currentPage->tmp = ftell(mPSFile);
     
    777796    mFontSize = 10;
    778797    mFontName = PI_DefaultFont;
    779     fprintf(mPSFile, "/Courier ff %d FS \n", mFontSize) ;
     798    double scaledFontSize = (double)mFontSize*currentPage->FontScaleFactor;
     799    fprintf(mPSFile, "/Courier ff %g FS /curfntsz %g def \n",
     800            scaledFontSize, scaledFontSize) ;
    780801    setFontDone = true;
    781802    currentBloc->tmp = ftell(mPSFile) ;
     
    830851    bool change = false;
    831852
    832     FontSize = (float)FontSize*currentPage->FontScaleFactor;
    833853    /* Couleurs */
    834854    if ( (DrawColor != PI_NotDefColor) && (DrawColor != mDrawColor) ) {
     
    890910        break ;         
    891911      } // endsw
    892       fprintf(mPSFile, " ff %d FS ", FontSize) ;
     912      double scaledFontSize = (double)FontSize*currentPage->FontScaleFactor;
     913      fprintf(mPSFile, " ff %g FS /curfntsz %g def \n", scaledFontSize, scaledFontSize);
    893914      setFontDone = true ;   // $CHECK$ - doit etre fait uniquement a ce moment
    894915    }
     
    898919      int posh = pos & PI_HorizontalPosition;
    899920      int posv = pos & PI_VerticalPosition;
    900       if ((posh == PI_HorizontalLeft)  && (posv == PI_VerticalBottom))
    901         fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) hlvbshstr gr\n",
     921      if ((posh == PI_HorizontalLeft)  &&
     922          ((posv == PI_VerticalBaseLine) || (posv == 0)) )
     923        fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) hlshstr gr\n",
    902924                x, y, s) ;
    903925      else {
     
    909931          else sshp = 'l';
    910932        }
    911         if (posv != PI_VerticalBottom) {
     933        if (posv == 0)
     934          fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) h%cshstr gr\n",
     935                  x, y, s, sshp) ;
     936        else {
    912937          if (posv == PI_VerticalCenter)  ssvp = 'c';
    913938          else if (posv == PI_VerticalTop)  ssvp = 't';
     939          else ssvp = 'b';
    914940        }
    915941        fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) h%cv%cshstr gr\n",
    916                 x, y, s, sshp, ssvp) ;
     942                  x, y, s, sshp, ssvp) ;
    917943      }
    918944    }
     945
    919946}
    920947
Note: See TracChangeset for help on using the changeset viewer.