// This is -*- C++ -*-

/* 
 * font.h
 *
 * Copyright 1998 Karl E. Nelson
 *
 * 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., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 */
#ifndef _GDKMM_FONT_H_
#define _GDKMM_FONT_H_

#include <gdk--/types.h>

class Gdk_Font: public Gdk_Handle<GdkFont>
  {
   protected:

     // Internal for gdk reference counters
     virtual void ref();

     // Internal for gdk reference counters
     virtual void unref();

/* REQUIRED Handle Constructors and Destructors */
#ifdef GDKMM_HANDLES_CONNECTED_ONLY
   protected:
#else
   public:
#endif
     // Create a unconnected font.
     Gdk_Font();

   public:
     // Create a font handle from a GdkFont
     Gdk_Font(GdkFont *font);
  
     Gdk_Font(const Gdk_Font& font);

     // Create a font handle loaded with specific fontname.
     Gdk_Font(const string &font_name);

     // Destroy a font handle.
     ~Gdk_Font();

     void create(const string &font_name);

     /* Provided member functions */
     
     Gdk_Font& load(const string &font_name);

     Gdk_Font& set_load(const string &fontset_name);

     gint font_id() const;

     gint equal(const Gdk_Font  &font);

     gint height();

     gint string_width(const string &str);

     gint text_width(const string &text);

     gint char_width(gchar     character);

     gint string_measure(const string &str);

     gint text_measure(const string &text);

     gint char_measure(gchar     character);
#if GDK_VERSION_GT(1,0)
     gint string_height(const string &str);

     gint text_height(const string &text);

     gint char_height(gchar character);

     void string_extents (const string &str,
			  gint        &lbearing,
			  gint        &rbearing,
			  gint        &width,
			  gint        &ascent,
			  gint        &descent);

     void text_extents(const string &text,
                       gint length,
                       gint &lbearing,
                       gint &rbearing,
                       gint &width,
                       gint &ascent,
                       gint &descent);

     /* These wrappers are quit raw.  We need to review them later */
     gint text_width_wc(const GdkWChar* text,gint text_length);

     gint char_width_wc(GdkWChar character);

     void text_extents_wc( const GdkWChar *text,                              
                           gint            text_length,
                           gint           &lbearing,
                           gint           &rbearing,
                           gint           &width,
                           gint           &ascent,
                           gint           &descent);

#endif
  };

#endif //_GDKMM_FONT_H_
