00001 /* Copyright (C) 2006 The cairomm Development Team 00002 * 00003 * This library is free software; you can redistribute it and/or 00004 * modify it under the terms of the GNU Library General Public 00005 * License as published by the Free Software Foundation; either 00006 * version 2 of the License, or (at your option) any later version. 00007 * 00008 * This library is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Library General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Library General Public 00014 * License along with this library; if not, write to the Free Software 00015 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00016 * 02110-1301, USA. 00017 */ 00018 00019 #ifndef __CAIROMM_SCALEDFONT_H 00020 #define __CAIROMM_SCALEDFONT_H 00021 00022 #include <cairomm/context.h> 00023 #include <cairomm/fontoptions.h> 00024 00025 namespace Cairo 00026 { 00027 00028 typedef enum 00029 { 00030 } ScaledFontType; 00031 00036 class ScaledFont 00037 { 00038 00039 public: 00041 typedef cairo_scaled_font_t cobject; 00042 00044 inline cobject* cobj() { return m_cobject; } 00045 00047 inline const cobject* cobj() const { return m_cobject; } 00048 00049 #ifndef DOXYGEN_IGNORE_THIS 00050 // For use only by the cairomm implementation. 00051 inline ErrorStatus get_status() const 00052 { return cairo_scaled_font_status(const_cast<cairo_scaled_font_t*>(cobj())); } 00053 00054 // for RefPtr 00055 void reference() const { cairo_scaled_font_reference(m_cobject); } 00056 void unreference() const { cairo_scaled_font_destroy(m_cobject); } 00057 #endif //DOXYGEN_IGNORE_THIS 00058 00062 explicit ScaledFont(cobject* cobj, bool has_reference = false); 00063 00077 static RefPtr<ScaledFont> create(FontFace& font_face, const Matrix& font_matrix, 00078 const Matrix& ctm, const FontOptions& options); 00079 00080 //TODO: This should really be get_extents(). 00082 void extents(FontExtents& extents) const; 00083 00084 //TODO: This should really be get_text_extents(). 00105 void text_extents(const std::string& utf8, TextExtents& extents) const; 00106 00107 //TODO: This should really be get_glyph_extents(). 00121 void glyph_extents(const std::vector<Glyph>& glyphs, TextExtents& extents); 00122 00126 RefPtr<FontFace> get_font_face() const; 00127 00131 void get_font_options(FontOptions& options) const; 00132 00136 void get_font_matrix(Matrix& font_matrix) const; 00137 00141 void get_ctm(Matrix& ctm) const; 00142 00146 FontType get_type() const; 00147 00148 protected: 00150 cobject* m_cobject; 00151 }; 00152 00153 } 00154 00155 #endif // __CAIROMM_SCALEDFONT_H 00156 // vim: ts=2 sw=2 et