forked from minhngoc25a/freetype2
* src/type42/t42drivr.c: s/T42_ENCODING_TYPE_/T1_ENCODING_TYPE_/.
(parse_font_matrix): Remove unnecessary code. (parse_sfnts): Initialize some variables. (t42_driver_class) [TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Use ft_module_driver_has_hinter conditionally. Moved some type 42 specific structure definitions to... * include/freetype/internal/t42types.h: New file. * include/freetype/internal/internal.h (FT_INTERNAL_T42_TYPES_H): New macro. * include/freetype/cache/ftcsbits.h (FTC_SBit): Added a new field `num_grays' for specifying the number of used gray levels. * src/cache/ftcsbits.c (ftc_sbit_node_load): Initialize it. Adding a driver for BDF fonts written by Francesco Zappa Nardelli <Francesco.Zappa.Nardelli@ens.fr>. Heavily modified by me to better adapt it to FreeType, removing unneeded stuff. Additionally, it now supports Mark Leisher's BDF extension for anti-aliased bitmap glyphs with 2 and 4 bpp. * src/bdf/*: New driver. * include/freetype/internal/bdftypes.h: New file. * include/freetype/internal/fttrace.h: Added BDF driver components. * include/freetype/fterrdef.h: Added error codes for BDF driver. * include/freetype/config/ftmodule.h, src/Jamfile: Updated. * include/freetype/internal/internal.h (FT_INTERNAL_BDF_TYPES_H): New macro. * include/freetype/config/ftstdlib.h (ft_sprintf): New alias for sprintf. * include/freetype/internal/fttrace.h: Added Type 42 driver component. * src/type42/t42drivr.c: Use it. * include/freetype/internal/internal.h (FT_INTERNAL_PCF_TYPES_H): New macro.
This commit is contained in:
parent
6795f1e2b3
commit
a4540bb98a
46
ChangeLog
46
ChangeLog
|
@ -1,3 +1,49 @@
|
|||
2002-05-21 Roberto Alameda <ojancano@geekmail.de>.
|
||||
|
||||
* src/type42/t42drivr.c: s/T42_ENCODING_TYPE_/T1_ENCODING_TYPE_/.
|
||||
(parse_font_matrix): Remove unnecessary code.
|
||||
(parse_sfnts): Initialize some variables.
|
||||
(t42_driver_class) [TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Use
|
||||
ft_module_driver_has_hinter conditionally.
|
||||
Moved some type 42 specific structure definitions to...
|
||||
* include/freetype/internal/t42types.h: New file.
|
||||
* include/freetype/internal/internal.h (FT_INTERNAL_T42_TYPES_H):
|
||||
New macro.
|
||||
|
||||
2002-05-20 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* include/freetype/cache/ftcsbits.h (FTC_SBit): Added a new field
|
||||
`num_grays' for specifying the number of used gray levels.
|
||||
* src/cache/ftcsbits.c (ftc_sbit_node_load): Initialize it.
|
||||
|
||||
2002-05-19 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
Adding a driver for BDF fonts written by Francesco Zappa Nardelli
|
||||
<Francesco.Zappa.Nardelli@ens.fr>. Heavily modified by me to
|
||||
better adapt it to FreeType, removing unneeded stuff. Additionally,
|
||||
it now supports Mark Leisher's BDF extension for anti-aliased
|
||||
bitmap glyphs with 2 and 4 bpp.
|
||||
|
||||
* src/bdf/*: New driver.
|
||||
* include/freetype/internal/bdftypes.h: New file.
|
||||
* include/freetype/internal/fttrace.h: Added BDF driver components.
|
||||
* include/freetype/fterrdef.h: Added error codes for BDF driver.
|
||||
* include/freetype/config/ftmodule.h, src/Jamfile: Updated.
|
||||
* include/freetype/internal/internal.h (FT_INTERNAL_BDF_TYPES_H):
|
||||
New macro.
|
||||
|
||||
* include/freetype/config/ftstdlib.h (ft_sprintf): New alias for
|
||||
sprintf.
|
||||
|
||||
2002-05-18 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* include/freetype/internal/fttrace.h: Added Type 42 driver
|
||||
component.
|
||||
* src/type42/t42drivr.c: Use it.
|
||||
|
||||
* include/freetype/internal/internal.h (FT_INTERNAL_PCF_TYPES_H):
|
||||
New macro.
|
||||
|
||||
2002-05-17 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* src/type42/Jamfile: New file.
|
||||
|
|
|
@ -57,27 +57,29 @@ FT_BEGIN_HEADER
|
|||
/* A very compact structure used to describe a small glyph bitmap. */
|
||||
/* */
|
||||
/* <Fields> */
|
||||
/* width :: The bitmap width in pixels. */
|
||||
/* width :: The bitmap width in pixels. */
|
||||
/* */
|
||||
/* height :: The bitmap height in pixels. */
|
||||
/* height :: The bitmap height in pixels. */
|
||||
/* */
|
||||
/* left :: The horizontal distance from the pen position to the */
|
||||
/* left bitmap border (a.k.a. `left side bearing', or */
|
||||
/* `lsb'). */
|
||||
/* left :: The horizontal distance from the pen position to the */
|
||||
/* left bitmap border (a.k.a. `left side bearing', or */
|
||||
/* `lsb'). */
|
||||
/* */
|
||||
/* top :: The vertical distance from the pen position (on the */
|
||||
/* baseline) to the upper bitmap border (a.k.a. `top side */
|
||||
/* bearing'). The distance is positive for upwards */
|
||||
/* Y coordinates. */
|
||||
/* top :: The vertical distance from the pen position (on the */
|
||||
/* baseline) to the upper bitmap border (a.k.a. `top */
|
||||
/* side bearing'). The distance is positive for upwards */
|
||||
/* Y coordinates. */
|
||||
/* */
|
||||
/* format :: The format of the glyph bitmap (monochrome or gray). */
|
||||
/* format :: The format of the glyph bitmap (monochrome or gray). */
|
||||
/* */
|
||||
/* pitch :: The number of bytes per bitmap line. May be positive */
|
||||
/* or negative. */
|
||||
/* num_grays :: The number of gray levels. */
|
||||
/* */
|
||||
/* xadvance :: The horizontal advance width in pixels. */
|
||||
/* pitch :: The number of bytes per bitmap line. May be positive */
|
||||
/* or negative. */
|
||||
/* */
|
||||
/* yadvance :: The vertical advance height in pixels. */
|
||||
/* xadvance :: The horizontal advance width in pixels. */
|
||||
/* */
|
||||
/* yadvance :: The vertical advance height in pixels. */
|
||||
/* */
|
||||
/* buffer :: A pointer to the bitmap pixels. */
|
||||
/* */
|
||||
|
@ -89,6 +91,7 @@ FT_BEGIN_HEADER
|
|||
FT_Char top;
|
||||
|
||||
FT_Byte format;
|
||||
FT_Short num_grays; /* XXX: Should be FT_Byte. See ftcsbits.c */
|
||||
FT_Char pitch;
|
||||
FT_Char xadvance;
|
||||
FT_Char yadvance;
|
||||
|
|
|
@ -2,6 +2,7 @@ FT_USE_MODULE(autohint_module_class)
|
|||
FT_USE_MODULE(cff_driver_class)
|
||||
FT_USE_MODULE(t1cid_driver_class)
|
||||
FT_USE_MODULE(pcf_driver_class)
|
||||
FT_USE_MODULE(bdf_driver_class)
|
||||
FT_USE_MODULE(psaux_module_class)
|
||||
FT_USE_MODULE(psnames_module_class)
|
||||
FT_USE_MODULE(pshinter_module_class)
|
||||
|
@ -13,4 +14,3 @@ FT_USE_MODULE(t1_driver_class)
|
|||
FT_USE_MODULE(t42_driver_class)
|
||||
FT_USE_MODULE(pfr_driver_class)
|
||||
FT_USE_MODULE(winfnt_driver_class)
|
||||
|
||||
|
|
|
@ -91,6 +91,10 @@
|
|||
#define ft_memmove memmove
|
||||
#define ft_memcmp memcmp
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define ft_sprintf sprintf
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/* */
|
||||
|
|
|
@ -35,19 +35,19 @@
|
|||
"no error" )
|
||||
|
||||
FT_ERRORDEF_( Cannot_Open_Resource, 0x01, \
|
||||
"cannot open resource" )
|
||||
"cannot open resource" )
|
||||
FT_ERRORDEF_( Unknown_File_Format, 0x02, \
|
||||
"unknown file format" )
|
||||
"unknown file format" )
|
||||
FT_ERRORDEF_( Invalid_File_Format, 0x03, \
|
||||
"broken file" )
|
||||
"broken file" )
|
||||
FT_ERRORDEF_( Invalid_Version, 0x04, \
|
||||
"invalid FreeType version" )
|
||||
"invalid FreeType version" )
|
||||
FT_ERRORDEF_( Lower_Module_Version, 0x05, \
|
||||
"module version is too low" )
|
||||
"module version is too low" )
|
||||
FT_ERRORDEF_( Invalid_Argument, 0x06, \
|
||||
"invalid argument" )
|
||||
"invalid argument" )
|
||||
FT_ERRORDEF_( Unimplemented_Feature, 0x07, \
|
||||
"unimplemented feature" )
|
||||
"unimplemented feature" )
|
||||
FT_ERRORDEF_( Invalid_Table, 0x08, \
|
||||
"broken table" )
|
||||
FT_ERRORDEF_( Invalid_Offset, 0x09, \
|
||||
|
@ -56,158 +56,174 @@
|
|||
/* glyph/character errors */
|
||||
|
||||
FT_ERRORDEF_( Invalid_Glyph_Index, 0x10, \
|
||||
"invalid glyph index" )
|
||||
"invalid glyph index" )
|
||||
FT_ERRORDEF_( Invalid_Character_Code, 0x11, \
|
||||
"invalid character code" )
|
||||
"invalid character code" )
|
||||
FT_ERRORDEF_( Invalid_Glyph_Format, 0x12, \
|
||||
"unsupported glyph image format" )
|
||||
"unsupported glyph image format" )
|
||||
FT_ERRORDEF_( Cannot_Render_Glyph, 0x13, \
|
||||
"cannot render this glyph format" )
|
||||
"cannot render this glyph format" )
|
||||
FT_ERRORDEF_( Invalid_Outline, 0x14, \
|
||||
"invalid outline" )
|
||||
"invalid outline" )
|
||||
FT_ERRORDEF_( Invalid_Composite, 0x15, \
|
||||
"invalid composite glyph" )
|
||||
"invalid composite glyph" )
|
||||
FT_ERRORDEF_( Too_Many_Hints, 0x16, \
|
||||
"too many hints" )
|
||||
"too many hints" )
|
||||
FT_ERRORDEF_( Invalid_Pixel_Size, 0x17, \
|
||||
"invalid pixel size" )
|
||||
"invalid pixel size" )
|
||||
|
||||
/* handle errors */
|
||||
|
||||
FT_ERRORDEF_( Invalid_Handle, 0x20, \
|
||||
"invalid object handle" )
|
||||
"invalid object handle" )
|
||||
FT_ERRORDEF_( Invalid_Library_Handle, 0x21, \
|
||||
"invalid library handle" )
|
||||
"invalid library handle" )
|
||||
FT_ERRORDEF_( Invalid_Driver_Handle, 0x22, \
|
||||
"invalid module handle" )
|
||||
"invalid module handle" )
|
||||
FT_ERRORDEF_( Invalid_Face_Handle, 0x23, \
|
||||
"invalid face handle" )
|
||||
"invalid face handle" )
|
||||
FT_ERRORDEF_( Invalid_Size_Handle, 0x24, \
|
||||
"invalid size handle" )
|
||||
"invalid size handle" )
|
||||
FT_ERRORDEF_( Invalid_Slot_Handle, 0x25, \
|
||||
"invalid glyph slot handle" )
|
||||
"invalid glyph slot handle" )
|
||||
FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26, \
|
||||
"invalid charmap handle" )
|
||||
"invalid charmap handle" )
|
||||
FT_ERRORDEF_( Invalid_Cache_Handle, 0x27, \
|
||||
"invalid cache manager handle" )
|
||||
"invalid cache manager handle" )
|
||||
FT_ERRORDEF_( Invalid_Stream_Handle, 0x28, \
|
||||
"invalid stream handle" )
|
||||
"invalid stream handle" )
|
||||
|
||||
/* driver errors */
|
||||
|
||||
FT_ERRORDEF_( Too_Many_Drivers, 0x30, \
|
||||
"too many modules" )
|
||||
"too many modules" )
|
||||
FT_ERRORDEF_( Too_Many_Extensions, 0x31, \
|
||||
"too many extensions" )
|
||||
"too many extensions" )
|
||||
|
||||
/* memory errors */
|
||||
|
||||
FT_ERRORDEF_( Out_Of_Memory, 0x40, \
|
||||
"out of memory" )
|
||||
"out of memory" )
|
||||
FT_ERRORDEF_( Unlisted_Object, 0x41, \
|
||||
"unlisted object" )
|
||||
"unlisted object" )
|
||||
|
||||
/* stream errors */
|
||||
|
||||
FT_ERRORDEF_( Cannot_Open_Stream, 0x51, \
|
||||
"cannot open stream" )
|
||||
"cannot open stream" )
|
||||
FT_ERRORDEF_( Invalid_Stream_Seek, 0x52, \
|
||||
"invalid stream seek" )
|
||||
"invalid stream seek" )
|
||||
FT_ERRORDEF_( Invalid_Stream_Skip, 0x53, \
|
||||
"invalid stream skip" )
|
||||
"invalid stream skip" )
|
||||
FT_ERRORDEF_( Invalid_Stream_Read, 0x54, \
|
||||
"invalid stream read" )
|
||||
"invalid stream read" )
|
||||
FT_ERRORDEF_( Invalid_Stream_Operation, 0x55, \
|
||||
"invalid stream operation" )
|
||||
"invalid stream operation" )
|
||||
FT_ERRORDEF_( Invalid_Frame_Operation, 0x56, \
|
||||
"invalid frame operation" )
|
||||
"invalid frame operation" )
|
||||
FT_ERRORDEF_( Nested_Frame_Access, 0x57, \
|
||||
"nested frame access" )
|
||||
"nested frame access" )
|
||||
FT_ERRORDEF_( Invalid_Frame_Read, 0x58, \
|
||||
"invalid frame read" )
|
||||
"invalid frame read" )
|
||||
|
||||
/* raster errors */
|
||||
|
||||
FT_ERRORDEF_( Raster_Uninitialized, 0x60, \
|
||||
"raster uninitialized" )
|
||||
"raster uninitialized" )
|
||||
FT_ERRORDEF_( Raster_Corrupted, 0x61, \
|
||||
"raster corrupted" )
|
||||
"raster corrupted" )
|
||||
FT_ERRORDEF_( Raster_Overflow, 0x62, \
|
||||
"raster overflow" )
|
||||
"raster overflow" )
|
||||
FT_ERRORDEF_( Raster_Negative_Height, 0x63, \
|
||||
"negative height while rastering" )
|
||||
"negative height while rastering" )
|
||||
|
||||
/* cache errors */
|
||||
|
||||
FT_ERRORDEF_( Too_Many_Caches, 0x70, \
|
||||
"too many registered caches" )
|
||||
"too many registered caches" )
|
||||
|
||||
/* TrueType and SFNT errors */
|
||||
|
||||
FT_ERRORDEF_( Invalid_Opcode, 0x80, \
|
||||
"invalid opcode" )
|
||||
"invalid opcode" )
|
||||
FT_ERRORDEF_( Too_Few_Arguments, 0x81, \
|
||||
"too few arguments" )
|
||||
"too few arguments" )
|
||||
FT_ERRORDEF_( Stack_Overflow, 0x82, \
|
||||
"stack overflow" )
|
||||
"stack overflow" )
|
||||
FT_ERRORDEF_( Code_Overflow, 0x83, \
|
||||
"code overflow" )
|
||||
"code overflow" )
|
||||
FT_ERRORDEF_( Bad_Argument, 0x84, \
|
||||
"bad argument" )
|
||||
"bad argument" )
|
||||
FT_ERRORDEF_( Divide_By_Zero, 0x85, \
|
||||
"division by zero" )
|
||||
"division by zero" )
|
||||
FT_ERRORDEF_( Invalid_Reference, 0x86, \
|
||||
"invalid reference" )
|
||||
"invalid reference" )
|
||||
FT_ERRORDEF_( Debug_OpCode, 0x87, \
|
||||
"found debug opcode" )
|
||||
"found debug opcode" )
|
||||
FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88, \
|
||||
"found ENDF opcode in execution stream" )
|
||||
"found ENDF opcode in execution stream" )
|
||||
FT_ERRORDEF_( Nested_DEFS, 0x89, \
|
||||
"nested DEFS" )
|
||||
"nested DEFS" )
|
||||
FT_ERRORDEF_( Invalid_CodeRange, 0x8A, \
|
||||
"invalid code range" )
|
||||
"invalid code range" )
|
||||
FT_ERRORDEF_( Execution_Too_Long, 0x8B, \
|
||||
"execution context too long" )
|
||||
"execution context too long" )
|
||||
FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C, \
|
||||
"too many function definitions" )
|
||||
"too many function definitions" )
|
||||
FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D, \
|
||||
"too many instruction definitions" )
|
||||
"too many instruction definitions" )
|
||||
FT_ERRORDEF_( Table_Missing, 0x8E, \
|
||||
"SFNT font table missing" )
|
||||
"SFNT font table missing" )
|
||||
FT_ERRORDEF_( Horiz_Header_Missing, 0x8F, \
|
||||
"horizontal header (hhea) table missing" )
|
||||
"horizontal header (hhea) table missing" )
|
||||
FT_ERRORDEF_( Locations_Missing, 0x90, \
|
||||
"locations (loca) table missing" )
|
||||
"locations (loca) table missing" )
|
||||
FT_ERRORDEF_( Name_Table_Missing, 0x91, \
|
||||
"name table missing" )
|
||||
"name table missing" )
|
||||
FT_ERRORDEF_( CMap_Table_Missing, 0x92, \
|
||||
"character map (cmap) table missing" )
|
||||
"character map (cmap) table missing" )
|
||||
FT_ERRORDEF_( Hmtx_Table_Missing, 0x93, \
|
||||
"horizontal metrics (hmtx) table missing" )
|
||||
"horizontal metrics (hmtx) table missing" )
|
||||
FT_ERRORDEF_( Post_Table_Missing, 0x94, \
|
||||
"PostScript (post) table missing" )
|
||||
"PostScript (post) table missing" )
|
||||
FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95, \
|
||||
"invalid horizontal metrics" )
|
||||
"invalid horizontal metrics" )
|
||||
FT_ERRORDEF_( Invalid_CharMap_Format, 0x96, \
|
||||
"invalid character map (cmap) format" )
|
||||
"invalid character map (cmap) format" )
|
||||
FT_ERRORDEF_( Invalid_PPem, 0x97, \
|
||||
"invalid ppem value" )
|
||||
"invalid ppem value" )
|
||||
FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98, \
|
||||
"invalid vertical metrics" )
|
||||
"invalid vertical metrics" )
|
||||
FT_ERRORDEF_( Could_Not_Find_Context, 0x99, \
|
||||
"could not find context" )
|
||||
"could not find context" )
|
||||
FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A, \
|
||||
"invalid PostScript (post) table format" )
|
||||
"invalid PostScript (post) table format" )
|
||||
FT_ERRORDEF_( Invalid_Post_Table, 0x9B, \
|
||||
"invalid PostScript (post) table" )
|
||||
"invalid PostScript (post) table" )
|
||||
|
||||
/* CFF, CID, and Type 1 errors */
|
||||
|
||||
FT_ERRORDEF_( Syntax_Error, 0xA0, \
|
||||
"opcode syntax error" )
|
||||
"opcode syntax error" )
|
||||
FT_ERRORDEF_( Stack_Underflow, 0xA1, \
|
||||
"argument stack underflow" )
|
||||
"argument stack underflow" )
|
||||
|
||||
/* BDF errors */
|
||||
|
||||
FT_ERRORDEF_( Missing_Startfont_Field, 0xB0, \
|
||||
"`STARTFONT' field missing" )
|
||||
FT_ERRORDEF_( Missing_Font_Field, 0xB1, \
|
||||
"`FONT' field missing" )
|
||||
FT_ERRORDEF_( Missing_Size_Field, 0xB2, \
|
||||
"`SIZE' field missing" )
|
||||
FT_ERRORDEF_( Missing_Chars_Field, 0xB3, \
|
||||
"`CHARS' field missing" )
|
||||
FT_ERRORDEF_( Missing_Startchar_Field, 0xB4, \
|
||||
"`STARTCHAR' field missing" )
|
||||
FT_ERRORDEF_( Missing_Encoding_Field, 0xB5, \
|
||||
"`ENCODING' field missing" )
|
||||
FT_ERRORDEF_( Missing_Bbx_Field, 0xB6, \
|
||||
"`BBX' field missing" )
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/* bdftypes.h
|
||||
|
||||
FreeType font driver for bdf fonts
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef __BDFTYPES_H__
|
||||
#define __BDFTYPES_H__
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
typedef struct BDF_Public_FaceRec_
|
||||
{
|
||||
FT_FaceRec root;
|
||||
|
||||
char* charset_encoding;
|
||||
char* charset_registry;
|
||||
|
||||
} BDF_Public_FaceRec, *BDF_Public_Face;
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
||||
#endif /* __BDFTYPES_H__ */
|
||||
|
||||
|
||||
/* END */
|
|
@ -77,6 +77,9 @@ FT_TRACE_DEF( cffload )
|
|||
FT_TRACE_DEF( cffobjs )
|
||||
FT_TRACE_DEF( cffparse )
|
||||
|
||||
/* Type 42 driver component */
|
||||
FT_TRACE_DEF( t42 )
|
||||
|
||||
/* CID driver components */
|
||||
FT_TRACE_DEF( cidafm )
|
||||
FT_TRACE_DEF( ciddriver )
|
||||
|
@ -88,14 +91,16 @@ FT_TRACE_DEF( cidparse )
|
|||
/* Windows fonts component */
|
||||
FT_TRACE_DEF( winfnt )
|
||||
|
||||
/* PCF fonts component */
|
||||
/* PCF fonts components */
|
||||
FT_TRACE_DEF( pcfdriver )
|
||||
FT_TRACE_DEF( pcfread )
|
||||
|
||||
/* BDF fonts component */
|
||||
FT_TRACE_DEF( bdf )
|
||||
FT_TRACE_DEF( bdfdriver )
|
||||
FT_TRACE_DEF( bdflib )
|
||||
|
||||
/* PFR fonts component */
|
||||
FT_TRACE_DEF( pfr )
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
|
@ -38,8 +38,11 @@
|
|||
|
||||
#define FT_INTERNAL_TRUETYPE_TYPES_H <freetype/internal/tttypes.h>
|
||||
#define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h>
|
||||
#define FT_INTERNAL_TYPE42_TYPES_H <freetype/internal/t42types.h>
|
||||
#define FT_INTERNAL_CFF_TYPES_H <freetype/internal/cfftypes.h>
|
||||
#define FT_INTERNAL_FNT_TYPES_H <freetype/internal/fnttypes.h>
|
||||
#define FT_INTERNAL_BDF_TYPES_H <freetype/internal/bdftypes.h>
|
||||
#define FT_INTERNAL_PCF_TYPES_H <freetype/internal/pcftypes.h>
|
||||
|
||||
#define FT_INTERNAL_POSTSCRIPT_NAMES_H <freetype/internal/psnames.h>
|
||||
#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#define __T1TYPES_H__
|
||||
|
||||
|
||||
#include<ft2build.h>
|
||||
#include <ft2build.h>
|
||||
#include FT_TYPE1_TABLES_H
|
||||
#include FT_INTERNAL_POSTSCRIPT_NAMES_H
|
||||
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* t42types.h */
|
||||
/* */
|
||||
/* Type 42 font data types (specification only). */
|
||||
/* */
|
||||
/* Copyright 2002 by Roberto Alameda. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef __T42TYPES_H__
|
||||
#define __T42TYPES_H__
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_TYPE1_TABLES_H
|
||||
#include FT_INTERNAL_TYPE1_TYPES_H
|
||||
#include FT_INTERNAL_POSTSCRIPT_NAMES_H
|
||||
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
typedef struct T42_FontRec_
|
||||
{
|
||||
/* font info dictionary */
|
||||
PS_FontInfoRec font_info;
|
||||
|
||||
/* top-level dictionary */
|
||||
FT_String* font_name;
|
||||
|
||||
T1_EncodingType encoding_type;
|
||||
T1_EncodingRec encoding;
|
||||
|
||||
FT_Byte* charstrings_block;
|
||||
FT_Byte* glyph_names_block;
|
||||
|
||||
FT_Int num_glyphs;
|
||||
FT_String** glyph_names; /* array of glyph names */
|
||||
FT_Byte** charstrings; /* array of glyph charstrings */
|
||||
FT_Int* charstrings_len;
|
||||
|
||||
FT_Byte paint_type;
|
||||
FT_Byte font_type;
|
||||
FT_Matrix font_matrix; /* From FontMatrix field: a, b, c, d */
|
||||
FT_Vector font_offset; /* From FontMatrix field: tx, ty */
|
||||
FT_BBox font_bbox;
|
||||
|
||||
FT_Int stroke_width;
|
||||
|
||||
} T42_FontRec, *T42_Font;
|
||||
|
||||
|
||||
typedef struct T42_FaceRec_
|
||||
{
|
||||
FT_FaceRec root;
|
||||
T42_FontRec type42;
|
||||
const void* psnames;
|
||||
const void* psaux;
|
||||
const void* afm_data;
|
||||
FT_Byte* ttf_data;
|
||||
FT_ULong ttf_size;
|
||||
FT_Face ttf_face;
|
||||
FT_CharMapRec charmaprecs[2];
|
||||
FT_CharMap charmaps[2];
|
||||
PS_Unicodes unicode_map;
|
||||
|
||||
} T42_FaceRec, *T42_Face;
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* __T1TYPES_H__ */
|
||||
|
||||
|
||||
/* END */
|
|
@ -14,7 +14,6 @@ SubDirHdrs [ FT2_SubDir src ] ;
|
|||
#
|
||||
HDRMACRO [ FT2_SubDir include internal internal.h ] ;
|
||||
|
||||
SubInclude FT2_TOP src pshinter ;
|
||||
SubInclude FT2_TOP src autohint ;
|
||||
SubInclude FT2_TOP src base ;
|
||||
SubInclude FT2_TOP src bdf ;
|
||||
|
@ -24,6 +23,7 @@ SubInclude FT2_TOP src cid ;
|
|||
SubInclude FT2_TOP src pcf ;
|
||||
SubInclude FT2_TOP src pfr ;
|
||||
SubInclude FT2_TOP src psaux ;
|
||||
SubInclude FT2_TOP src pshinter ;
|
||||
SubInclude FT2_TOP src psnames ;
|
||||
SubInclude FT2_TOP src raster ;
|
||||
SubInclude FT2_TOP src sfnt ;
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
# FreeType 2 src/bdf Jamfile (c) 2002 David Turner
|
||||
#
|
||||
|
||||
SubDir FT2_TOP src bdf ;
|
||||
|
||||
SubDirHdrs [ FT2_SubDir src bdf ] ;
|
||||
|
||||
{
|
||||
local _sources ;
|
||||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = bdfdrivr bdflib ;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sources = bdf ;
|
||||
}
|
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/bdf Jamfile
|
|
@ -0,0 +1,146 @@
|
|||
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/asn/developer/PDFS/TN/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. 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), and 4 (16
|
||||
gray levels). The driver returns either a bitmap with 1 bit per pixel or a
|
||||
pixmap with 8bits per pixel (using 4 and 16 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 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.
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
FreeType font driver for bdf files
|
||||
|
||||
Copyright (C) 2001 by
|
||||
Copyright (C) 2001, 2002 by
|
||||
Francesco Zappa Nardelli
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
@ -28,6 +28,7 @@ THE SOFTWARE.
|
|||
|
||||
#include <ft2build.h>
|
||||
#include "bdflib.c"
|
||||
#include "bdfdriver.c"
|
||||
#include "bdfdrivr.c"
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
550
src/bdf/bdf.h
550
src/bdf/bdf.h
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright 2000 Computing Research Labs, New Mexico State University
|
||||
* Copyright 2001 Francesco Zappa Nardelli
|
||||
* Copyright 2001, 2002 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"),
|
||||
|
@ -20,14 +20,15 @@
|
|||
* 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__
|
||||
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
/*
|
||||
* Based on bdf.h,v 1.16 2000/03/16 20:08:51 mleisher
|
||||
*/
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
|
@ -35,333 +36,260 @@
|
|||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/* Imported from bdfP.h */
|
||||
|
||||
#ifndef MYABS
|
||||
#define MYABS(xx) ((xx) < 0 ? -(xx) : (xx))
|
||||
#endif
|
||||
|
||||
#define _bdf_glyph_modified(map, e) ((map)[(e) >> 5] & (1 << ((e) & 31)))
|
||||
#define _bdf_set_glyph_modified(map, e) (map)[(e) >> 5] |= (1 << ((e) & 31))
|
||||
#define _bdf_clear_glyph_modified(map, e) (map)[(e) >> 5] &= ~(1 << ((e) & 31))
|
||||
#define _bdf_glyph_modified( map, e ) \
|
||||
( (map)[(e) >> 5] & ( 1 << ( (e) & 31 ) ) )
|
||||
#define _bdf_set_glyph_modified( map, e ) \
|
||||
( (map)[(e) >> 5] |= ( 1 << ( (e) & 31 ) ) )
|
||||
#define _bdf_clear_glyph_modified( map, e ) \
|
||||
( (map)[(e) >> 5] &= ~( 1 << ( (e) & 31 ) ) )
|
||||
|
||||
/* end of bdfP.h */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* BDF font options macros and types.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#define BDF_UNIX_EOL 1 /* Save fonts with Unix LF. */
|
||||
#define BDF_DOS_EOL 2 /* Save fonts with DOS CRLF. */
|
||||
#define BDF_MAC_EOL 3 /* Save fonts with Mac CR. */
|
||||
|
||||
#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 {
|
||||
int ttf_hint;
|
||||
int correct_metrics;
|
||||
int keep_unencoded;
|
||||
int keep_comments;
|
||||
int pad_cells;
|
||||
int font_spacing;
|
||||
long point_size;
|
||||
unsigned long resolution_x;
|
||||
unsigned long resolution_y;
|
||||
int bits_per_pixel;
|
||||
int eol;
|
||||
} 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 {
|
||||
char *name; /* Name of the property. */
|
||||
int format; /* Format of the property. */
|
||||
int builtin; /* A builtin property. */
|
||||
union {
|
||||
char *atom;
|
||||
long int32;
|
||||
unsigned long card32;
|
||||
} value; /* Value of the property. */
|
||||
} bdf_property_t;
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* BDF font metric and glyph types.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* A general bitmap type, mostly used when the glyph bitmap is being edited.
|
||||
*/
|
||||
typedef struct {
|
||||
short x;
|
||||
short y;
|
||||
unsigned short width;
|
||||
unsigned short height;
|
||||
unsigned short bpp;
|
||||
unsigned short pad;
|
||||
unsigned char *bitmap;
|
||||
unsigned long bytes;
|
||||
} bdf_bitmap_t;
|
||||
|
||||
typedef struct {
|
||||
int font_spacing;
|
||||
unsigned short swidth;
|
||||
unsigned short dwidth;
|
||||
unsigned short width;
|
||||
unsigned short height;
|
||||
short x_offset;
|
||||
short y_offset;
|
||||
short ascent;
|
||||
short descent;
|
||||
} bdf_metrics_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned short width;
|
||||
unsigned short height;
|
||||
short x_offset;
|
||||
short y_offset;
|
||||
short ascent;
|
||||
short descent;
|
||||
} bdf_bbx_t;
|
||||
|
||||
typedef struct {
|
||||
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 short bytes; /* Number of bytes used for the bitmap. */
|
||||
} bdf_glyph_t;
|
||||
|
||||
typedef struct {
|
||||
char *key;
|
||||
void *data;
|
||||
} _hashnode, *hashnode;
|
||||
|
||||
typedef struct {
|
||||
int limit;
|
||||
int size;
|
||||
int used;
|
||||
hashnode *table;
|
||||
} hashtable;
|
||||
|
||||
typedef struct {
|
||||
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 {
|
||||
char *name; /* Name of the font. */
|
||||
bdf_bbx_t bbx; /* Font bounding box. */
|
||||
|
||||
long point_size; /* Point size of the font. */
|
||||
unsigned long resolution_x; /* Font horizontal resolution. */
|
||||
unsigned long resolution_y; /* Font vertical resolution. */
|
||||
|
||||
int hbf; /* Font came from an HBF font. */
|
||||
|
||||
int spacing; /* Font spacing value. */
|
||||
|
||||
unsigned short monowidth; /* Logical width for monowidth font. */
|
||||
|
||||
long default_glyph; /* Encoding of the default glyph. */
|
||||
|
||||
long font_ascent; /* Font ascent. */
|
||||
long font_descent; /* Font descent. */
|
||||
|
||||
long glyphs_size; /* Glyph structures allocated. */
|
||||
long glyphs_used; /* Glyph structures used. */
|
||||
bdf_glyph_t *glyphs; /* Glyphs themselves. */
|
||||
|
||||
long unencoded_size; /* Unencoded glyph structures allocated. */
|
||||
long unencoded_used; /* Unencoded glyph structures 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. */
|
||||
|
||||
char *acmsgs; /* Auto-correction messages. */
|
||||
unsigned long acmsgs_len; /* Length of auto-correction messages. */
|
||||
|
||||
bdf_glyphlist_t overflow; /* Storage used for glyph insertion. */
|
||||
|
||||
void *internal; /* Internal data for the font. */
|
||||
|
||||
unsigned long nmod[2048]; /* Bitmap indicating modified glyphs. */
|
||||
unsigned long umod[2048]; /* Bitmap indicating modified unencoded. */
|
||||
|
||||
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;
|
||||
hashtable proptbl;
|
||||
|
||||
} bdf_font_t;
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* BDF font options macros and types. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Types for load/save callbacks.
|
||||
*
|
||||
**************************************************************************/
|
||||
#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. */
|
||||
|
||||
/*
|
||||
* Callback reasons.
|
||||
*/
|
||||
#define BDF_LOAD_START 1
|
||||
#define BDF_LOADING 2
|
||||
#define BDF_SAVE_START 3
|
||||
#define BDF_SAVING 4
|
||||
#define BDF_TRANSLATE_START 5
|
||||
#define BDF_TRANSLATING 6
|
||||
#define BDF_ROTATE_START 7
|
||||
#define BDF_ROTATING 8
|
||||
#define BDF_SHEAR_START 9
|
||||
#define BDF_SHEARING 10
|
||||
#define BDF_GLYPH_NAME_START 11
|
||||
#define BDF_GLYPH_NAME 12
|
||||
#define BDF_EXPORT_START 13
|
||||
#define BDF_EXPORTING 14
|
||||
#define BDF_EMBOLDEN_START 15
|
||||
#define BDF_EMBOLDENING 16
|
||||
#define BDF_WARNING 20
|
||||
#define BDF_ERROR 21
|
||||
#define BDF_ALL_SPACING ( BDF_PROPORTIONAL | \
|
||||
BDF_MONOWIDTH | \
|
||||
BDF_CHARCELL )
|
||||
|
||||
/*
|
||||
* Error codes.
|
||||
*/
|
||||
#define BDF_OK 0
|
||||
#define BDF_MISSING_START -1
|
||||
#define BDF_MISSING_FONTNAME -2
|
||||
#define BDF_MISSING_SIZE -3
|
||||
#define BDF_MISSING_FONTBBX -4
|
||||
#define BDF_MISSING_CHARS -5
|
||||
#define BDF_MISSING_STARTCHAR -6
|
||||
#define BDF_MISSING_ENCODING -7
|
||||
#define BDF_MISSING_BBX -8
|
||||
#define BDF_DEFAULT_LOAD_OPTIONS ( BDF_CORRECT_METRICS | \
|
||||
BDF_KEEP_COMMENTS | \
|
||||
BDF_KEEP_UNENCODED | \
|
||||
BDF_PROPORTIONAL )
|
||||
|
||||
#define BDF_NOT_CONSOLE_FONT -10
|
||||
#define BDF_NOT_MF_FONT -11
|
||||
#define BDF_NOT_PSF_FONT -12
|
||||
|
||||
#define BDF_OUT_OF_MEMORY -20
|
||||
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 int32;
|
||||
unsigned long card32;
|
||||
|
||||
} 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 _hashnode_
|
||||
{
|
||||
char* key;
|
||||
void* data;
|
||||
|
||||
} _hashnode, *hashnode;
|
||||
|
||||
|
||||
typedef struct hashtable_
|
||||
{
|
||||
int limit;
|
||||
int size;
|
||||
int used;
|
||||
hashnode* table;
|
||||
|
||||
} hashtable;
|
||||
|
||||
|
||||
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. */
|
||||
|
||||
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_glyph; /* 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. */
|
||||
|
||||
unsigned long nmod[2048]; /* Bitmap indicating modified glyphs. */
|
||||
unsigned long umod[2048]; /* 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;
|
||||
hashtable 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_EMPTY_FONT -99
|
||||
#define BDF_INVALID_LINE -100
|
||||
|
||||
typedef struct {
|
||||
unsigned long reason;
|
||||
unsigned long current;
|
||||
unsigned long total;
|
||||
unsigned long errlineno;
|
||||
} bdf_callback_struct_t;
|
||||
|
||||
typedef void (*bdf_callback_t) (bdf_callback_struct_t *call_data,
|
||||
void *client_data);
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* BDF font API. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* BDF font API.
|
||||
*
|
||||
**************************************************************************/
|
||||
FT_LOCAL( FT_Error )
|
||||
bdf_load_font( FT_Stream stream,
|
||||
FT_Memory memory,
|
||||
bdf_options_t* opts,
|
||||
bdf_font_t* *font );
|
||||
|
||||
/*
|
||||
* Startup and shutdown functions are no more needed
|
||||
*/
|
||||
FT_LOCAL( void )
|
||||
bdf_free_font( bdf_font_t* font );
|
||||
|
||||
/*
|
||||
* Font options functions.
|
||||
*/
|
||||
/*extern void bdf_default_options (bdf_options_t *opts);*/
|
||||
FT_LOCAL( bdf_property_t * )
|
||||
bdf_get_property( char* name,
|
||||
bdf_font_t* font );
|
||||
|
||||
/*
|
||||
* Font load, create, save and free functions.
|
||||
*/
|
||||
FT_LOCAL( bdf_property_t * )
|
||||
bdf_get_font_property( bdf_font_t* font,
|
||||
char* name );
|
||||
|
||||
FT_LOCAL( bdf_font_t* ) bdf_load_font (FT_Stream stream, FT_Memory memory,
|
||||
bdf_options_t *opts,
|
||||
bdf_callback_t callback, void *data);
|
||||
|
||||
|
||||
FT_LOCAL( void ) bdf_free_font (bdf_font_t *font);
|
||||
|
||||
/*
|
||||
* Font property functions.
|
||||
*/
|
||||
/* extern void bdf_create_property (char *name, int type, bdf_font_t *font); */
|
||||
FT_LOCAL( bdf_property_t* ) bdf_get_property (char *name, bdf_font_t *font);
|
||||
FT_LOCAL( unsigned long ) bdf_property_list (bdf_property_t **props);
|
||||
|
||||
FT_LOCAL( void ) bdf_add_font_property (bdf_font_t *font,
|
||||
bdf_property_t *property);
|
||||
|
||||
FT_LOCAL( void ) bdf_delete_font_property (bdf_font_t *font, char *name);
|
||||
|
||||
FT_LOCAL( bdf_property_t* ) bdf_get_font_property (bdf_font_t *font,
|
||||
char *name);
|
||||
|
||||
FT_LOCAL( unsigned long ) bdf_font_property_list (bdf_font_t *font,
|
||||
bdf_property_t **props);
|
||||
|
||||
/*
|
||||
* Font comment functions.
|
||||
*/
|
||||
FT_LOCAL( int ) bdf_replace_comments (bdf_font_t *font, char *comments,
|
||||
unsigned long comments_len);
|
||||
|
||||
/*
|
||||
* Other miscellaneous functions.
|
||||
*/
|
||||
FT_LOCAL( void ) bdf_set_default_metrics (bdf_font_t *font);
|
||||
|
||||
/* */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* _h_bdf */
|
||||
|
||||
#endif /* __BDF_H__ */
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
|
@ -1,463 +0,0 @@
|
|||
/* bdfdriver.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.
|
||||
*/
|
||||
|
||||
#include <ft2build.h>
|
||||
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
#include FT_INTERNAL_STREAM_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
|
||||
#include "bdf.h"
|
||||
#include "bdfdriver.h"
|
||||
|
||||
#include "bdferror.h"
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
||||
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
||||
/* messages during execution. */
|
||||
/* */
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_bdf
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
BDF_Face_Done( BDF_Face face )
|
||||
{
|
||||
FT_Memory memory = FT_FACE_MEMORY( face );
|
||||
|
||||
bdf_free_font(face->bdffont);
|
||||
|
||||
FT_FREE( face->en_table );
|
||||
|
||||
FT_FREE( face->charset_encoding);
|
||||
FT_FREE( face->charset_registry);
|
||||
FT_FREE( face->root.family_name );
|
||||
|
||||
FT_FREE( face->root.available_sizes );
|
||||
FT_FREE( face->bdffont );
|
||||
|
||||
FT_TRACE4(("bdf: done face\n"));
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
BDF_Face_Init( FT_Stream stream,
|
||||
BDF_Face face,
|
||||
FT_Int face_index,
|
||||
FT_Int num_params,
|
||||
FT_Parameter* params )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Memory memory = FT_FACE_MEMORY( face );
|
||||
bdf_font_t* font;
|
||||
bdf_options_t options;
|
||||
|
||||
FT_UNUSED( num_params );
|
||||
FT_UNUSED( params );
|
||||
FT_UNUSED( face_index );
|
||||
|
||||
(void) FT_STREAM_SEEK( 0 );
|
||||
|
||||
options.correct_metrics = 1; /* FZ XXX : options semantics */
|
||||
options.keep_unencoded = 1;
|
||||
options.pad_cells = 1;
|
||||
|
||||
font = bdf_load_font( stream, memory, &options, 0, 0 );
|
||||
if ( font == NULL )
|
||||
{
|
||||
FT_TRACE2(("[not a valid BDF file]\n"));
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
/* we have a bdf font: let's construct the face object */
|
||||
face->bdffont = font;
|
||||
{
|
||||
FT_Face root = FT_FACE( face );
|
||||
bdf_property_t* prop = NULL;
|
||||
|
||||
FT_TRACE4(("glyph %d - %d, unencoded %d %d\n",font->glyphs_size,
|
||||
font->glyphs_used, font->unencoded_size, font->unencoded_used));
|
||||
|
||||
|
||||
root->num_faces = 1;
|
||||
root->face_index = 0;
|
||||
root->face_flags = FT_FACE_FLAG_FIXED_SIZES |
|
||||
FT_FACE_FLAG_HORIZONTAL |
|
||||
FT_FACE_FLAG_FAST_GLYPHS ;
|
||||
|
||||
prop = bdf_get_font_property (font,"SPACING");
|
||||
|
||||
if ( prop && prop->format == BDF_ATOM )
|
||||
{
|
||||
if ( (*(prop->value.atom) == 'M') ||
|
||||
(*(prop->value.atom) == 'C') )
|
||||
{
|
||||
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* FZ XXX : TO DO : FT_FACE_FLAGS_VERTICAL */
|
||||
/* FZ XXX : I need a font to implement this */
|
||||
|
||||
root->style_flags = 0;
|
||||
|
||||
prop = bdf_get_font_property (font,"SLANT");
|
||||
|
||||
if ( prop && prop->format == BDF_ATOM )
|
||||
{
|
||||
if ( (*(prop->value.atom) == 'O' ) ||
|
||||
(*(prop->value.atom) == 'I' ) )
|
||||
{
|
||||
root->style_flags |= FT_STYLE_FLAG_ITALIC;
|
||||
}
|
||||
}
|
||||
|
||||
prop = bdf_get_font_property (font,"WEIGHT_NAME");
|
||||
|
||||
if ( prop && prop->format == BDF_ATOM )
|
||||
{
|
||||
if ( *(prop->value.atom) == 'B' )
|
||||
root->style_flags |= FT_STYLE_FLAG_BOLD;
|
||||
}
|
||||
|
||||
|
||||
prop = bdf_get_font_property (font,"FAMILY_NAME");
|
||||
if (prop != NULL) {
|
||||
int l = strlen(prop->value.atom) + 1;
|
||||
if ( FT_ALLOC( root->family_name, l * sizeof(char)) )
|
||||
goto Fail;
|
||||
strcpy(root->family_name, prop->value.atom);
|
||||
} else root->family_name = 0;
|
||||
|
||||
root->style_name = (char *)"Regular";
|
||||
if ( root->style_flags & FT_STYLE_FLAG_BOLD )
|
||||
{
|
||||
if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
|
||||
root->style_name = (char *)"Bold Italic";
|
||||
else
|
||||
root->style_name = (char *)"Bold";
|
||||
}
|
||||
else if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
|
||||
root->style_name = (char *)"Italic";
|
||||
|
||||
root->num_glyphs = font->glyphs_size ; /* unencoded included */
|
||||
|
||||
root->num_fixed_sizes = 1;
|
||||
if ( FT_ALLOC_ARRAY( root->available_sizes, 1,
|
||||
FT_Bitmap_Size ) )
|
||||
goto Fail;
|
||||
|
||||
prop = bdf_get_font_property(font,"PIXEL_SIZE");
|
||||
if (prop != NULL) {
|
||||
bdf_property_t *xres = 0, *yres = 0;
|
||||
|
||||
xres = bdf_get_font_property(font,"RESOLUTION_X");
|
||||
yres = bdf_get_font_property(font,"RESOLUTION_Y");
|
||||
if ((xres != NULL) && (yres != NULL)) {
|
||||
FT_TRACE4(("prop %d %d %d\n",prop->value.int32, xres->value.int32,
|
||||
yres->value.int32));
|
||||
root->available_sizes->width =
|
||||
prop->value.int32 * 75 / xres->value.int32;
|
||||
root->available_sizes->height =
|
||||
prop->value.int32 * 75 / yres->value.int32;
|
||||
}
|
||||
} else {
|
||||
/* some fonts have broken SIZE declaration (jiskan24.bdf) */
|
||||
FT_ERROR(("BDF Warning: reading size\n"));
|
||||
root->available_sizes->width = font->point_size ;
|
||||
root->available_sizes->height = font->point_size ;
|
||||
}
|
||||
|
||||
/* encoding table */
|
||||
{
|
||||
bdf_glyph_t *cur = font->glyphs;
|
||||
int n;
|
||||
|
||||
if ( FT_ALLOC ( face->en_table ,
|
||||
font->glyphs_size * sizeof(BDF_encoding_el ) ) )
|
||||
goto Fail;
|
||||
|
||||
for (n = 0; n<font->glyphs_size ; n++) {
|
||||
(face->en_table[n]).enc = cur[n].encoding ;
|
||||
FT_TRACE4(("enc n: %d, val %ld\n",n,cur[n].encoding));
|
||||
(face->en_table[n]).glyph = n;
|
||||
}
|
||||
}
|
||||
|
||||
/* charmaps */
|
||||
{
|
||||
bdf_property_t *charset_registry = 0, *charset_encoding = 0;
|
||||
|
||||
charset_registry = bdf_get_font_property(font,"CHARSET_REGISTRY");
|
||||
charset_encoding = bdf_get_font_property(font,"CHARSET_ENCODING");
|
||||
if ((charset_registry != NULL) && (charset_encoding != NULL)) {
|
||||
if ((charset_registry->format == BDF_ATOM) &&
|
||||
(charset_encoding->format == BDF_ATOM)) {
|
||||
if (FT_ALLOC(face->charset_encoding,
|
||||
(strlen(charset_encoding->value.atom)+1) * sizeof(char)))
|
||||
goto Exit;
|
||||
if (FT_ALLOC(face->charset_registry,
|
||||
(strlen(charset_registry->value.atom)+1) * sizeof(char)))
|
||||
goto Exit;
|
||||
strcpy(face->charset_registry,charset_registry->value.atom);
|
||||
strcpy(face->charset_encoding,charset_encoding->value.atom);
|
||||
|
||||
face->charmap.encoding = ft_encoding_none;
|
||||
face->charmap.platform_id = 0;
|
||||
face->charmap.encoding_id = 0;
|
||||
face->charmap.face = root;
|
||||
face->charmap_handle = &face->charmap;
|
||||
root->charmap = face->charmap_handle;
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
/* otherwise assume adobe standard encoding */
|
||||
face->charmap.encoding = ft_encoding_adobe_standard;
|
||||
face->charmap.platform_id = 7; /* taken from t1objs.c */
|
||||
face->charmap.encoding_id = 0;
|
||||
face->charmap.face = root;
|
||||
face->charmap_handle = &face->charmap;
|
||||
root->charmap = face->charmap_handle;
|
||||
}
|
||||
}
|
||||
|
||||
Exit:
|
||||
return FT_Err_Ok;
|
||||
|
||||
Fail:
|
||||
BDF_Face_Done( face );
|
||||
return FT_Err_Unknown_File_Format;
|
||||
}
|
||||
|
||||
static
|
||||
FT_Error BDF_Set_Pixel_Size( FT_Size size )
|
||||
{
|
||||
BDF_Face face = (BDF_Face)FT_SIZE_FACE( size );
|
||||
FT_Face root = FT_FACE( face );
|
||||
|
||||
FT_TRACE4(("rec %d - pres %d\n",size->metrics.y_ppem,
|
||||
root->available_sizes->height));
|
||||
if (size->metrics.y_ppem == root->available_sizes->height) {
|
||||
|
||||
size->metrics.ascender = face->bdffont->bbx.ascent << 6;
|
||||
size->metrics.descender = face->bdffont->bbx.descent * (-64);
|
||||
size->metrics.height = face->bdffont->bbx.height <<6;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
else {
|
||||
return FT_Err_Invalid_Pixel_Size;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
FT_Error BDF_Glyph_Load( FT_GlyphSlot slot,
|
||||
FT_Size size,
|
||||
FT_UInt glyph_index,
|
||||
FT_Int load_flags )
|
||||
{
|
||||
BDF_Face face = (BDF_Face)FT_SIZE_FACE( size );
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Bitmap *bitmap = &slot->bitmap;
|
||||
bdf_glyph_t glyph;
|
||||
int i;
|
||||
FT_Memory memory = face->bdffont->memory;
|
||||
|
||||
if (!face) {
|
||||
error = FT_Err_Invalid_Argument;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* slot, bitmap => freetype, glyph => bdflib */
|
||||
glyph = face->bdffont->glyphs[glyph_index];
|
||||
|
||||
bitmap->pitch = (glyph.bbx.width + 7) >> 3;
|
||||
bitmap->rows = glyph.bbx.height;
|
||||
bitmap->width = glyph.bbx.width;
|
||||
bitmap->num_grays = 1; /* unused */
|
||||
bitmap->pixel_mode = ft_pixel_mode_mono;
|
||||
|
||||
if ( FT_ALLOC ( bitmap->buffer , glyph.bytes) )
|
||||
return FT_Err_Out_Of_Memory;
|
||||
FT_MEM_SET( bitmap->buffer , 0 , glyph.bytes );
|
||||
for (i=0 ; i<glyph.bytes ; i++) {
|
||||
bitmap->buffer[i] = glyph.bitmap[i];
|
||||
}
|
||||
|
||||
slot->bitmap_left = 0;
|
||||
slot->bitmap_top = glyph.bbx.ascent ;
|
||||
|
||||
/* FZ TO DO : vertical metrics */
|
||||
slot->metrics.horiAdvance = glyph.dwidth << 6;
|
||||
slot->metrics.horiBearingX = glyph.bbx.x_offset << 6 ;
|
||||
slot->metrics.horiBearingY = glyph.bbx.y_offset << 6 ;
|
||||
slot->metrics.width = bitmap->width << 6 ;
|
||||
slot->metrics.height = bitmap->rows << 6;
|
||||
|
||||
slot->linearHoriAdvance = (FT_Fixed)glyph.dwidth << 16;
|
||||
slot->format = ft_glyph_format_bitmap;
|
||||
slot->flags = FT_GLYPH_OWN_BITMAP;
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
static
|
||||
FT_UInt BDF_Get_Char_Index( FT_CharMap charmap,
|
||||
FT_ULong char_code )
|
||||
{
|
||||
BDF_Face face = ((BDF_Face)charmap->face);
|
||||
BDF_encoding_el *en_table = face->en_table;
|
||||
int low, high, mid;
|
||||
|
||||
FT_TRACE4(("get_char_index %ld\n", char_code));
|
||||
|
||||
low = 0;
|
||||
high = face->bdffont->glyphs_used - 1;
|
||||
while (low <= high) {
|
||||
mid = (low+high) / 2;
|
||||
if (char_code < en_table[mid].enc)
|
||||
high = mid - 1;
|
||||
else if (char_code > en_table[mid].enc)
|
||||
low = mid + 1;
|
||||
else return en_table[mid].glyph;
|
||||
}
|
||||
|
||||
return face->bdffont->default_glyph;
|
||||
}
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const FT_Driver_ClassRec bdf_driver_class =
|
||||
{
|
||||
{
|
||||
ft_module_font_driver,
|
||||
sizeof ( FT_DriverRec ),
|
||||
|
||||
"bdf",
|
||||
0x10000L,
|
||||
0x20000L,
|
||||
|
||||
0,
|
||||
|
||||
(FT_Module_Constructor)0,
|
||||
(FT_Module_Destructor) 0,
|
||||
(FT_Module_Requester) 0
|
||||
},
|
||||
|
||||
sizeof( BDF_FaceRec ),
|
||||
sizeof( FT_SizeRec ),
|
||||
sizeof( FT_GlyphSlotRec ),
|
||||
|
||||
(FT_Face_InitFunc) BDF_Face_Init,
|
||||
(FT_Face_DoneFunc) BDF_Face_Done,
|
||||
(FT_Size_InitFunc) 0,
|
||||
(FT_Size_DoneFunc) 0,
|
||||
(FT_Slot_InitFunc) 0,
|
||||
(FT_Slot_DoneFunc) 0,
|
||||
|
||||
(FT_Size_ResetPointsFunc) BDF_Set_Pixel_Size,
|
||||
(FT_Size_ResetPixelsFunc) BDF_Set_Pixel_Size,
|
||||
|
||||
(FT_Slot_LoadFunc) BDF_Glyph_Load,
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_USE_CMAPS
|
||||
(FT_CharMap_CharIndexFunc)0,
|
||||
#else
|
||||
(FT_CharMap_CharIndexFunc)0,
|
||||
#endif
|
||||
|
||||
(FT_Face_GetKerningFunc) 0,
|
||||
(FT_Face_AttachFunc) 0,
|
||||
(FT_Face_GetAdvancesFunc) 0,
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_USE_CMAPS
|
||||
(FT_CharMap_CharNextFunc) 0, /*PCF_Char_Get_Next,*/
|
||||
#else
|
||||
(FT_CharMap_CharNextFunc) 0
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
(FTDriver_initFace) BDF_Init_Face,
|
||||
(FTDriver_doneFace) BDF_Done_Face,
|
||||
(FTDriver_initSize) 0,
|
||||
(FTDriver_doneSize) 0,
|
||||
(FTDriver_initGlyphSlot)0,
|
||||
(FTDriver_doneGlyphSlot)0,
|
||||
|
||||
(FTDriver_setCharSizes) BDF_Set_Pixel_Size,
|
||||
(FTDriver_setPixelSizes)BDF_Set_Pixel_Size,
|
||||
|
||||
(FTDriver_loadGlyph) BDF_Load_Glyph,
|
||||
(FTDriver_getCharIndex) BDF_Get_Char_Index,
|
||||
|
||||
(FTDriver_getKerning) 0,
|
||||
(FTDriver_attachFile) 0,
|
||||
(FTDriver_getAdvances) 0
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* getDriverClass */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* This function is used when compiling the TrueType driver as a */
|
||||
/* shared library (`.DLL' or `.so'). It will be used by the */
|
||||
/* high-level library of FreeType to retrieve the address of the */
|
||||
/* driver's generic interface. */
|
||||
/* */
|
||||
/* It shouldn't be implemented in a static build, as each driver must */
|
||||
/* have the same function as an exported entry point. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* The address of the TrueType's driver generic interface. The */
|
||||
/* format-specific interface can then be retrieved through the method */
|
||||
/* interface->get_format_interface. */
|
||||
/* */
|
||||
FT_EXPORT_DEF( const FT_Driver_Class* )
|
||||
getDriverClass( void )
|
||||
{
|
||||
return &bdf_driver_class;
|
||||
}
|
||||
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_DYNAMIC_DRIVERS */
|
||||
|
||||
|
||||
/* END */
|
|
@ -0,0 +1,564 @@
|
|||
/* bdfdrivr.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.
|
||||
*/
|
||||
|
||||
#include <ft2build.h>
|
||||
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
#include FT_INTERNAL_STREAM_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
|
||||
#include "bdf.h"
|
||||
#include "bdfdrivr.h"
|
||||
|
||||
#include "bdferror.h"
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
||||
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
||||
/* messages during execution. */
|
||||
/* */
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_bdfdriver
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
BDF_Face_Done( BDF_Face face )
|
||||
{
|
||||
FT_Memory memory = FT_FACE_MEMORY( face );
|
||||
|
||||
|
||||
bdf_free_font( face->bdffont );
|
||||
|
||||
FT_FREE( face->en_table );
|
||||
|
||||
FT_FREE( face->charset_encoding );
|
||||
FT_FREE( face->charset_registry );
|
||||
FT_FREE( face->root.family_name );
|
||||
|
||||
FT_FREE( face->root.available_sizes );
|
||||
|
||||
FT_FREE( face->bdffont );
|
||||
|
||||
FT_TRACE4(( "BDF_Face_Done: done face\n" ));
|
||||
|
||||
return BDF_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
BDF_Face_Init( FT_Stream stream,
|
||||
BDF_Face face,
|
||||
FT_Int face_index,
|
||||
FT_Int num_params,
|
||||
FT_Parameter* params )
|
||||
{
|
||||
FT_Error error = BDF_Err_Ok;
|
||||
FT_Memory memory = FT_FACE_MEMORY( face );
|
||||
|
||||
bdf_font_t* font;
|
||||
bdf_options_t options;
|
||||
|
||||
FT_UNUSED( num_params );
|
||||
FT_UNUSED( params );
|
||||
FT_UNUSED( face_index );
|
||||
|
||||
|
||||
if ( FT_STREAM_SEEK( 0 ) )
|
||||
goto Exit;
|
||||
|
||||
options.correct_metrics = 1; /* FZ XXX: options semantics */
|
||||
options.keep_unencoded = 1;
|
||||
options.keep_comments = 0;
|
||||
options.font_spacing = BDF_PROPORTIONAL;
|
||||
|
||||
error = bdf_load_font( stream, memory, &options, &font );
|
||||
if ( error == BDF_Err_Missing_Startfont_Field )
|
||||
{
|
||||
FT_TRACE2(( "[not a valid BDF file]\n" ));
|
||||
goto Fail;
|
||||
}
|
||||
else if ( error )
|
||||
goto Exit;
|
||||
|
||||
/* we have a bdf font: let's construct the face object */
|
||||
face->bdffont = font;
|
||||
{
|
||||
FT_Face root = FT_FACE( face );
|
||||
bdf_property_t* prop = NULL;
|
||||
|
||||
|
||||
FT_TRACE4(( "number of glyphs: %d (%d)\n",
|
||||
font->glyphs_size,
|
||||
font->glyphs_used ));
|
||||
FT_TRACE4(( "number of unencoded glyphs: %d (%d)\n",
|
||||
font->unencoded_size,
|
||||
font->unencoded_used ));
|
||||
|
||||
root->num_faces = 1;
|
||||
root->face_index = 0;
|
||||
root->face_flags = FT_FACE_FLAG_FIXED_SIZES |
|
||||
FT_FACE_FLAG_HORIZONTAL |
|
||||
FT_FACE_FLAG_FAST_GLYPHS;
|
||||
|
||||
prop = bdf_get_font_property( font, (char *)"SPACING" );
|
||||
if ( prop != NULL )
|
||||
if ( prop->format == BDF_ATOM )
|
||||
if ( ( *(prop->value.atom) == 'M' ) ||
|
||||
( *(prop->value.atom) == 'C' ) )
|
||||
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
|
||||
|
||||
/* FZ XXX: TO DO: FT_FACE_FLAGS_VERTICAL */
|
||||
/* FZ XXX: I need a font to implement this */
|
||||
|
||||
root->style_flags = 0;
|
||||
prop = bdf_get_font_property( font, (char *)"SLANT" );
|
||||
if ( prop != NULL )
|
||||
if ( prop->format == BDF_ATOM )
|
||||
if ( ( *(prop->value.atom) == 'O' ) ||
|
||||
( *(prop->value.atom) == 'I' ) )
|
||||
root->style_flags |= FT_STYLE_FLAG_ITALIC;
|
||||
|
||||
prop = bdf_get_font_property( font, (char *)"WEIGHT_NAME" );
|
||||
if ( prop != NULL )
|
||||
if ( prop->format == BDF_ATOM )
|
||||
if ( *(prop->value.atom) == 'B' )
|
||||
root->style_flags |= FT_STYLE_FLAG_BOLD;
|
||||
|
||||
prop = bdf_get_font_property( font, (char *)"FAMILY_NAME" );
|
||||
if ( prop != NULL )
|
||||
{
|
||||
int l = ft_strlen( prop->value.atom ) + 1;
|
||||
|
||||
|
||||
if ( FT_NEW_ARRAY( root->family_name, l ) )
|
||||
goto Exit;
|
||||
ft_strcpy( root->family_name, prop->value.atom );
|
||||
}
|
||||
else
|
||||
root->family_name = 0;
|
||||
|
||||
root->style_name = (char *)"Regular";
|
||||
if ( root->style_flags & FT_STYLE_FLAG_BOLD )
|
||||
{
|
||||
if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
|
||||
root->style_name = (char *)"Bold Italic";
|
||||
else
|
||||
root->style_name = (char *)"Bold";
|
||||
}
|
||||
else if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
|
||||
root->style_name = (char *)"Italic";
|
||||
|
||||
root->num_glyphs = font->glyphs_size; /* unencoded included */
|
||||
|
||||
root->num_fixed_sizes = 1;
|
||||
if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )
|
||||
goto Exit;
|
||||
|
||||
prop = bdf_get_font_property( font, (char *)"PIXEL_SIZE" );
|
||||
if ( prop != NULL )
|
||||
{
|
||||
bdf_property_t *xres = 0, *yres = 0;
|
||||
|
||||
|
||||
xres = bdf_get_font_property( font, (char *)"RESOLUTION_X" );
|
||||
yres = bdf_get_font_property( font, (char *)"RESOLUTION_Y" );
|
||||
if ( ( xres != NULL ) && ( yres != NULL ) )
|
||||
{
|
||||
FT_TRACE4(( "PIXEL_SIZE: %d RESOLUTION_X: %d RESOLUTION_Y: %d\n",
|
||||
prop->value.int32,
|
||||
xres->value.int32,
|
||||
yres->value.int32 ));
|
||||
root->available_sizes->width =
|
||||
prop->value.int32 * 75 / xres->value.int32;
|
||||
root->available_sizes->height =
|
||||
prop->value.int32 * 75 / yres->value.int32;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* some fonts have broken SIZE declaration (jiskan24.bdf) */
|
||||
FT_ERROR(( "BDF_Face_Init: reading size\n" ));
|
||||
root->available_sizes->width = font->point_size ;
|
||||
root->available_sizes->height = font->point_size ;
|
||||
}
|
||||
|
||||
/* encoding table */
|
||||
{
|
||||
bdf_glyph_t* cur = font->glyphs;
|
||||
unsigned long n;
|
||||
|
||||
|
||||
if ( FT_NEW_ARRAY( face->en_table, font->glyphs_size ) )
|
||||
goto Exit;
|
||||
|
||||
for ( n = 0; n < font->glyphs_size; n++ )
|
||||
{
|
||||
(face->en_table[n]).enc = cur[n].encoding;
|
||||
FT_TRACE4(( "idx %d, val 0x%lX\n", n, cur[n].encoding ));
|
||||
(face->en_table[n]).glyph = n;
|
||||
}
|
||||
}
|
||||
|
||||
/* charmaps */
|
||||
{
|
||||
bdf_property_t *charset_registry = 0, *charset_encoding = 0;
|
||||
|
||||
|
||||
charset_registry =
|
||||
bdf_get_font_property( font, (char *)"CHARSET_REGISTRY" );
|
||||
charset_encoding =
|
||||
bdf_get_font_property( font, (char *)"CHARSET_ENCODING" );
|
||||
if ( ( charset_registry != NULL ) && ( charset_encoding != NULL ) )
|
||||
{
|
||||
if ( ( charset_registry->format == BDF_ATOM ) &&
|
||||
( charset_encoding->format == BDF_ATOM ) )
|
||||
{
|
||||
if ( FT_NEW_ARRAY( face->charset_encoding,
|
||||
strlen( charset_encoding->value.atom ) + 1 ) )
|
||||
goto Exit;
|
||||
if (FT_NEW_ARRAY( face->charset_registry,
|
||||
strlen( charset_registry->value.atom ) + 1 ) )
|
||||
goto Exit;
|
||||
ft_strcpy( face->charset_registry, charset_registry->value.atom );
|
||||
ft_strcpy( face->charset_encoding, charset_encoding->value.atom );
|
||||
|
||||
face->charmap.encoding = ft_encoding_none;
|
||||
face->charmap.platform_id = 0;
|
||||
face->charmap.encoding_id = 0;
|
||||
face->charmap.face = root;
|
||||
face->charmap_handle = &face->charmap;
|
||||
|
||||
root->charmap = face->charmap_handle;
|
||||
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
/* otherwise assume adobe standard encoding */
|
||||
face->charmap.encoding = ft_encoding_adobe_standard;
|
||||
face->charmap.platform_id = 7; /* taken from t1objs.c */
|
||||
face->charmap.encoding_id = 0;
|
||||
face->charmap.face = root;
|
||||
face->charmap_handle = &face->charmap;
|
||||
|
||||
root->charmap = face->charmap_handle;
|
||||
}
|
||||
}
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
|
||||
Fail:
|
||||
BDF_Face_Done( face );
|
||||
return BDF_Err_Unknown_File_Format;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
FT_Error BDF_Set_Pixel_Size( FT_Size size )
|
||||
{
|
||||
BDF_Face face = (BDF_Face)FT_SIZE_FACE( size );
|
||||
FT_Face root = FT_FACE( face );
|
||||
|
||||
|
||||
FT_TRACE4(( "rec %d - pres %d\n",
|
||||
size->metrics.y_ppem, root->available_sizes->height ));
|
||||
|
||||
if ( size->metrics.y_ppem == root->available_sizes->height )
|
||||
{
|
||||
size->metrics.ascender = face->bdffont->bbx.ascent << 6;
|
||||
size->metrics.descender = face->bdffont->bbx.descent * ( -64 );
|
||||
size->metrics.height = face->bdffont->bbx.height << 6;
|
||||
|
||||
return BDF_Err_Ok;
|
||||
}
|
||||
else
|
||||
return BDF_Err_Invalid_Pixel_Size;
|
||||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
BDF_Glyph_Load( FT_GlyphSlot slot,
|
||||
FT_Size size,
|
||||
FT_UInt glyph_index,
|
||||
FT_Int load_flags )
|
||||
{
|
||||
BDF_Face face = (BDF_Face)FT_SIZE_FACE( size );
|
||||
FT_Error error = BDF_Err_Ok;
|
||||
FT_Bitmap* bitmap = &slot->bitmap;
|
||||
bdf_glyph_t glyph;
|
||||
int bpp = face->bdffont->bpp;
|
||||
int i, j, count;
|
||||
unsigned char *p, *pp;
|
||||
|
||||
FT_Memory memory = face->bdffont->memory;
|
||||
|
||||
FT_UNUSED( load_flags );
|
||||
|
||||
|
||||
if ( !face )
|
||||
{
|
||||
error = BDF_Err_Invalid_Argument;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* slot, bitmap => freetype, glyph => bdflib */
|
||||
glyph = face->bdffont->glyphs[glyph_index];
|
||||
|
||||
bitmap->rows = glyph.bbx.height;
|
||||
bitmap->width = glyph.bbx.width;
|
||||
|
||||
if ( bpp == 1 )
|
||||
{
|
||||
bitmap->pixel_mode = ft_pixel_mode_mono;
|
||||
bitmap->pitch = glyph.bpr;
|
||||
|
||||
if ( FT_NEW_ARRAY( bitmap->buffer, glyph.bytes ) )
|
||||
goto Exit;
|
||||
FT_MEM_COPY( bitmap->buffer, glyph.bitmap, glyph.bytes );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* blow up pixmap to have 8 bits per pixel */
|
||||
bitmap->pixel_mode = ft_pixel_mode_grays;
|
||||
bitmap->pitch = bitmap->width;
|
||||
|
||||
if ( FT_NEW_ARRAY( bitmap->buffer, bitmap->rows * bitmap->pitch ) )
|
||||
goto Exit;
|
||||
|
||||
switch ( bpp )
|
||||
{
|
||||
case 2:
|
||||
bitmap->num_grays = 4;
|
||||
|
||||
count = 0;
|
||||
p = glyph.bitmap;
|
||||
|
||||
for ( i = 0; i < bitmap->rows; i++ )
|
||||
{
|
||||
pp = p;
|
||||
|
||||
/* get the full bytes */
|
||||
for ( j = 0; j < ( bitmap->width >> 2 ); j++ )
|
||||
{
|
||||
bitmap->buffer[count++] = ( *pp & 0xC0 ) >> 6;
|
||||
bitmap->buffer[count++] = ( *pp & 0x30 ) >> 4;
|
||||
bitmap->buffer[count++] = ( *pp & 0x0C ) >> 2;
|
||||
bitmap->buffer[count++] = *pp & 0x03;
|
||||
|
||||
pp++;
|
||||
}
|
||||
|
||||
/* get remaining pixels (if any) */
|
||||
switch ( bitmap->width & 3 )
|
||||
{
|
||||
case 3:
|
||||
bitmap->buffer[count++] = ( *pp & 0xC0 ) >> 6;
|
||||
/* fall through */
|
||||
case 2:
|
||||
bitmap->buffer[count++] = ( *pp & 0x30 ) >> 4;
|
||||
/* fall through */
|
||||
case 1:
|
||||
bitmap->buffer[count++] = ( *pp & 0x0C ) >> 2;
|
||||
/* fall through */
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
|
||||
p += glyph.bpr;
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
bitmap->num_grays = 16;
|
||||
|
||||
count = 0;
|
||||
p = glyph.bitmap;
|
||||
|
||||
for ( i = 0; i < bitmap->rows; i++ )
|
||||
{
|
||||
pp = p;
|
||||
|
||||
/* get the full bytes */
|
||||
for ( j = 0; j < ( bitmap->width >> 1 ); j++ )
|
||||
{
|
||||
bitmap->buffer[count++] = ( *pp & 0xF0 ) >> 4;
|
||||
bitmap->buffer[count++] = *pp & 0x0F;
|
||||
|
||||
pp++;
|
||||
}
|
||||
|
||||
/* get remaining pixel (if any) */
|
||||
switch ( bitmap->width & 1 )
|
||||
{
|
||||
case 1:
|
||||
bitmap->buffer[count++] = ( *pp & 0xF0 ) >> 4;
|
||||
/* fall through */
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
|
||||
p += glyph.bpr;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
slot->bitmap_left = 0;
|
||||
slot->bitmap_top = glyph.bbx.ascent;
|
||||
|
||||
/* FZ XXX: TODO: vertical metrics */
|
||||
slot->metrics.horiAdvance = glyph.dwidth << 6;
|
||||
slot->metrics.horiBearingX = glyph.bbx.x_offset << 6;
|
||||
slot->metrics.horiBearingY = glyph.bbx.y_offset << 6;
|
||||
slot->metrics.width = bitmap->width << 6;
|
||||
slot->metrics.height = bitmap->rows << 6;
|
||||
|
||||
slot->linearHoriAdvance = (FT_Fixed)glyph.dwidth << 16;
|
||||
slot->format = ft_glyph_format_bitmap;
|
||||
slot->flags = FT_GLYPH_OWN_BITMAP;
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
FT_UInt BDF_Get_Char_Index( FT_CharMap charmap,
|
||||
FT_ULong char_code )
|
||||
{
|
||||
BDF_Face face = (BDF_Face)charmap->face;
|
||||
BDF_encoding_el* en_table = face->en_table;
|
||||
int low, high, mid;
|
||||
|
||||
|
||||
FT_TRACE4(( "BDF_Get_Char_Index %ld\n", char_code ));
|
||||
|
||||
low = 0;
|
||||
high = face->bdffont->glyphs_used - 1;
|
||||
|
||||
while ( low <= high )
|
||||
{
|
||||
mid = ( low + high ) / 2;
|
||||
if ( char_code < en_table[mid].enc )
|
||||
high = mid - 1;
|
||||
else if ( char_code > en_table[mid].enc )
|
||||
low = mid + 1;
|
||||
else
|
||||
return en_table[mid].glyph;
|
||||
}
|
||||
|
||||
return face->bdffont->default_glyph;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const FT_Driver_ClassRec bdf_driver_class =
|
||||
{
|
||||
{
|
||||
ft_module_font_driver,
|
||||
sizeof ( FT_DriverRec ),
|
||||
|
||||
"bdf",
|
||||
0x10000L,
|
||||
0x20000L,
|
||||
|
||||
0,
|
||||
|
||||
(FT_Module_Constructor)0,
|
||||
(FT_Module_Destructor) 0,
|
||||
(FT_Module_Requester) 0
|
||||
},
|
||||
|
||||
sizeof( BDF_FaceRec ),
|
||||
sizeof( FT_SizeRec ),
|
||||
sizeof( FT_GlyphSlotRec ),
|
||||
|
||||
(FT_Face_InitFunc) BDF_Face_Init,
|
||||
(FT_Face_DoneFunc) BDF_Face_Done,
|
||||
(FT_Size_InitFunc) 0,
|
||||
(FT_Size_DoneFunc) 0,
|
||||
(FT_Slot_InitFunc) 0,
|
||||
(FT_Slot_DoneFunc) 0,
|
||||
|
||||
(FT_Size_ResetPointsFunc) BDF_Set_Pixel_Size,
|
||||
(FT_Size_ResetPixelsFunc) BDF_Set_Pixel_Size,
|
||||
|
||||
(FT_Slot_LoadFunc) BDF_Glyph_Load,
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_USE_CMAPS
|
||||
(FT_CharMap_CharIndexFunc)0,
|
||||
#else
|
||||
(FT_CharMap_CharIndexFunc)BDF_Get_Char_Index,
|
||||
#endif
|
||||
|
||||
(FT_Face_GetKerningFunc) 0,
|
||||
(FT_Face_AttachFunc) 0,
|
||||
(FT_Face_GetAdvancesFunc) 0,
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_USE_CMAPS
|
||||
(FT_CharMap_CharNextFunc) 0, /* BDF_Char_Get_Next,*/
|
||||
#else
|
||||
(FT_CharMap_CharNextFunc) 0
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* getDriverClass */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* This function is used when compiling the TrueType driver as a */
|
||||
/* shared library (`.DLL' or `.so'). It will be used by the */
|
||||
/* high-level library of FreeType to retrieve the address of the */
|
||||
/* driver's generic interface. */
|
||||
/* */
|
||||
/* It shouldn't be implemented in a static build, as each driver must */
|
||||
/* have the same function as an exported entry point. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* The address of the TrueType's driver generic interface. The */
|
||||
/* format-specific interface can then be retrieved through the method */
|
||||
/* interface->get_format_interface. */
|
||||
/* */
|
||||
FT_EXPORT_DEF( const FT_Driver_Class* )
|
||||
getDriverClass( void )
|
||||
{
|
||||
return &bdf_driver_class;
|
||||
}
|
||||
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_DYNAMIC_DRIVERS */
|
||||
|
||||
|
||||
/* END */
|
|
@ -1,9 +1,9 @@
|
|||
/* bdfdriver.h
|
||||
/* bdfdrivr.h
|
||||
|
||||
FreeType font driver for bdf fonts
|
||||
|
||||
Copyright (C) 2001 by
|
||||
Francesco Zappa Nardelli
|
||||
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
|
||||
|
@ -25,44 +25,50 @@ THE SOFTWARE.
|
|||
*/
|
||||
|
||||
|
||||
#ifndef __BDF_DRIVER_H__
|
||||
#define __BDF_DRIVER_H__
|
||||
#ifndef __BDFDRIVR_H__
|
||||
#define __BDFDRIVR_H__
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_INTERNAL_DRIVER_H
|
||||
|
||||
#include "bdf.h"
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
typedef struct {
|
||||
FT_Long enc;
|
||||
FT_Short glyph;
|
||||
} BDF_encoding_el;
|
||||
|
||||
typedef struct BDF_FaceRec_
|
||||
{
|
||||
FT_FaceRec root;
|
||||
typedef struct BDF_encoding_el_
|
||||
{
|
||||
FT_ULong enc;
|
||||
FT_Short glyph;
|
||||
|
||||
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 */
|
||||
} BDF_FaceRec, *BDF_Face;
|
||||
} BDF_encoding_el;
|
||||
|
||||
|
||||
FT_EXPORT_VAR( const FT_Driver_ClassRec ) bdf_driver_class;
|
||||
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 */
|
||||
|
||||
} BDF_FaceRec, *BDF_Face;
|
||||
|
||||
|
||||
FT_EXPORT_VAR( const FT_Driver_ClassRec ) bdf_driver_class;
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
||||
#endif /* __BDF_DRIVER_H__ */
|
||||
#endif /* __BDFDRIVR_H__ */
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2001 Francesco Zappa Nardelli
|
||||
* Copyright 2001, 2002 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"),
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* This file is used to define the PCF error enumeration constants. */
|
||||
/* This file is used to define the BDF error enumeration constants. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include FT_ERRORS_H
|
||||
|
||||
#endif /* __PCFERROR_H__ */
|
||||
#endif /* __BDFERROR_H__ */
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
4047
src/bdf/bdflib.c
4047
src/bdf/bdflib.c
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
|||
# FreeType 2 BDF module definition
|
||||
#
|
||||
|
||||
# Copyright 2001 by
|
||||
# Copyright 2001, 2002 by
|
||||
# Francesco Zappa Nardelli
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
|
||||
|
||||
# Copyright (C) 2001 by
|
||||
# Copyright (C) 2001, 2002 by
|
||||
# Francesco Zappa Nardelli
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
@ -38,14 +38,13 @@ BDF_COMPILE := $(FT_COMPILE) $I$(BDF_DIR)
|
|||
|
||||
# bdf driver sources (i.e., C files)
|
||||
#
|
||||
BDF_DRV_SRC := $(BDF_DIR_)bdflib.c $(BDF_DIR_)bdfdriver.c
|
||||
BDF_DRV_SRC := $(BDF_DIR_)bdflib.c $(BDF_DIR_)bdfdrivr.c
|
||||
|
||||
|
||||
# bdf driver headers
|
||||
#
|
||||
#BDF_DRV_H := $(BDF_DRV_SRC:%.c=%.h)
|
||||
BDF_DRV_H := $(BDF_DIR_)bdf.h \
|
||||
$(BDF_DIR_)bdfdriver.h
|
||||
$(BDF_DIR_)bdfdrivr.h
|
||||
|
||||
# bdf driver object(s)
|
||||
#
|
||||
|
|
|
@ -213,16 +213,23 @@
|
|||
CHECK_CHAR( xadvance ) &&
|
||||
CHECK_CHAR( yadvance ) )
|
||||
{
|
||||
sbit->width = (FT_Byte)bitmap->width;
|
||||
sbit->height = (FT_Byte)bitmap->rows;
|
||||
sbit->pitch = (FT_Char)bitmap->pitch;
|
||||
sbit->left = (FT_Char)slot->bitmap_left;
|
||||
sbit->top = (FT_Char)slot->bitmap_top;
|
||||
sbit->xadvance = (FT_Char)xadvance;
|
||||
sbit->yadvance = (FT_Char)yadvance;
|
||||
sbit->format = (FT_Byte)bitmap->pixel_mode;
|
||||
sbit->width = (FT_Byte)bitmap->width;
|
||||
sbit->height = (FT_Byte)bitmap->rows;
|
||||
sbit->pitch = (FT_Char)bitmap->pitch;
|
||||
sbit->left = (FT_Char)slot->bitmap_left;
|
||||
sbit->top = (FT_Char)slot->bitmap_top;
|
||||
sbit->xadvance = (FT_Char)xadvance;
|
||||
sbit->yadvance = (FT_Char)yadvance;
|
||||
sbit->format = (FT_Byte)bitmap->pixel_mode;
|
||||
/* XXX: Fixme: We don't handle the number of gray levels */
|
||||
/* consistently -- we say num_grays == 1 for */
|
||||
/* monochrome but num_grays == 256 for gray. It */
|
||||
/* would be better to make this variable hold the */
|
||||
/* highest possible value so that it fits into */
|
||||
/* a single byte. */
|
||||
sbit->num_grays = bitmap->num_grays;
|
||||
|
||||
/* grab the bitmap when possible - this is a hack !! */
|
||||
/* grab the bitmap when possible - this is a hack! */
|
||||
if ( slot->flags & FT_GLYPH_OWN_BITMAP )
|
||||
{
|
||||
slot->flags &= ~FT_GLYPH_OWN_BITMAP;
|
||||
|
|
|
@ -32,70 +32,23 @@
|
|||
#include FT_INTERNAL_DRIVER_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include FT_INTERNAL_TYPE1_TYPES_H
|
||||
#include FT_INTERNAL_TYPE42_TYPES_H
|
||||
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
||||
#include FT_INTERNAL_STREAM_H
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
||||
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
||||
/* messages during execution. */
|
||||
/* */
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_t42
|
||||
|
||||
|
||||
/********************* Data Definitions ******************/
|
||||
|
||||
typedef enum T42_EncodingType_
|
||||
{
|
||||
T42_ENCODING_TYPE_NONE = 0,
|
||||
T42_ENCODING_TYPE_ARRAY,
|
||||
T42_ENCODING_TYPE_STANDARD,
|
||||
T42_ENCODING_TYPE_EXPERT,
|
||||
T42_ENCODING_TYPE_ISOLATIN1
|
||||
|
||||
} T42_EncodingType;
|
||||
|
||||
|
||||
typedef struct T42_Font_
|
||||
{
|
||||
/* font info dictionary */
|
||||
PS_FontInfoRec font_info;
|
||||
|
||||
/* top-level dictionary */
|
||||
FT_String* font_name;
|
||||
|
||||
T42_EncodingType encoding_type;
|
||||
T1_EncodingRec encoding;
|
||||
|
||||
FT_Byte* charstrings_block;
|
||||
FT_Byte* glyph_names_block;
|
||||
|
||||
FT_Int num_glyphs;
|
||||
FT_String** glyph_names; /* array of glyph names */
|
||||
FT_Byte** charstrings; /* array of glyph charstrings */
|
||||
FT_Int* charstrings_len;
|
||||
|
||||
FT_Byte paint_type;
|
||||
FT_Byte font_type;
|
||||
FT_Matrix font_matrix; /* From FontMatrix field: a, b, c, d */
|
||||
FT_Vector font_offset; /* From FontMatrix field: tx, ty */
|
||||
FT_BBox font_bbox;
|
||||
|
||||
FT_Int stroke_width;
|
||||
|
||||
} T42_FontRec, *T42_Font;
|
||||
|
||||
|
||||
typedef struct T42_FaceRec_
|
||||
{
|
||||
FT_FaceRec root;
|
||||
T42_FontRec type42;
|
||||
void* psnames;
|
||||
void* psaux;
|
||||
void* afm_data;
|
||||
FT_Byte* ttf_data;
|
||||
FT_ULong ttf_size;
|
||||
FT_Face ttf_face;
|
||||
FT_CharMapRec charmaprecs[2];
|
||||
FT_CharMap charmaps[2];
|
||||
PS_Unicodes unicode_map;
|
||||
|
||||
} T42_FaceRec, *T42_Face;
|
||||
|
||||
|
||||
typedef struct T42_DriverRec_
|
||||
{
|
||||
FT_DriverRec root;
|
||||
|
@ -431,11 +384,6 @@
|
|||
FT_Fixed temp_scale;
|
||||
|
||||
|
||||
/* XXX: Are these three lines necessary */
|
||||
if ( matrix->xx || matrix->yx )
|
||||
/* with synthetic fonts, it's possible we get here twice */
|
||||
return;
|
||||
|
||||
(void)T1_ToFixedArray( parser, 6, temp, 3 );
|
||||
|
||||
temp_scale = ABS( temp[3] );
|
||||
|
@ -604,7 +552,7 @@
|
|||
cur++;
|
||||
}
|
||||
|
||||
face->type42.encoding_type = T42_ENCODING_TYPE_ARRAY;
|
||||
face->type42.encoding_type = T1_ENCODING_TYPE_ARRAY;
|
||||
parser->root.cursor = cur;
|
||||
}
|
||||
/* Otherwise, we should have either `StandardEncoding', */
|
||||
|
@ -613,15 +561,15 @@
|
|||
{
|
||||
if ( cur + 17 < limit &&
|
||||
ft_strncmp( (const char*)cur, "StandardEncoding", 16 ) == 0 )
|
||||
face->type42.encoding_type = T42_ENCODING_TYPE_STANDARD;
|
||||
face->type42.encoding_type = T1_ENCODING_TYPE_STANDARD;
|
||||
|
||||
else if ( cur + 15 < limit &&
|
||||
ft_strncmp( (const char*)cur, "ExpertEncoding", 14 ) == 0 )
|
||||
face->type42.encoding_type = T42_ENCODING_TYPE_EXPERT;
|
||||
face->type42.encoding_type = T1_ENCODING_TYPE_EXPERT;
|
||||
|
||||
else if ( cur + 18 < limit &&
|
||||
ft_strncmp( (const char*)cur, "ISOLatin1Encoding", 17 ) == 0 )
|
||||
face->type42.encoding_type = T42_ENCODING_TYPE_ISOLATIN1;
|
||||
face->type42.encoding_type = T1_ENCODING_TYPE_ISOLATIN1;
|
||||
|
||||
else {
|
||||
FT_ERROR(( "parse_encoding: invalid token!\n" ));
|
||||
|
@ -654,10 +602,10 @@
|
|||
FT_Byte* cur = parser->root.cursor;
|
||||
FT_Byte* limit = parser->root.limit;
|
||||
FT_Error error;
|
||||
FT_Int num_tables, status;
|
||||
FT_ULong count, ttf_size, string_size;
|
||||
FT_Int num_tables = 0, status;
|
||||
FT_ULong count, ttf_size = 0, string_size = 0;
|
||||
FT_Bool in_string = 0;
|
||||
FT_Byte v;
|
||||
FT_Byte v = 0;
|
||||
|
||||
|
||||
/* The format is `/sfnts [ <...> <...> ... ] def' */
|
||||
|
@ -1151,7 +1099,7 @@
|
|||
loader.glyph_names.elements = 0;
|
||||
|
||||
/* we must now build type42.encoding when we have a custom array */
|
||||
if ( type42->encoding_type == T42_ENCODING_TYPE_ARRAY )
|
||||
if ( type42->encoding_type == T1_ENCODING_TYPE_ARRAY )
|
||||
{
|
||||
FT_Int charcode, idx, min_char, max_char;
|
||||
FT_Byte* char_name;
|
||||
|
@ -1416,22 +1364,22 @@
|
|||
|
||||
switch ( face->type42.encoding_type )
|
||||
{
|
||||
case T42_ENCODING_TYPE_STANDARD:
|
||||
case T1_ENCODING_TYPE_STANDARD:
|
||||
charmap->encoding = ft_encoding_adobe_standard;
|
||||
charmap->encoding_id = 0;
|
||||
break;
|
||||
|
||||
case T42_ENCODING_TYPE_EXPERT:
|
||||
case T1_ENCODING_TYPE_EXPERT:
|
||||
charmap->encoding = ft_encoding_adobe_expert;
|
||||
charmap->encoding_id = 1;
|
||||
break;
|
||||
|
||||
case T42_ENCODING_TYPE_ARRAY:
|
||||
case T1_ENCODING_TYPE_ARRAY:
|
||||
charmap->encoding = ft_encoding_adobe_custom;
|
||||
charmap->encoding_id = 2;
|
||||
break;
|
||||
|
||||
case T42_ENCODING_TYPE_ISOLATIN1:
|
||||
case T1_ENCODING_TYPE_ISOLATIN1:
|
||||
charmap->encoding = ft_encoding_latin_1;
|
||||
charmap->encoding_id = 3;
|
||||
break;
|
||||
|
@ -1540,12 +1488,6 @@
|
|||
ttmodule = FT_Get_Module( driver->root.root.library, "truetype" );
|
||||
driver->ttclazz = (FT_Driver_Class)ttmodule->clazz;
|
||||
|
||||
/* XXX: What about hinter support? */
|
||||
#if 0
|
||||
if (ttmodule->clazz->module_flags & ft_module_driver_has_hinter)
|
||||
driver->root.clazz->root.module_flags |= ft_module_driver_has_hinter;
|
||||
#endif
|
||||
|
||||
return T42_Err_Ok;
|
||||
}
|
||||
|
||||
|
@ -2063,7 +2005,11 @@
|
|||
{
|
||||
ft_module_font_driver |
|
||||
ft_module_driver_scalable |
|
||||
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
||||
ft_module_driver_has_hinter,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
|
||||
sizeof ( T42_DriverRec ),
|
||||
|
||||
|
|
Loading…
Reference in New Issue