1
/* The GIMP -- an image manipulation program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
#include <fontconfig/fontconfig.h>
23
#include <pango/pangoft2.h>
25
#include "libgimpbase/gimpenv.h"
27
#include "core/gimp-utils.h"
31
#include "gimp-intl.h"
34
static gchar * sanity_check_glib (void);
35
static gchar * sanity_check_fontconfig (void);
36
static gchar * sanity_check_freetype (void);
37
static gchar * sanity_check_filename_encoding (void);
40
/* public functions */
45
gchar *abort_message = sanity_check_glib ();
48
abort_message = sanity_check_fontconfig ();
51
abort_message = sanity_check_freetype ();
54
abort_message = sanity_check_filename_encoding ();
60
/* private functions */
63
sanity_check_glib (void)
65
const gchar *mismatch;
67
#define GLIB_REQUIRED_MAJOR 2
68
#define GLIB_REQUIRED_MINOR 4
69
#define GLIB_REQUIRED_MICRO 5
71
mismatch = gimp_check_glib_version (GLIB_REQUIRED_MAJOR,
77
return g_strdup_printf
79
"The GIMP requires GLib+ version %d.%d.%d or later.\n"
80
"Installed GLib+ version is %d.%d.%d.\n\n"
81
"Somehow you or your software packager managed\n"
82
"to install The GIMP with an older GLib+ version.\n\n"
83
"Please upgrade to GLib+ version %d.%d.%d or later.",
85
GLIB_REQUIRED_MAJOR, GLIB_REQUIRED_MINOR, GLIB_REQUIRED_MICRO,
86
glib_major_version, glib_minor_version, glib_micro_version,
87
GLIB_REQUIRED_MAJOR, GLIB_REQUIRED_MINOR, GLIB_REQUIRED_MICRO);
90
#undef GLIB_REQUIRED_MAJOR
91
#undef GLIB_REQUIRED_MINOR
92
#undef GLIB_REQUIRED_MICRO
98
sanity_check_fontconfig (void)
100
gint fc_version = FcGetVersion ();
101
gint fc_major_version = fc_version / 100 / 100;
102
gint fc_minor_version = fc_version / 100 % 100;
103
gint fc_micro_version = fc_version % 100;
105
#define FC_REQUIRED_MAJOR 2
106
#define FC_REQUIRED_MINOR 2
107
#define FC_REQUIRED_MICRO 0
109
if (fc_version < ((FC_REQUIRED_MAJOR * 10000) +
110
(FC_REQUIRED_MINOR * 100) +
111
(FC_REQUIRED_MICRO * 1)))
113
return g_strdup_printf
114
("The Fontconfig version being used is too old!\n\n"
115
"The GIMP requires Fontconfig version %d.%d.%d or later.\n"
116
"The Fontconfig version loaded by The GIMP is %d.%d.%d.\n\n"
117
"This may be caused by another instance of libfontconfig.so.1\n"
118
"being installed in the system, probably in /usr/X11R6/lib.\n"
119
"Please correct the situation or report it to someone who can.",
120
FC_REQUIRED_MAJOR, FC_REQUIRED_MINOR, FC_REQUIRED_MICRO,
121
fc_major_version, fc_minor_version, fc_micro_version);
124
#undef FC_REQUIRED_MAJOR
125
#undef FC_REQUIRED_MINOR
126
#undef FC_REQUIRED_MICRO
132
sanity_check_freetype (void)
134
FT_Library ft_library;
135
FT_Int ft_major_version;
136
FT_Int ft_minor_version;
137
FT_Int ft_micro_version;
140
#define FT_REQUIRED_MAJOR 2
141
#define FT_REQUIRED_MINOR 1
142
#define FT_REQUIRED_MICRO 7
144
if (FT_Init_FreeType (&ft_library) != 0)
145
g_error ("FT_Init_FreeType() failed");
147
FT_Library_Version (ft_library,
152
if (FT_Done_FreeType (ft_library) != 0)
153
g_error ("FT_Done_FreeType() failed");
155
ft_version = (ft_major_version * 10000 +
156
ft_minor_version * 100 +
157
ft_micro_version * 1);
159
if (ft_version < ((FT_REQUIRED_MAJOR * 10000) +
160
(FT_REQUIRED_MINOR * 100) +
161
(FT_REQUIRED_MICRO * 1)))
163
return g_strdup_printf
164
("FreeType version too old!\n\n"
165
"The GIMP requires FreeType version %d.%d.%d or later.\n"
166
"Installed FreeType version is %d.%d.%d.\n\n"
167
"Somehow you or your software packager managed\n"
168
"to install The GIMP with an older FreeType version.\n\n"
169
"Please upgrade to FreeType version %d.%d.%d or later.",
170
FT_REQUIRED_MAJOR, FT_REQUIRED_MINOR, FT_REQUIRED_MICRO,
171
ft_major_version, ft_minor_version, ft_micro_version,
172
FT_REQUIRED_MAJOR, FT_REQUIRED_MINOR, FT_REQUIRED_MICRO);
175
#undef FT_REQUIRED_MAJOR
176
#undef FT_REQUIRED_MINOR
177
#undef FT_REQUIRED_MICRO
183
sanity_check_filename_encoding (void)
186
GError *error = NULL;
188
result = g_filename_to_utf8 ("", -1, NULL, NULL, &error);
194
(_("The configured filename encoding cannot be converted to UTF-8: "
196
"Please check the value of the environment variable "
197
"G_FILENAME_ENCODING."),
200
g_error_free (error);
207
result = g_filename_to_utf8 (gimp_directory (), -1, NULL, NULL, &error);
213
(_("The name of the directory holding the GIMP user configuration "
214
"cannot be converted to UTF-8: "
216
"Most probably your filesystem stores files in an encoding "
217
"different from UTF-8 and you didn't tell GLib about this. "
218
"Please set the environment variable G_FILENAME_ENCODING."),
221
g_error_free (error);