Blob Blame History Raw
/* $Id: font.hg,v 1.2 2006/06/08 20:39:39 murrayc Exp $ */

/* font.h
 * 
 * Copyright (C) 1998-1999 The gtkmm Development Team 
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */


#include <glibmm/object.h>
#include <pangomm/rectangle.h>
#include <pangomm/language.h>
#include <pangomm/glyph.h>
#include <pangomm/fontdescription.h>
#include <pangomm/fontmetrics.h>
#include <pangomm/coverage.h>
#include <pango/pango-font.h>

_DEFS(pangomm,pango)
_PINCLUDE(glibmm/private/object_p.h)

namespace Pango
{

const int    SCALE          = 1024;
const double SCALE_XX_SMALL = 0.5787037037037;
const double SCALE_X_SMALL  = 0.6444444444444;
const double SCALE_SMALL    = 0.8333333333333;
const double SCALE_MEDIUM   = 1.0;
const double SCALE_LARGE    = 1.2;
const double SCALE_X_LARGE  = 1.4399999999999;
const double SCALE_XX_LARGE = 1.728;

#ifndef DOXYGEN_SHOULD_SKIP_THIS
class FontMap;
#endif //DOXYGEN_SHOULD_SKIP_THIS

/** A Pango::Font is used to represent a font in a rendering-system-independent matter.
 */
class Font : public Glib::Object
{
  _CLASS_GOBJECT(Font, PangoFont, PANGO_FONT, Glib::Object, GObject)
  _IGNORE(pango_font_find_shaper) //This would return a PangoEngineShape* but the definition of the struct is surrounded by #define PANGO_ENABLE_BACKEND [...] #endif. So don't wrap it.

public:
  _WRAP_METHOD(FontDescription describe() const, pango_font_describe)
  _WRAP_METHOD(FontDescription describe_with_absolute_size() const, pango_font_describe_with_absolute_size)
  _WRAP_METHOD(Glib::RefPtr<Coverage> get_coverage(const Language& language) const, pango_font_get_coverage)

  /** Gets overall metric information for a font.
   * The metrics may be substantially different for different scripts.
   * However, this function overload returns the metrics for the entire font.
   */
  FontMetrics get_metrics() const;
  _WRAP_METHOD(FontMetrics get_metrics(const Language& language) const, pango_font_get_metrics)

  _WRAP_METHOD(void get_glyph_extents(Glyph glyph, Rectangle& ink_rect, Rectangle& logical_rect) const, pango_font_get_glyph_extents)

  _WRAP_METHOD(Glib::RefPtr<FontMap> get_font_map(), pango_font_get_font_map)
  _WRAP_METHOD(Glib::RefPtr<const FontMap> get_font_map() const, pango_font_get_font_map, constversion)

  /** Get the ink extents of a glyph within the font.
   * @param glyph The glyph index.
   * @return The extents of the glyph as drawn.
   */
  Rectangle get_glyph_ink_extents(Glyph glyph) const;

  /** Gets the logical extents of a glyph within the font.
   * @param glyph The glyph index.
   * @return The logical extents of the glyph.
   */
  Rectangle get_glyph_logical_extents(Glyph glyph) const;
};

} /* namespace Pango */