4 * Copyright (C) 1999 Red Hat Software
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #ifndef __PANGO_TYPES_H__
23 #define __PANGO_TYPES_H__
26 #include <glib-object.h>
30 typedef struct _PangoLogAttr PangoLogAttr;
32 typedef struct _PangoEngineLang PangoEngineLang;
33 typedef struct _PangoEngineShape PangoEngineShape;
35 typedef struct _PangoFont PangoFont;
36 typedef struct _PangoFontMap PangoFontMap;
38 typedef struct _PangoRectangle PangoRectangle;
42 /* A index of a glyph into a font. Rendering system dependent */
43 typedef guint32 PangoGlyph;
47 #define PANGO_SCALE 1024
48 #define PANGO_PIXELS(d) (((int)(d) + 512) >> 10)
49 #define PANGO_PIXELS_FLOOR(d) (((int)(d)) >> 10)
50 #define PANGO_PIXELS_CEIL(d) (((int)(d) + 1023) >> 10)
51 /* The above expressions are just slightly wrong for floating point d;
52 * For example we'd expect PANGO_PIXELS(-512.5) => -1 but instead we get 0.
53 * That's unlikely to matter for practical use and the expression is much
54 * more compact and faster than alternatives that work exactly for both
55 * integers and floating point.
57 * PANGO_PIXELS also behaves differently for +512 and -512.
60 #define PANGO_UNITS_ROUND(d) \
61 (((d) + (PANGO_SCALE >> 1)) & ~(PANGO_SCALE - 1))
64 int pango_units_from_double (double d) G_GNUC_CONST;
65 double pango_units_to_double (int i) G_GNUC_CONST;
69 /* A rectangle. Used to store logical and physical extents of glyphs,
72 struct _PangoRectangle
80 /* Macros to translate from extents rectangles to ascent/descent/lbearing/rbearing
82 #define PANGO_ASCENT(rect) (-(rect).y)
83 #define PANGO_DESCENT(rect) ((rect).y + (rect).height)
84 #define PANGO_LBEARING(rect) ((rect).x)
85 #define PANGO_RBEARING(rect) ((rect).x + (rect).width)
87 void pango_extents_to_pixels (PangoRectangle *inclusive,
88 PangoRectangle *nearest);
91 #include <pango/pango-gravity.h>
92 #include <pango/pango-language.h>
93 #include <pango/pango-matrix.h>
94 #include <pango/pango-script.h>
95 #include <pango/pango-bidi-type.h>
100 #endif /* __PANGO_TYPES_H__ */