SourceForge: dvisvgm/dvisvgm: changeset 356:c871faefbd2c
fixed positioning of italic characters
authorMartin Gieseking <mgieseki@users.sourceforge.net>
Thu Oct 29 08:17:00 2009 +0100 (3 weeks ago)
changeset 356c871faefbd2c
parent 355411c9a3a27df
child 35739d380bdca39
fixed positioning of italic characters
src/DVIToSVGActions.cpp
src/Font.cpp
src/Font.h
     1.1 --- a/src/DVIToSVGActions.cpp	Sun Oct 25 07:57:31 2009 +0100
     1.2 +++ b/src/DVIToSVGActions.cpp	Thu Oct 29 08:17:00 2009 +0100
     1.3 @@ -88,7 +88,7 @@
     1.4  		/*	x *= BP;
     1.5  			y *= BP;*/
     1.6  		double s = font->scaleFactor(); // * BP;
     1.7 -		double w = s*font->charWidth(c);
     1.8 +		double w = s*(font->charWidth(c) + font->italicCorr(c));
     1.9  		double h = s*font->charHeight(c);
    1.10  		double d = s*font->charDepth(c);
    1.11  		BoundingBox charbox(x, y-h, x+w, y+d);
     2.1 --- a/src/Font.cpp	Sun Oct 25 07:57:31 2009 +0100
     2.2 +++ b/src/Font.cpp	Thu Oct 29 08:17:00 2009 +0100
     2.3 @@ -53,9 +53,10 @@
     2.4  }
     2.5  
     2.6  
     2.7 -double TFMFont::charWidth (int c) const  {return getTFM()->getCharWidth(c) + getTFM()->getItalicCorr(c);}
     2.8 +double TFMFont::charWidth (int c) const  {return getTFM()->getCharWidth(c);}
     2.9  double TFMFont::charDepth (int c) const  {return getTFM()->getCharDepth(c);}
    2.10  double TFMFont::charHeight (int c) const {return getTFM()->getCharHeight(c);}
    2.11 +double TFMFont::italicCorr (int c) const  {return getTFM()->getItalicCorr(c);}
    2.12  
    2.13  //////////////////////////////////////////////////////////////////////////////
    2.14  
     3.1 --- a/src/Font.h	Sun Oct 25 07:57:31 2009 +0100
     3.2 +++ b/src/Font.h	Thu Oct 29 08:17:00 2009 +0100
     3.3 @@ -51,6 +51,7 @@
     3.4  	virtual double charWidth (int c) const =0;
     3.5  	virtual double charDepth (int c) const =0;
     3.6  	virtual double charHeight (int c) const =0;
     3.7 +	virtual double italicCorr (int c) const =0;
     3.8  	virtual const TFM* getTFM () const =0;
     3.9  	virtual const char* path () const =0;
    3.10  };
    3.11 @@ -71,6 +72,7 @@
    3.12  		double charWidth (int c) const  {return 9.164;} // width of cmr10's 'M' in pt
    3.13  		double charHeight (int c) const {return 6.833;} // height of cmr10's 'M' in pt
    3.14  		double charDepth (int c) const  {return 0;}
    3.15 +		double italicCorr (int c) const {return 0;}
    3.16  		const TFM* getTFM () const      {return 0;}
    3.17  		const char* path () const       {return 0;}
    3.18  
    3.19 @@ -116,6 +118,7 @@
    3.20  		double charWidth (int c) const;
    3.21  		double charDepth (int c) const;
    3.22  		double charHeight (int c) const;
    3.23 +		double italicCorr (int c) const;
    3.24  
    3.25  	private:
    3.26  		mutable TFM *tfm;
    3.27 @@ -138,6 +141,7 @@
    3.28  		double charWidth (int c) const        {return pf->charWidth(c);}
    3.29  		double charDepth (int c) const        {return pf->charDepth(c);}
    3.30  		double charHeight (int c) const       {return pf->charHeight(c);}
    3.31 +		double italicCorr (int c) const       {return pf->italicCorr(c);}
    3.32  		const TFM* getTFM () const            {return pf->getTFM();}
    3.33  		const char* path () const             {return pf->path();}
    3.34  		Type type () const                    {return pf->type();}
    3.35 @@ -183,6 +187,7 @@
    3.36  		double charWidth (int c) const        {return vf->charWidth(c);}
    3.37  		double charDepth (int c) const        {return vf->charDepth(c);}
    3.38  		double charHeight (int c) const       {return vf->charHeight(c);}
    3.39 +		double italicCorr (int c) const       {return vf->italicCorr(c);}
    3.40  		const TFM* getTFM () const            {return vf->getTFM();}
    3.41  		const char* path () const             {return vf->path();}
    3.42