Commit efce08d6 authored by David Turner's avatar David Turner
Browse files

major re-organisation of the FreeType 2 directory hierarchy

parent 5d6b82d9
LASTEST CHANGES - 14-apr-2000
LATEST CHANGES -
- updated the structure of FT_Outline_Funcs in order to allow
direct coordinate scaling within the outline decomposition routine
(this is important for virtual "on" points with TrueType outlines)
+ updates to the rasters to support this..
- updated the OS/2 table loading code in "src/sfnt/ttload.c" in order
to support version 2 of the table (see OpenType 1.2 spec)
- created "include/tttables.h" and "include/t1tables.h" to allow
client applications to access some of the SFNT and T1 tables of a
face with a procedural interface (see FT_Get_Sfnt_Table())
+ updates to internal source files to reflect the change..
- some cleanups in the source code to get rid of warnings when compiling
with the "-Wall -W -ansi -pedantic" options in gcc.
- debugged and moved the smooth renderer to "src/base/ftgrays.c" and
its header to "include/ftgrays.h"
- updated TT_MAX_SUBGLYPHS to 96 as some CJK fonts have composites with
up to 80 sub-glyphs !! Thanks to Werner
================================================================================
OLD CHANGES - 14-apr-2000
- fixed a bug in the TrueType glyph loader that prevented the correct
loading of some CJK glyphs in mingli.ttf
......
#
# FreeType 2 library sub-Makefile
#
# Copyright 1996-2000 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# 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.
# DO NOT INVOKE THIS MAKEFILE DIRECTLY! IT IS MEANT TO BE INCLUDED BY
# OTHER MAKEFILES.
# The targets `objects' and `library' are defined at the end of this
# Makefile when all rules have been included.
#
.PHONY: build_freetype objects library
# default target -- build objects and library
#
build_freetype: objects library
# `multi' target -- build multiple objects and library
#
multi: objects library
# The FreeType source directory.
#
SRC := $(TOP)$(SEP)src
# The directory where the base layer components are placed. By default,
# this is `freetype/src/base'.
#
BASE_DIR := $(SRC)$(SEP)base
# A few short-cuts in order to avoid typing $(SEP) all the time for the
# directory separator.
#
# For example: SRC_ equals to `./src/' where `.' is $(TOP).
#
#
SRC_ := $(SRC)$(SEP)
BASE_ := $(BASE_DIR)$(SEP)
OBJ_ := $(OBJ_DIR)$(SEP)
LIB_ := $(LIB_DIR)$(SEP)
PUBLIC_ := $(TOP)$(SEP)include$(SEP)
CONFIG_ := $(TOP)$(SEP)config$(SEP)
# The name of the final library file.
#
FT_LIBRARY := $(LIB_)$(LIBRARY).$A
# include paths
#
# IMPORTANT NOTE: The architecture-dependent directory must ALWAYS be placed
# in front of the include list. Porters are then able to
# put their own version of some of the FreeType components
# in the `freetype/config/<system>' directory, as these
# files will override the default sources.
#
INCLUDES := $(BUILD) $(TOP)$(SEP)config $(TOP)$(SEP)include $(INCLUDES)
INCLUDE_FLAGS = $(INCLUDES:%=$I%)
# C flags used for the compilation of an object file. This must include at
# least the paths for the `base' and `config/<system>' directories,
# debug/optimization/warning flags + ansi compliance if needed.
#
FT_CFLAGS = $(CFLAGS) $(INCLUDE_FLAGS)
FT_CC = $(CC) $(FT_CFLAGS)
FT_COMPILE = $(CC) $(ANSIFLAGS) $(FT_CFLAGS)
# include the `modules' rules file
#
include $(CONFIG_)modules.mk
# Free the lists of driver objects.
#
COMPONENTS_LIST :=
DRIVERS_LIST :=
OBJECTS_LIST :=
# System-specific component -- this must be defined in this Makefile for
# easy updates. The default ANSI ftsystem.c is located in
# `freetype/config/ftsystem.c'. However, some system-specific configuration
# might define $(FTSYS_SRC) to fetch it in other places, like
# `freetype/config/<system>/ftsystem.c'.
#
# $(BASE_H) is defined in `src/base/rules.mk' and contains the list of all
# base layer header files.
#
ifndef FTSYS_SRC
FTSYS_SRC = $(BASE_)ftsystem.c
endif
FTSYS_OBJ = $(OBJ_)ftsystem.$O
OBJECTS_LIST += $(FTSYS_OBJ)
$(FTSYS_OBJ): $(FTSYS_SRC) $(BASE_H)
$(FT_COMPILE) $T$@ $<
# ftdebug component
#
# FTDebug contains code used to print traces and errors. It is normally
# empty for a release build (see ftoption.h).
#
FTDEBUG_SRC = $(BASE_)ftdebug.c
FTDEBUG_OBJ = $(OBJ_)ftdebug.$O
OBJECTS_LIST += $(FTDEBUG_OBJ)
$(FTDEBUG_OBJ): $(FTDEBUG_SRC) $(BASE_H)
$(FT_COMPILE) $T$@ $<
# Define $(PUBLIC_H) as the list of all public header files located in
# `$(TOP)/include'.
#
PUBLIC_H := $(wildcard $(PUBLIC_)*.h)
# Include all rule files from FreeType components.
#
include $(wildcard $(SRC)/*/rules.mk)
# FTInit file
#
# The C source `ftinit.c' contains the FreeType initialization routines.
# It is able to automatically register one or more drivers when the API
# function FT_Init_FreeType() is called.
#
# The set of initial drivers is determined by the driver Makefiles
# includes above. Each driver Makefile updates the FTINIT_xxxx lists
# which contain additional include paths and macros used to compile the
# single `ftinit.c' source.
#
FTINIT_SRC := $(BASE_)ftinit.c
FTINIT_OBJ := $(OBJ_)ftinit.$O
OBJECTS_LIST += $(FTINIT_OBJ)
$(FTINIT_OBJ): $(FTINIT_SRC) $(BASE_H) $(FT_MODULE_LIST)
$(FT_COMPILE) $T$@ $<
# All FreeType library objects
#
# By default, we include the base layer extensions. These could be
# omitted on builds which do not want them.
#
OBJ_M = $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M)
OBJ_S = $(BASE_OBJ_S) $(BASE_EXT_OBJ) $(DRV_OBJS_S)
# The target `multi' on the Make command line indicates that we want to
# compile each source file independently.
#
# Otherwise, each module/driver is compiled in a single object file through
# source file inclusion (see `src/base/ftbase.c' or
# `src/truetype/truetype.c' for examples).
#
BASE_OBJECTS := $(OBJECTS_LIST)
ifneq ($(findstring multi,$(MAKECMDGOALS)),)
OBJECTS_LIST += $(OBJ_M)
else
OBJECTS_LIST += $(OBJ_S)
endif
objects: $(OBJECTS_LIST)
library: $(FT_LIBRARY)
.c.$O:
$(FT_COMPILE) $T$@ $<
# Standard cleaning and distclean rules. These are not accepted
# on all systems though.
#
clean_freetype_std:
-$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S)
distclean_freetype_std: clean_freetype_std
-$(DELETE) $(FT_LIBRARY)
-$(DELETE) *.orig *~ core *.core
# The Dos command shell does not support very long list of arguments, so
# we are stuck with wildcards.
#
clean_freetype_dos:
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(OBJ_))*.$O 2> nul
distclean_freetype_dos: clean_freetype_dos
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) 2> nul
# Remove configuration file (used for distclean).
#
remove_config_mk:
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(CONFIG_MK))
# The `config.mk' file must define `clean_freetype' and
# `distclean_freetype'. Implementations may use to relay these to either
# the `std' or `dos' versions, or simply provide their own implementation.
#
clean: clean_freetype
distclean: distclean_freetype remove_config_mk
# EOF
......@@ -2,7 +2,6 @@
# FreeType 2 modules sub-Makefile
#
# Copyright 1996-2000 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
......
......@@ -267,8 +267,8 @@ else
$(LINK)
$(BIN_)ftview$E: $(OBJ_)ftview.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ) $(OBJ_)ftrast2.$O
$(GRAPH_LINK) $(OBJ_)ftrast2.$O
$(BIN_)ftview$E: $(OBJ_)ftview.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ) $(OBJ_)ftrast2.$O $(OBJ_)ftrast.$O
$(GRAPH_LINK) $(OBJ_)ftrast2.$O $(OBJ_)ftrast.$O
$(BIN_)ftstring$E: $(OBJ_)ftstring.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ)
$(GRAPH_LINK)
......
......@@ -13,9 +13,7 @@
/* */
/****************************************************************************/
#include "freetype.h"
#include "ftobjs.h"
#include "ftdriver.h"
#include <freetype/freetype.h>
#include <stdio.h>
#include <stdlib.h>
......
......@@ -13,9 +13,7 @@
/* */
/****************************************************************************/
#include "freetype.h"
#include "ftobjs.h"
#include "ftdriver.h"
#include <freetype/freetype.h>
#include <stdio.h>
#include <stdlib.h>
......
......@@ -21,7 +21,7 @@
******************************************************************/
#include "ftrast.h"
#include <ftcalc.h> /* for FT_MulDiv only */
#include <freetype/internal/ftcalc.h> /* for FT_MulDiv only */
/*************************************************************************/
/* */
......@@ -107,7 +107,7 @@
#undef FT_COMPONENT
#define FT_COMPONENT trace_raster
#include <ftdebug.h>
#include <freetype/internal/ftdebug.h>
/* The default render pool size */
......@@ -2941,7 +2941,7 @@ Scan_DropOuts :
#else
#include <ftobjs.h>
#include <freetype/internal/ftobjs.h>
static
int ft_black_new( FT_Memory memory, TRaster_Instance* *araster )
......
#ifndef FTRASTER_H
#define FTRASTER_H
#include <ftimage.h>
#include <freetype/ftimage.h>
extern FT_Raster_Funcs ft_black_raster;
......
......@@ -37,14 +37,35 @@
*
******************************************************************/
#include "ftraster.h"
#include <freetype.h> /* for FT_Outline_Decompose */
#include "ftrast2.h"
#include <freetype/freetype.h> /* for FT_Outline_Decompose */
#ifndef EXPORT_FUNC
#define EXPORT_FUNC /* nothing */
#endif
/**************************************************************************/
/* */
/* We need a 32-bit unsigned word for our optimized 2x2 filter.. The */
/* following uses the ANSI <limits.h> header file to compute exactly */
/* wether to use unsigned int or unsigned long */
/* */
#include <limits.h>
/* The number of bytes in an `int' type. */
#if UINT_MAX == 0xFFFFFFFF
typedef unsigned int Word32;
typedef int Int32;
#elif ULONG_MAX == 0xFFFFFFFF
typedef unsigned long Word32;
typedef long Int32;
#else
#error "could not find a 32-bit word on this machine !!"
#endif
#ifndef _xxFREETYPE_
/**************************************************************************/
......@@ -98,7 +119,7 @@
/* anti-aliasing mode.. Ignored if FT_RASTER_OPTION_ANTI_ALIAS isn't */
/* defined.. */
/* */
#define FT_RASTER_ANTI_ALIAS_17
#undef FT_RASTER_ANTI_ALIAS_17
/**************************************************************************/
/* */
......@@ -250,7 +271,7 @@
/* or high). These are ideals in order to subdivise bezier arcs in halves */
/* though simple additions and shifts. */
typedef long TPos, *PPos;
typedef Int32 TPos, *PPos;
/* The type of a scanline position/coordinate within a map */
......@@ -472,7 +493,7 @@
long grays[20]; /* Palette of gray levels used for render */
int gray_width; /* length in bytes of the onochrome */
int gray_width; /* length in bytes of the monochrome */
/* intermediate scanline of gray_lines. */
/* Each gray pixel takes 2 or 4 bits long */
......@@ -1070,367 +1091,6 @@
#endif
#ifdef FT_RASTER_CONIC_BEZIERS
/****************************************************************************/
/* */
/* <Function> Conic_Up */
/* */
/* <Description> */
/* Computes the scan-line intersections of an ascending second-order */
/* Bezier arc and stores them in the render pool. The arc is taken */
/* from the top of the stack.. */
/* */
/* <Input> */
/* miny :: minimum vertical grid coordinate */
/* maxy :: maximum vertical grid coordinate */
/* */
/* <Return> */
/* SUCCESS or FAILURE */
/* */
/****************************************************************************/
static
TBool Conic_Up( RAS_ARGS TPos miny, TPos maxy )
{
TPos y1, y2, e, e2, e0;
int f1;
TPoint* arc;
TPoint* start_arc;
PPos top;
arc = ras.arc;
y1 = arc[2].y;
y2 = arc[0].y;
top = ras.cursor;
if ( y2 < miny || y1 > maxy )
goto Fin;
e2 = FLOOR( y2 );
if ( e2 > maxy )
e2 = maxy;
e0 = miny;
if ( y1 < miny )
e = miny;
else
{
e = CEILING( y1 );
f1 = FRAC( y1 );
e0 = e;
if ( f1 == 0 )
{
if ( ras.joint )
{
top--;
ras.joint = FALSE;
}
*top++ = arc[2].x;
DEBUG_PSET;
e += ras.precision;
}
}
if ( ras.fresh )
{
ras.cur_prof->start = TRUNC( e0 );
ras.fresh = FALSE;
}
if ( e2 < e )
goto Fin;
if ( ( top+TRUNC(e2-e)+1 ) >= ras.pool_limit )
{
ras.cursor = top;
ras.error = ErrRaster_Overflow;
return FAILURE;
}
start_arc = arc;
while ( arc >= start_arc && e <= e2 )
{
ras.joint = FALSE;
y2 = arc[0].y;
if ( y2 > e )
{
y1 = arc[2].y;
if ( y2 - y1 >= ras.precision_step )
{
Split_Conic( arc );
arc += 2;
}
else
{
*top++ = arc[2].x +
FMulDiv( arc[0].x-arc[2].x,
e - y1,
y2 - y1 );
DEBUG_PSET;
arc -= 2;
e += ras.precision;
}
}
else
{
if ( y2 == e )
{
ras.joint = TRUE;
*top++ = arc[0].x;
DEBUG_PSET;
e += ras.precision;
}
arc -= 2;
}
}
Fin:
ras.cursor = top;
ras.arc -= 2;
return SUCCESS;
}
/****************************************************************************/
/* */
/* <Function> Conic_Down */
/* */
/* <Description> */
/* Computes the scan-line intersections of a descending second-order */
/* Bezier arc and stores them in the render pool. The arc is taken */
/* from the top of the stack.. */
/* */
/* <Input> */
/* miny :: minimum vertical grid coordinate */
/* maxy :: maximum vertical grid coordinate */
/* */
/* <Return> */
/* SUCCESS or FAILURE */
/* */
/****************************************************************************/
static
TBool Conic_Down( RAS_ARGS TPos miny, TPos maxy )
{
TPoint* arc = ras.arc;
TBool result, fresh;
arc[0].y = -arc[0].y;
arc[1].y = -arc[1].y;
arc[2].y = -arc[2].y;
fresh = ras.fresh;
result = Conic_Up( RAS_VARS -maxy, -miny );
if ( fresh && !ras.fresh )
ras.cur_prof->start = -ras.cur_prof->start;
arc[0].y = -arc[0].y;
return result;
}
#endif /* FT_RASTER_CONIC_BEZIERS */
#ifdef FT_RASTER_CUBIC_BEZIERS
/****************************************************************************/
/* */
/* <Function> Cubic_Up */
/* */
/* <Description> */
/* Computes the scan-line intersections of an ascending third-order */
/* bezier arc and stores them in the render pool */
/* */
/* <Input> */
/* miny :: minimum vertical grid coordinate */
/* maxy :: maximum vertical grid coordinate */
/* */
/* <Return> */
/* SUCCESS or FAILURE */
/* */
/****************************************************************************/
static
TBool Cubic_Up( RAS_ARGS TPos miny, TPos maxy )
{
TPos y1, y2, e, e2, e0;
int f1;
TPoint* arc;
TPoint* start_arc;
TPos* top;
arc = ras.arc;
y1 = arc[3].y;
y2 = arc[0].y;
top = ras.cursor;
if ( y2 < miny || y1 > maxy )
goto Fin;
e2 = FLOOR( y2 );
if ( e2 > maxy )
e2 = maxy;
e0 = miny;
if ( y1 < miny )
e = miny;
else
{
e = CEILING( y1 );
f1 = FRAC( y1 );
e0 = e;