Changeset 1846 in Sophya


Ignore:
Timestamp:
Dec 31, 2001, 5:18:54 PM (24 years ago)
Author:
ansari
Message:

Correction/amelioration trace de string pour sortie postscript - Reza 31/12/2001

Location:
trunk/SophyaPI/PI
Files:
4 edited

Legend:

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

    r1588 r1846  
    9595  for(k=0; k<10; k++)
    9696    mSL[k] = mSH[k] = 0;
    97 PIFont f(14, PI_DefaultFont);
     97PIFont f(16, PI_DefaultFont);
    9898g->SelFont(f);
    9999  g->SelForeground(PI_Black);
    100 g->DrawString(50,20,attstr[ia]);
    101 g->DrawString(XSize()/2,20,fszstr[js]);
     100g->DrawString(50,24,attstr[ia]);
     101g->DrawString(XSize()/2,24,fszstr[js]);
     102 int fh,fa,fd;
     103 fh = f.GetFontHeight(fa, fd);
     104 cout << " FontSize= " << f.GetFontSize() << " FontHeight= " << fh << endl;
     105g->DrawFBox(XSize()/2-30, 24-fh+2, fh, fh);
    102106
    103107
     
    314318        printf("Creating EPS File %s (Encapsulated PostScript) \n", buff);
    315319        PSFile *mps;
    316         mps = new PSFile(buff, 0.75);
     320        mps = new PSFile(buff);
    317321        mcurwin->PSPrint(mps,0,0);
    318322        delete mps;
  • trunk/SophyaPI/PI/pigraphx.cc

    r1640 r1846  
    300300    case  PI_FStarMarker :
    301301      for(k=0; k<10; k++) {
    302         x[k] = (int)(starcoordx[k]*(float)mMrkSz+(float)x0+0.5);
    303         y[k] = (int)(starcoordy[k]*(float)mMrkSz+(float)y0+0.5);
     302        x[k] = (int)(starcoordx[k]*hmsz+(float)x0+0.5);
     303        y[k] = (int)(starcoordy[k]*hmsz+(float)y0+0.5);
    304304        }
    305305      x[10] = x[0];   y[10] = y[0];
     
    719719double pio52 = pio5/2.;
    720720double cpi2 = M_PI/2.-pio5; 
    721 double re = 1.2;  // Rayon externe
    722 double ri = 0.5; //  rayon interne pour rext=1.2
     721// Pentagone inscrit dans un cercle de rayon R1 = 1
     722// les pointes de l'etoile seront inscrites dans un cercle
     723// de rayon R2 = 2.61803
     724double re = 1.;  // Rayon externe
     725double ri = 0.38; //  rayon interne pour rext=1.2
    723726for(int k=0; k<5; k++) {
    724727  starcoordx[2*k] = cos(k*pio5+cpi2)*re;
  • trunk/SophyaPI/PI/psfile.cc

    r1640 r1846  
    234234/PITriangle  {0 750 m 375 0 l 750 750 l c s} bind def\n\
    235235/PIFTriangle {0 750 m 375 0 l 750 750 l c f} bind def\n\
    236 /PIStar      {} def\n\
    237 /PIFStar     {} def\n\
     236/PIStar      {731 260 m 459 260 l 375 0 l 291 260 l 19 260 l \
     237239 419 l 155 678 l 375 518 l 595 678 l 511 419 l c s} def\n\
     238/PIFStar     {731 260 m 459 260 l 375 0 l 291 260 l 19 260 l \
     239239 419 l 155 678 l 375 518 l 595 678 l 511 419 l c f} def\n\
    238240end %%$PIDict\n\
    239241end %%$CharProcs\n\
     
    245247Encoding exch get\n\
    246248CharProcs exch get\n\
    247 end exec} def\n\
     249end 75 slw exec} def\n\
    248250end\n\
    249251/PIMarkers $PIMarkers definefont pop\n\
     
    303305/* Definition de la resolution coordonnees user par defaut (point/cm ou pixels/cm) */
    304306
    305 int PSFile::def_user_resol_X = 30;
    306 int PSFile::def_user_resol_Y = 30;
    307 void PSFile::SetDefaultUserResolution(int resx, int resy)
     307float PSFile::postscript_resolution = 28.;  /* environ 72 points / pouce  */
     308float PSFile::def_user_resol_X = 30.;      /* environ 75 points / pouce  */
     309float PSFile::def_user_resol_Y = 30.;
     310float PSFile::def_user_resolution = 30.;
     311
     312void PSFile::SetUserCoordResolution(float resx, float resy)
    308313{
    309   if ((resx < 1) || (resy < 1)) return;
     314  if ((resx < 1.) || (resy < 1.)) return;
    310315  def_user_resol_X = resx;
    311316  def_user_resol_Y = resy;
    312 }
    313 void PSFile::GetDefaultUserResolution(int& resx, int& resy)
     317  def_user_resolution = 0.5*(resx+resy);
     318}
     319float PSFile::GetUserCoordResolution(float& resx, float& resy)
    314320{
    315   if ((resx < 1) || (resy < 1)) return;
    316321  resx = def_user_resol_X;
    317322  resy = def_user_resol_Y;
    318 }
    319 
     323  return (def_user_resolution);
     324}
     325float PSFile::PSCoordResolution()
     326{
     327  return (postscript_resolution);
     328}
    320329
    321330/*
     
    563572            boundingBox = 0 ;
    564573        } /* BB */
     574        /* facteur d'echelle pour les fontes*/
     575        currentPage->FontScaleFactor = 1.1*scale;
     576        //        postscript_resolution/def_user_resolution*scale;
     577        /*
     578        cout << " EPS_DBG_FontScaleFactor = " << currentPage->FontScaleFactor
     579             << " scale= " << scale << " postscript_resolution= "
     580             << postscript_resolution << " def_user_resolution= "
     581             << def_user_resolution << endl;
     582        */
    565583    } /* EPS */
    566584    /*
     
    614632                    tw, th,
    615633                    0.5*(Tw-tw), -0.5*(Th+th)) ;
    616         }
     634        }  /* End if .Portrait  */
    617635        if(currentPage->orientation == PI_Landscape) {
    618636            /* Idem avec X<->Y */
     
    637655               th, tw,
    638656               0.5*(Th-th), 0.5*(Tw-tw));
    639         }
     657        } /* End if .Landscape */
     658        /* facteur d'echelle pour les fontes*/
     659        currentPage->FontScaleFactor = 1.2*scale*postscript_resolution;
     660        /*
     661        cout << " PS_DBG_FontScaleFactor = " << currentPage->FontScaleFactor
     662             << " scale= " << scale << " postscript_resolution= "
     663             << postscript_resolution << " def_user_resolution= "
     664             << def_user_resolution << endl;
     665        */
    640666    } /* End if .ps */
    641667// On redefint la fonte par defaut - $CHECK$ Reza 11/12/99
     
    772798    bool change = false;
    773799
     800    FontSize = (float)FontSize*currentPage->FontScaleFactor;
    774801    /* Couleurs */
    775802    if ( (DrawColor != PI_NotDefColor) && (DrawColor != mDrawColor) ) {
     
    10661093    if(MarkerSize != mMarkerSize || setFontDone) {
    10671094        mMarkerSize = MarkerSize ;
    1068         fprintf(mPSFile, "/PIMarkers ff %d scf sf\n", mMarkerSize) ;
     1095        fprintf(mPSFile, "/PIMarkers ff %d scf sf\n",
     1096                (int)(mMarkerSize*currentPage->FontScaleFactor)) ;
    10691097        setFontDone = false ;
    10701098    }
     
    10931121    if(MarkerSize != mMarkerSize || setFontDone) {
    10941122        mMarkerSize = MarkerSize ;
    1095         fprintf(mPSFile, "/PIMarkers ff %d scf sf\n", mMarkerSize) ;
     1123        fprintf(mPSFile, "/PIMarkers ff %d scf sf\n", 
     1124                (int)(mMarkerSize*currentPage->FontScaleFactor)) ;
    10961125        setFontDone = false ;
    10971126    }
  • trunk/SophyaPI/PI/psfile.h

    r1592 r1846  
    7272public:
    7373    /* Definition de la resolution coordonnees user par defaut (point/cm) */
    74     static void SetDefaultUserResolution(int resx, int resy);
    75     static void GetDefaultUserResolution(int & resx, int & resy);
     74    static void SetUserCoordResolution(float resx, float resy);
     75    static float GetUserCoordResolution(float & resx, float & resy);
     76    static float PSCoordResolution();
    7677
    7778    /* Production fichier eps */
     
    8081    PSFile (const char * FileName, PIOrientation orientation,
    8182            PIPaperSize paperSize= PI_A4,
    82             double marginX = 5.0, double marginY = 5.0 ) ;
     83            double marginX = 3.0, double marginY = 3.0 ) ;
    8384
    8485    virtual      ~PSFile();
     
    170171        int BlocCounter;
    171172        double Dx,Dy;              /* Sommet SE (unites utilisateur) */
     173        float FontScaleFactor;    /* Facteur d'echelle pour les fontes */
    172174        PIOrientation orientation;
    173175        long  begin, end, tmp;    /* Offsets dans le fichier */
     
    207209
    208210  /* resolution coordonnees user (point/cm - pixels/cm) */
    209     static int  def_user_resol_X, def_user_resol_Y;
     211    static float  def_user_resol_X, def_user_resol_Y;
     212    static float  def_user_resolution;
     213  /* resolution coordonnees PostScript (point/cm - pixels/cm) */
     214    static float  postscript_resolution;
    210215} ;
    211216
Note: See TracChangeset for help on using the changeset viewer.