Rollback the following changes, to fix it the proper way in Pango:
2006-05-22 Behdad Esfahbod <behdad@gnome.org> Rollback the following changes, to fix it the proper way in Pango: * gdk/gdkinternals.h: * gdk/gdkscreen.c (gdk_screen_class_init), (gdk_screen_finalize), (update_fontmap_resolution), (gdk_screen_set_resolution_libgtkonly): Add new function _gdk_screen_get_font_map() and have one fontmap per screen, with the correct resolution set on it. * gdk/gdkpango.c (gdk_pango_context_get_for_screen): Use _gdk_screen_get_font_map() instead of setting resolution on the PangoCairoContext. (#342529)
This commit is contained in:
committed by
Behdad Esfahbod
parent
a8bb6ab65b
commit
ef4abea285
14
ChangeLog
14
ChangeLog
@@ -1,3 +1,17 @@
|
|||||||
|
2006-05-22 Behdad Esfahbod <behdad@gnome.org>
|
||||||
|
|
||||||
|
Rollback the following changes, to fix it the proper way in Pango:
|
||||||
|
|
||||||
|
* gdk/gdkinternals.h:
|
||||||
|
* gdk/gdkscreen.c (gdk_screen_class_init), (gdk_screen_finalize),
|
||||||
|
(update_fontmap_resolution), (gdk_screen_set_resolution_libgtkonly):
|
||||||
|
Add new function _gdk_screen_get_font_map() and have one fontmap per
|
||||||
|
screen, with the correct resolution set on it.
|
||||||
|
|
||||||
|
* gdk/gdkpango.c (gdk_pango_context_get_for_screen): Use
|
||||||
|
_gdk_screen_get_font_map() instead of setting resolution on the
|
||||||
|
PangoCairoContext. (#342529)
|
||||||
|
|
||||||
2006-05-21 Behdad Esfahbod <behdad@gnome.org>
|
2006-05-21 Behdad Esfahbod <behdad@gnome.org>
|
||||||
|
|
||||||
* gdk/gdkinternals.h:
|
* gdk/gdkinternals.h:
|
||||||
|
|||||||
@@ -1,3 +1,17 @@
|
|||||||
|
2006-05-22 Behdad Esfahbod <behdad@gnome.org>
|
||||||
|
|
||||||
|
Rollback the following changes, to fix it the proper way in Pango:
|
||||||
|
|
||||||
|
* gdk/gdkinternals.h:
|
||||||
|
* gdk/gdkscreen.c (gdk_screen_class_init), (gdk_screen_finalize),
|
||||||
|
(update_fontmap_resolution), (gdk_screen_set_resolution_libgtkonly):
|
||||||
|
Add new function _gdk_screen_get_font_map() and have one fontmap per
|
||||||
|
screen, with the correct resolution set on it.
|
||||||
|
|
||||||
|
* gdk/gdkpango.c (gdk_pango_context_get_for_screen): Use
|
||||||
|
_gdk_screen_get_font_map() instead of setting resolution on the
|
||||||
|
PangoCairoContext. (#342529)
|
||||||
|
|
||||||
2006-05-21 Behdad Esfahbod <behdad@gnome.org>
|
2006-05-21 Behdad Esfahbod <behdad@gnome.org>
|
||||||
|
|
||||||
* gdk/gdkinternals.h:
|
* gdk/gdkinternals.h:
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
#include <gdk/gdktypes.h>
|
#include <gdk/gdktypes.h>
|
||||||
#include <gdk/gdkwindow.h>
|
#include <gdk/gdkwindow.h>
|
||||||
#include <gdk/gdkprivate.h>
|
#include <gdk/gdkprivate.h>
|
||||||
#include <pango/pango.h>
|
|
||||||
|
|
||||||
#ifndef __GDK_INTERNALS_H__
|
#ifndef __GDK_INTERNALS_H__
|
||||||
#define __GDK_INTERNALS_H__
|
#define __GDK_INTERNALS_H__
|
||||||
@@ -378,10 +377,6 @@ void _gdk_windowing_gc_get_foreground (GdkGC *gc,
|
|||||||
void _gdk_windowing_gc_get_background (GdkGC *gc,
|
void _gdk_windowing_gc_get_background (GdkGC *gc,
|
||||||
GdkColor *color);
|
GdkColor *color);
|
||||||
|
|
||||||
/* Gets the fontmap for screen */
|
|
||||||
PangoFontMap *
|
|
||||||
_gdk_screen_get_font_map (GdkScreen *screen);
|
|
||||||
|
|
||||||
/************************************
|
/************************************
|
||||||
* Initialization and exit routines *
|
* Initialization and exit routines *
|
||||||
************************************/
|
************************************/
|
||||||
|
|||||||
@@ -1413,16 +1413,20 @@ gdk_pango_context_get_for_screen (GdkScreen *screen)
|
|||||||
PangoFontMap *fontmap;
|
PangoFontMap *fontmap;
|
||||||
PangoContext *context;
|
PangoContext *context;
|
||||||
const cairo_font_options_t *options;
|
const cairo_font_options_t *options;
|
||||||
|
double dpi;
|
||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||||
|
|
||||||
fontmap = _gdk_screen_get_font_map (screen);
|
fontmap = pango_cairo_font_map_get_default ();
|
||||||
|
|
||||||
context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
|
context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
|
||||||
|
|
||||||
options = gdk_screen_get_font_options_libgtk_only (screen);
|
options = gdk_screen_get_font_options_libgtk_only (screen);
|
||||||
pango_cairo_context_set_font_options (context, options);
|
pango_cairo_context_set_font_options (context, options);
|
||||||
|
|
||||||
|
dpi = gdk_screen_get_resolution_libgtk_only (screen);
|
||||||
|
pango_cairo_context_set_resolution (context, dpi);
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,22 +25,9 @@
|
|||||||
#include "gdk.h" /* For gdk_rectangle_intersect() */
|
#include "gdk.h" /* For gdk_rectangle_intersect() */
|
||||||
#include "gdkcolor.h"
|
#include "gdkcolor.h"
|
||||||
#include "gdkwindow.h"
|
#include "gdkwindow.h"
|
||||||
#include "gdkinternals.h"
|
|
||||||
#include "gdkscreen.h"
|
#include "gdkscreen.h"
|
||||||
#include "gdkalias.h"
|
#include "gdkalias.h"
|
||||||
|
|
||||||
|
|
||||||
#define GDK_SCREEN_GET_PRIVATE(o) \
|
|
||||||
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GDK_TYPE_SCREEN, GdkScreenPrivate))
|
|
||||||
|
|
||||||
typedef struct _GdkScreenPrivate GdkScreenPrivate;
|
|
||||||
|
|
||||||
struct _GdkScreenPrivate
|
|
||||||
{
|
|
||||||
PangoFontMap *fontmap;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static void gdk_screen_class_init (GdkScreenClass *klass);
|
static void gdk_screen_class_init (GdkScreenClass *klass);
|
||||||
static void gdk_screen_init (GdkScreen *screen);
|
static void gdk_screen_init (GdkScreen *screen);
|
||||||
static void gdk_screen_dispose (GObject *object);
|
static void gdk_screen_dispose (GObject *object);
|
||||||
@@ -111,8 +98,6 @@ gdk_screen_class_init (GdkScreenClass *klass)
|
|||||||
g_cclosure_marshal_VOID__VOID,
|
g_cclosure_marshal_VOID__VOID,
|
||||||
G_TYPE_NONE,
|
G_TYPE_NONE,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GdkScreenPrivate));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -143,13 +128,9 @@ static void
|
|||||||
gdk_screen_finalize (GObject *object)
|
gdk_screen_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
GdkScreen *screen = GDK_SCREEN (object);
|
GdkScreen *screen = GDK_SCREEN (object);
|
||||||
GdkScreenPrivate *priv = GDK_SCREEN_GET_PRIVATE (screen);
|
|
||||||
|
|
||||||
if (screen->font_options)
|
if (screen->font_options)
|
||||||
cairo_font_options_destroy (screen->font_options);
|
cairo_font_options_destroy (screen->font_options);
|
||||||
|
|
||||||
if (priv->fontmap)
|
|
||||||
g_object_unref (priv->fontmap);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
@@ -356,48 +337,6 @@ gdk_screen_height_mm (void)
|
|||||||
return gdk_screen_get_height_mm (gdk_screen_get_default ());
|
return gdk_screen_get_height_mm (gdk_screen_get_default ());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
update_fontmap_resolution (GdkScreen *screen)
|
|
||||||
{
|
|
||||||
GdkScreenPrivate *priv = GDK_SCREEN_GET_PRIVATE (screen);
|
|
||||||
double dpi = screen->resolution;
|
|
||||||
|
|
||||||
if (dpi < 0)
|
|
||||||
dpi = 96.;
|
|
||||||
|
|
||||||
if (priv->fontmap)
|
|
||||||
pango_cairo_font_map_set_resolution (priv->fontmap, dpi);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* _gdk_screen_get_font_map:
|
|
||||||
* @screen: a #GdkScreen
|
|
||||||
*
|
|
||||||
* Gets the Pango fontmap for this screen that is used to create
|
|
||||||
* #PangoContext, with the right resolution set on it.
|
|
||||||
*
|
|
||||||
* Return value: the fontmap.
|
|
||||||
*
|
|
||||||
* Since: 2.10
|
|
||||||
**/
|
|
||||||
PangoFontMap *
|
|
||||||
_gdk_screen_get_font_map (GdkScreen *screen)
|
|
||||||
{
|
|
||||||
GdkScreenPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
|
||||||
|
|
||||||
priv = GDK_SCREEN_GET_PRIVATE (screen);
|
|
||||||
|
|
||||||
if (G_UNLIKELY (!priv->fontmap))
|
|
||||||
{
|
|
||||||
priv->fontmap = pango_cairo_font_map_new ();
|
|
||||||
update_fontmap_resolution (screen);
|
|
||||||
}
|
|
||||||
|
|
||||||
return priv->fontmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_screen_set_font_options_libgtk_only:
|
* gdk_screen_set_font_options_libgtk_only:
|
||||||
* @screen: a #GdkScreen
|
* @screen: a #GdkScreen
|
||||||
@@ -465,14 +404,10 @@ gdk_screen_set_resolution_libgtk_only (GdkScreen *screen,
|
|||||||
{
|
{
|
||||||
g_return_if_fail (GDK_IS_SCREEN (screen));
|
g_return_if_fail (GDK_IS_SCREEN (screen));
|
||||||
|
|
||||||
if (dpi < 0)
|
if (dpi >= 0)
|
||||||
dpi = -1;
|
|
||||||
|
|
||||||
if (dpi != screen->resolution)
|
|
||||||
{
|
|
||||||
screen->resolution = dpi;
|
screen->resolution = dpi;
|
||||||
update_fontmap_resolution (screen);
|
else
|
||||||
}
|
screen->resolution = -1.;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user