/* GD font center Copyright (C) 2002 VVK (valera@sbnet.ru), CNII Center, Moscow This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __GDMFONT_H #define __GDMFONT_H #ifdef __cplusplus extern "C" { #endif struct gdImageStruct; /***************************************************************************/ /* */ /* Modified gd font */ /* */ /***************************************************************************/ struct gd_mkern { unsigned char left; unsigned char right; short delta; }; struct gd_mchar { unsigned short width, height; unsigned short xadvance, yadvance; short dx, dy; unsigned int pointer; }; struct gd_mfont { int type; int nColor; const unsigned char *data; const struct gd_mchar *chars; int startChar, endChar; int width, height; int xorigin, yorigin; unsigned int dataSize; unsigned int flags; const struct gd_mkern *kerns; }; enum { GD_MFONT_PLAIN = 0, GD_MFONT_FIXED_WIDTH, GD_MFONT_PORTED }; #define mffSaveBlanks 0x0100u #define mffNewLine 0x0200u #define mffRotateLeft 0x0400u #define mffRotateRight 0x0800u #define mffUpperTable 0x1000u #define mffNegativeSpacing 0x2000u #define mffRightAlign 0x4000u #define mffMirror 0x8000u #define mfsFixedWidth 0x0001u #define mfsBold 0x0002u #define mfsItalic 0x0004u int gdMFontCharSize( const struct gd_mfont *mf, int c); void gdMFontChar( struct gdImageStruct *im, const struct gd_mfont *mf, int x, int y, int c, int color, unsigned int flags); int gdMFontStringSize( const struct gd_mfont *mf, const char *string, int *pheight, unsigned int flags, const unsigned char *table); void gdMFontString( struct gdImageStruct *im, const struct gd_mfont *mf, int x, int y, const char *string, int color, unsigned int flags, const unsigned char *table); int gdMFontTextSize( const struct gd_mfont *mf, const char *text, int length, int *pheight, unsigned int flags, const unsigned char *table); void gdMFontText( struct gdImageStruct *im, const struct gd_mfont *mf, int x, int y, const char *text, int length, int color, unsigned int flags, const unsigned char *table); extern const unsigned char gdTableKoi2win[256]; extern const unsigned char gdTableWin2koi[256]; /***************************************************************************/ /* */ /* Font image */ /* */ /***************************************************************************/ int gdMFontPrintImage( const char *fileName, const struct gd_mfont *mf, unsigned int flags); int gdMFontTextImage( const char *fileName, const struct gd_mfont *mf, const char *text, const unsigned char *table, unsigned int flags); struct gd_mfont_item { const struct gd_mfont *mf; const char *fileName; }; int gdMFontPrintList( const struct gd_mfont_item *list, unsigned int flags); int gdMFontTextList( const struct gd_mfont_item *list, const char *text, const unsigned char *table, unsigned int flags); #ifdef __cplusplus } #endif #endif