mirror of
https://github.com/brl/mutter.git
synced 2024-12-27 21:32:14 +00:00
2007-08-02 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/eglnative/clutter-backend-egl.c: * clutter/eglx/clutter-backend-egl.c: * clutter/sdl/clutter-backend-sdl.c: Set the default resolution as 96.0 dpi for every backend (we already were under this assumption anyway, and this makes it easier to change this setting per-backend). * clutter/pango/pangoclutter-fontmap.c: * clutter/pango/pangoclutter.h: Allow setting the resolution for the PangoClutterFontMap object and provide the implementation for the PangoFcFontMap::get_resolution() virtual function. This allows to set the resolution of the PangoContext when retrieving it. * clutter/clutter-label.c (clutter_label_init): Set the resolution of the font map with the one the backend gives us. * clutter/clutter-entry.c (clutter_entry_init): Ditto.
This commit is contained in:
parent
19e8b7aed4
commit
4ccfc2daa2
21
ChangeLog
21
ChangeLog
@ -1,3 +1,24 @@
|
||||
2007-08-02 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/eglnative/clutter-backend-egl.c:
|
||||
* clutter/eglx/clutter-backend-egl.c:
|
||||
* clutter/sdl/clutter-backend-sdl.c: Set the default resolution
|
||||
as 96.0 dpi for every backend (we already were under this
|
||||
assumption anyway, and this makes it easier to change this
|
||||
setting per-backend).
|
||||
|
||||
* clutter/pango/pangoclutter-fontmap.c:
|
||||
* clutter/pango/pangoclutter.h: Allow setting the resolution
|
||||
for the PangoClutterFontMap object and provide the implementation
|
||||
for the PangoFcFontMap::get_resolution() virtual function. This
|
||||
allows to set the resolution of the PangoContext when retrieving
|
||||
it.
|
||||
|
||||
* clutter/clutter-label.c (clutter_label_init): Set the
|
||||
resolution of the font map with the one the backend gives us.
|
||||
|
||||
* clutter/clutter-entry.c (clutter_entry_init): Ditto.
|
||||
|
||||
2007-08-02 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-color.c (clutter_color_subtract): Invert the
|
||||
|
@ -727,8 +727,7 @@ clutter_entry_init (ClutterEntry *self)
|
||||
if (G_UNLIKELY (_context == NULL))
|
||||
{
|
||||
_font_map = PANGO_CLUTTER_FONT_MAP (pango_clutter_font_map_new ());
|
||||
|
||||
/* pango_clutter_font_map_set_resolution (font_map, 96.0, 96.0); */
|
||||
pango_clutter_font_map_set_resolution (_font_map, resolution);
|
||||
_context = pango_clutter_font_map_create_context (_font_map);
|
||||
}
|
||||
|
||||
|
@ -482,10 +482,18 @@ clutter_label_init (ClutterLabel *self)
|
||||
|
||||
self->priv = priv = CLUTTER_LABEL_GET_PRIVATE (self);
|
||||
|
||||
if (_context == NULL)
|
||||
if (G_UNLIKELY (_context == NULL))
|
||||
{
|
||||
ClutterBackend *backend;
|
||||
gdouble resolution;
|
||||
|
||||
backend = clutter_get_default_backend ();
|
||||
resolution = clutter_backend_get_resolution (backend);
|
||||
if (resolution < 0)
|
||||
resolution = 96.0;
|
||||
|
||||
_font_map = PANGO_CLUTTER_FONT_MAP (pango_clutter_font_map_new ());
|
||||
/* pango_clutter_font_map_set_resolution (font_map, 96.0, 96.0); */
|
||||
pango_clutter_font_map_set_resolution (_font_map, resolution);
|
||||
_context = pango_clutter_font_map_create_context (_font_map);
|
||||
}
|
||||
|
||||
|
@ -191,6 +191,7 @@ clutter_backend_egl_init (ClutterBackendEGL *backend_egl)
|
||||
{
|
||||
ClutterBackend *backend = CLUTTER_BACKEND (backend_egl);
|
||||
|
||||
clutter_backend_set_resolution (backend, 96.0);
|
||||
clutter_backend_set_double_click_time (backend, 250);
|
||||
clutter_backend_set_double_click_distance (backend, 5);
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ clutter_backend_egl_post_parse (ClutterBackend *backend,
|
||||
if (backend_egl->xdpy)
|
||||
{
|
||||
EGLBoolean status;
|
||||
double dpi;
|
||||
|
||||
CLUTTER_NOTE (MISC, "Getting the X screen");
|
||||
|
||||
@ -77,6 +78,10 @@ clutter_backend_egl_post_parse (ClutterBackend *backend,
|
||||
|
||||
backend_egl->edpy = eglGetDisplay(backend_egl->xdpy);
|
||||
|
||||
dpi = (((double) DisplayHeight (backend_egl->xdpy, backend_egl->xscreen_num) * 25.4)
|
||||
/ (double) DisplayHeightMM (backend_egl->xdpy, backend_egl->xscreen_num));
|
||||
clutter_backend_set_resolution (backend, dpi);
|
||||
|
||||
status = eglInitialize(backend_egl->edpy,
|
||||
&backend_egl->egl_version_major,
|
||||
&backend_egl->egl_version_minor);
|
||||
@ -294,6 +299,7 @@ clutter_backend_egl_init (ClutterBackendEGL *backend_egl)
|
||||
ClutterBackend *backend = CLUTTER_BACKEND (backend_egl);
|
||||
|
||||
/* FIXME: get from xsettings */
|
||||
clutter_backend_set_resolution (backend, 96.0);
|
||||
clutter_backend_set_double_click_time (backend, 250);
|
||||
clutter_backend_set_double_click_distance (backend, 5);
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ struct _PangoClutterFontMap
|
||||
|
||||
FT_Library library;
|
||||
|
||||
double dpi;
|
||||
|
||||
/* Function to call on prepared patterns to do final
|
||||
* config tweaking.
|
||||
*/
|
||||
@ -150,6 +152,16 @@ _pango_clutter_font_map_get_library (PangoFontMap *fontmap_)
|
||||
return fontmap->library;
|
||||
}
|
||||
|
||||
void
|
||||
pango_clutter_font_map_set_resolution (PangoClutterFontMap *fontmap,
|
||||
double dpi)
|
||||
{
|
||||
g_return_if_fail (PANGO_CLUTTER_IS_FONT_MAP (fontmap));
|
||||
|
||||
fontmap->dpi = dpi;
|
||||
|
||||
pango_clutter_font_map_substitute_changed (fontmap);
|
||||
}
|
||||
|
||||
/**
|
||||
* _pango_clutter_font_map_get_renderer:
|
||||
@ -194,6 +206,13 @@ pango_clutter_font_map_new_font (PangoFcFontMap *fcfontmap,
|
||||
return (PangoFcFont *)_pango_clutter_font_new (PANGO_CLUTTER_FONT_MAP (fcfontmap), pattern);
|
||||
}
|
||||
|
||||
static double
|
||||
pango_clutter_font_map_get_resolution (PangoFcFontMap *fcfontmap,
|
||||
PangoContext *context)
|
||||
{
|
||||
return ((PangoClutterFontMap *)fcfontmap)->dpi;
|
||||
}
|
||||
|
||||
static void
|
||||
pango_clutter_font_map_class_init (PangoClutterFontMapClass *class)
|
||||
{
|
||||
@ -203,11 +222,13 @@ pango_clutter_font_map_class_init (PangoClutterFontMapClass *class)
|
||||
gobject_class->finalize = pango_clutter_font_map_finalize;
|
||||
fcfontmap_class->default_substitute = pango_clutter_font_map_default_substitute;
|
||||
fcfontmap_class->new_font = pango_clutter_font_map_new_font;
|
||||
fcfontmap_class->get_resolution = pango_clutter_font_map_get_resolution;
|
||||
}
|
||||
|
||||
static void
|
||||
pango_clutter_font_map_init (PangoClutterFontMap *fontmap)
|
||||
{
|
||||
fontmap->library = NULL;
|
||||
fontmap->dpi = 96.0;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,10 @@ pango_clutter_font_map_set_default_substitute
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
void
|
||||
pango_clutter_font_map_set_resolution (PangoClutterFontMap *fontmap,
|
||||
double dpi);
|
||||
|
||||
void
|
||||
pango_clutter_font_map_substitute_changed (PangoClutterFontMap *fontmap);
|
||||
|
||||
|
@ -208,6 +208,7 @@ clutter_backend_sdl_init (ClutterBackendSDL *backend_sdl)
|
||||
{
|
||||
ClutterBackend *backend = CLUTTER_BACKEND (backend_sdl);
|
||||
|
||||
clutter_backend_set_resolution (backend, 96.0);
|
||||
clutter_backend_set_double_click_time (backend, 250);
|
||||
clutter_backend_set_double_click_distance (backend, 5);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user