00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef HK_FONT
00012 #define HK_FONT
00013 #include "hk_class.h"
00014 #include "hk_url.h"
00015 class hk_fontprivate;
00016 class hk_encodingtab;
00017 typedef unsigned int HK_CHARSIZE;
00026 class hk_font : public hk_class
00027 {
00028 public:
00029 hk_font();
00030 hk_font(const hk_string& fontname,int fontsize);
00031 hk_font(const hk_font&);
00032 virtual ~hk_font();
00033 void set_font(const hk_string& fontname,int fontsize);
00034 void set_font(const hk_font&);
00035 hk_string fontname(void) const;
00036 int fontsize(void) const;
00037 void set_bold(bool);
00038 bool bold(void) const;
00039 void set_italic(bool);
00040 bool italic(void) const;
00041 bool operator=(const hk_font&);
00042 bool operator==(const hk_font&);
00043 bool operator!=(const hk_font&);
00044 hk_string psfontname(void);
00045 static void set_defaultfont(const hk_string& d,int s);
00046 static hk_string defaultfontname(void);
00047 static int defaultfontsize(void);
00048 static list<hk_string>* fontlist();
00052 bool text2lines(int fixedwidth,list<hk_string>* l,const hk_string& text);
00053
00054 virtual void savedata(ostream& s );
00055 virtual void loaddata(xmlNodePtr definition);
00056
00057 void set_encodingtab(hk_encodingtab* t);
00058 hk_encodingtab* encodingtab(void) const;
00059 hk_url fontfile(void);
00060 hk_string psfontembeddefinition(void);
00061 HK_CHARSIZE char_ascender_size();
00062 HK_CHARSIZE char_descender_size();
00063 bool is_scaleable(void) ;
00064 list<int>* available_sizes() ;
00065
00066
00067 void register_string(const hk_string&);
00068
00069 protected:
00070
00071 void set_fontface(void);
00072 private:
00073 bool is_equal(const hk_font&);
00074 void init(void);
00075 hk_string p_fontname;
00076 int p_fontsize;
00077 bool p_italic;
00078 bool p_bold;
00079 hk_fontprivate* p_private;
00080 static hk_string p_defaultfont;
00081 static int p_defaultfontsize;
00082 static int p_counter;
00083
00084 static list<hk_string> p_fontlist;
00085
00086 };
00087
00088 ostream& operator<<(ostream&,hk_font&);
00089 ostream& operator<<(ostream&,const hk_font&);
00090
00091
00092 class hk_encodingtabprivate;
00093 class hk_encodingtab: public hk_class
00094 {
00095 public:
00096 hk_encodingtab();
00097 ~hk_encodingtab();
00098 void register_unicode(HK_CHARSIZE code);
00099 void register_unicode(HK_CHARSIZE code,const hk_string & glyphname);
00100 HK_CHARSIZE max_nr() const;
00101 HK_CHARSIZE local (HK_CHARSIZE unicode);
00102 hk_string glyphname (HK_CHARSIZE unicode);
00103 HK_CHARSIZE unicode(HK_CHARSIZE local);
00104 void reset();
00105 void reset_has_changed(void);
00106 bool has_changed(void) const;
00107
00108 private:
00109 hk_encodingtabprivate* p_private;
00110 };
00111
00112 #endif