Skip to content

Commit d12f7f7

Browse files
committed
LibSpiro version 0.3
Collective fixes from tagpoint v0.2 (20130930) up to now (20150131). Most fixes are for setting-up libspiro to be seen as a package, and to solve some bugs listed on various distro sites. Also added two functions similar to original TaggedSpiroCPsToBezier() and SpiroCPsToBezier() for use by developers that need functions that require a void/nothing return.
1 parent 24cf80c commit d12f7f7

9 files changed

Lines changed: 82 additions & 34 deletions

File tree

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
- 31-Jan-2015
2+
* Libspiro Version 0.3.20150131
3+
* Allow Libspiro to be included using PKG_CHECK_MODULES().
4+
* Bug fixes in configure.ac m4 calls that caused problems seen in:
5+
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196780
6+
https://bugs.archlinux.org/task/43373
7+
* Add TaggedSpiroCPsToBezier1() and SpiroCPsToBezier1() for programs
8+
that cannot use TaggedSpiroCPsToBezier0() or SpiroCPsToBezier0().
9+
110
- 30-Sep-2013
211
* Libspiro Version 0.2.20130930
312

README

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ smooth continuous curves based on a given set of codes and X,Y constraints.
33

44
The main user(s) of Libspiro are Font editing programs such as FontForge,
55
and forked copies have been seen in more artistic programs such as InkScape,
6-
or in libraries such as GEGL. There may be other possible uses in future.
6+
or in libraries such as GEGL. There may be other possible uses in future,
7+
and this library has strong potential in graphical and vector type programs.
78

89
Developers interested in also sharing and making use of LibSpiro will likely
910
want to read (in this order to understand LibSpiro better):

README.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ Then the usual steps to compile it:
2626
```sh
2727
./configure
2828
make
29-
make install
29+
make check
30+
sudo make install
3031
```
3132

3233
## Usage
3334

3435
### In FontForge
3536

36-
FontForge will autodetect libspiro when it is installed in the usual way.
37+
FontForge will autodetect libspiro when it is installed in the usual way.
3738

3839
An exception to this is with the Mac bundled version (where `FontForge.app` is copied to `/Applications`.) To install your compiled version into the bundle, run ```sh ./configure --prefix=/Applications/FontForge.app/Contents/Resources/opt/local/ ```
3940

@@ -55,8 +56,8 @@ Mac OS X: A helping script, `./fontforge.sh` is provided to run FontForge inside
5556
- [bezier context](#the-bzier-context)
5657
- [Header file](#calling-into-libspiro)
5758
- Entry points
58-
- [SpiroCPsToBezier](#spirocpstobezier)(spiros_cp *,int n,int is_closed,bezctx *)
59-
- [TaggedSpiroCPsToBezier](#taggedspirocpstobezier)(spiros_cp *,bezctx *)
59+
- int [SpiroCPsToBezier0](#spirocpstobezier)(spiro_cp *,int n,int is_closed,bezctx *)
60+
- int [TaggedSpiroCPsToBezier0](#taggedspirocpstobezier)(spiro_cp *,bezctx *)
6061

6162
#### Basic Types
6263

@@ -121,23 +122,23 @@ You must create a super-class of this abstract type that handles the creation of
121122

122123
#### Calling into libspiro
123124

124-
Libspiro needs a header file:
125+
Your program needs this Libspiro header file:
125126

126127
```c
127128
#include <spiroentrypoints.h>
128129
```
129130

130131
You must define a bezier context that is appropriate for your internal splines (See [Raph's PostScript example](bezctx.md)).
131132

132-
#### SpiroCPsToBezier
133+
#### SpiroCPsToBezier0
133134

134135
You must create an array of spiro control points:
135136

136137
```c
137138
spiro_cp points[4];
138-
139+
139140
/* This defines something very like a circle, centered at the origin with radius 100 */
140-
141+
141142
points[0].x = -100; points[0].y = 0; points[0].ty = SPIRO_G4;
142143
points[1].x = 0; points[1].y = 100; points[1].ty = SPIRO_G4;
143144
points[2].x = 100; points[2].y = 0; points[2].ty = SPIRO_G4;
@@ -146,25 +147,25 @@ You must create an array of spiro control points:
146147

147148
![](closedspiro.png)
148149

149-
Then call `SpiroCPsToBezier`, a routine which takes 4 arguments
150+
Then call `SpiroCPsToBezier0`, a routine which takes 4 arguments and returns bc and an integer pass/fail flag.
150151

151-
1. An array of spiros
152-
2. The number of elements in the array
152+
1. An array of input spiros
153+
2. The number of elements in the spiros array
153154
3. Whether this describes a closed (True) or open (False) contour
154-
4. A bezier context
155+
4. A bezier results output context
156+
5. An integer success flag. 1 = completed task and have valid bezier results, or 0 = unable to complete task, bezier results are invalid.
155157
```c
156158
bc = new_bezctx_ps();
157-
SpiroCPsToBezier(points,4,True,bc)
159+
success = SpiroCPsToBezier0(points,4,True,bc)
158160
bezctx_ps_close(bc);
159-
```
160161

161-
#### TaggedSpiroCPsToBezier
162+
#### TaggedSpiroCPsToBezier0
162163

163-
Or call `TaggedSpiroCPsToBezier`. This routine requires that the array of spiro control points be tagged according to Raph's internal conventions. A closed curve will have an extra control point attached to the end of it with a type of `SPIRO_END`;
164+
Or call `TaggedSpiroCPsToBezier0`. This routine requires that the array of spiro control points be tagged according to Raph's internal conventions. A closed curve will have an extra control point attached to the end of it with a type of `SPIRO_END`;
164165

165166
```c
166167
spiro_cp points[5];
167-
168+
168169
points[0].x = -100; points[0].y = 0; points[0].ty = SPIRO_G4;
169170
points[1].x = 0; points[1].y = 100; points[1].ty = SPIRO_G4;
170171
points[2].x = 100; points[2].y = 0; points[2].ty = SPIRO_G4;
@@ -178,7 +179,7 @@ An open curve will have the type of the first control point set to `SPIRO_OPEN_C
178179

179180
```c
180181
spiro_cp points[4];
181-
182+
182183
points[0].x = -100; points[0].y = 0; points[0].ty = SPIRO_OPEN_CONTOUR;
183184
points[1].x = 0; points[1].y = 100; points[1].ty = SPIRO_G4;
184185
points[2].x = 100; points[2].y = 0; points[2].ty = SPIRO_G4;
@@ -189,13 +190,14 @@ An open curve will have the type of the first control point set to `SPIRO_OPEN_C
189190

190191
(In an open contour the point types of the first and last control points are going to be ignored).
191192

192-
In this case there is no need to provide a point count nor an open/closed contour flag. That information can be obtained from the control points themselves. So `TaggedSpiroCPsToBezier` only takes 2 arguments
193+
In this case there is no need to provide a point count nor an open/closed contour flag. That information can be obtained from the control points themselves. So `TaggedSpiroCPsToBezier0` only takes 2 arguments and returns bc and an integer pass/fail flag.
193194

194-
1. An array of spiros
195-
2. A bezier context
195+
1. An array of input spiros
196+
2. A bezier results output context
197+
3. An integer success flag. 1 = completed task and have valid bezier results, or 0 = unable to complete task, bezier results are invalid.
196198
```c
197199
bc = new_bezctx_ps();
198-
TaggedSpiroCPsToBezier(points,bc)
200+
success = TaggedSpiroCPsToBezier0(points,bc)
199201
bezctx_ps_close(bc);
200202
```
201203

config.guess

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#! /bin/sh
22
# Attempt to guess a canonical system name.
3-
# Copyright 1992-2014 Free Software Foundation, Inc.
3+
# Copyright 1992-2015 Free Software Foundation, Inc.
44

5-
timestamp='2014-11-04'
5+
timestamp='2015-01-01'
66

77
# This file is free software; you can redistribute it and/or modify it
88
# under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ version="\
5050
GNU config.guess ($timestamp)
5151
5252
Originally written by Per Bothner.
53-
Copyright 1992-2014 Free Software Foundation, Inc.
53+
Copyright 1992-2015 Free Software Foundation, Inc.
5454
5555
This is free software; see the source for copying conditions. There is NO
5656
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."

config.sub

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#! /bin/sh
22
# Configuration validation subroutine script.
3-
# Copyright 1992-2014 Free Software Foundation, Inc.
3+
# Copyright 1992-2015 Free Software Foundation, Inc.
44

5-
timestamp='2014-12-03'
5+
timestamp='2015-01-01'
66

77
# This file is free software; you can redistribute it and/or modify it
88
# under the terms of the GNU General Public License as published by
@@ -68,7 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
6868
version="\
6969
GNU config.sub ($timestamp)
7070
71-
Copyright 1992-2014 Free Software Foundation, Inc.
71+
Copyright 1992-2015 Free Software Foundation, Inc.
7272
7373
This is free software; see the source for copying conditions. There is NO
7474
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -260,7 +260,7 @@ case $basic_machine in
260260
| c4x | c8051 | clipper \
261261
| d10v | d30v | dlx | dsp16xx \
262262
| epiphany \
263-
| fido | fr30 | frv \
263+
| fido | fr30 | frv | ft32 \
264264
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
265265
| hexagon \
266266
| i370 | i860 | i960 | ia64 \

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dnl Process this file with autoconf to produce a configure script.
66
AC_PREREQ([2.61])
77
#-------------------------------------------
88
# PackageTimestamp version
9-
m4_define([spiro_package_stamp], [20130930])
9+
m4_define([spiro_package_stamp], [20150131])
1010
#-------------------------------------------
1111
# Making point releases:
1212
# spiro_major_version += 0;
@@ -21,7 +21,7 @@ m4_define([spiro_package_stamp], [20130930])
2121
# spiro_minor_version = 0;
2222
#
2323
m4_define([spiro_major_version], [0])
24-
m4_define([spiro_minor_version], [2])
24+
m4_define([spiro_minor_version], [3])
2525
m4_define([spiro_version],
2626
[spiro_major_version.spiro_minor_version.spiro_package_stamp])
2727
m4_define([spiro_info],

spiroentrypoints.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,10 @@ TaggedSpiroCPsToBezier0(spiro_cp *spiros,bezctx *bc)
7474
}
7575
return 0 ; // spiro did not converge or encountered non-finite values
7676
}
77+
78+
void SpiroCPsToBezier1(spiro_cp *spiros,int n,int isclosed,bezctx *bc,int *done) {
79+
*done = SpiroCPsToBezier0(spiros,n,isclosed,bc);
80+
}
81+
void TaggedSpiroCPsToBezier1(spiro_cp *spiros,bezctx *bc,int *done) {
82+
*done = TaggedSpiroCPsToBezier0(spiros,bc);
83+
}

spiroentrypoints.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ extern void TaggedSpiroCPsToBezier(spiro_cp *spiros,bezctx *bc);
2424
extern void SpiroCPsToBezier(spiro_cp *spiros,int n,int isclosed,bezctx *bc);
2525

2626

27+
28+
/* These functions are available in libspiro-0.2.20130930 or higher */
29+
2730
/* The two functions below return 1 upon success and 0 upon failure */
2831

2932
/* The spiros array should indicate it's own end... So */
@@ -37,4 +40,14 @@ extern int TaggedSpiroCPsToBezier0(spiro_cp *spiros,bezctx *bc);
3740
/* Open contours do not need to start with '{', nor to end with '}' */
3841
/* Close contours do not need to end with 'z' */
3942
extern int SpiroCPsToBezier0(spiro_cp *spiros,int n,int isclosed,bezctx *bc);
43+
44+
45+
46+
/* These functions are available in libspiro-0.3.20150131 or higher */
47+
48+
/* If you can't use TaggedSpiroCPsToBezier0(), SpiroCPsToBezier0(), */
49+
/* these functions are enhanced versions of the original functions, */
50+
/* where spiro success/failure replies are passd back through *done */
51+
extern void TaggedSpiroCPsToBezier1(spiro_cp *spiros,bezctx *bc,int *done);
52+
extern void SpiroCPsToBezier1(spiro_cp *spiros,int n,int isclosed,bezctx *bc,int *done);
4053
#endif

tests/call-test.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Test libspiro normal library calls
2-
Copyright (C) 2013 Jose Da Silva
2+
Copyright (C) 2013, Joe Da Silva
33
44
This program is free software; you can redistribute it and/or
55
modify it under the terms of the GNU General Public License
@@ -160,7 +160,7 @@ int test_curve(int c) {
160160
int nextknot[17];
161161
spiro_seg *segs = NULL;
162162
bezctx *bc;
163-
int i;
163+
int i,done;
164164

165165
/* Load sample data so that we can see if library is callable */
166166
load_test_curve(spiro,nextknot,c);
@@ -198,6 +198,22 @@ int test_curve(int c) {
198198
return -1;
199199
}
200200

201+
/* Check if TaggedSpiroCPsToBezier1() works okay */
202+
printf("---\ntesting TaggedSpiroCPsToBezier1() using data=path%d[].\n",c);
203+
TaggedSpiroCPsToBezier1(spiro,bc,&done);
204+
if ( done!=1 ) {
205+
printf("error with TaggedSpiroCPsToBezier1() using data=path%d[].\n",c);
206+
return -1;
207+
}
208+
209+
/* Check if SpiroCPsToBezier1() works okay */
210+
printf("---\ntesting SpiroCPsToBezier1() using data=path%d[].\n",c);
211+
SpiroCPsToBezier1(spiro,cl[c],(c==0 ? 1 : 0),bc,&done);
212+
if ( done!=1 ) {
213+
printf("error with SpiroCPsToBezier1() using data=path%d[].\n",c);
214+
return -1;
215+
}
216+
201217
free(bc);
202218
return 0;
203219
}

0 commit comments

Comments
 (0)