Add full FreeType support for Xprint. (Drew Parsons)

This commit is contained in:
Daniel Stone 2006-03-31 07:21:41 +00:00
parent 759033703c
commit 4c317bbc12
5 changed files with 58 additions and 37 deletions

View File

@ -1,3 +1,11 @@
2006-03-31 Daniel Stone <daniel@freedesktop.org>
* configure.ac:
* Xprint/Makefile.am:
* Xprint/ps/Makefile.am:
* Xprint/ps/psout_ftpstype3.c:
Add full FreeType support for Xprint. (Drew Parsons)
2006-03-30 Eric Anholt <anholt@FreeBSD.org>
* exa/exa.c: (exaValidateGC):

View File

@ -11,7 +11,8 @@ Xprt_LDFLAGS = -L$(top_srcdir)
Xprt_LDADD = @XPRINT_LIBS@ ps/libps.la raster/libraster.la \
pcl/libpcl.la pcl-mono/libpcl.la \
../mfb/libmfb.la ../mi/libmi.la \
../cfb32/libcfb32.la ../cfb/libcfb.la ../Xext/libXext.la
../cfb32/libcfb32.la ../cfb/libcfb.la ../Xext/libXext.la \
@FREETYPE_LIBS@
miinitext-wrapper.c:
echo "#include \"$(top_srcdir)/mi/miinitext.c\"" >> $@

View File

@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libps.la
INCLUDES = -I$(top_srcdir)/Xprint -I$(top_srcdir)/cfb -I$(top_srcdir)/mfb
AM_CFLAGS = @SERVER_DEFINES@ @DIX_CFLAGS@ @XPRINT_CFLAGS@ \
AM_CFLAGS = @SERVER_DEFINES@ @DIX_CFLAGS@ @XPRINT_CFLAGS@ @FREETYPE_CFLAGS@ \
-D_XP_PRINT_SERVER_ -DPSZ=8 -DXP_PSTEXT
libps_la_SOURCES = \
@ -35,3 +35,8 @@ EXTRA_DIST = PsFTFonts.c \
psout_ftpstype1.c \
psout_ftpstype3.c \
ttf2pt1wrap.c
if XP_USE_FREETYPE
AM_CFLAGS += -DXP_USE_FREETYPE
libps_la_SOURCES += $(EXTRA_DIST)
endif

View File

@ -55,13 +55,6 @@ THE SOFTWARE.
#include FT_MULTIPLE_MASTERS_H
#include FT_SFNT_NAMES_H
#define USE_FT_INTERNALS 1
#ifdef USE_FT_INTERNALS
#include FT_INTERNAL_TYPE1_TYPES_H
#include "t42types.h"
#include FT_INTERNAL_OBJECTS_H
#endif /* USE_FT_INTERNALS */
#include <X11/Xproto.h>
#include <X11/fonts/font.h>
#include <X11/fonts/fontstruct.h>
@ -287,28 +280,6 @@ FT_Error PSType3_createOutlineGlyphs( FILE *out, struct ft2info *ti, unsigned lo
return 0;
}
#ifdef USE_FT_INTERNALS
static FT_BBox *
FT_Get_PS_Font_BBox( FT_Face face )
{
const char *driver_name;
FT_BBox *font_bbox = NULL;
if ( face && face->driver && face->driver->root.clazz )
{
driver_name = face->driver->root.clazz->module_name;
if ( ft_strcmp( driver_name, "type1" ) == 0 )
font_bbox = &(((T1_Face)face)->type1.font_bbox);
else if ( ft_strcmp( driver_name, "t1cid" ) == 0 )
font_bbox = &(((CID_Face)face)->cid.font_bbox);
else if ( ft_strcmp( driver_name, "type42" ) == 0 )
font_bbox = &(((T42_Face)face)->type1.font_bbox);
}
return font_bbox;
}
#endif /* USE_FT_INTERNALS */
static
int PSType3_generateOutlineFont(FILE *out, const char *psfontname, struct ft2info *ti, long block_offset)
{
@ -362,12 +333,12 @@ int PSType3_generateOutlineFont(FILE *out, const char *psfontname, struct ft2inf
}
else
{
FT_BBox *font_bbox = FT_Get_PS_Font_BBox(ti->ttface);
fprintf(out, "/FontBBox [%d %d %d %d] def\n",
(int)font_bbox->xMin,
(int)font_bbox->yMin,
(int)font_bbox->xMax,
(int)font_bbox->yMax);
fprintf(out, "/FontBBox [%ld %ld %ld %ld] def\n",
ti->ttface->bbox.xMin,
ti->ttface->bbox.yMin,
ti->ttface->bbox.xMax,
ti->ttface->bbox.yMax);
}
fprintf(out, "/Encoding [\n");

View File

@ -1285,6 +1285,42 @@ if test "x$XPRINT" = xyes; then
AC_PATH_PROG(MKFONTSCALE, mkfontscale)
AC_PATH_PROG(MKFONTDIR, mkfontdir)
# freetype support code borrowed from lib/XFont
AC_ARG_ENABLE(freetype, [ --disable-freetype],[XP_USE_FREETYPE=$enableval],[XP_USE_FREETYPE=yes])
AM_CONDITIONAL(XP_USE_FREETYPE, [test x$XP_USE_FREETYPE = xyes])
if test x$XP_USE_FREETYPE = xyes; then
AC_DEFINE(XP_USE_FREETYPE,1,[Support FreeType rasterizer in Xprint for nearly all font file formats])
AC_ARG_WITH(freetype-config, [ --with-freetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=auto)
if test "$freetype_config" = "auto" ; then
PKG_CHECK_MODULES(FREETYPE, freetype2,
freetype_config=no, freetype_config=yes)
fi
if test "$freetype_config" = "yes"; then
AC_PATH_PROG(ft_config,freetype-config,no)
if test "$ft_config" = "no"; then
AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/])
fi
else
ft_config="$freetype_config"
fi
if test "$freetype_config" != "no"; then
FREETYPE_CFLAGS="`$ft_config --cflags`"
FREETYPE_LIBS="`$ft_config --libs`"
fi
FREETYPE_REQUIRES="freetype2"
else
FREETYPE_CFLAGS=""
FREETYPE_LIBS=""
FREETYPE_REQUIRES=""
fi
AC_SUBST(FREETYPE_LIBS)
AC_SUBST(FREETYPE_CFLAGS)
AC_SUBST(FREETYPE_REQUIRES)
# end freetype support
fi