ref: 02d4d59ac03aa79cafca124db6aa29030e6df55d
parent: 2a4fa1340e9bd585b61d8b0cad4c24fa1cb38682
author: Werner Lemberg <[email protected]>
date: Tue May 28 18:38:05 EDT 2002
* 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'.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,27 +1,36 @@
+2002-05-28 Detlef W�rkner <[email protected]>
+
+ * 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 <[email protected]>
- * 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 <[email protected]>
@@ -28,6 +37,9 @@
* src/base/ftnames.c (FT_Get_Sfnt_Name): Don't use FT_STREAM_READ_AT
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 <[email protected]>
--- 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(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
@@ -95,6 +110,10 @@
#ifdef FT_USE_T1
FT_USE_MODULE(t1_driver_class)
+#endif
+
+#ifdef FT_USE_T42
+FT_USE_MODULE(t42_driver_class)
#endif
#ifdef FT_USE_WINFNT
--- 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<---
#
@@ -151,6 +154,12 @@
$(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
#
type1cid.ppc.o: $(FTSRC)/cid/type1cid.c
@@ -157,9 +166,9 @@
$(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 @@
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 @@
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)
--- 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 @@
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/
@@ -203,6 +195,12 @@
sc $(SCFLAGS) objname=$@ $<
#
+# FreeType2 library Type42 font driver
+#
+type42.o: $(CORE)type42/t42drivr.c
+ sc $(SCFLAGS) objname=$@ $<
+
+#
# freetype library CID-keyed Type1 font driver
#
type1cid.o: $(CORE)cid/type1cid.c
@@ -214,9 +212,9 @@
# 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=$@ $<
#
@@ -223,4 +221,16 @@
# freetype library PCF bitmap font driver
#
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=$@ $<
--- a/docs/modules.txt
+++ b/docs/modules.txt
@@ -9,5 +9,6 @@
cid psaux, pshinter, psnames
truetype sfnt
type1 psaux, pshinter, psnames
+ type42 truetype
psaux psnames
sfnt psnames
--- a/include/freetype/ftbdf.h
+++ b/include/freetype/ftbdf.h
@@ -45,25 +45,29 @@
/**********************************************************************
*
- * @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,
--- a/include/freetype/t1tables.h
+++ b/include/freetype/t1tables.h
@@ -323,50 +323,55 @@
/************************************************************************
*
- * @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,
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -32,6 +32,7 @@
#include <ft2build.h>
+#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 )
{