diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fb959c0b..fa46044ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,18 +108,8 @@ # (this is compatible with the same CMake variables in zlib's CMake # support). -# To minimize the number of cmake_policy() workarounds, -# CMake >= 3 is requested. -cmake_minimum_required(VERSION 3.0...3.5) - -if (NOT CMAKE_VERSION VERSION_LESS 3.3) - # Allow symbol visibility settings also on static libraries. CMake < 3.3 - # only sets the property on a shared library build. - cmake_policy(SET CMP0063 NEW) - - # Support new IN_LIST if() operator. - cmake_policy(SET CMP0057 NEW) -endif () +# CMake 3.12 provides for IMPORTED targets for common libraries like zlib, libpng and bzip2 +cmake_minimum_required(VERSION 3.12) include(CheckIncludeFile) include(CMakeDependentOption) @@ -164,7 +154,7 @@ project(freetype C) set(VERSION_MAJOR "2") set(VERSION_MINOR "13") -set(VERSION_PATCH "2") +set(VERSION_PATCH "3") # Generate LIBRARY_VERSION and LIBRARY_SOVERSION. set(LIBTOOL_REGEX "version_info='([0-9]+):([0-9]+):([0-9]+)'") @@ -524,13 +514,11 @@ set(PKGCONFIG_LIBS "-L\${libdir} -lfreetype") set(PKGCONFIG_LIBS_PRIVATE "") if (ZLIB_FOUND) - target_link_libraries(freetype PRIVATE ${ZLIB_LIBRARIES}) - target_include_directories(freetype PRIVATE ${ZLIB_INCLUDE_DIRS}) + target_link_libraries(freetype PRIVATE ZLIB::ZLIB) list(APPEND PKGCONFIG_REQUIRES_PRIVATE "zlib") endif () if (BZIP2_FOUND) - target_link_libraries(freetype PRIVATE ${BZIP2_LIBRARIES}) - target_include_directories(freetype PRIVATE ${BZIP2_INCLUDE_DIR}) # not BZIP2_INCLUDE_DIRS + target_link_libraries(freetype PRIVATE BZip2::BZip2) if (PC_BZIP2_FOUND) list(APPEND PKGCONFIG_REQUIRES_PRIVATE "bzip2") else () @@ -538,14 +526,11 @@ if (BZIP2_FOUND) endif () endif () if (PNG_FOUND) - target_link_libraries(freetype PRIVATE ${PNG_LIBRARIES}) - target_compile_definitions(freetype PRIVATE ${PNG_DEFINITIONS}) - target_include_directories(freetype PRIVATE ${PNG_INCLUDE_DIRS}) + target_link_libraries(freetype PRIVATE PNG::PNG) list(APPEND PKGCONFIG_REQUIRES_PRIVATE "libpng") endif () if (HarfBuzz_FOUND) - target_link_libraries(freetype PRIVATE ${HarfBuzz_LIBRARY}) - target_include_directories(freetype PRIVATE ${HarfBuzz_INCLUDE_DIRS}) + target_link_libraries(freetype PRIVATE HarfBuzz::HarfBuzz) list(APPEND PKGCONFIG_REQUIRES_PRIVATE "harfbuzz >= ${HARFBUZZ_MIN_VERSION}") endif () if (BROTLIDEC_FOUND) diff --git a/MSBuild.rsp b/MSBuild.rsp index 3eba50762..8401e6030 100644 --- a/MSBuild.rsp +++ b/MSBuild.rsp @@ -1,2 +1,4 @@ +# MSBuild.rsp with default command-line switches +/clp:ForceConsoleColor +/p:Configuration=Release #/p:WindowsTargetPlatformVersion=10.0.16299.0 -/p:Configuration="Release" diff --git a/README b/README index 19c934256..0f5d3e0e0 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -FreeType 2.13.2 +FreeType 2.13.3 =============== Homepage: https://www.freetype.org @@ -32,9 +32,9 @@ sites. Go to and download one of the following files. - freetype-doc-2.13.2.tar.xz - freetype-doc-2.13.2.tar.gz - ftdoc2132.zip + freetype-doc-2.13.3.tar.xz + freetype-doc-2.13.3.tar.gz + ftdoc2133.zip To view the documentation online, go to diff --git a/autogen.sh b/autogen.sh index 7285a0155..a9f9575ff 100755 --- a/autogen.sh +++ b/autogen.sh @@ -99,7 +99,7 @@ check_tool_version () if test "$field"x = x; then field=3 # default to 3 for all GNU autotools, after filtering enclosed string fi - version=`$1 --version | head -1 | sed 's/([^)]*)/()/g' | cut -d ' ' -f $field` + version=`$1 --version | sed -n '1s/([^)]*)/()/gp' | cut -d ' ' -f $field` version_check=`compare_to_minimum_version $version $4` if test "$version_check"x = 0x; then echo "ERROR: Your version of the \`$2' tool is too old." @@ -182,7 +182,7 @@ copy_submodule_files () cp $DLG_SRC_DIR/* src/dlg } -if test -e ".git"; then +if test -d ".git" -o -h ".git"; then DLG_INC_DIR=subprojects/dlg/include/dlg DLG_SRC_DIR=subprojects/dlg/src/dlg diff --git a/builds/cmake/FindHarfBuzz.cmake b/builds/cmake/FindHarfBuzz.cmake index b481fa415..0f0e33a1a 100644 --- a/builds/cmake/FindHarfBuzz.cmake +++ b/builds/cmake/FindHarfBuzz.cmake @@ -28,8 +28,8 @@ # Try to find Harfbuzz include and library directories. # # After successful discovery, this will set for inclusion where needed: -# HarfBuzz_INCLUDE_DIRS - containg the HarfBuzz headers -# HarfBuzz_LIBRARIES - containg the HarfBuzz library +# HarfBuzz_INCLUDE_DIRS - containing the HarfBuzz headers +# HarfBuzz_LIBRARIES - containing the HarfBuzz library #[=======================================================================[.rst: FindHarfBuzz diff --git a/builds/compiler/gcc-dev.mk b/builds/compiler/gcc-dev.mk index e7121bec7..cdcd899f9 100644 --- a/builds/compiler/gcc-dev.mk +++ b/builds/compiler/gcc-dev.mk @@ -76,6 +76,7 @@ ifndef CFLAGS -Wpointer-arith \ -Wwrite-strings \ -Wredundant-decls \ + -Wno-format-extra-args \ -Wno-long-long \ $(nested_externs) \ $(strict_prototypes) diff --git a/builds/toplevel.mk b/builds/toplevel.mk index 4b7b148c5..0beda9441 100644 --- a/builds/toplevel.mk +++ b/builds/toplevel.mk @@ -274,12 +274,16 @@ dist: # GNU `config' git repository), relative to the `tmp' directory used during # `make dist'. # -CONFIG_GUESS = ~/git/config/config.guess -CONFIG_SUB = ~/git/config/config.sub +# GNU_CONFIG_GIT_URL = git://git.savannah.gnu.org/config.git +GNU_CONFIG_GIT_URL = https://git.savannah.gnu.org/git/config.git +GNU_CONFIG_DESTDIR = $(TOP_DIR)/subprojects/gnu-config + +CONFIG_GUESS = $(GNU_CONFIG_DESTDIR)/config.guess +CONFIG_SUB = $(GNU_CONFIG_DESTDIR)/config.sub # We also use this repository to access the gnulib script that converts git # commit messages to a ChangeLog file. -CHANGELOG_SCRIPT = ~/git/config/gitlog-to-changelog +CHANGELOG_SCRIPT = $(GNU_CONFIG_DESTDIR)/gitlog-to-changelog # Don't say `make do-dist'. Always use `make dist' instead. @@ -295,6 +299,8 @@ do-dist: distclean refdoc sh autogen.sh rm -rf $(TOP_DIR)/builds/unix/autom4te.cache + rm -rf $(GNU_CONFIG_DESTDIR) + git clone https://git.savannah.gnu.org/git/config.git $(GNU_CONFIG_DESTDIR) cp $(CONFIG_GUESS) $(TOP_DIR)/builds/unix cp $(CONFIG_SUB) $(TOP_DIR)/builds/unix @@ -312,5 +318,6 @@ do-dist: distclean refdoc @# Remove more stuff related to git. rm -rf $(TOP_DIR)/subprojects/dlg + rm -rf $(TOP_DIR)/subprojects/gnu-config # EOF diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index b3e056d55..46d957245 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -17,7 +17,7 @@ AC_CONFIG_SRCDIR([ftconfig.h.in]) # Don't forget to update `docs/VERSIONS.TXT'! -version_info='26:1:20' +version_info='26:2:20' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) @@ -46,6 +46,7 @@ if test ${cross_compiling} = yes; then AC_CHECK_PROG(CC_BUILD, ${build}-gcc, ${build}-gcc) test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, gcc, gcc) test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, cc, cc, , , /usr/ucb/cc) + test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, clang, clang) test -z "${CC_BUILD}" && AC_MSG_ERROR([cannot find native C compiler]) AC_MSG_CHECKING([for suffix of native executables]) @@ -62,12 +63,18 @@ if test ${cross_compiling} = yes; then fi rm -f a.* b.* a_out.exe conftest.* AC_MSG_RESULT($EXEEXT_BUILD) + CFLAGS_BUILD= + LDFLAGS_BUILD= else CC_BUILD=${CC} + CFLAGS_BUILD=${CFLAGS} + LDFLAGS_BUILD=${LDFLAGS} EXEEXT_BUILD=${EXEEXT} fi AC_SUBST(CC_BUILD) +AC_SUBST(CFLAGS_BUILD) +AC_SUBST(LDFLAGS_BUILD) AC_SUBST(EXEEXT_BUILD) diff --git a/builds/unix/unix-cc.in b/builds/unix/unix-cc.in index aafad2f97..9e329d23f 100644 --- a/builds/unix/unix-cc.in +++ b/builds/unix/unix-cc.in @@ -113,7 +113,9 @@ LDFLAGS := @LDFLAGS@ CCraw_build := @CC_BUILD@ # native CC of building system E_BUILD := @EXEEXT_BUILD@ # extension for executable on building system EXPORTS_LIST := $(OBJ_DIR)/ftexport.sym -CCexe := $(CCraw_build) # used to compile `apinames' only +CCexe := $(CCraw_build) # used to compile `apinames' only, see exports.mk +CCexe_CFLAGS := @CFLAGS_BUILD@ # ditto. +CCexe_LDFLAGS := @LDFLAGS_BUILD@ # ditto. # Library linking. diff --git a/builds/vms/apinames_vms.bash b/builds/vms/apinames_vms.bash index e9b1b727b..1928d21ae 100644 --- a/builds/vms/apinames_vms.bash +++ b/builds/vms/apinames_vms.bash @@ -1,2 +1,2 @@ src/tools/apinames -wV include/freetype/*.h > freetype_vms0.opt -mv freetype_vms0.opt freetype_vms.opt +/gnu/bin/mv freetype_vms0.opt freetype_vms.opt diff --git a/builds/wince/vc2005-ce/freetype.sln b/builds/wince/vc2005-ce/freetype.sln index ff4546388..62c6a657b 100644 --- a/builds/wince/vc2005-ce/freetype.sln +++ b/builds/wince/vc2005-ce/freetype.sln @@ -146,7 +146,7 @@ Global {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I) {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Release|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I) {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Release|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I) - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Releaase|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I) + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Release|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I) {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Release|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Standard SDK (ARMV4I) {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Release|Windows Mobile 6 Standard SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I) {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.LIB Release|Windows Mobile 6 Standard SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I) diff --git a/builds/wince/vc2005-ce/index.html b/builds/wince/vc2005-ce/index.html index 8ea6cfded..2505d7762 100644 --- a/builds/wince/vc2005-ce/index.html +++ b/builds/wince/vc2005-ce/index.html @@ -21,7 +21,7 @@ the following targets:
diff --git a/builds/wince/vc2008-ce/index.html b/builds/wince/vc2008-ce/index.html index a6e74f893..80a30eb16 100644 --- a/builds/wince/vc2008-ce/index.html +++ b/builds/wince/vc2008-ce/index.html @@ -21,7 +21,7 @@ the following targets:
diff --git a/builds/windows/ftdebug.c b/builds/windows/ftdebug.c
index 2c6996763..7d52de230 100644
--- a/builds/windows/ftdebug.c
+++ b/builds/windows/ftdebug.c
@@ -64,7 +64,7 @@
* with the actual log message if set to true.
*
* 5. The flag `ft_timestamp_flag` prints time along with the actual log
- * message if set to ture.
+ * message if set to true.
*
* 6. `ft_have_newline_char` is used to differentiate between a log
* message with and without a trailing newline character.
diff --git a/builds/windows/ftsystem.c b/builds/windows/ftsystem.c
index 477cad71f..36a2975f1 100644
--- a/builds/windows/ftsystem.c
+++ b/builds/windows/ftsystem.c
@@ -296,7 +296,7 @@
/* support for really old Windows */
#if defined( _WIN32_WCE ) || defined ( _WIN32_WINDOWS ) || \
- !defined( _WIN32_WINNT ) || _WIN32_WINNT <= 0x0400
+ ( defined( _WIN32_WINNT ) && _WIN32_WINNT <= 0x0400 )
FT_LOCAL_DEF( BOOL )
GetFileSizeEx( HANDLE hFile,
diff --git a/builds/windows/vc2010/index.html b/builds/windows/vc2010/index.html
index ee9b59a2b..03149d223 100644
--- a/builds/windows/vc2010/index.html
+++ b/builds/windows/vc2010/index.html
@@ -12,7 +12,7 @@
This directory contains solution and project files for
Visual C++ 2010 or newer, named freetype.sln,
and freetype.vcxproj. It compiles the following libraries
-from the FreeType 2.13.2 sources:
+from the FreeType 2.13.3 sources:
This directory contains project files freetype.dsp for Visual C++ 6.0, and freetype.vcproj for Visual C++ 2002 through 2008, which you might need to upgrade automatically. -It compiles the following libraries from the FreeType 2.13.2 sources:
+It compiles the following libraries from the FreeType 2.13.3 sources:
diff --git a/docs/CHANGES b/docs/CHANGES
index 0f9984ba8..498caebb9 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -1,4 +1,22 @@
-CHANGES BETWEEN 2.13.2 and 2.13.3 (2024-Mmm-DD)
+CHANGES BETWEEN 2.13.3 and 2.13.4 (2025-Mmm-DD)
+
+ I. IMPORTANT CHANGES
+
+ - Bitmap-only TrueType fonts now ignore FT_LOAD_NO_BITMAP flag and
+ proceed loading bitmaps instead of giving an error. This behavior
+ is documented and implemented for other bitmap-only fonts. The
+ flag was always meant to suppress the bitmap strikes in favor of
+ outlines, not to ban them completely.
+
+
+ III. MISCELLANEOUS
+
+ - The BDF driver now loads fonts 75% faster.
+
+
+======================================================================
+
+CHANGES BETWEEN 2.13.2 and 2.13.3 (2024-Aug-11)
I. IMPORTANT CHANGES
@@ -32,8 +50,8 @@ CHANGES BETWEEN 2.13.2 and 2.13.3 (2024-Mmm-DD)
III. MISCELLANEOUS
- - The B/W rasterizer has received a major upkeep that resulted in
- large performance improvement. The rendering speed has increased
+ - The B/W rasterizer has received a major upkeep that results in
+ large performance improvements. The rendering speed has increased
and even doubled for very complex glyphs.
- If the new configuration option `TT_CONFIG_OPTION_GPOS_KERNING` is
@@ -594,7 +612,7 @@ CHANGES BETWEEN 2.9.1 and 2.10.0 (2019-Mar-15)
Set text foreground color for palette index 0xFFFF.
FT_Get_Color_Glyph_Layer
- Get color layers for a given glyph (using an interator
+ Get color layers for a given glyph (using an iterator
object).
FT_Bitmap_Blend
diff --git a/docs/VERSIONS.TXT b/docs/VERSIONS.TXT
index 62481cb7f..a84067dfe 100644
--- a/docs/VERSIONS.TXT
+++ b/docs/VERSIONS.TXT
@@ -60,6 +60,7 @@ found on _most_ systems, but not all of them:
release libtool so
-------------------------------
+ 2.13.3 26.2.20 6.20.2
2.13.2 26.1.20 6.20.1
2.13.1 26.0.20 6.20.0
2.13.0 25.0.19 6.19.0
diff --git a/docs/freetype-config.1 b/docs/freetype-config.1
index 6ef1ac8f3..f52a4e6af 100644
--- a/docs/freetype-config.1
+++ b/docs/freetype-config.1
@@ -1,4 +1,4 @@
-.TH FREETYPE-CONFIG 1 "August 2023" "FreeType 2.13.2"
+.TH FREETYPE-CONFIG 1 "August 2024" "FreeType 2.13.3"
.
.
.SH NAME
diff --git a/docs/markdown/javascripts/extra.js b/docs/markdown/javascripts/extra.js
index 00f167089..b1ce774fa 100644
--- a/docs/markdown/javascripts/extra.js
+++ b/docs/markdown/javascripts/extra.js
@@ -1,5 +1,5 @@
/*
-Internal link topbar offest adjust Javascript
+Internal link topbar offset adjust Javascript
Code provided by @makshh on GitHub
Bug report on material-mkdocs
diff --git a/docs/oldlogs/ChangeLog.210 b/docs/oldlogs/ChangeLog.210
index 3cf9ea961..135af9760 100644
--- a/docs/oldlogs/ChangeLog.210
+++ b/docs/oldlogs/ChangeLog.210
@@ -2983,7 +2983,7 @@
[raster] Tune SMART macro (#58352).
Windows seems to perform smart dropout control at 26.6 precision.
- To mimick Windows independent of increased precision, we need to tweak
+ To mimic Windows independent of increased precision, we need to tweak
the macro so that some close calls break down rather than up.
* src/raster/ftraster.c (SMART): Tweak the macro.
@@ -6484,7 +6484,7 @@
Add internal functions `FT_Trace_Disable' and `FT_Trace_Enable'.
- It sometimes makes sense to suppress tracing informations, for
+ It sometimes makes sense to suppress tracing information, for
example, if it outputs identical messages again and again.
* include/freetype/internal/ftdebug.h: Make `ft_trace_levels' a
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index b88ccc608..58fc33dfe 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -5174,7 +5174,7 @@ FT_BEGIN_HEADER
*/
#define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 13
-#define FREETYPE_PATCH 2
+#define FREETYPE_PATCH 3
/**************************************************************************
diff --git a/include/freetype/ftcolor.h b/include/freetype/ftcolor.h
index 420720ddf..002d6c133 100644
--- a/include/freetype/ftcolor.h
+++ b/include/freetype/ftcolor.h
@@ -1518,7 +1518,7 @@ FT_BEGIN_HEADER
*
* @return:
* Value~1 if a clip box is found. If no clip box is found or an error
- * occured, value~0 is returned.
+ * occurred, value~0 is returned.
*
* @note:
* To retrieve the clip box in font units, reset scale to units-per-em
@@ -1646,7 +1646,7 @@ FT_BEGIN_HEADER
*
* @return:
* Value~1 if everything is OK. Value~0 if no details can be found for
- * this paint or any other error occured.
+ * this paint or any other error occurred.
*
* @since:
* 2.13
diff --git a/include/freetype/ftdriver.h b/include/freetype/ftdriver.h
index dd31626b0..1b7f539f5 100644
--- a/include/freetype/ftdriver.h
+++ b/include/freetype/ftdriver.h
@@ -847,7 +847,7 @@ FT_BEGIN_HEADER
* FT_Property_Set( library, "sdf", "spread", &spread );
* ```
*
- * @note
+ * @note:
* FreeType has two rasterizers for generating SDF, namely:
*
* 1. `sdf` for generating SDF directly from glyph's outline, and
diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h
index 6c7085f61..33070fb12 100644
--- a/include/freetype/ftimage.h
+++ b/include/freetype/ftimage.h
@@ -21,9 +21,10 @@
* Note: A 'raster' is simply a scan-line converter, used to render
* `FT_Outline`s into `FT_Bitmap`s.
*
- * Note: This file can be used for STANDALONE_ compilation of raster (B/W)
- * and smooth (anti-aliased) renderers. Therefore, it must rely on
- * standard variable types only rather than aliases in fttypes.h.
+ * Note: This file can be used for `STANDALONE_` compilation of raster
+ * (B/W) and smooth (anti-aliased) renderers. Therefore, it must
+ * rely on standard variable types only instead of aliases in
+ * `fttypes.h`.
*
*/
@@ -266,6 +267,10 @@ FT_BEGIN_HEADER
* *logical* one. For example, if @FT_Pixel_Mode is set to
* `FT_PIXEL_MODE_LCD`, the logical width is a just a third of the
* physical one.
+ *
+ * An empty bitmap with a NULL `buffer` is valid, with `rows` and/or
+ * `pitch` also set to 0. Such bitmaps might be produced while rendering
+ * empty or degenerate outlines.
*/
typedef struct FT_Bitmap_
{
diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h
index 40634602f..71128a2df 100644
--- a/include/freetype/internal/ftcalc.h
+++ b/include/freetype/internal/ftcalc.h
@@ -415,7 +415,7 @@ FT_BEGIN_HEADER
#define FT_MSB( x ) ( 31 - _CountLeadingZeros( x ) )
-#elif defined( _M_ARM64 ) || defined( _M_ARM )
+#elif defined( _M_ARM64 ) || defined( _M_ARM ) || defined( _M_ARM64EC )
#include
#pragma intrinsic( _CountLeadingZeros )
@@ -511,8 +511,8 @@ FT_BEGIN_HEADER
* The result of 'sqrt(x)'.
*
* @note:
- * This function is slow and should be avoided. Consider `FT_Hypot` or
- * `FT_Vector_NormLen' instead.
+ * This function is slow and should be avoided. Consider @FT_Hypot or
+ * @FT_Vector_NormLen instead.
*/
FT_BASE( FT_UInt32 )
FT_SqrtFixed( FT_UInt32 x );
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index b6b35a912..136aa8106 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -626,12 +626,6 @@ FT_BEGIN_HEADER
#define FT_FACE_MEMORY( x ) FT_FACE( x )->memory
#define FT_FACE_STREAM( x ) FT_FACE( x )->stream
-#define FT_SIZE_FACE( x ) FT_SIZE( x )->face
-#define FT_SLOT_FACE( x ) FT_SLOT( x )->face
-
-#define FT_FACE_SLOT( x ) FT_FACE( x )->glyph
-#define FT_FACE_SIZE( x ) FT_FACE( x )->size
-
/**************************************************************************
*
diff --git a/include/freetype/internal/fttrace.h b/include/freetype/internal/fttrace.h
index 102100d1b..bf0b60796 100644
--- a/include/freetype/internal/fttrace.h
+++ b/include/freetype/internal/fttrace.h
@@ -19,7 +19,7 @@
/* definitions of trace levels for FreeType 2 */
/* the maximum string length (if the argument to `FT_TRACE_DEF` */
- /* gets used as a string) plus one charachter for ':' plus */
+ /* gets used as a string) plus one character for ':' plus */
/* another one for the trace level */
#define FT_MAX_TRACE_LEVEL_LENGTH (9 + 1 + 1)
diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h
index 35e4e73af..69c81f6da 100644
--- a/include/freetype/internal/sfnt.h
+++ b/include/freetype/internal/sfnt.h
@@ -612,7 +612,7 @@ FT_BEGIN_HEADER
*
* @return:
* Value~1 if a ClipBox is found. If no clip box is found or an
- * error occured, value~0 is returned.
+ * error occurred, value~0 is returned.
*/
typedef FT_Bool
( *TT_Get_Color_Glyph_ClipBox_Func )( TT_Face face,
@@ -707,7 +707,7 @@ FT_BEGIN_HEADER
*
* @return:
* Value~1 if everything is OK. Value~0 if no details can be found for
- * this paint or any other error occured.
+ * this paint or any other error occurred.
*/
typedef FT_Bool
( *TT_Get_Paint_Func )( TT_Face face,
@@ -808,7 +808,7 @@ FT_BEGIN_HEADER
* corresponding (1,0) Apple entry.
*
* @return:
- * 1 if there is either a win or apple entry (or both), 0 otheriwse.
+ * 1 if there is either a win or apple entry (or both), 0 otherwise.
*/
typedef FT_Bool
(*TT_Get_Name_ID_Func)( TT_Face face,
diff --git a/include/freetype/tttables.h b/include/freetype/tttables.h
index 111f21802..2cf0ff1bc 100644
--- a/include/freetype/tttables.h
+++ b/include/freetype/tttables.h
@@ -838,8 +838,9 @@ FT_BEGIN_HEADER
* The target charmap.
*
* @return:
- * The format of `charmap`. If `charmap` doesn't belong to an SFNT face,
- * return -1.
+ * The format of `charmap`. If `charmap` doesn't belong to an SFNT face
+ * (including the synthetic Unicode charmap sometimes created by
+ * FreeType), return -1.
*/
FT_EXPORT( FT_Long )
FT_Get_CMap_Format( FT_CharMap charmap );
diff --git a/meson.build b/meson.build
index 18d812499..cfbb5b9f5 100644
--- a/meson.build
+++ b/meson.build
@@ -54,6 +54,9 @@ freetype_includedir = join_paths(get_option('includedir'), 'freetype2')
ft2_defines = []
+freetype_aclocaldir = join_paths(get_option('datadir'), 'aclocal')
+
+
# Generate a custom `ftmodule.h` version based on the content of
# `modules.cfg`.
@@ -156,6 +159,7 @@ ft2_public_headers = files([
'include/freetype/ftincrem.h',
'include/freetype/ftlcdfil.h',
'include/freetype/ftlist.h',
+ 'include/freetype/ftlogging.h',
'include/freetype/ftlzw.h',
'include/freetype/ftmac.h',
'include/freetype/ftmm.h',
@@ -231,7 +235,7 @@ endif
# value from the environment, when this is supported. A smaller refactor
# might make these platform-specific files much smaller, and could be moved
# into `ftsystem.c` as well.
-#
+
if host_machine.system() == 'windows'
winmod = import('windows')
ft2_sources += [
@@ -251,7 +255,7 @@ common_ldflags = []
#
# OSX sets the compatibility_version (aka libtools version) differently from
# the library name.
-#
+
if host_machine.system() == 'darwin'
# maintain compatibility with autotools on macOS
common_ldflags = [
@@ -266,13 +270,13 @@ endif
process_header_command = [python_exe,
files('builds/meson/process_ftoption_h.py'),
'@INPUT@', '--output=@OUTPUT@']
+
ftoption_command = process_header_command
-
-# external GZip support
+# External GZip support.
zlib_option = get_option('zlib')
-# Backwards-compatible aliases.
+# Backward-compatible aliases.
if zlib_option == 'disabled'
zlib_option = 'none'
elif zlib_option == 'enabled'
@@ -315,10 +319,17 @@ else
assert(false, 'Invalid zlib option ' + zlib_option)
endif
-# BZip2 support
-bzip2_dep = dependency('bzip2', required: false)
+# BZip2 support.
+bzip2_dep = dependency(
+ 'bzip2',
+ required: get_option('bzip2').disabled() ? get_option('bzip2') : false,
+)
if not bzip2_dep.found()
- bzip2_dep = cc.find_library('bz2', has_headers: ['bzlib.h'], required: get_option('bzip2'))
+ bzip2_dep = cc.find_library(
+ 'bz2',
+ has_headers: ['bzlib.h'],
+ required: get_option('bzip2'),
+ )
endif
if bzip2_dep.found()
@@ -327,7 +338,7 @@ if bzip2_dep.found()
ft2_deps += [bzip2_dep]
endif
-# PNG support
+# PNG support.
libpng_dep = dependency('libpng',
required: get_option('png'),
fallback: 'libpng')
@@ -337,7 +348,7 @@ if libpng_dep.found()
ft2_deps += [libpng_dep]
endif
-# Harfbuzz support
+# Harfbuzz support.
harfbuzz_dep = dependency('harfbuzz',
version: '>= 2.0.0',
required: get_option('harfbuzz'),
@@ -348,7 +359,7 @@ if harfbuzz_dep.found()
ft2_deps += [harfbuzz_dep]
endif
-# Brotli decompression support
+# Brotli decompression support.
brotli_dep = dependency('libbrotlidec',
required: get_option('brotli'))
@@ -357,6 +368,10 @@ if brotli_dep.found()
ft2_deps += [brotli_dep]
endif
+if get_option('error_strings')
+ ftoption_command += ['--enable=FT_CONFIG_OPTION_ERROR_STRINGS']
+endif
+
# We can now generate `ftoption.h`.
ftoption_h = custom_target('ftoption.h',
input: 'include/freetype/config/ftoption.h',
@@ -368,7 +383,8 @@ ftoption_h = custom_target('ftoption.h',
ft2_sources += ftoption_h
ft2_defines += ['-DFT_CONFIG_OPTIONS_H=']
-if host_machine.system() == 'windows'
+if host_machine.system() == 'windows' and \
+ get_option('default_library') == 'shared'
ft2_defines += ['-DDLL_EXPORT=1']
endif
@@ -376,6 +392,7 @@ endif
# Generate `ftconfig.h`.
ftconfig_command = process_header_command
+
if has_unistd_h
ftconfig_command += '--enable=HAVE_UNISTD_H'
endif
@@ -409,7 +426,8 @@ ft2_lib = library('freetype',
)
-# To be used by other projects including this one through `subproject`.
+# To be used by other projects including this one via `subproject`.
+
freetype_dep = declare_dependency(
include_directories: ft2_includes,
link_with: ft2_lib,
@@ -418,9 +436,9 @@ freetype_dep = declare_dependency(
meson.override_dependency('freetype2', freetype_dep)
-# NOTE: Using both `install_dir` and `subdir` doesn't seem to work below,
-# i.e., the subdir value seems to be ignored, contrary to examples in the
-# Meson documentation.
+# NOTE: Using both `install_dir` and `subdir` doesn't seem to work
+# below, i.e., the `subdir` value seems to be ignored, contrary to
+# examples in the Meson documentation.
install_headers('include/ft2build.h',
install_dir: freetype_includedir)
install_headers(ft2_public_headers,
@@ -429,6 +447,10 @@ install_headers(ft2_config_headers,
install_dir: join_paths(freetype_includedir, 'freetype/config'))
+install_data('builds/unix/freetype2.m4',
+ install_dir: freetype_aclocaldir)
+
+
pkgconfig = import('pkgconfig')
pkgconfig.generate(ft2_lib,
@@ -444,9 +466,11 @@ if get_option('tests').enabled()
subdir('tests')
endif
+
# NOTE: Unlike the old `make refdoc` command, this generates the
# documentation under `$BUILD/docs/` since Meson doesn't support modifying
# the source root directory (which is a good thing).
+
gen_docs = custom_target('freetype2 reference documentation',
output: 'docs',
input: ft2_public_headers + ft2_config_headers,
@@ -463,10 +487,10 @@ summary({'OS': host_machine.system(),
}, section: 'Operating System')
summary({'Zlib': zlib_option,
- 'Bzip2': bzip2_dep.found() ? 'yes' : 'no',
- 'Png': libpng_dep.found() ? 'yes' : 'no',
- 'Harfbuzz': harfbuzz_dep.found() ? 'yes' : 'no',
- 'Brotli': brotli_dep.found() ? 'yes' : 'no',
- }, section: 'Used Libraries')
+ 'Bzip2': bzip2_dep.found(),
+ 'Png': libpng_dep.found(),
+ 'Harfbuzz': harfbuzz_dep.found(),
+ 'Brotli': brotli_dep.found(),
+ }, bool_yn: true, section: 'Used Libraries')
# EOF
diff --git a/meson_options.txt b/meson_options.txt
index ce035b98d..d4aeb4a8b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -52,4 +52,9 @@ option('zlib',
'disabled', 'enabled' ],
description: 'Support reading gzip-compressed font files')
+option('error_strings',
+ type: 'boolean',
+ value: false,
+ description: 'Enable support for meaningful error descriptions')
+
# EOF
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index 869b60487..d24ad821f 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -1378,7 +1378,7 @@
}
- /* Initalize hinting engine. */
+ /* Initialize hinting engine. */
FT_LOCAL_DEF( FT_Error )
af_cjk_hints_init( AF_GlyphHints hints,
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 18addbea8..60c19fb20 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -2625,7 +2625,7 @@
}
- /* Initalize hinting engine. */
+ /* Initialize hinting engine. */
static FT_Error
af_latin_hints_init( AF_GlyphHints hints,
diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c
index 8b0123b3e..726f6ca2b 100644
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -438,7 +438,7 @@
AF_Module module = (AF_Module)module_;
FT_Error error = FT_Err_Ok;
- FT_Memory memory = module->root.library->memory;
+ FT_Memory memory = module->root.memory;
#ifdef FT_DEBUG_AUTOFIT
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index 5851dae16..92de09ed8 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -897,11 +897,11 @@
#ifndef FT_INT64
- /* Algorithm by Christophe Meessen (1993) with overflow fixed and */
- /* rounding added. Any unsigned fixed 16.16 argument is acceptable. */
- /* However, this algorithm is slower than the Babylonian method with */
- /* a good initial guess. We only use it for large 32-bit values when */
- /* 64-bit computations are not desirable. */
+ /* Algorithm by Christophe Meessen (1993) with overflow fixed and */
+ /* rounding added. Any unsigned fixed 16.16 argument is acceptable. */
+ /* However, this algorithm is slower than the Babylonian method with */
+ /* a good initial guess. We only use it for large 32-bit values when */
+ /* 64-bit computations are not desirable. */
else if ( v > 0x10000U )
{
FT_UInt32 r = v >> 1;
@@ -920,8 +920,8 @@
}
r <<= 1;
b >>= 1;
- }
- while ( b > 0x10 ); /* exactly 25 cycles */
+
+ } while ( b > 0x10 ); /* exactly 25 cycles */
return ( q + 0x40 ) >> 7;
}
@@ -946,8 +946,8 @@
{
t = q;
q = ( t + (FT_UInt32)( r / t ) + 1 ) >> 1;
- }
- while ( q != t ); /* less than 6 cycles */
+
+ } while ( q != t ); /* less than 6 cycles */
return q;
}
diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c
index 11307eaac..760003985 100644
--- a/src/base/ftdebug.c
+++ b/src/base/ftdebug.c
@@ -64,7 +64,7 @@
* with the actual log message if set to true.
*
* 5. The flag `ft_timestamp_flag` prints time along with the actual log
- * message if set to ture.
+ * message if set to true.
*
* 6. `ft_have_newline_char` is used to differentiate between a log
* message with and without a trailing newline character.
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 348bb2a26..f55078c16 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1253,14 +1253,14 @@
FT_Driver driver = (FT_Driver)driver_;
- /* finalize client-specific data */
- if ( size->generic.finalizer )
- size->generic.finalizer( size );
-
/* finalize format-specific stuff */
if ( driver->clazz->done_size )
driver->clazz->done_size( size );
+ /* finalize client-specific data */
+ if ( size->generic.finalizer )
+ size->generic.finalizer( size );
+
FT_FREE( size->internal );
FT_FREE( size );
}
@@ -1322,10 +1322,6 @@
driver );
face->size = NULL;
- /* now discard client data */
- if ( face->generic.finalizer )
- face->generic.finalizer( face );
-
/* discard charmaps */
destroy_charmaps( face, memory );
@@ -1340,6 +1336,10 @@
face->stream = NULL;
+ /* now discard client data */
+ if ( face->generic.finalizer )
+ face->generic.finalizer( face );
+
/* get rid of it */
if ( face->internal )
{
diff --git a/src/base/ftstream.c b/src/base/ftstream.c
index 41fd913be..667222461 100644
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -763,10 +763,10 @@
case ft_frame_bytes: /* read a byte sequence */
case ft_frame_skip: /* skip some bytes */
{
- FT_UInt len = fields->size;
+ FT_Offset len = fields->size;
- if ( cursor + len > stream->limit )
+ if ( len > (FT_Offset)( stream->limit - cursor ) )
{
error = FT_THROW( Invalid_Stream_Operation );
goto Exit;
diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c
index 64f46ce43..40d74d6e4 100644
--- a/src/base/ftstroke.c
+++ b/src/base/ftstroke.c
@@ -1371,7 +1371,7 @@
arc[1] = *control;
arc[2] = stroker->center;
- while ( arc >= bez_stack )
+ do
{
FT_Angle angle_in, angle_out;
@@ -1524,10 +1524,12 @@
}
}
- arc -= 2;
-
stroker->angle_in = angle_out;
- }
+
+ if ( arc == bez_stack )
+ break;
+ arc -= 2;
+ } while ( 1 );
stroker->center = *to;
stroker->line_length = 0;
@@ -1577,7 +1579,7 @@
arc[2] = *control1;
arc[3] = stroker->center;
- while ( arc >= bez_stack )
+ do
{
FT_Angle angle_in, angle_mid, angle_out;
@@ -1741,10 +1743,12 @@
}
}
- arc -= 3;
-
stroker->angle_in = angle_out;
- }
+
+ if ( arc == bez_stack )
+ break;
+ arc -= 3;
+ } while ( 1 );
stroker->center = *to;
stroker->line_length = 0;
diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c
index ec05bce33..b5e361174 100644
--- a/src/base/ftsynth.c
+++ b/src/base/ftsynth.c
@@ -141,7 +141,7 @@
/*
* XXX: overflow check for 16-bit system, for compatibility
* with FT_GlyphSlot_Embolden() since FreeType 2.1.10.
- * unfortunately, this function return no informations
+ * unfortunately, this function return no information
* about the cause of error.
*/
if ( ( ystr >> 6 ) > FT_INT_MAX || ( ystr >> 6 ) < FT_INT_MIN )
diff --git a/src/base/ftver.rc b/src/base/ftver.rc
index 62490c063..3175ab7de 100644
--- a/src/base/ftver.rc
+++ b/src/base/ftver.rc
@@ -18,8 +18,8 @@
#include
-#define FT_VERSION 2,13,2,0
-#define FT_VERSION_STR "2.13.2"
+#define FT_VERSION 2,13,3,0
+#define FT_VERSION_STR "2.13.3"
VS_VERSION_INFO VERSIONINFO
FILEVERSION FT_VERSION
@@ -45,7 +45,7 @@ BEGIN
VALUE "FileVersion", FT_VERSION_STR
VALUE "ProductName", "FreeType"
VALUE "ProductVersion", FT_VERSION_STR
- VALUE "LegalCopyright", L"\x00A9 2000-2023 The FreeType Project www.freetype.org. All rights reserved."
+ VALUE "LegalCopyright", L"\x00A9 2000-2024 The FreeType Project www.freetype.org. All rights reserved."
VALUE "InternalName", "freetype"
VALUE "OriginalFilename", FT_FILENAME
END
diff --git a/src/bdf/bdf.h b/src/bdf/bdf.h
index e2cb52c10..85a9e4f2e 100644
--- a/src/bdf/bdf.h
+++ b/src/bdf/bdf.h
@@ -57,39 +57,13 @@ FT_BEGIN_HEADER
*/
-#define BDF_CORRECT_METRICS 0x01 /* Correct invalid metrics when loading. */
-#define BDF_KEEP_COMMENTS 0x02 /* Preserve the font comments. */
-#define BDF_KEEP_UNENCODED 0x04 /* Keep the unencoded glyphs. */
-#define BDF_PROPORTIONAL 0x08 /* Font has proportional spacing. */
-#define BDF_MONOWIDTH 0x10 /* Font has mono width. */
-#define BDF_CHARCELL 0x20 /* Font has charcell spacing. */
+#define BDF_CORRECT_METRICS 0x1000 /* Correct metrics when loading. */
+#define BDF_KEEP_COMMENTS 0x2000 /* Preserve the font comments. */
+#define BDF_KEEP_UNENCODED 0x4000 /* Keep the unencoded glyphs. */
-#define BDF_ALL_SPACING ( BDF_PROPORTIONAL | \
- BDF_MONOWIDTH | \
- BDF_CHARCELL )
-
-#define BDF_DEFAULT_LOAD_OPTIONS ( BDF_CORRECT_METRICS | \
- BDF_KEEP_COMMENTS | \
- BDF_KEEP_UNENCODED | \
- BDF_PROPORTIONAL )
-
-
- typedef struct bdf_options_t_
- {
- int correct_metrics;
- int keep_unencoded;
- int keep_comments;
- int font_spacing;
-
- } bdf_options_t;
-
-
- /* Callback function type for unknown configuration options. */
- typedef int
- (*bdf_options_callback_t)( bdf_options_t* opts,
- char** params,
- unsigned long nparams,
- void* client_data );
+#define BDF_PROPORTIONAL 0x08 /* Font has proportional spacing. */
+#define BDF_MONOWIDTH 0x10 /* Font has mono width. */
+#define BDF_CHARCELL 0x20 /* Font has charcell spacing. */
/**************************************************************************
@@ -167,9 +141,6 @@ FT_BEGIN_HEADER
unsigned long resolution_y; /* Font vertical resolution. */
int spacing; /* Font spacing value. */
-
- unsigned short monowidth; /* Logical width for monowidth font. */
-
unsigned long default_char; /* Encoding of the default glyph. */
long font_ascent; /* Font ascent. */
@@ -190,7 +161,7 @@ FT_BEGIN_HEADER
char* comments; /* Font comments. */
unsigned long comments_len; /* Length of comment string. */
- void* internal; /* Internal data for the font. */
+ FT_Hash internal; /* Internal data for the font. */
unsigned short bpp; /* Bits per pixel. */
@@ -233,7 +204,7 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Error )
bdf_load_font( FT_Stream stream,
FT_Memory memory,
- bdf_options_t* opts,
+ unsigned long flags,
bdf_font_t* *font );
FT_LOCAL( void )
diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c
index e02a16093..1995c36ac 100644
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -349,7 +349,6 @@ THE SOFTWARE.
FT_Memory memory = FT_FACE_MEMORY( face );
bdf_font_t* font = NULL;
- bdf_options_t options;
FT_UNUSED( num_params );
FT_UNUSED( params );
@@ -360,12 +359,8 @@ THE SOFTWARE.
if ( FT_STREAM_SEEK( 0 ) )
goto Exit;
- options.correct_metrics = 1; /* FZ XXX: options semantics */
- options.keep_unencoded = 1;
- options.keep_comments = 0;
- options.font_spacing = BDF_PROPORTIONAL;
-
- error = bdf_load_font( stream, memory, &options, &font );
+ error = bdf_load_font( stream, memory,
+ BDF_CORRECT_METRICS | BDF_KEEP_UNENCODED, &font );
if ( FT_ERR_EQ( error, Missing_Startfont_Field ) )
{
FT_TRACE2(( " not a BDF file\n" ));
@@ -408,10 +403,18 @@ THE SOFTWARE.
FT_FACE_FLAG_HORIZONTAL;
prop = bdf_get_font_property( font, "SPACING" );
- 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' ) )
+ if ( prop && prop->value.atom )
+ {
+ if ( prop->value.atom[0] == 'p' || prop->value.atom[0] == 'P' )
+ font->spacing = BDF_PROPORTIONAL;
+ else if ( prop->value.atom[0] == 'm' || prop->value.atom[0] == 'M' )
+ font->spacing = BDF_MONOWIDTH;
+ else if ( prop->value.atom[0] == 'c' || prop->value.atom[0] == 'C' )
+ font->spacing = BDF_CHARCELL;
+ }
+
+ if ( font->spacing == BDF_MONOWIDTH ||
+ font->spacing == BDF_CHARCELL )
face->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
/* FZ XXX: TO DO: FT_FACE_FLAGS_VERTICAL */
@@ -444,19 +447,25 @@ THE SOFTWARE.
long value;
- /* sanity checks */
- if ( font->font_ascent > 0x7FFF || font->font_ascent < -0x7FFF )
- {
- font->font_ascent = font->font_ascent < 0 ? -0x7FFF : 0x7FFF;
- FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %ld\n",
- font->font_ascent ));
- }
- if ( font->font_descent > 0x7FFF || font->font_descent < -0x7FFF )
- {
- font->font_descent = font->font_descent < 0 ? -0x7FFF : 0x7FFF;
- FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %ld\n",
- font->font_descent ));
- }
+ prop = bdf_get_font_property( font, "FONT_ASCENT" );
+ if ( prop )
+ font->font_ascent = prop->value.l;
+ else
+ font->font_ascent = font->bbx.ascent;
+ if ( font->font_ascent > 0x7FFF )
+ font->font_ascent = 0x7FFF;
+ else if ( font->font_ascent < 0 )
+ font->font_ascent = 0;
+
+ prop = bdf_get_font_property( font, "FONT_DESCENT" );
+ if ( prop )
+ font->font_descent = prop->value.l;
+ else
+ font->font_descent = font->bbx.descent;
+ if ( font->font_descent > 0x7FFF )
+ font->font_descent = 0x7FFF;
+ else if ( font->font_descent < 0 )
+ font->font_descent = 0;
bsize->height = (FT_Short)( font->font_ascent + font->font_descent );
@@ -591,6 +600,12 @@ THE SOFTWARE.
resolution_y );
else
bsize->x_ppem = bsize->y_ppem;
+
+ prop = bdf_get_font_property( font, "DEFAULT_CHAR" );
+ if ( prop )
+ font->default_char = prop->value.ul;
+ else
+ font->default_char = ~0UL;
}
/* encoding table */
@@ -780,8 +795,8 @@ THE SOFTWARE.
FT_UInt glyph_index,
FT_Int32 load_flags )
{
- BDF_Face bdf = (BDF_Face)FT_SIZE_FACE( size );
- FT_Face face = FT_FACE( bdf );
+ FT_Face face = size->face;
+ BDF_Face bdf = (BDF_Face)face;
FT_Error error = FT_Err_Ok;
FT_Bitmap* bitmap = &slot->bitmap;
bdf_glyph_t glyph;
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index 813a4d839..852707807 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -51,25 +51,6 @@
#define FT_COMPONENT bdflib
-#define BUFSIZE 128
-
-
- /**************************************************************************
- *
- * Default BDF font options.
- *
- */
-
-
- static const bdf_options_t bdf_opts_ =
- {
- 1, /* Correct metrics. */
- 1, /* Preserve unencoded glyphs. */
- 0, /* Preserve comments. */
- BDF_PROPORTIONAL /* Default spacing. */
- };
-
-
/**************************************************************************
*
* Builtin BDF font properties.
@@ -89,7 +70,6 @@
{ "CHARSET_COLLECTIONS", BDF_ATOM, 1, { 0 } },
{ "CHARSET_ENCODING", BDF_ATOM, 1, { 0 } },
{ "CHARSET_REGISTRY", BDF_ATOM, 1, { 0 } },
- { "COMMENT", BDF_ATOM, 1, { 0 } },
{ "COPYRIGHT", BDF_ATOM, 1, { 0 } },
{ "DEFAULT_CHAR", BDF_CARDINAL, 1, { 0 } },
{ "DESTINATION", BDF_CARDINAL, 1, { 0 } },
@@ -237,18 +217,6 @@
void* client_data );
- /* List structure for splitting lines into fields. */
-
- typedef struct bdf_list_t__
- {
- char** field;
- unsigned long size;
- unsigned long used;
- FT_Memory memory;
-
- } bdf_list_t_;
-
-
/* Structure used while loading BDF fonts. */
typedef struct bdf_parse_t__
@@ -268,10 +236,8 @@
char* glyph_name;
long glyph_enc;
+ bdf_glyph_t* glyph;
bdf_font_t* font;
- bdf_options_t* opts;
-
- bdf_list_t_ list;
FT_Memory memory;
unsigned long size; /* the stream size */
@@ -285,238 +251,23 @@
( m[(FT_Byte)(cc) >> 3] & ( 1 << ( (cc) & 7 ) ) )
- static void
- bdf_list_init_( bdf_list_t_* list,
- FT_Memory memory )
+ static char*
+ bdf_strtok_( char* line,
+ int delim )
{
- FT_ZERO( list );
- list->memory = memory;
+ while ( *line && *line != delim )
+ line++;
+
+ if ( *line )
+ *line++ = '\0';
+
+ while ( *line && *line == delim )
+ line++;
+
+ return line;
}
- static void
- bdf_list_done_( bdf_list_t_* list )
- {
- FT_Memory memory = list->memory;
-
-
- if ( memory )
- {
- FT_FREE( list->field );
- FT_ZERO( list );
- }
- }
-
-
- static FT_Error
- bdf_list_ensure_( bdf_list_t_* list,
- unsigned long num_items ) /* same as bdf_list_t_.used */
- {
- FT_Error error = FT_Err_Ok;
-
-
- if ( num_items > list->size )
- {
- unsigned long oldsize = list->size; /* same as bdf_list_t_.size */
- unsigned long newsize = oldsize + ( oldsize >> 1 ) + 5;
- unsigned long bigsize = (unsigned long)( FT_INT_MAX / sizeof ( char* ) );
- FT_Memory memory = list->memory;
-
-
- if ( oldsize == bigsize )
- {
- error = FT_THROW( Out_Of_Memory );
- goto Exit;
- }
- else if ( newsize < oldsize || newsize > bigsize )
- newsize = bigsize;
-
- if ( FT_QRENEW_ARRAY( list->field, oldsize, newsize ) )
- goto Exit;
-
- list->size = newsize;
- }
-
- Exit:
- return error;
- }
-
-
- static void
- bdf_list_shift_( bdf_list_t_* list,
- unsigned long n )
- {
- unsigned long i, u;
-
-
- if ( list == NULL || list->used == 0 || n == 0 )
- return;
-
- if ( n >= list->used )
- {
- list->used = 0;
- return;
- }
-
- for ( u = n, i = 0; u < list->used; i++, u++ )
- list->field[i] = list->field[u];
- list->used -= n;
- }
-
-
- /* An empty string for empty fields. */
-
- static const char empty[] = ""; /* XXX eliminate this */
-
-
- static char *
- bdf_list_join_( bdf_list_t_* list,
- int c,
- unsigned long *alen )
- {
- unsigned long i, j;
- char* dp;
-
-
- *alen = 0;
-
- if ( list == NULL || list->used == 0 )
- return NULL;
-
- dp = list->field[0];
- for ( i = j = 0; i < list->used; i++ )
- {
- char* fp = list->field[i];
-
-
- while ( *fp )
- dp[j++] = *fp++;
-
- if ( i + 1 < list->used )
- dp[j++] = (char)c;
- }
- if ( dp != empty )
- dp[j] = 0;
-
- *alen = j;
- return dp;
- }
-
-
- /* The code below ensures that we have at least 4 + 1 `field' */
- /* elements in `list' (which are possibly NULL) so that we */
- /* don't have to check the number of fields in most cases. */
-
- static FT_Error
- bdf_list_split_( bdf_list_t_* list,
- const char* separators,
- char* line,
- unsigned long linelen )
- {
- unsigned long final_empty;
- int mult;
- const char *sp, *end;
- char *ep;
- char seps[32];
- FT_Error error = FT_Err_Ok;
-
-
- /* Initialize the list. */
- list->used = 0;
- if ( list->size )
- {
- list->field[0] = (char*)empty;
- list->field[1] = (char*)empty;
- list->field[2] = (char*)empty;
- list->field[3] = (char*)empty;
- list->field[4] = (char*)empty;
- }
-
- /* If the line is empty, then simply return. */
- if ( linelen == 0 || line[0] == 0 )
- goto Exit;
-
- /* In the original code, if the `separators' parameter is NULL or */
- /* empty, the list is split into individual bytes. We don't need */
- /* this, so an error is signaled. */
- if ( separators == NULL || *separators == 0 )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* Prepare the separator bitmap. */
- FT_MEM_ZERO( seps, 32 );
-
- /* If the very last character of the separator string is a plus, then */
- /* set the `mult' flag to indicate that multiple separators should be */
- /* collapsed into one. */
- for ( mult = 0, sp = separators; sp && *sp; sp++ )
- {
- if ( *sp == '+' && *( sp + 1 ) == 0 )
- mult = 1;
- else
- setsbit( seps, *sp );
- }
-
- /* Break the line up into fields. */
- for ( final_empty = 0, sp = ep = line, end = sp + linelen;
- sp < end && *sp; )
- {
- /* Collect everything that is not a separator. */
- for ( ; *ep && !sbitset( seps, *ep ); ep++ )
- ;
-
- /* Resize the list if necessary. */
- if ( list->used == list->size )
- {
- error = bdf_list_ensure_( list, list->used + 1 );
- if ( error )
- goto Exit;
- }
-
- /* Assign the field appropriately. */
- list->field[list->used++] = ( ep > sp ) ? (char*)sp : (char*)empty;
-
- sp = ep;
-
- if ( mult )
- {
- /* If multiple separators should be collapsed, do it now by */
- /* setting all the separator characters to 0. */
- for ( ; *ep && sbitset( seps, *ep ); ep++ )
- *ep = 0;
- }
- else if ( *ep != 0 )
- /* Don't collapse multiple separators by making them 0, so just */
- /* make the one encountered 0. */
- *ep++ = 0;
-
- final_empty = ( ep > sp && *ep == 0 );
- sp = ep;
- }
-
- /* Finally, NULL-terminate the list. */
- if ( list->used + final_empty >= list->size )
- {
- error = bdf_list_ensure_( list, list->used + final_empty + 1 );
- if ( error )
- goto Exit;
- }
-
- if ( final_empty )
- list->field[list->used++] = (char*)empty;
-
- list->field[list->used] = NULL;
-
- Exit:
- return error;
- }
-
-
-#define NO_SKIP 256 /* this value cannot be stored in a 'char' */
-
-
static FT_Error
bdf_readstream_( FT_Stream stream,
bdf_line_func_t_ callback,
@@ -525,8 +276,7 @@
{
bdf_line_func_t_ cb;
unsigned long lineno, buf_size;
- int refill, hold, to_skip;
- ptrdiff_t bytes, start, end, cursor, avail;
+ unsigned long bytes, start, end, cursor, avail;
char* buf = NULL;
FT_Memory memory = stream->memory;
FT_Error error = FT_Err_Ok;
@@ -546,53 +296,29 @@
cb = callback;
lineno = 1;
- buf[0] = 0;
start = 0;
- avail = 0;
cursor = 0;
- refill = 1;
- to_skip = NO_SKIP;
- bytes = 0; /* make compiler happy */
- for (;;)
+ Refill:
+ bytes = FT_Stream_TryRead( stream,
+ (FT_Byte*)buf + cursor, buf_size - cursor );
+ avail = cursor + bytes;
+
+ while ( bytes )
{
- if ( refill )
- {
- bytes = (ptrdiff_t)FT_Stream_TryRead(
- stream, (FT_Byte*)buf + cursor,
- buf_size - (unsigned long)cursor );
- avail = cursor + bytes;
- cursor = 0;
- refill = 0;
- }
-
- end = start;
-
- /* should we skip an optional character like \n or \r? */
- if ( start < avail && buf[start] == to_skip )
- {
- start += 1;
- to_skip = NO_SKIP;
- continue;
- }
+ /* try to find the start of the line */
+ while ( start < avail && buf[start] < ' ' )
+ start++;
/* try to find the end of the line */
- while ( end < avail && buf[end] != '\n' && buf[end] != '\r' )
+ end = start + 1;
+ while ( end < avail && buf[end] >= ' ' )
end++;
/* if we hit the end of the buffer, try shifting its content */
/* or even resizing it */
if ( end >= avail )
{
- if ( bytes == 0 )
- {
- /* last line in file doesn't end in \r or \n; */
- /* ignore it then exit */
- if ( lineno == 1 )
- error = FT_THROW( Missing_Startfont_Field );
- break;
- }
-
if ( start == 0 )
{
/* this line is definitely too long; try resizing the input */
@@ -602,17 +328,13 @@
if ( buf_size >= 65536UL ) /* limit ourselves to 64KByte */
{
- if ( lineno == 1 )
- error = FT_THROW( Missing_Startfont_Field );
- else
- {
- FT_ERROR(( "bdf_readstream_: " ERRMSG6, lineno ));
- error = FT_THROW( Invalid_Argument );
- }
+ FT_ERROR(( "bdf_readstream_: " ERRMSG6, lineno ));
+ error = FT_THROW( Invalid_File_Format );
+
goto Exit;
}
- new_size = buf_size * 2;
+ new_size = buf_size * 4;
if ( FT_QREALLOC( buf, buf_size, new_size ) )
goto Exit;
@@ -621,44 +343,28 @@
}
else
{
- bytes = avail - start;
+ cursor = avail - start;
- FT_MEM_MOVE( buf, buf + start, bytes );
+ FT_MEM_MOVE( buf, buf + start, cursor );
- cursor = bytes;
start = 0;
}
- refill = 1;
- continue;
+ goto Refill;
}
- /* Temporarily NUL-terminate the line. */
- hold = buf[end];
+ /* NUL-terminate the line. */
buf[end] = 0;
- /* XXX: Use encoding independent value for 0x1A */
- if ( buf[start] != '#' && buf[start] != 0x1A && end > start )
+ if ( buf[start] != '#' )
{
- error = (*cb)( buf + start, (unsigned long)( end - start ), lineno,
+ error = (*cb)( buf + start, end - start, lineno,
(void*)&cb, client_data );
- /* Redo if we have encountered CHARS without properties. */
- if ( error == -1 )
- error = (*cb)( buf + start, (unsigned long)( end - start ), lineno,
- (void*)&cb, client_data );
if ( error )
break;
}
lineno += 1;
- buf[end] = (char)hold;
start = end + 1;
-
- if ( hold == '\n' )
- to_skip = '\r';
- else if ( hold == '\r' )
- to_skip = '\n';
- else
- to_skip = NO_SKIP;
}
*lno = lineno;
@@ -673,17 +379,22 @@
static const unsigned char a2i[128] =
{
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const unsigned char ddigits[32] =
@@ -710,9 +421,6 @@
unsigned long v;
- if ( s == NULL || *s == 0 )
- return 0;
-
for ( v = 0; sbitset( ddigits, *s ); s++ )
{
if ( v < ( FT_ULONG_MAX - 9 ) / 10 )
@@ -735,16 +443,14 @@
long v, neg;
- if ( s == NULL || *s == 0 )
- return 0;
-
/* Check for a minus sign. */
- neg = 0;
if ( *s == '-' )
{
s++;
- neg = 1;
+ neg = -1;
}
+ else
+ neg = 1;
for ( v = 0; sbitset( ddigits, *s ); s++ )
{
@@ -757,7 +463,7 @@
}
}
- return ( !neg ) ? v : -v;
+ return neg * v;
}
@@ -768,9 +474,6 @@
unsigned short v;
- if ( s == NULL || *s == 0 )
- return 0;
-
for ( v = 0; sbitset( ddigits, *s ); s++ )
{
if ( v < ( FT_USHORT_MAX - 9 ) / 10 )
@@ -793,16 +496,14 @@
short v, neg;
- if ( s == NULL || *s == 0 )
- return 0;
-
/* Check for a minus. */
- neg = 0;
if ( *s == '-' )
{
s++;
- neg = 1;
+ neg = -1;
}
+ else
+ neg = 1;
for ( v = 0; sbitset( ddigits, *s ); s++ )
{
@@ -815,7 +516,7 @@
}
}
- return (short)( ( !neg ) ? v : -v );
+ return neg * v;
}
@@ -926,8 +627,6 @@
#define BDF_BBX_ 0x0400U
#define BDF_BITMAP_ 0x0800U
-#define BDF_SWIDTH_ADJ_ 0x1000U
-
#define BDF_GLYPH_BITS_ ( BDF_GLYPH_ | \
BDF_ENCODING_ | \
BDF_SWIDTH_ | \
@@ -935,9 +634,6 @@
BDF_BBX_ | \
BDF_BITMAP_ )
-#define BDF_GLYPH_WIDTH_CHECK_ 0x40000000UL
-#define BDF_GLYPH_HEIGHT_CHECK_ 0x80000000UL
-
static FT_Error
bdf_add_comment_( bdf_font_t* font,
@@ -949,6 +645,13 @@
FT_Error error = FT_Err_Ok;
+ /* Skip keyword COMMENT. */
+ comment += 7;
+ len -= 7;
+
+ if ( len == 0 )
+ goto Exit;
+
if ( FT_QRENEW_ARRAY( font->comments,
font->comments_len,
font->comments_len + len + 1 ) )
@@ -966,76 +669,6 @@
}
- /* Set the spacing from the font name if it exists, or set it to the */
- /* default specified in the options. */
- static FT_Error
- bdf_set_default_spacing_( bdf_font_t* font,
- bdf_options_t* opts,
- unsigned long lineno )
- {
- size_t len;
- char name[256];
- bdf_list_t_ list;
- FT_Memory memory;
- FT_Error error = FT_Err_Ok;
-
- FT_UNUSED( lineno ); /* only used in debug mode */
-
-
- if ( font == NULL || font->name == NULL || font->name[0] == 0 )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- memory = font->memory;
-
- bdf_list_init_( &list, memory );
-
- font->spacing = opts->font_spacing;
-
- len = ft_strlen( font->name ) + 1;
- /* Limit ourselves to 256 characters in the font name. */
- if ( len >= 256 )
- {
- FT_ERROR(( "bdf_set_default_spacing_: " ERRMSG7, lineno ));
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- FT_MEM_COPY( name, font->name, len );
-
- error = bdf_list_split_( &list, "-", name, (unsigned long)len );
- if ( error )
- goto Fail;
-
- if ( list.used == 15 )
- {
- switch ( list.field[11][0] )
- {
- case 'C':
- case 'c':
- font->spacing = BDF_CHARCELL;
- break;
- case 'M':
- case 'm':
- font->spacing = BDF_MONOWIDTH;
- break;
- case 'P':
- case 'p':
- font->spacing = BDF_PROPORTIONAL;
- break;
- }
- }
-
- Fail:
- bdf_list_done_( &list );
-
- Exit:
- return error;
- }
-
-
/* Determine whether the property is an atom or not. If it is, then */
/* clean it up so the double quotes are removed if they exist. */
static int
@@ -1115,8 +748,7 @@
/* First, check whether the property already exists in the font. */
- if ( ( propid = ft_hash_str_lookup( name,
- (FT_Hash)font->internal ) ) != NULL )
+ if ( ( propid = ft_hash_str_lookup( name, font->internal ) ) != NULL )
{
/* The property already exists in the font, so simply replace */
/* the value of the property with the current value. */
@@ -1203,60 +835,21 @@
break;
}
- /* If the property happens to be a comment, then it doesn't need */
- /* to be added to the internal hash table. */
- if ( _bdf_strncmp( name, "COMMENT", 7 ) != 0 )
- {
- /* Add the property to the font property table. */
- error = ft_hash_str_insert( fp->name,
- font->props_used,
- (FT_Hash)font->internal,
- memory );
- if ( error )
- goto Exit;
- }
+ /* Add the property to the font property table. */
+ error = ft_hash_str_insert( fp->name,
+ font->props_used,
+ font->internal,
+ memory );
+ if ( error )
+ goto Exit;
font->props_used++;
- /* Some special cases need to be handled here. The DEFAULT_CHAR */
- /* property needs to be located if it exists in the property list, the */
- /* FONT_ASCENT and FONT_DESCENT need to be assigned if they are */
- /* present, and the SPACING property should override the default */
- /* spacing. */
- if ( _bdf_strncmp( name, "DEFAULT_CHAR", 12 ) == 0 )
- font->default_char = fp->value.ul;
- else if ( _bdf_strncmp( name, "FONT_ASCENT", 11 ) == 0 )
- font->font_ascent = fp->value.l;
- else if ( _bdf_strncmp( name, "FONT_DESCENT", 12 ) == 0 )
- font->font_descent = fp->value.l;
- else if ( _bdf_strncmp( name, "SPACING", 7 ) == 0 )
- {
- if ( !fp->value.atom )
- {
- FT_ERROR(( "bdf_add_property_: " ERRMSG8, lineno, "SPACING" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- if ( fp->value.atom[0] == 'p' || fp->value.atom[0] == 'P' )
- font->spacing = BDF_PROPORTIONAL;
- else if ( fp->value.atom[0] == 'm' || fp->value.atom[0] == 'M' )
- font->spacing = BDF_MONOWIDTH;
- else if ( fp->value.atom[0] == 'c' || fp->value.atom[0] == 'C' )
- font->spacing = BDF_CHARCELL;
- }
-
Exit:
return error;
}
- static const unsigned char nibble_mask[8] =
- {
- 0xFF, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE
- };
-
-
static FT_Error
bdf_parse_end_( char* line,
unsigned long linelen,
@@ -1276,7 +869,75 @@
}
- /* Actually parse the glyph info and bitmaps. */
+ /* Line function prototypes. */
+ static FT_Error
+ bdf_parse_start_( char* line,
+ unsigned long linelen,
+ unsigned long lineno,
+ void* call_data,
+ void* client_data );
+
+
+ static FT_Error
+ bdf_parse_glyphs_( char* line,
+ unsigned long linelen,
+ unsigned long lineno,
+ void* call_data,
+ void* client_data );
+
+
+ /* Aggressively parse the glyph bitmaps. */
+ static FT_Error
+ bdf_parse_bitmap_( char* line,
+ unsigned long linelen,
+ unsigned long lineno,
+ void* call_data,
+ void* client_data )
+ {
+ bdf_line_func_t_* next = (bdf_line_func_t_ *)call_data;
+ bdf_parse_t_* p = (bdf_parse_t_ *) client_data;
+ bdf_glyph_t* glyph = p->glyph;
+
+ unsigned char* bp;
+ unsigned long i, nibbles;
+ int x;
+
+ FT_UNUSED( lineno ); /* only used in debug mode */
+
+
+ nibbles = glyph->bpr << 1;
+ bp = glyph->bitmap + p->row * glyph->bpr;
+
+ if ( nibbles > linelen )
+ {
+ FT_TRACE2(( "bdf_parse_bitmap_: " ACMSG16, glyph->encoding ));
+ nibbles = linelen;
+ }
+
+ for ( i = 0; i < nibbles; i++ )
+ {
+ /* char to hex without checks */
+ x = line[i];
+ x += 9 * ( x & 0x40 ) >> 6; /* for [A-Fa-f] */
+ x &= 0x0F;
+
+ if ( i & 1 )
+ *bp++ |= x;
+ else
+ *bp = x << 4;
+ }
+
+ p->row++;
+
+ /* When done, go back to parsing glyphs */
+ if ( p->row >= (unsigned long)glyph->bbx.height )
+ *next = bdf_parse_glyphs_;
+
+ return FT_Err_Ok;
+ }
+
+
+ /* Actually parse the glyph info. */
static FT_Error
bdf_parse_glyphs_( char* line,
unsigned long linelen,
@@ -1284,85 +945,22 @@
void* call_data,
void* client_data )
{
- int c, mask_index;
- char* s;
- unsigned char* bp;
- unsigned long i, slen, nibbles;
-
- bdf_line_func_t_* next;
- bdf_parse_t_* p;
+ bdf_line_func_t_* next = (bdf_line_func_t_ *)call_data;
+ bdf_parse_t_* p = (bdf_parse_t_ *) client_data;
+ bdf_font_t* font = p->font;
bdf_glyph_t* glyph;
- bdf_font_t* font;
- FT_Memory memory;
- FT_Error error = FT_Err_Ok;
+ FT_Memory memory = font->memory;
+ FT_Error error = FT_Err_Ok;
FT_UNUSED( lineno ); /* only used in debug mode */
- next = (bdf_line_func_t_ *)call_data;
- p = (bdf_parse_t_ *) client_data;
-
- font = p->font;
- memory = font->memory;
-
/* Check for a comment. */
if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
{
- if ( p->opts->keep_comments )
- {
- linelen -= 7;
-
- s = line + 7;
- if ( *s != 0 )
- {
- s++;
- linelen--;
- }
- error = bdf_add_comment_( p->font, s, linelen );
- }
- goto Exit;
- }
-
- /* The very first thing expected is the number of glyphs. */
- if ( !( p->flags & BDF_GLYPHS_ ) )
- {
- if ( _bdf_strncmp( line, "CHARS", 5 ) != 0 )
- {
- FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "CHARS" ));
- error = FT_THROW( Missing_Chars_Field );
- goto Exit;
- }
-
- error = bdf_list_split_( &p->list, " +", line, linelen );
- if ( error )
- goto Exit;
- p->cnt = font->glyphs_size = bdf_atoul_( p->list.field[1] );
-
- /* We need at least 20 bytes per glyph. */
- if ( p->cnt > p->size / 20 )
- {
- p->cnt = font->glyphs_size = p->size / 20;
- FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG17, p->cnt ));
- }
-
- /* Make sure the number of glyphs is non-zero. */
- if ( p->cnt == 0 )
- font->glyphs_size = 64;
-
- /* Limit ourselves to 1,114,112 glyphs in the font (this is the */
- /* number of code points available in Unicode). */
- if ( p->cnt >= 0x110000UL )
- {
- FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG5, lineno, "CHARS" ));
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( FT_NEW_ARRAY( font->glyphs, font->glyphs_size ) )
- goto Exit;
-
- p->flags |= BDF_GLYPHS_;
+ if ( p->flags & BDF_KEEP_COMMENTS )
+ error = bdf_add_comment_( font, line, linelen );
goto Exit;
}
@@ -1393,6 +991,9 @@
/* Check for the ENDCHAR field. */
if ( _bdf_strncmp( line, "ENDCHAR", 7 ) == 0 )
{
+ /* Free unused glyph_name */
+ FT_FREE( p->glyph_name );
+
p->glyph_enc = 0;
p->flags &= ~BDF_GLYPH_BITS_;
@@ -1401,9 +1002,9 @@
/* Check whether a glyph is being scanned but should be */
/* ignored because it is an unencoded glyph. */
- if ( ( p->flags & BDF_GLYPH_ ) &&
- p->glyph_enc == -1 &&
- p->opts->keep_unencoded == 0 )
+ if ( p->flags & BDF_GLYPH_ &&
+ p->glyph_enc == -1 &&
+ !( p->flags & BDF_KEEP_UNENCODED ) )
goto Exit;
/* Check for the STARTCHAR field. */
@@ -1417,31 +1018,14 @@
goto Exit;
}
- /* Set the character name in the parse info first until the */
- /* encoding can be checked for an unencoded character. */
- FT_FREE( p->glyph_name );
+ line = bdf_strtok_( line, ' ' );
- error = bdf_list_split_( &p->list, " +", line, linelen );
- if ( error )
- goto Exit;
-
- bdf_list_shift_( &p->list, 1 );
-
- s = bdf_list_join_( &p->list, ' ', &slen );
-
- if ( !s )
- {
- FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG8, lineno, "STARTCHAR" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- if ( FT_DUP( p->glyph_name, s, slen + 1 ) )
+ if ( FT_STRDUP( p->glyph_name, line ) )
goto Exit;
p->flags |= BDF_GLYPH_;
- FT_TRACE4(( DBGMSG1, lineno, s ));
+ FT_TRACE4(( DBGMSG1, lineno, line ));
goto Exit;
}
@@ -1457,11 +1041,9 @@
goto Exit;
}
- error = bdf_list_split_( &p->list, " +", line, linelen );
- if ( error )
- goto Exit;
+ line = bdf_strtok_( line, ' ' );
- p->glyph_enc = bdf_atol_( p->list.field[1] );
+ p->glyph_enc = bdf_atol_( line );
/* Normalize negative encoding values. The specification only */
/* allows -1, but we can be more generous here. */
@@ -1469,8 +1051,10 @@
p->glyph_enc = -1;
/* Check for alternative encoding format. */
- if ( p->glyph_enc == -1 && p->list.used > 2 )
- p->glyph_enc = bdf_atol_( p->list.field[2] );
+ line = bdf_strtok_( line, ' ' );
+
+ if ( p->glyph_enc == -1 && *line )
+ p->glyph_enc = bdf_atol_( line );
if ( p->glyph_enc < -1 || p->glyph_enc >= 0x110000L )
p->glyph_enc = -1;
@@ -1494,47 +1078,35 @@
glyph = font->glyphs + font->glyphs_used++;
glyph->name = p->glyph_name;
glyph->encoding = (unsigned long)p->glyph_enc;
+ }
+ else if ( p->flags & BDF_KEEP_UNENCODED )
+ {
+ /* Allocate the next unencoded glyph. */
+ if ( font->unencoded_used == font->unencoded_size )
+ {
+ if ( FT_RENEW_ARRAY( font->unencoded ,
+ font->unencoded_size,
+ font->unencoded_size + 4 ) )
+ goto Exit;
- /* Reset the initial glyph info. */
- p->glyph_name = NULL;
+ font->unencoded_size += 4;
+ }
+
+ glyph = font->unencoded + font->unencoded_used;
+ glyph->name = p->glyph_name;
+ glyph->encoding = font->unencoded_used++;
}
else
{
- /* Unencoded glyph. Check whether it should */
- /* be added or not. */
- if ( p->opts->keep_unencoded )
- {
- /* Allocate the next unencoded glyph. */
- if ( font->unencoded_used == font->unencoded_size )
- {
- if ( FT_RENEW_ARRAY( font->unencoded ,
- font->unencoded_size,
- font->unencoded_size + 4 ) )
- goto Exit;
-
- font->unencoded_size += 4;
- }
-
- glyph = font->unencoded + font->unencoded_used;
- glyph->name = p->glyph_name;
- glyph->encoding = font->unencoded_used++;
-
- /* Reset the initial glyph info. */
- p->glyph_name = NULL;
- }
- else
- {
- /* Free up the glyph name if the unencoded shouldn't be */
- /* kept. */
- FT_FREE( p->glyph_name );
- }
+ /* Free up the glyph name if the unencoded shouldn't be */
+ /* kept. */
+ FT_FREE( p->glyph_name );
+ glyph = NULL;
}
- /* Clear the flags that might be added when width and height are */
- /* checked for consistency. */
- p->flags &= ~( BDF_GLYPH_WIDTH_CHECK_ | BDF_GLYPH_HEIGHT_CHECK_ );
-
- p->flags |= BDF_ENCODING_;
+ p->glyph_name = NULL;
+ p->glyph = glyph;
+ p->flags |= BDF_ENCODING_;
goto Exit;
}
@@ -1543,90 +1115,23 @@
goto Missing_Encoding;
/* Point at the glyph being constructed. */
- if ( p->glyph_enc == -1 )
- glyph = font->unencoded + ( font->unencoded_used - 1 );
- else
- glyph = font->glyphs + ( font->glyphs_used - 1 );
-
- /* Check whether a bitmap is being constructed. */
- if ( p->flags & BDF_BITMAP_ )
- {
- /* If there are more rows than are specified in the glyph metrics, */
- /* ignore the remaining lines. */
- if ( p->row >= (unsigned long)glyph->bbx.height )
- {
- if ( !( p->flags & BDF_GLYPH_HEIGHT_CHECK_ ) )
- {
- FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG13, glyph->encoding ));
- p->flags |= BDF_GLYPH_HEIGHT_CHECK_;
- }
-
- goto Exit;
- }
-
- /* Only collect the number of nibbles indicated by the glyph */
- /* metrics. If there are more columns, they are simply ignored. */
- nibbles = glyph->bpr << 1;
- bp = glyph->bitmap + p->row * glyph->bpr;
-
- for ( i = 0; i < nibbles; i++ )
- {
- c = line[i];
- if ( !sbitset( hdigits, c ) )
- break;
- *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] );
- if ( i + 1 < nibbles && ( i & 1 ) )
- *++bp = 0;
- }
-
- /* If any line has not enough columns, */
- /* indicate they have been padded with zero bits. */
- if ( i < nibbles &&
- !( p->flags & BDF_GLYPH_WIDTH_CHECK_ ) )
- {
- FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG16, glyph->encoding ));
- p->flags |= BDF_GLYPH_WIDTH_CHECK_;
- }
-
- /* Remove possible garbage at the right. */
- mask_index = ( glyph->bbx.width * p->font->bpp ) & 7;
- if ( glyph->bbx.width )
- *bp &= nibble_mask[mask_index];
-
- /* If any line has extra columns, indicate they have been removed. */
- if ( i == nibbles &&
- sbitset( hdigits, line[nibbles] ) &&
- !( p->flags & BDF_GLYPH_WIDTH_CHECK_ ) )
- {
- FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG14, glyph->encoding ));
- p->flags |= BDF_GLYPH_WIDTH_CHECK_;
- }
-
- p->row++;
- goto Exit;
- }
+ glyph = p->glyph;
/* Expect the SWIDTH (scalable width) field next. */
if ( _bdf_strncmp( line, "SWIDTH", 6 ) == 0 )
{
- error = bdf_list_split_( &p->list, " +", line, linelen );
- if ( error )
- goto Exit;
+ line = bdf_strtok_( line, ' ' );
+ glyph->swidth = bdf_atous_( line );
- glyph->swidth = bdf_atous_( p->list.field[1] );
p->flags |= BDF_SWIDTH_;
-
goto Exit;
}
/* Expect the DWIDTH (device width) field next. */
if ( _bdf_strncmp( line, "DWIDTH", 6 ) == 0 )
{
- error = bdf_list_split_( &p->list, " +", line, linelen );
- if ( error )
- goto Exit;
-
- glyph->dwidth = bdf_atous_( p->list.field[1] );
+ line = bdf_strtok_( line, ' ' );
+ glyph->dwidth = bdf_atous_( line );
if ( !( p->flags & BDF_SWIDTH_ ) )
{
@@ -1644,17 +1149,21 @@
goto Exit;
}
+ /* Do not leak the bitmap or reset its size */
+ if ( p->flags & BDF_BITMAP_ )
+ goto Exit;
+
/* Expect the BBX field next. */
if ( _bdf_strncmp( line, "BBX", 3 ) == 0 )
{
- error = bdf_list_split_( &p->list, " +", line, linelen );
- if ( error )
- goto Exit;
-
- glyph->bbx.width = bdf_atous_( p->list.field[1] );
- glyph->bbx.height = bdf_atous_( p->list.field[2] );
- glyph->bbx.x_offset = bdf_atos_( p->list.field[3] );
- glyph->bbx.y_offset = bdf_atos_( p->list.field[4] );
+ line = bdf_strtok_( line, ' ' );
+ glyph->bbx.width = bdf_atous_( line );
+ line = bdf_strtok_( line, ' ' );
+ glyph->bbx.height = bdf_atous_( line );
+ line = bdf_strtok_( line, ' ' );
+ glyph->bbx.x_offset = bdf_atos_( line );
+ line = bdf_strtok_( line, ' ' );
+ glyph->bbx.y_offset = bdf_atos_( line );
/* Generate the ascent and descent of the character. */
glyph->bbx.ascent = (short)( glyph->bbx.height + glyph->bbx.y_offset );
@@ -1681,7 +1190,7 @@
/* If the BDF_CORRECT_METRICS flag is set, then adjust the SWIDTH */
/* value if necessary. */
- if ( p->opts->correct_metrics )
+ if ( p->flags & BDF_CORRECT_METRICS )
{
/* Determine the point size of the glyph. */
unsigned short sw = (unsigned short)FT_MulDiv(
@@ -1694,7 +1203,7 @@
{
glyph->swidth = sw;
- p->flags |= BDF_SWIDTH_ADJ_;
+ FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG8 ));
}
}
@@ -1729,11 +1238,12 @@
else
glyph->bytes = (unsigned short)bitmap_size;
- if ( FT_ALLOC( glyph->bitmap, glyph->bytes ) )
+ if ( !bitmap_size || FT_ALLOC( glyph->bitmap, glyph->bytes ) )
goto Exit;
p->row = 0;
p->flags |= BDF_BITMAP_;
+ *next = bdf_parse_bitmap_;
goto Exit;
}
@@ -1763,55 +1273,31 @@
void* call_data,
void* client_data )
{
- unsigned long vlen;
- bdf_line_func_t_* next;
- bdf_parse_t_* p;
+ bdf_line_func_t_* next = (bdf_line_func_t_ *)call_data;
+ bdf_parse_t_* p = (bdf_parse_t_ *) client_data;
+ bdf_font_t* font = p->font;
+
+ FT_Error error = FT_Err_Ok;
+
char* name;
char* value;
- char nbuf[BUFSIZE];
- FT_Error error = FT_Err_Ok;
FT_UNUSED( lineno );
- next = (bdf_line_func_t_ *)call_data;
- p = (bdf_parse_t_ *) client_data;
+ /* Check for a comment. */
+ if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
+ {
+ if ( p->flags & BDF_KEEP_COMMENTS )
+ error = bdf_add_comment_( font, line, linelen );
+
+ goto Exit;
+ }
/* Check for the end of the properties. */
if ( _bdf_strncmp( line, "ENDPROPERTIES", 13 ) == 0 )
{
- /* If the FONT_ASCENT or FONT_DESCENT properties have not been */
- /* encountered yet, then make sure they are added as properties and */
- /* make sure they are set from the font bounding box info. */
- /* */
- /* This is *always* done regardless of the options, because X11 */
- /* requires these two fields to compile fonts. */
- if ( bdf_get_font_property( p->font, "FONT_ASCENT" ) == 0 )
- {
- p->font->font_ascent = p->font->bbx.ascent;
- ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.ascent );
- error = bdf_add_property_( p->font, "FONT_ASCENT",
- nbuf, lineno );
- if ( error )
- goto Exit;
-
- FT_TRACE2(( "bdf_parse_properties_: " ACMSG1, p->font->bbx.ascent ));
- }
-
- if ( bdf_get_font_property( p->font, "FONT_DESCENT" ) == 0 )
- {
- p->font->font_descent = p->font->bbx.descent;
- ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.descent );
- error = bdf_add_property_( p->font, "FONT_DESCENT",
- nbuf, lineno );
- if ( error )
- goto Exit;
-
- FT_TRACE2(( "bdf_parse_properties_: " ACMSG2, p->font->bbx.descent ));
- }
-
- p->flags &= ~BDF_PROPS_;
- *next = bdf_parse_glyphs_;
+ *next = bdf_parse_start_;
goto Exit;
}
@@ -1820,35 +1306,17 @@
if ( _bdf_strncmp( line, "_XFREE86_GLYPH_RANGES", 21 ) == 0 )
goto Exit;
- /* Handle COMMENT fields and properties in a special way to preserve */
- /* the spacing. */
- if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
+ if ( bdf_is_atom_( line, linelen, &name, &value, p->font ) )
{
- name = value = line;
- value += 7;
- if ( *value )
- *value++ = 0;
- error = bdf_add_property_( p->font, name, value, lineno );
- if ( error )
- goto Exit;
- }
- else if ( bdf_is_atom_( line, linelen, &name, &value, p->font ) )
- {
- error = bdf_add_property_( p->font, name, value, lineno );
+ error = bdf_add_property_( font, name, value, lineno );
if ( error )
goto Exit;
}
else
{
- error = bdf_list_split_( &p->list, " +", line, linelen );
- if ( error )
- goto Exit;
- name = p->list.field[0];
+ value = bdf_strtok_( line, ' ' );
- bdf_list_shift_( &p->list, 1 );
- value = bdf_list_join_( &p->list, ' ', &vlen );
-
- error = bdf_add_property_( p->font, name, value, lineno );
+ error = bdf_add_property_( font, line, value, lineno );
if ( error )
goto Exit;
}
@@ -1866,123 +1334,94 @@
void* call_data,
void* client_data )
{
- unsigned long slen;
- bdf_line_func_t_* next;
- bdf_parse_t_* p;
+ bdf_line_func_t_* next = (bdf_line_func_t_ *)call_data;
+ bdf_parse_t_* p = (bdf_parse_t_ *) client_data;
bdf_font_t* font;
- char *s;
- FT_Memory memory = NULL;
+ FT_Memory memory = p->memory;
FT_Error error = FT_Err_Ok;
FT_UNUSED( lineno ); /* only used in debug mode */
- next = (bdf_line_func_t_ *)call_data;
- p = (bdf_parse_t_ *) client_data;
-
- if ( p->font )
- memory = p->font->memory;
-
- /* Check for a comment. This is done to handle those fonts that have */
- /* comments before the STARTFONT line for some reason. */
- if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
- {
- if ( p->opts->keep_comments && p->font )
- {
- linelen -= 7;
-
- s = line + 7;
- if ( *s != 0 )
- {
- s++;
- linelen--;
- }
- error = bdf_add_comment_( p->font, s, linelen );
- }
- goto Exit;
- }
-
+ /* The first line must be STARTFONT. */
+ /* Otherwise, reject the font immediately. */
if ( !( p->flags & BDF_START_ ) )
{
- memory = p->memory;
-
if ( _bdf_strncmp( line, "STARTFONT", 9 ) != 0 )
{
- /* we don't emit an error message since this code gets */
- /* explicitly caught one level higher */
error = FT_THROW( Missing_Startfont_Field );
goto Exit;
}
- p->flags = BDF_START_;
- font = p->font = NULL;
+ p->flags |= BDF_START_;
- if ( FT_NEW( font ) )
+ if ( FT_NEW( p->font ) )
goto Exit;
- p->font = font;
- font->memory = p->memory;
+ p->font->memory = memory;
{ /* setup */
+ bdf_property_t* prop = (bdf_property_t*)bdf_properties_;
+ FT_Hash proptbl = &p->font->proptbl;
size_t i;
- bdf_property_t* prop;
- error = ft_hash_str_init( &(font->proptbl), memory );
+ error = ft_hash_str_init( proptbl, memory );
if ( error )
goto Exit;
- for ( i = 0, prop = (bdf_property_t*)bdf_properties_;
- i < num_bdf_properties_; i++, prop++ )
+ for ( i = 0; i < num_bdf_properties_; i++, prop++ )
{
- error = ft_hash_str_insert( prop->name, i,
- &(font->proptbl), memory );
+ error = ft_hash_str_insert( prop->name, i, proptbl, memory );
if ( error )
goto Exit;
}
}
- if ( FT_QALLOC( p->font->internal, sizeof ( FT_HashRec ) ) )
+ if ( FT_QNEW( p->font->internal ) )
goto Exit;
- error = ft_hash_str_init( (FT_Hash)p->font->internal, memory );
+ error = ft_hash_str_init( p->font->internal, memory );
if ( error )
goto Exit;
- p->font->spacing = p->opts->font_spacing;
- p->font->default_char = ~0UL;
+
+ goto Exit;
+ }
+
+ /* Point at the font being constructed. */
+ font = p->font;
+
+ /* Check for a comment. */
+ if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
+ {
+ if ( p->flags & BDF_KEEP_COMMENTS )
+ error = bdf_add_comment_( font, line, linelen );
goto Exit;
}
/* Check for the start of the properties. */
- if ( _bdf_strncmp( line, "STARTPROPERTIES", 15 ) == 0 )
+ if ( !( p->flags & BDF_PROPS_ ) &&
+ _bdf_strncmp( line, "STARTPROPERTIES", 15 ) == 0 )
{
- if ( !( p->flags & BDF_FONT_BBX_ ) )
- {
- /* Missing the FONTBOUNDINGBOX field. */
- FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "FONTBOUNDINGBOX" ));
- error = FT_THROW( Missing_Fontboundingbox_Field );
- goto Exit;
- }
+ line = bdf_strtok_( line, ' ' );
+ font->props_size = bdf_atoul_( line );
- error = bdf_list_split_( &p->list, " +", line, linelen );
- if ( error )
- goto Exit;
+ if ( font->props_size < 2 )
+ font->props_size = 2;
- /* at this point, `p->font' can't be NULL */
- p->cnt = p->font->props_size = bdf_atoul_( p->list.field[1] );
/* We need at least 4 bytes per property. */
- if ( p->cnt > p->size / 4 )
+ if ( font->props_size > p->size / 4 )
{
- p->font->props_size = 0;
+ font->props_size = 0;
- FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG5, lineno, "STARTPROPERTIES" ));
+ FT_ERROR(( "bdf_parse_start_: " ERRMSG5, lineno, "STARTPROPERTIES" ));
error = FT_THROW( Invalid_Argument );
goto Exit;
}
- if ( FT_NEW_ARRAY( p->font->props, p->cnt ) )
+ if ( FT_NEW_ARRAY( font->props, font->props_size ) )
{
- p->font->props_size = 0;
+ font->props_size = 0;
goto Exit;
}
@@ -1995,28 +1434,19 @@
/* Check for the FONTBOUNDINGBOX field. */
if ( _bdf_strncmp( line, "FONTBOUNDINGBOX", 15 ) == 0 )
{
- if ( !( p->flags & BDF_SIZE_ ) )
- {
- /* Missing the SIZE field. */
- FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "SIZE" ));
- error = FT_THROW( Missing_Size_Field );
- goto Exit;
- }
+ line = bdf_strtok_( line, ' ' );
+ font->bbx.width = bdf_atous_( line );
+ line = bdf_strtok_( line, ' ' );
+ font->bbx.height = bdf_atous_( line );
+ line = bdf_strtok_( line, ' ' );
+ font->bbx.x_offset = bdf_atos_( line );
+ line = bdf_strtok_( line, ' ' );
+ font->bbx.y_offset = bdf_atos_( line );
- error = bdf_list_split_( &p->list, " +", line, linelen );
- if ( error )
- goto Exit;
+ font->bbx.ascent = (short)( font->bbx.height +
+ font->bbx.y_offset );
- p->font->bbx.width = bdf_atous_( p->list.field[1] );
- p->font->bbx.height = bdf_atous_( p->list.field[2] );
-
- p->font->bbx.x_offset = bdf_atos_( p->list.field[3] );
- p->font->bbx.y_offset = bdf_atos_( p->list.field[4] );
-
- p->font->bbx.ascent = (short)( p->font->bbx.height +
- p->font->bbx.y_offset );
-
- p->font->bbx.descent = (short)( -p->font->bbx.y_offset );
+ font->bbx.descent = (short)( -font->bbx.y_offset );
p->flags |= BDF_FONT_BBX_;
@@ -2026,31 +1456,43 @@
/* The next thing to check for is the FONT field. */
if ( _bdf_strncmp( line, "FONT", 4 ) == 0 )
{
- error = bdf_list_split_( &p->list, " +", line, linelen );
- if ( error )
- goto Exit;
- bdf_list_shift_( &p->list, 1 );
+ int i;
- s = bdf_list_join_( &p->list, ' ', &slen );
- if ( !s )
- {
- FT_ERROR(( "bdf_parse_start_: " ERRMSG8, lineno, "FONT" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
+ line = bdf_strtok_( line, ' ' );
/* Allowing multiple `FONT' lines (which is invalid) doesn't hurt... */
- FT_FREE( p->font->name );
+ FT_FREE( font->name );
- if ( FT_DUP( p->font->name, s, slen + 1 ) )
+ if ( FT_STRDUP( font->name, line ) )
goto Exit;
- /* If the font name is an XLFD name, set the spacing to the one in */
- /* the font name. If there is no spacing fall back on the default. */
- error = bdf_set_default_spacing_( p->font, p->opts, lineno );
- if ( error )
- goto Exit;
+ /* If the font name is an XLFD name, set the spacing to the one in */
+ /* the font name after the 11th dash. */
+ for ( i = 0; i < 11; i++ )
+ {
+ while ( *line && *line != '-' )
+ line++;
+ if ( *line )
+ line++;
+ }
+
+ switch ( *line )
+ {
+ case 'C':
+ case 'c':
+ font->spacing = BDF_CHARCELL;
+ break;
+ case 'M':
+ case 'm':
+ font->spacing = BDF_MONOWIDTH;
+ break;
+ case 'P':
+ case 'p':
+ default:
+ font->spacing = BDF_PROPORTIONAL;
+ break;
+ }
p->flags |= BDF_FONT_NAME_;
@@ -2060,6 +1502,47 @@
/* Check for the SIZE field. */
if ( _bdf_strncmp( line, "SIZE", 4 ) == 0 )
{
+ line = bdf_strtok_( line, ' ' );
+ font->point_size = bdf_atoul_( line );
+ line = bdf_strtok_( line, ' ' );
+ font->resolution_x = bdf_atoul_( line );
+ line = bdf_strtok_( line, ' ' );
+ font->resolution_y = bdf_atoul_( line );
+
+ /* Check for the bits per pixel field. */
+ line = bdf_strtok_( line, ' ' );
+ if ( *line )
+ {
+ unsigned short bpp;
+
+
+ bpp = bdf_atous_( line );
+
+ /* Only values 1, 2, 4, 8 are allowed for greymap fonts. */
+ if ( bpp > 4 )
+ font->bpp = 8;
+ else if ( bpp > 2 )
+ font->bpp = 4;
+ else if ( bpp > 1 )
+ font->bpp = 2;
+ else
+ font->bpp = 1;
+
+ if ( font->bpp != bpp )
+ FT_TRACE2(( "bdf_parse_start_: " ACMSG11, font->bpp ));
+ }
+ else
+ font->bpp = 1;
+
+ p->flags |= BDF_SIZE_;
+
+ goto Exit;
+ }
+
+ /* Check for the CHARS field */
+ if ( _bdf_strncmp( line, "CHARS", 5 ) == 0 )
+ {
+ /* Check the header for completeness before parsing glyphs. */
if ( !( p->flags & BDF_FONT_NAME_ ) )
{
/* Missing the FONT field. */
@@ -2067,50 +1550,13 @@
error = FT_THROW( Missing_Font_Field );
goto Exit;
}
-
- error = bdf_list_split_( &p->list, " +", line, linelen );
- if ( error )
- goto Exit;
-
- p->font->point_size = bdf_atoul_( p->list.field[1] );
- p->font->resolution_x = bdf_atoul_( p->list.field[2] );
- p->font->resolution_y = bdf_atoul_( p->list.field[3] );
-
- /* Check for the bits per pixel field. */
- if ( p->list.used == 5 )
+ if ( !( p->flags & BDF_SIZE_ ) )
{
- unsigned short bpp;
-
-
- bpp = bdf_atous_( p->list.field[4] );
-
- /* Only values 1, 2, 4, 8 are allowed for greymap fonts. */
- if ( bpp > 4 )
- p->font->bpp = 8;
- else if ( bpp > 2 )
- p->font->bpp = 4;
- else if ( bpp > 1 )
- p->font->bpp = 2;
- else
- p->font->bpp = 1;
-
- if ( p->font->bpp != bpp )
- FT_TRACE2(( "bdf_parse_start_: " ACMSG11, p->font->bpp ));
+ /* Missing the SIZE field. */
+ FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "SIZE" ));
+ error = FT_THROW( Missing_Size_Field );
+ goto Exit;
}
- else
- p->font->bpp = 1;
-
- p->flags |= BDF_SIZE_;
-
- goto Exit;
- }
-
- /* Check for the CHARS field -- font properties are optional */
- if ( _bdf_strncmp( line, "CHARS", 5 ) == 0 )
- {
- char nbuf[BUFSIZE];
-
-
if ( !( p->flags & BDF_FONT_BBX_ ) )
{
/* Missing the FONTBOUNDINGBOX field. */
@@ -2119,28 +1565,35 @@
goto Exit;
}
- /* Add the two standard X11 properties which are required */
- /* for compiling fonts. */
- p->font->font_ascent = p->font->bbx.ascent;
- ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.ascent );
- error = bdf_add_property_( p->font, "FONT_ASCENT",
- nbuf, lineno );
- if ( error )
+ line = bdf_strtok_( line, ' ' );
+ p->cnt = font->glyphs_size = bdf_atoul_( line );
+
+ /* We need at least 20 bytes per glyph. */
+ if ( p->cnt > p->size / 20 )
+ {
+ p->cnt = font->glyphs_size = p->size / 20;
+ FT_TRACE2(( "bdf_parse_start_: " ACMSG17, p->cnt ));
+ }
+
+ /* Make sure the number of glyphs is non-zero. */
+ if ( p->cnt == 0 )
+ font->glyphs_size = 64;
+
+ /* Limit ourselves to 1,114,112 glyphs in the font (this is the */
+ /* number of code points available in Unicode). */
+ if ( p->cnt >= 0x110000UL )
+ {
+ FT_ERROR(( "bdf_parse_start_: " ERRMSG5, lineno, "CHARS" ));
+ error = FT_THROW( Invalid_Argument );
goto Exit;
- FT_TRACE2(( "bdf_parse_properties_: " ACMSG1, p->font->bbx.ascent ));
+ }
- p->font->font_descent = p->font->bbx.descent;
- ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.descent );
- error = bdf_add_property_( p->font, "FONT_DESCENT",
- nbuf, lineno );
- if ( error )
+ if ( FT_NEW_ARRAY( font->glyphs, font->glyphs_size ) )
goto Exit;
- FT_TRACE2(( "bdf_parse_properties_: " ACMSG2, p->font->bbx.descent ));
- *next = bdf_parse_glyphs_;
+ p->flags |= BDF_GLYPHS_;
+ *next = bdf_parse_glyphs_;
- /* A special return value. */
- error = -1;
goto Exit;
}
@@ -2162,7 +1615,7 @@
FT_LOCAL_DEF( FT_Error )
bdf_load_font( FT_Stream stream,
FT_Memory memory,
- bdf_options_t* opts,
+ unsigned long flags,
bdf_font_t* *font )
{
unsigned long lineno = 0; /* make compiler happy */
@@ -2174,13 +1627,11 @@
if ( FT_NEW( p ) )
goto Exit;
- p->opts = (bdf_options_t*)( opts ? opts : &bdf_opts_ );
+ p->flags = flags; /* comments, metrics, unencoded */
p->minlb = 32767;
p->size = stream->size;
p->memory = memory; /* only during font creation */
- bdf_list_init_( &p->list, memory );
-
error = bdf_readstream_( stream, bdf_parse_start_,
(void *)p, &lineno );
if ( error )
@@ -2188,12 +1639,6 @@
if ( p->font )
{
- /* If the font is not proportional, set the font's monowidth */
- /* field to the width of the font bounding box. */
-
- if ( p->font->spacing != BDF_PROPORTIONAL )
- p->font->monowidth = p->font->bbx.width;
-
/* If the number of glyphs loaded is not that of the original count, */
/* indicate the difference. */
if ( p->cnt != p->font->glyphs_used + p->font->unencoded_used )
@@ -2204,7 +1649,7 @@
/* Once the font has been loaded, adjust the overall font metrics if */
/* necessary. */
- if ( p->opts->correct_metrics != 0 &&
+ if ( p->flags & BDF_CORRECT_METRICS &&
( p->font->glyphs_used > 0 || p->font->unencoded_used > 0 ) )
{
if ( p->maxrb - p->minlb != p->font->bbx.width )
@@ -2242,9 +1687,6 @@
p->font->bbx.height, p->maxas + p->maxds ));
p->font->bbx.height = (unsigned short)( p->maxas + p->maxds );
}
-
- if ( p->flags & BDF_SWIDTH_ADJ_ )
- FT_TRACE2(( "bdf_load_font: " ACMSG8 ));
}
}
@@ -2275,8 +1717,6 @@
Exit:
if ( p )
{
- bdf_list_done_( &p->list );
-
FT_FREE( p->glyph_name );
FT_FREE( p );
}
@@ -2311,7 +1751,7 @@
/* Free up the internal hash table of property names. */
if ( font->internal )
{
- ft_hash_str_free( (FT_Hash)font->internal, memory );
+ ft_hash_str_free( font->internal, memory );
FT_FREE( font->internal );
}
@@ -2369,9 +1809,9 @@
if ( font == NULL || font->props_size == 0 || name == NULL || *name == 0 )
return 0;
- propid = ft_hash_str_lookup( name, (FT_Hash)font->internal );
+ propid = ft_hash_str_lookup( name, font->internal );
- return propid ? ( font->props + *propid ) : 0;
+ return propid ? ( font->props + *propid ) : NULL;
}
diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c
index 04f664fad..7102d3d2d 100644
--- a/src/cache/ftcbasic.c
+++ b/src/cache/ftcbasic.c
@@ -45,8 +45,9 @@
FT_BOOL( FTC_SCALER_COMPARE( &(a)->scaler, &(b)->scaler ) && \
(a)->load_flags == (b)->load_flags )
-#define FTC_BASIC_ATTR_HASH( a ) \
- ( FTC_SCALER_HASH( &(a)->scaler ) + 31 * (a)->load_flags )
+#define FTC_BASIC_ATTR_HASH( a ) \
+ ( FTC_SCALER_HASH( &(a)->scaler ) + \
+ (FT_Offset)( 31 * (a)->load_flags ) )
typedef struct FTC_BasicQueryRec_
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index f6ebdb381..bab7d349a 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -168,26 +168,8 @@
CFF_Size cffsize = (CFF_Size)size;
- if ( !cffslot )
- return FT_THROW( Invalid_Slot_Handle );
-
FT_TRACE1(( "cff_glyph_load: glyph index %d\n", glyph_index ));
- /* check whether we want a scaled outline or bitmap */
- if ( !cffsize )
- load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
-
- /* reset the size object if necessary */
- if ( load_flags & FT_LOAD_NO_SCALE )
- size = NULL;
-
- if ( size )
- {
- /* these two objects must have the same parent */
- if ( size->face != slot->face )
- return FT_THROW( Invalid_Face_Handle );
- }
-
/* now load the glyph outline if necessary */
error = cff_slot_load( cffslot, cffsize, glyph_index, load_flags );
@@ -205,105 +187,70 @@
FT_Int32 flags,
FT_Fixed* advances )
{
- FT_UInt nn;
- FT_Error error = FT_Err_Ok;
- FT_GlyphSlot slot = face->glyph;
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Bool horz;
+ FT_UInt nn;
- if ( FT_IS_SFNT( face ) )
+ if ( !FT_IS_SFNT( face ) )
+ return FT_THROW( Unimplemented_Feature );
+
+ horz = !( flags & FT_LOAD_VERTICAL_LAYOUT );
+
+ if ( horz )
{
/* OpenType 1.7 mandates that the data from `hmtx' table be used; */
/* it is no longer necessary that those values are identical to */
/* the values in the `CFF' table */
+ if ( !cffface->horizontal.number_Of_HMetrics )
+ return FT_THROW( Unimplemented_Feature );
- CFF_Face cffface = (CFF_Face)face;
- FT_Short dummy;
-
-
- if ( flags & FT_LOAD_VERTICAL_LAYOUT )
- {
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- /* no fast retrieval for blended MM fonts without VVAR table */
- if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) &&
- !( cffface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
- return FT_THROW( Unimplemented_Feature );
+ /* no fast retrieval for blended MM fonts without HVAR table */
+ if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) &&
+ !( cffface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
+ return FT_THROW( Unimplemented_Feature );
#endif
+ }
+ else /* vertical */
+ {
+ /* check whether we have data from the `vmtx' table at all; */
+ /* otherwise we extract the info from the CFF glyphstrings */
+ /* (instead of synthesizing a global value using the `OS/2' */
+ /* table) */
+ if ( !cffface->vertical_info )
+ return FT_THROW( Unimplemented_Feature );
- /* check whether we have data from the `vmtx' table at all; */
- /* otherwise we extract the info from the CFF glyphstrings */
- /* (instead of synthesizing a global value using the `OS/2' */
- /* table) */
- if ( !cffface->vertical_info )
- goto Missing_Table;
-
- for ( nn = 0; nn < count; nn++ )
- {
- FT_UShort ah;
-
-
- ( (SFNT_Service)cffface->sfnt )->get_metrics( cffface,
- 1,
- start + nn,
- &dummy,
- &ah );
-
- FT_TRACE5(( " idx %d: advance height %d font unit%s\n",
- start + nn,
- ah,
- ah == 1 ? "" : "s" ));
- advances[nn] = ah;
- }
- }
- else
- {
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- /* no fast retrieval for blended MM fonts without HVAR table */
- if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) &&
- !( cffface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
- return FT_THROW( Unimplemented_Feature );
+ /* no fast retrieval for blended MM fonts without VVAR table */
+ if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) &&
+ !( cffface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
+ return FT_THROW( Unimplemented_Feature );
#endif
-
- /* check whether we have data from the `hmtx' table at all */
- if ( !cffface->horizontal.number_Of_HMetrics )
- goto Missing_Table;
-
- for ( nn = 0; nn < count; nn++ )
- {
- FT_UShort aw;
-
-
- ( (SFNT_Service)cffface->sfnt )->get_metrics( cffface,
- 0,
- start + nn,
- &dummy,
- &aw );
-
- FT_TRACE5(( " idx %d: advance width %d font unit%s\n",
- start + nn,
- aw,
- aw == 1 ? "" : "s" ));
- advances[nn] = aw;
- }
- }
-
- return error;
}
- Missing_Table:
- flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;
-
+ /* proceed to fast advances */
for ( nn = 0; nn < count; nn++ )
{
- error = cff_glyph_load( slot, face->size, start + nn, flags );
- if ( error )
- break;
+ FT_UShort aw;
+ FT_Short dummy;
- advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
- ? slot->linearVertAdvance
- : slot->linearHoriAdvance;
+
+ ( (SFNT_Service)cffface->sfnt )->get_metrics( cffface,
+ !horz,
+ start + nn,
+ &dummy,
+ &aw );
+
+ FT_TRACE5(( " idx %d: advance %s %d font unit%s\n",
+ start + nn,
+ horz ? "width" : "height",
+ aw,
+ aw == 1 ? "" : "s" ));
+ advances[nn] = aw;
}
- return error;
+ return FT_Err_Ok;
}
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index cbb071abd..1abee3aec 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -238,24 +238,12 @@
else if ( glyph_index >= cff->num_glyphs )
return FT_THROW( Invalid_Argument );
- if ( load_flags & FT_LOAD_NO_RECURSE )
- load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
-
- glyph->x_scale = 0x10000L;
- glyph->y_scale = 0x10000L;
- if ( size )
- {
- glyph->x_scale = size->root.metrics.x_scale;
- glyph->y_scale = size->root.metrics.y_scale;
- }
-
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
/* try to load embedded bitmap if any */
/* */
/* XXX: The convention should be emphasized in */
/* the documents because it can be confusing. */
- if ( size )
{
CFF_Face cff_face = (CFF_Face)size->root.face;
SFNT_Service sfnt = (SFNT_Service)cff_face->sfnt;
@@ -284,9 +272,6 @@
FT_Short dummy;
- glyph->root.outline.n_points = 0;
- glyph->root.outline.n_contours = 0;
-
glyph->root.metrics.width = (FT_Pos)metrics.width * 64;
glyph->root.metrics.height = (FT_Pos)metrics.height * 64;
@@ -426,6 +411,9 @@
/* if we have a CID subfont, use its matrix (which has already */
/* been multiplied with the root matrix) */
+ glyph->x_scale = size->root.metrics.x_scale;
+ glyph->y_scale = size->root.metrics.y_scale;
+
/* this scaling is only relevant if the PS hinter isn't active */
if ( cff->num_subfonts )
{
@@ -457,9 +445,6 @@
font_offset = cff->top_font.font_dict.font_offset;
}
- glyph->root.outline.n_points = 0;
- glyph->root.outline.n_contours = 0;
-
/* top-level code ensures that FT_LOAD_NO_HINTING is set */
/* if FT_LOAD_NO_SCALE is active */
hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_HINTING ) == 0 );
@@ -467,7 +452,6 @@
glyph->hint = hinting;
glyph->scaled = scaled;
- glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; /* by default */
{
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
@@ -602,10 +586,8 @@
{
/* Now, set the metrics -- this is rather simple, as */
/* the left side bearing is the xMin, and the top side */
- /* bearing the yMax. */
-
- /* For composite glyphs, return only left side bearing and */
- /* advance width. */
+ /* bearing the yMax. For composite glyphs, return only */
+ /* left side bearing and advance width. */
if ( load_flags & FT_LOAD_NO_RECURSE )
{
FT_Slot_Internal internal = glyph->root.internal;
@@ -624,6 +606,12 @@
FT_Bool has_vertical_info;
+ glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;
+
+ glyph->root.outline.flags = FT_OUTLINE_REVERSE_FILL;
+ if ( size && size->root.metrics.y_ppem < 24 )
+ glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION;
+
if ( face->horizontal.number_Of_HMetrics )
{
FT_Short horiBearingX = 0;
@@ -677,14 +665,6 @@
glyph->root.linearVertAdvance = metrics->vertAdvance;
- glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;
-
- glyph->root.outline.flags = 0;
- if ( size && size->root.metrics.y_ppem < 24 )
- glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION;
-
- glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL;
-
/* apply the font matrix, if any */
if ( font_matrix.xx != 0x10000L || font_matrix.yy != 0x10000L ||
font_matrix.xy != 0 || font_matrix.yx != 0 )
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 7c6713739..77dce2818 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -537,8 +537,8 @@
sfnt_format = 1;
- /* now, the font can be either an OpenType/CFF font, or an SVG CEF */
- /* font; in the latter case it doesn't have a `head' table */
+ /* the font may be OpenType/CFF, SVG CEF, or sfnt/CFF; a `head' table */
+ /* implies OpenType/CFF, otherwise just look for an optional cmap */
error = face->goto_table( face, TTAG_head, stream, 0 );
if ( !error )
{
@@ -554,7 +554,9 @@
{
/* load the `cmap' table explicitly */
error = sfnt->load_cmap( face, stream );
- if ( error )
+
+ /* this may fail because CID-keyed fonts don't have a cmap */
+ if ( FT_ERR_NEQ( error, Table_Missing ) && FT_ERR_NEQ( error, Ok ) )
goto Exit;
}
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index 7b571322d..cb2861519 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -452,16 +452,12 @@
glyph->x_scale = cidsize->metrics.x_scale;
glyph->y_scale = cidsize->metrics.y_scale;
- cidglyph->outline.n_points = 0;
- cidglyph->outline.n_contours = 0;
-
hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
( load_flags & FT_LOAD_NO_HINTING ) == 0 );
scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 );
glyph->hint = hinting;
glyph->scaled = scaled;
- cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
error = psaux->t1_decoder_funcs->init( &decoder,
cidglyph->face,
@@ -501,12 +497,8 @@
/* now set the metrics -- this is rather simple, as */
/* the left side bearing is the xMin, and the top side */
- /* bearing the yMax */
- cidglyph->outline.flags &= FT_OUTLINE_OWNER;
- cidglyph->outline.flags |= FT_OUTLINE_REVERSE_FILL;
-
- /* for composite glyphs, return only left side bearing and */
- /* advance width */
+ /* bearing the yMax; for composite glyphs, return only */
+ /* left side bearing and advance width */
if ( load_flags & FT_LOAD_NO_RECURSE )
{
FT_Slot_Internal internal = cidglyph->internal;
@@ -527,6 +519,13 @@
FT_Glyph_Metrics* metrics = &cidglyph->metrics;
+ cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
+
+ cidglyph->outline.flags &= FT_OUTLINE_OWNER;
+ cidglyph->outline.flags |= FT_OUTLINE_REVERSE_FILL;
+ if ( cidsize->metrics.y_ppem < 24 )
+ cidglyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
+
/* copy the _unscaled_ advance width */
metrics->horiAdvance =
FIXED_TO_INT( decoder.builder.advance.x );
@@ -539,11 +538,6 @@
face->cid.font_bbox.yMin ) >> 16;
cidglyph->linearVertAdvance = metrics->vertAdvance;
- cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
-
- if ( cidsize->metrics.y_ppem < 24 )
- cidglyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
-
/* apply the font matrix, if any */
if ( font_matrix.xx != 0x10000L || font_matrix.yy != 0x10000L ||
font_matrix.xy != 0 || font_matrix.yx != 0 )
diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c
index f1dba0240..93632f17c 100644
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -453,7 +453,7 @@ THE SOFTWARE.
FT_UInt glyph_index,
FT_Int32 load_flags )
{
- PCF_Face face = (PCF_Face)FT_SIZE_FACE( size );
+ PCF_Face face = (PCF_Face)size->face;
FT_Stream stream;
FT_Error error = FT_Err_Ok;
FT_Bitmap* bitmap = &slot->bitmap;
diff --git a/src/pfr/pfrobjs.c b/src/pfr/pfrobjs.c
index 084d2ef5a..79b8f629f 100644
--- a/src/pfr/pfrobjs.c
+++ b/src/pfr/pfrobjs.c
@@ -355,11 +355,8 @@
goto Exit;
}
- gchar = face->phy_font.chars + gindex;
- pfrslot->format = FT_GLYPH_FORMAT_OUTLINE;
- outline->n_points = 0;
- outline->n_contours = 0;
- gps_offset = face->header.gps_section_offset;
+ gchar = face->phy_font.chars + gindex;
+ gps_offset = face->header.gps_section_offset;
/* load the glyph outline (FT_LOAD_NO_RECURSE isn't supported) */
error = pfr_glyph_load( &slot->glyph, face->root.stream,
@@ -371,10 +368,9 @@
FT_Glyph_Metrics* metrics = &pfrslot->metrics;
FT_Pos advance;
FT_UInt em_metrics, em_outline;
- FT_Bool scaling;
- scaling = FT_BOOL( !( load_flags & FT_LOAD_NO_SCALE ) );
+ pfrslot->format = FT_GLYPH_FORMAT_OUTLINE;
/* copy outline data */
*outline = slot->glyph.loader->base.outline;
@@ -429,7 +425,7 @@
#endif
/* scale when needed */
- if ( scaling )
+ if ( !( load_flags & FT_LOAD_NO_SCALE ) )
{
FT_Int n;
FT_Fixed x_scale = pfrsize->metrics.x_scale;
diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c
index 6b445a996..7572e225e 100644
--- a/src/psaux/psintrp.c
+++ b/src/psaux/psintrp.c
@@ -445,7 +445,7 @@
cf2_stack_getReal( opStack,
delta++ ) ) );
- FT_TRACE6(( "%f ", (float) sum / 65536 ));
+ FT_TRACE6(( "%f ", (double)sum / 65536 ));
/* store blended result */
cf2_stack_setReal( opStack, i + base, sum );
@@ -2282,7 +2282,7 @@
arg = cf2_stack_popFixed( opStack );
if ( arg > 0 )
- arg = (CF2_F16Dot16)FT_SqrtFixed( arg );
+ arg = (CF2_F16Dot16)FT_SqrtFixed( (FT_UInt32)arg );
else
arg = 0;
diff --git a/src/sdf/ftbsdf.c b/src/sdf/ftbsdf.c
index adde05ba1..10d1de8a3 100644
--- a/src/sdf/ftbsdf.c
+++ b/src/sdf/ftbsdf.c
@@ -373,7 +373,7 @@
* @Input:
* current ::
* Array of Euclidean distances. `current` must point to the position
- * for which the distance is to be caculated. We treat this array as
+ * for which the distance is to be calculated. We treat this array as
* a two-dimensional array mapped to a one-dimensional array.
*
* x ::
@@ -550,7 +550,7 @@
*
* @Description:
* Loops over all the pixels and call `compute_edge_distance` only for
- * edge pixels. This maked the process a lot faster since
+ * edge pixels. This makes the process a lot faster since
* `compute_edge_distance` uses functions such as `FT_Vector_NormLen',
* which are quite slow.
*
diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c
index dc55d4263..8b3ff6776 100644
--- a/src/sdf/ftsdf.c
+++ b/src/sdf/ftsdf.c
@@ -3456,7 +3456,7 @@
* A complete shape which is used to generate SDF.
*
* spread ::
- * Maximum distances to be allowed inthe output bitmap.
+ * Maximum distances to be allowed in the output bitmap.
*
* @Output:
* bitmap ::
diff --git a/src/sdf/ftsdf.h b/src/sdf/ftsdf.h
index 25a0a13bb..d1ca8d375 100644
--- a/src/sdf/ftsdf.h
+++ b/src/sdf/ftsdf.h
@@ -57,7 +57,7 @@ FT_BEGIN_HEADER
* indicate positions inside of contours.
*
* flip_y ::
- * Setting this parameter to true maked the output image flipped
+ * Setting this parameter to true makes the output image flipped
* along the y-axis.
*
* overlaps ::
diff --git a/src/sfnt/ttbdf.c b/src/sfnt/ttbdf.c
index 6138fc46d..d9765f486 100644
--- a/src/sfnt/ttbdf.c
+++ b/src/sfnt/ttbdf.c
@@ -142,7 +142,7 @@
{
TT_Face ttface = (TT_Face)face;
TT_BDF bdf = &ttface->bdf;
- FT_Size size = FT_FACE_SIZE( face );
+ FT_Size size = face->size;
FT_Error error = FT_Err_Ok;
FT_Byte* p;
FT_UInt count;
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index 28f4d1173..3e40da6b0 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -179,7 +179,7 @@
cmap_info->format = 0;
- cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
+ cmap_info->language = TT_PEEK_USHORT( p );
return FT_Err_Ok;
}
@@ -596,7 +596,7 @@
cmap_info->format = 2;
- cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
+ cmap_info->language = TT_PEEK_USHORT( p );
return FT_Err_Ok;
}
@@ -1539,7 +1539,7 @@
cmap_info->format = 4;
- cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
+ cmap_info->language = TT_PEEK_USHORT( p );
return FT_Err_Ok;
}
@@ -1712,7 +1712,7 @@
cmap_info->format = 6;
- cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
+ cmap_info->language = TT_PEEK_USHORT( p );
return FT_Err_Ok;
}
@@ -2009,7 +2009,7 @@
cmap_info->format = 8;
- cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
+ cmap_info->language = TT_PEEK_ULONG( p );
return FT_Err_Ok;
}
@@ -2184,7 +2184,7 @@
cmap_info->format = 10;
- cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
+ cmap_info->language = TT_PEEK_ULONG( p );
return FT_Err_Ok;
}
@@ -2528,7 +2528,7 @@
cmap_info->format = 12;
- cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
+ cmap_info->language = TT_PEEK_ULONG( p );
return FT_Err_Ok;
}
@@ -2844,7 +2844,7 @@
cmap_info->format = 13;
- cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
+ cmap_info->language = TT_PEEK_ULONG( p );
return FT_Err_Ok;
}
diff --git a/src/sfnt/ttgpos.c b/src/sfnt/ttgpos.c
index c5dd043d6..b6cd8bf82 100644
--- a/src/sfnt/ttgpos.c
+++ b/src/sfnt/ttgpos.c
@@ -58,6 +58,7 @@
typedef enum gpos_lookup_type_
{
+ GPOS_LOOKUP_TYPE_NONE = 0,
GPOS_LOOKUP_TYPE_SINGLE_ADJUSTMENT = 1,
GPOS_LOOKUP_TYPE_PAIR_ADJUSTMENT = 2,
GPOS_LOOKUP_TYPE_CURSIVE_ATTACHMENT = 3,
@@ -132,14 +133,14 @@
else
{
context->current_lookup_table = NULL;
- context->current_lookup_type = 0;
+ context->current_lookup_type = GPOS_LOOKUP_TYPE_NONE;
context->subtable_count = 0;
context->subtable_offsets = NULL;
}
context->subtable_idx = 0;
context->subtable = NULL;
- context->subtable_type = 0;
+ context->subtable_type = GPOS_LOOKUP_TYPE_NONE;
}
@@ -195,7 +196,7 @@
FT_Int m;
FT_Int straw;
- FT_Int needle = glyph;
+ FT_Int needle = (FT_Int)glyph;
/* Binary search. */
@@ -230,7 +231,7 @@
FT_Int straw_start;
FT_Int straw_end;
- FT_Int needle = glyph;
+ FT_Int needle = (FT_Int)glyph;
/* Binary search. */
@@ -254,14 +255,11 @@
FT_PEEK_USHORT( range_record + 4 );
- return start_coverage_index + glyph - straw_start;
+ return (FT_Int)start_coverage_index + (FT_Int)glyph - straw_start;
}
}
break;
}
-
- default:
- return -1; /* unsupported */
}
return -1;
@@ -303,7 +301,7 @@
FT_Int straw_start;
FT_Int straw_end;
- FT_Int needle = glyph;
+ FT_Int needle = (FT_Int)glyph;
while ( l <= r )
@@ -325,9 +323,6 @@
}
break;
}
-
- default:
- return -1; /* Unsupported definition type, return an error. */
}
/* "All glyphs not assigned to a class fall into class 0." */
@@ -514,7 +509,7 @@
pair_value_count = FT_PEEK_USHORT( pair_value_table );
pair_value_array = pair_value_table + 2;
- needle = right_glyph;
+ needle = (FT_Int)right_glyph;
r = pair_value_count - 1;
l = 0;
@@ -584,9 +579,6 @@
return x_advance;
}
-
- default:
- return 0;
}
}
}
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index fe4d51559..c3a5fae2c 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -1046,7 +1046,7 @@
FT_LOCAL_DEF( void )
tt_face_free_name( TT_Face face )
{
- FT_Memory memory = face->root.driver->root.memory;
+ FT_Memory memory = face->root.memory;
TT_NameTable table = &face->name_table;
diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c
index a90237ad0..5698a62c8 100644
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -226,7 +226,7 @@
FT_UInt len = *p;
- /* all names in Adobe Glyph List are shorter than 40 characters */
+ /* names in the Adobe Glyph List are shorter than 40 characters */
if ( len >= 40U )
FT_TRACE4(( "load_format_20: unusual %u-char name found\n", len ));
@@ -240,7 +240,7 @@
if ( n < num_names )
{
FT_TRACE4(( "load_format_20: %hu PostScript names are truncated\n",
- num_names - n ));
+ (FT_UShort)( num_names - n ) ));
for ( ; n < num_names; n++ )
name_strings[n] = p_end;
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index cb3a8abf1..cad24a5c8 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -1462,12 +1462,13 @@
FT_Int originOffsetX, originOffsetY;
FT_Tag graphicType;
FT_Int recurse_depth = 0;
+ FT_Bool flipped = FALSE;
FT_Error error;
FT_Byte* p;
- FT_UNUSED( map );
#ifndef FT_CONFIG_OPTION_USE_PNG
+ FT_UNUSED( map );
FT_UNUSED( metrics_only );
#endif
@@ -1517,12 +1518,16 @@
switch ( graphicType )
{
+ case FT_MAKE_TAG( 'f', 'l', 'i', 'p' ):
+ flipped = !flipped;
+ FALL_THROUGH;
+
case FT_MAKE_TAG( 'd', 'u', 'p', 'e' ):
- if ( recurse_depth < 4 )
+ if ( recurse_depth++ < 4 )
{
glyph_index = FT_GET_USHORT();
FT_FRAME_EXIT();
- recurse_depth++;
+
goto retry;
}
error = FT_THROW( Invalid_File_Format );
@@ -1540,6 +1545,38 @@
glyph_end - glyph_start - 8,
TRUE,
metrics_only );
+ if ( flipped && !metrics_only && !error )
+ {
+ FT_UInt32* curr_pos = (FT_UInt32*)map->buffer;
+
+ /* `Load_SBit_Png` always returns a pixmap with 32 bits per pixel */
+ /* and no extra pitch bytes. */
+ FT_UInt width = map->width;
+ FT_UInt y;
+
+
+ for ( y = 0; y < map->rows; y++ )
+ {
+ FT_UInt32* left = curr_pos;
+ FT_UInt32* right = curr_pos + width - 1;
+
+
+ while ( left < right )
+ {
+ FT_UInt32 value;
+
+
+ value = *right;
+ *right = *left;
+ *left = value;
+
+ left++;
+ right--;
+ }
+
+ curr_pos += width;
+ }
+ }
#else
error = FT_THROW( Unimplemented_Feature );
#endif
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index b7c0632a6..24c119571 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1873,6 +1873,7 @@ typedef ptrdiff_t FT_PtrDist;
TCoord* band;
int continued = 0;
+ int error = Smooth_Err_Ok;
/* Initialize the null cell at the end of the poll. */
@@ -1907,7 +1908,6 @@ typedef ptrdiff_t FT_PtrDist;
do
{
TCoord i;
- int error;
ras.min_ex = band[1];
@@ -1936,7 +1936,7 @@ typedef ptrdiff_t FT_PtrDist;
continue;
}
else if ( error != Smooth_Err_Raster_Overflow )
- return error;
+ goto Exit;
/* render pool overflow; we will reduce the render band by half */
i = ( band[0] - band[1] ) >> 1;
@@ -1945,7 +1945,8 @@ typedef ptrdiff_t FT_PtrDist;
if ( i == 0 )
{
FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" ));
- return FT_THROW( Raster_Overflow );
+ error = FT_THROW( Raster_Overflow );
+ goto Exit;
}
band++;
@@ -1954,7 +1955,11 @@ typedef ptrdiff_t FT_PtrDist;
} while ( band >= bands );
}
- return Smooth_Err_Ok;
+ Exit:
+ ras.cell = ras.cell_free = ras.cell_null = NULL;
+ ras.ycells = NULL;
+
+ return error;
}
diff --git a/src/tools/apinames.c b/src/tools/apinames.c
index 5a49b0649..f64541ebb 100644
--- a/src/tools/apinames.c
+++ b/src/tools/apinames.c
@@ -42,6 +42,7 @@ typedef enum OutputFormat_
} OutputFormat;
+#define SUFFIX_VMS_64ADDR "64__"
static void
panic( const char* fmt,
@@ -76,11 +77,12 @@ static int max_names;
static void
-names_add( const char* name,
- const char* end )
+names_add( const char* name,
+ const char* end,
+ OutputFormat format )
{
unsigned int h;
- int nn, len;
+ int nn, len, len_suffix;
Name nm;
@@ -116,8 +118,18 @@ names_add( const char* name,
}
nm = &the_names[num_names++];
+ switch ( format )
+ {
+ case OUTPUT_VMS_OPT:
+ /* VMS mode would join the symbol name with a suffix */
+ len_suffix = sizeof ( SUFFIX_VMS_64ADDR );
+ break;
+ default:
+ len_suffix = 0;
+ }
+
nm->hash = h;
- nm->name = (char*)malloc( len + 1 );
+ nm->name = (char*)malloc( len + len_suffix + 1 );
if ( !nm->name )
panic( "not enough memory" );
@@ -181,6 +193,7 @@ names_dump( FILE* out,
case OUTPUT_WATCOM_LBC:
{
+ char temp[512];
const char* dot;
@@ -195,7 +208,6 @@ names_dump( FILE* out,
dot = strchr( dll_name, '.' );
if ( dot )
{
- char temp[512];
int len = dot - dll_name;
@@ -229,7 +241,7 @@ names_dump( FILE* out,
/* Also emit a 64-bit symbol, as created by the `vms_auto64` tool. */
/* It has the string '64__' appended to its name. */
- strcat( the_names[nn].name , "64__" );
+ strcat( the_names[nn].name , SUFFIX_VMS_64ADDR );
if ( vms_shorten_symbol( the_names[nn].name, short_symbol, 1 ) == -1 )
panic( "could not shorten name '%s'", the_names[nn].name );
fprintf( out, "symbol_vector = ( %s = PROCEDURE)\n", short_symbol );
@@ -277,8 +289,9 @@ typedef enum State_
static int
-read_header_file( FILE* file,
- int verbose )
+read_header_file( FILE* file,
+ int verbose,
+ OutputFormat format )
{
static char buff[LINEBUFF_SIZE + 1];
State state = STATE_START;
@@ -350,7 +363,7 @@ read_header_file( FILE* file,
if ( verbose )
fprintf( stderr, ">>> %.*s\n", (int)( p - name ), name );
- names_add( name, p );
+ names_add( name, p, format );
}
state = STATE_START;
@@ -380,7 +393,7 @@ usage( void )
"It receives a list of header files as an argument and\n"
"generates a sorted list of unique identifiers in various formats.\n"
"\n"
- "usage: %s header1 [options] [header2 ...]\n"
+ "usage: %s [options] header1 [header2 ...]\n"
"\n"
"options: - parse the contents of stdin, ignore arguments\n"
" -v verbose mode, output sent to standard error\n"
@@ -519,7 +532,7 @@ main( int argc,
} /* end of while loop */
if ( from_stdin )
- read_header_file( stdin, verbose );
+ read_header_file( stdin, verbose, format );
else
{
for ( --argc, argv++; argc > 0; argc--, argv++ )
@@ -534,7 +547,7 @@ main( int argc,
if ( verbose )
fprintf( stderr, "opening '%s'\n", argv[0] );
- read_header_file( file, verbose );
+ read_header_file( file, verbose, format );
fclose( file );
}
}
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index b656ccf04..e93f6a5c0 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1566,13 +1566,14 @@
if ( header_only )
goto Exit;
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ tt_get_metrics_incremental( loader, glyph_index );
+#endif
+ tt_loader_set_pp( loader );
+
+ /* shortcut for empty glyphs */
if ( loader->byte_len == 0 || loader->n_contours == 0 )
{
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- tt_get_metrics_incremental( loader, glyph_index );
-#endif
- tt_loader_set_pp( loader );
-
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
@@ -1627,11 +1628,6 @@
goto Exit;
}
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- tt_get_metrics_incremental( loader, glyph_index );
-#endif
- tt_loader_set_pp( loader );
-
/***********************************************************************/
/***********************************************************************/
@@ -2126,9 +2122,6 @@
&sbit_metrics );
if ( !error )
{
- glyph->outline.n_points = 0;
- glyph->outline.n_contours = 0;
-
glyph->metrics.width = (FT_Pos)sbit_metrics.width * 64;
glyph->metrics.height = (FT_Pos)sbit_metrics.height * 64;
@@ -2153,6 +2146,50 @@
glyph->bitmap_top = sbit_metrics.horiBearingY;
}
}
+ /* a missing glyph in a bitmap-only font is assumed whitespace */
+ /* that needs to be constructed using metrics data from `hmtx' */
+ /* and, optionally, `vmtx' tables */
+ else if ( FT_ERR_EQ( error, Missing_Bitmap ) &&
+ !FT_IS_SCALABLE( glyph->face ) &&
+ face->horz_metrics_size )
+ {
+ FT_Fixed x_scale = size->root.metrics.x_scale;
+ FT_Fixed y_scale = size->root.metrics.y_scale;
+
+ FT_Short left_bearing = 0;
+ FT_Short top_bearing = 0;
+
+ FT_UShort advance_width = 0;
+ FT_UShort advance_height = 0;
+
+
+ TT_Get_HMetrics( face, glyph_index,
+ &left_bearing,
+ &advance_width );
+ TT_Get_VMetrics( face, glyph_index,
+ 0,
+ &top_bearing,
+ &advance_height );
+
+ glyph->metrics.width = 0;
+ glyph->metrics.height = 0;
+
+ glyph->metrics.horiBearingX = FT_MulFix( left_bearing, x_scale );
+ glyph->metrics.horiBearingY = 0;
+ glyph->metrics.horiAdvance = FT_MulFix( advance_width, x_scale );
+
+ glyph->metrics.vertBearingX = 0;
+ glyph->metrics.vertBearingY = FT_MulFix( top_bearing, y_scale );
+ glyph->metrics.vertAdvance = FT_MulFix( advance_height, y_scale );
+
+ glyph->format = FT_GLYPH_FORMAT_BITMAP;
+ glyph->bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
+
+ glyph->bitmap_left = 0;
+ glyph->bitmap_top = 0;
+
+ error = FT_Err_Ok;
+ }
return error;
}
@@ -2431,79 +2468,21 @@
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
/* try to load embedded bitmap (if any) */
- if ( size->strike_index != 0xFFFFFFFFUL &&
- ( load_flags & FT_LOAD_NO_BITMAP ) == 0 &&
- IS_DEFAULT_INSTANCE( glyph->face ) )
+ if ( size->strike_index != 0xFFFFFFFFUL &&
+ !( load_flags & FT_LOAD_NO_BITMAP &&
+ FT_IS_SCALABLE( glyph->face ) ) &&
+ IS_DEFAULT_INSTANCE( glyph->face ) )
{
- FT_Fixed x_scale = size->root.metrics.x_scale;
- FT_Fixed y_scale = size->root.metrics.y_scale;
-
-
error = load_sbit_image( size, glyph, glyph_index, load_flags );
- if ( FT_ERR_EQ( error, Missing_Bitmap ) )
- {
- /* the bitmap strike is incomplete and misses the requested glyph; */
- /* if we have a bitmap-only font, return an empty glyph */
- if ( !FT_IS_SCALABLE( glyph->face ) )
- {
- FT_Short left_bearing = 0;
- FT_Short top_bearing = 0;
-
- FT_UShort advance_width = 0;
- FT_UShort advance_height = 0;
-
-
- /* to return an empty glyph, however, we need metrics data */
- /* from the `hmtx' (or `vmtx') table; the assumption is that */
- /* empty glyphs are missing intentionally, representing */
- /* whitespace - not having at least horizontal metrics is */
- /* thus considered an error */
- if ( !face->horz_metrics_size )
- return error;
-
- /* we now construct an empty bitmap glyph */
- TT_Get_HMetrics( face, glyph_index,
- &left_bearing,
- &advance_width );
- TT_Get_VMetrics( face, glyph_index,
- 0,
- &top_bearing,
- &advance_height );
-
- glyph->outline.n_points = 0;
- glyph->outline.n_contours = 0;
-
- glyph->metrics.width = 0;
- glyph->metrics.height = 0;
-
- glyph->metrics.horiBearingX = FT_MulFix( left_bearing, x_scale );
- glyph->metrics.horiBearingY = 0;
- glyph->metrics.horiAdvance = FT_MulFix( advance_width, x_scale );
-
- glyph->metrics.vertBearingX = 0;
- glyph->metrics.vertBearingY = FT_MulFix( top_bearing, y_scale );
- glyph->metrics.vertAdvance = FT_MulFix( advance_height, y_scale );
-
- glyph->format = FT_GLYPH_FORMAT_BITMAP;
- glyph->bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
-
- glyph->bitmap_left = 0;
- glyph->bitmap_top = 0;
-
- return FT_Err_Ok;
- }
- }
- else if ( error )
- {
- /* return error if font is not scalable */
- if ( !FT_IS_SCALABLE( glyph->face ) )
- return error;
- }
- else
+ if ( !error )
{
if ( FT_IS_SCALABLE( glyph->face ) ||
FT_HAS_SBIX( glyph->face ) )
{
+ FT_Fixed x_scale = size->root.metrics.x_scale;
+ FT_Fixed y_scale = size->root.metrics.y_scale;
+
+
/* for the bbox we need the header only */
(void)tt_loader_init( &loader, size, glyph, load_flags, TRUE );
(void)load_truetype_glyph( &loader, glyph_index, 0, TRUE );
@@ -2550,8 +2529,10 @@
y_scale );
}
- return FT_Err_Ok;
+ goto Exit;
}
+ else if ( !FT_IS_SCALABLE( glyph->face ) )
+ goto Exit;
}
if ( load_flags & FT_LOAD_SBITS_ONLY )
@@ -2614,7 +2595,7 @@
glyph->metrics.horiAdvance = FT_MulFix( advanceX, x_scale );
glyph->metrics.vertAdvance = FT_MulFix( advanceY, y_scale );
- return error;
+ goto Exit;
}
FT_TRACE3(( "Failed to load SVG glyph\n" ));
@@ -2642,10 +2623,6 @@
goto Done;
}
- glyph->format = FT_GLYPH_FORMAT_OUTLINE;
- glyph->num_subglyphs = 0;
- glyph->outline.flags = 0;
-
/* main loading loop */
error = load_truetype_glyph( &loader, glyph_index, 0, FALSE );
if ( !error )
@@ -2657,9 +2634,18 @@
}
else
{
+ glyph->format = FT_GLYPH_FORMAT_OUTLINE;
+
glyph->outline = loader.gloader->base.outline;
glyph->outline.flags &= ~FT_OUTLINE_SINGLE_PASS;
+ /* Set the `high precision' bit flag. This is _critical_ to */
+ /* get correct output for monochrome TrueType glyphs at all */
+ /* sizes using the bytecode interpreter. */
+ if ( !( load_flags & FT_LOAD_NO_SCALE ) &&
+ size->metrics->y_ppem < 24 )
+ glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
+
/* Translate array so that (0,0) is the glyph's origin. Note */
/* that this behaviour is independent on the value of bit 1 of */
/* the `flags' field in the `head' table -- at least major */
@@ -2708,14 +2694,6 @@
error = compute_glyph_metrics( &loader, glyph_index );
}
- /* Set the `high precision' bit flag. */
- /* This is _critical_ to get correct output for monochrome */
- /* TrueType glyphs at all sizes using the bytecode interpreter. */
- /* */
- if ( !( load_flags & FT_LOAD_NO_SCALE ) &&
- size->metrics->y_ppem < 24 )
- glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
-
FT_TRACE1(( " subglyphs = %u, contours = %hu, points = %hu,"
" flags = 0x%.3x\n",
loader.gloader->base.num_subglyphs,
@@ -2727,11 +2705,8 @@
tt_loader_done( &loader );
Exit:
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( error )
- FT_TRACE1(( " failed (error code 0x%x)\n",
- error ));
-#endif
+ FT_TRACE1(( error ? " failed (error code 0x%x)\n" : "",
+ error ));
return error;
}
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 095a72055..20860665d 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -129,9 +129,6 @@
* stream ::
* The data stream.
*
- * size ::
- * The size of the table holding the data.
- *
* @Output:
* point_cnt ::
* The number of points read. A zero value means that
@@ -144,14 +141,14 @@
*/
static FT_UShort*
ft_var_readpackedpoints( FT_Stream stream,
- FT_ULong size,
FT_UInt *point_cnt )
{
FT_UShort *points = NULL;
FT_UInt n;
- FT_UInt runcnt;
+ FT_UInt runcnt, cnt;
FT_UInt i, j;
FT_UShort first;
+ FT_Byte* p;
FT_Memory memory = stream->memory;
FT_Error error;
@@ -169,56 +166,60 @@
n |= FT_GET_BYTE();
}
- if ( n > size )
- {
- FT_TRACE1(( "ft_var_readpackedpoints: number of points too large\n" ));
- return NULL;
- }
-
- /* in the nested loops below we increase `i' twice; */
- /* it is faster to simply allocate one more slot */
- /* than to add another test within the loop */
- if ( FT_QNEW_ARRAY( points, n + 1 ) )
+ if ( FT_QNEW_ARRAY( points, n ) )
return NULL;
- *point_cnt = n;
-
+ p = stream->cursor;
first = 0;
i = 0;
while ( i < n )
{
- runcnt = FT_GET_BYTE();
+ if ( p >= stream->limit )
+ goto Fail;
+
+ runcnt = FT_NEXT_BYTE( p );
+ cnt = runcnt & GX_PT_POINT_RUN_COUNT_MASK;
+
+ /* first point not included in run count */
+ cnt++;
+ if ( cnt > n - i )
+ cnt = n - i;
+
if ( runcnt & GX_PT_POINTS_ARE_WORDS )
{
- runcnt &= GX_PT_POINT_RUN_COUNT_MASK;
- first += FT_GET_USHORT();
- points[i++] = first;
+ if ( 2 * cnt > (FT_UInt)( stream->limit - p ) )
+ goto Fail;
- /* first point not included in run count */
- for ( j = 0; j < runcnt; j++ )
+ for ( j = 0; j < cnt; j++ )
{
- first += FT_GET_USHORT();
+ first += FT_NEXT_USHORT( p );
points[i++] = first;
- if ( i >= n )
- break;
}
}
else
{
- first += FT_GET_BYTE();
- points[i++] = first;
+ if ( cnt > (FT_UInt)( stream->limit - p ) )
+ goto Fail;
- for ( j = 0; j < runcnt; j++ )
+ for ( j = 0; j < cnt; j++ )
{
- first += FT_GET_BYTE();
+ first += FT_NEXT_BYTE( p );
points[i++] = first;
- if ( i >= n )
- break;
}
}
}
+ stream->cursor = p;
+
+ *point_cnt = n;
+
return points;
+
+ Fail:
+ FT_TRACE1(( "ft_var_readpackedpoints: invalid table\n" ));
+
+ FT_FREE( points );
+ return NULL;
}
@@ -240,9 +241,6 @@
* stream ::
* The data stream.
*
- * size ::
- * The size of the table holding the data.
- *
* delta_cnt ::
* The number of deltas to be read.
*
@@ -258,13 +256,12 @@
*/
static FT_Fixed*
ft_var_readpackeddeltas( FT_Stream stream,
- FT_ULong size,
FT_UInt delta_cnt )
{
FT_Fixed *deltas = NULL;
FT_UInt runcnt, cnt;
FT_UInt i, j;
- FT_UInt bytes_used;
+ FT_Byte* p;
FT_Memory memory = stream->memory;
FT_Error error;
@@ -272,68 +269,51 @@
if ( FT_QNEW_ARRAY( deltas, delta_cnt ) )
return NULL;
- i = 0;
- bytes_used = 0;
-
- while ( i < delta_cnt && bytes_used < size )
+ p = stream->cursor;
+ i = 0;
+ while ( i < delta_cnt )
{
- runcnt = FT_GET_BYTE();
+ if ( p >= stream->limit )
+ goto Fail;
+
+ runcnt = FT_NEXT_BYTE( p );
cnt = runcnt & GX_DT_DELTA_RUN_COUNT_MASK;
- bytes_used++;
+ /* first point not included in run count */
+ cnt++;
+ if ( cnt > delta_cnt - i )
+ cnt = delta_cnt - i;
if ( runcnt & GX_DT_DELTAS_ARE_ZERO )
{
- /* `cnt` + 1 zeroes get added */
- for ( j = 0; j <= cnt && i < delta_cnt; j++ )
+ for ( j = 0; j < cnt; j++ )
deltas[i++] = 0;
}
else if ( runcnt & GX_DT_DELTAS_ARE_WORDS )
{
- /* `cnt` + 1 shorts from the stack */
- bytes_used += 2 * ( cnt + 1 );
- if ( bytes_used > size )
- {
- FT_TRACE1(( "ft_var_readpackeddeltas:"
- " number of short deltas too large\n" ));
+ if ( 2 * cnt > (FT_UInt)( stream->limit - p ) )
goto Fail;
- }
- for ( j = 0; j <= cnt && i < delta_cnt; j++ )
- deltas[i++] = FT_intToFixed( FT_GET_SHORT() );
+ for ( j = 0; j < cnt; j++ )
+ deltas[i++] = FT_intToFixed( FT_NEXT_SHORT( p ) );
}
else
{
- /* `cnt` + 1 signed bytes from the stack */
- bytes_used += cnt + 1;
- if ( bytes_used > size )
- {
- FT_TRACE1(( "ft_var_readpackeddeltas:"
- " number of byte deltas too large\n" ));
+ if ( cnt > (FT_UInt)( stream->limit - p ) )
goto Fail;
- }
- for ( j = 0; j <= cnt && i < delta_cnt; j++ )
- deltas[i++] = FT_intToFixed( FT_GET_CHAR() );
- }
-
- if ( j <= cnt )
- {
- FT_TRACE1(( "ft_var_readpackeddeltas:"
- " number of deltas too large\n" ));
- goto Fail;
+ for ( j = 0; j < cnt; j++ )
+ deltas[i++] = FT_intToFixed( FT_NEXT_CHAR( p ) );
}
}
- if ( i < delta_cnt )
- {
- FT_TRACE1(( "ft_var_readpackeddeltas: not enough deltas\n" ));
- goto Fail;
- }
+ stream->cursor = p;
return deltas;
Fail:
+ FT_TRACE1(( "ft_var_readpackeddeltas: invalid table\n" ));
+
FT_FREE( deltas );
return NULL;
}
@@ -2135,7 +2115,7 @@
/* Convert delta in F2DOT14 to 16.16 before adding. */
v += MUL_INT( delta, 4 );
- /* Clamp value range [-1, 1]. */
+ /* Clamp value to range [-1, 1]. */
v = v >= 0x10000L ? 0x10000 : v;
v = v <= -0x10000L ? -0x10000 : v;
@@ -3604,9 +3584,8 @@
FT_Stream_SeekSet( stream, offsetToData );
- sharedpoints = ft_var_readpackedpoints( stream,
- table_len,
- &spoint_count );
+ sharedpoints = ft_var_readpackedpoints( stream, &spoint_count );
+
offsetToData = FT_Stream_FTell( stream );
FT_Stream_SeekSet( stream, here );
@@ -3680,9 +3659,7 @@
if ( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS )
{
- localpoints = ft_var_readpackedpoints( stream,
- table_len,
- &point_count );
+ localpoints = ft_var_readpackedpoints( stream, &point_count );
points = localpoints;
}
else
@@ -3693,14 +3670,13 @@
}
deltas = ft_var_readpackeddeltas( stream,
- table_len,
point_count == 0 ? face->cvt_size
: point_count );
if ( !points || !deltas )
; /* failure, ignore it */
- else if ( localpoints == ALL_POINTS )
+ else if ( points == ALL_POINTS )
{
#ifdef FT_DEBUG_LEVEL_TRACE
int count = 0;
@@ -3794,8 +3770,8 @@
for ( i = 0; i < face->cvt_size; i++ )
face->cvt[i] += FT_fixedToFdot6( cvt_deltas[i] );
- /* iterate over all FT_Size objects and set `cvt_ready' to -1 */
- /* to trigger rescaling of all CVT values */
+ /* Iterate over all `FT_Size` objects and set `cvt_ready` to -1 */
+ /* to trigger rescaling of all CVT values. */
FT_List_Iterate( &root->sizes_list,
tt_cvt_ready_iterator,
NULL );
@@ -4142,9 +4118,8 @@
FT_Stream_SeekSet( stream, offsetToData );
- sharedpoints = ft_var_readpackedpoints( stream,
- blend->gvar_size,
- &spoint_count );
+ sharedpoints = ft_var_readpackedpoints( stream, &spoint_count );
+
offsetToData = FT_Stream_FTell( stream );
FT_Stream_SeekSet( stream, here );
@@ -4228,9 +4203,7 @@
if ( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS )
{
- localpoints = ft_var_readpackedpoints( stream,
- blend->gvar_size,
- &point_count );
+ localpoints = ft_var_readpackedpoints( stream, &point_count );
points = localpoints;
}
else
@@ -4240,11 +4213,9 @@
}
deltas_x = ft_var_readpackeddeltas( stream,
- blend->gvar_size,
point_count == 0 ? n_points
: point_count );
deltas_y = ft_var_readpackeddeltas( stream,
- blend->gvar_size,
point_count == 0 ? n_points
: point_count );
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index 08aee62a8..8033edb50 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -949,11 +949,8 @@
FT_TRACE4(( "Executing `fpgm' table.\n" ));
error = face->interpreter( exec );
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( error )
- FT_TRACE4(( " interpretation failed with error code 0x%x\n",
- error ));
-#endif
+ FT_TRACE4(( error ? " failed (error code 0x%x)\n" : "",
+ error ));
}
else
error = FT_Err_Ok;
@@ -994,16 +991,16 @@
FT_Error error;
FT_UInt i;
- /* unscaled CVT values are already stored in 26.6 format */
- FT_Fixed scale = size->ttmetrics.scale >> 6;
-
/* Scale the cvt values to the new ppem. */
/* By default, we use the y ppem value for scaling. */
FT_TRACE6(( "CVT values:\n" ));
for ( i = 0; i < size->cvt_size; i++ )
{
- size->cvt[i] = FT_MulFix( face->cvt[i], scale );
+ /* Unscaled CVT values are already stored in 26.6 format. */
+ /* Note that this scaling operation is very sensitive to rounding; */
+ /* the integer division by 64 must be applied to the first argument. */
+ size->cvt[i] = FT_MulFix( face->cvt[i] / 64, size->ttmetrics.scale );
FT_TRACE6(( " %3d: %f (%f)\n",
i, (double)face->cvt[i] / 64, (double)size->cvt[i] / 64 ));
}
@@ -1035,11 +1032,8 @@
FT_TRACE4(( "Executing `prep' table.\n" ));
error = face->interpreter( exec );
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( error )
- FT_TRACE4(( " interpretation failed with error code 0x%x\n",
- error ));
-#endif
+ FT_TRACE4(( error ? " failed (error code 0x%x)\n" : "",
+ error ));
}
else
error = FT_Err_Ok;
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index c29e68251..b28976259 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -398,16 +398,12 @@
glyph->y_scale = 0x10000L;
}
- t1glyph->outline.n_points = 0;
- t1glyph->outline.n_contours = 0;
-
hinting = FT_BOOL( !( load_flags & FT_LOAD_NO_SCALE ) &&
!( load_flags & FT_LOAD_NO_HINTING ) );
scaled = FT_BOOL( !( load_flags & FT_LOAD_NO_SCALE ) );
glyph->hint = hinting;
glyph->scaled = scaled;
- t1glyph->format = FT_GLYPH_FORMAT_OUTLINE;
error = decoder_funcs->init( &decoder,
t1glyph->face,
@@ -452,16 +448,12 @@
must_finish_decoder = FALSE;
- /* now, set the metrics -- this is rather simple, as */
- /* the left side bearing is the xMin, and the top side */
- /* bearing the yMax */
if ( !error )
{
- t1glyph->outline.flags &= FT_OUTLINE_OWNER;
- t1glyph->outline.flags |= FT_OUTLINE_REVERSE_FILL;
-
- /* for composite glyphs, return only left side bearing and */
- /* advance width */
+ /* now, set the metrics -- this is rather simple, as */
+ /* the left side bearing is the xMin, and the top side */
+ /* bearing the yMax; for composite glyphs, return only */
+ /* left side bearing and advance width */
if ( load_flags & FT_LOAD_NO_RECURSE )
{
FT_Slot_Internal internal = t1glyph->internal;
@@ -482,6 +474,13 @@
FT_Glyph_Metrics* metrics = &t1glyph->metrics;
+ t1glyph->format = FT_GLYPH_FORMAT_OUTLINE;
+
+ t1glyph->outline.flags &= FT_OUTLINE_OWNER;
+ t1glyph->outline.flags |= FT_OUTLINE_REVERSE_FILL;
+ if ( t1size && t1size->metrics.y_ppem < 24 )
+ t1glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
+
/* copy the _unscaled_ advance width */
metrics->horiAdvance =
FIXED_TO_INT( decoder.builder.advance.x );
@@ -504,11 +503,6 @@
FIXED_TO_INT( decoder.builder.advance.y );
}
- t1glyph->format = FT_GLYPH_FORMAT_OUTLINE;
-
- if ( t1size && t1size->metrics.y_ppem < 24 )
- t1glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
-
#if 1
/* apply the font matrix, if any */
if ( font_matrix.xx != 0x10000L || font_matrix.yy != 0x10000L ||
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index 1a0f01949..74a06416c 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -359,8 +359,8 @@
if ( type_id == 0x8008U )
{
font_count = count;
- font_offset = FT_STREAM_POS() + 4 +
- (FT_ULong)( stream->cursor - stream->limit );
+ font_offset = FT_STREAM_POS() + 4 -
+ (FT_ULong)( stream->limit - stream->cursor );
break;
}
@@ -1006,7 +1006,7 @@
FT_UInt glyph_index,
FT_Int32 load_flags )
{
- FNT_Face face = (FNT_Face)FT_SIZE_FACE( size );
+ FNT_Face face = (FNT_Face)size->face;
FNT_Font font;
FT_Error error = FT_Err_Ok;
FT_Byte* p;
diff --git a/subprojects/libpng.wrap b/subprojects/libpng.wrap
index eb0785d9d..2c5f9c6a2 100644
--- a/subprojects/libpng.wrap
+++ b/subprojects/libpng.wrap
@@ -1,13 +1,13 @@
[wrap-file]
-directory = libpng-1.6.40
-source_url = https://github.com/glennrp/libpng/archive/v1.6.40.tar.gz
-source_filename = libpng-1.6.40.tar.gz
-source_hash = 62d25af25e636454b005c93cae51ddcd5383c40fa14aa3dae8f6576feb5692c2
-patch_filename = libpng_1.6.40-1_patch.zip
-patch_url = https://wrapdb.mesonbuild.com/v2/libpng_1.6.40-1/get_patch
-patch_hash = bad558070e0a82faa5c0ae553bcd12d49021fc4b628f232a8e58c3fbd281aae1
-source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/libpng_1.6.40-1/libpng-1.6.40.tar.gz
-wrapdb_version = 1.6.40-1
+directory = libpng-1.6.43
+source_url = https://github.com/glennrp/libpng/archive/v1.6.43.tar.gz
+source_filename = libpng-1.6.43.tar.gz
+source_hash = fecc95b46cf05e8e3fc8a414750e0ba5aad00d89e9fdf175e94ff041caf1a03a
+patch_filename = libpng_1.6.43-2_patch.zip
+patch_url = https://wrapdb.mesonbuild.com/v2/libpng_1.6.43-2/get_patch
+patch_hash = 49951297edf03e81d925ab03726555f09994ad1ed78fb539a269216430eef3da
+source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/libpng_1.6.43-2/libpng-1.6.43.tar.gz
+wrapdb_version = 1.6.43-2
[provide]
libpng = libpng_dep
diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap
index f9f118038..aa14de177 100644
--- a/subprojects/zlib.wrap
+++ b/subprojects/zlib.wrap
@@ -1,13 +1,13 @@
[wrap-file]
-directory = zlib-1.3
-source_url = http://zlib.net/fossils/zlib-1.3.tar.gz
-source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.3-1/zlib-1.3.tar.gz
-source_filename = zlib-1.3.tar.gz
-source_hash = ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e
-patch_filename = zlib_1.3-1_patch.zip
-patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3-1/get_patch
-patch_hash = ab9d6b8167bb34a7c52b60b0cd6138aa4e0c2d31f997343a5f506f3b97b32008
-wrapdb_version = 1.3-1
+directory = zlib-1.3.1
+source_url = http://zlib.net/fossils/zlib-1.3.1.tar.gz
+source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.3.1-1/zlib-1.3.1.tar.gz
+source_filename = zlib-1.3.1.tar.gz
+source_hash = 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23
+patch_filename = zlib_1.3.1-1_patch.zip
+patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.1-1/get_patch
+patch_hash = e79b98eb24a75392009cec6f99ca5cdca9881ff20bfa174e8b8926d5c7a47095
+wrapdb_version = 1.3.1-1
[provide]
zlib = zlib_dep
diff --git a/vms_make.com b/vms_make.com
index 65d2eb586..03ecc721c 100644
--- a/vms_make.com
+++ b/vms_make.com
@@ -221,77 +221,77 @@ $ deck
all :
- define config [--.include.freetype.config]
- define internal [--.include.freetype.internal]
- define autofit [-.autofit]
- define base [-.base]
- define cache [-.cache]
- define cff [-.cff]
- define cid [-.cid]
- define freetype [--.include.freetype]
- define pcf [-.pcf]
- define psaux [-.psaux]
- define psnames [-.psnames]
- define raster [-.raster]
- define sfnt [-.sfnt]
- define smooth [-.smooth]
- define truetype [-.truetype]
- define type1 [-.type1]
- define winfonts [-.winfonts]
- if f$search("lib.dir") .eqs. "" then create/directory [.lib]
- set default [.builds.vms]
- $(MMS)$(MMSQUALIFIERS)
- set default [--.src.autofit]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.base]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.bdf]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.cache]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.cff]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.cid]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.gxvalid]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.gzip]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.bzip2]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.lzw]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.otvalid]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.pcf]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.pfr]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.psaux]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.pshinter]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.psnames]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.raster]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.sfnt]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.smooth]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.svg]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.truetype]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.type1]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.type42]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.winfonts]
- $(MMS)$(MMSQUALIFIERS)
- set default [-.sdf]
- $(MMS)$(MMSQUALIFIERS)
- set default [--]
+ define config [--.include.freetype.config]
+ define internal [--.include.freetype.internal]
+ define autofit [-.autofit]
+ define base [-.base]
+ define cache [-.cache]
+ define cff [-.cff]
+ define cid [-.cid]
+ define freetype [--.include.freetype]
+ define pcf [-.pcf]
+ define psaux [-.psaux]
+ define psnames [-.psnames]
+ define raster [-.raster]
+ define sfnt [-.sfnt]
+ define smooth [-.smooth]
+ define truetype [-.truetype]
+ define type1 [-.type1]
+ define winfonts [-.winfonts]
+ if f$search("lib.dir") .eqs. "" then create/directory [.lib]
+ set default [.builds.vms]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [--.src.autofit]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.base]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.bdf]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.cache]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.cff]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.cid]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.gxvalid]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.gzip]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.bzip2]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.lzw]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.otvalid]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.pcf]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.pfr]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.psaux]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.pshinter]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.psnames]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.raster]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.sfnt]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.smooth]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.svg]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.truetype]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.type1]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.type42]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.winfonts]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [-.sdf]
+ $(MMS)$(MMSQUALIFIERS)
+ set default [--]
# EOF
$ eod
@@ -348,11 +348,11 @@ OBJS64=ftsystem_64.obj
OBJSCXX=ftsystem_cxx.obj
all : $(OBJS)
- library/create [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library/create [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library/create [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library/create [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
ftsystem.obj : ftsystem.c ftconfig.h
@@ -411,11 +411,11 @@ OBJS64=autofit_64.obj
OBJSCXX=autofit_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -518,11 +518,11 @@ OBJSCXX=ftbase_cxx.obj,\
ftwinfnt_cxx.obj,ftpatent_cxx.obj,ftgxval_cxx.obj,ftotval_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
ftbase.obj : ftbase.c ftadvanc.c ftcalc.c ftcolor.c ftdbgmem.c fterrors.c\
@@ -585,11 +585,11 @@ OBJS64=bdf_64.obj
OBJSCXX=bdf_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -647,11 +647,11 @@ OBJS64=ftcache_64.obj
OBJSCXX=ftcache_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
ftcache.obj : ftcache.c ftcbasic.c ftccache.c ftccmap.c ftcglyph.c ftcimage.c \
@@ -712,11 +712,11 @@ OBJS64=cff_64.obj
OBJSCXX=cff_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -774,11 +774,11 @@ OBJS64=type1cid_64.obj
OBJSCXX=type1cid_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -836,11 +836,11 @@ OBJS64=gxvalid_64.obj
OBJSCXX=gxvalid_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -897,11 +897,11 @@ OBJS64=ftgzip_64.obj
OBJSCXX=ftgzip_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -960,11 +960,11 @@ OBJS64=ftbzip2_64.obj
OBJSCXX=ftbzip2_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -1021,11 +1021,11 @@ OBJS64=ftlzw_64.obj
OBJSCXX=ftlzw_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -1083,11 +1083,11 @@ OBJS64=otvalid_64.obj
OBJSCXX=otvalid_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -1157,11 +1157,11 @@ OBJS64=pcf_64.obj
OBJSCXX=pcf_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -1219,11 +1219,11 @@ OBJS64=pfr_64.obj
OBJSCXX=pfr_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -1281,11 +1281,11 @@ OBJS64=psaux_64.obj
OBJSCXX=psaux_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -1343,11 +1343,11 @@ OBJS64=pshinter_64.obj
OBJSCXX=pshinter_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -1405,11 +1405,11 @@ OBJS64=psnames_64.obj
OBJSCXX=psnames_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -1467,11 +1467,11 @@ OBJS64=raster_64.obj
OBJSCXX=raster_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -1499,7 +1499,8 @@ $ deck
CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.sfnt])
.ifdef X86
-CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] -Isys$library
+CXXFLAGS=$(CXXCOMP_FLAGS) -I[] -I[--.include] -I[--.src.base] -Isys$library\
+ -Wno-incompatible-pointer-types
.endif
.ifdef X86
@@ -1529,11 +1530,11 @@ OBJS64=sfnt_64.obj
OBJSCXX=sfnt_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -1591,11 +1592,11 @@ OBJS64=smooth_64.obj
OBJSCXX=smooth_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -1653,11 +1654,11 @@ OBJS64=svg_64.obj
OBJSCXX=svg_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -1715,11 +1716,11 @@ OBJS64=truetype_64.obj
OBJSCXX=truetype_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -1777,11 +1778,11 @@ OBJS64=type1_64.obj
OBJSCXX=type1_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
type1.obj : type1.c t1parse.c t1load.c t1objs.c t1driver.c t1gload.c t1afm.c
@@ -1841,11 +1842,11 @@ OBJS64=sdf_64.obj
OBJSCXX=sdf_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
sdf.obj : sdf.c ftbsdf.c ftsdf.c ftsdfcommon.c ftsdfrend.c
@@ -1905,11 +1906,11 @@ OBJS64=type42_64.obj
OBJSCXX=type42_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -1967,11 +1968,11 @@ OBJS64=winfnt_64.obj
OBJSCXX=winfnt_cxx.obj
all : $(OBJS)
- library [--.lib]freetype.olb $(OBJS)
- library [--.lib]freetype.olb $(OBJS64)
+ library [--.lib]freetype.olb $(OBJS)
+ library [--.lib]freetype.olb $(OBJS64)
.ifdef X86
- library [--.lib]freetype_cxx.olb $(OBJSCXX)
- library [--.lib]freetype_cxx.olb $(OBJS64)
+ library [--.lib]freetype_cxx.olb $(OBJSCXX)
+ library [--.lib]freetype_cxx.olb $(OBJS64)
.endif
# EOF
@@ -2014,7 +2015,7 @@ $ len = f$length(cparm) - start
$ cc_com = f$extract(start,len,cparm)
if (cc_com .nes. "DECC") .and. -
(cc_com .nes. "VAXC") .and. -
- (cc_com .nes. "GNUC")
+ (cc_com .nes. "GNUC")
$ then
$ write sys$output "Unsupported compiler choice ''cc_com' ignored"
$ write sys$output "Use DECC, VAXC, or GNUC instead"