Commit ec220279 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

register a log handler for the Gimp-Text domain.

2003-11-05  Sven Neumann  <sven@gimp.org>

	* app/app_procs.c: register a log handler for the Gimp-Text domain.

	* app/text/gimpfont.c: code cosmetics.

	* app/text/gimptext-compat.c: removed debugging output.

	Let GIMP work w/o any fonts. Of course you won't get any text
	functionality then:

	* app/text/gimpfontlist.c: don't install any font aliases if no
	fonts were found.

	* app/text/gimptextlayer.c: refuse to render any text layers when
	the GIMP fonts list is empty.

	* app/tools/gimptexttool.c: removed redundant includes.

	* app/tools/gimptextoptions.c: removed the font selection widget.
	This is a temporary regression that will be cured by improving the
	GimpFontView widget.

	* app/widgets/Makefile.am
	* app/widgets/gimpfontselection-dialog.[ch]
	* app/widgets/gimpfontselection.[ch]
	* app/widgets/gimppropwidgets.[ch]: removed the font selection and
	all references to it. Fixes bug #119267.
parent cf8a2756
2003-11-05 Sven Neumann <sven@gimp.org>
* app/app_procs.c: register a log handler for the Gimp-Text domain.
* app/text/gimpfont.c: code cosmetics.
* app/text/gimptext-compat.c: removed debugging output.
Let GIMP work w/o any fonts. Of course you won't get any text
functionality then:
* app/text/gimpfontlist.c: don't install any font aliases if no
fonts were found.
* app/text/gimptextlayer.c: refuse to render any text layers when
the GIMP fonts list is empty.
* app/tools/gimptexttool.c: removed redundant includes.
* app/tools/gimptextoptions.c: removed the font selection widget.
This is a temporary regression that will be cured by improving the
GimpFontView widget.
* app/widgets/Makefile.am
* app/widgets/gimpfontselection-dialog.[ch]
* app/widgets/gimpfontselection.[ch]
* app/widgets/gimppropwidgets.[ch]: removed the font selection and
all references to it. Fixes bug #119267.
2003-11-04 Sven Neumann <sven@gimp.org>
* etc/Makefile.am
......@@ -157,6 +157,10 @@ app_init (const gchar *full_prog_name,
G_LOG_LEVEL_MESSAGE,
gimp_message_log_func,
&the_gimp);
g_log_set_handler ("Gimp-Text",
G_LOG_LEVEL_MESSAGE,
gimp_message_log_func,
&the_gimp);
g_log_set_handler ("Gimp-GUI",
G_LOG_LEVEL_MESSAGE,
gimp_message_log_func,
......
......@@ -261,17 +261,17 @@ gimp_font_get_new_preview (GimpViewable *viewable,
gint width,
gint height)
{
GimpFont *font;
PangoLayout *layout;
PangoRectangle logical;
TempBuf *temp_buf;
FT_Bitmap bitmap;
guchar *p;
guchar black = 0;
GimpFont *font;
PangoLayout *layout;
PangoRectangle logical;
TempBuf *temp_buf;
FT_Bitmap bitmap;
guchar *p;
guchar black = 0;
font = GIMP_FONT (viewable);
if (!font->pango_context)
if (! font->pango_context)
return NULL;
if (! font->popup_layout ||
......
......@@ -282,8 +282,6 @@ gimp_font_list_load_names (GimpFontList *list,
FcFontSet *fontset;
gint i;
gimp_font_list_load_aliases (list, context);
os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, FC_SLANT, FC_WEIGHT, NULL);
pat = FcPatternCreate ();
......@@ -301,9 +299,15 @@ gimp_font_list_load_names (GimpFontList *list,
pango_font_description_free (desc);
}
/* only create aliases if there is at least one font available */
if (fontset->nfont > 0)
gimp_font_list_load_aliases (list, context);
FcFontSetDestroy (fontset);
}
#else
#else /* ! USE_FONTCONFIG_DIRECTLY */
static void
gimp_font_list_load_names (GimpFontList *list,
PangoFontMap *fontmap,
......
......@@ -70,9 +70,6 @@ text_render (GimpImage *gimage,
if (border < 0)
border = 0;
g_print ("text_render: x = %d, y = %d, fontname = '%s', border = %d\n",
text_x, text_y, fontname, border);
desc = pango_font_description_from_string (fontname);
size = PANGO_PIXELS (pango_font_description_get_size (desc));
......
......@@ -38,6 +38,7 @@
#include "config/gimpconfig-utils.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage.h"
#include "core/gimpparasitelist.h"
......@@ -368,6 +369,13 @@ gimp_text_layer_render_now (GimpTextLayer *layer)
item = GIMP_ITEM (layer);
image = gimp_item_get_image (item);
if (gimp_container_num_children (image->gimp->fonts) == 0)
{
g_message (_("Due to lack of any fonts,\n"
"text functionality is not available."));
return FALSE;
}
layout = gimp_text_layout_new (layer->text, image);
if (gimp_text_layout_get_size (layout, &width, &height))
......
......@@ -38,7 +38,6 @@
#include "widgets/gimpcolorpanel.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpfontselection.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gimptexteditor.h"
#include "widgets/gimpviewablebutton.h"
......@@ -239,7 +238,7 @@ gimp_text_options_notify_font (GimpContext *context,
context);
g_object_set (text,
"font", gimp_object_get_name (GIMP_OBJECT (font)),
"font", font ? gimp_object_get_name (GIMP_OBJECT (font)) : NULL,
NULL);
g_signal_handlers_unblock_by_func (text,
......@@ -287,10 +286,10 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
GimpDialogFactory *dialog_factory;
GtkWidget *auto_button;
GtkWidget *menu;
GtkWidget *font_selection;
GtkWidget *box;
GtkWidget *spinbutton;
gint digits;
gint row = 0;
options = GIMP_TEXT_OPTIONS (tool_options);
config = G_OBJECT (options->text);
......@@ -299,7 +298,7 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
dialog_factory = gimp_dialog_factory_from_name ("dock");
table = gtk_table_new (10, 3, FALSE);
table = gtk_table_new (9, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
......@@ -313,70 +312,69 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
GIMP_STOCK_TOOL_TEXT,
_("Open the font selection dialog"));
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("_Font:"), 1.0, 0.5,
button, 2, TRUE);
font_selection = gimp_prop_font_selection_new (config, "font");
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Font:"), 1.0, 0.5,
font_selection, 2, FALSE);
digits = gimp_unit_get_digits (options->text->unit);
spinbutton = gimp_prop_spin_button_new (config, "font-size",
1.0, 10.0, digits);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("_Size:"), 1.0, 0.5,
spinbutton, 1, FALSE);
menu = gimp_prop_unit_menu_new (config, "font-size-unit", "%a");
g_object_set_data (G_OBJECT (menu), "set_digits", spinbutton);
gtk_table_attach (GTK_TABLE (table), menu, 2, 3, 2, 3,
gtk_table_attach (GTK_TABLE (table), menu, 2, 3, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (menu);
row++;
button = gimp_prop_check_button_new (config, "hinting", _("_Hinting"));
gtk_table_attach (GTK_TABLE (table), button, 1, 3, 3, 4,
gtk_table_attach (GTK_TABLE (table), button, 1, 3, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (button);
row++;
auto_button = gimp_prop_check_button_new (config, "autohint",
_("Force Auto-Hinter"));
gtk_table_attach (GTK_TABLE (table), auto_button, 1, 3, 4, 5,
gtk_table_attach (GTK_TABLE (table), auto_button, 1, 3, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (auto_button);
row++;
gtk_widget_set_sensitive (auto_button, options->text->hinting);
g_object_set_data (G_OBJECT (button), "set_sensitive", auto_button);
button = gimp_prop_check_button_new (config, "antialias", _("Antialiasing"));
gtk_table_attach (GTK_TABLE (table), button, 1, 3, 5, 6,
gtk_table_attach (GTK_TABLE (table), button, 1, 3, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (button);
row++;
button = gimp_prop_color_button_new (config, "color",
_("Text Color"),
-1, 24, GIMP_COLOR_AREA_FLAT);
gimp_color_panel_set_context (GIMP_COLOR_PANEL (button),
GIMP_CONTEXT (options));
gimp_table_attach_aligned (GTK_TABLE (table), 0, 6,
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Color:"), 1.0, 0.5,
button, 1, FALSE);
box = gimp_prop_enum_stock_box_new (config, "justify", "gtk-justify", 0, 0);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 7,
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Justify:"), 1.0, 0.5,
box, 2, TRUE);
spinbutton = gimp_prop_spin_button_new (config, "indent", 1.0, 10.0, 1);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 8,
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Indent:"), 1.0, 0.5,
spinbutton, 1, FALSE);
spinbutton = gimp_prop_spin_button_new (config, "line-spacing", 1.0, 10.0, 1);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5);
gimp_table_attach_stock (GTK_TABLE (table), 9,
gimp_table_attach_stock (GTK_TABLE (table), row++,
_("Line\nSpacing:"), 0.0,
spinbutton, 1, GIMP_STOCK_LINE_SPACING);
......
......@@ -44,10 +44,7 @@
#include "text/gimptextlayer.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpfontselection.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h"
......
......@@ -93,10 +93,6 @@ libappwidgets_a_sources = \
gimpenummenu.h \
gimperrorconsole.c \
gimperrorconsole.h \
gimpfontselection.c \
gimpfontselection.h \
gimpfontselection-dialog.c \
gimpfontselection-dialog.h \
gimpfontview.c \
gimpfontview.h \
gimpgradienteditor.c \
......
......@@ -39,7 +39,6 @@
#include "gimpcolorpanel.h"
#include "gimpdnd.h"
#include "gimpenummenu.h"
#include "gimpfontselection.h"
#include "gimppreview.h"
#include "gimppropwidgets.h"
#include "gimpwidgets-constructors.h"
......@@ -1252,107 +1251,6 @@ gimp_prop_text_buffer_notify (GObject *config,
}
/********************/
/* font selection */
/********************/
static void gimp_prop_fontsel_callback (GtkWidget *fontsel,
GObject *config);
static void gimp_prop_fontsel_notify (GObject *config,
GParamSpec *param_spec,
GtkWidget *fontsel);
GtkWidget *
gimp_prop_font_selection_new (GObject *config,
const gchar *property_name)
{
GParamSpec *param_spec;
GtkWidget *fontsel;
gchar *value;
param_spec = check_param_spec (config, property_name,
G_TYPE_PARAM_STRING, G_STRLOC);
if (! param_spec)
return NULL;
g_object_get (config,
property_name, &value,
NULL);
fontsel = gimp_font_selection_new (NULL);
if (value)
{
gimp_font_selection_set_fontname (GIMP_FONT_SELECTION (fontsel), value);
g_free (value);
}
set_param_spec (G_OBJECT (fontsel),
GIMP_FONT_SELECTION (fontsel)->entry, param_spec);
g_signal_connect (fontsel, "font_changed",
G_CALLBACK (gimp_prop_fontsel_callback),
config);
connect_notify (config, property_name,
G_CALLBACK (gimp_prop_fontsel_notify),
fontsel);
return fontsel;
}
static void
gimp_prop_fontsel_callback (GtkWidget *fontsel,
GObject *config)
{
GParamSpec *param_spec;
const gchar *name;
param_spec = get_param_spec (G_OBJECT (fontsel));
if (! param_spec)
return;
name = gimp_font_selection_get_fontname (GIMP_FONT_SELECTION (fontsel));
g_signal_handlers_block_by_func (config,
gimp_prop_fontsel_notify,
fontsel);
g_object_set (config,
param_spec->name, name,
NULL);
g_signal_handlers_unblock_by_func (config,
gimp_prop_fontsel_notify,
fontsel);
}
static void
gimp_prop_fontsel_notify (GObject *config,
GParamSpec *param_spec,
GtkWidget *fontsel)
{
gchar *value;
g_object_get (config,
param_spec->name, &value,
NULL);
g_signal_handlers_block_by_func (fontsel,
gimp_prop_fontsel_callback,
config);
gimp_font_selection_set_fontname (GIMP_FONT_SELECTION (fontsel), value);
g_signal_handlers_unblock_by_func (fontsel,
gimp_prop_fontsel_callback,
config);
g_free (value);
}
/****************/
/* file entry */
/****************/
......
......@@ -112,8 +112,6 @@ GtkWidget * gimp_prop_entry_new (GObject *config,
GtkTextBuffer * gimp_prop_text_buffer_new (GObject *config,
const gchar *property_name,
gint max_len);
GtkWidget * gimp_prop_font_selection_new (GObject *config,
const gchar *property_name);
/* GimpParamPath */
......
......@@ -39,7 +39,6 @@
#include "gimpcolorpanel.h"
#include "gimpdnd.h"
#include "gimpenummenu.h"
#include "gimpfontselection.h"
#include "gimppreview.h"
#include "gimppropwidgets.h"
#include "gimpwidgets-constructors.h"
......@@ -1252,107 +1251,6 @@ gimp_prop_text_buffer_notify (GObject *config,
}
/********************/
/* font selection */
/********************/
static void gimp_prop_fontsel_callback (GtkWidget *fontsel,
GObject *config);
static void gimp_prop_fontsel_notify (GObject *config,
GParamSpec *param_spec,
GtkWidget *fontsel);
GtkWidget *
gimp_prop_font_selection_new (GObject *config,
const gchar *property_name)
{
GParamSpec *param_spec;
GtkWidget *fontsel;
gchar *value;
param_spec = check_param_spec (config, property_name,
G_TYPE_PARAM_STRING, G_STRLOC);
if (! param_spec)
return NULL;
g_object_get (config,
property_name, &value,
NULL);
fontsel = gimp_font_selection_new (NULL);
if (value)
{
gimp_font_selection_set_fontname (GIMP_FONT_SELECTION (fontsel), value);
g_free (value);
}
set_param_spec (G_OBJECT (fontsel),
GIMP_FONT_SELECTION (fontsel)->entry, param_spec);
g_signal_connect (fontsel, "font_changed",
G_CALLBACK (gimp_prop_fontsel_callback),
config);
connect_notify (config, property_name,
G_CALLBACK (gimp_prop_fontsel_notify),
fontsel);
return fontsel;
}
static void
gimp_prop_fontsel_callback (GtkWidget *fontsel,
GObject *config)
{
GParamSpec *param_spec;
const gchar *name;
param_spec = get_param_spec (G_OBJECT (fontsel));
if (! param_spec)
return;
name = gimp_font_selection_get_fontname (GIMP_FONT_SELECTION (fontsel));
g_signal_handlers_block_by_func (config,
gimp_prop_fontsel_notify,
fontsel);
g_object_set (config,
param_spec->name, name,
NULL);
g_signal_handlers_unblock_by_func (config,
gimp_prop_fontsel_notify,
fontsel);
}
static void
gimp_prop_fontsel_notify (GObject *config,
GParamSpec *param_spec,
GtkWidget *fontsel)
{
gchar *value;
g_object_get (config,
param_spec->name, &value,
NULL);
g_signal_handlers_block_by_func (fontsel,
gimp_prop_fontsel_callback,
config);
gimp_font_selection_set_fontname (GIMP_FONT_SELECTION (fontsel), value);
g_signal_handlers_unblock_by_func (fontsel,
gimp_prop_fontsel_callback,
config);
g_free (value);
}
/****************/
/* file entry */
/****************/
......
......@@ -112,8 +112,6 @@ GtkWidget * gimp_prop_entry_new (GObject *config,
GtkTextBuffer * gimp_prop_text_buffer_new (GObject *config,
const gchar *property_name,
gint max_len);
GtkWidget * gimp_prop_font_selection_new (GObject *config,
const gchar *property_name);
/* GimpParamPath */
......
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