1 /* Copyright (C) 2000-2008 by George Williams */
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are met:
6 * Redistributions of source code must retain the above copyright notice, this
7 * list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation
11 * and/or other materials provided with the distribution.
13 * The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #define _DEFINE_SEARCHVIEW_
28 #include "fontforgevw.h"
33 extern char *coord_sep
;
35 int onlycopydisplayed
= 0;
39 /* ********************************* Undoes ********************************* */
41 int maxundoes
= 0; /* -1 is infinite */
43 static void UHintListFree(void *hints
) {
48 if ( ((StemInfo
*) hints
)->hinttype
==ht_d
)
49 DStemInfosFree(hints
);
53 while ( t
!=NULL
&& t
->hinttype
!=ht_d
) {
59 DStemInfosFree((DStemInfo
*) t
);
63 void UndoesFree(Undoes
*undo
) {
66 while ( undo
!=NULL
) {
68 switch ( undo
->undotype
) {
70 case ut_width
: case ut_vwidth
: case ut_lbearing
: case ut_rbearing
:
71 /* Nothing else to free */;
73 case ut_state
: case ut_tstate
: case ut_statehint
: case ut_statename
:
74 case ut_hints
: case ut_anchors
: case ut_statelookup
:
75 SplinePointListsFree(undo
->u
.state
.splines
);
76 RefCharsFree(undo
->u
.state
.refs
);
77 UHintListFree(undo
->u
.state
.hints
);
78 free(undo
->u
.state
.instrs
);
79 ImageListsFree(undo
->u
.state
.images
);
80 if ( undo
->undotype
==ut_statename
) {
81 free( undo
->u
.state
.charname
);
82 free( undo
->u
.state
.comment
);
83 PSTFree( undo
->u
.state
.possub
);
85 AnchorPointsFree(undo
->u
.state
.anchor
);
88 free(undo
->u
.bmpstate
.bitmap
);
90 case ut_multiple
: case ut_layers
:
91 UndoesFree( undo
->u
.multiple
.mult
);
94 UndoesFree(undo
->u
.composit
.state
);
95 UndoesFree(undo
->u
.composit
.bitmaps
);
98 IError( "Unknown undo type in UndoesFree: %d", undo
->undotype
);
101 chunkfree(undo
,sizeof(Undoes
));
106 int getAdobeEnc(char *name
) {
107 extern char *AdobeStandardEncoding
[256];
110 for ( i
=0; i
<256; ++i
)
111 if ( strcmp(name
,AdobeStandardEncoding
[i
])==0 )
113 if ( i
==256 ) i
= -1;
117 int SCWasEmpty(SplineChar
*sc
, int skip_this_layer
) {
120 for ( i
=ly_fore
; i
<sc
->layer_cnt
; ++i
) if ( i
!=skip_this_layer
&& !sc
->layers
[i
].background
) {
121 if ( sc
->layers
[i
].refs
!=NULL
)
123 else if ( sc
->layers
[i
].splines
!=NULL
) {
125 for ( ss
= sc
->layers
[i
].splines
; ss
!=NULL
; ss
=ss
->next
) {
126 if ( ss
->first
->prev
!=NULL
)
127 return( false ); /* Closed contour */