1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2009 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
19 #include "fontmanager.h"
22 #define GLYPH_CACHE_SIZE 256
24 class TextFontDescription
;
27 const TextFontDescription
*desc
;
28 StyleSimulations simulate
;
29 FontFaceExtents extents
;
35 GlyphInfo glyphs
[GLYPH_CACHE_SIZE
];
38 TextFont (FontFace
**faces
, int n_faces
, int master
, double size
);
40 GlyphInfo
*GetGlyphInfo (FontFace
*face
, gunichar unichar
, guint32 index
);
41 void UpdateFaceExtents ();
42 void ClearGlyphCache ();
47 static TextFont
*Load (const char *resource
, int index
, double size
, StyleSimulations simulate
);
48 static TextFont
*Load (const TextFontDescription
*desc
);
50 bool SetStyleSimulations (StyleSimulations simulate
);
51 StyleSimulations
GetStyleSimulations () const;
53 bool SetSize (double size
);
54 double GetSize () const;
56 GlyphInfo
*GetGlyphInfo (gunichar unichar
);
57 GlyphInfo
*GetGlyphInfoByIndex (guint32 index
);
59 double Kerning (GlyphInfo
*left
, GlyphInfo
*right
);
60 double Descender () const;
61 double Ascender () const;
62 double Height () const;
64 double UnderlinePosition () const;
65 double UnderlineThickness () const;
67 void Path (cairo_t
*cr
, GlyphInfo
*glyph
, double x
, double y
);
68 void Path (cairo_t
*cr
, gunichar unichar
, double x
, double y
);
70 void AppendPath (moon_path
*path
, GlyphInfo
*glyph
, double x
, double y
);
71 void AppendPath (moon_path
*path
, gunichar unichar
, double x
, double y
);
75 class TextFontDescription
{
82 FontStretches stretch
;
88 TextFontDescription ();
89 ~TextFontDescription ();
94 bool SetSource (const char *source
);
95 const char *GetSource () const;
97 bool SetFamily (const char *family
);
98 const char *GetFamily () const;
99 char **GetFamilies () const;
101 bool SetLanguage (const char *lang
);
102 const char *GetLanguage () const;
104 bool SetStretch (FontStretches stretch
);
105 FontStretches
GetStretch () const;
107 bool SetWeight (FontWeights weight
);
108 FontWeights
GetWeight () const;
110 bool SetStyle (FontStyles style
);
111 FontStyles
GetStyle () const;
113 bool SetSize (double size
);
114 double GetSize () const;
117 #endif /* __FONTS_H__ */