Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:23:54

0001 /* Pango
0002  * pango-types.h:
0003  *
0004  * Copyright (C) 1999 Red Hat Software
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Library General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Library General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Library General Public
0017  * License along with this library; if not, write to the
0018  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0019  * Boston, MA 02111-1307, USA.
0020  */
0021 
0022 #ifndef __PANGO_TYPES_H__
0023 #define __PANGO_TYPES_H__
0024 
0025 #include <glib.h>
0026 #include <glib-object.h>
0027 
0028 #include <pango/pango-version-macros.h>
0029 
0030 G_BEGIN_DECLS
0031 
0032 typedef struct _PangoLogAttr PangoLogAttr;
0033 
0034 #ifndef __GI_SCANNER__
0035 typedef struct _PangoEngineLang PangoEngineLang;
0036 typedef struct _PangoEngineShape PangoEngineShape;
0037 #endif
0038 
0039 typedef struct _PangoFont    PangoFont;
0040 typedef struct _PangoFontMap PangoFontMap;
0041 
0042 typedef struct _PangoRectangle PangoRectangle;
0043 
0044 typedef struct _PangoContext PangoContext;
0045 
0046 typedef struct _PangoLanguage PangoLanguage;
0047 
0048 /* A index of a glyph into a font. Rendering system dependent */
0049 /**
0050  * PangoGlyph:
0051  *
0052  * A `PangoGlyph` represents a single glyph in the output form of a string.
0053  */
0054 typedef guint32 PangoGlyph;
0055 
0056 
0057 
0058 /**
0059  * PANGO_SCALE:
0060  *
0061  * The scale between dimensions used for Pango distances and device units.
0062  *
0063  * The definition of device units is dependent on the output device; it will
0064  * typically be pixels for a screen, and points for a printer. %PANGO_SCALE is
0065  * currently 1024, but this may be changed in the future.
0066  *
0067  * When setting font sizes, device units are always considered to be
0068  * points (as in "12 point font"), rather than pixels.
0069  */
0070 /**
0071  * PANGO_PIXELS:
0072  * @d: a dimension in Pango units.
0073  *
0074  * Converts a dimension to device units by rounding.
0075  *
0076  * Return value: rounded dimension in device units.
0077  */
0078 /**
0079  * PANGO_PIXELS_FLOOR:
0080  * @d: a dimension in Pango units.
0081  *
0082  * Converts a dimension to device units by flooring.
0083  *
0084  * Return value: floored dimension in device units.
0085  * Since: 1.14
0086  */
0087 /**
0088  * PANGO_PIXELS_CEIL:
0089  * @d: a dimension in Pango units.
0090  *
0091  * Converts a dimension to device units by ceiling.
0092  *
0093  * Return value: ceiled dimension in device units.
0094  * Since: 1.14
0095  */
0096 #define PANGO_SCALE 1024
0097 #define PANGO_PIXELS(d) (((int)(d) + 512) >> 10)
0098 #define PANGO_PIXELS_FLOOR(d) (((int)(d)) >> 10)
0099 #define PANGO_PIXELS_CEIL(d) (((int)(d) + 1023) >> 10)
0100 /* The above expressions are just slightly wrong for floating point d;
0101  * For example we'd expect PANGO_PIXELS(-512.5) => -1 but instead we get 0.
0102  * That's unlikely to matter for practical use and the expression is much
0103  * more compact and faster than alternatives that work exactly for both
0104  * integers and floating point.
0105  *
0106  * PANGO_PIXELS also behaves differently for +512 and -512.
0107  */
0108 
0109 /**
0110  * PANGO_UNITS_FLOOR:
0111  * @d: a dimension in Pango units.
0112  *
0113  * Rounds a dimension down to whole device units, but does not
0114  * convert it to device units.
0115  *
0116  * Return value: rounded down dimension in Pango units.
0117  * Since: 1.50
0118  */
0119 #define PANGO_UNITS_FLOOR(d)                \
0120   ((d) & ~(PANGO_SCALE - 1))
0121 
0122 /**
0123  * PANGO_UNITS_CEIL:
0124  * @d: a dimension in Pango units.
0125  *
0126  * Rounds a dimension up to whole device units, but does not
0127  * convert it to device units.
0128  *
0129  * Return value: rounded up dimension in Pango units.
0130  * Since: 1.50
0131  */
0132 #define PANGO_UNITS_CEIL(d)                 \
0133   (((d) + (PANGO_SCALE - 1)) & ~(PANGO_SCALE - 1))
0134 
0135 /**
0136  * PANGO_UNITS_ROUND:
0137  * @d: a dimension in Pango units.
0138  *
0139  * Rounds a dimension to whole device units, but does not
0140  * convert it to device units.
0141  *
0142  * Return value: rounded dimension in Pango units.
0143  * Since: 1.18
0144  */
0145 #define PANGO_UNITS_ROUND(d)                \
0146   (((d) + (PANGO_SCALE >> 1)) & ~(PANGO_SCALE - 1))
0147 
0148 
0149 PANGO_AVAILABLE_IN_1_16
0150 int    pango_units_from_double (double d) G_GNUC_CONST;
0151 PANGO_AVAILABLE_IN_1_16
0152 double pango_units_to_double (int i) G_GNUC_CONST;
0153 
0154 
0155 
0156 /**
0157  * PangoRectangle:
0158  * @x: X coordinate of the left side of the rectangle.
0159  * @y: Y coordinate of the the top side of the rectangle.
0160  * @width: width of the rectangle.
0161  * @height: height of the rectangle.
0162  *
0163  * The `PangoRectangle` structure represents a rectangle.
0164  *
0165  * `PangoRectangle` is frequently used to represent the logical or ink
0166  * extents of a single glyph or section of text. (See, for instance,
0167  * [method@Pango.Font.get_glyph_extents].)
0168  */
0169 struct _PangoRectangle
0170 {
0171   int x;
0172   int y;
0173   int width;
0174   int height;
0175 };
0176 
0177 /* Macros to translate from extents rectangles to ascent/descent/lbearing/rbearing
0178  */
0179 /**
0180  * PANGO_ASCENT:
0181  * @rect: a `PangoRectangle`
0182  *
0183  * Extracts the *ascent* from a `PangoRectangle`
0184  * representing glyph extents.
0185  *
0186  * The ascent is the distance from the baseline to the
0187  * highest point of the character. This is positive if the
0188  * glyph ascends above the baseline.
0189  */
0190 /**
0191  * PANGO_DESCENT:
0192  * @rect: a `PangoRectangle`
0193  *
0194  * Extracts the *descent* from a `PangoRectangle`
0195  * representing glyph extents.
0196  *
0197  * The descent is the distance from the baseline to the
0198  * lowest point of the character. This is positive if the
0199  * glyph descends below the baseline.
0200  */
0201 /**
0202  * PANGO_LBEARING:
0203  * @rect: a `PangoRectangle`
0204  *
0205  * Extracts the *left bearing* from a `PangoRectangle`
0206  * representing glyph extents.
0207  *
0208  * The left bearing is the distance from the horizontal
0209  * origin to the farthest left point of the character.
0210  * This is positive for characters drawn completely to
0211  * the right of the glyph origin.
0212  */
0213 /**
0214  * PANGO_RBEARING:
0215  * @rect: a `PangoRectangle`
0216  *
0217  * Extracts the *right bearing* from a `PangoRectangle`
0218  * representing glyph extents.
0219  *
0220  * The right bearing is the distance from the horizontal
0221  * origin to the farthest right point of the character.
0222  * This is positive except for characters drawn completely
0223  * to the left of the horizontal origin.
0224  */
0225 #define PANGO_ASCENT(rect) (-(rect).y)
0226 #define PANGO_DESCENT(rect) ((rect).y + (rect).height)
0227 #define PANGO_LBEARING(rect) ((rect).x)
0228 #define PANGO_RBEARING(rect) ((rect).x + (rect).width)
0229 
0230 PANGO_AVAILABLE_IN_1_16
0231 void pango_extents_to_pixels (PangoRectangle *inclusive,
0232                   PangoRectangle *nearest);
0233 
0234 
0235 #include <pango/pango-gravity.h>
0236 #include <pango/pango-language.h>
0237 #include <pango/pango-matrix.h>
0238 #include <pango/pango-script.h>
0239 #include <pango/pango-bidi-type.h>
0240 
0241 
0242 G_END_DECLS
0243 
0244 #endif /* __PANGO_TYPES_H__ */