Updated freetype to Freetype 2.1.8-CVS-20040206 in an attempt to fix some of the autohinting issues present in our version, does it help?

svn path=/trunk/; revision=8064
This commit is contained in:
Richard Campbell 2004-02-06 21:53:11 +00:00
parent 4ed1751218
commit 5c75940f98
189 changed files with 32326 additions and 13040 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
# FreeType 2 top Jamfile (c) 2001, 2002, 2003 David Turner
# FreeType 2 top Jamfile (c) 2001, 2002, 2003, 2004 David Turner
#
# The HDRMACRO is already defined in FTJam and is used to add
@ -61,7 +61,8 @@ FT2_BUILD_INCLUDE ?= ;
# IMPORTANT: You'll need to change the content of "ftmodule.h" as well
# if you modify this list or provide your own.
#
FT2_COMPONENTS ?= gzip # support for gzip-compressed files
FT2_COMPONENTS ?= autofit # auto-fitter
gzip # support for gzip-compressed files
autohint # auto-hinter
base # base component (public APIs)
bdf # BDF font driver
@ -146,7 +147,7 @@ if $(DEBUG_HINTER)
actions RefDoc
{
python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 --title=FreeType-2.1.5 --output=$(DOC_DIR) $(FT2_INCLUDE)/freetype/*.h $(FT2_INCLUDE)/freetype/config/*.h $(FT2_INCLUDE)/freetype/cache/*.h
python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 --title=FreeType-2.1.8 --output=$(DOC_DIR) $(FT2_INCLUDE)/freetype/*.h $(FT2_INCLUDE)/freetype/config/*.h $(FT2_INCLUDE)/freetype/cache/*.h
}
RefDoc refdoc ;

View file

@ -9,7 +9,7 @@
is called `libttf'. They are *not* compatible!
FreeType 2.1.5
FreeType 2.1.8
==============
Please read the docs/CHANGES file, it contains IMPORTANT INFORMATION.
@ -19,9 +19,9 @@
Note that the FreeType 2 documentation is now available as a
separate package from our sites. See:
ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.5.tar.bz2
ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.5.tar.gz
ftp://ftp.freetype.org/pub/freetype2/ftdoc215.zip
ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.8.tar.bz2
ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.8.tar.gz
ftp://ftp.freetype.org/pub/freetype2/ftdoc218.zip
Bugs

View file

@ -97,6 +97,7 @@ BASE_DIR := $(SRC_DIR)/base
#
PUBLIC_DIR := $(TOP_DIR)/include/freetype
INTERNAL_DIR := $(PUBLIC_DIR)/internal
SERVICES_DIR := $(INTERNAL_DIR)/services
CONFIG_DIR := $(PUBLIC_DIR)/config
CACHE_DIR := $(PUBLIC_DIR)/cache
@ -155,7 +156,8 @@ OBJECTS_LIST :=
# changes, the whole library is recompiled.
#
PUBLIC_H := $(wildcard $(PUBLIC_DIR)/*.h)
BASE_H := $(wildcard $(INTERNAL_DIR)/*.h)
BASE_H := $(wildcard $(INTERNAL_DIR)/*.h) \
$(wildcard $(SERVICES_DIR)/*.h)
CONFIG_H := $(wildcard $(CONFIG_DIR)/*.h) \
$(wildcard $(BUILD_DIR)/freetype/config/*.h)
CACHE_H := $(wildcard $(CACHE_DIR)/*.h)
@ -252,7 +254,7 @@ library: $(PROJECT_LIBRARY)
refdoc:
python $(SRC_DIR)/tools/docmaker/docmaker.py \
--prefix=ft2 \
--title=FreeType-2.1.5 \
--title=FreeType-2.1.7 \
--output=$(DOC_DIR) \
$(PUBLIC_DIR)/*.h \
$(PUBLIC_DIR)/config/*.h \

View file

@ -110,6 +110,7 @@ ifdef check_platform
$(RM) builds/unix/config.status
$(RM) builds/unix/unix-def.mk
$(RM) builds/unix/unix-cc.mk
$(RM) builds/unix/freetype2.pc
$(RM) nul
endif # test is_unix

View file

@ -6,3 +6,4 @@ config.log
libtool
ftconfig.h
freetype-config
freetype2.pc

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
timestamp='2003-01-10'
timestamp='2003-10-16'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -106,6 +106,7 @@ trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
@ -220,6 +221,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
mvmeppc:OpenBSD:*:*)
echo powerpc-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pegasos:OpenBSD:*:*)
echo powerpc-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
@ -235,74 +239,56 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:MicroBSD:*:*)
echo ${UNAME_MACHINE}-unknown-microbsd${UNAME_RELEASE}
exit 0 ;;
alpha:OSF1:*:*)
if test $UNAME_RELEASE = "V4.0"; then
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
fi
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0.
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in
"EV4 (21064)")
UNAME_MACHINE="alpha" ;;
"EV4.5 (21064)")
UNAME_MACHINE="alpha" ;;
"LCA4 (21066/21068)")
UNAME_MACHINE="alpha" ;;
"EV5 (21164)")
UNAME_MACHINE="alphaev5" ;;
"EV5.6 (21164A)")
UNAME_MACHINE="alphaev56" ;;
"EV5.6 (21164PC)")
UNAME_MACHINE="alphapca56" ;;
"EV5.7 (21164PC)")
UNAME_MACHINE="alphapca57" ;;
"EV6 (21264)")
UNAME_MACHINE="alphaev6" ;;
"EV6.7 (21264A)")
UNAME_MACHINE="alphaev67" ;;
"EV6.8CB (21264C)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8AL (21264B)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8CX (21264D)")
UNAME_MACHINE="alphaev68" ;;
"EV6.9A (21264/EV69A)")
UNAME_MACHINE="alphaev69" ;;
"EV7 (21364)")
UNAME_MACHINE="alphaev7" ;;
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
esac
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
eval $set_cc_for_build
cat <<EOF >$dummy.s
.data
\$Lformat:
.byte 37,100,45,37,120,10,0 # "%d-%x\n"
.text
.globl main
.align 4
.ent main
main:
.frame \$30,16,\$26,0
ldgp \$29,0(\$27)
.prologue 1
.long 0x47e03d80 # implver \$0
lda \$2,-1
.long 0x47e20c21 # amask \$2,\$1
lda \$16,\$Lformat
mov \$0,\$17
not \$1,\$18
jsr \$26,printf
ldgp \$29,0(\$26)
mov 0,\$16
jsr \$26,exit
.end main
EOF
$CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
if test "$?" = 0 ; then
case `$dummy` in
0-0)
UNAME_MACHINE="alpha"
;;
1-0)
UNAME_MACHINE="alphaev5"
;;
1-1)
UNAME_MACHINE="alphaev56"
;;
1-101)
UNAME_MACHINE="alphapca56"
;;
2-303)
UNAME_MACHINE="alphaev6"
;;
2-307)
UNAME_MACHINE="alphaev67"
;;
2-1307)
UNAME_MACHINE="alphaev68"
;;
3-1307)
UNAME_MACHINE="alphaev7"
;;
esac
fi
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
Alpha*:OpenVMS:*:*)
echo alpha-hp-vms
exit 0 ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
@ -324,6 +310,9 @@ EOF
*:OS/390:*:*)
echo i370-ibm-openedition
exit 0 ;;
*:OS400:*:*)
echo powerpc-ibm-os400
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
@ -341,6 +330,9 @@ EOF
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6
exit 0 ;;
DRS?6000:UNIX_SV:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7 && exit 0 ;;
@ -748,7 +740,7 @@ EOF
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
*:UNICOS/mp:*:*)
echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
@ -756,6 +748,11 @@ EOF
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
@ -777,7 +774,10 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
# GNU/KFreeBSD systems have a "k" prefix to indicate we are using
# FreeBSD's kernel, but not the complete OS.
case ${LIBC} in gnu) kernel_only='k' ;; esac
echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
exit 0 ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
@ -788,8 +788,8 @@ EOF
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit 0 ;;
x86:Interix*:3*)
echo i586-pc-interix3
x86:Interix*:[34]*)
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
exit 0 ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
@ -810,14 +810,22 @@ EOF
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
exit 0 ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit 0 ;;
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
exit 0 ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
@ -896,6 +904,9 @@ EOF
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit 0 ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
@ -953,6 +964,9 @@ EOF
LIBC=gnuaout
#endif
#endif
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
@ -1054,7 +1068,7 @@ EOF
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0)
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@ -1169,7 +1183,7 @@ EOF
*:QNX:*:4*)
echo i386-pc-qnx
exit 0 ;;
NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
NSR-[DGKLNPTVWY]:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit 0 ;;
*:NonStop-UX:*:*)
@ -1210,6 +1224,9 @@ EOF
*:ITS:*:*)
echo pdp10-unknown-its
exit 0 ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2

View file

@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
timestamp='2003-01-03'
timestamp='2003-11-03'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -118,7 +118,8 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@ -228,13 +229,14 @@ case $basic_machine in
| a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| clipper \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k \
| ip2k | iq2000 \
| m32r | m68000 | m68k | m88k | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
@ -247,6 +249,7 @@ case $basic_machine in
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
@ -257,11 +260,11 @@ case $basic_machine in
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic80 | tron \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
| we32k \
| x86 | xscale | xstormy16 | xtensa \
@ -296,7 +299,7 @@ case $basic_machine in
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
| bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| clipper-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
@ -304,7 +307,7 @@ case $basic_machine in
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* \
| ip2k-* | iq2000-* \
| m32r-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
@ -319,6 +322,7 @@ case $basic_machine in
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
@ -329,11 +333,13 @@ case $basic_machine in
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
@ -371,6 +377,9 @@ case $basic_machine in
basic_machine=a29k-none
os=-bsd
;;
amd64)
basic_machine=x86_64-pc
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
@ -735,6 +744,10 @@ case $basic_machine in
basic_machine=or32-unknown
os=-coff
;;
os400)
basic_machine=powerpc-ibm
os=-os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=-ose
@ -766,18 +779,24 @@ case $basic_machine in
pentiumpro | p6 | 6x86 | athlon | athlon_*)
basic_machine=i686-pc
;;
pentiumii | pentium2)
pentiumii | pentium2 | pentiumiii | pentium3)
basic_machine=i686-pc
;;
pentium4)
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumii-* | pentium2-*)
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium4-*)
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
;;
@ -836,6 +855,10 @@ case $basic_machine in
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
sei)
basic_machine=mips-sei
os=-seiux
;;
sequent)
basic_machine=i386-sequent
;;
@ -843,6 +866,9 @@ case $basic_machine in
basic_machine=sh-hitachi
os=-hms
;;
sh64)
basic_machine=sh64-unknown
;;
sparclite-wrs | simso-wrs)
basic_machine=sparclite-wrs
os=-vxworks
@ -917,14 +943,18 @@ case $basic_machine in
basic_machine=t90-cray
os=-unicos
;;
tic4x | c4x*)
basic_machine=tic4x-unknown
os=-coff
;;
tic54x | c54x*)
basic_machine=tic54x-unknown
os=-coff
;;
tic55x | c55x*)
basic_machine=tic55x-unknown
os=-coff
;;
tic6x | c6x*)
basic_machine=tic6x-unknown
os=-coff
;;
tx39)
basic_machine=mipstx39-unknown
;;
@ -938,6 +968,10 @@ case $basic_machine in
tower | tower-32)
basic_machine=m68k-ncr
;;
tpf)
basic_machine=s390x-ibm
os=-tpf
;;
udi29k)
basic_machine=a29k-amd
os=-udi
@ -1027,7 +1061,7 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sh64)
@ -1106,19 +1140,19 @@ case $os in
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -microbsd*)
| -powermax* | -dnix* | -nx6 | -nx7 | -sei*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@ -1142,6 +1176,9 @@ case $os in
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
-linux-dietlibc)
os=-linux-dietlibc
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
@ -1154,6 +1191,9 @@ case $os in
-opened*)
os=-openedition
;;
-os400*)
os=-os400
;;
-wince*)
os=-wince
;;
@ -1197,6 +1237,9 @@ case $os in
-sinix*)
os=-sysv4
;;
-tpf*)
os=-tpf
;;
-triton*)
os=-sysv3
;;
@ -1227,6 +1270,12 @@ case $os in
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint
;;
-aros*)
os=-aros
;;
-kaos*)
os=-kaos
;;
-none)
;;
*)
@ -1258,6 +1307,9 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
c4x-* | tic4x-*)
os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
@ -1436,9 +1488,15 @@ case $basic_machine in
-mvs* | -opened*)
vendor=ibm
;;
-os400*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-tpf*)
vendor=ibm
;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;

File diff suppressed because it is too large Load diff

View file

@ -1,91 +1,121 @@
dnl This file is part of the FreeType project.
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
# This file is part of the FreeType project.
#
# Process this file with autoconf to produce a configure script.
AC_INIT
AC_CONFIG_SRCDIR([ftconfig.in])
dnl configuration file -- stay in 8.3 limit
AC_CONFIG_HEADER(ftconfig.h:ftconfig.in)
dnl Don't forget to update VERSION.DLL!
version_info='9:4:3'
AC_SUBST(version_info)
# Don't forget to update docs/VERSION.DLL!
version_info='9:6:3'
AC_SUBST([version_info])
ft_version=`echo $version_info | tr : .`
AC_SUBST(ft_version)
AC_SUBST([ft_version])
dnl checks for system type
AC_CANONICAL_TARGET([])
dnl checks for programs
# checks for system type
AC_CANONICAL_TARGET
# checks for programs
AC_PROG_CC
AC_PROG_CPP
dnl get Compiler flags right.
# get compiler flags right
if test "x$CC" = xgcc; then
XX_CFLAGS="-Wall"
XX_ANSIFLAGS="-pedantic -ansi"
else
case "$host" in
*-dec-osf*)
CFLAGS=
XX_CFLAGS="-std1 -g3"
XX_ANSIFLAGS=
;;
*)
XX_CFLAGS=
XX_ANSIFLAGS=
;;
*-dec-osf*)
CFLAGS=
XX_CFLAGS="-std1 -g3"
XX_ANSIFLAGS=
;;
*)
XX_CFLAGS=
XX_ANSIFLAGS=
;;
esac
fi
AC_SUBST(XX_CFLAGS)
AC_SUBST(XX_ANSIFLAGS)
AC_SUBST([XX_CFLAGS])
AC_SUBST([XX_ANSIFLAGS])
AC_CHECK_PROG(RMF, rm, rm -f)
AC_CHECK_PROG(RMDIR, rmdir, rmdir)
dnl Since this file will be finally moved to another directory we make
dnl the path of the install script absolute. This small code snippet has
dnl been taken from automake's `ylwrap' script.
# auxiliary programs
AC_CHECK_PROG([RMF], [rm], [rm -f])
AC_CHECK_PROG([RMDIR], [rmdir], [rmdir])
# Since this file will be finally moved to another directory we make
# the path of the install script absolute. This small code snippet has
# been taken from automake's `ylwrap' script.
AC_PROG_INSTALL
case "$INSTALL" in
/*)
;;
*/*)
INSTALL="`pwd`/$INSTALL" ;;
/*)
;;
*/*)
INSTALL="`pwd`/$INSTALL" ;;
esac
dnl checks for header files
# checks for header files
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h)
AC_CHECK_HEADERS([fcntl.h unistd.h])
# checks for typedefs, structures, and compiler characteristics
dnl checks for typedefs, structures, and compiler characteristics
AC_C_CONST
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long])
dnl checks for library functions
dnl Here we check whether we can use our mmap file component.
# checks for library functions
# Here we check whether we can use our mmap file component.
AC_FUNC_MMAP
if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
FTSYS_SRC='$(BASE_DIR)/ftsystem.c'
else
FTSYS_SRC='$(BUILD_DIR)/ftsystem.c'
FT_MUNMAP_DECL
AC_CHECK_DECLS([munmap],
[],
[],
[
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/mman.h>
])
FT_MUNMAP_PARAM
fi
AC_SUBST(FTSYS_SRC)
AC_SUBST([FTSYS_SRC])
AC_CHECK_FUNCS(memcpy memmove)
AC_CHECK_FUNCS([memcpy memmove])
dnl Check for system zlib
AC_ARG_WITH(zlib,
[ --without-zlib use internal zlib instead of system-wide])
# Check for system zlib
AC_ARG_WITH([zlib],
dnl don't quote AS_HELP_STRING!
AS_HELP_STRING([--without-zlib],
[use internal zlib instead of system-wide]))
if test x$with_zlib != xno && test -z "$LIBZ"; then
AC_CHECK_LIB(z, gzsetparams, [AC_CHECK_HEADER(zlib.h, LIBZ='-lz')])
AC_CHECK_LIB([z], [gzsetparams], [AC_CHECK_HEADER([zlib.h], [LIBZ='-lz'])])
fi
if test x$with_zlib != xno && test -n "$LIBZ"; then
CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB"
@ -93,9 +123,13 @@ if test x$with_zlib != xno && test -n "$LIBZ"; then
SYSTEM_ZLIB=yes
fi
dnl Whether to use Mac OS resource-based fonts or not
AC_ARG_WITH(old-mac-fonts,
[ --with-old-mac-fonts allow Mac resource-based fonts to be used])
# Whether to use Mac OS resource-based fonts or not
AC_ARG_WITH([old-mac-fonts],
dnl don't quote AS_HELP_STRING!
AS_HELP_STRING([--with-old-mac-fonts],
[allow Mac resource-based fonts to be used]))
if test x$with_old_mac_fonts = xyes; then
CFLAGS="$CFLAGS -DTARGET_API_MAC_CARBON"
LDFLAGS="$LDFLAGS -Xlinker -framework -Xlinker CoreServices \
@ -104,25 +138,38 @@ else
CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"
fi
AC_SUBST(LIBZ)
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(SYSTEM_ZLIB)
AC_SUBST([LIBZ])
AC_SUBST([CFLAGS])
AC_SUBST([LDFLAGS])
AC_SUBST([SYSTEM_ZLIB])
AC_PROG_LIBTOOL
dnl create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
dnl and 'builds/unix/unix-cc.mk' that will be used by the build system
dnl
# configuration file -- stay in 8.3 limit
#
# since #undef doesn't survive in configuration header files we replace
# `/undef' with `#undef' after creating the output file
AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in],
[mv ftconfig.h ftconfig.tmp
sed 's|/undef|#undef|' < ftconfig.tmp > ftconfig.h
rm ftconfig.tmp])
# create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
# and 'builds/unix/unix-cc.mk' that will be used by the build system
#
AC_CONFIG_FILES([unix-cc.mk:unix-cc.in
unix-def.mk:unix-def.in
freetype-config
freetype2.pc:freetype2.in])
dnl re-generate the Jamfile to use libtool now
dnl
dnl AC_CONFIG_FILES([../../Jamfile:../../Jamfile.in])
# re-generate the Jamfile to use libtool now
#
# AC_CONFIG_FILES([../../Jamfile:../../Jamfile.in])
AC_OUTPUT
dnl end of configure.ac
# end of configure.ac

View file

@ -1,88 +1,104 @@
# Configure paths for FreeType2
# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
#
# serial 2
dnl AC_CHECK_FT2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for FreeType2, and define FT2_CFLAGS and FT2_LIBS
dnl
AC_DEFUN(AC_CHECK_FT2,
[dnl
dnl Get the cflags and libraries from the freetype-config script
dnl
AC_ARG_WITH(ft-prefix,
[ --with-ft-prefix=PREFIX
Prefix where FreeType is installed (optional)],
ft_config_prefix="$withval", ft_config_prefix="")
AC_ARG_WITH(ft-exec-prefix,
[ --with-ft-exec-prefix=PREFIX
Exec prefix where FreeType is installed (optional)],
ft_config_exec_prefix="$withval", ft_config_exec_prefix="")
AC_ARG_ENABLE(freetypetest,
[ --disable-freetypetest Do not try to compile and run
a test FreeType program],
[], enable_fttest=yes)
# AC_CHECK_FT2([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
# Test for FreeType 2, and define FT2_CFLAGS and FT2_LIBS.
# MINIMUM-VERSION is what libtool reports; the default is `7.0.1' (this is
# FreeType 2.0.4).
#
AC_DEFUN([AC_CHECK_FT2],
[# Get the cflags and libraries from the freetype-config script
#
AC_ARG_WITH([ft-prefix],
dnl don't quote AS_HELP_STRING!
AS_HELP_STRING([--with-ft-prefix=PREFIX],
[Prefix where FreeType is installed (optional)]),
[ft_config_prefix="$withval"],
[ft_config_prefix=""])
if test x$ft_config_exec_prefix != x ; then
ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
if test x${FT2_CONFIG+set} != xset ; then
FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
fi
fi
if test x$ft_config_prefix != x ; then
ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
if test x${FT2_CONFIG+set} != xset ; then
FT2_CONFIG=$ft_config_prefix/bin/freetype-config
fi
fi
AC_PATH_PROG(FT2_CONFIG, freetype-config, no)
AC_ARG_WITH([ft-exec-prefix],
dnl don't quote AS_HELP_STRING!
AS_HELP_STRING([--with-ft-exec-prefix=PREFIX],
[Exec prefix where FreeType is installed (optional)]),
[ft_config_exec_prefix="$withval"],
[ft_config_exec_prefix=""])
AC_ARG_ENABLE([freetypetest],
dnl don't quote AS_HELP_STRING!
AS_HELP_STRING([--disable-freetypetest],
[Do not try to compile and run a test FreeType program]),
[],
[enable_fttest=yes])
if test x$ft_config_exec_prefix != x ; then
ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
if test x${FT2_CONFIG+set} != xset ; then
FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
fi
fi
if test x$ft_config_prefix != x ; then
ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
if test x${FT2_CONFIG+set} != xset ; then
FT2_CONFIG=$ft_config_prefix/bin/freetype-config
fi
fi
AC_PATH_PROG([FT2_CONFIG], [freetype-config], [no])
min_ft_version=m4_if([$1], [], [7.0.1], [$1])
AC_MSG_CHECKING([for FreeType -- version >= $min_ft_version])
no_ft=""
if test "$FT2_CONFIG" = "no" ; then
no_ft=yes
else
FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
ft_min_major_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ft_min_minor_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
ft_min_micro_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test x$enable_fttest = xyes ; then
ft_config_is_lt=""
if test $ft_config_major_version -lt $ft_min_major_version ; then
ft_config_is_lt=yes
else
if test $ft_config_major_version -eq $ft_min_major_version ; then
if test $ft_config_minor_version -lt $ft_min_minor_version ; then
ft_config_is_lt=yes
else
if test $ft_config_minor_version -eq $ft_min_minor_version ; then
if test $ft_config_micro_version -lt $ft_min_micro_version ; then
ft_config_is_lt=yes
fi
fi
fi
fi
fi
if test x$ft_config_is_lt = xyes ; then
no_ft=yes
else
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $FT2_CFLAGS"
LIBS="$FT2_LIBS $LIBS"
#
# Sanity checks for the results of freetype-config to some extent.
#
AC_RUN_IFELSE([
AC_LANG_SOURCE([[
min_ft_version=ifelse([$1], ,6.1.0,$1)
AC_MSG_CHECKING(for FreeType - version >= $min_ft_version)
no_ft=""
if test "$FT2_CONFIG" = "no" ; then
no_ft=yes
else
FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
ft_min_major_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ft_min_minor_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
ft_min_micro_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test x$enable_fttest = xyes ; then
ft_config_is_lt=""
if test $ft_config_major_version -lt $ft_min_major_version ; then
ft_config_is_lt=yes
else
if test $ft_config_major_version -eq $ft_min_major_version ; then
if test $ft_config_minor_version -lt $ft_min_minor_version ; then
ft_config_is_lt=yes
else
if test $ft_config_minor_version -eq $ft_min_minor_version ; then
if test $ft_config_micro_version -lt $ft_min_micro_version ; then
ft_config_is_lt=yes
fi
fi
fi
fi
fi
if test x$ft_config_is_lt = xyes ; then
no_ft=yes
else
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $FT2_CFLAGS"
LIBS="$FT2_LIBS $LIBS"
dnl
dnl Sanity checks for the results of freetype-config to some extent
dnl
AC_TRY_RUN([
#include <ft2build.h>
#include FT_FREETYPE_H
#include <stdio.h>
@ -92,7 +108,7 @@ int
main()
{
FT_Library library;
FT_Error error;
FT_Error error;
error = FT_Init_FreeType(&library);
@ -104,40 +120,59 @@ main()
return 0;
}
}
],, no_ft=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi # test $ft_config_version -lt $ft_min_version
fi # test x$enable_fttest = xyes
fi # test "$FT2_CONFIG" = "no"
if test x$no_ft = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$FT2_CONFIG" = "no" ; then
echo "*** The freetype-config script installed by FreeType 2 could not be found."
echo "*** If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the FT2_CONFIG environment variable to the"
echo "*** full path to freetype-config."
]])
],
[],
[no_ft=yes],
[echo $ECHO_N "cross compiling; assuming OK... $ECHO_C"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi # test $ft_config_version -lt $ft_min_version
fi # test x$enable_fttest = xyes
fi # test "$FT2_CONFIG" = "no"
if test x$no_ft = x ; then
AC_MSG_RESULT([yes])
m4_if([$2], [], [:], [$2])
else
if test x$ft_config_is_lt = xyes ; then
echo "*** Your installed version of the FreeType 2 library is too old."
echo "*** If you have different versions of FreeType 2, make sure that"
echo "*** correct values for --with-ft-prefix or --with-ft-exec-prefix"
echo "*** are used, or set the FT2_CONFIG environment variable to the"
echo "*** full path to freetype-config."
AC_MSG_RESULT([no])
if test "$FT2_CONFIG" = "no" ; then
AC_MSG_WARN([
The freetype-config script installed by FreeType 2 could not be found.
If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in
your path, or set the FT2_CONFIG environment variable to the
full path to freetype-config.
])
else
echo "*** The FreeType test program failed to run. If your system uses"
echo "*** shared libraries and they are installed outside the normal"
echo "*** system library path, make sure the variable LD_LIBRARY_PATH"
echo "*** (or whatever is appropiate for your system) is correctly set."
if test x$ft_config_is_lt = xyes ; then
AC_MSG_WARN([
Your installed version of the FreeType 2 library is too old.
If you have different versions of FreeType 2, make sure that
correct values for --with-ft-prefix or --with-ft-exec-prefix
are used, or set the FT2_CONFIG environment variable to the
full path to freetype-config.
])
else
AC_MSG_WARN([
The FreeType test program failed to run. If your system uses
shared libraries and they are installed outside the normal
system library path, make sure the variable LD_LIBRARY_PATH
(or whatever is appropiate for your system) is correctly set.
])
fi
fi
FT2_CFLAGS=""
FT2_LIBS=""
m4_if([$3], [], [:], [$3])
fi
FT2_CFLAGS=""
FT2_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(FT2_CFLAGS)
AC_SUBST(FT2_LIBS)
])
AC_SUBST([FT2_CFLAGS])
AC_SUBST([FT2_LIBS])])
# end of freetype2.m4

View file

@ -1,31 +1,24 @@
## FreeType specific autoconf tests
# serial 1 FT_MUNMAP_DECL
# serial 2
AC_DEFUN(FT_MUNMAP_DECL,
[AC_MSG_CHECKING([whether munmap must be declared])
AC_CACHE_VAL(ft_cv_munmap_decl,
[AC_TRY_COMPILE([
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/mman.h>],
[char *(*pfn) = (char *(*))munmap],
ft_cv_munmap_decl=no,
ft_cv_munmap_decl=yes)])
AC_MSG_RESULT($ft_cv_munmap_decl)
if test $ft_cv_munmap_decl = yes; then
AC_DEFINE(NEED_MUNMAP_DECL,,
[Define to 1 if munmap() is not defined in <sys/mman.h>])
fi])
AC_DEFUN([FT_MUNMAP_PARAM],
[AC_MSG_CHECKING([for munmap's first parameter type])
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([[
AC_DEFUN(FT_MUNMAP_PARAM,
[AC_MSG_CHECKING([for munmap's first parameter type])
AC_TRY_COMPILE([
#include <unistd.h>
#include <sys/mman.h>
int munmap(void *, size_t);],,
AC_MSG_RESULT([void *]);AC_DEFINE(MUNMAP_USES_VOIDP,,
[Define to 1 if the first argument of munmap is of type void *]),
AC_MSG_RESULT([char *]))
])
int munmap(void *, size_t);
]])
],
[],
[AC_MSG_RESULT([void *])
AC_DEFINE([MUNMAP_USES_VOIDP],
[],
[Define to 1 if the first argument of munmap is of type void *])],
[AC_MSG_RESULT([char *])])
])
# end of ft-munmap.m4

View file

@ -4,7 +4,7 @@
/* */
/* Build macros of the FreeType 2 library. */
/* */
/* Copyright 1996-2001 by */
/* Copyright 1996-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -21,14 +21,15 @@
/* This is a Unix-specific version of <ft2build.h> that should be used */
/* exclusively *after* installation of the library. */
/* */
/* It assumes that "/usr/local/include/freetype2" (or wathever is */
/* returned by the "freetype-config --cflags" command) is in your */
/* compilation include path. */
/* It assumes that "/usr/local/include/freetype2" (or whatever is */
/* returned by the "freetype-config --cflags" or "pkg-config --cflags" */
/* command) is in your compilation include path. */
/* */
/* We don't need to do anything special in this release. However, for */
/* FreeType 2.1, the following installation changes will be performed: */
/* a future FreeType 2 release, the following installation changes will */
/* be performed: */
/* */
/* - The contents of "freetype-2.1/include/freetype" will be installed */
/* - The contents of "freetype-2.x/include/freetype" will be installed */
/* to "/usr/local/include/freetype2" instead of */
/* "/usr/local/include/freetype2/freetype". */
/* */
@ -39,11 +40,11 @@
/* replace all "<freetype/xxx>" with "<freetype2/xxx>". */
/* */
/* - Adding "/usr/local/include/freetype2" to your compilation include */
/* path will not be necessary anymore. The command */
/* "freetype-config --cflags" will return an empty string. */
/* path will not be necessary anymore. */
/* */
/* - Client applications which adhere to the new inclusion scheme */
/* WILL NOT NEED TO BE MODIFIED to compile with FT 2.1! */
/* These changes will be transparent to client applications which use */
/* freetype-config (or pkg-config). No modifications will be necessary */
/* to compile with the new scheme. */
/* */
/*************************************************************************/
@ -51,7 +52,7 @@
#ifndef __FT2_BUILD_UNIX_H__
#define __FT2_BUILD_UNIX_H__
/* "/usr/local/include/freetype2" must be in your current inclusion path */
/* "<prefix>/include/freetype2" must be in your current inclusion path */
#include <freetype/config/ftheader.h>
#endif /* __FT2_BUILD_UNIX_H__ */

View file

@ -4,7 +4,7 @@
/* */
/* UNIX-specific configuration file (specification only). */
/* */
/* Copyright 1996-2000, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -57,11 +57,12 @@ FT_BEGIN_HEADER
/*************************************************************************/
#define HAVE_UNISTD_H 0
#define HAVE_FCNTL_H 0
#undef HAVE_UNISTD_H
#undef HAVE_FCNTL_H
#undef SIZEOF_INT
#undef SIZEOF_LONG
#define SIZEOF_INT 2
#define SIZEOF_LONG 2
#define FT_SIZEOF_INT SIZEOF_INT
#define FT_SIZEOF_LONG SIZEOF_LONG
@ -89,6 +90,19 @@ FT_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
/* */
/* Mac support */
/* */
/* This is the only necessary change, so it is defined here instead */
/* providing a new configuration file. */
/* */
#if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \
( defined( __MWERKS__ ) && defined( macintosh ) )
#define FT_MACINTOSH 1
#endif
/*************************************************************************/
/* */
/* IntN types */
@ -112,31 +126,88 @@ FT_BEGIN_HEADER
#error "no 32bit type found -- please check your configuration files"
#endif
/* look up an integer type that is at least 32 bits */
#if FT_SIZEOF_INT >= 4
typedef int FT_Fast;
typedef unsigned int FT_UFast;
#elif FT_SIZEOF_LONG >= 4
typedef long FT_Fast;
typedef unsigned long FT_UFast;
#endif
/* determine whether we have a 64-bit int type for platforms without */
/* Autoconf */
#if FT_SIZEOF_LONG == 8
/* FT_LONG64 must be defined if a 64-bit type is available */
#define FT_LONG64
#define FT_INT64 long
#define FT_INT64 long
#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
/* this compiler provides the __int64 type */
#define FT_LONG64
#define FT_INT64 __int64
#elif defined( __BORLANDC__ ) /* Borland C++ */
/* XXXX: We should probably check the value of __BORLANDC__ in order */
/* to test the compiler version. */
/* this compiler provides the __int64 type */
#define FT_LONG64
#define FT_INT64 __int64
#elif defined( __WATCOMC__ ) /* Watcom C++ */
/* Watcom doesn't provide 64-bit data types */
#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
#define FT_LONG64
#define FT_INT64 long long int
#elif defined( __GNUC__ )
/* GCC provides the "long long" type */
#define FT_LONG64
#define FT_INT64 long long int
#endif /* FT_SIZEOF_LONG == 8 */
#define FT_BEGIN_STMNT do {
#define FT_END_STMNT } while ( 0 )
#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
#else
/*************************************************************************/
/* */
/* Many compilers provide the non-ANSI `long long' 64-bit type. You can */
/* activate it by defining the FTCALC_USE_LONG_LONG macro in */
/* `ftoption.h'. */
/* A 64-bit data type will create compilation problems if you compile */
/* in strict ANSI mode. To avoid them, we disable their use if */
/* __STDC__ is defined. You can however ignore this rule by */
/* defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
/* */
/* Note that this will produce many -ansi warnings during library */
/* compilation, and that in many cases, the generated code will be */
/* neither smaller nor faster! */
/* */
#ifdef FTCALC_USE_LONG_LONG
#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
#define FT_LONG64
#define FT_INT64 long long
#ifdef __STDC__
#endif /* FTCALC_USE_LONG_LONG */
#endif /* FT_SIZEOF_LONG == 8 */
/* Undefine the 64-bit macros in strict ANSI compilation mode. */
/* Since `#undef' doesn't survive in configuration header files */
/* we use the postprocessing facility of AC_CONFIG_HEADERS to */
/* replace the leading `/' with `#'. */
/undef FT_LONG64
/undef FT_INT64
#endif /* __STDC__ */
#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
@ -151,7 +222,7 @@ FT_BEGIN_HEADER
#define FT_LOCAL_DEF( x ) extern "C" x
#else
#define FT_LOCAL( x ) extern x
#define FT_LOCAL_DEF( x ) extern x
#define FT_LOCAL_DEF( x ) x
#endif
#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
@ -255,6 +326,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* __FTCONFIG_H__ */

View file

@ -1,21 +1,38 @@
#!/bin/sh
# install - install a program, script, or datafile
# This originally came from X11R5 (mit/util/scripts/install.sh).
scriptversion=2003-01-17.15
scriptversion=2003-09-24.23
# Copyright 1991 by the Massachusetts Institute of Technology
# (FSF changes in the public domain.)
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
@ -134,6 +151,11 @@ if test -z "$src"; then
exit 1
fi
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
src=
@ -158,6 +180,11 @@ else
exit 1
fi
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
@ -165,11 +192,10 @@ else
fi
fi
## this sed command emulates the dirname command
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# (this part is taken from Noah Friedman's mkinstalldirs script.)
# Skip lots of stat calls in the usual case.
if test ! -d "$dstdir"; then
@ -213,8 +239,8 @@ else
test -z "$dstfile" && dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/#inst.$$#
rmtmp=$dstdir/#rm.$$#
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0

View file

@ -51,6 +51,8 @@ install: $(PROJECT_LIBRARY)
done
$(INSTALL_DATA) $(BUILD_DIR)/ft2unix.h \
$(DESTDIR)$(includedir)/ft2build.h
$(INSTALL_DATA) $(BUILD_DIR)/ftconfig.h \
$(DESTDIR)$(includedir)/freetype2/freetype/config/ftconfig.h
$(INSTALL_SCRIPT) -m 755 $(OBJ_BUILD)/freetype-config \
$(DESTDIR)$(bindir)/freetype-config
$(INSTALL_SCRIPT) -m 644 $(BUILD_DIR)/freetype2.m4 \

File diff suppressed because it is too large Load diff

View file

@ -1,20 +1,26 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# Public domain.
scriptversion=2003-09-26.19
errstatus=0
dirmode=""
usage="\
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
Create each directory DIR (with mode MODE, if specified), including all
leading file name components.
"
# process command line arguments
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage" 1>&2
echo "$usage"
exit 0
;;
-m) # -m PERM arg
@ -23,6 +29,10 @@ while test $# -gt 0 ; do
dirmode=$1
shift
;;
--version)
echo "$0 $scriptversion"
exit 0
;;
--) # stop option processing
shift
break
@ -55,12 +65,25 @@ case $dirmode in
if mkdir -p -- . 2>/dev/null; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
test -d ./-p && rmdir ./-p
test -d ./-- && rmdir ./--
fi
;;
*)
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
else
# Clean up after NextStep and OpenStep mkdir.
for d in ./-m ./-p ./-- "./$dirmode";
do
test -d $d && rmdir $d
done
fi
;;
esac
@ -84,17 +107,17 @@ do
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=""
chmod "$dirmode" "$pathcomp" || lasterr=$?
lasterr=""
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
@ -107,5 +130,8 @@ exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
# mkinstalldirs ends here

View file

@ -70,7 +70,10 @@ T := -o$(space)
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
# ANSI compliance.
#
CFLAGS := -c @XX_CFLAGS@ @CPPFLAGS@ @CFLAGS@
# We use our own FreeType configuration file.
#
CFLAGS := -c @XX_CFLAGS@ @CPPFLAGS@ @CFLAGS@ \
-DFT_CONFIG_CONFIG_H="<ftconfig.h>"
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#

View file

@ -4,7 +4,7 @@
/* */
/* VMS-specific configuration file (specification only). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -34,8 +34,8 @@
/*************************************************************************/
#ifndef FTCONFIG_H
#define FTCONFIG_H
#ifndef __FTCONFIG_H__
#define __FTCONFIG_H__
/* Include the header file containing all developer build options */
@ -43,6 +43,7 @@
#include FT_CONFIG_OPTIONS_H
#include FT_CONFIG_STANDARD_LIBRARY_H
FT_BEGIN_HEADER
/*************************************************************************/
@ -89,6 +90,19 @@ FT_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
/* */
/* Mac support */
/* */
/* This is the only necessary change, so it is defined here instead */
/* providing a new configuration file. */
/* */
#if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \
( defined( __MWERKS__ ) && defined( macintosh ) )
#define FT_MACINTOSH 1
#endif
/*************************************************************************/
/* */
/* IntN types */
@ -112,32 +126,84 @@ FT_BEGIN_HEADER
#error "no 32bit type found -- please check your configuration files"
#endif
/* look up an integer type that is at least 32 bits */
#if FT_SIZEOF_INT >= 4
typedef int FT_Fast;
typedef unsigned int FT_UFast;
#elif FT_SIZEOF_LONG >= 4
typedef long FT_Fast;
typedef unsigned long FT_UFast;
#endif
/* determine whether we have a 64-bit int type for platforms without */
/* Autoconf */
#if FT_SIZEOF_LONG == 8
/* FT_LONG64 must be defined if a 64-bit type is available */
#define FT_LONG64
#define FT_INT64 long
#define FT_INT64 long
#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
/* this compiler provides the __int64 type */
#define FT_LONG64
#define FT_INT64 __int64
#elif defined( __BORLANDC__ ) /* Borland C++ */
/* XXXX: We should probably check the value of __BORLANDC__ in order */
/* to test the compiler version. */
/* this compiler provides the __int64 type */
#define FT_LONG64
#define FT_INT64 __int64
#elif defined( __WATCOMC__ ) /* Watcom C++ */
/* Watcom doesn't provide 64-bit data types */
#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
#define FT_LONG64
#define FT_INT64 long long int
#elif defined( __GNUC__ )
/* GCC provides the "long long" type */
#define FT_LONG64
#define FT_INT64 long long int
#endif /* FT_SIZEOF_LONG == 8 */
#define FT_BEGIN_STMNT do {
#define FT_END_STMNT } while ( 0 )
#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
#else
/*************************************************************************/
/* */
/* Many compilers provide the non-ANSI `long long' 64-bit type. You can */
/* activate it by defining the FTCALC_USE_LONG_LONG macro in */
/* `ftoption.h'. */
/* A 64-bit data type will create compilation problems if you compile */
/* in strict ANSI mode. To avoid them, we disable their use if */
/* __STDC__ is defined. You can however ignore this rule by */
/* defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
/* */
/* Note that this will produce many -ansi warnings during library */
/* compilation, and that in many cases, the generated code will be */
/* neither smaller nor faster! */
/* */
#ifdef FTCALC_USE_LONG_LONG
#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
#define FT_LONG64
#define FT_INT64 long long
#ifdef __STDC__
#endif /* FTCALC_USE_LONG_LONG */
/* undefine the 64-bit macros in strict ANSI compilation mode */
#undef FT_LONG64
#undef FT_INT64
#endif /* FT_SIZEOF_LONG == 8 */
#endif /* __STDC__ */
#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
@ -157,6 +223,7 @@ FT_BEGIN_HEADER
#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
#ifndef FT_BASE
#ifdef __cplusplus
@ -167,15 +234,16 @@ FT_BEGIN_HEADER
#endif /* !FT_BASE */
#ifndef BASE_DEF
#ifndef FT_BASE_DEF
#ifdef __cplusplus
#define BASE_DEF( x ) extern "C" x
#define FT_BASE_DEF( x ) extern "C" x
#else
#define BASE_DEF( x ) extern x
#define FT_BASE_DEF( x ) extern x
#endif
#endif /* !BASE_DEF */
#endif /* !FT_BASE_DEF */
#ifndef FT_EXPORT
@ -188,6 +256,7 @@ FT_BEGIN_HEADER
#endif /* !FT_EXPORT */
#ifndef FT_EXPORT_DEF
#ifdef __cplusplus
@ -209,6 +278,9 @@ FT_BEGIN_HEADER
#endif /* !FT_EXPORT_VAR */
/* The following macros are needed to compile the library with a */
/* C++ compiler and with 16bit compilers. */
/* */
/* This is special. Within C++, you must specify `extern "C"' for */
/* functions which are used via function pointers, and you also */
@ -216,23 +288,42 @@ FT_BEGIN_HEADER
/* assure C linkage -- it's not possible to have (local) anonymous */
/* functions which are accessed by (global) function pointers. */
/* */
/* */
/* FT_CALLBACK_DEF is used to _define_ a callback function. */
/* */
/* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
/* contains pointers to callback functions. */
/* */
/* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
/* that contains pointers to callback functions. */
/* */
/* */
/* Some 16bit compilers have to redefine these macros to insert */
/* the infamous `_cdecl' or `__fastcall' declarations. */
/* */
#ifndef FT_CALLBACK_DEF
#ifdef __cplusplus
#define FT_CALLBACK_DEF( x ) extern "C" x
#define FT_CALLBACK_TABLE extern "C"
#define FT_CALLBACK_TABLE_DEF extern "C"
#define FT_CALLBACK_DEF( x ) extern "C" x
#else
#define FT_CALLBACK_DEF( x ) static x
#endif
#endif /* FT_CALLBACK_DEF */
#define FT_CALLBACK_DEF( x ) static x
#define FT_CALLBACK_TABLE extern
#define FT_CALLBACK_TABLE_DEF
#ifndef FT_CALLBACK_TABLE
#ifdef __cplusplus
#define FT_CALLBACK_TABLE extern "C"
#define FT_CALLBACK_TABLE_DEF extern "C"
#else
#define FT_CALLBACK_TABLE extern
#define FT_CALLBACK_TABLE_DEF /* nothing */
#endif
#endif /* FT_CALLBACK_TABLE */
#endif /* __cplusplus */
FT_END_HEADER
#endif /* FTCONFIG_H */
#endif /* __FTCONFIG_H__ */
/* END */

View file

@ -19,6 +19,15 @@
</pre>
</ul>
<p>Be sure to extract the files with the Windows (CR+LF) line endings.
ZIP archives are already stored this way, so no further step is required.
If you use some .tar.*z archives, be sure to configure your extracting
tool to convert the line endings. For example, with
<a href="http://www.winzip.com">WinZip</a>, you should set the "TAR file
smart CR/LF Conversion" option on. Alternatively, you may consider using
the "unix2dos" or "u2d" utilities that are floating around, which
specifically deal with this particular problem.
<p>Build directories are placed in the top-level "objs" directory</p>
<p>Enjoy :-)</p>

View file

@ -28,14 +28,14 @@
* "ftoption.h"), then invoke Jam as usual.
*/
#ifndef __FT2_BUILD_GENERIC_H__
#define __FT2_BUILD_GENERIC_H__
#ifndef __FT2_BUILD_DEVEL_H__
#define __FT2_BUILD_DEVEL_H__
#define FT_CONFIG_OPTIONS_H <ftoption.h>
#include <freetype/config/ftheader.h>
#endif /* __FT2_BUILD_GENERIC_H__ */
#endif /* __FT2_BUILD_DEVEL_H__ */
/* END */

View file

@ -296,7 +296,7 @@ FT_BEGIN_HEADER
/* Do not #undef this macro here since the build system might define */
/* it for certain configurations only. */
/* */
/* #define FT_DEBUG_MEMORY */
#define FT_DEBUG_MEMORY
/*************************************************************************/

File diff suppressed because it is too large Load diff

View file

@ -101,15 +101,15 @@ IV. Overriding default configuration and module headers
name the configuration headers. To do so, you need a custom
"ft2build.h" whose content can be as simple as:
#ifndef __FT2_BUILD_GENERIC_H__
#define __FT2_BUILD_GENERIC_H__
#ifndef __FT2_BUILD_MY_PLATFORM_H__
#define __FT2_BUILD_MY_PLATFORM_H__
#define FT_CONFIG_OPTIONS_H <custom/my-ftoption.h>
#define FT_CONFIG_MACROS_H <custom/my-ftmodule.h>
#define FT_CONFIG_OPTIONS_H <custom/my-ftoption.h>
#define FT_CONFIG_MODULES_H <custom/my-ftmodule.h>
#include <freetype/config/ftheader.h>
#endif /* __FT2_BUILD_GENERIC_H__ */
#endif /* __FT2_BUILD_MY_PLATFORM_H__ */
Place those files in a separate directory, e.g.:

View file

@ -51,7 +51,10 @@ libtool number, as well as the shared object number found on _most_
systems, but not all of them:
release libtool so
--------------------------------------------------------------------
-------------------------------
2.1.8 9.6.3 6.3.6
2.1.7 9.5.3 6.3.5
2.1.6 9.5.3 6.3.5
2.1.5 9.4.3 6.3.4
2.1.4 9.3.3 6.3.3
2.1.3 9.2.3 6.3.2
@ -60,6 +63,8 @@ systems, but not all of them:
2.1.0 8.0.2 ?
2.0.9 9.0.3 ?
2.0.8 8.0.2 ?
2.0.4 7.0.1 ?
2.0.1 6.1.0 ?
The libtool numbers are a bit inconsistent due to the library's history:
@ -86,19 +91,19 @@ other release numbers.
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS=`freetype-config --cflags`
AC_TRY_CPP([
#include <freetype/freetype.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2000009
#error Freetype version too low.
#endif
],[
AC_MSG_RESULT(yes)
FREETYPE_LIBS=`freetype-config --libs`
AC_SUBST(FREETYPE_LIBS)
AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])
CPPFLAGS="$old_CPPFLAGS"
],[
AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])
])
],
[AC_MSG_RESULT(yes)
FREETYPE_LIBS=`freetype-config --libs`
AC_SUBST(FREETYPE_LIBS)
AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])
CPPFLAGS="$old_CPPFLAGS"],
[AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])])
--- end of VERSION.DLL ---

View file

@ -2,24 +2,27 @@
The FreeType 2 font engine is copyrighted work and cannot be used
legally without a software license. In order to make this project
usable to a vast majority of developers, we distribute it under two
mutually exclusive licenses.
mutually exclusive open-source licenses.
This means that *you* must choose *one* license of the two described
This means that *you* must choose *one* of the two licenses described
below, then obey all its terms and conditions when using FreeType 2 in
any of your projects or products.
- The FreeType License, found in the file "FTL.TXT", which is an
BSD-style open-source license *with* an advertising clause that
forces you to explicitely cite the FreeType project in your
product's documentation. All details are in the license file.
- The FreeType License, found in the file `FTL.TXT', which is similar
to the original BSD license *with* an advertising clause that forces
you to explicitly cite the FreeType project in your product's
documentation. All details are in the license file. This license
is suited to products which don't use the GNU General Public
License.
- The GNU General Public License, found in "GPL.TXT", which is the
traditionnal and "viral" GPL license that forces you to redistribute
the _complete_ sources of all your products that use FreeType 2.
- The GNU General Public License version 2, found in `GPL.TXT' (any
later version can be used also), for programs which already use the
GPL. Note that the FTL is incompatible with the GPL due to its
advertisement clause.
Note that the contributed PCF driver comes with a license similar to
that of X Window System which is compatible to the above two licenses
(see file src/pcf/readme).
The contributed PCF driver comes with a license similar to that of the X
Window System. It is compatible to the above two licenses (see file
src/pcf/readme).
--- end of licence.txt ---

View file

@ -7,12 +7,26 @@ How to prepare a new release
. builds/unix/configure.ac (version_info): Update according to the libtool
rules, then regenerate the configure script.
. builds/freetype.mk (refdoc): Update the --title option.
. builds/freetype.mk (refdoc): Update the `--title' option.
. docs/CHANGES: Document differences to last release.
. README: Update.
. docs/VERSION.DLL: Document changed version_info.
. docs/VERSION.DLL: Document changed `version_info'.
. ChangeLog: Announce new release.
. Call `make refdoc' to update HTML reference. Copy it to
freetype2/docs/reference in the `www' CVS module and update the CVS.
Then call `update-www' in ~/cvs/scripts on www.freetype.org to
update and distribute everything to sourceforge.
. Tag the CVS (freetype, ft2demos, www/freetype2/docs).
. Update `make-release' and `make-current' in ~/cvs/scripts/ on
www.freetype.org, then call them.
. Create an md5 checksum file (with md5sum).
. Announce new release on announce@freetype.org and to relevant newsgroups.

View file

@ -29,6 +29,7 @@ FT_Done_Size
FT_FloorFix
FT_Free
FT_Get_Char_Index
FT_Get_CMap_Language_ID
FT_Get_First_Char
FT_Get_Glyph_Name
FT_Get_Kerning
@ -66,6 +67,7 @@ FT_Load_Char
FT_Load_Glyph
FT_Load_Sfnt_Table
FT_Lookup_Renderer
ft_module_get_service
FT_MulDiv
FT_MulFix
FT_MulTo64
@ -82,6 +84,7 @@ FT_Outline_Done
FT_Outline_Done_Internal
FT_Outline_Get_Bitmap
FT_Outline_Get_CBox
FT_Outline_Get_Orientation
FT_Outline_New
FT_Outline_New_Internal
FT_Outline_Render
@ -94,6 +97,7 @@ FT_Render_Glyph
FT_Render_Glyph_Internal
FT_RoundFix
FT_Select_Charmap
ft_service_list_lookup
FT_Set_Char_Size
FT_Set_Charmap
FT_Set_Debug_Hook
@ -158,16 +162,23 @@ FT_Get_X11_Font_Format
FT_Get_PFR_Advance
FT_Get_PFR_Kerning
FT_Get_PFR_Metrics
FT_Glyph_Stroke
FT_Glyph_StrokeBorder
FT_Outline_GetInsideBorder
FT_Outline_GetOutsideBorder
FT_Stroker_BeginSubPath
FT_Stroker_ConicTo
FT_Stroker_CubicTo
FT_Stroker_Done
FT_Stroker_EndSubPath
FT_Stroker_Export
FT_Stroker_ExportBorder
FT_Stroker_GetBorderCounts
FT_Stroker_GetCounts
FT_Stroker_LineTo
FT_Stroker_New
FT_Stroker_ParseOutline
FT_Stroker_Rewind
FT_Stroker_Set
FT_Get_WinFNT_Header
FT_Outline_Get_BBox
@ -176,50 +187,57 @@ autohint_module_class
ft_autohinter_service
bdf_cmap_class
bdf_driver_class
FT_LruList_Destroy
FT_LruList_Lookup
FT_LruList_New
FT_LruList_Remove
FT_LruList_Remove_Selection
FT_LruList_Reset
ftc_cache_clear
ftc_cache_done
ftc_cache_init
ftc_cache_lookup
FTC_Cache_Clear
FTC_Cache_Done
FTC_Cache_Init
FTC_Cache_Lookup
FTC_Cache_NewNode
FTC_Cache_RemoveFaceID
ftc_cmap_cache_class
FTC_CMapCache_Lookup
FTC_CMapCache_New
ftc_face_list_class
ftc_family_done
ftc_family_init
ftc_family_table_alloc
ftc_family_table_free
ftc_glyph_family_done
ftc_glyph_family_init
ftc_glyph_node_compare
ftc_glyph_node_done
ftc_glyph_node_init
ftc_image_cache_class
FTC_Image_Cache_Lookup
FTC_Image_Cache_New
FTC_Family_Init
FTC_GCache_Done
FTC_GCache_Init
FTC_GCache_Lookup
FTC_GCache_New
FTC_GNode_Compare
FTC_GNode_Done
FTC_GNode_Init
FTC_GNode_UnselectFamily
FTC_ImageCache_Lookup
FTC_ImageCache_New
FTC_INode_Free
FTC_INode_New
FTC_INode_Weight
FTC_Manager_Compress
FTC_Manager_Done
FTC_Manager_Lookup_Face
FTC_Manager_Lookup_Size
FTC_Manager_FlushN
FTC_Manager_LookupFace
FTC_Manager_LookupSize
FTC_Manager_New
FTC_Manager_Register_Cache
FTC_Manager_RegisterCache
FTC_Manager_RemoveFaceID
FTC_Manager_Reset
FTC_MruList_Done
FTC_MruList_Find
FTC_MruList_Init
FTC_MruList_Lookup
FTC_MruList_New
FTC_MruList_Remove
FTC_MruList_RemoveSelection
FTC_MruList_Reset
FTC_MruNode_Prepend
FTC_MruNode_Remove
FTC_MruNode_Up
ftc_node_destroy
ftc_node_done
FTC_Node_Unref
ftc_sbit_cache_class
FTC_SBit_Cache_Lookup
FTC_SBit_Cache_New
FTC_SBitCache_Lookup
FTC_SBitCache_New
ftc_size_list_class
FTC_SNode_Compare
FTC_SNode_Free
FTC_SNode_New
FTC_SNode_Weight
cff_cmap_encoding_class_rec
cff_cmap_unicode_class_rec
cff_driver_class
@ -233,7 +251,7 @@ RepadBitmap
TwoByteSwap
pfr_cmap_class_rec
pfr_driver_class
pfr_service_rec
pfr_metrics_service_rec
ps_parser_funcs
ps_table_funcs
psaux_module_class

View file

@ -4,7 +4,7 @@
/* */
/* FreeType internal cache interface (specification). */
/* */
/* Copyright 2000-2001, 2002 by */
/* Copyright 2000-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -20,9 +20,7 @@
#define __FTCCACHE_H__
/* define to allow cache lookup inlining */
#define FTC_CACHE_USE_INLINE
#include FT_CACHE_INTERNAL_MRU_H
FT_BEGIN_HEADER
@ -30,13 +28,7 @@ FT_BEGIN_HEADER
typedef struct FTC_CacheRec_* FTC_Cache;
/* handle to cache class */
typedef const struct FTC_Cache_ClassRec_* FTC_Cache_Class;
/* handle to cache node family */
typedef struct FTC_FamilyRec_* FTC_Family;
/* handle to cache root query */
typedef struct FTC_QueryRec_* FTC_Query;
typedef const struct FTC_CacheClassRec_* FTC_CacheClass;
/*************************************************************************/
@ -62,12 +54,11 @@ FT_BEGIN_HEADER
/* structure size should be 20 bytes on 32-bits machines */
typedef struct FTC_NodeRec_
{
FTC_Node mru_next; /* circular mru list pointer */
FTC_Node mru_prev; /* circular mru list pointer */
FTC_Node link; /* used for hashing */
FT_UInt32 hash; /* used for hashing too */
FT_UShort fam_index; /* index of family the node belongs to */
FT_Short ref_count; /* reference count for this node */
FTC_MruNodeRec mru; /* circular mru list pointer */
FTC_Node link; /* used for hashing */
FT_UInt32 hash; /* used for hashing too */
FT_UShort cache_index; /* index of cache the node belongs to */
FT_Short ref_count; /* reference count for this node */
} FTC_NodeRec;
@ -75,6 +66,9 @@ FT_BEGIN_HEADER
#define FTC_NODE( x ) ( (FTC_Node)(x) )
#define FTC_NODE_P( x ) ( (FTC_Node*)(x) )
#define FTC_NODE__NEXT(x) FTC_NODE( (x)->mru.next )
#define FTC_NODE__PREV(x) FTC_NODE( (x)->mru.prev )
/*************************************************************************/
/* */
@ -83,83 +77,12 @@ FT_BEGIN_HEADER
/* cache sub-system internals. */
/* */
/* can be used as a FTC_Node_DoneFunc */
FT_EXPORT( void )
ftc_node_done( FTC_Node node,
FTC_Cache cache );
/* reserved for manager's use */
FT_EXPORT( void )
ftc_node_destroy( FTC_Node node,
FTC_Manager manager );
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** CACHE QUERY DEFINITIONS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* A structure modelling a cache node query. The following fields must */
/* all be set by the @FTC_Family_CompareFunc method of a cache's family */
/* list. */
/* */
typedef struct FTC_QueryRec_
{
FTC_Family family;
FT_UFast hash;
} FTC_QueryRec;
#define FTC_QUERY( x ) ( (FTC_Query)(x) )
#define FTC_QUERY_P( x ) ( (FTC_Query*)(x) )
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** CACHE FAMILY DEFINITIONS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
typedef struct FTC_FamilyRec_
{
FT_LruNodeRec lru;
FTC_Cache cache;
FT_UInt num_nodes;
FT_UInt fam_index;
} FTC_FamilyRec;
#define FTC_FAMILY( x ) ( (FTC_Family)(x) )
#define FTC_FAMILY_P( x ) ( (FTC_Family*)(x) )
/*************************************************************************/
/* */
/* These functions are exported so that they can be called from */
/* user-provided cache classes; otherwise, they are really part of the */
/* cache sub-system internals. */
/* */
/* must be called by any FTC_Node_InitFunc routine */
FT_EXPORT( FT_Error )
ftc_family_init( FTC_Family family,
FTC_Query query,
FTC_Cache cache );
/* can be used as a FTC_Family_DoneFunc; otherwise, must be called */
/* by any family finalizer function */
FT_EXPORT( void )
ftc_family_done( FTC_Family family );
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -168,64 +91,12 @@ FT_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
/* each cache really implements a dynamic hash table to manage its nodes */
typedef struct FTC_CacheRec_
{
FTC_Manager manager;
FT_Memory memory;
FTC_Cache_Class clazz;
FT_UInt cache_index; /* in manager's table */
FT_Pointer cache_data; /* used by cache node methods */
FT_UFast p;
FT_UFast mask;
FT_Long slack;
FTC_Node* buckets;
FT_LruList_ClassRec family_class;
FT_LruList families;
} FTC_CacheRec;
#define FTC_CACHE( x ) ( (FTC_Cache)(x) )
#define FTC_CACHE_P( x ) ( (FTC_Cache*)(x) )
/* initialize a given cache */
typedef FT_Error
(*FTC_Cache_InitFunc)( FTC_Cache cache );
/* clear a cache */
typedef void
(*FTC_Cache_ClearFunc)( FTC_Cache cache );
/* finalize a given cache */
typedef void
(*FTC_Cache_DoneFunc)( FTC_Cache cache );
typedef FT_Error
(*FTC_Family_InitFunc)( FTC_Family family,
FTC_Query query,
FTC_Cache cache );
typedef FT_Int
(*FTC_Family_CompareFunc)( FTC_Family family,
FTC_Query query );
typedef void
(*FTC_Family_DoneFunc)( FTC_Family family,
FTC_Cache cache );
/* initialize a new cache node */
typedef FT_Error
(*FTC_Node_InitFunc)( FTC_Node node,
FT_Pointer type,
FTC_Cache cache );
(*FTC_Node_NewFunc)( FTC_Node *pnode,
FT_Pointer query,
FTC_Cache cache );
/* compute the weight of a given cache node */
typedef FT_ULong
(*FTC_Node_WeightFunc)( FTC_Node node,
FTC_Cache cache );
@ -236,62 +107,159 @@ FT_BEGIN_HEADER
FT_Pointer key,
FTC_Cache cache );
/* finalize a given cache node */
typedef void
(*FTC_Node_DoneFunc)( FTC_Node node,
(*FTC_Node_FreeFunc)( FTC_Node node,
FTC_Cache cache );
typedef FT_Error
(*FTC_Cache_InitFunc)( FTC_Cache cache );
typedef struct FTC_Cache_ClassRec_
typedef void
(*FTC_Cache_DoneFunc)( FTC_Cache cache );
typedef struct FTC_CacheClassRec_
{
FT_UInt cache_size;
FTC_Cache_InitFunc cache_init;
FTC_Cache_ClearFunc cache_clear;
FTC_Cache_DoneFunc cache_done;
FTC_Node_NewFunc node_new;
FTC_Node_WeightFunc node_weight;
FTC_Node_CompareFunc node_compare;
FTC_Node_CompareFunc node_remove_faceid;
FTC_Node_FreeFunc node_free;
FT_UInt family_size;
FTC_Family_InitFunc family_init;
FTC_Family_CompareFunc family_compare;
FTC_Family_DoneFunc family_done;
FT_UInt cache_size;
FTC_Cache_InitFunc cache_init;
FTC_Cache_DoneFunc cache_done;
FT_UInt node_size;
FTC_Node_InitFunc node_init;
FTC_Node_WeightFunc node_weight;
FTC_Node_CompareFunc node_compare;
FTC_Node_DoneFunc node_done;
} FTC_Cache_ClassRec;
} FTC_CacheClassRec;
/* */
/* each cache really implements a dynamic hash table to manage its nodes */
typedef struct FTC_CacheRec_
{
FT_UFast p;
FT_UFast mask;
FT_Long slack;
FTC_Node* buckets;
FTC_CacheClassRec clazz; /* local copy, for speed */
FTC_Manager manager;
FT_Memory memory;
FT_UInt index; /* in manager's table */
FTC_CacheClass org_class; /* original class pointer */
} FTC_CacheRec;
/*************************************************************************/
/* */
/* These functions are exported so that they can be called from */
/* user-provided cache classes; otherwise, they are really part of the */
/* cache sub-system internals. */
/* */
#define FTC_CACHE( x ) ( (FTC_Cache)(x) )
#define FTC_CACHE_P( x ) ( (FTC_Cache*)(x) )
/* can be used directly as FTC_Cache_DoneFunc(), or called by custom */
/* cache finalizers */
FT_EXPORT( void )
ftc_cache_done( FTC_Cache cache );
/* can be used directly as FTC_Cache_ClearFunc(), or called by custom */
/* cache clear routines */
FT_EXPORT( void )
ftc_cache_clear( FTC_Cache cache );
/* initalize the hash table within the cache */
/* default cache initialize */
FT_EXPORT( FT_Error )
ftc_cache_init( FTC_Cache cache );
FTC_Cache_Init( FTC_Cache cache );
/* can be called when the key's hash value has been computed */
/* default cache finalizer */
FT_EXPORT( void )
FTC_Cache_Done( FTC_Cache cache );
/* Call this function to lookup the cache. If no corresponding
* node is found, a new one is automatically created. This function
* is capable of flushing the cache adequately to make room for the
* new cache object.
*/
FT_EXPORT( FT_Error )
ftc_cache_lookup( FTC_Cache cache,
FTC_Query query,
FTC_Node *anode );
FTC_Cache_Lookup( FTC_Cache cache,
FT_UInt32 hash,
FT_Pointer query,
FTC_Node *anode );
FT_EXPORT( FT_Error )
FTC_Cache_NewNode( FTC_Cache cache,
FT_UInt32 hash,
FT_Pointer query,
FTC_Node *anode );
/* Remove all nodes that relate to a given face_id. This is useful
* when un-installing fonts. Note that if a cache node relates to
* the face_id, but is locked (i.e., has 'ref_count > 0'), the node
* will _not_ be destroyed, but its internal face_id reference will
* be modified.
*
* The final result will be that the node will never come back
* in further lookup requests, and will be flushed on demand from
* the cache normally when its reference count reaches 0.
*/
FT_EXPORT( void )
FTC_Cache_RemoveFaceID( FTC_Cache cache,
FTC_FaceID face_id );
#ifdef FTC_INLINE
#define FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ) \
FT_BEGIN_STMNT \
FTC_Node *_bucket, *_pnode, _node; \
FTC_Cache _cache = FTC_CACHE(cache); \
FT_UInt32 _hash = (FT_UInt32)(hash); \
FTC_Node_CompareFunc _nodcomp = (FTC_Node_CompareFunc)(nodecmp); \
FT_UInt _idx; \
\
\
error = 0; \
node = NULL; \
_idx = _hash & _cache->mask; \
if ( _idx < _cache->p ) \
_idx = _hash & ( _cache->mask*2 + 1 ); \
\
_bucket = _pnode = _cache->buckets + _idx; \
for (;;) \
{ \
_node = *_pnode; \
if ( _node == NULL ) \
goto _NewNode; \
\
if ( _node->hash == _hash && _nodcomp( _node, query, _cache ) ) \
break; \
\
_pnode = &_node->link; \
} \
\
if ( _node != *_bucket ) \
{ \
*_pnode = _node->link; \
_node->link = *_bucket; \
*_bucket = _node; \
} \
\
{ \
FTC_Manager _manager = _cache->manager; \
\
\
if ( _node != _manager->nodes_list ) \
FTC_MruNode_Up( (FTC_MruNode*)&_manager->nodes_list, \
(FTC_MruNode)_node ); \
} \
goto _Ok; \
\
_NewNode: \
error = FTC_Cache_NewNode( _cache, _hash, query, &_node ); \
\
_Ok: \
*(FTC_Node*)&(node) = _node; \
FT_END_STMNT
#else /* !FTC_INLINE */
#define FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ) \
FT_BEGIN_STMNT \
error = FTC_Cache_Lookup( FTC_CACHE( cache ), hash, query, \
(FTC_Node*)&(node) ); \
FT_END_STMNT
#endif /* !FTC_INLINE */
/* */

View file

@ -4,7 +4,7 @@
/* */
/* FreeType abstract glyph cache (specification). */
/* */
/* Copyright 2000-2001, 2003 by */
/* Copyright 2000-2001, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -16,13 +16,84 @@
/***************************************************************************/
/*
*
* FTC_GCache is an _abstract_ cache object optimized to store glyph
* data. It works as follows:
*
* - It manages FTC_GNode objects. Each one of them can hold one or more
* glyph `items'. Item types are not specified in the FTC_GCache but
* in classes that extend it.
*
* - Glyph attributes, like face ID, character size, render mode, etc.,
* can be grouped into abstract `glyph families'. This avoids storing
* the attributes within the FTC_GCache, since it is likely that many
* FTC_GNodes will belong to the same family in typical uses.
*
* - Each FTC_GNode is thus an FTC_Node with two additional fields:
*
* * gindex: A glyph index, or the first index in a glyph range.
* * family: A pointer to a glyph `family'.
*
* - Family types are not fully specific in the FTC_Family type, but
* by classes that extend it.
*
* Note that both FTC_ImageCache and FTC_SBitCache extend FTC_GCache.
* They share an FTC_Family sub-class called FTC_BasicFamily which is
* used to store the following data: face ID, pixel/point sizes, load
* flags. For more details see the file `src/cache/ftcbasic.c'.
*
* Client applications can extend FTC_GNode with their own FTC_GNode
* and FTC_Family sub-classes to implement more complex caches (e.g.,
* handling automatic synthesis, like obliquing & emboldening, colored
* glyphs, etc.).
*
* See also the FTC_ICache & FTC_SCache classes in `ftcimage.h' and
* `ftcsbits.h', which both extend FTC_GCache with additional
* optimizations.
*
* A typical FTC_GCache implementation must provide at least the
* following:
*
* - FTC_GNode sub-class, e.g. MyNode, with relevant methods:
* my_node_new (must call FTC_GNode_Init)
* my_node_free (must call FTC_GNode_Done)
* my_node_compare (must call FTC_GNode_Compare)
* my_node_remove_faceid (must call ftc_gnode_unselect in case
* of match)
*
* - FTC_Family sub-class, e.g. MyFamily, with relevant methods:
* my_family_compare
* my_family_init
* my_family_reset (optional)
* my_family_done
*
* - FTC_GQuery sub-class, e.g. MyQuery, to hold cache-specific query
* data.
*
* - Constant structures for a FTC_GNodeClass.
*
* - MyCacheNew() can be implemented easily as a call to the convenience
* function FTC_GCache_New.
*
* - MyCacheLookup with a call to FTC_GCache_Lookup. This function will
* automatically:
*
* - Search for the corresponding family in the cache, or create
* a new one if necessary. Put it in FTC_GQUERY(myquery).family
*
* - Call FTC_Cache_Lookup.
*
* If it returns NULL, you should create a new node, then call
* ftc_cache_add as usual.
*/
/*************************************************************************/
/* */
/* Important: The functions defined in this file are only used to */
/* implement an abstract glyph cache class. You need to */
/* provide additional logic to implement a complete cache. */
/* For example, see `ftcimage.h' and `ftcimage.c' which */
/* implement a FT_Glyph cache based on this code. */
/* */
/*************************************************************************/
@ -47,99 +118,53 @@
#include <ft2build.h>
#include FT_CACHE_H
#include FT_CACHE_MANAGER_H
#include <stddef.h>
#include FT_CACHE_INTERNAL_MANAGER_H
FT_BEGIN_HEADER
/* each glyph set is characterized by a "glyph set type" which must be */
/* defined by sub-classes */
typedef struct FTC_GlyphFamilyRec_* FTC_GlyphFamily;
/*
* We can group glyphs into `families'. Each family correspond to a
* given face ID, character size, transform, etc.
*
* Families are implemented as MRU list nodes. They are
* reference-counted.
*/
/* handle to a glyph cache node */
typedef struct FTC_GlyphNodeRec_* FTC_GlyphNode;
/* size should be 24 + chunk size on 32-bit machines; */
/* note that the node's hash is ((gfam->hash << 16) | glyph_index) -- */
/* this _must_ be set properly by the glyph node initializer */
/* */
typedef struct FTC_GlyphNodeRec_
typedef struct FTC_FamilyRec_
{
FTC_NodeRec node;
FT_UShort item_count;
FT_UShort item_start;
FTC_MruNodeRec mrunode;
FT_UInt num_nodes; /* current number of nodes in this family */
FTC_Cache cache;
FTC_MruListClass clazz;
} FTC_GlyphNodeRec;
} FTC_FamilyRec, *FTC_Family;
#define FTC_FAMILY(x) ( (FTC_Family)(x) )
#define FTC_FAMILY_P(x) ( (FTC_Family*)(x) )
#define FTC_GLYPH_NODE( x ) ( (FTC_GlyphNode)(x) )
#define FTC_GLYPH_NODE_P( x ) ( (FTC_GlyphNode*)(x) )
typedef struct FTC_GlyphQueryRec_
typedef struct FTC_GNodeRec_
{
FTC_QueryRec query;
FT_UInt gindex;
FTC_NodeRec node;
FTC_Family family;
FT_UInt gindex;
} FTC_GlyphQueryRec, *FTC_GlyphQuery;
} FTC_GNodeRec, *FTC_GNode;
#define FTC_GNODE( x ) ( (FTC_GNode)(x) )
#define FTC_GNODE_P( x ) ( (FTC_GNode*)(x) )
#define FTC_GLYPH_QUERY( x ) ( (FTC_GlyphQuery)(x) )
/* a glyph set is used to categorize glyphs of a given type */
typedef struct FTC_GlyphFamilyRec_
typedef struct FTC_GQueryRec_
{
FTC_FamilyRec family;
FT_UInt32 hash;
FT_UInt item_total; /* total number of glyphs in family */
FT_UInt item_count; /* number of glyph items per node */
FT_UInt gindex;
FTC_Family family;
} FTC_GlyphFamilyRec;
} FTC_GQueryRec, *FTC_GQuery;
#define FTC_GLYPH_FAMILY( x ) ( (FTC_GlyphFamily)(x) )
#define FTC_GLYPH_FAMILY_P( x ) ( (FTC_GlyphFamily*)(x) )
#define FTC_GLYPH_FAMILY_MEMORY( x ) FTC_FAMILY(x)->cache->memory
/* each glyph node contains a 'chunk' of glyph items; */
/* translate a glyph index into a chunk index */
#define FTC_GLYPH_FAMILY_CHUNK( gfam, gindex ) \
( ( gindex ) / FTC_GLYPH_FAMILY( gfam )->item_count )
/* find a glyph index's chunk, and return its start index */
#define FTC_GLYPH_FAMILY_START( gfam, gindex ) \
( FTC_GLYPH_FAMILY_CHUNK( gfam, gindex ) * \
FTC_GLYPH_FAMILY( gfam )->item_count )
/* compute a glyph request's hash value */
#define FTC_GLYPH_FAMILY_HASH( gfam, gindex ) \
( (FT_UFast)( \
( FTC_GLYPH_FAMILY( gfam )->hash << 16 ) | \
( FTC_GLYPH_FAMILY_CHUNK( gfam, gindex ) & 0xFFFFU ) ) )
/* must be called in an FTC_Family_CompareFunc to update the query */
/* whenever a glyph set is matched in the lookup, or when it */
/* is created */
#define FTC_GLYPH_FAMILY_FOUND( gfam, gquery ) \
do \
{ \
FTC_QUERY( gquery )->family = FTC_FAMILY( gfam ); \
FTC_QUERY( gquery )->hash = \
FTC_GLYPH_FAMILY_HASH( gfam, \
FTC_GLYPH_QUERY( gquery )->gindex ); \
} while ( 0 )
/* retrieve glyph index of glyph node */
#define FTC_GLYPH_NODE_GINDEX( x ) \
( (FT_UInt)( FTC_GLYPH_NODE( x )->node.hash & 0xFFFFU ) )
#define FTC_GQUERY( x ) ( (FTC_GQuery)(x) )
/*************************************************************************/
@ -151,39 +176,116 @@ FT_BEGIN_HEADER
/* must be called by derived FTC_Node_InitFunc routines */
FT_EXPORT( void )
ftc_glyph_node_init( FTC_GlyphNode node,
FT_UInt gindex, /* glyph index for node */
FTC_GlyphFamily gfam );
FTC_GNode_Init( FTC_GNode node,
FT_UInt gindex, /* glyph index for node */
FTC_Family family );
/* returns TRUE iff the query's glyph index correspond to the node; */
/* this assumes that the "family" and "hash" fields of the query are */
/* already correctly set */
FT_EXPORT( FT_Bool )
ftc_glyph_node_compare( FTC_GlyphNode gnode,
FTC_GlyphQuery gquery );
FTC_GNode_Compare( FTC_GNode gnode,
FTC_GQuery gquery );
/* call this function to clear a node's family -- this is necessary */
/* to implement the `node_remove_faceid' cache method correctly */
FT_EXPORT( void )
FTC_GNode_UnselectFamily( FTC_GNode gnode,
FTC_Cache cache );
/* must be called by derived FTC_Node_DoneFunc routines */
FT_EXPORT( void )
ftc_glyph_node_done( FTC_GlyphNode node,
FTC_Cache cache );
FTC_GNode_Done( FTC_GNode node,
FTC_Cache cache );
/* must be called by derived FTC_Family_InitFunc; */
/* calls "ftc_family_init" */
FT_EXPORT( FT_Error )
ftc_glyph_family_init( FTC_GlyphFamily gfam,
FT_UInt32 hash,
FT_UInt item_count,
FT_UInt item_total,
FTC_GlyphQuery gquery,
FTC_Cache cache );
FT_EXPORT( void )
ftc_glyph_family_done( FTC_GlyphFamily gfam );
FTC_Family_Init( FTC_Family family,
FTC_Cache cache );
typedef struct FTC_GCacheRec_
{
FTC_CacheRec cache;
FTC_MruListRec families;
} FTC_GCacheRec, *FTC_GCache;
#define FTC_GCACHE( x ) ((FTC_GCache)(x))
/* can be used as @FTC_Cache_InitFunc */
FT_EXPORT( FT_Error )
FTC_GCache_Init( FTC_GCache cache );
/* can be used as @FTC_Cache_DoneFunc */
FT_EXPORT( void )
FTC_GCache_Done( FTC_GCache cache );
/* the glyph cache class adds fields for the family implementation */
typedef struct FTC_GCacheClassRec_
{
FTC_CacheClassRec clazz;
FTC_MruListClass family_class;
} FTC_GCacheClassRec;
typedef const FTC_GCacheClassRec* FTC_GCacheClass;
#define FTC_GCACHE_CLASS( x ) ((FTC_GCacheClass)(x))
#define FTC_CACHE__GCACHE_CLASS( x ) \
FTC_GCACHE_CLASS( FTC_CACHE(x)->org_class )
#define FTC_CACHE__FAMILY_CLASS( x ) \
((FTC_MruListClass) FTC_CACHE__GCACHE_CLASS(x)->family_class)
/* convenience function; use it instead of FTC_Manager_Register_Cache */
FT_EXPORT( FT_Error )
FTC_GCache_New( FTC_Manager manager,
FTC_GCacheClass clazz,
FTC_GCache *acache );
FT_EXPORT( FT_Error )
FTC_GCache_Lookup( FTC_GCache cache,
FT_UInt32 hash,
FT_UInt gindex,
FTC_GQuery query,
FTC_Node *anode );
#ifdef FTC_INLINE
#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash, \
gindex, query, node, error ) \
FT_BEGIN_STMNT \
FTC_GCache _gcache = FTC_GCACHE( cache ); \
FTC_GQuery _gquery = (FTC_GQuery)( query ); \
FTC_MruNode_CompareFunc _fcompare = (FTC_MruNode_CompareFunc)(famcmp); \
\
\
_gquery->gindex = (gindex); \
\
FTC_MRULIST_LOOKUP_CMP( &_gcache->families, _gquery, _fcompare, \
_gquery->family, error ); \
if ( !error ) \
FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ); \
FT_END_STMNT
/* */
#else /* !FTC_INLINE */
#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash, \
gindex, query, node, error ) \
FT_BEGIN_STMNT \
error = FTC_GCache_Lookup( FTC_GCACHE( cache ), hash, gindex, \
FTC_GQUERY( query ), (FTC_Node*)&(node) ); \
FT_END_STMNT
#endif /* !FTC_INLINE */
FT_END_HEADER

View file

@ -2,7 +2,7 @@
/* */
/* ftcimage.h */
/* */
/* FreeType Image cache (specification). */
/* FreeType Generic Image cache (specification) */
/* */
/* Copyright 2000-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
@ -16,6 +16,15 @@
/***************************************************************************/
/*
* FTC_ICache is an _abstract_ cache used to store a single FT_Glyph
* image per cache node.
*
* FTC_ICache extends FTC_GCache. For an implementation example,
* see FTC_ImageCache in `src/cache/ftbasic.c'.
*/
/*************************************************************************/
/* */
/* Each image cache really manages FT_Glyph objects. */
@ -29,284 +38,66 @@
#include <ft2build.h>
#include FT_CACHE_H
#include FT_CACHE_INTERNAL_GLYPH_H
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* cache_subsystem */
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** IMAGE CACHE OBJECT *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* @struct:
* FTC_ImageTypeRec
*
* @description:
* A simple structure used to describe the type of glyph image to be
* loaded into the cache.
*
* @fields:
* font :: An @FTC_FontRec used to describe the glyph's face and size.
*
* flags :: The load flags to be applied when loading the glyph; see
* the @FT_LOAD_XXX constants for details.
*
* @note:
* This type completely replaces the @FTC_Image_Desc structure which is
* now obsolete.
*/
typedef struct FTC_ImageTypeRec_
/* the FT_Glyph image node type - we store only 1 glyph per node */
typedef struct FTC_INodeRec_
{
FTC_FontRec font;
FT_Int32 flags;
FTC_GNodeRec gnode;
FT_Glyph glyph;
} FTC_ImageTypeRec;
} FTC_INodeRec, *FTC_INode;
typedef struct FTC_ImageTypeRec_* FTC_ImageType;
#define FTC_INODE( x ) ( (FTC_INode)( x ) )
#define FTC_INODE_GINDEX( x ) FTC_GNODE(x)->gindex
#define FTC_INODE_FAMILY( x ) FTC_GNODE(x)->family
/* */
typedef FT_Error
(*FTC_IFamily_LoadGlyphFunc)( FTC_Family family,
FT_UInt gindex,
FTC_Cache cache,
FT_Glyph *aglyph );
#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \
( FTC_FONT_COMPARE( &(d1)->font, &(d2)->font ) && \
(d1)->flags == (d2)->flags )
#define FTC_IMAGE_TYPE_HASH( d ) \
(FT_UFast)( FTC_FONT_HASH( &(d)->font ) ^ \
( (d)->flags << 4 ) )
/*************************************************************************/
/* */
/* <Type> */
/* FTC_ImageCache */
/* */
/* <Description> */
/* A handle to an glyph image cache object. They are designed to */
/* hold many distinct glyph images while not exceeding a certain */
/* memory threshold. */
/* */
typedef struct FTC_ImageCacheRec_* FTC_ImageCache;
/*************************************************************************/
/* */
/* <Function> */
/* FTC_ImageCache_New */
/* */
/* <Description> */
/* Creates a new glyph image cache. */
/* */
/* <Input> */
/* manager :: The parent manager for the image cache. */
/* */
/* <Output> */
/* acache :: A handle to the new glyph image cache object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
FT_EXPORT( FT_Error )
FTC_ImageCache_New( FTC_Manager manager,
FTC_ImageCache *acache );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_ImageCache_Lookup */
/* */
/* <Description> */
/* Retrieves a given glyph image from a glyph image cache. */
/* */
/* <Input> */
/* cache :: A handle to the source glyph image cache. */
/* */
/* type :: A pointer to a glyph image type descriptor. */
/* */
/* gindex :: The glyph index to retrieve. */
/* */
/* <Output> */
/* aglyph :: The corresponding @FT_Glyph object. 0 in case of */
/* failure. */
/* */
/* anode :: Used to return the address of of the corresponding cache */
/* node after incrementing its reference count (see note */
/* below). */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The returned glyph is owned and managed by the glyph image cache. */
/* Never try to transform or discard it manually! You can however */
/* create a copy with @FT_Glyph_Copy and modify the new one. */
/* */
/* If "anode" is _not_ NULL, it receives the address of the cache */
/* node containing the glyph image, after increasing its reference */
/* count. This ensures that the node (as well as the FT_Glyph) will */
/* always be kept in the cache until you call @FTC_Node_Unref to */
/* "release" it. */
/* */
/* If "anode" is NULL, the cache node is left unchanged, which means */
/* that the FT_Glyph could be flushed out of the cache on the next */
/* call to one of the caching sub-system APIs. Don't assume that it */
/* is persistent! */
/* */
FT_EXPORT( FT_Error )
FTC_ImageCache_Lookup( FTC_ImageCache cache,
FTC_ImageType type,
FT_UInt gindex,
FT_Glyph *aglyph,
FTC_Node *anode );
/* */
#define ftc_image_format( x ) ( (x) & 7 )
#define ftc_image_format_bitmap 0x0000
#define ftc_image_format_outline 0x0001
#define ftc_image_format_mask 0x000F
#define ftc_image_flag_monochrome 0x0010
#define ftc_image_flag_unhinted 0x0020
#define ftc_image_flag_autohinted 0x0040
#define ftc_image_flag_unscaled 0x0080
#define ftc_image_flag_no_sbits 0x0100
/* monochrome bitmap */
#define ftc_image_mono ftc_image_format_bitmap | \
ftc_image_flag_monochrome
/* anti-aliased bitmap */
#define ftc_image_grays ftc_image_format_bitmap
/* scaled outline */
#define ftc_image_outline ftc_image_format_outline
/*************************************************************************/
/* */
/* <Struct> */
/* FTC_Image_Desc */
/* */
/* <Description> */
/* THIS TYPE IS DEPRECATED. Use @FTC_ImageTypeRec instead. */
/* */
/* A simple structure used to describe a given glyph image category. */
/* */
/* <Fields> */
/* font :: An @FTC_FontRec used to describe the glyph's face */
/* and size. */
/* */
/* image_type :: The glyph image's type. */
/* */
typedef struct FTC_Image_Desc_
typedef struct FTC_IFamilyClassRec_
{
FTC_FontRec font;
FT_UInt image_type;
FTC_MruListClassRec clazz;
FTC_IFamily_LoadGlyphFunc family_load_glyph;
} FTC_Image_Desc;
} FTC_IFamilyClassRec;
typedef const FTC_IFamilyClassRec* FTC_IFamilyClass;
#define FTC_IFAMILY_CLASS( x ) ((FTC_IFamilyClass)(x))
#define FTC_CACHE__IFAMILY_CLASS( x ) \
FTC_IFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS(x)->family_class )
/*************************************************************************/
/* */
/* <Type> */
/* FTC_Image_Cache */
/* */
/* <Description> */
/* THIS TYPE IS DEPRECATED. Use @FTC_ImageCache instead. */
/* */
typedef FTC_ImageCache FTC_Image_Cache;
/* can be used as a @FTC_Node_FreeFunc */
FT_EXPORT( void )
FTC_INode_Free( FTC_INode inode,
FTC_Cache cache );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Image_Cache_New */
/* */
/* <Description> */
/* THIS FUNCTION IS DEPRECATED. Use @FTC_ImageCache_New instead. */
/* */
/* Creates a new glyph image cache. */
/* */
/* <Input> */
/* manager :: The parent manager for the image cache. */
/* */
/* <Output> */
/* acache :: A handle to the new glyph image cache object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* Can be used as @FTC_Node_NewFunc. `gquery.index' and `gquery.family'
* must be set correctly. This function will call the `family_load_glyph'
* method to load the FT_Glyph into the cache node.
*/
FT_EXPORT( FT_Error )
FTC_Image_Cache_New( FTC_Manager manager,
FTC_Image_Cache *acache );
FTC_INode_New( FTC_INode *pinode,
FTC_GQuery gquery,
FTC_Cache cache );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Image_Cache_Lookup */
/* */
/* <Description> */
/* THIS FUNCTION IS DEPRECATED. Use @FTC_ImageCache_Lookup instead. */
/* */
/* <Input> */
/* cache :: A handle to the source glyph image cache. */
/* */
/* desc :: A pointer to a glyph image descriptor. */
/* */
/* gindex :: The glyph index to retrieve. */
/* */
/* <Output> */
/* aglyph :: The corresponding @FT_Glyph object. 0 in case of */
/* failure. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The returned glyph is owned and managed by the glyph image cache. */
/* Never try to transform or discard it manually! You can however */
/* create a copy with @FT_Glyph_Copy and modify the new one. */
/* */
/* Because the glyph image cache limits the total amount of memory */
/* taken by the glyphs it holds, the returned glyph might disappear */
/* on a later invocation of this function! It is a cache after */
/* all... */
/* */
/* Use this function to "lock" the glyph as long as it is needed. */
/* */
FT_EXPORT( FT_Error )
FTC_Image_Cache_Lookup( FTC_Image_Cache cache,
FTC_Image_Desc* desc,
FT_UInt gindex,
FT_Glyph *aglyph );
/* can be used as @FTC_Node_WeightFunc */
FT_EXPORT( FT_ULong )
FTC_INode_Weight( FTC_INode inode );
/* */
FT_END_HEADER
#endif /* __FTCIMAGE_H__ */

View file

@ -4,7 +4,7 @@
/* */
/* FreeType Cache Manager (specification). */
/* */
/* Copyright 2000-2001 by */
/* Copyright 2000-2001, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -65,7 +65,7 @@
#include <ft2build.h>
#include FT_CACHE_H
#include FT_CACHE_INTERNAL_LRU_H
#include FT_CACHE_INTERNAL_MRU_H
#include FT_CACHE_INTERNAL_CACHE_H
@ -88,91 +88,25 @@ FT_BEGIN_HEADER
#define FTC_MAX_CACHES 16
typedef struct FTC_FamilyEntryRec_
{
FTC_Family family;
FTC_Cache cache;
FT_UInt index;
FT_UInt link;
} FTC_FamilyEntryRec, *FTC_FamilyEntry;
#define FTC_FAMILY_ENTRY_NONE ( (FT_UInt)-1 )
typedef struct FTC_FamilyTableRec_
{
FT_UInt count;
FT_UInt size;
FTC_FamilyEntry entries;
FT_UInt free;
} FTC_FamilyTableRec, *FTC_FamilyTable;
FT_EXPORT( FT_Error )
ftc_family_table_alloc( FTC_FamilyTable table,
FT_Memory memory,
FTC_FamilyEntry *aentry );
FT_EXPORT( void )
ftc_family_table_free( FTC_FamilyTable table,
FT_UInt idx );
/*************************************************************************/
/* */
/* <Struct> */
/* FTC_ManagerRec */
/* */
/* <Description> */
/* The cache manager structure. */
/* */
/* <Fields> */
/* library :: A handle to a FreeType library instance. */
/* */
/* faces_list :: The lru list of @FT_Face objects in the cache. */
/* */
/* sizes_list :: The lru list of @FT_Size objects in the cache. */
/* */
/* max_weight :: The maximum cache pool weight. */
/* */
/* cur_weight :: The current cache pool weight. */
/* */
/* num_nodes :: The current number of nodes in the manager. */
/* */
/* nodes_list :: The global lru list of all cache nodes. */
/* */
/* caches :: A table of installed/registered cache objects. */
/* */
/* request_data :: User-provided data passed to the requester. */
/* */
/* request_face :: User-provided function used to implement a mapping */
/* between abstract @FTC_FaceID values and real */
/* @FT_Face objects. */
/* */
/* families :: Global table of families. */
/* */
typedef struct FTC_ManagerRec_
{
FT_Library library;
FT_LruList faces_list;
FT_LruList sizes_list;
FT_Memory memory;
FTC_Node nodes_list;
FT_ULong max_weight;
FT_ULong cur_weight;
FT_UInt num_nodes;
FTC_Node nodes_list;
FTC_Cache caches[FTC_MAX_CACHES];
FT_UInt num_caches;
FTC_MruListRec faces;
FTC_MruListRec sizes;
FT_Pointer request_data;
FTC_Face_Requester request_face;
FTC_FamilyTableRec families;
} FTC_ManagerRec;
@ -201,43 +135,40 @@ FT_BEGIN_HEADER
FTC_Manager_Compress( FTC_Manager manager );
/* try to flush `count' old nodes from the cache; return the number
* of really flushed nodes
*/
FT_EXPORT( FT_UInt )
FTC_Manager_FlushN( FTC_Manager manager,
FT_UInt count );
/* this must be used internally for the moment */
FT_EXPORT( FT_Error )
FTC_Manager_Register_Cache( FTC_Manager manager,
FTC_Cache_Class clazz,
FTC_Cache *acache );
FTC_Manager_RegisterCache( FTC_Manager manager,
FTC_CacheClass clazz,
FTC_Cache *acache );
/* */
/* can be called to increment a node's reference count */
FT_EXPORT( void )
FTC_Node_Ref( FTC_Node node,
FTC_Manager manager );
#define FTC_SCALER_COMPARE( a, b ) \
( (a)->face_id == (b)->face_id && \
(a)->width == (b)->width && \
(a)->height == (b)->height && \
((a)->pixel != 0) == ((b)->pixel != 0) && \
( (a)->pixel || \
( (a)->x_res == (b)->x_res && \
(a)->y_res == (b)->y_res ) ) )
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Node_Unref */
/* */
/* <Description> */
/* Decrement a cache node's internal reference count. When the count */
/* reaches 0, it is not destroyed but becomes eligible for subsequent */
/* cache flushes. */
/* */
/* <Input> */
/* node :: The cache node handle. */
/* */
/* manager :: The cache manager handle. */
/* */
FT_EXPORT( void )
FTC_Node_Unref( FTC_Node node,
FTC_Manager manager );
#define FTC_SCALER_HASH( q ) \
( FTC_FACE_ID_HASH( (q)->face_id ) + \
(q)->width + (q)->height*7 + \
( (q)->pixel ? 0 : ( (q)->x_res*33 ^ (q)->y_res*61 ) ) )
/* */
FT_END_HEADER
#endif /* __FTCMANAG_H__ */

View file

@ -4,7 +4,7 @@
/* */
/* A small-bitmap cache (specification). */
/* */
/* Copyright 2000-2001, 2002 by */
/* Copyright 2000-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -22,251 +22,72 @@
#include <ft2build.h>
#include FT_CACHE_H
#include FT_CACHE_IMAGE_H
#include FT_CACHE_INTERNAL_GLYPH_H
FT_BEGIN_HEADER
#define FTC_SBIT_ITEMS_PER_NODE 16
/*************************************************************************/
/* */
/* <Section> */
/* cache_subsystem */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* FTC_SBit */
/* */
/* <Description> */
/* A handle to a small bitmap descriptor. See the @FTC_SBitRec */
/* structure for details. */
/* */
typedef struct FTC_SBitRec_* FTC_SBit;
/*************************************************************************/
/* */
/* <Struct> */
/* FTC_SBitRec */
/* */
/* <Description> */
/* A very compact structure used to describe a small glyph bitmap. */
/* */
/* <Fields> */
/* width :: The bitmap width in pixels. */
/* */
/* height :: The bitmap height in pixels. */
/* */
/* left :: The horizontal distance from the pen position to the */
/* left bitmap border (a.k.a. `left side bearing', or */
/* `lsb'). */
/* */
/* top :: The vertical distance from the pen position (on the */
/* baseline) to the upper bitmap border (a.k.a. `top */
/* side bearing'). The distance is positive for upwards */
/* Y coordinates. */
/* */
/* format :: The format of the glyph bitmap (monochrome or gray). */
/* */
/* max_grays :: Maximum gray level value (in the range 1 to 255). */
/* */
/* pitch :: The number of bytes per bitmap line. May be positive */
/* or negative. */
/* */
/* xadvance :: The horizontal advance width in pixels. */
/* */
/* yadvance :: The vertical advance height in pixels. */
/* */
/* buffer :: A pointer to the bitmap pixels. */
/* */
typedef struct FTC_SBitRec_
typedef struct FTC_SNodeRec_
{
FT_Byte width;
FT_Byte height;
FT_Char left;
FT_Char top;
FTC_GNodeRec gnode;
FT_UInt count;
FTC_SBitRec sbits[FTC_SBIT_ITEMS_PER_NODE];
FT_Byte format;
FT_Byte max_grays;
FT_Short pitch;
FT_Char xadvance;
FT_Char yadvance;
FT_Byte* buffer;
} FTC_SBitRec;
} FTC_SNodeRec, *FTC_SNode;
/*************************************************************************/
/* */
/* <Type> */
/* FTC_SBitCache */
/* */
/* <Description> */
/* A handle to a small bitmap cache. These are special cache objects */
/* used to store small glyph bitmaps (and anti-aliased pixmaps) in a */
/* much more efficient way than the traditional glyph image cache */
/* implemented by @FTC_ImageCache. */
/* */
typedef struct FTC_SBitCacheRec_* FTC_SBitCache;
#define FTC_SNODE( x ) ( (FTC_SNode)( x ) )
#define FTC_SNODE_GINDEX( x ) FTC_GNODE( x )->gindex
#define FTC_SNODE_FAMILY( x ) FTC_GNODE( x )->family
typedef FT_UInt
(*FTC_SFamily_GetCountFunc)( FTC_Family family,
FTC_Manager manager );
typedef FT_Error
(*FTC_SFamily_LoadGlyphFunc)( FTC_Family family,
FT_UInt gindex,
FTC_Manager manager,
FT_Face *aface );
typedef struct FTC_SFamilyClassRec_
{
FTC_MruListClassRec clazz;
FTC_SFamily_GetCountFunc family_get_count;
FTC_SFamily_LoadGlyphFunc family_load_glyph;
} FTC_SFamilyClassRec;
typedef const FTC_SFamilyClassRec* FTC_SFamilyClass;
#define FTC_SFAMILY_CLASS( x ) ((FTC_SFamilyClass)(x))
#define FTC_CACHE__SFAMILY_CLASS( x ) \
FTC_SFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS( x )->family_class )
/*************************************************************************/
/* */
/* <Type> */
/* FTC_SBit_Cache */
/* */
/* <Description> */
/* DEPRECATED. Use @FTC_SBitCache instead. */
/* */
typedef FTC_SBitCache FTC_SBit_Cache;
FT_EXPORT( void )
FTC_SNode_Free( FTC_SNode snode,
FTC_Cache cache );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_SBitCache_New */
/* */
/* <Description> */
/* Creates a new cache to store small glyph bitmaps. */
/* */
/* <Input> */
/* manager :: A handle to the source cache manager. */
/* */
/* <Output> */
/* acache :: A handle to the new sbit cache. NULL in case of error. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
FT_EXPORT( FT_Error )
FTC_SBitCache_New( FTC_Manager manager,
FTC_SBitCache *acache );
FTC_SNode_New( FTC_SNode *psnode,
FTC_GQuery gquery,
FTC_Cache cache );
FT_EXPORT( FT_ULong )
FTC_SNode_Weight( FTC_SNode inode );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_SBitCache_Lookup */
/* */
/* <Description> */
/* Looks up a given small glyph bitmap in a given sbit cache and */
/* "lock" it to prevent its flushing from the cache until needed */
/* */
/* <Input> */
/* cache :: A handle to the source sbit cache. */
/* */
/* type :: A pointer to the glyph image type descriptor. */
/* */
/* gindex :: The glyph index. */
/* */
/* <Output> */
/* sbit :: A handle to a small bitmap descriptor. */
/* */
/* anode :: Used to return the address of of the corresponding cache */
/* node after incrementing its reference count (see note */
/* below). */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The small bitmap descriptor and its bit buffer are owned by the */
/* cache and should never be freed by the application. They might */
/* as well disappear from memory on the next cache lookup, so don't */
/* treat them as persistent data. */
/* */
/* The descriptor's `buffer' field is set to 0 to indicate a missing */
/* glyph bitmap. */
/* */
/* If "anode" is _not_ NULL, it receives the address of the cache */
/* node containing the bitmap, after increasing its reference count. */
/* This ensures that the node (as well as the image) will always be */
/* kept in the cache until you call @FTC_Node_Unref to "release" it. */
/* */
/* If "anode" is NULL, the cache node is left unchanged, which means */
/* that the bitmap could be flushed out of the cache on the next */
/* call to one of the caching sub-system APIs. Don't assume that it */
/* is persistent! */
/* */
FT_EXPORT( FT_Error )
FTC_SBitCache_Lookup( FTC_SBitCache cache,
FTC_ImageType type,
FT_UInt gindex,
FTC_SBit *sbit,
FTC_Node *anode );
FT_EXPORT( FT_Bool )
FTC_SNode_Compare( FTC_SNode snode,
FTC_GQuery gquery,
FTC_Cache cache );
/* */
/*************************************************************************/
/* */
/* <Function> */
/* FTC_SBit_Cache_New */
/* */
/* <Description> */
/* DEPRECATED. Use @FTC_SBitCache_New instead. */
/* */
/* Creates a new cache to store small glyph bitmaps. */
/* */
/* <Input> */
/* manager :: A handle to the source cache manager. */
/* */
/* <Output> */
/* acache :: A handle to the new sbit cache. NULL in case of error. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
FT_EXPORT( FT_Error )
FTC_SBit_Cache_New( FTC_Manager manager,
FTC_SBit_Cache *acache );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_SBit_Cache_Lookup */
/* */
/* <Description> */
/* DEPRECATED. Use @FTC_SBitCache_Lookup instead. */
/* */
/* Looks up a given small glyph bitmap in a given sbit cache. */
/* */
/* <Input> */
/* cache :: A handle to the source sbit cache. */
/* */
/* desc :: A pointer to the glyph image descriptor. */
/* */
/* gindex :: The glyph index. */
/* */
/* <Output> */
/* sbit :: A handle to a small bitmap descriptor. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The small bitmap descriptor and its bit buffer are owned by the */
/* cache and should never be freed by the application. They might */
/* as well disappear from memory on the next cache lookup, so don't */
/* treat them as persistent data. */
/* */
/* The descriptor's `buffer' field is set to 0 to indicate a missing */
/* glyph bitmap. */
/* */
FT_EXPORT( FT_Error )
FTC_SBit_Cache_Lookup( FTC_SBit_Cache cache,
FTC_Image_Desc* desc,
FT_UInt gindex,
FTC_SBit *sbit );
FT_END_HEADER
#endif /* __FTCSBITS_H__ */

View file

@ -137,7 +137,7 @@ FT_BEGIN_HEADER
#error "no 32bit type found -- please check your configuration files"
#endif
/* now, lookup for an integer type that is at least 32 bits */
/* look up an integer type that is at least 32 bits */
#if FT_SIZEOF_INT >= 4
typedef int FT_Fast;
@ -192,6 +192,11 @@ FT_BEGIN_HEADER
#endif /* FT_SIZEOF_LONG == 8 */
#define FT_BEGIN_STMNT do {
#define FT_END_STMNT } while ( 0 )
#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
/*************************************************************************/
/* */
/* A 64-bit data type will create compilation problems if you compile */

View file

@ -4,7 +4,7 @@
/* */
/* Build macros of the FreeType 2 library. */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -281,7 +281,7 @@
/* A macro used in #include statements to name the file containing */
/* the module management API of FreeType 2. */
/* */
#define FT_MODULE_H <freetype/ftmodule.h>
#define FT_MODULE_H <freetype/ftmodapi.h>
/*************************************************************************/
@ -433,7 +433,10 @@
/* see the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need */
/* to store small glyph bitmaps, as it will use less memory. */
/* */
#define FT_CACHE_IMAGE_H <freetype/cache/ftcimage.h>
/* This macro is deprecated. Simply include @FT_CACHE_H to have all */
/* glyph image-related cache declarations. */
/* */
#define FT_CACHE_IMAGE_H FT_CACHE_H
/*************************************************************************/
@ -450,7 +453,10 @@
/* in @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images, */
/* including scalable outlines. */
/* */
#define FT_CACHE_SMALL_BITMAPS_H <freetype/cache/ftcsbits.h>
/* This macro is deprecated. Simply include @FT_CACHE_H to have all */
/* small bitmaps-related cache declarations. */
/* */
#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H
/*************************************************************************/
@ -462,7 +468,10 @@
/* A macro used in #include statements to name the file containing */
/* the `charmap' API of the FreeType 2 cache sub-system. */
/* */
#define FT_CACHE_CHARMAP_H <freetype/cache/ftccmap.h>
/* This macro is deprecated. Simply include @FT_CACHE_H to have all */
/* charmap-based cache declarations. */
/* */
#define FT_CACHE_CHARMAP_H FT_CACHE_H
/*************************************************************************/
@ -508,26 +517,30 @@
/* */
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
#define FT_STROKER_H <freetype/ftstroke.h>
#define FT_SYNTHESIS_H <freetype/ftsynth.h>
#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h>
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
#define FT_STROKER_H <freetype/ftstroke.h>
#define FT_SYNTHESIS_H <freetype/ftsynth.h>
#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h>
#define FT_CACHE_MANAGER_H <freetype/cache/ftcmanag.h>
#define FT_CACHE_MANAGER_H <freetype/cache/ftcmanag.h>
#define FT_CACHE_INTERNAL_LRU_H <freetype/cache/ftlru.h>
#define FT_CACHE_INTERNAL_GLYPH_H <freetype/cache/ftcglyph.h>
#define FT_CACHE_INTERNAL_CACHE_H <freetype/cache/ftccache.h>
#define FT_CACHE_INTERNAL_MRU_H <freetype/cache/ftcmru.h>
#define FT_CACHE_INTERNAL_MANAGER_H <freetype/cache/ftcmanag.h>
#define FT_CACHE_INTERNAL_CACHE_H <freetype/cache/ftccache.h>
#define FT_CACHE_INTERNAL_GLYPH_H <freetype/cache/ftcglyph.h>
#define FT_CACHE_INTERNAL_IMAGE_H <freetype/cache/ftcimage.h>
#define FT_CACHE_INTERNAL_SBITS_H <freetype/cache/ftcsbits.h>
#define FT_XFREE86_H <freetype/ftxf86.h>
#define FT_INCREMENTAL_H <freetype/ftincrem.h>
#define FT_XFREE86_H <freetype/ftxf86.h>
#define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h>
#define FT_INCREMENTAL_H <freetype/ftincrem.h>
#define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h>
/* now include internal headers definitions from <freetype/internal/...> */
#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
#include FT_INTERNAL_INTERNAL_H

View file

@ -257,7 +257,7 @@ FT_BEGIN_HEADER
/* The maximum number of modules that can be registered in a single */
/* FreeType library object. 32 is the default. */
/* */
#define FT_MAX_MODULES 16384
#define FT_MAX_MODULES 32767
/*************************************************************************/
@ -399,7 +399,7 @@ FT_BEGIN_HEADER
/* Do not #undef this macro here, since the build system might */
/* define it for certain configurations only. */
/* */
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
/*************************************************************************/
@ -411,11 +411,8 @@ FT_BEGIN_HEADER
/* FT_PARAM_TAG_UNPATENTED_HINTING; or when the debug hook */
/* FT_DEBUG_HOOK_UNPATENTED_HINTING is globally actived */
/* */
/* XXX: WARNING: THIS DOESN'T WORK AS ADVERTISED YET. PLEASE DO NOT */
/* DEFINE FOR THE MOMENT.. */
/* */
#define FT_DEBUG_HOOK_UNPATENTED_HINTING
#define TT_CONFIG_OPTION_UNPATENTED_HINTING
#define FT_DEBUG_HOOK_UNPATENTED_HINTING
#define TT_CONFIG_OPTION_UNPATENTED_HINTING
/*************************************************************************/

View file

@ -5,7 +5,7 @@
/* ANSI-specific library and header configuration file (specification */
/* only). */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -73,10 +73,11 @@
#include <ctype.h>
#define ft_isalnum isalnum
#define ft_isupper isupper
#define ft_islower islower
#define ft_xdigit isxdigit
#define ft_isalnum isalnum
#define ft_isupper isupper
#define ft_islower islower
#define ft_isdigit isdigit
#define ft_isxdigit isxdigit
#include <string.h>
@ -109,7 +110,7 @@
#define ft_qsort qsort
#define ft_exit exit /* only used to exit from unhandled exceptions */
#define ft_atoi atoi
#define ft_atol atol
/**********************************************************************/

View file

@ -16,6 +16,15 @@
/***************************************************************************/
#ifndef FT_FREETYPE_H
#error "`ft2build.h' hasn't been included yet!"
#error "Please always use macros to include FreeType header files."
#error "Example:"
#error " #include <ft2build.h>"
#error " #include FT_FREETYPE_H"
#endif
#ifndef __FREETYPE_H__
#define __FREETYPE_H__
@ -35,7 +44,7 @@
/* */
#define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 1
#define FREETYPE_PATCH 5
#define FREETYPE_PATCH 8
#include <ft2build.h>
@ -581,6 +590,37 @@ FT_BEGIN_HEADER
/* the font file, for the cases when they are needed, with the Adobe */
/* values as well. */
/* */
/* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
/* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
/* FT_ENCODING_UNICODE). Use `FT_Get_BDF_Charset_ID' to find out */
/* which encoding is really present. If, for example, the */
/* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */
/* the font is encoded in KOI8-R. */
/* */
/* FT_ENCODING_NONE is always set (with a single exception) by the */
/* winfonts driver. Use `FT_Get_WinFNT_Header' and examine the */
/* `charset' field of the `FT_WinFNT_HeaderRec' structure to find out */
/* which encoding is really present. For example, FT_WinFNT_ID_CP1251 */
/* (204) means Windows code page 1251 (for Russian). */
/* */
/* FT_ENCODING_NONE is set if `platform_id' is `TT_PLATFORM_MACINTOSH' */
/* and `encoding_id' is not `TT_MAC_ID_ROMAN' (otherwise it is set to */
/* FT_ENCODING_APPLE_ROMAN). */
/* */
/* If `platform_id' is `TT_PLATFORM_MACINTOSH', use the function */
/* `FT_Get_CMap_Language_ID' to query the Mac language ID which may be */
/* needed to be able to distinguish Apple encoding variants. See */
/* */
/* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */
/* */
/* to get an idea how to do that. Basically, if the language ID is 0, */
/* dont use it, otherwise subtract 1 from the language ID. Then */
/* examine `encoding_id'. If, for example, `encoding_id' is */
/* `TT_MAC_ID_ROMAN' and the language ID (minus 1) is */
/* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
/* `TT_MAC_ID_ARABIC' with `TT_MAC_LANGID_FARSI' means the Farsi */
/* variant the Arabic encoding. */
/* */
typedef enum FT_Encoding_
{
FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
@ -932,7 +972,7 @@ FT_BEGIN_HEADER
/* FT_FACE_FLAG_XXX */
/* */
/* <Description> */
/* A list of bit flags used in the 'face_flags' field of the */
/* A list of bit flags used in the `face_flags' field of the */
/* @FT_FaceRec structure. They inform client applications of */
/* properties of the corresponding face. */
/* */
@ -2021,7 +2061,9 @@ FT_BEGIN_HEADER
/* will be loaded. */
/* */
/* <Input> */
/* glyph_index :: The index of the glyph in the font file. */
/* glyph_index :: The index of the glyph in the font file. For */
/* CID-keyed fonts (either in PS or in CFF format) */
/* this argument specifies the CID value. */
/* */
/* load_flags :: A flag indicating what to load for this glyph. The */
/* @FT_LOAD_XXX constants can be used to control the */

View file

@ -4,7 +4,7 @@
/* */
/* FreeType exact bbox computation (specification). */
/* */
/* Copyright 1996-2001 by */
/* Copyright 1996-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -34,6 +34,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER

View file

@ -22,6 +22,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER

View file

@ -4,7 +4,7 @@
/* */
/* FreeType Cache subsystem (specification). */
/* */
/* Copyright 1996-2001, 2002, 2003 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -63,8 +63,8 @@ FT_BEGIN_HEADER
/* FTC_Face_Requester */
/* */
/* FTC_Manager_New */
/* FTC_Manager_Lookup_Face */
/* FTC_Manager_Lookup_Size */
/* FTC_Manager_LookupFace */
/* FTC_Manager_LookupSize */
/* */
/* FTC_Node */
/* FTC_Node_Ref */
@ -108,10 +108,10 @@ FT_BEGIN_HEADER
/* FTC_FaceID */
/* */
/* <Description> */
/* A generic pointer type that is used to identity face objects. The */
/* An opaque pointer type that is used to identity face objects. The */
/* contents of such objects is application-dependent. */
/* */
typedef FT_Pointer FTC_FaceID;
typedef struct FTC_FaceIDRec_* FTC_FaceID;
/*************************************************************************/
@ -257,22 +257,16 @@ FT_BEGIN_HEADER
/* Creates a new cache manager. */
/* */
/* <Input> */
/* library :: The parent FreeType library handle to use. */
/* library :: The parent FreeType library handle to use. */
/* */
/* max_faces :: Maximum number of faces to keep alive in manager. */
/* Use 0 for defaults. */
/* max_bytes :: Maximum number of bytes to use for cached data. */
/* Use 0 for defaults. */
/* */
/* max_sizes :: Maximum number of sizes to keep alive in manager. */
/* Use 0 for defaults. */
/* requester :: An application-provided callback used to translate */
/* face IDs into real @FT_Face objects. */
/* */
/* max_bytes :: Maximum number of bytes to use for cached data. */
/* Use 0 for defaults. */
/* */
/* requester :: An application-provided callback used to translate */
/* face IDs into real @FT_Face objects. */
/* */
/* req_data :: A generic pointer that is passed to the requester */
/* each time it is called (see @FTC_Face_Requester). */
/* req_data :: A generic pointer that is passed to the requester */
/* each time it is called (see @FTC_Face_Requester). */
/* */
/* <Output> */
/* amanager :: A handle to a new manager object. 0 in case of */
@ -325,7 +319,7 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Manager_Lookup_Face */
/* FTC_Manager_LookupFace */
/* */
/* <Description> */
/* Retrieves the @FT_Face object that corresponds to a given face ID */
@ -348,64 +342,480 @@ FT_BEGIN_HEADER
/* */
/* The @FT_Face object doesn't necessarily have a current size object */
/* (i.e., face->size can be 0). If you need a specific `font size', */
/* use @FTC_Manager_Lookup_Size instead. */
/* use @FTC_Manager_LookupSize instead. */
/* */
/* Never change the face's transformation matrix (i.e., never call */
/* the @FT_Set_Transform function) on a returned face! If you need */
/* to transform glyphs, do it yourself after glyph loading. */
/* */
FT_EXPORT( FT_Error )
FTC_Manager_Lookup_Face( FTC_Manager manager,
FTC_FaceID face_id,
FT_Face *aface );
FTC_Manager_LookupFace( FTC_Manager manager,
FTC_FaceID face_id,
FT_Face *aface );
/*************************************************************************/
/* */
/* <Struct> */
/* FTC_ScalerRec */
/* */
/* <Description> */
/* A structure used to describe a given character size in either */
/* pixels or points to the cache manager. See */
/* @FTC_Manager_LookupSize. */
/* */
/* <Fields> */
/* face_id :: The source face ID. */
/* */
/* width :: The character width. */
/* */
/* height :: The character height. */
/* */
/* pixel :: A Boolean. If TRUE, the `width' and `height' fields */
/* are interpreted as integer pixel character sizes. */
/* Otherwise, they are expressed as 1/64th of points. */
/* */
/* x_res :: Only used when `pixel' is FALSE to indicate the */
/* horizontal resolution in dpi. */
/* */
/* y_res :: Only used when `pixel' is FALSE to indicate the */
/* vertical resolution in dpi. */
/* */
/* <Note> */
/* This type is mainly used to retrieve @FT_Size objects through the */
/* cache manager. */
/* */
typedef struct FTC_ScalerRec_
{
FTC_FaceID face_id;
FT_UInt width;
FT_UInt height;
FT_Int pixel;
FT_UInt x_res;
FT_UInt y_res;
} FTC_ScalerRec, *FTC_Scaler;
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Manager_Lookup_Size */
/* FTC_Manager_LookupSize */
/* */
/* <Description> */
/* Retrieves the @FT_Face and @FT_Size objects that correspond to a */
/* given font. */
/* Retrieve the @FT_Size object that corresponds to a given */
/* @FTC_Scaler through a cache manager. */
/* */
/* <Input> */
/* manager :: A handle to the cache manager. */
/* */
/* font :: The font to use. */
/* scaler :: A scaler handle. */
/* */
/* <Output> */
/* aface :: A pointer to the handle of the face object. Set it to */
/* zero if you don't need it. */
/* */
/* asize :: A pointer to the handle of the size object. Set it to */
/* zero if you don't need it. */
/* asize :: A handle to the size object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The returned @FT_Face object is always owned by the manager. You */
/* should never try to discard it yourself. */
/* The returned @FT_Size object is always owned by the manager. You */
/* should never try to discard it by yourself. */
/* */
/* Never change the face's transformation matrix (i.e., never call */
/* the @FT_Set_Transform function) on a returned face! If you need */
/* to transform glyphs, do it yourself after glyph loading. */
/* */
/* Similarly, the returned @FT_Size object is always owned by the */
/* manager. You should never try to discard it, and never change its */
/* settings with @FT_Set_Pixel_Sizes or @FT_Set_Char_Size! */
/* */
/* The returned size object is the face's current size, which means */
/* that you can call @FT_Load_Glyph with the face if you need to. */
/* You can access the parent @FT_Face object simply as `size->face' */
/* if you need it. Note that this object is also owned by the */
/* manager. */
/* */
FT_EXPORT( FT_Error )
FTC_Manager_Lookup_Size( FTC_Manager manager,
FTC_Font font,
FT_Face *aface,
FT_Size *asize );
FTC_Manager_LookupSize( FTC_Manager manager,
FTC_Scaler scaler,
FT_Size *asize );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Node_Unref */
/* */
/* <Description> */
/* Decrement a cache node's internal reference count. When the count */
/* reaches 0, it is not destroyed but becomes eligible for subsequent */
/* cache flushes. */
/* */
/* <Input> */
/* node :: The cache node handle. */
/* */
/* manager :: The cache manager handle. */
/* */
FT_EXPORT( void )
FTC_Node_Unref( FTC_Node node,
FTC_Manager manager );
/* remove all nodes belonging to a given face_id */
FT_EXPORT( void )
FTC_Manager_RemoveFaceID( FTC_Manager manager,
FTC_FaceID face_id );
/*************************************************************************/
/* */
/* <Section> */
/* cache_subsystem */
/* */
/*************************************************************************/
/************************************************************************
*
* @type:
* FTC_CMapCache
*
* @description:
* An opaque handle used to manager a charmap cache. This cache is
* to hold character codes -> glyph indices mappings.
*/
typedef struct FTC_CMapCacheRec_* FTC_CMapCache;
/*************************************************************************/
/* */
/* @function: */
/* FTC_CMapCache_New */
/* */
/* @description: */
/* Create a new charmap cache. */
/* */
/* @input: */
/* manager :: A handle to the cache manager. */
/* */
/* @output: */
/* acache :: A new cache handle. NULL in case of error. */
/* */
/* @return: */
/* FreeType error code. 0 means success. */
/* */
/* @note: */
/* Like all other caches, this one will be destroyed with the cache */
/* manager. */
/* */
FT_EXPORT( FT_Error )
FTC_CMapCache_New( FTC_Manager manager,
FTC_CMapCache *acache );
/* retrieve the index of a given charmap */
FT_EXPORT( FT_Int )
FT_Get_CharMap_Index( FT_CharMap charmap );
/*************************************************************************/
/* */
/* @function: */
/* FTC_CMapCache_Lookup */
/* */
/* @description: */
/* Translate a character code into a glyph index, using the charmap */
/* cache. */
/* */
/* @input: */
/* cache :: A charmap cache handle. */
/* */
/* face_id :: source face id */
/* */
/* cmap_index :: index of charmap in source face */
/* */
/* char_code :: The character code (in the corresponding charmap). */
/* */
/* @return: */
/* Glyph index. 0 means `no glyph'. */
/* */
FT_EXPORT( FT_UInt )
FTC_CMapCache_Lookup( FTC_CMapCache cache,
FTC_FaceID face_id,
FT_Int cmap_index,
FT_UInt32 char_code );
/*************************************************************************/
/* */
/* <Section> */
/* cache_subsystem */
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** IMAGE CACHE OBJECT *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
typedef struct FTC_ImageTypeRec_
{
FTC_FaceID face_id;
FT_Int width;
FT_Int height;
FT_Int32 flags;
} FTC_ImageTypeRec;
typedef struct FTC_ImageTypeRec_* FTC_ImageType;
/* */
#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \
( FTC_FONT_COMPARE( &(d1)->font, &(d2)->font ) && \
(d1)->flags == (d2)->flags )
#define FTC_IMAGE_TYPE_HASH( d ) \
(FT_UFast)( FTC_FONT_HASH( &(d)->font ) ^ \
( (d)->flags << 4 ) )
/*************************************************************************/
/* */
/* <Type> */
/* FTC_ImageCache */
/* */
/* <Description> */
/* A handle to an glyph image cache object. They are designed to */
/* hold many distinct glyph images while not exceeding a certain */
/* memory threshold. */
/* */
typedef struct FTC_ImageCacheRec_* FTC_ImageCache;
/*************************************************************************/
/* */
/* <Function> */
/* FTC_ImageCache_New */
/* */
/* <Description> */
/* Creates a new glyph image cache. */
/* */
/* <Input> */
/* manager :: The parent manager for the image cache. */
/* */
/* <Output> */
/* acache :: A handle to the new glyph image cache object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
FT_EXPORT( FT_Error )
FTC_ImageCache_New( FTC_Manager manager,
FTC_ImageCache *acache );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_ImageCache_Lookup */
/* */
/* <Description> */
/* Retrieves a given glyph image from a glyph image cache. */
/* */
/* <Input> */
/* cache :: A handle to the source glyph image cache. */
/* */
/* type :: A pointer to a glyph image type descriptor. */
/* */
/* gindex :: The glyph index to retrieve. */
/* */
/* <Output> */
/* aglyph :: The corresponding @FT_Glyph object. 0 in case of */
/* failure. */
/* */
/* anode :: Used to return the address of of the corresponding cache */
/* node after incrementing its reference count (see note */
/* below). */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The returned glyph is owned and managed by the glyph image cache. */
/* Never try to transform or discard it manually! You can however */
/* create a copy with @FT_Glyph_Copy and modify the new one. */
/* */
/* If `anode' is _not_ NULL, it receives the address of the cache */
/* node containing the glyph image, after increasing its reference */
/* count. This ensures that the node (as well as the FT_Glyph) will */
/* always be kept in the cache until you call @FTC_Node_Unref to */
/* `release' it. */
/* */
/* If `anode' is NULL, the cache node is left unchanged, which means */
/* that the FT_Glyph could be flushed out of the cache on the next */
/* call to one of the caching sub-system APIs. Don't assume that it */
/* is persistent! */
/* */
FT_EXPORT( FT_Error )
FTC_ImageCache_Lookup( FTC_ImageCache cache,
FTC_ImageType type,
FT_UInt gindex,
FT_Glyph *aglyph,
FTC_Node *anode );
/*************************************************************************/
/* */
/* <Type> */
/* FTC_SBit */
/* */
/* <Description> */
/* A handle to a small bitmap descriptor. See the @FTC_SBitRec */
/* structure for details. */
/* */
typedef struct FTC_SBitRec_* FTC_SBit;
/*************************************************************************/
/* */
/* <Struct> */
/* FTC_SBitRec */
/* */
/* <Description> */
/* A very compact structure used to describe a small glyph bitmap. */
/* */
/* <Fields> */
/* width :: The bitmap width in pixels. */
/* */
/* height :: The bitmap height in pixels. */
/* */
/* left :: The horizontal distance from the pen position to the */
/* left bitmap border (a.k.a. `left side bearing', or */
/* `lsb'). */
/* */
/* top :: The vertical distance from the pen position (on the */
/* baseline) to the upper bitmap border (a.k.a. `top */
/* side bearing'). The distance is positive for upwards */
/* Y coordinates. */
/* */
/* format :: The format of the glyph bitmap (monochrome or gray). */
/* */
/* max_grays :: Maximum gray level value (in the range 1 to 255). */
/* */
/* pitch :: The number of bytes per bitmap line. May be positive */
/* or negative. */
/* */
/* xadvance :: The horizontal advance width in pixels. */
/* */
/* yadvance :: The vertical advance height in pixels. */
/* */
/* buffer :: A pointer to the bitmap pixels. */
/* */
typedef struct FTC_SBitRec_
{
FT_Byte width;
FT_Byte height;
FT_Char left;
FT_Char top;
FT_Byte format;
FT_Byte max_grays;
FT_Short pitch;
FT_Char xadvance;
FT_Char yadvance;
FT_Byte* buffer;
} FTC_SBitRec;
/*************************************************************************/
/* */
/* <Type> */
/* FTC_SBitCache */
/* */
/* <Description> */
/* A handle to a small bitmap cache. These are special cache objects */
/* used to store small glyph bitmaps (and anti-aliased pixmaps) in a */
/* much more efficient way than the traditional glyph image cache */
/* implemented by @FTC_ImageCache. */
/* */
typedef struct FTC_SBitCacheRec_* FTC_SBitCache;
/*************************************************************************/
/* */
/* <Function> */
/* FTC_SBitCache_New */
/* */
/* <Description> */
/* Creates a new cache to store small glyph bitmaps. */
/* */
/* <Input> */
/* manager :: A handle to the source cache manager. */
/* */
/* <Output> */
/* acache :: A handle to the new sbit cache. NULL in case of error. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
FT_EXPORT( FT_Error )
FTC_SBitCache_New( FTC_Manager manager,
FTC_SBitCache *acache );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_SBitCache_Lookup */
/* */
/* <Description> */
/* Looks up a given small glyph bitmap in a given sbit cache and */
/* `lock' it to prevent its flushing from the cache until needed. */
/* */
/* <Input> */
/* cache :: A handle to the source sbit cache. */
/* */
/* type :: A pointer to the glyph image type descriptor. */
/* */
/* gindex :: The glyph index. */
/* */
/* <Output> */
/* sbit :: A handle to a small bitmap descriptor. */
/* */
/* anode :: Used to return the address of of the corresponding cache */
/* node after incrementing its reference count (see note */
/* below). */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The small bitmap descriptor and its bit buffer are owned by the */
/* cache and should never be freed by the application. They might */
/* as well disappear from memory on the next cache lookup, so don't */
/* treat them as persistent data. */
/* */
/* The descriptor's `buffer' field is set to 0 to indicate a missing */
/* glyph bitmap. */
/* */
/* If `anode' is _not_ NULL, it receives the address of the cache */
/* node containing the bitmap, after increasing its reference count. */
/* This ensures that the node (as well as the image) will always be */
/* kept in the cache until you call @FTC_Node_Unref to `release' it. */
/* */
/* If `anode' is NULL, the cache node is left unchanged, which means */
/* that the bitmap could be flushed out of the cache on the next */
/* call to one of the caching sub-system APIs. Don't assume that it */
/* is persistent! */
/* */
FT_EXPORT( FT_Error )
FTC_SBitCache_Lookup( FTC_SBitCache cache,
FTC_ImageType type,
FT_UInt gindex,
FTC_SBit *sbit,
FTC_Node *anode );
/* */
FT_END_HEADER
#endif /* __FTCACHE_H__ */

View file

@ -36,6 +36,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@ -235,7 +241,8 @@ FT_BEGIN_HEADER
/* FT_Glyph_Copy */
/* */
/* <Description> */
/* A function used to copy a glyph image. */
/* A function used to copy a glyph image. Note that the created */
/* @FT_Glyph object must be released with @FT_Done_Glyph. */
/* */
/* <Input> */
/* source :: A handle to the source glyph object. */
@ -472,8 +479,7 @@ FT_BEGIN_HEADER
/* } */
/* */
/* */
/* This function will always fail if the glyph's format isn't */
/* scalable. */
/* This function does nothing if the glyph format isn't scalable. */
/* */
FT_EXPORT( FT_Error )
FT_Glyph_To_Bitmap( FT_Glyph* the_glyph,

View file

@ -22,6 +22,13 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/

View file

@ -53,8 +53,8 @@ FT_BEGIN_HEADER
/* <Description> */
/* The type FT_Pos is a 32-bit integer used to store vectorial */
/* coordinates. Depending on the context, these can represent */
/* distances in integer font units, or 26.6 fixed float pixel */
/* coordinates. */
/* distances in integer font units, or 16,16, or 26.6 fixed float */
/* pixel coordinates. */
/* */
typedef signed long FT_Pos;

View file

@ -22,6 +22,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER

View file

@ -4,7 +4,7 @@
/* */
/* Generic list support for FreeType (specification). */
/* */
/* Copyright 1996-2001 by */
/* Copyright 1996-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -31,6 +31,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER

View file

@ -100,21 +100,6 @@ FT_BEGIN_HEADER
/* */
typedef FT_Error
(*FT_Get_MM_Func)( FT_Face face,
FT_Multi_Master* master );
typedef FT_Error
(*FT_Set_MM_Design_Func)( FT_Face face,
FT_UInt num_coords,
FT_Long* coords );
typedef FT_Error
(*FT_Set_MM_Blend_Func)( FT_Face face,
FT_UInt num_coords,
FT_Long* coords );
/*************************************************************************/
/* */
/* <Function> */

View file

@ -5,7 +5,7 @@
/* Support for the FT_Outline type used to store glyph shapes of */
/* most scalable font formats (specification). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -24,6 +24,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@ -389,6 +395,72 @@ FT_BEGIN_HEADER
FT_Raster_Params* params );
/**************************************************************************
*
* @enum:
* FT_Orientation
*
* @description:
* A list of values used to describe an outline's contour orientation.
*
* The TrueType and Postscript specifications use different conventions
* to determine whether outline contours should be filled or unfilled.
*
* @values:
* FT_ORIENTATION_TRUETYPE ::
* According to the TrueType specification, clockwise contours must
* be filled, and counter-clockwise ones must be unfilled.
*
* FT_ORIENTATION_POSTSCRIPT ::
* According to the Postscript specification, counter-clockwise contours
* must be filled, and clockwise ones must be unfilled.
*
* FT_ORIENTATION_FILL_RIGHT ::
* This is identical to @FT_ORIENTATION_TRUETYPE, but is used to
* remember that in TrueType, everything that is to the right of
* the drawing direction of a contour must be filled.
*
* FT_ORIENTATION_FILL_LEFT ::
* This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to
* remember that in Postscript, everything that is to the left of
* the drawing direction of a contour must be filled.
*/
typedef enum
{
FT_ORIENTATION_TRUETYPE = 0,
FT_ORIENTATION_POSTSCRIPT = 1,
FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE,
FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT
} FT_Orientation;
/**************************************************************************
*
* @function:
* FT_Outline_Get_Orientation
*
* @description:
* This function analyzes a glyph outline and tries to compute its
* fill orientation (see @FT_Orientation). This is done by computing
* the direction of each global horizontal and/or vertical extrema
* within the outline.
*
* Note that this will return @FT_ORIENTATION_TRUETYPE for empty
* outlines.
*
* @input:
* outline ::
* A handle to the source outline.
*
* @return:
* The orientation.
*
*/
FT_EXPORT( FT_Orientation )
FT_Outline_Get_Orientation( FT_Outline* outline );
/* */

View file

@ -22,6 +22,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER

View file

@ -4,7 +4,7 @@
/* */
/* FreeType size objects management (specification). */
/* */
/* Copyright 1996-2001 by */
/* Copyright 1996-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -32,6 +32,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@ -101,7 +107,9 @@ FT_BEGIN_HEADER
/* FT_Done_Size */
/* */
/* <Description> */
/* Discards a given size object. */
/* Discards a given size object. Note that @FT_Done_Face */
/* automatically discards all size objects allocated with */
/* @FT_New_Size. */
/* */
/* <Input> */
/* size :: A handle to a target size object. */

View file

@ -7,7 +7,7 @@
/* */
/* This is _not_ used to retrieve glyph names! */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -26,6 +26,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER

View file

@ -4,7 +4,7 @@
/* */
/* FreeType path stroker (specification). */
/* */
/* Copyright 2002, 2003 by */
/* Copyright 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -21,42 +21,45 @@
#include <ft2build.h>
#include FT_OUTLINE_H
#include FT_GLYPH_H
FT_BEGIN_HEADER
/*@*************************************************************
*
* @type: FT_Stroker
*
* @description:
* opaque handler to a path stroker object
*/
typedef struct FT_StrokerRec_* FT_Stroker;
/*@*************************************************************
*
* @type:
* FT_Stroker
*
* @description:
* Opaque handler to a path stroker object.
*/
typedef struct FT_StrokerRec_* FT_Stroker;
/*@*************************************************************
*
* @enum: FT_Stroker_LineJoin
*
* @description:
* these values determine how two joining lines are rendered
* in a stroker.
*
* @values:
* FT_STROKER_LINEJOIN_ROUND ::
* used to render rounded line joins. circular arcs are used
* to join two lines smoothly
*
* FT_STROKER_LINEJOIN_BEVEL ::
* used to render beveled line joins; i.e. the two joining lines
* are extended until they intersect
*
* FT_STROKER_LINEJOIN_MITER ::
* same as beveled rendering, except that an additional line
* break is added if the angle between the two joining lines
* is too closed (this is useful to avoid unpleasant spikes
* in beveled rendering).
*/
/*@*************************************************************
*
* @enum:
* FT_Stroker_LineJoin
*
* @description:
* These values determine how two joining lines are rendered
* in a stroker.
*
* @values:
* FT_STROKER_LINEJOIN_ROUND ::
* Used to render rounded line joins. Circular arcs are used
* to join two lines smoothly.
*
* FT_STROKER_LINEJOIN_BEVEL ::
* Used to render beveled line joins; i.e., the two joining lines
* are extended until they intersect.
*
* FT_STROKER_LINEJOIN_MITER ::
* Same as beveled rendering, except that an additional line
* break is added if the angle between the two joining lines
* is too closed (this is useful to avoid unpleasant spikes
* in beveled rendering).
*/
typedef enum
{
FT_STROKER_LINEJOIN_ROUND = 0,
@ -66,27 +69,28 @@ FT_BEGIN_HEADER
} FT_Stroker_LineJoin;
/*@*************************************************************
*
* @enum: FT_Stroker_LineCap
*
* @description:
* these values determine how the end of opened sub-paths are
* rendered in a stroke
*
* @values:
* FT_STROKER_LINECAP_BUTT ::
* the end of lines is rendered as a full stop on the last
* point itself
*
* FT_STROKER_LINECAP_ROUND ::
* the end of lines is rendered as a half-circle around the
* last point
*
* FT_STROKER_LINECAP_SQUARE ::
* the end of lines is rendered as a square around the
* last point
*/
/*@*************************************************************
*
* @enum:
* FT_Stroker_LineCap
*
* @description:
* These values determine how the end of opened sub-paths are
* rendered in a stroke.
*
* @values:
* FT_STROKER_LINECAP_BUTT ::
* The end of lines is rendered as a full stop on the last
* point itself.
*
* FT_STROKER_LINECAP_ROUND ::
* The end of lines is rendered as a half-circle around the
* last point.
*
* FT_STROKER_LINECAP_SQUARE ::
* The end of lines is rendered as a square around the
* last point.
*/
typedef enum
{
FT_STROKER_LINECAP_BUTT = 0,
@ -95,12 +99,134 @@ FT_BEGIN_HEADER
} FT_Stroker_LineCap;
/* */
/**************************************************************
*
* @enum:
* FT_StrokerBorder
*
* @description:
* These values are used to select a given stroke border
* in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder.
*
* @values:
* FT_STROKER_BORDER_LEFT ::
* Select the left border, relative to the drawing direction.
*
* FT_STROKER_BORDER_RIGHT ::
* Select the right border, relative to the drawing direction.
*
* @note:
* Applications are generally interested in the `inside' and `outside'
* borders. However, there is no direct mapping between these and
* the `left' / `right' ones, since this really depends on the glyph's
* drawing orientation, which varies between font formats.
*
* You can however use @FT_Outline_GetInsideBorder and
* @FT_Outline_GetOutsideBorder to get these.
*/
typedef enum
{
FT_STROKER_BORDER_LEFT = 0,
FT_STROKER_BORDER_RIGHT
} FT_StrokerBorder;
/**************************************************************
*
* @function:
* FT_Outline_GetInsideBorder
*
* @description:
* Retrieve the @FT_StrokerBorder value corresponding to the
* `inside' borders of a given outline.
*
* @input:
* outline ::
* The source outline handle.
*
* @return:
* The border index. @FT_STROKER_BORDER_LEFT for empty or invalid
* outlines.
*/
FT_EXPORT( FT_StrokerBorder )
FT_Outline_GetInsideBorder( FT_Outline* outline );
/**************************************************************
*
* @function:
* FT_Outline_GetOutsideBorder
*
* @description:
* Retrieve the @FT_StrokerBorder value corresponding to the
* `outside' borders of a given outline.
*
* @input:
* outline ::
* The source outline handle.
*
* @return:
* The border index. @FT_STROKER_BORDER_LEFT for empty or invalid
* outlines.
*/
FT_EXPORT( FT_StrokerBorder )
FT_Outline_GetOutsideBorder( FT_Outline* outline );
/**************************************************************
*
* @function:
* FT_Stroker_New
*
* @description:
* Create a new stroker object.
*
* @input:
* memory ::
* The memory manager handle.
*
* @output:
* A new stroker object handle. NULL in case of error.
*
* @return:
* FreeType error code. 0 means success.
*/
FT_EXPORT( FT_Error )
FT_Stroker_New( FT_Memory memory,
FT_Stroker *astroker );
/**************************************************************
*
* @function:
* FT_Stroker_Set
*
* @description:
* Reset a stroker object's attributes.
*
* @input:
* stroker ::
* The target stroker handle.
*
* radius ::
* The border radius.
*
* line_cap ::
* The line cap style.
*
* line_join ::
* The line join style.
*
* miter_limit ::
* The miter limit for the FT_STROKER_LINEJOIN_MITER style,
* expressed as 16.16 fixed point value.
*
* @note:
* The radius is expressed in the same units that the outline
* coordinates.
*/
FT_EXPORT( void )
FT_Stroker_Set( FT_Stroker stroker,
FT_Fixed radius,
@ -109,29 +235,208 @@ FT_BEGIN_HEADER
FT_Fixed miter_limit );
/**************************************************************
*
* @function:
* FT_Stroker_Rewind
*
* @description:
* Reset a stroker object without changing its attributes.
* You should call this function before beginning a new
* series of calls to @FT_Stroker_BeginSubPath or
* @FT_Stroker_EndSubPath.
*
* @input:
* stroker ::
* The target stroker handle.
*/
FT_EXPORT( void )
FT_Stroker_Rewind( FT_Stroker stroker );
/**************************************************************
*
* @function:
* FT_Stroker_ParseOutline
*
* @description:
* A convenience function used to parse a whole outline with
* the stroker. The resulting outline(s) can be retrieved
* later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export.
*
* @input:
* stroker ::
* The target stroker handle.
*
* outline ::
* The source outline.
*
* opened ::
* A boolean. If TRUE, the outline is treated as an open path
* instead of a closed one.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* If `opened' is 0 (the default), the outline is treated as a closed
* path, and the stroker will generate two distinct `border' outlines.
*
* If `opened' is 1, the outline is processed as an open path, and the
* stroker will generate a single `stroke' outline.
*
* This function calls @FT_Stroker_Rewind automatically.
*/
FT_EXPORT( FT_Error )
FT_Stroker_ParseOutline( FT_Stroker stroker,
FT_Outline* outline,
FT_Bool opened );
/**************************************************************
*
* @function:
* FT_Stroker_BeginSubPath
*
* @description:
* Start a new sub-path in the stroker.
*
* @input:
* stroker ::
* The target stroker handle.
*
* to ::
* A pointer to the start vector.
*
* open ::
* A boolean. If TRUE, the sub-path is treated as an open one.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* This function is useful when you need to stroke a path that is
* not stored as a @FT_Outline object.
*/
FT_EXPORT( FT_Error )
FT_Stroker_BeginSubPath( FT_Stroker stroker,
FT_Vector* to,
FT_Bool open );
/**************************************************************
*
* @function:
* FT_Stroker_EndSubPath
*
* @description:
* Close the current sub-path in the stroker.
*
* @input:
* stroker ::
* The target stroker handle.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* You should call this function after @FT_Stroker_BeginSubPath.
* If the subpath was not `opened', this function will `draw' a
* single line segment to the start position when needed.
*/
FT_EXPORT( FT_Error )
FT_Stroker_EndSubPath( FT_Stroker stroker );
/**************************************************************
*
* @function:
* FT_Stroker_LineTo
*
* @description:
* `Draw' a single line segment in the stroker's current sub-path,
* from the last position.
*
* @input:
* stroker ::
* The target stroker handle.
*
* to ::
* A pointer to the destination point.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* You should call this function between @FT_Stroker_BeginSubPath and
* @FT_Stroker_EndSubPath.
*/
FT_EXPORT( FT_Error )
FT_Stroker_LineTo( FT_Stroker stroker,
FT_Vector* to );
/**************************************************************
*
* @function:
* FT_Stroker_ConicTo
*
* @description:
* `Draw; a single quadratic bezier in the stroker's current sub-path,
* from the last position.
*
* @input:
* stroker ::
* The target stroker handle.
*
* control ::
* A pointer to a Bézier control point.
*
* to ::
* A pointer to the destination point.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* You should call this function between @FT_Stroker_BeginSubPath and
* @FT_Stroker_EndSubPath.
*/
FT_EXPORT( FT_Error )
FT_Stroker_ConicTo( FT_Stroker stroker,
FT_Vector* control,
FT_Vector* to );
/**************************************************************
*
* @function:
* FT_Stroker_CubicTo
*
* @description:
* `Draw' a single cubic Bézier in the stroker's current sub-path,
* from the last position.
*
* @input:
* stroker ::
* The target stroker handle.
*
* control1 ::
* A pointer to the first Bézier control point.
*
* control2 ::
* A pointer to second Bézier control point.
*
* to ::
* A pointer to the destination point.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* You should call this function between @FT_Stroker_BeginSubPath and
* @FT_Stroker_EndSubPath.
*/
FT_EXPORT( FT_Error )
FT_Stroker_CubicTo( FT_Stroker stroker,
FT_Vector* control1,
@ -139,19 +444,240 @@ FT_BEGIN_HEADER
FT_Vector* to );
/**************************************************************
*
* @function:
* FT_Stroker_GetBorderCounts
*
* @description:
* Vall this function once you have finished parsing your paths
* with the stroker. It will return the number of points and
* contours necessary to export one of the `border' or `stroke'
* outlines generated by the stroker.
*
* @input:
* stroker ::
* The target stroker handle.
*
* border ::
* The border index.
*
* @output:
* anum_points ::
* The number of points.
*
* anum_contours ::
* The number of contours.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* When an outline, or a sub-path, is `closed', the stroker generates
* two independent `border' outlines, named `left' and `right'.
*
* When the outline, or a sub-path, is `opened', the stroker merges
* the `border' outlines with caps. The `left' border receives all
* points, while the `right' border becomes empty.
*
* Use the function @FT_Stroker_GetCounts instead if you want to
* retrieve the counts associated to both borders.
*/
FT_EXPORT( FT_Error )
FT_Stroker_GetBorderCounts( FT_Stroker stroker,
FT_StrokerBorder border,
FT_UInt *anum_points,
FT_UInt *anum_contours );
/**************************************************************
*
* @function:
* FT_Stroker_ExportBorder
*
* @description:
* Call this function after @FT_Stroker_GetBorderCounts to
* export the corresponding border to your own @FT_Outline
* structure.
*
* Note that this function will append the border points and
* contours to your outline, but will not try to resize its
* arrays.
*
* @input:
* stroker ::
* The target stroker handle.
*
* border ::
* The border index.
*
* outline ::
* The target outline handle.
*
* @note:
* Always call this function after @FT_Stroker_GetBorderCounts to
* get sure that there is enough room in your @FT_Outline object to
* receive all new data.
*
* When an outline, or a sub-path, is `closed', the stroker generates
* two independent `border' outlines, named `left' and `right'
*
* When the outline, or a sub-path, is `opened', the stroker merges
* the `border' outlines with caps. The `left' border receives all
* points, while the `right' border becomes empty.
*
* Use the function @FT_Stroker_Export instead if you want to
* retrieve all borders at once.
*/
FT_EXPORT( void )
FT_Stroker_ExportBorder( FT_Stroker stroker,
FT_StrokerBorder border,
FT_Outline* outline );
/**************************************************************
*
* @function:
* FT_Stroker_GetCounts
*
* @description:
* Call this function once you have finished parsing your paths
* with the stroker. It returns the number of points and
* contours necessary to export all points/borders from the stroked
* outline/path.
*
* @input:
* stroker ::
* The target stroker handle.
*
* @output:
* anum_points ::
* The number of points.
*
* anum_contours ::
* The number of contours.
*
* @return:
* FreeType error code. 0 means success.
*/
FT_EXPORT( FT_Error )
FT_Stroker_GetCounts( FT_Stroker stroker,
FT_UInt *anum_points,
FT_UInt *anum_contours );
/**************************************************************
*
* @function:
* FT_Stroker_Export
*
* @description:
* Call this function after @FT_Stroker_GetBorderCounts to
* export the all borders to your own @FT_Outline structure.
*
* Note that this function will append the border points and
* contours to your outline, but will not try to resize its
* arrays.
*
* @input:
* stroker ::
* The target stroker handle.
*
* outline ::
* The target outline handle.
*/
FT_EXPORT( void )
FT_Stroker_Export( FT_Stroker stroker,
FT_Outline* outline );
/**************************************************************
*
* @function:
* FT_Stroker_Done
*
* @description:
* Destroy a stroker object.
*
* @input:
* stroker ::
* A stroker handle. Can be NULL.
*/
FT_EXPORT( void )
FT_Stroker_Done( FT_Stroker stroker );
/**************************************************************
*
* @function:
* FT_Glyph_Stroke
*
* @description:
* Stroke a given outline glyph object with a given stroker.
*
* @inout:
* pglyph :: Source glyph handle on input, new glyph handle
* on output.
*
* @input:
* stroker ::
* A stroker handle.
*
* destroy ::
* A Boolean. If TRUE, the source glyph object is destroyed
* on success.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* The source glyph is untouched in case of error.
*/
FT_EXPORT( FT_Error )
FT_Glyph_Stroke( FT_Glyph *pglyph,
FT_Stroker stroker,
FT_Bool destroy );
/**************************************************************
*
* @function:
* FT_Glyph_StrokeBorder
*
* @description:
* Stroke a given outline glyph object with a given stroker, but
* only return either its inside or outside border.
*
* @inout:
* pglyph ::
* Source glyph handle on input, new glyph handle on output.
*
* @input:
* stroker ::
* A stroker handle.
*
* inside ::
* A Boolean. If TRUE, return the inside border, otherwise
* the outside border.
*
* destroy ::
* A Boolean. If TRUE, the source glyph object is destroyed
* on success.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* The source glyph is untouched in case of error.
*/
FT_EXPORT( FT_Error )
FT_Glyph_StrokeBorder( FT_Glyph *pglyph,
FT_Stroker stroker,
FT_Bool inside,
FT_Bool destroy );
/* */
FT_END_HEADER
#endif /* __FT_STROKE_H__ */

View file

@ -5,7 +5,7 @@
/* FreeType synthesizing code for emboldening and slanting */
/* (specification). */
/* */
/* Copyright 2000-2001 by */
/* Copyright 2000-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -41,6 +41,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER

View file

@ -21,6 +21,12 @@
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER

View file

@ -22,6 +22,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@ -43,10 +49,132 @@ FT_BEGIN_HEADER
/* */
/*************************************************************************/
/*************************************************************************
*
* @enum:
* FT_WinFNT_ID_XXX
*
* @description:
* A list of valid values for the `charset' byte in
* @FT_WinFNT_HeaderRec. Exact mapping tables for the various cpXXXX
* encodings (except for cp1361) can be found at ftp://ftp.unicode.org
* in the MAPPINGS/VENDORS/MICSFT/WINDOWS subdirectory. cp1361 is
* roughly a superset of MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT.
*
* @values:
* FT_WinFNT_ID_DEFAULT ::
* This is used for font enumeration and font creation as a
* `don't care' value. Valid font files don't contain this value.
* When querying for information about the character set of the font
* that is currently selected into a specified device context, this
* return value (of the related Windows API) simply denotes failure.
*
* FT_WinFNT_ID_SYMBOL ::
* There is no known mapping table available.
*
* FT_WinFNT_ID_MAC ::
* Mac Roman encoding.
*
* FT_WinFNT_ID_OEM ::
* From Michael Pöttgen <michael@poettgen.de>:
* The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM
* is used for the charset of vector fonts, like `modern.fon',
* `roman.fon', and `script.fon' on Windows.
*
* The `CreateFont' documentation says: The FT_WinFNT_ID_OEM value
* specifies a character set that is operating-system dependent.
*
* The `IFIMETRICS' documentation from the `Windows Driver
* Development Kit' says: This font supports an OEM-specific
* character set. The OEM character set is system dependent.
*
* In general OEM, as opposed to ANSI (i.e., cp1252), denotes the
* second default codepage that most international versions of
* Windows have. It is one of the OEM codepages from
*
* http://www.microsoft.com/globaldev/reference/cphome.mspx,
*
* and is used for the `DOS boxes', to support legacy applications.
* A German Windows version for example usually uses ANSI codepage
* 1252 and OEM codepage 850.
*
* FT_WinFNT_ID_CP874 ::
* A superset of Thai TIS 620 and ISO 8859-11.
*
* FT_WinFNT_ID_CP932 ::
* A superset of Japanese Shift-JIS (with minor deviations).
*
* FT_WinFNT_ID_CP936 ::
* A superset of simplified Chinese GB 2312-1980 (with different
* ordering and minor deviations).
*
* FT_WinFNT_ID_CP949 ::
* A superset of Korean Hangul KS C 5601-1987 (with different
* ordering and minor deviations).
*
* FT_WinFNT_ID_CP950 ::
* A superset of traditional Chinese Big 5 ETen (with different
* ordering and minor deviations).
*
* FT_WinFNT_ID_CP1250 ::
* A superset of East European ISO 8859-2 (with slightly different
* ordering).
*
* FT_WinFNT_ID_CP1251 ::
* A superset of Russian ISO 8859-5 (with different ordering).
*
* FT_WinFNT_ID_CP1252 ::
* ANSI encoding. A superset of ISO 8859-1.
*
* FT_WinFNT_ID_CP1253 ::
* A superset of Greek ISO 8859-7 (with minor modifications).
*
* FT_WinFNT_ID_CP1254 ::
* A superset of Turkish ISO 8859-9.
*
* FT_WinFNT_ID_CP1255 ::
* A superset of Hebrew ISO 8859-8 (with some modifications).
*
* FT_WinFNT_ID_CP1256 ::
* A superset of Arabic ISO 8859-6 (with different ordering).
*
* FT_WinFNT_ID_CP1257 ::
* A superset of Baltic ISO 8859-13 (with some deviations).
*
* FT_WinFNT_ID_CP1258 ::
* For Vietnamese. This encoding doesn't cover all necessary
* characters.
*
* FT_WinFNT_ID_CP1361 ::
* Korean (Johab).
*/
#define FT_WinFNT_ID_CP1252 0
#define FT_WinFNT_ID_DEFAULT 1
#define FT_WinFNT_ID_SYMBOL 2
#define FT_WinFNT_ID_MAC 77
#define FT_WinFNT_ID_CP932 128
#define FT_WinFNT_ID_CP949 129
#define FT_WinFNT_ID_CP1361 130
#define FT_WinFNT_ID_CP936 134
#define FT_WinFNT_ID_CP950 136
#define FT_WinFNT_ID_CP1253 161
#define FT_WinFNT_ID_CP1254 162
#define FT_WinFNT_ID_CP1258 163
#define FT_WinFNT_ID_CP1255 177
#define FT_WinFNT_ID_CP1256 178
#define FT_WinFNT_ID_CP1257 186
#define FT_WinFNT_ID_CP1251 204
#define FT_WinFNT_ID_CP874 222
#define FT_WinFNT_ID_CP1250 238
#define FT_WinFNT_ID_OEM 255
/*************************************************************************/
/* */
/* <Struct> */
/* FT_WinFNT_HeaderRec_ */
/* FT_WinFNT_HeaderRec */
/* */
/* <Description> */
/* Windows FNT Header info. */

View file

@ -4,7 +4,7 @@
/* */
/* Support functions for X11. */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -22,6 +22,13 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/* this comment is intentionally disabled for now, to prevent this */

View file

@ -4,7 +4,7 @@
/* */
/* Arithmetic computations (specification). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -27,7 +27,8 @@
FT_BEGIN_HEADER
FT_EXPORT( FT_Int32 ) FT_SqrtFixed( FT_Int32 x );
FT_EXPORT( FT_Int32 )
FT_SqrtFixed( FT_Int32 x );
#define SQRT_32( x ) FT_Sqrt32( x )
@ -59,6 +60,39 @@ FT_BEGIN_HEADER
/*************************************************************************/
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
/*************************************************************************/
/* */
/* <Function> */
/* FT_MulDiv_No_Round */
/* */
/* <Description> */
/* A very simple function used to perform the computation `(a*b)/c' */
/* (without rounding) with maximal accuracy (it uses a 64-bit */
/* intermediate integer whenever necessary). */
/* */
/* This function isn't necessarily as fast as some processor specific */
/* operations, but is at least completely portable. */
/* */
/* <Input> */
/* a :: The first multiplier. */
/* b :: The second multiplier. */
/* c :: The divisor. */
/* */
/* <Return> */
/* The result of `(a*b)/c'. This function never traps when trying to */
/* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
/* on the signs of `a' and `b'. */
/* */
FT_BASE( FT_Long )
FT_MulDiv_No_Round( FT_Long a,
FT_Long b,
FT_Long c );
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 )
#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 )
#define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 )

View file

@ -155,11 +155,15 @@ FT_BEGIN_HEADER
/* add data from AFM or PFM files on a Type 1 */
/* face, or a CIDMap on a CID-keyed face. */
/* */
/* get_advances :: A function handle used to return the advances */
/* of 'count' glyphs, starting at `index'. the */
/* `vertical' flags must be set when vertical */
/* advances are queried. The advances buffer is */
/* caller-allocated. */
/* get_advances :: A function handle used to return advance */
/* widths of 'count' glyphs (in font units), */
/* starting at `first'. The `vertical' flag must */
/* be set to get vertical advance heights. The */
/* `advances' buffer is caller-allocated. */
/* Currently not implemented. The idea of this */
/* function is to be able to perform */
/* device-independent text layout without loading */
/* a single glyph image. */
/* */
/* <Note> */
/* Most function pointers, with the exception of `load_glyph' and */

View file

@ -110,15 +110,15 @@ FT_BEGIN_HEADER
FT_BASE( void )
FT_GlyphLoader_Rewind( FT_GlyphLoader loader );
/* check that there is enough room to add 'n_points' and 'n_contours' */
/* to the glyph loader */
/* check that there is enough space to add `n_points' and `n_contours' */
/* to the glyph loader */
FT_BASE( FT_Error )
FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader,
FT_UInt n_points,
FT_UInt n_contours );
/* check that there is enough room to add 'n_subs' sub-glyphs to */
/* a glyph loader */
/* check that there is enough space to add `n_subs' sub-glyphs to */
/* a glyph loader */
FT_BASE( FT_Error )
FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader loader,
FT_UInt n_subs );

View file

@ -4,7 +4,7 @@
/* */
/* The FreeType memory management macros (specification). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -180,6 +180,12 @@ FT_BEGIN_HEADER
#define FT_ZERO( p ) FT_MEM_ZERO( p, sizeof ( *(p) ) )
#define FT_ARRAY_COPY( dest, source, count ) \
FT_MEM_COPY( dest, source, (count) * sizeof( *(dest) ) )
#define FT_ARRAY_MOVE( dest, source, count ) \
FT_MEM_MOVE( dest, source, (count) * sizeof( *(dest) ) )
/*************************************************************************/
/* */

View file

@ -34,7 +34,7 @@
#include FT_INTERNAL_GLYPH_LOADER_H
#include FT_INTERNAL_DRIVER_H
#include FT_INTERNAL_AUTOHINT_H
#include FT_INTERNAL_OBJECT_H
#include FT_INTERNAL_SERVICE_H
#ifdef FT_CONFIG_OPTION_INCREMENTAL
#include FT_INCREMENTAL_H
@ -79,6 +79,15 @@ FT_BEGIN_HEADER
#endif
#define FT_PAD_FLOOR( x, n ) ( (x) & ~((n)-1) )
#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n )
#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n )
#define FT_PIX_FLOOR( x ) ( (x) & ~63 )
#define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 )
#define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 )
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@ -271,51 +280,52 @@ FT_BEGIN_HEADER
/* FreeType. */
/* */
/* <Fields> */
/* max_points :: The maximal number of points used to store the */
/* vectorial outline of any glyph in this face. */
/* If this value cannot be known in advance, or */
/* if the face isn't scalable, this should be set */
/* to 0. Only relevant for scalable formats. */
/* max_points :: */
/* The maximal number of points used to store the vectorial outline */
/* of any glyph in this face. If this value cannot be known in */
/* advance, or if the face isn't scalable, this should be set to 0. */
/* Only relevant for scalable formats. */
/* */
/* max_contours :: The maximal number of contours used to store */
/* the vectorial outline of any glyph in this */
/* face. If this value cannot be known in */
/* advance, or if the face isn't scalable, this */
/* should be set to 0. Only relevant for */
/* scalable formats. */
/* max_contours :: */
/* The maximal number of contours used to store the vectorial */
/* outline of any glyph in this face. If this value cannot be */
/* known in advance, or if the face isn't scalable, this should be */
/* set to 0. Only relevant for scalable formats. */
/* */
/* transform_matrix :: A 2x2 matrix of 16.16 coefficients used to */
/* transform glyph outlines after they are loaded */
/* from the font. Only used by the convenience */
/* functions. */
/* transform_matrix :: */
/* A 2x2 matrix of 16.16 coefficients used to transform glyph */
/* outlines after they are loaded from the font. Only used by the */
/* convenience functions. */
/* */
/* transform_delta :: A translation vector used to transform glyph */
/* outlines after they are loaded from the font. */
/* Only used by the convenience functions. */
/* transform_delta :: */
/* A translation vector used to transform glyph outlines after they */
/* are loaded from the font. Only used by the convenience */
/* functions. */
/* */
/* transform_flags :: Some flags used to classify the transform. */
/* Only used by the convenience functions. */
/* transform_flags :: */
/* Some flags used to classify the transform. Only used by the */
/* convenience functions. */
/* */
/* postscript_name :: Postscript font name for this face. */
/* services :: */
/* A cache for frequently used services. It should be only */
/* accessed with the macro `FT_FACE_LOOKUP_SERVICE'. */
/* */
/* incremental_interface :: */
/* If non-null, the interface through */
/* which glyph data and metrics are loaded */
/* incrementally for faces that do not provide */
/* all of this data when first opened. */
/* This field exists only if */
/* @FT_CONFIG_OPTION_INCREMENTAL is defined. */
/* If non-null, the interface through which glyph data and metrics */
/* are loaded incrementally for faces that do not provide all of */
/* this data when first opened. This field exists only if */
/* @FT_CONFIG_OPTION_INCREMENTAL is defined. */
/* */
typedef struct FT_Face_InternalRec_
{
FT_UShort max_points;
FT_Short max_contours;
FT_UShort max_points;
FT_Short max_contours;
FT_Matrix transform_matrix;
FT_Vector transform_delta;
FT_Int transform_flags;
FT_Matrix transform_matrix;
FT_Vector transform_delta;
FT_Int transform_flags;
const char* postscript_name;
FT_ServiceCacheRec services;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_InterfaceRec* incremental_interface;
@ -466,6 +476,10 @@ FT_BEGIN_HEADER
FT_Get_Module_Interface( FT_Library library,
const char* mod_name );
FT_BASE( FT_Pointer )
ft_module_get_service( FT_Module module,
const char* service_id );
/* */
@ -704,6 +718,12 @@ FT_BEGIN_HEADER
/* generic :: Client data variable. Used to extend the */
/* Library class by higher levels and clients. */
/* */
/* version_major :: The major version number of the library. */
/* */
/* version_minor :: The minor version number of the library. */
/* */
/* version_patch :: The current patch level of the library. */
/* */
/* num_modules :: The number of modules currently registered */
/* within this library. This is set to 0 for new */
/* libraries. New modules are added through the */
@ -754,8 +774,6 @@ FT_BEGIN_HEADER
FT_DebugHook_Func debug_hooks[4];
FT_MetaClassRec meta_class;
} FT_LibraryRec;

View file

@ -27,26 +27,17 @@
#define FT_INTERNAL_OBJECTS_H <freetype/internal/ftobjs.h>
#define FT_INTERNAL_STREAM_H <freetype/internal/ftstream.h>
#define FT_INTERNAL_MEMORY_H <freetype/internal/ftmemory.h>
#define FT_INTERNAL_EXTENSION_H <freetype/internal/ftextend.h>
#define FT_INTERNAL_DEBUG_H <freetype/internal/ftdebug.h>
#define FT_INTERNAL_CALC_H <freetype/internal/ftcalc.h>
#define FT_INTERNAL_DRIVER_H <freetype/internal/ftdriver.h>
#define FT_INTERNAL_EXTEND_H <freetype/internal/ftextend.h>
#define FT_INTERNAL_TRACE_H <freetype/internal/fttrace.h>
#define FT_INTERNAL_GLYPH_LOADER_H <freetype/internal/ftgloadr.h>
#define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h>
#define FT_INTERNAL_HASH_H <freetype/internal/fthash.h>
#define FT_INTERNAL_OBJECT_H <freetype/internal/ftobject.h>
#define FT_INTERNAL_SERVICE_H <freetype/internal/ftserv.h>
#define FT_INTERNAL_TRUETYPE_TYPES_H <freetype/internal/tttypes.h>
#define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h>
#define FT_INTERNAL_TYPE42_TYPES_H <freetype/internal/t42types.h>
#define FT_INTERNAL_CFF_TYPES_H <freetype/internal/cfftypes.h>
#define FT_INTERNAL_FNT_TYPES_H <freetype/internal/fnttypes.h>
#define FT_INTERNAL_BDF_TYPES_H <freetype/internal/bdftypes.h>
#define FT_INTERNAL_PFR_H <freetype/internal/pfr.h>
#define FT_INTERNAL_POSTSCRIPT_NAMES_H <freetype/internal/psnames.h>
#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h>
#define FT_INTERNAL_POSTSCRIPT_HINTS_H <freetype/internal/pshints.h>
#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H <freetype/internal/psglobal.h>

View file

@ -24,6 +24,7 @@
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_TYPE1_TYPES_H
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
FT_BEGIN_HEADER
@ -123,7 +124,7 @@ FT_BEGIN_HEADER
FT_Int max_elems;
FT_Int num_elems;
FT_Byte** elements; /* addresses of table elements */
FT_Int* lengths; /* lengths of table elements */
FT_PtrDist* lengths; /* lengths of table elements */
FT_Memory memory;
PS_Table_FuncsRec funcs;
@ -329,18 +330,20 @@ FT_BEGIN_HEADER
void
(*skip_spaces)( PS_Parser parser );
void
(*skip_alpha)( PS_Parser parser );
(*skip_PS_token)( PS_Parser parser );
FT_Long
(*to_int)( PS_Parser parser );
FT_Fixed
(*to_fixed)( PS_Parser parser,
FT_Int power_ten );
FT_Error
(*to_bytes)( PS_Parser parser,
FT_Byte* bytes,
FT_Int max_bytes,
FT_Int* pnum_bytes );
FT_Long max_bytes,
FT_Long* pnum_bytes,
FT_Bool delimiters );
FT_Int
(*to_coord_array)( PS_Parser parser,
@ -648,14 +651,14 @@ FT_BEGIN_HEADER
T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1];
T1_Decoder_Zone zone;
PSNames_Service psnames; /* for seac */
FT_Service_PsCMaps psnames; /* for seac */
FT_UInt num_glyphs;
FT_Byte** glyph_names;
FT_Int lenIV; /* internal for sub routine calls */
FT_UInt num_subrs;
FT_Byte** subrs;
FT_Int* subrs_len; /* array of subrs length (optional) */
FT_PtrDist* subrs_len; /* array of subrs length (optional) */
FT_Matrix font_matrix;
FT_Vector font_offset;

View file

@ -125,11 +125,6 @@ FT_BEGIN_HEADER
(*TT_Done_Face_Func)( TT_Face face );
typedef FT_Module_Interface
(*SFNT_Get_Interface_Func)( FT_Module module,
const char* func_interface );
/*************************************************************************/
/* */
/* <FuncType> */
@ -255,20 +250,27 @@ FT_BEGIN_HEADER
/* returns its metrics. */
/* */
/* <Input> */
/* face :: The target face object. */
/* face :: */
/* The target face object. */
/* */
/* x_ppem :: The horizontal resolution in points per EM. */
/* strike_index :: */
/* The strike index. */
/* */
/* y_ppem :: The vertical resolution in points per EM. */
/* glyph_index :: */
/* The current glyph index. */
/* */
/* glyph_index :: The current glyph index. */
/* load_flags :: */
/* The current load flags. */
/* */
/* stream :: The input stream. */
/* stream :: */
/* The input stream. */
/* */
/* <Output> */
/* amap :: The target pixmap. */
/* amap :: */
/* The target pixmap. */
/* */
/* ametrics :: A big sbit metrics structure for the glyph image. */
/* ametrics :: */
/* A big sbit metrics structure for the glyph image. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. Returns an error if no */
@ -312,8 +314,8 @@ FT_BEGIN_HEADER
/* */
typedef FT_Error
(*TT_Set_SBit_Strike_Func)( TT_Face face,
FT_Int x_ppem,
FT_Int y_ppem,
FT_UInt x_ppem,
FT_UInt y_ppem,
FT_ULong *astrike_index );
@ -366,57 +368,6 @@ FT_BEGIN_HEADER
FT_Bool vertical );
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_CharMap_Load_Func */
/* */
/* <Description> */
/* Loads a given TrueType character map into memory. */
/* */
/* <Input> */
/* face :: A handle to the parent face object. */
/* */
/* stream :: A handle to the current stream object. */
/* */
/* <InOut> */
/* cmap :: A pointer to a cmap object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The function assumes that the stream is already in use (i.e., */
/* opened). In case of error, all partially allocated tables are */
/* released. */
/* */
typedef FT_Error
(*TT_CharMap_Load_Func)( TT_Face face,
TT_CMapTable cmap,
FT_Stream input );
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_CharMap_Free_Func */
/* */
/* <Description> */
/* Destroys a character mapping table. */
/* */
/* <Input> */
/* face :: A handle to the parent face object. */
/* */
/* cmap :: A handle to a cmap object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
typedef FT_Error
(*TT_CharMap_Free_Func)( TT_Face face,
TT_CMapTable cmap );
/*************************************************************************/
/* */
/* <FuncType> */
@ -457,22 +408,6 @@ FT_BEGIN_HEADER
(*TT_Free_Table_Func)( TT_Face face );
/*************************************************************************/
/* */
/* <FuncType> */
/* SFNT_Load_Table_Func */
/* */
/* <Description> */
/* Loads a given SFNT table into memory. */
/* */
typedef FT_Error
(*SFNT_Load_Table_Func)( FT_Face face,
FT_ULong tag,
FT_Long offset,
FT_Byte* buffer,
FT_ULong* length );
/*************************************************************************/
/* */
/* <Struct> */
@ -492,7 +427,7 @@ FT_BEGIN_HEADER
TT_Init_Face_Func init_face;
TT_Load_Face_Func load_face;
TT_Done_Face_Func done_face;
SFNT_Get_Interface_Func get_interface;
FT_Module_Requester get_interface;
TT_Load_Any_Func load_any;
TT_Load_SFNT_HeaderRec_Func load_sfnt_header;
@ -531,10 +466,6 @@ FT_BEGIN_HEADER
TT_Get_PS_Name_Func get_psname;
TT_Free_Table_Func free_psnames;
/* see `ttcmap.h' */
TT_CharMap_Load_Func load_charmap;
TT_CharMap_Free_Func free_charmap;
} SFNT_Interface;

View file

@ -5,7 +5,7 @@
/* Basic Type1/Type2 type definitions and interface (specification */
/* only). */
/* */
/* Copyright 1996-2001, 2002, 2003 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -23,8 +23,9 @@
#include <ft2build.h>
#include FT_TYPE1_TABLES_H
#include FT_INTERNAL_POSTSCRIPT_NAMES_H
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
#include FT_INTERNAL_SERVICE_H
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
FT_BEGIN_HEADER
@ -101,21 +102,21 @@ FT_BEGIN_HEADER
FT_Int num_subrs;
FT_Byte** subrs;
FT_Int* subrs_len;
FT_PtrDist* subrs_len;
FT_Int num_glyphs;
FT_String** glyph_names; /* array of glyph names */
FT_Byte** charstrings; /* array of glyph charstrings */
FT_Int* charstrings_len;
FT_PtrDist* charstrings_len;
FT_Byte* paint_type;
FT_Byte paint_type;
FT_Byte font_type;
FT_Matrix font_matrix;
FT_Vector font_offset;
FT_BBox font_bbox;
FT_Long font_id;
FT_Fixed* stroke_width;
FT_Fixed stroke_width;
} T1_FontRec, *T1_Font;
@ -141,17 +142,6 @@ FT_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
/* */
/* This structure/class is defined here because it is common to the */
/* following formats: TTF, OpenType-TT, and OpenType-CFF. */
/* */
/* Note, however, that the classes TT_Size, TT_GlyphSlot, and TT_CharMap */
/* are not shared between font drivers, and are thus defined normally in */
/* `ttobjs.h'. */
/* */
/*************************************************************************/
typedef struct T1_FaceRec_* T1_Face;
typedef struct CID_FaceRec_* CID_Face;
@ -169,7 +159,7 @@ FT_BEGIN_HEADER
/* support for Multiple Masters fonts */
PS_Blend blend;
/* since FT 2.1 - interface to PostScript hinter */
const void* pshinter;
@ -183,8 +173,10 @@ FT_BEGIN_HEADER
void* psaux;
CID_FaceInfoRec cid;
void* afm_data;
FT_Byte* binary_data; /* used if hex data has been converted */
FT_Stream cid_stream;
CID_Subrs subrs;
/* since FT 2.1 - interface to PostScript hinter */
void* pshinter;

View file

@ -105,41 +105,6 @@ FT_BEGIN_HEADER
} SFNT_HeaderRec, *SFNT_Header;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_TableDirRec */
/* */
/* <Description> */
/* This structure models a TrueType table directory. It is used to */
/* access the various tables of the font face. */
/* */
/* <Fields> */
/* version :: The version number; starts with 0x00010000. */
/* */
/* numTables :: The number of tables. */
/* */
/* searchRange :: Unused. */
/* */
/* entrySelector :: Unused. */
/* */
/* rangeShift :: Unused. */
/* */
/* <Note> */
/* This structure is only used during font opening. */
/* */
typedef struct TT_TableDirRec_
{
FT_Fixed version; /* should be 0x10000 */
FT_UShort numTables; /* number of tables */
FT_UShort searchRange; /* These parameters are only used */
FT_UShort entrySelector; /* for a dichotomy search in the */
FT_UShort rangeShift; /* directory. We ignore them. */
} TT_TableDirRec;
/*************************************************************************/
/* */
/* <Struct> */
@ -168,61 +133,6 @@ FT_BEGIN_HEADER
} TT_TableRec, *TT_Table;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_CMapDirRec */
/* */
/* <Description> */
/* This structure describes the directory of the `cmap' table, */
/* containing the font's character mappings table. */
/* */
/* <Fields> */
/* tableVersionNumber :: The version number. */
/* */
/* numCMaps :: The number of charmaps in the font. */
/* */
/* <Note> */
/* This structure is only used during font loading. */
/* */
typedef struct TT_CMapDirRec_
{
FT_UShort tableVersionNumber;
FT_UShort numCMaps;
} TT_CMapDirRec, *TT_CMapDir;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_CMapDirEntryRec */
/* */
/* <Description> */
/* This structure describes a charmap in a TrueType font. */
/* */
/* <Fields> */
/* platformID :: An ID used to specify for which platform this */
/* charmap is defined (FreeType manages all platforms). */
/* */
/* encodingID :: A platform-specific ID used to indicate which source */
/* encoding is used in this charmap. */
/* */
/* offset :: The offset of the charmap relative to the start of */
/* the `cmap' table. */
/* */
/* <Note> */
/* This structure is only used during font loading. */
/* */
typedef struct TT_CMapDirEntryRec_
{
FT_UShort platformID;
FT_UShort platformEncodingID;
FT_Long offset;
} TT_CMapDirEntryRec, *TT_CMapDirEntry;
/*************************************************************************/
/* */
/* <Struct> */
@ -908,201 +818,6 @@ FT_BEGIN_HEADER
} TT_Post_NamesRec, *TT_Post_Names;
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** TRUETYPE CHARMAPS SUPPORT ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* format 0 */
typedef struct TT_CMap0_
{
FT_ULong language; /* for Mac fonts (originally ushort) */
FT_Byte* glyphIdArray;
} TT_CMap0Rec, *TT_CMap0;
/* format 2 */
typedef struct TT_CMap2SubHeaderRec_
{
FT_UShort firstCode; /* first valid low byte */
FT_UShort entryCount; /* number of valid low bytes */
FT_Short idDelta; /* delta value to glyphIndex */
FT_UShort idRangeOffset; /* offset from here to 1st code */
} TT_CMap2SubHeaderRec, *TT_CMap2SubHeader;
typedef struct TT_CMap2Rec_
{
FT_ULong language; /* for Mac fonts (originally ushort) */
FT_UShort* subHeaderKeys; /* high byte mapping table */
/* value = subHeader index * 8 */
TT_CMap2SubHeader subHeaders;
FT_UShort* glyphIdArray;
FT_UShort numGlyphId; /* control value */
} TT_CMap2Rec, *TT_CMap2;
/* format 4 */
typedef struct TT_CMap4Segment_
{
FT_UShort endCount;
FT_UShort startCount;
FT_Short idDelta;
FT_UShort idRangeOffset;
} TT_CMap4SegmentRec, *TT_CMap4Segment;
typedef struct TT_CMap4Rec_
{
FT_ULong language; /* for Mac fonts (originally ushort) */
FT_UShort segCountX2; /* number of segments * 2 */
FT_UShort searchRange; /* these parameters can be used */
FT_UShort entrySelector; /* for a binary search */
FT_UShort rangeShift;
TT_CMap4Segment segments;
FT_UShort* glyphIdArray;
FT_UShort numGlyphId; /* control value */
TT_CMap4Segment last_segment; /* last used segment; this is a small */
/* cache to potentially increase speed */
} TT_CMap4Rec, *TT_CMap4;
/* format 6 */
typedef struct TT_CMap6_
{
FT_ULong language; /* for Mac fonts (originally ushort) */
FT_UShort firstCode; /* first character code of subrange */
FT_UShort entryCount; /* number of character codes in subrange */
FT_UShort* glyphIdArray;
} TT_CMap6Rec, *TT_CMap6;
/* auxiliary table for format 8 and 12 */
typedef struct TT_CMapGroupRec_
{
FT_ULong startCharCode;
FT_ULong endCharCode;
FT_ULong startGlyphID;
} TT_CMapGroupRec, *TT_CMapGroup;
/* FreeType handles format 8 and 12 identically. It is not necessary to
cover mixed 16bit and 32bit codes since FreeType always uses FT_ULong
for input character codes -- converting Unicode surrogates to 32bit
character codes must be done by the application. */
typedef struct TT_CMap8_12Rec_
{
FT_ULong language; /* for Mac fonts */
FT_ULong nGroups;
TT_CMapGroup groups;
TT_CMapGroup last_group; /* last used group; this is a small */
/* cache to potentially increase speed */
} TT_CMap8_12Rec, *TT_CMap8_12;
/* format 10 */
typedef struct TT_CMap10Rec_
{
FT_ULong language; /* for Mac fonts */
FT_ULong startCharCode; /* first character covered */
FT_ULong numChars; /* number of characters covered */
FT_UShort* glyphs;
} TT_CMap10Rec, *TT_CMap10;
typedef struct TT_CMapTableRec_* TT_CMapTable;
typedef FT_UInt
(*TT_CharMap_Func)( TT_CMapTable charmap,
FT_ULong char_code );
typedef FT_ULong
(*TT_CharNext_Func)( TT_CMapTable charmap,
FT_ULong char_code );
/* charmap table */
typedef struct TT_CMapTableRec_
{
FT_UShort platformID;
FT_UShort platformEncodingID;
FT_UShort format;
FT_ULong length; /* must be ulong for formats 8, 10, and 12 */
FT_Bool loaded;
FT_ULong offset;
union
{
TT_CMap0Rec cmap0;
TT_CMap2Rec cmap2;
TT_CMap4Rec cmap4;
TT_CMap6Rec cmap6;
TT_CMap8_12Rec cmap8_12;
TT_CMap10Rec cmap10;
} c;
TT_CharMap_Func get_index;
TT_CharNext_Func get_next_char;
} TT_CMapTableRec;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_CharMapRec */
/* */
/* <Description> */
/* The TrueType character map object type. */
/* */
/* <Fields> */
/* root :: The parent character map structure. */
/* */
/* cmap :: The used character map. */
/* */
typedef struct TT_CharMapRec_
{
FT_CharMapRec root;
TT_CMapTableRec cmap;
} TT_CharMapRec;
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@ -1121,9 +836,8 @@ FT_BEGIN_HEADER
/* This structure/class is defined here because it is common to the */
/* following formats: TTF, OpenType-TT, and OpenType-CFF. */
/* */
/* Note, however, that the classes TT_Size, TT_GlyphSlot, and TT_CharMap */
/* are not shared between font drivers, and are thus defined in */
/* `ttobjs.h'. */
/* Note, however, that the classes TT_Size and TT_GlyphSlot are not */
/* shared between font drivers, and are thus defined in `ttobjs.h'. */
/* */
/*************************************************************************/
@ -1145,17 +859,6 @@ FT_BEGIN_HEADER
typedef struct TT_FaceRec_* TT_Face;
/*************************************************************************/
/* */
/* <Type> */
/* TT_CharMap */
/* */
/* <Description> */
/* A handle to a TrueType character mapping object. */
/* */
typedef struct TT_CharMapRec_* TT_CharMap;
/* a function type used for the truetype bytecode interpreter hooks */
typedef FT_Error
(*TT_Interpreter)( void* exec_context );
@ -1341,15 +1044,6 @@ FT_BEGIN_HEADER
/* cmap_size :: The size in bytes of the `cmap_table' */
/* described above. */
/* */
/* num_charmaps :: The number of character mappings in the */
/* font. */
/* */
/* charmaps :: The array of charmap objects for this font */
/* file. Note that this field is a typeless */
/* pointer. The Reason is that the format of */
/* charmaps varies with the underlying font */
/* format and cannot be determined here. */
/* */
/* goto_table :: A function called by each TrueType table */
/* loader to position a stream's cursor to */
/* the start of a given table according to */
@ -1375,10 +1069,9 @@ FT_BEGIN_HEADER
/* It must be called after the header was */
/* read, and before the `forget'. */
/* */
/* sfnt :: A pointer to the SFNT `driver' interface. */
/* sfnt :: A pointer to the SFNT service. */
/* */
/* psnames :: A pointer to the `PSNames' module */
/* interface. */
/* psnames :: A pointer to the PostScript names service. */
/* */
/* hdmx :: The face's horizontal device metrics */
/* (`hdmx' table). This table is optional in */
@ -1497,14 +1190,15 @@ FT_BEGIN_HEADER
TT_Loader_ReadGlyphFunc read_simple_glyph;
TT_Loader_ReadGlyphFunc read_composite_glyph;
/* a typeless pointer to the SFNT_Interface table used to load */
/* the basic TrueType tables in the face object */
/* a typeless pointer to the SFNT_Interface table used to load */
/* the basic TrueType tables in the face object */
void* sfnt;
/* a typeless pointer to the PSNames_Interface table used to */
/* handle glyph names <-> unicode & Mac values */
/* a typeless pointer to the FT_Service_PsCMapsRec table used to */
/* handle glyph names <-> unicode & Mac values */
void* psnames;
/***********************************************************************/
/* */
/* Optional TrueType/OpenType tables */
@ -1576,6 +1270,8 @@ FT_BEGIN_HEADER
FT_Generic extra;
const char* postscript_name;
} TT_FaceRec;

View file

@ -24,6 +24,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER

View file

@ -291,6 +291,7 @@ FT_BEGIN_HEADER
#define TT_ADOBE_ID_STANDARD 0
#define TT_ADOBE_ID_EXPERT 1
#define TT_ADOBE_ID_CUSTOM 2
#define TT_ADOBE_ID_LATIN_1 3
/*************************************************************************/

View file

@ -24,6 +24,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@ -566,11 +572,6 @@ FT_BEGIN_HEADER
/* */
/* internal use only */
typedef void*
(*FT_Get_Sfnt_Table_Func)( FT_Face face,
FT_Sfnt_Tag tag );
/*************************************************************************/
/* */
@ -662,6 +663,27 @@ FT_BEGIN_HEADER
FT_Byte* buffer,
FT_ULong* length );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_CMap_Language_ID */
/* */
/* <Description> */
/* Return TrueType/sfnt specific cmap language ID. Definitions of */
/* language ID values are in freetype/ttnameid.h. */
/* */
/* <Input> */
/* charmap :: */
/* The target charmap. */
/* */
/* <Return> */
/* The language ID of `charmap'. If `charmap' doesn't belong to a */
/* TrueType/sfnt face, just return 0 as the default value. */
/* */
FT_EXPORT( FT_ULong )
FT_Get_CMap_Language_ID( FT_CharMap charmap );
/* */

View file

@ -23,6 +23,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER

View file

@ -25,6 +25,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER

View file

@ -30,7 +30,7 @@
/* cf. AH_BLUE_XXX constants in ahtypes.h */
static
const char* blue_chars[AH_BLUE_MAX] =
const char* const blue_chars[AH_BLUE_MAX] =
{
"THEZOCQS",
"HEZLOCUS",

View file

@ -418,7 +418,7 @@
/* first of all, reallocate the contours array if necessary */
if ( num_contours > outline->max_contours )
{
FT_Int new_contours = ( num_contours + 3 ) & -4;
FT_Int new_contours = FT_PAD_CEIL( num_contours, 4 );
if ( FT_RENEW_ARRAY( outline->contours,
@ -435,7 +435,7 @@
/* */
if ( num_points + 2 > outline->max_points )
{
FT_Int news = ( num_points + 2 + 7 ) & -8;
FT_Int news = FT_PAD_CEIL( num_points, 8 );
FT_Int max = outline->max_points;

View file

@ -4,7 +4,7 @@
/* */
/* Glyph hinter (body). */
/* */
/* Copyright 2000-2001, 2002, 2003 Catharon Productions Inc. */
/* Copyright 2000-2001, 2002, 2003, 2004 Catharon Productions Inc. */
/* Author: David Turner */
/* */
/* This file is part of the Catharon Typography Project and shall only */
@ -71,7 +71,7 @@
}
}
scaled = ( reference + 32 ) & -64;
scaled = FT_PIX_ROUND( reference );
if ( width >= reference )
{
@ -167,7 +167,7 @@
dist += delta;
}
else
dist = ( dist + 32 ) & -64;
dist = ( dist + 32 ) & ~63;
}
}
else
@ -181,7 +181,7 @@
/* in the case of vertical hinting, always round */
/* the stem heights to integer pixels */
if ( dist >= 64 )
dist = ( dist + 16 ) & -64;
dist = ( dist + 16 ) & ~63;
else
dist = 64;
}
@ -196,7 +196,7 @@
if ( dist < 64 )
dist = 64;
else
dist = ( dist + 32 ) & -64;
dist = ( dist + 32 ) & ~63;
}
else
{
@ -207,10 +207,10 @@
dist = ( dist + 64 ) >> 1;
else if ( dist < 128 )
dist = ( dist + 22 ) & -64;
dist = ( dist + 22 ) & ~63;
else
/* XXX: round otherwise to prevent color fringes in LCD mode */
dist = ( dist + 32 ) & -64;
dist = ( dist + 32 ) & ~63;
}
}
}
@ -284,7 +284,7 @@
dist += delta;
}
else
dist = ( dist + 32 ) & -64;
dist = ( dist + 32 ) & ~63;
}
}
else
@ -298,7 +298,7 @@
/* in the case of vertical hinting, always round */
/* the stem heights to integer pixels */
if ( dist >= 64 )
dist = ( dist + 16 ) & -64;
dist = ( dist + 16 ) & ~63;
else
dist = 64;
}
@ -313,7 +313,7 @@
if ( dist < 64 )
dist = 64;
else
dist = ( dist + 32 ) & -64;
dist = ( dist + 32 ) & ~63;
}
else
{
@ -324,10 +324,10 @@
dist = ( dist + 64 ) >> 1;
else if ( dist < 128 )
dist = ( dist + 22 ) & -64;
dist = ( dist + 22 ) & ~63;
else
/* XXX: round otherwise to prevent color fringes in LCD mode */
dist = ( dist + 32 ) & -64;
dist = ( dist + 32 ) & ~63;
}
}
}
@ -396,7 +396,7 @@
if ( base->flags & AH_EDGE_DONE )
{
if ( dist >= 64 )
dist = ( dist + 8 ) & -64;
dist = ( dist + 8 ) & ~63;
else if ( dist <= 32 && !vertical )
dist = ( dist + 33 ) >> 1;
@ -545,7 +545,7 @@
{
org_center = edge->opos + ( org_len >> 1 );
cur_pos1 = ( org_center + 32 ) & -64;
cur_pos1 = FT_PIX_ROUND( org_center );
error1 = org_center - ( cur_pos1 - u_off );
if ( error1 < 0 )
@ -565,7 +565,7 @@
}
else
edge->pos = ( edge->opos + 32 ) & -64;
edge->pos = FT_PIX_ROUND( edge->opos );
anchor = edge;
@ -575,7 +575,7 @@
#else /* !FT_CONFIG_CHESTER_STEM */
edge->pos = ( edge->opos + 32 ) & -64;
edge->pos = FT_PIX_ROUND( edge->opos );
anchor = edge;
edge->flags |= AH_EDGE_DONE;
@ -614,7 +614,7 @@
FT_Pos u_off, d_off;
cur_pos1 = ( org_center + 32 ) & -64;
cur_pos1 = FT_PIX_ROUND( org_center );
if (cur_len <= 64 )
u_off = d_off = 32;
@ -649,12 +649,12 @@
cur_len = ah_compute_stem_width( hinter, dimension, org_len,
edge->flags, edge2->flags );
cur_pos1 = ( org_pos + 32 ) & -64;
cur_pos1 = FT_PIX_ROUND( org_pos );
delta1 = ( cur_pos1 + ( cur_len >> 1 ) - org_center );
if ( delta1 < 0 )
delta1 = -delta1;
cur_pos2 = ( ( org_pos + org_len + 32 ) & -64 ) - cur_len;
cur_pos2 = FT_PIX_ROUND( org_pos + org_len ) - cur_len;
delta2 = ( cur_pos2 + ( cur_len >> 1 ) - org_center );
if ( delta2 < 0 )
delta2 = -delta2;
@ -665,12 +665,12 @@
#else /* !FT_CONFIG_CHESTER_STEM */
cur_pos1 = ( org_pos + 32 ) & -64;
cur_pos1 = FT_PIX_ROUND( org_pos );
delta1 = ( cur_pos1 + ( cur_len >> 1 ) - org_center );
if ( delta1 < 0 )
delta1 = -delta1;
cur_pos2 = ( ( org_pos + org_len + 32 ) & -64 ) - cur_len;
cur_pos2 = FT_PIX_ROUND( org_pos + org_len ) - cur_len;
delta2 = ( cur_pos2 + ( cur_len >> 1 ) - org_center );
if ( delta2 < 0 )
delta2 = -delta2;
@ -703,7 +703,7 @@
/* the third (lowest) stem aligns with the base line; it might end up */
/* one pixel higher or lower. */
n_edges = edge_limit - edges;
n_edges = (FT_Int)( edge_limit - edges );
if ( !dimension && ( n_edges == 6 || n_edges == 12 ) )
{
AH_EdgeRec *edge1, *edge2, *edge3;
@ -764,12 +764,12 @@
ah_align_serif_edge( hinter, edge->serif, edge, dimension );
else if ( !anchor )
{
edge->pos = ( edge->opos + 32 ) & -64;
edge->pos = FT_PIX_ROUND( edge->opos );
anchor = edge;
}
else
edge->pos = anchor->pos +
( ( edge->opos-anchor->opos + 32 ) & -64 );
FT_PIX_ROUND( edge->opos - anchor->opos );
edge->flags |= AH_EDGE_DONE;
@ -943,7 +943,7 @@
/* find enclosing edges */
min = 0;
max = edge_limit - edges;
max = (FT_UInt)( edge_limit - edges );
while ( min < max )
{
@ -1299,15 +1299,16 @@
if ( delta2 < 32 )
delta2 = 0;
else if ( delta2 < 64 )
delta2 = 32 + ( ( ( delta2 - 32 ) + 16 ) & -32 );
delta2 = 32 + ( ( ( delta2 - 32 ) + 16 ) & ~31 );
else
delta2 = ( delta2 + 32 ) & -64;
delta2 = FT_PIX_ROUND( delta2 );
if ( delta < 0 )
delta2 = -delta2;
scaled->blue_refs[n] =
( FT_MulFix( design->blue_refs[n], y_scale ) + 32 ) & -64;
FT_PIX_ROUND( FT_MulFix( design->blue_refs[n], y_scale ) );
scaled->blue_shoots[n] = scaled->blue_refs[n] + delta2;
}
@ -1493,14 +1494,14 @@
if ( error )
goto Exit;
FT_MEM_COPY( gloader->current.extra_points, slot->outline.points,
slot->outline.n_points * sizeof ( FT_Vector ) );
FT_ARRAY_COPY( gloader->current.extra_points, slot->outline.points,
slot->outline.n_points );
FT_MEM_COPY( gloader->current.outline.contours, slot->outline.contours,
slot->outline.n_contours * sizeof ( short ) );
FT_ARRAY_COPY( gloader->current.outline.contours, slot->outline.contours,
slot->outline.n_contours );
FT_MEM_COPY( gloader->current.outline.tags, slot->outline.tags,
slot->outline.n_points * sizeof ( char ) );
FT_ARRAY_COPY( gloader->current.outline.tags, slot->outline.tags,
slot->outline.n_points );
gloader->current.outline.n_points = slot->outline.n_points;
gloader->current.outline.n_contours = slot->outline.n_contours;
@ -1551,8 +1552,8 @@
old_lsb = edge1->opos;
new_lsb = edge1->pos;
hinter->pp1.x = ( ( new_lsb - old_lsb ) + 32 ) & -64;
hinter->pp2.x = ( ( edge2->pos + old_rsb ) + 32 ) & -64;
hinter->pp1.x = FT_PIX_ROUND( new_lsb - old_lsb );
hinter->pp2.x = FT_PIX_ROUND( edge2->pos + old_rsb );
#if 0
/* try to fix certain bad advance computations */
@ -1579,8 +1580,8 @@
if ( error )
goto Exit;
FT_MEM_COPY( gloader->current.subglyphs, slot->subglyphs,
num_subglyphs * sizeof ( FT_SubGlyph ) );
FT_ARRAY_COPY( gloader->current.subglyphs, slot->subglyphs,
num_subglyphs );
gloader->current.num_subglyphs = num_subglyphs;
num_base_subgs = gloader->base.num_subglyphs;
@ -1677,8 +1678,8 @@
x = FT_MulFix( subglyph->arg1, x_scale );
y = FT_MulFix( subglyph->arg2, y_scale );
x = ( x + 32 ) & -64;
y = ( y + 32 ) & -64;
x = FT_PIX_ROUND(x);
y = FT_PIX_ROUND(y);
}
{
@ -1715,10 +1716,10 @@
FT_Outline_Translate( &gloader->base.outline, -hinter->pp1.x, 0 );
FT_Outline_Get_CBox( &gloader->base.outline, &bbox );
bbox.xMin &= -64;
bbox.yMin &= -64;
bbox.xMax = ( bbox.xMax + 63 ) & -64;
bbox.yMax = ( bbox.yMax + 63 ) & -64;
bbox.xMin = FT_PIX_FLOOR( bbox.xMin );
bbox.yMin = FT_PIX_FLOOR( bbox.yMin );
bbox.xMax = FT_PIX_CEIL( bbox.xMax );
bbox.yMax = FT_PIX_CEIL( bbox.yMax );
slot->metrics.width = bbox.xMax - bbox.xMin;
slot->metrics.height = bbox.yMax - bbox.yMin;
@ -1733,7 +1734,7 @@
slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,
x_scale );
slot->metrics.horiAdvance = ( slot->metrics.horiAdvance + 32 ) & -64;
slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance );
/* now copy outline into glyph slot */
ah_loader_rewind( slot->internal->loader );
@ -1802,7 +1803,7 @@
if ( shoot > 0 )
{
FT_Pos scaled = FT_MulFix( shoot, y_scale );
FT_Pos fitted = ( scaled + 32 ) & -64;
FT_Pos fitted = FT_PIX_ROUND( scaled );
if ( scaled != fitted )
@ -1850,9 +1851,9 @@
hinter->do_stem_adjust = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT );
load_flags |= FT_LOAD_NO_SCALE
| FT_LOAD_IGNORE_TRANSFORM ;
load_flags |= FT_LOAD_NO_SCALE
| FT_LOAD_IGNORE_TRANSFORM;
load_flags &= ~FT_LOAD_RENDER;
error = ah_hinter_load( hinter, glyph_index, load_flags, 0 );

View file

@ -17,27 +17,8 @@
#include <ft2build.h>
#include FT_INTERNAL_BDF_TYPES_H
#include FT_INTERNAL_OBJECTS_H
static FT_Bool
test_font_type( FT_Face face,
const char* name )
{
if ( face && face->driver )
{
FT_Module driver = (FT_Module)face->driver;
if ( driver->clazz && driver->clazz->module_name )
{
if ( ft_strcmp( driver->clazz->module_name, name ) == 0 )
return 1;
}
}
return 0;
}
#include FT_SERVICE_BDF_H
FT_EXPORT_DEF( FT_Error )
@ -52,14 +33,15 @@
error = FT_Err_Invalid_Argument;
if ( test_font_type( face, "bdf" ) )
if ( face )
{
BDF_Public_Face bdf_face = (BDF_Public_Face)face;
FT_Service_BDF service;
encoding = (const char*) bdf_face->charset_encoding;
registry = (const char*) bdf_face->charset_registry;
error = 0;
FT_FACE_FIND_SERVICE( face, service, BDF );
if ( service && service->get_charset_id )
error = service->get_charset_id( face, &encoding, &registry );
}
if ( acharset_encoding )
@ -84,22 +66,18 @@
aproperty->type = BDF_PROPERTY_TYPE_NONE;
if ( face != NULL && face->driver != NULL )
if ( face )
{
FT_Driver driver = face->driver;
BDF_GetPropertyFunc func;
FT_Service_BDF service;
if ( driver->root.clazz->get_interface )
{
func = (BDF_GetPropertyFunc)driver->root.clazz->get_interface(
FT_MODULE( driver ), "get_bdf_property" );
if ( func )
error = func( face, prop_name, aproperty );
}
FT_FACE_FIND_SERVICE( face, service, BDF );
if ( service && service->get_property )
error = service->get_property( face, prop_name, aproperty );
}
return error;
return error;
}

View file

@ -74,8 +74,8 @@
FT_EXPORT_DEF( FT_Fixed )
FT_RoundFix( FT_Fixed a )
{
return ( a >= 0 ) ? ( a + 0x8000L ) & -0x10000L
: -((-a + 0x8000L ) & -0x10000L );
return ( a >= 0 ) ? ( a + 0x8000L ) & ~0xFFFFL
: -((-a + 0x8000L ) & ~0xFFFFL );
}
@ -84,8 +84,8 @@
FT_EXPORT_DEF( FT_Fixed )
FT_CeilFix( FT_Fixed a )
{
return ( a >= 0 ) ? ( a + 0xFFFFL ) & -0x10000L
: -((-a + 0xFFFFL ) & -0x10000L );
return ( a >= 0 ) ? ( a + 0xFFFFL ) & ~0xFFFFL
: -((-a + 0xFFFFL ) & ~0xFFFFL );
}
@ -94,8 +94,8 @@
FT_EXPORT_DEF( FT_Fixed )
FT_FloorFix( FT_Fixed a )
{
return ( a >= 0 ) ? a & -0x10000L
: -((-a) & -0x10000L );
return ( a >= 0 ) ? a & ~0xFFFFL
: -((-a) & ~0xFFFFL );
}
@ -155,6 +155,33 @@
}
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
/* documentation is in ftcalc.h */
FT_BASE_DEF( FT_Long )
FT_MulDiv_No_Round( FT_Long a,
FT_Long b,
FT_Long c )
{
FT_Int s;
FT_Long d;
s = 1;
if ( a < 0 ) { a = -a; s = -1; }
if ( b < 0 ) { b = -b; s = -s; }
if ( c < 0 ) { c = -c; s = -s; }
d = (FT_Long)( c > 0 ? (FT_Int64)a * b / c
: 0x7FFFFFFFL );
return ( s > 0 ) ? d : -d;
}
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
/* documentation is in freetype.h */
FT_EXPORT_DEF( FT_Long )
@ -303,9 +330,8 @@
s ^= c; c = ABS( c );
if ( a <= 46340L && b <= 46340L && c <= 176095L && c > 0 )
{
a = ( a * b + ( c >> 1 ) ) / c;
}
else if ( c > 0 )
{
FT_Int64 temp, temp2;
@ -325,6 +351,43 @@
}
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
FT_BASE_DEF( FT_Long )
FT_MulDiv_No_Round( FT_Long a,
FT_Long b,
FT_Long c )
{
long s;
if ( a == 0 || b == c )
return a;
s = a; a = ABS( a );
s ^= b; b = ABS( b );
s ^= c; c = ABS( c );
if ( a <= 46340L && b <= 46340L && c > 0 )
a = a * b / c;
else if ( c > 0 )
{
FT_Int64 temp;
ft_multo64( a, b, &temp );
a = ft_div64by32( temp.hi, temp.lo, c );
}
else
a = 0x7FFFFFFFL;
return ( s < 0 ? -a : a );
}
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
/* documentation is in freetype.h */
FT_EXPORT_DEF( FT_Long )

View file

@ -4,7 +4,7 @@
/* */
/* Memory debugger (body). */
/* */
/* Copyright 2001, 2002, 2003 by */
/* Copyright 2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -604,7 +604,7 @@
p = getenv( "FT2_ALLOC_TOTAL_MAX" );
if ( p != NULL )
{
FT_Long total_max = atol(p);
FT_Long total_max = ft_atol(p);
if ( total_max > 0 )
{
@ -616,7 +616,7 @@
p = getenv( "FT2_ALLOC_COUNT_MAX" );
if ( p != NULL )
{
FT_Long total_count = atol(p);
FT_Long total_count = ft_atol(p);
if ( total_count > 0 )
{

View file

@ -4,7 +4,7 @@
/* */
/* The FreeType glyph loader (body). */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -19,6 +19,7 @@
#include <ft2build.h>
#include FT_INTERNAL_GLYPH_LOADER_H
#include FT_INTERNAL_MEMORY_H
#include FT_INTERNAL_OBJECTS_H
#undef FT_COMPONENT
#define FT_COMPONENT trace_gloader
@ -205,7 +206,7 @@
if ( new_max > old_max )
{
new_max = ( new_max + 7 ) & -8;
new_max = FT_PAD_CEIL( new_max, 8 );
if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) ||
FT_RENEW_ARRAY( base->tags, old_max, new_max ) )
@ -225,7 +226,7 @@
n_contours;
if ( new_max > old_max )
{
new_max = ( new_max + 3 ) & -4;
new_max = FT_PAD_CEIL( new_max, 4 );
if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) )
goto Exit;
@ -261,7 +262,7 @@
old_max = loader->max_subglyphs;
if ( new_max > old_max )
{
new_max = ( new_max + 1 ) & -2;
new_max = FT_PAD_CEIL( new_max, 2 );
if ( FT_RENEW_ARRAY( base->subglyphs, old_max, new_max ) )
goto Exit;
@ -336,17 +337,17 @@
FT_Outline* in = &source->base.outline;
FT_MEM_COPY( out->points, in->points,
num_points * sizeof ( FT_Vector ) );
FT_MEM_COPY( out->tags, in->tags,
num_points * sizeof ( char ) );
FT_MEM_COPY( out->contours, in->contours,
num_contours * sizeof ( short ) );
FT_ARRAY_COPY( out->points, in->points,
num_points );
FT_ARRAY_COPY( out->tags, in->tags,
num_points );
FT_ARRAY_COPY( out->contours, in->contours,
num_contours );
/* do we need to copy the extra points? */
if ( target->use_extra && source->use_extra )
FT_MEM_COPY( target->base.extra_points, source->base.extra_points,
num_points * sizeof ( FT_Vector ) );
FT_ARRAY_COPY( target->base.extra_points, source->base.extra_points,
num_points );
out->n_points = (short)num_points;
out->n_contours = (short)num_contours;

View file

@ -4,7 +4,7 @@
/* */
/* FreeType convenience functions to handle glyphs (body). */
/* */
/* Copyright 1996-2001, 2002, 2003 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -253,14 +253,11 @@
goto Exit;
/* copy it */
FT_MEM_COPY( target->points, source->points,
source->n_points * sizeof ( FT_Vector ) );
FT_ARRAY_COPY( target->points, source->points, source->n_points );
FT_MEM_COPY( target->tags, source->tags,
source->n_points * sizeof ( FT_Byte ) );
FT_ARRAY_COPY( target->tags, source->tags, source->n_points );
FT_MEM_COPY( target->contours, source->contours,
source->n_contours * sizeof ( FT_Short ) );
FT_ARRAY_COPY( target->contours, source->contours, source->n_contours );
/* copy all flags, except the `FT_OUTLINE_OWNER' one */
target->flags = source->flags | FT_OUTLINE_OWNER;
@ -421,7 +418,7 @@
FT_Get_Glyph( FT_GlyphSlot slot,
FT_Glyph *aglyph )
{
FT_Library library = slot->library;
FT_Library library;
FT_Error error;
FT_Glyph glyph;
@ -431,6 +428,8 @@
if ( !slot )
return FT_Err_Invalid_Slot_Handle;
library = slot->library;
if ( !aglyph )
return FT_Err_Invalid_Argument;
@ -544,10 +543,10 @@
if ( bbox_mode == FT_GLYPH_BBOX_GRIDFIT ||
bbox_mode == FT_GLYPH_BBOX_PIXELS )
{
acbox->xMin &= -64;
acbox->yMin &= -64;
acbox->xMax = ( acbox->xMax + 63 ) & -64;
acbox->yMax = ( acbox->yMax + 63 ) & -64;
acbox->xMin = FT_PIX_FLOOR( acbox->xMin );
acbox->yMin = FT_PIX_FLOOR( acbox->yMin );
acbox->xMax = FT_PIX_CEIL( acbox->xMax );
acbox->yMax = FT_PIX_CEIL( acbox->yMax );
}
/* convert to integer pixels if needed */

View file

@ -4,7 +4,7 @@
/* */
/* Multiple Master font support (body). */
/* */
/* Copyright 1996-2001 by */
/* Copyright 1996-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -19,6 +19,7 @@
#include <ft2build.h>
#include FT_MULTIPLE_MASTERS_H
#include FT_INTERNAL_OBJECTS_H
#include FT_SERVICE_MULTIPLE_MASTERS_H
/*************************************************************************/
@ -31,15 +32,15 @@
#define FT_COMPONENT trace_mm
/* documentation is in ftmm.h */
FT_EXPORT_DEF( FT_Error )
FT_Get_Multi_Master( FT_Face face,
FT_Multi_Master *amaster )
static FT_Error
ft_face_get_mm_service( FT_Face face,
FT_Service_MultiMasters *aservice )
{
FT_Error error;
*aservice = NULL;
if ( !face )
return FT_Err_Invalid_Face_Handle;
@ -47,14 +48,34 @@
if ( FT_HAS_MULTIPLE_MASTERS( face ) )
{
FT_Driver driver = face->driver;
FT_Get_MM_Func func;
FT_FACE_LOOKUP_SERVICE( face,
*aservice,
MULTI_MASTERS );
if ( aservice )
error = FT_Err_Ok;
}
return error;
}
func = (FT_Get_MM_Func)driver->root.clazz->get_interface(
FT_MODULE( driver ), "get_mm" );
if ( func )
error = func( face, amaster );
/* documentation is in ftmm.h */
FT_EXPORT_DEF( FT_Error )
FT_Get_Multi_Master( FT_Face face,
FT_Multi_Master *amaster )
{
FT_Error error;
FT_Service_MultiMasters service;
error = ft_face_get_mm_service( face, &service );
if ( !error )
{
error = FT_Err_Invalid_Argument;
if ( service->get_mm )
error = service->get_mm( face, amaster );
}
return error;
@ -68,24 +89,16 @@
FT_UInt num_coords,
FT_Long* coords )
{
FT_Error error;
FT_Error error;
FT_Service_MultiMasters service;
if ( !face )
return FT_Err_Invalid_Face_Handle;
error = FT_Err_Invalid_Argument;
if ( FT_HAS_MULTIPLE_MASTERS( face ) )
error = ft_face_get_mm_service( face, &service );
if ( !error )
{
FT_Driver driver = face->driver;
FT_Set_MM_Design_Func func;
func = (FT_Set_MM_Design_Func)driver->root.clazz->get_interface(
FT_MODULE( driver ), "set_mm_design" );
if ( func )
error = func( face, num_coords, coords );
error = FT_Err_Invalid_Argument;
if ( service->set_mm_design )
error = service->set_mm_design( face, num_coords, coords );
}
return error;
@ -99,24 +112,16 @@
FT_UInt num_coords,
FT_Fixed* coords )
{
FT_Error error;
FT_Error error;
FT_Service_MultiMasters service;
if ( !face )
return FT_Err_Invalid_Face_Handle;
error = FT_Err_Invalid_Argument;
if ( FT_HAS_MULTIPLE_MASTERS( face ) )
error = ft_face_get_mm_service( face, &service );
if ( !error )
{
FT_Driver driver = face->driver;
FT_Set_MM_Blend_Func func;
func = (FT_Set_MM_Blend_Func)driver->root.clazz->get_interface(
FT_MODULE( driver ), "set_mm_blend" );
if ( func )
error = func( face, num_coords, coords );
error = FT_Err_Invalid_Argument;
if ( service->set_mm_blend )
error = service->set_mm_blend( face, num_coords, coords );
}
return error;

View file

@ -4,7 +4,7 @@
/* */
/* The FreeType private base classes (body). */
/* */
/* Copyright 1996-2001, 2002, 2003 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -27,6 +27,35 @@
#include FT_TRUETYPE_IDS_H
#include FT_OUTLINE_H
#include FT_SERVICE_SFNT_H
#include FT_SERVICE_POSTSCRIPT_NAME_H
#include FT_SERVICE_GLYPH_DICT_H
#include FT_SERVICE_TT_CMAP_H
FT_BASE_DEF( FT_Pointer )
ft_service_list_lookup( FT_ServiceDesc service_descriptors,
const char* service_id )
{
FT_Pointer result = NULL;
FT_ServiceDesc desc = service_descriptors;
if ( desc && service_id )
{
for ( ; desc->serv_id != NULL; desc++ )
{
if ( ft_strcmp( desc->serv_id, service_id ) == 0 )
{
result = (FT_Pointer)desc->serv_data;
break;
}
}
}
return result;
}
FT_BASE_DEF( void )
ft_validator_init( FT_Validator valid,
@ -547,15 +576,14 @@
if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 &&
( face->face_flags & FT_FACE_FLAG_SCALABLE ) )
{
FT_UInt EM = face->units_per_EM;
FT_Size_Metrics* metrics = &face->size->metrics;
slot->linearHoriAdvance = FT_MulDiv( slot->linearHoriAdvance,
(FT_Long)metrics->x_ppem << 16, EM );
metrics->x_scale, 64 );
slot->linearVertAdvance = FT_MulDiv( slot->linearVertAdvance,
(FT_Long)metrics->y_ppem << 16, EM );
metrics->y_scale, 64 );
}
if ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM ) == 0 )
@ -641,6 +669,28 @@
}
static void
destroy_charmaps( FT_Face face,
FT_Memory memory )
{
FT_Int n;
for ( n = 0; n < face->num_charmaps; n++ )
{
FT_CMap cmap = FT_CMAP( face->charmaps[n] );
FT_CMap_Done( cmap );
face->charmaps[n] = NULL;
}
FT_FREE( face->charmaps );
face->num_charmaps = 0;
}
/* destructor for faces list */
static void
destroy_face( FT_Memory memory,
@ -661,9 +711,9 @@
/* discard all sizes for this face */
FT_List_Finalize( &face->sizes_list,
(FT_List_Destructor)destroy_size,
memory,
driver );
(FT_List_Destructor)destroy_size,
memory,
driver );
face->size = 0;
/* now discard client data */
@ -671,25 +721,8 @@
face->generic.finalizer( face );
/* discard charmaps */
{
FT_Int n;
for ( n = 0; n < face->num_charmaps; n++ )
{
FT_CMap cmap = FT_CMAP( face->charmaps[n] );
FT_CMap_Done( cmap );
face->charmaps[n] = NULL;
}
FT_FREE( face->charmaps );
face->num_charmaps = 0;
}
destroy_charmaps( face, memory );
/* finalize format-specific stuff */
if ( clazz->done_face )
clazz->done_face( face );
@ -704,7 +737,6 @@
/* get rid of it */
if ( face->internal )
{
FT_FREE( face->internal->postscript_name );
FT_FREE( face->internal );
}
FT_FREE( face );
@ -748,7 +780,7 @@
/* caller should have already checked that `face' is valid */
FT_ASSERT ( face );
FT_ASSERT( face );
first = face->charmaps;
@ -897,6 +929,7 @@
Fail:
if ( error )
{
destroy_charmaps( face, memory );
clazz->done_face( face );
FT_FREE( internal );
FT_FREE( face );
@ -1109,9 +1142,10 @@
FT_Error error = FT_Err_Cannot_Open_Resource;
FT_Memory memory = library->memory;
FT_Byte* pfb_data;
int i, type, flags, len;
int i, type, flags;
FT_Long len;
FT_Long pfb_len, pfb_pos, pfb_lenpos;
FT_Long rlen, junk, temp;
FT_Long rlen, temp;
FT_Long *offsets;
@ -1130,12 +1164,11 @@
/* Find all the POST resource offsets */
for ( i = 0; i < resource_cnt; ++i )
{
(void)FT_READ_USHORT( junk ); /* resource id */
(void)FT_READ_USHORT( junk ); /* rsource name */
(void)FT_STREAM_SKIP( 4 ); /* resource id and resource name */
if ( FT_READ_LONG( temp ) )
goto Exit;
offsets[i] = resource_data + ( temp & 0xFFFFFFL );
(void)FT_READ_LONG( junk ); /* mbz */
(void)FT_STREAM_SKIP( 4 ); /* mbz */
}
/* Find the length of all the POST resources, concatenated. Assume */
@ -1154,14 +1187,14 @@
if ( FT_ALLOC( pfb_data, (FT_Long)pfb_len + 2 ) )
goto Exit;
pfb_pos = 0;
pfb_data[pfb_pos++] = 0x80;
pfb_data[pfb_pos++] = 1; /* Ascii section */
pfb_lenpos = pfb_pos;
pfb_data[pfb_pos++] = 0; /* 4-byte length, fill in later */
pfb_data[pfb_pos++] = 0;
pfb_data[pfb_pos++] = 0;
pfb_data[pfb_pos++] = 0;
pfb_data[0] = 0x80;
pfb_data[1] = 1; /* Ascii section */
pfb_data[2] = 0; /* 4-byte length, fill in later */
pfb_data[3] = 0;
pfb_data[4] = 0;
pfb_data[5] = 0;
pfb_pos = 7;
pfb_lenpos = 2;
len = 0;
type = 1;
@ -1179,10 +1212,10 @@
len += rlen;
else
{
pfb_data[pfb_lenpos ] = len & 0xFF;
pfb_data[pfb_lenpos + 1] = ( len >> 8 ) & 0xFF;
pfb_data[pfb_lenpos + 2] = ( len >> 16 ) & 0xFF;
pfb_data[pfb_lenpos + 3] = ( len >> 24 ) & 0xFF;
pfb_data[pfb_lenpos ] = (FT_Byte)( len );
pfb_data[pfb_lenpos + 1] = (FT_Byte)( len >> 8 );
pfb_data[pfb_lenpos + 2] = (FT_Byte)( len >> 16 );
pfb_data[pfb_lenpos + 3] = (FT_Byte)( len >> 24 );
if ( ( flags >> 8 ) == 5 ) /* End of font mark */
break;
@ -1192,8 +1225,8 @@
type = flags >> 8;
len = rlen;
pfb_data[pfb_pos++] = type;
pfb_lenpos = pfb_pos;
pfb_data[pfb_pos++] = (FT_Byte)type;
pfb_lenpos = (FT_Byte)pfb_pos;
pfb_data[pfb_pos++] = 0; /* 4-byte length, fill in later */
pfb_data[pfb_pos++] = 0;
pfb_data[pfb_pos++] = 0;
@ -1207,10 +1240,10 @@
pfb_data[pfb_pos++] = 0x80;
pfb_data[pfb_pos++] = 3;
pfb_data[pfb_lenpos ] = len & 0xFF;
pfb_data[pfb_lenpos + 1] = ( len >> 8 ) & 0xFF;
pfb_data[pfb_lenpos + 2] = ( len >> 16 ) & 0xFF;
pfb_data[pfb_lenpos + 3] = ( len >> 24 ) & 0xFF;
pfb_data[pfb_lenpos ] = (FT_Byte)( len );
pfb_data[pfb_lenpos + 1] = (FT_Byte)( len >> 8 );
pfb_data[pfb_lenpos + 2] = (FT_Byte)( len >> 16 );
pfb_data[pfb_lenpos + 3] = (FT_Byte)( len >> 24 );
return open_face_from_buffer( library,
pfb_data,
@ -1247,7 +1280,7 @@
FT_Error error;
int i;
FT_Long flag_offset= 0xFFFFFFL;
FT_Long rlen, junk;
FT_Long rlen;
int is_cff;
@ -1262,12 +1295,11 @@
for ( i = 0; i <= face_index; ++i )
{
(void)FT_READ_USHORT( junk ); /* resource id */
(void)FT_READ_USHORT( junk ); /* rsource name */
(void)FT_STREAM_SKIP( 4 ); /* resource id and resource name */
if ( FT_READ_LONG( flag_offset ) )
goto Exit;
flag_offset &= 0xFFFFFFL;
(void)FT_READ_LONG( junk ); /* mbz */
(void)FT_STREAM_SKIP( 4 ); /* mbz */
}
if ( flag_offset == 0xFFFFFFL )
@ -1318,9 +1350,10 @@
{
FT_Error error;
unsigned char head[16], head2[16];
FT_Long rdata_pos, map_pos, rdata_len, map_len;
FT_Long rdata_pos, map_pos, rdata_len;
int allzeros, allmatch, i, cnt, subcnt;
FT_Long type_list, tag, rpos, junk;
FT_Long type_list, rpos;
FT_ULong tag;
error = FT_Stream_Seek( stream, resource_offset );
@ -1342,10 +1375,7 @@
( head[ 9] << 16 ) |
( head[10] << 8 ) |
head[11];
map_len = ( head[12] << 24 ) |
( head[13] << 16 ) |
( head[14] << 8 ) |
head[15];
/* map_len = head[12] .. head[15] */
if ( rdata_pos + rdata_len != map_pos || map_pos == resource_offset )
return FT_Err_Unknown_File_Format;
@ -1354,7 +1384,7 @@
if ( error )
goto Exit;
head2[15] = head[15] + 1; /* make it be different */
head2[15] = (FT_Byte)( head[15] + 1 ); /* make it be different */
error = FT_Stream_Read( stream, (FT_Byte*)head2, 16 );
if ( error )
@ -1375,9 +1405,9 @@
/* If we've gotten this far then it's probably a mac resource file. */
/* Now, does it contain any interesting resources? */
(void)FT_READ_LONG( junk ); /* skip handle to next resource map */
(void)FT_READ_USHORT( junk ); /* skip file resource number */
(void)FT_READ_USHORT( junk ); /* skip attributes */
/* Skip handle to next resource map, the file resource number, and */
/* attributes. */
(void)FT_STREAM_SKIP( 4 + 2 + 2 );
if ( FT_READ_USHORT( type_list ) )
goto Exit;
@ -1497,14 +1527,8 @@
if ( FT_ERROR_BASE( error ) == FT_Err_Unknown_File_Format )
error = IsMacResource( library, stream, 0, face_index, aface );
#ifdef FT_MACINTOSH
/*
I know this section is within code which is normally turned off
for the Mac. It provides an alternative approach to reading the
mac resource forks on OS/X in the event that a user does not wish
to compile ftmac.c.
*/
/* Only meaningful on sytems with hfs+ drivers (or Macs) */
if ( ( FT_ERROR_BASE( error ) == FT_Err_Unknown_File_Format ||
FT_ERROR_BASE( error ) == FT_Err_Invalid_Stream_Operation ) &&
( args->flags & FT_OPEN_PATHNAME ) )
@ -1517,8 +1541,10 @@
memory = library->memory;
FT_ALLOC( newpath,
ft_strlen( args->pathname ) + ft_strlen( "/rsrc" ) + 1 );
if ( FT_ALLOC( newpath,
ft_strlen( args->pathname ) + ft_strlen( "/rsrc" ) + 1 ) )
goto Fail;
ft_strcpy( newpath, args->pathname );
ft_strcat( newpath, "/rsrc" );
@ -1533,8 +1559,7 @@
FT_FREE( newpath );
}
#endif /* FT_MACINTOSH */
Fail:
return error;
}
@ -1648,7 +1673,7 @@
FT_ERROR_BASE( error ) != FT_Err_Invalid_Stream_Operation )
goto Fail2;
#ifndef FT_MACINTOSH
#if !defined( FT_MACINTOSH ) && defined( FT_CONFIG_OPTION_MAC_FONTS )
error = load_mac_face( library, stream, face_index, aface, args );
if ( !error )
{
@ -1663,7 +1688,7 @@
if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format )
goto Fail2;
#endif /* !FT_MACINTOSH */
#endif /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */
/* no driver is able to handle this format */
error = FT_Err_Unknown_File_Format;
@ -1958,17 +1983,17 @@
{
/* Compute root ascender, descender, test height, and max_advance */
metrics->ascender = ( FT_MulFix( face->ascender,
metrics->y_scale ) + 63 ) & -64;
metrics->ascender = FT_PIX_CEIL( FT_MulFix( face->ascender,
metrics->y_scale ) );
metrics->descender = ( FT_MulFix( face->descender,
metrics->y_scale ) + 0 ) & -64;
metrics->descender = FT_PIX_FLOOR( FT_MulFix( face->descender,
metrics->y_scale ) );
metrics->height = ( FT_MulFix( face->height,
metrics->y_scale ) + 32 ) & -64;
metrics->height = FT_PIX_ROUND( FT_MulFix( face->height,
metrics->y_scale ) );
metrics->max_advance = ( FT_MulFix( face->max_advance_width,
metrics->x_scale ) + 32 ) & -64;
metrics->max_advance = FT_PIX_ROUND( FT_MulFix( face->max_advance_width,
metrics->x_scale ) );
}
@ -2014,11 +2039,11 @@
char_height = 1 * 64;
/* Compute pixel sizes in 26.6 units with rounding */
dim_x = ( ( char_width * horz_resolution + (36+32*72) ) / 72 ) & -64;
dim_y = ( ( char_height * vert_resolution + (36+32*72) ) / 72 ) & -64;
dim_x = ( char_width * horz_resolution + 36 ) / 72;
dim_y = ( char_height * vert_resolution + 36 ) / 72;
metrics->x_ppem = (FT_UShort)( dim_x >> 6 );
metrics->y_ppem = (FT_UShort)( dim_y >> 6 );
metrics->x_ppem = (FT_UShort)( ( dim_x + 32 ) >> 6 );
metrics->y_ppem = (FT_UShort)( ( dim_y + 32 ) >> 6 );
metrics->x_scale = 0x10000L;
metrics->y_scale = 0x10000L;
@ -2061,7 +2086,6 @@
metrics = &face->size->metrics;
clazz = driver->clazz;
/* default processing -- this can be overridden by the driver */
if ( pixel_width == 0 )
pixel_width = pixel_height;
@ -2073,6 +2097,12 @@
if ( pixel_height < 1 )
pixel_height = 1;
/* use `>=' to avoid potention compiler warning on 16bit platforms */
if ( pixel_width >= 0xFFFFU )
pixel_width = 0xFFFFU;
if ( pixel_height >= 0xFFFFU )
pixel_height = 0xFFFFU;
metrics->x_ppem = (FT_UShort)pixel_width;
metrics->y_ppem = (FT_UShort)pixel_height;
@ -2134,8 +2164,8 @@
if ( kern_mode != FT_KERNING_UNFITTED )
{
akerning->x = ( akerning->x + 32 ) & -64;
akerning->y = ( akerning->y + 32 ) & -64;
akerning->x = FT_PIX_ROUND( akerning->x );
akerning->y = FT_PIX_ROUND( akerning->y );
}
}
}
@ -2368,21 +2398,15 @@
if ( face && FT_HAS_GLYPH_NAMES( face ) )
{
/* now, lookup for glyph name */
FT_Driver driver = face->driver;
FT_Module_Class* clazz = FT_MODULE_CLASS( driver );
FT_Service_GlyphDict service;
if ( clazz->get_interface )
{
FT_Face_GetGlyphNameIndexFunc requester;
FT_FACE_LOOKUP_SERVICE( face,
service,
GLYPH_DICT );
requester = (FT_Face_GetGlyphNameIndexFunc)clazz->get_interface(
FT_MODULE( driver ), "name_index" );
if ( requester )
result = requester( face, glyph_name );
}
if ( service && service->name_index )
result = service->name_index( face, glyph_name );
}
return result;
@ -2408,21 +2432,15 @@
glyph_index <= (FT_UInt)face->num_glyphs &&
FT_HAS_GLYPH_NAMES( face ) )
{
/* now, lookup for glyph name */
FT_Driver driver = face->driver;
FT_Module_Class* clazz = FT_MODULE_CLASS( driver );
FT_Service_GlyphDict service;
if ( clazz->get_interface )
{
FT_Face_GetGlyphNameFunc requester;
FT_FACE_LOOKUP_SERVICE( face,
service,
GLYPH_DICT );
requester = (FT_Face_GetGlyphNameFunc)clazz->get_interface(
FT_MODULE( driver ), "glyph_name" );
if ( requester )
error = requester( face, glyph_index, buffer, buffer_max );
}
if ( service && service->get_name )
error = service->get_name( face, glyph_index, buffer, buffer_max );
}
return error;
@ -2440,25 +2458,19 @@
if ( !face )
goto Exit;
result = face->internal->postscript_name;
if ( !result )
{
/* now, look up glyph name */
FT_Driver driver = face->driver;
FT_Module_Class* clazz = FT_MODULE_CLASS( driver );
FT_Service_PsFontName service;
if ( clazz->get_interface )
{
FT_Face_GetPostscriptNameFunc requester;
FT_FACE_LOOKUP_SERVICE( face,
service,
POSTSCRIPT_FONT_NAME );
requester = (FT_Face_GetPostscriptNameFunc)clazz->get_interface(
FT_MODULE( driver ), "postscript_name" );
if ( requester )
result = requester( face );
}
if ( service && service->get_ps_font_name )
result = service->get_ps_font_name( face );
}
Exit:
return result;
}
@ -2470,21 +2482,17 @@
FT_Get_Sfnt_Table( FT_Face face,
FT_Sfnt_Tag tag )
{
void* table = 0;
FT_Get_Sfnt_Table_Func func;
FT_Driver driver;
void* table = 0;
FT_Service_SFNT_Table service;
if ( !face || !FT_IS_SFNT( face ) )
goto Exit;
if ( face && FT_IS_SFNT( face ) )
{
FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
if ( service != NULL )
table = service->get_table( face, tag );
}
driver = face->driver;
func = (FT_Get_Sfnt_Table_Func)driver->root.clazz->get_interface(
FT_MODULE( driver ), "get_sfnt" );
if ( func )
table = func( face, tag );
Exit:
return table;
}
@ -2498,20 +2506,39 @@
FT_Byte* buffer,
FT_ULong* length )
{
SFNT_Load_Table_Func func;
FT_Driver driver;
FT_Service_SFNT_Table service;
if ( !face || !FT_IS_SFNT( face ) )
return FT_Err_Invalid_Face_Handle;
driver = face->driver;
func = (SFNT_Load_Table_Func) driver->root.clazz->get_interface(
FT_MODULE( driver ), "load_sfnt" );
if ( !func )
FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
if ( service == NULL )
return FT_Err_Unimplemented_Feature;
return func( face, tag, offset, buffer, length );
return service->load_table( face, tag, offset, buffer, length );
}
FT_EXPORT_DEF( FT_ULong )
FT_Get_CMap_Language_ID( FT_CharMap charmap )
{
FT_Service_TTCMaps service;
FT_Face face;
TT_CMapInfo cmap_info;
if ( !charmap || !charmap->face )
return 0;
face = charmap->face;
FT_FACE_FIND_SERVICE( face, service, TT_CMAP );
if ( service == NULL )
return 0;
if ( service->get_cmap_info( charmap, &cmap_info ))
return 0;
return cmap_info.language;
}
@ -3061,6 +3088,50 @@
}
FT_BASE_DEF( FT_Pointer )
ft_module_get_service( FT_Module module,
const char* service_id )
{
FT_Pointer result = NULL;
if ( module )
{
FT_ASSERT( module->clazz && module->clazz->get_interface );
/* first, look for the service in the module
*/
if ( module->clazz->get_interface )
result = module->clazz->get_interface( module, service_id );
if ( result == NULL )
{
/* we didn't find it, look in all other modules then
*/
FT_Library library = module->library;
FT_Module* cur = library->modules;
FT_Module* limit = cur + library->num_modules;
for ( ; cur < limit; cur++ )
{
if ( cur[0] != module )
{
FT_ASSERT( cur[0]->clazz );
if ( cur[0]->clazz->get_interface )
{
result = cur[0]->clazz->get_interface( cur[0], service_id );
if ( result != NULL )
break;
}
}
}
}
}
return result;
}
/* documentation is in ftmodule.h */
FT_EXPORT_DEF( FT_Error )

View file

@ -4,7 +4,7 @@
/* */
/* FreeType outline management (body). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -26,6 +26,7 @@
#include <ft2build.h>
#include FT_OUTLINE_H
#include FT_INTERNAL_OBJECTS_H
#include FT_TRIGONOMETRY_H
/*************************************************************************/
@ -357,14 +358,11 @@
source->n_contours != target->n_contours )
return FT_Err_Invalid_Argument;
FT_MEM_COPY( target->points, source->points,
source->n_points * sizeof ( FT_Vector ) );
FT_ARRAY_COPY( target->points, source->points, source->n_points );
FT_MEM_COPY( target->tags, source->tags,
source->n_points * sizeof ( FT_Byte ) );
FT_ARRAY_COPY( target->tags, source->tags, source->n_points );
FT_MEM_COPY( target->contours, source->contours,
source->n_contours * sizeof ( FT_Short ) );
FT_ARRAY_COPY( target->contours, source->contours, source->n_contours );
/* copy all flags, except the `FT_OUTLINE_OWNER' one */
is_owner = target->flags & FT_OUTLINE_OWNER;
@ -655,4 +653,143 @@
}
typedef struct FT_OrientationExtremumRec_
{
FT_Int index;
FT_Long pos;
FT_Int first;
FT_Int last;
} FT_OrientationExtremumRec;
static FT_Orientation
ft_orientation_extremum_compute( FT_OrientationExtremumRec* extremum,
FT_Outline* outline )
{
FT_Vector *point, *first, *last, *prev, *next;
FT_Vector* points = outline->points;
FT_Angle angle_in, angle_out;
/* compute the previous and next points in the same contour */
point = points + extremum->index;
first = points + extremum->first;
last = points + extremum->last;
prev = point;
next = point;
do
{
prev = ( prev == first ) ? last : prev - 1;
if ( prev == point )
return FT_ORIENTATION_TRUETYPE; /* degenerate case */
} while ( prev->x != point->x || prev->y != point->y );
do
{
next = ( next == last ) ? first : next + 1;
if ( next == point )
return FT_ORIENTATION_TRUETYPE; /* shouldn't happen */
} while ( next->x != point->x || next->y != point->y );
/* now compute the orientation of the `out' vector relative */
/* to the `in' vector. */
angle_in = FT_Atan2( point->x - prev->x, point->y - prev->y );
angle_out = FT_Atan2( next->x - point->x, next->y - point->y );
return ( FT_Angle_Diff( angle_in, angle_out ) >= 0 )
? FT_ORIENTATION_TRUETYPE
: FT_ORIENTATION_POSTSCRIPT;
}
FT_EXPORT_DEF( FT_Orientation )
FT_Outline_Get_Orientation( FT_Outline* outline )
{
FT_Orientation result = FT_ORIENTATION_TRUETYPE;
if ( outline && outline->n_points > 0 )
{
FT_OrientationExtremumRec xmin, ymin, xmax, ymax;
FT_Int n;
FT_Int first, last;
FT_Vector* points = outline->points;
xmin.pos = ymin.pos = +32768L;
xmax.pos = ymax.pos = -32768L;
xmin.index = ymin.index = xmax.index = ymax.index = -1;
first = 0;
for ( n = 0; n < outline->n_contours; n++, first = last + 1 )
{
last = outline->contours[n];
/* skip single-point contours; these are degenerated cases */
if ( last > first + 1 )
{
FT_Int i;
for ( i = first; i < last; i++ )
{
FT_Pos x = points[i].x;
FT_Pos y = points[i].y;
if ( x < xmin.pos )
{
xmin.pos = x;
xmin.index = i;
xmin.first = first;
xmin.last = last;
}
if ( x > xmax.pos )
{
xmax.pos = x;
xmax.index = i;
xmax.first = first;
xmax.last = last;
}
if ( y < ymin.pos )
{
ymin.pos = y;
ymin.index = i;
ymin.first = first;
ymin.last = last;
}
if ( y > ymax.pos )
{
ymax.pos = y;
ymax.index = i;
ymax.first = first;
ymax.last = last;
}
}
}
if ( xmin.index >= 0 )
result = ft_orientation_extremum_compute( &xmin, outline );
else if ( xmax.index >= 0 )
result = ft_orientation_extremum_compute( &xmax, outline );
else if ( ymin.index >= 0 )
result = ft_orientation_extremum_compute( &ymin, outline );
else if ( ymax.index >= 0 )
result = ft_orientation_extremum_compute( &ymax, outline );
}
}
return result;
}
/* END */

View file

@ -16,34 +16,20 @@
/***************************************************************************/
#include <ft2build.h>
#include FT_INTERNAL_PFR_H
#include FT_INTERNAL_OBJECTS_H
#include FT_SERVICE_PFR_H
/* check the format */
static FT_Error
ft_pfr_check( FT_Face face,
FT_PFR_Service *aservice )
static FT_Service_PfrMetrics
ft_pfr_check( FT_Face face )
{
FT_Error error = FT_Err_Bad_Argument;
FT_Service_PfrMetrics service;
if ( face && face->driver )
{
FT_Module module = (FT_Module) face->driver;
const char* name = module->clazz->module_name;
FT_FACE_LOOKUP_SERVICE( face, service, PFR_METRICS );
if ( name[0] == 'p' &&
name[1] == 'f' &&
name[2] == 'r' &&
name[4] == 0 )
{
*aservice = (FT_PFR_Service) module->clazz->module_interface;
error = 0;
}
}
return error;
return service;
}
@ -54,12 +40,12 @@
FT_Fixed *ametrics_x_scale,
FT_Fixed *ametrics_y_scale )
{
FT_Error error;
FT_PFR_Service service;
FT_Error error = FT_Err_Ok;
FT_Service_PfrMetrics service;
error = ft_pfr_check( face, &service );
if ( !error )
service = ft_pfr_check( face );
if ( service )
{
error = service->get_metrics( face,
aoutline_resolution,
@ -67,6 +53,27 @@
ametrics_x_scale,
ametrics_y_scale );
}
else if ( face )
{
FT_Fixed x_scale, y_scale;
/* this is not a PFR font */
*aoutline_resolution = face->units_per_EM;
*ametrics_resolution = face->units_per_EM;
x_scale = y_scale = 0x10000L;
if ( face->size )
{
x_scale = face->size->metrics.x_scale;
y_scale = face->size->metrics.y_scale;
}
*ametrics_x_scale = x_scale;
*ametrics_y_scale = y_scale;
}
else
error = FT_Err_Invalid_Argument;
return error;
}
@ -77,15 +84,19 @@
FT_UInt right,
FT_Vector *avector )
{
FT_Error error;
FT_PFR_Service service;
FT_Error error;
FT_Service_PfrMetrics service;
error = ft_pfr_check( face, &service );
if ( !error )
{
service = ft_pfr_check( face );
if ( service )
error = service->get_kerning( face, left, right, avector );
}
else if ( face )
error = FT_Get_Kerning( face, left, right,
FT_KERNING_UNSCALED, avector );
else
error = FT_Err_Invalid_Argument;
return error;
}
@ -95,15 +106,19 @@
FT_UInt gindex,
FT_Pos *aadvance )
{
FT_Error error;
FT_PFR_Service service;
FT_Error error;
FT_Service_PfrMetrics service;
error = ft_pfr_check( face, &service );
if ( !error )
service = ft_pfr_check( face );
if ( service )
{
error = service->get_advance( face, gindex, aadvance );
}
else
/* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
error = FT_Err_Invalid_Argument;
return error;
}

View file

@ -4,7 +4,7 @@
/* */
/* FreeType path stroker (body). */
/* */
/* Copyright 2002, 2003 by */
/* Copyright 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -19,8 +19,31 @@
#include <ft2build.h>
#include FT_STROKER_H
#include FT_TRIGONOMETRY_H
#include FT_OUTLINE_H
#include FT_INTERNAL_MEMORY_H
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_OBJECTS_H
FT_EXPORT_DEF( FT_StrokerBorder )
FT_Outline_GetInsideBorder( FT_Outline* outline )
{
FT_Orientation o = FT_Outline_Get_Orientation( outline );
return o == FT_ORIENTATION_TRUETYPE ? FT_STROKER_BORDER_RIGHT
: FT_STROKER_BORDER_LEFT ;
}
FT_EXPORT_DEF( FT_StrokerBorder )
FT_Outline_GetOutsideBorder( FT_Outline* outline )
{
FT_Orientation o = FT_Outline_Get_Orientation( outline );
return o == FT_ORIENTATION_TRUETYPE ? FT_STROKER_BORDER_LEFT
: FT_STROKER_BORDER_RIGHT ;
}
/***************************************************************************/
@ -221,6 +244,7 @@
FT_Bool movable;
FT_Int start; /* index of current sub-path start point */
FT_Memory memory;
FT_Bool valid;
} FT_StrokeBorderRec, *FT_StrokeBorder;
@ -468,6 +492,7 @@
border->num_points = 0;
border->max_points = 0;
border->start = -1;
border->valid = 0;
}
@ -476,6 +501,7 @@
{
border->num_points = 0;
border->start = -1;
border->valid = 0;
}
@ -491,6 +517,7 @@
border->num_points = 0;
border->max_points = 0;
border->start = -1;
border->valid = 0;
}
@ -520,7 +547,7 @@
}
else if ( in_contour == 0 )
goto Fail;
if ( tags[0] & FT_STROKE_TAG_END )
{
if ( in_contour == 0 )
@ -534,6 +561,8 @@
if ( in_contour != 0 )
goto Fail;
border->valid = 1;
Exit:
*anum_points = num_points;
*anum_contours = num_contours;
@ -551,9 +580,9 @@
FT_Outline* outline )
{
/* copy point locations */
FT_MEM_COPY( outline->points + outline->n_points,
border->points,
border->num_points * sizeof ( FT_Vector ) );
FT_ARRAY_COPY( outline->points + outline->n_points,
border->points,
border->num_points );
/* copy tags */
{
@ -661,10 +690,18 @@
stroker->line_join = line_join;
stroker->miter_limit = miter_limit;
stroker->valid = 0;
FT_Stroker_Rewind( stroker );
}
ft_stroke_border_reset( &stroker->borders[0] );
ft_stroke_border_reset( &stroker->borders[1] );
FT_EXPORT_DEF( void )
FT_Stroker_Rewind( FT_Stroker stroker )
{
if ( stroker )
{
ft_stroke_border_reset( &stroker->borders[0] );
ft_stroke_border_reset( &stroker->borders[1] );
}
}
@ -1347,7 +1384,6 @@
{
FT_Error error = 0;
if ( stroker->subpath_open )
{
FT_StrokeBorder right = stroker->borders;
@ -1380,6 +1416,14 @@
FT_Angle turn;
FT_Int inside_side;
/* close the path if needed */
if ( stroker->center.x != stroker->subpath_start.x ||
stroker->center.y != stroker->subpath_start.y )
{
error = FT_Stroker_LineTo( stroker, &stroker->subpath_start );
if ( error )
goto Exit;
}
/* process the corner */
stroker->angle_out = stroker->subpath_angle;
@ -1408,14 +1452,9 @@
goto Exit;
}
/* we will first end our two subpaths */
/* then end our two subpaths */
ft_stroke_border_close( stroker->borders + 0 );
ft_stroke_border_close( stroker->borders + 1 );
/* now, add the reversed left subpath to "right" */
error = ft_stroker_add_reverse_left( stroker, 0 );
if ( error )
goto Exit;
}
Exit:
@ -1423,6 +1462,35 @@
}
FT_EXPORT_DEF( FT_Error )
FT_Stroker_GetBorderCounts( FT_Stroker stroker,
FT_StrokerBorder border,
FT_UInt *anum_points,
FT_UInt *anum_contours )
{
FT_UInt num_points = 0, num_contours = 0;
FT_Error error;
if ( !stroker || border > 1 )
{
error = FT_Err_Invalid_Argument;
goto Exit;
}
error = ft_stroke_border_get_counts( stroker->borders + border,
&num_points, &num_contours );
Exit:
if ( anum_points )
*anum_points = num_points;
if ( anum_contours )
*anum_contours = num_contours;
return error;
}
FT_EXPORT_DEF( FT_Error )
FT_Stroker_GetCounts( FT_Stroker stroker,
FT_UInt *anum_points,
@ -1446,8 +1514,6 @@
num_points = count1 + count3;
num_contours = count2 + count4;
stroker->valid = 1;
Exit:
*anum_points = num_points;
*anum_contours = num_contours;
@ -1455,15 +1521,29 @@
}
FT_EXPORT_DEF( void )
FT_Stroker_ExportBorder( FT_Stroker stroker,
FT_StrokerBorder border,
FT_Outline* outline )
{
if ( border == FT_STROKER_BORDER_LEFT ||
border == FT_STROKER_BORDER_RIGHT )
{
FT_StrokeBorder sborder = & stroker->borders[border];
if ( sborder->valid )
ft_stroke_border_export( sborder, outline );
}
}
FT_EXPORT_DEF( void )
FT_Stroker_Export( FT_Stroker stroker,
FT_Outline* outline )
{
if ( stroker->valid )
{
ft_stroke_border_export( stroker->borders + 0, outline );
ft_stroke_border_export( stroker->borders + 1, outline );
}
FT_Stroker_ExportBorder( stroker, FT_STROKER_BORDER_LEFT, outline );
FT_Stroker_ExportBorder( stroker, FT_STROKER_BORDER_RIGHT, outline );
}
@ -1494,6 +1574,8 @@
if ( !outline || !stroker )
return FT_Err_Invalid_Argument;
FT_Stroker_Rewind( stroker );
first = 0;
for ( n = 0; n < outline->n_contours; n++ )
@ -1664,4 +1746,156 @@
}
extern const FT_Glyph_Class ft_outline_glyph_class;
FT_EXPORT_DEF( FT_Error )
FT_Glyph_Stroke( FT_Glyph *pglyph,
FT_Stroker stroker,
FT_Bool destroy )
{
FT_Error error = FT_Err_Invalid_Argument;
FT_Glyph glyph = NULL;
if ( pglyph == NULL )
goto Exit;
glyph = *pglyph;
if ( glyph == NULL || glyph->clazz != &ft_outline_glyph_class )
goto Exit;
{
FT_Glyph copy;
error = FT_Glyph_Copy( glyph, &copy );
if ( error )
goto Exit;
glyph = copy;
}
{
FT_OutlineGlyph oglyph = (FT_OutlineGlyph) glyph;
FT_Outline* outline = &oglyph->outline;
FT_UInt num_points, num_contours;
error = FT_Stroker_ParseOutline( stroker, outline, 0 );
if ( error )
goto Fail;
(void)FT_Stroker_GetCounts( stroker, &num_points, &num_contours );
FT_Outline_Done( glyph->library, outline );
error = FT_Outline_New( glyph->library,
num_points, num_contours, outline );
if ( error )
goto Fail;
outline->n_points = 0;
outline->n_contours = 0;
FT_Stroker_Export( stroker, outline );
}
if ( destroy )
FT_Done_Glyph( *pglyph );
*pglyph = glyph;
goto Exit;
Fail:
FT_Done_Glyph( glyph );
glyph = NULL;
if ( !destroy )
*pglyph = NULL;
Exit:
return error;
}
FT_EXPORT_DEF( FT_Error )
FT_Glyph_StrokeBorder( FT_Glyph *pglyph,
FT_Stroker stroker,
FT_Bool inside,
FT_Bool destroy )
{
FT_Error error = FT_Err_Invalid_Argument;
FT_Glyph glyph = NULL;
if ( pglyph == NULL )
goto Exit;
glyph = *pglyph;
if ( glyph == NULL || glyph->clazz != &ft_outline_glyph_class )
goto Exit;
{
FT_Glyph copy;
error = FT_Glyph_Copy( glyph, &copy );
if ( error )
goto Exit;
glyph = copy;
}
{
FT_OutlineGlyph oglyph = (FT_OutlineGlyph) glyph;
FT_StrokerBorder border;
FT_Outline* outline = &oglyph->outline;
FT_UInt num_points, num_contours;
border = FT_Outline_GetOutsideBorder( outline );
if ( inside )
border = 1 - border;
error = FT_Stroker_ParseOutline( stroker, outline, 0 );
if ( error )
goto Fail;
(void)FT_Stroker_GetBorderCounts( stroker, border,
&num_points, &num_contours );
FT_Outline_Done( glyph->library, outline );
error = FT_Outline_New( glyph->library,
num_points,
num_contours,
outline );
if ( error )
goto Fail;
outline->n_points = 0;
outline->n_contours = 0;
FT_Stroker_ExportBorder( stroker, border, outline );
}
if ( destroy )
FT_Done_Glyph( *pglyph );
*pglyph = glyph;
goto Exit;
Fail:
FT_Done_Glyph( glyph );
glyph = NULL;
if ( !destroy )
*pglyph = NULL;
Exit:
return error;
}
/* END */

View file

@ -4,7 +4,7 @@
/* */
/* FreeType synthesizing code for emboldening and slanting (body). */
/* */
/* Copyright 2000-2001, 2002 by */
/* Copyright 2000-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -279,7 +279,8 @@
first = last + 1;
}
slot->metrics.horiAdvance = ( slot->metrics.horiAdvance + distance*4 ) & -64;
slot->metrics.horiAdvance =
( slot->metrics.horiAdvance + distance*4 ) & ~63;
}

View file

@ -17,6 +17,7 @@
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
#include FT_TRIGONOMETRY_H
@ -271,9 +272,9 @@
/* round theta */
if ( theta >= 0 )
theta = ( theta + 16 ) & -32;
theta = FT_PAD_ROUND( theta, 32 );
else
theta = - (( -theta + 16 ) & -32);
theta = - FT_PAD_ROUND( -theta, 32 );
vec->x = x;
vec->y = theta;

View file

@ -4,7 +4,7 @@
/* */
/* FreeType utility file for PS names support (body). */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -17,9 +17,9 @@
#include <ft2build.h>
#include FT_INTERNAL_TYPE1_TYPES_H
#include FT_INTERNAL_TYPE42_TYPES_H
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_SERVICE_H
#include FT_SERVICE_POSTSCRIPT_INFO_H
/* documentation is in t1tables.h */
@ -28,56 +28,39 @@
FT_Get_PS_Font_Info( FT_Face face,
PS_FontInfoRec* afont_info )
{
PS_FontInfo font_info = NULL;
FT_Error error = FT_Err_Invalid_Argument;
const char* driver_name;
FT_Error error = FT_Err_Invalid_Argument;
if ( face && face->driver && face->driver->root.clazz )
if ( face )
{
driver_name = face->driver->root.clazz->module_name;
if ( ft_strcmp( driver_name, "type1" ) == 0 )
font_info = &((T1_Face)face)->type1.font_info;
else if ( ft_strcmp( driver_name, "t1cid" ) == 0 )
font_info = &((CID_Face)face)->cid.font_info;
else if ( ft_strcmp( driver_name, "type42" ) == 0 )
font_info = &((T42_Face)face)->type1.font_info;
}
if ( font_info != NULL )
{
*afont_info = *font_info;
error = FT_Err_Ok;
FT_Service_PsInfo service = NULL;
FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
if ( service && service->ps_get_font_info )
error = service->ps_get_font_info( face, afont_info );
}
return error;
}
/* XXX: Bad hack, but I didn't want to change several drivers here. */
/* documentation is in t1tables.h */
FT_EXPORT_DEF( FT_Int )
FT_Has_PS_Glyph_Names( FT_Face face )
{
FT_Int result = 0;
const char* driver_name;
FT_Int result = 0;
FT_Service_PsInfo service = NULL;
if ( face && face->driver && face->driver->root.clazz )
if ( face )
{
/* Currently, only the type1, type42, and cff drivers provide */
/* reliable glyph names... */
FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
/* We could probably hack the TrueType driver to recognize */
/* certain cases where the glyph names are most certainly */
/* correct (e.g. using a 20 or 22 format `post' table), but */
/* this will probably happen later... */
driver_name = face->driver->root.clazz->module_name;
result = ( ft_strcmp( driver_name, "type1" ) == 0 ||
ft_strcmp( driver_name, "type42" ) == 0 ||
ft_strcmp( driver_name, "cff" ) == 0 );
if ( service && service->ps_has_glyph_names )
result = service->ps_has_glyph_names( face );
}
return result;

View file

@ -18,38 +18,30 @@
#include <ft2build.h>
#include FT_WINFONTS_H
#include FT_INTERNAL_FNT_TYPES_H
#include FT_INTERNAL_OBJECTS_H
#include FT_SERVICE_WINFNT_H
FT_EXPORT_DEF( FT_Error )
FT_Get_WinFNT_Header( FT_Face face,
FT_WinFNT_HeaderRec *header )
{
FT_Error error;
FT_Service_WinFnt service;
FT_Error error;
error = FT_Err_Invalid_Argument;
if ( face != NULL && face->driver != NULL )
if ( face != NULL )
{
FT_Module driver = (FT_Module) face->driver;
FT_FACE_LOOKUP_SERVICE( face, service, WINFNT );
if ( driver->clazz && driver->clazz->module_name &&
ft_strcmp( driver->clazz->module_name, "winfonts" ) == 0 )
if ( service != NULL )
{
FNT_Face fnt_face = (FNT_Face)face;
FNT_Font font = fnt_face->font;
if ( font )
{
FT_MEM_COPY( header, &font->header, sizeof ( *header ) );
error = FT_Err_Ok;
}
error = service->get_header( face, header );
}
}
return error;
}

View file

@ -4,7 +4,7 @@
/* */
/* FreeType utility file for X11 support (body). */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -19,59 +19,16 @@
#include <ft2build.h>
#include FT_XFREE86_H
#include FT_INTERNAL_OBJECTS_H
/* XXX: This really is a sad hack, but I didn't want to change every */
/* driver just to support this at the moment, since other important */
/* changes are coming anyway. */
typedef struct FT_FontFormatRec_
{
const char* driver_name;
const char* format_name;
} FT_FontFormatRec;
#include FT_SERVICE_XFREE86_NAME_H
FT_EXPORT_DEF( const char* )
FT_Get_X11_Font_Format( FT_Face face )
{
static const FT_FontFormatRec font_formats[] =
{
{ "type1", "Type 1" },
{ "truetype", "TrueType" },
{ "bdf", "BDF" },
{ "pcf", "PCF" },
{ "type42", "Type 42" },
{ "cidtype1", "CID Type 1" },
{ "cff", "CFF" },
{ "pfr", "PFR" },
{ "winfonts", "Windows FNT" }
};
const char* result = NULL;
if ( face && face->driver )
{
FT_Module driver = (FT_Module)face->driver;
if ( driver->clazz && driver->clazz->module_name )
{
FT_Int n;
FT_Int count = sizeof( font_formats ) / sizeof ( font_formats[0] );
result = driver->clazz->module_name;
for ( n = 0; n < count; n++ )
if ( ft_strcmp( result, font_formats[n].driver_name ) == 0 )
{
result = font_formats[n].format_name;
break;
}
}
}
if ( face )
FT_FACE_FIND_SERVICE( face, result, XF86_NAME );
return result;
}

View file

@ -31,6 +31,9 @@ THE SOFTWARE.
#include FT_INTERNAL_OBJECTS_H
#include FT_BDF_H
#include FT_SERVICE_BDF_H
#include FT_SERVICE_XFREE86_NAME_H
#include "bdf.h"
#include "bdfdrivr.h"
@ -169,6 +172,118 @@ THE SOFTWARE.
};
static FT_Error
bdf_interpret_style( BDF_Face bdf )
{
FT_Error error = BDF_Err_Ok;
FT_Face face = FT_FACE( bdf );
FT_Memory memory = face->memory;
bdf_font_t* font = bdf->bdffont;
bdf_property_t* prop;
char *istr = NULL, *bstr = NULL;
char *sstr = NULL, *astr = NULL;
int parts = 0, len = 0;
face->style_flags = 0;
prop = bdf_get_font_property( font, (char *)"SLANT" );
if ( prop && prop->format == BDF_ATOM &&
prop->value.atom &&
( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' ||
*(prop->value.atom) == 'I' || *(prop->value.atom) == 'i' ) )
{
face->style_flags |= FT_STYLE_FLAG_ITALIC;
istr = ( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' )
? (char *)"Oblique"
: (char *)"Italic";
len += ft_strlen( istr );
parts++;
}
prop = bdf_get_font_property( font, (char *)"WEIGHT_NAME" );
if ( prop && prop->format == BDF_ATOM &&
prop->value.atom &&
( *(prop->value.atom) == 'B' || *(prop->value.atom) == 'b' ) )
{
face->style_flags |= FT_STYLE_FLAG_BOLD;
bstr = (char *)"Bold";
len += ft_strlen( bstr );
parts++;
}
prop = bdf_get_font_property( font, (char *)"SETWIDTH_NAME" );
if ( prop && prop->format == BDF_ATOM &&
prop->value.atom && *(prop->value.atom) &&
!( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) )
{
sstr = (char *)(prop->value.atom);
len += ft_strlen( sstr );
parts++;
}
prop = bdf_get_font_property( font, (char *)"ADD_STYLE_NAME" );
if ( prop && prop->format == BDF_ATOM &&
prop->value.atom && *(prop->value.atom) &&
!( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) )
{
astr = (char *)(prop->value.atom);
len += ft_strlen( astr );
parts++;
}
if ( !parts || !len )
face->style_name = (char *)"Regular";
else
{
char *style, *s;
unsigned int i;
if ( FT_ALLOC( style, len + parts ) )
return error;
s = style;
if ( astr )
{
ft_strcpy( s, astr );
for ( i = 0; i < ft_strlen( astr ); i++, s++ )
if ( *s == ' ' )
*s = '-'; /* replace spaces with dashes */
*(s++) = ' ';
}
if ( bstr )
{
ft_strcpy( s, bstr );
s += ft_strlen( bstr );
*(s++) = ' ';
}
if ( istr )
{
ft_strcpy( s, istr );
s += ft_strlen( istr );
*(s++) = ' ';
}
if ( sstr )
{
ft_strcpy( s, sstr );
for ( i = 0; i < ft_strlen( sstr ); i++, s++ )
if ( *s == ' ' )
*s = '-'; /* replace spaces with dashes */
*(s++) = ' ';
}
*(--s) = '\0'; /* overwrite last ' ', terminate the string */
face->style_name = style; /* allocated string */
}
return error;
}
FT_CALLBACK_DEF( FT_Error )
BDF_Face_Done( BDF_Face face )
{
@ -249,39 +364,17 @@ THE SOFTWARE.
FT_FACE_FLAG_FAST_GLYPHS;
prop = bdf_get_font_property( font, "SPACING" );
if ( prop != NULL )
if ( prop->format == BDF_ATOM )
if ( prop->value.atom != NULL )
if ( ( *(prop->value.atom) == 'M' ) ||
( *(prop->value.atom) == 'm' ) ||
( *(prop->value.atom) == 'C' ) ||
( *(prop->value.atom) == 'c' ) )
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
if ( prop && prop->format == BDF_ATOM &&
prop->value.atom &&
( *(prop->value.atom) == 'M' || *(prop->value.atom) == 'm' ||
*(prop->value.atom) == 'C' || *(prop->value.atom) == 'c' ) )
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
/* FZ XXX: TO DO: FT_FACE_FLAGS_VERTICAL */
/* FZ XXX: I need a font to implement this */
root->style_flags = 0;
prop = bdf_get_font_property( font, "SLANT" );
if ( prop != NULL )
if ( prop->format == BDF_ATOM )
if ( prop->value.atom != NULL )
if ( ( *(prop->value.atom) == 'O' ) ||
( *(prop->value.atom) == 'o' ) ||
( *(prop->value.atom) == 'I' ) ||
( *(prop->value.atom) == 'i' ) )
root->style_flags |= FT_STYLE_FLAG_ITALIC;
prop = bdf_get_font_property( font, "WEIGHT_NAME" );
if ( prop != NULL )
if ( prop->format == BDF_ATOM )
if ( prop->value.atom != NULL )
if ( ( *(prop->value.atom) == 'B' ) ||
( *(prop->value.atom) == 'b' ) )
root->style_flags |= FT_STYLE_FLAG_BOLD;
prop = bdf_get_font_property( font, "FAMILY_NAME" );
if ( ( prop != NULL ) && ( prop->value.atom != NULL ) )
if ( prop && prop->value.atom )
{
int l = ft_strlen( prop->value.atom ) + 1;
@ -293,16 +386,8 @@ THE SOFTWARE.
else
root->family_name = 0;
root->style_name = (char *)"Regular";
if ( root->style_flags & FT_STYLE_FLAG_BOLD )
{
if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
root->style_name = (char *)"Bold Italic";
else
root->style_name = (char *)"Bold";
}
else if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
root->style_name = (char *)"Italic";
if ( ( error = bdf_interpret_style( face ) ) != 0 )
goto Exit;
root->num_glyphs = font->glyphs_size; /* unencoded included */
@ -317,26 +402,26 @@ THE SOFTWARE.
FT_MEM_ZERO( bsize, sizeof ( FT_Bitmap_Size ) );
prop = bdf_get_font_property( font, "PIXEL_SIZE" );
if ( prop != NULL )
if ( prop )
bsize->height = (FT_Short)prop->value.int32;
prop = bdf_get_font_property( font, "AVERAGE_WIDTH" );
if ( prop != NULL )
if ( prop )
bsize->width = (FT_Short)( ( prop->value.int32 + 5 ) / 10 );
prop = bdf_get_font_property( font, "POINT_SIZE" );
if ( prop != NULL )
if ( prop )
/* convert from 722.7 decipoints to 72 points per inch */
bsize->size =
(FT_Pos)( ( prop->value.int32 * 64 * 7200 + 36135L ) / 72270L );
prop = bdf_get_font_property( font, "RESOLUTION_X" );
if ( prop != NULL )
if ( prop )
bsize->x_ppem =
(FT_Pos)( ( prop->value.int32 * bsize->size + 36 ) / 72 );
prop = bdf_get_font_property( font, "RESOLUTION_Y" );
if ( prop != NULL )
if ( prop )
bsize->y_ppem =
(FT_Pos)( ( prop->value.int32 * bsize->size + 36 ) / 72 );
@ -378,12 +463,12 @@ THE SOFTWARE.
bdf_get_font_property( font, "CHARSET_REGISTRY" );
charset_encoding =
bdf_get_font_property( font, "CHARSET_ENCODING" );
if ( ( charset_registry != NULL ) && ( charset_encoding != NULL ) )
if ( charset_registry && charset_encoding )
{
if ( ( charset_registry->format == BDF_ATOM ) &&
( charset_encoding->format == BDF_ATOM ) &&
( charset_registry->value.atom != NULL ) &&
( charset_encoding->value.atom != NULL ) )
if ( charset_registry->format == BDF_ATOM &&
charset_encoding->format == BDF_ATOM &&
charset_registry->value.atom &&
charset_encoding->value.atom )
{
const char* s;
@ -649,6 +734,12 @@ THE SOFTWARE.
}
/*
*
* BDF SERVICE
*
*/
static FT_Error
bdf_get_bdf_property( BDF_Face face,
const char* prop_name,
@ -660,7 +751,7 @@ THE SOFTWARE.
FT_ASSERT( face && face->bdffont );
prop = bdf_get_font_property( face->bdffont, prop_name );
if ( prop != NULL )
if ( prop )
{
switch ( prop->format )
{
@ -689,6 +780,38 @@ THE SOFTWARE.
return BDF_Err_Invalid_Argument;
}
static FT_Error
bdf_get_charset_id( BDF_Face face,
const char* *acharset_encoding,
const char* *acharset_registry )
{
*acharset_encoding = face->charset_encoding;
*acharset_registry = face->charset_registry;
return 0;
}
static const FT_Service_BDFRec bdf_service_bdf =
{
(FT_BDF_GetCharsetIdFunc)bdf_get_charset_id,
(FT_BDF_GetPropertyFunc) bdf_get_bdf_property
};
/*
*
* SERVICES LIST
*
*/
static const FT_ServiceDescRec bdf_services[] =
{
{ FT_SERVICE_ID_BDF, &bdf_service_bdf },
{ FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_BDF },
{ NULL, NULL }
};
static FT_Module_Interface
bdf_driver_requester( FT_Module module,
@ -696,13 +819,11 @@ THE SOFTWARE.
{
FT_UNUSED( module );
if ( name && ft_strcmp( name, "get_bdf_property" ) == 0 )
return (FT_Module_Interface)bdf_get_bdf_property;
return NULL;
return ft_service_list_lookup( bdf_services, name );
}
FT_CALLBACK_TABLE_DEF
const FT_Driver_ClassRec bdf_driver_class =
{

View file

@ -2,7 +2,7 @@
FreeType font driver for bdf fonts
Copyright (C) 2001, 2002 by
Copyright (C) 2001, 2002, 2003 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy

View file

@ -163,7 +163,7 @@
{ (char *)"_MULE_RELATIVE_COMPOSE", BDF_INTEGER, 1, { 0 } },
};
static unsigned long
static const unsigned long
_num_bdf_properties = sizeof ( _bdf_properties ) /
sizeof ( _bdf_properties[0] );
@ -391,7 +391,7 @@
/* An empty string for empty fields. */
static char empty[1] = { 0 }; /* XXX eliminate this */
static const char empty[1] = { 0 }; /* XXX eliminate this */
/* Assume the line is NULL-terminated and that the `list' parameter */
@ -468,7 +468,7 @@
}
/* Assign the field appropriately. */
list->field[list->used++] = ( ep > sp ) ? sp : empty;
list->field[list->used++] = ( ep > sp ) ? sp : (char*)empty;
sp = ep;
@ -511,7 +511,7 @@
}
if ( final_empty )
list->field[list->used++] = empty;
list->field[list->used++] = (char*)empty;
if ( list->used == list->size )
{

View file

@ -1,4 +1,4 @@
# FreeType 2 src/cache Jamfile (c) 2001 David Turner
# FreeType 2 src/cache Jamfile (c) 2001, 2003, 2004 David Turner
#
SubDir FT2_TOP $(FT2_SRC_DIR) cache ;
@ -14,7 +14,15 @@ HDRMACRO [ FT2_SubDir include ftcache.h ] ;
if $(FT2_MULTI)
{
_sources = ftlru ftcmanag ftccache ftcglyph ftcsbits ftcimage ftccmap ;
_sources = ftcmru
ftcmanag
ftccache
ftcglyph
ftcsbits
ftcimage
ftcbasic
ftccmap
;
}
else
{

View file

@ -3,7 +3,7 @@
#
# Copyright 2001, 2002 by
# Copyright 2001, 2002, 2003, 2004 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -20,7 +20,6 @@ OBJS=ftcache.obj
all : $(OBJS)
library [--.lib]freetype.olb $(OBJS)
ftcache.obj : ftcache.c ftlru.c ftcmanag.c ftccache.c ftcglyph.c ftcimage.c \
ftcsbits.c ftccmap.c
ftcache.obj : ftcache.c
# EOF

View file

@ -4,7 +4,7 @@
/* */
/* The FreeType Caching sub-system (body only). */
/* */
/* Copyright 2000-2001 by */
/* Copyright 2000-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -19,13 +19,13 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
#include <ft2build.h>
#include "ftlru.c"
#include "ftcmru.c"
#include "ftcmanag.c"
#include "ftccache.c"
#include "ftccmap.c"
#include "ftcglyph.c"
#include "ftcimage.c"
#include "ftcsbits.c"
#include "ftccmap.c"
#include "ftcbasic.c"
/* END */

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,7 @@
/* */
/* FreeType CharMap cache (body) */
/* */
/* Copyright 2000-2001, 2002, 2003 by */
/* Copyright 2000-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -19,8 +19,7 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_CACHE_H
#include FT_CACHE_CHARMAP_H
#include FT_CACHE_MANAGER_H
#include FT_CACHE_INTERNAL_MANAGER_H
#include FT_INTERNAL_MEMORY_H
#include FT_INTERNAL_DEBUG_H
#include FT_TRUETYPE_IDS_H
@ -30,6 +29,7 @@
#undef FT_COMPONENT
#define FT_COMPONENT trace_cache
/*************************************************************************/
/* */
/* Each FTC_CMapNode contains a simple array to map a range of character */
@ -47,56 +47,44 @@
/* number of glyph indices / character code per node */
#define FTC_CMAP_INDICES_MAX 128
/* compute a query/node hash */
#define FTC_CMAP_HASH( faceid, index, charcode ) \
( FTC_FACE_ID_HASH( faceid ) + 211 * ( index ) + \
( (char_code) / FTC_CMAP_INDICES_MAX ) )
/* the charmap query */
typedef struct FTC_CMapQueryRec_
{
FTC_FaceID face_id;
FT_UInt cmap_index;
FT_UInt32 char_code;
} FTC_CMapQueryRec, *FTC_CMapQuery;
#define FTC_CMAP_QUERY( x ) ((FTC_CMapQuery)(x))
#define FTC_CMAP_QUERY_HASH( x ) \
FTC_CMAP_HASH( (x)->face_id, (x)->cmap_index, (x)->char_code )
/* the cmap cache node */
typedef struct FTC_CMapNodeRec_
{
FTC_NodeRec node;
FTC_FaceID face_id;
FT_UInt cmap_index;
FT_UInt32 first; /* first character in node */
FT_UInt16 indices[FTC_CMAP_INDICES_MAX]; /* array of glyph indices */
} FTC_CMapNodeRec, *FTC_CMapNode;
#define FTC_CMAP_NODE( x ) ( (FTC_CMapNode)( x ) )
/* compute node hash value from cmap family and "requested" glyph index */
#define FTC_CMAP_HASH( cfam, cquery ) \
( (cfam)->hash + ( (cquery)->char_code / FTC_CMAP_INDICES_MAX ) )
#define FTC_CMAP_NODE_HASH( x ) \
FTC_CMAP_HASH( (x)->face_id, (x)->cmap_index, (x)->first )
/* if (indices[n] == FTC_CMAP_UNKNOWN), we assume that the corresponding */
/* glyph indices haven't been queried through FT_Get_Glyph_Index() yet */
#define FTC_CMAP_UNKNOWN ( (FT_UInt16)-1 )
/* the charmap query */
typedef struct FTC_CMapQueryRec_
{
FTC_QueryRec query;
FTC_CMapDesc desc;
FT_UInt32 char_code;
} FTC_CMapQueryRec, *FTC_CMapQuery;
#define FTC_CMAP_QUERY( x ) ( (FTC_CMapQuery)( x ) )
/* the charmap family */
typedef struct FTC_CMapFamilyRec_
{
FTC_FamilyRec family;
FT_UInt32 hash;
FTC_CMapDescRec desc;
FT_UInt index;
} FTC_CMapFamilyRec, *FTC_CMapFamily;
#define FTC_CMAP_FAMILY( x ) ( (FTC_CMapFamily)( x ) )
#define FTC_CMAP_FAMILY_MEMORY( x ) FTC_FAMILY( x )->memory
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -106,27 +94,44 @@
/*************************************************************************/
/* no need for specific finalizer; we use "ftc_node_done" directly */
/* no need for specific finalizer; we use `ftc_node_done' directly */
FT_CALLBACK_DEF( void )
ftc_cmap_node_free( FTC_CMapNode node,
FTC_Cache cache )
{
FT_Memory memory = cache->memory;
FT_FREE( node );
}
/* initialize a new cmap node */
FT_CALLBACK_DEF( FT_Error )
ftc_cmap_node_init( FTC_CMapNode cnode,
FTC_CMapQuery cquery,
FTC_Cache cache )
ftc_cmap_node_new( FTC_CMapNode *anode,
FTC_CMapQuery query,
FTC_Cache cache )
{
FT_UInt32 first;
FT_UInt n;
FT_UNUSED( cache );
FT_Error error;
FT_Memory memory = cache->memory;
FTC_CMapNode node;
FT_UInt nn;
first = ( cquery->char_code / FTC_CMAP_INDICES_MAX ) *
FTC_CMAP_INDICES_MAX;
if ( !FT_NEW( node ) )
{
node->face_id = query->face_id;
node->cmap_index = query->cmap_index;
node->first = (query->char_code / FTC_CMAP_INDICES_MAX) *
FTC_CMAP_INDICES_MAX;
cnode->first = first;
for ( n = 0; n < FTC_CMAP_INDICES_MAX; n++ )
cnode->indices[n] = FTC_CMAP_UNKNOWN;
for ( nn = 0; nn < FTC_CMAP_INDICES_MAX; nn++ )
node->indices[nn] = FTC_CMAP_UNKNOWN;
}
return 0;
*anode = node;
return error;
}
@ -142,185 +147,27 @@
/* compare a cmap node to a given query */
FT_CALLBACK_DEF( FT_Bool )
ftc_cmap_node_compare( FTC_CMapNode cnode,
FTC_CMapQuery cquery )
ftc_cmap_node_compare( FTC_CMapNode node,
FTC_CMapQuery query )
{
FT_UInt32 offset = (FT_UInt32)( cquery->char_code - cnode->first );
return FT_BOOL( offset < FTC_CMAP_INDICES_MAX );
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** CHARMAP FAMILY *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
FT_CALLBACK_DEF( FT_Error )
ftc_cmap_family_init( FTC_CMapFamily cfam,
FTC_CMapQuery cquery,
FTC_Cache cache )
{
FTC_Manager manager = cache->manager;
FTC_CMapDesc desc = cquery->desc;
FT_UInt32 hash = 0;
FT_Error error;
FT_Face face;
/* setup charmap descriptor */
cfam->desc = *desc;
/* let's see whether the rest is correct too */
error = FTC_Manager_Lookup_Face( manager, desc->face_id, &face );
if ( !error )
if ( node->face_id == query->face_id &&
node->cmap_index == query->cmap_index )
{
FT_UInt count = face->num_charmaps;
FT_UInt idx = count;
FT_CharMap* cur = face->charmaps;
FT_UInt32 offset = (FT_UInt32)( query->char_code - node->first );
switch ( desc->type )
{
case FTC_CMAP_BY_INDEX:
idx = desc->u.index;
hash = idx * 33;
break;
case FTC_CMAP_BY_ENCODING:
if ( desc->u.encoding == FT_ENCODING_UNICODE )
{
/* Since the `interesting' table, pid/eid (3,10), is normally the
* last one, we loop backwards. This looses with type1 fonts with
* non-BMP characters (<.0001%), this wins with .ttf with non-BMP
* chars (.01% ?), and this is the same about 99.99% of the time!
*/
FT_UInt unicmap_idx = count; /* some UCS-2 map, if we found it */
cur += count - 1;
for ( idx = 0; idx < count; idx++, cur-- )
{
if ( cur[0]->encoding == FT_ENCODING_UNICODE )
{
unicmap_idx = idx; /* record we found a Unicode charmap */
/* XXX If some new encodings to represent UCS-4 are added,
* they should be added here.
*/
if ( ( cur[0]->platform_id == TT_PLATFORM_MICROSOFT &&
cur[0]->encoding_id == TT_MS_ID_UCS_4 ) ||
( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE &&
cur[0]->encoding_id == TT_APPLE_ID_UNICODE_32 ) )
/* Hurray! We found a UCS-4 charmap. We can stop the scan! */
{
idx = count - 1 - idx;
goto Found_idx_for_FTC_CMAP_BY_ENCODING;
}
}
}
/* We do not have any UCS-4 charmap. Sigh.
* Let's see if we have some other kind of Unicode charmap, though.
*/
if ( unicmap_idx < count )
idx = count - 1 - unicmap_idx;
}
else
{
for ( idx = 0; idx < count; idx++, cur++ )
if ( cur[0]->encoding == desc->u.encoding )
break;
}
Found_idx_for_FTC_CMAP_BY_ENCODING:
hash = idx * 67;
break;
case FTC_CMAP_BY_ID:
for ( idx = 0; idx < count; idx++, cur++ )
{
if ( (FT_UInt)cur[0]->platform_id == desc->u.id.platform &&
(FT_UInt)cur[0]->encoding_id == desc->u.id.encoding )
{
hash = ( ( desc->u.id.platform << 8 ) | desc->u.id.encoding ) * 7;
break;
}
}
break;
default:
;
}
if ( idx >= count )
goto Bad_Descriptor;
/* compute hash value, both in family and query */
cfam->index = idx;
cfam->hash = hash ^ FTC_FACE_ID_HASH( desc->face_id );
FTC_QUERY( cquery )->hash = FTC_CMAP_HASH( cfam, cquery );
error = ftc_family_init( FTC_FAMILY( cfam ),
FTC_QUERY( cquery ), cache );
return FT_BOOL( offset < FTC_CMAP_INDICES_MAX );
}
return error;
Bad_Descriptor:
FT_TRACE1(( "ftp_cmap_family_init: invalid charmap descriptor\n" ));
return FTC_Err_Invalid_Argument;
return 0;
}
FT_CALLBACK_DEF( FT_Bool )
ftc_cmap_family_compare( FTC_CMapFamily cfam,
FTC_CMapQuery cquery )
ftc_cmap_node_remove_faceid( FTC_CMapNode node,
FTC_FaceID face_id )
{
FT_Int result = 0;
/* first, compare face id and type */
if ( cfam->desc.face_id != cquery->desc->face_id ||
cfam->desc.type != cquery->desc->type )
goto Exit;
switch ( cfam->desc.type )
{
case FTC_CMAP_BY_INDEX:
result = ( cfam->desc.u.index == cquery->desc->u.index );
break;
case FTC_CMAP_BY_ENCODING:
result = ( cfam->desc.u.encoding == cquery->desc->u.encoding );
break;
case FTC_CMAP_BY_ID:
result = ( cfam->desc.u.id.platform == cquery->desc->u.id.platform &&
cfam->desc.u.id.encoding == cquery->desc->u.id.encoding );
break;
default:
;
}
if ( result )
{
/* when found, update the 'family' and 'hash' field of the query */
FTC_QUERY( cquery )->family = FTC_FAMILY( cfam );
FTC_QUERY( cquery )->hash = FTC_CMAP_HASH( cfam, cquery );
}
Exit:
return FT_BOOL( result );
return FT_BOOL( node->face_id == face_id );
}
@ -334,23 +181,17 @@
FT_CALLBACK_TABLE_DEF
const FTC_Cache_ClassRec ftc_cmap_cache_class =
const FTC_CacheClassRec ftc_cmap_cache_class =
{
sizeof ( FTC_CacheRec ),
(FTC_Cache_InitFunc) ftc_cache_init,
(FTC_Cache_ClearFunc)ftc_cache_clear,
(FTC_Cache_DoneFunc) ftc_cache_done,
sizeof ( FTC_CMapFamilyRec ),
(FTC_Family_InitFunc) ftc_cmap_family_init,
(FTC_Family_CompareFunc)ftc_cmap_family_compare,
(FTC_Family_DoneFunc) ftc_family_done,
sizeof ( FTC_CMapNodeRec ),
(FTC_Node_InitFunc) ftc_cmap_node_init,
(FTC_Node_NewFunc) ftc_cmap_node_new,
(FTC_Node_WeightFunc) ftc_cmap_node_weight,
(FTC_Node_CompareFunc)ftc_cmap_node_compare,
(FTC_Node_DoneFunc) ftc_node_done
(FTC_Node_CompareFunc)ftc_cmap_node_remove_faceid,
(FTC_Node_FreeFunc) ftc_cmap_node_free,
sizeof ( FTC_CacheRec ),
(FTC_Cache_InitFunc) FTC_Cache_Init,
(FTC_Cache_DoneFunc) FTC_Cache_Done,
};
@ -360,99 +201,84 @@
FTC_CMapCache_New( FTC_Manager manager,
FTC_CMapCache *acache )
{
return FTC_Manager_Register_Cache(
manager,
(FTC_Cache_Class)&ftc_cmap_cache_class,
FTC_CACHE_P( acache ) );
return FTC_Manager_RegisterCache( manager,
&ftc_cmap_cache_class,
FTC_CACHE_P( acache ) );
}
#ifdef FTC_CACHE_USE_INLINE
#define GEN_CACHE_FAMILY_COMPARE( f, q, c ) \
ftc_cmap_family_compare( (FTC_CMapFamily)(f), (FTC_CMapQuery)(q) )
#define GEN_CACHE_NODE_COMPARE( n, q, c ) \
ftc_cmap_node_compare( (FTC_CMapNode)(n), (FTC_CMapQuery)(q) )
#define GEN_CACHE_LOOKUP ftc_cmap_cache_lookup
#include "ftccache.i"
#else /* !FTC_CACHE_USE_INLINE */
#define ftc_cmap_cache_lookup ftc_cache_lookup
#endif /* !FTC_CACHE_USE_INLINE */
/* documentation is in ftccmap.h */
FT_EXPORT_DEF( FT_UInt )
FTC_CMapCache_Lookup( FTC_CMapCache cache,
FTC_CMapDesc desc,
FTC_CMapCache_Lookup( FTC_CMapCache cmap_cache,
FTC_FaceID face_id,
FT_Int cmap_index,
FT_UInt32 char_code )
{
FTC_CMapQueryRec cquery;
FTC_Cache cache = FTC_CACHE( cmap_cache );
FTC_CMapQueryRec query;
FTC_CMapNode node;
FT_Error error;
FT_UInt gindex = 0;
FT_UInt32 hash;
if ( !cache || !desc )
if ( !cache )
{
FT_ERROR(( "FTC_CMapCache_Lookup: bad arguments, returning 0!\n" ));
return 0;
}
cquery.desc = desc;
cquery.char_code = char_code;
query.face_id = face_id;
query.cmap_index = (FT_UInt)cmap_index;
query.char_code = char_code;
error = ftc_cmap_cache_lookup( FTC_CACHE( cache ),
FTC_QUERY( &cquery ),
(FTC_Node*)&node );
if ( !error )
hash = FTC_CMAP_HASH( face_id, cmap_index, char_code );
#if 1
FTC_CACHE_LOOKUP_CMP( cache, ftc_cmap_node_compare, hash, &query,
node, error );
#else
error = FTC_Cache_Lookup( cache, hash, &query, (FTC_Node*) &node );
#endif
if ( error )
goto Exit;
FT_ASSERT( (FT_UInt)( char_code - node->first ) < FTC_CMAP_INDICES_MAX );
gindex = node->indices[char_code - node->first];
if ( gindex == FTC_CMAP_UNKNOWN )
{
FT_UInt offset = (FT_UInt)( char_code - node->first );
FT_Face face;
FT_ASSERT( offset < FTC_CMAP_INDICES_MAX );
gindex = 0;
gindex = node->indices[offset];
if ( gindex == FTC_CMAP_UNKNOWN )
error = FTC_Manager_LookupFace( cache->manager, node->face_id, &face );
if ( error )
goto Exit;
if ( (FT_UInt)cmap_index < (FT_UInt)face->num_charmaps )
{
FT_Face face;
FT_CharMap old, cmap = NULL;
/* we need to use FT_Get_Char_Index */
gindex = 0;
error = FTC_Manager_Lookup_Face( FTC_CACHE(cache)->manager,
desc->face_id,
&face );
if ( !error )
{
FT_CharMap old, cmap = NULL;
FT_UInt cmap_index;
/* save old charmap, select new one */
old = face->charmap;
cmap_index = FTC_CMAP_FAMILY( FTC_QUERY( &cquery )->family )->index;
cmap = face->charmaps[cmap_index];
old = face->charmap;
cmap = face->charmaps[cmap_index];
if ( old != cmap )
FT_Set_Charmap( face, cmap );
/* perform lookup */
gindex = FT_Get_Char_Index( face, char_code );
node->indices[offset] = (FT_UInt16)gindex;
gindex = FT_Get_Char_Index( face, char_code );
/* restore old charmap */
if ( old != cmap )
FT_Set_Charmap( face, old );
}
}
node->indices[char_code - node->first] = gindex;
}
Exit:
return gindex;
}

View file

@ -4,7 +4,7 @@
/* */
/* FreeType Glyph Image (FT_Glyph) cache (body). */
/* */
/* Copyright 2000-2001 by */
/* Copyright 2000-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -20,7 +20,6 @@
#include FT_CACHE_H
#include FT_CACHE_INTERNAL_GLYPH_H
#include FT_ERRORS_H
#include FT_LIST_H
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_DEBUG_H
@ -29,45 +28,47 @@
/* create a new chunk node, setting its cache index and ref count */
FT_EXPORT_DEF( void )
ftc_glyph_node_init( FTC_GlyphNode gnode,
FT_UInt gindex,
FTC_GlyphFamily gfam )
FTC_GNode_Init( FTC_GNode gnode,
FT_UInt gindex,
FTC_Family family )
{
FT_UInt len;
FT_UInt start = FTC_GLYPH_FAMILY_START( gfam, gindex );
gnode->item_start = (FT_UShort)start;
len = gfam->item_total - start;
if ( len > gfam->item_count )
len = gfam->item_count;
gnode->item_count = (FT_UShort)len;
gfam->family.num_nodes++;
gnode->family = family;
gnode->gindex = gindex;
family->num_nodes++;
}
FT_EXPORT_DEF( void )
ftc_glyph_node_done( FTC_GlyphNode gnode,
FTC_Cache cache )
FTC_GNode_UnselectFamily( FTC_GNode gnode,
FTC_Cache cache )
{
FTC_Family family = gnode->family;
gnode->family = NULL;
if ( family && --family->num_nodes <= 0 )
FTC_MruList_Remove( &FTC_GCACHE( cache )->families,
(FTC_MruNode)family );
}
FT_EXPORT_DEF( void )
FTC_GNode_Done( FTC_GNode gnode,
FTC_Cache cache )
{
/* finalize the node */
gnode->item_count = 0;
gnode->item_start = 0;
gnode->gindex = 0;
ftc_node_done( FTC_NODE( gnode ), cache );
FTC_GNode_UnselectFamily( gnode, cache );
}
FT_EXPORT_DEF( FT_Bool )
ftc_glyph_node_compare( FTC_GlyphNode gnode,
FTC_GlyphQuery gquery )
FTC_GNode_Compare( FTC_GNode gnode,
FTC_GQuery gquery )
{
FT_UInt start = (FT_UInt)gnode->item_start;
FT_UInt count = (FT_UInt)gnode->item_count;
return FT_BOOL( (FT_UInt)( gquery->gindex - start ) < count );
return FT_BOOL( gnode->family == gquery->family &&
gnode->gindex == gquery->gindex );
}
@ -79,26 +80,34 @@
/*************************************************************************/
/*************************************************************************/
FT_EXPORT_DEF( void )
FTC_Family_Init( FTC_Family family,
FTC_Cache cache )
{
FTC_GCacheClass clazz = FTC_CACHE__GCACHE_CLASS( cache );
family->clazz = clazz->family_class;
family->num_nodes = 0;
family->cache = cache;
}
FT_EXPORT_DEF( FT_Error )
ftc_glyph_family_init( FTC_GlyphFamily gfam,
FT_UInt32 hash,
FT_UInt item_count,
FT_UInt item_total,
FTC_GlyphQuery gquery,
FTC_Cache cache )
FTC_GCache_Init( FTC_GCache cache )
{
FT_Error error;
FT_Error error;
error = ftc_family_init( FTC_FAMILY( gfam ), FTC_QUERY( gquery ), cache );
error = FTC_Cache_Init( FTC_CACHE( cache ) );
if ( !error )
{
gfam->hash = hash;
gfam->item_total = item_total;
gfam->item_count = item_count;
FTC_GLYPH_FAMILY_FOUND( gfam, gquery );
FTC_GCacheClass clazz = (FTC_GCacheClass)FTC_CACHE( cache )->org_class;
FTC_MruList_Init( &cache->families,
clazz->family_class,
0, /* no maximum here! */
cache,
FTC_CACHE( cache )->memory );
}
return error;
@ -106,9 +115,40 @@
FT_EXPORT_DEF( void )
ftc_glyph_family_done( FTC_GlyphFamily gfam )
FTC_GCache_Done( FTC_GCache cache )
{
ftc_family_done( FTC_FAMILY( gfam ) );
FTC_Cache_Done( (FTC_Cache)cache );
FTC_MruList_Done( &cache->families );
}
FT_EXPORT_DEF( FT_Error )
FTC_GCache_New( FTC_Manager manager,
FTC_GCacheClass clazz,
FTC_GCache *acache )
{
return FTC_Manager_RegisterCache( manager, (FTC_CacheClass)clazz,
(FTC_Cache*)acache );
}
FT_EXPORT_DEF( FT_Error )
FTC_GCache_Lookup( FTC_GCache cache,
FT_UInt32 hash,
FT_UInt gindex,
FTC_GQuery query,
FTC_Node *anode )
{
FT_Error error;
query->gindex = gindex;
FTC_MRULIST_LOOKUP( &cache->families, query, query->family, error );
if ( !error )
error = FTC_Cache_Lookup( FTC_CACHE( cache ), hash, query, anode );
return error;
}

Some files were not shown because too many files have changed in this diff Show more