2 * pangocairo-win32fontmap.c: Cairo font handling, Win32 backend
4 * Copyright (C) 2000-2005 Red Hat Software
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
24 #include "pangowin32-private.h"
25 #include "pangocairo.h"
26 #include "pangocairo-private.h"
27 #include "pangocairo-win32.h"
29 typedef struct _PangoCairoWin32FontMapClass PangoCairoWin32FontMapClass;
31 struct _PangoCairoWin32FontMapClass
33 PangoWin32FontMapClass parent_class;
37 pango_cairo_win32_font_map_set_resolution (PangoCairoFontMap *cfontmap,
40 PangoCairoWin32FontMap *cwfontmap = PANGO_CAIRO_WIN32_FONT_MAP (cfontmap);
46 pango_cairo_win32_font_map_get_resolution (PangoCairoFontMap *cfontmap)
48 PangoCairoWin32FontMap *cwfontmap = PANGO_CAIRO_WIN32_FONT_MAP (cfontmap);
50 return cwfontmap->dpi;
53 static cairo_font_type_t
54 pango_cairo_win32_font_map_get_font_type (PangoCairoFontMap *cfontmap)
56 return CAIRO_FONT_TYPE_WIN32;
60 cairo_font_map_iface_init (PangoCairoFontMapIface *iface)
62 iface->set_resolution = pango_cairo_win32_font_map_set_resolution;
63 iface->get_resolution = pango_cairo_win32_font_map_get_resolution;
64 iface->get_font_type = pango_cairo_win32_font_map_get_font_type;
67 G_DEFINE_TYPE_WITH_CODE (PangoCairoWin32FontMap, pango_cairo_win32_font_map, PANGO_TYPE_WIN32_FONT_MAP,
68 { G_IMPLEMENT_INTERFACE (PANGO_TYPE_CAIRO_FONT_MAP, cairo_font_map_iface_init) });
71 pango_cairo_win32_font_map_finalize (GObject *object)
73 PangoCairoWin32FontMap *cwfontmap = PANGO_CAIRO_WIN32_FONT_MAP (object);
75 G_OBJECT_CLASS (pango_cairo_win32_font_map_parent_class)->finalize (object);
79 pango_cairo_win32_font_map_find_font (PangoWin32FontMap *fontmap,
80 PangoContext *context,
82 const PangoFontDescription *desc)
84 return _pango_cairo_win32_font_new (PANGO_CAIRO_WIN32_FONT_MAP (fontmap),
89 pango_cairo_win32_font_map_class_init (PangoCairoWin32FontMapClass *class)
91 GObjectClass *gobject_class = G_OBJECT_CLASS (class);
92 PangoWin32FontMapClass *win32fontmap_class = PANGO_WIN32_FONT_MAP_CLASS (class);
94 gobject_class->finalize = pango_cairo_win32_font_map_finalize;
95 win32fontmap_class->find_font = pango_cairo_win32_font_map_find_font;
99 pango_cairo_win32_font_map_init (PangoCairoWin32FontMap *cwfontmap)
101 cwfontmap->dpi = GetDeviceCaps (pango_win32_get_dc (), LOGPIXELSY);