Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-18 10:28:15

0001 /* Pango
0002  * pango-item.h: Structure for storing run information
0003  *
0004  * Copyright (C) 2000 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_ITEM_H__
0023 #define __PANGO_ITEM_H__
0024 
0025 #include <pango/pango-types.h>
0026 #include <pango/pango-attributes.h>
0027 
0028 G_BEGIN_DECLS
0029 
0030 typedef struct _PangoAnalysis PangoAnalysis;
0031 typedef struct _PangoItem PangoItem;
0032 
0033 /**
0034  * PANGO_ANALYSIS_FLAG_CENTERED_BASELINE:
0035  *
0036  * Whether the segment should be shifted to center around the baseline.
0037  *
0038  * This is mainly used in vertical writing directions.
0039  *
0040  * Since: 1.16
0041  */
0042 #define PANGO_ANALYSIS_FLAG_CENTERED_BASELINE (1 << 0)
0043 
0044 /**
0045  * PANGO_ANALYSIS_FLAG_IS_ELLIPSIS:
0046  *
0047  * Whether this run holds ellipsized text.
0048  *
0049  * Since: 1.36.7
0050  */
0051 #define PANGO_ANALYSIS_FLAG_IS_ELLIPSIS (1 << 1)
0052 
0053 /**
0054  * PANGO_ANALYSIS_FLAG_NEED_HYPHEN:
0055  *
0056  * Whether to add a hyphen at the end of the run during shaping.
0057  *
0058  * Since: 1.44
0059  */
0060 #define PANGO_ANALYSIS_FLAG_NEED_HYPHEN (1 << 2)
0061 
0062 /**
0063  * PangoAnalysis:
0064  * @shape_engine: unused, reserved
0065  * @lang_engine: unused, reserved
0066  * @font: the font for this segment.
0067  * @level: the bidirectional level for this segment.
0068  * @gravity: the glyph orientation for this segment (A `PangoGravity`).
0069  * @flags: boolean flags for this segment (Since: 1.16).
0070  * @script: the detected script for this segment (A `PangoScript`) (Since: 1.18).
0071  * @language: the detected language for this segment.
0072  * @extra_attrs: extra attributes for this segment.
0073  *
0074  * The `PangoAnalysis` structure stores information about
0075  * the properties of a segment of text.
0076  */
0077 struct _PangoAnalysis
0078 {
0079 #ifndef __GI_SCANNER__
0080   PangoEngineShape *shape_engine;
0081   PangoEngineLang  *lang_engine;
0082 #else
0083   gpointer shape_engine;
0084   gpointer lang_engine;
0085 #endif
0086   PangoFont *font;
0087 
0088   guint8 level;
0089   guint8 gravity;
0090   guint8 flags;
0091 
0092   guint8 script;
0093   PangoLanguage *language;
0094 
0095   GSList *extra_attrs;
0096 };
0097 
0098 /**
0099  * PangoItem:
0100  * @offset: byte offset of the start of this item in text.
0101  * @length: length of this item in bytes.
0102  * @num_chars: number of Unicode characters in the item.
0103  * @analysis: analysis results for the item.
0104  *
0105  * The `PangoItem` structure stores information about a segment of text.
0106  *
0107  * You typically obtain `PangoItems` by itemizing a piece of text
0108  * with [func@itemize].
0109  */
0110 struct _PangoItem
0111 {
0112   int offset;
0113   int length;
0114   int num_chars;
0115   PangoAnalysis analysis;
0116 };
0117 
0118 #define PANGO_TYPE_ITEM (pango_item_get_type ())
0119 
0120 PANGO_AVAILABLE_IN_ALL
0121 GType                   pango_item_get_type          (void) G_GNUC_CONST;
0122 
0123 PANGO_AVAILABLE_IN_ALL
0124 PangoItem *             pango_item_new               (void);
0125 PANGO_AVAILABLE_IN_ALL
0126 PangoItem *             pango_item_copy              (PangoItem         *item);
0127 PANGO_AVAILABLE_IN_ALL
0128 void                    pango_item_free              (PangoItem         *item);
0129 
0130 
0131 PANGO_AVAILABLE_IN_1_54
0132 int                     pango_item_get_char_offset   (PangoItem         *item);
0133 
0134 PANGO_AVAILABLE_IN_ALL
0135 PangoItem *             pango_item_split             (PangoItem         *orig,
0136                                                       int                split_index,
0137                                                       int                split_offset);
0138 
0139 PANGO_AVAILABLE_IN_1_44
0140 void                    pango_item_apply_attrs       (PangoItem         *item,
0141                                                       PangoAttrIterator *iter);
0142 
0143 PANGO_AVAILABLE_IN_ALL
0144 GList *                 pango_reorder_items          (GList             *items);
0145 
0146 /* Itemization */
0147 
0148 PANGO_AVAILABLE_IN_ALL
0149 GList *                 pango_itemize                (PangoContext      *context,
0150                                                       const char        *text,
0151                                                       int                start_index,
0152                                                       int                length,
0153                                                       PangoAttrList     *attrs,
0154                                                       PangoAttrIterator *cached_iter);
0155 
0156 PANGO_AVAILABLE_IN_1_4
0157 GList *                 pango_itemize_with_base_dir  (PangoContext      *context,
0158                                                       PangoDirection     base_dir,
0159                                                       const char        *text,
0160                                                       int                start_index,
0161                                                       int                length,
0162                                                       PangoAttrList     *attrs,
0163                                                       PangoAttrIterator *cached_iter);
0164 
0165 G_END_DECLS
0166 
0167 #endif /* __PANGO_ITEM_H__ */