Laxkit  0.0.7.1
fontmanager-cairo.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) 2013 by Tom Lechner
22 //
23 #ifndef _LAX_FONTMANAGER_CAIRO_H
24 #define _LAX_FONTMANAGER_CAIRO_H
25 
26 #include <lax/lists.h>
27 #include <lax/refptrstack.h>
28 #include <lax/fontmanager.h>
29 
30 #include <cairo/cairo-xlib.h>
31 
32 
33 namespace Laxkit {
34 
35 
36 //---------------------------- LaxFontCairo -------------------------------
37 class LaxFontCairo : public LaxFont
38 {
39  protected:
40  public:
41  cairo_font_extents_t extents;
42  cairo_font_face_t *font;
43  cairo_scaled_font_t *scaledfont;
44  cairo_font_options_t *options;
45 
46  LaxFontCairo();
47  LaxFontCairo(const char *fontconfigstr,int nid);
48  LaxFontCairo(const char *family, const char *style, double size, int nid);
49  virtual ~LaxFontCairo();
50 
51  virtual double charwidth(unsigned long chr,int real,double *width=NULL,double *height=NULL);
52  virtual double contextcharwidth(char *start,char *pos,int real,double *width=NULL,double *height=NULL);
53  virtual double textheight();
54  virtual double ascent();
55  virtual double descent();
56  virtual double Resize(double newsize);
57 };
58 
59 
60 //---------------------------- FontManager -------------------------------
61 class FontManagerCairo : public FontManager, protected RefPtrStack<LaxFont>
62 {
63  public:
65  virtual ~FontManagerCairo() {}
66 
67  virtual LaxFont *MakeFontFromFile(const char *file, double size, int nid);
68  virtual LaxFont *MakeFontFromStr(const char *fcstr, int nid);
69  virtual LaxFont *MakeFont(const char *family, const char *style, double size, int nid);
70  virtual LaxFont *Add(LaxFont *font,int nid);
71  virtual LaxFont *CheckOut(int id);
72 };
73 
74 
75 //--------------------------- FontManagerCairo ------------------------------------------
76 FontManager *newFontManager_cairo();
77 
78 
79 
80 } //namespace Laxkit
81 
82 #endif
83 

Mon Feb 17 2014 11:52:56, Laxkit