Blame pango/pangomm/glyphstring.h

Packit 78284e
// Generated by gmmproc 2.49.5 -- DO NOT MODIFY!
Packit 78284e
#ifndef _PANGOMM_GLYPHSTRING_H
Packit 78284e
#define _PANGOMM_GLYPHSTRING_H
Packit 78284e
Packit 78284e
Packit 78284e
#include <glibmm/ustring.h>
Packit 78284e
#include <sigc++/sigc++.h>
Packit 78284e
Packit 78284e
/* $Id: glyphstring.hg,v 1.2 2006/05/30 17:14:21 murrayc Exp $ */
Packit 78284e
Packit 78284e
/* glyphstring.h
Packit 78284e
 *
Packit 78284e
 * Copyright (C) 1998-1999 The gtkmm Development Team
Packit 78284e
 *
Packit 78284e
 * This library is free software; you can redistribute it and/or
Packit 78284e
 * modify it under the terms of the GNU Lesser General Public
Packit 78284e
 * License as published by the Free Software Foundation; either
Packit 78284e
 * version 2.1 of the License, or (at your option) any later version.
Packit 78284e
 *
Packit 78284e
 * This library is distributed in the hope that it will be useful,
Packit 78284e
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 78284e
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 78284e
 * Lesser General Public License for more details.
Packit 78284e
 *
Packit 78284e
 * You should have received a copy of the GNU Lesser General Public
Packit 78284e
 * License along with this library; if not, write to the Free
Packit 78284e
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Packit 78284e
 */
Packit 78284e
Packit 78284e
#include <pangomm/font.h>
Packit 78284e
#include <pangomm/glyph.h>
Packit 78284e
#include <pangomm/item.h>
Packit 78284e
#include <cairomm/context.h>
Packit 78284e
#include <pango/pango-glyph.h>
Packit 78284e
#include <pango/pango-item.h> //For PangoAnalysis.
Packit 78284e
Packit 78284e
Packit 78284e
#ifndef DOXYGEN_SHOULD_SKIP_THIS
Packit 78284e
extern "C" { typedef struct _PangoGlyphString PangoGlyphString; }
Packit 78284e
#endif
Packit 78284e
Packit 78284e
namespace Pango
Packit 78284e
{
Packit 78284e
Packit 78284e
/** A Pango::GlyphString is used to store strings of glyphs with geometry and visual attribute information.
Packit 78284e
 * It can be measured or drawn to the screen.
Packit 78284e
 */
Packit 78284e
class GlyphString
Packit 78284e
{
Packit 78284e
  public:
Packit 78284e
#ifndef DOXYGEN_SHOULD_SKIP_THIS
Packit 78284e
  using CppObjectType = GlyphString;
Packit 78284e
  using BaseObjectType = PangoGlyphString;
Packit 78284e
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
Packit 78284e
Packit 78284e
  /** Get the GType for this class, for use with the underlying GObject type system.
Packit 78284e
   */
Packit 78284e
  static GType get_type() G_GNUC_CONST;
Packit 78284e
Packit 78284e
  GlyphString();
Packit 78284e
Packit 78284e
  explicit GlyphString(PangoGlyphString* gobject, bool make_a_copy = true);
Packit 78284e
Packit 78284e
  GlyphString(const GlyphString& other);
Packit 78284e
  GlyphString& operator=(const GlyphString& other);
Packit 78284e
Packit 78284e
  GlyphString(GlyphString&& other) noexcept;
Packit 78284e
  GlyphString& operator=(GlyphString&& other) noexcept;
Packit 78284e
Packit 78284e
  ~GlyphString() noexcept;
Packit 78284e
Packit 78284e
  void swap(GlyphString& other) noexcept;
Packit 78284e
Packit 78284e
  ///Provides access to the underlying C instance.
Packit 78284e
  PangoGlyphString*       gobj()       { return gobject_; }
Packit 78284e
Packit 78284e
  ///Provides access to the underlying C instance.
Packit 78284e
  const PangoGlyphString* gobj() const { return gobject_; }
Packit 78284e
Packit 78284e
  ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
Packit 78284e
  PangoGlyphString* gobj_copy() const;
Packit 78284e
Packit 78284e
protected:
Packit 78284e
  PangoGlyphString* gobject_;
Packit 78284e
Packit 78284e
private:
Packit 78284e
Packit 78284e
  //gtkmmproc error: pango_glyph_string_copy_static : ignored method defs lookup failed//gtkmmproc error: pango_glyph_string_equal : ignored method defs lookup failed
Packit 78284e
  
Packit 78284e
Packit 78284e
public:
Packit 78284e
  /** Construct a string of glyphs from a string of characters.
Packit 78284e
   * Given a segment of text and the corresponding Pango::Analysis structure
Packit 78284e
   * returned from Pango::Context::itemize(), convert the characters into glyphs.
Packit 78284e
   * You may also pass in only a sub-string of the item.
Packit 78284e
   * @param text The text to process. You must pass the same string into those member functions expecting a const Glib::ustring&.
Packit 78284e
   * @param analysis The analysis information return from Pango::Context::itemize().
Packit 78284e
   */
Packit 78284e
  GlyphString(const Glib::ustring& text, const Analysis& analysis);
Packit 78284e
Packit 78284e
  
Packit 78284e
  /** Resize a glyph string to the given length.
Packit 78284e
   * 
Packit 78284e
   * @param new_len The new length of the string.
Packit 78284e
   */
Packit 78284e
  void set_size(int new_len);
Packit 78284e
Packit 78284e
  
Packit 78284e
  /** Compute the logical and ink extents of a glyph string. See the documentation
Packit 78284e
   * for Pango::Font::get_glyph_extents() for details about the interpretation
Packit 78284e
   * of the rectangles.
Packit 78284e
   * 
Packit 78284e
   * @param font A Pango::Font.
Packit 78284e
   * @param ink_rect Rectangle used to store the extents of the glyph string as drawn.
Packit 78284e
   * @param logical_rect Rectangle used to store the logical extents of the glyph string.
Packit 78284e
   */
Packit 78284e
  void get_extents(const Glib::RefPtr<const Font>& font, Rectangle& ink_rect, Rectangle& logical_rect) const;
Packit 78284e
  
Packit 78284e
  /** Computes the extents of a sub-portion of a glyph string. The extents are
Packit 78284e
   * relative to the start of the glyph string range (the origin of their
Packit 78284e
   * coordinate system is at the start of the range, not at the start of the entire
Packit 78284e
   * glyph string).
Packit 78284e
   * 
Packit 78284e
   * @param start Start index.
Packit 78284e
   * @param end End index (the range is the set of bytes with
Packit 78284e
   *               indices such that start <= index < end).
Packit 78284e
   * @param font A Pango::Font.
Packit 78284e
   * @param ink_rect Rectangle used to store the extents of the glyph string range as drawn.
Packit 78284e
   * @param logical_rect Rectangle used to store the logical extents of the glyph string range.
Packit 78284e
   */
Packit 78284e
  void get_extents(int start, int end, const Glib::RefPtr<const Font>& font, Rectangle& ink_rect, Rectangle& logical_rect) const;
Packit 78284e
Packit 78284e
  
Packit 78284e
  /** Computes the logical width of the glyph string as can also be computed
Packit 78284e
   * using extents().  However, since this only computes the
Packit 78284e
   * width, it's much faster.  This is in fact only a convenience function that
Packit 78284e
   * computes the sum of geometry.width for each glyph in the @a glyphs.
Packit 78284e
   * 
Packit 78284e
   * @newin{1,14}
Packit 78284e
   * 
Packit 78284e
   * @return The logical width of the glyph string.
Packit 78284e
   */
Packit 78284e
  int get_width() const;
Packit 78284e
Packit 78284e
  /** Computes the extents of the glyph string as drawn.
Packit 78284e
   * @param font A Pango::Font.
Packit 78284e
   * @return The extents of the glyph string as drawn.
Packit 78284e
   */
Packit 78284e
  Rectangle get_ink_extents(const Glib::RefPtr<const Font>& font) const;
Packit 78284e
Packit 78284e
  /** Computes the extents of a sub-portion of the glyph string as drawn.
Packit 78284e
   * @param start The start index.
Packit 78284e
   * @param end The end index.
Packit 78284e
   * @param font A Panog::Font
Packit 78284e
   * @return The extents of the sub-portion of the glyph string as drawn.
Packit 78284e
   */
Packit 78284e
  Rectangle get_ink_extents(int start, int end, const Glib::RefPtr<const Font>& font) const;
Packit 78284e
Packit 78284e
  /** Computes the logical extents of a sub-portion of the glyph string.
Packit 78284e
   * @param font A Pango::Font.
Packit 78284e
   * @return The logical extents of the glyph string.
Packit 78284e
   */
Packit 78284e
  Rectangle get_logical_extents(const Glib::RefPtr<const Font>& font) const;
Packit 78284e
Packit 78284e
  /** Computes the logical extents of a sub-portion of the glyph string.
Packit 78284e
   * @param start The start index.
Packit 78284e
   * @param end The end index.
Packit 78284e
   * @param font A Pango::Font.
Packit 78284e
   * @return The logical extents of the sub-portion of the glyph string.
Packit 78284e
   */
Packit 78284e
  Rectangle get_logical_extents(int start, int end, const Glib::RefPtr<const Font>& font) const;
Packit 78284e
Packit 78284e
  /** Determine the screen width corresponding to each character.
Packit 78284e
   * When multiple characters compose a single cluster, the width of the entire cluster
Packit 78284e
   * is divided equally among the characters.
Packit 78284e
   * @param text The text corresponding to the glyphs.
Packit 78284e
   * @param embedding_level The embedding level of the string.
Packit 78284e
   * @return An array of integers representing the resulting character widths.
Packit 78284e
   */
Packit 78284e
  Glib::ArrayHandle<int> get_logical_widths(const Glib::ustring& text, int embedding_level) const;
Packit 78284e
Packit 78284e
  /** Converts from character position to x position.
Packit 78284e
   * (X position is measured from the left edge of the run). Character positions are computed by dividing up each cluster into equal portions.
Packit 78284e
   * @param text The text corresponding to the glyphs.
Packit 78284e
   * @param analysis The analysis information return from Pango::Context::itemize().
Packit 78284e
   * @param index The byte index within text.
Packit 78284e
   * @param trailing Whether we should compute the result for the beginning or end of the character.
Packit 78284e
   * @return The x position.
Packit 78284e
   */
Packit 78284e
  int index_to_x(const Glib::ustring& text, const Analysis& analysis, int index, bool trailing) const;
Packit 78284e
Packit 78284e
  /** Convert from x offset to character position.
Packit 78284e
   * Character positions are computed by dividing up each cluster into equal portions.
Packit 78284e
   * In scripts where positioning within a cluster is not allowed (such as Thai),
Packit 78284e
   * the returned value may not be a valid cursor position; the caller must combine the
Packit 78284e
   * result with the logical attributes for the text to compute the valid cursor position.
Packit 78284e
   * @param text The text corresponding to the glyphs.
Packit 78284e
   * @param analysis The analysis information return from Pango::Context::itemize().
Packit 78284e
   * @param x_pos The x offset (in thousands of a device unit).
Packit 78284e
   * @param index The location to store calculated byte index within.
Packit 78284e
   * @param trailing The location to store a boolean indicating whether the user clicked on the leading or trailing edge of the character.
Packit 78284e
   */
Packit 78284e
  void x_to_index(const Glib::ustring& text, const Analysis& analysis, int x_pos, int& index, bool& trailing) const;
Packit 78284e
Packit 78284e
  /** Gharacter positions are computed by dividing up each cluster into equal portions.
Packit 78284e
   * @return An array of Pango::GlyphInfo objects.
Packit 78284e
   */
Packit 78284e
  Glib::ArrayHandle<GlyphInfo> get_glyphs() const;
Packit 78284e
Packit 78284e
  //TODO: 
Packit 78284e
  //void        pango_cairo_glyph_string_path   (cairo_t *cr,
Packit 78284e
  //                                         PangoFont *font,
Packit 78284e
  //                                         PangoGlyphString *glyphs);
Packit 78284e
Packit 78284e
Packit 78284e
};
Packit 78284e
Packit 78284e
} //namespace Pango
Packit 78284e
Packit 78284e
Packit 78284e
namespace Pango
Packit 78284e
{
Packit 78284e
Packit 78284e
/** @relates Pango::GlyphString
Packit 78284e
 * @param lhs The left-hand side
Packit 78284e
 * @param rhs The right-hand side
Packit 78284e
 */
Packit 78284e
inline void swap(GlyphString& lhs, GlyphString& rhs) noexcept
Packit 78284e
  { lhs.swap(rhs); }
Packit 78284e
Packit 78284e
} // namespace Pango
Packit 78284e
Packit 78284e
namespace Glib
Packit 78284e
{
Packit 78284e
Packit 78284e
/** A Glib::wrap() method for this object.
Packit 78284e
 *
Packit 78284e
 * @param object The C instance.
Packit 78284e
 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
Packit 78284e
 * @result A C++ instance that wraps this C instance.
Packit 78284e
 *
Packit 78284e
 * @relates Pango::GlyphString
Packit 78284e
 */
Packit 78284e
Pango::GlyphString wrap(PangoGlyphString* object, bool take_copy = false);
Packit 78284e
Packit 78284e
#ifndef DOXYGEN_SHOULD_SKIP_THIS
Packit 78284e
template <>
Packit 78284e
class Value<Pango::GlyphString> : public Glib::Value_Boxed<Pango::GlyphString>
Packit 78284e
{};
Packit 78284e
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
Packit 78284e
Packit 78284e
} // namespace Glib
Packit 78284e
Packit 78284e
Packit 78284e
#endif /* _PANGOMM_GLYPHSTRING_H */
Packit 78284e