// -*- c++ -*- /* $Id: context.ccg,v 1.3 2006/06/10 15:26:24 murrayc Exp $ */ /* * * Copyright 1998-1999 The Gtk-- Development Team * Copyright 2001 Free Software Foundation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include //For PANGO_MATRIX_INIT namespace Pango { Glib::ArrayHandle< Glib::RefPtr > Context::list_families() const { //Get array: PangoFontFamily** pFamilies = 0; int n_families = 0; pango_context_list_families(const_cast(gobj()), &pFamilies, &n_families); return Glib::ArrayHandle< Glib::RefPtr > (pFamilies, n_families, Glib::OWNERSHIP_SHALLOW); } Pango::FontMetrics Context::get_metrics(const FontDescription& desc) const { return FontMetrics(pango_context_get_metrics(const_cast(gobj()), desc.gobj(), 0)); } ListHandle_Item Context::itemize(const Glib::ustring& text, const AttrList& attrs) const { return ListHandle_Item( pango_itemize(const_cast(gobj()), text.c_str(), 0, text.bytes(), const_cast(attrs.gobj()), 0), Glib::OWNERSHIP_DEEP); } ListHandle_Item Context::itemize(const Glib::ustring& text, int start_index, int length, const AttrList& attrs, AttrIter& cached_iter) const { return ListHandle_Item( pango_itemize(const_cast(gobj()), text.c_str(), start_index, length, const_cast(attrs.gobj()), cached_iter.gobj()), Glib::OWNERSHIP_DEEP); } void Context::update_from_cairo_context(const Cairo::RefPtr& context) { pango_cairo_update_context(context->cobj(), gobj()); } Matrix Context::get_matrix() const { const PangoMatrix* matrix = pango_context_get_matrix(const_cast(gobj())); if(matrix) return *matrix; else { PangoMatrix identity_transform = PANGO_MATRIX_INIT; return identity_transform; } } } /* namespace Pango */