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
;
36 GlyphInfo glyphs
[GLYPH_CACHE_SIZE
];
39 TextFont (FontFace
**faces
, int n_faces
, int master
, bool gapless
, double size
);
41 GlyphInfo
*GetGlyphInfo (FontFace
*face
, gunichar unichar
, guint32 index
);
42 void UpdateFaceExtents ();
43 void ClearGlyphCache ();
48 static TextFont
*Load (const char *resource
, int index
, double size
, StyleSimulations simulate
);
49 static TextFont
*Load (const TextFontDescription
*desc
);
51 bool SetStyleSimulations (StyleSimulations simulate
);
52 StyleSimulations
GetStyleSimulations () const;
54 bool SetSize (double size
);
55 double GetSize () const;
57 GlyphInfo
*GetGlyphInfo (gunichar unichar
);
58 GlyphInfo
*GetGlyphInfoByIndex (guint32 index
);
60 double Kerning (GlyphInfo
*left
, GlyphInfo
*right
);
61 double Descender () const;
62 double Ascender () const;
63 double Height () const;
65 double UnderlinePosition () const;
66 double UnderlineThickness () const;
68 void Path (cairo_t
*cr
, GlyphInfo
*glyph
, double x
, double y
);
69 void Path (cairo_t
*cr
, gunichar unichar
, double x
, double y
);
71 void AppendPath (moon_path
*path
, GlyphInfo
*glyph
, double x
, double y
);
72 void AppendPath (moon_path
*path
, gunichar unichar
, double x
, double y
);
76 class TextFontDescription
{
83 FontStretches stretch
;
89 TextFontDescription ();
90 ~TextFontDescription ();
95 bool SetSource (const char *source
);
96 const char *GetSource () const;
98 bool SetFamily (const char *family
);
99 const char *GetFamily () const;
100 char **GetFamilies () const;
102 bool SetLanguage (const char *lang
);
103 const char *GetLanguage () const;
105 bool SetStretch (FontStretches stretch
);
106 FontStretches
GetStretch () const;
108 bool SetWeight (FontWeights weight
);
109 FontWeights
GetWeight () const;
111 bool SetStyle (FontStyles style
);
112 FontStyles
GetStyle () const;
114 bool SetSize (double size
);
115 double GetSize () const;
118 #endif /* __FONTS_H__ */