1 /*
2  * Distributed under the Boost Software License, Version 1.0.
3  *    (See accompanying file LICENSE_1_0.txt or copy at
4  *          http://www.boost.org/LICENSE_1_0.txt)
5  */
6 module pango.item;
7 
8 import pango.utils;
9 import pango.font;
10 import pango.glyph;
11 import pango.language;
12 import pango.script;
13 import pango.gravity;
14 import pango.c.item;
15 
16 import glib;
17 import gobject;
18 
19 ///**
20 // * PANGO_ANALYSIS_FLAG_CENTERED_BASELINE:
21 // *
22 // * Whether the segment should be shifted to center around the baseline.
23 // * Used in vertical writing directions mostly.
24 // *
25 // * Since: 1.16
26 // */
27 //enum PANGO_ANALYSIS_FLAG_CENTERED_BASELINE = (1 << 0);
28 enum AnalysisFlagCenteredBaseline = PANGO_ANALYSIS_FLAG_CENTERED_BASELINE;
29 
30 ///**
31 // * PANGO_ANALYSIS_FLAG_IS_ELLIPSIS:
32 // *
33 // * This flag is used to mark runs that hold ellipsized text,
34 // * in an ellipsized layout.
35 // *
36 // * Since: 1.36.7
37 // */
38 //enum PANGO_ANALYSIS_FLAG_IS_ELLIPSIS = (1 << 1);
39 enum AnalysisFlagIsEllipsis = PANGO_ANALYSIS_FLAG_IS_ELLIPSIS;
40 
41 ///**
42 // * PangoAnalysis:
43 // * @shape_engine: the engine for doing rendering-system-dependent processing.
44 // * @lang_engine: the engine for doing rendering-system-independent processing.
45 // * @font: the font for this segment.
46 // * @level: the bidirectional level for this segment.
47 // * @gravity: the glyph orientation for this segment (A #PangoGravity).
48 // * @flags: boolean flags for this segment (currently only one) (Since: 1.16).
49 // * @script: the detected script for this segment (A #PangoScript) (Since: 1.18).
50 // * @language: the detected language for this segment.
51 // * @extra_attrs: extra attributes for this segment.
52 // *
53 // * The #PangoAnalysis structure stores information about
54 // * the properties of a segment of text.
55 // */
56 struct Analysis
57 {
58     PangoAnalysis pangoStruct;
59 
60     //PangoEngineShape *shape_engine;
61     //PangoEngineLang  *lang_engine;
62 
63     @property Font font() { return cast(Font)getExistingDObject(pangoStruct.font, Transfer.None); }
64     @property void font(Font f) { pangoStruct.font = f.nativePtr; }
65 
66     alias level = pangoStruct.level;
67 
68     @property Gravity gravity() { return cast(Gravity)pangoStruct.gravity; }
69     @property void gravity (Gravity gravity) { pangoStruct.gravity = cast(guint8)gravity; }
70 
71     alias flags = pangoStruct.flags;
72 
73     @property Script script() { return cast(Script)pangoStruct.script; }
74     @property void script (Script script) { pangoStruct.script = cast(guint8)script; }
75 
76     @property Language language() { return Language(pangoStruct.language); }
77     @property void language(Language language) { pangoStruct.language = language.nativePtr; }
78 
79     //GSList *extra_attrs;
80 }
81 
82 
83 
84 ///**
85 // * PangoItem:
86 // *
87 // * The #PangoItem structure stores information about a segment of text.
88 // */
89 //struct PangoItem
90 //{
91 //  gint offset;
92 //  gint length;
93 //  gint num_chars;
94 //  PangoAnalysis analysis;
95 //}
96 class Item {
97     mixin NativePtrHolder!(PangoItem, pango_item_free);
98 
99     package this(PangoItem *ptr, Transfer transfer) {
100         initialize(ptr, transfer);
101     }
102 
103     this() {
104         initialize(pango_item_new(), Transfer.Full);
105     }
106 
107     Item split(int splitIndex, int splitOffset) {
108         return getDObject!Item(pango_item_split(nativePtr, splitIndex, splitOffset), Transfer.Full);
109     }
110 }
111