2 * Copyright 2008 Department of Mathematical Sciences, New Mexico State University
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * DEPARTMENT OF MATHEMATICAL SCIENCES OR NEW MEXICO STATE UNIVERSITY BE
18 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 #define MYABS(xx) ((xx) < 0 ? -(xx) : (xx))
36 * Macros and structures used for undo operations in the font.
38 #define _UNDO_REPLACE_GLYPHS 1
39 #define _UNDO_INSERT_GLYPHS 2
40 #define _UNDO_MERGE_GLYPHS 3
43 * This structure is for undo operations of replacing and merging glyphs
52 * This structure is for undo operations of inserting glyphs.
61 * This is the final undo structure used to store undo information with the
73 * Tables for rotation and shearing.
75 extern double _bdf_cos_tbl[];
76 extern double _bdf_sin_tbl[];
77 extern double _bdf_tan_tbl[];
82 extern unsigned char _bdf_psf1magic[];
83 extern unsigned char _bdf_psf2magic[];
84 extern char _bdf_psfcombined[];
87 * Arrays of masks for test with different bits per pixel.
89 extern unsigned char bdf_onebpp[];
90 extern unsigned char bdf_twobpp[];
91 extern unsigned char bdf_fourbpp[];
92 extern unsigned char bdf_eightbpp[];
95 * Simple routine for determining the ceiling.
97 extern short _bdf_ceiling(double v);
99 extern unsigned char *_bdf_strdup(unsigned char *s, unsigned int len);
100 extern void _bdf_memmove(char *dest, char *src, unsigned int bytes);
102 extern short _bdf_atos(char *s, char **end, int base);
103 extern int _bdf_atol(char *s, char **end, int base);
104 extern unsigned int _bdf_atoul(char *s, char **end, int base);
107 * Function to locate the nearest glyph to a specified encoding.
109 extern bdf_glyph_t *_bdf_locate_glyph(bdf_font_t *font, int encoding,
113 * Macros to test/set the modified status of a glyph.
115 #define _bdf_glyph_modified(map, e) ((map)[(e) >> 5] & (1 << ((e) & 31)))
116 #define _bdf_set_glyph_modified(map, e) (map)[(e) >> 5] |= (1 << ((e) & 31))
117 #define _bdf_clear_glyph_modified(map, e) (map)[(e) >> 5] &= ~(1 << ((e) & 31))
120 * Function to add a message to the font.
122 extern void _bdf_add_acmsg(bdf_font_t *font, char *msg, unsigned int len);
125 * Function to add a comment to the font.
127 extern void _bdf_add_comment(bdf_font_t *font, char *comment,
131 * Function to do glyph name table cleanup when exiting.
133 extern void _bdf_glyph_name_cleanup(void);
136 * Function to pad cells when saving glyphs.
138 extern void _bdf_pad_cell(bdf_font_t *font, bdf_glyph_t *glyph,
142 * Function to crop glyphs down to their minimum bitmap.
144 extern void _bdf_crop_glyph(bdf_font_t *font, bdf_glyph_t *glyph);
147 * Routine to generate a string list from the PSF2 Unicode mapping format.
149 extern char **_bdf_psf_unpack_mapping(bdf_psf_unimap_t *unimap, int *num_seq);
152 * Routine to convert a string list of mappings back to PSF2 format.
154 extern int _bdf_psf_pack_mapping(char **list, int len, int encoding,
155 bdf_psf_unimap_t *map);