| 1 | /* Pango |
| 2 | * pango-item.h: Structure for storing run information |
| 3 | * |
| 4 | * Copyright (C) 2000 Red Hat Software |
| 5 | * |
| 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. |
| 10 | * |
| 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. |
| 15 | * |
| 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. |
| 20 | */ |
| 21 | |
| 22 | #ifndef __PANGO_ITEM_H__ |
| 23 | #define __PANGO_ITEM_H__ |
| 24 | |
| 25 | #include <pango/pango-types.h> |
| 26 | #include <pango/pango-attributes.h> |
| 27 | |
| 28 | G_BEGIN_DECLS |
| 29 | |
| 30 | typedef struct _PangoAnalysis PangoAnalysis; |
| 31 | typedef struct _PangoItem PangoItem; |
| 32 | |
| 33 | /** |
| 34 | * PANGO_ANALYSIS_FLAG_CENTERED_BASELINE: |
| 35 | * |
| 36 | * Whether the segment should be shifted to center around the baseline. |
| 37 | * |
| 38 | * This is mainly used in vertical writing directions. |
| 39 | * |
| 40 | * Since: 1.16 |
| 41 | */ |
| 42 | #define PANGO_ANALYSIS_FLAG_CENTERED_BASELINE (1 << 0) |
| 43 | |
| 44 | /** |
| 45 | * PANGO_ANALYSIS_FLAG_IS_ELLIPSIS: |
| 46 | * |
| 47 | * Whether this run holds ellipsized text. |
| 48 | * |
| 49 | * Since: 1.36.7 |
| 50 | */ |
| 51 | #define PANGO_ANALYSIS_FLAG_IS_ELLIPSIS (1 << 1) |
| 52 | |
| 53 | /** |
| 54 | * PANGO_ANALYSIS_FLAG_NEED_HYPHEN: |
| 55 | * |
| 56 | * Whether to add a hyphen at the end of the run during shaping. |
| 57 | * |
| 58 | * Since: 1.44 |
| 59 | */ |
| 60 | #define PANGO_ANALYSIS_FLAG_NEED_HYPHEN (1 << 2) |
| 61 | |
| 62 | /** |
| 63 | * PangoAnalysis: |
| 64 | * @shape_engine: unused, reserved |
| 65 | * @lang_engine: unused, reserved |
| 66 | * @font: the font for this segment. |
| 67 | * @level: the bidirectional level for this segment. |
| 68 | * @gravity: the glyph orientation for this segment (A `PangoGravity`). |
| 69 | * @flags: boolean flags for this segment (Since: 1.16). |
| 70 | * @script: the detected script for this segment (A `PangoScript`) (Since: 1.18). |
| 71 | * @language: the detected language for this segment. |
| 72 | * @extra_attrs: extra attributes for this segment. |
| 73 | * |
| 74 | * The `PangoAnalysis` structure stores information about |
| 75 | * the properties of a segment of text. |
| 76 | */ |
| 77 | struct _PangoAnalysis |
| 78 | { |
| 79 | #ifndef __GI_SCANNER__ |
| 80 | PangoEngineShape *shape_engine; |
| 81 | PangoEngineLang *lang_engine; |
| 82 | #else |
| 83 | gpointer shape_engine; |
| 84 | gpointer lang_engine; |
| 85 | #endif |
| 86 | PangoFont *font; |
| 87 | |
| 88 | guint8 level; |
| 89 | guint8 gravity; |
| 90 | guint8 flags; |
| 91 | |
| 92 | guint8 script; |
| 93 | PangoLanguage *language; |
| 94 | |
| 95 | GSList *; |
| 96 | }; |
| 97 | |
| 98 | /** |
| 99 | * PangoItem: |
| 100 | * @offset: byte offset of the start of this item in text. |
| 101 | * @length: length of this item in bytes. |
| 102 | * @num_chars: number of Unicode characters in the item. |
| 103 | * @char_offset: character offset of the start of this item in text. Since 1.50 |
| 104 | * @analysis: analysis results for the item. |
| 105 | * |
| 106 | * The `PangoItem` structure stores information about a segment of text. |
| 107 | * |
| 108 | * You typically obtain `PangoItems` by itemizing a piece of text |
| 109 | * with [func@itemize]. |
| 110 | */ |
| 111 | struct _PangoItem |
| 112 | { |
| 113 | int offset; |
| 114 | int length; |
| 115 | int num_chars; |
| 116 | PangoAnalysis analysis; |
| 117 | }; |
| 118 | |
| 119 | #define PANGO_TYPE_ITEM (pango_item_get_type ()) |
| 120 | |
| 121 | PANGO_AVAILABLE_IN_ALL |
| 122 | GType pango_item_get_type (void) G_GNUC_CONST; |
| 123 | |
| 124 | PANGO_AVAILABLE_IN_ALL |
| 125 | PangoItem * pango_item_new (void); |
| 126 | PANGO_AVAILABLE_IN_ALL |
| 127 | PangoItem * pango_item_copy (PangoItem *item); |
| 128 | PANGO_AVAILABLE_IN_ALL |
| 129 | void pango_item_free (PangoItem *item); |
| 130 | |
| 131 | PANGO_AVAILABLE_IN_ALL |
| 132 | PangoItem * pango_item_split (PangoItem *orig, |
| 133 | int split_index, |
| 134 | int split_offset); |
| 135 | |
| 136 | PANGO_AVAILABLE_IN_1_44 |
| 137 | void pango_item_apply_attrs (PangoItem *item, |
| 138 | PangoAttrIterator *iter); |
| 139 | |
| 140 | PANGO_AVAILABLE_IN_ALL |
| 141 | GList * pango_reorder_items (GList *items); |
| 142 | |
| 143 | /* Itemization */ |
| 144 | |
| 145 | PANGO_AVAILABLE_IN_ALL |
| 146 | GList * pango_itemize (PangoContext *context, |
| 147 | const char *text, |
| 148 | int start_index, |
| 149 | int length, |
| 150 | PangoAttrList *attrs, |
| 151 | PangoAttrIterator *cached_iter); |
| 152 | |
| 153 | PANGO_AVAILABLE_IN_1_4 |
| 154 | GList * pango_itemize_with_base_dir (PangoContext *context, |
| 155 | PangoDirection base_dir, |
| 156 | const char *text, |
| 157 | int start_index, |
| 158 | int length, |
| 159 | PangoAttrList *attrs, |
| 160 | PangoAttrIterator *cached_iter); |
| 161 | |
| 162 | |
| 163 | G_END_DECLS |
| 164 | |
| 165 | #endif /* __PANGO_ITEM_H__ */ |
| 166 | |