1/*
2 * Copyright (c) 2015- terrak <terrak1975@gmail.com>
3 *
4 * This file originated from: http://www.terrak.net/
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19package pango
20
21// #include <pango/pango.h>
22// #include "pango.go.h"
23// #include "fontconfig.go.h"
24import "C"
25import (
26	//	"github.com/andre-hub/gotk3/glib"
27	//	"github.com/andre-hub/gotk3/cairo"
28	"unsafe"
29
30	"github.com/gotk3/gotk3/glib"
31)
32
33func init() {
34	tm := []glib.TypeMarshaler{
35		// Enums
36		// Objects/Interfaces
37		{glib.Type(C.pango_font_description_get_type()), marshalFontDescription},
38	}
39	glib.RegisterGValueMarshalers(tm)
40}
41
42func AddFont(fontPath string) {
43	C.addFont(C.CString(fontPath))
44}
45
46// FontDescription is a representation of PangoFontDescription.
47type FontDescription struct {
48	pangoFontDescription *C.PangoFontDescription
49}
50
51// Native returns a pointer to the underlying PangoLayout.
52func (v *FontDescription) Native() uintptr {
53	return uintptr(unsafe.Pointer(v.native()))
54}
55
56func (v *FontDescription) native() *C.PangoFontDescription {
57	return (*C.PangoFontDescription)(unsafe.Pointer(v.pangoFontDescription))
58}
59
60// FontMetrics is a representation of PangoFontMetrics.
61type FontMetrics struct {
62	pangoFontMetrics *C.PangoFontMetrics
63}
64
65// Native returns a pointer to the underlying PangoLayout.
66func (v *FontMetrics) Native() uintptr {
67	return uintptr(unsafe.Pointer(v.native()))
68}
69
70func (v *FontMetrics) native() *C.PangoFontMetrics {
71	return (*C.PangoFontMetrics)(unsafe.Pointer(v.pangoFontMetrics))
72}
73
74const (
75	PANGO_SCALE = C.PANGO_SCALE
76)
77
78type Style int
79
80const (
81	STYLE_NORMAL  Style = C.PANGO_STYLE_NORMAL
82	STYLE_OBLIQUE Style = C.PANGO_STYLE_OBLIQUE
83	STYLE_ITALIC  Style = C.PANGO_STYLE_ITALIC
84)
85
86type Variant int
87
88const (
89	VARIANT_NORMAL     Variant = C.PANGO_VARIANT_NORMAL
90	VARIANT_SMALL_CAPS Variant = C.PANGO_VARIANT_SMALL_CAPS
91)
92
93type Weight int
94
95const (
96	WEIGHT_THIN       Weight = C.PANGO_WEIGHT_THIN       /* 100 */
97	WEIGHT_ULTRALIGHT Weight = C.PANGO_WEIGHT_ULTRALIGHT /* 200 */
98	WEIGHT_LIGHT      Weight = C.PANGO_WEIGHT_LIGHT      /* 300 */
99	WEIGHT_SEMILIGHT  Weight = 350                       /* 350 */
100	WEIGHT_BOOK       Weight = C.PANGO_WEIGHT_BOOK       /* 380 */
101	WEIGHT_NORMAL     Weight = C.PANGO_WEIGHT_NORMAL     /* 400 */
102	WEIGHT_MEDIUM     Weight = C.PANGO_WEIGHT_MEDIUM     /* 500 */
103	WEIGHT_SEMIBOLD   Weight = C.PANGO_WEIGHT_SEMIBOLD   /* 600 */
104	WEIGHT_BOLD       Weight = C.PANGO_WEIGHT_BOLD       /* 700 */
105	WEIGHT_ULTRABOLD  Weight = C.PANGO_WEIGHT_ULTRABOLD  /* 800 */
106	WEIGHT_HEAVY      Weight = C.PANGO_WEIGHT_HEAVY      /* 900 */
107	WEIGHT_ULTRAHEAVY Weight = C.PANGO_WEIGHT_ULTRAHEAVY /* 1000 */
108
109)
110
111type Stretch int
112
113const (
114	STRETCH_ULTRA_CONDENSED        Stretch = C.PANGO_STRETCH_ULTRA_CONDENSED
115	STRETCH_EXTRA_CONDENSEDStretch Stretch = C.PANGO_STRETCH_EXTRA_CONDENSED
116	STRETCH_CONDENSEDStretch       Stretch = C.PANGO_STRETCH_CONDENSED
117	STRETCH_SEMI_CONDENSEDStretch  Stretch = C.PANGO_STRETCH_SEMI_CONDENSED
118	STRETCH_NORMALStretch          Stretch = C.PANGO_STRETCH_NORMAL
119	STRETCH_SEMI_EXPANDEDStretch   Stretch = C.PANGO_STRETCH_SEMI_EXPANDED
120	STRETCH_EXPANDEDStretch        Stretch = C.PANGO_STRETCH_EXPANDED
121	STRETCH_EXTRA_EXPANDEDStretch  Stretch = C.PANGO_STRETCH_EXTRA_EXPANDED
122	STRETCH_ULTRA_EXPANDEDStretch  Stretch = C.PANGO_STRETCH_ULTRA_EXPANDED
123)
124
125type FontMask int
126
127const (
128	FONT_MASK_FAMILY          FontMask = C.PANGO_FONT_MASK_FAMILY  /*  1 << 0 */
129	FONT_MASK_STYLEFontMask   FontMask = C.PANGO_FONT_MASK_STYLE   /*  1 << 1 */
130	FONT_MASK_VARIANTFontMask FontMask = C.PANGO_FONT_MASK_VARIANT /*  1 << 2 */
131	FONT_MASK_WEIGHTFontMask  FontMask = C.PANGO_FONT_MASK_WEIGHT  /*  1 << 3 */
132	FONT_MASK_STRETCHFontMask FontMask = C.PANGO_FONT_MASK_STRETCH /*  1 << 4 */
133	FONT_MASK_SIZEFontMask    FontMask = C.PANGO_FONT_MASK_SIZE    /*  1 << 5 */
134	FONT_MASK_GRAVITYFontMask FontMask = C.PANGO_FONT_MASK_GRAVITY /*  1 << 6 */
135)
136
137type Scale float64
138
139const (
140	SCALE_XX_SMALL Scale = /* C.PANGO_SCALE_XX_SMALL */ 0.5787037037037
141	SCALE_X_SMALL  Scale = /*C.PANGO_SCALE_X_SMALL  */ 0.6444444444444
142	SCALE_SMALL    Scale = /*C.PANGO_SCALE_SMALL    */ 0.8333333333333
143	SCALE_MEDIUM   Scale = /*C.PANGO_SCALE_MEDIUM   */ 1.0
144	SCALE_LARGE    Scale = /*C.PANGO_SCALE_LARGE    */ 1.2
145	SCALE_X_LARGE  Scale = /*C.PANGO_SCALE_X_LARGE  */ 1.4399999999999
146	SCALE_XX_LARGE Scale = /*C.PANGO_SCALE_XX_LARGE */ 1.728
147)
148
149/*
150 * PangoFontDescription
151 */
152
153func marshalFontDescription(p uintptr) (interface{}, error) {
154	c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p)))
155	c2 := (*C.PangoFontDescription)(unsafe.Pointer(c))
156	return wrapFontDescription(c2), nil
157}
158
159func wrapFontDescription(obj *C.PangoFontDescription) *FontDescription {
160	return &FontDescription{obj}
161}
162
163//PangoFontDescription *pango_font_description_new         (void);
164func FontDescriptionNew() *FontDescription {
165	c := C.pango_font_description_new()
166	v := new(FontDescription)
167	v.pangoFontDescription = c
168	return v
169}
170
171//PangoFontDescription *pango_font_description_copy        (const PangoFontDescription  *desc);
172func (v *FontDescription) Copy() *FontDescription {
173	c := C.pango_font_description_copy(v.native())
174	v2 := new(FontDescription)
175	v2.pangoFontDescription = c
176	return v2
177}
178
179//PangoFontDescription *pango_font_description_copy_static (const PangoFontDescription  *desc);
180func (v *FontDescription) CopyStatic() *FontDescription {
181	c := C.pango_font_description_copy_static(v.native())
182	v2 := new(FontDescription)
183	v2.pangoFontDescription = c
184	return v2
185}
186
187//guint                 pango_font_description_hash        (const PangoFontDescription  *desc) G_GNUC_PURE;
188func (v *FontDescription) Hash() uint {
189	c := C.pango_font_description_hash(v.native())
190	return uint(c)
191}
192
193//gboolean              pango_font_description_equal       (const PangoFontDescription  *desc1,
194//							  const PangoFontDescription  *desc2) G_GNUC_PURE;
195func (v *FontDescription) Equal(v2 *FontDescription) bool {
196	c := C.pango_font_description_equal(v.native(), v2.native())
197	return gobool(c)
198}
199
200//void                  pango_font_description_free        (PangoFontDescription        *desc);
201func (v *FontDescription) Free() {
202	C.pango_font_description_free(v.native())
203}
204
205//void                  pango_font_descriptions_free       (PangoFontDescription       **descs,
206//							  int                          n_descs);
207//func (v *FontDescription) FontDescriptionsFree(n_descs int) {
208//	C.pango_font_descriptions_free(v.native(), C.int(n_descs))
209//}
210
211//void                 pango_font_description_set_family        (PangoFontDescription *desc,
212//							       const char           *family);
213func (v *FontDescription) SetFamily(family string) {
214	cstr := C.CString(family)
215	defer C.free(unsafe.Pointer(cstr))
216	C.pango_font_description_set_family(v.native(), (*C.char)(cstr))
217}
218
219//void                 pango_font_description_set_family_static (PangoFontDescription *desc,
220//							       const char           *family);
221func (v *FontDescription) SetFamilyStatic(family string) {
222	cstr := C.CString(family)
223	defer C.free(unsafe.Pointer(cstr))
224	C.pango_font_description_set_family_static(v.native(), (*C.char)(cstr))
225}
226
227//const char          *pango_font_description_get_family        (const PangoFontDescription *desc) G_GNUC_PURE;
228func (v *FontDescription) GetFamily() string {
229	c := C.pango_font_description_get_family(v.native())
230	return C.GoString((*C.char)(c))
231}
232
233//void                 pango_font_description_set_style         (PangoFontDescription *desc,
234//							       PangoStyle            style);
235func (v *FontDescription) SetStyle(style Style) {
236	C.pango_font_description_set_style(v.native(), (C.PangoStyle)(style))
237}
238
239//PangoStyle           pango_font_description_get_style         (const PangoFontDescription *desc) G_GNUC_PURE;
240func (v *FontDescription) GetStyle() Style {
241	c := C.pango_font_description_get_style(v.native())
242	return Style(c)
243}
244
245//void                 pango_font_description_set_variant       (PangoFontDescription *desc,
246//							       PangoVariant          variant);
247//PangoVariant         pango_font_description_get_variant       (const PangoFontDescription *desc) G_GNUC_PURE;
248
249//void                 pango_font_description_set_weight        (PangoFontDescription *desc,
250//							       PangoWeight           weight);
251func (v *FontDescription) SetWeight(weight Weight) {
252	C.pango_font_description_set_weight(v.native(), (C.PangoWeight)(weight))
253}
254
255//PangoWeight          pango_font_description_get_weight        (const PangoFontDescription *desc) G_GNUC_PURE;
256func (v *FontDescription) GetWeight() Weight {
257	c := C.pango_font_description_get_weight(v.native())
258	return Weight(c)
259}
260
261//void                 pango_font_description_set_stretch       (PangoFontDescription *desc,
262//							       PangoStretch          stretch);
263func (v *FontDescription) SetStretch(stretch Stretch) {
264	C.pango_font_description_set_stretch(v.native(), (C.PangoStretch)(stretch))
265}
266
267//PangoStretch         pango_font_description_get_stretch       (const PangoFontDescription *desc) G_GNUC_PURE;
268func (v *FontDescription) GetStretch() Stretch {
269	c := C.pango_font_description_get_stretch(v.native())
270	return Stretch(c)
271}
272
273//void                 pango_font_description_set_size          (PangoFontDescription *desc,
274//							       gint                  size);
275func (v *FontDescription) SetSize(size int) {
276	C.pango_font_description_set_size(v.native(), (C.gint)(size))
277}
278
279//gint                 pango_font_description_get_size          (const PangoFontDescription *desc) G_GNUC_PURE;
280func (v *FontDescription) GetSize() int {
281	c := C.pango_font_description_get_size(v.native())
282	return int(c)
283}
284
285//void                 pango_font_description_set_absolute_size (PangoFontDescription *desc,
286//							       double                size);
287func (v *FontDescription) SetAbsoluteSize(size float64) {
288	C.pango_font_description_set_absolute_size(v.native(), (C.double)(size))
289}
290
291//gboolean             pango_font_description_get_size_is_absolute (const PangoFontDescription *desc) G_GNUC_PURE;
292func (v *FontDescription) GetSizeIsAbsolute() bool {
293	c := C.pango_font_description_get_size_is_absolute(v.native())
294	return gobool(c)
295}
296
297//void                 pango_font_description_set_gravity       (PangoFontDescription *desc,
298//							       PangoGravity          gravity);
299func (v *FontDescription) SetGravity(gravity Gravity) {
300	C.pango_font_description_set_gravity(v.native(), (C.PangoGravity)(gravity))
301}
302
303//PangoGravity         pango_font_description_get_gravity       (const PangoFontDescription *desc) G_GNUC_PURE;
304func (v *FontDescription) GetGravity() Gravity {
305	c := C.pango_font_description_get_gravity(v.native())
306	return Gravity(c)
307}
308
309//PangoFontMask pango_font_description_get_set_fields (const PangoFontDescription *desc) G_GNUC_PURE;
310func (v *FontDescription) GetSetFields() FontMask {
311	c := C.pango_font_description_get_set_fields(v.native())
312	return FontMask(c)
313}
314
315//void          pango_font_description_unset_fields   (PangoFontDescription       *desc,
316//						     PangoFontMask               to_unset);
317func (v *FontDescription) GetUnsetFields(to_unset FontMask) {
318	C.pango_font_description_unset_fields(v.native(), (C.PangoFontMask)(to_unset))
319}
320
321//void pango_font_description_merge        (PangoFontDescription       *desc,
322//					  const PangoFontDescription *desc_to_merge,
323//					  gboolean                    replace_existing);
324func (v *FontDescription) Merge(desc_to_merge *FontDescription, replace_existing bool) {
325	C.pango_font_description_merge(v.native(), desc_to_merge.native(), gbool(replace_existing))
326}
327
328//void pango_font_description_merge_static (PangoFontDescription       *desc,
329//					  const PangoFontDescription *desc_to_merge,
330//					  gboolean                    replace_existing);
331func (v *FontDescription) MergeStatic(desc_to_merge *FontDescription, replace_existing bool) {
332	C.pango_font_description_merge_static(v.native(), desc_to_merge.native(), gbool(replace_existing))
333}
334
335//gboolean pango_font_description_better_match (const PangoFontDescription *desc,
336//					      const PangoFontDescription *old_match,
337//					      const PangoFontDescription *new_match) G_GNUC_PURE;
338func (v *FontDescription) BetterMatch(old_match, new_match *FontDescription) bool {
339	c := C.pango_font_description_better_match(v.native(), old_match.native(), new_match.native())
340	return gobool(c)
341}
342
343//PangoFontDescription *pango_font_description_from_string (const char                  *str);
344func FontDescriptionFromString(str string) *FontDescription {
345	cstr := C.CString(str)
346	defer C.free(unsafe.Pointer(cstr))
347	c := C.pango_font_description_from_string((*C.char)(cstr))
348	v := new(FontDescription)
349	v.pangoFontDescription = c
350	return v
351}
352
353//char *                pango_font_description_to_string   (const PangoFontDescription  *desc);
354func (v *FontDescription) ToString() string {
355	c := C.pango_font_description_to_string(v.native())
356	return C.GoString((*C.char)(c))
357}
358
359//char *                pango_font_description_to_filename (const PangoFontDescription  *desc);
360func (v *FontDescription) ToFilename() string {
361	c := C.pango_font_description_to_filename(v.native())
362	return C.GoString((*C.char)(c))
363}
364
365///*
366// * PangoFontMetrics
367// */
368//
369///**
370// * PANGO_TYPE_FONT_METRICS:
371// *
372// * The #GObject type for #PangoFontMetrics.
373// */
374//#define PANGO_TYPE_FONT_METRICS  (pango_font_metrics_get_type ())
375//GType             pango_font_metrics_get_type                    (void) G_GNUC_CONST;
376//PangoFontMetrics *pango_font_metrics_ref                         (PangoFontMetrics *metrics);
377//void              pango_font_metrics_unref                       (PangoFontMetrics *metrics);
378//int               pango_font_metrics_get_ascent                  (PangoFontMetrics *metrics) G_GNUC_PURE;
379//int               pango_font_metrics_get_descent                 (PangoFontMetrics *metrics) G_GNUC_PURE;
380//int               pango_font_metrics_get_approximate_char_width  (PangoFontMetrics *metrics) G_GNUC_PURE;
381//int               pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics) G_GNUC_PURE;
382//int               pango_font_metrics_get_underline_position      (PangoFontMetrics *metrics) G_GNUC_PURE;
383//int               pango_font_metrics_get_underline_thickness     (PangoFontMetrics *metrics) G_GNUC_PURE;
384//int               pango_font_metrics_get_strikethrough_position  (PangoFontMetrics *metrics) G_GNUC_PURE;
385//int               pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics) G_GNUC_PURE;
386//
387//#ifdef PANGO_ENABLE_BACKEND
388//
389//PangoFontMetrics *pango_font_metrics_new (void);
390//
391//struct _PangoFontMetrics
392//{
393//  guint ref_count;
394//
395//  int ascent;
396//  int descent;
397//  int approximate_char_width;
398//  int approximate_digit_width;
399//  int underline_position;
400//  int underline_thickness;
401//  int strikethrough_position;
402//  int strikethrough_thickness;
403//};
404//
405//#endif /* PANGO_ENABLE_BACKEND */
406//
407///*
408// * PangoFontFamily
409// */
410//
411///**
412// * PANGO_TYPE_FONT_FAMILY:
413// *
414// * The #GObject type for #PangoFontFamily.
415// */
416///**
417// * PANGO_FONT_FAMILY:
418// * @object: a #GObject.
419// *
420// * Casts a #GObject to a #PangoFontFamily.
421// */
422///**
423// * PANGO_IS_FONT_FAMILY:
424// * @object: a #GObject.
425// *
426// * Returns: %TRUE if @object is a #PangoFontFamily.
427// */
428//#define PANGO_TYPE_FONT_FAMILY              (pango_font_family_get_type ())
429//#define PANGO_FONT_FAMILY(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT_FAMILY, PangoFontFamily))
430//#define PANGO_IS_FONT_FAMILY(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT_FAMILY))
431//
432//typedef struct _PangoFontFamily      PangoFontFamily;
433//typedef struct _PangoFontFace        PangoFontFace;
434//
435//GType      pango_font_family_get_type       (void) G_GNUC_CONST;
436//
437//void                 pango_font_family_list_faces (PangoFontFamily  *family,
438//						   PangoFontFace  ***faces,
439//						   int              *n_faces);
440//const char *pango_font_family_get_name   (PangoFontFamily  *family) G_GNUC_PURE;
441//gboolean   pango_font_family_is_monospace         (PangoFontFamily  *family) G_GNUC_PURE;
442//
443//#ifdef PANGO_ENABLE_BACKEND
444//
445//#define PANGO_FONT_FAMILY_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
446//#define PANGO_IS_FONT_FAMILY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FAMILY))
447//#define PANGO_FONT_FAMILY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
448//
449//typedef struct _PangoFontFamilyClass PangoFontFamilyClass;
450//
451//
452///**
453// * PangoFontFamily:
454// *
455// * The #PangoFontFamily structure is used to represent a family of related
456// * font faces. The faces in a family share a common design, but differ in
457// * slant, weight, width and other aspects.
458// */
459//struct _PangoFontFamily
460//{
461//  GObject parent_instance;
462//};
463//
464//struct _PangoFontFamilyClass
465//{
466//  GObjectClass parent_class;
467//
468//  /*< public >*/
469//
470//  void  (*list_faces)      (PangoFontFamily  *family,
471//			    PangoFontFace  ***faces,
472//			    int              *n_faces);
473//  const char * (*get_name) (PangoFontFamily  *family);
474//  gboolean (*is_monospace) (PangoFontFamily *family);
475//
476//  /*< private >*/
477//
478//  /* Padding for future expansion */
479//  void (*_pango_reserved2) (void);
480//  void (*_pango_reserved3) (void);
481//  void (*_pango_reserved4) (void);
482//};
483//
484//#endif /* PANGO_ENABLE_BACKEND */
485//
486///*
487// * PangoFontFace
488// */
489//
490///**
491// * PANGO_TYPE_FONT_FACE:
492// *
493// * The #GObject type for #PangoFontFace.
494// */
495///**
496// * PANGO_FONT_FACE:
497// * @object: a #GObject.
498// *
499// * Casts a #GObject to a #PangoFontFace.
500// */
501///**
502// * PANGO_IS_FONT_FACE:
503// * @object: a #GObject.
504// *
505// * Returns: %TRUE if @object is a #PangoFontFace.
506// */
507//#define PANGO_TYPE_FONT_FACE              (pango_font_face_get_type ())
508//#define PANGO_FONT_FACE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT_FACE, PangoFontFace))
509//#define PANGO_IS_FONT_FACE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT_FACE))
510//
511//GType      pango_font_face_get_type       (void) G_GNUC_CONST;
512//
513//PangoFontDescription *pango_font_face_describe       (PangoFontFace  *face);
514//const char           *pango_font_face_get_face_name  (PangoFontFace  *face) G_GNUC_PURE;
515//void                  pango_font_face_list_sizes     (PangoFontFace  *face,
516//						      int           **sizes,
517//						      int            *n_sizes);
518//gboolean              pango_font_face_is_synthesized (PangoFontFace  *face) G_GNUC_PURE;
519//
520//#ifdef PANGO_ENABLE_BACKEND
521//
522//#define PANGO_FONT_FACE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
523//#define PANGO_IS_FONT_FACE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FACE))
524//#define PANGO_FONT_FACE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
525//
526//typedef struct _PangoFontFaceClass   PangoFontFaceClass;
527//
528///**
529// * PangoFontFace:
530// *
531// * The #PangoFontFace structure is used to represent a group of fonts with
532// * the same family, slant, weight, width, but varying sizes.
533// */
534//struct _PangoFontFace
535//{
536//  GObject parent_instance;
537//};
538//
539//struct _PangoFontFaceClass
540//{
541//  GObjectClass parent_class;
542//
543//  /*< public >*/
544//
545//  const char           * (*get_face_name)  (PangoFontFace *face);
546//  PangoFontDescription * (*describe)       (PangoFontFace *face);
547//  void                   (*list_sizes)     (PangoFontFace  *face,
548//					    int           **sizes,
549//					    int            *n_sizes);
550//  gboolean               (*is_synthesized) (PangoFontFace *face);
551//
552//  /*< private >*/
553//
554//  /* Padding for future expansion */
555//  void (*_pango_reserved3) (void);
556//  void (*_pango_reserved4) (void);
557//};
558//
559//#endif /* PANGO_ENABLE_BACKEND */
560//
561///*
562// * PangoFont
563// */
564//
565///**
566// * PANGO_TYPE_FONT:
567// *
568// * The #GObject type for #PangoFont.
569// */
570///**
571// * PANGO_FONT:
572// * @object: a #GObject.
573// *
574// * Casts a #GObject to a #PangoFont.
575// */
576///**
577// * PANGO_IS_FONT:
578// * @object: a #GObject.
579// *
580// * Returns: %TRUE if @object is a #PangoFont.
581// */
582//#define PANGO_TYPE_FONT              (pango_font_get_type ())
583//#define PANGO_FONT(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT, PangoFont))
584//#define PANGO_IS_FONT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT))
585//
586//GType                 pango_font_get_type          (void) G_GNUC_CONST;
587//
588//PangoFontDescription *pango_font_describe          (PangoFont        *font);
589//PangoFontDescription *pango_font_describe_with_absolute_size (PangoFont        *font);
590//PangoCoverage *       pango_font_get_coverage      (PangoFont        *font,
591//						    PangoLanguage    *language);
592//PangoEngineShape *    pango_font_find_shaper       (PangoFont        *font,
593//						    PangoLanguage    *language,
594//						    guint32           ch);
595//PangoFontMetrics *    pango_font_get_metrics       (PangoFont        *font,
596//						    PangoLanguage    *language);
597//void                  pango_font_get_glyph_extents (PangoFont        *font,
598//						    PangoGlyph        glyph,
599//						    PangoRectangle   *ink_rect,
600//						    PangoRectangle   *logical_rect);
601//PangoFontMap         *pango_font_get_font_map      (PangoFont        *font);
602//
603//#ifdef PANGO_ENABLE_BACKEND
604//
605//#define PANGO_FONT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT, PangoFontClass))
606//#define PANGO_IS_FONT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT))
607//#define PANGO_FONT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT, PangoFontClass))
608//
609//typedef struct _PangoFontClass       PangoFontClass;
610//
611///**
612// * PangoFont:
613// *
614// * The #PangoFont structure is used to represent
615// * a font in a rendering-system-independent matter.
616// * To create an implementation of a #PangoFont,
617// * the rendering-system specific code should allocate
618// * a larger structure that contains a nested
619// * #PangoFont, fill in the <structfield>klass</structfield> member of
620// * the nested #PangoFont with a pointer to
621// * a appropriate #PangoFontClass, then call
622// * pango_font_init() on the structure.
623// *
624// * The #PangoFont structure contains one member
625// * which the implementation fills in.
626// */
627//struct _PangoFont
628//{
629//  GObject parent_instance;
630//};
631//
632//struct _PangoFontClass
633//{
634//  GObjectClass parent_class;
635//
636//  /*< public >*/
637//
638//  PangoFontDescription *(*describe)           (PangoFont      *font);
639//  PangoCoverage *       (*get_coverage)       (PangoFont      *font,
640//					       PangoLanguage  *lang);
641//  PangoEngineShape *    (*find_shaper)        (PangoFont      *font,
642//					       PangoLanguage  *lang,
643//					       guint32         ch);
644//  void                  (*get_glyph_extents)  (PangoFont      *font,
645//					       PangoGlyph      glyph,
646//					       PangoRectangle *ink_rect,
647//					       PangoRectangle *logical_rect);
648//  PangoFontMetrics *    (*get_metrics)        (PangoFont      *font,
649//					       PangoLanguage  *language);
650//  PangoFontMap *        (*get_font_map)       (PangoFont      *font);
651//  PangoFontDescription *(*describe_absolute)  (PangoFont      *font);
652//  /*< private >*/
653//
654//  /* Padding for future expansion */
655//  void (*_pango_reserved1) (void);
656//  void (*_pango_reserved2) (void);
657//};
658//
659///* used for very rare and miserable situtations that we cannot even
660// * draw a hexbox
661// */
662//#define PANGO_UNKNOWN_GLYPH_WIDTH  10
663//#define PANGO_UNKNOWN_GLYPH_HEIGHT 14
664//
665//#endif /* PANGO_ENABLE_BACKEND */
666//
667///**
668// * PANGO_GLYPH_EMPTY:
669// *
670// * The %PANGO_GLYPH_EMPTY macro represents a #PangoGlyph value that has a
671// *  special meaning, which is a zero-width empty glyph.  This is useful for
672// * example in shaper modules, to use as the glyph for various zero-width
673// * Unicode characters (those passing pango_is_zero_width()).
674// */
675///**
676// * PANGO_GLYPH_INVALID_INPUT:
677// *
678// * The %PANGO_GLYPH_INVALID_INPUT macro represents a #PangoGlyph value that has a
679// * special meaning of invalid input.  #PangoLayout produces one such glyph
680// * per invalid input UTF-8 byte and such a glyph is rendered as a crossed
681// * box.
682// *
683// * Note that this value is defined such that it has the %PANGO_GLYPH_UNKNOWN_FLAG
684// * on.
685// *
686// * Since: 1.20
687// */
688///**
689// * PANGO_GLYPH_UNKNOWN_FLAG:
690// *
691// * The %PANGO_GLYPH_UNKNOWN_FLAG macro is a flag value that can be added to
692// * a #gunichar value of a valid Unicode character, to produce a #PangoGlyph
693// * value, representing an unknown-character glyph for the respective #gunichar.
694// */
695///**
696// * PANGO_GET_UNKNOWN_GLYPH:
697// * @wc: a Unicode character
698// *
699// * The way this unknown glyphs are rendered is backend specific.  For example,
700// * a box with the hexadecimal Unicode code-point of the character written in it
701// * is what is done in the most common backends.
702// *
703// * Returns: a #PangoGlyph value that means no glyph was found for @wc.
704// */
705//#define PANGO_GLYPH_EMPTY           ((PangoGlyph)0x0FFFFFFF)
706//#define PANGO_GLYPH_INVALID_INPUT   ((PangoGlyph)0xFFFFFFFF)
707//#define PANGO_GLYPH_UNKNOWN_FLAG    ((PangoGlyph)0x10000000)
708//#define PANGO_GET_UNKNOWN_GLYPH(wc) ((PangoGlyph)(wc)|PANGO_GLYPH_UNKNOWN_FLAG)
709//
710//
711