"SfR Fresh" - the SfR Freeware/Shareware Archive

Member "pango-1.20.5/pango/pangocairo-win32fontmap.c" of archive pango-1.20.5.tar.gz:


As a special service "SfR Fresh" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
    1 /* Pango
    2  * pangocairo-win32fontmap.c: Cairo font handling, Win32 backend
    3  *
    4  * Copyright (C) 2000-2005 Red Hat Software
    5  *
    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.
   10  *
   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.
   15  *
   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.
   20  */
   21 
   22 #include <config.h>
   23 
   24 #include "pangowin32-private.h"
   25 #include "pangocairo.h"
   26 #include "pangocairo-private.h"
   27 #include "pangocairo-win32.h"
   28 
   29 typedef struct _PangoCairoWin32FontMapClass PangoCairoWin32FontMapClass;
   30 
   31 struct _PangoCairoWin32FontMapClass
   32 {
   33   PangoWin32FontMapClass parent_class;
   34 };
   35 
   36 static void
   37 pango_cairo_win32_font_map_set_resolution (PangoCairoFontMap *cfontmap,
   38 					   double             dpi)
   39 {
   40   PangoCairoWin32FontMap *cwfontmap = PANGO_CAIRO_WIN32_FONT_MAP (cfontmap);
   41 
   42   cwfontmap->dpi = dpi;
   43 }
   44 
   45 static double
   46 pango_cairo_win32_font_map_get_resolution (PangoCairoFontMap *cfontmap)
   47 {
   48   PangoCairoWin32FontMap *cwfontmap = PANGO_CAIRO_WIN32_FONT_MAP (cfontmap);
   49 
   50   return cwfontmap->dpi;
   51 }
   52 
   53 static cairo_font_type_t
   54 pango_cairo_win32_font_map_get_font_type (PangoCairoFontMap *cfontmap)
   55 {
   56   return CAIRO_FONT_TYPE_WIN32;
   57 }
   58 
   59 static void
   60 cairo_font_map_iface_init (PangoCairoFontMapIface *iface)
   61 {
   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;
   65 }
   66 
   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) });
   69 
   70 static void
   71 pango_cairo_win32_font_map_finalize (GObject *object)
   72 {
   73   PangoCairoWin32FontMap *cwfontmap = PANGO_CAIRO_WIN32_FONT_MAP (object);
   74 
   75   G_OBJECT_CLASS (pango_cairo_win32_font_map_parent_class)->finalize (object);
   76 }
   77 
   78 static PangoFont *
   79 pango_cairo_win32_font_map_find_font (PangoWin32FontMap          *fontmap,
   80 				      PangoContext               *context,
   81 				      PangoWin32Face             *face,
   82 				      const PangoFontDescription *desc)
   83 {
   84   return _pango_cairo_win32_font_new (PANGO_CAIRO_WIN32_FONT_MAP (fontmap),
   85 				      context, face, desc);
   86 }
   87 
   88 static void
   89 pango_cairo_win32_font_map_class_init (PangoCairoWin32FontMapClass *class)
   90 {
   91   GObjectClass *gobject_class = G_OBJECT_CLASS (class);
   92   PangoWin32FontMapClass *win32fontmap_class = PANGO_WIN32_FONT_MAP_CLASS (class);
   93 
   94   gobject_class->finalize  = pango_cairo_win32_font_map_finalize;
   95   win32fontmap_class->find_font = pango_cairo_win32_font_map_find_font;
   96 }
   97 
   98 static void
   99 pango_cairo_win32_font_map_init (PangoCairoWin32FontMap *cwfontmap)
  100 {
  101   cwfontmap->dpi = GetDeviceCaps (pango_win32_get_dc (), LOGPIXELSY);
  102 }