--- parser3/src/classes/image.C 2002/11/27 09:43:53 1.84 +++ parser3/src/classes/image.C 2002/11/28 12:23:39 1.87 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_IMAGE_C="$Date: 2002/11/27 09:43:53 $"; +static const char* IDENT_IMAGE_C="$Date: 2002/11/28 12:23:39 $"; /* jpegsize: gets the width and height (in pixels) of a jpeg file @@ -891,10 +891,10 @@ static void _polybar(Request& r, const S // font -#define Y(y)(y+index*height+1) +#define Y(y)(y+index*height) /// simple gdImage-based font storage & text output -class Font : public Pooled { +class Font: public Pooled { public: const static int letter_spacing; @@ -906,7 +906,7 @@ public: Font(Pool& pool, const String& aalphabet, - gdImage& aifont, int aheight, int amonospace, int aspacebarspace) : Pooled(pool), + gdImage& aifont, int aheight, int amonospace, int aspacebarspace): Pooled(pool), alphabet(aalphabet), height(aheight), monospace(amonospace), spacebarspace(aspacebarspace), ifont(aifont) { @@ -924,7 +924,7 @@ public: return spacebarspace; int tr=ifont.GetTransparent(); for(int x=ifont.SX()-1; x>=0; x--) { - for(int y=0; y=0) - ifont.Copy(image, x, y, 0, Y(0), index_width(index), height-1); + ifont.Copy(image, x, y, 0, Y(0), index_width(index), height); } /* ******************************** string ********************************** */ + int step_width(int index) { + return letter_spacing + (monospace ? monospace : index_width(index)); + } + + // counts trailing letter_spacing, consider this OK. useful for contiuations int string_width(const String& s){ const char *cstr=s.cstr(); int result=0; for(; *cstr; cstr++) - result+=index_width(index_of(*cstr)); + result+=step_width(index_of(*cstr)); return result; } @@ -951,7 +956,7 @@ public: if(cstr) for(; *cstr; cstr++) { int index=index_of(*cstr); index_display(image, x, y, index); - x+=letter_spacing + (monospace ? monospace : index_width(index)); + x+=step_width(index); } }