From 02d4d59ac03aa79cafca124db6aa29030e6df55d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 28 May 2002 22:38:05 +0000 Subject: [PATCH] * 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'. --- ChangeLog | 46 +++++++++------ .../amiga/include/freetype/config/ftmodule.h | 23 +++++++- builds/amiga/makefile | 46 +++++++++++---- builds/amiga/smakefile | 58 +++++++++++-------- docs/modules.txt | 1 + include/freetype/ftbdf.h | 22 ++++--- include/freetype/t1tables.h | 45 +++++++------- src/bdf/bdflib.c | 19 +++--- 8 files changed, 166 insertions(+), 94 deletions(-) diff --git a/ChangeLog b/ChangeLog index b9558cac2..adffe1e21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,27 +1,36 @@ +2002-05-28 Detlef Würkner + + * 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 - * include/freetype/ftxf86.h, src/base/ftxf86.c: added a new API named - FT_Get_X11_Font_Format to return an X11-compatible string describing the - font format of a given face. This was put in a new optional base source - file, corresponding to a new public header (named FT_XFREE86_H since - this function should only be used within the XFree86 font server IMO). + * include/freetype/ftxf86.h, src/base/ftxf86.c: New files. + They provad a new API (FT_Get_X11_Font_Format) an X11-compatible + string describing the font format of a given face. This was put in + a new optional base source file, corresponding to a new public + 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 - not documented yet. + * include/freetype/config/ftheader.h (FT_XFREE86_H): New macro (not + documented yet). - * include/freetype/t1tables.h, src/base/fttype1.c: adding two new APIs - named "FT_Get_PS_Font_Info" and "FT_Has_PS_Glyph_Names". This required - a new optional source in 'src/base' named "fttype1.c" + * src/base/fttype1.c: New file, provoding two new API functions + (FT_Get_PS_Font_Info and FT_Has_PS_Glyph_Names). + * include/freetype/t1tables.h: Updated. - * src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms: updating - build control files for the new files "ftxf86.c" and "fttype1.c" in - src/base + * src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms: + Updating build control files for the new files "ftxf86.c" and + "fttype1.c" in src/base. - * src/pshinter/pshglob.c (psh_blues_scale_zones): fixed a bug that - prevented family blue zones substitution from hapenning correctly + * src/pshinter/pshglob.c (psh_blues_scale_zones): Fixed a bug that + prevented family blue zones substitution from hapenning correctly. - * include/freetype/ftbdf.h: adding documentation comments for the - API reference describing the new function FT_Get_BDF_Charset_ID. + * include/freetype/ftbdf.h FT_Get_BDF_Charset_ID): Adding + documentation comment. 2002-05-28 Werner Lemberg @@ -29,6 +38,9 @@ but FT_STREAM_READ. Declare `stream' variable. + * src/bdf/bdflib.c (_bdf_parse_glyphs): Replace floating point math + with calls to `FT_MulDiv'. + 2002-05-28 David Turner Fixing the SFNT name table loader to support various buggy fonts. diff --git a/builds/amiga/include/freetype/config/ftmodule.h b/builds/amiga/include/freetype/config/ftmodule.h index e93f1ce33..6cdb81f18 100644 --- a/builds/amiga/include/freetype/config/ftmodule.h +++ b/builds/amiga/include/freetype/config/ftmodule.h @@ -7,9 +7,12 @@ //#define FT_USE_SMOOTH // anti-aliasing rasterizer //#define FT_USE_TT // truetype 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_CFF // opentype font driver // does not work with TektonPro +//#define FT_USE_T42 // type42 font driver // yet unstable +//#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_PFR // pfr font driver //#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver #include "FT:src/base/ftinit.c" */ @@ -17,6 +20,10 @@ // TetiSoft: make sure that needed support modules are built in. // Dependencies can be found by searching for FT_Get_Module. +#ifdef FT_USE_T42 +#define FT_USE_TT +#endif + #ifdef FT_USE_TT #define FT_USE_SFNT #endif @@ -65,10 +72,18 @@ FT_USE_MODULE(cff_driver_class) FT_USE_MODULE(t1cid_driver_class) #endif +#ifdef FT_USE_BDF +FT_USE_MODULE(bdf_driver_class) +#endif + #ifdef FT_USE_PCF FT_USE_MODULE(pcf_driver_class) #endif +#ifdef FT_USE_PFR +FT_USE_MODULE(pfr_driver_class) +#endif + #ifdef FT_USE_PSAUX FT_USE_MODULE(psaux_module_class) #endif @@ -97,6 +112,10 @@ FT_USE_MODULE(tt_driver_class) FT_USE_MODULE(t1_driver_class) #endif +#ifdef FT_USE_T42 +FT_USE_MODULE(t42_driver_class) +#endif + #ifdef FT_USE_WINFNT FT_USE_MODULE(winfnt_driver_class) #endif diff --git a/builds/amiga/makefile b/builds/amiga/makefile index 8846c667f..7ca9ca70c 100644 --- a/builds/amiga/makefile +++ b/builds/amiga/makefile @@ -11,15 +11,18 @@ # Your programs source code should start with this # (uncomment the parts you do not need to keep the program small): # ---8<--- -#define FT_USE_AUTOHINT // autohinter -#define FT_USE_RASTER // monochrome rasterizer -#define FT_USE_SMOOTH // anti-aliasing rasterizer -#define FT_USE_TT // truetype font driver -#define FT_USE_T1 // type1 font driver -#define FT_USE_T1CID // cid-keyed type1 font driver -#define FT_USE_CFF // opentype font driver -#define FT_USE_PCF // pcf bitmap font driver -#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver +#define FT_USE_AUTOHINT // autohinter +#define FT_USE_RASTER // monochrome rasterizer +#define FT_USE_SMOOTH // anti-aliasing rasterizer +#define FT_USE_TT // truetype font driver +#define FT_USE_T1 // type1 font driver +#define FT_USE_T42 // type42 font driver +#define FT_USE_T1CID // cid-keyed type1 font driver +#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_PFR // pfr font driver +#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver #include "FT:src/base/ftinit.c" # ---8<--- # @@ -150,6 +153,12 @@ truetype.ppc.o: $(FTSRC)/truetype/truetype.c type1.ppc.o: $(FTSRC)/type1/type1.c $(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 # @@ -157,9 +166,9 @@ type1cid.ppc.o: $(FTSRC)/cid/type1cid.c $(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 $@ $< # @@ -168,6 +177,18 @@ winfnt.ppc.o: $(FTSRC)/winfonts/winfnt.c pcf.ppc.o: $(FTSRC)/pcf/pcf.c $(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 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 -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) $(AR) $@ $(BASEPPC) $(AHINTPPC) $(PSPPC) $(RASTERPPC) sfnt.ppc.o ftcache.ppc.o $(FONTDPPC) diff --git a/builds/amiga/smakefile b/builds/amiga/smakefile index e3dbaf592..ec915081a 100644 --- a/builds/amiga/smakefile +++ b/builds/amiga/smakefile @@ -9,15 +9,18 @@ # Your programs source code should start with this # (uncomment the parts you do not need to keep the program small): # ---8<--- -#define FT_USE_AUTOHINT // autohinter -#define FT_USE_RASTER // monochrome rasterizer -#define FT_USE_SMOOTH // anti-aliasing rasterizer -#define FT_USE_TT // truetype font driver -#define FT_USE_T1 // type1 font driver -#define FT_USE_T1CID // cid-keyed type1 font driver -#define FT_USE_CFF // opentype font driver -#define FT_USE_PCF // pcf bitmap font driver -#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver +#define FT_USE_AUTOHINT // autohinter +#define FT_USE_RASTER // monochrome rasterizer +#define FT_USE_SMOOTH // anti-aliasing rasterizer +#define FT_USE_TT // truetype font driver +#define FT_USE_T1 // type1 font driver +#define FT_USE_T42 // type42 font driver +#define FT_USE_T1CID // cid-keyed type1 font driver +#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_PFR // pfr font driver +#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver #include "FT:src/base/ftinit.c" # ---8<--- # @@ -47,23 +50,12 @@ OBJSFNT = sfnt.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) 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/ @@ -202,6 +194,12 @@ truetype.o: $(CORE)truetype/truetype.c type1.o: $(CORE)type1/type1.c sc $(SCFLAGS) objname=$@ $< +# +# FreeType2 library Type42 font driver +# +type42.o: $(CORE)type42/t42drivr.c + sc $(SCFLAGS) objname=$@ $< + # # freetype library CID-keyed Type1 font driver # @@ -214,9 +212,9 @@ type1cid.o: $(CORE)cid/type1cid.c # 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=$@ $< # @@ -224,3 +222,15 @@ winfnt.o: $(CORE)winfonts/winfnt.c # pcf.o: $(CORE)pcf/pcf.c 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=$@ $< diff --git a/docs/modules.txt b/docs/modules.txt index 74e64cdc4..04f4d120a 100644 --- a/docs/modules.txt +++ b/docs/modules.txt @@ -9,5 +9,6 @@ Note that the use of `psnames' can be controlled in ftconfig.h cid psaux, pshinter, psnames truetype sfnt type1 psaux, pshinter, psnames + type42 truetype psaux psnames sfnt psnames diff --git a/include/freetype/ftbdf.h b/include/freetype/ftbdf.h index fe5f8b61e..c33f9fc21 100644 --- a/include/freetype/ftbdf.h +++ b/include/freetype/ftbdf.h @@ -45,25 +45,29 @@ FT_BEGIN_HEADER /********************************************************************** * - * @function: FT_Get_BDF_Charset_ID + * @function: + * FT_Get_BDF_Charset_ID * * @description: - * retrieves a BDF font character set identity, according to - * the BDF specification + * Retrieves a BDF font character set identity, according to + * the BDF specification. * * @input: - * face :: handle to input face + * face :: + * handle to input face * * @output: - * acharset_encoding :: charset encoding, as a C string owned by the face - * acharset_registry :: charset register, as a C string owned by the face + * acharset_encoding :: + * Charset encoding, as a C string, owned by the face. + * + * acharset_registry :: + * Charset registry, as a C string, owned by the face. * * @return: - * error code. 0 means success + * FreeType rror code. 0 means success. * * @note: - * this function will only work with BDF faces, it will return an - * error otherwise. + * This function only works with BDF faces, returning an error otherwise. */ FT_EXPORT( FT_Error ) FT_Get_BDF_Charset_ID( FT_Face face, diff --git a/include/freetype/t1tables.h b/include/freetype/t1tables.h index 08f245f3d..660ea8a44 100644 --- a/include/freetype/t1tables.h +++ b/include/freetype/t1tables.h @@ -323,50 +323,55 @@ FT_BEGIN_HEADER /************************************************************************ * - * @function: FT_Has_PS_Glyph_Names + * @function: + * FT_Has_PS_Glyph_Names * * @description: - * returns true when a given face provides reliable Postscript glyph - * names. This is similar to using the @FT_HAS_GLYPH_NAMES macro, except - * that certain fonts (mostly TrueType) contain incorrect glyph name - * tables. + * Return true if a given face provides reliable Postscript glyph + * names. This is similar to using the @FT_HAS_GLYPH_NAMES macro, + * except that certain fonts (mostly TrueType) contain incorrect + * glyph name tables. * - * when this function returns true, the caller is sure that the glyph - * names returned by @FT_Get_Glyph_Name are reliable. + * When this function returns true, the caller is sure that the glyph + * names returned by @FT_Get_Glyph_Name are reliable. * * @input: - * face :: face handle + * face :: + * face handle * * @return: - * boolean. true if glyph names are reliable + * Boolean. True if glyph names are reliable. */ 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: - * retrieve the @PS_FontInfoRec structure corresponding to a given - * Postscript font. + * Retrieve the @PS_FontInfoRec structure corresponding to a given + * Postscript font. * * @input: - * face :: postscript face handle + * face :: + * Postscript face handle. * * @output: - * afont_info :: output font info structure pointer + * afont_info :: + * Output font info structure pointer. * * @return: - * error code. 0 means success + * FreeType error code. 0 means success. * * @note: - * the string pointers within the font info structure are owned by - * the face and don't need to be freed by the caller. + * The string pointers within the font info structure are owned by + * the face and don't need to be freed by the caller. * - * if the font's format is not Postscript-based, this function will - * return the @FT_Err_Invalid_Argument error code. + * If the font's format is not Postscript-based, this function will + * return the @FT_Err_Invalid_Argument error code. */ FT_EXPORT( FT_Error ) FT_Get_PS_Font_Info( FT_Face face, diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c index d45a9ee64..2baa498b6 100644 --- a/src/bdf/bdflib.c +++ b/src/bdf/bdflib.c @@ -32,6 +32,7 @@ #include +#include FT_FREETYPE_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_OBJECTS_H @@ -1437,7 +1438,6 @@ char* s; unsigned char* bp; unsigned long i, slen, nibbles; - double ps, rx, dw, sw; _bdf_line_func_t* next; _bdf_parse_t* p; @@ -1740,11 +1740,10 @@ /* the scalable width from the device width. */ FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG9, lineno )); - ps = (double)font->point_size; - rx = (double)font->resolution_x; - dw = (double)glyph->dwidth; - - glyph->swidth = (unsigned short)( ( dw * 72000.0 ) / ( ps * rx ) ); + glyph->swidth = (unsigned short)FT_MulDiv( + glyph->dwidth, 72000L, + (FT_Long)( font->point_size * + font->resolution_x ) ); } p->flags |= _BDF_DWIDTH; @@ -1791,11 +1790,11 @@ if ( p->opts->correct_metrics != 0 ) { /* Determine the point size of the glyph. */ - ps = (double)font->point_size; - rx = (double)font->resolution_x; - dw = (double)glyph->dwidth; + unsigned short sw = (unsigned short)FT_MulDiv( + glyph->dwidth, 72000L, + (FT_Long)( font->point_size * + font->resolution_x ) ); - sw = (unsigned short)( ( dw * 72000.0 ) / ( ps * rx ) ); if ( sw != glyph->swidth ) {