Normalise line endings (unix)

This commit is contained in:
Will Pearson
2019-04-09 10:11:17 -07:00
parent 75d17abf01
commit 98797aac6e
926 changed files with 720853 additions and 720853 deletions

View File

@@ -1,148 +1,148 @@
FreeType font driver for BDF fonts
Francesco Zappa Nardelli
<francesco.zappa.nardelli@ens.fr>
Introduction
************
BDF (Bitmap Distribution Format) is a bitmap font format defined by Adobe,
which is intended to be easily understood by both humans and computers.
This code implements a BDF driver for the FreeType library, following the
Adobe Specification V 2.2. The specification of the BDF font format is
available from Adobe's web site:
http://partners.adobe.com/public/developer/en/font/5005.BDF_Spec.pdf
Many good bitmap fonts in bdf format come with XFree86 (www.XFree86.org).
They do not define vertical metrics, because the X Consortium BDF
specification has removed them.
Encodings
*********
The variety of encodings that accompanies bdf fonts appears to encompass the
small set defined in freetype.h. On the other hand, two properties that
specify encoding and registry are usually defined in bdf fonts.
I decided to make these two properties directly accessible, leaving to the
client application the work of interpreting them. For instance:
#include FT_INTERNAL_BDF_TYPES_H
FT_Face face;
BDF_Public_Face bdfface;
FT_New_Face( library, ..., &face );
bdfface = (BDF_Public_Face)face;
if ( ( bdfface->charset_registry == "ISO10646" ) &&
( bdfface->charset_encoding == "1" ) )
[..]
Thus the driver always exports `ft_encoding_none' as face->charmap.encoding.
FT_Get_Char_Index's behavior is unmodified, that is, it converts the ULong
value given as argument into the corresponding glyph number.
If the two properties are not available, Adobe Standard Encoding should be
assumed.
Anti-Aliased Bitmaps
********************
The driver supports an extension to the BDF format as used in Mark Leisher's
xmbdfed bitmap font editor. Microsoft's SBIT tool expects bitmap fonts in
that format for adding anti-aliased them to TrueType fonts. It introduces a
fourth field to the `SIZE' keyword which gives the bpp value (bits per
pixel) of the glyph data in the font. Possible values are 1 (the default),
2 (four gray levels), 4 (16 gray levels), and 8 (256 gray levels). The
driver returns either a bitmap with 1 bit per pixel or a pixmap with 8bits
per pixel (using 4, 16, and 256 gray levels, respectively).
Known problems
**************
- A font is entirely loaded into memory. Obviously, this is not the Right
Thing(TM). If you have big fonts I suggest you convert them into PCF
format (using the bdftopcf utility): the PCF font drive of FreeType can
perform incremental glyph loading.
When I have some time, I will implement on-demand glyph parsing.
- Except for encodings properties, client applications have no visibility of
the PCF_Face object. This means that applications cannot directly access
font tables and must trust FreeType.
- Currently, glyph names are ignored.
I plan to give full visibility of the BDF_Face object in an upcoming
revision of the driver, thus implementing also glyph names.
- As I have never seen a BDF font that defines vertical metrics, vertical
metrics are (parsed and) discarded. If you own a BDF font that defines
vertical metrics, please let me know (I will implement them in 5-10
minutes).
License
*******
Copyright (C) 2001-2002 by Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*** Portions of the driver (that is, bdflib.c and bdf.h):
Copyright 2000 Computing Research Labs, New Mexico State University
Copyright 2001-2002, 2011 Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Credits
*******
This driver is based on excellent Mark Leisher's bdf library. If you
find something good in this driver you should probably thank him, not
me.
FreeType font driver for BDF fonts
Francesco Zappa Nardelli
<francesco.zappa.nardelli@ens.fr>
Introduction
************
BDF (Bitmap Distribution Format) is a bitmap font format defined by Adobe,
which is intended to be easily understood by both humans and computers.
This code implements a BDF driver for the FreeType library, following the
Adobe Specification V 2.2. The specification of the BDF font format is
available from Adobe's web site:
http://partners.adobe.com/public/developer/en/font/5005.BDF_Spec.pdf
Many good bitmap fonts in bdf format come with XFree86 (www.XFree86.org).
They do not define vertical metrics, because the X Consortium BDF
specification has removed them.
Encodings
*********
The variety of encodings that accompanies bdf fonts appears to encompass the
small set defined in freetype.h. On the other hand, two properties that
specify encoding and registry are usually defined in bdf fonts.
I decided to make these two properties directly accessible, leaving to the
client application the work of interpreting them. For instance:
#include FT_INTERNAL_BDF_TYPES_H
FT_Face face;
BDF_Public_Face bdfface;
FT_New_Face( library, ..., &face );
bdfface = (BDF_Public_Face)face;
if ( ( bdfface->charset_registry == "ISO10646" ) &&
( bdfface->charset_encoding == "1" ) )
[..]
Thus the driver always exports `ft_encoding_none' as face->charmap.encoding.
FT_Get_Char_Index's behavior is unmodified, that is, it converts the ULong
value given as argument into the corresponding glyph number.
If the two properties are not available, Adobe Standard Encoding should be
assumed.
Anti-Aliased Bitmaps
********************
The driver supports an extension to the BDF format as used in Mark Leisher's
xmbdfed bitmap font editor. Microsoft's SBIT tool expects bitmap fonts in
that format for adding anti-aliased them to TrueType fonts. It introduces a
fourth field to the `SIZE' keyword which gives the bpp value (bits per
pixel) of the glyph data in the font. Possible values are 1 (the default),
2 (four gray levels), 4 (16 gray levels), and 8 (256 gray levels). The
driver returns either a bitmap with 1 bit per pixel or a pixmap with 8bits
per pixel (using 4, 16, and 256 gray levels, respectively).
Known problems
**************
- A font is entirely loaded into memory. Obviously, this is not the Right
Thing(TM). If you have big fonts I suggest you convert them into PCF
format (using the bdftopcf utility): the PCF font drive of FreeType can
perform incremental glyph loading.
When I have some time, I will implement on-demand glyph parsing.
- Except for encodings properties, client applications have no visibility of
the PCF_Face object. This means that applications cannot directly access
font tables and must trust FreeType.
- Currently, glyph names are ignored.
I plan to give full visibility of the BDF_Face object in an upcoming
revision of the driver, thus implementing also glyph names.
- As I have never seen a BDF font that defines vertical metrics, vertical
metrics are (parsed and) discarded. If you own a BDF font that defines
vertical metrics, please let me know (I will implement them in 5-10
minutes).
License
*******
Copyright (C) 2001-2002 by Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*** Portions of the driver (that is, bdflib.c and bdf.h):
Copyright 2000 Computing Research Labs, New Mexico State University
Copyright 2001-2002, 2011 Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Credits
*******
This driver is based on excellent Mark Leisher's bdf library. If you
find something good in this driver you should probably thank him, not
me.

View File

@@ -1,34 +1,34 @@
/* bdf.c
FreeType font driver for bdf files
Copyright (C) 2001, 2002 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#define FT_MAKE_OPTION_SINGLE_OBJECT
#include <ft2build.h>
#include "bdflib.c"
#include "bdfdrivr.c"
/* END */
/* bdf.c
FreeType font driver for bdf files
Copyright (C) 2001, 2002 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#define FT_MAKE_OPTION_SINGLE_OBJECT
#include <ft2build.h>
#include "bdflib.c"
#include "bdfdrivr.c"
/* END */

View File

@@ -1,280 +1,280 @@
/*
* Copyright 2000 Computing Research Labs, New Mexico State University
* Copyright 2001-2004, 2011 Francesco Zappa Nardelli
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef BDF_H_
#define BDF_H_
/*
* Based on bdf.h,v 1.16 2000/03/16 20:08:51 mleisher
*/
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_HASH_H
FT_BEGIN_HEADER
/* Imported from bdfP.h */
#define _bdf_glyph_modified( map, e ) \
( (map)[(e) >> 5] & ( 1UL << ( (e) & 31 ) ) )
#define _bdf_set_glyph_modified( map, e ) \
( (map)[(e) >> 5] |= ( 1UL << ( (e) & 31 ) ) )
#define _bdf_clear_glyph_modified( map, e ) \
( (map)[(e) >> 5] &= ~( 1UL << ( (e) & 31 ) ) )
/* end of bdfP.h */
/*************************************************************************/
/* */
/* BDF font options macros and types. */
/* */
/*************************************************************************/
#define BDF_CORRECT_METRICS 0x01 /* Correct invalid metrics when loading. */
#define BDF_KEEP_COMMENTS 0x02 /* Preserve the font comments. */
#define BDF_KEEP_UNENCODED 0x04 /* Keep the unencoded glyphs. */
#define BDF_PROPORTIONAL 0x08 /* Font has proportional spacing. */
#define BDF_MONOWIDTH 0x10 /* Font has mono width. */
#define BDF_CHARCELL 0x20 /* Font has charcell spacing. */
#define BDF_ALL_SPACING ( BDF_PROPORTIONAL | \
BDF_MONOWIDTH | \
BDF_CHARCELL )
#define BDF_DEFAULT_LOAD_OPTIONS ( BDF_CORRECT_METRICS | \
BDF_KEEP_COMMENTS | \
BDF_KEEP_UNENCODED | \
BDF_PROPORTIONAL )
typedef struct bdf_options_t_
{
int correct_metrics;
int keep_unencoded;
int keep_comments;
int font_spacing;
} bdf_options_t;
/* Callback function type for unknown configuration options. */
typedef int
(*bdf_options_callback_t)( bdf_options_t* opts,
char** params,
unsigned long nparams,
void* client_data );
/*************************************************************************/
/* */
/* BDF font property macros and types. */
/* */
/*************************************************************************/
#define BDF_ATOM 1
#define BDF_INTEGER 2
#define BDF_CARDINAL 3
/* This structure represents a particular property of a font. */
/* There are a set of defaults and each font has their own. */
typedef struct bdf_property_t_
{
char* name; /* Name of the property. */
int format; /* Format of the property. */
int builtin; /* A builtin property. */
union
{
char* atom;
long l;
unsigned long ul;
} value; /* Value of the property. */
} bdf_property_t;
/*************************************************************************/
/* */
/* BDF font metric and glyph types. */
/* */
/*************************************************************************/
typedef struct bdf_bbx_t_
{
unsigned short width;
unsigned short height;
short x_offset;
short y_offset;
short ascent;
short descent;
} bdf_bbx_t;
typedef struct bdf_glyph_t_
{
char* name; /* Glyph name. */
long encoding; /* Glyph encoding. */
unsigned short swidth; /* Scalable width. */
unsigned short dwidth; /* Device width. */
bdf_bbx_t bbx; /* Glyph bounding box. */
unsigned char* bitmap; /* Glyph bitmap. */
unsigned long bpr; /* Number of bytes used per row. */
unsigned short bytes; /* Number of bytes used for the bitmap. */
} bdf_glyph_t;
typedef struct bdf_glyphlist_t_
{
unsigned short pad; /* Pad to 4-byte boundary. */
unsigned short bpp; /* Bits per pixel. */
long start; /* Beginning encoding value of glyphs. */
long end; /* Ending encoding value of glyphs. */
bdf_glyph_t* glyphs; /* Glyphs themselves. */
unsigned long glyphs_size; /* Glyph structures allocated. */
unsigned long glyphs_used; /* Glyph structures used. */
bdf_bbx_t bbx; /* Overall bounding box of glyphs. */
} bdf_glyphlist_t;
typedef struct bdf_font_t_
{
char* name; /* Name of the font. */
bdf_bbx_t bbx; /* Font bounding box. */
unsigned long point_size; /* Point size of the font. */
unsigned long resolution_x; /* Font horizontal resolution. */
unsigned long resolution_y; /* Font vertical resolution. */
int spacing; /* Font spacing value. */
unsigned short monowidth; /* Logical width for monowidth font. */
long default_char; /* Encoding of the default glyph. */
long font_ascent; /* Font ascent. */
long font_descent; /* Font descent. */
unsigned long glyphs_size; /* Glyph structures allocated. */
unsigned long glyphs_used; /* Glyph structures used. */
bdf_glyph_t* glyphs; /* Glyphs themselves. */
unsigned long unencoded_size; /* Unencoded glyph struct. allocated. */
unsigned long unencoded_used; /* Unencoded glyph struct. used. */
bdf_glyph_t* unencoded; /* Unencoded glyphs themselves. */
unsigned long props_size; /* Font properties allocated. */
unsigned long props_used; /* Font properties used. */
bdf_property_t* props; /* Font properties themselves. */
char* comments; /* Font comments. */
unsigned long comments_len; /* Length of comment string. */
bdf_glyphlist_t overflow; /* Storage used for glyph insertion. */
void* internal; /* Internal data for the font. */
/* The size of the next two arrays must be in sync with the */
/* size of the `have' array in the `bdf_parse_t' structure. */
unsigned long nmod[34816]; /* Bitmap indicating modified glyphs. */
unsigned long umod[34816]; /* Bitmap indicating modified */
/* unencoded glyphs. */
unsigned short modified; /* Boolean indicating font modified. */
unsigned short bpp; /* Bits per pixel. */
FT_Memory memory;
bdf_property_t* user_props;
unsigned long nuser_props;
FT_HashRec proptbl;
} bdf_font_t;
/*************************************************************************/
/* */
/* Types for load/save callbacks. */
/* */
/*************************************************************************/
/* Error codes. */
#define BDF_MISSING_START -1
#define BDF_MISSING_FONTNAME -2
#define BDF_MISSING_SIZE -3
#define BDF_MISSING_CHARS -4
#define BDF_MISSING_STARTCHAR -5
#define BDF_MISSING_ENCODING -6
#define BDF_MISSING_BBX -7
#define BDF_OUT_OF_MEMORY -20
#define BDF_INVALID_LINE -100
/*************************************************************************/
/* */
/* BDF font API. */
/* */
/*************************************************************************/
FT_LOCAL( FT_Error )
bdf_load_font( FT_Stream stream,
FT_Memory memory,
bdf_options_t* opts,
bdf_font_t* *font );
FT_LOCAL( void )
bdf_free_font( bdf_font_t* font );
FT_LOCAL( bdf_property_t * )
bdf_get_property( char* name,
bdf_font_t* font );
FT_LOCAL( bdf_property_t * )
bdf_get_font_property( bdf_font_t* font,
const char* name );
FT_END_HEADER
#endif /* BDF_H_ */
/* END */
/*
* Copyright 2000 Computing Research Labs, New Mexico State University
* Copyright 2001-2004, 2011 Francesco Zappa Nardelli
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef BDF_H_
#define BDF_H_
/*
* Based on bdf.h,v 1.16 2000/03/16 20:08:51 mleisher
*/
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_HASH_H
FT_BEGIN_HEADER
/* Imported from bdfP.h */
#define _bdf_glyph_modified( map, e ) \
( (map)[(e) >> 5] & ( 1UL << ( (e) & 31 ) ) )
#define _bdf_set_glyph_modified( map, e ) \
( (map)[(e) >> 5] |= ( 1UL << ( (e) & 31 ) ) )
#define _bdf_clear_glyph_modified( map, e ) \
( (map)[(e) >> 5] &= ~( 1UL << ( (e) & 31 ) ) )
/* end of bdfP.h */
/*************************************************************************/
/* */
/* BDF font options macros and types. */
/* */
/*************************************************************************/
#define BDF_CORRECT_METRICS 0x01 /* Correct invalid metrics when loading. */
#define BDF_KEEP_COMMENTS 0x02 /* Preserve the font comments. */
#define BDF_KEEP_UNENCODED 0x04 /* Keep the unencoded glyphs. */
#define BDF_PROPORTIONAL 0x08 /* Font has proportional spacing. */
#define BDF_MONOWIDTH 0x10 /* Font has mono width. */
#define BDF_CHARCELL 0x20 /* Font has charcell spacing. */
#define BDF_ALL_SPACING ( BDF_PROPORTIONAL | \
BDF_MONOWIDTH | \
BDF_CHARCELL )
#define BDF_DEFAULT_LOAD_OPTIONS ( BDF_CORRECT_METRICS | \
BDF_KEEP_COMMENTS | \
BDF_KEEP_UNENCODED | \
BDF_PROPORTIONAL )
typedef struct bdf_options_t_
{
int correct_metrics;
int keep_unencoded;
int keep_comments;
int font_spacing;
} bdf_options_t;
/* Callback function type for unknown configuration options. */
typedef int
(*bdf_options_callback_t)( bdf_options_t* opts,
char** params,
unsigned long nparams,
void* client_data );
/*************************************************************************/
/* */
/* BDF font property macros and types. */
/* */
/*************************************************************************/
#define BDF_ATOM 1
#define BDF_INTEGER 2
#define BDF_CARDINAL 3
/* This structure represents a particular property of a font. */
/* There are a set of defaults and each font has their own. */
typedef struct bdf_property_t_
{
char* name; /* Name of the property. */
int format; /* Format of the property. */
int builtin; /* A builtin property. */
union
{
char* atom;
long l;
unsigned long ul;
} value; /* Value of the property. */
} bdf_property_t;
/*************************************************************************/
/* */
/* BDF font metric and glyph types. */
/* */
/*************************************************************************/
typedef struct bdf_bbx_t_
{
unsigned short width;
unsigned short height;
short x_offset;
short y_offset;
short ascent;
short descent;
} bdf_bbx_t;
typedef struct bdf_glyph_t_
{
char* name; /* Glyph name. */
long encoding; /* Glyph encoding. */
unsigned short swidth; /* Scalable width. */
unsigned short dwidth; /* Device width. */
bdf_bbx_t bbx; /* Glyph bounding box. */
unsigned char* bitmap; /* Glyph bitmap. */
unsigned long bpr; /* Number of bytes used per row. */
unsigned short bytes; /* Number of bytes used for the bitmap. */
} bdf_glyph_t;
typedef struct bdf_glyphlist_t_
{
unsigned short pad; /* Pad to 4-byte boundary. */
unsigned short bpp; /* Bits per pixel. */
long start; /* Beginning encoding value of glyphs. */
long end; /* Ending encoding value of glyphs. */
bdf_glyph_t* glyphs; /* Glyphs themselves. */
unsigned long glyphs_size; /* Glyph structures allocated. */
unsigned long glyphs_used; /* Glyph structures used. */
bdf_bbx_t bbx; /* Overall bounding box of glyphs. */
} bdf_glyphlist_t;
typedef struct bdf_font_t_
{
char* name; /* Name of the font. */
bdf_bbx_t bbx; /* Font bounding box. */
unsigned long point_size; /* Point size of the font. */
unsigned long resolution_x; /* Font horizontal resolution. */
unsigned long resolution_y; /* Font vertical resolution. */
int spacing; /* Font spacing value. */
unsigned short monowidth; /* Logical width for monowidth font. */
long default_char; /* Encoding of the default glyph. */
long font_ascent; /* Font ascent. */
long font_descent; /* Font descent. */
unsigned long glyphs_size; /* Glyph structures allocated. */
unsigned long glyphs_used; /* Glyph structures used. */
bdf_glyph_t* glyphs; /* Glyphs themselves. */
unsigned long unencoded_size; /* Unencoded glyph struct. allocated. */
unsigned long unencoded_used; /* Unencoded glyph struct. used. */
bdf_glyph_t* unencoded; /* Unencoded glyphs themselves. */
unsigned long props_size; /* Font properties allocated. */
unsigned long props_used; /* Font properties used. */
bdf_property_t* props; /* Font properties themselves. */
char* comments; /* Font comments. */
unsigned long comments_len; /* Length of comment string. */
bdf_glyphlist_t overflow; /* Storage used for glyph insertion. */
void* internal; /* Internal data for the font. */
/* The size of the next two arrays must be in sync with the */
/* size of the `have' array in the `bdf_parse_t' structure. */
unsigned long nmod[34816]; /* Bitmap indicating modified glyphs. */
unsigned long umod[34816]; /* Bitmap indicating modified */
/* unencoded glyphs. */
unsigned short modified; /* Boolean indicating font modified. */
unsigned short bpp; /* Bits per pixel. */
FT_Memory memory;
bdf_property_t* user_props;
unsigned long nuser_props;
FT_HashRec proptbl;
} bdf_font_t;
/*************************************************************************/
/* */
/* Types for load/save callbacks. */
/* */
/*************************************************************************/
/* Error codes. */
#define BDF_MISSING_START -1
#define BDF_MISSING_FONTNAME -2
#define BDF_MISSING_SIZE -3
#define BDF_MISSING_CHARS -4
#define BDF_MISSING_STARTCHAR -5
#define BDF_MISSING_ENCODING -6
#define BDF_MISSING_BBX -7
#define BDF_OUT_OF_MEMORY -20
#define BDF_INVALID_LINE -100
/*************************************************************************/
/* */
/* BDF font API. */
/* */
/*************************************************************************/
FT_LOCAL( FT_Error )
bdf_load_font( FT_Stream stream,
FT_Memory memory,
bdf_options_t* opts,
bdf_font_t* *font );
FT_LOCAL( void )
bdf_free_font( bdf_font_t* font );
FT_LOCAL( bdf_property_t * )
bdf_get_property( char* name,
bdf_font_t* font );
FT_LOCAL( bdf_property_t * )
bdf_get_font_property( bdf_font_t* font,
const char* name );
FT_END_HEADER
#endif /* BDF_H_ */
/* END */

File diff suppressed because it is too large Load Diff

View File

@@ -1,80 +1,80 @@
/* bdfdrivr.h
FreeType font driver for bdf fonts
Copyright (C) 2001, 2002, 2003, 2004 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef BDFDRIVR_H_
#define BDFDRIVR_H_
#include <ft2build.h>
#include FT_INTERNAL_DRIVER_H
#include "bdf.h"
FT_BEGIN_HEADER
#ifdef FT_CONFIG_OPTION_PIC
#error "this module does not support PIC yet"
#endif
typedef struct BDF_encoding_el_
{
FT_Long enc;
FT_UShort glyph;
} BDF_encoding_el;
typedef struct BDF_FaceRec_
{
FT_FaceRec root;
char* charset_encoding;
char* charset_registry;
bdf_font_t* bdffont;
BDF_encoding_el* en_table;
FT_CharMap charmap_handle;
FT_CharMapRec charmap; /* a single charmap per face */
FT_UInt default_glyph;
} BDF_FaceRec, *BDF_Face;
FT_EXPORT_VAR( const FT_Driver_ClassRec ) bdf_driver_class;
FT_END_HEADER
#endif /* BDFDRIVR_H_ */
/* END */
/* bdfdrivr.h
FreeType font driver for bdf fonts
Copyright (C) 2001, 2002, 2003, 2004 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef BDFDRIVR_H_
#define BDFDRIVR_H_
#include <ft2build.h>
#include FT_INTERNAL_DRIVER_H
#include "bdf.h"
FT_BEGIN_HEADER
#ifdef FT_CONFIG_OPTION_PIC
#error "this module does not support PIC yet"
#endif
typedef struct BDF_encoding_el_
{
FT_Long enc;
FT_UShort glyph;
} BDF_encoding_el;
typedef struct BDF_FaceRec_
{
FT_FaceRec root;
char* charset_encoding;
char* charset_registry;
bdf_font_t* bdffont;
BDF_encoding_el* en_table;
FT_CharMap charmap_handle;
FT_CharMapRec charmap; /* a single charmap per face */
FT_UInt default_glyph;
} BDF_FaceRec, *BDF_Face;
FT_EXPORT_VAR( const FT_Driver_ClassRec ) bdf_driver_class;
FT_END_HEADER
#endif /* BDFDRIVR_H_ */
/* END */

View File

@@ -1,45 +1,45 @@
/*
* Copyright 2001, 2002, 2012 Francesco Zappa Nardelli
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*************************************************************************/
/* */
/* This file is used to define the BDF error enumeration constants. */
/* */
/*************************************************************************/
#ifndef BDFERROR_H_
#define BDFERROR_H_
#include FT_MODULE_ERRORS_H
#undef FTERRORS_H_
#undef FT_ERR_PREFIX
#define FT_ERR_PREFIX BDF_Err_
#define FT_ERR_BASE FT_Mod_Err_BDF
#include FT_ERRORS_H
#endif /* BDFERROR_H_ */
/* END */
/*
* Copyright 2001, 2002, 2012 Francesco Zappa Nardelli
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*************************************************************************/
/* */
/* This file is used to define the BDF error enumeration constants. */
/* */
/*************************************************************************/
#ifndef BDFERROR_H_
#define BDFERROR_H_
#include FT_MODULE_ERRORS_H
#undef FTERRORS_H_
#undef FT_ERR_PREFIX
#define FT_ERR_PREFIX BDF_Err_
#define FT_ERR_BASE FT_Mod_Err_BDF
#include FT_ERRORS_H
#endif /* BDFERROR_H_ */
/* END */

File diff suppressed because it is too large Load Diff