diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /dviware/dvisvgm/libs/ff-woff/inc |
Initial commit
Diffstat (limited to 'dviware/dvisvgm/libs/ff-woff/inc')
-rw-r--r-- | dviware/dvisvgm/libs/ff-woff/inc/basics.h | 125 | ||||
-rw-r--r-- | dviware/dvisvgm/libs/ff-woff/inc/chardata.h | 78 | ||||
-rw-r--r-- | dviware/dvisvgm/libs/ff-woff/inc/charset.h | 71 | ||||
-rw-r--r-- | dviware/dvisvgm/libs/ff-woff/inc/dlist.h | 151 | ||||
-rw-r--r-- | dviware/dvisvgm/libs/ff-woff/inc/ffintl.h | 37 | ||||
-rw-r--r-- | dviware/dvisvgm/libs/ff-woff/inc/gimage.h | 204 | ||||
-rw-r--r-- | dviware/dvisvgm/libs/ff-woff/inc/gnetwork.h | 87 | ||||
-rw-r--r-- | dviware/dvisvgm/libs/ff-woff/inc/gwwiconv.h | 48 | ||||
-rw-r--r-- | dviware/dvisvgm/libs/ff-woff/inc/ustring.h | 212 | ||||
-rw-r--r-- | dviware/dvisvgm/libs/ff-woff/inc/utype.h | 155 |
10 files changed, 1168 insertions, 0 deletions
diff --git a/dviware/dvisvgm/libs/ff-woff/inc/basics.h b/dviware/dvisvgm/libs/ff-woff/inc/basics.h new file mode 100644 index 0000000000..e1a543d39e --- /dev/null +++ b/dviware/dvisvgm/libs/ff-woff/inc/basics.h @@ -0,0 +1,125 @@ +/* Copyright (C) 2000-2012 by George Williams */ +/* + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + + * The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _BASICS_H +#define _BASICS_H + +#include <fontforge-config.h> +#include <stdio.h> /* for NULL */ +#ifdef HAVE_STDINT_H +#include <stdint.h> +#else +#include <inttypes.h> +#endif +#include <stdlib.h> /* for free */ +#include <limits.h> +#include <stdbool.h> + +typedef int32_t int32; +typedef uint32_t uint32; +typedef int16_t int16; +typedef uint16_t uint16; +typedef int8_t int8; +typedef uint8_t uint8; + +/* An integral type which can hold a pointer */ +typedef intptr_t intpt; + +typedef uint32 unichar_t; + +/* A macro to mark unused function parameters with. We often + * have such parameters, because of extensive use of callbacks. + */ +#ifdef UNUSED +#elif defined(__GNUC__) +# define UNUSED(x) UNUSED_ ## x __attribute__((unused)) +#elif defined(__LCLINT__) +# define UNUSED(x) /*@unused@*/ x +#else +# define UNUSED(x) x +#endif + +/* A macro to print a string for debug purposes + */ +#ifdef FONTFORGE_DEBUG +#define TRACE(...) printf(__VA_ARGS__) +#else +#define TRACE(...) +#endif + +extern void NoMoreMemMessage(void); + +static inline int imin(int a, int b) +{ + return (a < b) ? a : b; +} + +static inline int imax(int a, int b) +{ + return (a < b) ? b : a; +} + +#define IS_IN_ORDER3( a, b, c ) ( ((a)<=(b)) && ((b)<=(c)) ) + + +/** + * Many lists in FontForge are singly linked. At times you might want + * to append to the list which, when you only have a pointer to the + * start of the list can be more verbose than one would like. To use + * this macro you must defined a null initialized variable 'last' + * outside of any loop that traverses the source list. The last + * variable is used used by this macro to quickly append to the list + * as you go. This macro also assumes that the 'last' and 'newitem' + * types have a member "->next" which contains the single linked list + * pointer to the next element. + * + * Efficient list append should really be a one line call in the bulk + * of the code :) + * + * example: + * MyListObjectType* newfoolast = 0; + * MyListObjectType* newfoolist = 0; + * + * for( ... iterate a source collection of foos ... ) + * { + * MyListObjectType* foocopy = CopyIt( foo ); + * FFLIST_SINGLE_LINKED_APPEND( newfoolist, newfoolast, foocopy ); + * } + */ +#define FFLIST_SINGLE_LINKED_APPEND( head, last, newitem ) \ + if ( !last ) \ + { \ + newitem->next = 0; \ + head = last = newitem; \ + } \ + else \ + { \ + last->next = newitem; \ + last = newitem; \ + } + + +#endif diff --git a/dviware/dvisvgm/libs/ff-woff/inc/chardata.h b/dviware/dvisvgm/libs/ff-woff/inc/chardata.h new file mode 100644 index 0000000000..39bff9487a --- /dev/null +++ b/dviware/dvisvgm/libs/ff-woff/inc/chardata.h @@ -0,0 +1,78 @@ +#include <basics.h> + +struct charmap { + int first, last; + unsigned char **table; + unichar_t *totable; +}; +struct charmap2 { + int first, last; + unsigned short **table; + unichar_t *totable; +}; + +extern const unichar_t unicode_from_i8859_1[]; +extern struct charmap i8859_1_from_unicode; +extern const unichar_t unicode_from_i8859_2[]; +extern struct charmap i8859_2_from_unicode; +extern const unichar_t unicode_from_i8859_3[]; +extern struct charmap i8859_3_from_unicode; +extern const unichar_t unicode_from_i8859_4[]; +extern struct charmap i8859_4_from_unicode; +extern const unichar_t unicode_from_i8859_5[]; +extern struct charmap i8859_5_from_unicode; +extern const unichar_t unicode_from_i8859_6[]; +extern struct charmap i8859_6_from_unicode; +extern const unichar_t unicode_from_i8859_7[]; +extern struct charmap i8859_7_from_unicode; +extern const unichar_t unicode_from_i8859_8[]; +extern struct charmap i8859_8_from_unicode; +extern const unichar_t unicode_from_i8859_9[]; +extern struct charmap i8859_9_from_unicode; +extern const unichar_t unicode_from_i8859_10[]; +extern struct charmap i8859_10_from_unicode; +extern const unichar_t unicode_from_i8859_11[]; +extern struct charmap i8859_11_from_unicode; +extern const unichar_t unicode_from_i8859_13[]; +extern struct charmap i8859_13_from_unicode; +extern const unichar_t unicode_from_i8859_14[]; +extern struct charmap i8859_14_from_unicode; +extern const unichar_t unicode_from_i8859_15[]; +extern struct charmap i8859_15_from_unicode; +extern const unichar_t unicode_from_koi8_r[]; +extern struct charmap koi8_r_from_unicode; +extern const unichar_t unicode_from_jis201[]; +extern struct charmap jis201_from_unicode; +extern const unichar_t unicode_from_win[]; +extern struct charmap win_from_unicode; +extern const unichar_t unicode_from_mac[]; +extern struct charmap mac_from_unicode; +extern const unichar_t unicode_from_MacSymbol[]; +extern struct charmap MacSymbol_from_unicode; +extern const unichar_t unicode_from_ZapfDingbats[]; +extern struct charmap ZapfDingbats_from_unicode; + +extern unichar_t *unicode_from_alphabets[]; +extern struct charmap *alphabets_from_unicode[]; + +extern const unichar_t unicode_from_jis208[]; +extern const unichar_t unicode_from_jis212[]; +extern struct charmap2 jis_from_unicode; +/* Subtract 0xa100 before indexing this array */ +extern const unichar_t unicode_from_big5[]; +extern struct charmap2 big5_from_unicode; +/* Subtract 0x8100 before indexing this array */ +extern const unichar_t unicode_from_big5hkscs[]; +extern struct charmap2 big5hkscs_from_unicode; +extern const unichar_t unicode_from_ksc5601[]; +extern struct charmap2 ksc5601_from_unicode; +/* Subtract 0x8400 before indexing this array */ +extern const unichar_t unicode_from_johab[]; +extern struct charmap2 johab_from_unicode; +extern const unichar_t unicode_from_gb2312[]; +extern struct charmap2 gb2312_from_unicode; + +/* a mask for each character saying what charset(s) it may be found in */ +extern const unsigned long * const unicode_backtrans[]; + +extern const unichar_t *const * const unicode_alternates[]; diff --git a/dviware/dvisvgm/libs/ff-woff/inc/charset.h b/dviware/dvisvgm/libs/ff-woff/inc/charset.h new file mode 100644 index 0000000000..94daf0d3b4 --- /dev/null +++ b/dviware/dvisvgm/libs/ff-woff/inc/charset.h @@ -0,0 +1,71 @@ +/* Copyright (C) 2000-2012 by George Williams */ +/* + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + + * The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _CHARSET_H +#define _CHARSET_H +/* ASCII is ISO 646, except the ISO version admits national alternatives */ +enum encoding { e_usascii, e_iso646_no, e_iso646_se, e_iso8859_1, + e_iso8859_2, e_iso8859_3, e_iso8859_4, e_iso8859_5, e_iso8859_6, + e_iso8859_7, e_iso8859_8, e_iso8859_9, e_iso8859_10, + e_iso8859_11/* same as TIS */, e_iso8859_13, e_iso8859_14, e_iso8859_15, + e_koi8_r, /* RFC 1489 */ + e_jis201, /* 8 bit, ascii & katakana */ + e_win, e_mac, + e_user, +/* korean appears to fit into the jis/euc encoding schemes */ +/* the difference between jis & jis2 is what the output encoding should be (presence of '(') */ + e_jis, e_jis2, e_jiskorean, e_jisgb, e_sjis, /* multi-byte */ + e_euc, e_euckorean, e_eucgb, + e_wansung, e_johab, + e_big5, + e_big5hkscs, + e_unicode, e_unicode_backwards, /* wide chars */ + e_utf7, e_utf8, /* unicode encodings */ + e_ucs4, /* 4 byte chars */ + e_notrans, /* _inch returns 16bits */ + e_encodingmax, e_unknown=-1, e_first2byte=e_jis }; + +enum charset { em_none = -1, + em_iso8859_1, em_iso8859_2, em_iso8859_3, em_iso8859_4, em_iso8859_5, + em_iso8859_6, em_iso8859_7, em_iso8859_8, em_iso8859_9, em_iso8859_10, + em_iso8859_11/* same as TIS */, em_iso8859_13, em_iso8859_14, em_iso8859_15, + em_koi8_r, + em_jis201, + em_win, em_mac, em_symbol, em_zapfding, em_user, em_adobestandard=em_user, + em_jis208, em_jis212, em_ksc5601, em_gb2312, em_big5, em_big5hkscs, + em_johab /* Korean*/, +/* 28 */ + em_unicode, em_unicode4, em_gb18030 , em_max, em_first2byte=em_jis208, em_last94x94=em_gb2312 }; + +extern int /*enum charset*/ local_encoding; +#if HAVE_ICONV +# include <iconv.h> +extern char *iconv_local_encoding_name; +#else +# include "gwwiconv.h" /* My fake iconv based on encodings in gdraw/gunicode */ +#endif +extern struct namemap { const char *name; int map; } encodingnames[]; +#endif diff --git a/dviware/dvisvgm/libs/ff-woff/inc/dlist.h b/dviware/dvisvgm/libs/ff-woff/inc/dlist.h new file mode 100644 index 0000000000..eb4fcb9621 --- /dev/null +++ b/dviware/dvisvgm/libs/ff-woff/inc/dlist.h @@ -0,0 +1,151 @@ +/* Copyright (C) 2012 by Ben Martin */ +/* + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + + * The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _DLIST_H +#define _DLIST_H + +/** + * Doubly linked list abstraction. Putting a full member of this + * struct first in another struct means you can treat it as a + * dlinkedlist. You can have a struct in many lists simply by + * embedding another dlistnode member and handing a pointer to that + * member to the dlist() helper functions. Double linking has big + * advantages in removal of single elements where you do not need to + * rescan to find removeme->prev; + */ +struct dlistnode { + struct dlistnode* next; + struct dlistnode* prev; +}; + +/** + * DEVELOPERS: make sure the start of this struct is compatible with + * dlistnode. While I could use the dlistnode as a first member, using + * a copy of the members in the same order as dlistnode has them + * allows callers using this struct a bit simpler access. + * + * While one can embed a dlistnode member into a struct to create + * linked lists, sometimes you want to return a splice of one of those + * lists. For example, if you have a double linked list of all your + * hotkeys, you might like to return only the ones that have a + * modifier of the Control key. You want to leave the hotkey structs + * in their original list, but create a new kust that references just + * a desired selection of objects. + * + * In other words, if you have some data you want to return in a + * double linked list, then use this node type. You can build one up + * using dlist_pushfront_external() and the caller can free that list + * using dlist_free_external(). Any of the foreach() functions will + * work to iterate a list of dlistnodeExternal as this list is + * identical to a dlistnode with an extra ptr payload. + */ +struct dlistnodeExternal { + struct dlistnode* next; + struct dlistnode* prev; + void* ptr; +}; + + +/** + * Push the node onto the head of the list + */ +extern void dlist_pushfront( struct dlistnode** list, struct dlistnode* node ); + +/** + * Take the last node off the list and return it. If the list is empty, return 0. + */ +struct dlistnode* dlist_popback( struct dlistnode** list ); + +/** + * the number of nodes in the list + */ +extern int dlist_size( struct dlistnode** list ); + +/** + * is the list empty + */ +extern int dlist_isempty( struct dlistnode** list ); + +/** + * Remove the node from the list. The node itself is not free()ed. + * That is still up to the caller. All this function does is preserve + * the list structure without the node being in it. + */ +extern void dlist_erase( struct dlistnode** list, struct dlistnode* node ); +typedef void (*dlist_foreach_func_type)( struct dlistnode* ); + +/** + * Call func for every node in the list. This is a defensive + * implementation, if you want to remove a node from the list inside + * func() that is perfectly fine. + */ +extern void dlist_foreach( struct dlistnode** list, dlist_foreach_func_type func ); +typedef void (*dlist_foreach_udata_func_type)( struct dlistnode*, void* udata ); + +/** + * Like dlist_foreach(), defensive coding still, but the udata pointer + * is passed back to your visitor function. + */ +extern void dlist_foreach_udata( struct dlistnode** list, dlist_foreach_udata_func_type func, void* udata ); + +/** + * Like dlist_foreach_udata() but nodes are visited in reverse order. + */ +extern void dlist_foreach_reverse_udata( struct dlistnode** list, dlist_foreach_udata_func_type func, void* udata ); + +/** + * Assuming list is an externalNode list, push a newly allocated list node with + * a dlistnodeExternal.ptr = ptr passed. + */ +extern void dlist_pushfront_external( struct dlistnode** list, void* ptr ); + +/** + * Free a list of externalNode type. The externalNode memory is + * free()ed, whatever externalNode.ptr is pointing to is not free()ed. + */ +extern void dlist_free_external( struct dlistnode** list ); + + +typedef void (*dlist_visitor_func_type)( struct dlistnode* ); + +/** + * To create a list of bounded length, use this function. Limit is the + * maximum length the list can reach. If list nodes have to be removed + * to be under this limit then "f" is used as a callback to free list + * nodes. This allows application specific freeing of a list node, and + * the ability to maintain a limit on the length of a list as a simple + * one line call. + * + * The current implementation expects you to only be trimming one or + * two entries at a time. It will still work for trimming 100 entries + * at a single time, but might not be quite as optimized for that case + * as it could be. + */ +extern void dlist_trim_to_limit( struct dlistnode** list, int limit, dlist_visitor_func_type f ); + + +#endif // _DLIST_H + diff --git a/dviware/dvisvgm/libs/ff-woff/inc/ffintl.h b/dviware/dvisvgm/libs/ff-woff/inc/ffintl.h new file mode 100644 index 0000000000..e4c14a2b76 --- /dev/null +++ b/dviware/dvisvgm/libs/ff-woff/inc/ffintl.h @@ -0,0 +1,37 @@ +/* Copyright (C) 2005-2012 by George Williams */ +/* + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + + * The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FFINTL_H +#define FFINTL_H + +#define _(str) (str) + +/* For messages including utf8 sequences that need gettext_noop treatment */ +#define NU_(str) (str) +#define N_(str) (str) + +#endif /* FFINTL_H */ diff --git a/dviware/dvisvgm/libs/ff-woff/inc/gimage.h b/dviware/dvisvgm/libs/ff-woff/inc/gimage.h new file mode 100644 index 0000000000..47fa137279 --- /dev/null +++ b/dviware/dvisvgm/libs/ff-woff/inc/gimage.h @@ -0,0 +1,204 @@ +/* Copyright (C) 2000-2012 by George Williams */ +/* + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + + * The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _GIMAGE_H +#define _GIMAGE_H +#include <basics.h> + +typedef uint32 Color; + +#define COLOR_UNKNOWN ((Color) 0xffffffff) +#define COLOR_TRANSPARENT ((Color) 0xffffffff) +#define COLOR_DEFAULT ((Color) 0xfffffffe) +#define COLOR_CREATE(r,g,b) (((r)<<16) | ((g)<<8) | (b)) +#define COLOR_ALPHA(col) (((col)>>24)) +#define COLOR_RED(col) (((col)>>16) & 0xff) +#define COLOR_GREEN(col) (((col)>>8) & 0xff) +#define COLOR_BLUE(col) ((col)&0xff) + +struct hslrgb { + double h,s,l,v; + double r,g,b; + uint8 rgb, hsl, hsv; +}; + +struct hslrgba { + double h,s,l,v; + double r,g,b; + uint8 rgb, hsl, hsv, has_alpha; + double alpha; +}; + +typedef struct clut { + int16 clut_len; + unsigned int is_grey: 1; + uint32 trans_index; /* will be ignored for cluts in images, use base->trans instead */ + Color clut[256]; +} GClut; + +#define GCLUT_CLUT_EMPTY \ +{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 \ +} + + +typedef struct revcmap RevCMap; + +enum image_type { it_mono, it_bitmap=it_mono, it_index, it_true, it_rgba }; + +struct _GImage { +/* Format: bitmaps are stored with the most significant bit first in byte units + indexed images are stored in byte units + true color images are stored in 4 byte units, 0,red,green,blue + rgba images are stored in 4 byte units, alpha,red,green blue +*/ + enum image_type image_type: 2; + int16 delay; /* for animated GIFs, delay to next frame */ + int32 width, height; + int32 bytes_per_line; + uint8 *data; + GClut *clut; + Color trans; /* PNG supports more than one transparent color, we don't */ + /* for non-true color images this is the index, not a color */ +}; + +/* We deal with 1 bit, 8 bit and 32 bit images internal. 1 bit images may have*/ +/* a clut (if they don't assume bw, 0==black, 1==white), 8 bit must have a */ +/* clut, 32bit are actually 24 bit RGB images, but we pad them for easy */ +/* accessing. it_screen means that we've got an image that can be drawn */ +/* directly on the screen */ +typedef struct gimage { + short list_len; /* length of list */ + union { /* depends on whether has_list is set */ + struct _GImage *image; + struct _GImage **images; + } u; + void *userdata; +} GImage; + +enum pastetrans_type { ptt_paste_trans_to_trans, ptt_old_shines_through}; + +typedef struct grect { + int32 x,y,width,height; +} GRect; + +#define GRECT_EMPTY { 0, 0, 0, 0 } + + +typedef struct gpoint { + int16 x,y; +} GPoint; + +#define GPOINT_EMPTY { 0, 0 } + + +extern GImage *GImageCreate(enum image_type type, int32 width, int32 height); +extern GImage *_GImage_Create(enum image_type type, int32 width, int32 height); +extern void GImageDestroy(GImage *gi); +extern GImage *GImageCreateAnimation(GImage **images, int n); +extern GImage *GImageAddImageBefore(GImage *dest, GImage *src, int pos); + +extern GImage *GImageBaseGetSub(struct _GImage *base, enum image_type it, GRect *src, GClut *nclut, RevCMap *rev); +extern GImage *GImageGetSub(GImage *image,enum image_type it, GRect *src, GClut *nclut, RevCMap *rev); +extern int GImageInsertToBase(struct _GImage *tobase, GImage *from, GRect *src, RevCMap *rev, + int to_x, int to_y, enum pastetrans_type ptt ); +extern int GImageInsert(GImage *to, GImage *from, GRect *src, RevCMap *rev, + int to_x, int to_y, enum pastetrans_type ptt ); +extern Color _GImageGetPixelColor(struct _GImage *base,int x, int y); /* Obsolete */ +extern Color GImageGetPixelColor(GImage *base,int x, int y); /* Obsolete */ +extern Color GImageGetPixelRGBA(GImage *base,int x, int y); +extern int GImageGetWidth(GImage *); +extern int GImageGetHeight(GImage *); +extern void *GImageGetUserData(GImage *img); +extern void GImageSetUserData(GImage *img,void *userdata); +extern void GImageResize(struct _GImage *tobase, struct _GImage *fbase, + GRect *src, RevCMap *rev); +extern GImage *GImageResize32(GImage *from, GRect *src, int width, int height, Color trans); +extern GImage *GImageResizeSame(GImage *from, GRect *src, int width, int height, RevCMap *rev); +extern RevCMap *GClutReverse(GClut *clut,int side_size); +void GClut_RevCMapFree(RevCMap *rev); +extern GClut *GImageFindCLUT(GImage *image,GClut *clut,int clutmax); +extern int GImageSameClut(GClut *clut,GClut *nclut); +extern int GImageGreyClut(GClut *clut); +extern Color GImageColourFName(unichar_t *name); +extern Color _GImage_ColourFName(char *name); +extern char *GImageNameFColour(Color col); +extern Color GDrawColorDarken(Color col, int by); +extern Color GDrawColorBrighten(Color col, int by); + +extern int GImageWriteGImage(GImage *gi, char *filename); +extern int GImageWrite_Bmp(GImage *gi, FILE *fp); +extern int GImageWriteBmp(GImage *gi, char *filename); +extern GImage *GImageRead_Bmp(FILE *file); +extern GImage *GImageReadBmp(char *filename); +extern int GImageWriteXbm(GImage *gi, char *filename); +extern GImage *GImageReadXbm(char *filename); +extern int GImageWriteXpm(GImage *gi, char *filename); +extern GImage *GImageReadXpm(char *filename); +extern int GImageWriteEps(GImage *gi, char *filename); +extern GImage *GImageReadTiff(char *filename); +extern GImage *GImageReadJpeg(char *filename); +extern GImage *GImageRead_Jpeg(FILE *fp); +extern int GImageWrite_Jpeg(GImage *gi, FILE *outfile, int quality, int progressive); +extern int GImageWriteJpeg(GImage *gi, char *filename, int quality, int progressive); +extern GImage *GImageRead_Png(FILE *fp); +extern GImage *GImageReadPng(char *filename); +extern int GImageWrite_Png(GImage *gi, FILE *fp, int progressive); +extern int GImageWritePng(GImage *gi, char *filename, int progressive); +extern GImage *GImageReadGif(char *filename); +extern int GImageWriteGif(GImage *gi,char *filename,int progressive); +extern GImage *GImageReadRas(char *filename); /* Sun Raster */ +extern GImage *GImageReadRgb(char *filename); /* SGI */ +extern GImage *GImageRead(char *filename); + +extern void GImageDrawRect(GImage *img,GRect *r,Color col); +extern void GImageDrawImage(GImage *dest,GImage *src,GRect *junk,int x, int y); +extern void GImageBlendOver(GImage *dest,GImage *src,GRect *from,int x, int y); + +extern void gRGB2HSL(struct hslrgb *col); +extern void gHSL2RGB(struct hslrgb *col); +extern void gRGB2HSV(struct hslrgb *col); +extern void gHSV2RGB(struct hslrgb *col); +extern void gColor2Hslrgb(struct hslrgb *col,Color from); +extern void gColor2Hslrgba(struct hslrgba *col,Color from); +extern Color gHslrgb2Color(struct hslrgb *col); +extern Color gHslrgba2Color(struct hslrgba *col); + +#endif diff --git a/dviware/dvisvgm/libs/ff-woff/inc/gnetwork.h b/dviware/dvisvgm/libs/ff-woff/inc/gnetwork.h new file mode 100644 index 0000000000..89067924c9 --- /dev/null +++ b/dviware/dvisvgm/libs/ff-woff/inc/gnetwork.h @@ -0,0 +1,87 @@ +/* Copyright (C) 2013 by Ben Martin */ +/* + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + + * The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ALREADY_INCLUDED_GNETWORK_H_ +#define _ALREADY_INCLUDED_GNETWORK_H_ + +#include <fontforge-config.h> + +#define IPADDRESS_STRING_LENGTH_T 100 + +/** + * Get a string that describes this host. It may be something + * like "foobar" if the user has decided to call their laptop that name. + * So you might not be able to resolve the returned hostname on a remote + * computer. Data is copied to outstring and outstring is returned. + */ +char* ff_gethostname( char* outstring, int outstring_sz ); + + +/** + * Get the network accessible IP address of the local machine. + * + * If the machine is multihomed you had better hope that traffic + * from the network can reach all NICs on the host. + * + * The output is copied to outstring which is assumed to be + * at least ipaddress_string_length_t bytes long. The outstring is + * also returned. + */ +extern char* getNetworkAddress( char* outstring ); + +extern char* HostPortPack( char* hostname, int port ); +extern char* HostPortUnpack( char* packed, int* port, int port_default ); + +/** + * This is ZUUID_LEN. Because that length is stable and to avoid bringing in + * the czmq header file it is redeclared from base form here. + */ +#define FF_UUID_BINARY_SIZE 16 +/** + * min length of a buffer that will contain an ascii string serialiation of a uuid + */ +#define FF_UUID_STRING_SIZE 33 + +/** + * generate a new uuid and stringify it into the target area provided + * after the call target should contain something like + * 1b4e28ba-2fa1-11d2-883f-0016d3cca427 + * with the trailing NUL. Before the call target needs to be at least + * FF_UUID_STRING_SIZE bytes long. + * the 'target' is also the return value. + */ +char* ff_uuid_generate( char* target ); + +/** + * This test might be improved in the future. + * You pass a string which might have the form of a UUID (or be "\0 whatever") or + * just be a null pointer, and the function returns true if the uuid string + * you passed in conforms to being a uuid. + */ +extern int ff_uuid_isValid( char* uuid ); + +#endif diff --git a/dviware/dvisvgm/libs/ff-woff/inc/gwwiconv.h b/dviware/dvisvgm/libs/ff-woff/inc/gwwiconv.h new file mode 100644 index 0000000000..ff650a6dd3 --- /dev/null +++ b/dviware/dvisvgm/libs/ff-woff/inc/gwwiconv.h @@ -0,0 +1,48 @@ +/* Copyright (C) 2004-2012 by George Williams */ +/* + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + + * The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _GWWICONV_H +#define _GWWICONV_H + +# ifndef HAVE_ICONV +# define __need_size_t +# include <stdlib.h> /* For size_t */ + +typedef void *gww_iconv_t; + +extern gww_iconv_t gww_iconv_open(const char *toenc,const char *fromenc); +extern void gww_iconv_close( gww_iconv_t cd); +extern size_t gww_iconv( gww_iconv_t cd, + char **inbuf, size_t *inlen, + char **outbuf, size_t *outlen); + +#define iconv_t gww_iconv_t +#define iconv_open gww_iconv_open +#define iconv_close gww_iconv_close +#define iconv gww_iconv + +# endif /* HAVE_ICONV */ +#endif /* _GWWICONV_H */ diff --git a/dviware/dvisvgm/libs/ff-woff/inc/ustring.h b/dviware/dvisvgm/libs/ff-woff/inc/ustring.h new file mode 100644 index 0000000000..3e3f1b891c --- /dev/null +++ b/dviware/dvisvgm/libs/ff-woff/inc/ustring.h @@ -0,0 +1,212 @@ +/* Copyright (C) 2000-2012 by George Williams */ +/* + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + + * The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _UCHAR_H +# define _UCHAR_H +#include <stdarg.h> +#include <string.h> +#include <memory.h> +#include <basics.h> +#include <charset.h> + +extern char *copy(const char *); +extern char *copyn(const char *,long); +extern unichar_t *u_copy(const unichar_t*); +extern unichar_t *u_copyn(const unichar_t*, long); +extern unichar_t *u_copynallocm(const unichar_t *pt, long n, long m); +extern unichar_t *uc_copyn(const char *, int); +extern unichar_t *uc_copy(const char*); +extern unichar_t *u_concat(const unichar_t*,const unichar_t*); +extern char *cu_copyn(const unichar_t *pt,int len); +extern char *cu_copy(const unichar_t*); + +extern long uc_strcmp(const unichar_t *,const char *); +extern long u_strcmp(const unichar_t *, const unichar_t *); +extern long uc_strncmp(const unichar_t *,const char *,int); +extern long u_strncmp(const unichar_t *, const unichar_t *,int); +extern long uc_strmatch(const unichar_t *,const char *); +extern long uc_strnmatch(const unichar_t *,const char *,int); +extern long u_strnmatch(const unichar_t *str1, const unichar_t *str2, int len); +extern long u_strmatch(const unichar_t *, const unichar_t *); +extern int strmatch(const char *,const char *); +extern int strnmatch(const char *str1, const char *str2, int n); +extern void uc_strcpy(unichar_t *, const char *); +extern void cu_strcpy(char *, const unichar_t *); +extern void u_strcpy(unichar_t *, const unichar_t *); +extern void u_strncpy(unichar_t *, const unichar_t *,int); +extern void cu_strncpy(char *to, const unichar_t *from, int len); +extern void uc_strncpy(unichar_t *to, const char *from, int len); +/** + * Like strncpy but passing a null 'from' will simply null terminate + * to[0] to give a blank result rather than a crash. + */ +extern char *cc_strncpy(char *to, const char *from, int len); +extern void uc_strcat(unichar_t *, const char *); +extern void uc_strncat(unichar_t *, const char *,int len); +extern void cu_strcat(char *, const unichar_t *); +extern void cu_strncat(char *, const unichar_t *,int len); +extern void u_strcat(unichar_t *, const unichar_t *); +extern void u_strncat(unichar_t *, const unichar_t *, int len); +extern int u_strlen(const unichar_t *); +/** + * Like strlen() but passing a null pointer gets a 0 length + */ +extern int c_strlen(const char *); +extern unichar_t *u_strchr(const unichar_t *,unichar_t); +extern unichar_t *u_strrchr(const unichar_t *,unichar_t); +extern unichar_t *uc_strstr(const unichar_t *,const char *); +extern unichar_t *u_strstr(const unichar_t *,const unichar_t *); +extern unichar_t *uc_strstrmatch(const unichar_t *,const char *); +extern unichar_t *u_strstrmatch(const unichar_t *,const unichar_t *); +extern char * strstrmatch(const char *,const char *); + +extern char *u_to_c(const unichar_t *); +extern unichar_t *c_to_u(const char *); + +extern unsigned long u_strtoul(const unichar_t *,unichar_t **,int); +extern long u_strtol(const unichar_t *,unichar_t **,int); +extern double u_strtod(const unichar_t *,unichar_t **); + +/* + * Convert the integer 'v' to a string and return it. + * You do not own the return value, it is an internal buffer + * so you should copy it before using the function again + */ +extern char* c_itostr( int v ); + +extern char *strstart(const char *initial,const char *full); +extern char *strstartmatch(const char *initial,const char *full); +extern unichar_t *u_strstartmatch(const unichar_t *initial, const unichar_t *full); +extern unichar_t *cu_strstartmatch(const char *initial, const unichar_t *full); + +#define utf82u_strncpy utf82U_strncpy +extern int32 utf8_ildb(const char **utf8_text); +#define UTF8IDPB_NOZERO 1 /* Allow for 0 encoded as a non-zero utf8 0xc0:0x80 char */ +#define UTF8IDPB_OLDLIMIT 2 /* Today's utf8 is agreed to be limited to {0..0x10FFFF} */ +#define UTF8IDPB_UCS2 8 /* Encode {0...0xffff} as 16bit ucs2 type values */ +#define UTF8IDPB_UTF16 16 /* Encode {0...0x10ffff} as 16bit utf16 type values */ +#define UTF8IDPB_UTF32 32 /* Encode {0...0x10ffff} as 32bit utf32 type values */ +extern char *utf8_idpb(char *utf8_text,uint32 ch,int flags); +extern char *utf8_db(char *utf8_text); +extern char *utf8_ib(char *utf8_text); +extern int utf8_valid(const char *str); +extern void utf8_truncatevalid(char *str); +extern char *latin1_2_utf8_strcpy(char *utf8buf,const char *lbuf); +extern char *latin1_2_utf8_copy(const char *lbuf); +extern char *utf8_2_latin1_copy(const char *utf8buf); +extern long utf8_strlen(const char *utf8_str); /* Count how many characters in the string NOT bytes */ +extern long utf82u_strlen(const char *utf8_str); /* Count how many shorts needed to represent in UCS2 */ +extern void utf8_strncpy(register char *to, const char *from, int len); /* copy n characters NOT bytes */ +extern char *def2utf8_copy(const char *from); +extern char *utf82def_copy(const char *ufrom); +extern char *utf8_strchr(const char *utf8_str, int search_char); + +extern unichar_t *utf82u_strncpy(unichar_t *ubuf,const char *utf8buf,int len); +extern unichar_t *utf82u_strcpy(unichar_t *ubuf,const char *utf8buf); +extern void utf82u_strcat(unichar_t *ubuf,const char *utf8buf); +extern unichar_t *utf82u_copyn(const char *utf8buf,int len); +extern unichar_t *utf82u_copy(const char *utf8buf); +extern char *u2utf8_strcpy(char *utf8buf,const unichar_t *ubuf); +extern char *u2utf8_copy(const unichar_t *ubuf); +extern char *u2utf8_copyn(const unichar_t *ubuf,int len); +extern unichar_t *encoding2u_strncpy(unichar_t *uto, const char *from, int n, enum encoding cs); +extern char *u2encoding_strncpy(char *to, const unichar_t *ufrom, size_t n, enum encoding cs); +extern unichar_t *def2u_strncpy(unichar_t *uto, const char *from, size_t n); +extern char *u2def_strncpy(char *to, const unichar_t *ufrom, size_t n); +extern unichar_t *def2u_copy(const char *from); +extern char *u2def_copy(const unichar_t *ufrom); + +extern int uAllAscii(const unichar_t *str); +extern int AllAscii(const char *); +extern char *StripToASCII(const char *utf8_str); + +extern char *copytolower(const char *); +extern int endswith(const char *haystack,const char *needle); +extern int endswithi(const char *haystack,const char *needle); +extern int endswithi_partialExtension( const char *haystack,const char *needle); + +/** + * Remove trailing \n or \r from the given string. No memory + * allocations are performed, null is injected over these terminators + * to trim the string. + * + * This function is designed to be impotent if called with a string + * that does not end with \n or \r. ie, you don't need to redundantly + * check if there is a newline at the end of string and not call here + * if there is no newline. You can just call here with any string and + * be assured that afterwards there will be no trailing newline or + * carrage return character found at the end of the string pointed to + * by 'p'. + */ +extern char* chomp( char* p ); + +/** + * Return true if the haystack plain string ends with the string + * needle. Return 0 otherwise. + * + * Needles which are larger than the haystack are handled. + * + * No new strings are allocated, freed, or returned. + */ +int endswith(const char *haystack,const char *needle); + +/** + * Return true if the haystack unicode string ends with the string needle. + * Return 0 otherwise. + * + * Needles which are larger than the haystack are handled. + * + * No new strings are allocated, freed, or returned. + */ +extern int u_endswith(const unichar_t *haystack,const unichar_t *needle); + +extern int u_startswith(const unichar_t *haystack,const unichar_t *needle); +extern int uc_startswith(const unichar_t *haystack,const char* needle); + +/** + * In the string 's' replace all occurances of 'orig' with 'replacement'. + * If you set free_s to true then the string 's' will be freed by this function. + * Normally you want to set free_s to 0 to avoid that. The case you will want to + * use free_s to 1 is chaining many calls like: + * + * char* s = copy( input ); + * s = str_replace_all( s, "foo", "bar", 1 ); + * s = str_replace_all( s, "baz", "gah", 1 ); + * // use s + * free(s); + * // no leaks in the above. + * + * Note that 's' is first copied before the first call to replace_all in the above + * so it can be freed without concern. This also allows the ordering of replace_all + * in the above to be changed without having to worry about the free_s flag. + */ +extern char* str_replace_all( char* s, char* orig, char* replacement, int free_s ); + + +int toint( char* v ); +char* tostr( int v ); + +#endif diff --git a/dviware/dvisvgm/libs/ff-woff/inc/utype.h b/dviware/dvisvgm/libs/ff-woff/inc/utype.h new file mode 100644 index 0000000000..d977213ff2 --- /dev/null +++ b/dviware/dvisvgm/libs/ff-woff/inc/utype.h @@ -0,0 +1,155 @@ +#ifndef _UTYPE_H +#define _UTYPE_H +/* Copyright: 2001 George Williams */ +/* License: BSD-3-clause */ +/* Contributions: Joe Da Silva */ + +/* This file was generated using the program 'makeutype' */ + +#include <ctype.h> /* Include here so we can control it. If a system header includes it later bad things happen */ +#include <basics.h> /* Include here so we can use pre-defined int types to correctly size constant data arrays. */ +#ifdef tolower +# undef tolower +#endif +#ifdef toupper +# undef toupper +#endif +#ifdef islower +# undef islower +#endif +#ifdef isupper +# undef isupper +#endif +#ifdef isalpha +# undef isalpha +#endif +#ifdef isdigit +# undef isdigit +#endif +#ifdef isalnum +# undef isalnum +#endif +#ifdef isspace +# undef isspace +#endif +#ifdef ispunct +# undef ispunct +#endif +#ifdef ishexdigit +# undef ishexdigit +#endif + +extern const unsigned short ____tolower[]; +extern const unsigned short ____toupper[]; +extern const unsigned short ____totitle[]; +extern const unsigned short ____tomirror[]; +extern const unsigned char ____digitval[]; + +/* utype[] holds binary flags used for features of each unicode.org character */ +#define ____L 0x1 +#define ____U 0x2 +#define ____TITLE 0x4 +#define ____D 0x8 +#define ____S 0x10 +#define ____P 0x20 +#define ____X 0x40 +#define ____ZW 0x80 +#define ____L2R 0x100 +#define ____R2L 0x200 +#define ____ENUM 0x400 +#define ____ANUM 0x800 +#define ____ENS 0x1000 +#define ____CS 0x2000 +#define ____ENT 0x4000 +#define ____COMBINE 0x8000 +#define ____BB 0x10000 +#define ____BA 0x20000 +#define ____NS 0x40000 +#define ____NE 0x80000 +#define ____UB 0x100000 +#define ____NB 0x8000000 +#define ____AL 0x200000 +#define ____ID 0x400000 +#define ____INITIAL 0x800000 +#define ____MEDIAL 0x1000000 +#define ____FINAL 0x2000000 +#define ____ISOLATED 0x4000000 +#define ____DECOMPNORM 0x10000000 + +#define islower(ch) (____utype[(ch)+1]&____L) +#define isupper(ch) (____utype[(ch)+1]&____U) +#define istitle(ch) (____utype[(ch)+1]&____TITLE) +#define isalpha(ch) (____utype[(ch)+1]&(____L|____U|____TITLE|____AL)) +#define isdigit(ch) (____utype[(ch)+1]&____D) +#define isalnum(ch) (____utype[(ch)+1]&(____L|____U|____TITLE|____AL|____D)) +#define isideographic(ch) (____utype[(ch)+1]&____ID) +#define isideoalpha(ch) (____utype[(ch)+1]&(____ID|____L|____U|____TITLE|____AL)) +#define isspace(ch) (____utype[(ch)+1]&____S) +#define ispunct(ch) (____utype[(ch)+1]&_____P) +#define ishexdigit(ch) (____utype[(ch)+1]&____X) +#define iszerowidth(ch) (____utype[(ch)+1]&____ZW) +#define islefttoright(ch) (____utype[(ch)+1]&____L2R) +#define isrighttoleft(ch) (____utype[(ch)+1]&____R2L) +#define iseuronumeric(ch) (____utype[(ch)+1]&____ENUM) +#define isarabnumeric(ch) (____utype[(ch)+1]&____ANUM) +#define iseuronumsep(ch) (____utype[(ch)+1]&____ENS) +#define iscommonsep(ch) (____utype[(ch)+1]&____CS) +#define iseuronumterm(ch) (____utype[(ch)+1]&____ENT) +#define iscombining(ch) (____utype[(ch)+1]&____COMBINE) +#define isbreakbetweenok(ch1,ch2) (((____utype[(ch1)+1]&____BA) && !(____utype[(ch2)+1]&____NS)) || ((____utype[(ch2)+1]&____BB) && !(____utype[(ch1)+1]&____NE)) || (!(____utype[(ch2)+1]&____D) && ch1=='/')) +#define isnobreak(ch) (____utype[(ch)+1]&____NB) +#define isarabinitial(ch) (____utype[(ch)+1]&____INITIAL) +#define isarabmedial(ch) (____utype[(ch)+1]&____MEDIAL) +#define isarabfinal(ch) (____utype[(ch)+1]&____FINAL) +#define isarabisolated(ch) (____utype[(ch)+1]&____ISOLATED) + +#define isdecompositionnormative(ch) (____utype[(ch)+1]&____DECOMPNORM) + +extern const uint32 ____utype[]; /* hold character type features for each Unicode.org defined character */ + +/* utype2[] binary flags used for position/layout of each unicode.org character */ +#define ____COMBININGCLASS 0xff +#define ____ABOVE 0x100 +#define ____BELOW 0x200 +#define ____OVERSTRIKE 0x400 +#define ____LEFT 0x800 +#define ____RIGHT 0x1000 +#define ____JOINS2 0x2000 +#define ____CENTERLEFT 0x4000 +#define ____CENTERRIGHT 0x8000 +#define ____CENTEREDOUTSIDE 0x10000 +#define ____OUTSIDE 0x20000 +#define ____LEFTEDGE 0x80000 +#define ____RIGHTEDGE 0x40000 +#define ____TOUCHING 0x100000 +#define ____COMBININGPOSMASK 0x1fff00 +#define ____NOPOSDATAGIVEN (uint32)(-1) /* -1 == no position data given */ + +#define combiningclass(ch) (____utype2[(ch)+1]&____COMBININGCLASS) +#define combiningposmask(ch) (____utype2[(ch)+1]&____COMBININGPOSMASK) + +extern const uint32 ____utype2[]; /* hold position boolean flags for each Unicode.org defined character */ + +#define isunicodepointassigned(ch) (____codepointassigned[(ch)/32]&(1<<((ch)%32))) + +extern const uint32 ____codepointassigned[]; /* 1bit_boolean_flag x 32 = exists in Unicode.org character chart list. */ + +#define tolower(ch) (____tolower[(ch)+1]) +#define toupper(ch) (____toupper[(ch)+1]) +#define totitle(ch) (____totitle[(ch)+1]) +#define tomirror(ch) (____tomirror[(ch)+1]) +#define tovalue(ch) (____digitval[(ch)+1]) + + +extern struct arabicforms { + unsigned short initial, medial, final, isolated; + unsigned int isletter: 1; + unsigned int joindual: 1; + unsigned int required_lig_with_alef: 1; +} ArabicForms[256]; /* for chars 0x600-0x6ff, subtract 0x600 to use array */ + +#define _SOFT_HYPHEN 0xad + +#define _DOUBLE_S 0xdf + +#endif |