Databaseconnectionclasses  0.5.3
hk_font.h
1 // ****************************************************************************
2 // copyright (c) 2000-2005 Horst Knorr <hk_classes@knoda.org>
3 // This file is part of the hk_classes library.
4 // This file may be distributed and/or modified under the terms of the
5 // GNU Library Public License version 2 as published by the Free Software
6 // Foundation and appearing in the file COPYING included in the
7 // packaging of this file.
8 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 // ****************************************************************************
11 #ifndef HK_FONT
12 #define HK_FONT
13 #include "hk_class.h"
14 #include "hk_url.h"
15 class hk_fontprivate;
16 class hk_encodingtab;
17 typedef unsigned int HK_CHARSIZE;
26 class hk_font : public hk_class
27 {
28 public:
29  hk_font();
30  hk_font(const hk_string& fontname,int fontsize);
31  hk_font(const hk_font&);
32  virtual ~hk_font();
33  void set_font(const hk_string& fontname,int fontsize);
34  void set_font(const hk_font&);
35  hk_string fontname(void) const;
36  int fontsize(void) const;
37  void set_bold(bool);
38  bool bold(void) const;
39  void set_italic(bool);
40  bool italic(void) const;
41  bool operator=(const hk_font&);
42  bool operator==(const hk_font&);
43  bool operator!=(const hk_font&);
44  hk_string psfontname(void);
45  static void set_defaultfont(const hk_string& d,int s);
46  static hk_string defaultfontname(void);
47  static int defaultfontsize(void);
48 static list<hk_string>* fontlist();
52  bool text2lines(int fixedwidth,list<hk_string>* l,const hk_string& text);
53 
54 virtual void savedata(ostream& s );
55 virtual void loaddata(xmlNodePtr definition);
56 
57 void set_encodingtab(hk_encodingtab* t);
58 hk_encodingtab* encodingtab(void) const;
59 hk_url fontfile(void);
60 hk_string psfontembeddefinition(void);
61  HK_CHARSIZE char_ascender_size();
62  HK_CHARSIZE char_descender_size();
63  bool is_scaleable(void) ;
64  list<int>* available_sizes() ;
65 
66 
67 void register_string(const hk_string&);
68 
69 protected:
70 
71 void set_fontface(void);
72 private:
73 bool is_equal(const hk_font&);
74 void init(void);
75 hk_string p_fontname;
76 int p_fontsize;
77 bool p_italic;
78 bool p_bold;
79 hk_fontprivate* p_private;
80 static hk_string p_defaultfont;
81 static int p_defaultfontsize;
82 static int p_counter;
83 
84 static list<hk_string> p_fontlist;
85 
86 };
87 
88 ostream& operator<<(ostream&,hk_font&);
89 ostream& operator<<(ostream&,const hk_font&);
90 
91 
93 class hk_encodingtab: public hk_class
94 {
95  public:
97  ~hk_encodingtab();
98  void register_unicode(HK_CHARSIZE code);
99  void register_unicode(HK_CHARSIZE code,const hk_string & glyphname);
100  HK_CHARSIZE max_nr() const;
101  HK_CHARSIZE local (HK_CHARSIZE unicode);
102  hk_string glyphname (HK_CHARSIZE unicode);
103  HK_CHARSIZE unicode(HK_CHARSIZE local);
104  void reset();
105  void reset_has_changed(void);
106  bool has_changed(void) const;
107 
108  private:
109  hk_encodingtabprivate* p_private;
110 };
111 
112 #endif
basic class for all other defined classes.
Definition: hk_class.h:52
Definition: hk_font.cpp:913
represents a font
Definition: hk_font.h:26
Definition: hk_url.h:17
Definition: hk_font.cpp:29
virtual void loaddata(xmlNodePtr definition)
Definition: hk_font.cpp:374
bool text2lines(int fixedwidth, list< hk_string > *l, const hk_string &text)
Definition: hk_font.cpp:669
Definition: hk_font.h:93
virtual void savedata(ostream &s)
Definition: hk_font.cpp:361