Commit c7712c9c authored by Manish Singh's avatar Manish Singh

don't die on corrupted fonts. Give some error messages instead.

-Yosh
parent b3801f42
Wed Apr 29 01:43:30 PDT 1998 Manish Singh <yosh@gimp.org>
* app/text_tool.c: don't die on corrupted fonts. Give some
error messages instead.
Tue Apr 28 23:17:37 PDT 1998 Manish Singh <yosh@gimp.org>
* app/gradient.c: enable adjustment of the gradient list box
......
......@@ -18,7 +18,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "gdk/gdkkeysyms.h"
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkprivate.h>
#include "appenv.h"
#include "actionarea.h"
#include "buildmenu.h"
......@@ -1590,7 +1591,22 @@ text_load_font (TextTool *text_tool)
weight_str, slant_str, set_width_str, spacing_str,
registry_str, encoding_str, fontname))
{
/* Trap errors with bad fonts -Yosh */
gdk_error_warnings = 0;
gdk_error_code = 0;
font = gdk_font_load (fontname);
gdk_error_warnings = 1;
if (gdk_error_code == -1)
{
char *buf;
buf = g_malloc (strlen (family_str) + 87);
sprintf(buf, "I'm sorry, but the font %s is corrupt.\nPlease ask the system adminstrator to replace it.", family_str);
message_box (buf, NULL, NULL);
g_free (buf);
return FALSE;
}
if (font)
{
if (text_tool->font)
......@@ -1758,8 +1774,11 @@ text_render (GImage *gimage,
if (!crop) border = 0;
/* load the font in */
gdk_error_warnings = 0;
gdk_error_code = 0;
font = gdk_font_load (fontname);
if (!font)
gdk_error_warnings = 1;
if (!font || (gdk_error_code == -1))
return NULL;
/* determine the bounding box of the text */
......@@ -1934,8 +1953,11 @@ text_get_extents (char *fontname,
int line_width, line_height;
/* load the font in */
gdk_error_warnings = 0;
gdk_error_code = 0;
font = gdk_font_load (fontname);
if (!font)
gdk_error_warnings = 1;
if (!font || (gdk_error_code == -1))
return FALSE;
/* determine the bounding box of the text */
......
......@@ -18,7 +18,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "gdk/gdkkeysyms.h"
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkprivate.h>
#include "appenv.h"
#include "actionarea.h"
#include "buildmenu.h"
......@@ -1590,7 +1591,22 @@ text_load_font (TextTool *text_tool)
weight_str, slant_str, set_width_str, spacing_str,
registry_str, encoding_str, fontname))
{
/* Trap errors with bad fonts -Yosh */
gdk_error_warnings = 0;
gdk_error_code = 0;
font = gdk_font_load (fontname);
gdk_error_warnings = 1;
if (gdk_error_code == -1)
{
char *buf;
buf = g_malloc (strlen (family_str) + 87);
sprintf(buf, "I'm sorry, but the font %s is corrupt.\nPlease ask the system adminstrator to replace it.", family_str);
message_box (buf, NULL, NULL);
g_free (buf);
return FALSE;
}
if (font)
{
if (text_tool->font)
......@@ -1758,8 +1774,11 @@ text_render (GImage *gimage,
if (!crop) border = 0;
/* load the font in */
gdk_error_warnings = 0;
gdk_error_code = 0;
font = gdk_font_load (fontname);
if (!font)
gdk_error_warnings = 1;
if (!font || (gdk_error_code == -1))
return NULL;
/* determine the bounding box of the text */
......@@ -1934,8 +1953,11 @@ text_get_extents (char *fontname,
int line_width, line_height;
/* load the font in */
gdk_error_warnings = 0;
gdk_error_code = 0;
font = gdk_font_load (fontname);
if (!font)
gdk_error_warnings = 1;
if (!font || (gdk_error_code == -1))
return FALSE;
/* determine the bounding box of the text */
......
......@@ -18,7 +18,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "gdk/gdkkeysyms.h"
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkprivate.h>
#include "appenv.h"
#include "actionarea.h"
#include "buildmenu.h"
......@@ -1590,7 +1591,22 @@ text_load_font (TextTool *text_tool)
weight_str, slant_str, set_width_str, spacing_str,
registry_str, encoding_str, fontname))
{
/* Trap errors with bad fonts -Yosh */
gdk_error_warnings = 0;
gdk_error_code = 0;
font = gdk_font_load (fontname);
gdk_error_warnings = 1;
if (gdk_error_code == -1)
{
char *buf;
buf = g_malloc (strlen (family_str) + 87);
sprintf(buf, "I'm sorry, but the font %s is corrupt.\nPlease ask the system adminstrator to replace it.", family_str);
message_box (buf, NULL, NULL);
g_free (buf);
return FALSE;
}
if (font)
{
if (text_tool->font)
......@@ -1758,8 +1774,11 @@ text_render (GImage *gimage,
if (!crop) border = 0;
/* load the font in */
gdk_error_warnings = 0;
gdk_error_code = 0;
font = gdk_font_load (fontname);
if (!font)
gdk_error_warnings = 1;
if (!font || (gdk_error_code == -1))
return NULL;
/* determine the bounding box of the text */
......@@ -1934,8 +1953,11 @@ text_get_extents (char *fontname,
int line_width, line_height;
/* load the font in */
gdk_error_warnings = 0;
gdk_error_code = 0;
font = gdk_font_load (fontname);
if (!font)
gdk_error_warnings = 1;
if (!font || (gdk_error_code == -1))
return FALSE;
/* determine the bounding box of the text */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment