• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

作図ソフト dia の改良版


Commit MetaInfo

Revision349519e2a8dd88eab0008baeb37a9a6dc65c9e9d (tree)
Time2008-03-16 22:02:48
AuthorHans Breuer <hans@breu...>
CommiterHans Breuer

Log Message

added missing exports

2008-03-16 Hans Breuer <hans@breuer.org>

* lib/libdia.def : added missing exports

[merged from svn://svn.gnome.org/svn/dia/branches/dia_0_96 revision 3657]

2007-03-29 Lars Clausen <lars@raeder.dk>

* NEWS:
* RELEASE-PROCESS:
* config.h.win32:
* doc/en/dia.xml:
* doc/pl/dia.xml:
* doc/eu/dia.xml:
* configure.in: Release 0.96.1 is a brown-bag release for empty
initial line problem in shapes, and a couple other bugs.

* app/diapsrenderer.c (draw_text_line): Use language-independent
float conversion in new text rendering code. Fixes bug #424052.

* plug-ins/vdx/vdx-import.c: Updated to version 0.9.4 to fix shape
problems and text errors. Fixes bug #417956.

* lib/text.c (text_key_event): Treat keypad enter like return.
Fixes bug #423480.

* plug-ins/dxf/dxf-import.c: Load closed polyline as polygon,
patch from Ben Abbott fixes font height problems. Fixes bug #421250.

2007-03-28 Lars Clausen <lars@raeder.dk>

* objects/custom/custom_object.c (custom_update_data): Use newer
way to get text ascent. Fixes bug #423351.

[end merge]

svn path=/branches/dia-0-96/; revision=3918

Change Summary

Incremental Difference

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,38 @@
1-2007-03-26 Hans Breuer <hans@breuer.org>
1+2008-03-16 Hans Breuer <hans@breuer.org>
22
3- * bindings/* : dia/lib bindings with the help of SWIG, for details
4- see: http://mail.gnome.org/archives/dia-list/2007-March/msg00092.html
3+ * lib/libdia.def : added missing exports
4+
5+[merged from svn://svn.gnome.org/svn/dia/branches/dia_0_96 revision 3657]
6+
7+2007-03-29 Lars Clausen <lars@raeder.dk>
8+
9+ * NEWS:
10+ * RELEASE-PROCESS:
11+ * config.h.win32:
12+ * doc/en/dia.xml:
13+ * doc/pl/dia.xml:
14+ * doc/eu/dia.xml:
15+ * configure.in: Release 0.96.1 is a brown-bag release for empty
16+ initial line problem in shapes, and a couple other bugs.
17+
18+ * app/diapsrenderer.c (draw_text_line): Use language-independent
19+ float conversion in new text rendering code. Fixes bug #424052.
20+
21+ * plug-ins/vdx/vdx-import.c: Updated to version 0.9.4 to fix shape
22+ problems and text errors. Fixes bug #417956.
23+
24+ * lib/text.c (text_key_event): Treat keypad enter like return.
25+ Fixes bug #423480.
26+
27+ * plug-ins/dxf/dxf-import.c: Load closed polyline as polygon,
28+ patch from Ben Abbott fixes font height problems. Fixes bug #421250.
29+
30+2007-03-28 Lars Clausen <lars@raeder.dk>
31+
32+ * objects/custom/custom_object.c (custom_update_data): Use newer
33+ way to get text ascent. Fixes bug #423351.
34+
35+[end merge]
536
637 2007-03-25 Lars Clausen <lars@raeder.dk>
738
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
1+dia-0.96.1: 29-Mar-2007
2+
3+ * Brown-bag release with five bugfixes, one of them critical: Empty
4+ initial lines in shapes crashes Dia (#421250).
5+
16 dia-0.96: 25-Mar-2007
27
38 * Final release of 0.96.
--- a/config.h.win32
+++ b/config.h.win32
@@ -18,7 +18,7 @@
1818 #undef LOCALEDIR /* needs to be calculated at runtime */
1919 /* NOT: #define LOCALEDIR "../lib/locale" */
2020
21-#define VERSION "0.96"
21+#define VERSION "0.96.1"
2222
2323 /*
2424 * We are linking libxml as DLL with either msvc or mingw, but this
--- a/configure.in
+++ b/configure.in
@@ -1,6 +1,6 @@
11 dnl Process this -*- autoconf -*- file with autoconf to produce a
22 dnl configure script.
3-AC_INIT(dia, 0.96, http://bugzilla.gnome.org/enter_bug.cgi?product=dia)
3+AC_INIT(dia, 0.96.1, http://bugzilla.gnome.org/enter_bug.cgi?product=dia)
44 AC_CONFIG_SRCDIR(app/diagram.c)
55 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
66
--- a/doc/en/dia.xml
+++ b/doc/en/dia.xml
@@ -8,7 +8,7 @@
88
99 [
1010
11- <!ENTITY VERSION "0.96">
11+ <!ENTITY VERSION "0.96.1">
1212
1313 <!ENTITY INTRODUCTION SYSTEM "intro.xml">
1414
--- a/doc/eu/dia.xml
+++ b/doc/eu/dia.xml
@@ -4,7 +4,7 @@
44
55 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "../../dtd/docbookx.dtd" [
66
7- <!ENTITY VERSION "0.96">
7+ <!ENTITY VERSION "0.96.1">
88
99 <!ENTITY INTRODUCTION SYSTEM "intro.xml">
1010
--- a/doc/pl/dia.xml
+++ b/doc/pl/dia.xml
@@ -1,7 +1,7 @@
11 <?xml version="1.0" encoding="iso-8859-1"?>
22
33 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "../../dtd/docbookx.dtd"[
4-<!ENTITY VERSION "0.96">
4+<!ENTITY VERSION "0.96.1">
55 <!ENTITY INTRODUCTION SYSTEM "intro.xml">
66 <!ENTITY QUICKSTART SYSTEM "usage-quickstart.xml">
77 <!ENTITY CANVAS SYSTEM "usage-canvas.xml">
--- a/lib/libdia.def
+++ b/lib/libdia.def
@@ -217,8 +217,10 @@ EXPORTS
217217 dia_font_ref
218218 dia_font_set_any_family
219219 dia_font_set_weight_from_string
220+ dia_font_set_slant
220221 dia_font_set_slant_from_string
221222 dia_font_set_height
223+ dia_font_set_weight
222224 dia_font_copy
223225 dia_font_string_width
224226
@@ -637,6 +639,7 @@ EXPORTS
637639 text_distance_from
638640 text_draw
639641 text_get_attributes
642+ text_get_ascent
640643 text_get_descent
641644 text_get_line
642645 text_get_line_strlen
--- a/lib/text.c
+++ b/lib/text.c
@@ -884,6 +884,7 @@ text_key_event(Focus *focus, guint keyval, const gchar *str, int strlen,
884884 text_delete_backward(text);
885885 break;
886886 case GDK_Return:
887+ case GDK_KP_Enter:
887888 return_val = TRUE;
888889 *change = text_create_change(text, TYPE_SPLIT_ROW, 'Q',
889890 text->cursor_pos, text->cursor_row);
--- a/objects/custom/custom_object.c
+++ b/objects/custom/custom_object.c
@@ -977,14 +977,13 @@ custom_update_data(Custom *custom, AnchorShape horiz, AnchorShape vert)
977977 txs = text_get_string_copy(custom->text);
978978
979979 if ((tb.bottom+tb.top)/2 > elem->corner.y + elem->height)
980- p.y = tb.top +
981- dia_font_ascent(txs,custom->text->font, custom->text->height);
980+ p.y = tb.top + text_get_ascent(custom->text);
982981 else if ((tb.bottom+tb.top)/2 < elem->corner.y)
983982 p.y = tb.bottom + custom->text->height * (custom->text->numlines - 1);
984983 else
985984 p.y = (tb.top + tb.bottom -
986985 custom->text->height * custom->text->numlines) / 2 +
987- dia_font_ascent(txs,custom->text->font, custom->text->height);
986+ text_get_ascent(custom->text);
988987 text_set_position(custom->text, &p);
989988 g_free(txs);
990989 }
@@ -1190,16 +1189,13 @@ void custom_reposition_text(Custom *custom, GraphicElementText *text) {
11901189 /* align the text to be close to the shape ... */
11911190
11921191 if ((tb.bottom+tb.top)/2 > elem->corner.y + elem->height)
1193- p.y = tb.top +
1194- dia_font_ascent(text->string,
1195- text->object->font, text->object->height);
1192+ p.y = tb.top + text_get_ascent(text->object);
11961193 else if ((tb.bottom+tb.top)/2 < elem->corner.y)
11971194 p.y = tb.bottom + text->object->height * (text->object->numlines - 1);
11981195 else
11991196 p.y = (tb.top + tb.bottom -
12001197 text->object->height * text->object->numlines) / 2 +
1201- dia_font_ascent(text->string,
1202- text->object->font, text->object->height);
1198+ text_get_ascent(text->object);
12031199 text_set_position(text->object, &p);
12041200 return;
12051201 }
--- a/plug-ins/dxf/dxf-import.c
+++ b/plug-ins/dxf/dxf-import.c
@@ -552,10 +552,7 @@ DiaObject *read_entity_polyline_dxf(FILE *filedxf, DxfData *data, DiagramData *d
552552
553553 if( closed )
554554 {
555- ++points;
556- p = g_realloc( p, sizeof( Point ) * points );
557- p[points-1].x = p[0].x;
558- p[points-1].y = p[0].y;
555+ otype = object_get_type("Standard - Polygon");
559556 }
560557
561558 pcd->num_points = points;
@@ -941,7 +938,7 @@ DiaObject *read_entity_text_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
941938 height = atof(data->value) * coord_scale * measure_scale;
942939 /*printf( "text height %f\n", height );*/
943940 break;
944- case 62:
941+ case 62:
945942 colour = atoi(data->value);
946943 text_colour.red = acad_pal[colour].r / 255.0;
947944 text_colour.green = acad_pal[colour].g / 255.0;
@@ -994,7 +991,7 @@ DiaObject *read_entity_text_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
994991 } while(codedxf != 0);
995992 setlocale(LC_NUMERIC,old_locale);
996993
997- location.y += y_offset * height;
994+ location.y += y_offset * height;
998995
999996 text_obj = otype->ops->create(&location, otype->default_user_data,
1000997 &h1, &h2);
@@ -1010,6 +1007,7 @@ DiaObject *read_entity_text_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
10101007 tprop->attr.position.y = location.y;
10111008
10121009 attributes_get_default_font(&tprop->attr.font, &tprop->attr.height);
1010+ tprop->attr.height = height;
10131011 tprop->attr.color = text_colour;
10141012
10151013 text_obj->ops->set_props(text_obj, props);
--- a/plug-ins/vdx/vdx-import.c
+++ b/plug-ins/vdx/vdx-import.c
@@ -97,7 +97,11 @@ create_standard_line(Point *points,
9797 &h1, &h2);
9898
9999 props = prop_list_from_descs(vdx_line_prop_descs, pdtpp_true);
100- g_assert(props->len == 4);
100+ if (props->len != 4)
101+ {
102+ g_debug("create_standard_line() - props->len != 4");
103+ return 0;
104+ }
101105
102106 ptprop = g_ptr_array_index(props,0);
103107 ptprop->point_data = points[0];
@@ -216,8 +220,12 @@ vdx_parse_color(const char *s, const VDXDocument *theDoc)
216220 if (theDoc->Colors && i < theDoc->Colors->len)
217221 return g_array_index(theDoc->Colors, Color, i);
218222 }
219- message_warning(_("Couldn't read color: %s\n"), s);
220- g_debug("Couldn't read color: %s", s);
223+ /* Colour 0 is always black, so don't warn (OmniGraffle) */
224+ if (*s != '0')
225+ {
226+ message_warning(_("Couldn't read color: %s\n"), s);
227+ g_debug("Couldn't read color: %s", s);
228+ }
221229 return c;
222230 }
223231
@@ -381,7 +389,13 @@ find_child(unsigned int type, const void *p)
381389 {
382390 struct vdx_any *Any = (struct vdx_any *)p;
383391 GSList *child;
384- g_assert(p);
392+
393+ if (!p)
394+ {
395+ g_debug("find_child called with p=0");
396+ return 0;
397+ }
398+
385399 for(child = Any->children; child; child = child->next)
386400 {
387401 struct vdx_any *Any_child = (struct vdx_any *)child->data;
@@ -403,7 +417,12 @@ find_child_next(unsigned int type, const void *p, const void *given)
403417 struct vdx_any *Any = (struct vdx_any *)p;
404418 GSList *child;
405419 gboolean found_given = FALSE;
406- g_assert(p);
420+
421+ if (!p)
422+ {
423+ g_debug("find_child_next() called with p=0");
424+ return 0;
425+ }
407426 for(child = Any->children; child; child = child->next)
408427 {
409428 struct vdx_any *Any_child = (struct vdx_any *)child->data;
@@ -448,14 +467,17 @@ get_style_child(unsigned int type, unsigned int style, VDXDocument* theDoc)
448467 {
449468 struct vdx_StyleSheet theSheet;
450469 struct vdx_any *Any;
451- if (!theDoc->StyleSheets)
452- {
453- g_debug("Unknown stylesheet reference");
454- return 0;
455- }
456470 while(1)
457471 {
458- g_assert(theDoc->StyleSheets && style < theDoc->StyleSheets->len);
472+ if (!theDoc->StyleSheets || style >= theDoc->StyleSheets->len)
473+ {
474+ /* Ignore style 0 for OmniGraffle */
475+ if (style)
476+ {
477+ g_debug("Unknown stylesheet reference: %d", style);
478+ }
479+ return 0;
480+ }
459481 theSheet = g_array_index(theDoc->StyleSheets,
460482 struct vdx_StyleSheet, style);
461483 Any = find_child(type, &theSheet);
@@ -486,7 +508,12 @@ get_shape_by_id(unsigned int id, struct vdx_Shapes *Shapes, unsigned int depth)
486508 struct vdx_Shape *Shape;
487509 struct vdx_Shapes *SubShapes;
488510 GSList *child;
489- g_assert(Shapes);
511+
512+ if (!Shapes)
513+ {
514+ g_debug("get_shape_by_id() called with Shapes=0");
515+ return 0;
516+ }
490517
491518 /* A Master has a list of Shapes */
492519 for(child = Shapes->children; child; child = child->next)
@@ -529,7 +556,12 @@ get_master_shape(unsigned int master, unsigned int shape, VDXDocument* theDoc)
529556 struct vdx_Master theMaster;
530557 struct vdx_Shapes *Shapes;
531558
532- g_assert(master < theDoc->Masters->len);
559+ if (!theDoc->Masters || master >= theDoc->Masters->len)
560+ {
561+ g_debug("Unknown master reference");
562+ return 0;
563+ }
564+
533565 if (theDoc->debug_comments)
534566 g_debug("Looking for Master %d Shape %d", master, shape);
535567 theMaster = g_array_index(theDoc->Masters,
@@ -586,7 +618,11 @@ vdx_simple_properties(DiaObject *obj,
586618 ColorProperty *cprop = 0;
587619 unsigned int debug_id;
588620
589- g_assert(props->len == 2);
621+ if (props->len != 2)
622+ {
623+ g_debug("vdx_simple_properties() - props->len != 4");
624+ return;
625+ }
590626
591627 if (Line)
592628 {
@@ -711,6 +747,12 @@ apply_XForm(Point p, const struct vdx_XForm *XForm)
711747 double sin_theta, cos_theta;
712748
713749 /* Remove the offset of the rotation pin from the object */
750+ if (!XForm)
751+ {
752+ g_debug("apply_XForm() called with XForm=0");
753+ return q;
754+ }
755+
714756 q.x -= XForm->LocPinX;
715757 q.y -= XForm->LocPinY;
716758
@@ -771,6 +813,11 @@ make_arrow(const struct vdx_Line *Line, char start_end,
771813 double size = 0;
772814 unsigned int type = 0;
773815
816+ if (!Line)
817+ {
818+ g_debug("make_arrow() called with Line=0");
819+ return 0;
820+ }
774821 a->type = ARROW_FILLED_TRIANGLE;
775822
776823 if (start_end == 's')
@@ -823,17 +870,18 @@ plot_polyline(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
823870 struct vdx_ArcTo *ArcTo;
824871 struct vdx_any *Any;
825872 Point *points, p;
826- unsigned int num_points = 0;
873+ unsigned int num_points = 1;
827874 unsigned int count = 0;
828875 Arrow* start_arrow_p = NULL;
829876 Arrow* end_arrow_p = NULL;
830877 gboolean done = FALSE;
831878
832879 if (theDoc->debug_comments) g_debug("plot_polyline()");
833- if ((Geom->NoFill || (Fill && !Fill->FillPattern)) &&
834- (Geom->NoLine || (Line && !Line->LinePattern)))
880+ if (!Geom || ((Geom->NoFill || (Fill && !Fill->FillPattern)) &&
881+ (Geom->NoLine || (Line && !Line->LinePattern))))
835882 {
836883 *more = 0;
884+ if (theDoc->debug_comments) g_debug("Nothing to plot");
837885 return 0;
838886 }
839887
@@ -854,6 +902,12 @@ plot_polyline(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
854902 LineTo = (struct vdx_LineTo*)(item->data);
855903 if (LineTo->Del) continue;
856904 p.x = LineTo->X; p.y = LineTo->Y;
905+ if (!count)
906+ {
907+ /* Use current as start point */
908+ points[count++] =
909+ dia_point(apply_XForm(*current, XForm), theDoc);
910+ }
857911 break;
858912 case vdx_types_MoveTo:
859913 MoveTo = (struct vdx_MoveTo*)(item->data);
@@ -867,11 +921,6 @@ plot_polyline(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
867921 done = TRUE;
868922 break;
869923 }
870- else
871- {
872- num_points--;
873- continue;
874- }
875924 }
876925 break;
877926 default:
@@ -908,7 +957,8 @@ plot_polyline(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
908957
909958 if (count > 2)
910959 {
911- if (Geom->NoFill)
960+ /* If we had to break the Geom partway, it's not a polygon */
961+ if (Geom->NoFill || done)
912962 {
913963 /* Yes, it is end_arrow followed by start_arrow */
914964 newobj = create_standard_polyline(count, points,
@@ -928,6 +978,7 @@ plot_polyline(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
928978 }
929979 else
930980 {
981+ /* Don't plot lines with only one point */
931982 if (theDoc->debug_comments)
932983 g_debug("Empty polyline");
933984 }
@@ -1017,6 +1068,12 @@ arc_to_ellipticalarc(struct vdx_ArcTo *ArcTo, const Point *Start,
10171068 Point perp;
10181069 double length;
10191070
1071+ if (!EllipticalArcTo || !ArcTo || !Start)
1072+ {
1073+ g_debug("arc_to_ellipticalarc() called with null parameters");
1074+ return FALSE;
1075+ }
1076+
10201077 EllipticalArcTo->type = vdx_types_EllipticalArcTo;
10211078 EllipticalArcTo->children = 0;
10221079
@@ -1082,6 +1139,12 @@ ellipticalarc_to_bezier(Point p0, Point p3, Point p4, double C, double D,
10821139
10831140 double a, b, c, d, e, f, g; /* Scratch variables */
10841141
1142+ if (!p1 || !p2)
1143+ {
1144+ g_debug("ellipticalarc_to_bezier() called with null parameters");
1145+ return FALSE;
1146+ }
1147+
10851148 /* We assume the arc is not degenerate:
10861149 p0 != p4 != p3 != p0, 0 < D < infty
10871150 */
@@ -1423,7 +1486,7 @@ plot_bezier(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
14231486 if (!all_lines)
14241487 {
14251488 /* It's a Bezier */
1426- if (Geom->NoFill)
1489+ if (Geom && Geom->NoFill)
14271490 {
14281491 /* Yes, it is end then start arrow */
14291492 newobj = create_standard_bezierline(num_points, bezpoints,
@@ -1450,7 +1513,7 @@ plot_bezier(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
14501513
14511514 if (count > 2)
14521515 {
1453- if (Geom->NoFill)
1516+ if (Geom && Geom->NoFill)
14541517 {
14551518 /* Yes, it is end_arrow followed by start_arrow */
14561519 newobj = create_standard_polyline(count, points,
@@ -1498,6 +1561,12 @@ NURBS_N(unsigned int i, unsigned int k, float u, unsigned int n,
14981561 {
14991562 float sum = 0.0;
15001563
1564+ if (! knot)
1565+ {
1566+ g_debug("NURBS_N() called with knot=0");
1567+ return sum;
1568+ }
1569+
15011570 if (k == 0)
15021571 {
15031572 if (knot[i] <= u && u < knot[i+1])
@@ -1542,7 +1611,13 @@ NURBS_C(unsigned int k, float u, unsigned int n,
15421611 float bottom = 0;
15431612 unsigned int i;
15441613 float N_i_k;
1545- Point p;
1614+ Point p = {0, 0};
1615+
1616+ if (!knot || !weight || !control)
1617+ {
1618+ g_debug("NURBS_C() called with null parameters");
1619+ return p;
1620+ }
15461621
15471622 for(i=0; i<=n; i++)
15481623 {
@@ -1608,8 +1683,8 @@ plot_nurbs(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
16081683 unsigned int steps = 40;
16091684 float start_u, step_u;
16101685
1611- if(theDoc->debug_comments)
1612- g_debug("plot_nurbs()");
1686+ if (theDoc->debug_comments)
1687+ g_debug("plot_nurbs(), current x=%f y=%f", current->x, current->y);
16131688
16141689 item = *more;
16151690 Any = (struct vdx_any *)(item->data);
@@ -1620,6 +1695,8 @@ plot_nurbs(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
16201695 current->x = MoveTo->X;
16211696 current->y = MoveTo->Y;
16221697 begin = *current;
1698+ if (theDoc->debug_comments)
1699+ g_debug("MoveTo x=%f y=%f", begin.x, begin.y);
16231700 item = item->next;
16241701 Any = (struct vdx_any *)(item->data);
16251702 *more = item;
@@ -1627,6 +1704,7 @@ plot_nurbs(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
16271704
16281705 if (Any->type == vdx_types_NURBSTo)
16291706 {
1707+ if (theDoc->debug_comments) g_debug("NURBSTo");
16301708 NURBSTo = (struct vdx_NURBSTo*)(item->data);
16311709
16321710 /* E holds the NURBS formula */
@@ -1688,25 +1766,25 @@ plot_nurbs(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
16881766 i = 0;
16891767 while(c && *c && i < n)
16901768 {
1691- g_assert(c);
1769+ if (!c) break;
16921770 control[i].x = atof(++c);
16931771 current->x = control[i].x;
16941772 /* xType = 0 means X is proportion of Width */
16951773 if (xType == 0) control[i].x *= XForm->Width;
16961774 c = strchr(c, ',');
16971775
1698- g_assert(c);
1776+ if (!c) break;
16991777 control[i].y = atof(++c);
17001778 current->y = control[i].y;
17011779 /* yType = 0 means Y is proportion of Height */
17021780 if (yType == 0) control[i].y *= XForm->Height;
17031781 c = strchr(c, ',');
17041782
1705- g_assert(c);
1783+ if (!c) break;
17061784 knot[i] = atof(++c);
17071785 c = strchr(c, ',');
17081786
1709- g_assert(c);
1787+ if (!c) break;
17101788 weight[i] = atof(++c);
17111789 c = strchr(c, ',');
17121790 i++;
@@ -1717,6 +1795,7 @@ plot_nurbs(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
17171795 {
17181796 if (Any->type == vdx_types_SplineStart)
17191797 {
1798+ if (theDoc->debug_comments) g_debug("SplineStart");
17201799 SplineStart = (struct vdx_SplineStart*)(item->data);
17211800 item2 = item;
17221801 n = 1;
@@ -1829,7 +1908,8 @@ plot_nurbs(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
18291908 {
18301909 points[num_points-1] = dia_point(apply_XForm(end, XForm), theDoc);
18311910 if (theDoc->debug_comments)
1832- g_debug("Point %d VDX x=%f y=%f", num_points-1, end.x, end.y);
1911+ g_debug("End Point %d VDX x=%f y=%f", num_points-1, end.x, end.y);
1912+ *current = end;
18331913 }
18341914
18351915 if (theDoc->debug_comments)
@@ -1875,6 +1955,12 @@ write_base64_file(const char *filename, const char *b64)
18751955 char buf[4]; /* For 4 decoded 6-bit chunks */
18761956 unsigned int buf_len = 0;
18771957
1958+ if (!filename || !b64)
1959+ {
1960+ g_debug("write_base64_file() called with null parameters");
1961+ return;
1962+ }
1963+
18781964 f = g_fopen(filename, "w+b");
18791965 if (!f)
18801966 {
@@ -2068,6 +2154,7 @@ plot_geom(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
20682154 {
20692155 const GSList *item;
20702156 gboolean all_lines = TRUE; /* Flag for line/polyline */
2157+ gboolean has_nurbs = FALSE; /* Flag for NURBS */
20712158 unsigned int num_steps = 0; /* Flag for poly */
20722159 struct vdx_any *last_point = 0;
20732160 unsigned int dia_type_choice = vdx_dia_any;
@@ -2076,7 +2163,7 @@ plot_geom(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
20762163 struct vdx_ArcTo *ArcTo;
20772164
20782165 /* Is it disabled? */
2079- if (Geom->NoShow)
2166+ if (!Geom || Geom->NoShow)
20802167 {
20812168 if (theDoc->debug_comments)
20822169 g_debug("NoShow");
@@ -2103,6 +2190,11 @@ plot_geom(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
21032190 if (ArcTo->Del) continue;
21042191 all_lines = FALSE;
21052192 break;
2193+ case vdx_types_NURBSTo:
2194+ case vdx_types_SplineKnot:
2195+ has_nurbs = TRUE;
2196+ all_lines = FALSE;
2197+ break;
21062198 default:
21072199 all_lines = FALSE;
21082200 }
@@ -2141,7 +2233,7 @@ plot_geom(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
21412233 if (Geom->NoFill) { dia_type_choice = vdx_dia_bezier; }
21422234 else { dia_type_choice = vdx_dia_beziergon; }
21432235 /* Unless it's a spline */
2144- if (last_point->type == vdx_types_SplineKnot)
2236+ if (last_point->type == vdx_types_SplineKnot || has_nurbs)
21452237 dia_type_choice = vdx_dia_nurbs;
21462238 }
21472239
@@ -2203,8 +2295,13 @@ plot_text(const struct vdx_Text *Text, const struct vdx_XForm *XForm,
22032295 double height;
22042296 char *font_name = 0;
22052297 DiaFontStyle style = 0;
2298+ DiaFont *font = 0;
22062299
2207- if (!Char || !text) { g_debug("Not enough info for text"); return 0; }
2300+ if (!Text || !Char || !text || !XForm)
2301+ {
2302+ g_debug("Not enough info for text");
2303+ return 0;
2304+ }
22082305 p.x = 0; p.y = 0;
22092306
22102307 /* Setup position for horizontal alignment */
@@ -2316,11 +2413,17 @@ plot_text(const struct vdx_Text *Text, const struct vdx_XForm *XForm,
23162413 font_name = FaceName.Name;
23172414 }
23182415 }
2319- tprop->attr.font = dia_font_new(font_name, style, height);
2416+
2417+ font = dia_font_new_from_legacy_name(font_name);
2418+ dia_font_set_weight(font, DIA_FONT_STYLE_GET_WEIGHT(style));
2419+ dia_font_set_slant(font, DIA_FONT_STYLE_GET_SLANT(style));
2420+ dia_font_set_height(font, height);
2421+ tprop->attr.font = font;
2422+
23202423 if (theDoc->debug_comments)
2321- g_debug("Text: %s at %f,%f v=%d h=%d s=%.2x",
2424+ g_debug("Text: %s at %f,%f v=%d h=%d s=%.2x f=%s",
23222425 tprop->text_data, p.x, p.y,
2323- eprop->enum_data, tprop->attr.alignment, style);
2426+ eprop->enum_data, tprop->attr.alignment, style, font_name);
23242427
23252428 tprop->attr.height = height;
23262429 tprop->attr.color = Char->Color;
@@ -2359,6 +2462,11 @@ vdx_plot_shape(struct vdx_Shape *Shape, GSList *objects,
23592462 const GSList *more = 0;
23602463 Point current = {0, 0};
23612464
2465+ if (!Shape)
2466+ {
2467+ g_debug("vdx_plot_shape() called with Shape=0");
2468+ return 0;
2469+ }
23622470 theDoc->shape_id = Shape->ID;
23632471 if (Shape->Del)
23642472 {
@@ -2701,6 +2809,12 @@ vdx_setup_layers(struct vdx_PageSheet* PageSheet, VDXDocument* theDoc,
27012809
27022810 /* What layers are on this page? */
27032811
2812+ if (!PageSheet)
2813+ {
2814+ g_debug("vdx_setup_layers() called with PageSheet=0");
2815+ return;
2816+ }
2817+
27042818 for (child = PageSheet->children; child; child = child->next)
27052819 {
27062820 if (!child || !child->data) continue;