00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef _GRAPHFONT_H_
00036 #define _GRAPHFONT_H_
00037
00038
00039 #include <fx.h>
00040
00041
00042 #ifdef CAIROGRAPHICS
00043 #include <cairo.h>
00044 #endif
00045
00046
00047
00048
00049
00050
00051 class CGraphFont
00052 {
00053 private:
00054 FXFont *textFont;
00055 FXFont *symFont;
00056 FXFont *textSFont;
00057 FXFont *symSFont;
00058 FXFont *numFont;
00059 int fontbaseline;
00060 int fontSupbaseline;
00061 int fontSubbaseline;
00062 int numfontbaseline;
00063 float fontkernel[3][3];
00064 bool aamethod;
00065 float numfactor;
00066
00067 #ifdef CAIROGRAPHICS
00068 float cairofontraise;
00069 float cairofontlower;
00070
00071
00072 #endif
00073
00074 FXApp *app;
00075
00076 FXString doubleToString(double d);
00077 FXString preciseString(double d, int precision);
00078
00079 public:
00080 CGraphFont();
00081 ~CGraphFont();
00082
00083 FXFontDesc textFontdesc;
00084 FXFontDesc symFontdesc;
00085 int fontheight;
00086 int numfontheight;
00087
00088 void buildFont(FXApp *a, bool hqaa, float nummultiplier);
00089
00090 int getPrecision(double d);
00091
00092 int getStringDimensions(FXString txt);
00093 FXColor* drawAAString(FXString txt, int &length);
00094 float* drawAAStringf(FXString txt, int &length);
00095
00096
00097 int getStringDimensions(double d, int precision = 0);
00098 FXColor* drawAAString(double d, int &length, int precision = 0);
00099 float* drawAAStringf(double d, int &length, int precision = 0);
00100
00101 #ifdef CAIROGRAPHICS
00102 float cairofontheight;
00103 float cairobaselineheight;
00104 float caironumfontheight;
00105
00106 void initCairoMeasurements(cairo_t *c);
00107
00108 float getStringDimensions(cairo_t *c, FXString txt);
00109 float getStringDimensions(cairo_t *c, double d, int precision = 0);
00110 void drawString(cairo_t *c, float x, float y, FXString txt);
00111 void drawString(cairo_t *c, float x, float y, double d, int precision = 0);
00112 #endif
00113 };
00114
00115 #endif