# win32_font.h

Go to the documentation of this file.

    00001 /* Copyright (C) 2008 Jonathon Jongsma
    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 #ifndef __CAIROMM_WIN32_FONT_H
    00019 #define __CAIROMM_WIN32_FONT_H
    00020
    00021 #include <cairo-features.h>
    00022
    00023 #ifdef CAIRO_HAS_WIN32_FONT
    00024 #include <cairo-win32.h>
    00025 #include <cairomm/fontface.h>
    00026 #include <cairomm/scaledfont.h>
    00027
    00028 namespace Cairo
    00029 {
    00030
    00035 class Win32FontFace : public FontFace
    00036 {
    00037 public:
    00038
    00049   static RefPtr<Win32FontFace> create(LOGFONTW* logfont);
    00050
    00058   static RefPtr<Win32FontFace> create(HFONT font);
    00059
    00073   static RefPtr<Win32FontFace> create(LOGFONTW* logfont, HFONT font);
    00074
    00075 protected:
    00076   Win32FontFace(LOGFONTW* logfont);
    00077   Win32FontFace(HFONT font);
    00078   Win32FontFace(LOGFONTW* logfont, HFONT font);
    00079 };
    00080
    00081
    00086 class Win32ScaledFont : public ScaledFont
    00087 {
    00088 public:
    00089
    00094   static RefPtr<Win32ScaledFont> create(const RefPtr<Win32FontFace>& font_face,
    00095                                         const Matrix& font_matrix,
    00096                                         const Matrix& ctm,
    00097                                         const FontOptions& options = FontOptions());
    00098
    00118   void select_font(HDC hdc);
    00119
    00124   void done_font();
    00125
    00134   double get_metrics_factor() const;
    00135
    00143   void get_logical_to_device(Matrix& logical_to_device) const;
    00144
    00152   void get_device_to_logical(Matrix& device_to_logical) const;
    00153
    00154 protected:
    00155   Win32ScaledFont(const RefPtr<Win32FontFace>& font_face,
    00156                   const Matrix& font_matrix,
    00157                   const Matrix& ctm,
    00158                   const FontOptions& options = FontOptions());
    00159 };
    00160
    00161 }
    00162
    00163 #endif // CAIRO_HAS_WIN32_FONT
    00164
    00165 #endif // __CAIROMM_WIN32_FONT_H