* builds/amiga/makefile, builds/amiga/smakefile,

amiga/include/freetype/config/ftmodule.h: Updated to include
support for BDF and Type42 drivers.

* docs/modules.txt: Updated.

* src/bdf/bdflib.c (_bdf_parse_glyphs): Replace floating point math
with calls to `FT_MulDiv'.
This commit is contained in:
Werner Lemberg 2002-05-28 22:38:05 +00:00
parent 2a4fa1340e
commit 02d4d59ac0
8 changed files with 166 additions and 94 deletions

View File

@ -1,27 +1,36 @@
2002-05-28 Detlef Würkner <TetiSoft@apg.lahn.de>
* builds/amiga/makefile, builds/amiga/smakefile,
amiga/include/freetype/config/ftmodule.h: Updated to include
support for BDF and Type42 drivers.
* docs/modules.txt: Updated.
2005-05-28 David Turner <david@freetype.org> 2005-05-28 David Turner <david@freetype.org>
* include/freetype/ftxf86.h, src/base/ftxf86.c: added a new API named * include/freetype/ftxf86.h, src/base/ftxf86.c: New files.
FT_Get_X11_Font_Format to return an X11-compatible string describing the They provad a new API (FT_Get_X11_Font_Format) an X11-compatible
font format of a given face. This was put in a new optional base source string describing the font format of a given face. This was put in
file, corresponding to a new public header (named FT_XFREE86_H since a new optional base source file, corresponding to a new public
this function should only be used within the XFree86 font server IMO). header (named FT_XFREE86_H since this function should only be used
within the XFree86 font server IMO).
* include/freetype/config/ftheader.h: adding FT_XFREE86_H, though it's * include/freetype/config/ftheader.h (FT_XFREE86_H): New macro (not
not documented yet. documented yet).
* include/freetype/t1tables.h, src/base/fttype1.c: adding two new APIs * src/base/fttype1.c: New file, provoding two new API functions
named "FT_Get_PS_Font_Info" and "FT_Has_PS_Glyph_Names". This required (FT_Get_PS_Font_Info and FT_Has_PS_Glyph_Names).
a new optional source in 'src/base' named "fttype1.c" * include/freetype/t1tables.h: Updated.
* src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms: updating * src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms:
build control files for the new files "ftxf86.c" and "fttype1.c" in Updating build control files for the new files "ftxf86.c" and
src/base "fttype1.c" in src/base.
* src/pshinter/pshglob.c (psh_blues_scale_zones): fixed a bug that * src/pshinter/pshglob.c (psh_blues_scale_zones): Fixed a bug that
prevented family blue zones substitution from hapenning correctly prevented family blue zones substitution from hapenning correctly.
* include/freetype/ftbdf.h: adding documentation comments for the * include/freetype/ftbdf.h FT_Get_BDF_Charset_ID): Adding
API reference describing the new function FT_Get_BDF_Charset_ID. documentation comment.
2002-05-28 Werner Lemberg <wl@gnu.org> 2002-05-28 Werner Lemberg <wl@gnu.org>
@ -29,6 +38,9 @@
but FT_STREAM_READ. but FT_STREAM_READ.
Declare `stream' variable. Declare `stream' variable.
* src/bdf/bdflib.c (_bdf_parse_glyphs): Replace floating point math
with calls to `FT_MulDiv'.
2002-05-28 David Turner <david@freetype.org> 2002-05-28 David Turner <david@freetype.org>
Fixing the SFNT name table loader to support various buggy fonts. Fixing the SFNT name table loader to support various buggy fonts.

View File

@ -7,9 +7,12 @@
//#define FT_USE_SMOOTH // anti-aliasing rasterizer //#define FT_USE_SMOOTH // anti-aliasing rasterizer
//#define FT_USE_TT // truetype font driver //#define FT_USE_TT // truetype font driver
//#define FT_USE_T1 // type1 font driver //#define FT_USE_T1 // type1 font driver
//#define FT_USE_T1CID // cid-keyed type1 font driver // no cmap support, useless //#define FT_USE_T42 // type42 font driver // yet unstable
//#define FT_USE_CFF // opentype font driver // does not work with TektonPro //#define FT_USE_T1CID // cid-keyed type1 font driver // no cmap support
//#define FT_USE_CFF // opentype font driver
//#define FT_USE_BDF // bdf bitmap font driver
//#define FT_USE_PCF // pcf bitmap font driver //#define FT_USE_PCF // pcf bitmap font driver
//#define FT_USE_PFR // pfr font driver
//#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver //#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver
#include "FT:src/base/ftinit.c" #include "FT:src/base/ftinit.c"
*/ */
@ -17,6 +20,10 @@
// TetiSoft: make sure that needed support modules are built in. // TetiSoft: make sure that needed support modules are built in.
// Dependencies can be found by searching for FT_Get_Module. // Dependencies can be found by searching for FT_Get_Module.
#ifdef FT_USE_T42
#define FT_USE_TT
#endif
#ifdef FT_USE_TT #ifdef FT_USE_TT
#define FT_USE_SFNT #define FT_USE_SFNT
#endif #endif
@ -65,10 +72,18 @@ FT_USE_MODULE(cff_driver_class)
FT_USE_MODULE(t1cid_driver_class) FT_USE_MODULE(t1cid_driver_class)
#endif #endif
#ifdef FT_USE_BDF
FT_USE_MODULE(bdf_driver_class)
#endif
#ifdef FT_USE_PCF #ifdef FT_USE_PCF
FT_USE_MODULE(pcf_driver_class) FT_USE_MODULE(pcf_driver_class)
#endif #endif
#ifdef FT_USE_PFR
FT_USE_MODULE(pfr_driver_class)
#endif
#ifdef FT_USE_PSAUX #ifdef FT_USE_PSAUX
FT_USE_MODULE(psaux_module_class) FT_USE_MODULE(psaux_module_class)
#endif #endif
@ -97,6 +112,10 @@ FT_USE_MODULE(tt_driver_class)
FT_USE_MODULE(t1_driver_class) FT_USE_MODULE(t1_driver_class)
#endif #endif
#ifdef FT_USE_T42
FT_USE_MODULE(t42_driver_class)
#endif
#ifdef FT_USE_WINFNT #ifdef FT_USE_WINFNT
FT_USE_MODULE(winfnt_driver_class) FT_USE_MODULE(winfnt_driver_class)
#endif #endif

View File

@ -11,15 +11,18 @@
# Your programs source code should start with this # Your programs source code should start with this
# (uncomment the parts you do not need to keep the program small): # (uncomment the parts you do not need to keep the program small):
# ---8<--- # ---8<---
#define FT_USE_AUTOHINT // autohinter #define FT_USE_AUTOHINT // autohinter
#define FT_USE_RASTER // monochrome rasterizer #define FT_USE_RASTER // monochrome rasterizer
#define FT_USE_SMOOTH // anti-aliasing rasterizer #define FT_USE_SMOOTH // anti-aliasing rasterizer
#define FT_USE_TT // truetype font driver #define FT_USE_TT // truetype font driver
#define FT_USE_T1 // type1 font driver #define FT_USE_T1 // type1 font driver
#define FT_USE_T1CID // cid-keyed type1 font driver #define FT_USE_T42 // type42 font driver
#define FT_USE_CFF // opentype font driver #define FT_USE_T1CID // cid-keyed type1 font driver
#define FT_USE_PCF // pcf bitmap font driver #define FT_USE_CFF // opentype font driver
#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver #define FT_USE_BDF // bdf bitmap font driver
#define FT_USE_PCF // pcf bitmap font driver
#define FT_USE_PFR // pfr font driver
#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver
#include "FT:src/base/ftinit.c" #include "FT:src/base/ftinit.c"
# ---8<--- # ---8<---
# #
@ -150,6 +153,12 @@ truetype.ppc.o: $(FTSRC)/truetype/truetype.c
type1.ppc.o: $(FTSRC)/type1/type1.c type1.ppc.o: $(FTSRC)/type1/type1.c
$(CC) -c $(CFLAGS) -o $@ $< $(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library Type42 font driver
#
type42.ppc.o: $(FTSRC)/type42/t42drivr.c
$(CC) -c $(CFLAGS) -o $@ $<
# #
# FreeType2 library CID-keyed Type1 font driver # FreeType2 library CID-keyed Type1 font driver
# #
@ -157,9 +166,9 @@ type1cid.ppc.o: $(FTSRC)/cid/type1cid.c
$(CC) -c $(CFLAGS) -o $@ $< $(CC) -c $(CFLAGS) -o $@ $<
# #
# FreeType2 library Windows FNT/FON bitmap font driver # FreeType2 library BDF bitmap font driver
# #
winfnt.ppc.o: $(FTSRC)/winfonts/winfnt.c bdf.ppc.o: $(FTSRC)/bdf/bdf.c
$(CC) -c $(CFLAGS) -o $@ $< $(CC) -c $(CFLAGS) -o $@ $<
# #
@ -168,6 +177,18 @@ winfnt.ppc.o: $(FTSRC)/winfonts/winfnt.c
pcf.ppc.o: $(FTSRC)/pcf/pcf.c pcf.ppc.o: $(FTSRC)/pcf/pcf.c
$(CC) -c $(CFLAGS) -o $@ $< $(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library PFR font driver
#
pfr.ppc.o: $(FTSRC)/pfr/pfr.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library Windows FNT/FON bitmap font driver
#
winfnt.ppc.o: $(FTSRC)/winfonts/winfnt.c
$(CC) -c $(CFLAGS) -o $@ $<
BASEPPC = ftbase.ppc.o ftglyph.ppc.o ftbbox.ppc.o ftmm.ppc.o ftsynth.ppc.o BASEPPC = ftbase.ppc.o ftglyph.ppc.o ftbbox.ppc.o ftmm.ppc.o ftsynth.ppc.o
DEBUGPPC = ftdebug.ppc.o ftdebugpure.ppc.o DEBUGPPC = ftdebug.ppc.o ftdebugpure.ppc.o
@ -178,7 +199,8 @@ PSPPC = psaux.ppc.o psnames.ppc.o pshinter.ppc.o
RASTERPPC = raster.ppc.o smooth.ppc.o RASTERPPC = raster.ppc.o smooth.ppc.o
FONTDPPC = cff.ppc.o type1.ppc.o type1cid.ppc.o truetype.ppc.o winfnt.ppc.o pcf.ppc.o FONTDPPC = cff.ppc.o type1.ppc.o type42.ppc.o type1cid.ppc.o truetype.ppc.o\
bdf.ppc.o pcf.ppc.o pfr.ppc.o winfnt.ppc.o
libft2_ppc.a: $(BASEPPC) $(AHINTPPC) $(PSPPC) $(RASTERPPC) sfnt.ppc.o ftcache.ppc.o $(FONTDPPC) libft2_ppc.a: $(BASEPPC) $(AHINTPPC) $(PSPPC) $(RASTERPPC) sfnt.ppc.o ftcache.ppc.o $(FONTDPPC)
$(AR) $@ $(BASEPPC) $(AHINTPPC) $(PSPPC) $(RASTERPPC) sfnt.ppc.o ftcache.ppc.o $(FONTDPPC) $(AR) $@ $(BASEPPC) $(AHINTPPC) $(PSPPC) $(RASTERPPC) sfnt.ppc.o ftcache.ppc.o $(FONTDPPC)

View File

@ -9,15 +9,18 @@
# Your programs source code should start with this # Your programs source code should start with this
# (uncomment the parts you do not need to keep the program small): # (uncomment the parts you do not need to keep the program small):
# ---8<--- # ---8<---
#define FT_USE_AUTOHINT // autohinter #define FT_USE_AUTOHINT // autohinter
#define FT_USE_RASTER // monochrome rasterizer #define FT_USE_RASTER // monochrome rasterizer
#define FT_USE_SMOOTH // anti-aliasing rasterizer #define FT_USE_SMOOTH // anti-aliasing rasterizer
#define FT_USE_TT // truetype font driver #define FT_USE_TT // truetype font driver
#define FT_USE_T1 // type1 font driver #define FT_USE_T1 // type1 font driver
#define FT_USE_T1CID // cid-keyed type1 font driver #define FT_USE_T42 // type42 font driver
#define FT_USE_CFF // opentype font driver #define FT_USE_T1CID // cid-keyed type1 font driver
#define FT_USE_PCF // pcf bitmap font driver #define FT_USE_CFF // opentype font driver
#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver #define FT_USE_BDF // bdf bitmap font driver
#define FT_USE_PCF // pcf bitmap font driver
#define FT_USE_PFR // pfr font driver
#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver
#include "FT:src/base/ftinit.c" #include "FT:src/base/ftinit.c"
# ---8<--- # ---8<---
# #
@ -47,23 +50,12 @@ OBJSFNT = sfnt.o
OBJCACHE = ftcache.o OBJCACHE = ftcache.o
OBJOT = cff.o
OBJT1 = type1.o
OBJT1C = type1cid.o
OBJTT = truetype.o
OBJWINFNT = winfnt.o
OBJPCF = pcf.o
OBJPS = $(OBJPSAUX) $(OBJPSNAM) $(OBJPSHINT) OBJPS = $(OBJPSAUX) $(OBJPSNAM) $(OBJPSHINT)
OBJRASTER = $(OBJRAST) $(OBJSMOOTH) OBJRASTER = $(OBJRAST) $(OBJSMOOTH)
OBJFONTD = $(OBJOT) $(OBJT1) $(OBJT1C) $(OBJTT) $(OBJWINFNT) $(OBJPCF) OBJFONTD = cff.o type1.o type42.o type1cid.o\
truetype.o winfnt.o bdf.o pcf.o pfr.o
CORE = FT:src/ CORE = FT:src/
@ -202,6 +194,12 @@ truetype.o: $(CORE)truetype/truetype.c
type1.o: $(CORE)type1/type1.c type1.o: $(CORE)type1/type1.c
sc $(SCFLAGS) objname=$@ $< sc $(SCFLAGS) objname=$@ $<
#
# FreeType2 library Type42 font driver
#
type42.o: $(CORE)type42/t42drivr.c
sc $(SCFLAGS) objname=$@ $<
# #
# freetype library CID-keyed Type1 font driver # freetype library CID-keyed Type1 font driver
# #
@ -214,9 +212,9 @@ type1cid.o: $(CORE)cid/type1cid.c
# sc $(SCFLAGS) objname=$@ $< # sc $(SCFLAGS) objname=$@ $<
# #
# freetype library Windows FNT/FON bitmap font driver # freetype library BDF bitmap font driver
# #
winfnt.o: $(CORE)winfonts/winfnt.c bdf.o: $(CORE)bdf/bdf.c
sc $(SCFLAGS) objname=$@ $< sc $(SCFLAGS) objname=$@ $<
# #
@ -224,3 +222,15 @@ winfnt.o: $(CORE)winfonts/winfnt.c
# #
pcf.o: $(CORE)pcf/pcf.c pcf.o: $(CORE)pcf/pcf.c
sc $(SCFLAGS) objname=$@ $< sc $(SCFLAGS) objname=$@ $<
#
# freetype library PFR font driver
#
pfr.o: $(CORE)pfr/pfr.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library Windows FNT/FON bitmap font driver
#
winfnt.o: $(CORE)winfonts/winfnt.c
sc $(SCFLAGS) objname=$@ $<

View File

@ -9,5 +9,6 @@ Note that the use of `psnames' can be controlled in ftconfig.h
cid psaux, pshinter, psnames cid psaux, pshinter, psnames
truetype sfnt truetype sfnt
type1 psaux, pshinter, psnames type1 psaux, pshinter, psnames
type42 truetype
psaux psnames psaux psnames
sfnt psnames sfnt psnames

View File

@ -45,25 +45,29 @@ FT_BEGIN_HEADER
/********************************************************************** /**********************************************************************
* *
* @function: FT_Get_BDF_Charset_ID * @function:
* FT_Get_BDF_Charset_ID
* *
* @description: * @description:
* retrieves a BDF font character set identity, according to * Retrieves a BDF font character set identity, according to
* the BDF specification * the BDF specification.
* *
* @input: * @input:
* face :: handle to input face * face ::
* handle to input face
* *
* @output: * @output:
* acharset_encoding :: charset encoding, as a C string owned by the face * acharset_encoding ::
* acharset_registry :: charset register, as a C string owned by the face * Charset encoding, as a C string, owned by the face.
*
* acharset_registry ::
* Charset registry, as a C string, owned by the face.
* *
* @return: * @return:
* error code. 0 means success * FreeType rror code. 0 means success.
* *
* @note: * @note:
* this function will only work with BDF faces, it will return an * This function only works with BDF faces, returning an error otherwise.
* error otherwise.
*/ */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )
FT_Get_BDF_Charset_ID( FT_Face face, FT_Get_BDF_Charset_ID( FT_Face face,

View File

@ -323,50 +323,55 @@ FT_BEGIN_HEADER
/************************************************************************ /************************************************************************
* *
* @function: FT_Has_PS_Glyph_Names * @function:
* FT_Has_PS_Glyph_Names
* *
* @description: * @description:
* returns true when a given face provides reliable Postscript glyph * Return true if a given face provides reliable Postscript glyph
* names. This is similar to using the @FT_HAS_GLYPH_NAMES macro, except * names. This is similar to using the @FT_HAS_GLYPH_NAMES macro,
* that certain fonts (mostly TrueType) contain incorrect glyph name * except that certain fonts (mostly TrueType) contain incorrect
* tables. * glyph name tables.
* *
* when this function returns true, the caller is sure that the glyph * When this function returns true, the caller is sure that the glyph
* names returned by @FT_Get_Glyph_Name are reliable. * names returned by @FT_Get_Glyph_Name are reliable.
* *
* @input: * @input:
* face :: face handle * face ::
* face handle
* *
* @return: * @return:
* boolean. true if glyph names are reliable * Boolean. True if glyph names are reliable.
*/ */
FT_EXPORT( FT_Int ) FT_EXPORT( FT_Int )
FT_Has_PS_Glyph_Names( FT_Face face ); FT_Has_PS_Glyph_Names( FT_Face face );
/************************************************************************ /************************************************************************
* *
* @function: FT_Get_PS_Font_Info * @function:
* FT_Get_PS_Font_Info
* *
* @description: * @description:
* retrieve the @PS_FontInfoRec structure corresponding to a given * Retrieve the @PS_FontInfoRec structure corresponding to a given
* Postscript font. * Postscript font.
* *
* @input: * @input:
* face :: postscript face handle * face ::
* Postscript face handle.
* *
* @output: * @output:
* afont_info :: output font info structure pointer * afont_info ::
* Output font info structure pointer.
* *
* @return: * @return:
* error code. 0 means success * FreeType error code. 0 means success.
* *
* @note: * @note:
* the string pointers within the font info structure are owned by * The string pointers within the font info structure are owned by
* the face and don't need to be freed by the caller. * the face and don't need to be freed by the caller.
* *
* if the font's format is not Postscript-based, this function will * If the font's format is not Postscript-based, this function will
* return the @FT_Err_Invalid_Argument error code. * return the @FT_Err_Invalid_Argument error code.
*/ */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )
FT_Get_PS_Font_Info( FT_Face face, FT_Get_PS_Font_Info( FT_Face face,

View File

@ -32,6 +32,7 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_FREETYPE_H
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
@ -1437,7 +1438,6 @@
char* s; char* s;
unsigned char* bp; unsigned char* bp;
unsigned long i, slen, nibbles; unsigned long i, slen, nibbles;
double ps, rx, dw, sw;
_bdf_line_func_t* next; _bdf_line_func_t* next;
_bdf_parse_t* p; _bdf_parse_t* p;
@ -1740,11 +1740,10 @@
/* the scalable width from the device width. */ /* the scalable width from the device width. */
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG9, lineno )); FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG9, lineno ));
ps = (double)font->point_size; glyph->swidth = (unsigned short)FT_MulDiv(
rx = (double)font->resolution_x; glyph->dwidth, 72000L,
dw = (double)glyph->dwidth; (FT_Long)( font->point_size *
font->resolution_x ) );
glyph->swidth = (unsigned short)( ( dw * 72000.0 ) / ( ps * rx ) );
} }
p->flags |= _BDF_DWIDTH; p->flags |= _BDF_DWIDTH;
@ -1791,11 +1790,11 @@
if ( p->opts->correct_metrics != 0 ) if ( p->opts->correct_metrics != 0 )
{ {
/* Determine the point size of the glyph. */ /* Determine the point size of the glyph. */
ps = (double)font->point_size; unsigned short sw = (unsigned short)FT_MulDiv(
rx = (double)font->resolution_x; glyph->dwidth, 72000L,
dw = (double)glyph->dwidth; (FT_Long)( font->point_size *
font->resolution_x ) );
sw = (unsigned short)( ( dw * 72000.0 ) / ( ps * rx ) );
if ( sw != glyph->swidth ) if ( sw != glyph->swidth )
{ {