1 // Generated by gmmproc 2.49.5 -- DO NOT MODIFY!
2 
3 
4 #include <glibmm.h>
5 
6 #include <pangomm/glyphstring.h>
7 #include <pangomm/private/glyphstring_p.h>
8 
9 
10 // -*- c++ -*-
11 /* $Id: glyphstring.ccg,v 1.2 2006/05/30 17:14:21 murrayc Exp $ */
12 
13 /*
14  *
15  * Copyright 1998-2002 The gtkmm Development Team
16  *
17  * This library is free software; you can redistribute it and/or
18  * modify it under the terms of the GNU Lesser General Public
19  * License as published by the Free Software Foundation; either
20  * version 2.1 of the License, or (at your option) any later version.
21  *
22  * This library is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25  * Lesser General Public License for more details.
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free
29  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30  */
31 
32 #include <glibmm/utility.h>
33 #include <pango/pangocairo.h>
34 
35 namespace Pango
36 {
37 
GlyphString(const Glib::ustring & text,const Analysis & analysis)38 GlyphString::GlyphString(const Glib::ustring& text, const Analysis& analysis)
39 :
40   gobject_(pango_glyph_string_new())
41 {
42   pango_shape(text.c_str(), text.bytes(), const_cast<PangoAnalysis*>(analysis.gobj()), gobj());
43 }
44 
get_ink_extents(const Glib::RefPtr<const Font> & font) const45 Rectangle GlyphString::get_ink_extents(const Glib::RefPtr<const Font>& font) const
46 {
47   Rectangle ink_rect;
48   pango_glyph_string_extents(const_cast<PangoGlyphString*>(gobj()), const_cast<PangoFont*>(font->gobj()), ink_rect.gobj(), 0);
49   return ink_rect;
50 }
51 
get_ink_extents(int start,int end,const Glib::RefPtr<const Font> & font) const52 Rectangle GlyphString::get_ink_extents(int start, int end, const Glib::RefPtr<const Font>& font) const
53 {
54   Rectangle ink_rect;
55   pango_glyph_string_extents_range(const_cast<PangoGlyphString*>(gobj()), start, end, const_cast<PangoFont*>(font->gobj()), ink_rect.gobj(), 0);
56   return ink_rect;
57 }
58 
get_logical_extents(const Glib::RefPtr<const Font> & font) const59 Rectangle GlyphString::get_logical_extents(const Glib::RefPtr<const Font>& font) const
60 {
61   Rectangle logical_rect;
62   pango_glyph_string_extents(const_cast<PangoGlyphString*>(gobj()), const_cast<PangoFont*>(font->gobj()), 0, logical_rect.gobj());
63   return logical_rect;
64 }
65 
get_logical_extents(int start,int end,const Glib::RefPtr<const Font> & font) const66 Rectangle GlyphString::get_logical_extents(int start, int end, const Glib::RefPtr<const Font>& font) const
67 {
68   Rectangle logical_rect;
69   pango_glyph_string_extents_range(const_cast<PangoGlyphString*>(gobj()), start, end, const_cast<PangoFont*>(font->gobj()), 0, logical_rect.gobj());
70   return logical_rect;
71 }
72 
get_logical_widths(const Glib::ustring & text,int embedding_level) const73 Glib::ArrayHandle<int> GlyphString::get_logical_widths(const Glib::ustring& text, int embedding_level) const
74 {
75   int* logical_widths = g_new(int, text.length());
76   pango_glyph_string_get_logical_widths(const_cast<PangoGlyphString*>(gobj()), text.c_str(), text.bytes(), embedding_level, logical_widths);
77   return Glib::ArrayHandle<int>(logical_widths, text.length(), Glib::OWNERSHIP_SHALLOW);
78 }
79 
index_to_x(const Glib::ustring & text,const Analysis & analysis,int index,bool trailing) const80 int GlyphString::index_to_x(const Glib::ustring& text, const Analysis& analysis, int index, bool trailing) const
81 {
82   int x_pos;
83   pango_glyph_string_index_to_x(const_cast<PangoGlyphString*>(gobj()), const_cast<gchar*>(text.c_str()), text.bytes(), const_cast<PangoAnalysis*>(analysis.gobj()), index, static_cast<int>(trailing), &x_pos);
84   return x_pos;
85 }
86 
x_to_index(const Glib::ustring & text,const Analysis & analysis,int x_pos,int & index,bool & trailing) const87 void GlyphString::x_to_index(const Glib::ustring& text, const Analysis& analysis, int x_pos, int& index, bool& trailing) const
88 {
89   gboolean trailing_temp = FALSE;
90   pango_glyph_string_x_to_index(const_cast<PangoGlyphString*>(gobj()), const_cast<char*>(text.c_str()), text.bytes(), const_cast<PangoAnalysis*>(analysis.gobj()), x_pos, &index, &trailing_temp);
91   trailing = trailing_temp;
92 }
93 
get_glyphs() const94 Glib::ArrayHandle<GlyphInfo> GlyphString::get_glyphs() const
95 {
96   return Glib::ArrayHandle<GlyphInfo>(reinterpret_cast<GlyphInfo*>(gobj()->glyphs), gobj()->num_glyphs, Glib::OWNERSHIP_NONE);
97 }
98 
99 } //namespace Pango
100 
101 namespace
102 {
103 } // anonymous namespace
104 
105 
106 namespace Glib
107 {
108 
wrap(PangoGlyphString * object,bool take_copy)109 Pango::GlyphString wrap(PangoGlyphString* object, bool take_copy)
110 {
111   return Pango::GlyphString(object, take_copy);
112 }
113 
114 } // namespace Glib
115 
116 
117 namespace Pango
118 {
119 
120 
121 // static
get_type()122 GType GlyphString::get_type()
123 {
124   return pango_glyph_string_get_type();
125 }
126 
GlyphString()127 GlyphString::GlyphString()
128 :
129   gobject_ (pango_glyph_string_new())
130 {}
131 
GlyphString(const GlyphString & other)132 GlyphString::GlyphString(const GlyphString& other)
133 :
134   gobject_ ((other.gobject_) ? pango_glyph_string_copy(other.gobject_) : nullptr)
135 {}
136 
GlyphString(GlyphString && other)137 GlyphString::GlyphString(GlyphString&& other) noexcept
138 :
139   gobject_(other.gobject_)
140 {
141   other.gobject_ = nullptr;
142 }
143 
operator =(GlyphString && other)144 GlyphString& GlyphString::operator=(GlyphString&& other) noexcept
145 {
146   GlyphString temp (other);
147   swap(temp);
148   return *this;
149 }
150 
GlyphString(PangoGlyphString * gobject,bool make_a_copy)151 GlyphString::GlyphString(PangoGlyphString* gobject, bool make_a_copy)
152 :
153   // For BoxedType wrappers, make_a_copy is true by default.  The static
154   // BoxedType wrappers must always take a copy, thus make_a_copy = true
155   // ensures identical behaviour if the default argument is used.
156   gobject_ ((make_a_copy && gobject) ? pango_glyph_string_copy(gobject) : gobject)
157 {}
158 
operator =(const GlyphString & other)159 GlyphString& GlyphString::operator=(const GlyphString& other)
160 {
161   GlyphString temp (other);
162   swap(temp);
163   return *this;
164 }
165 
~GlyphString()166 GlyphString::~GlyphString() noexcept
167 {
168   if(gobject_)
169     pango_glyph_string_free(gobject_);
170 }
171 
swap(GlyphString & other)172 void GlyphString::swap(GlyphString& other) noexcept
173 {
174   std::swap(gobject_, other.gobject_);
175 }
176 
gobj_copy() const177 PangoGlyphString* GlyphString::gobj_copy() const
178 {
179   return pango_glyph_string_copy(gobject_);
180 }
181 
182 
set_size(int new_len)183 void GlyphString::set_size(int new_len)
184 {
185   pango_glyph_string_set_size(gobj(), new_len);
186 }
187 
get_extents(const Glib::RefPtr<const Font> & font,Rectangle & ink_rect,Rectangle & logical_rect) const188 void GlyphString::get_extents(const Glib::RefPtr<const Font>& font, Rectangle& ink_rect, Rectangle& logical_rect) const
189 {
190   pango_glyph_string_extents(const_cast<PangoGlyphString*>(gobj()), const_cast<PangoFont*>(Glib::unwrap<Font>(font)), (ink_rect).gobj(), (logical_rect).gobj());
191 }
192 
get_extents(int start,int end,const Glib::RefPtr<const Font> & font,Rectangle & ink_rect,Rectangle & logical_rect) const193 void GlyphString::get_extents(int start, int end, const Glib::RefPtr<const Font>& font, Rectangle& ink_rect, Rectangle& logical_rect) const
194 {
195   pango_glyph_string_extents_range(const_cast<PangoGlyphString*>(gobj()), start, end, const_cast<PangoFont*>(Glib::unwrap<Font>(font)), (ink_rect).gobj(), (logical_rect).gobj());
196 }
197 
get_width() const198 int GlyphString::get_width() const
199 {
200   return pango_glyph_string_get_width(const_cast<PangoGlyphString*>(gobj()));
201 }
202 
203 
204 } // namespace Pango
205 
206 
207