Laxkit  0.0.7.1
fontmanager.h
1 //
2 //
3 // The Laxkit, a windowing toolkit
4 // Please consult http://laxkit.sourceforge.net about where to send any
5 // correspondence about this software.
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Library General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Library General Public License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 //
21 // Copyright (C) 2004-2012 by Tom Lechner
22 //
23 #ifndef _LAX_FONTMANAGER_H
24 #define _LAX_FONTMANAGER_H
25 
26 #include <cstdlib>
27 #include <lax/anobject.h>
28 
29 namespace Laxkit {
30 
31 //---------------------------- LaxFont -------------------------------
32 class LaxFont : public anObject
33 {
34  protected:
35  public:
36  int id;
37  unsigned long textstyle;
38  char cntlchar;
39 
40  LaxFont();
41  LaxFont(const char *fontconfigstr,int nid);
42  LaxFont(const char *family, const char *style, double size, int nid);
43  virtual ~LaxFont() {}
44  virtual int laxfid() { return id; }
45 
46  virtual double charwidth(unsigned long chr,int real,double *width=NULL,double *height=NULL) = 0;
47  virtual double contextcharwidth(char *start,char *pos,int real,double *width=NULL,double *height=NULL) = 0;
48  virtual double ascent() = 0;
49  virtual double descent() = 0;
50  virtual double textheight() = 0;
51  virtual double Resize(double newsize) = 0;
52 };
53 
54 
55 //---------------------------- FontManager -------------------------------
56 class FontManager : public anObject
57 {
58  public:
59  FontManager();
60  virtual ~FontManager() {}
61 
62  virtual LaxFont *MakeFontFromFile(const char *file, double size, int nid) = 0;
63  virtual LaxFont *MakeFontFromStr(const char *fcstr, int nid) = 0;
64  virtual LaxFont *MakeFont(const char *family, const char *style, double size, int nid) = 0;
65  virtual LaxFont *Add(LaxFont *font,int nid) = 0;
66  virtual LaxFont *CheckOut(int id) = 0;
67 };
68 
69 
70 //--------------------------------------- Default Renderer Stuff ---------------------------
71 
72 typedef FontManager *(*NewFontManagerFunc)();
73 int SetNewFontManagerFunc(const char *backend);
74 
75 int SetDefaultFontManager(FontManager *manager);
76 FontManager *GetDefaultFontManager();
77 
78 
79 
80 } // namespace Laxkit
81 
82 #endif
83 

Mon Feb 17 2014 11:52:56, Laxkit