added new enum GimpTextHintStyle.

2008-10-27  Sven Neumann  <sven@gimp.org>

	* libgimpbase/gimpbaseenums.[ch]: added new enum 
GimpTextHintStyle.

	* libgimp/gimpenums.c.tail
	* tools/pdbgen/enums.pl: regenerated.

	* app/text/gimptext.[ch]: added new property "hint-style". 
Removed
	"autohint" property and mapped the boolean property "hinting" to
	the new enum property "hint-style".

	* app/text/gimptextlayout-render.c 
(gimp_text_layout_render_flags):
	use "hint-style".

	* app/tools/gimptextoptions.[ch]: changed tool options 
accordingly.

	* tools/pdbgen/pdb/text_layer.pdb: deprecated the "hinting" API
	and introduced getters and setters for "hint-style".

	* app/pdb/text-layer-cmds.c
	* app/pdb/internal-procs.c
	* libgimp/gimptextlayer_pdb.[ch]: regenerated.


svn path=/trunk/; revision=27432
This commit is contained in:
Sven Neumann 2008-10-27 07:59:32 +00:00 committed by Sven Neumann
parent cd0885518b
commit 033fcf1628
15 changed files with 678 additions and 329 deletions

View file

@ -1,3 +1,26 @@
2008-10-27 Sven Neumann <sven@gimp.org>
* libgimpbase/gimpbaseenums.[ch]: added new enum GimpTextHintStyle.
* libgimp/gimpenums.c.tail
* tools/pdbgen/enums.pl: regenerated.
* app/text/gimptext.[ch]: added new property "hint-style". Removed
"autohint" property and mapped the boolean property "hinting" to
the new enum property "hint-style".
* app/text/gimptextlayout-render.c (gimp_text_layout_render_flags):
use "hint-style".
* app/tools/gimptextoptions.[ch]: changed tool options accordingly.
* tools/pdbgen/pdb/text_layer.pdb: deprecated the "hinting" API
and introduced getters and setters for "hint-style".
* app/pdb/text-layer-cmds.c
* app/pdb/internal-procs.c
* libgimp/gimptextlayer_pdb.[ch]: regenerated.
2008-10-27 Michael Natterer <mitch@gimp.org>
* app/tools/gimpdrawtool.[ch]: add gimp_draw_tool_set_clip_rect()

View file

@ -29,7 +29,7 @@
#include "internal-procs.h"
/* 593 procedures registered total */
/* 595 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)

View file

@ -326,86 +326,6 @@ text_layer_set_font_size_invoker (GimpProcedure *procedure,
error ? *error : NULL);
}
static GValueArray *
text_layer_get_hinting_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
GimpLayer *layer;
gboolean hinting = FALSE;
gboolean autohint = FALSE;
layer = gimp_value_get_layer (&args->values[0], gimp);
if (success)
{
if (gimp_pdb_layer_is_text_layer (layer, error))
{
g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
"hinting", &hinting,
"autohint", &autohint,
NULL);
}
else
{
success = FALSE;
}
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
{
g_value_set_boolean (&return_vals->values[1], hinting);
g_value_set_boolean (&return_vals->values[2], autohint);
}
return return_vals;
}
static GValueArray *
text_layer_set_hinting_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpLayer *layer;
gboolean hinting;
gboolean autohint;
layer = gimp_value_get_layer (&args->values[0], gimp);
hinting = g_value_get_boolean (&args->values[1]);
autohint = g_value_get_boolean (&args->values[2]);
if (success)
{
if (gimp_pdb_layer_is_text_layer (layer, error))
{
gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
_("Set text layer attribute"),
"hinting", hinting,
"autohint", autohint,
NULL);
}
else
{
success = FALSE;
}
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GValueArray *
text_layer_get_antialias_invoker (GimpProcedure *procedure,
Gimp *gimp,
@ -478,6 +398,78 @@ text_layer_set_antialias_invoker (GimpProcedure *procedure,
error ? *error : NULL);
}
static GValueArray *
text_layer_get_hint_style_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
GimpLayer *layer;
gint32 style = 0;
layer = gimp_value_get_layer (&args->values[0], gimp);
if (success)
{
if (gimp_pdb_layer_is_text_layer (layer, error))
{
g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
"hint-style", &style,
NULL);
}
else
{
success = FALSE;
}
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_enum (&return_vals->values[1], style);
return return_vals;
}
static GValueArray *
text_layer_set_hint_style_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpLayer *layer;
gint32 style;
layer = gimp_value_get_layer (&args->values[0], gimp);
style = g_value_get_enum (&args->values[1]);
if (success)
{
if (gimp_pdb_layer_is_text_layer (layer, error))
{
gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
_("Set text layer attribute"),
"hint-style", style,
NULL);
}
else
{
success = FALSE;
}
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GValueArray *
text_layer_get_kerning_invoker (GimpProcedure *procedure,
Gimp *gimp,
@ -1052,6 +1044,84 @@ text_layer_set_letter_spacing_invoker (GimpProcedure *procedure,
error ? *error : NULL);
}
static GValueArray *
text_layer_get_hinting_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
GimpLayer *layer;
gboolean hinting = FALSE;
gboolean autohint = FALSE;
layer = gimp_value_get_layer (&args->values[0], gimp);
if (success)
{
if (gimp_pdb_layer_is_text_layer (layer, error))
{
g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
"hinting", &hinting,
NULL);
}
else
{
success = FALSE;
}
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
{
g_value_set_boolean (&return_vals->values[1], hinting);
g_value_set_boolean (&return_vals->values[2], autohint);
}
return return_vals;
}
static GValueArray *
text_layer_set_hinting_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpLayer *layer;
gboolean hinting;
gboolean autohint;
layer = gimp_value_get_layer (&args->values[0], gimp);
hinting = g_value_get_boolean (&args->values[1]);
autohint = g_value_get_boolean (&args->values[2]);
if (success)
{
if (gimp_pdb_layer_is_text_layer (layer, error))
{
gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
_("Set text layer attribute"),
"hinting", hinting,
NULL);
}
else
{
success = FALSE;
}
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
void
register_text_layer_procs (GimpPDB *pdb)
{
@ -1308,76 +1378,6 @@ register_text_layer_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-text-layer-get-hinting
*/
procedure = gimp_procedure_new (text_layer_get_hinting_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-text-layer-get-hinting");
gimp_procedure_set_static_strings (procedure,
"gimp-text-layer-get-hinting",
"Get information about hinting in the specified text layer.",
"This procedure provides information about the hinting that is being used in a text layer.",
"Marcus Heese <heese@cip.ifi.lmu.de>",
"Marcus Heese",
"2008",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_layer_id ("layer",
"layer",
"The text layer",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_boolean ("hinting",
"hinting",
"A flag which is true if hinting is used on the font.",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_boolean ("autohint",
"autohint",
"A flag which is true if the text layer is forced to use the autohinter from FreeType.",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-text-layer-set-hinting
*/
procedure = gimp_procedure_new (text_layer_set_hinting_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-text-layer-set-hinting");
gimp_procedure_set_static_strings (procedure,
"gimp-text-layer-set-hinting",
"Enable/disable the use of hinting in a text layer.",
"This procedure enables or disables hinting on the text of a text layer. If you enable 'auto-hint', FreeType\'s automatic hinter will be used and hinting information from the font will be ignored.",
"Marcus Heese <heese@cip.ifi.lmu.de>",
"Marcus Heese",
"2008",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_layer_id ("layer",
"layer",
"The text layer",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("hinting",
"hinting",
"Enable/disable the use of hinting on the text",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("autohint",
"autohint",
"Force the use of the autohinter provided through FreeType",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-text-layer-get-antialias
*/
@ -1436,6 +1436,66 @@ register_text_layer_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-text-layer-get-hint-style
*/
procedure = gimp_procedure_new (text_layer_get_hint_style_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-text-layer-get-hint-style");
gimp_procedure_set_static_strings (procedure,
"gimp-text-layer-get-hint-style",
"Get information about hinting in the specified text layer.",
"This procedure provides information about the hinting that is being used in a text layer. Hinting can be optimized for fidelity or contrast or it can be turned entirely off.",
"Marcus Heese <heese@cip.ifi.lmu.de>",
"Marcus Heese",
"2008",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_layer_id ("layer",
"layer",
"The text layer",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_enum ("style",
"style",
"The hint style used for font outlines",
GIMP_TYPE_TEXT_HINT_STYLE,
GIMP_TEXT_HINT_STYLE_NONE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-text-layer-set-hint-style
*/
procedure = gimp_procedure_new (text_layer_set_hint_style_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-text-layer-set-hint-style");
gimp_procedure_set_static_strings (procedure,
"gimp-text-layer-set-hint-style",
"Control how font outlines are hinted in a text layer.",
"This procedure sets the hint style for font outlines in a text layer. This controls whether to fit font outlines to the pixel grid, and if so, whether to optimize for fidelity or contrast.",
"Sven Neumann <sven@gimp.org>",
"Sven Neumann",
"2008",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_layer_id ("layer",
"layer",
"The text layer",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_enum ("style",
"style",
"The new hint style",
GIMP_TYPE_TEXT_HINT_STYLE,
GIMP_TEXT_HINT_STYLE_NONE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-text-layer-get-kerning
*/
@ -1907,4 +1967,74 @@ register_text_layer_procs (GimpPDB *pdb)
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-text-layer-get-hinting
*/
procedure = gimp_procedure_new (text_layer_get_hinting_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-text-layer-get-hinting");
gimp_procedure_set_static_strings (procedure,
"gimp-text-layer-get-hinting",
"This procedure is deprecated! Use 'gimp-text-layer-get-hint-style' instead.",
"This procedure is deprecated! Use 'gimp-text-layer-get-hint-style' instead.",
"",
"",
"",
"gimp-text-layer-get-hint-style");
gimp_procedure_add_argument (procedure,
gimp_param_spec_layer_id ("layer",
"layer",
"The text layer",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_boolean ("hinting",
"hinting",
"A flag which is true if hinting is used on the font.",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_boolean ("autohint",
"autohint",
"A flag which is true if the text layer is forced to use the autohinter from FreeType.",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-text-layer-set-hinting
*/
procedure = gimp_procedure_new (text_layer_set_hinting_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-text-layer-set-hinting");
gimp_procedure_set_static_strings (procedure,
"gimp-text-layer-set-hinting",
"Enable/disable the use of hinting in a text layer.",
"This procedure enables or disables hinting on the text of a text layer. If you enable 'auto-hint', FreeType\'s automatic hinter will be used and hinting information from the font will be ignored.",
"Marcus Heese <heese@cip.ifi.lmu.de>",
"Marcus Heese",
"2008",
"gimp-text-layer-set-hint-style");
gimp_procedure_add_argument (procedure,
gimp_param_spec_layer_id ("layer",
"layer",
"The text layer",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("hinting",
"hinting",
"Enable/disable the use of hinting on the text",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("autohint",
"autohint",
"Force the use of the autohinter provided through FreeType",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
}

View file

@ -46,9 +46,8 @@ enum
PROP_FONT,
PROP_FONT_SIZE,
PROP_UNIT,
PROP_HINTING,
PROP_AUTOHINT,
PROP_ANTIALIAS,
PROP_HINT_STYLE,
PROP_KERNING,
PROP_LANGUAGE,
PROP_BASE_DIR,
@ -65,7 +64,9 @@ enum
PROP_TRANSFORMATION,
PROP_OFFSET_X,
PROP_OFFSET_Y,
PROP_BORDER
PROP_BORDER,
/* for backward compatibility */
PROP_HINTING
};
@ -128,19 +129,16 @@ gimp_text_class_init (GimpTextClass *klass)
"font-size-unit", NULL,
TRUE, FALSE, GIMP_UNIT_PIXEL,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_HINTING,
"hinting", NULL,
TRUE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_AUTOHINT,
"autohint", NULL,
FALSE,
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_DEFAULTS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ANTIALIAS,
"antialias", NULL,
TRUE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_HINT_STYLE,
"hint-style", NULL,
GIMP_TYPE_TEXT_HINT_STYLE,
GIMP_TEXT_HINT_STYLE_MEDIUM,
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_DEFAULTS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_KERNING,
"kerning", NULL,
FALSE,
@ -228,6 +226,12 @@ gimp_text_class_init (GimpTextClass *klass)
G_PARAM_CONSTRUCT |
GIMP_PARAM_WRITABLE));
/* the old hinting options have been replaced by 'hint-style' */
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_HINTING,
"hinting", NULL,
TRUE,
GIMP_PARAM_STATIC_STRINGS);
g_free (language);
}
@ -282,15 +286,12 @@ gimp_text_get_property (GObject *object,
case PROP_UNIT:
g_value_set_int (value, text->unit);
break;
case PROP_HINTING:
g_value_set_boolean (value, text->hinting);
break;
case PROP_AUTOHINT:
g_value_set_boolean (value, text->autohint);
break;
case PROP_ANTIALIAS:
g_value_set_boolean (value, text->antialias);
break;
case PROP_HINT_STYLE:
g_value_set_enum (value, text->hint_style);
break;
case PROP_KERNING:
g_value_set_boolean (value, text->kerning);
break;
@ -339,6 +340,10 @@ gimp_text_get_property (GObject *object,
case PROP_OFFSET_Y:
g_value_set_double (value, text->offset_y);
break;
case PROP_HINTING:
g_value_set_boolean (value,
text->hint_style != GIMP_TEXT_HINT_STYLE_NONE);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@ -388,15 +393,12 @@ gimp_text_set_property (GObject *object,
case PROP_UNIT:
text->unit = g_value_get_int (value);
break;
case PROP_HINTING:
text->hinting = g_value_get_boolean (value);
break;
case PROP_AUTOHINT:
text->autohint = g_value_get_boolean (value);
break;
case PROP_ANTIALIAS:
text->antialias = g_value_get_boolean (value);
break;
case PROP_HINT_STYLE:
text->hint_style = g_value_get_enum (value);
break;
case PROP_KERNING:
text->kerning = g_value_get_boolean (value);
break;
@ -451,6 +453,11 @@ gimp_text_set_property (GObject *object,
case PROP_BORDER:
text->border = g_value_get_int (value);
break;
case PROP_HINTING:
text->hint_style = (g_value_get_boolean (value) ?
GIMP_TEXT_HINT_STYLE_MEDIUM :
GIMP_TEXT_HINT_STYLE_NONE);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;

View file

@ -45,9 +45,8 @@ struct _GimpText
gchar *font;
GimpUnit unit;
gdouble font_size;
gboolean hinting;
gboolean autohint;
gboolean antialias;
GimpTextHintStyle hint_style;
gboolean kerning;
gchar *language;
GimpTextDirection base_dir;

View file

@ -208,16 +208,24 @@ gimp_text_layout_render_flags (GimpTextLayout *layout)
CAIRO_ANTIALIAS_DEFAULT :
CAIRO_ANTIALIAS_NONE));
/*
* FIXME:
*
* The autohint property can't be supported any longer, but we
* should expose the cairo_hint_style_t enum.
*/
switch (text->hint_style)
{
case GIMP_TEXT_HINT_STYLE_NONE:
cairo_font_options_set_hint_style (flags, CAIRO_HINT_STYLE_NONE);
break;
cairo_font_options_set_hint_style (flags, (text->hinting ?
CAIRO_HINT_STYLE_DEFAULT :
CAIRO_HINT_STYLE_NONE));
case GIMP_TEXT_HINT_STYLE_SLIGHT:
cairo_font_options_set_hint_style (flags, CAIRO_HINT_STYLE_SLIGHT);
break;
case GIMP_TEXT_HINT_STYLE_MEDIUM:
cairo_font_options_set_hint_style (flags, CAIRO_HINT_STYLE_MEDIUM);
break;
case GIMP_TEXT_HINT_STYLE_FULL:
cairo_font_options_set_hint_style (flags, CAIRO_HINT_STYLE_FULL);
break;
}
return flags;
}

View file

@ -53,9 +53,8 @@ enum
PROP_0 = GIMP_RECTANGLE_OPTIONS_PROP_LAST + 1,
PROP_FONT_SIZE,
PROP_UNIT,
PROP_HINTING,
PROP_AUTOHINT,
PROP_ANTIALIAS,
PROP_HINT_STYLE,
PROP_LANGUAGE,
PROP_BASE_DIR,
PROP_JUSTIFICATION,
@ -123,24 +122,18 @@ gimp_text_options_class_init (GimpTextOptionsClass *klass)
"font-size", NULL,
0.0, 8192.0, 18.0,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_HINTING,
"hinting",
N_("Hinting alters the font outline to "
"produce a crisp bitmap at small "
"sizes"),
TRUE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_AUTOHINT,
"autohint",
N_("If available, hints from the font are "
"used but you may prefer to always use "
"the automatic hinter"),
FALSE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ANTIALIAS,
"antialias", NULL,
TRUE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_HINT_STYLE,
"hint-style",
N_("Hinting alters the font outline to "
"produce a crisp bitmap at small "
"sizes"),
GIMP_TYPE_TEXT_HINT_STYLE,
GIMP_TEXT_HINT_STYLE_MEDIUM,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_LANGUAGE,
"language", NULL,
(const gchar *) gtk_get_default_language (),
@ -220,15 +213,12 @@ gimp_text_options_get_property (GObject *object,
case PROP_UNIT:
g_value_set_int (value, options->unit);
break;
case PROP_HINTING:
g_value_set_boolean (value, options->hinting);
break;
case PROP_AUTOHINT:
g_value_set_boolean (value, options->autohint);
break;
case PROP_ANTIALIAS:
g_value_set_boolean (value, options->antialias);
break;
case PROP_HINT_STYLE:
g_value_set_enum (value, options->hint_style);
break;
case PROP_LANGUAGE:
g_value_set_string (value, options->language);
break;
@ -281,15 +271,12 @@ gimp_text_options_set_property (GObject *object,
case PROP_UNIT:
options->unit = g_value_get_int (value);
break;
case PROP_HINTING:
options->hinting = g_value_get_boolean (value);
break;
case PROP_AUTOHINT:
options->autohint = g_value_get_boolean (value);
break;
case PROP_ANTIALIAS:
options->antialias = g_value_get_boolean (value);
break;
case PROP_HINT_STYLE:
options->hint_style = g_value_get_enum (value);
break;
case PROP_BASE_DIR:
options->base_dir = g_value_get_enum (value);
break;
@ -442,7 +429,6 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *auto_button;
GtkWidget *entry;
GtkWidget *box;
GtkWidget *spinbutton;
@ -478,23 +464,11 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = gimp_prop_check_button_new (config, "hinting", _("Hinting"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
auto_button = gimp_prop_check_button_new (config, "autohint",
_("Force auto-hinter"));
gtk_box_pack_start (GTK_BOX (vbox), auto_button, FALSE, FALSE, 0);
gtk_widget_show (auto_button);
gtk_widget_set_sensitive (auto_button, options->hinting);
g_object_set_data (G_OBJECT (button), "set_sensitive", auto_button);
button = gimp_prop_check_button_new (config, "antialias", _("Antialiasing"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
table = gtk_table_new (5, 3, FALSE);
table = gtk_table_new (6, 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 (main_vbox), table, FALSE, FALSE, 0);
@ -504,6 +478,12 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
button = gimp_prop_enum_combo_box_new (config, "hint-style", -1, -1);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Hinting:"), 0.0, 0.5,
button, 1, TRUE);
gtk_size_group_add_widget (size_group, button);
button = gimp_prop_color_button_new (config, "foreground", _("Text Color"),
40, 24, GIMP_COLOR_AREA_FLAT);
gimp_color_panel_set_context (GIMP_COLOR_PANEL (button),

View file

@ -40,9 +40,8 @@ struct _GimpTextOptions
GimpUnit unit;
gdouble font_size;
gboolean hinting;
gboolean autohint;
gboolean antialias;
GimpTextHintStyle hint_style;
gchar *language;
GimpTextDirection base_dir;
GimpTextJustification justify;

View file

@ -48,6 +48,7 @@ static const GimpGetTypeFunc get_type_funcs[] =
gimp_size_type_get_type,
gimp_stack_trace_mode_get_type,
gimp_text_direction_get_type,
gimp_text_hint_style_get_type,
gimp_text_justification_get_type,
gimp_transfer_mode_get_type,
gimp_transform_direction_get_type,
@ -103,6 +104,7 @@ static const gchar * const type_names[] =
"GimpSizeType",
"GimpStackTraceMode",
"GimpTextDirection",
"GimpTextHintStyle",
"GimpTextJustification",
"GimpTransferMode",
"GimpTransformDirection",

View file

@ -24,6 +24,9 @@
#include "config.h"
#include "gimp.h"
#undef GIMP_DISABLE_DEPRECATED
#undef __GIMP_TEXT_LAYER_PDB_H__
#include "gimptextlayer_pdb.h"
/**
* gimp_text_layer_new:
@ -283,83 +286,6 @@ gimp_text_layer_set_font_size (gint32 layer_ID,
return success;
}
/**
* gimp_text_layer_get_hinting:
* @layer_ID: The text layer.
* @autohint: A flag which is true if the text layer is forced to use the autohinter from FreeType.
*
* Get information about hinting in the specified text layer.
*
* This procedure provides information about the hinting that is being
* used in a text layer.
*
* Returns: A flag which is true if hinting is used on the font.
*
* Since: GIMP 2.6
*/
gboolean
gimp_text_layer_get_hinting (gint32 layer_ID,
gboolean *autohint)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean hinting = FALSE;
return_vals = gimp_run_procedure ("gimp-text-layer-get-hinting",
&nreturn_vals,
GIMP_PDB_LAYER, layer_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
hinting = return_vals[1].data.d_int32;
*autohint = return_vals[2].data.d_int32;
}
gimp_destroy_params (return_vals, nreturn_vals);
return hinting;
}
/**
* gimp_text_layer_set_hinting:
* @layer_ID: The text layer.
* @hinting: Enable/disable the use of hinting on the text.
* @autohint: Force the use of the autohinter provided through FreeType.
*
* Enable/disable the use of hinting in a text layer.
*
* This procedure enables or disables hinting on the text of a text
* layer. If you enable 'auto-hint', FreeType\'s automatic hinter will
* be used and hinting information from the font will be ignored.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.6
*/
gboolean
gimp_text_layer_set_hinting (gint32 layer_ID,
gboolean hinting,
gboolean autohint)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-text-layer-set-hinting",
&nreturn_vals,
GIMP_PDB_LAYER, layer_ID,
GIMP_PDB_INT32, hinting,
GIMP_PDB_INT32, autohint,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_text_layer_get_antialias:
* @layer_ID: The text layer.
@ -428,6 +354,76 @@ gimp_text_layer_set_antialias (gint32 layer_ID,
return success;
}
/**
* gimp_text_layer_get_hint_style:
* @layer_ID: The text layer.
*
* Get information about hinting in the specified text layer.
*
* This procedure provides information about the hinting that is being
* used in a text layer. Hinting can be optimized for fidelity or
* contrast or it can be turned entirely off.
*
* Returns: The hint style used for font outlines.
*
* Since: GIMP 2.8
*/
GimpTextHintStyle
gimp_text_layer_get_hint_style (gint32 layer_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpTextHintStyle style = 0;
return_vals = gimp_run_procedure ("gimp-text-layer-get-hint-style",
&nreturn_vals,
GIMP_PDB_LAYER, layer_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
style = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return style;
}
/**
* gimp_text_layer_set_hint_style:
* @layer_ID: The text layer.
* @style: The new hint style.
*
* Control how font outlines are hinted in a text layer.
*
* This procedure sets the hint style for font outlines in a text
* layer. This controls whether to fit font outlines to the pixel grid,
* and if so, whether to optimize for fidelity or contrast.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.8
*/
gboolean
gimp_text_layer_set_hint_style (gint32 layer_ID,
GimpTextHintStyle style)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-text-layer-set-hint-style",
&nreturn_vals,
GIMP_PDB_LAYER, layer_ID,
GIMP_PDB_INT32, style,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_text_layer_get_kerning:
* @layer_ID: The text layer.
@ -972,3 +968,73 @@ gimp_text_layer_set_letter_spacing (gint32 layer_ID,
return success;
}
/**
* gimp_text_layer_get_hinting:
* @layer_ID: The text layer.
* @autohint: A flag which is true if the text layer is forced to use the autohinter from FreeType.
*
* This procedure is deprecated! Use gimp_text_layer_get_hint_style()
* instead.
*
* Returns: A flag which is true if hinting is used on the font.
*/
gboolean
gimp_text_layer_get_hinting (gint32 layer_ID,
gboolean *autohint)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean hinting = FALSE;
return_vals = gimp_run_procedure ("gimp-text-layer-get-hinting",
&nreturn_vals,
GIMP_PDB_LAYER, layer_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
hinting = return_vals[1].data.d_int32;
*autohint = return_vals[2].data.d_int32;
}
gimp_destroy_params (return_vals, nreturn_vals);
return hinting;
}
/**
* gimp_text_layer_set_hinting:
* @layer_ID: The text layer.
* @hinting: Enable/disable the use of hinting on the text.
* @autohint: Force the use of the autohinter provided through FreeType.
*
* This procedure is deprecated! Use gimp_text_layer_set_hint_style()
* instead.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.6
*/
gboolean
gimp_text_layer_set_hinting (gint32 layer_ID,
gboolean hinting,
gboolean autohint)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-text-layer-set-hinting",
&nreturn_vals,
GIMP_PDB_LAYER, layer_ID,
GIMP_PDB_INT32, hinting,
GIMP_PDB_INT32, autohint,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}

View file

@ -45,14 +45,12 @@ gdouble gimp_text_layer_get_font_size (gint32
gboolean gimp_text_layer_set_font_size (gint32 layer_ID,
gdouble font_size,
GimpUnit unit);
gboolean gimp_text_layer_get_hinting (gint32 layer_ID,
gboolean *autohint);
gboolean gimp_text_layer_set_hinting (gint32 layer_ID,
gboolean hinting,
gboolean autohint);
gboolean gimp_text_layer_get_antialias (gint32 layer_ID);
gboolean gimp_text_layer_set_antialias (gint32 layer_ID,
gboolean antialias);
GimpTextHintStyle gimp_text_layer_get_hint_style (gint32 layer_ID);
gboolean gimp_text_layer_set_hint_style (gint32 layer_ID,
GimpTextHintStyle style);
gboolean gimp_text_layer_get_kerning (gint32 layer_ID);
gboolean gimp_text_layer_set_kerning (gint32 layer_ID,
gboolean kerning);
@ -78,6 +76,13 @@ gboolean gimp_text_layer_set_line_spacing (gint32
gdouble gimp_text_layer_get_letter_spacing (gint32 layer_ID);
gboolean gimp_text_layer_set_letter_spacing (gint32 layer_ID,
gdouble letter_spacing);
#ifndef GIMP_DISABLE_DEPRECATED
gboolean gimp_text_layer_get_hinting (gint32 layer_ID,
gboolean *autohint);
gboolean gimp_text_layer_set_hinting (gint32 layer_ID,
gboolean hinting,
gboolean autohint);
#endif /* GIMP_DISABLE_DEPRECATED */
G_END_DECLS

View file

@ -621,7 +621,7 @@ gimp_repeat_mode_get_type (void)
static const GimpEnumDesc descs[] =
{
{ GIMP_REPEAT_NONE, N_("None"), NULL },
{ GIMP_REPEAT_NONE, N_("repeat|None"), NULL },
{ GIMP_REPEAT_SAWTOOTH, N_("Sawtooth wave"), NULL },
{ GIMP_REPEAT_TRIANGULAR, N_("Triangular wave"), NULL },
{ 0, NULL, NULL }
@ -1088,6 +1088,39 @@ gimp_text_direction_get_type (void)
return type;
}
GType
gimp_text_hint_style_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_TEXT_HINT_STYLE_NONE, "GIMP_TEXT_HINT_STYLE_NONE", "none" },
{ GIMP_TEXT_HINT_STYLE_SLIGHT, "GIMP_TEXT_HINT_STYLE_SLIGHT", "slight" },
{ GIMP_TEXT_HINT_STYLE_MEDIUM, "GIMP_TEXT_HINT_STYLE_MEDIUM", "medium" },
{ GIMP_TEXT_HINT_STYLE_FULL, "GIMP_TEXT_HINT_STYLE_FULL", "full" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_TEXT_HINT_STYLE_NONE, N_("hinting|None"), NULL },
{ GIMP_TEXT_HINT_STYLE_SLIGHT, N_("hinting|Slight"), NULL },
{ GIMP_TEXT_HINT_STYLE_MEDIUM, N_("hinting|Medium"), NULL },
{ GIMP_TEXT_HINT_STYLE_FULL, N_("hinting|Full"), NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (! type)
{
type = g_enum_register_static ("GimpTextHintStyle", values);
gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType
gimp_text_justification_get_type (void)
{

View file

@ -269,7 +269,7 @@ GType gimp_repeat_mode_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_REPEAT_NONE, /*< desc="None" >*/
GIMP_REPEAT_NONE, /*< desc="repeat|None" >*/
GIMP_REPEAT_SAWTOOTH, /*< desc="Sawtooth wave" >*/
GIMP_REPEAT_TRIANGULAR /*< desc="Triangular wave" >*/
} GimpRepeatMode;
@ -473,6 +473,19 @@ typedef enum
} GimpTextDirection;
#define GIMP_TYPE_TEXT_HINT_STYLE (gimp_text_hint_style_get_type ())
GType gimp_text_hint_style_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_TEXT_HINT_STYLE_NONE, /*< desc="hinting|None" >*/
GIMP_TEXT_HINT_STYLE_SLIGHT, /*< desc="hinting|Slight" >*/
GIMP_TEXT_HINT_STYLE_MEDIUM, /*< desc="hinting|Medium" >*/
GIMP_TEXT_HINT_STYLE_FULL, /*< desc="hinting|Full" >*/
} GimpTextHintStyle;
#define GIMP_TYPE_TEXT_JUSTIFICATION (gimp_text_justification_get_type ())
GType gimp_text_justification_get_type (void) G_GNUC_CONST;

View file

@ -364,6 +364,18 @@ package Gimp::CodeGen::enums;
mapping => { GIMP_TEXT_DIRECTION_LTR => '0',
GIMP_TEXT_DIRECTION_RTL => '1' }
},
GimpTextHintStyle =>
{ contig => 1,
header => 'libgimpbase/gimpbaseenums.h',
symbols => [ qw(GIMP_TEXT_HINT_STYLE_NONE
GIMP_TEXT_HINT_STYLE_SLIGHT
GIMP_TEXT_HINT_STYLE_MEDIUM
GIMP_TEXT_HINT_STYLE_FULL) ],
mapping => { GIMP_TEXT_HINT_STYLE_NONE => '0',
GIMP_TEXT_HINT_STYLE_SLIGHT => '1',
GIMP_TEXT_HINT_STYLE_MEDIUM => '2',
GIMP_TEXT_HINT_STYLE_FULL => '3' }
},
GimpTextJustification =>
{ contig => 1,
header => 'libgimpbase/gimpbaseenums.h',

View file

@ -307,14 +307,7 @@ CODE
}
sub text_layer_get_hinting {
$blurb = 'Get information about hinting in the specified text layer.';
$help = <<'HELP';
This procedure provides information about the hinting that is being
used in a text layer.
HELP
&marcus_pdb_misc('2008', '2.6');
&std_pdb_deprecated ('gimp-text-layer-get-hint-style');
@inargs = (
{ name => 'layer', type => 'layer',
@ -334,8 +327,7 @@ HELP
if (gimp_pdb_layer_is_text_layer (layer, error))
{
g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
"hinting", &hinting,
"autohint", &autohint,
"hinting", &hinting,
NULL);
}
else
@ -348,6 +340,8 @@ CODE
}
sub text_layer_set_hinting {
&std_pdb_deprecated ('gimp-text-layer-set-hint-style');
$blurb = 'Enable/disable the use of hinting in a text layer.';
$help = <<'HELP';
@ -374,8 +368,7 @@ HELP
{
gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
_("Set text layer attribute"),
"hinting", hinting,
"autohint", autohint,
"hinting", hinting,
NULL);
}
else
@ -459,6 +452,82 @@ CODE
);
}
sub text_layer_get_hint_style {
$blurb = 'Get information about hinting in the specified text layer.';
$help = <<'HELP';
This procedure provides information about the hinting that is being
used in a text layer. Hinting can be optimized for fidelity or contrast
or it can be turned entirely off.
HELP
&marcus_pdb_misc('2008', '2.8');
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The text layer' }
);
@outargs = (
{ name => 'style', type => 'enum GimpTextHintStyle',
desc => 'The hint style used for font outlines' }
);
%invoke = (
code => <<'CODE'
{
if (gimp_pdb_layer_is_text_layer (layer, error))
{
g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
"hint-style", &style,
NULL);
}
else
{
success = FALSE;
}
}
CODE
);
}
sub text_layer_set_hint_style {
$blurb = 'Control how font outlines are hinted in a text layer.';
$help = <<'HELP';
This procedure sets the hint style for font outlines in a text
layer. This controls whether to fit font outlines to the pixel grid,
and if so, whether to optimize for fidelity or contrast.
HELP
&neo_pdb_misc('2008', '2.8');
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The text layer' },
{ name => 'style', type => 'enum GimpTextHintStyle',
desc => 'The new hint style' }
);
%invoke = (
code => <<'CODE'
{
if (gimp_pdb_layer_is_text_layer (layer, error))
{
gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
_("Set text layer attribute"),
"hint-style", style,
NULL);
}
else
{
success = FALSE;
}
}
CODE
);
}
sub text_layer_get_kerning {
$blurb = 'Check if kerning is used in the text layer.';
@ -1057,10 +1126,10 @@ CODE
text_layer_set_font
text_layer_get_font_size
text_layer_set_font_size
text_layer_get_hinting
text_layer_set_hinting
text_layer_get_antialias
text_layer_set_antialias
text_layer_get_hint_style
text_layer_set_hint_style
text_layer_get_kerning
text_layer_set_kerning
text_layer_get_language
@ -1076,7 +1145,10 @@ CODE
text_layer_get_line_spacing
text_layer_set_line_spacing
text_layer_get_letter_spacing
text_layer_set_letter_spacing);
text_layer_set_letter_spacing
text_layer_get_hinting
text_layer_set_hinting
);
%exports = (app => [@procs], lib => [@procs]);