Skip to content

Commit

Permalink
2003-06-15 Masatake YAMATO <yamato@redhat.com>
Browse files Browse the repository at this point in the history
	* main.c (read_command_line): added new parameter, input_opts.
	(main): passed input_opts to read_command_line.
	Don't set input_opts->background_color here.
	(read_command_line): Set input_opts->background_color here.
	(read_command_line): Set input_opts->charcode here.

2003-06-12  Serge Vakulenko <vak@cronyx.ru>

	(Logged by Masatake.)

	* autotrace.h (_at_fitting_opts_type): added charcode.

	* autotrace.h (struct _at_input_opts_type): added charcode.

	* fit.c (new_fitting_opts): Initialize charcode.
	(fit_one_spline): Fixed two bugs, which caused unexpected aborts with
	diagnostics "zero determinant of C0*C1"
	and "assertion error in line 1276 of fit.c".

	* main.c (read_command_line::long_options): Added
	charcode as an option.

	* module.c: Added gf input.

	* output.c: included output-ugs.h.
	(output_formats): Added ugs output.
  • Loading branch information
masatake authored and autotrace committed Jul 23, 2013
1 parent 3d8c995 commit 76e261a
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 15 deletions.
29 changes: 29 additions & 0 deletions ChangeLog
@@ -1,3 +1,32 @@
2003-06-15 Masatake YAMATO <yamato@redhat.com>

* main.c (read_command_line): added new parameter, input_opts.
(main): passed input_opts to read_command_line.
Don't set input_opts->background_color here.
(read_command_line): Set input_opts->background_color here.
(read_command_line): Set input_opts->charcode here.

2003-06-12 Serge Vakulenko <vak@cronyx.ru>

(Logged by Masatake.)

* autotrace.h (_at_fitting_opts_type): added charcode.

* autotrace.h (struct _at_input_opts_type): added charcode.

* fit.c (new_fitting_opts): Initialize charcode.
(fit_one_spline): Fixed two bugs, which caused unexpected aborts with
diagnostics "zero determinant of C0*C1"
and "assertion error in line 1276 of fit.c".

* main.c (read_command_line::long_options): Added
charcode as an option.

* module.c: Added gf input.

* output.c: included output-ugs.h.
(output_formats): Added ugs output.

2003-06-11 Masatake YAMATO <yamato@redhat.com>

* tools-version.sh (TOOLS): Added glib-gettextize.
Expand Down
7 changes: 6 additions & 1 deletion HACKING
Expand Up @@ -109,11 +109,16 @@ This variable is passed to aclocal that is invoked by autogen.sh.

See http://sourceforge.net/cvs/?group_id=11789

The module name is autotrace. After checking out the codes, invoke
The module name is autotrace. After checking out the code, invoke
autogen.sh in the distribution. That generates configure.in,
Makefile.in and so on. autogen.sh invokes automake, autoconf, aclocal
and autofig.

When you check out the code, you will find autotrace-0.27pre directory
under autotrace source code top directory. You should ignore
autotrace-0.27pre directory. The directory was checked in by
my mistake(Masatake YAMATO). It is difficult to remove a
directory from a CVS repository.

* Autofig

Expand Down
2 changes: 2 additions & 0 deletions Makefile.am
Expand Up @@ -32,6 +32,7 @@ endif
input_src=input-pnm.c input-pnm.h \
input-bmp.c input-bmp.h \
input-tga.c input-tga.h \
input-gf.c input-gf.h \
$(input_png_src) \
$(input_magick_src)

Expand All @@ -51,6 +52,7 @@ output-er.c output-er.h \
output-fig.c output-fig.h \
output-sk.c output-sk.h \
output-svg.c output-svg.h \
output-ugs.c output-ugs.h \
output-p2e.c output-p2e.h \
output-emf.c output-emf.h \
output-dxf.c output-dxf.h \
Expand Down
1 change: 1 addition & 0 deletions THANKS
Expand Up @@ -22,3 +22,4 @@ Ralf Stubner (bugfixes about pstoedit usage)
Dag Wieers (rpm-spec file)
Mario Kleiner (fix a bug in mig output)
jakobfrandsen (report a bug in Makefile.am)
Serge Vakulenko (fix a bug, usg export, gf import)
2 changes: 2 additions & 0 deletions autotrace.c
Expand Up @@ -86,6 +86,7 @@ at_input_opts_new(void)
at_input_opts_type * opts;
XMALLOC(opts, sizeof(at_input_opts_type));
opts->background_color = NULL;
opts->charcode = 0;
return opts;
}

Expand All @@ -94,6 +95,7 @@ at_input_opts_copy(at_input_opts_type * original)
{
at_input_opts_type * opts;
opts = at_input_opts_new();
*opts = *original;
if (original->background_color)
opts->background_color = at_color_copy(original->background_color);
return opts;
Expand Down
6 changes: 6 additions & 0 deletions autotrace.h
Expand Up @@ -123,6 +123,11 @@ N_("background-color <hexadezimal>: the color of the background that " \
"default is no background color.")
at_color_type *background_color;

#define at_doc__charcode \
N_("charcode <unsigned>: code of character to load from GF file, " \
"allowed are 0..255; default is the first character in font.")
unsigned charcode;

#define at_doc__color_count \
N_("color-count <unsigned>: number of colors a color bitmap is reduced to, " \
"it does not work on grayscale, allowed are 1..256; " \
Expand Down Expand Up @@ -209,6 +214,7 @@ N_("width-weight-factor <real>: weight factor for fitting the linewidth.")
struct _at_input_opts_type
{
at_color_type *background_color;
unsigned charcode; /* Character code used only in GF input.*/
};

struct _at_output_opts_type
Expand Down
15 changes: 9 additions & 6 deletions fit.c
Expand Up @@ -110,6 +110,7 @@ new_fitting_opts (void)
fitting_opts_type fitting_opts;

fitting_opts.background_color = NULL;
fitting_opts.charcode = 0;
fitting_opts.color_count = 0;
fitting_opts.corner_always_threshold = (at_real) 60.0;
fitting_opts.corner_surround = 4;
Expand Down Expand Up @@ -1280,14 +1281,15 @@ fit_one_spline (curve_type curve,
C0_C1_det = C[0][0] * C[1][1] - C[1][0] * C[0][1];
if (C0_C1_det == 0.0)
{
LOG ("zero determinant of C0*C1");
at_exception_fatal(exception, "zero determinant of C0*C1");
goto cleanup;
/* Zero determinant */
alpha1 = 0;
alpha2 = 0;
}

else
{
alpha1 = X_C1_det / C0_C1_det;
alpha2 = C0_X_det / C0_C1_det;

}
CONTROL1 (spline) = Vadd_point (START_POINT (spline),
Vmult_scalar (t1_hat, alpha1));
CONTROL2 (spline) = Vadd_point (END_POINT (spline),
Expand Down Expand Up @@ -1321,7 +1323,8 @@ set_initial_parameter_values (curve_type curve)
CURVE_T (curve, p) = CURVE_T (curve, p - 1) + d;
}

assert (LAST_CURVE_T (curve) != 0.0);
if (LAST_CURVE_T (curve) == 0.0)
LAST_CURVE_T (curve) = 1.0;

for (p = 1; p < CURVE_LENGTH (curve); p++)
CURVE_T (curve, p) = CURVE_T (curve, p) / LAST_CURVE_T (curve);
Expand Down
23 changes: 16 additions & 7 deletions main.c
Expand Up @@ -57,6 +57,7 @@ static void dot_printer(at_real percentage, at_address client_data);

static char * read_command_line (int, char * [],
at_fitting_opts_type *,
at_input_opts_type *,
at_output_opts_type *);

static unsigned int hctoi (char c);
Expand Down Expand Up @@ -94,9 +95,11 @@ main (int argc, char * argv[])
textdomain(PACKAGE);
#endif /* Def: ENABLE_NLS */

fitting_opts = at_fitting_opts_new ();
output_opts = at_output_opts_new ();
input_name = read_command_line (argc, argv, fitting_opts, output_opts);
fitting_opts = at_fitting_opts_new ();
input_opts = at_input_opts_new ();
output_opts = at_output_opts_new ();

input_name = read_command_line (argc, argv, fitting_opts, input_opts, output_opts);

if (strgicmp (output_name, input_name))
FATAL(_("Input and output file may not be the same\n"));
Expand Down Expand Up @@ -141,10 +144,6 @@ main (int argc, char * argv[])
/* Open the main input file. */
if (input_reader != NULL)
{
input_opts = at_input_opts_new ();
if (fitting_opts->background_color)
input_opts->background_color = at_color_copy(fitting_opts->background_color);

bitmap = at_bitmap_read(input_reader, input_name, input_opts,
exception_handler, NULL);

Expand Down Expand Up @@ -214,6 +213,7 @@ main (int argc, char * argv[])
should be ignored, for example FFFFFF;\n\
default is no background color.\n\
centerline: trace a character's centerline, rather than its outline.\n\
charcode <unsigned>: code of character to load from GF font file.\n\
color-count <unsigned>: number of colors a color bitmap is reduced to,\n\
it does not work on grayscale, allowed are 1..256;\n\
default is 0, that means not color reduction is done.\n\
Expand Down Expand Up @@ -265,6 +265,7 @@ width-weight-factor <real>: weight factor for fitting the linewidth.\n\
static char *
read_command_line (int argc, char * argv[],
at_fitting_opts_type * fitting_opts,
at_input_opts_type * input_opts,
at_output_opts_type * output_opts)
{
int g; /* `getopt' return code. */
Expand All @@ -275,6 +276,7 @@ read_command_line (int argc, char * argv[],
{ "debug-arch", 0, 0, 0 },
{ "debug-bitmap", 0, (int *)&dumping_bitmap, 1 },
{ "centerline", 0, 0, 0 },
{ "charcode", 1, 0, 0 },
{ "color-count", 1, 0, 0 },
{ "corner-always-threshold", 1, 0, 0 },
{ "corner-surround", 1, 0, 0 },
Expand Down Expand Up @@ -323,10 +325,17 @@ read_command_line (int argc, char * argv[],
fitting_opts->background_color = at_color_new((unsigned char)(hctoi (optarg[0]) * 16 + hctoi (optarg[1])),
(unsigned char)(hctoi (optarg[2]) * 16 + hctoi (optarg[3])),
(unsigned char)(hctoi (optarg[4]) * 16 + hctoi (optarg[5])));
input_opts->background_color = at_color_copy(fitting_opts->background_color);
}
else if (ARGUMENT_IS ("centerline"))
fitting_opts->centerline = true;

else if (ARGUMENT_IS ("charcode"))
{
fitting_opts->charcode = strtoul (optarg, 0, 0);
input_opts->charcode = fitting_opts->charcode;
}

else if (ARGUMENT_IS ("color-count"))
fitting_opts->color_count = atou (optarg);

Expand Down
4 changes: 3 additions & 1 deletion module.c
Expand Up @@ -30,6 +30,8 @@
#include "input-pnm.h"
#include "input-bmp.h"
#include "input-tga.h"
#include "input-gf.h"

#ifdef HAVE_LIBPNG
#include "input-png.h"
#endif /* HAVE_LIBPNG */
Expand All @@ -56,7 +58,7 @@ at_module_init (void)
at_input_add_handler_full ("PGM", "Portable graymap format", input_pnm_reader, 0, "PGM", NULL);
at_input_add_handler_full ("PPM", "Portable pixmap format", input_pnm_reader, 0, "PPM", NULL);


at_input_add_handler ("GF", "TeX raster font", input_gf_reader);
#if HAVE_MAGICK

#if (MagickLibVersion < 0x0534)
Expand Down
2 changes: 2 additions & 0 deletions output.c
Expand Up @@ -32,6 +32,7 @@
#include "output-p2e.h"
#include "output-sk.h"
#include "output-svg.h"
#include "output-ugs.h"
#include "output-fig.h"
#ifdef HAVE_LIBSWF
#include "output-swf.h"
Expand Down Expand Up @@ -61,6 +62,7 @@ static struct output_format_entry output_formats[] = {
{"p2e", "pstoedit frontend format", output_p2e_writer},
{"sk", "Sketch", output_sk_writer},
{"svg", "Scalable Vector Graphics", output_svg_writer},
{"ugs", "Unicode glyph source", output_ugs_writer},
{"fig", "XFIG 3.2", output_fig_writer},
#ifdef HAVE_LIBSWF
{"swf", "Shockwave Flash 3", output_swf_writer},
Expand Down

0 comments on commit 76e261a

Please sign in to comment.