diff --git a/.gitignore b/.gitignore index b5db9d874..a47f568e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ config.mk objs/vc2010/ +build diff --git a/.mailmap b/.mailmap index 233b65704..c406e23a4 100644 --- a/.mailmap +++ b/.mailmap @@ -6,3 +6,4 @@ Suzuki, Toshiya (鈴木俊哉) sssa Suzuki, Toshiya (鈴木俊哉) suzuki toshiya Ben Wagner Bungeman +Ewald Hew (Hew Yih Shiuan 丘毅宣) diff --git a/CMakeLists.txt b/CMakeLists.txt index 63f576701..95daeb78d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # CMakeLists.txt # -# Copyright 2013-2017 by +# Copyright 2013-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # Written originally by John Cary @@ -12,35 +12,40 @@ # fully. # # -# As a preliminary, create a compilation directory and change into it, for -# example +# The following will 1. create a build directory and 2. change into it and +# call cmake to configure the build with default parameters as a static +# library. # -# mkdir ~/freetype2.compiled -# cd ~/freetype2.compiled -# -# Now you can say -# -# cmake -# -# to create a Makefile that builds a static version of the library. +# cmake -E make_directory build +# cmake -E chdir build cmake .. # # For a dynamic library, use # -# cmake -D BUILD_SHARED_LIBS:BOOL=true +# cmake -E chdir build cmake -D BUILD_SHARED_LIBS:BOOL=true .. # # For a framework on OS X, use # -# cmake -D BUILD_FRAMEWORK:BOOL=true -G Xcode -# -# instead. +# cmake -E chdir build cmake -G Xcode -D BUILD_FRAMEWORK:BOOL=true .. # # For an iOS static library, use # -# cmake -D IOS_PLATFORM=OS -G Xcode +# cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=OS .. # # or # -# cmake -D IOS_PLATFORM=SIMULATOR -G Xcode +# cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=SIMULATOR .. +# +# Finally, build the project with: +# +# cmake --build build +# +# Install it with +# +# (sudo) cmake --build build --target install +# +# A binary distribution can be made with +# +# cmake --build build --config Release --target package # # Please refer to the cmake manual for further options, in particular, how # to modify compilation and linking parameters. @@ -59,28 +64,33 @@ # . `CMakeLists.txt' is provided as-is since it is normally not used by the # developer team. # -# . If you want to disable the automatic generation of the distribution -# targets, add the `-D FREETYPE_NO_DIST=true' command line argument. -# -# . Set the `WITH_ZLIB', `WITH_BZip2', `WITH_PNG', and `WITH_HarfBuzz' -# CMake variables to `ON' or `OFF' to force or skip using a dependency. +# . Set the `FT_WITH_ZLIB', `FT_WITH_BZIP2', `FT_WITH_PNG', and +# `FT_WITH_HARFBUZZ' CMake variables to `ON' to force using a dependency. # Leave a variable undefined (which is the default) to use the dependency -# only if it is available. Example: +# only if it is available. Set `CMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE' to +# disable a dependency completely (CMake package name, so `BZip2' instead of +# `BZIP2'). Example: # -# cmake ... -DWITH_ZLIB=ON -DWITH_HarfBuzz=OFF ... +# cmake -DFT_WITH_ZLIB=ON -DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE [...] # # . Installation of FreeType can be controlled with the CMake variables # `SKIP_INSTALL_HEADERS', `SKIP_INSTALL_LIBRARIES', and `SKIP_INSTALL_ALL' # (this is compatible with the same CMake variables in zlib's CMake # support). +# FreeType explicitly marks the API to be exported and relies on the compiler +# to hide all other symbols. CMake supports a C_VISBILITY_PRESET property +# starting with 2.8.12. +cmake_minimum_required(VERSION 2.8.12) -cmake_minimum_required(VERSION 2.6) - +if (NOT CMAKE_VERSION VERSION_LESS 3.3) + # Allow symbol visibility settings also on static libraries. CMake < 3.3 + # only sets the propery on a shared library build. + cmake_policy(SET CMP0063 NEW) +endif () include(CheckIncludeFile) - # CMAKE_TOOLCHAIN_FILE must be set before `project' is called, which # configures the base build environment and references the toolchain file if (APPLE) @@ -116,30 +126,47 @@ else () endif () -project(freetype) +project(freetype C) +set(VERSION_MAJOR "2") +set(VERSION_MINOR "9") +set(VERSION_PATCH "0") + +# SOVERSION scheme: CURRENT.AGE.REVISION +# If there was an incompatible interface change: +# Increment CURRENT. Set AGE and REVISION to 0 +# If there was a compatible interface change: +# Increment AGE. Set REVISION to 0 +# If the source code was changed, but there were no interface changes: +# Increment REVISION. +set(LIBRARY_VERSION "6.16.0") +set(LIBRARY_SOVERSION "6") + +# These options mean "require x and complain if not found". They'll get +# optionally found anyway. Use `-DCMAKE_DISABLE_FIND_PACKAGE_x=TRUE` to disable +# searching for a packge entirely (x is the CMake package name, so "BZip2" +# instead of "BZIP2"). +option(FT_WITH_ZLIB "Use system zlib instead of internal library." OFF) +option(FT_WITH_BZIP2 "Support bzip2 compressed fonts." OFF) +option(FT_WITH_PNG "Support PNG compressed OpenType embedded bitmaps." OFF) +option(FT_WITH_HARFBUZZ "Improve auto-hinting of OpenType fonts." OFF) -if (WIN32 AND NOT MINGW AND BUILD_SHARED_LIBS) - message(FATAL_ERROR "Building shared libraries on Windows needs MinGW") -endif () # Disallow in-source builds if ("${PROJECT_BINARY_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}") message(FATAL_ERROR - " -In-source builds are not permitted! Make a separate folder for" - " building, e.g.," - " - mkdir build; cd build; cmake .." - " -Before that, remove the files created by this failed run with" - " - rm -rf CMakeCache.txt CMakeFiles") + "In-source builds are not permitted! Make a separate folder for" + " building, e.g.,\n" + " cmake -E make_directory build\n" + " cmake -E chdir build cmake ..\n" + "Before that, remove the files created by this failed run with\n" + " cmake -E remove CMakeCache.txt\n" + " cmake -E remove_directory CMakeFiles") endif () # Add local cmake modules -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/builds/cmake) +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/builds/cmake) if (BUILD_FRAMEWORK) @@ -152,45 +179,32 @@ if (BUILD_FRAMEWORK) endif () -set(VERSION_MAJOR "2") -set(VERSION_MINOR "7") -set(VERSION_PATCH "1") - -set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) -set(SHARED_LIBRARY_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}) - - -# Compiler definitions for building the library -add_definitions(-DFT2_BUILD_LIBRARY) - - # Find dependencies -foreach (d ZLIB BZip2 PNG HarfBuzz) - string(TOUPPER "${d}" D) - - if (DEFINED WITH_${d} OR DEFINED WITH_${D}) - if (WITH_${d} OR WITH_${D}) - find_package(${d} QUIET REQUIRED) - endif () - else () - find_package(${d} QUIET) - endif () - - if (${d}_FOUND OR ${D}_FOUND) - message(STATUS "Building with ${d}") - endif () -endforeach () +if (FT_WITH_HARFBUZZ) + find_package(HarfBuzz 1.3.0 REQUIRED) +else () + find_package(HarfBuzz 1.3.0) +endif () +if (FT_WITH_PNG) + find_package(PNG REQUIRED) +else () + find_package(PNG) +endif () -message(STATUS - "Creating directory ${PROJECT_BINARY_DIR}/include/freetype/config") -file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/include/freetype/config") +if (FT_WITH_ZLIB) + find_package(ZLIB REQUIRED) +else () + find_package(ZLIB) +endif () +if (FT_WITH_BZIP2) + find_package(BZip2 REQUIRED) +else () + find_package(BZip2) +endif () # Create the configuration file -message(STATUS - "Creating file ${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h") - if (UNIX) check_include_file("unistd.h" HAVE_UNISTD_H) check_include_file("fcntl.h" HAVE_FCNTL_H) @@ -200,38 +214,27 @@ if (UNIX) FTCONFIG_H) if (HAVE_UNISTD_H) string(REGEX REPLACE - "#undef +(HAVE_UNISTD_H)" "#define \\1" + "#undef +(HAVE_UNISTD_H)" "#define \\1 1" FTCONFIG_H "${FTCONFIG_H}") endif () if (HAVE_FCNTL_H) string(REGEX REPLACE - "#undef +(HAVE_FCNTL_H)" "#define \\1" + "#undef +(HAVE_FCNTL_H)" "#define \\1 1" FTCONFIG_H "${FTCONFIG_H}") endif () if (HAVE_STDINT_H) string(REGEX REPLACE - "#undef +(HAVE_STDINT_H)" "#define \\1" + "#undef +(HAVE_STDINT_H)" "#define \\1 1" FTCONFIG_H "${FTCONFIG_H}") endif () string(REPLACE "/undef " "#undef " FTCONFIG_H "${FTCONFIG_H}") - file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h-new" - "${FTCONFIG_H}") -else () - file(READ "${PROJECT_SOURCE_DIR}/include/freetype/config/ftconfig.h" - FTCONFIG_H) - file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h-new" + file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h" "${FTCONFIG_H}") endif () -execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h-new" - "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h") # Create the options file -message(STATUS - "Creating file ${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h") - file(READ "${PROJECT_SOURCE_DIR}/include/freetype/config/ftoption.h" FTOPTION_H) if (ZLIB_FOUND) @@ -254,16 +257,8 @@ if (HARFBUZZ_FOUND) "/\\* +(#define +FT_CONFIG_OPTION_USE_HARFBUZZ) +\\*/" "\\1" FTOPTION_H "${FTOPTION_H}") endif () -file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h-new" +file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h" "${FTOPTION_H}") -execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h-new" - "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h") - - -# Specify library include directories -include_directories("${PROJECT_SOURCE_DIR}/include") -include_directories(BEFORE "${PROJECT_BINARY_DIR}/include") file(GLOB PUBLIC_HEADERS "include/ft2build.h" "include/freetype/*.h") @@ -278,13 +273,11 @@ set(BASE_SRCS src/base/ftbdf.c src/base/ftbitmap.c src/base/ftcid.c - src/base/ftfntfmt.c src/base/ftfstype.c src/base/ftgasp.c src/base/ftglyph.c src/base/ftgxval.c src/base/ftinit.c - src/base/ftlcdfil.c src/base/ftmm.c src/base/ftotval.c src/base/ftpatent.c @@ -316,22 +309,24 @@ set(BASE_SRCS ) if (WIN32) - set(BASE_SRCS ${BASE_SRCS} builds/windows/ftdebug.c) + enable_language(RC) + list(APPEND BASE_SRCS builds/windows/ftdebug.c + src/base/ftver.rc) elseif (WINCE) - set(BASE_SRCS ${BASE_SRCS} builds/wince/ftdebug.c) + list(APPEND BASE_SRCS builds/wince/ftdebug.c) else () - set(BASE_SRCS ${BASE_SRCS} src/base/ftdebug.c) + list(APPEND BASE_SRCS src/base/ftdebug.c) endif () - if (BUILD_FRAMEWORK) - set(BASE_SRCS - ${BASE_SRCS} - builds/mac/freetype-Info.plist - ) + list(APPEND BASE_SRCS builds/mac/freetype-Info.plist) endif () -set(CMAKE_DEBUG_POSTFIX d) + +if (NOT DISABLE_FORCE_DEBUG_POSTFIX) + set(CMAKE_DEBUG_POSTFIX d) +endif() + add_library(freetype ${PUBLIC_HEADERS} @@ -340,15 +335,35 @@ add_library(freetype ${BASE_SRCS} ) +set_target_properties( + freetype PROPERTIES + C_VISIBILITY_PRESET hidden) + +target_compile_definitions( + freetype PRIVATE FT2_BUILD_LIBRARY) + +if (WIN32) + target_compile_definitions( + freetype PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) +endif () if (BUILD_SHARED_LIBS) set_target_properties(freetype PROPERTIES - VERSION ${PROJECT_VERSION} - SOVERSION ${SHARED_LIBRARY_VERSION} - COMPILE_DEFINITIONS freetype_EXPORTS - ) + VERSION ${LIBRARY_VERSION} + SOVERSION ${LIBRARY_SOVERSION}) endif () +target_include_directories( + freetype BEFORE # Pick up ftconfig.h and ftoption.h generated above. + PRIVATE "${PROJECT_BINARY_DIR}/include") + +target_include_directories( + freetype + PRIVATE "${PROJECT_SOURCE_DIR}/include") + +target_include_directories( + freetype + PUBLIC $) if (BUILD_FRAMEWORK) set_property(SOURCE ${PUBLIC_CONFIG_HEADERS} @@ -362,91 +377,121 @@ if (BUILD_FRAMEWORK) ) endif () -if (NOT CMAKE_VERSION VERSION_LESS 2.8.12) - target_include_directories(freetype - PUBLIC $) -endif () -if (CMAKE_VERSION VERSION_LESS 2.8.12) - set(MAYBE_PRIVATE "") -else () - set(MAYBE_PRIVATE "PRIVATE") -endif () +set(PKG_CONFIG_REQUIRED_PRIVATE "") if (ZLIB_FOUND) - target_link_libraries(freetype ${MAYBE_PRIVATE} ${ZLIB_LIBRARIES}) - include_directories(${ZLIB_INCLUDE_DIRS}) + target_link_libraries(freetype PRIVATE ${ZLIB_LIBRARIES}) + target_include_directories(freetype PRIVATE ${ZLIB_INCLUDE_DIRS}) + list(APPEND PKG_CONFIG_REQUIRED_PRIVATE zlib) endif () if (BZIP2_FOUND) - target_link_libraries(freetype ${MAYBE_PRIVATE} ${BZIP2_LIBRARIES}) - include_directories(${BZIP2_INCLUDE_DIR}) # not BZIP2_INCLUDE_DIRS + target_link_libraries(freetype PRIVATE ${BZIP2_LIBRARIES}) + target_include_directories(freetype PRIVATE ${BZIP2_INCLUDE_DIR}) # not BZIP2_INCLUDE_DIRS + list(APPEND PKG_CONFIG_REQUIRED_PRIVATE bzip2) endif () if (PNG_FOUND) - add_definitions(${PNG_DEFINITIONS}) - target_link_libraries(freetype ${MAYBE_PRIVATE} ${PNG_LIBRARIES}) - include_directories(${PNG_INCLUDE_DIRS}) + target_link_libraries(freetype PRIVATE ${PNG_LIBRARIES}) + target_compile_definitions(freetype PRIVATE ${PNG_DEFINITIONS}) + target_include_directories(freetype PRIVATE ${PNG_INCLUDE_DIRS}) + list(APPEND PKG_CONFIG_REQUIRED_PRIVATE libpng) endif () if (HARFBUZZ_FOUND) - target_link_libraries(freetype ${MAYBE_PRIVATE} ${HARFBUZZ_LIBRARIES}) - include_directories(${HARFBUZZ_INCLUDE_DIRS}) + target_link_libraries(freetype PRIVATE ${HARFBUZZ_LIBRARIES}) + target_include_directories(freetype PRIVATE ${HARFBUZZ_INCLUDE_DIRS}) + list(APPEND PKG_CONFIG_REQUIRED_PRIVATE harfbuzz) endif () -# Installations -# Note the trailing slash in the argument to the `DIRECTORY' directive +# Installation +include(GNUInstallDirs) + if (NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ - DESTINATION include/freetype2 - PATTERN "internal" EXCLUDE - PATTERN "ftconfig.h" EXCLUDE - PATTERN "ftoption.h" EXCLUDE - ) - install(FILES - ${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h - ${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h - DESTINATION include/freetype2/freetype/config - ) + install( + # Note the trailing slash in the argument to `DIRECTORY'! + DIRECTORY ${PROJECT_SOURCE_DIR}/include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/freetype2 + COMPONENT headers + PATTERN "internal" EXCLUDE + PATTERN "ftconfig.h" EXCLUDE + PATTERN "ftoption.h" EXCLUDE) + install( + FILES ${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h + ${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/freetype2/freetype/config + COMPONENT headers) endif () if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) - install(TARGETS freetype + # Generate the pkg-config file + if (UNIX) + file(READ ${PROJECT_SOURCE_DIR}/builds/unix/freetype2.in FREETYPE2_PC_IN) + + string(REPLACE ";" ", " PKG_CONFIG_REQUIRED_PRIVATE "${PKG_CONFIG_REQUIRED_PRIVATE}") + + string(REPLACE "%prefix%" ${CMAKE_INSTALL_PREFIX} + FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) + string(REPLACE "%exec_prefix%" "\${prefix}" + FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) + string(REPLACE "%libdir%" "\${prefix}/${CMAKE_INSTALL_LIBDIR}" + FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) + string(REPLACE "%includedir%" "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}" + FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) + string(REPLACE "%ft_version%" "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" + FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) + string(REPLACE "%REQUIRES_PRIVATE%" "${PKG_CONFIG_REQUIRED_PRIVATE}" + FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) + string(REPLACE "%LIBS_PRIVATE%" "" # All libs support pkg-config + FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) + + file(WRITE ${PROJECT_BINARY_DIR}/freetype2.pc ${FREETYPE2_PC_IN}) + + install( + FILES ${PROJECT_BINARY_DIR}/freetype2.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + COMPONENT pkgconfig) + endif () + + install( + TARGETS freetype + EXPORT freetype-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + FRAMEWORK DESTINATION Library/Frameworks + COMPONENT libraries) + install( EXPORT freetype-targets - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - FRAMEWORK DESTINATION Library/Frameworks - ) - install(EXPORT freetype-targets - DESTINATION lib/cmake/freetype - FILE freetype-config.cmake - ) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype + FILE freetype-config.cmake + COMPONENT headers) endif () # Packaging -# CPack version numbers for release tarball name. +set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME}) +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The FreeType font rendering library.") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/docs/LICENSE.TXT") + set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) -set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}}) -if (NOT DEFINED CPACK_PACKAGE_DESCRIPTION_SUMMARY) - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CMAKE_PROJECT_NAME}") -endif () -if (NOT DEFINED CPACK_SOURCE_PACKAGE_FILE_NAME) - set(CPACK_SOURCE_PACKAGE_FILE_NAME - "${CMAKE_PROJECT_NAME}-${PROJECT_VERSION}-r${PROJECT_REV}" - CACHE INTERNAL "tarball basename" - ) -endif () -set(CPACK_SOURCE_GENERATOR TGZ) -set(CPACK_SOURCE_IGNORE_FILES - "/CVS/;/.svn/;.swp$;.#;/#;/build/;/serial/;/ser/;/parallel/;/par/;~;/preconfig.out;/autom4te.cache/;/.config") -set(CPACK_GENERATOR TGZ) -include(CPack) +set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}) +set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") +if (WIN32) + set(CPACK_GENERATOR ZIP) +else() + set(CPACK_GENERATOR TGZ) +endif() + +set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") +set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C/C++ Headers") +set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION + "Library used to build programs which use FreeType") +set(CPACK_COMPONENT_HEADERS_DESCRIPTION + "C/C++ header files for use with FreeType") +set(CPACK_COMPONENT_HEADERS_DEPENDS libraries) +set(CPACK_COMPONENT_LIBRARIES_GROUP "Development") +set(CPACK_COMPONENT_HEADERS_GROUP "Development") -# Add `make dist' target if FREETYPE_DIST is set (which is the default) -if (NOT DEFINED FREETYPE_NO_DIST) - add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) -endif () - -# eof +include(CPack) diff --git a/ChangeLog b/ChangeLog index fae5e1ae4..1b86d6025 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,1053 +1,504 @@ -2017-04-02 Alexei Podtelezhnikov +2018-04-26 Werner Lemberg - [autofit] Handle LCD lightly. + Another fix for handling invalid format 2 cmaps. - This commit explicitly disables stem adjustment and metrics changes - for FT_LOAD_TARGET_LCD, redoing the last commit. - - * include/freetype/freetype.h (FT_LOAD_TARGET_XXX): Docs updated. - * src/autofit/afcjk.c (af_cjk_hints_init): Updated. - * src/autofit/aflatin.c (af_latin_hints_init): Updated. - * src/autofit/aflatin2.c (af_latin2_hints_init): Updated. - -2017-03-30 Alexei Podtelezhnikov - - [autofit] LCD equals LIGHT, LCD_V equals NORMAL. - - * include/freetype/freetype.h (FT_LOAD_TARGET_XXX): Docs updated. - * src/autofit/afcjk.c (af_cjk_hints_init): Updated. - * src/autofit/aflatin.c (af_latin_hints_init): Updated. - * src/autofit/aflatin2.c (af_latin2_hints_init): Updated. - -2017-03-12 Alexei Podtelezhnikov - - [smooth] Dubious fix for Firefox. - - * src/base/ftlcdfil.c (FT_Library_SetLcdFilter{,Weights}) - [!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Return FT_Err_Ok instead of - FT_Err_Unimplemented_Feature. - * include/freetype/ftlcdfil.h: Documentation updated. - -2017-03-08 Alexei Podtelezhnikov - - [smooth] Harmony itself. - - This is a new technology for LCD-optimized rendering. It capitalizes - on the fact that each color channel grid is shifted by a third of a - pixel. Therefore it is logical to render 3 separate monochrome - bitmaps shifting the outline by 1/3 pixel, and then combine them. - Importantly, the resulting output does not require additional LCD - filtering. - - * src/smooth/ftsmooth.c (ft_smooth_render_generic) - [!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Implement new LCD-optimized - rendering. - - * include/freetype/ftlcdfil.h, include/freetype/freetype.h, - include/freetype/config/ftoption.h, devel/ftoption.h: Updated - documentation. - -2017-03-08 Alexei Podtelezhnikov - - [smooth] Groundwork for Harmony. - - * src/smooth/ftsmooth.c (ft_smooth_render_generic): Apply consistent - LCD padding regardless of `FT_CONFIG_OPTION_SUBPIXEL_RENDERING'. - - * devel/ftoption.h: Comment out `FT_CONFIG_OPTION_SUBPIXEL_RENDERING'. - -2017-03-08 Werner Lemberg - - [sfnt] Another fix for buggy variation fonts. + Sigh. Reported as - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=759 - - * src/sfnt/sfobjs.c (sfnt_init_face): While setting number of - instances to zero for `CFF' fonts table, ensure that there is no - `CFF2' present also (which gets priority). - -2017-03-07 Werner Lemberg - - [sfnt] Improve handling for buggy variation fonts. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=738 - - * src/sfnt/sfobjs.c (sfnt_init_face): While setting number of - instances to zero for `CFF' fonts table, ensure that there is no `glyf' - present also (which gets priority). - -2017-03-06 Werner Lemberg - - [sfnt, truetype] Always provide default instance. - - As documented in the OpenType specification, an entry for the - default instance may be omitted in the named instance table. In - particular this means that even if there is no named instance table - in the font we actually do have a named instance, namely the default - instance. - - For consistency, we always want the default instance in our list of - named instances. If it is missing, we try to synthesize it. - - * src/sfnt/sfobjs.c (sfnt_init_face): Check whether the default - instance is in the table of named instances. Otherwise adjust - number of instances. - - * src/truetype/ttgxvar.c: Include FT_TRUETYPE_IDS_H. - (TT_Get_MM_Var): Use `face->root.style_flags' as the number of named - instances. - Sythesize a named instance entry if necessary. - (tt_done_blend): Free `normalized_stylecoords'. - -2017-03-05 Werner Lemberg - - [sfnt] Remove redundant code. - - * src/sfnt/sfobjs.c (sfnt_init_face): Remove second test for - `num_instances', which will always succeed. - -2017-03-04 Werner Lemberg - - [sfnt] Add `get_name_id' service. - - * include/freetype/internal/sfnt.h (TT_Get_Name_ID_Func): New - typedef. - (SFNT_Interface): Add `get_name_id' field. - (FT_DEFINE_SFNT_INTERFACE): Updated. - - * src/sfnt/sfdriver.c (search_name_id): Rename to... - (sfnt_get_name_id): ... this. - (sfnt_get_ps_name, sfnt_interface): Udpated. - -2017-03-04 Werner Lemberg - - [truetype] Make `TT_Set_MM_Blend' set named instance index. - - * src/truetype/ttgxvar.h (GX_Blend): New array - `normalized_stylecoords'. - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Allocate and fill - `normalized_stylecoords'. - (TT_Set_MM_Blend): Check instance tuple and adjust `face_index' - accordingly. - -2017-03-02 Werner Lemberg - - [truetype] Split off designer/normalized conversion routines. - - * src/truetype/ttgxvar.c (TT_Set_Var_Design): Split off conversion - code designer->normalized coordinates to... - (ft_var_to_normalized): ... New function. - (TT_Get_Var_Design): Split off conversion code normalized->designer - coordinates to... - (ft_var_to_design): ... New function. - -2017-02-28 Werner Lemberg - - [sfnt] Further generalize `sfnt_get_ps_name'; report invalid data. - - * src/sfnt/sfdriver.c (sfnt_ps_map): New array. - (sfnt_is_postscript): New function. - (char_type_func): New typedef. - (get_win_string, get_apple_string): Add argument to specify - character checking function. - Add argument whether argument checking failures should be reported. - Update callers. - (search_name_id): Fix return value. - -2017-02-23 Werner Lemberg - - [sfnt] Split off another bit of `sfnt_get_ps_name'. - - * src/sfnt/sfdriver.c (sfnt_get_ps_name): Split off some - functionality into... - (search_name_id): ... New function. - -2017-02-23 Werner Lemberg - - [sfnt] Modularize `sfnt_get_ps_name'. - - * src/sfnt/sfdriver.c (sfnt_get_ps_name): Split off some - functionality into... - (IS_WIN, IS_APPLE): ... New macros. - (get_win_string, get_apple_string): ... New functions. - -2017-02-23 Werner Lemberg - - [truetype] Minor improvement. - - * src/truetype/ttgload.c (TT_Process_Simple_Glyph, - load_truetype_glyph): Remove unnecessary tests. - -2017-02-23 Werner Lemberg - - * include/freetype/internal/tttypes.h (TT_Face): s/isCFF2/is_cff2/. - - For orthogonality with other structure field names. - - Update all users. - -2017-02-22 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_hline): Improve code. - -2017-02-20 Dominik Röttsches - - Fix some `ttnameid.h' entries (#50313). - - * include/freetype/ttnameid.h: - s/TT_MS_LANGID_SPANISH_INTERNATIONAL_SORT/TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT/, - s/TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIA/TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN/. - -2017-02-20 Werner Lemberg - - [cff] Finish support for `random' operator. - - * src/cff/cfftypes.h (CFF_SubFontRec): Add `random' field. - - * src/cff/cffobjs.c: Updated. - (cff_driver_init): Initialize random seed value. - - * src/cff/cffload.c (cff_random): New function. - (cff_subfont_load): Add `face' argument. - Update all callers. - Initialize random number generator with a proper seed value. - (cff_font_load): Add `face' argument. - Update all callers. - - * src/cff/cffload.h: Updated. - - * src/cff/cf2intrp.c (CF2_FIXME): Removed. - (cf2_interpT2CharString) : Implement opcode. - - * src/cff/cffgload.c (cff_decoder_parse_charstrings): Don't - initialize random seed value. - : Use new random seed framework. - -2017-02-20 Werner Lemberg - - [cff] Sanitize `initialRandomSeed'. - - * src/cff/cffload.c (cff_load_private_dict): Make - `initial_random_seed' value always positive. - -2017-02-20 Werner Lemberg - - [cff] Introduce `random-seed' property (2/2). - - * src/base/ftobjs.c: Include `FT_CFF_DRIVER_H'. - (open_face): Initialize `face->internal->random_seed'. - (FT_Face_Properties): Handle `FT_PARAM_TAG_RANDOM_SEED'. - - * src/cff/cffdrivr.c (cff_property_set): Handle `random-seed' - property. - -2017-02-20 Werner Lemberg - - [cff] Introduce `random-seed' property (1/2). - - We need this for support of the `random' operator. - - * include/freetype/ftcffdrv.h (FT_PARAM_TAG_RANDOM_SEED): New macro. - - * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New - field `random_seed'. - - * src/cff/cffobjs.h (CFF_DriverRec): New field `random_seed'. - -2017-02-17 Werner Lemberg - - Remove clang warnings. - - * src/autofit/aflatin.c (af_latin_sort_blue): Add missing `static' - keyword. - - * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, - FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): - Initialize some variables. - -2017-02-16 Nikolaus Waxweiler - Werner Lemberg - - Add face property for stem darkening. - - * include/freetype/ftautoh.h (FT_PARAM_TAG_STEM_DARKENING): New - macro. - - * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Add - `no_stem_darkening' field. - - * src/autofit/afloader.c (af_loader_load_glyph), - src/autofit/afmodule.c (af_property_set): Updated. - - * src/base/ftobjs.c: Include FT_AUTOHINTER_H. - (ft_open_face_internal): Updated. - (FT_Face_Properties): Handle FT_PARAM_TAG_STEM_DARKENING. - - * src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Updated. - - * src/cff/cffdrivr.c (cff_property_set): Updated. - -2017-02-16 Nikolaus Waxweiler - Werner Lemberg - - Add face property for LCD filter weights. + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8003 - * include/freetype/ftlcdfil.h (FT_PARAM_TAG_LCD_FILTER_WEIGHTS, - FT_LCD_FILTER_FIVE_TAPS): New macros. - (FT_LcdFiveTapFilter): New typedef. + * src/sfnt/ttcmap.c (tt_cmap2_char_next): Adjust condition to avoid + an endless loop. - * include/freetype/ftobjs.h (FT_Face_InternalRec) - [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Add `lcd_weights' field. - (FT_Bitmap_LcdFilterFunc): Change third argument to weights array. - (ft_lcd_filter_fir): New prototype. - (FT_LibraryRec): Updated. +2018-04-24 Ben Wagner - * src/base/ftlcdfil.c (_ft_lcd_filter_fir): Renamed to... - (ft_lcd_filter_dir): ... this base function. - Updated. - (_ft_lcd_filter_legacy): Updated. - (FT_Library_SetLcdFilterWeights, FT_Library_SetLcdFilter): Updated. - - * src/base/ftobjs.c (ft_open_face_internal): Updated. - (FT_Face_Properties): Handle FT_PARAM_TAG_LCD_FILTER_WEIGHTS. - - * src/smooth/ftsmooth.c (ft_smooth_render_generic) - [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Handle LCD weights from - `FT_Face_Internal'. - -2017-02-14 Nikolaus Waxweiler - Werner Lemberg - - Add new function `FT_Face_Properties'. - - This commit provides the framework, to be filled with something - useful in the next commits. - - * include/freetype/freetype.h (FT_Face_Properties): Declare. - - * src/base/ftobjs.c (FT_Face_Properties): New function. - -2017-02-13 Werner Lemberg - - [autofit] Prevent overlapping blue zones. - - Problem reported as - - https://github.com/google/fonts/issues/632 - - The font in question (Nunito) has values 705 and 713 for the - reference and overshoot values, respectively, of the first blue - zone. Blue zone 2, however, has value 710 for both the reference - and overshoot. At 12ppem, reference and overshoot of blue zone 0 - becomes 8px, while blue zone 2 becomes 9px. - - A peculiarity of this font is that the tops of isolated vertical - stems like `N' have a slight overshoot also. The auto-hinter tries - to find the nearest blue zone using the *original* coordinates. For - vertical stems, this is value 713. For normal horizontal tops like - in character `E', this is value 710. Since value 713 is mapped to - 8px but value 710 to 9px, `N' and similar characters are one pixel - higher than `E', which looks very bad. - - This commit sanitizes blue zones to avoid such a behaviour. - - * src/autofit/aflatin.c (af_latin_sort_blue): New function. - (af_latin_metrics_init_blues): Sort blue values and remove overlaps. - -2017-02-12 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_sweep): Improve code. - -2017-02-06 Werner Lemberg - - [truetype] Implement `VVAR' table support. - - * src/truetype/ttgxvar.h (GX_HVarTable): Renamed to... - (GX_HVVarTable): ...This. - (GX_Blend): Add fields for `VVAR' table handling. - Other minor updates. - - * src/truetype/ttgxvar.c (ft_var_load_hvar): Renamed to... - (ft_var_load_hvvar): ...This. - Handle VVAR loading also (controlled by an additional parameter). - (tt_hadvance_adjust): Renamed to... - (tt_hvadvance_adjust): ...This. - Handle application of advance height also (controlled by an - additional parameter). - (tt_hadvance_adjust, tt_vadvance_adjust): Wrappers for - `tt_hvadvance_adjust'. - - * src/truetype/ttdriver.c (tt_service_metrics_variations): Updated. - -2017-02-05 Werner Lemberg - - [autofit] Use better blue zone characters for lowercase latin. - - The number of lowercase characters for computing the top flat blue - zone value was too small (in most cases only `x' and `z'). If one - of the two characters has a large serif, say, it can happen that - FreeType must select between two different values, having a 50% - chance to use the wrong one. As a result, rendering at larger PPEM - values could yield uneven lowercase glyph heights. + [base] Avoid undefined behaviour in lcd filtering code (#53727). - Problem reported by Christoph Koeberlin . + * src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy): + Ensure `height > 0'. - * src/autofit/afblue.dat (AF_BLUE_STRING_LATIN_SMALL): Replaced - with... - (AF_BLUE_STRING_LATIN_SMALL_TOP, AF_BLUE_STRING_LATIN_SMALL_BOTTOM): - ... New, extended sets. - (AF_BLUE_STRINGSET_LATN): Updated. +2018-04-22 Werner Lemberg - * src/autofit/afblue.c, scr/autofit/afblue.h: Regenerated. + * src/base/ftoutln.c (FT_Outline_Decompose): Improve error tracing. -2017-02-04 Werner Lemberg +2018-04-22 Alexei Podtelezhnikov - Make `freetype-config' a wrapper of `pkg-config' if possible. + [base] Fix bitmap emboldening. - Based on ideas taken from + Bug introduced after release 2.8. - http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/tree/freetype-multilib.patch - http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/tree/freetype-2.5.3-freetype-config-prefix.patch + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): We use + `FT_QALLOC_MULT', which doesn't zero out the buffer. Adjust the + bitmap copying code to take care of this fact. - * builds/unix/freetype-config.in: Rewritten. Use `pkg-config' to - set output variables if program is available. +2018-04-22 Werner Lemberg - * docs/CHANGES, docs/freetype-config.1: Updated. + Another fix for handling invalid format 2 cmaps. -2017-02-04 Werner Lemberg - - * builds/unix/unix-def.in (freetype-config): Fix permissions. - -2017-02-03 Werner Lemberg - - * src/autofit/afglobal.c (af_face_globals_free): Erase useless code. - -2017-02-03 Werner Lemberg - - * include/freetype/ftgasp.h (FT_GASP_SYMMETRIC_GRIDFIT): Fix value. - - Reported by Behdad. - -2017-02-02 Werner Lemberg - - [truetype] Fix MVAR post-action handling. + The previous commit was incomplete. Reported as - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=509 - - * src/truetype/ttobjs.c (tt_size_reset): Do nothing for CFF2. This - is important to make `tt_size_reset_iterator' (called in - `tt_apply_mvar') always work. - -2017-02-02 Werner Lemberg - - Make compilation with FT_CONFIG_OPTION_PIC work again. - - All code committed here is guarded with `FT_CONFIG_OPTION_PIC'. - - * include/freetype/internal/services/svmetric.h - (FT_DEFINE_SERVICE_METRICSVARIATIONSREC): Remove trailing semicolon. - - * src/autofit/aflatin.c (af_latin_hints_compute_edges, - af_latin_hint_edges): Provide `globals' variable. - - * src/autofit/afloader.c (af_loader_load_glyph): Remove shadowing - variable. - - * src/autofit/afmodule.c (AF_SCRIPT_CLASSES_GET, - AF_STYLE_CLASSES_GET): Redefine. - - * src/autofit/aftypes.h (AF_DEFINE_WRITING_SYSTEM_CLASS): Fix typo. - - * src/cff/cffparse.c (CFF_FIELD_BLEND): Provide it. - - * src/cff/cffpic.h (CffModulePIC): Fix typo. - -2017-01-31 Alexei Podtelezhnikov - - * src/smooth/ftgrays.c (gray_render_scanline): Improve code. - -2017-01-31 Werner Lemberg - - [cff] Provide metrics variation service interface (#50196). - - Only now I've got an OTF with an HVAR table for testing... - - The code in `ftmm.c' uses `FT_FACE_LOOKUP_SERVICE' to get the - metrics variations interface. However, this didn't work with - `FT_FACE_FIND_GLOBAL_SERVICE' used in `sfnt_init_face'. + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7928 - * src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (cff_hadvance_adjust, cff_metrics_adjust): Wrapper functions for - metric service functions from the `truetype' module. - (cff_service_metrics_variations): New service. - (cff_services): Updated. + * src/sfnt/ttcmap.c (tt_cmap2_char_next): Adjust condition to avoid + an endless loop. - * src/cff/cffpic.h (CFF_SERVICE_METRICS_VAR_GET): New macro. - [FT_CONFIG_OPTION_PIC]: Synchronize code. +2018-04-19 Werner Lemberg + This will be part of the forthcoming Unicode 11.0. - Add framework to support services with 9 functions. - - * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC9): - New macro. - -2017-01-31 Werner Lemberg + * src/autofit/afblue.dat: Add blue zone data for Mtavruli. + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. - [base] Fix error handing in MM functions. + * src/autofit/afscript.h: Add Mtavruli standard character. - * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, - FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): - Implement it. +2018-04-18 Werner Lemberg -2017-01-31 Werner Lemberg + Fix handling of invalid format 2 cmaps. - [truetype] Fix sanity check for `gvar' table (#50184). + The problem was introduced after the last release. - * src/truetype/ttgxvar.c (ft_var_load_gvar): There might be missing - variation data for some glyphs. + Reported as -2017-01-31 Werner Lemberg + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7828 - [autofit] Avoid uninitialized jumps (#50191). + * src/sfnt/ttcmap.c (tt_cmap2_char_next): Avoid endless loop. - * src/autofit/afcjk.c (af_cjk_metrics_check_digits), - src/autofit/aflatin.c (af_latin_metrics_check_digits): Initialize - `advance'. +2018-04-17 Werner Lemberg -2017-01-27 Werner Lemberg + [truetype] Integer overflow issues. - s/GB2312/PRC/. + Reported as - * include/freetype/freetype.h (FT_ENCODING_PRC): New enum value. - (FT_ENCODING_GB2312): Deprecated. + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7739 - * include/freetype/ttnameid.h (TT_MS_ID_PRC): New macro. - (TT_MS_ID_GB2312): Deprecated. + * src/truetype/ttinterp.c (Ins_CEILING): Use FT_PIX_CEIL_LONG. - * src/sfnt/sfobjs.c (sfnt_find_encoding): Updated. +2018-04-16 Werner Lemberg - * docs/CHANGES: Updated. + [truetype] Integer overflow issues. -2017-01-26 Werner Lemberg - - [base] Add `FT_Get_Sfnt_LangTag' function. + Reported as - * include/freetype/ftsnames.h (FT_SfntLangTag): New structure. - (FT_Get_Sfnt_LangTag): New declaration. + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7718 - * src/base/ftsnames.c (FT_Get_Sfnt_LangTag): New funtion. + * src/truetype/ttinterp.c (Ins_MIRP): Use ADD_LONG. - * docs/CHANGES: Updated. +2018-04-15 Alexei Podtelezhnikov -2017-01-26 Werner Lemberg + [build] Use `info' function of make 3.81. - [sfnt] Support `name' table format 1. + * configure, docs/INSTALL, docs/INSTALL.CROSS, docs/INSTALL.GNU, + docs/INSTALL.UNIX, docs/MAKEPP: Bump make version requirements. - * include/freetype/internal/tttypes.h (TT_LangTagRec): New - structure. - (TT_NameTableRec): Add fields `numLangTagRecords' and `langTags'. + * builds/detect.mk (std_setup): Replace `echo' with `info'. + (dos_setup): Removed. + * builds/unix/install.mk, builds/modules.mk, builds/dos/detect.mk, + builds/windows/detect.mk, builds/os2/detect.mk: Updated. + * builds/newline: No longer needed. - * src/sfnt/ttload.c (tt_face_load_name): Add support for language - tags. - Reduce array size of name strings in case of invalid entries. - (tt_face_free_name): Updated. +2018-04-15 Werner Lemberg - * docs/CHANGES: Updated. + [truetype]: Limit `SLOOP' bytecode argument to 16 bits. -2017-01-25 Werner Lemberg + This fixes - [sfnt] s/TT_NameEntry/TT_Name/. + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7707 - * include/freetype/internal/tttypes.h (TT_NameEntryRec): Renamed - to... - (TT_NameRec): This. - (TT_NameTableRec): Updated. + * src/truetype/ttinterp.c (Ins_SLOOP): Do it. - * src/base/ftsnames.c (FT_Get_Sfnt_Name): Updated. +2018-04-14 Werner Lemberg - * src/sfnt/sfdriver.c (sfnt_get_ps_name): Updated. + [truetype] Integer overflow issues. - * src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16, - tt_name_entry_ascii_from_other): Renamed to... - (tt_name_ascii_from_utf16, tt_name_entry_ascii_from_other): This, - respectively. - (TT_NameEntry_ConvertFunc): Renamed to... - (TT_Name_ConvertFunc): This. - (tt_face_get_name): Updated. + Reported as - * src/sfnt/ttload.c (tt_face_load_name, tt_face_free_names): - Updated. + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7652 -2017-01-24 Werner Lemberg + * src/truetype/ttinterp.c (Ins_MDAP): Use SUB_LONG. - [sfnt] Fix Postscript name service for symbol fonts. +2018-04-14 Werner Lemberg - * src/sfnt/sfdriver.c (sfnt_get_ps_name): Accept PID/EID=3/0 - entries also. + [autofit] Update to Unicode 11.0.0. -2017-01-24 Werner Lemberg + But no support new scripts (volunteers welcomed). - [truetype] For OpenType 1.7: s/preferred/typographic/ (sub)family. + * src/autofit/afranges.c (af_arab_nonbase_uniranges, + af_beng_nonbase_uniranges, af_cakm_nonbase_uniranges, + af_deva_nonbase_uniranges, af_geor_uniranges, + af_gujr_nonbase_uniranges, af_mlym_nonbase_uniranges, + af_nkoo_nonbase_uniranges, af_telu_nonbase_uniranges, + af_hani_uniranges): Add new data. - * include/freetype/ftsnames.h - (FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY, - FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY): New macros. - (FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY, - FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY): Deprecated. +2018-04-10 Nikolaus Waxweiler - * include/freetype/ttnameid.h (TT_NAME_ID_TYPOGRAPHIC_FAMILY, - TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY): New macros. - (TT_NAME_ID_PREFERRED_FAMILY, TT_NAME_ID_PREFERRED_SUBFAMILY): - Deprecated. + * CMakeLists.txt, builds/cmake/FindHarfBuzz.cmake: Extensive + modernization measures. - * src/sfnt/sfobjs.c (sfnt_load_face): Updated. + This brings up the minimum required CMake version to 2.8.12. - * docs/CHANGES: Updated. + The installation paths follow the GNU defaults now, e.g. installing on a + 64 bit host will place binaries into the lib64/ folder on e.g. Fedora. -2017-01-23 Werner Lemberg + Symbols are hidden by default (e.g. `-fvisibility=hidden' on GCC). - [base] Add `FT_Set_Default_Properties' (#49187). + CMake will no longer look for a C++ compiler. - * include/freetype/ftmodapi.h: Add declaration. + Library and .so version now match the Autotools build. - * src/base/ftinit.c (ft_set_default_properties): Renamed to... - (FT_Set_Default_Properties): ... this. - (FT_Init_FreeType): Updated. + Comments in the build file and informational messages now use platform + agnostic example commands. - * docs/CHANGES: Updated. + ftoption.h and ftconfig.h are written directly without a redundant `-new' + copy. -2017-01-23 Werner Lemberg + External dependencies are expressed as option()s and will turn up as such + in cmake-gui. - [truetype] Minor updates for OpenType 1.8.1. + Internal: Properties such as dependencies and include directories are now + privately set on the freetype library instead of globally. - * src/truetype/ttgxvar.h (GX_MVarTable): `axisCount' has been - removed from the specification; it is now reserved. + The CPack definitions have been cleaned up, the `make dist' has been + removed. Source packages generated with CPack don't contain Autotools + files and aren't used by the maintainters anyway. - * src/truetype/ttgxvar.c (ft_var_load_mvar): Updated. - (GX_FVar_Head): Remove `countSizePairs'; the corresponding data - field in the `MVAR' table is now reserved. - (fvar_fields): Updated. + On Windows, src/base/ftver.rc is compiled to decorate the library with + version and copyright information. -2017-01-23 Werner Lemberg + A pkg-config file is now generated and installed. - [truetype] Avoid segfault for invalid variation data. +2018-04-09 Werner Lemberg - * src/truetype/ttgxvar.c (ft_var_load_item_variation_store): Assure - `itemCount' is not zero. + [truetype] Integer overflow issues. Reported as - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=441 - -2017-01-20 Werner Lemberg - - * src/truetype/ttinterp.c (TT_RunIns): Adjust loop detector limits. - -2017-01-17 Werner Lemberg - - * include/freetype/ttnameid.h: Updated to OpenType 1.8.1. - - (TT_APPLE_ID_FULL_UNICODE): New macro. + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7453 - (TT_MS_LANGID_BOSNIAN_BOSNIA_HERZ_CYRILLIC, - TT_MS_LANGID_UPPER_SORBIAN_GERMANY, - TT_MS_LANGID_LOWER_SORBIAN_GERMANY, TT_MS_LANGID_IRISH_IRELAND, - TT_MS_LANGID_INUKTITUT_CANADA_LATIN, TT_MS_LANGID_BASHKIR_RUSSIA, - TT_MS_LANGID_LUXEMBOURGISH_LUXEMBOURG, - TT_MS_LANGID_GREENLANDIC_GREENLAND, TT_MS_LANGID_MAPUDUNGUN_CHILE, - TT_MS_LANGID_MOHAWK_MOHAWK, TT_MS_LANGID_BRETON_FRANCE, - TT_MS_LANGID_OCCITAN_FRANCE, TT_MS_LANGID_CORSICAN_FRANCE, - TT_MS_LANGID_ALSATIAN_FRANCE, TT_MS_LANGID_YAKUT_RUSSIA, - TT_MS_LANGID_KICHE_GUATEMALA, TT_MS_LANGID_KINYARWANDA_RWANDA, - TT_MS_LANGID_WOLOF_SENEGAL, TT_MS_LANGID_DARI_AFGHANISTAN): New - macros. + * src/truetype/ttinterp.c (Round_Super, Round_Super_45): Use + ADD_LONG and SUB_LONG. - (TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC): Fix value. +2018-04-06 Alexei Podtelezhnikov - (TT_MS_LANGID_GERMAN_LIECHTENSTEIN, TT_MS_LANGID_CATALAN_CATALAN, - TT_MS_LANGID_CHINESE_MACAO, TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT, - TT_MS_LANGID_KOREAN_KOREA, TT_MS_LANGID_ROMANSH_SWITZERLAND, - TT_MS_LANGID_SLOVENIAN_SLOVENIA, TT_MS_LANGID_BASQUE_BASQUE, - TT_MS_LANGID_SETSWANA_SOUTH_AFRICA, - TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA, - TT_MS_LANGID_ISIZULU_SOUTH_AFRICA, TT_MS_LANGID_KAZAKH_KAZAKHSTAN, - TT_MS_LANGID_KYRGYZ_KYRGYZSTAN, TT_MS_LANGID_KISWAHILI_KENYA, - TT_MS_LANGID_TATAR_RUSSIA, TT_MS_LANGID_ODIA_INDIA, - TT_MS_LANGID_MONGOLIAN_PRC, TT_MS_LANGID_TIBETAN_PRC, - TT_MS_LANGID_WELSH_UNITED_KINGDOM, TT_MS_LANGID_GALICIAN_GALICIAN, - TT_MS_LANGID_SINHALA_SRI_LANKA, TT_MS_LANGID_TAMAZIGHT_ALGERIA, - TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA, TT_MS_LANGID_YI_PRC, - TT_MS_LANGID_UIGHUR_PRC): New aliases. + [windows, wince] Clean up legacy project files. - Remove commented out code. - - (TT_NAME_ID_LIGHT_BACKGROUND, TT_NAME_ID_DARK_BACKGROUND, - TT_NAME_ID_VARIATIONS_PREFIX): New macros. - - (HAVE_LIMIT_ON_IDENTS): Remove macro (which was useless since many - years), use guarded long macros by default and define short versions - as aliases for the long ones. - -2017-01-15 Werner Lemberg - - * src/truetype/ttgxvar.c (tt_apply_var): Handle underline parameters - also. - -2017-01-11 Werner Lemberg + * builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2008-ce/freetype.vcproj, + builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2008/freetype.vcproj, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/freetype.dsp: Remove per-file compile flags. - * src/base/ftobjs.c (ft_open_face_internal): Improve tracing. +2018-04-04 Werner Lemberg -2017-01-11 Werner Lemberg + [cff, type1] Sanitize `BlueFuzz' and `BlueShift'. - [truetype] Actually use metrics variation service. + Reported as - * src/base/ftmm.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (ft_face_get_mvar_service): New auxiliary function to look up - metrics variation service. - (FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, - FT_Set_Var_Blend_Coordinates): Call metrics variation service. + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7371 - * src/truetype/ttobjs.c (tt_face_init): Use metrics variations for - named instances. + * src/cff/cffload.c (cff_load_private_dict): Sanitize + `priv->blue_shift' and `priv->blue_fuzz' to avoid overflows later + on. -2017-01-11 Werner Lemberg + * src/type1/t1load.c (T1_Open_Face): Ditto. - [truetype] Provide metrics variation service. +2018-04-04 Ben Wagner - * include/freetype/internal/services/svmetric.h - (FT_Metrics_Adjust_Func): Reduce number of necessary parameters. + * src/truetype/ttobjs.c (trick_names): Add 3 tricky fonts (#53554), + `DFHei-Md-HK-BF', `DFKaiShu-Md-HK-BF' and `DFMing-Bd-HK-BF'. + (tt_check_trickyness_sfnt_ids): Add checksums for 3 tricky fonts + in above. - * src/truetype/ttgxvar.c: Include FT_LIST_H. - (tt_size_reset_iterator): New auxiliary function for... - (tt_apply_var): New function. +2018-04-01 Werner Lemberg - * src/truetype/ttgxvar.h: Updated. + * builds/toplevel.mk (work): Use $(SEP). - * src/truetype/ttdriver.c (tt_service_metrics_variations): Add - `tt_apply_mvar'. + This fixes the `make refdoc' using Cygwin: $(CAT) is `type' on this + platform, and this program only understands backslashes in paths. - * include/freetype/internal/ftserv.h (FT_ServiceCache): Add metrics - variation service. + Reported by Nikhil Ramakrishnan . -2017-01-11 Werner Lemberg +2018-03-30 Werner Lemberg - [truetype] Parse `MVAR' table. + [truetype] Fix memory leak (only if tracing is on). - * src/truetype/ttgxvar.h (MVAR_TAG_XXX): New macros for MVAR tags. - (GX_Value, GX_MVarTable): New structures. - (GX_Blend): Add it. + * src/truetype/ttgxvar.c (TT_Get_MM_Var) [FT_DEBUG_LEVEL_TRACE}: Fix + it. - * src/truetype/ttgxvar.c (GX_VALUE_SIZE, GX_VALUE_CASE, - GX_GASP_CASE): New macros. - (ft_var_get_value_pointer): New auxiliary function to get a pointer - to a value from various SFNT tables already stored in `TT_Face'. - (ft_var_load_mvar): New function. - (TT_Get_MM_Var): Call it. - (tt_done_blend): Updated. +2018-03-23 Ben Wagner -2017-01-11 Werner Lemberg + [sfnt] Correctly handle missing bitmaps in sbix format (#53404). - [truetype] More preparations for MVAR support. + * src/sfnt/ttfsbit.c (tt_face_load_sbix_image): Fix return value. - * src/truetype/ttobjs.c (tt_size_reset): Add argument to make - function only recompute ascender, descender, and height. +2018-03-23 Ben Wagner - * src/truetype/ttobjs.h: Updated. + [truetype] Fix advance of empty glyphs in bitmap fonts (#53393). - * src/truetype/ttdriver.c (tt_size_select, tt_size_request): - Updated. + * src/truetype/ttgload.c (TT_Load_Glyph): Apply scaling to metrics + for empty bitmaps. -2017-01-09 Werner Lemberg +2018-03-22 Werner Lemberg - [pcf] Disable long family names by default. + Remove `ftlcdfil.c' and `ftfntfmt.c' from build files (#53415). - * include/freetype/config/ftoption.h - (PCF_CONFIG_OPTION_LONG_FAMILY_NAMES): Comment out. + builds/amiga/makefile, builds/amiga/makefile.os4, + builds/amiga/smakefile, builds/mac/FreeType.m68k_cfm.make.txt, + builds/mac/FreeType.m68k_far.make.txt, + builds/mac/FreeType.ppc_carbon.make.txt, + builds/mac/FreeType.ppc_classic.make.txt, + builds/symbian/freetype.mmp, builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2008-ce/freetype.vcproj, + builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/freetype.vcxproj.filters, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, vms_make.com: Do it. -2017-01-09 Werner Lemberg +2018-03-13 Werner Lemberg - [pcf] Make long family names configurable. + * src/sfnt/ttcmap.c (tt_cmap2_validate): Fix potential numeric + overflow. - The change from 2016-09-29 was too radical (except for people using - the openSuSE GNU/Linux distribution). To ameliorate the situation, - PCF_CONFIG_OPTION_LONG_FAMILY_NAMES gets introduced which controls - the feature; if set, a new PCF property option - `no-long-family-names' can be used to switch this feature off. +2018-03-13 Werner Lemberg - * include/freetype/config/ftoption.h, devel/ftoption.h - (PCF_CONFIG_OPTION_LONG_FAMILY_NAMES): New option. + Fix cmap format 2 handling (#53320). - * include/freetype/ftpcfdrv.h: New header file (only containing - comments currently, used for building the documentation). + The patch introduced for #52646 was not correct. - * include/freetype/config/ftheader.h (FT_PCF_DRIVER_H): New macro. + * src/sfnt/ttcmap.c (tt_cmap2_char_next): Adjust condition. - * src/pcf/pcf.h (PCF_Driver): Add `no_long_family_names' field. +2018-03-10 Nikolaus Waxweiler - * src/pcf/pcfdrivr.c: Include FT_SERVICE_PROPERTIES_H and - FT_PCF_DRIVER_H. - (pcf_property_set, pcf_property_get): New functions. - (pcf_service_properties): New service. - (pcf_services): Updated. - (pcf_driver_init) [PCF_CONFIG_OPTION_LONG_FAMILY_NAMES]: Handle - `no_long_family_names'. + * CMakeLists.txt (BASE_SRCS): Update to changes from 2018-03-05. - * src/pcf/pcfread.c (pcf_load_font): Handle `no_long_family_names' - and PCF_CONFIG_OPTION_LONG_FAMILY_NAMES. +2018-03-09 Chun-wei Fan - * docs/CHANGES: Updated. + * CMakeLists.txt [win32]: Allow MSVC DLL builds (#53287). -2017-01-09 Werner Lemberg + Do not limit DLL builds to MinGW, since we already have + `__declspec(dllexport)' directives in `ftconfig.h'. + Also suppress more warnings for POSIX functions. - [pcf] Introduce a driver structure. +2018-03-08 Hugh McMaster - To be filled later on with something useful. + Make installation of `freetype-config' optional (#53093). - * src/pcf/pcf.h (PCF_Driver): New structure. + * builds/unix/configure.raw: Add option `--enable-freetype-config' + and set `INSTALL_FT2_CONFIG'. + * builds/unix/unix-def.in (INSTALL_FT2_CONFIG): Define. + * builds/unix/install.mk (install): Handle it. - * src/pcf/pcfdrivr.c (pcf_driver_init, pcf_driver_done): New dummy - functions. - (pcf_driver_class): Updated. +2018-03-05 Werner Lemberg -2017-01-08 Werner Lemberg + Make `ftlcdfil.c' part of the `base' module. - [truetype] Again some GX code shuffling. + `ftobjs.c' needs `ft_lcd_padding'. - We need this later on for MVAR also. + Problem reported by duhuanpeng <548708880@qq.com>. - * src/truetype/ttgxvar.c (tt_hadvance_adjust): Split off computing - an item store variation delta into... - (ft_var_get_item_delta): ...new function. + * modules.cfg (BASE_EXTENSIONS): Don't include `ftlcdfil.c'. -2017-01-08 Werner Lemberg + * src/base/ftbase.c: Include `ftlcdfil.c'. + * src/base/rules.mk (BASE_SRC): Add `ftlcdfil.c'. + * src/base/Jamfile (_sources): Adjusted. - [truetype] Adjust font variation flags for MVAR. + * docs/INSTALL.ANY: Updated. - * include/freetype/internal/tttypes.h (TT_FACE_FLAG_VAR_XXX): - Remove all flags related to MVAR; replace it with... - (TT_FACE_FLAG_VAR_MVAR): ...this new macro. - (TT_Face): Remove `mvar_support' field (which was still unused). +2018-03-05 Werner Lemberg -2017-01-06 Werner Lemberg + Make `ftfntfmt.c' part of the `base' module. - [truetype] More GX code shuffling. + `ftobjs.c' needs `FT_Get_Font_Format'. - We need this later on for MVAR also. + Problem reported by duhuanpeng <548708880@qq.com>. - * src/truetype/ttgxvar.c (tt_done_blend): Split off handling of item - variation store into... - (ft_var_done_item_variation_store): ...new function. + * modules.cfg (BASE_EXTENSIONS): Don't include `ftfntfmt.c'. -2017-01-06 Werner Lemberg + * src/base/ftbase.c: Include `ftfntfmt.c'. + * src/base/rules.mk (BASE_SRC): Add `ftfntfmt.c'. + * src/base/Jamfile (_sources): Adjusted. - [truetype] More generalization of GX stuff. + * docs/INSTALL.ANY: Updated. - We need this later on for MVAR also. +2018-03-01 Werner Lemberg - * src/truetype/ttgxvar.c (ft_var_load_delta_set_index_mapping): Add - parameters for delta-set index mapping and item variation store. - (ft_var_load_item_variation_store): Add parameter for item variation - store. - s/hvarData/varData/. - Move allocation of `hvar_table' to... - (ft_var_load_hvar): ...this function. - Updated. + * src/truetype/ttinterp.c (TT_RunIns): Fix tracing arguments. -2017-01-06 Werner Lemberg +2018-02-23 Werner Lemberg - [truetype] Some GX structure renames for generalization. + * builds/unix/configure.raw: Need HarfBuzz 1.3.0 or newer. - We need this later on for MVAR also. + Problem reported by Alan Coopersmith . - * src/truetype/ttgxvar.h (GX_HVarData): Renamed to... - (GX_ItemVarData): ...this. - (GX_HVarRegion): Renamed to... - (GX_VarRegion): ...this. - (GX_HVStore): Renamed to... - (GX_ItemVarStore): ...this. - (GX_WidthMap): Renamed to... - (GX_DeltaSetIdxMap): ...this. +2018-02-17 Werner Lemberg - (GX_HVarTable): Updated. + [sfnt] Prefer `CBDT'/`CBLC' over `glyf' table (#53154). - * src/truetype/ttgxvar.c: Updated. +2018-02-06 Werner Lemberg -2017-01-06 Werner Lemberg + [truetype] Integer overflow issues. - [truetype] Code shuffling. + Reported as - * src/truetype/ttgxvar.c (ft_var_load_hvar): Split off loading of - item variation store and delta set index mapping into... - (ft_var_load_item_variation_store, - ft_var_load_delta_set_index_mapping): ...new functions. + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6027 -2017-01-06 Werner Lemberg + * src/truetype/ttinterp.c (Ins_MSIRP, Ins_MIAP, Ins_MIRP): Use + SUB_LONG; avoid FT_ABS. - [truetype] Add HVAR access without advance width map. +2018-02-04 Alexei Podtelezhnikov - * src/truetype/ttgxvar.c (ft_var_load_hvar): Handle case where - `offsetToAdvanceWidthMapping' is zero. - (tt_hadvance_adjust): Implement direct deltaSet access by glyph - index. + [unix] Use -fvisibility=hidden. -2017-01-06 Werner Lemberg + It is now widely recommended that ELF shared libraries hide symbols + except those with explicit __attribute__((visibility("default"))). + This is supported by all major compilers and should rather be an + option in libtool. - [pcf] Revise driver. + * builds/unix/configure.raw: Add -fvisibility=hidden to CFLAGS. + * builds/unix/ftconfig.in, builds/vms/ftconfig.h, + include/freetype/config/ftconfig.h (FT_EXPORT): Use visibility + attribute. - This commit improves tracing and handling of malformed fonts. In - particular, the changes to `pcf_get_properties' fix +2018-01-27 Werner Lemberg - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=379 + [truetype] Better protection against invalid VF data. - * src/pcf/pcfread.c (tableNames): Use long names for better - readability. - (pcf_read_TOC): Allow at most 9 tables. - (pcf_get_properties): Allow at most 256 properties. - Limit strings array length to 256 * (65536 + 1) bytes. - Better tracing. - (pcf_get_metric): Trace metric data. - (pcf_get_metrics): Allow at most 65536 metrics. - Fix comparison of `metrics->ascent' and `metrics->descent' to avoid - potential overflow. - Better tracing. - (pcf_get_bitmaps): Allow at most 65536 bitmaps. - Better tracing. - (pcf_get_encodings, pcf_get_accel): Better tracing. + Reported as - * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Don't trace `format' details. - These are now shown by `pcf_get_bitmaps'. + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5739 -2017-01-04 Werner Lemberg + Bug introduced in commit 08cd62deedefe217f2ea50e392923ce8b5bc7ac7. - * src/pcf/pcfdrivr.c (PCF_Face_Init): Trace compression format. + * src/truetype/ttgxvar.c (TT_Set_Var_Design): Always initialize + `normalizedcoords'. -2017-01-04 Werner Lemberg +2018-01-27 Werner Lemberg - [cff] More consistency checks for pure CFFs. + * src/truetype/ttinterp.c (Ins_GETVARIATION): Avoid NULL reference. Reported as - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=378 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5736 - * src/cff/cffload.c (cff_font_load): Check element number and size - of Name and Top DICT indices. +2018-01-27 Werner Lemberg -2017-01-04 Werner Lemberg + * src/truetype/ttgxvar.c (tt_set_mm_blend): Minor. - [cff, truetype] Minor tracing improvement. +2018-01-27 Werner Lemberg - * src/cff/cffobjs.c (cff_face_init), src/truetype/ttobjs.c - (tt_face_init): Indent first tracing message from SFNT driver. + [truetype] Better trace VF instances. -2017-01-03 Werner Lemberg + * src/truetype/ttgxvar.c (ft_var_to_normalized): Don't emit number + of coordinates. + (TT_Get_MM_Var): Trace instance indices names. + (TT_Set_Var_Design): Updated. - [truetype] Various minor fixes. +2018-01-27 Werner Lemberg - * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check instruction - size only if we do native hinting. - (TT_Load_Glyph): Trace returned error code. + [truetype] Beautify tracing of VF axis records. - * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Trace - returned error code. - (tt_size_ready_bytecode): Don't run `prep' table if `fpgm' table is - invalid. + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Show axis records in a + table-like manner. -2017-01-03 Werner Lemberg +2018-01-26 Ben Wagner - [sfnt] Don't fail if PCLT, EBLC (and similar tables) are invalid. + [truetype] Fix multiple calls of `FT_Get_MM_Var' (#52955). - These tables are optional. + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Set + `face->blend->num_axis' in case we have to initialize the + `face->blend'. - * src/sfnt/sfobjs.c (sfnt_load_face): Implement it. +2018-01-23 Alexei Podtelezhnikov -2017-01-03 Werner Lemberg + [apinames] Anonymous version map for GNU linker. - * src/cff/cffparse.c (cff_parse_num): Simplify. + * src/tools/apinames.c (PROGRAM_VERSION): Set to 0.3. + (OutputFormat): Add `OUTPUT_GNU_VERMAP'. + (names_dump): Handle it. + (usage): Updated. + (main): Handle new command line flag `-wL'. -2017-01-03 Werner Lemberg +2018-01-21 Alexei Podtelezhnikov - Various fixes for clang's undefined behaviour sanitizer. + [unix] Call libtool to clean up. - * src/cff/cffload.c (FT_fdot14ToFixed): Fix casting. - (cff_blend_doBlend): Don't left-shift negative numbers. - Handle 5-byte numbers byte by byte to avoid alignment issues. + * builds/unix/install.mk (clean_project_unix, distclean_project_unix): + Use libtool. + * builds/freetype.mk: Minor. - * src/cff/cffparse.c (cff_parse_num): Handle 5-byte numbers byte by - byte to avoid alignment issues. +2018-01-18 Alexei Podtelezhnikov - * src/cid/cidload (cid_read_subrs): Do nothing if we don't have any - subrs. + * src/base/ftver.rc: Fix mingw-w64 compilation. - * src/psaux/t1decode.c (t1_decode_parse_charstring): Fix tracing. +2018-01-18 Alexei Podtelezhnikov - * src/tools/glnames.py (main): Put `DEFINE_PSTABLES' guard around - definition of `ft_get_adobe_glyph_index'. + [build] Enable VERSIONINFO resource for Cygwin/MinGW. - * src/psnames/pstables.h: Regenerated. + * builds/unix/configure.raw: Check for resource compiler. + * builds/unix/unix-cc.in: Conditionally set up resource compiler. + * builds/freetype.mk: Add conditional rule for `ftver.rc'. + * src/base/ftver.rc: Copyright notice and year update. - * src/psnames/psmodule.c: Include `pstables.h' twice to get both - declaration and definition. +2018-01-18 Alexei Podtelezhnikov - * src/truetype/ttgxvar.c (FT_fdot14ToFixed, FT_intToFixed): Fix - casting. + [build] Move VERSIONINFO resource. -2017-01-01 Werner Lemberg + * builds/windows/vc2010/freetype.vcxproj: Updated. + * builds/windows/ftver.rc: Move file from here... + * src/base/ftver.rc: ... to here. - [cff] Handle multiple `blend' operators in a row correctly. +2018-01-12 Alexei Podtelezhnikov - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=368 - - * src/cff/cffload.c (cff_blend_doBlend): Adjust `parser->stack' - pointers into `subFont->blend_stack' after reallocation. + [build] Expand dllexport/dllimport to Cygwin/MinGW. -2017-01-01 Werner Lemberg + * include/freetype/config/ftconfig.h: Respect DLL_EXPORT, + s/_MSC_VER/_WIN32/. + * builds/unix/ftconfig.in: Replicate here. + * builds/vms/ftconfig.h: Replicate here. - [sfnt] Return correct number of named instances for TTCs. +2018-01-12 Alexei Podtelezhnikov - Without this patch, requesting information for face index N returned - the data for face index N+1 (or index 0). + [build] Improve and document MSVC build. - * src/sfnt/sfobjs.c (sfnt_init_face): Correctly adjust `face_index' - for negative `face_instance_index' values. + * include/freetype/config/ftconfig.h: Guard dllexport/dllimport + attributes with _DLL and FT2_DLLIMPORT. + * builds/windows/vc2010/index.html: Update documentation. -2016-12-31 Werner Lemberg +2018-01-10 Steve Robinson - */*: Use hex numbers for errors in tracing messages. + * CMakeLists.txt [win32]: Suppress warnings for POSIX functions. -2016-12-31 Werner Lemberg +2018-01-10 Ewald Hew - [truetype] Check axis count in HVAR table. + [psaux] Correctly handle Flex features (#52846). - Reported as + * src/psaux/psintrp.c (cf2_interpT2CharString) : Do not move if doing Flex. - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=362 +2018-01-09 Alexei Podtelezhnikov - * src/truetype/ttgxvar.c (ft_var_load_hvar): Check axis count. - (ft_var_load_avar): Fix tracing message. + * builds/windows/vc2010/freetype.sln: Synchronize with the project. -2016-12-30 Werner Lemberg +2018-01-08 Werner Lemberg - * Version 2.7.1 released. - ========================= + * Version 2.9 released. + ======================= - Tag sources with `VER-2-7-1'. + Tag sources with `VER-2-9'. - * docs/VERSION.TXT: Add entry for version 2.7.1. + * docs/VERSION.TXT: Add entry for version 2.9. * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, builds/windows/vc2005/index.html, @@ -1061,2077 +512,1796 @@ builds/windows/visualce/freetype.dsp, builds/windows/visualce/freetype.vcproj, builds/windows/visualce/index.html, + builds/windows/ftver.rc, builds/wince/vc2005-ce/freetype.vcproj, builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/freetype.vcproj, - builds/wince/vc2008-ce/index.html: s/2.7/2.7.1/, s/27/271/. + builds/wince/vc2008-ce/index.html: s/2.8.1/2.9/, s/281/29/. - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. + * include/freetype/freetype.h (FREETYPE_MINOR): Set to 9. + (FREETYPE_PATCH): Set to 0. - * builds/unix/configure.raw (version_info): Set to 19:0:13. + * builds/unix/configure.raw (version_info): Set to 22:0:16. * CMakeLists.txt (VERSION_PATCH): Set to 1. -2016-12-30 Werner Lemberg +2018-01-07 Werner Lemberg - [ftfuzzer] Replace `rand' with an xorshift algorithm. + Add check for librt, needed for `ftbench' (#52824). - * src/tools/ftfuzzer/ftfuzzer.cc: Don't include `stdlib.h'. - (Random): Implement and use a 32bit `xorshift' algorithm. + * builds/unix/configure.raw (LIB_CLOCK_GETTIME): Define; this will + hold `-lrt' if necessary. -2016-12-30 Werner Lemberg + * builds/unix/unix-cc.in (LIB_CLOCK_GETTIME): New variable. - [ftfuzzer] Restrict number of tested bitmap strikes. +2018-01-07 Ewald Hew - Malformed fonts often have large values for the number of bitmap - strikes, and FreeType doesn't check the validity of all bitmap - strikes in advance. + [psaux] Fix Type 1 glyphs with too many stem hints. - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=353 - - * src/tools/ftfuzzer/ftfuzzer.cc: Include `stdlib.h' for `rand'. - (Random): Small class to provide n randomly selected numbers - (without repetition) out of the value set [1,N]. - (LLVMFuzzerTestOneInput): Use it to test only up to 10 bitmap - strikes. - -2016-12-29 Werner Lemberg - - [truetype] Variation font API stability issues. - - Make some functions work before a call to `TT_Set_MM_Blend'. - - * src/truetype/ttgxvar.c (tt_hadvance_adjust): Exit immediately if - we don't blend. - (TT_Get_MM_Blend, TT_Get_Var_Design): Return default values if we - don't blend. - -2016-12-29 Werner Lemberg - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Check axis data. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=348 - -2016-12-29 Werner Lemberg - - [truetype] Tracing fixes. - - * src/truetype/ttgxvar.c (tt_hadvance_adjust): Emit correct - information. - (TT_Set_Var_Design): Fix typo. - (TT_Get_Var_Design): Fix typos. - -2016-12-29 Werner Lemberg - - */*: Use `0.5f' for tracing 16.16 numbers. - -2016-12-29 Werner Lemberg - - [pcf] Protect against gzip bombs. - - Fix suggested by Kostya; reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=345 - - * src/pcf/pcfread.c (pcf_read_TOC): Limit number of TOC entries to - 1024. - -2016-12-28 Werner Lemberg - - [psnames] Only declare, not define, data in `pstables.h' (#49949). - - Pdfium includes `pstables.h' a second time; moving the definition - from `pstables.h' to `psmodule.c' saves more than 60kByte data - segment space for this case. - - * src/tools/glnames.py (StringTable::dump, - StringTable::dump_sublist, dump_encoding, dump_array): Emit - additional code to only define tables if `DEFINE_PS_TABLES' is set. + According to the CFF specification, charstrings can have up to 96 stem + hints. Due to hint replacement routines in Type 1 charstrings, some + glyphs are rejected by the Adobe engine, which implements the above + limit. This fix turns off hinting for such glyphs. - * src/psnames/pstables.h: Regenerated. - * src/psnames/psmodule.c (DEFINE_PS_TABLES): Define. + * src/psaux/pshints.c (cf2_hintmap_build): Reset the error from calling + `cf2_hintmask_setAll' on a problematic Type 1 charstring and turn off + hinting. -2016-12-28 Werner Lemberg +2018-01-06 Werner Lemberg - [cff] Catch `blend' op in non-variant fonts. + Add `FT_Done_MM_Var'. - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=334 - - * src/cff/cf2intrp.c (cf2_interpT2CharString) : Don't - allow `blend' op for non-variant fonts. - -2016-12-28 Werner Lemberg - - [cff] Better check of number of blends. - - * src/cff/cf2intrp.c (cf2_interpT2CharString) , - src/cff/cffparse.c (cff_parse_blend): Compare number of blends with - stack size. - -2016-12-27 Werner Lemberg - - Documentation updates. - - * docs/CHANGES: Add missing information. - - * docs/formats.txt: Rewritten and updated. - -2016-12-27 Werner Lemberg - - [truetype, type1] Implement `FT_Get_Var_Design_Coordinates'. - - * src/truetype/ttgxvar.c (TT_Get_Var_Design): Implement. - (TT_Set_Var_Design): Fix tracing. + This is necessary in case the application's memory routines differ + from FreeType. A typical example is a Python application on Windows + that calls FreeType compiled as a DLL via the `ctypes' interface. - * src/type1/t1load.c (T1_Get_Var_Design): Implement. + * include/freetype/ftmm.h, src/base/ftmm.c (FT_Done_MM_Var): Declare + and define. -2016-12-24 Werner Lemberg - - * src/truetype/ttpload.c (tt_face_load_hdmx): Ignore `version'. - - Problem reported by 張俊芝 <418092625@qq.com>. - -2016-12-24 Werner Lemberg - - * src/sfnt/ttsbit.c (tt_face_load_sbit): Allow more version values. - - Some fonts seem to have the `version' field in the wrong byte order. - - Problem reported by 張俊芝 <418092625@qq.com>. + * docs/CHANGES: Updated. -2016-12-24 Werner Lemberg +2018-01-03 Werner Lemberg - * src/truetype/ttpload.c (tt_face_load_loca): Sanitize table length. + [truetype] Round offsets of glyph components only if hinting is on. - This trivial fix allows us to accept more fonts. + * src/truetype/ttgload.c (TT_Process_Composite_Component): Implement + it. - Problem reported by 張俊芝 <418092625@qq.com>. +2018-01-03 Werner Lemberg -2016-12-24 Werner Lemberg + * src/truetype/ttgxvar.c (ft_var_to_design): Remove dead code. - * src/sfnt/sfobjs.c (sfnt_init_face): Fix tracing. + This is a better fix than the previous commit, which is now + reverted. -2016-12-22 Werner Lemberg +2018-01-03 Alexei Podtelezhnikov - * CMakeLists.txt: Make it work with cmake 2.8.11.2 (#49909). + Move internal LCD-related declarations. -2016-12-22 Werner Lemberg + * include/freetype/ftlcdfil.h (ft_lcd_padding, ft_lcd_filter_fir): + Move from here... + * include/freetype/internal/ftobjs.h: ... to here. - Ensure used preprocessor symbols are defined (#49790). +2018-01-03 Alexei Podtelezhnikov - * builds/unix/ftconfig.in, builds/vms/ftconfig.h, - include/freetype/config/ftconfig.h: Check `__GNUC__', `__IBMC__', - and `__SUNPRO_C' correctly. + * include/freetype/config/ftconfig.h (FT_EXPORT, FT_EXPORT_DEF) + [_MSC_VER]: Limit Visual C++ attributes. -2016-12-22 Werner Lemberg +2018-01-03 Werner Lemberg - * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Check `count'. + [truetype] Make blend/design coordinate round-tripping work. - Reported as + Behdad reported that setting blend coordinates, then getting design + coordinates did incorrectly return the default instance's + coordinates. - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=308 + * src/truetype/ttgxvar.c (tt_set_mm_blend): Fix it. -2016-12-22 Werner Lemberg +2017-12-31 Werner Lemberg - [cff] Protect against invalid `vsindex' and `blend' values. + * src/sfnt/ttcmap.c (tt_cmap2_char_next): Fix endless loop. Reported as - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=305 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4838 - * src/cff/cf2intrp.c (cf2_interpT2CharString) : Implement it. +2017-12-31 Werner Lemberg -2016-12-22 Werner Lemberg + Synchronize other Windows project files. - [ftfuzzer] Always use Adobe CFF engine. + * builds/windows/*: Add missing files. - * src/tools/ftfuzzer/ftfuzzer.cc (FT_Global::FT_Global): Implement - it. +2017-12-31 Werner Lemberg -2016-12-21 Werner Lemberg + Update Visual C 2010 project files. - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko. + Problem reported by Hin-Tak. - I should really stop coding late in the evening... + * builds/windows/vc2010/freetype.vcxproj: Add files `ftbdf.c' and + `ftcid.c'. + Sort entries. + * builds/windows/vc2010/freetype.vcxproj.filter: Ditto. + Fix members of `FT_MODULE' group. - Thanks again to Ben for checking. +2017-12-30 Werner Lemberg -2016-12-21 Werner Lemberg + * builds/vms/ftconfig.h: Synchronize with unix `ftconfig.in' file. - [autofit] Support variation fonts. +2017-12-28 Werner Lemberg - (This ChangeLog entry was added later on.) + * builds/unix/ftconfig.in: Synchronize with main `ftconfig.h' file. - * src/autofit/afglobal.c (af_face_globals_free): Remove useless - code. + Reported by Nikolaus. - * src/base/ftmm.c (FT_Set_MM_Design_Coordinates, - * FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, - FT_Set_Var_Blend_Coordinates): Finalize - auto-hinter data to enforce recomputation. Note that this is a - brute-force method which should be improved. +2017-12-27 Werner Lemberg -2016-12-21 Werner Lemberg + Fix compiler warnings. - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko. + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Make `pitch' and + `new_pitch' unsigned. - Don't apply deltas twice for non-phantom points. + * src/base/ftpsprop.c: Include FT_INTERNAL_POSTSCRIPT_PROPS_H. - Spotted by Ben Wagner. +2017-12-27 Werner Lemberg -2016-12-21 Werner Lemberg + Fixes for `make multi'. - [cff, truetype] Another try for #49829. + * include/freetype/internal/ftpsprop.h: Use `FT_BASE_CALLBACK'. + (ps_property_get): Harmonize declaration with corresponding + function typedef. - * src/cff/cffdrivr.c: Don't include - `FT_SERVICE_METRICS_VARIATIONS_H'. - (cff_get_advances): Use `ttface->variation_support'. + * include/freety[e/internal/fttrace.h: Add `trace_psprops'. - * src/truetype/ttdriver.c (tt_get_advances): Use - `ttface->variation_support'. + * src/base/ftpsprop.c: Include necessary header files. + (FT_COMPONENT): Define. + (ps_property_set): Tag with `FT_BASE_CALLBACK_DEF'. + (ps_property_get): Tag with `FT_BASE_CALLBACK_DEF'. + Harmonize declaration with corresponding function typedef. - * src/truetype/ttgload.c (TT_Process_Simple_Glyph, - load_truetype_glyph): Use `ttface->variation_support'. +2017-12-27 Werner Lemberg -2016-12-21 Werner Lemberg + Provide support for intra-module callback functions. - [truetype, sfnt] Introduce font variation flags to `TT_Face'. + This is needed especially for `make multi' with C++. - * include/freetype/internal/tttypes.h (TT_FACE_FLAG_VAR_XXX): - New macros describing available functionality of various OpenType - tables related to font variation. - (TT_Face): New fields `variation_support' and `mvar_support', - replacing and extending `use_fvar'. + * include/freetype/config/ftconfig.h (FT_BASE_CALLBACK, + FT_BASE_CALLBACK_DEF): New macros. - * src/sfnt/sfobjs.c (sfnt_init_face, sfnt_load_face): Use - `variation_support'. +2017-12-25 Ewald Hew - * src/truetype/ttgxvar.c (ft_var_load_hvar): Set `variation_support' - field. - (TT_Vary_Apply_Glyph_Deltas): Updated. + Move PostScript drivers' property handlers to `base'. -2016-12-21 Werner Lemberg + This reduces the amount of duplicated code across PostScript + drivers. - [base] Improve sanity check for Mac resources (#49888). + * src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c + ({cff,cid,t1}_property_{get,set}): Moved to... + * include/freetype/internal/ftpsprop.h: ...this new file. + (ps_property_{get,set}): New functions to replace moved ones. - * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Abort if `rlen' is not - positive. + * src/base/ftpsprop.c: New file that implements above functions. -2016-12-20 Werner Lemberg + * include/freetype/internal/internal.h + (FT_INTERNAL_POSTSCRIPT_PROPS_H): New macro. - [base] More sanity checks for Mac resources. + * src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c: + Updated. - We use + * src/base/Jamfile, src/base/rules.mk (BASE_SRC), src/base/ftbase.c: + Updated. - https://github.com/kreativekorp/ksfl/wiki/Macintosh-Resource-File-Format +2017-12-20 Werner Lemberg - and + Speed up FT_Set_Var_{Design,Blend}_Coordinates if curr == new. - https://developer.apple.com/legacy/library/documentation/mac/pdf/MoreMacintoshToolbox.pdf#page=151 + We exit early if the current design or blend coordinates are + identical to the new ones. - as references. + * src/truetype/ttgxvar.c (tt_set_mm_blend, TT_Set_Var_Design): + Implement it, returning internal error code -1 if there will be no + variation change. - * include/freetype/internal/ftrfork.h (FT_RFork_Ref): Use FT_Short - for `res_id'. + * src/type1/t1load.c (t1_set_mm_blend): Ditto. - * src/base/ftrfork.c (FT_Raccess_Get_HeaderInfo): Extract map length - and use it to improve sanity checks. - Follow the specification more closely;in particular, all data types - are signed, not unsigned. - (FT_Raccess_Get_DataOffsets): Follow the specification more closely; - in particular, all data types are signed, not unsigned. - Add some sanity checks. + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, + FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Updated. -2016-12-20 Werner Lemberg +2017-12-18 Werner Lemberg - [truetype] Improve logic for getting fast advance widths. + [sfnt] Fix charmap type 2 iterator (#52646). - * src/cff/cffdrivr.c (cff_get_advances), src/truetype/ttdriver.c - (tt_get_advances): Use `is_default_instance' for test; this gets - recomputed after changing blend coordinates. + The subsetted demo font of the report that exhibits the bug has a + very unusual type 2 cmap for Unicode(!): It contains only two + sub-headers, one for one-byte characters (covering the range 0x20 to + 0xFA), and a second one for higher byte 0x01 (just for character + code U+0131). -2016-12-20 Ben Wagner - Werner Lemberg + Before this commit, the iterator wasn't able to correctly handle a + sub-header for higher byte 0x01. - [truetype] Fix linear metrics of GX variation fonts (#49829). + * src/sfnt/ttcmap.c (tt_cmap2_char_next): Fix character increment + for outer loop. - When asking for an unhinted non-default variations, - `linearVertAdvance' is currently the value from the `hmtx' table - instead of the actual value after applying the variation. `HVAR' - support fixes this, but fonts will exist without that table and will - need sane fallback. +2017-12-18 Matthias Clasen - Problem also reported as + [truetype] Fix clamping, minor tracing code beautification. - https://bugs.chromium.org/p/skia/issues/detail?id=5917 + * src/truetype/ttgxvar.c (ft_var_to_normalized): Trace number of + design coordinates. + Use clamped value. - * src/truetype/ttgload.c (TT_Process_Simple_Glyph, - load_truetype_glyph): Implement linear advance adjustments if `HVAR' - or `VVAR' tables are missing. +2017-12-18 Werner Lemberg -2016-12-20 Werner Lemberg + * src/*/*: Only use `ft_' and `FT_' variants of stdc library stuff. - [cff, truetype] Fast advance width retrieval for fonts with HVAR. +2017-12-18 Werner Lemberg - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + * src/truetype/ttgxvar.c (tt_face_vary_cvt): Add size guard (#52688). - * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Don't handle MM. +2017-12-18 Werner Lemberg - * src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (cff_get_advances): Test for HVAR and VVAR. + [truetype] Fix previous commit. - * src/truetype/ttdriver.c (tt_get_advances): Test for HVAR and VVAR. + * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Correctly handle + unhinted phantom points, which must be properly scaled. -2016-12-18 Werner Lemberg +2017-12-18 Werner Lemberg - [base] Fix invalid mac font recursion. + [truetype] Don't apply HVAR and VVAR deltas twice (#52683). - Reported as + * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Always adjust + `pp1' to `pp4', except if we have an HVAR and/or VVAR table. - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=304 + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Handle + alternative code branch identically w.r.t. presence of an HVAR + and/or VVAR table. - * src/base/ftobjs.c (FT_Open_Face): Code moved to... - (ft_open_face_internal): ... this function. - Add a parameter to control whether we try special Mac font handling - in case of failure. - (FT_Open_Face, FT_New_Face, FT_New_Memory_Face, - open_face_from_buffer): Use `ft_open_face_internal'. +2017-12-17 Jonathan Kew -2016-12-18 Werner Lemberg + [truetype] Correctly handle variation font phantom points (#52683). - * src/cff/cffobjs.c (cff_face_init): Make named instances work. + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix phantom + point indices. -2016-12-18 Werner Lemberg +2017-12-17 Jonathan Kew - [truetype, cff] Extend `get_var_blend' function of MM service. + Fix incorrect advance width scaling (#52683). - In particular, we need access to named instance data. + * src/base/ftadvance.c (FT_Get_Advances): Always respect the + FT_LOAD_NO_SCALE flag if present. - * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): - Add argument for `FT_MM_Var'. +2017-12-16 Alexei Podtelezhnikov - * src/cff/cffload.c (cff_get_var_blend): Updated. - * src/cff/cffload.h: Updated. + * builds/windows/vc2010/freetype.vcxproj: AfterBuild copy. + * objs/.gitignore: Ignore almost everything. - * src/cff/cf2ft.c (cf2_getNormalizedVector): Updated. +2017-12-11 Werner Lemberg - * src/truetype/ttgxvar.c (tt_get_var_blend): Updated. - Accept value `NULL' for arguments. - * src/truetype/ttgxvar.h: Updated. + Fix compiler warning (#52640). -2016-12-18 Werner Lemberg + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Remove unused + variable. - [sfnt] Handle `fvar' with zero axes as a non-MM font. +2017-12-08 Azzuro - This is better behaviour than exiting with an error. + * builds/windows/vc2010/freetype.vcxproj: Adjust output directory. - * include/freetype/internal/tttypes.h (TT_Face): Add `use_fvar' - field. + This allows builds with different configurations in parallel. - * src/sfnt/sfobjs.c (sfnt_init_face): Compute `use_fvar', also - updating the validation code. - Use `use_fvar' to compute FT_FACE_FLAG_MULTIPLE_MASTERS. +2017-12-08 Werner Lemberg - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Remove `fvar' validation - code. + Fix `make setup dos', second try (#52622). -2016-12-18 Werner Lemberg + * builds/detect.mk (dos_setup): Don't use literal `>' character at + all. Mixing the different escaping rules from make, dos, and + windows is too fragile. - Minor GX code shuffling. +2017-12-08 Werner Lemberg - * include/freetype/internal/tttypes.h (TT_Face): Move - `is_default_instance' into TT_CONFIG_OPTION_GX_VAR_SUPPORT - block. + [docmaker] Fix code section parsing. - * src/sfnt/sfobjs.c (sfnt_init_face): Updated. - * src/truetype/ttgload.c (IS_DEFAULT_INSTANCE): New macro. - (TT_Load_Glyph): Use it. + Stuff like -2016-12-18 Werner Lemberg + { + + } - [cff] Better handling of non-CFF font formats. + confused the parser, which incorrectly treated `' as a markup + tag. - * src/cff/cffload.c (cff_font_load): Pure CFFs don't have a - signature, so return `FT_Err_Unknown_File_Format' more often. + * src/tools/docmaker/content.py (ContentProcessor::process_content): + Apply `re_markup_tags' only outside of code sections. -2016-12-17 Werner Lemberg +2017-12-08 Werner Lemberg - * src/cff/cffload.c (cff_build_blend_vector): Remove redundant code. + New `ftdriver.h' file, covering all driver modules. -2016-12-17 Werner Lemberg + This reduces redundancy and increases synergy; it also reduces the + number of header files. - * src/truetype/ttobjs.c (tt_face_init): Simplify conditional code. + * include/freetype/config/ftheader.h (FT_DRIVER_H): New macro. + (FT_AUTOHINTER_H, FT_CFF_DRIVER_H, FT_TRUETYPE_DRIVER_H, + FT_PCF_DRIVER_H, FT_TYPE1_DRIVER_H): Make them aliases to + FT_DRIVER_H. -2016-12-17 Werner Lemberg + * include/freetype/ftautoh.h, include/freetype/ftcffdrv.h, + include/freetype/ftpcfdrv.h, include/freetype/ftt1drv.h, + include/freetype/ftttdrv.h: Replaced with... + * include/freetype/ftdriver.h: ...this new file. + (FT_CFF_HINTING_ADOBE, FT_T1_HINTING_ADOBE): Renamed to... + (FT_HINTING_ADOBE): ... this new macro. + (FT_CFF_HINTING_FREETYPE, FT_T1_HINTING_FREETYPE): Renamed to... + (FT_HINTING_FREETYPE): ... this new macro. - [sfnt, truetype] Various sanitizing fixes. + * src/*/*: Updated accordingly. - * src/sfnt/sfobjs.c (sfnt_init_face): If the axis count in `fvar' is - zero, set `num_instances' to zero. +2017-12-08 Werner Lemberg - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Handle `fvar' table with - zero axes as invalid. + Move `ftdriver.h' to `ftdrv.h'. - * src/truetype/ttobjs.c (tt_face_init): Improve logic of loading - `loca', `cvt', `fpgm', and `prep' table. + * include/freetype/internal/ftdriver.h: Renamed to... + * include/freetype/internal/ftdrv.h: ... this name. -2016-12-17 Werner Lemberg + * include/freetype/internal/internal.h (FT_INTERNAL_DRIVER_H): + Updated. - Improve tracing of `FT_Open_Face'. +2017-12-08 Werner Lemberg - * src/base/ftobjs.c (FT_Open_Face): Return info on number of - available faces and numbered instances, or the indices of the - requested face and numbered instance. + Fix access to uninitalized memory (#52613). - * src/sfnt/sfobjs. (sfnt_open_font): Trace number of subfonts. + Also reported as -2016-12-17 Werner Lemberg + https://bugs.chromium.org/p/chromium/issues/detail?id=791317 - * src/cff/cffload.c (cff_load_private_dict): Always init `blend'. + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): If increasing the + bitmap size needs a larger bitmap buffer, assure that the new memory + areas are initialized also. - Reported as +2017-12-08 Werner Lemberg - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=295 + Fix `make setup dos' (#52622). -2016-12-16 Werner Lemberg + * builds/detect.mk (dos_setup): Properly escape literal `>' + character. - [truetype] Fix `cvar' sanity test. +2017-12-07 Werner Lemberg - Reported by Dave Arnold. + Fix C++ compilation. - * src/truetype/ttgxvar.c (tt_face_vary_cvt): Use tuple count mask. + * src/psaux/psauxmod.h: Use FT_CALLBACK_TABLE macro where necessary. -2016-12-16 Werner Lemberg + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Fix warning. - [cff, truetype] Remove compiler warnings; fix `make multi'. +2017-12-07 Werner Lemberg - * src/cff/cf2font.h: Include `cffload.h'. + Fix `make multi'. - * src/cff/cffload.c: Include FT_MULTIPLE_MASTERS_H and - FT_SERVICE_MULTIPLE_MASTERS_H. - (cff_vstore_load): Eliminate `vsSize'. - (cff_load_private_dict): Tag as `FT_LOCAL_DEF'. + * include/freetype/internal/fttrace.h: Remove unused tracing macros. + s/pshalgo2/pshalgo/. + Add `trace_cffdecode'. + * src/pshinter/pshalgo.c (FT_COMPONENT): Updated. - * src/cff/cffload.h: Include `cffobjs.h'. - Provide declaration for `cff_load_private_dict'. + * src/cff/cffload.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H. + * src/cff/cffobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H and + FT_SERVICE_CFF_TABLE_LOAD_H. - * src/truetype/ttgxvar.c (ft_var_load_hvar): Eliminate - `minorVersion' and `map_offset'. + * src/cid/cidriver.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H. -2016-12-16 Werner Lemberg + * src/psaux/cffdecode.c: Include FT_FREETYPE_H and + FT_INTERNAL_DEBUG_H. + (FT_COMPONENT): Define. + * src/psaux/cffdecode.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H. + * src/psaux/psauxmod.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H. + Declare `cff_builder_funcs' and `ps_builder_funcs'. + * src/psaux/psft.c: Include `psobjs.h' and `cffdecode.h'. + * src/psaux/psobjs.c : Include `psauxmod.h'. - [cff] Fix heap buffer overflow (#49858). +2017-12-07 Werner Lemberg - * src/cff/cffparse.c (cff_parser_run): Add one more stack size - check. + * include/freetype/config/ftheader.h: Some clean-up. -2016-12-15 Werner Lemberg + This commit removes documentation of deprecated macros and does some + minor streamlining. - Fix clang warnings. +2017-12-06 Werner Lemberg - * src/cff/cffload.c (cff_blend_doBlend): Add cast. - (cff_subfont_load): Set `error' correctly. + * builds/symbian/bld.inf: Updated. - * src/sfnt/ttmtx.c (tt_face_get_metrics): Typo. +2017-12-06 Werner Lemberg -2016-12-15 Dave Arnold - Werner Lemberg + New header file `ftparams.h' that collects all parameter tags. - [cff] Implement CFF2 support (2/2). + * include/freetype/config/ftheader.h (FT_PARAMETER_TAGS_H): New + macro. + (FT_TRUETYPE_UNPATENTED_H, FT_UNPATENTED_HINTING_H): Define it to + `ftparams.h'. - The font variation code. All parts dependent on the GX code in the - `truetype' module are guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. - In other words, you can still compile the `cff' module without - defining TT_CONFIG_OPTION_GX_VAR_SUPPORT (which brings you CFF2 - support without font variation). + * include/freetype/ftautoh.h, include/freetype/ftcffdrv.h, + include/freetype/ftincrem.h, include/freetype/ftlcdfil.h, + include/freetype/ftsnames.h, include/freetype/ftt1drv.h: Include + FT_PARAMETER_TAGS_H. + Move FT_PARAM_TAG_XXX definitions to... + * include/freetype/ftparams.h: ...this new file. - * src/cff/cf2font.c (cf2_font_setup): Add support for font - variation. - * src/cff/cf2font.h (CF2_Font): Add fields for variation data. + * include/freetype/ttunpat.h: Remove. No longer needed. - * src/cff/cf2ft.c (cf2_free_instance): Free blend data. - (cf2_getVStore, cf2_getNormalizedVector): New functions. - * src/cff/cf2ft.h: Updated. +2017-12-05 Werner Lemberg - * src/cff/cf2intrp.c: Include `cffload.h'. - (cf2_cmdRESERVED_15, cf2_cmdRESERVED_16): Replace with... - (cf2_cmdVSINDEX, cf2_cmdBLEND): ... this new enum values. - (cf2_doBlend): New function. - (cf2_interpT2CharString): Handle `vsindex' and `blend' opcodes. + Improve tracing messages by using singular and plural forms. - * src/cff/cffload.c (FT_fdot14ToFixed): New macro. - (cff_vstore_done, cff_vstore_load): New functions. - (cff_blend_clear, cff_blend_doBlend, cff_blend_build_vector, - cff_blend_check_vector): New functions. - (cff_load_private_dict): Add arguments for blend vector. - Handle blend data. - (cff_subfont_load, cff_subfont_done): Updated. - (cff_font_load): Handle CFF2 variation store data. - (cff_font_done): Updated. - * src/cff/cffload.h: Include `cffparse.h'. - Updated. + * src/*/*.c: Implement it. - * src/cff/cffobjs.c (cff_face_done): Updated. +2017-12-04 Werner Lemberg - * src/cff/cffparse.c: Include `cffload.h'. - (cff_parse_num): Handle internal value 255. - (cff_parse_vsindex, cff_parse_blend): New functions. - (CFF_FIELD_BLEND): New macro. - (cff_parser_run): Updated. - * src/cff/cffparse.h (cff_kind_blend): New enum value. + [truetype] Allow shared points in `cvar' table (#52532). - * src/cff/cfftoken.h: Handle `vstore', `vsindex', and `blend' - dictionary values. + * src/truetype/ttgxvar.c (tt_face_vary_cvt): Implement it by copying + and adjusting the corresponding code from + `TT_Vary_Apply_Glyph_Deltas'. - * src/cff/cfftypes.h (CFF_VarData, CFF_AxisCoords, CFF_VarRegion, - CFF_VStore, CFF_Blend): New structures. - (CFF_FontRecDict): Add `vstore_offset' field. - (CFF_Private): Add `vsindex' field. - (CFF_SubFont): Add fields for blend data. - (CFF_Font): Add `vstore' field. +2017-11-28 Werner Lemberg - * src/truetype/ttgxvar.c (TT_Get_MM_Var): `CFF2' is equal to `gvar', - since glyph variation data is directly embedded. - (TT_Set_MM_Blend): Don't load `gvar' table for CFF2 fonts. + [truetype] Improving tracing of composite glyphs. -2016-12-15 Dave Arnold - Werner Lemberg + * src/truetype/ttgload.c (TT_Load_Composite_Glyph) + [FT_DEBUG_LEVEL_TRACE]: Show composite glyph information. - [cff] Implement CFF2 support (1/2). +2017-11-27 Werner Lemberg - This commit does not contain the blend code for font variation - support, which follows in another commit. + [type1] Allow (again) `/Encoding' with >256 elements (#52464). - You should ignore whitespace while inspecting this commit. + In version 2.6.1, this has been disallowed to better reject + malformed fonts; however, this restriction was too strong. This + time, we only take the first 256 elements into account, since + encoding arrays are always accessed with a 8bit integer, according + to the PostScript Language Reference. - * include/freetype/internal/tttypes.h (TT_Face): Add `isCFF2' - member. + * src/type1/t1load.c (parse_encoding): Implement it. - * src/cff/cf2font.h (CF2_Font): Add `isCFF2' member. +2017-11-27 Jan Alexander Steffens (heftig) - * src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Handle `isCFF2' - flag. - (cf2_getMaxstack): New function. - * src/cff/cf2ft.h: Updated. + Fix last commit (#52522). - * src/cff/cf2intrp.c (cf2_escRESERVED_38): New enum. - (cf2_interpT2CharString): Handle CFF2 differences. - Add tracing message for errors. + * builds/freetype.mk: Set `FT_OPTION_H' and `FTOPTION_FLAG' + properly if we have `ftoption.h' in `BUILD_DIR'. - * src/cff/cffdrivr.c (cff_get_glyph_name, cff_get_name_index): - Update for CFF2. +2017-11-24 Werner Lemberg - * src/cff/cffload.c (FT_FIXED_ONE): New macro. - (cff_index_init, cff_index_load_offsets, cff_index_access_element, - cff_index_get_name, cff_ft_select_get, cff_load_private_dict, - cff_subfont_load, cff_font_load): Handle CFF2. - * src/cff/cffload.h: Updated. + [unix] Install a massaged `ftoption.h' file (#51780). - * src/cff/cffobjs.c (cff_face_init): Handle CFF2. + * builds/unix/configure.raw (ftoption_set, ftoption_unset): New + auxiliary functions to construct... + (FTOPTION_H_SED): ... this new variable. + Apply it as a sed argument while copying `ftoption.h' to the + `builds/unix' directory (using `AC_CONFIG_FILES'). + Simplify code of test that checks cpp's computation of bit length + (the test previously created an empty `ftoption.h' file and deleted + it immediately afterwards); without this change, it can happen on my + GNU/Linux box that `configure's execution of `config.status' doesn't + create `ftoption.h' (no idea why this happens). - * src/cff/cffparse.c (cff_parse_maxstack): New function. - (CFFCODE_TOPDICT, CFFCODE_PRIVATE): Removed - * src/cff/cffparse.h (CFF2_MAX_STACK, CFF2_DEFAULT_STACK): New - macros. - (CFF2_CODE_TOPDICT, CFF2_CODE_FONTDICT, CFF2_CODE_PRIVATE): New - macros. + * builds/unix/install.mk (install): Install + `builds/unix/ftoption.h'. - * src/cff/cfftoken.h: Add fields for CFF2 dictionaries (but no blend - stuff). + * builds/unix/unix-def.in (DISTCLEAN): Updated. - * src/cff/cfftypes.h (CFF_Index): Add `hdr_size' field. - (CFF_FontRecDict): Add `maxstack' field. - (CFF_Private): Add `subfont' field. - (CFF_Font): Add `top_dict_length' and `cff2' fields. + * builds/unix/.gitignore: Updated. - * src/sfnt/sfobjs.c (sfnt_load_face): Handle `CFF2' table. +2017-11-23 Tor Andersson -2016-12-15 Werner Lemberg - Dave Arnold + Silence unused function warnings (#52465). - [truetype] Provide HVAR advance width variation as a service. + Some static function declarations cause unused function warnings if + certain config options are turned off via `ftoption.h'. - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + * src/base/ftbase.h, src/base/ftrfork.c, src/sfnt/ttbdf.h, + src/truetype/ttgxvar.h: Add #ifdef guards around these sections. - * src/truetype/ttdriver.c (tt_service_metrics_variations): Updated. +2017-11-22 Ewald Hew - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Prevent - double adjustment of advance width. + * src/psaux/psft.c (cf2_setGlyphWidth): Check format before setting. - * src/sfnt/ttmtx.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (tt_face_get_metrics): Apply metrics variations. + Reported as -2016-12-15 Dave Arnold - Werner Lemberg + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4377 - [truetype] Provide function to apply `HVAR' advance width variation. +2017-11-22 Ewald Hew - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + [psaux] Fix CFF advance widths. (#52466) - * src/truetype/ttgxvar.c (tt_hadvance_adjust): New function. - * src/truetype/ttgxvar.h: Updated. + Glyph advance widths were being written to the new `PS_Decoder' but not + saved to the underlying format specific decoder. This caused pure CFF + fonts to have bad advance width. -2016-12-15 Dave Arnold - Werner Lemberg + * include/freetype/internal/psaux.h (PS_Decoder): Change `glyph_width' + field to pointer. + Remove unused fields. + * src/psaux/psobjs.c (ps_decoder_init): Change `glyph_width' from copy + to reference. + Remove unused. + * src/psaux/psft.c (cf2_setGlyphWidth): Update code. - [truetype] Add `HVAR' table parsing. +2017-11-15 Vlad Tsyrklevich - Note that this is not complete yet; it only handles advance width - variation. + * include/freetype/ftrender.h: Fix `FT_Renderer_RenderFunc' type. - Activation of the code follows in another commit. +2017-11-14 Nikolaus Waxweiler - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + Use Adobe hinting engine for `light' hinting of both CFF and Type 1. - * include/freetype/ftmm.h (FT_Var_Named_Style): Add `psid' member. + Since Ewald Hew factored the Adobe hinting engine out of the CFF + driver code, we can now use it on Type 1 (and CID) font formats, as + both have the same hinting philosophy. - * src/truetype/ttgxvar.h (GX_HVarData, GX_AxisCoords, GX_HVarRegion, - GX_HVStore, GX_WidthMap): New auxiliary structures for... - (GX_HVarTable): ... HVAR main structure. - (GX_BlendRec): Add data for HVAR loading. + This change activates the Adobe hinter when in LIGHT mode, and + therefore always unless explicitly asking for the auto-hinter. This + makes LIGHT behavior consistent with CFF fonts. As of this commit, + the hinting engine table looks as follows. - * src/truetype/ttgxvar.c (FT_FIXED_ONE, FT_fdot14ToFixed, - FT_intToFixed, FT_fixedToInt): New macros. - (ft_var_load_hvar): New function. - (TT_Get_MM_Var): Updated. - (tt_done_blend): Deallocate HVAR data. + LIGHT NORMAL + ------------------------- + TrueType Auto v40 + CFF Adobe Adobe + Type 1 Adobe Adobe -2016-12-15 Dave Arnold +2017-11-10 Yuri Levchenko - [cff] Extend number parsing. + * CMakeLists.txt: Add `DISABLE_FORCE_DEBUG_PREFIX' option. - The forthcoming CFF2 support needs a dynamic parsing limit. +2017-11-06 Alexei Podtelezhnikov - * src/cff/cffparse.c (cff_parse_num, do_fixed, cff_parse_fixed, - cff_parse_fixed_scaled, cff_parse_fixed_dynamic): Add argument for - parser. - (cff_parse_font_matrix, cff_parse_font_bbox, cff_parse_private_dict, - cff_parse_multiple_master, cff_parse_cid_ros, cff_parser_run): Updated. + * src/base/ftobjs.c (FT_Load_Glyph): Relocate condition. - * src/cff/cffparse.h (cff_parse_num): Export locally. +2017-11-06 Alexei Podtelezhnikov -2016-12-15 Dave Arnold + * src/smooth/ftgrays.c (gray_set_cell): Fix uninitialized variables. - [cff] Implement dynamic stack size for Adobe engine. +2017-11-03 Ewald Hew - This also adds `cf2_stack_setReal' and `cf2_stack_pop', needed for - the forthcoming CFF2 support. + [psaux] Fix PostScript interpreter rewinding in Type 1 mode. (#52251) - * src/cff/cf2stack.c (cf2_stack_init): Add argument for stack size. - (cf2_stack_free): Deallocate stack. - (cf2_stack_count, cf2_stack_pushInt, cf2_stack_pushFixed, - cf2_stack_popInt, cf2_stack_popFixed, cf2_stack_getReal, - cf2_stack_clear): Updated. - (cf2_stack_setReal, cf2_stack_pop): New functions. + The interpreter in Type 1 mode rewinds the charstring after collecting + all hints for building the initial hintmap (commit d52dd7f). However, + some charstrings use `endchar' in a final subroutine call, rewinding to + the start of that subroutine, and only a small section of the actual + glyph is drawn. - * src/cff/cf2stack.h (CF2_Stack): Add `stackSize' member. - Update function declarations. + * src/psaux/psintrp.c (cf2_interpT2CharString) : + Ensure we are on the top level charstring before rewinding. - * src/cff/cf2intrp.c (cf2_interpT2CharString): Updated. +2017-11-03 suzuki toshiya - * src/cff/cffparse.c (cff_parser_init): Add parameter for stack - size; return error code. - (cff_parser_done): New function. - (cff_parser_run): Updated. + [truetype] Add more tricky fonts. - * src/cff/cffparse.h (CFF_Parser): Add `stackSize' member and make - `stack' a pointer. - Update function declarations. + See the report by Yang Yinsen. + https://lists.gnu.org/archive/html/freetype-devel/2017-11/msg00000.html - * src/cff/cffload.c (cff_load_private_dict, cff_subfont_load): - Updated. + * src/truetype/ttobjs.c (trick_names): Add `DFGothic-EB', + `DFGyoSho-Lt', `DFHSGothic-W5', `DFHSMincho-W3' and `DFHSMincho-W7'. + (tt_check_trickyness_sfnt_ids): Add checksums for DFGothic-EB, + DFGyoSho-Lt, DFHSGothic-W5, DFHSMincho-W3 and DFHSMincho-W7. Also + add checksums for DLCLiShu and DLCHayBold which their family names + were already listed but their checksums were previously unknown. -2016-12-15 Dave Arnold - Werner Lemberg +2017-11-01 Alexei Podtelezhnikov - [cff] Code shuffling. + [smooth] Fix complex rendering at high ppem. - * src/cff/cfftypes.h (CFF_Font): Add `library' and `base_offset' - fields. + We used to split large glyphs into horizontal bands and continue + bisecting them still horizontally if that was not enough. This is + guaranteed to fail when a single scanline cannot fit into the + rendering memory pool. Now we bisect the bands vertically so that + the smallest unit is a column of the band height, which is guranteed + to fit into memory. - * src/cff/cffload.c (cff_subfont_load): Change last argument to - `CFF_Font' - Split off parsing of private dictionary into... - (cff_load_private_dict): ...this new function. - (cff_font_load): Updated. + * src/smooth/ftgrays.c (gray_convert_glyph): Implement it. -2016-12-14 Werner Lemberg +2017-10-20 Alexei Podtelezhnikov - [sfnt, truetype] Add framework for Metrics Variations service. + [smooth] Improve complex rendering at high ppem. - No effect yet; service functions will be implemented later on. + At large sizes almost but not exactly horizontal segments can quickly + drain the rendering pool. This patch at least avoids filling the pool + with trivial cells. Beyond this, we can only increase the pool size. - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + Reported, analyzed, and tested by Colin Fahey. - * include/freetype/internal/services/svmetric.h: New file. + * src/smooth/ftgrays.c (gray_set_cell): Do not record trivial cells. - * include/freetype/internal/ftserv.h - (FT_SERVICE_METRICS_VARIATIONS_H): New macro. +2017-10-20 Alexei Podtelezhnikov - * include/freetype/internal/tttypes.h (TT_Face): New field `var'. + [base] Improve tracing in FT_Load_Glyph, FT_*_Size. - * src/sfnt/sfobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (sfnt_init_face): Initialize `face->var'. + * src/base/ftobjs.c (FT_Load_Glyph): Tag tracing messages with + function name, glyph index, and load flags. + (FT_Select_Metrics, FT_Request_Metrics): Remove all tracing. + (FT_Select_Size, FT_Request_Size): Improve tracing. - * src/truetype/ttdriver.c: Include FT_SERVICE_METRICS_VARIATIONS_H. - (tt_service_metrics_variations): New service. - (tt_services): Updated. +2017-10-18 Alexei Podtelezhnikov - * src/truetype/ttpic.h: Updated. + [base] Improve tracing in FT_Render_Glyph. -2016-12-14 Werner Lemberg + * src/base/ftobjs.c (FT_Render_Glyph_Internal): Add total coverage + calculations and downgrade Netpbm dump to bitmap:7. - [cff] Add Multiple Masters service. +2017-10-15 Ewald Hew - The code simply uses the MM functions from the `truetype' module. + [cff] Fix segfault on missing `psaux' (#52218) - Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + * src/cff/cffload.c (cff_done_blend): Add a check for possible nullptr. - * include/freetype/internal/tttypes.h (TT_Face): New field `mm'. + * modules.cfg: Update dependency list. - * src/cff/cffdrivr.c: Include FT_SERVICE_MULTIPLE_MASTERS_H. - (cff_set_mm_blend, cff_get_mm_blend, cff_get_mm_var, - cff_set_var_design, cff_get_var_design): New functions. - (cff_service_multi_masters): New service. - (cff_services): Updated. +2017-10-15 Alexei Podtelezhnikov - * src/cff/cffload.c (cff_get_var_blend, cff_done_blend): New - functions. - * src/cff/cffload.h: Updated. + [base, cff] Fix MSVC warnings. - * src/cff/cffpic.h (CFF_SERVICE_MULTI_MASTERS_GET): New macro. + * src/base/ftobjs.c (FT_New_Library): C4702: unreachable code. + (ft_glyphslot_preset_bitmap): C4244: possible loss of data. + * src/cff/cffload.c (cff_blend_doBlend): C4244: possible loss of data. + Turn `sum' into unsigned. - * src/sfnt/sfobjs.c: Include FT_SERVICE_MULTIPLE_MASTERS_H. - (sfnt_init_face): Initialize `face->mm'. +2017-10-14 Alexei Podtelezhnikov -2016-12-14 Werner Lemberg + [base] Netpbm image tracing. - Extend functionality of `ft_module_get_service'. + * src/base/ftobjs.c (FT_Load_Glyph): Trace bitmap size. + (FT_Render_Glyph_Internal): Trace bitmap in Netpbm format. - It can now differentiate between local and global searches. + * src/smooth/ftgrays.c (gray_sweep): Sweep remnants of span tracing. - * src/base/ftobjs.c (ft_module_get_service): Add `global' argument. - (FT_Get_TrueType_Engine_Type): Updated. +2017-10-14 Alexei Podtelezhnikov - * src/cff/cffdrivr.c (cff_get_ps_name, cff_get_cmap_info): Updated. + * builds/windows/ftdebug.c (FT_Message): Print to stderr. + * builds/wince/ftdebug.c (FT_Message): Ditto. - * include/freetype/internal/ftobjs.h: Updated. - * include/freetype/internal/ftserv.h (FT_FACE_FIND_GLOBAL_SERVICE): - Updated. +2017-10-14 Behdad Esfahbod -2016-12-14 Werner Lemberg + [afshaper] Delay creating `hb_set' objects until needed. - * src/truetype/ttgxvar.c (tt_get_var_blend): Fix compiler warning. + In runs on Noto Naskh Arabic, this results in 89 sets created + instead of 340 before. Makes auto-hinter setup with HarfBuzz + enabled 20% to 30% faster. -2016-12-14 Dave Arnold - Werner Lemberg + * src/autofit/afshaper.c (af_shaper_get_coverage): Implement it. - [sfnt, cff] Minor preparations. +2017-10-12 Ewald Hew - * include/freetype/tttags.h (TTAG_CFF2, TTAG_HVAR, TTAG_MVAR, - TTAG_VVAR): New SFNT table tags. + [type1, cid] Add hinting engine switch. - * src/cff/cf2fixed.h (CF2_FIXED_ONE, CF2_FIXED_EPSILON): Add cast. + Implement property service in `type1' and `cid' drivers to allow + switching between FreeType or Adobe hinting engine when both are + available. -2016-12-10 Werner Lemberg + * src/cid/cidriver.c (cid_property_{set,get}, cid_services), + src/type1/t1driver.c (t1_property_{set,get}, t1_services): Add + Properties service. - [truetype, type1] Add `get_var_blend' to MM service. + * src/cid/cidobjs.c (cid_driver_init), src/type1/t1objs.c + (T1_Driver_Init): Add default property values. - For internal use; we want to share code between the forthcoming CFF2 - support and TrueType. +2017-10-12 Ewald Hew - * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): - New typedef. - (MultiMasters): Add `get_var_blend'. - (FT_Service_MultiMasters): Updated. + Add T1_CONFIG_OPTION_OLD_ENGINE configuration option. - * src/truetype/ttgxvar.c (tt_get_var_blend): New function. - * src/truetype/ttgxvar.h: Updated. + This controls whether the old Type 1 engine gets compiled into FreeType. + It is disabled by default. - * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. - * src/type1/t1driver.c (t1_service_multi_masters): Updated. + * devel/ftoption.h, include/freetype/config/ftoption.h + (T1_CONFIG_OPTION_OLD_ENGINE): New macro. -2016-12-10 Werner Lemberg + * include/freetype/internal/psaux.h (PS_Decoder): Remove unused field. + * include/freetype/internal/psaux.h, src/cid/cidgload.c + (cid_load_glyph), src/psaux/psauxmod.c, src/psaux/psobjs.c + (ps_builder_add_point), src/psaux/t1decode.c + (t1_lookup_glyph_by_stdcharcode, t1_decoder_parse_glyph, + t1operator_seac, t1_decoder_parse_charstrings), src/psaux/t1decode.h, + src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Surround + relevant code with macro. + Minor code changes. - [truetype, type1] Add `done_blend' to MM service. +2017-10-12 Ewald Hew - For internal use; we want to share code between the forthcoming CFF2 - support and TrueType. + Extract width parsing from Type 1 parser. - * include/freetype/internal/services/svmm.h (FT_Done_Blend_Func): - New typedef. - (MultiMasters): Add `done_blend'. - (FT_Service_MultiMasters): Updated. + Duplicate the fast advance width calculations from the old parser. + This is to facilitate adding options for compiling out the old parser. - * src/truetype/ttgxvar.c (tt_done_blend): Use `TT_Face' as argument. - * src/truetype/ttgxvar.h: Updated. + * src/psaux/t1decode.{c,h} (t1_decoder_parse_metrics): New function. + * include/freetype/internal/psaux.h (T1_Decoder_Funcs): New entry + `parse_metrics'. + * src/psaux/psauxmod.c: Set the new entry. - * src/truetype/ttobjs.c (TT_Face_Done): Updated. + * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String), + src/cid/cidgload.c (cid_load_glyph): Separate + conditional for selecting engine. - * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. - * src/type1/t1driver.c (t1_service_multi_masters): Updated. +2017-10-09 Werner Lemberg -2016-12-09 Werner Lemberg + * src/base/ftoutln.c (FT_Outline_Translate): Fix integer overflow. - [sfnt] Revert change from 2016-12-08. + Reported as - I missed the functionality of `ft_module_get_service', which makes - the change unnecessary. + https://bugs.chromium.org/p/chromium/issues/detail?id=772775 -2016-12-08 Werner Lemberg +2017-10-08 Werner Lemberg - Add framework to support services with 8 functions. + * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Integer overflows. - We will need this for CFF variation font support. + Reported as - * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC8): - New macro. + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3579 -2016-12-08 Werner Lemberg +2017-10-07 Werner Lemberg - [sfnt] Add `get_glyph_name' and `get_name_index' to SFNT interface. + [sfnt] Adjust behaviour of PS font names for variation fonts. - CFF2 fonts will need access to those two functions. + * src/sfnt/sfdriver.c (sfnt_get_var_ps_name): Use a named instance's + PS name only if no variation is applied. - * include/freetype/internal/sfnt.h: Include FT_SERVICE_GLYPH_DICT_H. - (SFNT_Interface): Add `get_glyph_name' and `get_name_index' members. - (FT_DEFINE_SFNT_INTERFACE): Updated. +2017-10-07 Werner Lemberg - * src/sfnt/sfdriver.c (sfnt_get_glyph_name, sfnt_get_name_index): - Fix signatures to exactly correspond to the glyph dict service - function typedefs. - (sfnt_interface): Updated. + [cff, truetype] Adjust behaviour of named instances. -2016-12-06 Dave Arnold + This commit completely separates the interaction between named + instances and variation functions. In particular, resetting the + variation returns to the current named instance (if set) and not to + the base font. - Add `FT_Get_Var_Design_Coordinates' function. + As a side effect, variation functions no longer change the named + instance index. - Note that the low-level functions aren't implemented yet. + * src/cff/cffobjs.c (cff_face_init): Use MM service's `set_instance' + function. + Also apply `MVAR' table to named instances. - * include/freetype/ftmm.h: Declare. + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Add cast. + (tt_set_mm_blend): No longer check whether requested variation + coincides with a named instance. + (TT_Set_Var_Design): Use current named instance for default + coordinates. + * src/truetype/ttobjs.c (tt_face_init): Use `TT_Set_Named_Instance'. - * include/freetype/internal/services/svmm.h - (FT_Get_Var_Design_Func): New typedef. - (MultiMasters): New MM service function `get_var_design'. - (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. - Update all callers. +2017-10-07 Werner Lemberg - * src/base/ftmm.c (FT_Get_Var_Design_Coordinates): Implement. + Make `FT_Set_Named_Instance' work. - * src/truetype/ttdriver.c: Updated. + * src/cff/cffdrivr.c (cff_set_instance): New function. + (cff_service_multi_masters): Register it. - * src/truetype/ttgxvar.c (TT_Get_Var_Design): New dummy function to - handle `get_var_design' service. + * src/truetype/ttgxvar.c (TT_Set_Named_Instance): New function. * src/truetype/ttgxvar.h: Updated. + * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Register + it. - * src/type1/t1driver.c: Updated. - - * src/type1/t1load.c (T1_Get_Var_Design): New dump function to - handle `get_var_design' service. + * src/type1/t1load.c (T1_Reset_MM_Blend): New function. * src/type1/t1load.h: Updated. + * src/type1/t1driver.c (t1_service_multi_masters): Register it. -2016-12-06 Werner Lemberg - - * src/type1/t1load.c (parse_subrs): Fix memory leak. - - The `subrs' keyword might erroneously occur multiple times. - - Reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=231 - -2016-12-01 Werner Lemberg - - [gzip] Improve building with external zlib (#49673). - - Building FreeType with external zlib 1.2.8 makes msvc 14 stop with - the following error. - - ftgzip.c - zlib-1.2.8\zlib.h(86): error C2061: - syntax error: identifier 'z_const' - zlib-1.2.8\zlib.h(94): error C2054: - expected '(' to follow 'z_const' - zlib-1.2.8\zlib.h(94): error C2085: - 'msg': not in formal parameter list - ... - zlib-1.2.8\zlib.h(877): fatal error C1003: - error count exceeds 100; stopping compilation - - The error happens because FreeType keeps an own copy of zlib-1.1.4 - under `src/gzip'. When building `src/gzip/ftgzip.c' with - FT_CONFIG_OPTION_SYSTEM_ZLIB defined, it uses - - #include - - which correctly finds an external `zlib.h', but `zlib.h' itself has - a line - - #include "zconf.h" - - which makes Visual Studio 2015 find `src/gzip/zconf.h' while - compiling the files in `src/gzip'. - - * src/gzip/zconf.h: Rename to... - * src/gzip/ftzconf.h: ... this. - * src/gzip/zlib.h, src/gzip/rules.mk (GZIP_DRV_SRCS): Updated. - -2016-12-01 Oleksandr Chekhovskyi - - [autofit] Fix Emscripten crash (patch #9180). - - Function calls through pointers must use a matching signature to - work on Emscripten, since such calls are dispatched through lookup - tables grouped by signature. - - * src/autofit/aftypes.h (AF_WritingSystem_ApplyHintsFunc): Fix - typedef. - -2016-11-29 Werner Lemberg - - [smooth] Revert previous commit. Already fixed with 6ca54c64. - -2016-11-29 Werner Lemberg - - [smooth] Avoid conditional jump on uninitialized value (#49711). - - * src/smooth/ftgrays.c (gray_raster_render): Initialize `worker'. - -2016-11-27 Nikolaus Waxweiler - - [autofit] Code shuffling. - - Also improve some comments and remove unused code. - - No functional change. - - * src/autofit/afloader.c (af_loader_load_g): Merged with... - (af_loader_load_glyph): ...this function. - Split off emboldening code into... - (af_loader_embolden_glyph_in_slot): ... this function. +2017-10-07 Werner Lemberg -2016-11-17 Werner Lemberg + Make `FT_FACE_FLAG_VARIATION' work. - Better support of LLP64 systems with gcc (and clang). + * include/freetype/internal/tttypes.h (TT_Face): Remove + `is_default_instance'; this can be replaced with a combination of + `FT_IS_VARIATION' and `FT_IS_INSTANCE'. - * builds/unix/configure.raw: Call `AC_TYPE_LONG_LONG_INT'. + * src/cff/cffdrivr.c (cff_get_advances): Updated. - * builds/unix/ftconfig.in (FT_LONG64): Enable for LLP64 systems (and - suppress warnings) even without `FT_CONFIG_OPTION_FORCE_INT64'. + * src/sfnt/sfdriver.c (sfnt_get_ps_name), src/sfnt/sfobjs.c + (sfnt_init_face): Updated. -2016-11-10 Werner Lemberg + * src/truetype/ttdriver.c (tt_get_advances), src/truetype/ttgload.c + (TT_Process_Simple_Glyph, load_truetype_glyph, IS_DEFAULT_INSTANCE), + src/truetype/ttgxvar.c (tt_set_mm_blend): Updated. + * src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design): + Handle `FT_FACE_FLAG_VARIATION'. - Fix `lcd_weights' array size. + * src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_Design): Handle + `FT_FACE_FLAG_VARIATION'. - * include/freetype/internal/ftobjs.h (FT_LibraryRec): Do it. +2017-10-07 Werner Lemberg - Reported by Nikolaus. - -2016-11-06 Werner Lemberg - - * src/base/ftobjs.c (FT_Render_Glyph_Internal): Fix tracing. - -2016-11-06 Werner Lemberg - - [sfnt] Improve FT_LOAD_BITMAP_METRICS_ONLY for `sbix' format. - - It's unavoidable to call the PNG engine, but to get the metrics it - is sufficient to read the PNG image's header only. - - * src/sfnt/pngshim.c (Load_SBit_Png): Add argument to control the - allocation of the glyph slot. - * src/sfnt/pngshim.h: Updated. - * src/sfnt/ttsbit.c (tt_sbit_decoder_load_png, - tt_face_load_sbix_image, tt_face_load_sbit_image): Updated. - -2016-11-06 Werner Lemberg - - [sfnt] Speed up `sbix' lookup. - - This also fixes a bug introduced in 2016-10-01 which prevents - display of embedded bitmap fonts that use the `sbix' format. - - * src/sfnt/ttsbit.c (tt_face_load_sbit): Store `sbix' size and - offset also in `ebdt_size' and `ebdt_start', respectively. This - makes the test for an embedded bitmap data table succeed for this - format. - - (tt_face_load_strike_metrics) : Use - `ebdt_size' and `ebdt_start' - (tt_face_load_sbix_image): Ditto. - -2016-11-06 Seigo Nonaka - Werner Lemberg - - Introduce a way of quickly retrieving (embedded) bitmap metrics. - - `FT_Load_Glyph' doesn't generate a bitmap for a non-bitmap glyph - until the user calls `FT_Render_Glyph'. However, it always - allocates memory for bitmaps and copies or decodes the contents of a - bitmap glyph, which can be quite slow for PNG data. - - * include/freetype/freetype.h (FT_LOAD_BITMAP_METRICS_ONLY): New - macro. - - * src/base/ftobjs.c (FT_Load_Glyph): Unset FT_LOAD_RENDER if - FT_LOAD_BITMAP_METRICS_ONLY is used. - - * src/sfnt/ttsbit.c (tt_sbit_decoder_alloc_bitmap, - tt_sbit_decoder_load_bitmap): Add argument to control allocation of - the glyph slot. - (tt_sbit_decoder_load_image, tt_sbit_decoder_load_compound, - tt_face_load_sbit_image): Updated. - - * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Quickly exit if - `FT_LOAD_BITMAP_METRICS_ONLY' is set. - - * src/pfr/pfrsbit.c, src/pfr/pfrsbit.h (pfr_slot_load_bitmap): Add - argument to control allocation of the glyph slot. - * src/pfr/pfrobjs (pfr_slot_load): Updated. - - * src/winfonts/winfnt.c (FNT_Load_Glyph): Ditto. - - * docs/CHANGES: Updated. - -2016-11-06 Werner Lemberg - - Synchronize with gnulib (#49448). + New function `FT_Set_Named_Instance'. - * include/freetype/config/ftconfig.h, builds/unix/ftconfig.in, - builds/vms/ftconfig.h (FT_TYPEOF): Update code to use definition in - current version of `intprops.h'. - Other minor synchronization to reduce code differences between the - three files. + No effect yet. -2016-11-03 Behdad Esfahbod + * src/base/ftmm.c (FT_Set_Named_Instance): New function. - [truetype] Clamp variation requests to valid range. + * include/freetype/ftmm.h: Updated. - This is required by OpenType 1.8; it also avoids rounding surprises. +2017-10-07 Werner Lemberg - * src/truetype/ttgxvar.c (TT_Set_Var_Design): Clamp design coordinates - outside of the allowed range to always stay within the range instead - of producing an error. + Add macros for checking whether a font variation is active. -2016-10-29 Werner Lemberg + * include/freetype/freetype.h (FT_FACE_FLAG_VARIATION, + FT_IS_VARIATION): New macros. + No effect yet. - [truetype] Remove clang warnings. +2017-10-07 Werner Lemberg - * src/truetype/ttinterp.h (TT_ExecContextRec): Using `FT_ULong' for - loop counter handling. + Add framework for setting named instance in MM service. - * src/truetype/ttinterp.c: Updated. - (Ins_SCANTYPE): Use signed constant. - (TT_RunIns): Ensure `num_twilight_points' is 16bit. - -2016-10-27 Werner Lemberg - - [truetype] Fix commit from 2014-11-24. - - Problem reported by Hin-Tak Leung . - - * src/truetype/ttpload.c (tt_face_load_hdmx): Fix file checking - logic. - -2016-10-26 Werner Lemberg - - Add `FT_Get_{MM,Var}_Blend_Coordinates' functions. - - * include/freetype/ftmm.h: Declare. - - * include/freetype/internal/services/svmm.h (FT_Get_MM_Blend_Func): - New typedef. - (MultiMasters): New MM service function `get_mm_blend'. + * include/freetype/internal/services/svmm.h (FT_Set_Instance_Func): + New function typedef. + (MultiMasters): Add `set_instance' member. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. - Update all callers. - - * src/base/ftmm.c (FT_Get_MM_Blend_Coordinates, - FT_Get_Var_Blend_Coordinates): Implement. - - * src/truetype/ttdriver.c: Updated. - * src/truetype/ttgxvar.c (TT_Get_MM_Blend): New function to handle - `get_mm_blend' service. - * src/truetype/ttgxvar.h: Updated. + * src/cff/cffdrivr.c (cff_service_multi_masters), + src/truetype/ttdriver (tt_service_gx_multi_masters), + src/type1/t1driver.c (t1_service_multi_masters): Updated. - * src/type1/t1driver.c: Updated. +2017-10-07 Werner Lemberg - * src/type1/t1load.c (T1_Get_MM_Blend): New function to handle - `get_mm_blend' service. - * src/type1/t1load.h: Updated. + [type1] Minor code shuffling. - * docs/CHANGES: Document. + * src/type1/t1load.c (T1_Set_MM_Blend): Make it a wrapper of... + (t1_set_mm_blend): ...this new function. + (T1_Set_MM_Design): Use `t1_set_mm_blend'. -2016-10-26 Werner Lemberg +2017-10-05 Werner Lemberg - * src/type1/t1load.c (parse_subrs): Fix limit check. + * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Fix integer + overflow. Reported as - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=81 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3539 -2016-10-25 Alexei Podtelezhnikov +2017-10-05 Werner Lemberg - [cff] Correct cmap format reporting (#24819). + Fix compiler warnings. - * src/cff/cffdrivr.c (cff_get_cmap_info): Throw an error on synthetic - charmap instead of guessing its format and language. + * src/cff/cffdrivr.c (cff_ps_get_font_extra): Avoid code that relies + on numeric overflow. + Add cast. -2016-10-22 Werner Lemberg + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Fix variable + types, add cast. - [truetype] Fix SCANTYPE instruction (#49394). +2017-10-04 John Tytgat - * src/truetype/ttinterp.c (Ins_SCANTYPE): Only use lower 16bits. + [cff] Add support for `FSType'. -2016-10-22 Werner Lemberg + * include/freetype/internal/cfftypes.h (CFF_FontRec): Add + `font_extra' entry. - [sfnt] Improve handling of invalid post 2.5 tables [#49393]. + * src/cff/cffdrivr.c (cff_ps_get_font_extra): New function to + retrieve FSType info from the embedded PostScript data. + (cff_service_ps_info): Register function. - * src/sfnt/ttpost.c (load_format_25): We need at least a single - table entry. + * src/cff/cffload.c (cff_font_done): Free `font_extra'. -2016-10-14 Werner Lemberg +2017-09-30 Alexei Podtelezhnikov - [truetype] Fix handling of `cvar' table data. + Signedness fixes in bitmap presetting. Reported as - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53 - - * src/truetype/ttgxvar.c (tt_face_vary_cvt): Ignore invalid CVT - indices. - -2016-10-11 Werner Lemberg - - [psaux] Fix handling of invalid flex subrs. - - Problem reported as - - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52 - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings) - : Set `flex_state' after error checking. - -2016-10-11 Werner Lemberg - - * src/truetype/ttgxvar.c (tt_done_blend): Fix deallocation. - -2016-10-08 Werner Lemberg - - * src/cid/cidload.c (cid_face_open): Properly propagate `error'. - -2016-10-08 Werner Lemberg - - [cid] Fix parsing of subr offsets. - - Bug introduced 2016-05-16. - - * src/cid/cidparse.c (cid_parser_new): Fix off-by-one error. + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3514. -2016-10-01 Werner Lemberg + * src/raster/ftrend1.c (ft_raster1_render): Exlicitly signed height. + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto. + * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Explicitly unsigned + subtraction. - [sfnt] Disable bitmap strikes if we don't have a bitmap data table. +2017-09-29 Alexei Podtelezhnikov - * src/sfnt/ttsbit.c (tt_face_load_sbit): Check whether we have - a bitmap data table. + Bitmap metrics presetting [2/2]. -2016-10-01 Alexei Podtelezhnikov + * src/base/ftobjs.c (FT_Load_Glyph): Preset the bitmap metrics when + appropriate but `FT_Render_Glyph' is not called. + * include/freetype/freetype.h (FT_GlyphSlotRec): Document the change. - [smooth] Remove impossibility. +2017-09-28 Alexei Podtelezhnikov - * src/smooth/ftgrays.c (TWorker): Rearrange fields. - (gray_convert_glyph): Remove impossible condition and clean up. + [smooth, raster] Miscellaneous cleanups. -2016-09-29 Werner Lemberg + * src/raster/ftrend1.c (ft_raster1_render): Clean up the exit. + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Reduce + translations and clean up the exit. + (ft_smooth_render_lcd, ft_smooth_render_lcd): Remove unused `error'. - [pcf] Enrich family name with foundry name and glyph width info. +2017-09-28 Ben Wagner - This is a very old patch from openSuSE (from 2006, submitted to - FreeType in 2011) that I forgot to apply. + [truetype] Really, really fix #52082. - https://build.opensuse.org/package/view_file/openSUSE:Factory/freetype2/freetype2-bitmap-foundry.patch + * src/truetype/ttinterp.c (Ins_MDRP): Correct conditional. - Prepend the foundry name plus a space to the family name. There are - many fonts just called `Fixed' which look completely different, and - which have nothing to do with each other. When selecting `Fixed' in - KDE or Gnome one gets results that appear rather random, the style - changes often if one changes the size and one cannot select some - fonts at all. +2017-09-28 Werner Lemberg - We also check whether we have `wide' characters; all put together, - we get family names like `Sony Fixed' or `Misc Fixed Wide'. + * src/psaux/psintrp.c (cf2_doStems): Fix integer overflow. - * src/pcf/pcfread.c (pcf_load_font): Implement it. - - * docs/CHANGES: Document it. - -2016-09-29 Werner Lemberg - - [ftfuzzer] Speed up. - - * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Don't - check for embedded bitmaps if we have a non-default instance. - -2016-09-29 Werner Lemberg - - [truetype] Disallow bitmap strokes for non-default instances. - - Also speed up access of default instances if GX variations are - active. - - * include/freetype/internal/tttypes.h (TT_FaceRec): Add - `is_default_instance' member. - - * src/sfnt/sfobjs.c (sfnt_init_face): Initialize - `is_default_instance'. - - * src/truetype/ttgload.c (TT_Process_Simple_Glyph, - load_truetype_glyph): Add test for default instance. - (TT_Load_Glyph): Load embedded bitmaps for default instance only. - - * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Compute - `is_default_instance'. - -2016-09-29 Werner Lemberg - - [truetype] Clean up `TT_Face' structure. - - * include/freetype/internal/tttypes.h (TT_FaceRec): Remove unused - fields `horz_metrics' and `vert_metrics'. - Update documentation. - - * src/sfnt/sfobjs.c (sfnt_done_face): Updated. - -2016-09-28 Werner Lemberg - - More FT_ZERO usage. - - * src/gxvalid/gxvcommn.c (gxv_ClassTable_validate): - s/ft_memset/FT_MEM_ZERO/. + Reported as - * src/psaux/t1decode.c (t1_decoder_parse_charstrings): - s/ft_memset/FT_ARRAY_ZERO/. + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3510 - * src/raster/ftraster.c (FT_ZERO): Define. - (ft_black_new): Use it. - * src/raster/ftrend1.c (ft_raster1_get_cbox): - s/FT_MEM_ZERO/FT_ZERO/. +2017-09-28 Ewald Hew - * src/smooth/ftgrays.c (FT_ZERO): Define. - (gray_raster_new): Use it. - * src/smooth/ftsmooth.c (ft_smooth_get_cbox): - s/FT_MEM_ZERO/FT_ZERO/. + * src/cid/cidgload.c (cid_slot_load_glyph): Fix memory leak. -2016-09-28 Werner Lemberg + Reported as - */*: s/FT_MEM_ZERO/FT_ZERO/ where appropriate. + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3489 -2016-09-27 Werner Lemberg +2017-09-28 Alexei Podtelezhnikov - [truetype] Trace number of executed opcodes. + Bitmap metrics presetting [1/2]. - * src/truetype/ttinterp.c (TT_RunIns): Implement it. + This mainly just extracts the code for presetting the bitmap metrics + from the monochrome, grayscale, and LCD renderers into a separate + function. -2016-09-27 Werner Lemberg + * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): New function that + calculates prospective bitmap metrics for the given rendering mode. + * include/freetype/internal/ftobjs.h (ft_glyphslot_preset_bitmap): + Declare it. - [truetype] Speed up `TT_Load_Glyph'. + * src/base/ftlcdfil.c (ft_lcd_padding): New helper function that adds + padding to CBox taking into account pecularities of LCD rendering. + * include/freetype/ftlcdfil.h (ft_lcd_padding): Declare it. - This avoids additional calls to `tt_face_lookup_table' for the - `glyf' table, which can be expensive. + * src/raster/ftrend1.c (ft_raster1_render): Reworked to use + `ft_glyphslot_preset_bitmap'. + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto. + (ft_smooth_render_lcd, ft_smooth_render_lcd): The pixel_mode setting + is moved to `ft_glyphslot_preset_bitmap'. - * include/freetype/internal/tttypes.h (TT_LoaderRec): Move - `glyf_offset' field to ... - (TT_FaceRec): ... this structure. - * src/truetype/ttgload.c (load_truetype_glyph): Updated. - (tt_loader_init): Move initialization of `glyf_offset' to ... - * src/truetype/ttpload.c (tt_face_load_loca): ... this function. +2017-09-28 Ewald Hew -2016-09-27 Werner Lemberg + [psaux] Fix compiler warning. - [truetype] Introduce dynamic limits for some bytecode opcodes. + * src/psaux/pshints.c (cf2_hintmap_dump): Add switch for tracing + code. - This speeds up FreeType's handling of malformed fonts. +2017-09-27 Werner Lemberg - * src/truetype/ttinterp.c (TT_RunIns): Set up limits for the number - of twilight points, the total number of negative jumps, and the - total number of loops in LOOPCALL opcodes. The values are based on - the number of points and entries in the CVT table. - (Ins_JMPR): Test negative jump counter. - (Ins_LOOPCALL): Test loopcall counter. + * src/sfnt/ttload.c (tt_face_load_font_dir): Fix compiler warning. - * src/truetype/ttinterp.h (TT_ExecContext): Updated. +2017-09-25 Werner Lemberg - * docs/CHANGES: Updated. + [psaux] Fix compiler warnings. -2016-09-25 Werner Lemberg + * src/psaux/psft.c (cf2_initLocalRegionBuffer): Remove redundant + test. - [truetype] Sanitize only last entry of `loca' table. + * src/psaux/psintrp.c (cf2_interpT2CharString) + : Add casts. - Without this patch, a loca sequence like `0 100000 0 100000 ...', - where value 100000 is larger than the `glyf' table size, makes - FreeType handle the whole `glyf' table as a single glyph again and - again, which is certainly invalid (and can be very slow, too). + * src/psaux/psobjs.c (ps_decoder_init): Add cast. - * src/truetype/ttpload.c (tt_face_get_location): Implement. - Improve tracing messages. +2017-09-25 Ewald Hew -2016-09-25 Werner Lemberg + [psaux] Minor fixes. - * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Fix typo. + * include/freetype/internal/psaux.h, src/psaux/psobjs.{c,h}: + Rearrange `ps_builder_init' arguments to conventional order. -2016-09-24 Werner Lemberg + * src/psaux/psft.c (cf2_decoder_parse_charstrings): Add a check and + notice for `SubFont' in Type 1 mode. - [autofit] Tracing fixes. +2017-09-25 Ewald Hew - * src/autofit/afmodule.c (af_autofitter_load_glyph): Call dumping - functions only if we actually do tracing. + [psaux] Move `psdecode' into `psobjs'. -2016-09-22 Alexei Podtelezhnikov + As the former only contains a single procedure, move it into + `psobjs' for simplicity. Also change the parameter order to the + conventional one. - [smooth] Reduce divisions in the line renderer. + * src/psaux/psdecode.c (ps_decoder_init): Moved to... + * src/psaux/psobjs.c: ...Here. + * src/psaux/psdecode.h, src/psaux/psobjs.h: Ditto. - We don't need some divisions if a line segments stays within a single - row or a single column of pixels. + * include/freetype/internal/psaux.h (PSAux_ServiceRec): Update + `ps_decoder_init' function signature. - * src/smooth/ftgrays.c (gray_render_line) [FT_LONG64]: Make divisions - conditional. + * src/cff/cffgload.c, src/cid/cidgload.c, src/type1/t1gload.c: + Update calls. -2016-09-15 Alexei Podtelezhnikov + * src/psaux/psaux.c, src/psaux/psauxmod.c: Update includes. - * src/smooth/ftgrays.c (gray_sweep): Remove check for empty table. + * src/psaux/Jamfile (_sources), src/psaux/rules.mk (PSAUX_DRV_SRC): + Update file references. -2016-09-14 Alexei Podtelezhnikov +2017-09-25 Ewald Hew - [smooth] Another tiny speed-up. + [psaux] Fix Type 1 hinting. - * src/smooth/ftgrays.c (gray_find_cell): Merge into... - (gray_record_cell): ... this function. + Type 1 hinting breaks sometimes when mid-charstring hints should + have been in the initial hintmap. This fix adds a preprocessing + pass that reads all hints and builds the correct initial hintmap + first, before proceeding to build the glyph outline. -2016-09-11 Alexei Podtelezhnikov + * src/psaux/psintrp.c (cf2_interpT2CharString): New + `initial_map_ready' boolean flag. + Ignore outline commands and hint changes on first pass. + : Add section to build hintmap and rewind. - * src/smooth/ftgrays.c (gray_{find,set}_cell): Remove dubious code. +2017-09-25 Ewald Hew -2016-09-11 Alexei Podtelezhnikov + [psaux] Add tracing for hints. - [smooth] Fix valgrind warning and reoptimize. + * src/psaux/pshints.c (cf2_hintmap_dump): New function. + (cf2_hintmap_insertHint): Trace incoming and inserted hints. + (cf2_hintmap_build): Dump hintmap before and after hint adjustment. - The algorithm calls `gray_set_cell' at the start of each new contour - or when the contours cross the cell boundaries. Double-checking for - that is wasteful. +2017-09-25 Ewald Hew - * src/smooth/ftgrays.c (gray_set_cell): Remove check for a new cell. - (gray_convert_glyph): Remove initialization introduced by 44b172e88. + [psaux] Minor fixes. -2016-09-10 Werner Lemberg + * src/psaux/psintrp.c (cf2_interpT2CharString): Fix check for pop + results. + s/font->decoder/decoder/ where necessary. + : Use + offset parameter in `cf2_doStems' instead of doing correction for + left-sidebearing. - [sfnt] Fix previous commit. +2017-09-25 Ewald Hew - Problems reported as + [cid] Use the new engine. - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40 + * src/cid/cidgload.c: Update includes. + (cid_load_glyph, cid_slot_load_glyph): Implement changes to glyph + loading code as with `type1' module. - We now map the strike index right before accessing the physical - data, not earlier. +2017-09-25 Ewald Hew - * src/sfnt/sfobjs.c (sfnt_load_face): Set `face->sbit_strike_map' - after creating the map so that... + [cid] Add Adobe engine configuration. - * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): ... this function - can be used before and after setting up `sbit_strike_map'. - (tt_face_set_sbit_strike): Revert change. - (tt_sbit_decoder_init, tt_face_load_sbix_image): Map strike index. + This is similar to what was done in the `type1' module. - * src/truetype/ttdriver.c (tt_size_select): Revert change. + * src/cid/cidriver.c (t1cid_driver_class): Update declaration. + * src/cid/cidobjs.c: Include FT_TYPE1_DRIVER_H. + (cid_driver_init): Update code. -2016-09-09 Werner Lemberg +2017-09-25 Ewald Hew - [ftfuzzer] Minor improvements. + [psaux] Change subfont synthesis for CID fonts. - * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Ignore - invalid strikes. - Use better values for call to `FT_Set_Char_Size'. + Change `t1_make_subfont' to take in the Private dict record as an + argument. This is because Type 1 and CID font records in FreeType + have this in different places. -2016-09-09 Werner Lemberg + * src/psaux/psobjs.c (t1_make_subfont): Change `T1_Face' to + `FT_Face' so that CID is also accepted. + Take `PS_Private' as an argument and let caller figure out where the + Private dict actually is. + Update references. - [sfnt] Don't provide (completely) broken strike data. + * include/freetype/internal/psaux.h, src/psaux/psobjs.h: Update + declaration. - FreeType tries to sanitize strike header data; we now reject - completely broken ones. + * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Update + call. - * include/freetype/internal/tttypes.h (TT_FaceRec): New - `sbit_strike_map' array pointer. +2017-09-25 Ewald Hew - * src/base/ftobjs.c (FT_Match_Size): Reject matches where either - width or height would be zero. - Add tracing message in case of error. + [type1] Switch to Adobe engine. - * src/sfnt/sfobjs.c (sfnt_load_face): Populate `sbit_strike_map', - only using (more or less) valid strike header data for - FT_Face's `available_sizes' array. - (sfnt_done_face): Updated. + * src/type1/t1objs.c (T1_Driver_Init): Set default to Adobe engine. - * src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Use - `sbit_strike_map'. - (tt_face_load_strike_metrics): Improve tracing. +2017-09-25 Ewald Hew - * src/truetype/ttdriver.c (tt_size_select): Use `sbit_strike_map'. + [psaux] Extend Adobe interpreter (seac). -2016-09-08 Werner Lemberg + This concludes the changes needed to add Type 1 support. - * Version 2.7 released. - ======================= + * src/psaux/psintrp.c: Update includes. + (cf2_interpT2CharString) : Implement this similarly to + implied seac for CFF. + * src/psaux/t1decode.c (t1_lookup_glyph_by_stdcharcode_ps): New + function to look up the glyph index. - Tag sources with `VER-2-7'. + * src/psaux/psft.c (cf2_getT1SeacComponent, + cf2_freeT1SeacComponent): New functions to get the charstrings for + seac components. - * docs/VERSION.TXT: Add entry for version 2.7. + * src/psaux/t1decode.h, src/psaux/psft.h: Update declarations. - * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, - builds/windows/vc2005/index.html, - builds/windows/vc2008/freetype.vcproj, - builds/windows/vc2008/index.html, - builds/windows/vc2010/freetype.vcxproj, - builds/windows/vc2010/index.html, - builds/windows/visualc/freetype.dsp, - builds/windows/visualc/freetype.vcproj, - builds/windows/visualc/index.html, - builds/windows/visualce/freetype.dsp, - builds/windows/visualce/freetype.vcproj, - builds/windows/visualce/index.html, - builds/wince/vc2005-ce/freetype.vcproj, - builds/wince/vc2005-ce/index.html, - builds/wince/vc2008-ce/freetype.vcproj, - builds/wince/vc2008-ce/index.html: s/2.6.5/2.7/, s/265/27/. +2017-09-25 Ewald Hew - * include/freetype/freetype.h (FREETYPE_MINOR): Set to 7. - (FREETYPE_PATCH): Set to 0. + [psaux] Extend Adobe interpreter (flex in callothersubr). - * builds/unix/configure.raw (version_info): Set to 18:6:12. - * CMakeLists.txt (VERSION_MINOR): Set to 7. - (VERSION_PATCH): Set to 0. + * src/psaux/psintrp.c (cf2_interpT2CharString) + : Fix Flex feature handling (OtherSubrs 0, 1, + 2). + : Do not actually move the `glyphPath' while doing + flex. This is to avoid closing the current contour. - * docs/CHANGES: Updated. +2017-09-25 Ewald Hew -2016-09-08 Werner Lemberg + [psaux] Extend Adobe interpreter (callothersubr). - * src/truetype/ttinterp.c: Include `ttgxvar.h'. + * src/psaux/psintrp.c (cf2_interpT2CharString) + : Copy code from + `t1_decoder_parse_charstrings' (in `t1decode.c'). + OtherSubr 3 (change hints) should reset the hintmask, so that the + new hints are applied. + Fix function calls and stack access. - This fixes the `multi' build. +2017-09-25 Ewald Hew -2016-09-08 Werner Lemberg + [psaux] Extend Adobe interpreter (pop). - [autofit] Another improvement to Armenian support. + * src/psaux/psintrp.c (cf2_interpT2CharString): Change how unhandled + OtherSubr results are stored. Implement the PostScript stack using + an array. + : Ensure that the stack is not cleared after getting + `OtherSubr' results. + Fix stack access. - Suggested by Hrant H Papazian . +2017-09-25 Ewald Hew - * src/autofit/afscript.h: Use better suited characters to derive - default stem widths. + [psaux] Extend Adobe interpreter (callsubr). -2016-09-07 Alexei Podtelezhnikov + * src/psaux/psintrp.c (cf2_interpT2CharString) : + Type 1 mode. - * src/smooth/ftgrays.c (gray_hline): Micro-optimize. + * src/psaux/psft.c (cf2_initLocalRegionBuffer): Add Type 1 mode. -2016-09-06 Alexei Podtelezhnikov +2017-09-25 Ewald Hew - [smooth] Operate in absolute bitmap coordinates. + [psaux] Extend Adobe interpreter (div, four-byte numbers). - Simpler bitmap addressing improves performance by 1.5%. + * src/psaux/psintrp.c (cf2_interpT2CharString) : Add + Type 1 mode. Type 1 requires large integers to be followed by + `div'; cf. `Adobe Type 1 Font Format', section 6.2. + : Push Type 1 four-byte numbers as `Int' always. This is + to ensure `div' and `callsubr' get values they can use. - * src/smooth/ftgrays.c (gray_TWorker): Remove count fields. - (gray_dump_cells, gray_find_cell, gray_set_cell, gray_hline, - gray_sweep, gray_convert_glyph, gray_raster_render): Updated. +2017-09-25 Ewald Hew -2016-09-06 Alexei Podtelezhnikov + [psaux] Extend Adobe interpreter (hints). - [smooth] Improve contour start (take 2). + * src/psaux/psintrp.c (cf2_interpT2CharString) : Add correction for left sidebearing in Type 1 mode. + Allow adding hints mid-charstring. + : Translate into equivalent commands + for three normal stem hints. This requires some recalculation of + stem positions. + Correction for left sidebearing. - * src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly - instead of... - (gray_start_cell): ... this function, which is removed. - (gray_convert_glyph): Make initial y-coordinate invalid. +2017-09-25 Ewald Hew -2016-09-06 Werner Lemberg + [psaux] Extend Adobe interpreter (hsbw, sbw). - [type1] MM fonts support exactly zero named instances (#48748). + * src/psaux/psintrp.c (cf2_doStems): `hsbw' or `sbw' must be the + first operation in a Type 1 charstring. + (cf2_interpT2CharString): Remove unused variables. + : `hsbw' or `sbw' + must be the first operation in a Type 1 charstring. + : Fix data access and add correction for + left sidebearing. - * src/type1/t1load.c (T1_Get_MM_Var): Set `num_namedstyles' to zero. +2017-09-25 Ewald Hew -2016-09-06 Jonathan Kew + [psaux] Extend Adobe interpreter (setcurrentpoint). - [cff] Fix uninitialized memory. + * src/psaux/psintrp.c (cf2_interpT2CharString) + : Fix stack access. - Problem reported as +2017-09-25 Ewald Hew - https://bugzilla.mozilla.org/show_bug.cgi?id=1270288 + [psaux] Extend Adobe interpreter (closepath). - * src/cff/cf2interp.c (cf2_interpT2CharString): Initialize `storage' - array to handle a `get' opcode without a previous `put'. + * src/psaux/psintrp.c (cf2_interpT2CharString) : + Use the right builder function. We can use the `haveWidth' boolean + already present, instead of implementing `parse_state'. -2016-09-05 Alexei Podtelezhnikov +2017-09-25 Ewald Hew - * src/smooth/ftgrays.c (gray_move_to, gray_start_cell): Revert. + [psaux] Add Type 1 operations to Adobe CFF interpreter. -2016-09-05 Alexei Podtelezhnikov + The following Type 1 specific ops have been added (copied from + `t1decode'): - [smooth] Improve contour start. + closepath + vstem3 + hstem3 + seac + sbw + callothersubr + pop + setcurrentpoint + hsbw - * src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly - instead of... - (gray_start_cell): ... this function, which is removed. + The following require a Type 1 mode, because of differences in + specification: -2016-09-05 Werner Lemberg + hstem + vstem + vmoveto + callsubr + div + rmoveto + hmoveto + Numbers - [cff] Fix memory initialization. + The subsequent commits will implement these changes and adapt + accesses of data and objects to the new interpreter. - * src/cff/cf2stack.c (cf2_stack_init): Use `FT_NEW'. The `Q' - variants of FreeType's memory allocation macros don't do zeroing. + NOTE: Will not compile in the meantime! -2016-09-05 Werner Lemberg + * src/psaux/psintrp.c: Add opcodes to enum. + (cf2_interpT2CharString): Copy relevant code over from + `t1_decoder_parse_charstrings' (in `t1decode.c'). - [ftrandom] Minor improvements. +2017-09-25 Ewald Hew - * src/tools/ftrandom/ftrandom.c (_XOPEN_SOURCE): New macro, set to - 500. + [type1] Fixes for rendering. - * src/tools/ftrandom/Makefile (CFLAGS): Split off include - directories to ... - (INCLUDES): ... this new variable. - (LDFLAGS): New variable. - (ftrandom.o, ftrandom): Updated. + The Type 1 advance width calculation passes null for glyph slot, + etc, which can cause null pointer access in the new interpreter. + Fall back to the old one for now. -2016-09-05 Werner Lemberg + Fix the large glyph retry code and ensure hinting and scaling flags + are set properly. - [autofit] Improve Armenian support. + * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Add a + check for metrics_only. + Set the `force_scaling' flag. + (T1_Parse_Glyph): Updated. + (T1_Load_Glyph): Add `hinting' and `scaled' flags. - Thanks to Hrant H Papazian for help. +2017-09-25 Ewald Hew - * src/autofit/afblue.dat (AF_BLUE_STRING_ARMENIAN_*): Improve - selection of characters. + [psaux] Add missing objects (2/2). - * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + Synthesize a `SubFont' object for Type 1 fonts. This is used in the + interpreter to access Private dict data, which are stored in + different places for Type 1 and CFF. This allows the same data to + be used in either mode. -2016-09-04 Werner Lemberg + * src/psaux/psobjs.c (t1_make_subfont): New procedure to copy + required values to a dummy `CFF_SubFont' object. This is similar to + `cff_make_private_dict'. + * src/psaux/psobjs.h: Add the new declaration. - [ftrandom] Improve Makefile. + * include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Ditto. + Add this to the PSAux Service for future use with CID fonts. - It now supports both a normal build (`./configure && make') and a - development build (`make devel'). + * src/type1/t1gload.c: Include FT_INTERNAL_CFF_TYPES_H. + (T1_Parse_Glyph_And_Get_Char_String): Add the call. - * src/tools/ftrandom/Makefile (VPATH): Set it so that - `libfreetype.a' gets searched in both `objs' (for the development - build) and `objs/.libs' (for a normal build which uses libtool). - (LIBS): Add missing libraries. - (ftrandom.o): New rule. - (ftrandom): Use automatic variables. +2017-09-25 Ewald Hew -2016-09-03 Werner Lemberg + [psaux] Add missing objects for Type 1 (1/2). - [truetype] More fixes for handling of GX deltas. + Move `CF2_Font' instance to `PS_Decoder'. This is the context for + the interpreter and since it is currently stored in `CFF_Font', is + unavailable in Type 1 mode. - Problems reported by Bob Taylor . + * include/freetype/internal/psaux.h (T1_Decoder, PS_Decoder): New + `cf2_instance' field. - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix rough - sanity test for glyph variation array header size. - Always set stream position before reading packed x and y deltas. - Fix thinko w.r.t. `localpoints' array. + * src/psaux/psdecode.c (ps_decoder_init): Copy `cf2_instance' to + `PS_Decoder'. -2016-09-03 Werner Lemberg + * src/psaux/t1decode.c (t1_decoder_done): Add finalization code. - [ftrandom] Various fixes. + * src/psaux/psft.c (cf2_decoder_parse_charstrings): Update accesses. - * src/tools/ftrandom/ftrandom.c (GOOD_FONTS_DIR): Provide better - default. - (error_fraction): Make it of type `double' to work as advertized – - this was completely broken. - Update all related code. - (error_count, fcnt): Make it unsigned to fix compiler warnings. - Update all related code. - (fontlist): Change `len' member to `long' to fix compiler warnings. - (FT_MoveTo, FT_LineTo, FT_ConicTo, FT_CubicTo, abort_test): Tag - unused variables. - (TestFace, FindFonts, copyfont, do_test): Fix compiler warnings. - (ExecuteTest): Ditto. - Call `FT_Done_FreeType'. - (getErrorCnt): Replace `ceil' with an ordinary cast to `unsigned - int'. - (usage): Improve output. - (main): Fix compiler warnings. +2017-09-25 Ewald Hew - * src/tools/ftrandom/README: Updated. + Allow `type1' module to use the Adobe engine. -2016-09-03 Werner Lemberg + Add the callback and some conditionals to switch between the two + engines. - [base] Avoid negative bitmap stroke dimensions (#48985). + * include/freetype/internal/psaux.h (T1_Decoder_FuncsRec): Change + function declarations. + * src/psaux/psauxmod.c (T1_Decoder_FuncsRec): Register the + callbacks. - * src/base/ftobjs.c (FT_Open_Face): Check whether negation was - actually successful. For example, this can fail for value - -32768 if the type is `signed short'. If there are problems, - disable the stroke. + * src/psaux/psobjs.c (ps_builder_add_point): Add conditionals for + number conversion. -2016-09-03 Werner Lemberg + * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Add code + to choose which renderer to use. - [cff] Avoid null pointer passed to FT_MEM_COPY (#48984). + * src/cid/cidgload.c (cid_load_glyph): Update call. + * src/base/ftobjs.c, src/psaux/psobjs.c, src/type1/t1gload.c: Update + includes. - * src/cff/cffload.c (cff_index_get_name): Check `byte_len'. +2017-09-25 Ewald Hew -2016-09-02 Werner Lemberg + [type1] Add Adobe engine configuration. - [unix] Enable 64bit support in file system access (#48962). + Use the previously changed PS_Driver in type1 module to store + hinting engine configuration. - * builds/unix/configure.raw: Call `AC_SYS_LARGEFILE'. + * include/freetype/ftt1drv.h: New file. + Duplicate and rename config options from CFF. + * include/freetype/config/ftheader.h (FT_TYPE1_DRIVER_H): New macro. -2016-09-02 Werner Lemberg + * src/type1/t1driver.c (t1_driver_class): Update declaration. + * src/type1/t1objs.c: Include FT_TYPE1_DRIVER_H. + (T1_Driver_Init): Update code. - [sfnt] Avoid left shift of negative value (#48980). +2017-09-25 Ewald Hew - * src/sfnt/ttsbit.c (tt_sbit_decoder_load_bit_aligned): Use unsigned - constant. + [cff] Move and rename `CFF_Driver'. -2016-09-02 Werner Lemberg + This is so that we can use the same hinting engine parameters for + Type 1. - * src/smooth/ftgrays.c (gray_hline): Fix clang compiler warnings. + * include/freetype/internal/cffotypes.h (CFF_Driver): Rename and + move to... + * include/freetype/internal/psaux.h (PS_Driver): ...here. -2016-09-02 Werner Lemberg + * src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffload.c, + src/cff/cffobjs.c, src/cff/cffobjs.h, src/psaux/psft.c, + src/psaux/psobjs.c: Update references. - Some preparations for the next release. +2017-09-25 Ewald Hew - * include/freetype/config/ftoption.h - (TT_CONFIG_OPTION_SUBPIXEL_HINTING): Enable. + [psaux, type1] Reorganize object fields. - * docs/CHANGES: Updated. + Make some fields more generic, so that we can access them the same + way regardless of Type 1 or CFF. -2016-09-01 Alexei Podtelezhnikov + * include/freetype/internal/psaux.h (PS_Builder): Change `TT_Face' + to `FT_Face'. + Remove unused fields. - [smooth] Simplify span rendering more. + * src/psaux/psft.c: Update all accesses of `PS_Builder.face'. + Add some asserts to guard against casting `T1_Face' as `TT_Face'. - It turns out that there is significant cost associated with `FT_Span' - creation and calls to `gray_render_span' because it happens so - frequently. This removes these steps from our internal use but leaves - it alone for `FT_RASTER_FLAG_DIRECT" to preserve API. The speed gain - is about 5%. + * src/type1/t1objs.h (T1_GlyphSlot): Reorder fields to follow + `CFF_GlyphSlot', so that we can pretend they are the same in the + interpreter. - * src/smooth/ftgrays.c (gray_render_span): Removed. The code is - migrated to... - (gray_hline): ... here. + * src/psaux/psobjs.c (ps_builder_init, ps_builder_add_point): + Updated with above changes. -2016-08-30 Alexei Podtelezhnikov +2017-09-25 Ewald Hew - [smooth] Streamline pixmap drawing a bit more. + [psaux] Prepare for Type 1 mode. - Zero coverage is unlikely (1 out of 256) to warrant checking. This - gives 0.5% speed improvement in rendering simple glyphs. + Add some checks for Type 1 data passing through. - * src/smooth/ftgrays.c (gray_hline, gray_render_span): Remove checks. + * src/psaux/psfont.h (CF2_Font): Add `isT1' flag. + * src/psaux/psfont.c (cf2_font_setup): Skip the variations and blend + code which is not applicable for Type 1. -2016-08-29 Alexei Podtelezhnikov + * src/psaux/psft.c (cf2_decoder_parse_charstrings): Avoid accessing + `decoder->cff' in Type 1 mode. + Copy `is_t1' flag to `CF2_Font'. - [smooth] Streamline pixmap drawing. +2017-09-25 Ewald Hew - This gives 2% speed improvement in rendering simple glyphs. + [psaux, cff] Use the new objects. - * src/smooth/ftgrays.c (TPixmap): Reduced pixmap descriptor with a - pointer to its bottom-left and pitch to be used in... - (gray_TWorker): ... here. - (gray_render_span): Move pixmap flow check from here... - (gray_raster_render): .. to here. + * include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Fix + switching between new and old engines. -2016-08-27 Alexei Podtelezhnikov + * src/cff/cffgload.c, src/cff/cffparse.c: Update calls. - [smooth] Reduce stack of band boundaries. + * src/psaux/psblues.c, src/psaux/psfont.c, src/psaux/psfont.h, + src/psaux/psft.c, src/psaux/psft.h, src/psaux/psintrp.c: Update all + to use new objects. - * src/smooth/ftgrays.c (gray_TBand): Removed. - (gray_convert_glyph): Updated to stack band boundaries concisely. +2017-09-24 Ewald Hew -2016-08-26 Werner Lemberg + [psaux] Objects for new interpreter (part 2). - * src/cid/cidload.c (cid_face_open): Improve handling of `SDBytes'. + Make the new objects copy over values. They are essentially wrapper + types for the different decoders/builders. -2016-08-26 Werner Lemberg + * include/freetype/internal/psaux.h: Update declarations. + (PS_Builder): Add `is_t1' flag. + (PS_Decoder_{Get,Free}_Glyph_Callback): Renamed to... + (CFF_Decoder_{Get,Free}_Glyph_Callback: ... this. + (PS_Decoder): Updated. + Add `t1_parse_callback' member. + (PSAux_ServiceRec): Add `ps_decoder_init' member. - [cid] Fix commit from 2016-05-16. + * src/psaux/psdecode.h, src/psaux/psobjs.h: Update declarations. - * src/cid/cidparse.c (cid_parser_new): Fix off-by-one errors. + * src/psaux/psdecode.c, src/psaux/psobjs.c: Implement copy with two + modes. -2016-08-26 Werner Lemberg + * src/psaux/psauxmod.c: Add builder and decoder functions to `PSAux' + service. - [sfnt] Cache offset and size to bitmap data table. +2017-09-24 Ewald Hew - This commit avoids `EBDT' and friends being looked up again and - again while loading a single embedded bitmap. + [psaux] Add objects for new interpreter. - * include/freetype/internal/tttypes.h (TT_FaceRec) - [TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: New fields `ebdt_start' and - `ebdt_size'. + Introduce `PS_Decoder' and `PS_Builder' which include all fields + from either Type 1 or CFF decoders/builders. - * src/sfnt/ttsbit.c (tt_sbit_decoder_init): Move table lookup to ... - (tt_face_load_sbit): ... this function; also store the table size - and offset. + * include/freetype/internal/psaux.h (PS_Builder, PS_Decoder): New + structs. -2016-08-26 Alexei Podtelezhnikov + * src/psaux/psobjs.c, src/psaux/psobjs.h: Add `PS_Builder' + functions. - * src/smooth/ftgrays.c (gray_raster_render): Minor tweaks. + * src/psaux/psdecode.c, src/psaux/psdecode.h: New files to hold + `PS_Decoder' initialization functions. -2016-08-26 Werner Lemberg + * src/psaux/psaux.c, src/psaux/Jamfile (_sources), + src/psaux/rules.mk (PSAUX_DRV_SRC): Updated. - [type1] Fix heap buffer overflow. +2017-09-24 Ewald Hew - Reported as + [psaux] Rename files. - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36 + Replace the `cf2' file name prefix with `ps' as the Adobe engine + will be used for both PostScript Types 1 and 2 (CFF) instead of just + CFF. - * src/type1/t1load.c (parse_charstrings): Reject fonts that don't - contain glyph names. + s/cf2/ps/ for all following. -2016-08-25 Werner Lemberg + * src/psaux/cf2*: Rename files. + * src/psaux/*: Update includes. - [sfnt] Fix previous commit (#48901). + * src/psaux/Jamfile (_sources), src/psaux/rules.mk (PSAUX_DRC_SRC, + PSAUX_DRV_H): Update file references. - * src/sfnt/ttcmap.c (tt_cmap4_char_map_binary): Thinkos. +2017-09-24 Ewald Hew -2016-08-25 Werner Lemberg + [psaux] Minor fix. - [sfnt] Speed up handling of invalid format 4 cmaps. + Use `MultiMasters' service in `psaux' instead of a call to `cff'. + The project builds if CFF_CONFIG_OPTION_OLD_ENGINE is not defined. - * src/sfnt/ttcmap.c (tt_cmap4_next, tt_cmap4_char_map_binary): Add - tests for `num_glyph' from `tt_cmap4_char_map_linear'. + * src/psaux/cf2ft.c: Update includes. + (cf2_getNormalizedVector): Use `mm->get_var_blend' instead of + `cff_get_var_blend'. -2016-08-25 Werner Lemberg +2017-09-24 Ewald Hew - * include/freetype/internal/ftdriver.h: Remove unused typedefs. + [psaux, cff] Move `cff_random' into `psaux' service. -2016-08-22 Alexei Podtelezhnikov + NOTE: Does not compile! - [smooth] Simplify span rendering. + Minor fix to allow both `cff' and `psaux' to use `cff_random'. - This removes unnecessary complexity of span merging and buffering. - Instead, the spans are rendered as they come, speeding up the - rendering by about 5% as a result. + * src/cff/cffload.c (cff_random): Move to... + * src/psaux/psobjs.c: Here. + * src/cff/cffload.h: Move corresponding declaration to + `src/psaux/psobjs.h'. - * src/smooth/ftgrays.c [FT_MAX_GRAY_SPANS]: Macro removed. - (gray_TWorker): Remove span buffer and related fields. - (gray_sweep, gray_hline): Updated. + * include/freetype/internal/psaux.h (PSAux_ServiceRec): Register the + function here... + * src/psaux/psauxmod.c: And here. - * include/freetype/ftimage.h: Remove documentation note about - `FT_MAX_GRAY_SPANS', which was never in `ftoption.h' and is now gone. + * src/cff/cffload.c, src/psaux/cf2intrp.c: Update code. -2016-08-16 Werner Lemberg +2017-09-24 Ewald Hew - [truetype] Fix `MPS' instruction. + [cff] Move struct declarations to `freetype/internal'. - According to Greg Hitchcock, MPS in DWrite really returns the point - size. + NOTE: Does not compile! - * src/truetype/ttobjs.h (TT_SizeRec): Add `point_size' member. + This is so that the CFF functions moved to `psaux' can access the + same structs that they need. - * src/truetype/ttdriver.c (tt_size_request): Set `point_size'. + * src/cff/cfftypes.h: Moved to... + * include/freetype/internal/cfftypes.h: ...Here. - * src/truetype/ttinterp.h (TT_ExecContextRec): Add `pointSize' - member. + * src/cff/cffobjs.h: Moved the struct declarations to... + * include/freetype/internal/cffotypes.h: ... this new file. - * src/truetype/ttinterp.c (TT_Load_Context): Updated. - (Ins_MPS): Fix instruction. + * include/freetype/internal/internal.h (FT_INTERNAL_CFF_TYPES_H, + FT_INTERNAL_CFF_OBJECT_TYPES_H): New macros. -2016-08-16 Werner Lemberg + * src/cff/cffcmap.h, src/cff/cffdrivr.c, src/cff/cffgload.c, + src/cff/cffgload.h, src/cff/cffload.h, src/cff/cffobjs.c, + src/cff/cffobjs.h, src/cff/cffparse.h, src/psaux/psobjs.h, + include/freetype/internal/psaux.h, + include/freetype/internal/services/svcfftl.h: Update includes. - [lzw] Optimize last commit. + * src/cff/rules.mk (CFF_DRV_H): Updated. - * src/lzw/ftzopen.c (ft_lzwstate_get_code): Move check into - conditional clause. +2017-09-24 Ewald Hew -2016-08-16 Werner Lemberg + [psaux, cff] Add new service for inter-module calls. - [lzw] Avoid invalid left shift. + NOTE: Does not compile! - Reported as + This is to allow CFF functions moved to `psaux' to call functions + declared in `src/cff/cffload.h'. - https://bugzilla.mozilla.org/show_bug.cgi?id=1295366 + * include/freetype/internal/services/svcfftl.h: New file, setting up + a `CFFLoad' service. - * src/lzw/ftzopen.c (ft_lzwstate_get_code): Limit `num_bits'. + * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC10, + FT_DEFINE_SERVICEDESCREC): New macros. + (FT_SERVICE_CFF_TABLE_LOAD_H): New macro. -2016-08-16 Werner Lemberg + * src/cff/cffdrivr.c, src/cff/cffpic.h: Register the new service. - [lzw] Avoid buffer overrun. + * src/cff/cfftypes.h (CFF_FontRec), src/psaux/cf2font.h + (CF2_FontRec): Add service interface. - Reported as + * src/cff/cffobjs.c, src/psaux/cf2font.c, src/psaux/cf2ft.c, + src/psaux/cf2intrp.c, src/psaux/cffdecode.c: Use the new service. - https://bugzilla.mozilla.org/show_bug.cgi?id=1273283 +2017-09-24 Ewald Hew - * src/lzw/ftzopen.c (ft_lzwstate_refill): Ensure `buf_size' doesn't - underflow. + [psaux, cff] Add callbacks for inter-module calls. -2016-08-16 Werner Lemberg + NOTE: Does not compile! - [truetype] Fix compiler warning. + * include/freetype/internal/psaux.h: Add function pointer + declarations. - * src/truetype/ttgload.c (load_truetype_glyph): Add cast. + * src/psaux/cffdecode.c (cff_decoder_init): Update to take in + callbacks. + * src/psaux/cffdecode.h: Ditto. -2016-08-13 Werner Lemberg + * src/cff/cffgload.c (cff_compute_max_advance, cff_slot_load): + Update calls to pass in callbacks. + * src/psaux/cf2ft.c, src/psaux/cffdecode.c: Use them. - [winfonts] Avoid zero bitmap width and height. +2017-09-24 Ewald Hew - Reported as + [psaux, cff] Create new `PSAux' service interface entries. - https://bugzilla.mozilla.org/show_bug.cgi?id=1272173 + NOTE: Does not compile! - * src/winfonts/winfnt.c (FNT_Face_Init): Check zero pixel height. - (FNT_Load_Glyph): Check for zero pitch. + * include/freetype/internal/psaux.h: Include + FT_INTERNAL_TRUETYPE_TYPES_H. + (CFF_Builder_FuncsRec, CFF_Decocer_FuncsRec): New function tables. + (CFF_Builder): Updated. + Fix for forward declaration. + (PSAux_ServiceRec): New field `cff_decoder_funcs'. -2016-08-11 Alexei Podtelezhnikov + * src/psaux/psauxmod.c (cff_builder_funcs, cff_decoder_funcs): New + function tables. + (PSAux_Interface): Updated. - * src/truetype/ttinterp.c (Pop_Push_Count): Revert changes. + * include/freetype/internal/tttypes.h (TT_FaceRec): Add `psaux' + service interface. -2016-08-11 Alexei Podtelezhnikov + * src/cff/cffgload.c, src/cff/cffobjs.c, src/cff/cffparse.c: Update + function calls to use psaux service. - * src/truetype/ttinterp.c (TT_RunIns): Minor and formatting. +2017-09-24 Ewald Hew -2016-08-11 Alexei Podtelezhnikov + [psaux, cff] Move CFF builder components into `psaux' module. - * src/truetype/ttinterp.c (Pop_Push_Count): Fix some entries. + NOTE: Does not compile! -2016-08-10 Peter Klotz + * src/cff/cffgload.c + (cff_builder_{init,done,add_point,add_point1,add_contour,start_point,close_contour}, + cff_check_points): Move to... + * src/psaux/psobjs.c: Here. - * src/smooth/ftgrays.c (gray_hline): Fix uninitialized access. + * src/cff/cffgload.h: Move corresponding declarations to + `src/psaux/psobjs.h'. -2016-08-10 Werner Lemberg + * src/cff/cffgload.h (CFF_Builder): Move struct declaration to... + * include/freetype/internal/psaux.h: Here. - [sfnt] Use correct type for `italicAngle' field (#48732). +2017-09-24 Ewald Hew - * src/sfnt/ttload.c (tt_face_load_post): Fix types. + [psaux, cff] Move CFF decoder components into `psaux' module. -2016-08-06 Jon Spencer + NOTE: Does not compile! - [sfnt] Fix `FT_Get_Advance' for bitmap strikes. + * src/cff/cffgload.c (CFF_Operator, + CFF_COUNT_{CHECK_WIDTH,EXACT,CLEAR_STACK}, cff_argument_counts, + cff_operator_seac, cff_compute_bias, + cff_lookup_glyph_by_stdcharcode, + cff_decoder_{parse_charstrings,init,prepare}): Move to... + * src/psaux/cffdecode.c: This new file. - `FT_Get_Advance' returns 0 for bitmap fonts. It first gets the - advance value from the font table and then scales it by the - `font->size->metrics->x_scale' field. But `FT_Select_Size' doesn't - set that value for bitmap fonts and the advance gets scaled to zero. + * src/cff/cffgload.h: Move corresponding declarations to... + * src/psaux/cffdecode.h: This new file. - Taken from + * src/cff/cffgload.h (CFF_MAX_{OPERANDS,SUBRS_CALLS,TRANS_ELEMENTS}, + CFF_Decoder_Zone, CFF_Decoder): Move declarations to... + * include/freetype/internal/psaux.h: Here. - https://github.com/behdad/harfbuzz/issues/252 + * src/psaux/cf2ft.h: Update include. - * src/sfnt/ttsbit.c (tt_face_load_strike_metrics) - : Set scale values. + * src/psaux/psaux.c, src/psaux/rules.mk (PSAUX_DRV_SRC): Update with + the new file. -2016-08-06 Behdad Esfahbod +2017-09-24 Ewald Hew - [truetype] Fix GX variation handling of composites. + [psaux, cff] Move Adobe's engine components into `psaux' module. - * src/truetype/ttgload.c (load_truetype_glyph) - [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Check `ARGS_ARE_XY_VALUES' flag. + This is the first patch of a sequence to move the Type 2 charstring + processing capability from the `cff' module to the `psaux' module. -2016-08-05 Alexei Podtelezhnikov + NOTE: Does not compile! - [smooth] Minor refactoring. + * src/cff/cf2*: Move these files to... + * src/psaux/cf2*: Here. - * src/smooth/ftgrays.c (gray_render_scanline, gray_render_line): - Updated. + * src/cff/Jamfile (_sources), src/cff/rules.mk (CFF_DRV_SRC, + CFF_DRV_H), src/cff/cff.c, src/cff/cffgload.c: Remove file + references. -2016-07-29 Werner Lemberg + * src/psaux/Jamfile (_sources), src/psaux/rules.mk, src/psaux/psaux.c + (PSAUX_DRV_SRC, PSAUX_DRV_H): Add file references. - [sfnt, truetype] Don't abort on invalid `maxComponentDepth'. +2017-09-24 Alexei Podtelezhnikov - Since 2016-05-16 we detect infinite recursion directly. + Tweak per-face LCD filtering controls. - * src/sfnt/ttload.c (tt_face_load_maxp): Don't adjust - `maxComponentDepth'. - * src/truetype/ttgload.c (load_truetype_glyph): Don't abort if - `maxComponentDepth' is not valid. Instead, simply adjust its value - and emit a tracing message. + Thing are simpler with a NULL-function pointer. -2016-07-26 Werner Lemberg + * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New + pointer to the filter function. + (FT_LibraryRec): Remove unused `lcd_filter'. + (FT_Bitmap_LcdFilterFunc, ft_lcd_filter_fir): Move from here... + * include/freetype/ftlcdfil.h (FT_Bitmap_LcdFilterFunc, + ft_lcd_filter_fir): ... to here. - * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Minor. + * src/base/ftobjs.c (ft_open_face_internal): NULL-initialize the + per-face filter. + (FT_Face_Properties): Set it. + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Simplify. - No functional change. + * src/base/ftlcdfil.c (ft_lcd_filter_fir, FT_Libary_SetLcdFilter): + Minor. -2016-07-22 Hin-Tak Leung +2017-09-24 Jonathan Kew - [truetype] Record the end of IDEFs. + [sfnt] Fix `premultiply_data' (#52092). - To match the logic in FDEF. The value of the end is only used for - bound-checking in `Ins_JMPR', so it may not have been obvious that - it was not recorded. Tested (as part of Font Validator 2.0) all the - fonts on Fedora and did not see any change. + * src/sfnt/pngshim.c (premultiply_data): Don't use vector extension + if we have less than 16 bytes of data. - * src/truetype/ttinterp.c (Ins_IDEF): Updated. +2017-09-24 Werner Lemberg -2016-07-19 Werner Lemberg + [otvalid] Fix handling of ValueRecords. - [truetype] Sanitizer fix, second try. + For GPOS pair positioning format 1 the description of ValueRecords + in the OpenType specification (1.8.2, from today) is wrong – the + offset has to be taken from the parent structure; in this case the + `PairSet' table. - * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary - tests and use only one slot more. + * src/otvalid/otvgpos.c (otv_PairSet_validate): Set `extra3'. + (otv_PairPos_validate): Adjust. -2016-07-19 Werner Lemberg +2017-09-23 Werner Lemberg - [truetype] Sanitizer fix. + [otvalid] Handle `GSUB' and `GPOS' v1.1 tables. - * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Increase array - to fix nested loops. + * src/otvalid/otvgsub.c (otv_GSUB_validate), src/otvalid/otvgpos.c + (otv_GPOS_validate): Implement it. -2016-07-18 Werner Lemberg +2017-09-23 Werner Lemberg - [truetype] Make GETDATA work only for GX fonts. + [otvalid] Update common table handling to OpenType 1.8.2. - * src/truetype/ttinterp.c (opcode_name): Updated. - (Ins_GETDATA): Only define for `TT_CONFIG_OPTION_GX_VAR_SUPPORT'. - (TT_RunIns): Updated. + * src/otvalid/otvcommn.c (otv_Device_validate): Handle + VariationIndex subtable. + (otv_Lookup_validate): Handle MarkFilteringSet. -2016-07-17 Werner Lemberg +2017-09-23 Alexei Podtelezhnikov - [truetype] Add support for Apple's + [build] Windows-style DLL versioning. - GETDATA[], opcode 0x92 + * build/windows/ftver.rc: New VERSIONINFO resource. + * build/windows/vc2010/freetype.vcxproj: Further improvements. - bytecode instruction. It always returns 17, and we have absolutely - no idea what it is good for... +2017-09-23 Ben Wagner - * src/truetype/ttinterp.c (Pop_Push_Count, opcode_name): Updated. - (Ins_GETDATA): New function. - (TT_RunIns): Add it. + [truetype] Really fix #52082. -2016-07-16 Werner Lemberg + * src/truetype/ttinterp.c (Ins_MDRP): Correct conditional. - [truetype] Add bytecode support for GX variation fonts. +2017-09-23 Werner Lemberg - This commit implements undocumented (but confirmed) stuff from - Apple's old bytecode engine. + [otvalid] Handle `GDEF' v1.2 and v1.3 tables. - GETVARIATION[], opcode 0x91 - This opcode pushes normalized variation coordinates for all axes - onto the stack (in 2.14 format). Coordinate of first axis gets - pushed first. + No validation of variation stuff yet. - GETINFO[], selector bit 3 - If GX variation support is enabled, bit 10 of the result is set - to 1. + * src/otvalid/otvgdef.c (otv_MarkGlyphSets_validate): New function. + (otv_GDEF_validate): Implement it. - * src/truetype/ttinterp.c: Include FT_MULTIPLE_MASTERS_H. - (opcode_name) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated. - (Ins_GETINFO) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle selector - bit 3, checking support for variation glyph hinting. - (Ins_GETVARIATION) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New function - to implement opcode 0x91. - (TT_RunIns) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle opcode 0x91. +2017-09-22 Werner Lemberg -2016-07-16 Werner Lemberg + [otvalid] Handle `BASE' v1.1 table. - [truetype] Fix GETINFO bytecode instruction. + No validation of variation stuff yet. - * src/truetype/ttinterp.c (Ins_GETINFO): Fix return value for - stretching information. + * src/otvalid/otvbase.c (otv_BASE_validate): Implement it. -2016-07-16 Behdad Esfahbod +2017-09-22 Werner Lemberg - [truetype] Make all glyphs in `Zycon' GX font work. + [otvalid] Macros for 32bit offset support. - * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary - tests. + * src/otvalid/otvcommn.h (OTV_OPTIONAL_TABLE32, + OTV_OPTIONAL_OFFSET32, OTV_SIZE_CHECK32): New macros. -2016-07-16 Werner Lemberg +2017-09-21 Alexei Podtelezhnikov - [truetype] Fix GX delta tracing. + [build] Simplify Visual C++ 2010 project. - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Trace - relative point movements. + * build/windows/vc2010/freetype.vcxproj: Remove fake singlethreaded + configurations and tweak. -2016-07-16 Behdad Esfahbod +2017-09-21 Werner Lemberg - [truetype] More fixes for GX. + [truetype] Integer overflow (#52082). - This finally fixes the rendering of the cyclist and the lizard in - the `Zycon' font. + * src/truetype/ttinterp.c (Ins_MDRP): Avoid FT_ABS. - * src/truetype/ttgxvar.c (ft_var_readpackedpoints): `first' point - index is always cumulative. +2017-09-21 Werner Lemberg - (tt_handle_deltas): Rename to... - (tt_interpolate_deltas): ... This. - Add new parameter for output point array. - Update caller. + [sfnt] Fix postscript name for default instance of variation fonts. - (TT_Vary_Apply_Glyph_Deltas): Add `points_out' array; it now holds - the intermediate results of `tt_interpolate_deltas' that are to be - added to `outline->points'. + Problem reported by Behdad. -2016-07-15 Werner Lemberg + * src/sfnt/sfdriver.c (sfnt_get_ps_name): Test + `is_default_instance'. - * src/autofit/aflatin.c (af_latin_hints_compute_segments): Thinko. +2017-09-21 Werner Lemberg - `max_pos' is always larger than `min_pos' so `FT_ABS' is not needed. + [truetype] Fix `mmvar' array pointers, part 2. - Reported by Alexei. + The previous commit was incomplete. -2016-07-16 Nikolaus Waxweiler + * src/truetype/ttgxvar.c: Properly initialize sub-array offsets for + `master' also. - * src/truetype/ttinterp.c (Ins_MIRP): Fix copy-and-paste error. +2017-09-21 Werner Lemberg - Problem reported by Hin-Tak Leung. + [truetype] Fix `mmvar' array pointers. -2016-07-15 Werner Lemberg + Without this change, clang's AddressSanitizer reports many runtime + errors due to misaligned addresses. - [autofit] Update and improve segment and edge tracing. + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Use multiples of pointer + size for sub-array offsets into `mmvar'. - * src/autofit/afhints.c (af_glyph_hints_dump_segments): Trace - `delta' also. - Don't show first point of segment as a replacement for `pos'; this - is (a) misleading, since the difference to `pos' can be almost - arbitrarily large in corner cases, and (b) it is better to have all - segment data in font units instead of a single value given in output - space coordinates. - Improve layout. - (af_glyph_hints_dump_edges): Show px->units and units->px conversion - values for convenience. - Improve layout. +2017-09-20 Werner Lemberg -2016-07-15 Werner Lemberg + [truetype] Integer overflows. - [autofit] For edges, reject segments wider than 1px (#41334). + Changes triggered by - * src/autofit/afhints.h (AF_SegmentRec): New member `delta'. + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3429 - * src/autofit/aflatin.c (af_latin_hints_compute_segments): Compute - `delta'. - (af_latin_hints_compute_edges): Reject segments with a delta larger - than 0.5px. + * src/truetype/ttinterp.c (Ins_SHPIX, Ins_DELTAP): Use NEG_LONG. + (Ins_MIAP): Use SUB_LONG. -2016-07-14 Werner Lemberg +2017-09-19 Alexei Podtelezhnikov - * include/freetype/freetype.h (FT_IS_NAMED_INSTANCE): New macro. + [build] Fix DLL builds in Visual C++ project. -2016-07-14 Werner Lemberg + * build/windows/vc2010/freetype.vcxproj: Use DynamicLibrary in Debug + and Release configurations. + * include/freetype/config/ftconfig.h (FT_EXPORT, FT_EXPORT_DEF) + [_DLL]: Use Visual C++ extensions. - [sfnt] Fix `face_index' value in `FT_Face' for named instances. +2017-09-19 John Tytgat - * src/sfnt/sfobjs.c (sfnt_init_face): Don't strip off higher 16bits. + [cff] Fix family name logic of pure CFF fontdata (#52056). -2016-07-14 Werner Lemberg + 1. If `FamilyName' is present in the CFF font, use this for + FT_Face's `family_name'. + 2. Otherwise, use the face name and chop off any subset prefix. + 3. If at this point FT_Face's `family_name' is set, use this + together with the full name to determine the style. + 4. Otherwise, use `CIDFontName' as FT_Face's `family_name'. + 5. If we don't have a valid style, use "Regular". - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix tracing. + Previously, FT_Face's `family_name' entry for pure CFF fontdata + nearly always was the fontname itself, instead of the `FamilyName' + entry in the CFF font (assuming there is one). -2016-07-14 Behdad Esfahbod + * src/cff/cffobjs.c (cff_face_init) [pure_cff]: Implement it. - [truetype] Fix gxvar delta interpolation. +2017-09-18 Alexei Podtelezhnikov - The coordinates of the base font should be used for interpolation - purposes, NOT the current points (i.e., the result of accumulation - of previous deltas). + [build] Declutter Visual C++ 2010-2017 project. - * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Initialize - `points_org' before looping over all tuples. + * build/windows/vc2010/freetype.vcxproj: Use MaxSpeed (/02) + optimization for Release configuration throughout the project. ---------------------------------------------------------------------------- -Copyright 2016-2017 by +Copyright 2017-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.20 b/ChangeLog.20 index a6ceb4f78..63e3116bd 100644 --- a/ChangeLog.20 +++ b/ChangeLog.20 @@ -1338,7 +1338,7 @@ (cff_compute_bias): Use `U' for constant. * src/cid/cidload.c (cid_decrypt): Ditto. * src/psaux/psobjs.c (T1_Decrypt): Ditto. - * src/psaux/t1decode.c (T1_Decoder_Parse_CharStrings): Ditto. + * src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto. * src/sfnt/ttload.c (TT_Load_Kern): Remove unused `version' variable. * src/sfnt/ttsbit.c (TT_Load_SBit_Image): Remove unused `top' @@ -1524,7 +1524,7 @@ * src/base/ftcalc.c (FT_DivFix): Fixed a bug in the 64-bit code that created incorrect scale factors! - (FT_Round_Fix, FT_CeilFix, FT_FloorFix): Minor improvements. + (FT_RoundFix, FT_CeilFix, FT_FloorFix): Minor improvements. 2001-05-12 Werner Lemberg @@ -2597,7 +2597,7 @@ ---------------------------------------------------------------------------- -Copyright 2000-2017 by +Copyright 2000-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.21 b/ChangeLog.21 index 904e4626e..1adc81783 100644 --- a/ChangeLog.21 +++ b/ChangeLog.21 @@ -617,7 +617,7 @@ `ft_get_adobe_glyph_index', a new function defined in `pstables.h'. (ps_get_macintosh_name, ps_get_standard_strings): Updated. - * src/base/ftobjs.c (FT_Set_Char_Sizes): Handle fractional sizes + * src/base/ftobjs.c (FT_Set_Char_Size): Handle fractional sizes more carefully. This fixes Savannah bug #12263. 2005-03-06 David Turner @@ -1819,7 +1819,7 @@ 2004-08-11 Detlef Würkner * src/base/ftrfork.c (FT_Raccess_Guess) - [!FT_CONFIG_OPTION_GUESSING_EMBEDDED_FORK]: Remove compiler + [!FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK]: Remove compiler warnings. 2004-08-06 Adam Piotrowski @@ -2101,7 +2101,7 @@ 2004-06-08 David Turner - * include/freetype/freetype.h (FT_GlyphMetrics): Move `lsb_delta' + * include/freetype/freetype.h (FT_Glyph_Metrics): Move `lsb_delta' and `rsb_delta' elements to... (FT_GlyphSlotRec): Here to retain binary compatibility with older FreeType versions. @@ -2864,7 +2864,7 @@ (psh_blues_snap_stem): Don't use blue_shift but blue_threshold. * src/pshinter/pshalgo.c (PSH_STRONG_THRESHOLD_MAXIMUM): New macro. - (psh_glyph_find_string_points): Use PSH_STRONG_THRESHOLD_MAXIMUM. + (psh_glyph_find_strong_points): Use PSH_STRONG_THRESHOLD_MAXIMUM. (psh_glyph_find_blue_points): New function. Needed for fonts like p052003l.pfb (URW Palladio L Roman) which have flex curves at the base line within blue zones, but the flex curves aren't covered by @@ -3361,7 +3361,7 @@ * src/base/ftstroke.c: Include FT_INTERNAL_OBJECTS_H. (FT_Outline_GetOutsideBorder): Inverse result. - (FT_Stroker_Rewind, FT_Glyph_Stroke, FT_GlyphStrokeBorder): New + (FT_Stroker_Rewind, FT_Glyph_Stroke, FT_Glyph_StrokeBorder): New functions. (FT_Stroker_EndSubPath): Close path if needed. (FT_Stroker_Set, FT_Stroker_ParseOutline): Use FT_Stroker_Rewind. @@ -3493,8 +3493,8 @@ 2003-12-23 David Turner * include/freetype/internal/ftobjs.h (FT_PAD_FLOOR, FT_PAD_ROUND, - FT_PAD_CEIL, FT_PIX_FLOOR, FT_PIX_ROUND, FT_CEIL): New macros. They - are used to avoid compiler warnings with very pedantic compilers. + FT_PAD_CEIL, FT_PIX_FLOOR, FT_PIX_ROUND, FT_PIX_CEIL): New macros. + They are used to avoid compiler warnings with very pedantic compilers. Note that `(x) & -64' causes a warning if (x) is not signed. Use `(x) & ~63' instead! Updated all related code. @@ -4231,7 +4231,7 @@ (t42_parse_encoding): Use `ft_isdigit'. - * src/base/ftmm.c (ft_face_get_mm_service): Return FT_Err_OK if + * src/base/ftmm.c (ft_face_get_mm_service): Return FT_Err_Ok if success. 2003-10-05 Werner Lemberg @@ -4749,8 +4749,7 @@ * include/freetype/ttunpat.h: Fixing documentation comment. * include/freetype/config/ftoption.h, devel/ftoption.h - (TT_CONFIG_OPTION_OPTION_COMPILE_UNPATENTED_HINTING): Replaced - with... + (TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING): Replaced with... (TT_CONFIG_OPTION_UNPATENTED_HINTING): This. Updated all users. (TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING): Removed. @@ -5024,7 +5023,7 @@ drivers. * src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code. - (FT_Set_Pixel_Size): Assign value to `metrics' after validation of + (FT_Set_Pixel_Sizes): Assign value to `metrics' after validation of arguments. 2003-06-20 Werner Lemberg @@ -5200,7 +5199,7 @@ * src/cid/cidload.c (cid_load_keyword): Handle T1_FIELD_LOCATION_BBOX. (parse_font_bbox): Commented out. - (cid_field_record): Comment out element for parsing FontBBox. + (cid_field_records): Comment out element for parsing FontBBox. * src/type42/t42parse.c (t42_parse_font_bbox): Commented out. (t42_keywords): Handle FontBBox with T1_FIELD_BBOX, not with @@ -5916,7 +5915,7 @@ 2003-04-23 Werner Lemberg * src/pfr/pfrload.c (pfr_extra_item_load_font_id): Use FT_PtrDist - instead of FT_Uint for `len'. + instead of FT_UInt for `len'. 2003-04-22 Werner Lemberg @@ -6550,7 +6549,7 @@ * src/cache/ftcsbits.c (ftc_sbit_node_load): Fixed a small bug that caused problems with embedded bitmaps. - * src/otlayout/otlayout.h, src/otlyaout/otlconf.h, + * src/otlayout/otlayout.h, src/otlayout/otlconf.h, src/otlayout/otlgsub.c, src/otlayout/otlgsub.h, src/otlayout/otlparse.c, src/otlayout/otlparse.h, src/otlayout/otlutils.h: Updating the OpenType Layout code, adding @@ -6996,7 +6995,7 @@ 2002-09-08 David Turner - Various updates to correctly support sub-pixel rendering. + Various updates to correctly support subpixel rendering. * include/freetype/config/ftmodule.h: Add two renderers for LCD. @@ -7376,7 +7375,7 @@ * src/pcf/pcfdriver.c (PCF_Glyph_Load): Fix computation of horiBearingX. - * src/bdf/bdfdrivr.c (BDF_GlyphLoad): Fix computation of + * src/bdf/bdfdrivr.c (BDF_Glyph_Load): Fix computation of horiBearingY. 2002-08-16 George Williams @@ -7603,7 +7602,7 @@ * src/cid/cidriver.c (Cid_Get_Char_Index, Cid_Get_Next_Char): Removed. - (t1_cid_driver_class): Updated. + (t1cid_driver_class): Updated. * src/truetype/ttdriver.c (tt_driver_class): Updated. * src/type1/t1driver.c (Get_Char_Index, Get_Next_Char): Removed (t1_driver_class): Updated. @@ -7698,7 +7697,7 @@ CFF_Done_SubFont -> cff_subfont_done CFF_Load_Font -> cff_font_load CFF_Done_Font -> cff_font_done - CFF_Size_Get_Global_Funcs -> cff_size_get_global_funcs + CFF_Size_Get_Globals_Funcs -> cff_size_get_globals_funcs CFF_Size_Done -> cff_size_done CFF_Size_Init -> cff_size_init CFF_Size_Reset -> cff_size_reset @@ -9063,7 +9062,7 @@ FT_Glyph_Name_Requester => FT_Face_GetGlyphNameFunc FT_Name_Index_Requester => FT_Face_GetGlyphNameIndexFunc - * src/base/ftapi.c: New file. It contains backwards compatibility + * src/base/ftapi.c: New file. It contains backward compatibility functions. * include/freetype/internal/psaux.h, src/cid/cidload.c, @@ -9106,7 +9105,7 @@ FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings. * src/base/ftcalc.c (FT_MulFix): Ditto. * src/cff/cffdrivr.c (cff_get_name_index): Ditto. - * src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init, + * src/cff/cffobjs.c (CFF_Size_Get_Globals_Funcs, CFF_Size_Init, CFF_GlyphSlot_Init): Ditto. * src/cid/cidobjs.c (CID_GlyphSlot_Init, CID_Size_Get_Globals_Funcs): Ditto. @@ -9247,7 +9246,7 @@ { } PS_StructRec, *PS_Struct; - typedef PS_StructRec T1_Struct; /* backwards-compatibility */ + typedef PS_StructRec T1_Struct; /* backward compatibility */ Hence, we increase the coherency of the source code by effectively using the `Rec' prefix for structure types. @@ -9384,7 +9383,7 @@ * src/pcf/pcfread.c (pcf_seek_to_table_type): Ditto. * src/sfnt/sfdriver.c (get_sfnt_postscript_name): Ditto. (pcf_get_bitmaps): The same for `sizebitmaps'. - * src/psaux/t1decode.c (T1_Decode_Parse_Charstrings): The same for + * src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): The same for `orig_y'. (t1operator_seac): Comment out more dead code. * src/pshinter/pshalgo2.c (ps2_hints_apply): Add `DEBUG_HINTER' @@ -9423,7 +9422,7 @@ ---------------------------------------------------------------------------- -Copyright 2002-2017 by +Copyright 2002-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.22 b/ChangeLog.22 index 532930829..4517c3224 100644 --- a/ChangeLog.22 +++ b/ChangeLog.22 @@ -189,7 +189,7 @@ * src/base/ftdbgmem.c (_ft_debug_file, _ft_debug_lineno) [FT_DEBUG_MEMORY]: New global variables, replacing... - (FT_MemTable_Rec) [FT_DEBUG_MEMORY]: Remove `filename' and + (FT_MemTableRec) [FT_DEBUG_MEMORY]: Remove `filename' and `line_no'. Update all callers. (ft_mem_debug_alloc) [FT_DEBUG_MEMORY]: Avoid possible integer overflow. @@ -494,7 +494,7 @@ FTC_MruList_Init, FTC_MruList_Reset, FTC_MruList_Done, FTC_MruList_New, FTC_MruList_Remove, FTC_MruList_RemoveSelection): Declare as FT_LOCAL_DEF. - (FTC_MruListFind, FTC_MruList_Lookup) [!FTC_INLINE]: Compile + (FTC_MruList_Find, FTC_MruList_Lookup) [!FTC_INLINE]: Compile conditionally. Declare as FT_LOCAL_DEF. @@ -605,14 +605,14 @@ * docs/release: Minor additions and clarifications. - * docs/CHANGES: Updated to reflect many fixes for backwards + * docs/CHANGES: Updated to reflect many fixes for backward compatibility. Still incomplete. 2006-02-26 David Turner * src/base/ftobjs.c (ft_recompute_scaled_metrics): Re-enable conservative rounding of metrics to avoid breaking clients like - Pango (see http://bugzilla.gnome.org/show_bug.cgi?id=327852). + Pango (see https://bugzilla.gnome.org/show_bug.cgi?id=327852). 2006-02-25 Werner Lemberg @@ -814,7 +814,7 @@ * include/freetype/ftcache.h (FTC_IMAGE_TYPE_COMPARE, FTC_IMAGE_TYPE_HASH), src/cache/ftcbasic.c (FTC_OldFontRec, FTC_OldImageDescRec, FTC_ImageCache_Lookup, FTC_Image_Cache_New, - FTC_OldImage_Desc, FTC_OLD_IMAGE_FORMAT, ftc_old_image_xxx, + FTC_OldImageDesc, FTC_OLD_IMAGE_FORMAT, ftc_old_image_xxx, ftc_image_type_from_old_desc, FTC_Image_Cache_Lookup, FTC_SBitCache_Lookup, FTC_SBit_Cache_New, FTC_SBit_Cache_Lookup) [FT_CONFIG_OPTION_OLD_INTERNALS]: Try to revive old functions of the @@ -2318,7 +2318,7 @@ Further information on the SING Glyphlet format can be found at: - http://www.adobe.com/products/indesign/sing_gaiji.html + https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5148.SING_Tutorial.pdf * include/freetype/tttags.h (TTAG_SING, TTAG_META): New macros for the OpenType tables `SING' and `META'. These two tables are used in @@ -2787,7 +2787,7 @@ 2005-06-15 Kirill Smelkov The next release will be 2.2.0, so don't worry about source code - backwards compatibility. + backward compatibility. * include/freetype/ftimage.h (FT_Outline_MoveToFunc, FT_Outline_LineToFunc, FT_Outline_ConicToFunc, @@ -2821,7 +2821,7 @@ ---------------------------------------------------------------------------- -Copyright 2005-2017 by +Copyright 2005-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.23 b/ChangeLog.23 index 79dc028c1..85253f112 100644 --- a/ChangeLog.23 +++ b/ChangeLog.23 @@ -43,7 +43,7 @@ * src/base/ftoutln.c (FT_Outline_New_Internal): The length of FT_Outline->points[] should be numPoints, not 2 * numPoints. Found by Paul Messmer, see - http://lists.gnu.org/archive/html/freetype-devel/2010-02/msg00003.html + https://lists.gnu.org/archive/html/freetype-devel/2010-02/msg00003.html 2010-02-10 Ken Sharp @@ -108,7 +108,7 @@ Preferred family names should be used for legacy systems that can hold only a few faces (<= 4) for a family name. Suggested by Andreas Heinrich. - http://lists.gnu.org/archive/html/freetype/2010-01/msg00001.html + https://lists.gnu.org/archive/html/freetype/2010-01/msg00001.html * include/freetype/ftsnames.h (FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY, FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY): Define. @@ -631,7 +631,7 @@ The issue of incompatible cast between unsigned long and void* on LLP64 platform is reported by NightStrike from MinGW-Win64 project. See - http://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html + https://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html * src/bdf/bdf.h: The type of hashnode->data is changed from void* to size_t. @@ -657,7 +657,7 @@ On LLP64 platform, the conversion from pointer to FT_Fixed need to drop higher 32-bit. Explicit casts are required. Reported by NightStrike from MinGW-w64 project. See - http://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html + https://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html * src/cff/cffgload.c: Convert the pointers to FT_Fixed explicitly. @@ -864,7 +864,7 @@ LP64 systems: Higher bits are not used. 16-bit systems: Drop can occur. See - http://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00065.html + https://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00065.html These functions will be refined to take FT_ULong flags in next bump with incompatible API change. @@ -929,7 +929,7 @@ type1: Fix a data type mismatching with its source. * include/freetype/internal/t1types.h: The type of - T1_Face->buildchar is matched with T1_Decorder->top. + T1_Face->buildchar is matched with T1_Decoder->top. 2009-07-31 suzuki toshiya @@ -975,8 +975,8 @@ psaux: Fix a data type mismatching with its source. * include/freetype/internal/psaux.h: The type of - T1_DecorderRec.buildchar is matched with - T1_DecorderRec.top. + T1_DecoderRec.buildchar is matched with + T1_DecoderRec.top. 2009-07-31 suzuki toshiya @@ -1765,7 +1765,7 @@ ftgzip.c by FT2 are enabled by default. To use zlib zcalloc() & zfree(), define USE_ZLIB_ZCALLOC. See discussion: - http://lists.gnu.org/archive/html/freetype-devel/2009-02/msg00000.html + https://lists.gnu.org/archive/html/freetype-devel/2009-02/msg00000.html 2009-07-31 suzuki toshiya @@ -1904,7 +1904,7 @@ 2009-07-15 suzuki toshiya Borland C++ compiler patch proposed by Mirco Babin. - http://lists.gnu.org/archive/html/freetype/2009-07/msg00016.html. + https://lists.gnu.org/archive/html/freetype/2009-07/msg00016.html. * builds/exports.mk: Delete unused flags, CCexe_{CFLAGS,LDFLAGS}. Fix APINAMES_C and APINAMES_EXE pathnames to reflect the platform @@ -1929,7 +1929,7 @@ * src/tools/chktrcmp.py: A script to check trace_XXXX macros that are used in C source but undefined in fttrace.h, or defined in fttrace.h but unused in C sources. See - http://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html. + https://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html. * docs/DEBUG: Mention on chktrcmp.py. * docs/release: Ditto. @@ -1961,7 +1961,7 @@ * include/freetype/internal/fttrace.h: Add FT_TRACE_DEF( t1afm ) and FT_TRACE_DEF( ttbdf ). See - http://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html + https://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html 2009-07-09 suzuki toshiya @@ -1975,8 +1975,8 @@ Prevent the overflows by a glyph with too many points or contours. The bug is reported by Boris Letocha . See - http://lists.gnu.org/archive/html/freetype-devel/2009-06/msg00031.html - http://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00002.html + https://lists.gnu.org/archive/html/freetype-devel/2009-06/msg00031.html + https://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00002.html * include/freetype/ftimage.h (FT_OUTLINE_CONTOURS_MAX, FT_OUTLINE_POINTS_MAX): New macros to declare the maximum @@ -2001,7 +2001,7 @@ 2009-06-28 suzuki toshiya ftpatent: Fix a bug by wrong usage of service->table_info(). - http://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00039.html + https://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00039.html * include/freetype/internal/services/svsfnt.h: Extend FT_SFNT_TableInfoFunc() to take new argument to obtain the offset @@ -2069,7 +2069,7 @@ * builds/unix/configure.raw: Fix a bug in sed script to extract native suffix for binary executables, patch by Peter Breitenlohner. - http://lists.gnu.org/archive/html/freetype-devel/2009-04/msg00036.html + https://lists.gnu.org/archive/html/freetype-devel/2009-04/msg00036.html 2009-06-26 Werner Lemberg @@ -2125,7 +2125,7 @@ code unconditionally. Add support for random numbers and update remaining code accordingly; this should work now. - (t1_operator_seac): Updated. + (t1operator_seac): Updated. * src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H. (ps_hints_t1stem3, t1_hints_stem): Updated. @@ -2594,14 +2594,14 @@ Position Independent Code (PIC) support in smooth renderer. * src/smooth/ftsmooth.h declare ft_smooth_renderer_class, - ft_smooth_lcd_renderer_class and ft_smooth_lcd_v_renderer_class + ft_smooth_lcd_renderer_class and ft_smooth_lcdv_renderer_class using macros from ftrender.h, when FT_CONFIG_OPTION_PIC is defined create and destroy functions will be declared. * src/smooth/ftsmooth.c when FT_CONFIG_OPTION_PIC is defined the following structs: ft_smooth_renderer_class, ft_smooth_lcd_renderer_class - and ft_smooth_lcd_v_renderer_class + and ft_smooth_lcdv_renderer_class will have functions to init or create and destroy them instead of being allocated in the global scope. And macros will be used from ftspic.h in order to access @@ -3469,8 +3469,8 @@ faces includes broken face which FT_Done_Face() cannot free, FT_Done_Library() retries FT_Done_Face() and it can fall into an endless loop. See the discussion: - http://lists.gnu.org/archive/html/freetype-devel/2008-09/msg00047.html - http://lists.gnu.org/archive/html/freetype-devel/2008-10/msg00000.html + https://lists.gnu.org/archive/html/freetype-devel/2008-09/msg00047.html + https://lists.gnu.org/archive/html/freetype-devel/2008-10/msg00000.html 2009-01-07 Werner Lemberg @@ -3492,7 +3492,7 @@ * builds/unix/configure.raw: Don't call AC_CANONICAL_BUILD and AC_CANONICAL_TARGET and use $host_os only. A nice explanation for this change can be found at - http://blog.flameeyes.eu/s/canonical-target. + https://blog.flameeyes.eu/s/canonical-target. From Savannah patch #6712. @@ -4516,7 +4516,7 @@ recommends to add the option only to CFLAGS, LDFLAGS should include it because libfreetype.la is built with -no-undefined. This fixes a bug reported by Ryan Schmidt in MacPorts, - http://trac.macports.org/ticket/15331. + https://trac.macports.org/ticket/15331. 2008-06-21 Werner Lemberg @@ -4861,7 +4861,7 @@ 2008-04-14 Werner Lemberg * src/pcf/pcfdrivr.c (PCF_Face_Init): Protect call to - `FT_Stream_OpenLZW' with `FT_CONFIG_OPTION_USE_LZ'. From Savannah + `FT_Stream_OpenLZW' with `FT_CONFIG_OPTION_USE_LZW'. From Savannah bug #22909. 2008-04-13 Werner Lemberg @@ -5243,7 +5243,7 @@ functions related to cmap type 14 support to the `FT_Object_ActionName' scheme: - FT_Get_Char_Variant_index -> FT_Face_GetCharVariantIndex + FT_Get_Char_Variant_Index -> FT_Face_GetCharVariantIndex FT_Get_Char_Variant_IsDefault -> FT_Face_GetCharVariantIsDefault FT_Get_Variant_Selectors -> FT_Face_GetVariantSelectors FT_Get_Variants_Of_Char -> FT_Face_GetVariantsOfChar @@ -5530,7 +5530,7 @@ * src/truetype/ttinterp.c (Ins_IUP): Add missing variable initialization. - * src/autofit/aflatin.c (af_latin_metric_init_blues): Get rid of an + * src/autofit/aflatin.c (af_latin_metrics_init_blues): Get rid of an infinite loop in the case of degenerate fonts. 2007-06-26 Rahul Bhalerao @@ -6187,13 +6187,13 @@ * builds/unix/ftsystem.c (FT_Stream_Open): Temporary fix to prevent 32bit unsigned long overflow by 64bit filesize on LP64 platform, as proposed by Sean McBride: - http://lists.gnu.org/archive/html/freetype-devel/2007-03/msg00032.html + https://lists.gnu.org/archive/html/freetype-devel/2007-03/msg00032.html 2007-03-22 suzuki toshiya * builds/unix/ftconfig.in: Suppress SGI compiler's warning against setjmp, proposed by Sean McBride: - http://lists.gnu.org/archive/html/freetype-devel/2007-03/msg00032.html + https://lists.gnu.org/archive/html/freetype-devel/2007-03/msg00032.html 2007-03-19 suzuki toshiya @@ -6852,7 +6852,7 @@ * include/freetype/internal/services/svotval.h: Add `volatile' to sync with the modification by Jens Claudius on 2006-08-22; cf. - http://cvs.savannah.gnu.org/viewcvs/freetype/freetype2/src/otvalid/otvmod.c?r1=1.4&r2=1.5 + https://cvs.savannah.gnu.org/viewcvs/freetype/freetype2/src/otvalid/otvmod.c?r1=1.4&r2=1.5 2006-12-15 suzuki toshiya @@ -6876,7 +6876,7 @@ * src/base/ftobjs.c: Improvement of resource fork handler for POSIX, cf. - http://lists.gnu.org/archive/html/freetype-devel/2006-10/msg00025.html + https://lists.gnu.org/archive/html/freetype-devel/2006-10/msg00025.html (Mac_Read_sfnt_Resource): Count only `sfnt' resource of suitcase font format or .dfont, to simulate the face index number counted by ftmac.c. (IsMacResource): Return the number of scalable faces correctly. @@ -7023,7 +7023,7 @@ (_ft_lcd_filter_fir): This. Update parameters. (_ft_lcd_filter_legacy) [USE_LEGACY]: New filter function. - (FT_Library_Set_LcdFilter): Update parameters. + (FT_Library_SetLcdFilter): Update parameters. Handle new filter modes. * include/internal/ftobjs.h: Include FT_LCD_FILTER_H. @@ -7524,7 +7524,7 @@ `ft_validator_run' wrapping `setjmp' can cause a crash, as found by Jens: - http://lists.gnu.org/archive/html/freetype-devel/2006-08/msg00004.htm. + https://lists.gnu.org/archive/html/freetype-devel/2006-08/msg00004.htm. * src/otvalid/otvmod.c: Replace `ft_validator_run' by `ft_setjmp'. It reverts the change introduced on 2005-08-20. @@ -7721,7 +7721,7 @@ 2006-06-24 Eugeniy Meshcheryakov Fix two hinting bugs as reported in - http://lists.gnu.org/archive/html/freetype-devel/2006-06/msg00057.html. + https://lists.gnu.org/archive/html/freetype-devel/2006-06/msg00057.html. * include/freetype/internal/tttypes.h (TT_GlyphZoneRec): Add `first_point' member. @@ -7761,7 +7761,7 @@ should return `FT_Err_Unimplemented_Feature' if validation service is unavailable (disabled in `modules.cfg'). It is originally suggested by David Turner, cf. - http://lists.gnu.org/archive/html/freetype-devel/2005-11/msg00078.html + https://lists.gnu.org/archive/html/freetype-devel/2005-11/msg00078.html * src/base/ftgxval.c (FT_TrueTypeGX_Validate): Return FT_Err_Unimplemented_Feature if TrueTypeGX validation service is @@ -7857,7 +7857,7 @@ 2006-05-18 Werner Lemberg * src/truetype/ttgload.c (TT_Load_Composite_Glyph) - [FT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Make it compilable again. + [TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Make it compilable again. 2006-05-17 David Turner @@ -7932,7 +7932,7 @@ ---------------------------------------------------------------------------- -Copyright 2006-2017 by +Copyright 2006-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.24 b/ChangeLog.24 index 4f32a6be7..44abc4060 100644 --- a/ChangeLog.24 +++ b/ChangeLog.24 @@ -335,7 +335,7 @@ * include/freetype/ftmoderr.h: Fix commit from 2013-03-11. - The previous version was not backwards compatible. Reported by + The previous version was not backward compatible. Reported by Behdad. 2013-03-14 Werner Lemberg @@ -744,7 +744,7 @@ 2013-01-16 David 'Digit' Turner - [truetype] Improve sub-pixel code. + [truetype] Improve subpixel code. This patches fixes many issues with the ttsubpix implementation. @@ -1860,10 +1860,10 @@ Fix `checking if gcc static flag -static works' test. On my linux build tree, I receive yes answer in every package I - build except freetype for this test checking if gcc static flag + build except FreeType for this test checking if gcc static flag `-static' works - On freetype, no is received, unless bzip2 and zlib are disabled using + In FreeType, no is received, unless bzip2 and zlib are disabled using ./configure --without-bzip2 --without-zlib @@ -1977,7 +1977,7 @@ Most of the code is based on the ClearType whitepaper written by Greg Hitchcock - http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx + https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx which gives a detailed overview of the necessary changes to the Microsoft rasterizer so that older fonts are supported. However, a @@ -2103,7 +2103,7 @@ NEC FA family dated in 1996 have different checksum. Reported by Johnson Y. Yan ; see - http://lists.gnu.org/archive/html/freetype-devel/2012-06/msg00023.html + https://lists.gnu.org/archive/html/freetype-devel/2012-06/msg00023.html * src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids): 4 sets of fpgm & prep table checksums for FA-Gothic, FA-Minchou, @@ -2117,7 +2117,7 @@ Problem reported by jola ; see - http://lists.gnu.org/archive/html/freetype-devel/2012-05/msg00036.html + https://lists.gnu.org/archive/html/freetype-devel/2012-05/msg00036.html * src/raster/ftraster.c (SMulDiv_No_Round): New macro. (Line_Up): Use it. @@ -2603,7 +2603,7 @@ See discussion starting at - http://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00037.html + https://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00037.html * src/smooth/ftgrays.c: s/TBand/gray_TBand/. * src/raster/ftraster.c: s/TBand/black_TBand/. @@ -2616,7 +2616,7 @@ `outline.flags' so that this information is preserved. See discussion starting at - http://lists.gnu.org/archive/html/freetype-devel/2012-02/msg00046.html + https://lists.gnu.org/archive/html/freetype-devel/2012-02/msg00046.html 2012-02-11 Werner Lemberg @@ -2677,7 +2677,7 @@ [raccess] Modify for PIC build. Based on the patch provided by Erik Dahlstrom , - http://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00010.html + https://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00010.html Also `raccess_guess_table[]' and `raccess_rule_by_darwin_vfs()' are renamed with `ft_' suffixes. @@ -2941,10 +2941,10 @@ [type42] Remove casts. - * src/type42/t42driver.c (t42_driver_class): Remove all casts and + * src/type42/t42drivr.c (t42_driver_class): Remove all casts and update affected functions. - * src/type42/t42objs.c, src/type42/t42objs.h: Updated for t42driver + * src/type42/t42objs.c, src/type42/t42objs.h: Updated for t42 driver changes. 2011-11-30 Werner Lemberg @@ -3127,7 +3127,7 @@ According to - http://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html + https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html this should be mentioned explicitly. @@ -3456,7 +3456,7 @@ See - http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00049.html + https://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00049.html for some comparison images. @@ -3556,7 +3556,7 @@ See - http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00001.html + https://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00001.html for example documents. The FreeType stroker now produces results very similar to that produced by GhostScript and Distiller for these @@ -4005,9 +4005,9 @@ aligned, bluezones for CJK Ideographs are calculated from sample glyphs. At present, vertical bluezones (bluezones to align vertical stems) are disabled by default. For detail, see - http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00070.html - http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00092.html - http://lists.gnu.org/archive/html/freetype-devel/2011-05/msg00001.html + https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00070.html + https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00092.html + https://lists.gnu.org/archive/html/freetype-devel/2011-05/msg00001.html * include/freetype/internal/fttrace.h: New trace component `afcjk'. * src/autofit/afcjk.h (AF_CJK{Blue,Axis,Metric}Rec): Add CJK version @@ -4029,7 +4029,7 @@ af_latin_hints_compute_blue_edges. (af_cjk_metrics_init_blues): New function, CJK version of af_latin_metrics_init_blues. - (af_cjk_hints_edges): Add code to align the edge stems to blue zones. + (af_cjk_hint_edges): Add code to align the edge stems to blue zones. * src/autofit/afindic.c (af_indic_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric, and initialize as af_cjk_metrics_init. @@ -4075,8 +4075,8 @@ the TrueType font header. Some bad PDF generators write wrong values. For details see examples and benchmark tests of the latency by recalculation: - http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00091.html - http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00096.html + https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00091.html + https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00096.html 2011-04-30 suzuki toshiya @@ -4109,7 +4109,7 @@ Because some PDF generators mangle the family name badly, the trickyness check by the checksum should be invoked always. For sample PDF, see - http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00073.html + https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00073.html * src/truetype/ttobjs.c (tt_check_trickyness): Even when tt_check_trickyness_family() finds no trickyness, @@ -4146,8 +4146,8 @@ When there are too many stems to preserve their gaps in the rasterization of CJK Ideographs at a low resolution, blur the stems instead of showing clumped stems. See - http://lists.gnu.org/archive/html/freetype-devel/2011-02/msg00011.html - http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00046.html + https://lists.gnu.org/archive/html/freetype-devel/2011-02/msg00011.html + https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00046.html for details. * src/autofit/afcjk.c (af_cjk_hint_edges): Store the position of @@ -4343,7 +4343,7 @@ [cache] Fix an off-by-one bug in `FTC_Manager_RemoveFaceID'. Found by , see detail in - http://lists.gnu.org/archive/html/freetype/2011-01/msg00023.html + https://lists.gnu.org/archive/html/freetype/2011-01/msg00023.html * src/cache/ftccache.c (FTC_Cache_RemoveFaceID): Check the node buckets[cache->p + cache->mask] too. @@ -4464,7 +4464,7 @@ Johnson Y. Yan. The bug report by Qt developers is considered too. - http://bugreports.qt.nokia.com/browse/QTBUG-6521 + https://bugreports.qt.io/browse/QTBUG-6521 2011-01-15 Werner Lemberg @@ -4923,7 +4923,7 @@ Partially undo change from 2010-10-15 by using ONE_PIXEL/4; this has been tested with demo images sent to the mailing list. See - http://lists.gnu.org/archive/html/freetype-devel/2010-10/msg00055.html + https://lists.gnu.org/archive/html/freetype-devel/2010-10/msg00055.html and later mails in this thread. @@ -4943,7 +4943,7 @@ Problem reported by Tom Bishop ; see thread starting with - http://lists.gnu.org/archive/html/freetype/2010-10/msg00049.html + https://lists.gnu.org/archive/html/freetype/2010-10/msg00049.html * src/raster/ftraster.c (Line_Up): Replace FMulDiv with SMulDiv since the involved multiplication exceeds 32 bits. @@ -5007,7 +5007,7 @@ normal clients. For the history of these macros, see the investigation: - http://lists.gnu.org/archive/html/freetype/2010-10/msg00022.html + https://lists.gnu.org/archive/html/freetype/2010-10/msg00022.html 2010-10-24 suzuki toshiya @@ -5054,7 +5054,7 @@ by Darwin VFS are skipped. It reduces the warnings of the deprecated resource fork access method by recent Darwin kernel. Fix MacPorts ticket #18859: - http://trac.macports.org/ticket/18859 + https://trac.macports.org/ticket/18859 * src/base/ftobjs.c (load_face_in_embedded_rfork): When `FT_Stream_New' returns FT_Err_Cannot_Open_Stream, it @@ -5182,7 +5182,7 @@ [smooth] Fix splitting of cubics for negative values. Reported by Róbert Márki ; see - http://lists.gnu.org/archive/html/freetype/2010-09/msg00019.html. + https://lists.gnu.org/archive/html/freetype/2010-09/msg00019.html. * src/smooth/ftgrays.c (gray_render_cubic): Fix thinko. @@ -5349,7 +5349,7 @@ Ignore the environmental setting of LIBTOOL. Patch is suggested by Adrian Bunk, to prevent unexpected reflection of environmental LIBTOOL. See: - http://savannah.nongnu.org/patch/?7290 + https://savannah.nongnu.org/patch/?7290 * builds/unix/unix-cc.in: LIBTOOL is unconditionally set to $(FT_LIBTOOL_DIR)/libtool. FT_LIBTOOL_DIR is set to $(BUILD_DIR) @@ -5406,8 +5406,8 @@ for nameless fonts is safer for PDFs including embedded Chinese fonts. Written by David Bevan, see: - http://lists.gnu.org/archive/html/freetype-devel/2010-08/msg00021.html - http://lists.freedesktop.org/archives/poppler/2010-August/006310.html + https://lists.gnu.org/archive/html/freetype-devel/2010-08/msg00021.html + https://lists.freedesktop.org/archives/poppler/2010-August/006310.html * src/truetype/ttobjs.c (tt_check_trickyness): If a NULL pointer by nameless font is given, TRUE is returned to enable hinting. @@ -5968,7 +5968,7 @@ * src/smooth/ftgrays.c (gray_render_cubic): Fix algorithm. The previous version was too aggressive, as demonstrated in - http://lists.gnu.org/archive/html/freetype-devel/2010-06/msg00020.html. + https://lists.gnu.org/archive/html/freetype-devel/2010-06/msg00020.html. 2010-06-24 Werner Lemberg @@ -6065,7 +6065,7 @@ simplified algorithm to find out whether the spline can be replaced with two straight lines. See this thread for more: - http://lists.gnu.org/archive/html/freetype-devel/2010-06/msg00000.html + https://lists.gnu.org/archive/html/freetype-devel/2010-06/msg00000.html 2010-06-09 Werner Lemberg @@ -6220,7 +6220,7 @@ Add new function `FT_Library_SetLcdFilterWeights'. This is based on code written by Lifter - . It fixes + . It fixes FreeDesktop bug #27386. * src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights): New @@ -6344,7 +6344,7 @@ ---------------------------------------------------------------------------- -Copyright 2010-2017 by +Copyright 2010-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.25 b/ChangeLog.25 index 109ff67d9..59cf2bfed 100644 --- a/ChangeLog.25 +++ b/ChangeLog.25 @@ -112,8 +112,8 @@ Original patch is designed by Werner Lemberg. Extra part for otvalid and gxvalid are added by suzuki toshiya, see discussion: - http://lists.nongnu.org/archive/html/freetype-devel/2014-12/msg00002.html - http://lists.nongnu.org/archive/html/freetype-devel/2014-12/msg00007.html + https://lists.nongnu.org/archive/html/freetype-devel/2014-12/msg00002.html + https://lists.nongnu.org/archive/html/freetype-devel/2014-12/msg00007.html * include/internal/ftvalid.h: Introduce FT_THROW() in FT_INVALID_(). * src/gxvalid/gxvcommn.h: Ditto. @@ -144,7 +144,7 @@ for Borland's bug tracker entry. Reported by Yuliana Zigangirova , - http://lists.gnu.org/archive/html/freetype-devel/2014-04/msg00001.html. + https://lists.gnu.org/archive/html/freetype-devel/2014-04/msg00001.html. * include/internal/ftvalid.h (FT_ValidatorRec), src/smooth/ftgrays.c (gray_TWorker_): Move `ft_jmp_buf' field to be the first element. @@ -244,7 +244,7 @@ All public FreeType enumeration and flag values are uppercase... - * include/tttables.h (FT_Sfnt_Tag): Implement it. For backwards + * include/tttables.h (FT_Sfnt_Tag): Implement it. For backward compatibility, retain the old values as macros. * src/base/ftfstype.c (FT_Get_FSType_Flags), src/sfnt/sfdriver.c @@ -2116,7 +2116,7 @@ builds/unix/unix-def.in (freetype-config, freetype2.pc): Handle HarfBuzz. - * docs/INSTALL.UNIX: Document interdependency of Freetype with + * docs/INSTALL.UNIX: Document interdependency of FreeType with HarfBuzz. 2014-02-28 Alexei Podtelezhnikov @@ -2669,8 +2669,8 @@ with Carbon framework is incompatible with that by FreeType 2 without Carbon framework.) Found by Khaled Hosny and Hin-Tak Leung. - http://lists.gnu.org/archive/html/freetype-devel/2013-02/msg00035.html - http://lists.gnu.org/archive/html/freetype-devel/2013-12/msg00027.html + https://lists.gnu.org/archive/html/freetype-devel/2013-02/msg00035.html + https://lists.gnu.org/archive/html/freetype-devel/2013-12/msg00027.html * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Add a switch `sort_by_res_id' to control the fragmented resource ordering. @@ -3181,7 +3181,7 @@ Problem reported by Hin-Tak Leung ; see - http://lists.nongnu.org/archive/html/freetype-devel/2013-08/msg00005.html + https://lists.nongnu.org/archive/html/freetype-devel/2013-08/msg00005.html for details. @@ -3556,7 +3556,7 @@ Suggested by Akira Tagoh, see - http://lists.gnu.org/archive/html/freetype/2013-09/msg00030.html + https://lists.gnu.org/archive/html/freetype/2013-09/msg00030.html * src/bdf/bdfdrivr.c (BDF_Face_Init): Return `Invalid_Argument' error if the font could be opened but non-zero `face_index' is @@ -4767,7 +4767,7 @@ * src/cache/ftcmanag.c (FTC_Manager_Check): Fix cast. * src/cache/ftcmanag.h (FTC_ManagerRec): Ditto. - * src/cff/cf2arrst.c (cf2_arrstack_setNum_Elements): Use cast. + * src/cff/cf2arrst.c (cf2_arrstack_setNumElements): Use cast. * src/cff/cf2ft.c (cf2_freeSeacComponent): Ditto. * src/cff/cffobjs.c (remove_subset_prefix, remove_style): Ditto. @@ -5145,7 +5145,7 @@ ---------------------------------------------------------------------------- -Copyright 2013-2017 by +Copyright 2013-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.26 b/ChangeLog.26 index 7c1126ab8..ea89e91ab 100644 --- a/ChangeLog.26 +++ b/ChangeLog.26 @@ -563,26 +563,26 @@ * src/truetype/ttinterp.c (SUBPIXEL_HINTING): Replaced by... (NO_SUBPIXEL_HINTING, SUBPIXEL_HINTING_INFINALITY, SUBPIXEL_HINTING_MINIMAL): ...new macros. - (Direct_Move, Direct_Move_X, Direct_Move_Y): Handle backwards + (Direct_Move, Direct_Move_X, Direct_Move_Y): Handle backward compatibility. Updated. (Ins_RS, Ins_FDEF, Ins_ENDF, Ins_CALL, Ins_LOOPCALL, Ins_MD): Updated. (Ins_INSTCTRL): Handle native ClearType mode flag. Updated. - (Ins_FLIPPT, Ins_FLIPRGON, Ins_FLIPRGOFF): Handle backwards + (Ins_FLIPPT, Ins_FLIPRGON, Ins_FLIPRGOFF): Handle backward compatibility. (Move_Zp2_Point): Ditto. (Ins_SHP): Updated. - (Ins_SHPIX): Handle backwards compatibility. + (Ins_SHPIX): Handle backward compatibility. Updated. (Ins_MSIRP, Ins_MDAP, Ins_MIAP, Ins_MDRP, Ins_MIRP): Updated. (Ins_ALIGNRP): Updated. - (Ins_IUP, Ins_DELTAP): Handle backwards compatibility. + (Ins_IUP, Ins_DELTAP): Handle backward compatibility. Updated. (Ins_GETINFO): Handle v38 flags. Updated. - (TT_RunIns): Handle backwards compatibility mode. + (TT_RunIns): Handle backward compatibility mode. Updated. 2016-05-17 Nikolaus Waxweiler @@ -606,16 +606,16 @@ * src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields `subpixel_hinting_lean', `vertical_lcd_lean', - `backwards_compatibility', `iupx_called', iupy_called', and + `backward_compatibility', `iupx_called', iupy_called', and `grayscale_cleartype' for new hinting mode. * src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40 interpreters conditionally. * src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless - in v38 backwards compatibility mode. + in v38 backward compatibility mode. Updated. - (compute_glyph_metrics): Add v38 backwards compatibility mode + (compute_glyph_metrics): Add v38 backward compatibility mode constraint for adjusting advance widths. Updated. (tt_loader_init): Handle new flags `subpixel_hinting_lean', @@ -663,7 +663,7 @@ The previous fix for #46372 misunderstood a composite glyph referring same component twice as a recursive reference. See the discussion - http://lists.gnu.org/archive/html/freetype/2016-05/msg00000.html + https://lists.gnu.org/archive/html/freetype/2016-05/msg00000.html Thanks to Khaled Hosny for finding this issue. @@ -788,7 +788,7 @@ proper blue zones can't be defined. However, there is already a proposal submitted to Unicode; see - http://www.unicode.org/L2/L2016/16034-n4707-georgian.pdf + https://www.unicode.org/L2/L2016/16034-n4707-georgian.pdf Additionally, due to historical reasons, Unicode treats Khutsuri as the same script as Mkhedruli, and so does OpenType. However, since @@ -1482,7 +1482,7 @@ Still handle `__FTERRORS_H__'. - We need this for backwards compatibility. + We need this for backward compatibility. Problem reported by John Emmas . @@ -2478,7 +2478,7 @@ Problem reported by David Capello ; see - http://lists.nongnu.org/archive/html/freetype-devel/2015-10/msg00108.html + https://lists.nongnu.org/archive/html/freetype-devel/2015-10/msg00108.html for details. @@ -3813,7 +3813,7 @@ See - http://lists.nongnu.org/archive/html/freetype-devel/2015-07/msg00008.html + https://lists.nongnu.org/archive/html/freetype-devel/2015-07/msg00008.html for a rationale. @@ -3932,7 +3932,7 @@ This change is a result of a discussion thread on freetype-devel - http://lists.nongnu.org/archive/html/freetype-devel/2015-06/msg00041.html + https://lists.nongnu.org/archive/html/freetype-devel/2015-06/msg00041.html Re-introduce the `freetype2' subdirectory for all FreeType header files after installation, and rename the `freetype2' subdirectory in @@ -4114,7 +4114,7 @@ Problem reported by Grissiom ; in - http://lists.nongnu.org/archive/html/freetype/2015-05/msg00013.html + https://lists.nongnu.org/archive/html/freetype/2015-05/msg00013.html there is an example code to trigger the bug. @@ -4222,7 +4222,7 @@ [truetype] Support selector index 3 of the INSTCTRL instruction. - This flag activates `native ClearType hinting', disabling backwards + This flag activates `native ClearType hinting', disabling backward compatibility mode as described in Greg Hitchcocks whitepaper. In other words, it enables unrestricted functionality of all TrueType instructions in ClearType. @@ -4292,7 +4292,7 @@ This follows the OpenType 1.7 specification. See - http://tug.org/pipermail/tex-live/2015-April/036634.html + https://tug.org/pipermail/tex-live/2015-April/036634.html for a discussion. @@ -5695,7 +5695,7 @@ ---------------------------------------------------------------------------- -Copyright 2015-2017 by +Copyright 2015-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/ChangeLog.27 b/ChangeLog.27 new file mode 100644 index 000000000..0e82b2fb3 --- /dev/null +++ b/ChangeLog.27 @@ -0,0 +1,2106 @@ +2016-12-30 Werner Lemberg + + * Version 2.7.1 released. + ========================= + + + Tag sources with `VER-2-7-1'. + + * docs/VERSION.TXT: Add entry for version 2.7.1. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.7/2.7.1/, s/27/271/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. + + * builds/unix/configure.raw (version_info): Set to 19:0:13. + * CMakeLists.txt (VERSION_PATCH): Set to 1. + +2016-12-30 Werner Lemberg + + [ftfuzzer] Replace `rand' with an xorshift algorithm. + + * src/tools/ftfuzzer/ftfuzzer.cc: Don't include `stdlib.h'. + (Random): Implement and use a 32bit `xorshift' algorithm. + +2016-12-30 Werner Lemberg + + [ftfuzzer] Restrict number of tested bitmap strikes. + + Malformed fonts often have large values for the number of bitmap + strikes, and FreeType doesn't check the validity of all bitmap + strikes in advance. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=353 + + * src/tools/ftfuzzer/ftfuzzer.cc: Include `stdlib.h' for `rand'. + (Random): Small class to provide n randomly selected numbers + (without repetition) out of the value set [1,N]. + (LLVMFuzzerTestOneInput): Use it to test only up to 10 bitmap + strikes. + +2016-12-29 Werner Lemberg + + [truetype] Variation font API stability issues. + + Make some functions work before a call to `TT_Set_MM_Blend'. + + * src/truetype/ttgxvar.c (tt_hadvance_adjust): Exit immediately if + we don't blend. + (TT_Get_MM_Blend, TT_Get_Var_Design): Return default values if we + don't blend. + +2016-12-29 Werner Lemberg + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Check axis data. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=348 + +2016-12-29 Werner Lemberg + + [truetype] Tracing fixes. + + * src/truetype/ttgxvar.c (tt_hadvance_adjust): Emit correct + information. + (TT_Set_Var_Design): Fix typo. + (TT_Get_Var_Design): Fix typos. + +2016-12-29 Werner Lemberg + + */*: Use `0.5f' for tracing 16.16 numbers. + +2016-12-29 Werner Lemberg + + [pcf] Protect against gzip bombs. + + Fix suggested by Kostya; reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=345 + + * src/pcf/pcfread.c (pcf_read_TOC): Limit number of TOC entries to + 1024. + +2016-12-28 Werner Lemberg + + [psnames] Only declare, not define, data in `pstables.h' (#49949). + + Pdfium includes `pstables.h' a second time; moving the definition + from `pstables.h' to `psmodule.c' saves more than 60kByte data + segment space for this case. + + * src/tools/glnames.py (StringTable::dump, + StringTable::dump_sublist, dump_encoding, dump_array): Emit + additional code to only define tables if `DEFINE_PS_TABLES' is set. + + * src/psnames/pstables.h: Regenerated. + * src/psnames/psmodule.c (DEFINE_PS_TABLES): Define. + +2016-12-28 Werner Lemberg + + [cff] Catch `blend' op in non-variant fonts. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=334 + + * src/cff/cf2intrp.c (cf2_interpT2CharString) : Don't + allow `blend' op for non-variant fonts. + +2016-12-28 Werner Lemberg + + [cff] Better check of number of blends. + + * src/cff/cf2intrp.c (cf2_interpT2CharString) , + src/cff/cffparse.c (cff_parse_blend): Compare number of blends with + stack size. + +2016-12-27 Werner Lemberg + + Documentation updates. + + * docs/CHANGES: Add missing information. + + * docs/formats.txt: Rewritten and updated. + +2016-12-27 Werner Lemberg + + [truetype, type1] Implement `FT_Get_Var_Design_Coordinates'. + + * src/truetype/ttgxvar.c (TT_Get_Var_Design): Implement. + (TT_Set_Var_Design): Fix tracing. + + * src/type1/t1load.c (T1_Get_Var_Design): Implement. + +2016-12-24 Werner Lemberg + + * src/truetype/ttpload.c (tt_face_load_hdmx): Ignore `version'. + + Problem reported by 張俊芝 <418092625@qq.com>. + +2016-12-24 Werner Lemberg + + * src/sfnt/ttsbit.c (tt_face_load_sbit): Allow more version values. + + Some fonts seem to have the `version' field in the wrong byte order. + + Problem reported by 張俊芝 <418092625@qq.com>. + +2016-12-24 Werner Lemberg + + * src/truetype/ttpload.c (tt_face_load_loca): Sanitize table length. + + This trivial fix allows us to accept more fonts. + + Problem reported by 張俊芝 <418092625@qq.com>. + +2016-12-24 Werner Lemberg + + * src/sfnt/sfobjs.c (sfnt_init_face): Fix tracing. + +2016-12-22 Werner Lemberg + + * CMakeLists.txt: Make it work with cmake 2.8.11.2 (#49909). + +2016-12-22 Werner Lemberg + + Ensure used preprocessor symbols are defined (#49790). + + * builds/unix/ftconfig.in, builds/vms/ftconfig.h, + include/freetype/config/ftconfig.h: Check `__GNUC__', `__IBMC__', + and `__SUNPRO_C' correctly. + +2016-12-22 Werner Lemberg + + * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Check `count'. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=308 + +2016-12-22 Werner Lemberg + + [cff] Protect against invalid `vsindex' and `blend' values. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=305 + + * src/cff/cf2intrp.c (cf2_interpT2CharString) : Implement it. + +2016-12-22 Werner Lemberg + + [ftfuzzer] Always use Adobe CFF engine. + + * src/tools/ftfuzzer/ftfuzzer.cc (FT_Global::FT_Global): Implement + it. + +2016-12-21 Werner Lemberg + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko. + + I should really stop coding late in the evening... + + Thanks again to Ben for checking. + +2016-12-21 Werner Lemberg + + [autofit] Support variation fonts. + + (This ChangeLog entry was added later on.) + + * src/autofit/afglobal.c (af_face_globals_free): Remove useless + code. + + * src/base/ftmm.c (FT_Set_MM_Design_Coordinates, + * FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, + FT_Set_Var_Blend_Coordinates): Finalize + auto-hinter data to enforce recomputation. Note that this is a + brute-force method which should be improved. + +2016-12-21 Werner Lemberg + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko. + + Don't apply deltas twice for non-phantom points. + + Spotted by Ben Wagner. + +2016-12-21 Werner Lemberg + + [cff, truetype] Another try for #49829. + + * src/cff/cffdrivr.c: Don't include + `FT_SERVICE_METRICS_VARIATIONS_H'. + (cff_get_advances): Use `ttface->variation_support'. + + * src/truetype/ttdriver.c (tt_get_advances): Use + `ttface->variation_support'. + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph, + load_truetype_glyph): Use `ttface->variation_support'. + +2016-12-21 Werner Lemberg + + [truetype, sfnt] Introduce font variation flags to `TT_Face'. + + * include/freetype/internal/tttypes.h (TT_FACE_FLAG_VAR_XXX): + New macros describing available functionality of various OpenType + tables related to font variation. + (TT_Face): New fields `variation_support' and `mvar_support', + replacing and extending `use_fvar'. + + * src/sfnt/sfobjs.c (sfnt_init_face, sfnt_load_face): Use + `variation_support'. + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Set `variation_support' + field. + (TT_Vary_Apply_Glyph_Deltas): Updated. + +2016-12-21 Werner Lemberg + + [base] Improve sanity check for Mac resources (#49888). + + * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Abort if `rlen' is not + positive. + +2016-12-20 Werner Lemberg + + [base] More sanity checks for Mac resources. + + We use + + https://github.com/kreativekorp/ksfl/wiki/Macintosh-Resource-File-Format + + and + + https://developer.apple.com/legacy/library/documentation/mac/pdf/MoreMacintoshToolbox.pdf#page=151 + + as references. + + * include/freetype/internal/ftrfork.h (FT_RFork_Ref): Use FT_Short + for `res_id'. + + * src/base/ftrfork.c (FT_Raccess_Get_HeaderInfo): Extract map length + and use it to improve sanity checks. + Follow the specification more closely;in particular, all data types + are signed, not unsigned. + (FT_Raccess_Get_DataOffsets): Follow the specification more closely; + in particular, all data types are signed, not unsigned. + Add some sanity checks. + +2016-12-20 Werner Lemberg + + [truetype] Improve logic for getting fast advance widths. + + * src/cff/cffdrivr.c (cff_get_advances), src/truetype/ttdriver.c + (tt_get_advances): Use `is_default_instance' for test; this gets + recomputed after changing blend coordinates. + +2016-12-20 Ben Wagner + Werner Lemberg + + [truetype] Fix linear metrics of GX variation fonts (#49829). + + When asking for an unhinted non-default variations, + `linearVertAdvance' is currently the value from the `hmtx' table + instead of the actual value after applying the variation. `HVAR' + support fixes this, but fonts will exist without that table and will + need sane fallback. + + Problem also reported as + + https://bugs.chromium.org/p/skia/issues/detail?id=5917 + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph, + load_truetype_glyph): Implement linear advance adjustments if `HVAR' + or `VVAR' tables are missing. + +2016-12-20 Werner Lemberg + + [cff, truetype] Fast advance width retrieval for fonts with HVAR. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Don't handle MM. + + * src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H. + (cff_get_advances): Test for HVAR and VVAR. + + * src/truetype/ttdriver.c (tt_get_advances): Test for HVAR and VVAR. + +2016-12-18 Werner Lemberg + + [base] Fix invalid mac font recursion. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=304 + + * src/base/ftobjs.c (FT_Open_Face): Code moved to... + (ft_open_face_internal): ... this function. + Add a parameter to control whether we try special Mac font handling + in case of failure. + (FT_Open_Face, FT_New_Face, FT_New_Memory_Face, + open_face_from_buffer): Use `ft_open_face_internal'. + +2016-12-18 Werner Lemberg + + * src/cff/cffobjs.c (cff_face_init): Make named instances work. + +2016-12-18 Werner Lemberg + + [truetype, cff] Extend `get_var_blend' function of MM service. + + In particular, we need access to named instance data. + + * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): + Add argument for `FT_MM_Var'. + + * src/cff/cffload.c (cff_get_var_blend): Updated. + * src/cff/cffload.h: Updated. + + * src/cff/cf2ft.c (cf2_getNormalizedVector): Updated. + + * src/truetype/ttgxvar.c (tt_get_var_blend): Updated. + Accept value `NULL' for arguments. + * src/truetype/ttgxvar.h: Updated. + +2016-12-18 Werner Lemberg + + [sfnt] Handle `fvar' with zero axes as a non-MM font. + + This is better behaviour than exiting with an error. + + * include/freetype/internal/tttypes.h (TT_Face): Add `use_fvar' + field. + + * src/sfnt/sfobjs.c (sfnt_init_face): Compute `use_fvar', also + updating the validation code. + Use `use_fvar' to compute FT_FACE_FLAG_MULTIPLE_MASTERS. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Remove `fvar' validation + code. + +2016-12-18 Werner Lemberg + + Minor GX code shuffling. + + * include/freetype/internal/tttypes.h (TT_Face): Move + `is_default_instance' into TT_CONFIG_OPTION_GX_VAR_SUPPORT + block. + + * src/sfnt/sfobjs.c (sfnt_init_face): Updated. + * src/truetype/ttgload.c (IS_DEFAULT_INSTANCE): New macro. + (TT_Load_Glyph): Use it. + +2016-12-18 Werner Lemberg + + [cff] Better handling of non-CFF font formats. + + * src/cff/cffload.c (cff_font_load): Pure CFFs don't have a + signature, so return `FT_Err_Unknown_File_Format' more often. + +2016-12-17 Werner Lemberg + + * src/cff/cffload.c (cff_build_blend_vector): Remove redundant code. + +2016-12-17 Werner Lemberg + + * src/truetype/ttobjs.c (tt_face_init): Simplify conditional code. + +2016-12-17 Werner Lemberg + + [sfnt, truetype] Various sanitizing fixes. + + * src/sfnt/sfobjs.c (sfnt_init_face): If the axis count in `fvar' is + zero, set `num_instances' to zero. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Handle `fvar' table with + zero axes as invalid. + + * src/truetype/ttobjs.c (tt_face_init): Improve logic of loading + `loca', `cvt', `fpgm', and `prep' table. + +2016-12-17 Werner Lemberg + + Improve tracing of `FT_Open_Face'. + + * src/base/ftobjs.c (FT_Open_Face): Return info on number of + available faces and numbered instances, or the indices of the + requested face and numbered instance. + + * src/sfnt/sfobjs. (sfnt_open_font): Trace number of subfonts. + +2016-12-17 Werner Lemberg + + * src/cff/cffload.c (cff_load_private_dict): Always init `blend'. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=295 + +2016-12-16 Werner Lemberg + + [truetype] Fix `cvar' sanity test. + + Reported by Dave Arnold. + + * src/truetype/ttgxvar.c (tt_face_vary_cvt): Use tuple count mask. + +2016-12-16 Werner Lemberg + + [cff, truetype] Remove compiler warnings; fix `make multi'. + + * src/cff/cf2font.h: Include `cffload.h'. + + * src/cff/cffload.c: Include FT_MULTIPLE_MASTERS_H and + FT_SERVICE_MULTIPLE_MASTERS_H. + (cff_vstore_load): Eliminate `vsSize'. + (cff_load_private_dict): Tag as `FT_LOCAL_DEF'. + + * src/cff/cffload.h: Include `cffobjs.h'. + Provide declaration for `cff_load_private_dict'. + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Eliminate + `minorVersion' and `map_offset'. + +2016-12-16 Werner Lemberg + + [cff] Fix heap buffer overflow (#49858). + + * src/cff/cffparse.c (cff_parser_run): Add one more stack size + check. + +2016-12-15 Werner Lemberg + + Fix clang warnings. + + * src/cff/cffload.c (cff_blend_doBlend): Add cast. + (cff_subfont_load): Set `error' correctly. + + * src/sfnt/ttmtx.c (tt_face_get_metrics): Typo. + +2016-12-15 Dave Arnold + Werner Lemberg + + [cff] Implement CFF2 support (2/2). + + The font variation code. All parts dependent on the GX code in the + `truetype' module are guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + In other words, you can still compile the `cff' module without + defining TT_CONFIG_OPTION_GX_VAR_SUPPORT (which brings you CFF2 + support without font variation). + + * src/cff/cf2font.c (cf2_font_setup): Add support for font + variation. + * src/cff/cf2font.h (CF2_Font): Add fields for variation data. + + * src/cff/cf2ft.c (cf2_free_instance): Free blend data. + (cf2_getVStore, cf2_getNormalizedVector): New functions. + * src/cff/cf2ft.h: Updated. + + * src/cff/cf2intrp.c: Include `cffload.h'. + (cf2_cmdRESERVED_15, cf2_cmdRESERVED_16): Replace with... + (cf2_cmdVSINDEX, cf2_cmdBLEND): ... this new enum values. + (cf2_doBlend): New function. + (cf2_interpT2CharString): Handle `vsindex' and `blend' opcodes. + + * src/cff/cffload.c (FT_fdot14ToFixed): New macro. + (cff_vstore_done, cff_vstore_load): New functions. + (cff_blend_clear, cff_blend_doBlend, cff_blend_build_vector, + cff_blend_check_vector): New functions. + (cff_load_private_dict): Add arguments for blend vector. + Handle blend data. + (cff_subfont_load, cff_subfont_done): Updated. + (cff_font_load): Handle CFF2 variation store data. + (cff_font_done): Updated. + * src/cff/cffload.h: Include `cffparse.h'. + Updated. + + * src/cff/cffobjs.c (cff_face_done): Updated. + + * src/cff/cffparse.c: Include `cffload.h'. + (cff_parse_num): Handle internal value 255. + (cff_parse_vsindex, cff_parse_blend): New functions. + (CFF_FIELD_BLEND): New macro. + (cff_parser_run): Updated. + * src/cff/cffparse.h (cff_kind_blend): New enum value. + + * src/cff/cfftoken.h: Handle `vstore', `vsindex', and `blend' + dictionary values. + + * src/cff/cfftypes.h (CFF_VarData, CFF_AxisCoords, CFF_VarRegion, + CFF_VStore, CFF_Blend): New structures. + (CFF_FontRecDict): Add `vstore_offset' field. + (CFF_Private): Add `vsindex' field. + (CFF_SubFont): Add fields for blend data. + (CFF_Font): Add `vstore' field. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): `CFF2' is equal to `gvar', + since glyph variation data is directly embedded. + (TT_Set_MM_Blend): Don't load `gvar' table for CFF2 fonts. + +2016-12-15 Dave Arnold + Werner Lemberg + + [cff] Implement CFF2 support (1/2). + + This commit does not contain the blend code for font variation + support, which follows in another commit. + + You should ignore whitespace while inspecting this commit. + + * include/freetype/internal/tttypes.h (TT_Face): Add `isCFF2' + member. + + * src/cff/cf2font.h (CF2_Font): Add `isCFF2' member. + + * src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Handle `isCFF2' + flag. + (cf2_getMaxstack): New function. + * src/cff/cf2ft.h: Updated. + + * src/cff/cf2intrp.c (cf2_escRESERVED_38): New enum. + (cf2_interpT2CharString): Handle CFF2 differences. + Add tracing message for errors. + + * src/cff/cffdrivr.c (cff_get_glyph_name, cff_get_name_index): + Update for CFF2. + + * src/cff/cffload.c (FT_FIXED_ONE): New macro. + (cff_index_init, cff_index_load_offsets, cff_index_access_element, + cff_index_get_name, cff_ft_select_get, cff_load_private_dict, + cff_subfont_load, cff_font_load): Handle CFF2. + * src/cff/cffload.h: Updated. + + * src/cff/cffobjs.c (cff_face_init): Handle CFF2. + + * src/cff/cffparse.c (cff_parse_maxstack): New function. + (CFFCODE_TOPDICT, CFFCODE_PRIVATE): Removed + * src/cff/cffparse.h (CFF2_MAX_STACK, CFF2_DEFAULT_STACK): New + macros. + (CFF2_CODE_TOPDICT, CFF2_CODE_FONTDICT, CFF2_CODE_PRIVATE): New + macros. + + * src/cff/cfftoken.h: Add fields for CFF2 dictionaries (but no blend + stuff). + + * src/cff/cfftypes.h (CFF_Index): Add `hdr_size' field. + (CFF_FontRecDict): Add `maxstack' field. + (CFF_Private): Add `subfont' field. + (CFF_Font): Add `top_dict_length' and `cff2' fields. + + * src/sfnt/sfobjs.c (sfnt_load_face): Handle `CFF2' table. + +2016-12-15 Werner Lemberg + Dave Arnold + + [truetype] Provide HVAR advance width variation as a service. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * src/truetype/ttdriver.c (tt_service_metrics_variations): Updated. + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Prevent + double adjustment of advance width. + + * src/sfnt/ttmtx.c: Include FT_SERVICE_METRICS_VARIATIONS_H. + (tt_face_get_metrics): Apply metrics variations. + +2016-12-15 Dave Arnold + Werner Lemberg + + [truetype] Provide function to apply `HVAR' advance width variation. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * src/truetype/ttgxvar.c (tt_hadvance_adjust): New function. + * src/truetype/ttgxvar.h: Updated. + +2016-12-15 Dave Arnold + Werner Lemberg + + [truetype] Add `HVAR' table parsing. + + Note that this is not complete yet; it only handles advance width + variation. + + Activation of the code follows in another commit. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * include/freetype/ftmm.h (FT_Var_Named_Style): Add `psid' member. + + * src/truetype/ttgxvar.h (GX_HVarData, GX_AxisCoords, GX_HVarRegion, + GX_HVStore, GX_WidthMap): New auxiliary structures for... + (GX_HVarTable): ... HVAR main structure. + (GX_BlendRec): Add data for HVAR loading. + + * src/truetype/ttgxvar.c (FT_FIXED_ONE, FT_fdot14ToFixed, + FT_intToFixed, FT_fixedToInt): New macros. + (ft_var_load_hvar): New function. + (TT_Get_MM_Var): Updated. + (tt_done_blend): Deallocate HVAR data. + +2016-12-15 Dave Arnold + + [cff] Extend number parsing. + + The forthcoming CFF2 support needs a dynamic parsing limit. + + * src/cff/cffparse.c (cff_parse_num, do_fixed, cff_parse_fixed, + cff_parse_fixed_scaled, cff_parse_fixed_dynamic): Add argument for + parser. + (cff_parse_font_matrix, cff_parse_font_bbox, cff_parse_private_dict, + cff_parse_multiple_master, cff_parse_cid_ros, cff_parser_run): Updated. + + * src/cff/cffparse.h (cff_parse_num): Export locally. + +2016-12-15 Dave Arnold + + [cff] Implement dynamic stack size for Adobe engine. + + This also adds `cf2_stack_setReal' and `cf2_stack_pop', needed for + the forthcoming CFF2 support. + + * src/cff/cf2stack.c (cf2_stack_init): Add argument for stack size. + (cf2_stack_free): Deallocate stack. + (cf2_stack_count, cf2_stack_pushInt, cf2_stack_pushFixed, + cf2_stack_popInt, cf2_stack_popFixed, cf2_stack_getReal, + cf2_stack_clear): Updated. + (cf2_stack_setReal, cf2_stack_pop): New functions. + + * src/cff/cf2stack.h (CF2_Stack): Add `stackSize' member. + Update function declarations. + + * src/cff/cf2intrp.c (cf2_interpT2CharString): Updated. + + * src/cff/cffparse.c (cff_parser_init): Add parameter for stack + size; return error code. + (cff_parser_done): New function. + (cff_parser_run): Updated. + + * src/cff/cffparse.h (CFF_Parser): Add `stackSize' member and make + `stack' a pointer. + Update function declarations. + + * src/cff/cffload.c (cff_load_private_dict, cff_subfont_load): + Updated. + +2016-12-15 Dave Arnold + Werner Lemberg + + [cff] Code shuffling. + + * src/cff/cfftypes.h (CFF_Font): Add `library' and `base_offset' + fields. + + * src/cff/cffload.c (cff_subfont_load): Change last argument to + `CFF_Font' + Split off parsing of private dictionary into... + (cff_load_private_dict): ...this new function. + (cff_font_load): Updated. + +2016-12-14 Werner Lemberg + + [sfnt, truetype] Add framework for Metrics Variations service. + + No effect yet; service functions will be implemented later on. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * include/freetype/internal/services/svmetric.h: New file. + + * include/freetype/internal/ftserv.h + (FT_SERVICE_METRICS_VARIATIONS_H): New macro. + + * include/freetype/internal/tttypes.h (TT_Face): New field `var'. + + * src/sfnt/sfobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H. + (sfnt_init_face): Initialize `face->var'. + + * src/truetype/ttdriver.c: Include FT_SERVICE_METRICS_VARIATIONS_H. + (tt_service_metrics_variations): New service. + (tt_services): Updated. + + * src/truetype/ttpic.h: Updated. + +2016-12-14 Werner Lemberg + + [cff] Add Multiple Masters service. + + The code simply uses the MM functions from the `truetype' module. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * include/freetype/internal/tttypes.h (TT_Face): New field `mm'. + + * src/cff/cffdrivr.c: Include FT_SERVICE_MULTIPLE_MASTERS_H. + (cff_set_mm_blend, cff_get_mm_blend, cff_get_mm_var, + cff_set_var_design, cff_get_var_design): New functions. + (cff_service_multi_masters): New service. + (cff_services): Updated. + + * src/cff/cffload.c (cff_get_var_blend, cff_done_blend): New + functions. + * src/cff/cffload.h: Updated. + + * src/cff/cffpic.h (CFF_SERVICE_MULTI_MASTERS_GET): New macro. + + * src/sfnt/sfobjs.c: Include FT_SERVICE_MULTIPLE_MASTERS_H. + (sfnt_init_face): Initialize `face->mm'. + +2016-12-14 Werner Lemberg + + Extend functionality of `ft_module_get_service'. + + It can now differentiate between local and global searches. + + * src/base/ftobjs.c (ft_module_get_service): Add `global' argument. + (FT_Get_TrueType_Engine_Type): Updated. + + * src/cff/cffdrivr.c (cff_get_ps_name, cff_get_cmap_info): Updated. + + * include/freetype/internal/ftobjs.h: Updated. + * include/freetype/internal/ftserv.h (FT_FACE_FIND_GLOBAL_SERVICE): + Updated. + +2016-12-14 Werner Lemberg + + * src/truetype/ttgxvar.c (tt_get_var_blend): Fix compiler warning. + +2016-12-14 Dave Arnold + Werner Lemberg + + [sfnt, cff] Minor preparations. + + * include/freetype/tttags.h (TTAG_CFF2, TTAG_HVAR, TTAG_MVAR, + TTAG_VVAR): New SFNT table tags. + + * src/cff/cf2fixed.h (CF2_FIXED_ONE, CF2_FIXED_EPSILON): Add cast. + +2016-12-10 Werner Lemberg + + [truetype, type1] Add `get_var_blend' to MM service. + + For internal use; we want to share code between the forthcoming CFF2 + support and TrueType. + + * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): + New typedef. + (MultiMasters): Add `get_var_blend'. + (FT_Service_MultiMasters): Updated. + + * src/truetype/ttgxvar.c (tt_get_var_blend): New function. + * src/truetype/ttgxvar.h: Updated. + + * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. + * src/type1/t1driver.c (t1_service_multi_masters): Updated. + +2016-12-10 Werner Lemberg + + [truetype, type1] Add `done_blend' to MM service. + + For internal use; we want to share code between the forthcoming CFF2 + support and TrueType. + + * include/freetype/internal/services/svmm.h (FT_Done_Blend_Func): + New typedef. + (MultiMasters): Add `done_blend'. + (FT_Service_MultiMasters): Updated. + + * src/truetype/ttgxvar.c (tt_done_blend): Use `TT_Face' as argument. + * src/truetype/ttgxvar.h: Updated. + + * src/truetype/ttobjs.c (TT_Face_Done): Updated. + + * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. + * src/type1/t1driver.c (t1_service_multi_masters): Updated. + +2016-12-09 Werner Lemberg + + [sfnt] Revert change from 2016-12-08. + + I missed the functionality of `ft_module_get_service', which makes + the change unnecessary. + +2016-12-08 Werner Lemberg + + Add framework to support services with 8 functions. + + We will need this for CFF variation font support. + + * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC8): + New macro. + +2016-12-08 Werner Lemberg + + [sfnt] Add `get_glyph_name' and `get_name_index' to SFNT interface. + + CFF2 fonts will need access to those two functions. + + * include/freetype/internal/sfnt.h: Include FT_SERVICE_GLYPH_DICT_H. + (SFNT_Interface): Add `get_glyph_name' and `get_name_index' members. + (FT_DEFINE_SFNT_INTERFACE): Updated. + + * src/sfnt/sfdriver.c (sfnt_get_glyph_name, sfnt_get_name_index): + Fix signatures to exactly correspond to the glyph dict service + function typedefs. + (sfnt_interface): Updated. + +2016-12-06 Dave Arnold + + Add `FT_Get_Var_Design_Coordinates' function. + + Note that the low-level functions aren't implemented yet. + + * include/freetype/ftmm.h: Declare. + + * include/freetype/internal/services/svmm.h + (FT_Get_Var_Design_Func): New typedef. + (MultiMasters): New MM service function `get_var_design'. + (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. + Update all callers. + + * src/base/ftmm.c (FT_Get_Var_Design_Coordinates): Implement. + + * src/truetype/ttdriver.c: Updated. + + * src/truetype/ttgxvar.c (TT_Get_Var_Design): New dummy function to + handle `get_var_design' service. + * src/truetype/ttgxvar.h: Updated. + + * src/type1/t1driver.c: Updated. + + * src/type1/t1load.c (T1_Get_Var_Design): New dump function to + handle `get_var_design' service. + * src/type1/t1load.h: Updated. + +2016-12-06 Werner Lemberg + + * src/type1/t1load.c (parse_subrs): Fix memory leak. + + The `subrs' keyword might erroneously occur multiple times. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=231 + +2016-12-01 Werner Lemberg + + [gzip] Improve building with external zlib (#49673). + + Building FreeType with external zlib 1.2.8 makes msvc 14 stop with + the following error. + + ftgzip.c + zlib-1.2.8\zlib.h(86): error C2061: + syntax error: identifier 'z_const' + zlib-1.2.8\zlib.h(94): error C2054: + expected '(' to follow 'z_const' + zlib-1.2.8\zlib.h(94): error C2085: + 'msg': not in formal parameter list + ... + zlib-1.2.8\zlib.h(877): fatal error C1003: + error count exceeds 100; stopping compilation + + The error happens because FreeType keeps an own copy of zlib-1.1.4 + under `src/gzip'. When building `src/gzip/ftgzip.c' with + FT_CONFIG_OPTION_SYSTEM_ZLIB defined, it uses + + #include + + which correctly finds an external `zlib.h', but `zlib.h' itself has + a line + + #include "zconf.h" + + which makes Visual Studio 2015 find `src/gzip/zconf.h' while + compiling the files in `src/gzip'. + + * src/gzip/zconf.h: Rename to... + * src/gzip/ftzconf.h: ... this. + * src/gzip/zlib.h, src/gzip/rules.mk (GZIP_DRV_SRCS): Updated. + +2016-12-01 Oleksandr Chekhovskyi + + [autofit] Fix Emscripten crash (patch #9180). + + Function calls through pointers must use a matching signature to + work on Emscripten, since such calls are dispatched through lookup + tables grouped by signature. + + * src/autofit/aftypes.h (AF_WritingSystem_ApplyHintsFunc): Fix + typedef. + +2016-11-29 Werner Lemberg + + [smooth] Revert previous commit. Already fixed with 6ca54c64. + +2016-11-29 Werner Lemberg + + [smooth] Avoid conditional jump on uninitialized value (#49711). + + * src/smooth/ftgrays.c (gray_raster_render): Initialize `worker'. + +2016-11-27 Nikolaus Waxweiler + + [autofit] Code shuffling. + + Also improve some comments and remove unused code. + + No functional change. + + * src/autofit/afloader.c (af_loader_load_g): Merged with... + (af_loader_load_glyph): ...this function. + Split off emboldening code into... + (af_loader_embolden_glyph_in_slot): ... this function. + +2016-11-17 Werner Lemberg + + Better support of LLP64 systems with gcc (and clang). + + * builds/unix/configure.raw: Call `AC_TYPE_LONG_LONG_INT'. + + * builds/unix/ftconfig.in (FT_LONG64): Enable for LLP64 systems (and + suppress warnings) even without `FT_CONFIG_OPTION_FORCE_INT64'. + +2016-11-10 Werner Lemberg + + Fix `lcd_weights' array size. + + * include/freetype/internal/ftobjs.h (FT_LibraryRec): Do it. + + Reported by Nikolaus. + +2016-11-06 Werner Lemberg + + * src/base/ftobjs.c (FT_Render_Glyph_Internal): Fix tracing. + +2016-11-06 Werner Lemberg + + [sfnt] Improve FT_LOAD_BITMAP_METRICS_ONLY for `sbix' format. + + It's unavoidable to call the PNG engine, but to get the metrics it + is sufficient to read the PNG image's header only. + + * src/sfnt/pngshim.c (Load_SBit_Png): Add argument to control the + allocation of the glyph slot. + * src/sfnt/pngshim.h: Updated. + * src/sfnt/ttsbit.c (tt_sbit_decoder_load_png, + tt_face_load_sbix_image, tt_face_load_sbit_image): Updated. + +2016-11-06 Werner Lemberg + + [sfnt] Speed up `sbix' lookup. + + This also fixes a bug introduced in 2016-10-01 which prevents + display of embedded bitmap fonts that use the `sbix' format. + + * src/sfnt/ttsbit.c (tt_face_load_sbit): Store `sbix' size and + offset also in `ebdt_size' and `ebdt_start', respectively. This + makes the test for an embedded bitmap data table succeed for this + format. + + (tt_face_load_strike_metrics) : Use + `ebdt_size' and `ebdt_start' + (tt_face_load_sbix_image): Ditto. + +2016-11-06 Seigo Nonaka + Werner Lemberg + + Introduce a way of quickly retrieving (embedded) bitmap metrics. + + `FT_Load_Glyph' doesn't generate a bitmap for a non-bitmap glyph + until the user calls `FT_Render_Glyph'. However, it always + allocates memory for bitmaps and copies or decodes the contents of a + bitmap glyph, which can be quite slow for PNG data. + + * include/freetype/freetype.h (FT_LOAD_BITMAP_METRICS_ONLY): New + macro. + + * src/base/ftobjs.c (FT_Load_Glyph): Unset FT_LOAD_RENDER if + FT_LOAD_BITMAP_METRICS_ONLY is used. + + * src/sfnt/ttsbit.c (tt_sbit_decoder_alloc_bitmap, + tt_sbit_decoder_load_bitmap): Add argument to control allocation of + the glyph slot. + (tt_sbit_decoder_load_image, tt_sbit_decoder_load_compound, + tt_face_load_sbit_image): Updated. + + * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Quickly exit if + `FT_LOAD_BITMAP_METRICS_ONLY' is set. + + * src/pfr/pfrsbit.c, src/pfr/pfrsbit.h (pfr_slot_load_bitmap): Add + argument to control allocation of the glyph slot. + * src/pfr/pfrobjs (pfr_slot_load): Updated. + + * src/winfonts/winfnt.c (FNT_Load_Glyph): Ditto. + + * docs/CHANGES: Updated. + +2016-11-06 Werner Lemberg + + Synchronize with gnulib (#49448). + + * include/freetype/config/ftconfig.h, builds/unix/ftconfig.in, + builds/vms/ftconfig.h (FT_TYPEOF): Update code to use definition in + current version of `intprops.h'. + Other minor synchronization to reduce code differences between the + three files. + +2016-11-03 Behdad Esfahbod + + [truetype] Clamp variation requests to valid range. + + This is required by OpenType 1.8; it also avoids rounding surprises. + + * src/truetype/ttgxvar.c (TT_Set_Var_Design): Clamp design coordinates + outside of the allowed range to always stay within the range instead + of producing an error. + +2016-10-29 Werner Lemberg + + [truetype] Remove clang warnings. + + * src/truetype/ttinterp.h (TT_ExecContextRec): Using `FT_ULong' for + loop counter handling. + + * src/truetype/ttinterp.c: Updated. + (Ins_SCANTYPE): Use signed constant. + (TT_RunIns): Ensure `num_twilight_points' is 16bit. + +2016-10-27 Werner Lemberg + + [truetype] Fix commit from 2014-11-24. + + Problem reported by Hin-Tak Leung . + + * src/truetype/ttpload.c (tt_face_load_hdmx): Fix file checking + logic. + +2016-10-26 Werner Lemberg + + Add `FT_Get_{MM,Var}_Blend_Coordinates' functions. + + * include/freetype/ftmm.h: Declare. + + * include/freetype/internal/services/svmm.h (FT_Get_MM_Blend_Func): + New typedef. + (MultiMasters): New MM service function `get_mm_blend'. + (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. + Update all callers. + + * src/base/ftmm.c (FT_Get_MM_Blend_Coordinates, + FT_Get_Var_Blend_Coordinates): Implement. + + * src/truetype/ttdriver.c: Updated. + + * src/truetype/ttgxvar.c (TT_Get_MM_Blend): New function to handle + `get_mm_blend' service. + * src/truetype/ttgxvar.h: Updated. + + * src/type1/t1driver.c: Updated. + + * src/type1/t1load.c (T1_Get_MM_Blend): New function to handle + `get_mm_blend' service. + * src/type1/t1load.h: Updated. + + * docs/CHANGES: Document. + +2016-10-26 Werner Lemberg + + * src/type1/t1load.c (parse_subrs): Fix limit check. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=81 + +2016-10-25 Alexei Podtelezhnikov + + [cff] Correct cmap format reporting (#24819). + + * src/cff/cffdrivr.c (cff_get_cmap_info): Throw an error on synthetic + charmap instead of guessing its format and language. + +2016-10-22 Werner Lemberg + + [truetype] Fix SCANTYPE instruction (#49394). + + * src/truetype/ttinterp.c (Ins_SCANTYPE): Only use lower 16bits. + +2016-10-22 Werner Lemberg + + [sfnt] Improve handling of invalid post 2.5 tables [#49393]. + + * src/sfnt/ttpost.c (load_format_25): We need at least a single + table entry. + +2016-10-14 Werner Lemberg + + [truetype] Fix handling of `cvar' table data. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53 + + * src/truetype/ttgxvar.c (tt_face_vary_cvt): Ignore invalid CVT + indices. + +2016-10-11 Werner Lemberg + + [psaux] Fix handling of invalid flex subrs. + + Problem reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52 + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings) + : Set `flex_state' after error checking. + +2016-10-11 Werner Lemberg + + * src/truetype/ttgxvar.c (tt_done_blend): Fix deallocation. + +2016-10-08 Werner Lemberg + + * src/cid/cidload.c (cid_face_open): Properly propagate `error'. + +2016-10-08 Werner Lemberg + + [cid] Fix parsing of subr offsets. + + Bug introduced 2016-05-16. + + * src/cid/cidparse.c (cid_parser_new): Fix off-by-one error. + +2016-10-01 Werner Lemberg + + [sfnt] Disable bitmap strikes if we don't have a bitmap data table. + + * src/sfnt/ttsbit.c (tt_face_load_sbit): Check whether we have + a bitmap data table. + +2016-10-01 Alexei Podtelezhnikov + + [smooth] Remove impossibility. + + * src/smooth/ftgrays.c (TWorker): Rearrange fields. + (gray_convert_glyph): Remove impossible condition and clean up. + +2016-09-29 Werner Lemberg + + [pcf] Enrich family name with foundry name and glyph width info. + + This is a very old patch from openSuSE (from 2006, submitted to + FreeType in 2011) that I forgot to apply. + + https://build.opensuse.org/package/view_file/openSUSE:Factory/freetype2/freetype2-bitmap-foundry.patch + + Prepend the foundry name plus a space to the family name. There are + many fonts just called `Fixed' which look completely different, and + which have nothing to do with each other. When selecting `Fixed' in + KDE or Gnome one gets results that appear rather random, the style + changes often if one changes the size and one cannot select some + fonts at all. + + We also check whether we have `wide' characters; all put together, + we get family names like `Sony Fixed' or `Misc Fixed Wide'. + + * src/pcf/pcfread.c (pcf_load_font): Implement it. + + * docs/CHANGES: Document it. + +2016-09-29 Werner Lemberg + + [ftfuzzer] Speed up. + + * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Don't + check for embedded bitmaps if we have a non-default instance. + +2016-09-29 Werner Lemberg + + [truetype] Disallow bitmap strikes for non-default instances. + + Also speed up access of default instances if GX variations are + active. + + * include/freetype/internal/tttypes.h (TT_FaceRec): Add + `is_default_instance' member. + + * src/sfnt/sfobjs.c (sfnt_init_face): Initialize + `is_default_instance'. + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph, + load_truetype_glyph): Add test for default instance. + (TT_Load_Glyph): Load embedded bitmaps for default instance only. + + * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Compute + `is_default_instance'. + +2016-09-29 Werner Lemberg + + [truetype] Clean up `TT_Face' structure. + + * include/freetype/internal/tttypes.h (TT_FaceRec): Remove unused + fields `horz_metrics' and `vert_metrics'. + Update documentation. + + * src/sfnt/sfobjs.c (sfnt_done_face): Updated. + +2016-09-28 Werner Lemberg + + More FT_ZERO usage. + + * src/gxvalid/gxvcommn.c (gxv_ClassTable_validate): + s/ft_memset/FT_MEM_ZERO/. + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings): + s/ft_memset/FT_ARRAY_ZERO/. + + * src/raster/ftraster.c (FT_ZERO): Define. + (ft_black_new): Use it. + * src/raster/ftrend1.c (ft_raster1_get_cbox): + s/FT_MEM_ZERO/FT_ZERO/. + + * src/smooth/ftgrays.c (FT_ZERO): Define. + (gray_raster_new): Use it. + * src/smooth/ftsmooth.c (ft_smooth_get_cbox): + s/FT_MEM_ZERO/FT_ZERO/. + +2016-09-28 Werner Lemberg + + */*: s/FT_MEM_ZERO/FT_ZERO/ where appropriate. + +2016-09-27 Werner Lemberg + + [truetype] Trace number of executed opcodes. + + * src/truetype/ttinterp.c (TT_RunIns): Implement it. + +2016-09-27 Werner Lemberg + + [truetype] Speed up `TT_Load_Glyph'. + + This avoids additional calls to `tt_face_lookup_table' for the + `glyf' table, which can be expensive. + + * include/freetype/internal/tttypes.h (TT_LoaderRec): Move + `glyf_offset' field to ... + (TT_FaceRec): ... this structure. + * src/truetype/ttgload.c (load_truetype_glyph): Updated. + (tt_loader_init): Move initialization of `glyf_offset' to ... + * src/truetype/ttpload.c (tt_face_load_loca): ... this function. + +2016-09-27 Werner Lemberg + + [truetype] Introduce dynamic limits for some bytecode opcodes. + + This speeds up FreeType's handling of malformed fonts. + + * src/truetype/ttinterp.c (TT_RunIns): Set up limits for the number + of twilight points, the total number of negative jumps, and the + total number of loops in LOOPCALL opcodes. The values are based on + the number of points and entries in the CVT table. + (Ins_JMPR): Test negative jump counter. + (Ins_LOOPCALL): Test loopcall counter. + + * src/truetype/ttinterp.h (TT_ExecContext): Updated. + + * docs/CHANGES: Updated. + +2016-09-25 Werner Lemberg + + [truetype] Sanitize only last entry of `loca' table. + + Without this patch, a loca sequence like `0 100000 0 100000 ...', + where value 100000 is larger than the `glyf' table size, makes + FreeType handle the whole `glyf' table as a single glyph again and + again, which is certainly invalid (and can be very slow, too). + + * src/truetype/ttpload.c (tt_face_get_location): Implement. + Improve tracing messages. + +2016-09-25 Werner Lemberg + + * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Fix typo. + +2016-09-24 Werner Lemberg + + [autofit] Tracing fixes. + + * src/autofit/afmodule.c (af_autofitter_load_glyph): Call dumping + functions only if we actually do tracing. + +2016-09-22 Alexei Podtelezhnikov + + [smooth] Reduce divisions in the line renderer. + + We don't need some divisions if a line segments stays within a single + row or a single column of pixels. + + * src/smooth/ftgrays.c (gray_render_line) [FT_LONG64]: Make divisions + conditional. + +2016-09-15 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_sweep): Remove check for empty table. + +2016-09-14 Alexei Podtelezhnikov + + [smooth] Another tiny speed-up. + + * src/smooth/ftgrays.c (gray_find_cell): Merge into... + (gray_record_cell): ... this function. + +2016-09-11 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_{find,set}_cell): Remove dubious code. + +2016-09-11 Alexei Podtelezhnikov + + [smooth] Fix valgrind warning and reoptimize. + + The algorithm calls `gray_set_cell' at the start of each new contour + or when the contours cross the cell boundaries. Double-checking for + that is wasteful. + + * src/smooth/ftgrays.c (gray_set_cell): Remove check for a new cell. + (gray_convert_glyph): Remove initialization introduced by 44b172e88. + +2016-09-10 Werner Lemberg + + [sfnt] Fix previous commit. + + Problems reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40 + + We now map the strike index right before accessing the physical + data, not earlier. + + * src/sfnt/sfobjs.c (sfnt_load_face): Set `face->sbit_strike_map' + after creating the map so that... + + * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): ... this function + can be used before and after setting up `sbit_strike_map'. + (tt_face_set_sbit_strike): Revert change. + (tt_sbit_decoder_init, tt_face_load_sbix_image): Map strike index. + + * src/truetype/ttdriver.c (tt_size_select): Revert change. + +2016-09-09 Werner Lemberg + + [ftfuzzer] Minor improvements. + + * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Ignore + invalid strikes. + Use better values for call to `FT_Set_Char_Size'. + +2016-09-09 Werner Lemberg + + [sfnt] Don't provide (completely) broken strike data. + + FreeType tries to sanitize strike header data; we now reject + completely broken ones. + + * include/freetype/internal/tttypes.h (TT_FaceRec): New + `sbit_strike_map' array pointer. + + * src/base/ftobjs.c (FT_Match_Size): Reject matches where either + width or height would be zero. + Add tracing message in case of error. + + * src/sfnt/sfobjs.c (sfnt_load_face): Populate `sbit_strike_map', + only using (more or less) valid strike header data for + FT_Face's `available_sizes' array. + (sfnt_done_face): Updated. + + * src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Use + `sbit_strike_map'. + (tt_face_load_strike_metrics): Improve tracing. + + * src/truetype/ttdriver.c (tt_size_select): Use `sbit_strike_map'. + +2016-09-08 Werner Lemberg + + * Version 2.7 released. + ======================= + + + Tag sources with `VER-2-7'. + + * docs/VERSION.TXT: Add entry for version 2.7. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.6.5/2.7/, s/265/27/. + + * include/freetype/freetype.h (FREETYPE_MINOR): Set to 7. + (FREETYPE_PATCH): Set to 0. + + * builds/unix/configure.raw (version_info): Set to 18:6:12. + * CMakeLists.txt (VERSION_MINOR): Set to 7. + (VERSION_PATCH): Set to 0. + + * docs/CHANGES: Updated. + +2016-09-08 Werner Lemberg + + * src/truetype/ttinterp.c: Include `ttgxvar.h'. + + This fixes the `multi' build. + +2016-09-08 Werner Lemberg + + [autofit] Another improvement to Armenian support. + + Suggested by Hrant H Papazian . + + * src/autofit/afscript.h: Use better suited characters to derive + default stem widths. + +2016-09-07 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_hline): Micro-optimize. + +2016-09-06 Alexei Podtelezhnikov + + [smooth] Operate in absolute bitmap coordinates. + + Simpler bitmap addressing improves performance by 1.5%. + + * src/smooth/ftgrays.c (gray_TWorker): Remove count fields. + (gray_dump_cells, gray_find_cell, gray_set_cell, gray_hline, + gray_sweep, gray_convert_glyph, gray_raster_render): Updated. + +2016-09-06 Alexei Podtelezhnikov + + [smooth] Improve contour start (take 2). + + * src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly + instead of... + (gray_start_cell): ... this function, which is removed. + (gray_convert_glyph): Make initial y-coordinate invalid. + +2016-09-06 Werner Lemberg + + [type1] MM fonts support exactly zero named instances (#48748). + + * src/type1/t1load.c (T1_Get_MM_Var): Set `num_namedstyles' to zero. + +2016-09-06 Jonathan Kew + + [cff] Fix uninitialized memory. + + Problem reported as + + https://bugzilla.mozilla.org/show_bug.cgi?id=1270288 + + * src/cff/cf2intrp.c (cf2_interpT2CharString): Initialize `storage' + array to handle a `get' opcode without a previous `put'. + +2016-09-05 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_move_to, gray_start_cell): Revert. + +2016-09-05 Alexei Podtelezhnikov + + [smooth] Improve contour start. + + * src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly + instead of... + (gray_start_cell): ... this function, which is removed. + +2016-09-05 Werner Lemberg + + [cff] Fix memory initialization. + + * src/cff/cf2stack.c (cf2_stack_init): Use `FT_NEW'. The `Q' + variants of FreeType's memory allocation macros don't do zeroing. + +2016-09-05 Werner Lemberg + + [ftrandom] Minor improvements. + + * src/tools/ftrandom/ftrandom.c (_XOPEN_SOURCE): New macro, set to + 500. + + * src/tools/ftrandom/Makefile (CFLAGS): Split off include + directories to ... + (INCLUDES): ... this new variable. + (LDFLAGS): New variable. + (ftrandom.o, ftrandom): Updated. + +2016-09-05 Werner Lemberg + + [autofit] Improve Armenian support. + + Thanks to Hrant H Papazian for help. + + * src/autofit/afblue.dat (AF_BLUE_STRING_ARMENIAN_*): Improve + selection of characters. + + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + +2016-09-04 Werner Lemberg + + [ftrandom] Improve Makefile. + + It now supports both a normal build (`./configure && make') and a + development build (`make devel'). + + * src/tools/ftrandom/Makefile (VPATH): Set it so that + `libfreetype.a' gets searched in both `objs' (for the development + build) and `objs/.libs' (for a normal build which uses libtool). + (LIBS): Add missing libraries. + (ftrandom.o): New rule. + (ftrandom): Use automatic variables. + +2016-09-03 Werner Lemberg + + [truetype] More fixes for handling of GX deltas. + + Problems reported by Bob Taylor . + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix rough + sanity test for glyph variation array header size. + Always set stream position before reading packed x and y deltas. + Fix thinko w.r.t. `localpoints' array. + +2016-09-03 Werner Lemberg + + [ftrandom] Various fixes. + + * src/tools/ftrandom/ftrandom.c (GOOD_FONTS_DIR): Provide better + default. + (error_fraction): Make it of type `double' to work as advertized – + this was completely broken. + Update all related code. + (error_count, fcnt): Make it unsigned to fix compiler warnings. + Update all related code. + (fontlist): Change `len' member to `long' to fix compiler warnings. + (FT_MoveTo, FT_LineTo, FT_ConicTo, FT_CubicTo, abort_test): Tag + unused variables. + (TestFace, FindFonts, copyfont, do_test): Fix compiler warnings. + (ExecuteTest): Ditto. + Call `FT_Done_FreeType'. + (getErrorCnt): Replace `ceil' with an ordinary cast to `unsigned + int'. + (usage): Improve output. + (main): Fix compiler warnings. + + * src/tools/ftrandom/README: Updated. + +2016-09-03 Werner Lemberg + + [base] Avoid negative bitmap strike dimensions (#48985). + + * src/base/ftobjs.c (FT_Open_Face): Check whether negation was + actually successful. For example, this can fail for value + -32768 if the type is `signed short'. If there are problems, + disable the strike. + +2016-09-03 Werner Lemberg + + [cff] Avoid null pointer passed to FT_MEM_COPY (#48984). + + * src/cff/cffload.c (cff_index_get_name): Check `byte_len'. + +2016-09-02 Werner Lemberg + + [unix] Enable 64bit support in file system access (#48962). + + * builds/unix/configure.raw: Call `AC_SYS_LARGEFILE'. + +2016-09-02 Werner Lemberg + + [sfnt] Avoid left shift of negative value (#48980). + + * src/sfnt/ttsbit.c (tt_sbit_decoder_load_bit_aligned): Use unsigned + constant. + +2016-09-02 Werner Lemberg + + * src/smooth/ftgrays.c (gray_hline): Fix clang compiler warnings. + +2016-09-02 Werner Lemberg + + Some preparations for the next release. + + * include/freetype/config/ftoption.h + (TT_CONFIG_OPTION_SUBPIXEL_HINTING): Enable. + + * docs/CHANGES: Updated. + +2016-09-01 Alexei Podtelezhnikov + + [smooth] Simplify span rendering more. + + It turns out that there is significant cost associated with `FT_Span' + creation and calls to `gray_render_span' because it happens so + frequently. This removes these steps from our internal use but leaves + it alone for `FT_RASTER_FLAG_DIRECT" to preserve API. The speed gain + is about 5%. + + * src/smooth/ftgrays.c (gray_render_span): Removed. The code is + migrated to... + (gray_hline): ... here. + +2016-08-30 Alexei Podtelezhnikov + + [smooth] Streamline pixmap drawing a bit more. + + Zero coverage is unlikely (1 out of 256) to warrant checking. This + gives 0.5% speed improvement in rendering simple glyphs. + + * src/smooth/ftgrays.c (gray_hline, gray_render_span): Remove checks. + +2016-08-29 Alexei Podtelezhnikov + + [smooth] Streamline pixmap drawing. + + This gives 2% speed improvement in rendering simple glyphs. + + * src/smooth/ftgrays.c (TPixmap): Reduced pixmap descriptor with a + pointer to its bottom-left and pitch to be used in... + (gray_TWorker): ... here. + (gray_render_span): Move pixmap flow check from here... + (gray_raster_render): .. to here. + +2016-08-27 Alexei Podtelezhnikov + + [smooth] Reduce stack of band boundaries. + + * src/smooth/ftgrays.c (gray_TBand): Removed. + (gray_convert_glyph): Updated to stack band boundaries concisely. + +2016-08-26 Werner Lemberg + + * src/cid/cidload.c (cid_face_open): Improve handling of `SDBytes'. + +2016-08-26 Werner Lemberg + + [cid] Fix commit from 2016-05-16. + + * src/cid/cidparse.c (cid_parser_new): Fix off-by-one errors. + +2016-08-26 Werner Lemberg + + [sfnt] Cache offset and size to bitmap data table. + + This commit avoids `EBDT' and friends being looked up again and + again while loading a single embedded bitmap. + + * include/freetype/internal/tttypes.h (TT_FaceRec) + [TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: New fields `ebdt_start' and + `ebdt_size'. + + * src/sfnt/ttsbit.c (tt_sbit_decoder_init): Move table lookup to ... + (tt_face_load_sbit): ... this function; also store the table size + and offset. + +2016-08-26 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_raster_render): Minor tweaks. + +2016-08-26 Werner Lemberg + + [type1] Fix heap buffer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36 + + * src/type1/t1load.c (parse_charstrings): Reject fonts that don't + contain glyph names. + +2016-08-25 Werner Lemberg + + [sfnt] Fix previous commit (#48901). + + * src/sfnt/ttcmap.c (tt_cmap4_char_map_binary): Thinkos. + +2016-08-25 Werner Lemberg + + [sfnt] Speed up handling of invalid format 4 cmaps. + + * src/sfnt/ttcmap.c (tt_cmap4_next, tt_cmap4_char_map_binary): Add + tests for `num_glyph' from `tt_cmap4_char_map_linear'. + +2016-08-25 Werner Lemberg + + * include/freetype/internal/ftdriver.h: Remove unused typedefs. + +2016-08-22 Alexei Podtelezhnikov + + [smooth] Simplify span rendering. + + This removes unnecessary complexity of span merging and buffering. + Instead, the spans are rendered as they come, speeding up the + rendering by about 5% as a result. + + * src/smooth/ftgrays.c [FT_MAX_GRAY_SPANS]: Macro removed. + (gray_TWorker): Remove span buffer and related fields. + (gray_sweep, gray_hline): Updated. + + * include/freetype/ftimage.h: Remove documentation note about + `FT_MAX_GRAY_SPANS', which was never in `ftoption.h' and is now gone. + +2016-08-16 Werner Lemberg + + [truetype] Fix `MPS' instruction. + + According to Greg Hitchcock, MPS in DWrite really returns the point + size. + + * src/truetype/ttobjs.h (TT_SizeRec): Add `point_size' member. + + * src/truetype/ttdriver.c (tt_size_request): Set `point_size'. + + * src/truetype/ttinterp.h (TT_ExecContextRec): Add `pointSize' + member. + + * src/truetype/ttinterp.c (TT_Load_Context): Updated. + (Ins_MPS): Fix instruction. + +2016-08-16 Werner Lemberg + + [lzw] Optimize last commit. + + * src/lzw/ftzopen.c (ft_lzwstate_get_code): Move check into + conditional clause. + +2016-08-16 Werner Lemberg + + [lzw] Avoid invalid left shift. + + Reported as + + https://bugzilla.mozilla.org/show_bug.cgi?id=1295366 + + * src/lzw/ftzopen.c (ft_lzwstate_get_code): Limit `num_bits'. + +2016-08-16 Werner Lemberg + + [lzw] Avoid buffer overrun. + + Reported as + + https://bugzilla.mozilla.org/show_bug.cgi?id=1273283 + + * src/lzw/ftzopen.c (ft_lzwstate_refill): Ensure `buf_size' doesn't + underflow. + +2016-08-16 Werner Lemberg + + [truetype] Fix compiler warning. + + * src/truetype/ttgload.c (load_truetype_glyph): Add cast. + +2016-08-13 Werner Lemberg + + [winfonts] Avoid zero bitmap width and height. + + Reported as + + https://bugzilla.mozilla.org/show_bug.cgi?id=1272173 + + * src/winfonts/winfnt.c (FNT_Face_Init): Check zero pixel height. + (FNT_Load_Glyph): Check for zero pitch. + +2016-08-11 Alexei Podtelezhnikov + + * src/truetype/ttinterp.c (Pop_Push_Count): Revert changes. + +2016-08-11 Alexei Podtelezhnikov + + * src/truetype/ttinterp.c (TT_RunIns): Minor and formatting. + +2016-08-11 Alexei Podtelezhnikov + + * src/truetype/ttinterp.c (Pop_Push_Count): Fix some entries. + +2016-08-10 Peter Klotz + + * src/smooth/ftgrays.c (gray_hline): Fix uninitialized access. + +2016-08-10 Werner Lemberg + + [sfnt] Use correct type for `italicAngle' field (#48732). + + * src/sfnt/ttload.c (tt_face_load_post): Fix types. + +2016-08-06 Jon Spencer + + [sfnt] Fix `FT_Get_Advance' for bitmap strikes. + + `FT_Get_Advance' returns 0 for bitmap fonts. It first gets the + advance value from the font table and then scales it by the + `font->size->metrics->x_scale' field. But `FT_Select_Size' doesn't + set that value for bitmap fonts and the advance gets scaled to zero. + + Taken from + + https://github.com/behdad/harfbuzz/issues/252 + + * src/sfnt/ttsbit.c (tt_face_load_strike_metrics) + : Set scale values. + +2016-08-06 Behdad Esfahbod + + [truetype] Fix GX variation handling of composites. + + * src/truetype/ttgload.c (load_truetype_glyph) + [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Check `ARGS_ARE_XY_VALUES' flag. + +2016-08-05 Alexei Podtelezhnikov + + [smooth] Minor refactoring. + + * src/smooth/ftgrays.c (gray_render_scanline, gray_render_line): + Updated. + +2016-07-29 Werner Lemberg + + [sfnt, truetype] Don't abort on invalid `maxComponentDepth'. + + Since 2016-05-16 we detect infinite recursion directly. + + * src/sfnt/ttload.c (tt_face_load_maxp): Don't adjust + `maxComponentDepth'. + * src/truetype/ttgload.c (load_truetype_glyph): Don't abort if + `maxComponentDepth' is not valid. Instead, simply adjust its value + and emit a tracing message. + +2016-07-26 Werner Lemberg + + * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Minor. + + No functional change. + +2016-07-22 Hin-Tak Leung + + [truetype] Record the end of IDEFs. + + To match the logic in FDEF. The value of the end is only used for + bound-checking in `Ins_JMPR', so it may not have been obvious that + it was not recorded. Tested (as part of Font Validator 2.0) all the + fonts on Fedora and did not see any change. + + * src/truetype/ttinterp.c (Ins_IDEF): Updated. + +2016-07-19 Werner Lemberg + + [truetype] Sanitizer fix, second try. + + * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary + tests and use only one slot more. + +2016-07-19 Werner Lemberg + + [truetype] Sanitizer fix. + + * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Increase array + to fix nested loops. + +2016-07-18 Werner Lemberg + + [truetype] Make GETDATA work only for GX fonts. + + * src/truetype/ttinterp.c (opcode_name): Updated. + (Ins_GETDATA): Only define for `TT_CONFIG_OPTION_GX_VAR_SUPPORT'. + (TT_RunIns): Updated. + +2016-07-17 Werner Lemberg + + [truetype] Add support for Apple's + + GETDATA[], opcode 0x92 + + bytecode instruction. It always returns 17, and we have absolutely + no idea what it is good for... + + * src/truetype/ttinterp.c (Pop_Push_Count, opcode_name): Updated. + (Ins_GETDATA): New function. + (TT_RunIns): Add it. + +2016-07-16 Werner Lemberg + + [truetype] Add bytecode support for GX variation fonts. + + This commit implements undocumented (but confirmed) stuff from + Apple's old bytecode engine. + + GETVARIATION[], opcode 0x91 + This opcode pushes normalized variation coordinates for all axes + onto the stack (in 2.14 format). Coordinate of first axis gets + pushed first. + + GETINFO[], selector bit 3 + If GX variation support is enabled, bit 10 of the result is set + to 1. + + * src/truetype/ttinterp.c: Include FT_MULTIPLE_MASTERS_H. + (opcode_name) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated. + (Ins_GETINFO) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle selector + bit 3, checking support for variation glyph hinting. + (Ins_GETVARIATION) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New function + to implement opcode 0x91. + (TT_RunIns) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle opcode 0x91. + +2016-07-16 Werner Lemberg + + [truetype] Fix GETINFO bytecode instruction. + + * src/truetype/ttinterp.c (Ins_GETINFO): Fix return value for + stretching information. + +2016-07-16 Behdad Esfahbod + + [truetype] Make all glyphs in `Zycon' GX font work. + + * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary + tests. + +2016-07-16 Werner Lemberg + + [truetype] Fix GX delta tracing. + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Trace + relative point movements. + +2016-07-16 Behdad Esfahbod + + [truetype] More fixes for GX. + + This finally fixes the rendering of the cyclist and the lizard in + the `Zycon' font. + + * src/truetype/ttgxvar.c (ft_var_readpackedpoints): `first' point + index is always cumulative. + + (tt_handle_deltas): Rename to... + (tt_interpolate_deltas): ... This. + Add new parameter for output point array. + Update caller. + + (TT_Vary_Apply_Glyph_Deltas): Add `points_out' array; it now holds + the intermediate results of `tt_interpolate_deltas' that are to be + added to `outline->points'. + +2016-07-15 Werner Lemberg + + * src/autofit/aflatin.c (af_latin_hints_compute_segments): Thinko. + + `max_pos' is always larger than `min_pos' so `FT_ABS' is not needed. + + Reported by Alexei. + +2016-07-16 Nikolaus Waxweiler + + * src/truetype/ttinterp.c (Ins_MIRP): Fix copy-and-paste error. + + Problem reported by Hin-Tak Leung. + +2016-07-15 Werner Lemberg + + [autofit] Update and improve segment and edge tracing. + + * src/autofit/afhints.c (af_glyph_hints_dump_segments): Trace + `delta' also. + Don't show first point of segment as a replacement for `pos'; this + is (a) misleading, since the difference to `pos' can be almost + arbitrarily large in corner cases, and (b) it is better to have all + segment data in font units instead of a single value given in output + space coordinates. + Improve layout. + (af_glyph_hints_dump_edges): Show px->units and units->px conversion + values for convenience. + Improve layout. + +2016-07-15 Werner Lemberg + + [autofit] For edges, reject segments wider than 1px (#41334). + + * src/autofit/afhints.h (AF_SegmentRec): New member `delta'. + + * src/autofit/aflatin.c (af_latin_hints_compute_segments): Compute + `delta'. + (af_latin_hints_compute_edges): Reject segments with a delta larger + than 0.5px. + +2016-07-14 Werner Lemberg + + * include/freetype/freetype.h (FT_IS_NAMED_INSTANCE): New macro. + +2016-07-14 Werner Lemberg + + [sfnt] Fix `face_index' value in `FT_Face' for named instances. + + * src/sfnt/sfobjs.c (sfnt_init_face): Don't strip off higher 16bits. + +2016-07-14 Werner Lemberg + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix tracing. + +2016-07-14 Behdad Esfahbod + + [truetype] Fix gxvar delta interpolation. + + The coordinates of the base font should be used for interpolation + purposes, NOT the current points (i.e., the result of accumulation + of previous deltas). + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Initialize + `points_org' before looping over all tuples. + + +---------------------------------------------------------------------------- + +Copyright 2016-2018 by +David Turner, Robert Wilhelm, and Werner Lemberg. + +This file is part of the FreeType project, and may only be used, modified, +and distributed under the terms of the FreeType project license, +LICENSE.TXT. By continuing to use, modify, or distribute this file you +indicate that you have read the license and understand and accept it +fully. + + +Local Variables: +version-control: never +coding: utf-8 +End: diff --git a/ChangeLog.28 b/ChangeLog.28 new file mode 100644 index 000000000..ca1ff3850 --- /dev/null +++ b/ChangeLog.28 @@ -0,0 +1,3136 @@ +2017-09-16 Werner Lemberg + + * Version 2.8.1 released. + ========================= + + + Tag sources with `VER-2-8-1'. + + * docs/VERSION.TXT: Add entry for version 2.8.1. + * docs/CHANGES: Updated. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.8/2.8.1/, s/28/281/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. + + * builds/unix/configure.raw (version_info): Set to 21:0:15. + * CMakeLists.txt (VERSION_PATCH): Set to 1. + +2017-09-13 suzuki toshiya + + [sfnt] lowest gcc for vectors (e1d0249e) is changed to 4.7. + + __builtin_shuffle() was introduced in gcc-4.7. The lowest + gcc to enable vector operation is delayed from 4.6 to 4.7. + + * src/sfnt/pngshim.c (premultiply_data): Fix cpp-macro to + enable the vector operation, to change the lowest gcc version + from 4.6 to 4.7. + +2017-09-13 suzuki toshiya + + [cache] Fix a possible overflow by signed integer comparison. + + Improve the code by 5d3ff05615dda6d1325ed612381a17a0df04c975 , + issues are found by Behdad Esfahbod and Werner Lemberg. + + * src/cache/ftcbasic.c (FTC_ImageCache_Lookup): Replace + a subtraction to check higher bit by a bit operation, + and cpp-conditionalize for appropriate systems. Add better + documentation to the comment. + (FTC_ImageCache_LookupScaler): Ditto. + (FTC_SBitCache_Lookup): Ditto. + (FTC_SBitCache_LookupScaler): Ditto. + +2017-09-13 Werner Lemberg + + [autofit] Really fix #41334 (#52000). + + * src/autofit/aflatin.c (af_latin_hints_compute_segments): Set + `segment->delta' everywhere. + +2017-09-12 suzuki toshiya + + [autofit, sfnt] Fix for `make multi'. + + * src/autofit/afshaper.c: Include FT_ADVANCE_H, to use + FT_Get_Advance() in it. + * src/sfnt/ttcmap.c: Include FT_SERVICE_POSTSCRIPT_CMAPS_H + to use PS_Unicodes in it, also include `ttpost.h' to use + tt_face_get_ps_name() in it. + +2017-09-11 Azzuro + + [build] Improve builds with different MS Visual Studio versions. + + * builds/windows/vc2010/freetype.vcxproj: Switch platform toolset + according to the Visual Studio version. + +2017-09-11 Werner Lemberg + + * src/sfnt/ttkern.c (tt_face_load_kern): Reject format 2 tables. + + Reported by Behdad. + +2017-09-09 Werner Lemberg + + [autofit] Improve communication with ftgrid. + + * src/autofit/afhints.c (af_glyph_hints_get_segment_offset): + Provide values in font units. + +2017-09-08 suzuki toshiya + + [base] Remove a check for resource ID in the resource fork driver. + + LastResort.dfont has a marginal resource ID 0xFFFF for sfnt + resource. Inside Macintosh: More Macintosh Toolbox, `Resource IDs' + (1-46), tells that some IDs are reserved and should not be used. + FreeType2 just uses resource ID to sort the fragmented resource. + To accept the marginal fonts, the checking is removed. + + * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Remove res_id + validity check, fix a trace message format. + +2017-09-08 suzuki toshiya + + [sfnt, truetype] Register the tags for marginal fonts. + + The first 32bit of standard TrueType variants is 0x00010000, + `OTTO', `ttcf', `true' or `typ1'. 2 marginal dfonts on legacy Mac + OS X, Keyboard.dfont and LastResort.dfont, have the sfnt resources + starting 0xA5 followed by `kbd' or `lst'. Considering the following + data could be parsed as conventional TrueType fonts, the header + checking is updated to allow these tags. It seems that recent Mac + OS X has already switched to normal TTF for these fonts. + + See the discussion at + http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=3931.0 + + * include/freetype/tttags.h (TTAG_0xA5kbd, TTAG_0xA5lst): New header + tags for Keyboard.dfont and LastResort.dfont. + * src/sfnt/sfobjs.c (sfnt_open_font): Accept the sfnt resource + starts with TTAG_0xA5kbd or TTAG_0xA5lst. + * src/truetype/ttobjs.c (tt_face_init): Accept the face with the + format tag is TTAG_0xA5kbd or TTAG_0xA5lst. + +2017-09-05 Werner Lemberg + + Fix multiple calls of `FT_Bitmap_Convert'. + + The documentation of `FT_Bitmap_Convert' says that multiple calls do + proper reallocation of the target FT_Bitmap object. However, this + failed for the sequence + + non-empty bitmap + empty bitmap + non-empty bitmap + + Reason was that `FT_Bitmap_Convert' only reallocated the bitmap + buffer if it became too small; it didn't make the buffer smaller. + For an empty bitmap following a non-empty one, only the buffer + dimension got set to zero, without deallocation. If the next call + was a non-empty buffer again, an assertion in `ft_mem_qrealloc' was + triggered. + + * src/base/ftbitmap.c (FT_Bitmap_Convert): Always reallocate target + buffer to the correct size. + + * docs/CHANGES: Document it. + +2017-09-05 Werner Lemberg + + [bdf] Fix size and resolution handling. + + * src/bdf/bdfdrivr.c (BDF_Face_Init): Use `SIZE' values if + `POINT_SIZE', `RESOLUTION_X', or `RESOLUTION_Y' properties are + missing. + + * docs/CHANGES: Document it. + +2017-08-25 Alexei Podtelezhnikov + + Swap `ALLOC_MULT' arguments (#51833). + + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Updated. + * src/winfonts/winfnt.c (FNT_Load_Glyph): Updated. + * src/raster/ftrend1.c (ft_raster1_render): Updated. + +2017-08-23 Werner Lemberg + + [sfnt] Fix clang compilation (#51788). + + * src/sfnt/pngshim.c (premultiply_data): Use vectors instead of + scalars. + (vector_shuffle): New macro to take care of a different built-in + function name on clang. + +2017-08-22 Werner Lemberg + + [base] Don't zero out allocated memory twice (#51816). + + Patch applied from bug report. + + * src/base/ftutil.c (ft_mem_qrealloc): Use low-level allocation to + avoid unnecessary overhead. + +2017-08-22 Werner Lemberg + + [truetype] Integer overflow. + + Changes triggered by + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3107 + + * src/truetype/ttinterp.c (Ins_MDRP, Ins_MIRP, Ins_ALIGNPTS): Use + NEG_LONG. + +2017-08-17 Alexei Podtelezhnikov + + [sfnt] Avoid synthetic unicode for symbol fonts with PUA. + + Reported as + + https://bugs.chromium.org/p/chromium/issues/detail?id=754574 + + * src/sfnt/sfobjs.c (sfnt_load_face): Check for FT_ENCODING_MS_SYMBOL. + +2017-08-16 Werner Lemberg + + * src/sfnt/pngshim.c (premultiply_data): Fix compiler warnings. + +2017-08-15 Behdad Esfahbod + + [sfnt] Speed up PNG image loading. + + This reduces the overhead of `premultiply_data' by 60%. + + * src/sfnt/pngshim.c (premultiply_data): Provide code which uses + gcc's (and clang's) `vector_byte' attribute to process 4 pixels at a + time. + +2017-08-11 Werner Lemberg + + [sfnt, truetype] Improve handling of missing sbits. + + Requested by Behdad. + + Modern bitmap-only SFNTs like `NotoColorEmoji.ttf' don't contain + entries in the bitmap strike(s) for empty glyphs. Instead, they + rely that a space glyph gets created from the font's metrics data. + This commit makes FreeType behave accordingly. + + * include/freetype/fterrdef.h (FT_Err_Missing_Bitmap): New error + code. + + * src/sfnt/ttsbit.c (tt_sbit_decoder_load_image): Change error codes + to make a distinction between a missing bitmap in a composite and a + simple missing bitmap. + + * src/truetype/ttgload.c (TT_Load_Glyph): For a missing bitmap (in a + bitmap-only font), synthesize an empty bitmap glyph if metrics are + available. + +2017-08-10 Werner Lemberg + + [base] Minor API improvement for default variation axis setting. + + * src/base/ftmm.c (FT_Set_MM_Design_Coordinates, + FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, + FT_Set_Var_Blend_Coordinates): Allow coords==NULL if num_coords==0. + + * docs/CHANGES: Updated. + +2017-08-08 Werner Lemberg + + [psnames] Really fix issue #49949. + + We now use a separate preprocessor macro to handle both definition + and declaration of the glyph name arrays. + + * src/psnames/psmodule.c (DEFINE_PS_TABLE_DATA): New macro. + + * src/tools/glnames.py (StringTable::dump, + StringTable::dump_sublist): Use `DEFINE_PS_TABLE_DATA'. + (dump_encoding): Ditto. + (main): Use `wb' mode for writing the output file, which works on + Windows also. + + * src/psnames/pstables.h: Regenerated. + +2017-08-08 Alexei Podtelezhnikov + + [smooth] Harmony LCD rendering. + + This is a new technology for LCD-optimized rendering. It capitalizes + on the fact that each color channel grid is shifted by a third of a + pixel. Therefore it is logical to render 3 separate monochrome + bitmaps shifting the outline by 1/3 pixel, and then combine them. + Importantly, the resulting output does not require additional LCD + filtering. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic) + [!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Implement new LCD-optimized + rendering. + + * include/freetype/ftlcdfil.h, include/freetype/freetype.h, + include/freetype/config/ftoption.h, devel/ftoption.h: Updated + documentation. + +2017-08-08 Alexei Podtelezhnikov + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Clean up. + +2017-08-08 Alexei Podtelezhnikov + + * src/sfnt/ttpost.c (format): Use otspec-compliant versions. + +2017-08-05 Werner Lemberg + + [truetype] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2868 + + * src/truetype/ttinterp.c (Ins_ALIGNRP): Use NEG_LONG. + +2017-08-05 Werner Lemberg + + [base, truetype] New function `FT_Get_Var_Axis_Flags'. + + The reserved `flags' field got a value in OpenType version 1.8.2; + unfortunately, the public `FT_Var_Axis' structure misses the + corresponding element. Since we can't add a new field, we add an + access function. + + * src/base/ftmm.c (FT_Get_Var_Axis_Flags): New function. + + * include/freetype/ftmm.h (FT_VAR_AXIS_FLAG_HIDDEN): New macro. + Updated. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Increase allocated memory + of `mmvar' to hold axis flags. + Fill the axis flags array. + + * docs/CHANGES: Updated. + +2017-08-03 Nikolaus Waxweiler + + [truetype] Fix metrics of B/W hinting in v40 mode. + + Phantom points are now saved outside v40 backwards compatibility + mode. This fixes the jumping glyphs when switching between v35 and + v40 monochrome mode. + + * src/truetype/ttgload.c (TT_Hint_Glyph): Fix inversed bool logic. + +2017-08-03 Nikolaus Waxweiler + + [truetype] Do not set any ClearType flags in v40 monochrome mode. + + This fixes weird behavior of instructions that resulted in rendering + differences between v35 and v40 in monochrome mode, e.g., in + `timesbi.ttf'. + + * src/truetype/ttinterp.c (Ins_GETINFO) + [TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL]: Check + `subpixel_hinting_lean'. + +2017-08-01 Werner Lemberg + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Fix thinko. + +2017-08-01 Behdad Esfahbod + + [truetype] Fix loading of named instances. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Preserve file position + while loading the `avar' table. + +2017-08-01 Werner Lemberg + + [sfnt, truetype] Minor adjustments for OpenType 1.8.2. + + * src/sfnt/sfobjs.c (sfnt_load_face): The units per EM value has now + (tighter) limits. + + * src/truetype/ttgload.c (load_truetype_glyph): The new OpenType + version explicitly allows all negative values for the number of + contours if we have a composite glyph (this is for better backwards + compatibility I guess), but it still recommends value -1. + +2017-07-26 Werner Lemberg + + [cff] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2738 + + * src/cff/cf2hints.c (cf2_glyphpath_computeOffset, + cf2_glyphpath_curveTo): Use ADD_INT32. + +2017-07-13 Werner Lemberg + + [base] Fix memory leak. + + Reported as + + https://bugs.chromium.org/p/chromium/issues/detail?id=738362 + + * src/base/ftglyph.c (FT_Get_Glyph): Do proper deallocation in case + of error. + +2017-07-12 Werner Lemberg + + [base] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2573 + + * src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Use + FT_PIX_CEIL_LONG and FT_PIX_ROUND_LONG. + +2017-07-12 Werner Lemberg + + * src/truetype/ttpload.c (tt_face_get_location): Off-by-one typo. + + Also improve tracing message. + + Problem reported as + + https://bugs.chromium.org/p/chromium/issues/detail?id=738919 + +2017-07-07 Werner Lemberg + + [cff] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2517 + + * src/cff/cf2blues.c (cf2_blues_capture): Use SUB_INT32. + +2017-07-05 Werner Lemberg + + * src/sfnt/ttcmap.c (tt_cmap_unicode_class_rec): Fix warning. + +2017-07-05 Werner Lemberg + + * src/truetype/ttgxvar.c (FT_Stream_SeekSet): Fix warning (#51395). + +2017-07-04 Werner Lemberg + + [truetype] Prevent address overflow (#51365). + + * src/truetype/ttgxvar.c (FT_Stream_SeekSet): Add guard. + +2017-07-03 Alexei Podtelezhnikov + + * src/base/ftlcdfil.c (ft_lcd_filter_fir): Improve code. + +2017-07-03 Werner Lemberg + + [truetype] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2455 + + * src/truetype/ttinterp.c (Ins_SCFS): Use SUB_LONG. + +2017-07-01 Alexei Podtelezhnikov + + * src/sfnt/sfobjs.c (sfnt_load_face): Ignore No_Unicode_Glyph_Name. + +2017-06-28 Ben Wagner + + Avoid Microsoft compiler warnings (#51331). + + While clang's sanitizer recommends a cast to unsigned for safe + negation (to handle -INT_MIN), both MSVC and Visualc emit warning + C4146 if an unsigned value gets negated. + + * include/freetype/internal/ftcalc.h (NEG_LONG, NEG_INT32), + src/base/ftcalc.c (FT_MOVE_SIGN): Replace negation with a + subtraction. + +2017-06-27 Werner Lemberg + + * src/cff/cffparse.c (do_fixed): Fix typo. + + Spotted by chris . + +2017-06-27 Werner Lemberg + + [truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2384 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2391 + + * src/base/ftcalc.c (FT_MulDiv, FT_MulDiv_No_Round, FT_DivFix): Use + NEG_LONG. + + * src/truetype/ttinterp.c (Ins_SxVTL): Use NEG_LONG. + +2017-06-24 Werner Lemberg + + [truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2364 + + * src/truetype/ttinterp.c (Ins_ISECT): Use NEG_LONG. + +2017-06-22 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2323 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2328 + + * src/cff/cf2blues.c (cf2_blues_capture): Use ADD_INT32 and + SUB_INT32. + + * src/truetype/ttinterp.c (Ins_SDPVTL): Use SUB_LONG and NEG_LONG. + +2017-06-21 Alexei Podtelezhnikov + + [sfnt] Synthesize a Unicode charmap if one is missing. + + * src/sfnt/ttcmap.h (tt_cmap_unicode_class_rec): Declare it. + * src/sfnt/ttcmap.c (tt_get_glyph_name, tt_cmap_unicode_init, + tt_cmap_unicode_done, tt_cmap_unicode_char_index, + tt_cmap_unicode_char_next, tt_cmap_unicode_class_rec): Implement + synthetic Unicode charmap class. + (tt_get_cmap_info): Make sure the callback is available. + + * src/sfnt/sfobjs.c (sfnt_load_face) + [FT_CONFIG_OPTION_POSTSCRIPT_NAMES]: If Unicode charmap is missing, + synthesize one. + + * include/freetype/config/ftoption.h: Document it. + * devel/ftoption.h: Ditto. + +2017-06-20 Tony Theodore + + Fix pkg-config in freetype-config for cross-compiling (#51274). + + * builds/unix/unix-def.in (PKG_CONFIG): New variable. + (freetype-config): Use it in sed expression. + + * builds/unix/freetype-config.in: s/pkg-config/%PKG_CONFIG%/. + +2017-06-20 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2300 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2313 + + * src/cff/cf2hints.c (cf2_hintmap_adjustHints): Use ADD_INT32. + + * src/truetype/ttinterp.c (Ins_ABS): Avoid FT_ABS. + +2017-06-17 Alexei Podtelezhnikov + + [base, smooth] LCD filtering cleanups. + + * src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy): + Clean up, start filtering from the bottom-left origin. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Updated. + +2017-06-16 Werner Lemberg + + [truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2270 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2276 + + * src/truetype/ttinterp.c (Ins_MDRP, _iup_worker_interpolate): Use + ADD_LONG and SUB_LONG. + +2017-06-15 Werner Lemberg + + [bdf, cff] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2244 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2261 + + * src/bdf/bdfdrivr.c (BDF_Face_Init): Replace calls to FT_ABS with + direct code to avoid value negation. + + * src/cff/cf2blues.c (cf2_blues_capture): Use SUB_INT32 and + ADD_INT32. + +2017-06-13 Werner Lemberg + + * src/winfonts/winfnt.c (FNT_Face_Init): Don't set active encoding. + + FreeType only sets a default active encoding for Unicode. + +2017-06-13 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2216 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2218 + + * src/cff/cf2fixed.h (cf2_fixedAbs): Use NEG_INT32. + + * src/truetype/ttinterp.c (Ins_IP): Use SUB_LONG. + +2017-06-11 Werner Lemberg + + [cff] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2200 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2210 + + * src/cff/cf2hints.c (cf2_hintmap_insertHint): Use SUB_INT32 and + ADD_INT32. + + * src/cff/cf2intrp.c (cf2_interpT2CharString) : Use + ADD_INT32. + +2017-06-10 Werner Lemberg + + [truetype] Fix TT_Set_Var_Design. + + Reported by Nikolaus Waxweiler . + + * src/truetype/ttgxvar.c (TT_Set_Var_Design): Correctly handle the + case where we have less input coordinates than axes. + +2017-06-10 Werner Lemberg + + * src/base/ftcalc.c (FT_DivFix): Fix embarrassing typo. + + Bug introduced 2017-05-28. + +2017-06-09 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2144 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2151 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2153 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2173 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2186 + + * src/cff/cf2blues.c (cf2_blues_init): Use SUB_INT32. + + * src/truetype/ttinterp.c (Round_None, Round_To_Grid, + Round_To_Half_Grid, Round_Down_To_Grid, Round_Up_To_Grid, + Round_To_Double_Grid, Round_Super, Round_Super_45): Use ADD_LONG, + SUB_LONG, NEG_LONG, FT_PIX_ROUND_LONG, FT_PIX_CEIL_LONG, + FT_PAD_ROUND_LONG + (Ins_SxVTL, Ins_MIRP): Use SUB_LONG. + (_iup_worker_shift): Use SUB_LONG and ADD_LONG. + +2017-06-09 Werner Lemberg + + Provide more macros for flooring, ceiling, and rounding. + + These versions don't produce run-time errors due to integer + overflow. + + * include/freetype/internal/ftobjs.h: Include FT_INTERNAL_CALC_H. + (FT_PAD_ROUND_LONG, FT_PAD_CEIL_LONG, FT_PIX_ROUND_LONG, + FT_PIX_CEIL_LONG): New macros. + (FT_PAD_ROUND_INT32, FT_PAD_CEIL_INT32, FT_PIX_ROUND_INT32, + FT_PIX_CEIL_INT32): New macros. + +2017-06-09 Werner Lemberg + + Remove unused macros. + + * include/freetype/internal/ftcalc.h (ADD_INT, SUB_INT, MUL_INT, + NEG_INT): Deleted. + +2017-06-09 Werner Lemberg + + */*: Remove `OVERFLOW_' prefix. + + This increases readability. + +2017-06-07 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2133 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2137 + + * src/cff/cf2hints.c (cf2_hint_init): Use OVERFLOW_SUB_INT32. + + * src/truetype/ttinterp.c (PROJECT, DUALPROJ): Use + OVERFLOW_SUB_LONG. + +2017-06-06 Werner Lemberg + + [cff] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2109 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2110 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2122 + + * src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32. + + * src/cff/cf2hints.c (cf2_hintmap_map): Synchronize if-else + branches. + +2017-06-05 Werner Lemberg + + [cff] Integer overflow. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2089 + + * src/cff/cffload.c (cff_blend_doBlend): User OVERFLOW_ADD_INT32. + +2017-06-04 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2075 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2088 + + * src/cff/cf2font.c (cf2_font_setup): Use OVERFLOW_MUL_INT32. + + * src/truetype/ttinterp.c (Ins_ISECT): Use OVERFLOW_MUL_LONG, + OVERFLOW_ADD_LONG, and OVERFLOW_SUB_LONG. + +2017-06-03 Werner Lemberg + + [base, cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2060 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2062 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2063 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2068 + + * src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Use + OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG. + + * src/cff/cf2blues.c (cf2_blues_capture), src/cff/cf2hints.c + (cf2_hintmap_adjustHints): Use OVERFLOW_SUB_INT32. + + * src/truetype/ttgload.c (compute_glyph_metrics): User + OVERFLOW_SUB_LONG. + + * src/truetype/ttinterp.c (Direct_Move, Direct_Move_Orig, + Direct_Move_X, Direct_Move_Y, Direct_Move_Orig_X, + Direct_Move_Orig_Y, Move_Zp2_Point, Ins_MSIRP): Use + OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG. + +2017-06-03 Werner Lemberg + + * builds/unix/freetype-config.in: Fix pkg-config test (#51162). + + Patch directly taken from bug report. + +2017-06-03 Werner Lemberg + + [bdf] Synchronize sanity checks with pcf driver. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2054 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2058 + + * src/bdf/bdfdrivr.c (BDF_Face_Init): Check font ascent and descent. + Check AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE, RESOLUTION_X, and + RESOLUTION_Y properties. + +2017-06-03 Werner Lemberg + + [cff, truetype] Integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2047 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2057 + + * src/cff/cf2hints.c (cf2_hintmap_map): Use OVERFLOW_SUB_INT32. + + * src/truetype/ttinterp.c (Ins_ADD): Use OVERFLOW_ADD_LONG. + (Ins_SUB): Use OVERFLOW_SUB_LONG. + (Ins_NEG): Use NEG_LONG. + +2017-06-03 Werner Lemberg + + ftcalc.h: Avoid left-shift of negative numbers. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2055 + + * include/freetype/internal/ftcalc.h (INT_TO_F26DOT6, + INT_TO_F2DOT14, INT_TO_FIXED, F2DOT14_TO_FIXED): Use multiplication. + +2017-06-02 Werner Lemberg + + [cff] Even more integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2046 + + * src/cff/cf2intrp.c (cf2_doStems, cf2_interpT2CharString): Use + OVERFLOW_ADD_INT32. + +2017-06-02 Werner Lemberg + + [cff] More integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2032 + + * src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32. + +2017-06-02 Werner Lemberg + + [bdf] Don't left-shift negative numbers. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2031 + + * src/bdf/bdfdrivr.c (BDF_Face_Init): Use multiplication. + +2017-06-02 Werner Lemberg + + [bdf] Fix integer scanning routines. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2029 + + * src/bdf/bdflib.c (_bdf_atoul, _bdf_atol, _bdf_atous, _bdf_atos): + Stop scanning if result would overflow. + +2017-06-02 Werner Lemberg + + [cff] Fix integer overflows. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2027 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2028 + + * src/cff/cf2hints.c (cf2_hintmap_insertHint), src/cff/cf2intrp.c + (cf2_doFlex): Use OVERFLOW_ADD_INT32 and OVERFLOW_SUB_INT32. + +2017-06-01 Werner Lemberg + + [smooth] Some 32bit integer overflow run-time errors. + + * src/smooth/ftgrays.c [STANDALONE] (OVERFLOW_ADD_LONG, + OVERFLOW_SUB_LONG, OVERFLOW_MUL_LONG, NEG_LONG): New macros. + [!STANDALONE]: Include FT_INTERNAL_CALC_H. + (gray_render_cubic): Use those macros where appropriate. + +2017-06-01 Werner Lemberg + + * src/base/ftglyph.c (FT_Get_Glyph): Check `slot->advance'. + +2017-06-01 Werner Lemberg + + [psaux] 32bit integer overflow tun-time errors (#46149). + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Use + OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG where appropriate. + +2017-06-01 Werner Lemberg + + * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter again. + + Problem reported by Marek Kašík . + + The problematic font that exceeds the old limit is Padauk-Bold, + version 3.002, containing bytecode generated by a buggy version of + ttfautohint. + +2017-05-31 Werner Lemberg + + [cff] 32bit integer overflow run-time errors 2/2 (#46149). + + This commit handles the new engine. + + * include/freetype/internal/ftcalc.h (OVERFLOW_ADD_INT32, + OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, NEG_INT, NEG_LONG, + NEG_INT32): New macros. + + * src/cff/cf2ft.c (cf2_getScaleAndHintFlag): Use OVERFLOW_ADD_INT32. + + * src/cff/cf2hints.c (cf2_getWindingMomentum, cf2_hint_init, + cf2_hintmap_map, cf2_glyphpath_hintPoint, + cf2_glyphpath_computeIntersection, cf2_glyphpath_computeOffset, + cf2_glyphpath_lineTo, cf2_glyphpath_curveTo): Use + OVERFLOW_ADD_INT32, OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, and + NEG_INT32 where appropriate. + + * src/cff/cf2intrp.c (cf2_doFlex, cf2_doBlend, + cf2_interpT2CharString): Ditto. + Also add some other code where needed to avoid overflow. + +2017-05-30 Werner Lemberg + + [cff] 32bit integer overflow run-time errors 1/2 (#46149). + + This commit handles the old engine. + + * src/cff/cffgload.c: Include FT_INTERNAL_CALC_H. + (cff_decoder_parse_charstrings): Use OVERFLOW_ADD_LONG and + OVERFLOW_SUB_LONG where needed. + + * src/cff/cffparse.c: Include FT_INTERNAL_CALC_H. + (power_ten_limits): New static array. + (do_fixed): Use it to prevent multiplication overflow. + (cff_parser_run): Use OVERFLOW_ADD_LONG. + +2017-05-30 Werner Lemberg + + [psaux] Correctly handle sequences of multiple number signs. + + * src/psaux/psconv.c (PS_Conv_Strtol, PS_Conv_ToFixed): Return zero + if we encounter more than a single sign. + +2017-05-29 Werner Lemberg + + [pcf] 32bit integer overflow run-time errors (#46149). + + * src/pcf/pcfread.c (pcf_get_accel): Add sanity checks for + `fontAscent' and `fontDescent'. + (pcf_load_font): Add sanity checks for global height. + Add sanity checks for AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE, + RESOLUTION_X, and RESOLUTION_Y properties. + +2017-05-29 Werner Lemberg + + Handle some integer overflow run-time errors (#46149, #48979). + + This commit (mainly for 32bit CPUs) is the first of a series of + similar commits to handle known integer overflows. Basically, all + of them are harmless, since they affect rendering of glyphs only, + not posing security threats. It is expected that fuzzying will show + up more overflows, to be fixed in due course. + + The idea is to mark places where overflows can occur, using macros + that simply cast to unsigned integers, because overflow arithmetic + is well defined in this case. Doing so suppresses run-time errors + of sanitizers without adding computational overhead. + + * include/freetype/internal/ftcalc.h (OVERFLOW_ADD_INT, + OVERFLOW_SUB_INT, OVERFLOW_MUL_INT, OVERFLOW_ADD_LONG, + OVERFLOW_SUB_LONG, OVERFLOW_MUL_LONG): New macros. + + * src/base/ftcalc.c (FT_RoundFix, FT_CeilFix, FT_Matrix_Multiply, + FT_Matrix_Multiply_Scaled, FT_Vector_Transform_Scaled, + ft_corner_orientation): Use new macros. + + * src/base/ftoutln.c (FT_Outline_Get_Orientation): Use new macros. + +2017-05-28 Werner Lemberg + + * include/freetype/internal/ftcalc.h (FLOAT_TO_FIXED): Remove. + + This macro is not used. + +2017-05-28 Werner Lemberg + + [cff] s/cf2_floatToFixed/cf2_doubleToFixed/. + + The new name better describes what the macro actually does; + additionally, we don't need a trailing `f' for literals (there was + only a single such instance in the code, but this caused a clang + warning because the macro itself uses `double' literals). + + * src/cff/cf2blues.c, src/cff/cf2blues.h, src/cff/cf2fixed.h, + src/cff/cf2font.c, src/cff/cf2hints.c: Updated. + +2017-05-28 Werner Lemberg + + Fix negation of INT_MIN and LONG_MIN (#46149). + + * src/base/ftcalc.c (FT_MOVE_SIGN): Add argument to pass unsigned + value, to be used as the result. + (FT_MulDiv, FT_MulDiv_No_Round, FT_DivFix, FT_MulFix, + FT_Vector_NormLen): Updated. + +2017-05-27 Werner Lemberg + + [truetype] Fix handling of design coordinates (#51127). + + * src/truetype/ttgxvar.c (tt_set_mm_blend): Compute all design + coordinates if we have to create the `blends->coord' array. + (TT_Get_MM_Blend, TT_Get_Var_Design): Select default instance + coordinates if no instance is selected yet. + +2017-05-24 Werner Lemberg + + [bdf, pcf] Support ISO646.1991-IRV character encoding (aka ASCII). + + Problem reported by Marek Kašík , cf. + + https://bugzilla.redhat.com/show_bug.cgi?id=1451795 + + * src/bdf/bdfdrivr.c (BDF_Face_Init), src/pcf/pcfdrivr.c + (PCF_Face_Init): Implement it. + +2017-05-20 Nikolaus Waxweiler + + [truetype] Always use interpreter v35 for B/W rendering (#51051). + + * src/truetype/ttgload.c (tt_loader_init) + [TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL]: Adjust + `subpixel_hinting_lean', `grayscale_cleartype', and + `vertical_lcd_lean' accordingly. + + * src/truetype/ttinterp.c (Ins_GETINFO): Updated. + (TT_RunIns): Update `backward_compatibility' flag. + +2017-05-20 Alexei Podtelezhnikov + + [smooth] Implement minimal dynamic padding for LCD filtering. + + Extra bitmap padding for LCD filtering depends on the filter. The + default 5-tap filter needs 2 extra subpixels. The light 3-tap filter + needs only 1 extra subpixel. This space could be already available + due to rounding. In order to optimize the padding, we now expand + CBox for the given filter weights before rounding. + + This change breaks current Skia (and Firefox). + + * include/freetype/internal/ftobjs.h (FT_LibraryRec) + [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Remove `lcd_extra' field. + + * src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights, + FT_Library_SetLcdFilter): Remove `lcd_extra' initializations. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Implement dymanic + LCD padding. + +2017-05-15 Werner Lemberg + + [sfnt] Return proper scaling values for SBIX bitmaps. + + Problem reported by Hin-Tak Leung . + + * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Implement it. + +2017-05-15 Werner Lemberg + + [truetype] Fix error handling for embedded bitmaps. + + Problem reported by Hin-Tak Leung . + + * src/truetype/ttgload.c (TT_Load_Glyph) + [TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: Handle error if font is not + scalable. + +2017-05-15 Alexei Podtelezhnikov + + [autofit] Make autohint warping NORMAL option. + + This moves warping option from LIGHT to NORMAL mode. This makes LIGHT + truly void of hinting in x-direction, with left side bearing never + changed and right side bearing only altered by advance rounding. + Therefore, LIGHT is now ready to return fractional advance. As a + NORMAL option, warping substitutes normal hinting. + + * src/autofit/afcjk.c (af_cjk_hints_apply): Updated. + * src/autofit/aflatin.c (af_latin_hints_apply): Updated. + * src/autofit/aflatin2.c (af_latin2_hints_apply): Updated. + + * src/autofit/afloader.c (af_loader_load_glyph): Handle warping + phantom points as normal. + +2017-05-14 Werner Lemberg + + Remove remnants of raster pool. + + * include/freetype/internal/ftobjs.h (FT_LibraryRec): Remove + `raster_pool' and `raster_pool_size' fields. + + * src/base/ftobjs.c (FT_New_Library), src/raster/ftrend1.c + (ft_raster1_init), src/smooth/ftsmooth.c (ft_smooth_init): Updated. + +2017-05-13 Werner Lemberg + + * Version 2.8 released. + ======================= + + + Tag sources with `VER-2-8'. + + * docs/VERSION.TXT: Add entry for version 2.8. + * docs/CHANGES: Updated. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.7.1/2.8/, s/271/28/. + + * include/freetype/freetype.h (FREETYPE_MINOR): Set to 8. + (FREETYPE_PATCH): Set to 0. + + * builds/unix/configure.raw (version_info): Set to 20:0:14. + * CMakeLists.txt (VERSION_MINOR): Set to 8. + (VERSION_PATCH): Set to 0. + +2017-05-12 Hin-Tak Leung + + Fix `FT_UINT_TO_POINTER' macro for Windows. + + * builds/unix/ftconfig.in, builds/vms/ftconfig.h, + include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER) [_WIN64]: + Fix definition. + +2017-05-11 Sascha Brawer + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + + [truetype] Add tricky font `DFGirl-W6-WIN-BF' (from Dynalab). + + Reported by Roy Tam . + + * src/truetype/ttobjs.c (tt_check_trickyness_family): Implement it. + +2017-05-07 Roy Tam + Werner Lemberg + + [truetype] More tricky fonts (mainly from Dynalab). + + * src/truetype/ttobjs.c (tt_check_trickyness_family, + tt_check_trickyness_sfnt_ids): Add them. + +2017-05-07 Werner Lemberg + + [truetype] Add tricky font `DLCHayMedium' (from Dynalab). + + Reported by Roy Tam . + + * src/truetype/ttobjs.c (tt_check_trickyness_family): Implement it. + +2017-05-03 Werner Lemberg + + */*: s/backwards compatibility/backward compatibility/. + +2017-05-03 Sascha Brawer + Werner Lemberg + Werner Lemberg + + [autofit] Add blue-zone support for Sundanese script. + + This essentially moves the Sundanese script from the `Indic' hinter + to the `Latin' hinter. + + * src/autofit/afblue.dat: Add blue zone data for Sundanese. + + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/afscript.h: Add Sundanese standard character and move + data out of AF_CONFIG_OPTION_INDIC block. + + * src/autofit/afranges.c: Move Sundanese data out of + AF_CONFIG_OPTION_INDIC block. + + * src/autofit/afstyles.h: Update Sundanese data; in particular, use + AF_WRITING_SYSTEM_LATIN. + +2017-05-03 Sascha Brawer + Werner Lemberg + + [truetype] Make `IUP' gvar deltas do the same as Apple (#50832). + + When points are not touched by gvar interpolation deltas, FreeType + gave a slightly different result than Apple's CoreText. + + The OpenType working group will update the specification to document + the following behaviour: If the two points with deltas to the `left' + and `right' of the untouched point have the same coordinate, then + the inferred delta for the untouched point should be zero. + + * src/truetype/ttgxvar.c (tt_delta_interpolate): Implement new + behaviour. + +2017-05-02 Werner Lemberg + + [autofit] Remove `slight' auto-hint mode again. + + A poll on freetype-devel favoured changes directly applied to + `light'. + + * include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT, + FT_RENDER_MODE_SLIGHT): Removed. + + * src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c + (af_latin_hints_init), src/autofit/aflatin2.c + (af_latin2_hints_init): Revert change from 2017-04-22. + + * src/autofit/afloader.c (af_loader_load_glyph) Remove references to + FT_RENDER_MODE_SLIGHT. + [AF_CONFIG_OPTION_TT_SIZE_METRICS]: Enable TrueType-like metrics + unconditionally. + + * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Revert change from + 2017-04-22. + + * src/base/ftobjs.c (FT_Load_Glyph): Revert change from 2017-04-22. + + * src/pshinter/pshalgo.c (ps_hints_apply): Revert change from + 2017-04-22. + + * src/smooth/ftsmooth.c (ft_smooth_render): Revert change from + 2017-04-22. + + * docs/CHANGES: Updated. + +2017-04-30 Werner Lemberg + + [autofit] Fix metrics computation. + + Problem reported by Markus Trippelsdorf and + Nikolaus Waxweiler . + + * src/base/ftobjs.c (FT_Request_Size): Trigger recomputation of + auto-hinter metrics. Without this change, multiple size changing + calls for a single face fail. + +2017-04-29 Werner Lemberg + + * src/truetype/ttdriver.c (tt_size_request): Properly check `error'. + + Reported by Earnestly in + + https://lists.nongnu.org/archive/html/freetype/2017-04/msg00031.html + +2017-04-27 Werner Lemberg + + Introduce AF_CONFIG_OPTION_TT_SIZE_METRICS configuration option. + + * include/freetype/config/ftoption.h + (AF_CONFIG_OPTION_TT_SIZE_METRICS): New option, commented out by + default. + + * src/autofit/afloader.c (af_loader_load_glyph): Use + AF_CONFIG_OPTION_TT_SIZE_METRICS to guard the corresponding code. + +2017-04-26 Werner Lemberg + + * include/freetype/freetype.h (FT_Render_Mode): Fix order. + + This retains backward compatibility. + + Noted by Alexei. + +2017-04-22 Werner Lemberg + + [truetype] Do linear scaling for FT_LOAD_NO_HINTING (#50470). + + * src/truetype/ttobjs.h (TT_SizeRec): Add field `hinted_metrics' to + hold hinted metrics. + Make `metrics' a pointer so that `tt_glyph_load' can easily switch + between metrics. + + * src/truetype/ttdriver.c (tt_size_request): Updated. + (tt_glyph_load): Use top-level metrics if FT_LOAD_NO_HINTING is + used. + + * src/truetype/ttgload.c (TT_Hint_Glyph, TT_Process_Simple_Glyph, + TT_Process_Composite_Component, load_truetype_glyph, + compute_glyph_metrics, TT_Load_Glyph): Updated. + + * src/truetype/ttinterp.c (TT_Load_Context): Updated. + + * src/truetype/ttobjs.c (tt_size_reset): Updated. + + * src/truetype/ttsubpix.c (sph_set_tweaks): Updated. + +2017-04-22 Werner Lemberg + + Add new `slight' auto-hinting mode. + + This mode uses fractional advance widths and doesn't scale glyphs + horizontally, only applying vertical scaling and hinting. + + At the same time, the behaviour of the `light' auto-hinter gets + restored for backward compatibility: Both vertical and horizontal + scaling is again based on rounded metrics values (this was changed + in a commit from 2017-03-30 as a side effect). To be more precise, + the behaviour is restored for TrueType fonts only; for other font + formats like Type 1, this is a new feature of the `light' hinting + mode. + + * include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT): New macro. + (FT_RENDER_MODE_SLIGHT): New render mode. + + * include/freetype/internal/ftobjs.h (FT_Size_InternalRec): Add + `autohint_mode' and `autohint_metrics' fields. + + * src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c + (af_latin_hints_init), src/autofit/aflatin2 (af_latin2_hints_init): + Updated. + + * src/autofit/afloader.c (af_loader_embolden_glyph_in_slot): Use + `autohint_metrics'. + (af_loader_load_glyph): s/internal/slot_internal/. + Initialize `autohint_metrics' and `autohint_mode' depending on + current auto-hint mode. + Use `autohint_metrics'. + Updated. + + * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Updated. + + * src/base/ftobjs.c (FT_Load_Glyph): Updated. + (FT_New_Size): Allocate `internal' object. + + * src/pshinter/pshalgo.c (ps_hints_apply): Updated. + + * src/smooth/ftsmooth.c (ft_smooth_render): Updated. + +2017-04-22 Werner Lemberg + + Introduce `FT_Size_InternalRec' structure. + + We are going to extend this later on. + + * include/freetype/internal/ftobjs.h (FT_Size_InternalRec): New + structure with a single field `module_data'. + + * src/base/ftobjs.c (FT_New_Size): Allocate `internal' field of + `FT_Size' structure. + + * src/cff/cffgload.c (cff_builder_init, cff_decoder_prepare): Use + `size->internal->module_data' instead of `size->internal'. + + * src/cff/cffobjs.c (cff_size_done): Deallocate `module_data'. + (cff_size_init, cff_size_select, cff_size_request): Use + `size->internal->module_data' instead of `size->internal'. + + * src/cif/cidobjs.c (cid_size_done, cid_size_init, + cid_size_request): Use `size->internal->module_data' instead of + `size->internal'. + + * src/psaux/psobjs.c (t1_builder_ini): Use + `size->internal->module_data' instead of `size->internal'. + + * src/type1/t1objs.c (T1_Size_Done, T1_Size_Init, T1_Size_Request): + Use `size->internal->module_data' instead of `size->internal'. + +2017-04-21 Alexei Podtelezhnikov + + * src/smooth/ftsmooth.h: Remove unused guards and declaration. + +2017-04-16 Hin-Tak Leung + + Fix tracing messages. + + * src/base/ftobjs.c (FT_Face_GetCharVariantIndex, + FT_Face_GetCharVariantIsDefault, FT_Face_GetVariantsOfChar): Print + correct function name. + +2017-04-08 Sascha Brawer + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + + [autofit] Fix invalid character range description (#50745). + + Also reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1034 + + * src/autofit/afranges.c (af_glag_nonbase_uniranges): Fix typo in + recent commit. + +2017-04-07 Werner Lemberg + + [ftfuzzer] Fix clang warnings. + + * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Add + casts. + +2017-04-06 Sascha Brawer + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + + [autofit] Add support for Adlam script. + + * src/autofit/afblue.dat: Add blue zone data for Adlam. + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/afscript.h: Add Adlam standard characters. + + * src/autofit/afranges.c, src/autofit/afstyles.h: Add Adlam data. + +2017-04-06 Sascha Brawer + + [autofit] Add support for Ol Chiki script. + + * src/autofit/afblue.dat: Add blue zone data for Ol Chiki. + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/afscript.h: Add Ol Chiki standard character. + + * src/autofit/afranges.c, src/autofit/afstyles.h: Add Ol Chiki data. + +2017-04-03 Werner Lemberg + + [truetype] Avoid reexecution of `fpgm' and `prep' in case of error. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=981 + + * include/freetype/fterrdef.h (FT_Err_DEF_In_Glyf_Bytecode): New + error code. + + * src/truetype/ttinterp.c (Ins_FDEF, Ins_IDEF): Prohibit execution + of these two opcodes in `glyf' bytecode. + (TT_RunIns): Don't enforce reexecution of `fpgm' and `prep' bytecode + in case of error since function tables can no longer be modified + (due to the changes in `Ins_FDEF' and `Ins_IDEF'). This change can + enormously speed up handling of broken fonts. + +2017-04-02 Alexei Podtelezhnikov + + [autofit] Disable metrics adjustment for `FT_LOAD_TARGET_LCD'. + + * src/autofit/aflatin.c (af_latin_hints_init): Updated. + * src/autofit/aflatin2.c (af_latin2_hints_init): Ditto. + +2017-04-01 Werner Lemberg + + * src/truetype/ttgload.c: Include FT_CONFIG_CONFIG_H. + + Otherwise FT_UINT_TO_POINTER might not be defined. + + Problem reported by Alexei. + +2017-03-31 Alexei Podtelezhnikov + + [autofit] Disable stem adjustment for `FT_LOAD_TARGET_LCD'. + + * include/freetype/freetype.h (FT_LOAD_TARGET_LCD): Document it. + * src/autofit/afcjk.c (af_cjk_hints_init): Updated. + * src/autofit/aflatin.c (af_latin_hints_init): Ditto. + * src/autofit/aflatin2.c (af_latin2_hints_init): Ditto. + +2017-03-31 Werner Lemberg + + * src/cff/cffload.c (cff_font_load): Improve fix from 2017-01-04. + + Allow CFFs containing a single font to have an empty font name. + + Problem reported by 張俊芝 <418092625@qq.com> in + + https://lists.nongnu.org/archive/html/freetype-devel/2017-03/msg00074.html + +2017-03-30 Werner Lemberg + + * src/cff/cffparse.h (CFF2_DEFAULT_STACK): Set to 513 also. + + Requested by Dave Arnold. + +2017-03-30 Werner Lemberg + + [truetype] Fix HVAR and VVAR handling (#50678). + + * src/truetype/ttgxvar.c (tt_hvadvance_adjust): Handle + glyph indices larger than `mapCount' as described in the + specification. + +2017-03-30 Werner Lemberg + + [truetype] Allow linear scaling for unhinted rendering (#50470). + + * src/truetype/ttdriver.c (tt_size_request): Revert change from + 2011-07-16; the intended metrics fix seems now to be implemented in + a different way, making the patch unnecessary. Note that this + change was usually patched out by all major GNU/Linux distributions + due to heavy side effects. + + * src/truetype/ttgload.c (compute_glyph_metrics, TT_Load_Glyph): + Refer to the metrics of the `TT_Size' object. + +2017-03-29 Werner Lemberg + + [truetype] Fix thinko related to PS name of default named instance. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): `strid' and `psid' are + name ID values, not indices into the array of name entries. + +2017-03-27 Werner Lemberg + + [cid, truetype] Don't use `index' as a variable name. + + At least on FreeBSD there is a global declaration of `index' in file + `/usr/include/strings.h'. + + * src/cff/cf2intrp.c, src/truetype/ttgload.c: s/index/idx/ where + appropriate. + +2017-03-27 Wojciech Mamrak + + [sfnt] Minor improvement for handling kern tables. + + * src/sfnt/ttkern.c (tt_face_load_kern): Don't check for + cross-stream kerning tables since we reject format 2 tables later + on anyways. + Modify code for limit test... + (tt_face_get_kerning): ... to avoid a limit test here. + +2017-03-27 Werner Lemberg + + [pcf] Fix compiler warnings. + + Reported by Alexander Hedges . + + * src/pcf/pcfdrivr.c (pcf_property_set, pcf_property_get): Tag + `property_name' with `FT_UNUSED' where necessary. + +2017-03-26 Werner Lemberg + + * src/psaux/psobjs.c (t1_builder_close_contour): Add safety guard. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=941 + +2017-03-23 Werner Lemberg + + [psaux] Better protect `flex' handling. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=935 + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings) + : Since there is not a single flex operator but a + series of subroutine calls, malformed fonts can call arbitrary other + operators after the start of a flex, possibly adding points. For + this reason we have to check the available number of points before + inserting a point. + +2017-03-23 Werner Lemberg + + [sfnt] Fix check for default named instance. + + * src/sfnt/sfobjs.c (sfnt_init_face): A `fixed' number needs four + bytes, not two... + +2017-03-23 Werner Lemberg + + Make MM fonts work (again). + + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, + FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Ignore + return value of `ft_face_get_mvar_service'; instead, check whether a + service is actually returned. + +2017-03-20 Werner Lemberg + + [truetype] Some variable renamings. + + Too much local variables holding different structures were called + `metrics'. + + * src/truetype/ttdriver.c (tt_size_select): s/metrics/size_metrics/. + + * src/truetype/ttgload.c (tt_get_metrics_incr_overrides, + compute_glyph_metrics): s/metrics/incr_metrics/. + (load_sbit_image): s/metrics/sbit_metrics/. + + * src/truetype/ttobjs.c (tt_size_run_fpgm): s/metrics/size_metrics/. + (tt_size_init_bytecode): s/metrics/tt_metrics/. + (tt_size_reset): s/metrics/size_metrics/. + +2017-03-20 Werner Lemberg + + [sfnt] Don't add instances to non-variation fonts. + + * src/sfnt/sfobjs.c (sfnt_init_face): Fix it. + +2017-03-20 Werner Lemberg + + * src/cff/cffgload.c (cff_builder_init): Add safety guard (#50578). + +2017-03-18 Werner Lemberg + + Introduce FT_UINT_TO_POINTER macro (#50560). + + We have to make a separate case for Windows 64's LLP64 data model. + + * builds/unix/ftconfig.in, builds/vms/ftconfig.h, + include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER): New macro. + + * src/truetype/ttgload.c (load_truetype_glyph): Use it. + +2017-03-18 Werner Lemberg + + * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter (#50573). + + The problematic font that exceeds the old limit is Lato-Regular, + version 2.007, containing bytecode generated by a buggy version of + ttfautohint. + +2017-03-18 Werner Lemberg + + [truetype] Another limitation for bytecode loop count maximum. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=900 + + * src/truetype/ttinterp.c (TT_RunIns): Limit `loopcall_counter_max' + by number of glyphs also. + +2017-03-18 Werner Lemberg + + [ftfuzzer] Minor improvement. + + * src/tools/ftfuzzer/ftfuzzer.cc: Don't set intermediate axis if + bitmap strikes are active. + +2017-03-18 Werner Lemberg + + Improve `make multi'. + + * src/autofit/aflatin2.c: Guard file with FT_OPTION_AUTOFIT2. + + * src/base/ftmac.c: Guard more parts of the file with FT_MACINTOSH. + + * src/psaux/afmparse.c: Guard file with T1_CONFIG_OPTION_NO_AFM. + + * src/sfnt/pngshim.c: Guard file with + TT_CONFIG_OPTION_EMBEDDED_BITMAPS also. + + * src/sfnt/ttbdf.c: Avoid empty source file. + * src/sfnt/ttpost.c: Guard file with + TT_CONFIG_OPTION_POSTSCRIPT_NAMES. + * src/sfnt/ttsbit.c: Guard file with + TT_CONFIG_OPTION_EMBEDDED_BITMAPS. + + * src/truetype/ttgxvar.c, src/truetype/ttinterp.c: Avoid empty + source file. + + * src/truetype/ttsubpix.c: Guard file with + TT_USE_BYTECODE_INTERPRETER also. + + * src/type1/t1afm.c: Guard file with T1_CONFIG_OPTION_NO_AFM. + + * src/autofit/autofit.c, src/base/ftbase.c, src/cache/ftcache.c, + src/cff/cff.c, src/cid/type1cid.c, src/gxvalid/gxvalid.c, + src/pcf/pcf.c, src/pfr/pfr.c, src/psaux/psaux.c, + src/pshinter/pshinter.c, src/psnames/psnames.c, src/raster/raster.c, + src/sfnt/sfnt.c, src/smooth/smooth.c, src/truetype/truetype.c, + src/type1/type1.c, src/type42/type42.c: Remove conditionals; sort + entries. + +2017-03-17 Werner Lemberg + + Fixes for conditional compilation. + + * src/autofit/afcjk.c, src/autofit/afindic.c: Include `afcjk.h' + earlier. + + * src/sfnt/sfobjs.c (sfnt_init_face): Put `memory' variable into + TT_CONFIG_OPTION_GX_VAR_SUPPORT block. + (sfnt_done_face): Protect some code with + TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Remove compiler + warning. + + * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Put `tmp' variable + into TT_USE_BYTECODE_INTERPRETER block. + + (tt_loader_init): Put `error' variable into + TT_USE_BYTECODE_INTERPRETER block. + +2017-03-17 Werner Lemberg + + Fix preprocessor warning. + + * devel/ftoption.h, include/freetype/config/ftoption.h: Test whether + TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined before checking its + value. + +2017-03-17 Werner Lemberg + + `make multi' fixes; compiler warnings. + + * src/base/ftsnames.c: Include FT_INTERNAL_DEBUG_H. + + * src/cff/cffobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include + FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. + + * src/sfnt/sfdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include + FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. + (get_win_string, get_apple_string): Initialize `result'. + +2017-03-17 Dave Arnold + + [cff] Fix potential bugs in default NDV for CFF2. + + * src/cff/cffload.c (cff_blend_build_vector): Explicitly build blend + vector when `lenNDV' is zero; don't rely on zero-init. + Save `lenNDV' as part of cache key even when `lenNDV' is zero. + +2017-03-17 Dave Arnold + + [cff] Fix CFF2 stack allocation. + + * src/cff/cffparse.c (cff_parser_init) add 1 for operator. + +2017-03-16 Werner Lemberg + + * src/truetype/ttgxvar.c (tt_done_blend): Free `vvar_table'. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=883 + +2017-03-15 Werner Lemberg + + Remove clang compiler warnings (#50548). + + * include/freetype/internal/tttypes.h (TT_FaceRec): Make + `var_postscript_prefix_len' unsigned. + + * src/autofit/afwarp.c (af_warper_compute_line_best): Remove + redundant assignment. + + * src/cff/cffload.c (cff_subfont_load): Add casts. + + * src/cff/cffparse.c (cff_parse_blend): Remove redundant assignment. + + * src/sfnt/sfdriver.c (fmix32, murmur_hash_3_128): Add `static' + keyword. + Add casts. + (fixed2float): Add cast. + (sfnt_get_var_ps_name): Make `p' always initialized. + Add casts. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Add casts. + +2017-03-15 Werner Lemberg + + [ftfuzzer] Limit number of tested faces and instances. + + This is inspired by the discussion in and analysis of + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=859 + + * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Use only + up to 20 face indices. + Use only up to 20 instance indices. + +2017-03-15 Werner Lemberg + + * src/tools/ftfuzzer/ftfuzzer.cc: Improve readability; formatting. + +2017-03-14 Werner Lemberg + + [sfnt] Implement PS names for font instances [3/3]. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * include/freetype/internal/tttypes.h (TT_FaceRec): New fields + `var_postscript_prefix' and `var_postscript_prefix_len'. + + * src/sfnt/sfdriver.c: Include FT_TRUETYPE_IDS_H. + (sfnt_is_alphanumeric): New wrapperfunction for `ft_isalnum'. + (get_win_string, get_apple_string): Remove `const' from return + value. + (MAX_VALUE_DESCRIPTOR_LEN, MAX_PS_NAME_LEN): New macros. + (hexdigits): New array. + (sfnt_get_var_ps_name): New function, implementing Adobe TechNote + 5902 to construct a PS name for a variation font instance. + (sfnt_get_ps_name): Call `sfnt_get_var_ps_name' for font instances. + + * src/sfnt/sfobjs.c (sfnt_done_face): Updated. + + * src/truetype/ttgxvar.c (tt_set_mm_blend): Reset + `face->postscript_name' to trigger recalculation for new instance + parameters. + +2017-03-14 Werner Lemberg + + [sfnt] Implement PS names for font instances [2/3]. + + * src/sfnt/sfdriver.c (fix2float) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: + New function to find the shortest representation of a 16.16 + fractional number. + +2017-03-14 Werner Lemberg + + [sfnt] Implement PS names for font instances [1/3]. + + Add 128bit MurmurHash 3 function. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * src/sfnt/sfdriver.c (ROTL32): New macro. + (fmix32, murmur_hash_3_128): New functions. + +2017-03-13 Werner Lemberg + + [truetype] Ignore invalid MVAR tags. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=838 + + * src/truetype/ttgxvar.c (ft_var_load_mvar): Ignore value and emit + warning for invalid tags. + (tt_apply_mvar): Ignore invalid tags. + +2017-03-12 Werner Lemberg + + [truetype] Store and use design coordinates also. + + * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): + Add `normalizedcoords' argument. + + * src/truetype/ttgxvar.h (GX_BlendRec): Add `coords' field to store + the design coordinates of the current instance. + Updated. + + * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Move functionality to... + (tt_set_mm_blend): ... New function. + Convert data in `normalizedcoords' array to `coords' array on + demand. + (TT_Set_Var_Design): Store argument data in `coords' array. + (TT_Get_Var_Design): Get data from `coords' array. + (tt_get_var_blend): Updated. + (tt_done_blend): Updated. + + * src/cff/cffload.c, src/cff/cffload.h (cff_get_var_blend): Updated. + + * src/cff/cf2ft.c (cf2_getNormalizedVector): Updated. + + * src/cff/cffobjs.c (cff_face_init): Updated. + +2017-03-12 Werner Lemberg + + src/truetype/ttgxvar.[ch]: s/avar_checked/avar_loaded/. + +2017-03-08 Werner Lemberg + + [sfnt] Another fix for buggy variation fonts. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=759 + + * src/sfnt/sfobjs.c (sfnt_init_face): While setting number of + instances to zero for `CFF' fonts table, ensure that there is no + `CFF2' present also (which gets priority). + +2017-03-07 Werner Lemberg + + [sfnt] Improve handling for buggy variation fonts. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=738 + + * src/sfnt/sfobjs.c (sfnt_init_face): While setting number of + instances to zero for `CFF' fonts table, ensure that there is no + `glyf' table present also (which gets priority). + +2017-03-06 Werner Lemberg + + [sfnt, truetype] Always provide default instance. + + As documented in the OpenType specification, an entry for the + default instance may be omitted in the named instance table. In + particular this means that even if there is no named instance table + in the font we actually do have a named instance, namely the default + instance. + + For consistency, we always want the default instance in our list of + named instances. If it is missing, we try to synthesize it. + + * src/sfnt/sfobjs.c (sfnt_init_face): Check whether the default + instance is in the table of named instances. Otherwise adjust + number of instances. + + * src/truetype/ttgxvar.c: Include FT_TRUETYPE_IDS_H. + (TT_Get_MM_Var): Use `face->root.style_flags' as the number of named + instances. + Sythesize a named instance entry if necessary. + (tt_done_blend): Free `normalized_stylecoords'. + +2017-03-05 Werner Lemberg + + [sfnt] Remove redundant code. + + * src/sfnt/sfobjs.c (sfnt_init_face): Remove second test for + `num_instances', which will always succeed. + +2017-03-04 Werner Lemberg + + [sfnt] Add `get_name_id' service. + + * include/freetype/internal/sfnt.h (TT_Get_Name_ID_Func): New + typedef. + (SFNT_Interface): Add `get_name_id' field. + (FT_DEFINE_SFNT_INTERFACE): Updated. + + * src/sfnt/sfdriver.c (search_name_id): Rename to... + (sfnt_get_name_id): ... this. + (sfnt_get_ps_name, sfnt_interface): Updated. + +2017-03-04 Werner Lemberg + + [truetype] Make `TT_Set_MM_Blend' set named instance index. + + * src/truetype/ttgxvar.h (GX_Blend): New array + `normalized_stylecoords'. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Allocate and fill + `normalized_stylecoords'. + (TT_Set_MM_Blend): Check instance tuple and adjust `face_index' + accordingly. + +2017-03-02 Werner Lemberg + + [truetype] Split off designer/normalized conversion routines. + + * src/truetype/ttgxvar.c (TT_Set_Var_Design): Split off conversion + code designer->normalized coordinates to... + (ft_var_to_normalized): ... New function. + (TT_Get_Var_Design): Split off conversion code normalized->designer + coordinates to... + (ft_var_to_design): ... New function. + +2017-02-28 Werner Lemberg + + [sfnt] Further generalize `sfnt_get_ps_name'; report invalid data. + + * src/sfnt/sfdriver.c (sfnt_ps_map): New array. + (sfnt_is_postscript): New function. + (char_type_func): New typedef. + (get_win_string, get_apple_string): Add argument to specify + character checking function. + Add argument whether argument checking failures should be reported. + Update callers. + (search_name_id): Fix return value. + +2017-02-23 Werner Lemberg + + [sfnt] Split off another bit of `sfnt_get_ps_name'. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name): Split off some + functionality into... + (search_name_id): ... New function. + +2017-02-23 Werner Lemberg + + [sfnt] Modularize `sfnt_get_ps_name'. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name): Split off some + functionality into... + (IS_WIN, IS_APPLE): ... New macros. + (get_win_string, get_apple_string): ... New functions. + +2017-02-23 Werner Lemberg + + [truetype] Minor improvement. + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph, + load_truetype_glyph): Remove unnecessary tests. + +2017-02-23 Werner Lemberg + + * include/freetype/internal/tttypes.h (TT_Face): s/isCFF2/is_cff2/. + + For orthogonality with other structure field names. + + Update all users. + +2017-02-22 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_hline): Improve code. + +2017-02-20 Dominik Röttsches + + Fix some `ttnameid.h' entries (#50313). + + * include/freetype/ttnameid.h: + s/TT_MS_LANGID_SPANISH_INTERNATIONAL_SORT/TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT/, + s/TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIA/TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN/. + +2017-02-20 Werner Lemberg + + [cff] Finish support for `random' operator. + + * src/cff/cfftypes.h (CFF_SubFontRec): Add `random' field. + + * src/cff/cffobjs.c: Updated. + (cff_driver_init): Initialize random seed value. + + * src/cff/cffload.c (cff_random): New function. + (cff_subfont_load): Add `face' argument. + Update all callers. + Initialize random number generator with a proper seed value. + (cff_font_load): Add `face' argument. + Update all callers. + + * src/cff/cffload.h: Updated. + + * src/cff/cf2intrp.c (CF2_FIXME): Removed. + (cf2_interpT2CharString) : Implement opcode. + + * src/cff/cffgload.c (cff_decoder_parse_charstrings): Don't + initialize random seed value. + : Use new random seed framework. + +2017-02-20 Werner Lemberg + + [cff] Sanitize `initialRandomSeed'. + + * src/cff/cffload.c (cff_load_private_dict): Make + `initial_random_seed' value always positive. + +2017-02-20 Werner Lemberg + + [cff] Introduce `random-seed' property (2/2). + + * src/base/ftobjs.c: Include `FT_CFF_DRIVER_H'. + (open_face): Initialize `face->internal->random_seed'. + (FT_Face_Properties): Handle `FT_PARAM_TAG_RANDOM_SEED'. + + * src/cff/cffdrivr.c (cff_property_set): Handle `random-seed' + property. + +2017-02-20 Werner Lemberg + + [cff] Introduce `random-seed' property (1/2). + + We need this for support of the `random' operator. + + * include/freetype/ftcffdrv.h (FT_PARAM_TAG_RANDOM_SEED): New macro. + + * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New + field `random_seed'. + + * src/cff/cffobjs.h (CFF_DriverRec): New field `random_seed'. + +2017-02-17 Werner Lemberg + + Remove clang warnings. + + * src/autofit/aflatin.c (af_latin_sort_blue): Add missing `static' + keyword. + + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, + FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): + Initialize some variables. + +2017-02-16 Nikolaus Waxweiler + Werner Lemberg + + Add face property for stem darkening. + + * include/freetype/ftautoh.h (FT_PARAM_TAG_STEM_DARKENING): New + macro. + + * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Add + `no_stem_darkening' field. + + * src/autofit/afloader.c (af_loader_load_glyph), + src/autofit/afmodule.c (af_property_set): Updated. + + * src/base/ftobjs.c: Include FT_AUTOHINTER_H. + (ft_open_face_internal): Updated. + (FT_Face_Properties): Handle FT_PARAM_TAG_STEM_DARKENING. + + * src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Updated. + + * src/cff/cffdrivr.c (cff_property_set): Updated. + +2017-02-16 Nikolaus Waxweiler + Werner Lemberg + + Add face property for LCD filter weights. + + * include/freetype/ftlcdfil.h (FT_PARAM_TAG_LCD_FILTER_WEIGHTS, + FT_LCD_FILTER_FIVE_TAPS): New macros. + (FT_LcdFiveTapFilter): New typedef. + + * include/freetype/ftobjs.h (FT_Face_InternalRec) + [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Add `lcd_weights' field. + (FT_Bitmap_LcdFilterFunc): Change third argument to weights array. + (ft_lcd_filter_fir): New prototype. + (FT_LibraryRec): Updated. + + * src/base/ftlcdfil.c (_ft_lcd_filter_fir): Renamed to... + (ft_lcd_filter_fir): ... this base function. + Updated. + (_ft_lcd_filter_legacy): Updated. + (FT_Library_SetLcdFilterWeights, FT_Library_SetLcdFilter): Updated. + + * src/base/ftobjs.c (ft_open_face_internal): Updated. + (FT_Face_Properties): Handle FT_PARAM_TAG_LCD_FILTER_WEIGHTS. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic) + [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Handle LCD weights from + `FT_Face_Internal'. + +2017-02-14 Nikolaus Waxweiler + Werner Lemberg + + Add new function `FT_Face_Properties'. + + This commit provides the framework, to be filled with something + useful in the next commits. + + * include/freetype/freetype.h (FT_Face_Properties): Declare. + + * src/base/ftobjs.c (FT_Face_Properties): New function. + +2017-02-13 Werner Lemberg + + [autofit] Prevent overlapping blue zones. + + Problem reported as + + https://github.com/google/fonts/issues/632 + + The font in question (Nunito) has values 705 and 713 for the + reference and overshoot values, respectively, of the first blue + zone. Blue zone 2, however, has value 710 for both the reference + and overshoot. At 12ppem, reference and overshoot of blue zone 0 + becomes 8px, while blue zone 2 becomes 9px. + + A peculiarity of this font is that the tops of isolated vertical + stems like `N' have a slight overshoot also. The auto-hinter tries + to find the nearest blue zone using the *original* coordinates. For + vertical stems, this is value 713. For normal horizontal tops like + in character `E', this is value 710. Since value 713 is mapped to + 8px but value 710 to 9px, `N' and similar characters are one pixel + higher than `E', which looks very bad. + + This commit sanitizes blue zones to avoid such a behaviour. + + * src/autofit/aflatin.c (af_latin_sort_blue): New function. + (af_latin_metrics_init_blues): Sort blue values and remove overlaps. + +2017-02-12 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_sweep): Improve code. + +2017-02-06 Werner Lemberg + + [truetype] Implement `VVAR' table support. + + * src/truetype/ttgxvar.h (GX_HVarTable): Renamed to... + (GX_HVVarTable): ...This. + (GX_Blend): Add fields for `VVAR' table handling. + Other minor updates. + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Renamed to... + (ft_var_load_hvvar): ...This. + Handle VVAR loading also (controlled by an additional parameter). + (tt_hadvance_adjust): Renamed to... + (tt_hvadvance_adjust): ...This. + Handle application of advance height also (controlled by an + additional parameter). + (tt_hadvance_adjust, tt_vadvance_adjust): Wrappers for + `tt_hvadvance_adjust'. + + * src/truetype/ttdriver.c (tt_service_metrics_variations): Updated. + +2017-02-05 Werner Lemberg + + [autofit] Use better blue zone characters for lowercase latin. + + The number of lowercase characters for computing the top flat blue + zone value was too small (in most cases only `x' and `z'). If one + of the two characters has a large serif, say, it can happen that + FreeType must select between two different values, having a 50% + chance to use the wrong one. As a result, rendering at larger PPEM + values could yield uneven lowercase glyph heights. + + Problem reported by Christoph Koeberlin . + + * src/autofit/afblue.dat (AF_BLUE_STRING_LATIN_SMALL): Replaced + with... + (AF_BLUE_STRING_LATIN_SMALL_TOP, AF_BLUE_STRING_LATIN_SMALL_BOTTOM): + ... New, extended sets. + (AF_BLUE_STRINGSET_LATN): Updated. + + * src/autofit/afblue.c, scr/autofit/afblue.h: Regenerated. + +2017-02-04 Werner Lemberg + + Make `freetype-config' a wrapper of `pkg-config' if possible. + + Based on ideas taken from + + http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/tree/freetype-multilib.patch + http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/tree/freetype-2.5.3-freetype-config-prefix.patch + + * builds/unix/freetype-config.in: Rewritten. Use `pkg-config' to + set output variables if program is available. + + * docs/CHANGES, docs/freetype-config.1: Updated. + +2017-02-04 Werner Lemberg + + * builds/unix/unix-def.in (freetype-config): Fix permissions. + +2017-02-03 Werner Lemberg + + * src/autofit/afglobal.c (af_face_globals_free): Erase useless code. + +2017-02-03 Werner Lemberg + + * include/freetype/ftgasp.h (FT_GASP_SYMMETRIC_GRIDFIT): Fix value. + + Reported by Behdad. + +2017-02-02 Werner Lemberg + + [truetype] Fix MVAR post-action handling. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=509 + + * src/truetype/ttobjs.c (tt_size_reset): Do nothing for CFF2. This + is important to make `tt_size_reset_iterator' (called in + `tt_apply_mvar') always work. + +2017-02-02 Werner Lemberg + + Make compilation with FT_CONFIG_OPTION_PIC work again. + + All code committed here is guarded with `FT_CONFIG_OPTION_PIC'. + + * include/freetype/internal/services/svmetric.h + (FT_DEFINE_SERVICE_METRICSVARIATIONSREC): Remove trailing semicolon. + + * src/autofit/aflatin.c (af_latin_hints_compute_edges, + af_latin_hint_edges): Provide `globals' variable. + + * src/autofit/afloader.c (af_loader_load_glyph): Remove shadowing + variable. + + * src/autofit/afmodule.c (AF_SCRIPT_CLASSES_GET, + AF_STYLE_CLASSES_GET): Redefine. + + * src/autofit/aftypes.h (AF_DEFINE_WRITING_SYSTEM_CLASS): Fix typo. + + * src/cff/cffparse.c (CFF_FIELD_BLEND): Provide it. + + * src/cff/cffpic.h (CffModulePIC): Fix typo. + +2017-01-31 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_render_scanline): Improve code. + +2017-01-31 Werner Lemberg + + [cff] Provide metrics variation service interface (#50196). + + Only now I've got an OTF with an HVAR table for testing... + + The code in `ftmm.c' uses `FT_FACE_LOOKUP_SERVICE' to get the + metrics variations interface. However, this didn't work with + `FT_FACE_FIND_GLOBAL_SERVICE' used in `sfnt_init_face'. + + * src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H. + (cff_hadvance_adjust, cff_metrics_adjust): Wrapper functions for + metric service functions from the `truetype' module. + (cff_service_metrics_variations): New service. + (cff_services): Updated. + + * src/cff/cffpic.h (CFF_SERVICE_METRICS_VAR_GET): New macro. + [FT_CONFIG_OPTION_PIC]: Synchronize code. + + * src/sfnt/sfobjs.c (sfnt_init_face): Replace call to + FT_FACE_FIND_GLOBAL_SERVICE with `ft_module_get_service' to always + load the service from the `truetype' module. + +2017-01-31 Werner Lemberg + + Add framework to support services with 9 functions. + + * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC9): + New macro. + +2017-01-31 Werner Lemberg + + [base] Fix error handing in MM functions. + + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, + FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): + Implement it. + +2017-01-31 Werner Lemberg + + [truetype] Fix sanity check for `gvar' table (#50184). + + * src/truetype/ttgxvar.c (ft_var_load_gvar): There might be missing + variation data for some glyphs. + +2017-01-31 Werner Lemberg + + [autofit] Avoid uninitialized jumps (#50191). + + * src/autofit/afcjk.c (af_cjk_metrics_check_digits), + src/autofit/aflatin.c (af_latin_metrics_check_digits): Initialize + `advance'. + +2017-01-27 Werner Lemberg + + s/GB2312/PRC/. + + * include/freetype/freetype.h (FT_ENCODING_PRC): New enum value. + (FT_ENCODING_GB2312): Deprecated. + + * include/freetype/ttnameid.h (TT_MS_ID_PRC): New macro. + (TT_MS_ID_GB2312): Deprecated. + + * src/sfnt/sfobjs.c (sfnt_find_encoding): Updated. + + * docs/CHANGES: Updated. + +2017-01-26 Werner Lemberg + + [base] Add `FT_Get_Sfnt_LangTag' function. + + * include/freetype/ftsnames.h (FT_SfntLangTag): New structure. + (FT_Get_Sfnt_LangTag): New declaration. + + * src/base/ftsnames.c (FT_Get_Sfnt_LangTag): New function. + + * docs/CHANGES: Updated. + +2017-01-26 Werner Lemberg + + [sfnt] Support `name' table format 1. + + * include/freetype/internal/tttypes.h (TT_LangTagRec): New + structure. + (TT_NameTableRec): Add fields `numLangTagRecords' and `langTags'. + + * src/sfnt/ttload.c (tt_face_load_name): Add support for language + tags. + Reduce array size of name strings in case of invalid entries. + (tt_face_free_name): Updated. + + * docs/CHANGES: Updated. + +2017-01-25 Werner Lemberg + + [sfnt] s/TT_NameEntry/TT_Name/. + + * include/freetype/internal/tttypes.h (TT_NameEntryRec): Renamed + to... + (TT_NameRec): This. + (TT_NameTableRec): Updated. + + * src/base/ftsnames.c (FT_Get_Sfnt_Name): Updated. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name): Updated. + + * src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16, + tt_name_entry_ascii_from_other): Renamed to... + (tt_name_ascii_from_utf16, tt_name_entry_ascii_from_other): This, + respectively. + (TT_NameEntry_ConvertFunc): Renamed to... + (TT_Name_ConvertFunc): This. + (tt_face_get_name): Updated. + + * src/sfnt/ttload.c (tt_face_load_name, tt_face_free_name): + Updated. + +2017-01-24 Werner Lemberg + + [sfnt] Fix Postscript name service for symbol fonts. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name): Accept PID/EID=3/0 + entries also. + +2017-01-24 Werner Lemberg + + [truetype] For OpenType 1.7: s/preferred/typographic/ (sub)family. + + * include/freetype/ftsnames.h + (FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY, + FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY): New macros. + (FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY, + FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY): Deprecated. + + * include/freetype/ttnameid.h (TT_NAME_ID_TYPOGRAPHIC_FAMILY, + TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY): New macros. + (TT_NAME_ID_PREFERRED_FAMILY, TT_NAME_ID_PREFERRED_SUBFAMILY): + Deprecated. + + * src/sfnt/sfobjs.c (sfnt_load_face): Updated. + + * docs/CHANGES: Updated. + +2017-01-23 Werner Lemberg + + [base] Add `FT_Set_Default_Properties' (#49187). + + * include/freetype/ftmodapi.h: Add declaration. + + * src/base/ftinit.c (ft_set_default_properties): Renamed to... + (FT_Set_Default_Properties): ... this. + (FT_Init_FreeType): Updated. + + * docs/CHANGES: Updated. + +2017-01-23 Werner Lemberg + + [truetype] Minor updates for OpenType 1.8.1. + + * src/truetype/ttgxvar.h (GX_MVarTable): `axisCount' has been + removed from the specification; it is now reserved. + + * src/truetype/ttgxvar.c (ft_var_load_mvar): Updated. + (GX_FVar_Head): Remove `countSizePairs'; the corresponding data + field in the `MVAR' table is now reserved. + (fvar_fields): Updated. + +2017-01-23 Werner Lemberg + + [truetype] Avoid segfault for invalid variation data. + + * src/truetype/ttgxvar.c (ft_var_load_item_variation_store): Assure + `itemCount' is not zero. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=441 + +2017-01-20 Werner Lemberg + + * src/truetype/ttinterp.c (TT_RunIns): Adjust loop detector limits. + +2017-01-17 Werner Lemberg + + * include/freetype/ttnameid.h: Updated to OpenType 1.8.1. + + (TT_APPLE_ID_FULL_UNICODE): New macro. + + (TT_MS_LANGID_BOSNIAN_BOSNIA_HERZ_CYRILLIC, + TT_MS_LANGID_UPPER_SORBIAN_GERMANY, + TT_MS_LANGID_LOWER_SORBIAN_GERMANY, TT_MS_LANGID_IRISH_IRELAND, + TT_MS_LANGID_INUKTITUT_CANADA_LATIN, TT_MS_LANGID_BASHKIR_RUSSIA, + TT_MS_LANGID_LUXEMBOURGISH_LUXEMBOURG, + TT_MS_LANGID_GREENLANDIC_GREENLAND, TT_MS_LANGID_MAPUDUNGUN_CHILE, + TT_MS_LANGID_MOHAWK_MOHAWK, TT_MS_LANGID_BRETON_FRANCE, + TT_MS_LANGID_OCCITAN_FRANCE, TT_MS_LANGID_CORSICAN_FRANCE, + TT_MS_LANGID_ALSATIAN_FRANCE, TT_MS_LANGID_YAKUT_RUSSIA, + TT_MS_LANGID_KICHE_GUATEMALA, TT_MS_LANGID_KINYARWANDA_RWANDA, + TT_MS_LANGID_WOLOF_SENEGAL, TT_MS_LANGID_DARI_AFGHANISTAN): New + macros. + + (TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC): Fix value. + + (TT_MS_LANGID_GERMAN_LIECHTENSTEIN, TT_MS_LANGID_CATALAN_CATALAN, + TT_MS_LANGID_CHINESE_MACAO, TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT, + TT_MS_LANGID_KOREAN_KOREA, TT_MS_LANGID_ROMANSH_SWITZERLAND, + TT_MS_LANGID_SLOVENIAN_SLOVENIA, TT_MS_LANGID_BASQUE_BASQUE, + TT_MS_LANGID_SETSWANA_SOUTH_AFRICA, + TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA, + TT_MS_LANGID_ISIZULU_SOUTH_AFRICA, TT_MS_LANGID_KAZAKH_KAZAKHSTAN, + TT_MS_LANGID_KYRGYZ_KYRGYZSTAN, TT_MS_LANGID_KISWAHILI_KENYA, + TT_MS_LANGID_TATAR_RUSSIA, TT_MS_LANGID_ODIA_INDIA, + TT_MS_LANGID_MONGOLIAN_PRC, TT_MS_LANGID_TIBETAN_PRC, + TT_MS_LANGID_WELSH_UNITED_KINGDOM, TT_MS_LANGID_GALICIAN_GALICIAN, + TT_MS_LANGID_SINHALA_SRI_LANKA, TT_MS_LANGID_TAMAZIGHT_ALGERIA, + TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA, TT_MS_LANGID_YI_PRC, + TT_MS_LANGID_UIGHUR_PRC): New aliases. + + Remove commented out code. + + (TT_NAME_ID_LIGHT_BACKGROUND, TT_NAME_ID_DARK_BACKGROUND, + TT_NAME_ID_VARIATIONS_PREFIX): New macros. + + (HAVE_LIMIT_ON_IDENTS): Remove macro (which was useless since many + years), use guarded long macros by default and define short versions + as aliases for the long ones. + +2017-01-15 Werner Lemberg + + * src/truetype/ttgxvar.c (tt_apply_var): Handle underline parameters + also. + +2017-01-11 Werner Lemberg + + * src/base/ftobjs.c (ft_open_face_internal): Improve tracing. + +2017-01-11 Werner Lemberg + + [truetype] Actually use metrics variation service. + + * src/base/ftmm.c: Include FT_SERVICE_METRICS_VARIATIONS_H. + (ft_face_get_mvar_service): New auxiliary function to look up + metrics variation service. + (FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, + FT_Set_Var_Blend_Coordinates): Call metrics variation service. + + * src/truetype/ttobjs.c (tt_face_init): Use metrics variations for + named instances. + +2017-01-11 Werner Lemberg + + [truetype] Provide metrics variation service. + + * include/freetype/internal/services/svmetric.h + (FT_Metrics_Adjust_Func): Reduce number of necessary parameters. + + * src/truetype/ttgxvar.c: Include FT_LIST_H. + (tt_size_reset_iterator): New auxiliary function for... + (tt_apply_var): New function. + + * src/truetype/ttgxvar.h: Updated. + + * src/truetype/ttdriver.c (tt_service_metrics_variations): Add + `tt_apply_mvar'. + + * include/freetype/internal/ftserv.h (FT_ServiceCache): Add metrics + variation service. + +2017-01-11 Werner Lemberg + + [truetype] Parse `MVAR' table. + + * src/truetype/ttgxvar.h (MVAR_TAG_XXX): New macros for MVAR tags. + (GX_Value, GX_MVarTable): New structures. + (GX_Blend): Add it. + + * src/truetype/ttgxvar.c (GX_VALUE_SIZE, GX_VALUE_CASE, + GX_GASP_CASE): New macros. + (ft_var_get_value_pointer): New auxiliary function to get a pointer + to a value from various SFNT tables already stored in `TT_Face'. + (ft_var_load_mvar): New function. + (TT_Get_MM_Var): Call it. + (tt_done_blend): Updated. + +2017-01-11 Werner Lemberg + + [truetype] More preparations for MVAR support. + + * src/truetype/ttobjs.c (tt_size_reset): Add argument to make + function only recompute ascender, descender, and height. + + * src/truetype/ttobjs.h: Updated. + + * src/truetype/ttdriver.c (tt_size_select, tt_size_request): + Updated. + +2017-01-09 Werner Lemberg + + [pcf] Disable long family names by default. + + * include/freetype/config/ftoption.h + (PCF_CONFIG_OPTION_LONG_FAMILY_NAMES): Comment out. + +2017-01-09 Werner Lemberg + + [pcf] Make long family names configurable. + + The change from 2016-09-29 was too radical (except for people using + the openSuSE GNU/Linux distribution). To ameliorate the situation, + PCF_CONFIG_OPTION_LONG_FAMILY_NAMES gets introduced which controls + the feature; if set, a new PCF property option + `no-long-family-names' can be used to switch this feature off. + + * include/freetype/config/ftoption.h, devel/ftoption.h + (PCF_CONFIG_OPTION_LONG_FAMILY_NAMES): New option. + + * include/freetype/ftpcfdrv.h: New header file (only containing + comments currently, used for building the documentation). + + * include/freetype/config/ftheader.h (FT_PCF_DRIVER_H): New macro. + + * src/pcf/pcf.h (PCF_Driver): Add `no_long_family_names' field. + + * src/pcf/pcfdrivr.c: Include FT_SERVICE_PROPERTIES_H and + FT_PCF_DRIVER_H. + (pcf_property_set, pcf_property_get): New functions. + (pcf_service_properties): New service. + (pcf_services): Updated. + (pcf_driver_init) [PCF_CONFIG_OPTION_LONG_FAMILY_NAMES]: Handle + `no_long_family_names'. + + * src/pcf/pcfread.c (pcf_load_font): Handle `no_long_family_names' + and PCF_CONFIG_OPTION_LONG_FAMILY_NAMES. + + * docs/CHANGES: Updated. + +2017-01-09 Werner Lemberg + + [pcf] Introduce a driver structure. + + To be filled later on with something useful. + + * src/pcf/pcf.h (PCF_Driver): New structure. + + * src/pcf/pcfdrivr.c (pcf_driver_init, pcf_driver_done): New dummy + functions. + (pcf_driver_class): Updated. + +2017-01-08 Werner Lemberg + + [truetype] Again some GX code shuffling. + + We need this later on for MVAR also. + + * src/truetype/ttgxvar.c (tt_hadvance_adjust): Split off computing + an item store variation delta into... + (ft_var_get_item_delta): ...new function. + +2017-01-08 Werner Lemberg + + [truetype] Adjust font variation flags for MVAR. + + * include/freetype/internal/tttypes.h (TT_FACE_FLAG_VAR_XXX): + Remove all flags related to MVAR; replace it with... + (TT_FACE_FLAG_VAR_MVAR): ...this new macro. + (TT_Face): Remove `mvar_support' field (which was still unused). + +2017-01-06 Werner Lemberg + + [truetype] More GX code shuffling. + + We need this later on for MVAR also. + + * src/truetype/ttgxvar.c (tt_done_blend): Split off handling of item + variation store into... + (ft_var_done_item_variation_store): ...new function. + +2017-01-06 Werner Lemberg + + [truetype] More generalization of GX stuff. + + We need this later on for MVAR also. + + * src/truetype/ttgxvar.c (ft_var_load_delta_set_index_mapping): Add + parameters for delta-set index mapping and item variation store. + (ft_var_load_item_variation_store): Add parameter for item variation + store. + s/hvarData/varData/. + Move allocation of `hvar_table' to... + (ft_var_load_hvar): ...this function. + Updated. + +2017-01-06 Werner Lemberg + + [truetype] Some GX structure renames for generalization. + + We need this later on for MVAR also. + + * src/truetype/ttgxvar.h (GX_HVarData): Renamed to... + (GX_ItemVarData): ...this. + (GX_HVarRegion): Renamed to... + (GX_VarRegion): ...this. + (GX_HVStore): Renamed to... + (GX_ItemVarStore): ...this. + (GX_WidthMap): Renamed to... + (GX_DeltaSetIdxMap): ...this. + + (GX_HVarTable): Updated. + + * src/truetype/ttgxvar.c: Updated. + +2017-01-06 Werner Lemberg + + [truetype] Code shuffling. + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Split off loading of + item variation store and delta set index mapping into... + (ft_var_load_item_variation_store, + ft_var_load_delta_set_index_mapping): ...new functions. + +2017-01-06 Werner Lemberg + + [truetype] Add HVAR access without advance width map. + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Handle case where + `offsetToAdvanceWidthMapping' is zero. + (tt_hadvance_adjust): Implement direct deltaSet access by glyph + index. + +2017-01-06 Werner Lemberg + + [pcf] Revise driver. + + This commit improves tracing and handling of malformed fonts. In + particular, the changes to `pcf_get_properties' fix + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=379 + + * src/pcf/pcfread.c (tableNames): Use long names for better + readability. + (pcf_read_TOC): Allow at most 9 tables. + (pcf_get_properties): Allow at most 256 properties. + Limit strings array length to 256 * (65536 + 1) bytes. + Better tracing. + (pcf_get_metric): Trace metric data. + (pcf_get_metrics): Allow at most 65536 metrics. + Fix comparison of `metrics->ascent' and `metrics->descent' to avoid + potential overflow. + Better tracing. + (pcf_get_bitmaps): Allow at most 65536 bitmaps. + Better tracing. + (pcf_get_encodings, pcf_get_accel): Better tracing. + + * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Don't trace `format' details. + These are now shown by `pcf_get_bitmaps'. + +2017-01-04 Werner Lemberg + + * src/pcf/pcfdrivr.c (PCF_Face_Init): Trace compression format. + +2017-01-04 Werner Lemberg + + [cff] More consistency checks for pure CFFs. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=378 + + * src/cff/cffload.c (cff_font_load): Check element number and size + of Name and Top DICT indices. + +2017-01-04 Werner Lemberg + + [cff, truetype] Minor tracing improvement. + + * src/cff/cffobjs.c (cff_face_init), src/truetype/ttobjs.c + (tt_face_init): Indent first tracing message from SFNT driver. + +2017-01-03 Werner Lemberg + + [truetype] Various minor fixes. + + * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check instruction + size only if we do native hinting. + (TT_Load_Glyph): Trace returned error code. + + * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Trace + returned error code. + (tt_size_ready_bytecode): Don't run `prep' table if `fpgm' table is + invalid. + +2017-01-03 Werner Lemberg + + [sfnt] Don't fail if PCLT, EBLC (and similar tables) are invalid. + + These tables are optional. + + * src/sfnt/sfobjs.c (sfnt_load_face): Implement it. + +2017-01-03 Werner Lemberg + + * src/cff/cffparse.c (cff_parse_num): Simplify. + +2017-01-03 Werner Lemberg + + Various fixes for clang's undefined behaviour sanitizer. + + * src/cff/cffload.c (FT_fdot14ToFixed): Fix casting. + (cff_blend_doBlend): Don't left-shift negative numbers. + Handle 5-byte numbers byte by byte to avoid alignment issues. + + * src/cff/cffparse.c (cff_parse_num): Handle 5-byte numbers byte by + byte to avoid alignment issues. + + * src/cid/cidload (cid_read_subrs): Do nothing if we don't have any + subrs. + + * src/psaux/t1decode.c (t1_decode_parse_charstring): Fix tracing. + + * src/tools/glnames.py (main): Put `DEFINE_PSTABLES' guard around + definition of `ft_get_adobe_glyph_index'. + + * src/psnames/pstables.h: Regenerated. + + * src/psnames/psmodule.c: Include `pstables.h' twice to get both + declaration and definition. + + * src/truetype/ttgxvar.c (FT_fdot14ToFixed, FT_intToFixed): Fix + casting. + +2017-01-01 Werner Lemberg + + [cff] Handle multiple `blend' operators in a row correctly. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=368 + + * src/cff/cffload.c (cff_blend_doBlend): Adjust `parser->stack' + pointers into `subFont->blend_stack' after reallocation. + +2017-01-01 Werner Lemberg + + [sfnt] Return correct number of named instances for TTCs. + + Without this patch, requesting information for face index N returned + the data for face index N+1 (or index 0). + + * src/sfnt/sfobjs.c (sfnt_init_face): Correctly adjust `face_index' + for negative `face_instance_index' values. + +2016-12-31 Werner Lemberg + + */*: Use hex numbers for errors in tracing messages. + +2016-12-31 Werner Lemberg + + [truetype] Check axis count in HVAR table. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=362 + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Check axis count. + (ft_var_load_avar): Fix tracing message. + + +---------------------------------------------------------------------------- + +Copyright 2016-2018 by +David Turner, Robert Wilhelm, and Werner Lemberg. + +This file is part of the FreeType project, and may only be used, modified, +and distributed under the terms of the FreeType project license, +LICENSE.TXT. By continuing to use, modify, or distribute this file you +indicate that you have read the license and understand and accept it +fully. + + +Local Variables: +version-control: never +coding: utf-8 +End: diff --git a/Jamfile b/Jamfile index bd45e9457..a9eb39632 100644 --- a/Jamfile +++ b/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 top Jamfile. # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -210,7 +210,7 @@ actions RefDoc { python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 - --title=FreeType-2.7.1 + --title=FreeType-2.9 --output=$(DOC_DIR) $(FT2_INCLUDE)/freetype/*.h $(FT2_INCLUDE)/freetype/config/*.h diff --git a/Jamrules b/Jamrules index 0047e5399..bdd04bcca 100644 --- a/Jamrules +++ b/Jamrules @@ -1,6 +1,6 @@ # FreeType 2 JamRules. # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/Makefile b/Makefile index 1c4145840..0c7ee0eef 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/README b/README index fc7c4175b..1e7ea97d4 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ - FreeType 2.7.1 - ============== + FreeType 2.9 + ============ - Homepage: http://www.freetype.org + Homepage: https://www.freetype.org FreeType is a freely available software library to render fonts. @@ -20,17 +20,17 @@ documentation is available as a separate package from our sites. Go to - http://download.savannah.gnu.org/releases/freetype/ + https://download.savannah.gnu.org/releases/freetype/ and download one of the following files. - freetype-doc-2.7.1.tar.bz2 - freetype-doc-2.7.1.tar.gz - ftdoc271.zip + freetype-doc-2.9.tar.bz2 + freetype-doc-2.9.tar.gz + ftdoc29.zip To view the documentation online, go to - http://www.freetype.org/freetype2/documentation.html + https://www.freetype.org/freetype2/documentation.html Mailing Lists @@ -46,7 +46,7 @@ The lists are moderated; see - http://www.freetype.org/contact.html + https://www.freetype.org/contact.html how to subscribe. @@ -71,7 +71,7 @@ ---------------------------------------------------------------------- -Copyright 2006-2017 by +Copyright 2006-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/README.git b/README.git index 06f778b48..a3d7fc0cd 100644 --- a/README.git +++ b/README.git @@ -37,7 +37,7 @@ repository. ---------------------------------------------------------------------- -Copyright 2005-2017 by +Copyright 2005-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/autogen.sh b/autogen.sh index 31c1534bc..ab90e6417 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright 2005-2017 by +# Copyright 2005-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/amiga/README b/builds/amiga/README index fb44116ed..29e97d667 100644 --- a/builds/amiga/README +++ b/builds/amiga/README @@ -1,7 +1,7 @@ README for the builds/amiga subdirectory. -Copyright 2005-2017 by +Copyright 2005-2018 by Werner Lemberg and Detlef Wrkner. This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/amiga/include/config/ftconfig.h b/builds/amiga/include/config/ftconfig.h index 9434841e6..0217e0ed1 100644 --- a/builds/amiga/include/config/ftconfig.h +++ b/builds/amiga/include/config/ftconfig.h @@ -4,7 +4,7 @@ /* */ /* Amiga-specific configuration file (specification only). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* Werner Lemberg and Detlef Wrkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/amiga/include/config/ftmodule.h b/builds/amiga/include/config/ftmodule.h index 38ea4c900..f8baab566 100644 --- a/builds/amiga/include/config/ftmodule.h +++ b/builds/amiga/include/config/ftmodule.h @@ -4,7 +4,7 @@ /* */ /* Amiga-specific FreeType module selection. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* Werner Lemberg and Detlef Wrkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/amiga/makefile b/builds/amiga/makefile index e467f9ab6..6a7700af2 100644 --- a/builds/amiga/makefile +++ b/builds/amiga/makefile @@ -5,7 +5,7 @@ # -# Copyright 2005-2017 by +# Copyright 2005-2018 by # Werner Lemberg and Detlef Wrkner. # # This file is part of the FreeType project, and may only be used, modified, @@ -96,9 +96,6 @@ ftbitmap.ppc.o: $(FTSRC)/base/ftbitmap.c ftcid.ppc.o: $(FTSRC)/base/ftcid.c $(CC) -c $(CFLAGS) -o $@ $< -ftfntfmt.ppc.o: $(FTSRC)/base/ftfntfmt.c - $(CC) -c $(CFLAGS) -o $@ $< - ftfstype.ppc.o: $(FTSRC)/base/ftfstype.c $(CC) -c $(CFLAGS) -o $@ $< @@ -111,9 +108,6 @@ ftglyph.ppc.o: $(FTSRC)/base/ftglyph.c ftgxval.ppc.o: $(FTSRC)/base/ftgxval.c $(CC) -c $(CFLAGS) -o $@ $< -ftlcdfil.ppc.o: $(FTSRC)/base/ftlcdfil.c - $(CC) -c $(CFLAGS) -o $@ $< - ftmm.ppc.o: $(FTSRC)/base/ftmm.c $(CC) -c $(CFLAGS) -o $@ $< @@ -270,8 +264,8 @@ otvalid.ppc.o: $(FTSRC)/otvalid/otvalid.c $(CC) -c $(CFLAGS) -o $@ $< BASEPPC = ftbase.ppc.o ftbbox.ppc.o ftbdf.ppc.o ftbitmap.ppc.o ftcid.ppc.o \ - ftfntfmt.ppc.oftfstype.ppc.o ftgasp.ppc.o ftglyph.ppc.o \ - ftgxval.ppc.o ftlcdfil.ppc.o ftmm.ppc.o ftotval.ppc.o \ + oftfstype.ppc.o ftgasp.ppc.o ftglyph.ppc.o \ + ftgxval.ppc.o ftmm.ppc.o ftotval.ppc.o \ ftpatent.ppc.o ftpfr.ppc.o ftstroke.ppc.o ftsynth.ppc.o \ fttype1.ppc.o ftwinfnt.ppc.o diff --git a/builds/amiga/makefile.os4 b/builds/amiga/makefile.os4 index 82ee86449..0d340cf19 100644 --- a/builds/amiga/makefile.os4 +++ b/builds/amiga/makefile.os4 @@ -4,7 +4,7 @@ # -# Copyright 2005-2017 by +# Copyright 2005-2018 by # Werner Lemberg and Detlef Wrkner. # # This file is part of the FreeType project, and may only be used, modified, @@ -99,9 +99,6 @@ ftdebug.ppc.o: FT:src/base/ftdebug.c ftdebugpure.ppc.o: src/base/ftdebug.c $(CC) -c $(CFLAGS) -o $@ src/base/ftdebug.c -ftfntfmt.ppc.o: FT:src/base/ftfntfmt.c - $(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftfntfmt.c - ftfstype.ppc.o: FT:src/base/ftfstype.c $(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftfstype.c @@ -114,9 +111,6 @@ ftglyph.ppc.o: FT:src/base/ftglyph.c ftgxval.ppc.o: FT:src/base/ftgxval.c $(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftgxval.c -ftlcdfil.ppc.o: FT:src/base/ftlcdfil.c - $(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftlcdfil.c - ftmm.ppc.o: FT:src/base/ftmm.c $(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftmm.c @@ -274,8 +268,8 @@ otvalid.ppc.o: FT:src/otvalid/otvalid.c $(CC) -c $(CFLAGS) -o $@ /FT/src/otvalid/otvalid.c BASE = ftbase.ppc.o ftbbox.ppc.o ftbdf.ppc.o ftbitmap.ppc.o ftcid.ppc.o \ - ftfntfmt.ppc.o ftfstype.ppc.o ftgasp.ppc.o ftglyph.ppc.o \ - ftgxval.ppc.o ftlcdfil.ppc.o ftmm.ppc.o ftotval.ppc.o \ + ftfstype.ppc.o ftgasp.ppc.o ftglyph.ppc.o \ + ftgxval.ppc.o ftmm.ppc.o ftotval.ppc.o \ ftpatent.ppc.o ftpfr.ppc.o ftstroke.ppc.o ftsynth.ppc.o \ fttype1.ppc.o ftwinfnt.ppc.o diff --git a/builds/amiga/smakefile b/builds/amiga/smakefile index 08e0a3892..f5de3089a 100644 --- a/builds/amiga/smakefile +++ b/builds/amiga/smakefile @@ -3,7 +3,7 @@ # -# Copyright 2005-2017 by +# Copyright 2005-2018 by # Werner Lemberg and Detlef Wrkner. # # This file is part of the FreeType project, and may only be used, modified, @@ -42,8 +42,8 @@ # (and either ftdebug.o or ftdebugpure.o if you enabled FT_DEBUG_LEVEL_ERROR or # FT_DEBUG_LEVEL_TRACE in include/freetype/config/ftoption.h). -OBJBASE = ftbase.o ftbbox.o ftbdf.o ftbitmap.o ftcid.o ftfntfmt.o ftfstype.o \ - ftgasp.o ftglyph.o ftgxval.o ftlcdfil.o ftmm.o ftotval.o \ +OBJBASE = ftbase.o ftbbox.o ftbdf.o ftbitmap.o ftcid.o ftfstype.o \ + ftgasp.o ftglyph.o ftgxval.o ftmm.o ftotval.o \ ftpatent.o ftpfr.o ftstroke.o ftsynth.o fttype1.o ftwinfnt.o OBJSYSTEM = ftsystem.o ftsystempure.o @@ -133,8 +133,6 @@ ftbitmap.o: $(CORE)base/ftbitmap.c sc $(SCFLAGS) objname=$@ $< ftcid.o: $(CORE)base/ftcid.c sc $(SCFLAGS) objname=$@ $< -ftfntfmt.o: $(CORE)base/ftfntfmt.c - sc $(SCFLAGS) objname=$@ $< ftfstype.o: $(CORE)base/ftfstype.c sc $(SCFLAGS) objname=$@ $< ftgasp.o: $(CORE)base/ftgasp.c @@ -143,8 +141,6 @@ ftglyph.o: $(CORE)base/ftglyph.c sc $(SCFLAGS) objname=$@ $< ftgxval.o: $(CORE)base/ftgxval.c sc $(SCFLAGS) objname=$@ $< -ftlcdfil.o: $(CORE)base/ftlcdfil.c - sc $(SCFLAGS) objname=$@ $< ftmm.o: $(CORE)base/ftmm.c sc $(SCFLAGS) objname=$@ $< ftotval.o: $(CORE)base/ftotval.c diff --git a/builds/amiga/src/base/ftdebug.c b/builds/amiga/src/base/ftdebug.c index 1a897cf2d..f3ba48c93 100644 --- a/builds/amiga/src/base/ftdebug.c +++ b/builds/amiga/src/base/ftdebug.c @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component for amiga (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, Werner Lemberg and Detlef Wrkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/amiga/src/base/ftsystem.c b/builds/amiga/src/base/ftsystem.c index c3960d96a..babaeeb68 100644 --- a/builds/amiga/src/base/ftsystem.c +++ b/builds/amiga/src/base/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* Amiga-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, Werner Lemberg and Detlef Wrkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/ansi/ansi-def.mk b/builds/ansi/ansi-def.mk index d3c0f282a..1484f9629 100644 --- a/builds/ansi/ansi-def.mk +++ b/builds/ansi/ansi-def.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/ansi/ansi.mk b/builds/ansi/ansi.mk index b33e8cec5..c06732c83 100644 --- a/builds/ansi/ansi.mk +++ b/builds/ansi/ansi.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/beos/beos-def.mk b/builds/beos/beos-def.mk index fa6f236dd..89c54ddd5 100644 --- a/builds/beos/beos-def.mk +++ b/builds/beos/beos-def.mk @@ -5,7 +5,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/beos/beos.mk b/builds/beos/beos.mk index 181efe440..619ceaff4 100644 --- a/builds/beos/beos.mk +++ b/builds/beos/beos.mk @@ -2,7 +2,7 @@ # FreeType 2 configuration rules for a BeOS system # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/beos/detect.mk b/builds/beos/detect.mk index 30f6d10d4..82f62059b 100644 --- a/builds/beos/detect.mk +++ b/builds/beos/detect.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/cmake/FindHarfBuzz.cmake b/builds/cmake/FindHarfBuzz.cmake index f394b82bf..ee0d52e36 100644 --- a/builds/cmake/FindHarfBuzz.cmake +++ b/builds/cmake/FindHarfBuzz.cmake @@ -31,42 +31,51 @@ # HARFBUZZ_LIBRARIES - containg the HarfBuzz library include(FindPkgConfig) +pkg_check_modules(PC_HARFBUZZ QUIET harfbuzz) -pkg_check_modules(PC_HARFBUZZ harfbuzz>=0.9.7) - -find_path(HARFBUZZ_INCLUDE_DIRS NAMES hb.h - HINTS ${PC_HARFBUZZ_INCLUDE_DIRS} ${PC_HARFBUZZ_INCLUDEDIR} +find_path(HARFBUZZ_INCLUDE_DIRS + NAMES hb.h + HINTS ${PC_HARFBUZZ_INCLUDEDIR} + ${PC_HARFBUZZ_INCLUDE_DIRS} + PATH_SUFFIXES harfbuzz ) find_library(HARFBUZZ_LIBRARIES NAMES harfbuzz - HINTS ${PC_HARFBUZZ_LIBRARY_DIRS} ${PC_HARFBUZZ_LIBDIR} + HINTS ${PC_HARFBUZZ_LIBDIR} + ${PC_HARFBUZZ_LIBRARY_DIRS} ) -# HarfBuzz 0.9.18 split ICU support into a separate harfbuzz-icu library. -if ("${PC_HARFBUZZ_VERSION}" VERSION_GREATER "0.9.17") - if (HarfBuzz_FIND_REQUIRED) - set(_HARFBUZZ_REQUIRED REQUIRED) - else () - set(_HARFBUZZ_REQUIRED "") - endif () - pkg_check_modules(PC_HARFBUZZ_ICU harfbuzz-icu>=0.9.18 ${_HARFBUZZ_REQUIRED}) - find_library(HARFBUZZ_ICU_LIBRARIES NAMES harfbuzz-icu - HINTS ${PC_HARFBUZZ_ICU_LIBRARY_DIRS} ${PC_HARFBUZZ_ICU_LIBDIR} - ) - if (HARFBUZZ_ICU_LIBRARIES) - list(APPEND HARFBUZZ_LIBRARIES "${HARFBUZZ_ICU_LIBRARIES}") +if (HARFBUZZ_INCLUDE_DIRS) + if (EXISTS "${HARFBUZZ_INCLUDE_DIRS}/hb-version.h") + file(READ "${HARFBUZZ_INCLUDE_DIRS}/hb-version.h" _harfbuzz_version_content) + + string(REGEX MATCH "#define +HB_VERSION_STRING +\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _dummy "${_harfbuzz_version_content}") + set(HARFBUZZ_VERSION "${CMAKE_MATCH_1}") endif () - set(_HARFBUZZ_EXTRA_REQUIRED_VAR "HARFBUZZ_ICU_LIBRARIES") -else () - set(_HARFBUZZ_EXTRA_REQUIRED_VAR "") +endif () + +if ("${harfbuzz_FIND_VERSION}" VERSION_GREATER "${HARFBUZZ_VERSION}") + message(FATAL_ERROR "Required version (" ${harfbuzz_FIND_VERSION} ") is higher than found version (" ${HARFBUZZ_VERSION} ")") endif () include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(HarfBuzz DEFAULT_MSG HARFBUZZ_INCLUDE_DIRS - HARFBUZZ_LIBRARIES ${_HARFBUZZ_EXTRA_REQUIRED_VAR}) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( + harfbuzz + REQUIRED_VARS HARFBUZZ_INCLUDE_DIRS HARFBUZZ_LIBRARIES + VERSION_VAR HARFBUZZ_VERSION) mark_as_advanced( - HARFBUZZ_ICU_LIBRARIES HARFBUZZ_INCLUDE_DIRS HARFBUZZ_LIBRARIES ) + +# Allows easy linking as in +# target_link_libraries(freetype PRIVATE Harfbuzz::Harfbuzz) +if (NOT CMAKE_VERSION VERSION_LESS 3.1) + if (HARFBUZZ_FOUND AND NOT TARGET Harfbuzz::Harfbuzz) + add_library(Harfbuzz::Harfbuzz INTERFACE IMPORTED) + set_target_properties( + Harfbuzz::Harfbuzz PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${HARFBUZZ_INCLUDE_DIRS}") + endif () +endif () diff --git a/builds/cmake/iOS.cmake b/builds/cmake/iOS.cmake index 5717e6a7b..c6da70c0c 100644 --- a/builds/cmake/iOS.cmake +++ b/builds/cmake/iOS.cmake @@ -1,6 +1,6 @@ # iOS.cmake # -# Copyright 2014-2017 by +# Copyright 2014-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # Written by David Wimsey diff --git a/builds/cmake/testbuild.sh b/builds/cmake/testbuild.sh index 34aded722..1fa3a1869 100755 --- a/builds/cmake/testbuild.sh +++ b/builds/cmake/testbuild.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -# Copyright 2015-2017 by +# Copyright 2015-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/ansi-cc.mk b/builds/compiler/ansi-cc.mk index d61964110..99fe8cb58 100644 --- a/builds/compiler/ansi-cc.mk +++ b/builds/compiler/ansi-cc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/bcc-dev.mk b/builds/compiler/bcc-dev.mk index 9b43fd1d9..8d67fa1a5 100644 --- a/builds/compiler/bcc-dev.mk +++ b/builds/compiler/bcc-dev.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/bcc.mk b/builds/compiler/bcc.mk index 82e38294f..02d483336 100644 --- a/builds/compiler/bcc.mk +++ b/builds/compiler/bcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/emx.mk b/builds/compiler/emx.mk index a25e4bc1f..2926b1179 100644 --- a/builds/compiler/emx.mk +++ b/builds/compiler/emx.mk @@ -3,7 +3,7 @@ # -# Copyright 2003-2017 by +# Copyright 2003-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/gcc-dev.mk b/builds/compiler/gcc-dev.mk index 8994fa290..48d284898 100644 --- a/builds/compiler/gcc-dev.mk +++ b/builds/compiler/gcc-dev.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/gcc.mk b/builds/compiler/gcc.mk index 3465038c9..9c772394a 100644 --- a/builds/compiler/gcc.mk +++ b/builds/compiler/gcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/intelc.mk b/builds/compiler/intelc.mk index 287db441c..e9236d34b 100644 --- a/builds/compiler/intelc.mk +++ b/builds/compiler/intelc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/unix-lcc.mk b/builds/compiler/unix-lcc.mk index 560c61bf3..09fffeb67 100644 --- a/builds/compiler/unix-lcc.mk +++ b/builds/compiler/unix-lcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/visualage.mk b/builds/compiler/visualage.mk index 2aa4fbe83..10299da62 100644 --- a/builds/compiler/visualage.mk +++ b/builds/compiler/visualage.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/visualc.mk b/builds/compiler/visualc.mk index e86ecc5f6..74f498b61 100644 --- a/builds/compiler/visualc.mk +++ b/builds/compiler/visualc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/watcom.mk b/builds/compiler/watcom.mk index 62a481184..e455922f0 100644 --- a/builds/compiler/watcom.mk +++ b/builds/compiler/watcom.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/compiler/win-lcc.mk b/builds/compiler/win-lcc.mk index 91b429e0e..1356c1ca8 100644 --- a/builds/compiler/win-lcc.mk +++ b/builds/compiler/win-lcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/detect.mk b/builds/detect.mk index 4ed478e43..eb7f79749 100644 --- a/builds/detect.mk +++ b/builds/detect.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -101,54 +101,28 @@ ifndef CONFIG_FILE .PHONY: setup endif -# The following targets are equivalent, with the exception that they use -# a slightly different syntax for the `echo' command. +# Flash out and copy rules. # -# std_setup: defined for most (i.e. Unix-like) platforms -# dos_setup: defined for Dos-ish platforms like Dos, Windows & OS/2 -# -.PHONY: std_setup dos_setup +.PHONY: std_setup std_setup: - @echo "" - @echo "$(PROJECT_TITLE) build system -- automatic system detection" - @echo "" - @echo "The following settings are used:" - @echo "" - @echo " platform $(PLATFORM)" - @echo " compiler $(CC)" - @echo " configuration directory $(BUILD_DIR)" - @echo " configuration rules $(CONFIG_RULES)" - @echo "" - @echo "If this does not correspond to your system or settings please remove the file" - @echo "\`$(CONFIG_MK)' from this directory then read the INSTALL file for help." - @echo "" - @echo "Otherwise, simply type \`$(MAKE)' again to build the library," - @echo "or \`$(MAKE) refdoc' to build the API reference (this needs python >= 2.6)." - @echo "" - @$(COPY) $(CONFIG_RULES) $(CONFIG_MK) - - -# Special case for Dos, Windows, OS/2, where echo "" doesn't work correctly! -# -dos_setup: - @type builds$(SEP)newline - @echo $(PROJECT_TITLE) build system -- automatic system detection - @type builds$(SEP)newline - @echo The following settings are used: - @type builds$(SEP)newline - @echo platform$(PLATFORM) - @echo compiler$(CC) - @echo configuration directory$(subst /,$(SEP),$(BUILD_DIR)) - @echo configuration rules$(subst /,$(SEP),$(CONFIG_RULES)) - @type builds$(SEP)newline - @echo If this does not correspond to your system or settings please remove the file - @echo '$(CONFIG_MK)' from this directory then read the INSTALL file for help. - @type builds$(SEP)newline - @echo Otherwise, simply type 'make' again to build the library. - @echo or 'make refdoc' to build the API reference (this needs python >= 2.6). - @type builds$(SEP)newline - @$(COPY) $(subst /,$(SEP),$(CONFIG_RULES) $(CONFIG_MK)) > nul + $(info ) + $(info $(PROJECT_TITLE) build system -- automatic system detection) + $(info ) + $(info The following settings are used:) + $(info ) + $(info $(empty) platform $(PLATFORM)) + $(info $(empty) compiler $(CC)) + $(info $(empty) configuration directory $(subst /,$(SEP),$(BUILD_DIR))) + $(info $(empty) configuration rules $(subst /,$(SEP),$(CONFIG_RULES))) + $(info ) + $(info If this does not correspond to your system or settings please remove the file) + $(info `$(CONFIG_MK)' from this directory then read the INSTALL file for help.) + $(info ) + $(info Otherwise, simply type `$(MAKE)' again to build the library,) + $(info or `$(MAKE) refdoc' to build the API reference (this needs python >= 2.6).) + $(info ) + @$(COPY) $(subst /,$(SEP),$(CONFIG_RULES) $(CONFIG_MK)) # EOF diff --git a/builds/dos/detect.mk b/builds/dos/detect.mk index 85c48df9e..0201f7b46 100644 --- a/builds/dos/detect.mk +++ b/builds/dos/detect.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -133,7 +133,7 @@ ifeq ($(PLATFORM),dos) COPY := copy endif # test NT - setup: dos_setup + setup: std_setup endif endif # test PLATFORM dos diff --git a/builds/dos/dos-def.mk b/builds/dos/dos-def.mk index a6c2f225f..cb1154dc8 100644 --- a/builds/dos/dos-def.mk +++ b/builds/dos/dos-def.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/dos/dos-emx.mk b/builds/dos/dos-emx.mk index 85de03778..dedcc3fc1 100644 --- a/builds/dos/dos-emx.mk +++ b/builds/dos/dos-emx.mk @@ -3,7 +3,7 @@ # -# Copyright 2003-2017 by +# Copyright 2003-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/dos/dos-gcc.mk b/builds/dos/dos-gcc.mk index e38acfbea..53099ab41 100644 --- a/builds/dos/dos-gcc.mk +++ b/builds/dos/dos-gcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/dos/dos-wat.mk b/builds/dos/dos-wat.mk index ddb4876b7..1bd00e73e 100644 --- a/builds/dos/dos-wat.mk +++ b/builds/dos/dos-wat.mk @@ -3,7 +3,7 @@ # -# Copyright 2003-2017 by +# Copyright 2003-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/exports.mk b/builds/exports.mk index 10b79d355..59fe31a4b 100644 --- a/builds/exports.mk +++ b/builds/exports.mk @@ -3,7 +3,7 @@ # -# Copyright 2005-2017 by +# Copyright 2005-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/freetype.mk b/builds/freetype.mk index f8cfd411c..6f68a0f65 100644 --- a/builds/freetype.mk +++ b/builds/freetype.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -153,6 +153,9 @@ endif ifneq ($(wildcard $(OBJ_DIR)/ftoption.h),) FTOPTION_H := $(OBJ_DIR)/ftoption.h FTOPTION_FLAG := $DFT_CONFIG_OPTIONS_H="" +else ifneq ($(wildcard $(BUILD_DIR)/ftoption.h),) + FTOPTION_H := $(BUILD_DIR)/ftoption.h + FTOPTION_FLAG := $DFT_CONFIG_OPTIONS_H="" endif # `CPPFLAGS' might be specified by the user in the environment. @@ -245,6 +248,22 @@ $(FTINIT_OBJ): $(FTINIT_SRC) $(FREETYPE_H) $(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) +# ftver component +# +# The VERSIONINFO resource `ftver.rc' contains version and copyright +# to be compiled by windres and tagged into DLL usually. +# +ifneq ($(RC),) + FTVER_SRC := $(BASE_DIR)/ftver.rc + FTVER_OBJ := $(OBJ_DIR)/ftver.$O + + OBJECTS_LIST += $(FTVER_OBJ) + + $(FTVER_OBJ): $(FTVER_SRC) + $(RC) -o $@ $< +endif + + # All FreeType library objects. # OBJ_M := $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M) @@ -326,10 +345,9 @@ remove_ftmodule_h: .PHONY: clean distclean -# The `config.mk' file must define `clean_freetype' and -# `distclean_freetype'. Implementations may use to relay these to either -# the `std' or `dos' versions from above, or simply provide their own -# implementation. +# The `config.mk' file must define `clean_project' and `distclean_project'. +# Implementations may use to relay these to either the `std' or `dos' +# versions from above, or simply provide their own implementation. # clean: clean_project distclean: distclean_project remove_config_mk remove_ftmodule_h diff --git a/builds/link_dos.mk b/builds/link_dos.mk index 3854e7072..3b0e8da58 100644 --- a/builds/link_dos.mk +++ b/builds/link_dos.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/link_std.mk b/builds/link_std.mk index 4cc2dc913..8ba5e64db 100644 --- a/builds/link_std.mk +++ b/builds/link_std.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/mac/FreeType.m68k_cfm.make.txt b/builds/mac/FreeType.m68k_cfm.make.txt index c0a55f510..b74565f10 100644 --- a/builds/mac/FreeType.m68k_cfm.make.txt +++ b/builds/mac/FreeType.m68k_cfm.make.txt @@ -38,7 +38,6 @@ SrcFiles = \xB6 :src:base:ftbdf.c \xB6 :src:base:ftbitmap.c \xB6 :src:base:ftdebug.c \xB6 - :src:base:ftfntfmt.c \xB6 :src:base:ftfstype.c \xB6 :src:base:ftglyph.c \xB6 :src:base:ftgxval.c \xB6 @@ -83,7 +82,6 @@ ObjFiles-68K = \xB6 "{ObjDir}ftbdf.c.o" \xB6 "{ObjDir}ftbitmap.c.o" \xB6 "{ObjDir}ftdebug.c.o" \xB6 - "{ObjDir}ftfntfmt.c.o" \xB6 "{ObjDir}ftfstype.c.o" \xB6 "{ObjDir}ftglyph.c.o" \xB6 "{ObjDir}ftgxval.c.o" \xB6 @@ -161,7 +159,6 @@ FreeType.m68k_cfm.o \xC4\xC4 {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5 "{ObjDir}ftbdf.c.o" \xC4 :src:base:ftbdf.c "{ObjDir}ftbitmap.c.o" \xC4 :src:base:ftbitmap.c "{ObjDir}ftdebug.c.o" \xC4 :src:base:ftdebug.c -"{ObjDir}ftfntfmt.c.o" \xC4 :src:base:ftfntfmt.c "{ObjDir}ftfstype.c.o" \xC4 :src:base:ftfstype.c "{ObjDir}ftglyph.c.o" \xC4 :src:base:ftglyph.c "{ObjDir}ftgxval.c.o" \xC4 :src:base:ftgxval.c diff --git a/builds/mac/FreeType.m68k_far.make.txt b/builds/mac/FreeType.m68k_far.make.txt index e9b7f6f5f..d880ddbb7 100644 --- a/builds/mac/FreeType.m68k_far.make.txt +++ b/builds/mac/FreeType.m68k_far.make.txt @@ -37,7 +37,6 @@ SrcFiles = \xB6 :src:base:ftbdf.c \xB6 :src:base:ftbitmap.c \xB6 :src:base:ftdebug.c \xB6 - :src:base:ftfntfmt.c \xB6 :src:base:ftfstype.c \xB6 :src:base:ftglyph.c \xB6 :src:base:ftgxval.c \xB6 @@ -82,7 +81,6 @@ ObjFiles-68K = \xB6 "{ObjDir}ftbdf.c.o" \xB6 "{ObjDir}ftbitmap.c.o" \xB6 "{ObjDir}ftdebug.c.o" \xB6 - "{ObjDir}ftfntfmt.c.o" \xB6 "{ObjDir}ftfstype.c.o" \xB6 "{ObjDir}ftglyph.c.o" \xB6 "{ObjDir}ftgxval.c.o" \xB6 @@ -160,7 +158,6 @@ FreeType.m68k_far.o \xC4\xC4 {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5 "{ObjDir}ftbdf.c.o" \xC4 :src:base:ftbdf.c "{ObjDir}ftbitmap.c.o" \xC4 :src:base:ftbitmap.c "{ObjDir}ftdebug.c.o" \xC4 :src:base:ftdebug.c -"{ObjDir}ftfntfmt.c.o" \xC4 :src:base:ftfntfmt.c "{ObjDir}ftfstype.c.o" \xC4 :src:base:ftfstype.c "{ObjDir}ftglyph.c.o" \xC4 :src:base:ftglyph.c "{ObjDir}ftgxval.c.o" \xC4 :src:base:ftgxval.c diff --git a/builds/mac/FreeType.ppc_carbon.make.txt b/builds/mac/FreeType.ppc_carbon.make.txt index 9eb1dac4e..1fa8c3076 100644 --- a/builds/mac/FreeType.ppc_carbon.make.txt +++ b/builds/mac/FreeType.ppc_carbon.make.txt @@ -38,7 +38,6 @@ SrcFiles = \xB6 :src:base:ftbdf.c \xB6 :src:base:ftbitmap.c \xB6 :src:base:ftdebug.c \xB6 - :src:base:ftfntfmt.c \xB6 :src:base:ftfstype.c \xB6 :src:base:ftglyph.c \xB6 :src:base:ftgxval.c \xB6 @@ -83,7 +82,6 @@ ObjFiles-PPC = \xB6 "{ObjDir}ftbdf.c.x" \xB6 "{ObjDir}ftbitmap.c.x" \xB6 "{ObjDir}ftdebug.c.x" \xB6 - "{ObjDir}ftfntfmt.c.x" \xB6 "{ObjDir}ftfstype.c.x" \xB6 "{ObjDir}ftglyph.c.x" \xB6 "{ObjDir}ftgxval.c.x" \xB6 @@ -164,7 +162,6 @@ FreeType.ppc_carbon.o \xC4\xC4 {ObjFiles-PPC} {LibFiles-PPC} {\xA5MondoBuild\x "{ObjDir}ftbdf.c.x" \xC4 :src:base:ftbdf.c "{ObjDir}ftbitmap.c.x" \xC4 :src:base:ftbitmap.c "{ObjDir}ftdebug.c.x" \xC4 :src:base:ftdebug.c -"{ObjDir}ftfntfmt.c.x" \xC4 :src:base:ftfntfmt.c "{ObjDir}ftfstype.c.x" \xC4 :src:base:ftfstype.c "{ObjDir}ftglyph.c.x" \xC4 :src:base:ftglyph.c "{ObjDir}ftgxval.c.x" \xC4 :src:base:ftgxval.c diff --git a/builds/mac/FreeType.ppc_classic.make.txt b/builds/mac/FreeType.ppc_classic.make.txt index 0627eeaa9..2550190cb 100644 --- a/builds/mac/FreeType.ppc_classic.make.txt +++ b/builds/mac/FreeType.ppc_classic.make.txt @@ -38,7 +38,6 @@ SrcFiles = \xB6 :src:base:ftbdf.c \xB6 :src:base:ftbitmap.c \xB6 :src:base:ftdebug.c \xB6 - :src:base:ftfntfmt.c \xB6 :src:base:ftfstype.c \xB6 :src:base:ftglyph.c \xB6 :src:base:ftgxval.c \xB6 @@ -83,7 +82,6 @@ ObjFiles-PPC = \xB6 "{ObjDir}ftbdf.c.x" \xB6 "{ObjDir}ftbitmap.c.x" \xB6 "{ObjDir}ftdebug.c.x" \xB6 - "{ObjDir}ftfntfmt.c.x" \xB6 "{ObjDir}ftfstype.c.x" \xB6 "{ObjDir}ftglyph.c.x" \xB6 "{ObjDir}ftgxval.c.x" \xB6 @@ -164,7 +162,6 @@ FreeType.ppc_classic.o \xC4\xC4 {ObjFiles-PPC} {LibFiles-PPC} {\xA5MondoBuild\ "{ObjDir}ftbdf.c.x" \xC4 :src:base:ftbdf.c "{ObjDir}ftbitmap.c.x" \xC4 :src:base:ftbitmap.c "{ObjDir}ftdebug.c.x" \xC4 :src:base:ftdebug.c -"{ObjDir}ftfntfmt.c.x" \xC4 :src:base:ftfntfmt.c "{ObjDir}ftfstype.c.x" \xC4 :src:base:ftfstype.c "{ObjDir}ftglyph.c.x" \xC4 :src:base:ftglyph.c "{ObjDir}ftgxval.c.x" \xC4 :src:base:ftgxval.c diff --git a/builds/mac/ftmac.c b/builds/mac/ftmac.c index 60cf73e5a..c45546cee 100644 --- a/builds/mac/ftmac.c +++ b/builds/mac/ftmac.c @@ -5,7 +5,7 @@ /* Mac FOND support. Written by just@letterror.com. */ /* Heavily Fixed by mpsuzuki, George Williams and Sean McBride */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -1423,7 +1423,7 @@ typedef short ResourceIndex; /* accepts an FSRef instead of a path. */ /* */ /* This function is deprecated because Carbon data types (FSRef) */ - /* are not cross-platform, and thus not suitable for the freetype API. */ + /* are not cross-platform, and thus not suitable for the FreeType API. */ FT_EXPORT_DEF( FT_Error ) FT_New_Face_From_FSRef( FT_Library library, const FSRef* ref, @@ -1481,7 +1481,7 @@ typedef short ResourceIndex; /* accepts an FSSpec instead of a path. */ /* */ /* This function is deprecated because Carbon data types (FSSpec) */ - /* are not cross-platform, and thus not suitable for the freetype API. */ + /* are not cross-platform, and thus not suitable for the FreeType API. */ FT_EXPORT_DEF( FT_Error ) FT_New_Face_From_FSSpec( FT_Library library, const FSSpec* spec, diff --git a/builds/modules.mk b/builds/modules.mk index a89d5791b..9a7a4a0aa 100644 --- a/builds/modules.mk +++ b/builds/modules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -41,7 +41,7 @@ endif define FTMODULE_H_INIT $(REMOVE_MODULE) -@-echo Generating modules list in $(FTMODULE_H)... +$(info Generating modules list in $(FTMODULE_H)...) $(OPEN_MODULE)/* This is a generated file. */$(CLOSE_MODULE) endef @@ -56,7 +56,7 @@ endef define FTMODULE_H_DONE $(OPEN_MODULE)/* EOF */$(CLOSE_MODULE) -@echo done. +$(info done.) endef diff --git a/builds/newline b/builds/newline deleted file mode 100644 index 8b1378917..000000000 --- a/builds/newline +++ /dev/null @@ -1 +0,0 @@ - diff --git a/builds/os2/detect.mk b/builds/os2/detect.mk index 3ea68fb5e..aaf78488b 100644 --- a/builds/os2/detect.mk +++ b/builds/os2/detect.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -65,7 +65,7 @@ ifeq ($(PLATFORM),os2) .PHONY: devel endif - setup: dos_setup + setup: std_setup endif # test PLATFORM os2 diff --git a/builds/os2/os2-def.mk b/builds/os2/os2-def.mk index 2fe626345..7ad1ffbad 100644 --- a/builds/os2/os2-def.mk +++ b/builds/os2/os2-def.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/os2/os2-dev.mk b/builds/os2/os2-dev.mk index 842a289ab..505a754f7 100644 --- a/builds/os2/os2-dev.mk +++ b/builds/os2/os2-dev.mk @@ -5,7 +5,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/os2/os2-gcc.mk b/builds/os2/os2-gcc.mk index 4cdffba57..65026b101 100644 --- a/builds/os2/os2-gcc.mk +++ b/builds/os2/os2-gcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/symbian/bld.inf b/builds/symbian/bld.inf index 8087202c2..9c6d8dca1 100644 --- a/builds/symbian/bld.inf +++ b/builds/symbian/bld.inf @@ -2,7 +2,7 @@ // FreeType 2 project for the symbian platform // -// Copyright 2008-2017 by +// Copyright 2008-2018 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, modified, @@ -25,10 +25,14 @@ PRJ_EXPORTS ../../include/freetype/config/ftoption.h config/ftoption.h ../../include/freetype/config/ftstdlib.h config/ftstdlib.h ../../include/freetype/freetype.h freetype.h +../../include/freetype/ftadvanc.h ftadvanc.h +../../include/freetype/ftautoh.h ftautoh.h ../../include/freetype/ftbbox.h ftbbox.h ../../include/freetype/ftbdf.h ftbdf.h ../../include/freetype/ftbitmap.h ftbitmap.h +../../include/freetype/ftbzip2.h ftbzip2.h ../../include/freetype/ftcache.h ftcache.h +../../include/freetype/ftcffdrv.h ftcffdrv.h ../../include/freetype/ftcid.h ftcid.h ../../include/freetype/fterrdef.h fterrdef.h ../../include/freetype/fterrors.h fterrors.h @@ -37,7 +41,6 @@ PRJ_EXPORTS ../../include/freetype/ftglyph.h ftglyph.h ../../include/freetype/ftgxval.h ftgxval.h ../../include/freetype/ftgzip.h ftgzip.h -../../include/freetype/ftbzip2.h ftbzip2.h ../../include/freetype/ftimage.h ftimage.h ../../include/freetype/ftincrem.h ftincrem.h ../../include/freetype/ftlcdfil.h ftlcdfil.h @@ -49,6 +52,8 @@ PRJ_EXPORTS ../../include/freetype/ftmoderr.h ftmoderr.h ../../include/freetype/ftotval.h ftotval.h ../../include/freetype/ftoutln.h ftoutln.h +../../include/freetype/ftparams.h ftparams.h +../../include/freetype/ftpcfdrv.h ftpcfdrv.h ../../include/freetype/ftpfr.h ftpfr.h ../../include/freetype/ftrender.h ftrender.h ../../include/freetype/ftsizes.h ftsizes.h @@ -56,11 +61,12 @@ PRJ_EXPORTS ../../include/freetype/ftstroke.h ftstroke.h ../../include/freetype/ftsynth.h ftsynth.h ../../include/freetype/ftsystem.h ftsystem.h +../../include/freetype/ftt1drv.h ftt1drv.h ../../include/freetype/fttrigon.h fttrigon.h +../../include/freetype/ftttdrv.h ftttdrv.h ../../include/freetype/fttypes.h fttypes.h ../../include/freetype/ftwinfnt.h ftwinfnt.h ../../include/freetype/t1tables.h t1tables.h ../../include/freetype/ttnameid.h ttnameid.h ../../include/freetype/tttables.h tttables.h ../../include/freetype/tttags.h tttags.h -../../include/freetype/ttunpat.h ttunpat.h diff --git a/builds/symbian/freetype.mmp b/builds/symbian/freetype.mmp index 6fe73332d..4e4a041eb 100644 --- a/builds/symbian/freetype.mmp +++ b/builds/symbian/freetype.mmp @@ -2,7 +2,7 @@ // FreeType 2 makefile for the symbian platform // -// Copyright 2008-2017 by +// Copyright 2008-2018 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, modified, @@ -28,13 +28,11 @@ source ftbbox.c source ftbdf.c source ftbitmap.c source ftcid.c -source ftfntfmt.c source ftfstype.c source ftgasp.c source ftglyph.c source ftgxval.c source ftinit.c -source ftlcdfil.c source ftmm.c source ftotval.c source ftpatent.c @@ -49,6 +47,10 @@ sourcepath ..\..\src\bdf source bdf.c +sourcepath ..\..\src\bzip2 + +source ftbzip2.c + sourcepath ..\..\src\cache source ftcache.c @@ -65,10 +67,6 @@ sourcepath ..\..\src\gzip source ftgzip.c -sourcepath ..\..\src\bzip2 - -source ftbzip2.c - sourcepath ..\..\src\lzw source ftlzw.c @@ -126,12 +124,12 @@ systeminclude ..\..\include systeminclude \epoc32\include\stdapis userinclude ..\..\src\autofit userinclude ..\..\src\bdf +userinclude ..\..\src\bzip2 userinclude ..\..\src\cache userinclude ..\..\src\cff userinclude ..\..\src\cid userinclude ..\..\src\gxvalid userinclude ..\..\src\gzip -userinclude ..\..\src\bzip2 userinclude ..\..\src\lzw userinclude ..\..\src\otvalid userinclude ..\..\src\pcf diff --git a/builds/toplevel.mk b/builds/toplevel.mk index 7b1d03be3..7ce0ed8db 100644 --- a/builds/toplevel.mk +++ b/builds/toplevel.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -172,7 +172,8 @@ include $(TOP_DIR)/builds/modules.mk # get FreeType version string, using a # poor man's `sed' emulation with make's built-in string functions # -work := $(strip $(shell $(CAT) $(TOP_DIR)/include/freetype/freetype.h)) +work := $(strip $(shell $(CAT) \ + $(subst /,$(SEP),$(TOP_DIR)/include/freetype/freetype.h))) work := $(subst |,x,$(work)) work := $(subst $(space),|,$(work)) work := $(subst \#define|FREETYPE_MAJOR|,$(space),$(work)) diff --git a/builds/unix/.gitignore b/builds/unix/.gitignore index e4e0a12c6..f89b226b8 100644 --- a/builds/unix/.gitignore +++ b/builds/unix/.gitignore @@ -10,6 +10,7 @@ configure.ac freetype2.pc freetype-config ftconfig.h +ftoption.h install-sh libtool ltmain.sh diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index 5bc0e4958..1b4aa2cad 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -2,7 +2,7 @@ # # Process this file with autoconf to produce a configure script. # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -17,7 +17,7 @@ AC_CONFIG_SRCDIR([ftconfig.in]) # Don't forget to update `docs/VERSIONS.TXT'! -version_info='19:0:13' +version_info='22:0:16' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) @@ -37,6 +37,7 @@ AC_SUBST(EXEEXT) PKG_PROG_PKG_CONFIG([0.24]) LT_INIT(win32-dll) +LT_PROG_RC # checks for native programs to generate building tool @@ -112,15 +113,13 @@ AC_TYPE_LONG_LONG_INT AC_MSG_CHECKING([whether cpp computation of bit length in ftconfig.in works]) orig_CPPFLAGS="${CPPFLAGS}" -CPPFLAGS="-I${srcdir} -I. ${CPPFLAGS}" +CPPFLAGS="-I${srcdir} -I. -I${srcdir}/../../include/freetype/config ${CPPFLAGS}" ac_clean_files= -for f in ft2build.h ftoption.h ftstdlib.h; do - if test ! -f $f; then - ac_clean_files="$ac_clean_files $f" - touch $f - fi -done +if test ! -f ft2build.h; then + ac_clean_files=ft2build.h + touch ft2build.h +fi cat > conftest.c <<\_ACEOF #include @@ -178,6 +177,15 @@ fi CPPFLAGS="${orig_CPPFLAGS}" +AC_ARG_ENABLE([freetype-config], + AS_HELP_STRING([--enable-freetype-config], [install freetype-config]), + [case "${enableval}" in + yes) enable_freetype_config="TRUE" ;; + no) enable_freetype_config="FALSE" ;; + *) AC_MSG_ERROR([unknown value '${enableval}' passed with --enable-freetype-config]) ;; + esac], [enable_freetype_config="FALSE"]) + +AC_SUBST(INSTALL_FT2_CONFIG, [$enable_freetype_config]) # checks for library functions @@ -275,7 +283,7 @@ if test "x$GCC" = xyes; then } ])], - [AC_MSG_RESULT([ok, add it to XX_ANSIFLAGS]) + [AC_MSG_RESULT([ok, adding to XX_ANSIFLAGS]) XX_ANSIFLAGS="${XX_ANSIFLAGS} ${a}" ], [AC_MSG_RESULT([no])]) @@ -300,6 +308,18 @@ AC_SUBST([XX_CFLAGS]) AC_SUBST([XX_ANSIFLAGS]) +# It is recommended that shared libraries hide symbols except those with +# explicit __attribute__((visibility("default"))). +# +AC_MSG_CHECKING([for -fvisibility=hidden compiler flag]) +orig_CFLAGS="${CFLAGS}" +CFLAGS="${CFLAGS} -fvisibility=hidden" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], + AC_MSG_RESULT(yes), + CFLAGS="${orig_CFLAGS}" + AC_MSG_RESULT(no)) + + # All library tests below try `pkg-config' first. If that fails, a function # from the library is tested in the traditional autoconf way (zlib, bzip2), # or a config script is called (libpng). @@ -476,7 +496,7 @@ AC_ARG_WITH([harfbuzz], have_harfbuzz=no if test x"$with_harfbuzz" = xyes -o x"$with_harfbuzz" = xauto; then - harfbuzz_pkg="harfbuzz >= 0.9.21" + harfbuzz_pkg="harfbuzz >= 1.3.0" have_harfbuzz_pkg=no if test x"$HARFBUZZ_CFLAGS" = x -a x"$HARFBUZZ_LIBS" = x; then @@ -511,6 +531,21 @@ if test x"$with_harfbuzz" = xyes -a "$have_harfbuzz" = no; then fi +# check for librt +# +# We need `clock_gettime' for the `ftbench' demo program. +# +# The code is modeled after gnulib's file `clock_time.m4', ignoring +# very old Solaris systems. + +LIB_CLOCK_GETTIME= +AC_SEARCH_LIBS([clock_gettime], + [rt], + [test "$ac_cv_search_clock_gettime" = "none required" \ + || LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime]) +AC_SUBST([LIB_CLOCK_GETTIME]) + + # Some options handling SDKs/archs in CFLAGS should be copied # to LDFLAGS. Apple TechNote 2137 recommends to include these # options in CFLAGS but not in LDFLAGS. @@ -977,27 +1012,63 @@ AC_SUBST([build_libtool_libs]) # changing LDFLAGS value should only be done after # lt_cv_prog_compiler_static_works test +ftoption_set() +{ + regexp="-e \\\"s|.*#.*def.*$1.*|#define $1|\\\"" + FTOPTION_H_SED="$FTOPTION_H_SED $regexp" +} + +ftoption_unset() +{ + regexp="-e \\\"s|.*#.*def.*$1.*|/* #undef $1 */|\\\"" + FTOPTION_H_SED="$FTOPTION_H_SED $regexp" +} + if test "$have_zlib" != no; then - CFLAGS="$CFLAGS $ZLIB_CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB" + CFLAGS="$CFLAGS $ZLIB_CFLAGS" LDFLAGS="$LDFLAGS $ZLIB_LIBS" + ftoption_set FT_CONFIG_OPTION_SYSTEM_ZLIB +else + ftoption_unset FT_CONFIG_OPTION_SYSTEM_ZLIB fi - if test "$have_bzip2" != no; then - CFLAGS="$CFLAGS $BZIP2_CFLAGS -DFT_CONFIG_OPTION_USE_BZIP2" + CFLAGS="$CFLAGS $BZIP2_CFLAGS" LDFLAGS="$LDFLAGS $BZIP2_LIBS" + ftoption_set FT_CONFIG_OPTION_USE_BZIP2 +else + ftoption_unset FT_CONFIG_OPTION_USE_BZIP2 fi if test "$have_libpng" != no; then - CFLAGS="$CFLAGS $LIBPNG_CFLAGS -DFT_CONFIG_OPTION_USE_PNG" + CFLAGS="$CFLAGS $LIBPNG_CFLAGS" LDFLAGS="$LDFLAGS $LIBPNG_LIBS" + ftoption_set FT_CONFIG_OPTION_USE_PNG +else + ftoption_unset FT_CONFIG_OPTION_USE_PNG fi if test "$have_harfbuzz" != no; then - CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS -DFT_CONFIG_OPTION_USE_HARFBUZZ" + CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS" LDFLAGS="$LDFLAGS $HARFBUZZ_LIBS" + ftoption_set FT_CONFIG_OPTION_USE_HARFBUZZ +else + ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ fi AC_SUBST([CFLAGS]) AC_SUBST([LDFLAGS]) +# We don't want to use a template file for `ftoption.h', since compilation +# should work without calling a configure script also. For this reason, we +# copy the `include/freetype/config/ftoption.h' file to the `unix/builds' +# directory (using a dummy `AC_CONFIG_FILES' call) and apply the just +# constructed $FTOPTION_H_SED regexp (using the post-action of +# `AC_CONFIG_FILES'); this is also the version that gets installed later on. +# +AC_CONFIG_FILES([ftoption.h:${srcdir}/../../include/freetype/config/ftoption.h], + [mv ftoption.h ftoption.tmp + eval "sed $FTOPTION_H_SED < ftoption.tmp > ftoption.h" + rm ftoption.tmp], + [FTOPTION_H_SED="$FTOPTION_H_SED"]) + # configuration file -- stay in 8.3 limit # # since #undef doesn't survive in configuration header files we replace diff --git a/builds/unix/detect.mk b/builds/unix/detect.mk index a2cf0a72b..54daa0786 100644 --- a/builds/unix/detect.mk +++ b/builds/unix/detect.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/freetype-config.in b/builds/unix/freetype-config.in index 97de13449..2d5b90dc2 100644 --- a/builds/unix/freetype-config.in +++ b/builds/unix/freetype-config.in @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright 2000-2017 by +# Copyright 2000-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -14,7 +14,7 @@ export LC_ALL # if `pkg-config' is available, use values from `freetype2.pc' -pkg-config --version >/dev/null 2>&1 +%PKG_CONFIG% --atleast-pkgconfig-version 0.24 >/dev/null 2>&1 if test $? -eq 0 ; then # note that option `--variable' is not affected by the # PKG_CONFIG_SYSROOT_DIR environment variable @@ -23,17 +23,17 @@ if test $? -eq 0 ; then export PKG_CONFIG_SYSROOT_DIR fi - prefix=`pkg-config --variable prefix freetype2` - exec_prefix=`pkg-config --variable exec_prefix freetype2` + prefix=`%PKG_CONFIG% --variable prefix freetype2` + exec_prefix=`%PKG_CONFIG% --variable exec_prefix freetype2` - includedir=`pkg-config --variable includedir freetype2` - libdir=`pkg-config --variable libdir freetype2` + includedir=`%PKG_CONFIG% --variable includedir freetype2` + libdir=`%PKG_CONFIG% --variable libdir freetype2` - version=`pkg-config --modversion freetype2` + version=`%PKG_CONFIG% --modversion freetype2` - cflags=`pkg-config --cflags freetype2` - dynamic_libs=`pkg-config --libs freetype2` - static_libs=`pkg-config --static --libs freetype2` + cflags=`%PKG_CONFIG% --cflags freetype2` + dynamic_libs=`%PKG_CONFIG% --libs freetype2` + static_libs=`%PKG_CONFIG% --static --libs freetype2` else prefix="%prefix%" exec_prefix="%exec_prefix%" diff --git a/builds/unix/freetype2.in b/builds/unix/freetype2.in index c4dfda4ab..2d759ecf8 100644 --- a/builds/unix/freetype2.in +++ b/builds/unix/freetype2.in @@ -4,7 +4,7 @@ libdir=%libdir% includedir=%includedir% Name: FreeType 2 -URL: http://freetype.org +URL: https://freetype.org Description: A free, high-quality, and portable font engine. Version: %ft_version% Requires: diff --git a/builds/unix/freetype2.m4 b/builds/unix/freetype2.m4 index 172212f10..af2e6590e 100644 --- a/builds/unix/freetype2.m4 +++ b/builds/unix/freetype2.m4 @@ -1,7 +1,7 @@ # Configure paths for FreeType2 # Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/ft-munmap.m4 b/builds/unix/ft-munmap.m4 index 27dd7d50c..00eda4925 100644 --- a/builds/unix/ft-munmap.m4 +++ b/builds/unix/ft-munmap.m4 @@ -1,6 +1,6 @@ ## FreeType specific autoconf tests # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in index 0bc93f19a..b9c21da2c 100644 --- a/builds/unix/ftconfig.in +++ b/builds/unix/ftconfig.in @@ -4,7 +4,7 @@ /* */ /* UNIX-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -365,6 +365,15 @@ FT_BEGIN_HEADER #endif +#ifdef _WIN64 + /* only 64bit Windows uses the LLP64 data model, i.e., */ + /* 32bit integers, 64bit pointers */ +#define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x) +#else +#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x) +#endif + + /*************************************************************************/ /* */ /* miscellaneous */ @@ -388,6 +397,14 @@ FT_BEGIN_HEADER #endif + /* Use FT_LOCAL and FT_LOCAL_DEF to declare and define, respectively, */ + /* a function that gets used only within the scope of a module. */ + /* Normally, both the header and source code files for such a */ + /* function are within a single module directory. */ + /* */ + /* Intra-module arrays should be tagged with FT_LOCAL_ARRAY and */ + /* FT_LOCAL_ARRAY_DEF. */ + /* */ #ifdef FT_MAKE_OPTION_SINGLE_OBJECT #define FT_LOCAL( x ) static x @@ -409,6 +426,12 @@ FT_BEGIN_HEADER #define FT_LOCAL_ARRAY_DEF( x ) const x + /* Use FT_BASE and FT_BASE_DEF to declare and define, respectively, */ + /* functions that are used in more than a single module. In the */ + /* current setup this implies that the declaration is in a header */ + /* file in the `include/freetype/internal' directory, and the */ + /* function body is in a file in `src/base'. */ + /* */ #ifndef FT_BASE #ifdef __cplusplus @@ -431,14 +454,63 @@ FT_BEGIN_HEADER #endif /* !FT_BASE_DEF */ + /* When compiling FreeType as a DLL or DSO with hidden visibility */ + /* some systems/compilers need a special attribute in front OR after */ + /* the return type of function declarations. */ + /* */ + /* Two macros are used within the FreeType source code to define */ + /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ + /* */ + /* FT_EXPORT( return_type ) */ + /* */ + /* is used in a function declaration, as in */ + /* */ + /* FT_EXPORT( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ); */ + /* */ + /* */ + /* FT_EXPORT_DEF( return_type ) */ + /* */ + /* is used in a function definition, as in */ + /* */ + /* FT_EXPORT_DEF( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ) */ + /* { */ + /* ... some code ... */ + /* return FT_Err_Ok; */ + /* } */ + /* */ + /* You can provide your own implementation of FT_EXPORT and */ + /* FT_EXPORT_DEF here if you want. */ + /* */ + /* To export a variable, use FT_EXPORT_VAR. */ + /* */ #ifndef FT_EXPORT -#ifdef __cplusplus +#ifdef FT2_BUILD_LIBRARY + +#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) ) +#define FT_EXPORT( x ) __declspec( dllexport ) x +#elif defined( __GNUC__ ) && __GNUC__ >= 4 +#define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x +#elif defined( __cplusplus ) +#define FT_EXPORT( x ) extern "C" x +#else +#define FT_EXPORT( x ) extern x +#endif + +#else + +#if defined( FT2_DLLIMPORT ) +#define FT_EXPORT( x ) __declspec( dllimport ) x +#elif defined( __cplusplus ) #define FT_EXPORT( x ) extern "C" x #else #define FT_EXPORT( x ) extern x #endif +#endif + #endif /* !FT_EXPORT */ @@ -474,7 +546,13 @@ FT_BEGIN_HEADER /* functions which are accessed by (global) function pointers. */ /* */ /* */ - /* FT_CALLBACK_DEF is used to _define_ a callback function. */ + /* FT_CALLBACK_DEF is used to _define_ a callback function, */ + /* located in the same source code file as the structure that uses */ + /* it. */ + /* */ + /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare */ + /* and define a callback function, respectively, in a similar way */ + /* as FT_BASE and FT_BASE_DEF work. */ /* */ /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ /* contains pointers to callback functions. */ @@ -494,6 +572,16 @@ FT_BEGIN_HEADER #endif #endif /* FT_CALLBACK_DEF */ +#ifndef FT_BASE_CALLBACK +#ifdef __cplusplus +#define FT_BASE_CALLBACK( x ) extern "C" x +#define FT_BASE_CALLBACK_DEF( x ) extern "C" x +#else +#define FT_BASE_CALLBACK( x ) extern x +#define FT_BASE_CALLBACK_DEF( x ) x +#endif +#endif /* FT_BASE_CALLBACK */ + #ifndef FT_CALLBACK_TABLE #ifdef __cplusplus #define FT_CALLBACK_TABLE extern "C" diff --git a/builds/unix/ftsystem.c b/builds/unix/ftsystem.c index 48a235ba3..8fdbeb0f6 100644 --- a/builds/unix/ftsystem.c +++ b/builds/unix/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* Unix-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/unix/install.mk b/builds/unix/install.mk index fae486cb3..c08c3b756 100644 --- a/builds/unix/install.mk +++ b/builds/unix/install.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -30,15 +30,20 @@ # # We also remove `$(includedir)/ft2build.h' for the same reason. # +# Note that some header files get handled twice for simplicity; a special, +# configured version overwrites the generic one. +# install: $(PROJECT_LIBRARY) -$(DELDIR) $(DESTDIR)$(includedir)/freetype2 -$(DELETE) $(DESTDIR)$(includedir)/ft2build.h $(MKINSTALLDIRS) $(DESTDIR)$(libdir) \ $(DESTDIR)$(libdir)/pkgconfig \ $(DESTDIR)$(includedir)/freetype2/freetype/config \ - $(DESTDIR)$(bindir) \ - $(DESTDIR)$(datadir)/aclocal \ + $(DESTDIR)$(datadir)/aclocal +ifeq ($(INSTALL_FT2_CONFIG),TRUE) + $(MKINSTALLDIRS) $(DESTDIR)$(bindir) \ $(DESTDIR)$(mandir)/man1 +endif $(LIBTOOL) --mode=install $(INSTALL) \ $(PROJECT_LIBRARY) $(DESTDIR)$(libdir) -for P in $(PUBLIC_H) ; do \ @@ -49,20 +54,24 @@ install: $(PROJECT_LIBRARY) $(INSTALL_DATA) \ $$P $(DESTDIR)$(includedir)/freetype2/freetype/config ; \ done - $(INSTALL_DATA) $(TOP_DIR)/include/ft2build.h \ + $(INSTALL_DATA) $(TOP_DIR)/include/ft2build.h \ $(DESTDIR)$(includedir)/freetype2/ft2build.h $(INSTALL_DATA) $(OBJ_BUILD)/ftconfig.h \ $(DESTDIR)$(includedir)/freetype2/freetype/config/ftconfig.h $(INSTALL_DATA) $(OBJ_DIR)/ftmodule.h \ $(DESTDIR)$(includedir)/freetype2/freetype/config/ftmodule.h - $(INSTALL_SCRIPT) -m 755 $(OBJ_BUILD)/freetype-config \ - $(DESTDIR)$(bindir)/freetype-config - $(INSTALL_SCRIPT) -m 644 $(BUILD_DIR)/freetype2.m4 \ + $(INSTALL_DATA) $(OBJ_BUILD)/ftoption.h \ + $(DESTDIR)$(includedir)/freetype2/freetype/config/ftoption.h + $(INSTALL_SCRIPT) -m 644 $(BUILD_DIR)/freetype2.m4 \ $(DESTDIR)$(datadir)/aclocal/freetype2.m4 - $(INSTALL_SCRIPT) -m 644 $(OBJ_BUILD)/freetype2.pc \ + $(INSTALL_SCRIPT) -m 644 $(OBJ_BUILD)/freetype2.pc \ $(DESTDIR)$(libdir)/pkgconfig/freetype2.pc - $(INSTALL_DATA) $(TOP_DIR)/docs/freetype-config.1 \ +ifeq ($(INSTALL_FT2_CONFIG),TRUE) + $(INSTALL_SCRIPT) -m 755 $(OBJ_BUILD)/freetype-config \ + $(DESTDIR)$(bindir)/freetype-config + $(INSTALL_DATA) $(TOP_DIR)/docs/freetype-config.1 \ $(DESTDIR)$(mandir)/man1/freetype-config.1 +endif uninstall: @@ -75,7 +84,7 @@ uninstall: check: - @echo There is no validation suite for this package. + $(info There is no validation suite for this package.) .PHONY: clean_project_unix distclean_project_unix @@ -83,13 +92,11 @@ check: # Unix cleaning and distclean rules. # clean_project_unix: - -$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S) - -$(DELETE) $(patsubst %.$O,%.$(SO),$(BASE_OBJECTS) $(OBJ_M) $(OBJ_S)) \ - $(CLEAN) + -$(LIBTOOL) --mode=clean $(RM) $(OBJECTS_LIST) + -$(DELETE) $(CLEAN) distclean_project_unix: clean_project_unix - -$(DELETE) $(PROJECT_LIBRARY) - -$(DELDIR) $(OBJ_DIR)/.libs + -$(LIBTOOL) --mode=clean $(RM) $(PROJECT_LIBRARY) -$(DELETE) *.orig *~ core *.core $(DISTCLEAN) # EOF diff --git a/builds/unix/unix-cc.in b/builds/unix/unix-cc.in index a967cee93..5675866ea 100644 --- a/builds/unix/unix-cc.in +++ b/builds/unix/unix-cc.in @@ -2,7 +2,7 @@ # FreeType 2 template for Unix-specific compiler definitions # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -87,13 +87,20 @@ ANSIFLAGS := @XX_ANSIFLAGS@ # C compiler to use -- we use libtool! # -# CCraw := $(CC) CC := $(LIBTOOL) --mode=compile $(CCraw) +# Resource compiler to use on Cygwin/MinGW, usually windres. +# +RCraw := @RC@ +ifneq ($(RCraw),) + RC := $(LIBTOOL) --tag=RC --mode=compile $(RCraw) +endif + # Linker flags. # -LDFLAGS := @LDFLAGS@ +LDFLAGS := @LDFLAGS@ +LIB_CLOCK_GETTIME := @LIB_CLOCK_GETTIME@ # for ftbench # export symbols diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in index feae99b65..6957053ab 100644 --- a/builds/unix/unix-def.in +++ b/builds/unix/unix-def.in @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -43,6 +43,7 @@ DISTCLEAN += $(OBJ_BUILD)/config.cache \ $(OBJ_BUILD)/unix-def.mk \ $(OBJ_BUILD)/unix-cc.mk \ $(OBJ_BUILD)/ftconfig.h \ + $(OBJ_BUILD)/ftoption.h \ $(LIBTOOL) \ $(OBJ_BUILD)/Makefile @@ -62,6 +63,7 @@ version_info := @version_info@ # Variables needed for `freetype-config' and `freetype.pc'. # +PKG_CONFIG := @PKG_CONFIG@ REQUIRES_PRIVATE := @REQUIRES_PRIVATE@ LIBS_PRIVATE := @LIBS_PRIVATE@ LIBSSTATIC_CONFIG := @LIBSSTATIC_CONFIG@ @@ -102,6 +104,7 @@ NO_OUTPUT := 2> /dev/null $(OBJ_BUILD)/freetype-config: $(TOP_DIR)/builds/unix/freetype-config.in rm -f $@ $@.tmp sed -e 's|%LIBSSTATIC_CONFIG%|$(LIBSSTATIC_CONFIG)|' \ + -e 's|%PKG_CONFIG%|$(PKG_CONFIG)|' \ -e 's|%build_libtool_libs%|$(build_libtool_libs)|' \ -e 's|%exec_prefix%|$(exec_prefix)|' \ -e 's|%ft_version%|$(ft_version)|' \ @@ -142,6 +145,9 @@ $(OBJ_BUILD)/freetype2.pc: $(TOP_DIR)/builds/unix/freetype2.in chmod a-w $@.tmp mv $@.tmp $@ +# defines whether we should install `freetype-config' or not +INSTALL_FT2_CONFIG = @INSTALL_FT2_CONFIG@ + all install: $(OBJ_BUILD)/freetype-config \ $(OBJ_BUILD)/freetype2.pc diff --git a/builds/unix/unix-dev.mk b/builds/unix/unix-dev.mk index 92c06001b..5a516ad28 100644 --- a/builds/unix/unix-dev.mk +++ b/builds/unix/unix-dev.mk @@ -6,7 +6,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/unix-lcc.mk b/builds/unix/unix-lcc.mk index 5122fdece..73a02d430 100644 --- a/builds/unix/unix-lcc.mk +++ b/builds/unix/unix-lcc.mk @@ -6,7 +6,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/unix.mk b/builds/unix/unix.mk index 14d5c0cbb..acd54d3dd 100644 --- a/builds/unix/unix.mk +++ b/builds/unix/unix.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/unix/unixddef.mk b/builds/unix/unixddef.mk index 30f2307c0..a8da63a0a 100644 --- a/builds/unix/unixddef.mk +++ b/builds/unix/unixddef.mk @@ -4,7 +4,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/vms/ftconfig.h b/builds/vms/ftconfig.h index c959ff19f..021e2c651 100644 --- a/builds/vms/ftconfig.h +++ b/builds/vms/ftconfig.h @@ -4,7 +4,7 @@ /* */ /* VMS-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -33,6 +33,7 @@ /* */ /*************************************************************************/ + #ifndef FTCONFIG_H_ #define FTCONFIG_H_ @@ -209,12 +210,12 @@ FT_BEGIN_HEADER #endif -#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT) +#if FT_SIZEOF_INT == 4 typedef signed int FT_Int32; typedef unsigned int FT_UInt32; -#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT) +#elif FT_SIZEOF_LONG == 4 typedef signed long FT_Int32; typedef unsigned long FT_UInt32; @@ -225,12 +226,12 @@ FT_BEGIN_HEADER /* look up an integer type that is at least 32 bits */ -#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT) +#if FT_SIZEOF_INT >= 4 typedef int FT_Fast; typedef unsigned int FT_UFast; -#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT) +#elif FT_SIZEOF_LONG >= 4 typedef long FT_Fast; typedef unsigned long FT_UFast; @@ -238,15 +239,25 @@ FT_BEGIN_HEADER #endif - /* determine whether we have a 64-bit int type for platforms without */ - /* Autoconf */ -#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) + /* determine whether we have a 64-bit int type */ + /* (mostly for environments without `autoconf') */ +#if FT_SIZEOF_LONG == 8 /* FT_LONG64 must be defined if a 64-bit type is available */ #define FT_LONG64 #define FT_INT64 long #define FT_UINT64 unsigned long + /* we handle the LLP64 scheme separately for GCC and clang, */ + /* suppressing the `long long' warning */ +#elif ( FT_SIZEOF_LONG == 4 ) && \ + defined( HAVE_LONG_LONG_INT ) && \ + defined( __GNUC__ ) +#pragma GCC diagnostic ignored "-Wlong-long" +#define FT_LONG64 +#define FT_INT64 long long int +#define FT_UINT64 unsigned long long int + /*************************************************************************/ /* */ /* A 64-bit data type may create compilation problems if you compile */ @@ -298,7 +309,7 @@ FT_BEGIN_HEADER #endif /* __STDC_VERSION__ >= 199901L */ -#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */ +#endif /* FT_SIZEOF_LONG == 8 */ #ifdef FT_LONG64 typedef FT_INT64 FT_Int64; @@ -306,6 +317,15 @@ FT_BEGIN_HEADER #endif +#ifdef _WIN64 + /* only 64bit Windows uses the LLP64 data model, i.e., */ + /* 32bit integers, 64bit pointers */ +#define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x) +#else +#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x) +#endif + + /*************************************************************************/ /* */ /* miscellaneous */ @@ -329,6 +349,14 @@ FT_BEGIN_HEADER #endif + /* Use FT_LOCAL and FT_LOCAL_DEF to declare and define, respectively, */ + /* a function that gets used only within the scope of a module. */ + /* Normally, both the header and source code files for such a */ + /* function are within a single module directory. */ + /* */ + /* Intra-module arrays should be tagged with FT_LOCAL_ARRAY and */ + /* FT_LOCAL_ARRAY_DEF. */ + /* */ #ifdef FT_MAKE_OPTION_SINGLE_OBJECT #define FT_LOCAL( x ) static x @@ -350,6 +378,12 @@ FT_BEGIN_HEADER #define FT_LOCAL_ARRAY_DEF( x ) const x + /* Use FT_BASE and FT_BASE_DEF to declare and define, respectively, */ + /* functions that are used in more than a single module. In the */ + /* current setup this implies that the declaration is in a header */ + /* file in the `include/freetype/internal' directory, and the */ + /* function body is in a file in `src/base'. */ + /* */ #ifndef FT_BASE #ifdef __cplusplus @@ -372,14 +406,63 @@ FT_BEGIN_HEADER #endif /* !FT_BASE_DEF */ + /* When compiling FreeType as a DLL or DSO with hidden visibility */ + /* some systems/compilers need a special attribute in front OR after */ + /* the return type of function declarations. */ + /* */ + /* Two macros are used within the FreeType source code to define */ + /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ + /* */ + /* FT_EXPORT( return_type ) */ + /* */ + /* is used in a function declaration, as in */ + /* */ + /* FT_EXPORT( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ); */ + /* */ + /* */ + /* FT_EXPORT_DEF( return_type ) */ + /* */ + /* is used in a function definition, as in */ + /* */ + /* FT_EXPORT_DEF( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ) */ + /* { */ + /* ... some code ... */ + /* return FT_Err_Ok; */ + /* } */ + /* */ + /* You can provide your own implementation of FT_EXPORT and */ + /* FT_EXPORT_DEF here if you want. */ + /* */ + /* To export a variable, use FT_EXPORT_VAR. */ + /* */ #ifndef FT_EXPORT -#ifdef __cplusplus +#ifdef FT2_BUILD_LIBRARY + +#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) ) +#define FT_EXPORT( x ) __declspec( dllexport ) x +#elif defined( __GNUC__ ) && __GNUC__ >= 4 +#define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x +#elif defined( __cplusplus ) +#define FT_EXPORT( x ) extern "C" x +#else +#define FT_EXPORT( x ) extern x +#endif + +#else + +#if defined( FT2_DLLIMPORT ) +#define FT_EXPORT( x ) __declspec( dllimport ) x +#elif defined( __cplusplus ) #define FT_EXPORT( x ) extern "C" x #else #define FT_EXPORT( x ) extern x #endif +#endif + #endif /* !FT_EXPORT */ @@ -415,7 +498,13 @@ FT_BEGIN_HEADER /* functions which are accessed by (global) function pointers. */ /* */ /* */ - /* FT_CALLBACK_DEF is used to _define_ a callback function. */ + /* FT_CALLBACK_DEF is used to _define_ a callback function, */ + /* located in the same source code file as the structure that uses */ + /* it. */ + /* */ + /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare */ + /* and define a callback function, respectively, in a similar way */ + /* as FT_BASE and FT_BASE_DEF work. */ /* */ /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ /* contains pointers to callback functions. */ @@ -435,6 +524,16 @@ FT_BEGIN_HEADER #endif #endif /* FT_CALLBACK_DEF */ +#ifndef FT_BASE_CALLBACK +#ifdef __cplusplus +#define FT_BASE_CALLBACK( x ) extern "C" x +#define FT_BASE_CALLBACK_DEF( x ) extern "C" x +#else +#define FT_BASE_CALLBACK( x ) extern x +#define FT_BASE_CALLBACK_DEF( x ) x +#endif +#endif /* FT_BASE_CALLBACK */ + #ifndef FT_CALLBACK_TABLE #ifdef __cplusplus #define FT_CALLBACK_TABLE extern "C" diff --git a/builds/vms/ftsystem.c b/builds/vms/ftsystem.c index d83e8ec6f..7d79f9a31 100644 --- a/builds/vms/ftsystem.c +++ b/builds/vms/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* VMS-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/builds/wince/ftdebug.c b/builds/wince/ftdebug.c index 7a20e2fac..83c5f4479 100644 --- a/builds/wince/ftdebug.c +++ b/builds/wince/ftdebug.c @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component for WinCE (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -79,7 +79,7 @@ va_start( ap, fmt ); - vprintf( fmt, ap ); + vfprintf( stderr, fmt, ap ); /* send the string to the debugger as well */ vsprintf( buf, fmt, ap ); OutputDebugStringEx( buf ); diff --git a/builds/wince/vc2005-ce/freetype.vcproj b/builds/wince/vc2005-ce/freetype.vcproj index 279abeefa..012934bef 100644 --- a/builds/wince/vc2005-ce/freetype.vcproj +++ b/builds/wince/vc2005-ce/freetype.vcproj @@ -21,7 +21,7 @@ - + @@ -41,7 +41,7 @@ - + @@ -61,7 +61,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -101,7 +101,7 @@ - + @@ -121,7 +121,7 @@ - + @@ -141,7 +141,7 @@ - + @@ -161,7 +161,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -201,7 +201,7 @@ - + @@ -221,7 +221,7 @@ - + @@ -241,7 +241,7 @@ - + @@ -261,7 +261,7 @@ - + @@ -281,7 +281,7 @@ - + @@ -301,7 +301,7 @@ - + @@ -321,7 +321,7 @@ - + @@ -341,7 +341,7 @@ - + @@ -361,7 +361,7 @@ - + @@ -381,7 +381,7 @@ - + @@ -401,7 +401,7 @@ - + @@ -421,7 +421,7 @@ - + @@ -441,7 +441,7 @@ - + @@ -461,7 +461,7 @@ - + @@ -481,7 +481,7 @@ - + @@ -501,7 +501,7 @@ - + @@ -521,7 +521,7 @@ - + @@ -541,7 +541,7 @@ - + @@ -561,7 +561,7 @@ - + @@ -581,7 +581,7 @@ - + @@ -601,7 +601,7 @@ - + @@ -621,7 +621,7 @@ - + @@ -641,7 +641,7 @@ - + @@ -661,7 +661,7 @@ - + @@ -681,7 +681,7 @@ - + @@ -701,7 +701,7 @@ - + @@ -721,7 +721,7 @@ - + @@ -741,7 +741,7 @@ - + @@ -758,7 +758,7 @@ - + @@ -773,585 +773,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -1359,774 +792,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2135,139 +812,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2282,1540 +829,28 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3836,4 +871,4 @@ - \ No newline at end of file + diff --git a/builds/wince/vc2005-ce/index.html b/builds/wince/vc2005-ce/index.html index 58d6093bc..267241528 100644 --- a/builds/wince/vc2005-ce/index.html +++ b/builds/wince/vc2005-ce/index.html @@ -21,14 +21,14 @@ the following targets:
  • PPC/SP WM6 (Windows Mobile 6)
  • -It compiles the following libraries from the FreeType 2.7.1 sources:

    +It compiles the following libraries from the FreeType 2.9 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype29.lib - release build; single threaded + freetype29_D.lib - debug build; single threaded + freetype29MT.lib - release build; multi-threaded + freetype29MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/wince/vc2008-ce/freetype.vcproj b/builds/wince/vc2008-ce/freetype.vcproj index ca306ceff..d80cfde91 100644 --- a/builds/wince/vc2008-ce/freetype.vcproj +++ b/builds/wince/vc2008-ce/freetype.vcproj @@ -88,7 +88,7 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/builds/wince/vc2008-ce/index.html b/builds/wince/vc2008-ce/index.html index 37de05c52..18f2a481b 100644 --- a/builds/wince/vc2008-ce/index.html +++ b/builds/wince/vc2008-ce/index.html @@ -21,14 +21,14 @@ the following targets:

  • PPC/SP WM6 (Windows Mobile 6)
  • -It compiles the following libraries from the FreeType 2.7.1 sources:

    +It compiles the following libraries from the FreeType 2.9 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype29.lib - release build; single threaded + freetype29_D.lib - debug build; single threaded + freetype29MT.lib - release build; multi-threaded + freetype29MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/detect.mk b/builds/windows/detect.mk index 350d15605..dd5669ca5 100644 --- a/builds/windows/detect.mk +++ b/builds/windows/detect.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -77,7 +77,7 @@ ifeq ($(PLATFORM),windows) # So we need to hack. # # Kudos to Eli Zaretskii (DJGPP guru) that helped debug it. - # Details are available in threads of the freetype mailing list + # Details are available in threads of the FreeType mailing list # (2004-11-11), and then in the devel mailing list (2004-11-20 to -23). # ifeq ($(OS),Windows_NT) @@ -95,22 +95,22 @@ ifeq ($(PLATFORM),windows) ifneq ($(findstring list,$(MAKECMDGOALS)),) # test for the "list" target dump_target_list: - @echo - @echo $(PROJECT_TITLE) build system -- supported compilers - @echo - @echo Several command-line compilers are supported on Win32: - @echo - @echo make setupgcc (with Mingw) - @echo make setup visualcMicrosoft Visual C++ - @echo make setup bcc32Borland C/C++ - @echo make setup lccWin32-LCC - @echo make setup intelcIntel C/C++ - @echo + $(info ) + $(info $(PROJECT_TITLE) build system -- supported compilers) + $(info ) + $(info Several command-line compilers are supported on Win32:) + $(info ) + $(info $(empty) make setup gcc (with Mingw)) + $(info $(empty) make setup visualc Microsoft Visual C++) + $(info $(empty) make setup bcc32 Borland C/C++) + $(info $(empty) make setup lcc Win32-LCC) + $(info $(empty) make setup intelc Intel C/C++) + $(info ) setup: dump_target_list .PHONY: dump_target_list list else - setup: dos_setup + setup: std_setup endif # additionally, we provide hooks for various other compilers diff --git a/builds/windows/ftdebug.c b/builds/windows/ftdebug.c index cadfceade..ec70a0e80 100644 --- a/builds/windows/ftdebug.c +++ b/builds/windows/ftdebug.c @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component for Win32 (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -65,7 +65,7 @@ va_start( ap, fmt ); - vprintf( fmt, ap ); + vfprintf( stderr, fmt, ap ); /* send the string to the debugger as well */ vsprintf( buf, fmt, ap ); OutputDebugStringA( buf ); diff --git a/builds/windows/vc2005/freetype.vcproj b/builds/windows/vc2005/freetype.vcproj index b643840c2..383f07ea8 100644 --- a/builds/windows/vc2005/freetype.vcproj +++ b/builds/windows/vc2005/freetype.vcproj @@ -16,7 +16,7 @@ - + @@ -33,7 +33,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -101,7 +101,7 @@ - + @@ -116,105 +116,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -222,151 +135,27 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - - - - @@ -376,8 +165,6 @@ - - @@ -385,244 +172,28 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -643,4 +214,4 @@ - \ No newline at end of file + diff --git a/builds/windows/vc2005/index.html b/builds/windows/vc2005/index.html index c3a5ab7d5..a25e67426 100644 --- a/builds/windows/vc2005/index.html +++ b/builds/windows/vc2005/index.html @@ -11,14 +11,14 @@

    This directory contains project files for Visual C++, named freetype.vcproj, and Visual Studio, called freetype.sln. It -compiles the following libraries from the FreeType 2.7.1 sources:

    +compiles the following libraries from the FreeType 2.9 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype29.lib - release build; single threaded + freetype29_D.lib - debug build; single threaded + freetype29MT.lib - release build; multi-threaded + freetype29MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/vc2008/freetype.vcproj b/builds/windows/vc2008/freetype.vcproj index 20d82c4bf..c9e395120 100644 --- a/builds/windows/vc2008/freetype.vcproj +++ b/builds/windows/vc2008/freetype.vcproj @@ -70,7 +70,7 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - @@ -826,270 +511,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - @@ -1342,806 +586,50 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/builds/windows/vc2008/index.html b/builds/windows/vc2008/index.html index bf9282f48..e0fdf2dc4 100644 --- a/builds/windows/vc2008/index.html +++ b/builds/windows/vc2008/index.html @@ -11,14 +11,14 @@

    This directory contains project files for Visual C++, named freetype.vcproj, and Visual Studio, called freetype.sln. It -compiles the following libraries from the FreeType 2.7.1 sources:

    +compiles the following libraries from the FreeType 2.9 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype29.lib - release build; single threaded + freetype29_D.lib - debug build; single threaded + freetype29MT.lib - release build; multi-threaded + freetype29MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/vc2010/freetype.sln b/builds/windows/vc2010/freetype.sln index b209eddd2..8698207a9 100644 --- a/builds/windows/vc2010/freetype.sln +++ b/builds/windows/vc2010/freetype.sln @@ -6,42 +6,30 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 - Debug Multithreaded|Win32 = Debug Multithreaded|Win32 - Debug Multithreaded|x64 = Debug Multithreaded|x64 - Debug Singlethreaded|Win32 = Debug Singlethreaded|Win32 - Debug Singlethreaded|x64 = Debug Singlethreaded|x64 + Debug Static|Win32 = Debug Static|Win32 + Debug Static|x64 = Debug Static|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 - Release Multithreaded|Win32 = Release Multithreaded|Win32 - Release Multithreaded|x64 = Release Multithreaded|x64 - Release Singlethreaded|Win32 = Release Singlethreaded|Win32 - Release Singlethreaded|x64 = Release Singlethreaded|x64 + Release Static|Win32 = Release Static|Win32 + Release Static|x64 = Release Static|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.ActiveCfg = Debug|Win32 {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.Build.0 = Debug|Win32 {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|x64.ActiveCfg = Debug|x64 {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|x64.Build.0 = Debug|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Multithreaded|Win32.ActiveCfg = Debug Multithreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Multithreaded|Win32.Build.0 = Debug Multithreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Multithreaded|x64.ActiveCfg = Debug Multithreaded|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Multithreaded|x64.Build.0 = Debug Multithreaded|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Singlethreaded|Win32.ActiveCfg = Debug Singlethreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Singlethreaded|Win32.Build.0 = Debug Singlethreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Singlethreaded|x64.ActiveCfg = Debug Singlethreaded|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Singlethreaded|x64.Build.0 = Debug Singlethreaded|x64 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|Win32.ActiveCfg = Debug Static|Win32 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|Win32.Build.0 = Debug Static|Win32 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|x64.ActiveCfg = Debug Static|x64 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|x64.Build.0 = Debug Static|x64 {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.ActiveCfg = Release|Win32 {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.Build.0 = Release|Win32 {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|x64.ActiveCfg = Release|x64 {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|x64.Build.0 = Release|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Multithreaded|Win32.ActiveCfg = Release Multithreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Multithreaded|Win32.Build.0 = Release Multithreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Multithreaded|x64.ActiveCfg = Release Multithreaded|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Multithreaded|x64.Build.0 = Release Multithreaded|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Singlethreaded|Win32.ActiveCfg = Release Singlethreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Singlethreaded|Win32.Build.0 = Release Singlethreaded|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Singlethreaded|x64.ActiveCfg = Release Singlethreaded|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Singlethreaded|x64.Build.0 = Release Singlethreaded|x64 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|Win32.ActiveCfg = Release Static|Win32 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|Win32.Build.0 = Release Static|Win32 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|x64.ActiveCfg = Release Static|x64 + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|x64.Build.0 = Release Static|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/builds/windows/vc2010/freetype.vcxproj b/builds/windows/vc2010/freetype.vcxproj index 64a71f8bc..521e84722 100644 --- a/builds/windows/vc2010/freetype.vcxproj +++ b/builds/windows/vc2010/freetype.vcxproj @@ -9,20 +9,12 @@ Debug x64 - - Debug Multithreaded + + Debug Static Win32 - - Debug Multithreaded - x64 - - - Debug Singlethreaded - Win32 - - - Debug Singlethreaded + + Debug Static x64 @@ -33,183 +25,103 @@ Release x64 - - Release Multithreaded + + Release Static Win32 - - Release Multithreaded - x64 - - - Release Singlethreaded - Win32 - - - Release Singlethreaded + + Release Static x64 + + + + 4.0 + + + + v100 + + + + v120 + + + + v140 + + + + v141 + + - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} + FreeType - StaticLibrary + DynamicLibrary false - MultiByte - v100 + Unicode - StaticLibrary - false - MultiByte - v100 - - - StaticLibrary + DynamicLibrary false - MultiByte - v100 + Unicode - + StaticLibrary false - MultiByte - v100 + Unicode - + StaticLibrary false - MultiByte - v100 - - - StaticLibrary - false - MultiByte - v100 + Unicode - StaticLibrary + DynamicLibrary false - MultiByte - v100 + Unicode - StaticLibrary + DynamicLibrary false - MultiByte - v100 + Unicode - + StaticLibrary false - MultiByte - v100 + Unicode - + StaticLibrary false - MultiByte - v100 - - - StaticLibrary - false - MultiByte - v100 - - - StaticLibrary - false - MultiByte - v100 + Unicode - <_ProjectFileVersion>10.0.30319.1 - .\..\..\..\objs\vc2010\$(Platform)\ - .\..\..\..\objs\vc2010\$(Platform)\$(Configuration)\ - .\..\..\..\objs\vc2010\$(Platform)\ - .\..\..\..\objs\vc2010\$(Platform)\$(Configuration)\ - .\..\..\..\objs\vc2010\$(Platform)\ - .\..\..\..\objs\vc2010\$(Platform)\$(Configuration)\ - .\..\..\..\objs\vc2010\$(Platform)\ - .\..\..\..\objs\vc2010\$(Platform)\$(Configuration)\ - .\..\..\..\objs\vc2010\$(Platform)\ - .\..\..\..\objs\vc2010\$(Platform)\$(Configuration)\ - .\..\..\..\objs\vc2010\$(Platform)\ - .\..\..\..\objs\vc2010\$(Platform)\$(Configuration)\ - .\..\..\..\objs\vc2010\$(Platform)\ - .\..\..\..\objs\vc2010\$(Platform)\$(Configuration)\ - .\..\..\..\objs\vc2010\$(Platform)\ - .\..\..\..\objs\vc2010\$(Platform)\$(Configuration)\ - .\..\..\..\objs\vc2010\$(Platform)\ - .\..\..\..\objs\vc2010\$(Platform)\$(Configuration)\ - .\..\..\..\objs\vc2010\$(Platform)\ - .\..\..\..\objs\vc2010\$(Platform)\$(Configuration)\ - .\..\..\..\objs\vc2010\$(Platform)\ - .\..\..\..\objs\vc2010\$(Platform)\$(Configuration)\ - .\..\..\..\objs\vc2010\$(Platform)\ - .\..\..\..\objs\vc2010\$(Platform)\$(Configuration)\ - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - AllRules.ruleset - - - - - freetype271d - freetype271d - freetype271MTd - freetype271MTd - freetype271STd - freetype271STd - freetype271 - freetype271 - freetype271MT - freetype271MT - freetype271ST - freetype271ST + ..\..\..\objs\$(Platform)\$(Configuration)\ + ..\..\..\objs\$(Platform)\$(Configuration)\ + AllRules.ruleset + + + freetype Disabled $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL true @@ -223,7 +135,7 @@ Disabled - _DEBUG;$(UserDefines);%(PreprocessorDefinitions) + _DEBUG;_DLL;$(UserDefines);%(PreprocessorDefinitions) 0x0409 @@ -237,7 +149,7 @@ Disabled $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL true @@ -251,7 +163,7 @@ Disabled - _DEBUG;$(UserDefines);%(PreprocessorDefinitions) + _DEBUG;_DLL;$(UserDefines);%(PreprocessorDefinitions) 0x0409 @@ -261,13 +173,11 @@ $(UserDependencies);%(AdditionalDependencies) - + Disabled $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;_CRT_SECURE_NO_DEPRECATE;$(UserDefines);%(PreprocessorDefinitions) - false - false + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug true @@ -291,69 +201,11 @@ $(UserDependencies);%(AdditionalDependencies) - + Disabled $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;_CRT_SECURE_NO_DEPRECATE;$(UserDefines);%(PreprocessorDefinitions) - false - false - EnableFastChecks - MultiThreadedDebug - true - Level4 - ProgramDatabase - Default - 4001 - true - false - $(OutDir)$(TargetName).pdb - Disabled - - - _DEBUG;$(UserDefines);%(PreprocessorDefinitions) - 0x0409 - - - true - MachineX64 - $(UserLibraryDirectories);%(AdditionalLibraryDirectories) - $(UserDependencies);%(AdditionalDependencies) - - - - - Disabled - $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - true - Level4 - ProgramDatabase - Default - 4001 - true - false - $(OutDir)$(TargetName).pdb - Disabled - - - _DEBUG;$(UserDefines);%(PreprocessorDefinitions) - 0x0409 - - - true - MachineX86 - $(UserLibraryDirectories);%(AdditionalLibraryDirectories) - $(UserDependencies);%(AdditionalDependencies) - - - - - Disabled - $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug true @@ -379,10 +231,10 @@ - Full + MaxSpeed AnySuitable $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) true MultiThreadedDLL true @@ -406,7 +258,7 @@ true - NDEBUG;$(UserDefines);%(PreprocessorDefinitions) + NDEBUG;_DLL;$(UserDefines);%(PreprocessorDefinitions) 0x0409 @@ -419,10 +271,10 @@ - Full + MaxSpeed AnySuitable $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) true MultiThreadedDLL true @@ -446,7 +298,7 @@ true - NDEBUG;$(UserDefines);%(PreprocessorDefinitions) + NDEBUG;_DLL;$(UserDefines);%(PreprocessorDefinitions) 0x0409 @@ -457,12 +309,12 @@ $(UserDependencies);%(AdditionalDependencies) - + - Full + MaxSpeed AnySuitable $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) true MultiThreaded true @@ -498,12 +350,12 @@ $(UserDependencies);%(AdditionalDependencies) - + - Full + MaxSpeed AnySuitable $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) true MultiThreaded true @@ -539,1180 +391,54 @@ $(UserDependencies);%(AdditionalDependencies) - - - Full - AnySuitable - $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) - true - MultiThreaded - true - true - Level4 - Default - 4001 - true - false - StreamingSIMDExtensions2 - false - false - false - - - true - - - true - Neither - true - - - NDEBUG;$(UserDefines);%(PreprocessorDefinitions) - 0x0409 - - - - true - MachineX86 - $(UserLibraryDirectories);%(AdditionalLibraryDirectories) - $(UserDependencies);%(AdditionalDependencies) - - - - - Full - AnySuitable - $(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions) - true - MultiThreaded - true - true - Level4 - Default - 4001 - true - false - StreamingSIMDExtensions2 - false - false - false - - - true - - - true - Neither - true - - - NDEBUG;$(UserDefines);%(PreprocessorDefinitions) - 0x0409 - - - - true - MachineX64 - $(UserLibraryDirectories);%(AdditionalLibraryDirectories) - $(UserDependencies);%(AdditionalDependencies) - - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - + + + - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - false - false - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - false - false - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - false - false - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - false - false - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - false - false - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - false - false - + - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - + + + + + + + + - - - - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + false - - - - - - - - + - \ No newline at end of file + + + + diff --git a/builds/windows/vc2010/freetype.vcxproj.filters b/builds/windows/vc2010/freetype.vcxproj.filters index 0e947f4ba..8ba3673e6 100644 --- a/builds/windows/vc2010/freetype.vcxproj.filters +++ b/builds/windows/vc2010/freetype.vcxproj.filters @@ -17,118 +17,118 @@ Source Files - + Source Files - + Source Files - + Source Files - + Source Files Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - - Source Files\FT_MODULES + + Source Files - - Source Files\FT_MODULES + + Source Files - - Source Files\FT_MODULES + + Source Files - - Source Files\FT_MODULES + + Source Files - - Source Files\FT_MODULES + + Source Files - - Source Files\FT_MODULES + + Source Files - - Source Files\FT_MODULES + + Source Files - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES - + Source Files\FT_MODULES diff --git a/builds/windows/vc2010/index.html b/builds/windows/vc2010/index.html index 8e465913a..8677511dc 100644 --- a/builds/windows/vc2010/index.html +++ b/builds/windows/vc2010/index.html @@ -1,42 +1,26 @@

    - FreeType 2 Project Files for VS.NET 2010 or newer + FreeType 2 Project Files for Visual C++ 2010 or newer

    - FreeType 2 Project Files for VS.NET 2010 or newer + FreeType 2 Project Files for Visual C++ 2010 or newer

    -

    This directory contains a project file for Visual C++ (VS.NET 2010 -or newer), named freetype.vcxproj, and Visual Studio, called -freetype.sln. It compiles the following libraries from the -FreeType 2.7.1 sources:

    +

    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.9 sources:

      -
      -    freetype271.lib    - release build
      -    freetype271d.lib   - debug build
      -    freetype271ST.lib  - release build; single threaded
      -    freetype271STd.lib - debug build;   single threaded
      -    freetype271MT.lib  - release build; multi-threaded
      -    freetype271MTd.lib - debug build;   multi-threaded
      +
    • freetype.dll using 'Release' or 'Debug' configurations
    • +
    • freetype.lib using 'Release Static' or 'Debug Static' configurations
    -

    Both Win32 and x64 builds are supported.

    - -

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP -archives are already stored this way, so no further action is required. If -you use some .tar.*z archives, be sure to configure your extracting -tool to convert the line endings. For example, with WinZip, you should activate the TAR -file smart CR/LF Conversion option. Alternatively, you may consider -using the unix2dos or u2d utilities that are floating -around, which specifically deal with this particular problem. - -

    Build directories are placed in the top-level objs\vc2010 -directory.

    +

    Both Win32 and x64 builds are supported. Build directories and target +files are placed in the top-level objs directory.

    Customization of the FreeType library is done by editing the ftoption.h header file in the top-level devel path. @@ -48,5 +32,9 @@ edit the freetype.users.props file in this directory. It also simplifies automated (command-line) builds using msbuild.

    +

    To link your executable with FreeType DLL, you may want to define +FT2_DLLIMPORT so that the imported functions are appropriately +attributed with dllimport.

    + diff --git a/builds/windows/visualc/freetype.dsp b/builds/windows/visualc/freetype.dsp index f6eeeb368..04b200d1d 100644 --- a/builds/windows/visualc/freetype.dsp +++ b/builds/windows/visualc/freetype.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug" @@ -78,7 +78,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug Multithreaded" @@ -102,8 +102,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype271_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271MT_D.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype29_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29MT_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Multithreaded" @@ -126,8 +126,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype271.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271MT.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype29.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29MT.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Singlethreaded" @@ -151,8 +151,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype271.lib" -# ADD LIB32 /out:"..\..\..\objs\freetype271ST.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype29.lib" +# ADD LIB32 /out:"..\..\..\objs\freetype29ST.lib" # SUBTRACT LIB32 /nologo !ELSEIF "$(CFG)" == "freetype - Win32 Debug Singlethreaded" @@ -177,8 +177,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype271_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271ST_D.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype29_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29ST_D.lib" !ENDIF @@ -200,17 +200,14 @@ SOURCE=..\..\..\src\autofit\autofit.c # Begin Source File SOURCE=..\..\..\src\bdf\bdf.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\cff\cff.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\base\ftbase.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -226,7 +223,11 @@ SOURCE=..\..\..\src\base\ftbitmap.c # End Source File # Begin Source File -SOURCE=..\..\..\src\base\ftfntfmt.c +SOURCE=..\..\..\src\base\ftcid.c +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\base\ftpatent.c # End Source File # Begin Source File @@ -239,18 +240,15 @@ SOURCE=..\..\..\src\base\ftgasp.c # Begin Source File SOURCE=..\..\..\src\cache\ftcache.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\ftdebug.c # ADD CPP /Ze -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\base\ftglyph.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -263,7 +261,6 @@ SOURCE=..\..\..\src\gzip\ftgzip.c # Begin Source File SOURCE=..\..\..\src\base\ftinit.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -272,7 +269,6 @@ SOURCE=..\..\..\src\lzw\ftlzw.c # Begin Source File SOURCE=..\..\..\src\base\ftmm.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -293,7 +289,6 @@ SOURCE=..\..\..\src\base\ftsynth.c # Begin Source File SOURCE=..\..\..\src\base\ftsystem.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -306,7 +301,6 @@ SOURCE=..\..\..\src\base\ftwinfnt.c # Begin Source File SOURCE=..\..\..\src\pcf\pcf.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -315,57 +309,46 @@ SOURCE=..\..\..\src\pfr\pfr.c # Begin Source File SOURCE=..\..\..\src\psaux\psaux.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\pshinter\pshinter.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\psnames\psmodule.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\raster\raster.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\sfnt\sfnt.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\smooth\smooth.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\truetype\truetype.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\type1\type1.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\cid\type1cid.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\type42\type42.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\winfonts\winfnt.c -# SUBTRACT CPP /Fr # End Source File # End Group # Begin Group "Header Files" diff --git a/builds/windows/visualc/freetype.vcproj b/builds/windows/visualc/freetype.vcproj index 69c084cce..7e6a46c47 100644 --- a/builds/windows/visualc/freetype.vcproj +++ b/builds/windows/visualc/freetype.vcproj @@ -69,7 +69,7 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - @@ -825,270 +510,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - @@ -1341,806 +585,50 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/builds/windows/visualc/index.html b/builds/windows/visualc/index.html index a2be3af69..32cebc6dd 100644 --- a/builds/windows/visualc/index.html +++ b/builds/windows/visualc/index.html @@ -11,14 +11,14 @@

    This directory contains project files for Visual C++, named freetype.dsp, and Visual Studio, called freetype.sln. It -compiles the following libraries from the FreeType 2.7.1 sources:

    +compiles the following libraries from the FreeType 2.9 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype29.lib - release build; single threaded + freetype29_D.lib - debug build; single threaded + freetype29MT.lib - release build; multi-threaded + freetype29MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/visualce/freetype.dsp b/builds/windows/visualce/freetype.dsp index f6eeeb368..d65714572 100644 --- a/builds/windows/visualce/freetype.dsp +++ b/builds/windows/visualce/freetype.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug" @@ -78,7 +78,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug Multithreaded" @@ -102,8 +102,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype271_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271MT_D.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype29_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29MT_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Multithreaded" @@ -126,8 +126,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype271.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271MT.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype29.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29MT.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Singlethreaded" @@ -151,8 +151,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype271.lib" -# ADD LIB32 /out:"..\..\..\objs\freetype271ST.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype29.lib" +# ADD LIB32 /out:"..\..\..\objs\freetype29ST.lib" # SUBTRACT LIB32 /nologo !ELSEIF "$(CFG)" == "freetype - Win32 Debug Singlethreaded" @@ -177,8 +177,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype271_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271ST_D.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype29_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype29ST_D.lib" !ENDIF @@ -200,17 +200,14 @@ SOURCE=..\..\..\src\autofit\autofit.c # Begin Source File SOURCE=..\..\..\src\bdf\bdf.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\cff\cff.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\base\ftbase.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -226,7 +223,7 @@ SOURCE=..\..\..\src\base\ftbitmap.c # End Source File # Begin Source File -SOURCE=..\..\..\src\base\ftfntfmt.c +SOURCE=..\..\..\src\base\ftcid.c # End Source File # Begin Source File @@ -239,18 +236,15 @@ SOURCE=..\..\..\src\base\ftgasp.c # Begin Source File SOURCE=..\..\..\src\cache\ftcache.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\ftdebug.c # ADD CPP /Ze -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\base\ftglyph.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -263,7 +257,6 @@ SOURCE=..\..\..\src\gzip\ftgzip.c # Begin Source File SOURCE=..\..\..\src\base\ftinit.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -272,7 +265,6 @@ SOURCE=..\..\..\src\lzw\ftlzw.c # Begin Source File SOURCE=..\..\..\src\base\ftmm.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -280,6 +272,10 @@ SOURCE=..\..\..\src\base\ftotval.c # End Source File # Begin Source File +SOURCE=..\..\..\src\base\ftpatent.c +# End Source File +# Begin Source File + SOURCE=..\..\..\src\base\ftpfr.c # End Source File # Begin Source File @@ -293,7 +289,6 @@ SOURCE=..\..\..\src\base\ftsynth.c # Begin Source File SOURCE=..\..\..\src\base\ftsystem.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -306,7 +301,6 @@ SOURCE=..\..\..\src\base\ftwinfnt.c # Begin Source File SOURCE=..\..\..\src\pcf\pcf.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File @@ -315,57 +309,46 @@ SOURCE=..\..\..\src\pfr\pfr.c # Begin Source File SOURCE=..\..\..\src\psaux\psaux.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\pshinter\pshinter.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\psnames\psmodule.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\raster\raster.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\sfnt\sfnt.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\smooth\smooth.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\truetype\truetype.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\type1\type1.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\cid\type1cid.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\type42\type42.c -# SUBTRACT CPP /Fr # End Source File # Begin Source File SOURCE=..\..\..\src\winfonts\winfnt.c -# SUBTRACT CPP /Fr # End Source File # End Group # Begin Group "Header Files" diff --git a/builds/windows/visualce/freetype.vcproj b/builds/windows/visualce/freetype.vcproj index 55c874df8..df1584829 100644 --- a/builds/windows/visualce/freetype.vcproj +++ b/builds/windows/visualce/freetype.vcproj @@ -87,7 +87,7 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -8727,5126 +3615,50 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/builds/windows/visualce/index.html b/builds/windows/visualce/index.html index 80c15bf77..3b3390af2 100644 --- a/builds/windows/visualce/index.html +++ b/builds/windows/visualce/index.html @@ -21,14 +21,14 @@ the following targets:

  • PPC/SP WM6 (Windows Mobile 6)
  • -It compiles the following libraries from the FreeType 2.7.1 sources:

    +It compiles the following libraries from the FreeType 2.9 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype29.lib - release build; single threaded + freetype29_D.lib - debug build; single threaded + freetype29MT.lib - release build; multi-threaded + freetype29MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/builds/windows/w32-bcc.mk b/builds/windows/w32-bcc.mk index d8d33b10b..01aab1ce0 100644 --- a/builds/windows/w32-bcc.mk +++ b/builds/windows/w32-bcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-bccd.mk b/builds/windows/w32-bccd.mk index ea634e502..2c14d6c8c 100644 --- a/builds/windows/w32-bccd.mk +++ b/builds/windows/w32-bccd.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-dev.mk b/builds/windows/w32-dev.mk index c9b96e9b8..279d5f9a0 100644 --- a/builds/windows/w32-dev.mk +++ b/builds/windows/w32-dev.mk @@ -5,7 +5,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-gcc.mk b/builds/windows/w32-gcc.mk index 27a0a8f7d..9e3476b94 100644 --- a/builds/windows/w32-gcc.mk +++ b/builds/windows/w32-gcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-icc.mk b/builds/windows/w32-icc.mk index c4f3dbf6b..e695c1214 100644 --- a/builds/windows/w32-icc.mk +++ b/builds/windows/w32-icc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-intl.mk b/builds/windows/w32-intl.mk index 4442bd314..1e36662d6 100644 --- a/builds/windows/w32-intl.mk +++ b/builds/windows/w32-intl.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-lcc.mk b/builds/windows/w32-lcc.mk index 0508fbb9b..5729d36c1 100644 --- a/builds/windows/w32-lcc.mk +++ b/builds/windows/w32-lcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-mingw32.mk b/builds/windows/w32-mingw32.mk index ae408239c..b3a210df2 100644 --- a/builds/windows/w32-mingw32.mk +++ b/builds/windows/w32-mingw32.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-vcc.mk b/builds/windows/w32-vcc.mk index 922fc60d1..342c8aa6d 100644 --- a/builds/windows/w32-vcc.mk +++ b/builds/windows/w32-vcc.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/w32-wat.mk b/builds/windows/w32-wat.mk index 4d6138e71..37ecc8880 100644 --- a/builds/windows/w32-wat.mk +++ b/builds/windows/w32-wat.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/builds/windows/win32-def.mk b/builds/windows/win32-def.mk index c9bebdbb0..f83d444ff 100644 --- a/builds/windows/win32-def.mk +++ b/builds/windows/win32-def.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/configure b/configure index e4312f9cb..f9d218667 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -15,7 +15,7 @@ rm -f config.mk builds/unix/unix-def.mk builds/unix/unix-cc.mk -# respect GNUMAKE environment variable for backwards compatibility +# respect GNUMAKE environment variable for backward compatibility if test "x$GNUMAKE" = x; then if test "x$MAKE" = x; then if test "x`make -v 2>/dev/null | egrep 'GNU|makepp'`" = x; then @@ -29,7 +29,7 @@ else fi if test "x`$MAKE -v 2>/dev/null | egrep 'GNU|makepp'`" = x; then - echo "GNU make (>= 3.80) or makepp (>= 1.19) is required to build FreeType2." >&2 + echo "GNU make (>= 3.81) or makepp (>= 2.0) is required to build FreeType2." >&2 echo "Please try" >&2 echo >&2 echo " MAKE= $0" >&2 diff --git a/devel/ft2build.h b/devel/ft2build.h index c805cf989..1d17141b2 100644 --- a/devel/ft2build.h +++ b/devel/ft2build.h @@ -4,7 +4,7 @@ /* */ /* FreeType 2 build and setup macros (development version). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/devel/ftoption.h b/devel/ftoption.h index ef3fcf211..1b4619eb0 100644 --- a/devel/ftoption.h +++ b/devel/ftoption.h @@ -4,7 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -268,48 +268,6 @@ FT_BEGIN_HEADER #define FT_CONFIG_OPTION_USE_HARFBUZZ - /*************************************************************************/ - /* */ - /* DLL export compilation */ - /* */ - /* When compiling FreeType as a DLL, some systems/compilers need a */ - /* special keyword in front OR after the return type of function */ - /* declarations. */ - /* */ - /* Two macros are used within the FreeType source code to define */ - /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ - /* */ - /* FT_EXPORT( return_type ) */ - /* */ - /* is used in a function declaration, as in */ - /* */ - /* FT_EXPORT( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ); */ - /* */ - /* */ - /* FT_EXPORT_DEF( return_type ) */ - /* */ - /* is used in a function definition, as in */ - /* */ - /* FT_EXPORT_DEF( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ) */ - /* { */ - /* ... some code ... */ - /* return FT_Err_Ok; */ - /* } */ - /* */ - /* You can provide your own implementation of FT_EXPORT and */ - /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */ - /* will be later automatically defined as `extern return_type' to */ - /* allow normal compilation. */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_EXPORT(x) extern x */ -/* #define FT_EXPORT_DEF(x) x */ - - /*************************************************************************/ /* */ /* Glyph Postscript Names handling */ @@ -324,7 +282,7 @@ FT_BEGIN_HEADER /* */ /* - The TrueType driver will provide its own set of glyph names, */ /* if you build it to support postscript names in the TrueType */ - /* `post' table. */ + /* `post' table, but will not synthesize a missing Unicode charmap. */ /* */ /* - The Type 1 driver will not be able to synthesize a Unicode */ /* charmap out of the glyphs found in the fonts. */ @@ -669,7 +627,7 @@ FT_BEGIN_HEADER /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */ /* defined. */ /* */ - /* [1] http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ + /* [1] https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ /* */ /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */ /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 */ @@ -689,7 +647,7 @@ FT_BEGIN_HEADER /* composite flags array which can be used to disambiguate, but old */ /* fonts will not have them. */ /* */ - /* http://www.microsoft.com/typography/otspec/glyf.htm */ + /* https://www.microsoft.com/typography/otspec/glyf.htm */ /* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html */ /* */ #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED @@ -786,6 +744,16 @@ FT_BEGIN_HEADER #undef T1_CONFIG_OPTION_NO_MM_SUPPORT + /*************************************************************************/ + /* */ + /* T1_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe Type 1 */ + /* engine gets compiled into FreeType. If defined, it is possible to */ + /* switch between the two engines using the `hinting-engine' property of */ + /* the type1 driver module. */ + /* */ +#define T1_CONFIG_OPTION_OLD_ENGINE + + /*************************************************************************/ /*************************************************************************/ /**** ****/ @@ -910,6 +878,7 @@ FT_BEGIN_HEADER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #define TT_USE_BYTECODE_INTERPRETER +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING #if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 1 #define TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY #endif @@ -917,6 +886,7 @@ FT_BEGIN_HEADER #if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 2 #define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL #endif +#endif #endif diff --git a/docs/CHANGES b/docs/CHANGES index 4cc8ee8d0..99c9d481c 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -1,8 +1,218 @@ +CHANGES BETWEEN 2.9 and 2.9.1 -CHANGES BETWEEN 2.7.1 and 2.7.2 + I. IMPORTANT BUG FIXES + + - Type 1 fonts containing flex features were not rendered + correctly (bug introduced in version 2.9). + + - CVE-2018-6942: Older FreeType versions can crash with certain + malformed variation fonts. + + http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-6942 + + + II. MISCELLANEOUS + + - Bug fix: Multiple calls to `FT_Get_MM_Var' returned garbage. + + - The base extensions `ftlcdfil' and `ftfntfmt' are now part of + the base module (and thus no longer configurable in file + `modules.cfg'). + + - Use of the `freetype-config' script to get compilation and + linking options is deprecated since it doesn't support + cross-compiling, among other deficiencies. Instead, you should + use the `pkg-config' interface. + + The `configure' script no longer installs `freetype-config' by + default. For backwards compatibility, a new configure option + `--enable-freetype-config' is provided that reverts this + decision. + + +====================================================================== + +CHANGES BETWEEN 2.8.1 and 2.9 + + I. IMPORTANT BUG FIXES + + - Advance width values of variation fonts were often wrong. + + - More fixes for variation font support; you should update to this + version if you want to support them. + + + II. IMPORTANT CHANGES + + - As a GSoC project, Ewald Hew extended the new (Adobe) CFF engine + to handle Type 1 fonts also, thus greatly improving the + rendering of this format. This is the new default. The old + engine is still available if the configuration macro + `T1_CONFIG_OPTION_OLD_ENGINE' gets defined; using the + `hinting-engine' property of the `type1' driver module you can + then switch between the two engines. + + - A new function, `FT_Set_Named_Instance', can be used to set or + change the current named instance. + + - Starting with this FreeType version, resetting variation + coordinates will return to the currently selected named + instance. Previously, FreeType returned to the base font (i.e., + no instance set). + + + III. MISCELLANEOUS + + - The `face_flags' field of the `FT_Face' structure has a new bit, + `FT_FACE_FLAG_VARIATION', which is set if a variation font has + been altered with `FT_Set_MM_Design_Coordinates', + `FT_Set_Var_Design_Coordinates', or + `FT_Set_Var_Blend_Coordinates'. + + - If the current face is a named instance, the new macro + `FT_IS_NAMED_INSTANCE' returns true. + + - `FT_IS_VARIATION' is a new macro that returns true whenever a + face object has been altered by `FT_Set_MM_Design_Coordinates', + `FT_Set_Var_Design_Coordinates', or + `FT_Set_Var_Blend_Coordinates'. + + - Changing the design coordinates of a variation font with + `FT_Set_Var_Design_Coordinates' or + `FT_Set_Var_Blend_Coordinates' does not influence the named + instance index value (only `FT_Set_Named_Instance' does that). + + - Special PostScript names for named instances are only returned + if the named instance is set with `FT_Set_Named_Instance' (and + the font has corresponding entries in its `fvar' table). If + `FT_IS_VARIATION' returns true, the algorithmically derived + PostScript name is provided, not looking up special entries for + named instances. + + - A new function `FT_Done_MM_Var' is provided to free the memory + returned in a call to `FT_Get_MM_Var'. + + - On platforms using the `configure' script, the installed + `ftoption.h' file now correctly reflects configuration options + like `--with-harfbuzz'. + + - Better support to build FreeType as a DLL on Windows using + Visual C. + + - All data specific to driver modules is now collected in a single + file, `FT_DRIVER_H'. Consequently, the macros + `FT_AUTOHINTER_H', `FT_CFF_DRIVER_H', `FT_TRUETYPE_DRIVER_H', + and `FT_PCF_DRIVER_H' still work but are deprecated. + + - Some fuzzer fixes to better reject malformed fonts. + + - The `ftbench' demo program has a new test for opening a new face + and loading some glyphs. + + - The `ftbench' demo program has a new option `-j' to specify the + last glyph index to be used in the tests. + + - The `ftgrid' demo program has a new option `-n' to suppress + display of named instances of variation fonts. + + - The `ttdebug' demo program can now show a stack trace (key `K') + and switch between hexadecimal and decimal display of integers + (key `I'). + + +====================================================================== + +CHANGES BETWEEN 2.8 and 2.8.1 + + I. IMPORTANT BUG FIXES + + - B/W hinting of TrueType fonts didn't work properly if + interpreter version 38 or 40 was selected. + + - Some severe problems within the handling of TrueType Variation + Fonts were found and fixed. + + - Function `FT_Set_Var_Design_Coordinates' didn't correctly handle + the case with less input coordinates than axes. + + + II. IMPORTANT CHANGES + + - By default, FreeType now offers high quality LCD-optimized + output without resorting to ClearType techniques of resolution + tripling and filtering. In this method, called Harmony, each + color channel is generated separately after shifting the glyph + outline, capitalizing on the fact that the color grids on LCD + panels are shifted by a third of a pixel. This output is + indistinguishable from ClearType with a light 3-tap filter. + + + III. MISCELLANEOUS + + - Using the new function `FT_Get_Var_Axis_Flags', an application + can access the `flags' field of a variation axis (introduced in + OpenType version 1.8.2) + + - More sanity checks. + + - The internal representation of buffers for LCD rendering has + changed (to be more precise, the amount of padding gets computed + differently). Applications that use the FreeType API are not + affected. + + - To reset all design axis values of a variation font to its + default values you can now say + + error = FT_Set_Var_Design_Coordinates( face, 0, NULL ); + + This also works with functions `FT_Set_MM_Design_Coordinates' + and `FT_Set_MM_Blend_Coordinates'. + + - FreeType now synthesizes a missing Unicode cmap for (older) + TrueType fonts also if glyph names are available. + + - FreeType has improved handling of BDF fonts without the + `POINT_SIZE', `RESOLUTION_X', or `RESOLUTION_Y' properties; the + library now uses the values of the `SIZE' keyword if they are + missing. Previously, `SIZE' was completely ignored, and + FreeType used heuristic values instead. + + - Multiple calls to `FT_Bitmap_Convert' do work now as advertised. + Previously, they failed with an assertion error if there was an + empty bitmap between non-empty ones. + + - The warping option has moved from `light' to `normal' hinting + where it replaces the original hinting algorithm. The `light' + mode is now always void of any hinting in x-direction. + + - 16bit compiler support is now officially ended. We didn't + provide any maintenance since many years, and given that there + were no error or problem reports either it seems that it is no + longer needed. + + - The `ftgrid' demo program can now toggle the display of grid + lines with the `G' key. + + - The `ftgrid' demo program can toggle a different set of colors + (suitable to color-blind people) with the `C' key. + + - The `ftgrid' demo program now supports the `-e' command line + option to select a cmap. + + - The `ftdump' demo program has a new command line option `-t' to + output the SFNT table list. + + +====================================================================== + +CHANGES BETWEEN 2.7.1 and 2.8 I. IMPORTANT CHANGES + - Support for OpenType Variation Fonts is now complete. The last + missing part was handling the `VVAR' and `MVAR' tables, which is + available with this release. + - A new function `FT_Face_Properties' allows the control of some module and library properties per font. Currently, the following properties can be handled: stem darkening, LCD filter @@ -17,11 +227,56 @@ CHANGES BETWEEN 2.7.1 and 2.7.2 FREETYPE_PROPERTIES=pcf:no-long-family-names=1 - - Variations font support now takes care of the `VVAR' and `MVAR' - tables also. + - Support for the following scripts has been added to the + auto-hinter. + Adlam, Avestan, Bamum, Buhid, Carian, Chakma, Coptic, Cypriot, + Deseret, Glagolitic, Gothic, Kayah, Lisu, N'Ko, Ol Chiki, Old + Turkic, Osage, Osmanya, Saurashtra, Shavian, Sundanese, Tai + Viet, Tifinagh, Unified Canadian Syllabics, Vai - II. MISCELLANEOUS + + II. IMPORTANT BUG FIXES + + - `Light' auto-hinting mode no longer uses TrueType metrics for + TrueType fonts. This bug was introduced in version 2.4.6, + causing horizontal scaling also. Almost all GNU/Linux + distributions (with Fedora as a notable exception) disabled the + corresponding patch for good reasons; chances are thus high that + you won't notice a difference. + + If optical backward compatibility for legacy applications is + necessary, you might enable the AF_CONFIG_OPTION_TT_SIZE_METRICS + configuration option. However, it is strongly recommended to + avoid that, adjusting font sizes instead. + + - Global size metrics values in the `FT_Size_Metrics' structure + can be different for TrueType fonts. Reason is that in older + FreeType versions the metrics were rounded differently to + integer pixels compared to all other font formats, yielding an + inconsistent behaviour if you used non-native hinting. Starting + with this version, global size metrics for TrueType fonts are + handled the same as other font formats: `ascender' gets rounded + up, `descender' gets rounded down, `height' gets normally + rounded, and `max_advance' gets normally rounded, too. + + If you need more precise values of (global) ascender, descender, + height, or `max_advance', please take the corresponding values + from the `FT_Face' structure and scale them manually. + + - If a TrueType font gets loaded with FT_LOAD_NO_HINTING, FreeType + now scales the font linearly again (bug introduced in version + 2.4.6). + + - CVE-2017-8105, CVE-2017-8287: Older FreeType versions have + out-of-bounds writes caused by heap-based buffer overflows + related to Type 1 fonts. + + https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8105 + https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8287 + + + III. MISCELLANEOUS - A new function `FT_Set_Default_Properties' has been added to parse the `FREETYPE_PROPERTIES' environment variable @@ -62,6 +317,12 @@ CHANGES BETWEEN 2.7.1 and 2.7.2 - The `freetype-config' script is now a wrapper of `pkg-config' if this program is available in the path. + - FT_LOAD_TARGET_LCD is now a variant of FT_LOAD_TARGET_LIGHT; + this should provide better rendering results. + + - A mode to display light auto-hinting with subpixel positioning + has been added to `ftdiff'. + ====================================================================== @@ -84,6 +345,12 @@ CHANGES BETWEEN 2.7 and 2.7.1 - Handling of raw CID fonts was partially broken (bug introduced in 2.6.4). + - CVE-2016-10328: Older FreeType versions had an out-of-bounds + write caused by a heap-based buffer overflow related to the CFF + fonts. + + https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-10328 + III. MISCELLANEOUS @@ -306,7 +573,7 @@ CHANGES BETWEEN 2.6.2 and 2.6.3 to the user. The exception to this is `__FTERRORS_H__', which must be sometimes undefined by the user to get FreeType error strings: Both this form and the new `FTERRORS_H_' macro are - accepted for backwards compatibility. + accepted for backward compatibility. - Minor improvements mainly to the Type 1 driver. @@ -383,8 +650,8 @@ CHANGES BETWEEN 2.6.1 and 2.6.2 - The smooth renderer has been made faster. - - The `ftstring' demo program now supports sub-pixel rendering; - use key `l' to cycle through the LCD modes. + - The `ftstring' demo program now supports subpixel rendering; use + key `l' to cycle through the LCD modes. - The `ftstring' demo program now supports colour rendering; use the `space' key to cycle through various colour combinations. @@ -547,17 +814,17 @@ CHANGES BETWEEN 2.5.5 and 2.6 compiler warnings. - Function `FT_Bitmap_New' has been renamed to `FT_Bitmap_Init', - since this name better reflects its function. For backwards + since this name better reflects its function. For backward compatibility, the old function name is still available. - Function `FT_Get_X11_Font_Format' has been renamed to `FT_Get_Font_Format', since this name better reflects its - function. For backwards compatibility, the old function name is + function. For backward compatibility, the old function name is still available. Additionally, the header file macro for this function has been renamed to `FT_FONT_FORMATS_H' (the old name `FT_XFREE86_H' is - retained for backwards compatibility). + retained for backward compatibility). - Various improvements to the `ftgrid' demo program. @@ -597,7 +864,7 @@ CHANGES BETWEEN 2.5.3 and 2.5.4 I. IMPORTANT BUG FIXES - A variant of vulnerability CVE-2014-2240 was identified - (cf. http://savannah.nongnu.org/bugs/?43661) and fixed in the + (cf. https://savannah.nongnu.org/bugs/?43661) and fixed in the new CFF driver. All users should upgrade. - The new auto-hinter code using HarfBuzz crashed for some invalid @@ -668,7 +935,7 @@ CHANGES BETWEEN 2.5.2 and 2.5.3 I. IMPORTANT BUG FIXES - A vulnerability (CVE-2014-2240) was identified and fixed in the - new CFF driver (cf. http://savannah.nongnu.org/bugs/?41697). + new CFF driver (cf. https://savannah.nongnu.org/bugs/?41697). All users should upgrade. - More bug fixes related to correct positioning of composite @@ -701,7 +968,7 @@ CHANGES BETWEEN 2.5.2 and 2.5.3 and install FreeType again. With FreeType's `configure' script the procedure boils down to - configure, build, and install Freetype, then configure, compile, + configure, build, and install FreeType, then configure, compile, and install HarfBuzz, then configure, compile, and install FreeType again (after executing `make distclean'). @@ -991,7 +1258,7 @@ index ebcf189..3f2ce6b 100644 II. MISCELLANEOUS - The (top-level) `configure' script now respects the MAKE - environment variable to specify a `make' binary. For backwards + environment variable to specify a `make' binary. For backward compatibility, GNUMAKE still overrides MAKE, though. - The `ftview' and `ftdiff' demo programs have been redesigned, @@ -1040,7 +1307,7 @@ CHANGES BETWEEN 2.4.10 and 2.4.11 - Subpixel hinting support has been contributed by Infinality, based on Greg Hitchcock's whitepaper at - http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx + https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx Originally, it was a separate patch available from @@ -1910,7 +2177,7 @@ CHANGES BETWEEN 2.3.0 and 2.2.1 of the library, mainly due to patent issues. For more information see: - http://lists.gnu.org/archive/html/freetype/2006-09/msg00064.html + https://lists.gnu.org/archive/html/freetype/2006-09/msg00064.html A new configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING has been introduced in `ftoption.h'; manually define it in this @@ -2013,7 +2280,7 @@ CHANGES BETWEEN 2.2 and 2.1.10 We provide patches for most of those rogue clients. See the following page for more information: - http://www.freetype.org/freetype2/patches/rogue-patches.html + https://www.freetype.org/freetype2/patches/rogue-patches.html Note that, as a convenience to our Unix desktop users, version 2.2 is *binary* compatible with FreeType 2.1.7, which means that @@ -2125,7 +2392,7 @@ CHANGES BETWEEN 2.2 and 2.1.10 - Rudimentary support for Adobe's new `SING Glyphlet' format. See - http://www.adobe.com/products/indesign/sing_gaiji.html + https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5148.SING_Tutorial.pdf for more information. @@ -2329,7 +2596,7 @@ CHANGES BETWEEN 2.1.8 and 2.1.7 correctly treated as a CID, similar to FreeType's CID driver module. Note that CID CMap support is still missing. - - The FT_FACE_FLAGS_GLYPH_NAMES flag is now set correctly for all + - The FT_FACE_FLAG_GLYPH_NAMES flag is now set correctly for all font formats. - Some subsetted Type 1 fonts weren't parsed correctly. This bug @@ -2802,7 +3069,7 @@ CHANGES BETWEEN 2.1.3 and 2.1.2 quality since many nasty defaults have been suppressed. Please visit the web page: - http://www.freetype.org/hinting/smooth-hinting.html + https://www.freetype.org/hinting/smooth-hinting.html for additional details on this topic. @@ -2822,12 +3089,12 @@ CHANGES BETWEEN 2.1.3 and 2.1.2 FT_LOAD_TARGET_MONO :: Hint and render for 1-bit displays. FT_LOAD_TARGET_LCD :: Hint and render for horizontal RGB or - BGR sub-pixel displays (like LCD + BGR subpixel displays (like LCD screens). THIS IS STILL EXPERIMENTAL! FT_LOAD_TARGET_LCD_V :: Same as FT_LOAD_TARGET_LCD, for - vertical sub-pixel displays (like + vertical subpixel displays (like rotated LCD screens). THIS IS STILL EXPERIMENTAL! @@ -3061,7 +3328,7 @@ CHANGES BETWEEN 2.1.0 and 2.0.9 - The FreeType 2 redesign has begun. More information can be found at this URL: - http://www.freetype.org/freetype2/redesign.html + https://www.freetype.org/freetype2/redesign.html The following internal changes have been performed within the sources of this release: @@ -3652,13 +3919,7 @@ CHANGES BETWEEN 2.0.2 and 2.0.1 For more information, see section I of the following document: - http://www.freetype.org/ - freetype2/docs/tutorial/step1.html - - or - - http://freetype.sourceforge.net/ - freetype2/docs/tutorial/step1.html + https://www.freetype.org/freetype2/docs/tutorial/step1.html - Many, many comments have been added to the public source file in order to automatically generate the API Reference through the @@ -3667,7 +3928,7 @@ CHANGES BETWEEN 2.0.2 and 2.0.1 The latter has been updated to support the grouping of sections in chapters and better index sort. See: - http://www.freetype.org/freetype2/docs/reference/ft2-toc.html + https://www.freetype.org/freetype2/docs/reference/ft2-toc.html III. CHANGES TO THE BUILD PROCESS @@ -4742,7 +5003,7 @@ Extensions support: ------------------------------------------------------------------------ -Copyright 2000-2017 by +Copyright 2000-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/CUSTOMIZE b/docs/CUSTOMIZE index 6d1587e09..916be3275 100644 --- a/docs/CUSTOMIZE +++ b/docs/CUSTOMIZE @@ -139,7 +139,7 @@ IV. Overriding default configuration and module headers ---------------------------------------------------------------------- -Copyright 2003-2017 by +Copyright 2003-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/DEBUG b/docs/DEBUG index e5e9390c7..751eaf028 100644 --- a/docs/DEBUG +++ b/docs/DEBUG @@ -191,7 +191,7 @@ behaviour of FreeType at runtime. ------------------------------------------------------------------------ -Copyright 2002-2017 by +Copyright 2002-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/FTL.TXT b/docs/FTL.TXT index 433ab060e..c406d150f 100644 --- a/docs/FTL.TXT +++ b/docs/FTL.TXT @@ -163,7 +163,7 @@ Legal Terms Our home page can be found at - http://www.freetype.org + https://www.freetype.org --- end of FTL.TXT --- diff --git a/docs/INSTALL b/docs/INSTALL index d6ec0d83b..71d4a0553 100644 --- a/docs/INSTALL +++ b/docs/INSTALL @@ -14,7 +14,7 @@ I. Normal installation and upgrades compilation, since other make tools won't work (this includes BSD Make). - GNU Make VERSION 3.80 OR NEWER IS NEEDED! + GNU Make VERSION 3.81 OR NEWER IS NEEDED! [For `cmake' see below.] @@ -72,12 +72,12 @@ II. Custom builds of the library http://makepp.sourceforge.net - for more information; you need version 1.19 or newer, and you must + for more information; you need version 2.0 or newer, and you must pass option `--norc-substitution'. ---------------------------------------------------------------------- -Copyright 2000-2017 by +Copyright 2000-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/INSTALL.ANY b/docs/INSTALL.ANY index 30b957859..fddac9ad2 100644 --- a/docs/INSTALL.ANY +++ b/docs/INSTALL.ANY @@ -39,11 +39,9 @@ I. Standard procedure src/base/ftbdf.c -- optional, see src/base/ftbitmap.c -- optional, see src/base/ftcid.c -- optional, see - src/base/ftfntfmt.c -- optional, see src/base/ftfstype.c -- optional src/base/ftgasp.c -- optional, see src/base/ftgxval.c -- optional, see - src/base/ftlcdfil.c -- optional, see src/base/ftmm.c -- optional, see src/base/ftotval.c -- optional, see src/base/ftpatent.c -- optional @@ -143,7 +141,7 @@ II. Support for flat-directory compilation ---------------------------------------------------------------------- -Copyright 2003-2017 by +Copyright 2003-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/INSTALL.CROSS b/docs/INSTALL.CROSS index 1a837aeee..239e1a9b6 100644 --- a/docs/INSTALL.CROSS +++ b/docs/INSTALL.CROSS @@ -9,7 +9,7 @@ procedure. ----------------- For self-building the FreeType library on a Unix system, GNU Make - 3.80 or newer is required. `INSTALL.UNIX' contains hints how to + 3.81 or newer is required. `INSTALL.UNIX' contains hints how to check the installed `make'. The GNU C compiler to cross-build the target system is required. @@ -163,7 +163,7 @@ procedure. ---------------------------------------------------------------------- -Copyright 2006-2017 by +Copyright 2006-2018 by suzuki toshiya, David Turner, Robert Wilhelm, and Werner Lemberg. diff --git a/docs/INSTALL.GNU b/docs/INSTALL.GNU index 79b53d842..e314ecfdd 100644 --- a/docs/INSTALL.GNU +++ b/docs/INSTALL.GNU @@ -25,7 +25,7 @@ instructions in the file `INSTALL.UNIX' instead. http://makepp.sourceforge.net - for more information; you need version 1.19 or newer, and you must + for more information; you need version 2.0 or newer, and you must pass option `--norc-substitution'. Make sure that you are invoking GNU Make from the command line, by @@ -35,7 +35,7 @@ instructions in the file `INSTALL.UNIX' instead. to display its version number. - VERSION 3.80 OR NEWER IS NEEDED! + VERSION 3.81 OR NEWER IS NEEDED! 2. Invoke `make' @@ -148,7 +148,7 @@ instructions in the file `INSTALL.UNIX' instead. ---------------------------------------------------------------------- -Copyright 2003-2017 by +Copyright 2003-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/INSTALL.UNIX b/docs/INSTALL.UNIX index 8b620da68..f92d828e6 100644 --- a/docs/INSTALL.UNIX +++ b/docs/INSTALL.UNIX @@ -19,7 +19,7 @@ or MSys on Win32: GNU Make Copyright (C) Free Software Foundation Inc. - Note that version 3.80 or higher is *required* or the build will + Note that version 3.81 or higher is *required* or the build will fail. It is also fine to have GNU Make under another name (e.g. 'gmake') @@ -105,7 +105,7 @@ or MSys on Win32: ---------------------------------------------------------------------- -Copyright 2003-2017 by +Copyright 2003-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/INSTALL.VMS b/docs/INSTALL.VMS index 7a5174d2e..c1d30e06e 100644 --- a/docs/INSTALL.VMS +++ b/docs/INSTALL.VMS @@ -1,7 +1,7 @@ -How to build the freetype2 library on VMS +How to build the FreeType 2 library on VMS ----------------------------------------- -It is actually very straightforward to install the Freetype2 library. +It is actually very straightforward to install the FreeType 2 library. Just execute vms_make.com from the toplevel directory to build the library. This procedure currently accepts the following options: @@ -15,10 +15,10 @@ ccopt= Options to pass to the C compiler e.g. ccopt=/float=ieee In case you did download the demos, place them in a separate directory -sharing the same toplevel as the directory of Freetype2 and follow the -same instructions as above for the demos from there. The build -process relies on this to figure the location of the Freetype2 include -files. +sharing the same top level as the directory of FreeType 2 and follow +the same instructions as above for the demos from there. The build +process relies on this to figure out the location of the FreeType 2 +include files. To rebuild the sources it is necessary to have MMS/MMK installed on @@ -49,7 +49,7 @@ V7.2-1. ------------------------------------------------------------------------ -Copyright 2000-2017 by +Copyright 2000-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/MAKEPP b/docs/MAKEPP index 58eaf551d..a4d44b78e 100644 --- a/docs/MAKEPP +++ b/docs/MAKEPP @@ -1,5 +1,5 @@ As a special exception, FreeType can also be built with the 'makepp' build tool, available from http://makepp.sourceforge.net. -Note, however. that you will need at least version 1.19 and pass the +Note, however, that you will need at least version 2.0 and pass the option --norc-substitution to have it work correctly. diff --git a/docs/TODO b/docs/TODO index c4304b323..1a443a2ed 100644 --- a/docs/TODO +++ b/docs/TODO @@ -27,7 +27,7 @@ Other bugs have been registered at the savannah bugzilla of FreeType. ------------------------------------------------------------------------ -Copyright 2001-2017 by +Copyright 2001-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/VERSIONS.TXT b/docs/VERSIONS.TXT index ec491de01..b0d25b54f 100644 --- a/docs/VERSIONS.TXT +++ b/docs/VERSIONS.TXT @@ -52,6 +52,9 @@ on _most_ systems, but not all of them: release libtool so ------------------------------- + 2.9.0 22.0.16 6.16.0 + 2.8.1 21.0.15 6.15.0 + 2.8.0 20.0.14 6.14.0 2.7.1 19.0.13 6.13.0 2.7.0 18.6.12 6.12.6 2.6.5 18.5.12 6.12.5 @@ -98,7 +101,7 @@ other release numbers. #include #include FT_FREETYPE_H #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2000009 -#error Freetype version too low. +#error FreeType version too low. #endif ], [AC_MSG_RESULT(yes) @@ -110,7 +113,7 @@ other release numbers. ------------------------------------------------------------------------ -Copyright 2002-2017 by +Copyright 2002-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/formats.txt b/docs/formats.txt index 5e56073cc..75aba92e3 100644 --- a/docs/formats.txt +++ b/docs/formats.txt @@ -7,9 +7,12 @@ Table fields wrapper format The format used to represent the font data. In the table below it is used only if the font format differs. Possible values are - `SFNT' (binary), `PS' (a text header, followed by binary or text - data), `LZW' (compressed with either `gzip' or `compress'), and - `BZ2' (compressed with `bzip2`). + + SFNT binary + PFB binary + PS a text header, followed by binary or text data + LZW compressed with either `gzip' or `compress' + BZ2 compressed with `bzip2'. font format How the font is to be accessed, possibly after converting the file @@ -95,6 +98,9 @@ which isn't supported yet please send a mail too. --- PS TYPE_1 --- type1 T1_SPEC.pdf + (PFA, Type 1 font resource) + PFB PS TYPE_1 --- type1 T1_SPEC.pdf, + 5040.Download_Fonts.pdf (`normal' Type 1 font) --- PS TYPE_1 CID cid PLRM.pdf (CID Font Type 0; Type 9 font) @@ -149,10 +155,11 @@ which isn't supported yet please send a mail too. [1] Support should be rather simple since this is identical to `CFF' but in a PS wrapper. -[2] Official PFR specification: +[2] The official PFR specification is no longer available, but + archive.org has archived it: - http://www.bitstream.com/categories/developer/truedoc/pfrspec.html - http://www.bitstream.com/categories/developer/truedoc/pfrspec1.2.pdf + https://web.archive.org/web/20091014062300/http://www.bitstream.com/font_rendering/products/truedoc/pfrspec.html + https://web.archive.org/web/20081115152605/http://www.bitstream.com/font_rendering/pdfs/pfrspec1.3.pdf The syntax of the auxiliary data is not defined there, but is partially defined in MHP 1.0.3 (also called ETSI TS 101812 V1.3.1) @@ -161,8 +168,6 @@ which isn't supported yet please send a mail too. http://www.etsi.org/ http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=18799 - (free registration required). - [3] Support is rudimentary currently; some tables or data are not loaded yet. @@ -178,15 +183,15 @@ which isn't supported yet please send a mail too. George Williams deduced the font format from the X11 sources and documented it for his FontForge font editor: - http://fontforge.github.io/pcf-format.html + https://fontforge.github.io/pcf-format.html [5] This is from MS Windows 3; see Microsoft's Knowledge Base article at - http://support.microsoft.com/kb/65123 + https://support.microsoft.com/kb/65123 ------------------------------------------------------------------------ -Copyright 2004-2017 by +Copyright 2004-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, @@ -197,3 +202,7 @@ accept it fully. --- end of formats.txt --- + +Local Variables: +coding: utf-8 +End: diff --git a/docs/freetype-config.1 b/docs/freetype-config.1 index d98400d2d..e060dcbd1 100644 --- a/docs/freetype-config.1 +++ b/docs/freetype-config.1 @@ -1,4 +1,4 @@ -.TH FREETYPE-CONFIG 1 "December 2016" "FreeType 2.7.1" +.TH FREETYPE-CONFIG 1 "January 2018" "FreeType 2.9" . . .SH NAME diff --git a/docs/raster.txt b/docs/raster.txt index bd3fd00f3..8ef466ef9 100644 --- a/docs/raster.txt +++ b/docs/raster.txt @@ -618,7 +618,7 @@ II. Rendering Technology ------------------------------------------------------------------------ -Copyright 2003-2017 by +Copyright 2003-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/docs/release b/docs/release index f07b067c3..44b4cb100 100644 --- a/docs/release +++ b/docs/release @@ -189,7 +189,7 @@ How to prepare a new release ---------------------------------------------------------------------- -Copyright 2003-2017 by +Copyright 2003-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index 9d7f8839b..eedebf408 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -4,7 +4,7 @@ /* */ /* ANSI-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -73,11 +73,11 @@ FT_BEGIN_HEADER /* The size of an `int' type. */ #if FT_UINT_MAX == 0xFFFFUL -#define FT_SIZEOF_INT (16 / FT_CHAR_BIT) +#define FT_SIZEOF_INT ( 16 / FT_CHAR_BIT ) #elif FT_UINT_MAX == 0xFFFFFFFFUL -#define FT_SIZEOF_INT (32 / FT_CHAR_BIT) +#define FT_SIZEOF_INT ( 32 / FT_CHAR_BIT ) #elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL -#define FT_SIZEOF_INT (64 / FT_CHAR_BIT) +#define FT_SIZEOF_INT ( 64 / FT_CHAR_BIT ) #else #error "Unsupported size of `int' type!" #endif @@ -85,11 +85,11 @@ FT_BEGIN_HEADER /* The size of a `long' type. A five-byte `long' (as used e.g. on the */ /* DM642) is recognized but avoided. */ #if FT_ULONG_MAX == 0xFFFFFFFFUL -#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) +#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT ) #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL -#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) +#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT ) #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL -#define FT_SIZEOF_LONG (64 / FT_CHAR_BIT) +#define FT_SIZEOF_LONG ( 64 / FT_CHAR_BIT ) #else #error "Unsupported size of `long' type!" #endif @@ -236,12 +236,12 @@ FT_BEGIN_HEADER #endif -#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT) +#if FT_SIZEOF_INT == ( 32 / FT_CHAR_BIT ) typedef signed int FT_Int32; typedef unsigned int FT_UInt32; -#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT) +#elif FT_SIZEOF_LONG == ( 32 / FT_CHAR_BIT ) typedef signed long FT_Int32; typedef unsigned long FT_UInt32; @@ -252,12 +252,12 @@ FT_BEGIN_HEADER /* look up an integer type that is at least 32 bits */ -#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT) +#if FT_SIZEOF_INT >= ( 32 / FT_CHAR_BIT ) typedef int FT_Fast; typedef unsigned int FT_UFast; -#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT) +#elif FT_SIZEOF_LONG >= ( 32 / FT_CHAR_BIT ) typedef long FT_Fast; typedef unsigned long FT_UFast; @@ -267,7 +267,7 @@ FT_BEGIN_HEADER /* determine whether we have a 64-bit int type for platforms without */ /* Autoconf */ -#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) +#if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT ) /* FT_LONG64 must be defined if a 64-bit type is available */ #define FT_LONG64 @@ -333,6 +333,15 @@ FT_BEGIN_HEADER #endif +#ifdef _WIN64 + /* only 64bit Windows uses the LLP64 data model, i.e., */ + /* 32bit integers, 64bit pointers */ +#define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x) +#else +#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x) +#endif + + /*************************************************************************/ /* */ /* miscellaneous */ @@ -356,6 +365,14 @@ FT_BEGIN_HEADER #endif + /* Use FT_LOCAL and FT_LOCAL_DEF to declare and define, respectively, */ + /* a function that gets used only within the scope of a module. */ + /* Normally, both the header and source code files for such a */ + /* function are within a single module directory. */ + /* */ + /* Intra-module arrays should be tagged with FT_LOCAL_ARRAY and */ + /* FT_LOCAL_ARRAY_DEF. */ + /* */ #ifdef FT_MAKE_OPTION_SINGLE_OBJECT #define FT_LOCAL( x ) static x @@ -377,6 +394,12 @@ FT_BEGIN_HEADER #define FT_LOCAL_ARRAY_DEF( x ) const x + /* Use FT_BASE and FT_BASE_DEF to declare and define, respectively, */ + /* functions that are used in more than a single module. In the */ + /* current setup this implies that the declaration is in a header */ + /* file in the `include/freetype/internal' directory, and the */ + /* function body is in a file in `src/base'. */ + /* */ #ifndef FT_BASE #ifdef __cplusplus @@ -399,14 +422,63 @@ FT_BEGIN_HEADER #endif /* !FT_BASE_DEF */ + /* When compiling FreeType as a DLL or DSO with hidden visibility */ + /* some systems/compilers need a special attribute in front OR after */ + /* the return type of function declarations. */ + /* */ + /* Two macros are used within the FreeType source code to define */ + /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ + /* */ + /* FT_EXPORT( return_type ) */ + /* */ + /* is used in a function declaration, as in */ + /* */ + /* FT_EXPORT( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ); */ + /* */ + /* */ + /* FT_EXPORT_DEF( return_type ) */ + /* */ + /* is used in a function definition, as in */ + /* */ + /* FT_EXPORT_DEF( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ) */ + /* { */ + /* ... some code ... */ + /* return FT_Err_Ok; */ + /* } */ + /* */ + /* You can provide your own implementation of FT_EXPORT and */ + /* FT_EXPORT_DEF here if you want. */ + /* */ + /* To export a variable, use FT_EXPORT_VAR. */ + /* */ #ifndef FT_EXPORT -#ifdef __cplusplus +#ifdef FT2_BUILD_LIBRARY + +#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) ) +#define FT_EXPORT( x ) __declspec( dllexport ) x +#elif defined( __GNUC__ ) && __GNUC__ >= 4 +#define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x +#elif defined( __cplusplus ) +#define FT_EXPORT( x ) extern "C" x +#else +#define FT_EXPORT( x ) extern x +#endif + +#else + +#if defined( FT2_DLLIMPORT ) +#define FT_EXPORT( x ) __declspec( dllimport ) x +#elif defined( __cplusplus ) #define FT_EXPORT( x ) extern "C" x #else #define FT_EXPORT( x ) extern x #endif +#endif + #endif /* !FT_EXPORT */ @@ -431,6 +503,7 @@ FT_BEGIN_HEADER #endif /* !FT_EXPORT_VAR */ + /* The following macros are needed to compile the library with a */ /* C++ compiler and with 16bit compilers. */ /* */ @@ -442,7 +515,13 @@ FT_BEGIN_HEADER /* functions which are accessed by (global) function pointers. */ /* */ /* */ - /* FT_CALLBACK_DEF is used to _define_ a callback function. */ + /* FT_CALLBACK_DEF is used to _define_ a callback function, */ + /* located in the same source code file as the structure that uses */ + /* it. */ + /* */ + /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare */ + /* and define a callback function, respectively, in a similar way */ + /* as FT_BASE and FT_BASE_DEF work. */ /* */ /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ /* contains pointers to callback functions. */ @@ -462,6 +541,16 @@ FT_BEGIN_HEADER #endif #endif /* FT_CALLBACK_DEF */ +#ifndef FT_BASE_CALLBACK +#ifdef __cplusplus +#define FT_BASE_CALLBACK( x ) extern "C" x +#define FT_BASE_CALLBACK_DEF( x ) extern "C" x +#else +#define FT_BASE_CALLBACK( x ) extern x +#define FT_BASE_CALLBACK_DEF( x ) x +#endif +#endif /* FT_BASE_CALLBACK */ + #ifndef FT_CALLBACK_TABLE #ifdef __cplusplus #define FT_CALLBACK_TABLE extern "C" diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h index d491af57c..702f77cc4 100644 --- a/include/freetype/config/ftheader.h +++ b/include/freetype/config/ftheader.h @@ -4,7 +4,7 @@ /* */ /* Build macros of the FreeType 2 library. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -315,6 +315,19 @@ #define FT_RENDER_H + /************************************************************************* + * + * @macro: + * FT_DRIVER_H + * + * @description: + * A macro used in #include statements to name the file containing + * structures and macros related to the driver modules. + * + */ +#define FT_DRIVER_H + + /************************************************************************* * * @macro: @@ -324,8 +337,10 @@ * A macro used in #include statements to name the file containing * structures and macros related to the auto-hinting module. * + * Deprecated since version 2.9; use @FT_DRIVER_H instead. + * */ -#define FT_AUTOHINTER_H +#define FT_AUTOHINTER_H FT_DRIVER_H /************************************************************************* @@ -337,8 +352,10 @@ * A macro used in #include statements to name the file containing * structures and macros related to the CFF driver module. * + * Deprecated since version 2.9; use @FT_DRIVER_H instead. + * */ -#define FT_CFF_DRIVER_H +#define FT_CFF_DRIVER_H FT_DRIVER_H /************************************************************************* @@ -350,8 +367,10 @@ * A macro used in #include statements to name the file containing * structures and macros related to the TrueType driver module. * + * Deprecated since version 2.9; use @FT_DRIVER_H instead. + * */ -#define FT_TRUETYPE_DRIVER_H +#define FT_TRUETYPE_DRIVER_H FT_DRIVER_H /************************************************************************* @@ -363,8 +382,10 @@ * A macro used in #include statements to name the file containing * structures and macros related to the PCF driver module. * + * Deprecated since version 2.9; use @FT_DRIVER_H instead. + * */ -#define FT_PCF_DRIVER_H +#define FT_PCF_DRIVER_H FT_DRIVER_H /************************************************************************* @@ -554,63 +575,6 @@ #define FT_CACHE_H - /************************************************************************* - * - * @macro: - * FT_CACHE_IMAGE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * `glyph image' API of the FreeType~2 cache sub-system. - * - * It is used to define a cache for @FT_Glyph elements. You can also - * use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to - * store small glyph bitmaps, as it will use less memory. - * - * This macro is deprecated. Simply include @FT_CACHE_H to have all - * glyph image-related cache declarations. - * - */ -#define FT_CACHE_IMAGE_H FT_CACHE_H - - - /************************************************************************* - * - * @macro: - * FT_CACHE_SMALL_BITMAPS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * `small bitmaps' API of the FreeType~2 cache sub-system. - * - * It is used to define a cache for small glyph bitmaps in a relatively - * memory-efficient way. You can also use the API defined in - * @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images, - * including scalable outlines. - * - * This macro is deprecated. Simply include @FT_CACHE_H to have all - * small bitmaps-related cache declarations. - * - */ -#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H - - - /************************************************************************* - * - * @macro: - * FT_CACHE_CHARMAP_H - * - * @description: - * A macro used in #include statements to name the file containing the - * `charmap' API of the FreeType~2 cache sub-system. - * - * This macro is deprecated. Simply include @FT_CACHE_H to have all - * charmap-based cache declarations. - * - */ -#define FT_CACHE_CHARMAP_H FT_CACHE_H - - /************************************************************************* * * @macro: @@ -760,17 +724,6 @@ #define FT_LCD_FILTER_H - /************************************************************************* - * - * @macro: - * FT_UNPATENTED_HINTING_H - * - * @description: - * Deprecated. - */ -#define FT_UNPATENTED_HINTING_H - - /************************************************************************* * * @macro: @@ -809,25 +762,30 @@ /* */ + /* These header files don't need to be included by the user. */ #define FT_ERROR_DEFINITIONS_H +#define FT_PARAMETER_TAGS_H + /* Deprecated macros. */ +#define FT_UNPATENTED_HINTING_H +#define FT_TRUETYPE_UNPATENTED_H + + /* FT_CACHE_H is the only header file needed for the cache subsystem. */ +#define FT_CACHE_IMAGE_H FT_CACHE_H +#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H +#define FT_CACHE_CHARMAP_H FT_CACHE_H /* The internals of the cache sub-system are no longer exposed. We */ /* default to FT_CACHE_H at the moment just in case, but we know of */ /* no rogue client that uses them. */ /* */ -#define FT_CACHE_MANAGER_H -#define FT_CACHE_INTERNAL_MRU_H -#define FT_CACHE_INTERNAL_MANAGER_H -#define FT_CACHE_INTERNAL_CACHE_H -#define FT_CACHE_INTERNAL_GLYPH_H -#define FT_CACHE_INTERNAL_IMAGE_H -#define FT_CACHE_INTERNAL_SBITS_H - - -#define FT_INCREMENTAL_H - -#define FT_TRUETYPE_UNPATENTED_H +#define FT_CACHE_MANAGER_H FT_CACHE_H +#define FT_CACHE_INTERNAL_MRU_H FT_CACHE_H +#define FT_CACHE_INTERNAL_MANAGER_H FT_CACHE_H +#define FT_CACHE_INTERNAL_CACHE_H FT_CACHE_H +#define FT_CACHE_INTERNAL_GLYPH_H FT_CACHE_H +#define FT_CACHE_INTERNAL_IMAGE_H FT_CACHE_H +#define FT_CACHE_INTERNAL_SBITS_H FT_CACHE_H /* diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 46457b682..4bcab2af5 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -4,7 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -75,19 +75,21 @@ FT_BEGIN_HEADER /*************************************************************************/ - /*************************************************************************/ + /*#***********************************************************************/ /* */ /* If you enable this configuration option, FreeType recognizes an */ /* environment variable called `FREETYPE_PROPERTIES', which can be used */ /* to control the various font drivers and modules. The controllable */ - /* properties are listed in the section `Controlling FreeType Modules' */ - /* in the reference's table of contents; currently there are properties */ - /* for the auto-hinter (file `ftautoh.h'), CFF (file `ftcffdrv.h'), */ - /* TrueType (file `ftttdrv.h'), and PCF (file `ftpcfdrv.h'). */ + /* properties are listed in the section @properties. */ + /* */ + /* You have to undefine this configuration option on platforms that lack */ + /* the concept of environment variables (and thus don't have the */ + /* `getenv' function), for example Windows CE. */ /* */ /* `FREETYPE_PROPERTIES' has the following syntax form (broken here into */ /* multiple lines for better readability). */ /* */ + /* { */ /* */ /* ':' */ /* '=' */ @@ -95,6 +97,7 @@ FT_BEGIN_HEADER /* ':' */ /* '=' */ /* ... */ + /* } */ /* */ /* Example: */ /* */ @@ -211,6 +214,10 @@ FT_BEGIN_HEADER /* Do not #undef this macro here since the build system might define */ /* it for certain configurations only. */ /* */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ + /* */ /* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */ @@ -227,6 +234,10 @@ FT_BEGIN_HEADER /* */ /* Define this macro if you want to enable this `feature'. */ /* */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ + /* */ /* #define FT_CONFIG_OPTION_USE_BZIP2 */ @@ -252,6 +263,10 @@ FT_BEGIN_HEADER /* */ /* Define this macro if you want to enable this `feature'. */ /* */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ + /* */ /* #define FT_CONFIG_OPTION_USE_PNG */ @@ -265,49 +280,11 @@ FT_BEGIN_HEADER /* */ /* Define this macro if you want to enable this `feature'. */ /* */ -/* #define FT_CONFIG_OPTION_USE_HARFBUZZ */ - - - /*************************************************************************/ - /* */ - /* DLL export compilation */ - /* */ - /* When compiling FreeType as a DLL, some systems/compilers need a */ - /* special keyword in front OR after the return type of function */ - /* declarations. */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ /* */ - /* Two macros are used within the FreeType source code to define */ - /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ - /* */ - /* FT_EXPORT( return_type ) */ - /* */ - /* is used in a function declaration, as in */ - /* */ - /* FT_EXPORT( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ); */ - /* */ - /* */ - /* FT_EXPORT_DEF( return_type ) */ - /* */ - /* is used in a function definition, as in */ - /* */ - /* FT_EXPORT_DEF( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ) */ - /* { */ - /* ... some code ... */ - /* return FT_Err_Ok; */ - /* } */ - /* */ - /* You can provide your own implementation of FT_EXPORT and */ - /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */ - /* will be later automatically defined as `extern return_type' to */ - /* allow normal compilation. */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_EXPORT(x) extern x */ -/* #define FT_EXPORT_DEF(x) x */ +/* #define FT_CONFIG_OPTION_USE_HARFBUZZ */ /*************************************************************************/ @@ -324,7 +301,7 @@ FT_BEGIN_HEADER /* */ /* - The TrueType driver will provide its own set of glyph names, */ /* if you build it to support postscript names in the TrueType */ - /* `post' table. */ + /* `post' table, but will not synthesize a missing Unicode charmap. */ /* */ /* - The Type 1 driver will not be able to synthesize a Unicode */ /* charmap out of the glyphs found in the fonts. */ @@ -678,7 +655,7 @@ FT_BEGIN_HEADER /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */ /* defined. */ /* */ - /* [1] http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ + /* [1] https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ /* */ /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */ #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 @@ -698,7 +675,7 @@ FT_BEGIN_HEADER /* composite flags array which can be used to disambiguate, but old */ /* fonts will not have them. */ /* */ - /* http://www.microsoft.com/typography/otspec/glyf.htm */ + /* https://www.microsoft.com/typography/otspec/glyf.htm */ /* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html */ /* */ #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED @@ -795,6 +772,16 @@ FT_BEGIN_HEADER #undef T1_CONFIG_OPTION_NO_MM_SUPPORT + /*************************************************************************/ + /* */ + /* T1_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe Type 1 */ + /* engine gets compiled into FreeType. If defined, it is possible to */ + /* switch between the two engines using the `hinting-engine' property of */ + /* the type1 driver module. */ + /* */ +/* #define T1_CONFIG_OPTION_OLD_ENGINE */ + + /*************************************************************************/ /*************************************************************************/ /**** ****/ @@ -810,8 +797,8 @@ FT_BEGIN_HEADER /* possible to set up the default values of the four control points that */ /* define the stem darkening behaviour of the (new) CFF engine. For */ /* more details please read the documentation of the */ - /* `darkening-parameters' property of the cff driver module (file */ - /* `ftcffdrv.h'), which allows the control at run-time. */ + /* `darkening-parameters' property (file `ftdriver.h'), which allows the */ + /* control at run-time. */ /* */ /* Do *not* undefine these macros! */ /* */ @@ -883,7 +870,9 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ - /* Compile autofit module with Indic script support. */ + /* Compile autofit module with fallback Indic script support, covering */ + /* some scripts that the `latin' submodule of the autofit module doesn't */ + /* (yet) handle. */ /* */ #define AF_CONFIG_OPTION_INDIC @@ -897,11 +886,31 @@ FT_BEGIN_HEADER /* */ /* This experimental option is active only if the rendering mode is */ /* FT_RENDER_MODE_LIGHT; you can switch warping on and off with the */ - /* `warping' property of the auto-hinter (see file `ftautoh.h' for more */ + /* `warping' property of the auto-hinter (see file `ftdriver.h' for more */ /* information; by default it is switched off). */ /* */ #define AF_CONFIG_OPTION_USE_WARPER + /*************************************************************************/ + /* */ + /* Use TrueType-like size metrics for `light' auto-hinting. */ + /* */ + /* It is strongly recommended to avoid this option, which exists only to */ + /* help some legacy applications retain its appearance and behaviour */ + /* with respect to auto-hinted TrueType fonts. */ + /* */ + /* The very reason this option exists at all are GNU/Linux distributions */ + /* like Fedora that did not un-patch the following change (which was */ + /* present in FreeType between versions 2.4.6 and 2.7.1, inclusive). */ + /* */ + /* 2011-07-16 Steven Chu */ + /* */ + /* [truetype] Fix metrics on size request for scalable fonts. */ + /* */ + /* This problematic commit is now reverted (more or less). */ + /* */ +/* #define AF_CONFIG_OPTION_TT_SIZE_METRICS */ + /* */ @@ -919,6 +928,7 @@ FT_BEGIN_HEADER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #define TT_USE_BYTECODE_INTERPRETER +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING #if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 1 #define TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY #endif @@ -926,6 +936,7 @@ FT_BEGIN_HEADER #if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 2 #define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL #endif +#endif #endif diff --git a/include/freetype/config/ftstdlib.h b/include/freetype/config/ftstdlib.h index 05a4845fd..42f9a06e4 100644 --- a/include/freetype/config/ftstdlib.h +++ b/include/freetype/config/ftstdlib.h @@ -5,7 +5,7 @@ /* ANSI-specific library and header configuration file (specification */ /* only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 8a291f6cd..008335cfa 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -4,7 +4,7 @@ /* */ /* FreeType high-level API and common types (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -138,6 +138,7 @@ FT_BEGIN_HEADER /* FT_FACE_FLAG_TRICKY */ /* FT_FACE_FLAG_KERNING */ /* FT_FACE_FLAG_MULTIPLE_MASTERS */ + /* FT_FACE_FLAG_VARIATION */ /* FT_FACE_FLAG_GLYPH_NAMES */ /* FT_FACE_FLAG_EXTERNAL_STREAM */ /* FT_FACE_FLAG_HINTER */ @@ -147,14 +148,16 @@ FT_BEGIN_HEADER /* FT_HAS_KERNING */ /* FT_HAS_FIXED_SIZES */ /* FT_HAS_GLYPH_NAMES */ - /* FT_HAS_MULTIPLE_MASTERS */ /* FT_HAS_COLOR */ + /* FT_HAS_MULTIPLE_MASTERS */ /* */ /* FT_IS_SFNT */ /* FT_IS_SCALABLE */ /* FT_IS_FIXED_WIDTH */ /* FT_IS_CID_KEYED */ /* FT_IS_TRICKY */ + /* FT_IS_NAMED_INSTANCE */ + /* FT_IS_VARIATION */ /* */ /* FT_STYLE_FLAG_BOLD */ /* FT_STYLE_FLAG_ITALIC */ @@ -575,7 +578,8 @@ FT_BEGIN_HEADER /* */ /* When a new face is created (either through @FT_New_Face or */ /* @FT_Open_Face), the library looks for a Unicode charmap within */ - /* the list and automatically activates it. */ + /* the list and automatically activates it. If there is no Unicode */ + /* charmap, FreeType doesn't set an `active' charmap. */ /* */ /* */ /* See @FT_CharMapRec for the publicly accessible fields of a given */ @@ -647,7 +651,7 @@ FT_BEGIN_HEADER /* FT_ENCODING_MS_SYMBOL :: */ /* Microsoft Symbol encoding, used to encode mathematical symbols */ /* and wingdings. For more information, see */ - /* `http://www.microsoft.com/typography/otspec/recom.htm', */ + /* `https://www.microsoft.com/typography/otspec/recom.htm', */ /* `http://www.kostis.net/charsets/symbol.htm', and */ /* `http://www.kostis.net/charsets/wingding.htm'. */ /* */ @@ -656,7 +660,7 @@ FT_BEGIN_HEADER /* */ /* FT_ENCODING_SJIS :: */ /* Shift JIS encoding for Japanese. More info at */ - /* `http://en.wikipedia.org/wiki/Shift_JIS'. See note on */ + /* `https://en.wikipedia.org/wiki/Shift_JIS'. See note on */ /* multi-byte encodings below. */ /* */ /* FT_ENCODING_PRC :: */ @@ -672,7 +676,7 @@ FT_BEGIN_HEADER /* Corresponds to the Korean encoding system known as Extended */ /* Wansung (MS Windows code page 949). */ /* For more information see */ - /* `http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'. */ + /* `https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'. */ /* */ /* FT_ENCODING_JOHAB :: */ /* The Korean standard character set (KS~C 5601-1992), which */ @@ -720,11 +724,12 @@ FT_BEGIN_HEADER /* Same as FT_ENCODING_JOHAB. Deprecated. */ /* */ /* */ - /* By default, FreeType automatically synthesizes a Unicode charmap */ - /* for PostScript fonts, using their glyph name dictionaries. */ - /* However, it also reports the encodings defined explicitly in the */ - /* font file, for the cases when they are needed, with the Adobe */ - /* values as well. */ + /* By default, FreeType enables a Unicode charmap and tags it with */ + /* FT_ENCODING_UNICODE when it is either provided or can be generated */ + /* from PostScript glyph name dictionaries in the font file. */ + /* All other encodings are considered legacy and tagged only if */ + /* explicitly defined in the font file. Otherwise, FT_ENCODING_NONE */ + /* is used. */ /* */ /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */ /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */ @@ -748,7 +753,7 @@ FT_BEGIN_HEADER /* @FT_Get_CMap_Language_ID to query the Mac language ID that may */ /* be needed to be able to distinguish Apple encoding variants. See */ /* */ - /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */ + /* https://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */ /* */ /* to get an idea how to do that. Basically, if the language ID */ /* is~0, don't use it, otherwise subtract 1 from the language ID. */ @@ -771,7 +776,7 @@ FT_BEGIN_HEADER FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ), FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ), - /* for backwards compatibility */ + /* for backward compatibility */ FT_ENCODING_GB2312 = FT_ENCODING_PRC, FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS, FT_ENCODING_MS_GB2312 = FT_ENCODING_PRC, @@ -826,8 +831,8 @@ FT_BEGIN_HEADER /* */ /* platform_id :: An ID number describing the platform for the */ /* following encoding ID. This comes directly from */ - /* the TrueType specification gets emulated */ - /* for other formats. */ + /* the TrueType specification and gets emulated for */ + /* other formats. */ /* */ /* encoding_id :: A platform specific encoding number. This also */ /* comes from the TrueType specification and gets */ @@ -887,34 +892,41 @@ FT_BEGIN_HEADER /* are set to~0 if there is only one face in */ /* the font file. */ /* */ - /* Bits 16-30 are relevant to GX and OpenType */ - /* variation fonts only, holding the named */ - /* instance index for the current face index */ - /* (starting with value~1; value~0 indicates */ - /* font access without variation data). For */ - /* non-variation fonts, bits 16-30 are */ - /* ignored. If we have the third named */ - /* instance of face~4, say, `face_index' is */ - /* set to 0x00030004. */ + /* [Since 2.6.1] Bits 16-30 are relevant to GX */ + /* and OpenType variation fonts only, holding */ + /* the named instance index for the current */ + /* face index (starting with value~1; value~0 */ + /* indicates font access without a named */ + /* instance). For non-variation fonts, bits */ + /* 16-30 are ignored. If we have the third */ + /* named instance of face~4, say, `face_index' */ + /* is set to 0x00030004. */ /* */ /* Bit 31 is always zero (this is, */ /* `face_index' is always a positive value). */ /* */ + /* [Since 2.9] Changing the design coordinates */ + /* with @FT_Set_Var_Design_Coordinates or */ + /* @FT_Set_Var_Blend_Coordinates does not */ + /* influence the named instance index value */ + /* (only @FT_Set_Named_Instance does that). */ + /* */ /* face_flags :: A set of bit flags that give important */ /* information about the face; see */ /* @FT_FACE_FLAG_XXX for the details. */ /* */ /* style_flags :: The lower 16~bits contain a set of bit */ /* flags indicating the style of the face; see */ - /* @FT_STYLE_FLAG_XXX for the details. Bits */ - /* 16-30 hold the number of named instances */ - /* available for the current face if we have a */ - /* GX or OpenType variation (sub)font. Bit 31 */ - /* is always zero (this is, `style_flags' is */ - /* always a positive value). Note that a */ - /* variation font has always at least one */ - /* named instance, namely the default */ - /* instance. */ + /* @FT_STYLE_FLAG_XXX for the details. */ + /* */ + /* [Since 2.6.1] Bits 16-30 hold the number */ + /* of named instances available for the */ + /* current face if we have a GX or OpenType */ + /* variation (sub)font. Bit 31 is always zero */ + /* (this is, `style_flags' is always a */ + /* positive value). Note that a variation */ + /* font has always at least one named */ + /* instance, namely the default instance. */ /* */ /* num_glyphs :: The number of glyphs in the face. If the */ /* face is scalable and has sbits (see */ @@ -1051,6 +1063,9 @@ FT_BEGIN_HEADER /* `descender', `height', `underline_position', and */ /* `underline_thickness'. */ /* */ + /* Especially for TrueType fonts see also the documentation for */ + /* @FT_Size_Metrics. */ + /* */ typedef struct FT_FaceRec_ { FT_Long num_faces; @@ -1161,7 +1176,7 @@ FT_BEGIN_HEADER /* interpolating between them. Supported formats are Adobe MM, */ /* TrueType GX, and OpenType variation fonts. */ /* */ - /* See the multiple-masters specific API for details. */ + /* See section @multiple_masters for API details. */ /* */ /* FT_FACE_FLAG_GLYPH_NAMES :: */ /* The face contains glyph names, which can be retrieved using */ @@ -1211,8 +1226,15 @@ FT_BEGIN_HEADER /* tricky fonts; they are hard-coded in file `ttobjs.c'. */ /* */ /* FT_FACE_FLAG_COLOR :: */ - /* The face has color glyph tables. To access color glyphs use */ - /* @FT_LOAD_COLOR. */ + /* [Since 2.5.1] The face has color glyph tables. To access color */ + /* glyphs use @FT_LOAD_COLOR. */ + /* */ + /* FT_FACE_FLAG_VARIATION :: */ + /* [Since 2.9] Set if the current face (or named instance) has been */ + /* altered with @FT_Set_MM_Design_Coordinates, */ + /* @FT_Set_Var_Design_Coordinates, or */ + /* @FT_Set_Var_Blend_Coordinates. This flag is unset by a call to */ + /* @FT_Set_Named_Instance. */ /* */ #define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) @@ -1229,6 +1251,7 @@ FT_BEGIN_HEADER #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 ) #define FT_FACE_FLAG_TRICKY ( 1L << 13 ) #define FT_FACE_FLAG_COLOR ( 1L << 14 ) +#define FT_FACE_FLAG_VARIATION ( 1L << 15 ) /************************************************************************* @@ -1390,11 +1413,37 @@ FT_BEGIN_HEADER * A macro that returns true whenever a face object is a named instance * of a GX or OpenType variation font. * + * [Since 2.9] Changing the design coordinates with + * @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does + * not influence the return value of this macro (only + * @FT_Set_Named_Instance does that). + * + * @since: + * 2.7 + * */ #define FT_IS_NAMED_INSTANCE( face ) \ ( (face)->face_index & 0x7FFF0000L ) + /************************************************************************* + * + * @macro: + * FT_IS_VARIATION( face ) + * + * @description: + * A macro that returns true whenever a face object has been altered + * by @FT_Set_MM_Design_Coordinates, @FT_Set_Var_Design_Coordinates, or + * @FT_Set_Var_Blend_Coordinates. + * + * @since: + * 2.9 + * + */ +#define FT_IS_VARIATION( face ) \ + ( (face)->face_flags & FT_FACE_FLAG_VARIATION ) + + /************************************************************************* * * @macro: @@ -1436,6 +1485,9 @@ FT_BEGIN_HEADER * A macro that returns true whenever a face object contains * tables for color glyphs. * + * @since: + * 2.5.1 + * */ #define FT_HAS_COLOR( face ) \ ( (face)->face_flags & FT_FACE_FLAG_COLOR ) @@ -1506,27 +1558,40 @@ FT_BEGIN_HEADER /* fractional pixels. Only relevant for scalable */ /* font formats. */ /* */ - /* ascender :: The ascender in 26.6 fractional pixels. See */ - /* @FT_FaceRec for the details. */ + /* ascender :: The ascender in 26.6 fractional pixels, rounded up */ + /* to an integer value. See @FT_FaceRec for the */ + /* details. */ /* */ - /* descender :: The descender in 26.6 fractional pixels. See */ - /* @FT_FaceRec for the details. */ + /* descender :: The descender in 26.6 fractional pixels, rounded */ + /* down to an integer value. See @FT_FaceRec for the */ + /* details. */ /* */ - /* height :: The height in 26.6 fractional pixels. See */ - /* @FT_FaceRec for the details. */ + /* height :: The height in 26.6 fractional pixels, rounded to */ + /* an integer value. See @FT_FaceRec for the */ + /* details. */ /* */ /* max_advance :: The maximum advance width in 26.6 fractional */ - /* pixels. See @FT_FaceRec for the details. */ + /* pixels, rounded to an integer value. See */ + /* @FT_FaceRec for the details. */ /* */ /* */ /* The scaling values, if relevant, are determined first during a */ /* size changing operation. The remaining fields are then set by the */ /* driver. For scalable formats, they are usually set to scaled */ - /* values of the corresponding fields in @FT_FaceRec. */ + /* values of the corresponding fields in @FT_FaceRec. Some values */ + /* like ascender or descender are rounded for historical reasons; */ + /* more precise values (for outline fonts) can be derived by scaling */ + /* the corresponding @FT_FaceRec values manually, with code similar */ + /* to the following. */ + /* */ + /* { */ + /* scaled_ascender = FT_MulFix( face->ascender, */ + /* size_metrics->y_scale ); */ + /* } */ /* */ - /* Note that due to glyph hinting, these values might not be exact */ - /* for certain fonts. Thus they must be treated as unreliable */ - /* with an error margin of at least one pixel! */ + /* Note that due to glyph hinting and the selected rendering mode */ + /* these values are usually not exact; consequently, they must be */ + /* treated as unreliable with an error margin of at least one pixel! */ /* */ /* Indeed, the only way to get the exact metrics is to render _all_ */ /* glyphs. As this would be a definite performance hit, it is up to */ @@ -1534,6 +1599,43 @@ FT_BEGIN_HEADER /* */ /* The `FT_Size_Metrics' structure is valid for bitmap fonts also. */ /* */ + /* */ + /* *TrueType* *fonts* *with* *native* *bytecode* *hinting* */ + /* */ + /* All applications that handle TrueType fonts with native hinting */ + /* must be aware that TTFs expect different rounding of vertical font */ + /* dimensions. The application has to cater for this, especially if */ + /* it wants to rely on a TTF's vertical data (for example, to */ + /* properly align box characters vertically). */ + /* */ + /* Only the application knows _in_ _advance_ that it is going to use */ + /* native hinting for TTFs! FreeType, on the other hand, selects the */ + /* hinting mode not at the time of creating an @FT_Size object but */ + /* much later, namely while calling @FT_Load_Glyph. */ + /* */ + /* Here is some pseudo code that illustrates a possible solution. */ + /* */ + /* { */ + /* font_format = FT_Get_Font_Format( face ); */ + /* */ + /* if ( !strcmp( font_format, "TrueType" ) && */ + /* do_native_bytecode_hinting ) */ + /* { */ + /* ascender = ROUND( FT_MulFix( face->ascender, */ + /* size_metrics->y_scale ) ); */ + /* descender = ROUND( FT_MulFix( face->descender, */ + /* size_metrics->y_scale ) ); */ + /* } */ + /* else */ + /* { */ + /* ascender = size_metrics->ascender; */ + /* descender = size_metrics->descender; */ + /* } */ + /* */ + /* height = size_metrics->height; */ + /* max_advance = size_metrics->max_advance; */ + /* } */ + /* */ typedef struct FT_Size_Metrics_ { FT_UShort x_ppem; /* horizontal pixels per EM */ @@ -1675,17 +1777,13 @@ FT_BEGIN_HEADER /* @FT_GLYPH_FORMAT_COMPOSITE, but other values */ /* are possible. */ /* */ - /* bitmap :: This field is used as a bitmap descriptor */ - /* when the slot format is */ - /* @FT_GLYPH_FORMAT_BITMAP. Note that the */ - /* address and content of the bitmap buffer can */ - /* change between calls of @FT_Load_Glyph and a */ - /* few other functions. */ + /* bitmap :: This field is used as a bitmap descriptor. */ + /* Note that the address and content of the */ + /* bitmap buffer can change between calls of */ + /* @FT_Load_Glyph and a few other functions. */ /* */ /* bitmap_left :: The bitmap's left bearing expressed in */ - /* integer pixels. Only valid if the format is */ - /* @FT_GLYPH_FORMAT_BITMAP, this is, if the */ - /* glyph slot contains a bitmap. */ + /* integer pixels. */ /* */ /* bitmap_top :: The bitmap's top bearing expressed in integer */ /* pixels. This is the distance from the */ @@ -1732,7 +1830,9 @@ FT_BEGIN_HEADER /* If @FT_Load_Glyph is called with default flags (see */ /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */ /* its native format (e.g., an outline glyph for TrueType and Type~1 */ - /* formats). */ + /* formats). [Since 2.9] The prospective bitmap metrics are */ + /* calculated according to @FT_LOAD_TARGET_XXX and other flags even */ + /* for the outline glyph, even if @FT_LOAD_RENDER is not set. */ /* */ /* This image can later be converted into a bitmap by calling */ /* @FT_Render_Glyph. This function searches the current renderer for */ @@ -1748,11 +1848,37 @@ FT_BEGIN_HEADER /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */ /* */ /* Here is a small pseudo code fragment that shows how to use */ - /* `lsb_delta' and `rsb_delta': */ + /* `lsb_delta' and `rsb_delta' to do fractional positioning of */ + /* glyphs: */ + /* */ + /* { */ + /* FT_GlyphSlot slot = face->glyph; */ + /* FT_Pos origin_x = 0; */ + /* */ + /* */ + /* for all glyphs do */ + /* */ + /* */ + /* FT_Outline_Translate( slot->outline, origin_x & 63, 0 ); */ + /* */ + /* */ + /* */ + /* */ + /* */ + /* origin_x += slot->advance.x; */ + /* origin_x += slot->rsb_delta - slot->lsb_delta; */ + /* endfor */ + /* } */ + /* */ + /* Here is another small pseudo code fragment that shows how to use */ + /* `lsb_delta' and `rsb_delta' to improve integer positioning of */ + /* glyphs: */ /* */ /* { */ - /* FT_Pos origin_x = 0; */ - /* FT_Pos prev_rsb_delta = 0; */ + /* FT_GlyphSlot slot = face->glyph; */ + /* FT_Pos origin_x = 0; */ + /* FT_Pos prev_rsb_delta = 0; */ /* */ /* */ /* for all glyphs do */ @@ -1761,16 +1887,16 @@ FT_BEGIN_HEADER /* */ /* */ /* */ - /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */ + /* if ( prev_rsb_delta - slot->lsb_delta > 32 ) */ /* origin_x -= 64; */ - /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */ + /* else if ( prev_rsb_delta - slot->lsb_delta < -31 ) */ /* origin_x += 64; */ /* */ - /* prev_rsb_delta = face->glyph->rsb_delta; */ + /* prev_rsb_delta = slot->rsb_delta; */ /* */ /* */ /* */ - /* origin_x += face->glyph->advance.x; */ + /* origin_x += slot->advance.x; */ /* endfor */ /* } */ /* */ @@ -1855,8 +1981,8 @@ FT_BEGIN_HEADER /* */ /* If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is */ /* set, this function reads the `FREETYPE_PROPERTIES' environment */ - /* variable to control driver properties. See sections @auto_hinter, */ - /* @cff_driver, @pcf_driver, and @tt_driver for more. */ + /* variable to control driver properties. See section @properties */ + /* for more. */ /* */ FT_EXPORT( FT_Error ) FT_Init_FreeType( FT_Library *alibrary ); @@ -1937,8 +2063,8 @@ FT_BEGIN_HEADER /* data :: A pointer to the parameter data. */ /* */ /* */ - /* The ID and function of parameters are driver-specific. See the */ - /* various FT_PARAM_TAG_XXX flags for more information. */ + /* The ID and function of parameters are driver-specific. See */ + /* section @parameter_tags for more information. */ /* */ typedef struct FT_Parameter_ { @@ -2004,7 +2130,7 @@ FT_BEGIN_HEADER /* `num_params' and `params' is used. They are ignored otherwise. */ /* */ /* Ideally, both the `pathname' and `params' fields should be tagged */ - /* as `const'; this is missing for API backwards compatibility. In */ + /* as `const'; this is missing for API backward compatibility. In */ /* other words, applications should treat them as read-only. */ /* */ typedef struct FT_Open_Args_ @@ -2115,14 +2241,14 @@ FT_BEGIN_HEADER /* with value~0). Set it to~0 if there is only one */ /* face in the font file. */ /* */ - /* Bits 16-30 are relevant to GX and OpenType variation */ - /* fonts only, specifying the named instance index for */ - /* the current face index (starting with value~1; */ - /* value~0 makes FreeType ignore named instances). For */ - /* non-variation fonts, bits 16-30 are ignored. */ - /* Assuming that you want to access the third named */ - /* instance in face~4, `face_index' should be set to */ - /* 0x00030004. If you want to access face~4 without */ + /* [Since 2.6.1] Bits 16-30 are relevant to GX and */ + /* OpenType variation fonts only, specifying the named */ + /* instance index for the current face index (starting */ + /* with value~1; value~0 makes FreeType ignore named */ + /* instances). For non-variation fonts, bits 16-30 are */ + /* ignored. Assuming that you want to access the third */ + /* named instance in face~4, `face_index' should be set */ + /* to 0x00030004. If you want to access face~4 without */ /* variation handling, simply set `face_index' to */ /* value~4. */ /* */ @@ -2540,6 +2666,10 @@ FT_BEGIN_HEADER /* glyph relative to this size. For more information refer to */ /* `https://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html'. */ /* */ + /* Contrary to @FT_Set_Char_Size, this function doesn't have special */ + /* code to normalize zero-valued widths, heights, or resolutions */ + /* (which lead to errors in most cases). */ + /* */ /* Don't use this function if you are using the FreeType cache API. */ /* */ FT_EXPORT( FT_Error ) @@ -2704,6 +2834,10 @@ FT_BEGIN_HEADER /* since its glyph indices are not listed in any of the font's */ /* charmaps. */ /* */ + /* If no active cmap is set up (i.e., `face->charmap' is zero), the */ + /* call to @FT_Get_Char_Index is omitted, and the function behaves */ + /* identically to @FT_Load_Glyph. */ + /* */ FT_EXPORT( FT_Error ) FT_Load_Char( FT_Face face, FT_ULong char_code, @@ -2825,26 +2959,26 @@ FT_BEGIN_HEADER * Disable the auto-hinter. See also the note below. * * FT_LOAD_COLOR :: - * Load embedded color bitmap images. The resulting color bitmaps, - * if available, will have the @FT_PIXEL_MODE_BGRA format. If the - * flag is not set and color bitmaps are found, they are converted - * to 256-level gray bitmaps transparently, using the + * [Since 2.5] Load embedded color bitmap images. The resulting color + * bitmaps, if available, will have the @FT_PIXEL_MODE_BGRA format. + * If the flag is not set and color bitmaps are found, they are + * converted to 256-level gray bitmaps transparently, using the * @FT_PIXEL_MODE_GRAY format. * * FT_LOAD_COMPUTE_METRICS :: - * Compute glyph metrics from the glyph data, without the use of - * bundled metrics tables (for example, the `hdmx' table in TrueType - * fonts). This flag is mainly used by font validating or font - * editing applications, which need to ignore, verify, or edit those - * tables. + * [Since 2.6.1] Compute glyph metrics from the glyph data, without + * the use of bundled metrics tables (for example, the `hdmx' table in + * TrueType fonts). This flag is mainly used by font validating or + * font editing applications, which need to ignore, verify, or edit + * those tables. * * Currently, this flag is only implemented for TrueType fonts. * * FT_LOAD_BITMAP_METRICS_ONLY :: - * Request loading of the metrics and bitmap image information of a - * (possibly embedded) bitmap glyph without allocating or copying - * the bitmap image data itself. No effect if the target glyph is - * not a bitmap image. + * [Since 2.7.1] Request loading of the metrics and bitmap image + * information of a (possibly embedded) bitmap glyph without + * allocating or copying the bitmap image data itself. No effect if + * the target glyph is not a bitmap image. * * This flag unsets @FT_LOAD_RENDER. * @@ -2928,12 +3062,22 @@ FT_BEGIN_HEADER * A lighter hinting algorithm for gray-level modes. Many generated * glyphs are fuzzier but better resemble their original shape. This * is achieved by snapping glyphs to the pixel grid only vertically - * (Y-axis), as is done by Microsoft's ClearType and Adobe's - * proprietary font renderer. This preserves inter-glyph spacing in + * (Y-axis), as is done by FreeType's new CFF engine or Microsoft's + * ClearType font renderer. This preserves inter-glyph spacing in * horizontal text. The snapping is done either by the native font * driver, if the driver itself and the font support it, or by the * auto-hinter. * + * Advance widths are rounded to integer values; however, using the + * `lsb_delta' and `rsb_delta' fields of @FT_GlyphSlotRec, it is + * possible to get fractional advance widths for subpixel positioning + * (which is recommended to use). + * + * If configuration option AF_CONFIG_OPTION_TT_SIZE_METRICS is active, + * TrueType-like metrics are used to make this mode behave similarly + * as in unpatched FreeType versions between 2.4.6 and 2.7.1 + * (inclusive). + * * FT_LOAD_TARGET_MONO :: * Strong hinting algorithm that should only be used for monochrome * output. The result is probably unpleasant if the glyph is rendered @@ -2968,6 +3112,13 @@ FT_BEGIN_HEADER * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD ); * } * + * In general, you should stick with one rendering mode. For example, + * switching between @FT_LOAD_TARGET_NORMAL and @FT_LOAD_TARGET_MONO + * enforces a lot of recomputation for TrueType fonts, which is slow. + * Another reason is caching: Selecting a different mode usually causes + * changes in both the outlines and the rasterized bitmaps; it is thus + * necessary to empty the cache after a mode switch to avoid false hits. + * */ #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 ) @@ -3058,13 +3209,13 @@ FT_BEGIN_HEADER /* opacity). */ /* */ /* FT_RENDER_MODE_LCD :: */ - /* This mode corresponds to horizontal RGB and BGR sub-pixel */ + /* This mode corresponds to horizontal RGB and BGR subpixel */ /* displays like LCD screens. It produces 8-bit bitmaps that are */ /* 3~times the width of the original glyph outline in pixels, and */ /* which use the @FT_PIXEL_MODE_LCD mode. */ /* */ /* FT_RENDER_MODE_LCD_V :: */ - /* This mode corresponds to vertical RGB and BGR sub-pixel displays */ + /* This mode corresponds to vertical RGB and BGR subpixel displays */ /* (like PDA screens, rotated LCD displays, etc.). It produces */ /* 8-bit bitmaps that are 3~times the height of the original */ /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */ @@ -3152,7 +3303,7 @@ FT_BEGIN_HEADER /* this does not translate to 50% brightness for that pixel on our */ /* sRGB and gamma~2.2 screens. Due to their non-linearity, they */ /* dwell longer in the darks and only a pixel value of about 186 */ - /* results in 50% brightness – 128 ends up too dark on both bright */ + /* results in 50% brightness -- 128 ends up too dark on both bright */ /* and dark backgrounds. The net result is that dark text looks */ /* burnt-out, pixely and blotchy on bright background, bright text */ /* too frail on dark backgrounds, and colored text on colored */ @@ -3405,6 +3556,20 @@ FT_BEGIN_HEADER /* The returned pointer is owned by the face and is destroyed with */ /* it. */ /* */ + /* For variation fonts, this string changes if you select a different */ + /* instance, and you have to call `FT_Get_PostScript_Name' again to */ + /* retrieve it. FreeType follows Adobe TechNote #5902, `Generating */ + /* PostScript Names for Fonts Using OpenType Font Variations'. */ + /* */ + /* https://download.macromedia.com/pub/developer/opentype/tech-notes/5902.AdobePSNameGeneration.html */ + /* */ + /* [Since 2.9] Special PostScript names for named instances are only */ + /* returned if the named instance is set with @FT_Set_Named_Instance */ + /* (and the font has corresponding entries in its `fvar' table). If */ + /* @FT_IS_VARIATION returns true, the algorithmically derived */ + /* PostScript name is provided, not looking up special entries for */ + /* named instances. */ + /* */ FT_EXPORT( const char* ) FT_Get_Postscript_Name( FT_Face face ); @@ -3634,17 +3799,17 @@ FT_BEGIN_HEADER * Note that only a subset of the available properties can be * controlled. * - * * Stem darkening (@FT_PARAM_TAG_STEM_DARKENING, corresponding to the - * property `no-stem-darkening' provided by the `autofit' and `cff' - * modules; see @no-stem-darkening[autofit] and - * @no-stem-darkening[cff]). + * * @FT_PARAM_TAG_STEM_DARKENING (stem darkening, corresponding to the + * property `no-stem-darkening' provided by the `autofit', `cff', + * `type1', and `t1cid' modules; see @no-stem-darkening). * - * * LCD filter weights (@FT_PARAM_TAG_LCD_FILTER_WEIGHTS, corresponding + * * @FT_PARAM_TAG_LCD_FILTER_WEIGHTS (LCD filter weights, corresponding * to function @FT_Library_SetLcdFilterWeights). * - * * Seed value for the CFF `random' operator - * (@FT_PARAM_TAG_RANDOM_SEED, corresponding to the `random-seed' - * property provided by the `cff' module; see @random-seed). + * * @FT_PARAM_TAG_RANDOM_SEED (seed value for the CFF, Type~1, and CID + * `random' operator, corresponding to the `random-seed' property + * provided by the `cff', `type1', and `t1cid' modules; see + * @random-seed). * * Pass NULL as `data' in @FT_Parameter for a given tag to reset the * option and use the library or module default again. @@ -3707,6 +3872,9 @@ FT_BEGIN_HEADER * FT_Face_Properties( face, 1, &property ); * } * + * @since: + * 2.8 + * */ FT_EXPORT( FT_Error ) FT_Face_Properties( FT_Face face, @@ -3831,7 +3999,7 @@ FT_BEGIN_HEADER /* and subsetting restrictions associated with a font. */ /* */ /* See */ - /* http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */ + /* https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */ /* for more details. */ /* */ /* */ @@ -3931,9 +4099,9 @@ FT_BEGIN_HEADER /* Sequences' (IVS), collected in the `Ideographic Variation */ /* Database' (IVD). */ /* */ - /* http://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt */ - /* http://unicode.org/reports/tr37/ */ - /* http://unicode.org/ivd/ */ + /* https://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt */ + /* https://unicode.org/reports/tr37/ */ + /* https://unicode.org/ivd/ */ /* */ /* To date (January 2017), the character with the most ideographic */ /* variations is U+9089, having 32 such IVS. */ @@ -4268,6 +4436,9 @@ FT_BEGIN_HEADER /* `a' rounded to the nearest 16.16 fixed integer, halfway cases away */ /* from zero. */ /* */ + /* */ + /* The function uses wrap-around arithmetic. */ + /* */ FT_EXPORT( FT_Fixed ) FT_RoundFix( FT_Fixed a ); @@ -4286,6 +4457,9 @@ FT_BEGIN_HEADER /* */ /* `a' rounded towards plus infinity. */ /* */ + /* */ + /* The function uses wrap-around arithmetic. */ + /* */ FT_EXPORT( FT_Fixed ) FT_CeilFix( FT_Fixed a ); @@ -4382,8 +4556,8 @@ FT_BEGIN_HEADER * */ #define FREETYPE_MAJOR 2 -#define FREETYPE_MINOR 7 -#define FREETYPE_PATCH 1 +#define FREETYPE_MINOR 9 +#define FREETYPE_PATCH 0 /*************************************************************************/ diff --git a/include/freetype/ftadvanc.h b/include/freetype/ftadvanc.h index dea96e0db..f78e8b1a9 100644 --- a/include/freetype/ftadvanc.h +++ b/include/freetype/ftadvanc.h @@ -4,7 +4,7 @@ /* */ /* Quick computation of advance widths (specification only). */ /* */ -/* Copyright 2008-2017 by */ +/* Copyright 2008-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftautoh.h b/include/freetype/ftautoh.h deleted file mode 100644 index dc00ae1ab..000000000 --- a/include/freetype/ftautoh.h +++ /dev/null @@ -1,532 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftautoh.h */ -/* */ -/* FreeType API for controlling the auto-hinter (specification only). */ -/* */ -/* Copyright 2012-2017 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef FTAUTOH_H_ -#define FTAUTOH_H_ - -#include -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /************************************************************************** - * - * @section: - * auto_hinter - * - * @title: - * The auto-hinter - * - * @abstract: - * Controlling the auto-hinting module. - * - * @description: - * While FreeType's auto-hinter doesn't expose API functions by itself, - * it is possible to control its behaviour with @FT_Property_Set and - * @FT_Property_Get. The following lists the available properties - * together with the necessary macros and structures. - * - * Note that the auto-hinter's module name is `autofitter' for - * historical reasons. - * - */ - - - /************************************************************************** - * - * @property: - * glyph-to-script-map - * - * @description: - * *Experimental* *only* - * - * The auto-hinter provides various script modules to hint glyphs. - * Examples of supported scripts are Latin or CJK. Before a glyph is - * auto-hinted, the Unicode character map of the font gets examined, and - * the script is then determined based on Unicode character ranges, see - * below. - * - * OpenType fonts, however, often provide much more glyphs than - * character codes (small caps, superscripts, ligatures, swashes, etc.), - * to be controlled by so-called `features'. Handling OpenType features - * can be quite complicated and thus needs a separate library on top of - * FreeType. - * - * The mapping between glyph indices and scripts (in the auto-hinter - * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an - * array with `num_glyphs' elements, as found in the font's @FT_Face - * structure. The `glyph-to-script-map' property returns a pointer to - * this array, which can be modified as needed. Note that the - * modification should happen before the first glyph gets processed by - * the auto-hinter so that the global analysis of the font shapes - * actually uses the modified mapping. - * - * The following example code demonstrates how to access it (omitting - * the error handling). - * - * { - * FT_Library library; - * FT_Face face; - * FT_Prop_GlyphToScriptMap prop; - * - * - * FT_Init_FreeType( &library ); - * FT_New_Face( library, "foo.ttf", 0, &face ); - * - * prop.face = face; - * - * FT_Property_Get( library, "autofitter", - * "glyph-to-script-map", &prop ); - * - * // adjust `prop.map' as needed right here - * - * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT ); - * } - * - */ - - - /************************************************************************** - * - * @enum: - * FT_AUTOHINTER_SCRIPT_XXX - * - * @description: - * *Experimental* *only* - * - * A list of constants used for the @glyph-to-script-map property to - * specify the script submodule the auto-hinter should use for hinting a - * particular glyph. - * - * @values: - * FT_AUTOHINTER_SCRIPT_NONE :: - * Don't auto-hint this glyph. - * - * FT_AUTOHINTER_SCRIPT_LATIN :: - * Apply the latin auto-hinter. For the auto-hinter, `latin' is a - * very broad term, including Cyrillic and Greek also since characters - * from those scripts share the same design constraints. - * - * By default, characters from the following Unicode ranges are - * assigned to this submodule. - * - * { - * U+0020 - U+007F // Basic Latin (no control characters) - * U+00A0 - U+00FF // Latin-1 Supplement (no control characters) - * U+0100 - U+017F // Latin Extended-A - * U+0180 - U+024F // Latin Extended-B - * U+0250 - U+02AF // IPA Extensions - * U+02B0 - U+02FF // Spacing Modifier Letters - * U+0300 - U+036F // Combining Diacritical Marks - * U+0370 - U+03FF // Greek and Coptic - * U+0400 - U+04FF // Cyrillic - * U+0500 - U+052F // Cyrillic Supplement - * U+1D00 - U+1D7F // Phonetic Extensions - * U+1D80 - U+1DBF // Phonetic Extensions Supplement - * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement - * U+1E00 - U+1EFF // Latin Extended Additional - * U+1F00 - U+1FFF // Greek Extended - * U+2000 - U+206F // General Punctuation - * U+2070 - U+209F // Superscripts and Subscripts - * U+20A0 - U+20CF // Currency Symbols - * U+2150 - U+218F // Number Forms - * U+2460 - U+24FF // Enclosed Alphanumerics - * U+2C60 - U+2C7F // Latin Extended-C - * U+2DE0 - U+2DFF // Cyrillic Extended-A - * U+2E00 - U+2E7F // Supplemental Punctuation - * U+A640 - U+A69F // Cyrillic Extended-B - * U+A720 - U+A7FF // Latin Extended-D - * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures) - * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols - * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement - * } - * - * FT_AUTOHINTER_SCRIPT_CJK :: - * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old - * Vietnamese, and some other scripts. - * - * By default, characters from the following Unicode ranges are - * assigned to this submodule. - * - * { - * U+1100 - U+11FF // Hangul Jamo - * U+2E80 - U+2EFF // CJK Radicals Supplement - * U+2F00 - U+2FDF // Kangxi Radicals - * U+2FF0 - U+2FFF // Ideographic Description Characters - * U+3000 - U+303F // CJK Symbols and Punctuation - * U+3040 - U+309F // Hiragana - * U+30A0 - U+30FF // Katakana - * U+3100 - U+312F // Bopomofo - * U+3130 - U+318F // Hangul Compatibility Jamo - * U+3190 - U+319F // Kanbun - * U+31A0 - U+31BF // Bopomofo Extended - * U+31C0 - U+31EF // CJK Strokes - * U+31F0 - U+31FF // Katakana Phonetic Extensions - * U+3200 - U+32FF // Enclosed CJK Letters and Months - * U+3300 - U+33FF // CJK Compatibility - * U+3400 - U+4DBF // CJK Unified Ideographs Extension A - * U+4DC0 - U+4DFF // Yijing Hexagram Symbols - * U+4E00 - U+9FFF // CJK Unified Ideographs - * U+A960 - U+A97F // Hangul Jamo Extended-A - * U+AC00 - U+D7AF // Hangul Syllables - * U+D7B0 - U+D7FF // Hangul Jamo Extended-B - * U+F900 - U+FAFF // CJK Compatibility Ideographs - * U+FE10 - U+FE1F // Vertical forms - * U+FE30 - U+FE4F // CJK Compatibility Forms - * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms - * U+1B000 - U+1B0FF // Kana Supplement - * U+1D300 - U+1D35F // Tai Xuan Hing Symbols - * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement - * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B - * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C - * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D - * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement - * } - * - * FT_AUTOHINTER_SCRIPT_INDIC :: - * Apply the indic auto-hinter, covering all major scripts from the - * Indian sub-continent and some other related scripts like Thai, Lao, - * or Tibetan. - * - * By default, characters from the following Unicode ranges are - * assigned to this submodule. - * - * { - * U+0900 - U+0DFF // Indic Range - * U+0F00 - U+0FFF // Tibetan - * U+1900 - U+194F // Limbu - * U+1B80 - U+1BBF // Sundanese - * U+A800 - U+A82F // Syloti Nagri - * U+ABC0 - U+ABFF // Meetei Mayek - * U+11800 - U+118DF // Sharada - * } - * - * Note that currently Indic support is rudimentary only, missing blue - * zone support. - * - */ -#define FT_AUTOHINTER_SCRIPT_NONE 0 -#define FT_AUTOHINTER_SCRIPT_LATIN 1 -#define FT_AUTOHINTER_SCRIPT_CJK 2 -#define FT_AUTOHINTER_SCRIPT_INDIC 3 - - - /************************************************************************** - * - * @struct: - * FT_Prop_GlyphToScriptMap - * - * @description: - * *Experimental* *only* - * - * The data exchange structure for the @glyph-to-script-map property. - * - */ - typedef struct FT_Prop_GlyphToScriptMap_ - { - FT_Face face; - FT_UShort* map; - - } FT_Prop_GlyphToScriptMap; - - - /************************************************************************** - * - * @property: - * fallback-script - * - * @description: - * *Experimental* *only* - * - * If no auto-hinter script module can be assigned to a glyph, a - * fallback script gets assigned to it (see also the - * @glyph-to-script-map property). By default, this is - * @FT_AUTOHINTER_SCRIPT_CJK. Using the `fallback-script' property, - * this fallback value can be changed. - * - * { - * FT_Library library; - * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "autofitter", - * "fallback-script", &fallback_script ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * It's important to use the right timing for changing this value: The - * creation of the glyph-to-script map that eventually uses the - * fallback script value gets triggered either by setting or reading a - * face-specific property like @glyph-to-script-map, or by auto-hinting - * any glyph from that face. In particular, if you have already created - * an @FT_Face structure but not loaded any glyph (using the - * auto-hinter), a change of the fallback script will affect this face. - * - */ - - - /************************************************************************** - * - * @property: - * default-script - * - * @description: - * *Experimental* *only* - * - * If FreeType gets compiled with FT_CONFIG_OPTION_USE_HARFBUZZ to make - * the HarfBuzz library access OpenType features for getting better - * glyph coverages, this property sets the (auto-fitter) script to be - * used for the default (OpenType) script data of a font's GSUB table. - * Features for the default script are intended for all scripts not - * explicitly handled in GSUB; an example is a `dlig' feature, - * containing the combination of the characters `T', `E', and `L' to - * form a `TEL' ligature. - * - * By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the - * `default-script' property, this default value can be changed. - * - * { - * FT_Library library; - * FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "autofitter", - * "default-script", &default_script ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * It's important to use the right timing for changing this value: The - * creation of the glyph-to-script map that eventually uses the - * default script value gets triggered either by setting or reading a - * face-specific property like @glyph-to-script-map, or by auto-hinting - * any glyph from that face. In particular, if you have already created - * an @FT_Face structure but not loaded any glyph (using the - * auto-hinter), a change of the default script will affect this face. - * - */ - - - /************************************************************************** - * - * @property: - * increase-x-height - * - * @description: - * For ppem values in the range 6~<= ppem <= `increase-x-height', round - * up the font's x~height much more often than normally. If the value - * is set to~0, which is the default, this feature is switched off. Use - * this property to improve the legibility of small font sizes if - * necessary. - * - * { - * FT_Library library; - * FT_Face face; - * FT_Prop_IncreaseXHeight prop; - * - * - * FT_Init_FreeType( &library ); - * FT_New_Face( library, "foo.ttf", 0, &face ); - * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 ); - * - * prop.face = face; - * prop.limit = 14; - * - * FT_Property_Set( library, "autofitter", - * "increase-x-height", &prop ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * Set this value right after calling @FT_Set_Char_Size, but before - * loading any glyph (using the auto-hinter). - * - */ - - - /************************************************************************** - * - * @struct: - * FT_Prop_IncreaseXHeight - * - * @description: - * The data exchange structure for the @increase-x-height property. - * - */ - typedef struct FT_Prop_IncreaseXHeight_ - { - FT_Face face; - FT_UInt limit; - - } FT_Prop_IncreaseXHeight; - - - /************************************************************************** - * - * @property: - * warping - * - * @description: - * *Experimental* *only* - * - * If FreeType gets compiled with option AF_CONFIG_OPTION_USE_WARPER to - * activate the warp hinting code in the auto-hinter, this property - * switches warping on and off. - * - * Warping only works in `light' auto-hinting mode. The idea of the - * code is to slightly scale and shift a glyph along the non-hinted - * dimension (which is usually the horizontal axis) so that as much of - * its segments are aligned (more or less) to the grid. To find out a - * glyph's optimal scaling and shifting value, various parameter - * combinations are tried and scored. - * - * By default, warping is off. The example below shows how to switch on - * warping (omitting the error handling). - * - * { - * FT_Library library; - * FT_Bool warping = 1; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "autofitter", - * "warping", &warping ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values 1 and 0 for `on' and `off', respectively). - * - * The warping code can also change advance widths. Have a look at the - * `lsb_delta' and `rsb_delta' fields in the @FT_GlyphSlotRec structure - * for details on improving inter-glyph distances while rendering. - * - * Since warping is a global property of the auto-hinter it is best to - * change its value before rendering any face. Otherwise, you should - * reload all faces that get auto-hinted in `light' hinting mode. - * - */ - - - /************************************************************************** - * - * @property: - * no-stem-darkening[autofit] - * - * @description: - * *Experimental* *only,* *requires* *linear* *alpha* *blending* *and* - * *gamma* *correction* - * - * Stem darkening emboldens glyphs at smaller sizes to make them more - * readable on common low-DPI screens when using linear alpha blending - * and gamma correction, see @FT_Render_Glyph. When not using linear - * alpha blending and gamma correction, glyphs will appear heavy and - * fuzzy! - * - * Gamma correction essentially lightens fonts since shades of grey are - * shifted to higher pixel values (=~higher brightness) to match the - * original intention to the reality of our screens. The side-effect is - * that glyphs `thin out'. Mac OS~X and Adobe's proprietary font - * rendering library implement a counter-measure: stem darkening at - * smaller sizes where shades of gray dominate. By emboldening a glyph - * slightly in relation to its pixel size, individual pixels get higher - * coverage of filled-in outlines and are therefore `blacker'. This - * counteracts the `thinning out' of glyphs, making text remain readable - * at smaller sizes. All glyphs that pass through the auto-hinter will - * be emboldened unless this property is set to TRUE. - * - * See the description of the CFF driver for algorithmic details. Total - * consistency with the CFF driver is currently not achieved because the - * emboldening method differs and glyphs must be scaled down on the - * Y-axis to keep outline points inside their precomputed blue zones. - * The smaller the size (especially 9ppem and down), the higher the loss - * of emboldening versus the CFF driver. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable similar to the CFF driver. It can also be set per face - * using @FT_Face_Properties with @FT_PARAM_TAG_STEM_DARKENING. - * - */ - - - /* - * @constant: - * FT_PARAM_TAG_STEM_DARKENING - * - * @description: - * An @FT_Parameter tag to be used with @FT_Face_Properties. The - * corresponding Boolean argument specifies whether to apply stem - * darkening, overriding the global default values or the values set up - * with @FT_Property_Set (see @no-stem-darkening[autofit] and - * @no-stem-darkening[cff]). - * - * This is a passive setting that only takes effect if the font driver - * or autohinter honors it, which the CFF driver always does, but the - * autohinter only in `light' hinting mode (as of version 2.7.0). - * - */ -#define FT_PARAM_TAG_STEM_DARKENING \ - FT_MAKE_TAG( 'd', 'a', 'r', 'k' ) - - - /************************************************************************** - * - * @property: - * darkening-parameters[autofit] - * - * @description: - * *Experimental* *only* - * - * See the description of the CFF driver for details. This - * implementation appropriates the - * CFF_CONFIG_OPTION_DARKENING_PARAMETER_* #defines for consistency. - * Note the differences described in @no-stem-darkening[autofit]. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable similar to the CFF driver. - */ - - - /* */ - - -FT_END_HEADER - -#endif /* FTAUTOH_H_ */ - - -/* END */ diff --git a/include/freetype/ftbbox.h b/include/freetype/ftbbox.h index f03bdc1e1..f9eb70b13 100644 --- a/include/freetype/ftbbox.h +++ b/include/freetype/ftbbox.h @@ -4,7 +4,7 @@ /* */ /* FreeType exact bbox computation (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -61,7 +61,7 @@ FT_BEGIN_HEADER /* Compute the exact bounding box of an outline. This is slower */ /* than computing the control box. However, it uses an advanced */ /* algorithm that returns _very_ quickly when the two boxes */ - /* coincide. Otherwise, the outline Bézier arcs are traversed to */ + /* coincide. Otherwise, the outline Bezier arcs are traversed to */ /* extract their extrema. */ /* */ /* */ diff --git a/include/freetype/ftbdf.h b/include/freetype/ftbdf.h index 3d3106bad..1b6dea658 100644 --- a/include/freetype/ftbdf.h +++ b/include/freetype/ftbdf.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing BDF-specific strings (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftbitmap.h b/include/freetype/ftbitmap.h index 04b2402ad..a43187cad 100644 --- a/include/freetype/ftbitmap.h +++ b/include/freetype/ftbitmap.h @@ -4,7 +4,7 @@ /* */ /* FreeType utility functions for bitmaps (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -97,7 +97,7 @@ FT_BEGIN_HEADER FT_EXPORT( FT_Error ) FT_Bitmap_Copy( FT_Library library, const FT_Bitmap *source, - FT_Bitmap *target); + FT_Bitmap *target ); /*************************************************************************/ diff --git a/include/freetype/ftbzip2.h b/include/freetype/ftbzip2.h index 9147a790a..6edfa031b 100644 --- a/include/freetype/ftbzip2.h +++ b/include/freetype/ftbzip2.h @@ -4,7 +4,7 @@ /* */ /* Bzip2-compressed stream support. */ /* */ -/* Copyright 2010-2017 by */ +/* Copyright 2010-2018 by */ /* Joel Klinghed. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftcache.h b/include/freetype/ftcache.h index 5ff3ccf40..52d5f00e0 100644 --- a/include/freetype/ftcache.h +++ b/include/freetype/ftcache.h @@ -4,7 +4,7 @@ /* */ /* FreeType Cache subsystem (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -540,13 +540,6 @@ FT_BEGIN_HEADER FTC_FaceID face_id ); - /*************************************************************************/ - /* */ - /*

    */ - /* cache_subsystem */ - /* */ - /*************************************************************************/ - /************************************************************************* * * @type: @@ -623,14 +616,6 @@ FT_BEGIN_HEADER FT_UInt32 char_code ); - /*************************************************************************/ - /* */ - /*
    */ - /* cache_subsystem */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ diff --git a/include/freetype/ftcffdrv.h b/include/freetype/ftcffdrv.h deleted file mode 100644 index c55b5916b..000000000 --- a/include/freetype/ftcffdrv.h +++ /dev/null @@ -1,320 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftcffdrv.h */ -/* */ -/* FreeType API for controlling the CFF driver (specification only). */ -/* */ -/* Copyright 2013-2017 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef FTCFFDRV_H_ -#define FTCFFDRV_H_ - -#include -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /************************************************************************** - * - * @section: - * cff_driver - * - * @title: - * The CFF driver - * - * @abstract: - * Controlling the CFF driver module. - * - * @description: - * While FreeType's CFF driver doesn't expose API functions by itself, - * it is possible to control its behaviour with @FT_Property_Set and - * @FT_Property_Get. The list below gives the available properties - * together with the necessary macros and structures. - * - * The CFF driver's module name is `cff'. - * - * *Hinting* *and* *antialiasing* *principles* *of* *the* *new* *engine* - * - * The rasterizer is positioning horizontal features (e.g., ascender - * height & x-height, or crossbars) on the pixel grid and minimizing the - * amount of antialiasing applied to them, while placing vertical - * features (vertical stems) on the pixel grid without hinting, thus - * representing the stem position and weight accurately. Sometimes the - * vertical stems may be only partially black. In this context, - * `antialiasing' means that stems are not positioned exactly on pixel - * borders, causing a fuzzy appearance. - * - * There are two principles behind this approach. - * - * 1) No hinting in the horizontal direction: Unlike `superhinted' - * TrueType, which changes glyph widths to accommodate regular - * inter-glyph spacing, Adobe's approach is `faithful to the design' in - * representing both the glyph width and the inter-glyph spacing - * designed for the font. This makes the screen display as close as it - * can be to the result one would get with infinite resolution, while - * preserving what is considered the key characteristics of each glyph. - * Note that the distances between unhinted and grid-fitted positions at - * small sizes are comparable to kerning values and thus would be - * noticeable (and distracting) while reading if hinting were applied. - * - * One of the reasons to not hint horizontally is antialiasing for LCD - * screens: The pixel geometry of modern displays supplies three - * vertical sub-pixels as the eye moves horizontally across each visible - * pixel. On devices where we can be certain this characteristic is - * present a rasterizer can take advantage of the sub-pixels to add - * increments of weight. In Western writing systems this turns out to - * be the more critical direction anyway; the weights and spacing of - * vertical stems (see above) are central to Armenian, Cyrillic, Greek, - * and Latin type designs. Even when the rasterizer uses greyscale - * antialiasing instead of color (a necessary compromise when one - * doesn't know the screen characteristics), the unhinted vertical - * features preserve the design's weight and spacing much better than - * aliased type would. - * - * 2) Alignment in the vertical direction: Weights and spacing along the - * y~axis are less critical; what is much more important is the visual - * alignment of related features (like cap-height and x-height). The - * sense of alignment for these is enhanced by the sharpness of grid-fit - * edges, while the cruder vertical resolution (full pixels instead of - * 1/3 pixels) is less of a problem. - * - * On the technical side, horizontal alignment zones for ascender, - * x-height, and other important height values (traditionally called - * `blue zones') as defined in the font are positioned independently, - * each being rounded to the nearest pixel edge, taking care of - * overshoot suppression at small sizes, stem darkening, and scaling. - * - * Hstems (this is, hint values defined in the font to help align - * horizontal features) that fall within a blue zone are said to be - * `captured' and are aligned to that zone. Uncaptured stems are moved - * in one of four ways, top edge up or down, bottom edge up or down. - * Unless there are conflicting hstems, the smallest movement is taken - * to minimize distortion. - * - * @order: - * hinting-engine[cff] - * no-stem-darkening[cff] - * darkening-parameters[cff] - * random-seed - * - */ - - - /************************************************************************** - * - * @property: - * hinting-engine[cff] - * - * @description: - * Thanks to Adobe, which contributed a new hinting (and parsing) - * engine, an application can select between `freetype' and `adobe' if - * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration - * macro isn't defined, `hinting-engine' does nothing. - * - * The default engine is `freetype' if CFF_CONFIG_OPTION_OLD_ENGINE is - * defined, and `adobe' otherwise. - * - * The following example code demonstrates how to select Adobe's hinting - * engine (omitting the error handling). - * - * { - * FT_Library library; - * FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "cff", - * "hinting-engine", &hinting_engine ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values `adobe' or `freetype'). - */ - - - /************************************************************************** - * - * @enum: - * FT_CFF_HINTING_XXX - * - * @description: - * A list of constants used for the @hinting-engine[cff] property to - * select the hinting engine for CFF fonts. - * - * @values: - * FT_CFF_HINTING_FREETYPE :: - * Use the old FreeType hinting engine. - * - * FT_CFF_HINTING_ADOBE :: - * Use the hinting engine contributed by Adobe. - * - */ -#define FT_CFF_HINTING_FREETYPE 0 -#define FT_CFF_HINTING_ADOBE 1 - - - /************************************************************************** - * - * @property: - * no-stem-darkening[cff] - * - * @description: - * By default, the Adobe CFF engine darkens stems at smaller sizes, - * regardless of hinting, to enhance contrast. This feature requires - * a rendering system with proper gamma correction. Setting this - * property, stem darkening gets switched off. - * - * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is set. - * - * { - * FT_Library library; - * FT_Bool no_stem_darkening = TRUE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "cff", - * "no-stem-darkening", &no_stem_darkening ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values 1 and 0 for `on' and `off', respectively). - * It can also be set per face using @FT_Face_Properties with - * @FT_PARAM_TAG_STEM_DARKENING. - * - */ - - - /************************************************************************** - * - * @property: - * darkening-parameters[cff] - * - * @description: - * By default, the Adobe CFF engine darkens stems as follows (if the - * `no-stem-darkening' property isn't set): - * - * { - * stem width <= 0.5px: darkening amount = 0.4px - * stem width = 1px: darkening amount = 0.275px - * stem width = 1.667px: darkening amount = 0.275px - * stem width >= 2.333px: darkening amount = 0px - * } - * - * and piecewise linear in-between. At configuration time, these four - * control points can be set with the macro - * `CFF_CONFIG_OPTION_DARKENING_PARAMETERS'. At runtime, the control - * points can be changed using the `darkening-parameters' property, as - * the following example demonstrates. - * - * { - * FT_Library library; - * FT_Int darken_params[8] = { 500, 300, // x1, y1 - * 1000, 200, // x2, y2 - * 1500, 100, // x3, y3 - * 2000, 0 }; // x4, y4 - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "cff", - * "darkening-parameters", darken_params ); - * } - * - * The x~values give the stem width, and the y~values the darkening - * amount. The unit is 1000th of pixels. All coordinate values must be - * positive; the x~values must be monotonically increasing; the - * y~values must be monotonically decreasing and smaller than or - * equal to 500 (corresponding to half a pixel); the slope of each - * linear piece must be shallower than -1 (e.g., -.4). - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable, using eight comma-separated integers without spaces. Here - * the above example, using `\' to break the line for readability. - * - * { - * FREETYPE_PROPERTIES=\ - * cff:darkening-parameters=500,300,1000,200,1500,100,2000,0 - * } - */ - - - /************************************************************************** - * - * @property: - * random-seed - * - * @description: - * By default, the seed value for the CFF `random' operator is set to a - * random value. However, mainly for debugging purposes, it is often - * necessary to use a known value as a seed so that the pseudo-random - * number sequences generated by `random' are repeatable. - * - * The `random-seed' property does that. Its argument is a signed 32bit - * integer; if the value is zero or negative, the seed given by the - * `intitialRandomSeed' private DICT operator in a CFF file gets used - * (or a default value if there is no such operator). If the value is - * positive, use it instead of `initialRandomSeed', which is - * consequently ignored. - * - * @note: - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable. It can also be set per face using @FT_Face_Properties with - * @FT_PARAM_TAG_RANDOM_SEED. - * - */ - - - /* - * @constant: - * FT_PARAM_TAG_RANDOM_SEED - * - * @description: - * An @FT_Parameter tag to be used with @FT_Face_Properties. The - * corresponding 32bit signed integer argument overrides the CFF - * module's random seed value with a face-specific one; see - * @random-seed. - * - */ -#define FT_PARAM_TAG_RANDOM_SEED \ - FT_MAKE_TAG( 's', 'e', 'e', 'd' ) - - - /* */ - - -FT_END_HEADER - - -#endif /* FTCFFDRV_H_ */ - - -/* END */ diff --git a/include/freetype/ftchapters.h b/include/freetype/ftchapters.h index a0a121b0a..51257bb7c 100644 --- a/include/freetype/ftchapters.h +++ b/include/freetype/ftchapters.h @@ -76,8 +76,11 @@ /* */ /* auto_hinter */ /* cff_driver */ +/* t1_cid_driver */ /* tt_driver */ /* pcf_driver */ +/* properties */ +/* parameter_tags */ /* */ /***************************************************************************/ diff --git a/include/freetype/ftcid.h b/include/freetype/ftcid.h index 4adcbeeda..5e9100a67 100644 --- a/include/freetype/ftcid.h +++ b/include/freetype/ftcid.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing CID font information (specification). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* Dereg Clegg and Michael Toftdal. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -87,7 +87,7 @@ FT_BEGIN_HEADER FT_Get_CID_Registry_Ordering_Supplement( FT_Face face, const char* *registry, const char* *ordering, - FT_Int *supplement); + FT_Int *supplement ); /********************************************************************** diff --git a/include/freetype/ftdriver.h b/include/freetype/ftdriver.h new file mode 100644 index 000000000..e90475b2a --- /dev/null +++ b/include/freetype/ftdriver.h @@ -0,0 +1,1225 @@ +/***************************************************************************/ +/* */ +/* ftdriver.h */ +/* */ +/* FreeType API for controlling driver modules (specification only). */ +/* */ +/* Copyright 2017-2018 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef FTDRIVER_H_ +#define FTDRIVER_H_ + +#include +#include FT_FREETYPE_H +#include FT_PARAMETER_TAGS_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * auto_hinter + * + * @title: + * The auto-hinter + * + * @abstract: + * Controlling the auto-hinting module. + * + * @description: + * While FreeType's auto-hinter doesn't expose API functions by itself, + * it is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. The following lists the available properties + * together with the necessary macros and structures. + * + * Note that the auto-hinter's module name is `autofitter' for + * historical reasons. + * + * Available properties are @increase-x-height, @no-stem-darkening + * (experimental), @darkening-parameters (experimental), @warping + * (experimental), @glyph-to-script-map (experimental), @fallback-script + * (experimental), and @default-script (experimental), as documented in + * the @properties section. + * + */ + + + /************************************************************************** + * + * @section: + * cff_driver + * + * @title: + * The CFF driver + * + * @abstract: + * Controlling the CFF driver module. + * + * @description: + * While FreeType's CFF driver doesn't expose API functions by itself, + * it is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. + * + * The CFF driver's module name is `cff'. + * + * Available properties are @hinting-engine, @no-stem-darkening, + * @darkening-parameters, and @random-seed, as documented in the + * @properties section. + * + * + * *Hinting* *and* *antialiasing* *principles* *of* *the* *new* *engine* + * + * The rasterizer is positioning horizontal features (e.g., ascender + * height & x-height, or crossbars) on the pixel grid and minimizing the + * amount of antialiasing applied to them, while placing vertical + * features (vertical stems) on the pixel grid without hinting, thus + * representing the stem position and weight accurately. Sometimes the + * vertical stems may be only partially black. In this context, + * `antialiasing' means that stems are not positioned exactly on pixel + * borders, causing a fuzzy appearance. + * + * There are two principles behind this approach. + * + * 1) No hinting in the horizontal direction: Unlike `superhinted' + * TrueType, which changes glyph widths to accommodate regular + * inter-glyph spacing, Adobe's approach is `faithful to the design' in + * representing both the glyph width and the inter-glyph spacing + * designed for the font. This makes the screen display as close as it + * can be to the result one would get with infinite resolution, while + * preserving what is considered the key characteristics of each glyph. + * Note that the distances between unhinted and grid-fitted positions at + * small sizes are comparable to kerning values and thus would be + * noticeable (and distracting) while reading if hinting were applied. + * + * One of the reasons to not hint horizontally is antialiasing for LCD + * screens: The pixel geometry of modern displays supplies three + * vertical subpixels as the eye moves horizontally across each visible + * pixel. On devices where we can be certain this characteristic is + * present a rasterizer can take advantage of the subpixels to add + * increments of weight. In Western writing systems this turns out to + * be the more critical direction anyway; the weights and spacing of + * vertical stems (see above) are central to Armenian, Cyrillic, Greek, + * and Latin type designs. Even when the rasterizer uses greyscale + * antialiasing instead of color (a necessary compromise when one + * doesn't know the screen characteristics), the unhinted vertical + * features preserve the design's weight and spacing much better than + * aliased type would. + * + * 2) Alignment in the vertical direction: Weights and spacing along the + * y~axis are less critical; what is much more important is the visual + * alignment of related features (like cap-height and x-height). The + * sense of alignment for these is enhanced by the sharpness of grid-fit + * edges, while the cruder vertical resolution (full pixels instead of + * 1/3 pixels) is less of a problem. + * + * On the technical side, horizontal alignment zones for ascender, + * x-height, and other important height values (traditionally called + * `blue zones') as defined in the font are positioned independently, + * each being rounded to the nearest pixel edge, taking care of + * overshoot suppression at small sizes, stem darkening, and scaling. + * + * Hstems (this is, hint values defined in the font to help align + * horizontal features) that fall within a blue zone are said to be + * `captured' and are aligned to that zone. Uncaptured stems are moved + * in one of four ways, top edge up or down, bottom edge up or down. + * Unless there are conflicting hstems, the smallest movement is taken + * to minimize distortion. + * + */ + + + /************************************************************************** + * + * @section: + * pcf_driver + * + * @title: + * The PCF driver + * + * @abstract: + * Controlling the PCF driver module. + * + * @description: + * While FreeType's PCF driver doesn't expose API functions by itself, + * it is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. Right now, there is a single property + * @no-long-family-names available if FreeType is compiled with + * PCF_CONFIG_OPTION_LONG_FAMILY_NAMES. + * + * The PCF driver's module name is `pcf'. + * + */ + + + /************************************************************************** + * + * @section: + * t1_cid_driver + * + * @title: + * The Type 1 and CID drivers + * + * @abstract: + * Controlling the Type~1 and CID driver modules. + * + * @description: + * It is possible to control the behaviour of FreeType's Type~1 and + * Type~1 CID drivers with @FT_Property_Set and @FT_Property_Get. + * + * Behind the scenes, both drivers use the Adobe CFF engine for hinting; + * however, the used properties must be specified separately. + * + * The Type~1 driver's module name is `type1'; the CID driver's module + * name is `t1cid'. + * + * Available properties are @hinting-engine, @no-stem-darkening, + * @darkening-parameters, and @random-seed, as documented in the + * @properties section. + * + * Please see the @cff_driver section for more details on the new + * hinting engine. + * + */ + + + /************************************************************************** + * + * @section: + * tt_driver + * + * @title: + * The TrueType driver + * + * @abstract: + * Controlling the TrueType driver module. + * + * @description: + * While FreeType's TrueType driver doesn't expose API functions by + * itself, it is possible to control its behaviour with @FT_Property_Set + * and @FT_Property_Get. The following lists the available properties + * together with the necessary macros and structures. + * + * The TrueType driver's module name is `truetype'. + * + * A single property @interpreter-version is available, as documented in + * the @properties section. + * + * We start with a list of definitions, kindly provided by Greg + * Hitchcock. + * + * _Bi-Level_ _Rendering_ + * + * Monochromatic rendering, exclusively used in the early days of + * TrueType by both Apple and Microsoft. Microsoft's GDI interface + * supported hinting of the right-side bearing point, such that the + * advance width could be non-linear. Most often this was done to + * achieve some level of glyph symmetry. To enable reasonable + * performance (e.g., not having to run hinting on all glyphs just to + * get the widths) there was a bit in the head table indicating if the + * side bearing was hinted, and additional tables, `hdmx' and `LTSH', to + * cache hinting widths across multiple sizes and device aspect ratios. + * + * _Font_ _Smoothing_ + * + * Microsoft's GDI implementation of anti-aliasing. Not traditional + * anti-aliasing as the outlines were hinted before the sampling. The + * widths matched the bi-level rendering. + * + * _ClearType_ _Rendering_ + * + * Technique that uses physical subpixels to improve rendering on LCD + * (and other) displays. Because of the higher resolution, many methods + * of improving symmetry in glyphs through hinting the right-side + * bearing were no longer necessary. This lead to what GDI calls + * `natural widths' ClearType, see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec21. Since hinting + * has extra resolution, most non-linearity went away, but it is still + * possible for hints to change the advance widths in this mode. + * + * _ClearType_ _Compatible_ _Widths_ + * + * One of the earliest challenges with ClearType was allowing the + * implementation in GDI to be selected without requiring all UI and + * documents to reflow. To address this, a compatible method of + * rendering ClearType was added where the font hints are executed once + * to determine the width in bi-level rendering, and then re-run in + * ClearType, with the difference in widths being absorbed in the font + * hints for ClearType (mostly in the white space of hints); see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec20. Somewhat by + * definition, compatible width ClearType allows for non-linear widths, + * but only when the bi-level version has non-linear widths. + * + * _ClearType_ _Subpixel_ _Positioning_ + * + * One of the nice benefits of ClearType is the ability to more crisply + * display fractional widths; unfortunately, the GDI model of integer + * bitmaps did not support this. However, the WPF and Direct Write + * frameworks do support fractional widths. DWrite calls this `natural + * mode', not to be confused with GDI's `natural widths'. Subpixel + * positioning, in the current implementation of Direct Write, + * unfortunately does not support hinted advance widths, see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec22. Note that the + * TrueType interpreter fully allows the advance width to be adjusted in + * this mode, just the DWrite client will ignore those changes. + * + * _ClearType_ _Backward_ _Compatibility_ + * + * This is a set of exceptions made in the TrueType interpreter to + * minimize hinting techniques that were problematic with the extra + * resolution of ClearType; see + * http://www.beatstamm.com/typography/RTRCh4.htm#Sec1 and + * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx. + * This technique is not to be confused with ClearType compatible + * widths. ClearType backward compatibility has no direct impact on + * changing advance widths, but there might be an indirect impact on + * disabling some deltas. This could be worked around in backward + * compatibility mode. + * + * _Native_ _ClearType_ _Mode_ + * + * (Not to be confused with `natural widths'.) This mode removes all + * the exceptions in the TrueType interpreter when running with + * ClearType. Any issues on widths would still apply, though. + * + */ + + + /************************************************************************** + * + * @section: + * properties + * + * @title: + * Driver properties + * + * @abstract: + * Controlling driver modules. + * + * @description: + * Driver modules can be controlled by setting and unsetting properties, + * using the functions @FT_Property_Set and @FT_Property_Get. This + * section documents the available properties, together with auxiliary + * macros and structures. + * + */ + + + /************************************************************************** + * + * @enum: + * FT_HINTING_XXX + * + * @description: + * A list of constants used for the @hinting-engine property to + * select the hinting engine for CFF, Type~1, and CID fonts. + * + * @values: + * FT_HINTING_FREETYPE :: + * Use the old FreeType hinting engine. + * + * FT_HINTING_ADOBE :: + * Use the hinting engine contributed by Adobe. + * + * @since: + * 2.9 + * + */ +#define FT_HINTING_FREETYPE 0 +#define FT_HINTING_ADOBE 1 + + /* these constants (introduced in 2.4.12) are deprecated */ +#define FT_CFF_HINTING_FREETYPE FT_HINTING_FREETYPE +#define FT_CFF_HINTING_ADOBE FT_HINTING_ADOBE + + + /************************************************************************** + * + * @property: + * hinting-engine + * + * @description: + * Thanks to Adobe, which contributed a new hinting (and parsing) + * engine, an application can select between `freetype' and `adobe' if + * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration + * macro isn't defined, `hinting-engine' does nothing. + * + * The same holds for the Type~1 and CID modules if compiled with + * T1_CONFIG_OPTION_OLD_ENGINE. + * + * For the `cff' module, the default engine is `freetype' if + * CFF_CONFIG_OPTION_OLD_ENGINE is defined, and `adobe' otherwise. + * + * For both the `type1' and `t1cid' modules, the default engine is + * `freetype' if T1_CONFIG_OPTION_OLD_ENGINE is defined, and `adobe' + * otherwise. + * + * The following example code demonstrates how to select Adobe's hinting + * engine for the `cff' module (omitting the error handling). + * + * { + * FT_Library library; + * FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "cff", + * "hinting-engine", &hinting_engine ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values `adobe' or `freetype'). + * + * @since: + * 2.4.12 (for `cff' module) + * + * 2.9 (for `type1' and `t1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * no-stem-darkening + * + * @description: + * All glyphs that pass through the auto-hinter will be emboldened + * unless this property is set to TRUE. The same is true for the CFF, + * Type~1, and CID font modules if the `Adobe' engine is selected (which + * is the default). + * + * Stem darkening emboldens glyphs at smaller sizes to make them more + * readable on common low-DPI screens when using linear alpha blending + * and gamma correction, see @FT_Render_Glyph. When not using linear + * alpha blending and gamma correction, glyphs will appear heavy and + * fuzzy! + * + * Gamma correction essentially lightens fonts since shades of grey are + * shifted to higher pixel values (=~higher brightness) to match the + * original intention to the reality of our screens. The side-effect is + * that glyphs `thin out'. Mac OS~X and Adobe's proprietary font + * rendering library implement a counter-measure: stem darkening at + * smaller sizes where shades of gray dominate. By emboldening a glyph + * slightly in relation to its pixel size, individual pixels get higher + * coverage of filled-in outlines and are therefore `blacker'. This + * counteracts the `thinning out' of glyphs, making text remain readable + * at smaller sizes. + * + * By default, the Adobe engines for CFF, Type~1, and CID fonts darken + * stems at smaller sizes, regardless of hinting, to enhance contrast. + * Setting this property, stem darkening gets switched off. + * + * For the auto-hinter, stem-darkening is experimental currently and + * thus switched off by default (this is, `no-stem-darkening' is set to + * TRUE by default). Total consistency with the CFF driver is not + * achieved right now because the emboldening method differs and glyphs + * must be scaled down on the Y-axis to keep outline points inside their + * precomputed blue zones. The smaller the size (especially 9ppem and + * down), the higher the loss of emboldening versus the CFF driver. + * + * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is + * set. + * + * { + * FT_Library library; + * FT_Bool no_stem_darkening = TRUE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "cff", + * "no-stem-darkening", &no_stem_darkening ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values 1 and 0 for `on' and `off', respectively). + * It can also be set per face using @FT_Face_Properties with + * @FT_PARAM_TAG_STEM_DARKENING. + * + * @since: + * 2.4.12 (for `cff' module) + * + * 2.6.2 (for `autofitter' module) + * + * 2.9 (for `type1' and `t1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * darkening-parameters + * + * @description: + * By default, the Adobe hinting engine, as used by the CFF, Type~1, and + * CID font drivers, darkens stems as follows (if the + * `no-stem-darkening' property isn't set): + * + * { + * stem width <= 0.5px: darkening amount = 0.4px + * stem width = 1px: darkening amount = 0.275px + * stem width = 1.667px: darkening amount = 0.275px + * stem width >= 2.333px: darkening amount = 0px + * } + * + * and piecewise linear in-between. At configuration time, these four + * control points can be set with the macro + * `CFF_CONFIG_OPTION_DARKENING_PARAMETERS'; the CFF, Type~1, and CID + * drivers share these values. At runtime, the control points can be + * changed using the `darkening-parameters' property, as the following + * example demonstrates for the Type~1 driver. + * + * { + * FT_Library library; + * FT_Int darken_params[8] = { 500, 300, // x1, y1 + * 1000, 200, // x2, y2 + * 1500, 100, // x3, y3 + * 2000, 0 }; // x4, y4 + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "type1", + * "darkening-parameters", darken_params ); + * } + * + * The x~values give the stem width, and the y~values the darkening + * amount. The unit is 1000th of pixels. All coordinate values must be + * positive; the x~values must be monotonically increasing; the + * y~values must be monotonically decreasing and smaller than or + * equal to 500 (corresponding to half a pixel); the slope of each + * linear piece must be shallower than -1 (e.g., -.4). + * + * The auto-hinter provides this property, too, as an experimental + * feature. See @no-stem-darkening for more. + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable, using eight comma-separated integers without spaces. Here + * the above example, using `\' to break the line for readability. + * + * { + * FREETYPE_PROPERTIES=\ + * type1:darkening-parameters=500,300,1000,200,1500,100,2000,0 + * } + * + * @since: + * 2.5.1 (for `cff' module) + * + * 2.6.2 (for `autofitter' module) + * + * 2.9 (for `type1' and `t1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * random-seed + * + * @description: + * By default, the seed value for the CFF `random' operator and the + * similar `0 28 callothersubr pop' command for the Type~1 and CID + * drivers is set to a random value. However, mainly for debugging + * purposes, it is often necessary to use a known value as a seed so + * that the pseudo-random number sequences generated by `random' are + * repeatable. + * + * The `random-seed' property does that. Its argument is a signed 32bit + * integer; if the value is zero or negative, the seed given by the + * `intitialRandomSeed' private DICT operator in a CFF file gets used + * (or a default value if there is no such operator). If the value is + * positive, use it instead of `initialRandomSeed', which is + * consequently ignored. + * + * @note: + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable. It can also be set per face using @FT_Face_Properties with + * @FT_PARAM_TAG_RANDOM_SEED. + * + * @since: + * 2.8 (for `cff' module) + * + * 2.9 (for `type1' and `t1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * no-long-family-names + * + * @description: + * If PCF_CONFIG_OPTION_LONG_FAMILY_NAMES is active while compiling + * FreeType, the PCF driver constructs long family names. + * + * There are many PCF fonts just called `Fixed' which look completely + * different, and which have nothing to do with each other. When + * selecting `Fixed' in KDE or Gnome one gets results that appear rather + * random, the style changes often if one changes the size and one + * cannot select some fonts at all. The improve this situation, the PCF + * module prepends the foundry name (plus a space) to the family name. + * It also checks whether there are `wide' characters; all put together, + * family names like `Sony Fixed' or `Misc Fixed Wide' are constructed. + * + * If `no-long-family-names' is set, this feature gets switched off. + * + * { + * FT_Library library; + * FT_Bool no_long_family_names = TRUE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "pcf", + * "no-long-family-names", + * &no_long_family_names ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values 1 and 0 for `on' and `off', respectively). + * + * @since: + * 2.8 + */ + + + /************************************************************************** + * + * @enum: + * TT_INTERPRETER_VERSION_XXX + * + * @description: + * A list of constants used for the @interpreter-version property to + * select the hinting engine for Truetype fonts. + * + * The numeric value in the constant names represents the version + * number as returned by the `GETINFO' bytecode instruction. + * + * @values: + * TT_INTERPRETER_VERSION_35 :: + * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in + * Windows~98; only grayscale and B/W rasterizing is supported. + * + * TT_INTERPRETER_VERSION_38 :: + * Version~38 corresponds to MS rasterizer v.1.9; it is roughly + * equivalent to the hinting provided by DirectWrite ClearType (as can + * be found, for example, in the Internet Explorer~9 running on + * Windows~7). It is used in FreeType to select the `Infinality' + * subpixel hinting code. The code may be removed in a future + * version. + * + * TT_INTERPRETER_VERSION_40 :: + * Version~40 corresponds to MS rasterizer v.2.1; it is roughly + * equivalent to the hinting provided by DirectWrite ClearType (as can + * be found, for example, in Microsoft's Edge Browser on Windows~10). + * It is used in FreeType to select the `minimal' subpixel hinting + * code, a stripped-down and higher performance version of the + * `Infinality' code. + * + * @note: + * This property controls the behaviour of the bytecode interpreter + * and thus how outlines get hinted. It does *not* control how glyph + * get rasterized! In particular, it does not control subpixel color + * filtering. + * + * If FreeType has not been compiled with the configuration option + * TT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 or~40 causes + * an `FT_Err_Unimplemented_Feature' error. + * + * Depending on the graphics framework, Microsoft uses different + * bytecode and rendering engines. As a consequence, the version + * numbers returned by a call to the `GETINFO' bytecode instruction are + * more convoluted than desired. + * + * Here are two tables that try to shed some light on the possible + * values for the MS rasterizer engine, together with the additional + * features introduced by it. + * + * { + * GETINFO framework version feature + * ------------------------------------------------------------------- + * 3 GDI (Win 3.1), v1.0 16-bit, first version + * TrueImage + * 33 GDI (Win NT 3.1), v1.5 32-bit + * HP Laserjet + * 34 GDI (Win 95) v1.6 font smoothing, + * new SCANTYPE opcode + * 35 GDI (Win 98/2000) v1.7 (UN)SCALED_COMPONENT_OFFSET + * bits in composite glyphs + * 36 MGDI (Win CE 2) v1.6+ classic ClearType + * 37 GDI (XP and later), v1.8 ClearType + * GDI+ old (before Vista) + * 38 GDI+ old (Vista, Win 7), v1.9 subpixel ClearType, + * WPF Y-direction ClearType, + * additional error checking + * 39 DWrite (before Win 8) v2.0 subpixel ClearType flags + * in GETINFO opcode, + * bug fixes + * 40 GDI+ (after Win 7), v2.1 Y-direction ClearType flag + * DWrite (Win 8) in GETINFO opcode, + * Gray ClearType + * } + * + * The `version' field gives a rough orientation only, since some + * applications provided certain features much earlier (as an example, + * Microsoft Reader used subpixel and Y-direction ClearType already in + * Windows 2000). Similarly, updates to a given framework might include + * improved hinting support. + * + * { + * version sampling rendering comment + * x y x y + * -------------------------------------------------------------- + * v1.0 normal normal B/W B/W bi-level + * v1.6 high high gray gray grayscale + * v1.8 high normal color-filter B/W (GDI) ClearType + * v1.9 high high color-filter gray Color ClearType + * v2.1 high normal gray B/W Gray ClearType + * v2.1 high high gray gray Gray ClearType + * } + * + * Color and Gray ClearType are the two available variants of + * `Y-direction ClearType', meaning grayscale rasterization along the + * Y-direction; the name used in the TrueType specification for this + * feature is `symmetric smoothing'. `Classic ClearType' is the + * original algorithm used before introducing a modified version in + * Win~XP. Another name for v1.6's grayscale rendering is `font + * smoothing', and `Color ClearType' is sometimes also called `DWrite + * ClearType'. To differentiate between today's Color ClearType and the + * earlier ClearType variant with B/W rendering along the vertical axis, + * the latter is sometimes called `GDI ClearType'. + * + * `Normal' and `high' sampling describe the (virtual) resolution to + * access the rasterized outline after the hinting process. `Normal' + * means 1 sample per grid line (i.e., B/W). In the current Microsoft + * implementation, `high' means an extra virtual resolution of 16x16 (or + * 16x1) grid lines per pixel for bytecode instructions like `MIRP'. + * After hinting, these 16 grid lines are mapped to 6x5 (or 6x1) grid + * lines for color filtering if Color ClearType is activated. + * + * Note that `Gray ClearType' is essentially the same as v1.6's + * grayscale rendering. However, the GETINFO instruction handles it + * differently: v1.6 returns bit~12 (hinting for grayscale), while v2.1 + * returns bits~13 (hinting for ClearType), 18 (symmetrical smoothing), + * and~19 (Gray ClearType). Also, this mode respects bits 2 and~3 for + * the version~1 gasp table exclusively (like Color ClearType), while + * v1.6 only respects the values of version~0 (bits 0 and~1). + * + * Keep in mind that the features of the above interpreter versions + * might not map exactly to FreeType features or behavior because it is + * a fundamentally different library with different internals. + * + */ +#define TT_INTERPRETER_VERSION_35 35 +#define TT_INTERPRETER_VERSION_38 38 +#define TT_INTERPRETER_VERSION_40 40 + + + /************************************************************************** + * + * @property: + * interpreter-version + * + * @description: + * Currently, three versions are available, two representing the + * bytecode interpreter with subpixel hinting support (old `Infinality' + * code and new stripped-down and higher performance `minimal' code) and + * one without, respectively. The default is subpixel support if + * TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel support + * otherwise (since it isn't available then). + * + * If subpixel hinting is on, many TrueType bytecode instructions behave + * differently compared to B/W or grayscale rendering (except if `native + * ClearType' is selected by the font). Microsoft's main idea is to + * render at a much increased horizontal resolution, then sampling down + * the created output to subpixel precision. However, many older fonts + * are not suited to this and must be specially taken care of by + * applying (hardcoded) tweaks in Microsoft's interpreter. + * + * Details on subpixel hinting and some of the necessary tweaks can be + * found in Greg Hitchcock's whitepaper at + * `https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. + * Note that FreeType currently doesn't really `subpixel hint' (6x1, 6x2, + * or 6x5 supersampling) like discussed in the paper. Depending on the + * chosen interpreter, it simply ignores instructions on vertical stems + * to arrive at very similar results. + * + * The following example code demonstrates how to deactivate subpixel + * hinting (omitting the error handling). + * + * { + * FT_Library library; + * FT_Face face; + * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_35; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "truetype", + * "interpreter-version", + * &interpreter_version ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values `35', `38', or `40'). + * + * @since: + * 2.5 + */ + + + /************************************************************************** + * + * @property: + * glyph-to-script-map + * + * @description: + * *Experimental* *only* + * + * The auto-hinter provides various script modules to hint glyphs. + * Examples of supported scripts are Latin or CJK. Before a glyph is + * auto-hinted, the Unicode character map of the font gets examined, and + * the script is then determined based on Unicode character ranges, see + * below. + * + * OpenType fonts, however, often provide much more glyphs than + * character codes (small caps, superscripts, ligatures, swashes, etc.), + * to be controlled by so-called `features'. Handling OpenType features + * can be quite complicated and thus needs a separate library on top of + * FreeType. + * + * The mapping between glyph indices and scripts (in the auto-hinter + * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an + * array with `num_glyphs' elements, as found in the font's @FT_Face + * structure. The `glyph-to-script-map' property returns a pointer to + * this array, which can be modified as needed. Note that the + * modification should happen before the first glyph gets processed by + * the auto-hinter so that the global analysis of the font shapes + * actually uses the modified mapping. + * + * The following example code demonstrates how to access it (omitting + * the error handling). + * + * { + * FT_Library library; + * FT_Face face; + * FT_Prop_GlyphToScriptMap prop; + * + * + * FT_Init_FreeType( &library ); + * FT_New_Face( library, "foo.ttf", 0, &face ); + * + * prop.face = face; + * + * FT_Property_Get( library, "autofitter", + * "glyph-to-script-map", &prop ); + * + * // adjust `prop.map' as needed right here + * + * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT ); + * } + * + * @since: + * 2.4.11 + * + */ + + + /************************************************************************** + * + * @enum: + * FT_AUTOHINTER_SCRIPT_XXX + * + * @description: + * *Experimental* *only* + * + * A list of constants used for the @glyph-to-script-map property to + * specify the script submodule the auto-hinter should use for hinting a + * particular glyph. + * + * @values: + * FT_AUTOHINTER_SCRIPT_NONE :: + * Don't auto-hint this glyph. + * + * FT_AUTOHINTER_SCRIPT_LATIN :: + * Apply the latin auto-hinter. For the auto-hinter, `latin' is a + * very broad term, including Cyrillic and Greek also since characters + * from those scripts share the same design constraints. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * { + * U+0020 - U+007F // Basic Latin (no control characters) + * U+00A0 - U+00FF // Latin-1 Supplement (no control characters) + * U+0100 - U+017F // Latin Extended-A + * U+0180 - U+024F // Latin Extended-B + * U+0250 - U+02AF // IPA Extensions + * U+02B0 - U+02FF // Spacing Modifier Letters + * U+0300 - U+036F // Combining Diacritical Marks + * U+0370 - U+03FF // Greek and Coptic + * U+0400 - U+04FF // Cyrillic + * U+0500 - U+052F // Cyrillic Supplement + * U+1D00 - U+1D7F // Phonetic Extensions + * U+1D80 - U+1DBF // Phonetic Extensions Supplement + * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement + * U+1E00 - U+1EFF // Latin Extended Additional + * U+1F00 - U+1FFF // Greek Extended + * U+2000 - U+206F // General Punctuation + * U+2070 - U+209F // Superscripts and Subscripts + * U+20A0 - U+20CF // Currency Symbols + * U+2150 - U+218F // Number Forms + * U+2460 - U+24FF // Enclosed Alphanumerics + * U+2C60 - U+2C7F // Latin Extended-C + * U+2DE0 - U+2DFF // Cyrillic Extended-A + * U+2E00 - U+2E7F // Supplemental Punctuation + * U+A640 - U+A69F // Cyrillic Extended-B + * U+A720 - U+A7FF // Latin Extended-D + * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures) + * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols + * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement + * } + * + * FT_AUTOHINTER_SCRIPT_CJK :: + * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old + * Vietnamese, and some other scripts. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * { + * U+1100 - U+11FF // Hangul Jamo + * U+2E80 - U+2EFF // CJK Radicals Supplement + * U+2F00 - U+2FDF // Kangxi Radicals + * U+2FF0 - U+2FFF // Ideographic Description Characters + * U+3000 - U+303F // CJK Symbols and Punctuation + * U+3040 - U+309F // Hiragana + * U+30A0 - U+30FF // Katakana + * U+3100 - U+312F // Bopomofo + * U+3130 - U+318F // Hangul Compatibility Jamo + * U+3190 - U+319F // Kanbun + * U+31A0 - U+31BF // Bopomofo Extended + * U+31C0 - U+31EF // CJK Strokes + * U+31F0 - U+31FF // Katakana Phonetic Extensions + * U+3200 - U+32FF // Enclosed CJK Letters and Months + * U+3300 - U+33FF // CJK Compatibility + * U+3400 - U+4DBF // CJK Unified Ideographs Extension A + * U+4DC0 - U+4DFF // Yijing Hexagram Symbols + * U+4E00 - U+9FFF // CJK Unified Ideographs + * U+A960 - U+A97F // Hangul Jamo Extended-A + * U+AC00 - U+D7AF // Hangul Syllables + * U+D7B0 - U+D7FF // Hangul Jamo Extended-B + * U+F900 - U+FAFF // CJK Compatibility Ideographs + * U+FE10 - U+FE1F // Vertical forms + * U+FE30 - U+FE4F // CJK Compatibility Forms + * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms + * U+1B000 - U+1B0FF // Kana Supplement + * U+1D300 - U+1D35F // Tai Xuan Hing Symbols + * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement + * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B + * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C + * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D + * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement + * } + * + * FT_AUTOHINTER_SCRIPT_INDIC :: + * Apply the indic auto-hinter, covering all major scripts from the + * Indian sub-continent and some other related scripts like Thai, Lao, + * or Tibetan. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * { + * U+0900 - U+0DFF // Indic Range + * U+0F00 - U+0FFF // Tibetan + * U+1900 - U+194F // Limbu + * U+1B80 - U+1BBF // Sundanese + * U+A800 - U+A82F // Syloti Nagri + * U+ABC0 - U+ABFF // Meetei Mayek + * U+11800 - U+118DF // Sharada + * } + * + * Note that currently Indic support is rudimentary only, missing blue + * zone support. + * + * @since: + * 2.4.11 + * + */ +#define FT_AUTOHINTER_SCRIPT_NONE 0 +#define FT_AUTOHINTER_SCRIPT_LATIN 1 +#define FT_AUTOHINTER_SCRIPT_CJK 2 +#define FT_AUTOHINTER_SCRIPT_INDIC 3 + + + /************************************************************************** + * + * @struct: + * FT_Prop_GlyphToScriptMap + * + * @description: + * *Experimental* *only* + * + * The data exchange structure for the @glyph-to-script-map property. + * + * @since: + * 2.4.11 + * + */ + typedef struct FT_Prop_GlyphToScriptMap_ + { + FT_Face face; + FT_UShort* map; + + } FT_Prop_GlyphToScriptMap; + + + /************************************************************************** + * + * @property: + * fallback-script + * + * @description: + * *Experimental* *only* + * + * If no auto-hinter script module can be assigned to a glyph, a + * fallback script gets assigned to it (see also the + * @glyph-to-script-map property). By default, this is + * @FT_AUTOHINTER_SCRIPT_CJK. Using the `fallback-script' property, + * this fallback value can be changed. + * + * { + * FT_Library library; + * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "autofitter", + * "fallback-script", &fallback_script ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * It's important to use the right timing for changing this value: The + * creation of the glyph-to-script map that eventually uses the + * fallback script value gets triggered either by setting or reading a + * face-specific property like @glyph-to-script-map, or by auto-hinting + * any glyph from that face. In particular, if you have already created + * an @FT_Face structure but not loaded any glyph (using the + * auto-hinter), a change of the fallback script will affect this face. + * + * @since: + * 2.4.11 + * + */ + + + /************************************************************************** + * + * @property: + * default-script + * + * @description: + * *Experimental* *only* + * + * If FreeType gets compiled with FT_CONFIG_OPTION_USE_HARFBUZZ to make + * the HarfBuzz library access OpenType features for getting better + * glyph coverages, this property sets the (auto-fitter) script to be + * used for the default (OpenType) script data of a font's GSUB table. + * Features for the default script are intended for all scripts not + * explicitly handled in GSUB; an example is a `dlig' feature, + * containing the combination of the characters `T', `E', and `L' to + * form a `TEL' ligature. + * + * By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the + * `default-script' property, this default value can be changed. + * + * { + * FT_Library library; + * FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "autofitter", + * "default-script", &default_script ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * It's important to use the right timing for changing this value: The + * creation of the glyph-to-script map that eventually uses the + * default script value gets triggered either by setting or reading a + * face-specific property like @glyph-to-script-map, or by auto-hinting + * any glyph from that face. In particular, if you have already created + * an @FT_Face structure but not loaded any glyph (using the + * auto-hinter), a change of the default script will affect this face. + * + * @since: + * 2.5.3 + * + */ + + + /************************************************************************** + * + * @property: + * increase-x-height + * + * @description: + * For ppem values in the range 6~<= ppem <= `increase-x-height', round + * up the font's x~height much more often than normally. If the value + * is set to~0, which is the default, this feature is switched off. Use + * this property to improve the legibility of small font sizes if + * necessary. + * + * { + * FT_Library library; + * FT_Face face; + * FT_Prop_IncreaseXHeight prop; + * + * + * FT_Init_FreeType( &library ); + * FT_New_Face( library, "foo.ttf", 0, &face ); + * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 ); + * + * prop.face = face; + * prop.limit = 14; + * + * FT_Property_Set( library, "autofitter", + * "increase-x-height", &prop ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * Set this value right after calling @FT_Set_Char_Size, but before + * loading any glyph (using the auto-hinter). + * + * @since: + * 2.4.11 + * + */ + + + /************************************************************************** + * + * @struct: + * FT_Prop_IncreaseXHeight + * + * @description: + * The data exchange structure for the @increase-x-height property. + * + */ + typedef struct FT_Prop_IncreaseXHeight_ + { + FT_Face face; + FT_UInt limit; + + } FT_Prop_IncreaseXHeight; + + + /************************************************************************** + * + * @property: + * warping + * + * @description: + * *Experimental* *only* + * + * If FreeType gets compiled with option AF_CONFIG_OPTION_USE_WARPER to + * activate the warp hinting code in the auto-hinter, this property + * switches warping on and off. + * + * Warping only works in `normal' auto-hinting mode replacing it. + * The idea of the code is to slightly scale and shift a glyph along + * the non-hinted dimension (which is usually the horizontal axis) so + * that as much of its segments are aligned (more or less) to the grid. + * To find out a glyph's optimal scaling and shifting value, various + * parameter combinations are tried and scored. + * + * By default, warping is off. The example below shows how to switch on + * warping (omitting the error handling). + * + * { + * FT_Library library; + * FT_Bool warping = 1; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "autofitter", + * "warping", &warping ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES' environment + * variable (using values 1 and 0 for `on' and `off', respectively). + * + * The warping code can also change advance widths. Have a look at the + * `lsb_delta' and `rsb_delta' fields in the @FT_GlyphSlotRec structure + * for details on improving inter-glyph distances while rendering. + * + * Since warping is a global property of the auto-hinter it is best to + * change its value before rendering any face. Otherwise, you should + * reload all faces that get auto-hinted in `normal' hinting mode. + * + * @since: + * 2.6 + * + */ + + + /* */ + + +FT_END_HEADER + + +#endif /* FTDRIVER_H_ */ + + +/* END */ diff --git a/include/freetype/fterrdef.h b/include/freetype/fterrdef.h index 232dccdc6..8ffd346ca 100644 --- a/include/freetype/fterrdef.h +++ b/include/freetype/fterrdef.h @@ -4,7 +4,7 @@ /* */ /* FreeType error codes (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -231,6 +231,10 @@ "invalid PostScript (post) table format" ) FT_ERRORDEF_( Invalid_Post_Table, 0x9B, "invalid PostScript (post) table" ) + FT_ERRORDEF_( DEF_In_Glyf_Bytecode, 0x9C, + "found FDEF or IDEF opcode in glyf bytecode" ) + FT_ERRORDEF_( Missing_Bitmap, 0x9D, + "missing bitmap in strike" ) /* CFF, CID, and Type 1 errors */ diff --git a/include/freetype/fterrors.h b/include/freetype/fterrors.h index 021989d0d..f6ee5c24e 100644 --- a/include/freetype/fterrors.h +++ b/include/freetype/fterrors.h @@ -4,7 +4,7 @@ /* */ /* FreeType error code handling (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -38,15 +38,15 @@ /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ /* defined in `ftoption.h' in order to make the higher byte indicate */ /* the module where the error has happened (this is not compatible */ - /* with standard builds of FreeType 2, however). See the file */ + /* with standard builds of FreeType~2, however). See the file */ /* `ftmoderr.h' for more details. */ /* */ /* *Error* *Message* *Strings* */ /* */ /* Error definitions are set up with special macros that allow client */ /* applications to build a table of error message strings. The */ - /* strings are not included in a normal build of FreeType 2 to */ - /* save space (most client applications do not use them). */ + /* strings are not included in a normal build of FreeType~2 to save */ + /* space (most client applications do not use them). */ /* */ /* To do so, you have to define the following macros before including */ /* this file. */ @@ -106,7 +106,7 @@ /* */ /* #undefine __FTERRORS_H__ */ /* */ - /* work for backwards compatibility. */ + /* work for backward compatibility. */ /* */ #if !( defined( FTERRORS_H_ ) && defined ( __FTERRORS_H__ ) ) #define FTERRORS_H_ diff --git a/include/freetype/ftfntfmt.h b/include/freetype/ftfntfmt.h index 337758328..cc86efac2 100644 --- a/include/freetype/ftfntfmt.h +++ b/include/freetype/ftfntfmt.h @@ -4,7 +4,7 @@ /* */ /* Support functions for font formats. */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftgasp.h b/include/freetype/ftgasp.h index ce18d6478..9b54fc86a 100644 --- a/include/freetype/ftgasp.h +++ b/include/freetype/ftgasp.h @@ -4,7 +4,7 @@ /* */ /* Access of TrueType's `gasp' table (specification). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftglyph.h b/include/freetype/ftglyph.h index 79879a7ac..5f3fc009c 100644 --- a/include/freetype/ftglyph.h +++ b/include/freetype/ftglyph.h @@ -4,7 +4,7 @@ /* */ /* FreeType convenience functions to handle glyphs (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -231,6 +231,12 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* Because `*aglyph->advance.x' and '*aglyph->advance.y' are 16.16 */ + /* fixed-point numbers, `slot->advance.x' and `slot->advance.y' */ + /* (which are in 26.6 fixed-point format) must be in the range */ + /* ]-32768;32768[. */ + /* */ FT_EXPORT( FT_Error ) FT_Get_Glyph( FT_GlyphSlot slot, FT_Glyph *aglyph ); @@ -341,10 +347,10 @@ FT_BEGIN_HEADER /* */ /* */ /* Return a glyph's `control box'. The control box encloses all the */ - /* outline's points, including Bézier control points. Though it */ + /* outline's points, including Bezier control points. Though it */ /* coincides with the exact bounding box for most glyphs, it can be */ /* slightly larger in some situations (like when rotating an outline */ - /* that contains Bézier outside arcs). */ + /* that contains Bezier outside arcs). */ /* */ /* Computing the control box is very fast, while getting the bounding */ /* box can take much more time as it needs to walk over all segments */ @@ -566,6 +572,9 @@ FT_BEGIN_HEADER /* */ /* The result is undefined if either `a' or `b' is zero. */ /* */ + /* Since the function uses wrap-around arithmetic, results become */ + /* meaningless if the arguments are very large. */ + /* */ FT_EXPORT( void ) FT_Matrix_Multiply( const FT_Matrix* a, FT_Matrix* b ); diff --git a/include/freetype/ftgxval.h b/include/freetype/ftgxval.h index f239c71eb..8382d5995 100644 --- a/include/freetype/ftgxval.h +++ b/include/freetype/ftgxval.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating TrueTypeGX/AAT tables (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO, Redhat K.K, */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ @@ -101,15 +101,15 @@ FT_BEGIN_HEADER * The number of tables checked in this module. Use it as a parameter * for the `table-length' argument of function @FT_TrueTypeGX_Validate. */ -#define FT_VALIDATE_GX_LENGTH (FT_VALIDATE_GX_LAST_INDEX + 1) +#define FT_VALIDATE_GX_LENGTH ( FT_VALIDATE_GX_LAST_INDEX + 1 ) /* */ /* Up to 0x1000 is used by otvalid. Ox2xxx is reserved for feature OT extension. */ -#define FT_VALIDATE_GX_START 0x4000 -#define FT_VALIDATE_GX_BITFIELD( tag ) \ - ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX ) +#define FT_VALIDATE_GX_START 0x4000 +#define FT_VALIDATE_GX_BITFIELD( tag ) \ + ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX ) /********************************************************************** diff --git a/include/freetype/ftgzip.h b/include/freetype/ftgzip.h index bd5ceaab9..db033da0e 100644 --- a/include/freetype/ftgzip.h +++ b/include/freetype/ftgzip.h @@ -4,7 +4,7 @@ /* */ /* Gzip-compressed stream support. */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -129,6 +129,9 @@ FT_BEGIN_HEADER * @note: * This function may return `FT_Err_Unimplemented_Feature' if your build * of FreeType was not compiled with zlib support. + * + * @since: + * 2.5.1 */ FT_EXPORT( FT_Error ) FT_Gzip_Uncompress( FT_Memory memory, diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h index 1a049ef16..79ede1959 100644 --- a/include/freetype/ftimage.h +++ b/include/freetype/ftimage.h @@ -5,7 +5,7 @@ /* FreeType glyph image formats and default raster interface */ /* (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -169,13 +169,13 @@ FT_BEGIN_HEADER /* @FT_RENDER_MODE_LCD_V. */ /* */ /* FT_PIXEL_MODE_BGRA :: */ - /* An image with four 8-bit channels per pixel, representing a */ - /* color image (such as emoticons) with alpha channel. For each */ - /* pixel, the format is BGRA, which means, the blue channel comes */ - /* first in memory. The color channels are pre-multiplied and in */ - /* the sRGB colorspace. For example, full red at half-translucent */ - /* opacity will be represented as `00,00,80,80', not `00,00,FF,80'. */ - /* See also @FT_LOAD_COLOR. */ + /* [Since 2.5] An image with four 8-bit channels per pixel, */ + /* representing a color image (such as emoticons) with alpha */ + /* channel. For each pixel, the format is BGRA, which means, the */ + /* blue channel comes first in memory. The color channels are */ + /* pre-multiplied and in the sRGB colorspace. For example, full */ + /* red at half-translucent opacity will be represented as */ + /* `00,00,80,80', not `00,00,FF,80'. See also @FT_LOAD_COLOR. */ /* */ typedef enum FT_Pixel_Mode_ { @@ -301,11 +301,11 @@ FT_BEGIN_HEADER /* each outline point's type. */ /* */ /* If bit~0 is unset, the point is `off' the curve, */ - /* i.e., a Bézier control point, while it is `on' if */ + /* i.e., a Bezier control point, while it is `on' if */ /* set. */ /* */ /* Bit~1 is meaningful for `off' points only. If set, */ - /* it indicates a third-order Bézier arc control point; */ + /* it indicates a third-order Bezier arc control point; */ /* and a second-order control point if unset. */ /* */ /* If bit~2 is set, bits 5-7 contain the drop-out mode */ @@ -532,7 +532,7 @@ FT_BEGIN_HEADER /* A function pointer type used to describe the signature of a `conic */ /* to' function during outline walking or decomposition. */ /* */ - /* A `conic to' is emitted to indicate a second-order Bézier arc in */ + /* A `conic to' is emitted to indicate a second-order Bezier arc in */ /* the outline. */ /* */ /* */ @@ -564,12 +564,12 @@ FT_BEGIN_HEADER /* A function pointer type used to describe the signature of a `cubic */ /* to' function during outline walking or decomposition. */ /* */ - /* A `cubic to' is emitted to indicate a third-order Bézier arc. */ + /* A `cubic to' is emitted to indicate a third-order Bezier arc. */ /* */ /* */ - /* control1 :: A pointer to the first Bézier control point. */ + /* control1 :: A pointer to the first Bezier control point. */ /* */ - /* control2 :: A pointer to the second Bézier control point. */ + /* control2 :: A pointer to the second Bezier control point. */ /* */ /* to :: A pointer to the target end point. */ /* */ @@ -595,16 +595,16 @@ FT_BEGIN_HEADER /* */ /* */ /* A structure to hold various function pointers used during outline */ - /* decomposition in order to emit segments, conic, and cubic Béziers. */ + /* decomposition in order to emit segments, conic, and cubic Beziers. */ /* */ /* */ /* move_to :: The `move to' emitter. */ /* */ /* line_to :: The segment emitter. */ /* */ - /* conic_to :: The second-order Bézier arc emitter. */ + /* conic_to :: The second-order Bezier arc emitter. */ /* */ - /* cubic_to :: The third-order Bézier arc emitter. */ + /* cubic_to :: The third-order Bezier arc emitter. */ /* */ /* shift :: The shift that is applied to coordinates before they */ /* are sent to the emitter. */ @@ -701,7 +701,7 @@ FT_BEGIN_HEADER /* */ /* FT_GLYPH_FORMAT_OUTLINE :: */ /* The glyph image is a vectorial outline made of line segments */ - /* and Bézier arcs; it can be described as an @FT_Outline; you */ + /* and Bezier arcs; it can be described as an @FT_Outline; you */ /* generally want to access the `outline' field of the */ /* @FT_GlyphSlotRec structure to read it. */ /* */ @@ -1064,24 +1064,24 @@ FT_BEGIN_HEADER /* */ /* */ /* FreeType used to provide an area of memory called the `render */ - /* pool' available to all registered rasters. This was not thread */ - /* safe however and now FreeType never allocates this pool. NULL */ - /* is always passed in as pool_base. */ + /* pool' available to all registered rasterizers. This was not */ + /* thread safe, however, and now FreeType never allocates this pool. */ /* */ - /* This function is called each time the render pool changes, or just */ - /* after a new raster object is created. */ + /* This function is called after a new raster object is created. */ /* */ /* */ /* raster :: A handle to the new raster object. */ /* */ - /* pool_base :: The address in memory of the render pool. */ + /* pool_base :: Previously, the address in memory of the render pool. */ + /* Set this to NULL. */ /* */ - /* pool_size :: The size in bytes of the render pool. */ + /* pool_size :: Previously, the size in bytes of the render pool. */ + /* Set this to 0. */ /* */ /* */ - /* Rasters should ignore the render pool and rely on dynamic or stack */ - /* allocation if they want to (a handle to the memory allocator is */ - /* passed to the raster constructor). */ + /* Rasterizers should rely on dynamic or stack allocation if they */ + /* want to (a handle to the memory allocator is passed to the */ + /* rasterizer constructor). */ /* */ typedef void (*FT_Raster_ResetFunc)( FT_Raster raster, diff --git a/include/freetype/ftincrem.h b/include/freetype/ftincrem.h index f6ae2baed..44619f941 100644 --- a/include/freetype/ftincrem.h +++ b/include/freetype/ftincrem.h @@ -4,7 +4,7 @@ /* */ /* FreeType incremental loading (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,6 +21,7 @@ #include #include FT_FREETYPE_H +#include FT_PARAMETER_TAGS_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" @@ -331,18 +332,6 @@ FT_BEGIN_HEADER typedef FT_Incremental_InterfaceRec* FT_Incremental_Interface; - /*************************************************************************** - * - * @constant: - * FT_PARAM_TAG_INCREMENTAL - * - * @description: - * A constant used as the tag of @FT_Parameter structures to indicate - * an incremental loading object to be used by FreeType. - * - */ -#define FT_PARAM_TAG_INCREMENTAL FT_MAKE_TAG( 'i', 'n', 'c', 'r' ) - /* */ diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h index 795c045f2..8e35e38d1 100644 --- a/include/freetype/ftlcdfil.h +++ b/include/freetype/ftlcdfil.h @@ -5,7 +5,7 @@ /* FreeType API for color filtering of subpixel bitmap glyphs */ /* (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,6 +22,7 @@ #include #include FT_FREETYPE_H +#include FT_PARAMETER_TAGS_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" @@ -278,22 +279,6 @@ FT_BEGIN_HEADER unsigned char *weights ); - /* - * @constant: - * FT_PARAM_TAG_LCD_FILTER_WEIGHTS - * - * @description: - * An @FT_Parameter tag to be used with @FT_Face_Properties. The - * corresponding argument specifies the five LCD filter weights for a - * given face (if using @FT_LOAD_TARGET_LCD, for example), overriding - * the global default values or the values set up with - * @FT_Library_Set_LcdFilterWeights. - * - */ -#define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \ - FT_MAKE_TAG( 'l', 'c', 'd', 'f' ) - - /* * @type: * FT_LcdFiveTapFilter @@ -302,6 +287,9 @@ FT_BEGIN_HEADER * A typedef for passing the five LCD filter weights to * @FT_Face_Properties within an @FT_Parameter structure. * + * @since: + * 2.8 + * */ #define FT_LCD_FILTER_FIVE_TAPS 5 diff --git a/include/freetype/ftlist.h b/include/freetype/ftlist.h index 5309cb18b..117473b96 100644 --- a/include/freetype/ftlist.h +++ b/include/freetype/ftlist.h @@ -4,7 +4,7 @@ /* */ /* Generic list support for FreeType (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftlzw.h b/include/freetype/ftlzw.h index a82c95e7c..1615912d6 100644 --- a/include/freetype/ftlzw.h +++ b/include/freetype/ftlzw.h @@ -4,7 +4,7 @@ /* */ /* LZW-compressed stream support. */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftmac.h b/include/freetype/ftmac.h index ad97c6e4c..c1e497ca2 100644 --- a/include/freetype/ftmac.h +++ b/include/freetype/ftmac.h @@ -4,7 +4,7 @@ /* */ /* Additional Mac-specific API. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -35,11 +35,12 @@ FT_BEGIN_HEADER -/* gcc-3.4.1 and later can warn about functions tagged as deprecated */ + /* gcc-3.1 and later can warn about functions tagged as deprecated */ #ifndef FT_DEPRECATED_ATTRIBUTE -#if defined(__GNUC__) && \ - ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) -#define FT_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) +#if defined( __GNUC__ ) && \ + ( ( __GNUC__ >= 4 ) || \ + ( ( __GNUC__ == 3 ) && ( __GNUC_MINOR__ >= 1 ) ) ) +#define FT_DEPRECATED_ATTRIBUTE __attribute__(( deprecated )) #else #define FT_DEPRECATED_ATTRIBUTE #endif diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index c41b80ea6..9948102c1 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -4,7 +4,7 @@ /* */ /* FreeType Multiple Master font interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -178,7 +178,8 @@ FT_BEGIN_HEADER /* strid :: The entry in `name' table identifying this instance. */ /* */ /* psid :: The entry in `name' table identifying a PostScript name */ - /* for this instance. */ + /* for this instance. Value 0xFFFF indicates a missing */ + /* entry. */ /* */ typedef struct FT_Var_Named_Style_ { @@ -195,7 +196,7 @@ FT_BEGIN_HEADER /* FT_MM_Var */ /* */ /* */ - /* A structure to model the axes and space of a Adobe MM, TrueType */ + /* A structure to model the axes and space of an Adobe MM, TrueType */ /* GX, or OpenType variation font. */ /* */ /* Some fields are specific to one format and not to the others. */ @@ -285,7 +286,7 @@ FT_BEGIN_HEADER /* */ /* amaster :: The variation descriptor. */ /* Allocates a data structure, which the user must */ - /* deallocate with `free' after use. */ + /* deallocate with a call to @FT_Done_MM_Var after use. */ /* */ /* */ /* FreeType error code. 0~means success. */ @@ -295,6 +296,26 @@ FT_BEGIN_HEADER FT_MM_Var* *amaster ); + /*************************************************************************/ + /* */ + /* */ + /* FT_Done_MM_Var */ + /* */ + /* */ + /* Free the memory allocated by @FT_Get_MM_Var. */ + /* */ + /* */ + /* library :: A handle of the face's parent library object that was */ + /* used in the call to @FT_Get_MM_Var to create `amaster'. */ + /* */ + /* */ + /* FreeType error code. 0~means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Done_MM_Var( FT_Library library, + FT_MM_Var *amaster ); + + /*************************************************************************/ /* */ /* */ @@ -321,6 +342,15 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* [Since 2.8.1] To reset all axes to the default values, call the */ + /* function with `num_coords' set to zero and `coords' set to NULL. */ + /* */ + /* [Since 2.9] If `num_coords' is larger than zero, this function */ + /* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */ + /* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */ + /* is zero, this bit flag gets unset. */ + /* */ FT_EXPORT( FT_Error ) FT_Set_MM_Design_Coordinates( FT_Face face, FT_UInt num_coords, @@ -351,6 +381,17 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* [Since 2.8.1] To reset all axes to the default values, call the */ + /* function with `num_coords' set to zero and `coords' set to NULL. */ + /* [Since 2.9] `Default values' means the currently selected named */ + /* instance (or the base font if no named instance is selected). */ + /* */ + /* [Since 2.9] If `num_coords' is larger than zero, this function */ + /* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */ + /* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */ + /* is zero, this bit flag gets unset. */ + /* */ FT_EXPORT( FT_Error ) FT_Set_Var_Design_Coordinates( FT_Face face, FT_UInt num_coords, @@ -381,6 +422,9 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* 2.7.1 */ + /* */ FT_EXPORT( FT_Error ) FT_Get_Var_Design_Coordinates( FT_Face face, FT_UInt num_coords, @@ -415,6 +459,17 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* [Since 2.8.1] To reset all axes to the default values, call the */ + /* function with `num_coords' set to zero and `coords' set to NULL. */ + /* [Since 2.9] `Default values' means the currently selected named */ + /* instance (or the base font if no named instance is selected). */ + /* */ + /* [Since 2.9] If `num_coords' is larger than zero, this function */ + /* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */ + /* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */ + /* is zero, this bit flag gets unset. */ + /* */ FT_EXPORT( FT_Error ) FT_Set_MM_Blend_Coordinates( FT_Face face, FT_UInt num_coords, @@ -446,6 +501,9 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* 2.7.1 */ + /* */ FT_EXPORT( FT_Error ) FT_Get_MM_Blend_Coordinates( FT_Face face, FT_UInt num_coords, @@ -474,11 +532,101 @@ FT_BEGIN_HEADER /* */ /* This is another name of @FT_Get_MM_Blend_Coordinates. */ /* */ + /* */ + /* 2.7.1 */ + /* */ FT_EXPORT( FT_Error ) FT_Get_Var_Blend_Coordinates( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); + + /*************************************************************************/ + /* */ + /* */ + /* FT_VAR_AXIS_FLAG_XXX */ + /* */ + /* */ + /* A list of bit flags used in the return value of */ + /* @FT_Get_Var_Axis_Flags. */ + /* */ + /* */ + /* FT_VAR_AXIS_FLAG_HIDDEN :: */ + /* The variation axis should not be exposed to user interfaces. */ + /* */ + /* */ + /* 2.8.1 */ + /* */ +#define FT_VAR_AXIS_FLAG_HIDDEN 1 + + + /*************************************************************************/ + /* */ + /* */ + /* FT_Get_Var_Axis_Flags */ + /* */ + /* */ + /* Get the `flags' field of an OpenType Variation Axis Record. */ + /* */ + /* Not meaningful for Adobe MM fonts (`*flags' is always zero). */ + /* */ + /* */ + /* master :: The variation descriptor. */ + /* */ + /* axis_index :: The index of the requested variation axis. */ + /* */ + /* */ + /* flags :: The `flags' field. See @FT_VAR_AXIS_FLAG_XXX for */ + /* possible values. */ + /* */ + /* */ + /* FreeType error code. 0~means success. */ + /* */ + /* */ + /* 2.8.1 */ + /* */ + FT_EXPORT( FT_Error ) + FT_Get_Var_Axis_Flags( FT_MM_Var* master, + FT_UInt axis_index, + FT_UInt* flags ); + + + /*************************************************************************/ + /* */ + /* */ + /* FT_Set_Named_Instance */ + /* */ + /* */ + /* Set or change the current named instance. */ + /* */ + /* */ + /* face :: A handle to the source face. */ + /* */ + /* instance_index :: The index of the requested instance, starting */ + /* with value 1. If set to value 0, FreeType */ + /* switches to font access without a named */ + /* instance. */ + /* */ + /* */ + /* FreeType error code. 0~means success. */ + /* */ + /* */ + /* The function uses the value of `instance_index' to set bits 16-30 */ + /* of the face's `face_index' field. It also resets any variation */ + /* applied to the font, and the @FT_FACE_FLAG_VARIATION bit of the */ + /* face's `face_flags' field gets reset to zero (i.e., */ + /* @FT_IS_VARIATION will return false). */ + /* */ + /* For Adobe MM fonts (which don't have named instances) this */ + /* function simply resets the current face to the default instance. */ + /* */ + /* */ + /* 2.9 */ + /* */ + FT_EXPORT( FT_Error ) + FT_Set_Named_Instance( FT_Face face, + FT_UInt instance_index ); + /* */ diff --git a/include/freetype/ftmodapi.h b/include/freetype/ftmodapi.h index 4147aadf8..a6eb876eb 100644 --- a/include/freetype/ftmodapi.h +++ b/include/freetype/ftmodapi.h @@ -4,7 +4,7 @@ /* */ /* FreeType modules public interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -323,16 +323,15 @@ FT_BEGIN_HEADER * The module name. * * property_name :: - * The property name. Properties are described in the `Synopsis' - * subsection of the module's documentation. + * The property name. Properties are described in section + * @properties. * * Note that only a few modules have properties. * * value :: * A generic pointer to a variable or structure that gives the new * value of the property. The exact definition of `value' is - * dependent on the property; see the `Synopsis' subsection of the - * module's documentation. + * dependent on the property; see section @properties. * * @return: * FreeType error code. 0~means success. @@ -390,15 +389,14 @@ FT_BEGIN_HEADER * The module name. * * property_name :: - * The property name. Properties are described in the `Synopsis' - * subsection of the module's documentation. + * The property name. Properties are described in section + * @properties. * * @inout: * value :: * A generic pointer to a variable or structure that gives the * value of the property. The exact definition of `value' is - * dependent on the property; see the `Synopsis' subsection of the - * module's documentation. + * dependent on the property; see section @properties. * * @return: * FreeType error code. 0~means success. @@ -446,8 +444,8 @@ FT_BEGIN_HEADER /* */ /* If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is */ /* set, this function reads the `FREETYPE_PROPERTIES' environment */ - /* variable to control driver properties. See sections @auto_hinter, */ - /* @cff_driver, @pcf_driver, and @tt_driver for more. */ + /* variable to control driver properties. See section @properties */ + /* for more. */ /* */ /* If the compilation option is not set, this function does nothing. */ /* */ @@ -475,6 +473,9 @@ FT_BEGIN_HEADER /* */ /* library :: A handle to a new library object. */ /* */ + /* */ + /* 2.8 */ + /* */ FT_EXPORT( void ) FT_Set_Default_Properties( FT_Library library ); diff --git a/include/freetype/ftmoderr.h b/include/freetype/ftmoderr.h index 7f608375e..e0fc1312b 100644 --- a/include/freetype/ftmoderr.h +++ b/include/freetype/ftmoderr.h @@ -4,7 +4,7 @@ /* */ /* FreeType module error offsets (specification). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftotval.h b/include/freetype/ftotval.h index b5d27cfe7..26731c2b9 100644 --- a/include/freetype/ftotval.h +++ b/include/freetype/ftotval.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating OpenType tables (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftoutln.h b/include/freetype/ftoutln.h index 07f73ebb1..89389a49b 100644 --- a/include/freetype/ftoutln.h +++ b/include/freetype/ftoutln.h @@ -5,7 +5,7 @@ /* Support for the FT_Outline type used to store glyph shapes of */ /* most scalable font formats (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -89,7 +89,7 @@ FT_BEGIN_HEADER /* */ /* */ /* Walk over an outline's structure to decompose it into individual */ - /* segments and Bézier arcs. This function also emits `move to' */ + /* segments and Bezier arcs. This function also emits `move to' */ /* operations to indicate the start of new contours in the outline. */ /* */ /* */ @@ -190,9 +190,6 @@ FT_BEGIN_HEADER /* If the outline's `owner' field is not set, only the outline */ /* descriptor will be released. */ /* */ - /* The reason why this function takes an `library' parameter is */ - /* simply to use ft_mem_free(). */ - /* */ FT_EXPORT( FT_Error ) FT_Outline_Done( FT_Library library, FT_Outline* outline ); @@ -232,10 +229,10 @@ FT_BEGIN_HEADER /* */ /* */ /* Return an outline's `control box'. The control box encloses all */ - /* the outline's points, including Bézier control points. Though it */ + /* the outline's points, including Bezier control points. Though it */ /* coincides with the exact bounding box for most glyphs, it can be */ /* slightly larger in some situations (like when rotating an outline */ - /* that contains Bézier outside arcs). */ + /* that contains Bezier outside arcs). */ /* */ /* Computing the control box is very fast, while getting the bounding */ /* box can take much more time as it needs to walk over all segments */ @@ -385,6 +382,9 @@ FT_BEGIN_HEADER /* @FT_Outline_Embolden, which uses the same strength in both */ /* directions. */ /* */ + /* */ + /* 2.4.10 */ + /* */ FT_EXPORT( FT_Error ) FT_Outline_EmboldenXY( FT_Outline* outline, FT_Pos xstrength, diff --git a/include/freetype/ftparams.h b/include/freetype/ftparams.h new file mode 100644 index 000000000..5a9006c50 --- /dev/null +++ b/include/freetype/ftparams.h @@ -0,0 +1,205 @@ +/***************************************************************************/ +/* */ +/* ftparams.h */ +/* */ +/* FreeType API for possible FT_Parameter tags (specification only). */ +/* */ +/* Copyright 2017-2018 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef FTPARAMS_H_ +#define FTPARAMS_H_ + +#include +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * parameter_tags + * + * @title: + * Parameter Tags + * + * @abstract: + * Macros for driver property and font loading parameter tags. + * + * @description: + * This section contains macros for the @FT_Parameter structure that are + * used with various functions to activate some special functionality or + * different behaviour of various components of FreeType. + * + */ + + + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY + * + * @description: + * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic + * family names in the `name' table (introduced in OpenType version + * 1.4). Use this for backward compatibility with legacy systems that + * have a four-faces-per-family restriction. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \ + FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) + + + /* this constant is deprecated */ +#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \ + FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY + + + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY + * + * @description: + * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic + * subfamily names in the `name' table (introduced in OpenType version + * 1.4). Use this for backward compatibility with legacy systems that + * have a four-faces-per-family restriction. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \ + FT_MAKE_TAG( 'i', 'g', 'p', 's' ) + + + /* this constant is deprecated */ +#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \ + FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY + + + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_INCREMENTAL + * + * @description: + * An @FT_Parameter tag to be used with @FT_Open_Face to indicate + * incremental glyph loading. + * + */ +#define FT_PARAM_TAG_INCREMENTAL \ + FT_MAKE_TAG( 'i', 'n', 'c', 'r' ) + + + /************************************************************************** + * + * @constant: + * FT_PARAM_TAG_LCD_FILTER_WEIGHTS + * + * @description: + * An @FT_Parameter tag to be used with @FT_Face_Properties. The + * corresponding argument specifies the five LCD filter weights for a + * given face (if using @FT_LOAD_TARGET_LCD, for example), overriding + * the global default values or the values set up with + * @FT_Library_SetLcdFilterWeights. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \ + FT_MAKE_TAG( 'l', 'c', 'd', 'f' ) + + + /************************************************************************** + * + * @constant: + * FT_PARAM_TAG_RANDOM_SEED + * + * @description: + * An @FT_Parameter tag to be used with @FT_Face_Properties. The + * corresponding 32bit signed integer argument overrides the font + * driver's random seed value with a face-specific one; see + * @random-seed. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_RANDOM_SEED \ + FT_MAKE_TAG( 's', 'e', 'e', 'd' ) + + + /************************************************************************** + * + * @constant: + * FT_PARAM_TAG_STEM_DARKENING + * + * @description: + * An @FT_Parameter tag to be used with @FT_Face_Properties. The + * corresponding Boolean argument specifies whether to apply stem + * darkening, overriding the global default values or the values set up + * with @FT_Property_Set (see @no-stem-darkening). + * + * This is a passive setting that only takes effect if the font driver + * or autohinter honors it, which the CFF, Type~1, and CID drivers + * always do, but the autohinter only in `light' hinting mode (as of + * version 2.9). + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_STEM_DARKENING \ + FT_MAKE_TAG( 'd', 'a', 'r', 'k' ) + + + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_UNPATENTED_HINTING + * + * @description: + * Deprecated, no effect. + * + * Previously: A constant used as the tag of an @FT_Parameter structure to + * indicate that unpatented methods only should be used by the TrueType + * bytecode interpreter for a typeface opened by @FT_Open_Face. + * + */ +#define FT_PARAM_TAG_UNPATENTED_HINTING \ + FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) + + + /* */ + + +FT_END_HEADER + + +#endif /* FTPARAMS_H_ */ + + +/* END */ diff --git a/include/freetype/ftpcfdrv.h b/include/freetype/ftpcfdrv.h deleted file mode 100644 index 6622c936f..000000000 --- a/include/freetype/ftpcfdrv.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftpcfdrv.h */ -/* */ -/* FreeType API for controlling the PCF driver (specification only). */ -/* */ -/* Copyright 2017 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef FTPCFDRV_H_ -#define FTPCFDRV_H_ - -#include -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /************************************************************************** - * - * @section: - * pcf_driver - * - * @title: - * The PCF driver - * - * @abstract: - * Controlling the PCF driver module. - * - * @description: - * While FreeType's PCF driver doesn't expose API functions by itself, - * it is possible to control its behaviour with @FT_Property_Set and - * @FT_Property_Get. Right now, there is a single property - * `no-long-family-names' available if FreeType is compiled with - * PCF_CONFIG_OPTION_LONG_FAMILY_NAMES. - * - * The PCF driver's module name is `pcf'. - * - */ - - - /************************************************************************** - * - * @property: - * no-long-family-names - * - * @description: - * If PCF_CONFIG_OPTION_LONG_FAMILY_NAMES is active while compiling - * FreeType, the PCF driver constructs long family names. - * - * There are many PCF fonts just called `Fixed' which look completely - * different, and which have nothing to do with each other. When - * selecting `Fixed' in KDE or Gnome one gets results that appear rather - * random, the style changes often if one changes the size and one - * cannot select some fonts at all. The improve this situation, the PCF - * module prepends the foundry name (plus a space) to the family name. - * It also checks whether there are `wide' characters; all put together, - * family names like `Sony Fixed' or `Misc Fixed Wide' are constructed. - * - * If `no-long-family-names' is set, this feature gets switched off. - * - * { - * FT_Library library; - * FT_Bool no_long_family_names = TRUE; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "pcf", - * "no-long-family-names", - * &no_long_family_names ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values 1 and 0 for `on' and `off', respectively). - * - */ - - -FT_END_HEADER - - -#endif /* FTPCFDRV_H_ */ - - -/* END */ diff --git a/include/freetype/ftpfr.h b/include/freetype/ftpfr.h index f2a6ae934..a69cc482d 100644 --- a/include/freetype/ftpfr.h +++ b/include/freetype/ftpfr.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing PFR-specific data (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -71,7 +71,7 @@ FT_BEGIN_HEADER * * ametrics_x_scale :: * A 16.16 fixed-point number used to scale distance expressed - * in metrics units to device sub-pixels. This is equivalent to + * in metrics units to device subpixels. This is equivalent to * `face->size->x_scale', but for metrics only. Optional (parameter * can be NULL). * @@ -123,7 +123,7 @@ FT_BEGIN_HEADER * mode, which always returns distances converted to outline units. * * You can use the value of the `x_scale' and `y_scale' parameters - * returned by @FT_Get_PFR_Metrics to scale these to device sub-pixels. + * returned by @FT_Get_PFR_Metrics to scale these to device subpixels. */ FT_EXPORT( FT_Error ) FT_Get_PFR_Kerning( FT_Face face, @@ -154,7 +154,7 @@ FT_BEGIN_HEADER * * @note: * You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics - * to convert the advance to device sub-pixels (i.e., 1/64th of pixels). + * to convert the advance to device subpixels (i.e., 1/64th of pixels). */ FT_EXPORT( FT_Error ) FT_Get_PFR_Advance( FT_Face face, diff --git a/include/freetype/ftrender.h b/include/freetype/ftrender.h index 960837580..fa8ad22b9 100644 --- a/include/freetype/ftrender.h +++ b/include/freetype/ftrender.h @@ -4,7 +4,7 @@ /* */ /* FreeType renderer modules public interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -88,7 +88,7 @@ FT_BEGIN_HEADER typedef FT_Error (*FT_Renderer_RenderFunc)( FT_Renderer renderer, FT_GlyphSlot slot, - FT_UInt mode, + FT_Render_Mode mode, const FT_Vector* origin ); typedef FT_Error diff --git a/include/freetype/ftsizes.h b/include/freetype/ftsizes.h index 2f3958a85..72cb08bf2 100644 --- a/include/freetype/ftsizes.h +++ b/include/freetype/ftsizes.h @@ -4,7 +4,7 @@ /* */ /* FreeType size objects management (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftsnames.h b/include/freetype/ftsnames.h index ff888b705..8eb8d70ff 100644 --- a/include/freetype/ftsnames.h +++ b/include/freetype/ftsnames.h @@ -7,7 +7,7 @@ /* */ /* This is _not_ used to retrieve glyph names! */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,6 +25,7 @@ #include #include FT_FREETYPE_H +#include FT_PARAMETER_TAGS_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" @@ -189,6 +190,9 @@ FT_BEGIN_HEADER /* Please refer to the TrueType or OpenType specification for more */ /* details. */ /* */ + /* */ + /* 2.8 */ + /* */ typedef struct FT_SfntLangTag_ { FT_Byte* string; /* this string is *not* null-terminated! */ @@ -229,53 +233,15 @@ FT_BEGIN_HEADER /* invalid format~1 language ID values, FT_Err_Invalid_Argument is */ /* returned. */ /* */ + /* */ + /* 2.8 */ + /* */ FT_EXPORT( FT_Error ) FT_Get_Sfnt_LangTag( FT_Face face, FT_UInt langID, FT_SfntLangTag *alangTag ); - /*************************************************************************** - * - * @constant: - * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY - * - * @description: - * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic - * family names in the `name' table (introduced in OpenType version - * 1.4). Use this for backwards compatibility with legacy systems that - * have a four-faces-per-family restriction. - * - */ -#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \ - FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) - - - /* this constant is deprecated */ -#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \ - FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY - - - /*************************************************************************** - * - * @constant: - * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY - * - * @description: - * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic - * subfamily names in the `name' table (introduced in OpenType version - * 1.4). Use this for backwards compatibility with legacy systems that - * have a four-faces-per-family restriction. - * - */ -#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \ - FT_MAKE_TAG( 'i', 'g', 'p', 's' ) - - - /* this constant is deprecated */ -#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \ - FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY - /* */ diff --git a/include/freetype/ftstroke.h b/include/freetype/ftstroke.h index 8a868089c..44b6fbe19 100644 --- a/include/freetype/ftstroke.h +++ b/include/freetype/ftstroke.h @@ -4,7 +4,7 @@ /* */ /* FreeType path stroker (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -136,7 +136,7 @@ FT_BEGIN_HEADER * FT_STROKER_LINEJOIN_MITER_VARIABLE generates a mitered line * join as used in XPS. FT_STROKER_LINEJOIN_MITER is an alias * for FT_STROKER_LINEJOIN_MITER_VARIABLE, retained for - * backwards compatibility. + * backward compatibility. */ typedef enum FT_Stroker_LineJoin_ { @@ -466,7 +466,7 @@ FT_BEGIN_HEADER * FT_Stroker_ConicTo * * @description: - * `Draw' a single quadratic Bézier in the stroker's current sub-path, + * `Draw' a single quadratic Bezier in the stroker's current sub-path, * from the last position. * * @input: @@ -474,7 +474,7 @@ FT_BEGIN_HEADER * The target stroker handle. * * control :: - * A pointer to a Bézier control point. + * A pointer to a Bezier control point. * * to :: * A pointer to the destination point. @@ -498,7 +498,7 @@ FT_BEGIN_HEADER * FT_Stroker_CubicTo * * @description: - * `Draw' a single cubic Bézier in the stroker's current sub-path, + * `Draw' a single cubic Bezier in the stroker's current sub-path, * from the last position. * * @input: @@ -506,10 +506,10 @@ FT_BEGIN_HEADER * The target stroker handle. * * control1 :: - * A pointer to the first Bézier control point. + * A pointer to the first Bezier control point. * * control2 :: - * A pointer to second Bézier control point. + * A pointer to second Bezier control point. * * to :: * A pointer to the destination point. diff --git a/include/freetype/ftsynth.h b/include/freetype/ftsynth.h index 1863fa238..ff9fb43d9 100644 --- a/include/freetype/ftsynth.h +++ b/include/freetype/ftsynth.h @@ -5,7 +5,7 @@ /* FreeType synthesizing code for emboldening and slanting */ /* (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftsystem.h b/include/freetype/ftsystem.h index 1aa4762ad..f6b1629ef 100644 --- a/include/freetype/ftsystem.h +++ b/include/freetype/ftsystem.h @@ -4,7 +4,7 @@ /* */ /* FreeType low-level system interface definition (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/fttrigon.h b/include/freetype/fttrigon.h index 89f035067..2e3f3f1f7 100644 --- a/include/freetype/fttrigon.h +++ b/include/freetype/fttrigon.h @@ -4,7 +4,7 @@ /* */ /* FreeType trigonometric functions (specification). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/ftttdrv.h b/include/freetype/ftttdrv.h deleted file mode 100644 index 79e3e6e8b..000000000 --- a/include/freetype/ftttdrv.h +++ /dev/null @@ -1,328 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftttdrv.h */ -/* */ -/* FreeType API for controlling the TrueType driver */ -/* (specification only). */ -/* */ -/* Copyright 2013-2017 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef FTTTDRV_H_ -#define FTTTDRV_H_ - -#include -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /************************************************************************** - * - * @section: - * tt_driver - * - * @title: - * The TrueType driver - * - * @abstract: - * Controlling the TrueType driver module. - * - * @description: - * While FreeType's TrueType driver doesn't expose API functions by - * itself, it is possible to control its behaviour with @FT_Property_Set - * and @FT_Property_Get. The following lists the available properties - * together with the necessary macros and structures. - * - * The TrueType driver's module name is `truetype'. - * - * We start with a list of definitions, kindly provided by Greg - * Hitchcock. - * - * _Bi-Level_ _Rendering_ - * - * Monochromatic rendering, exclusively used in the early days of - * TrueType by both Apple and Microsoft. Microsoft's GDI interface - * supported hinting of the right-side bearing point, such that the - * advance width could be non-linear. Most often this was done to - * achieve some level of glyph symmetry. To enable reasonable - * performance (e.g., not having to run hinting on all glyphs just to - * get the widths) there was a bit in the head table indicating if the - * side bearing was hinted, and additional tables, `hdmx' and `LTSH', to - * cache hinting widths across multiple sizes and device aspect ratios. - * - * _Font_ _Smoothing_ - * - * Microsoft's GDI implementation of anti-aliasing. Not traditional - * anti-aliasing as the outlines were hinted before the sampling. The - * widths matched the bi-level rendering. - * - * _ClearType_ _Rendering_ - * - * Technique that uses physical subpixels to improve rendering on LCD - * (and other) displays. Because of the higher resolution, many methods - * of improving symmetry in glyphs through hinting the right-side - * bearing were no longer necessary. This lead to what GDI calls - * `natural widths' ClearType, see - * http://www.beatstamm.com/typography/RTRCh4.htm#Sec21. Since hinting - * has extra resolution, most non-linearity went away, but it is still - * possible for hints to change the advance widths in this mode. - * - * _ClearType_ _Compatible_ _Widths_ - * - * One of the earliest challenges with ClearType was allowing the - * implementation in GDI to be selected without requiring all UI and - * documents to reflow. To address this, a compatible method of - * rendering ClearType was added where the font hints are executed once - * to determine the width in bi-level rendering, and then re-run in - * ClearType, with the difference in widths being absorbed in the font - * hints for ClearType (mostly in the white space of hints); see - * http://www.beatstamm.com/typography/RTRCh4.htm#Sec20. Somewhat by - * definition, compatible width ClearType allows for non-linear widths, - * but only when the bi-level version has non-linear widths. - * - * _ClearType_ _Subpixel_ _Positioning_ - * - * One of the nice benefits of ClearType is the ability to more crisply - * display fractional widths; unfortunately, the GDI model of integer - * bitmaps did not support this. However, the WPF and Direct Write - * frameworks do support fractional widths. DWrite calls this `natural - * mode', not to be confused with GDI's `natural widths'. Subpixel - * positioning, in the current implementation of Direct Write, - * unfortunately does not support hinted advance widths, see - * http://www.beatstamm.com/typography/RTRCh4.htm#Sec22. Note that the - * TrueType interpreter fully allows the advance width to be adjusted in - * this mode, just the DWrite client will ignore those changes. - * - * _ClearType_ _Backwards_ _Compatibility_ - * - * This is a set of exceptions made in the TrueType interpreter to - * minimize hinting techniques that were problematic with the extra - * resolution of ClearType; see - * http://www.beatstamm.com/typography/RTRCh4.htm#Sec1 and - * http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx. - * This technique is not to be confused with ClearType compatible - * widths. ClearType backwards compatibility has no direct impact on - * changing advance widths, but there might be an indirect impact on - * disabling some deltas. This could be worked around in backwards - * compatibility mode. - * - * _Native_ _ClearType_ _Mode_ - * - * (Not to be confused with `natural widths'.) This mode removes all - * the exceptions in the TrueType interpreter when running with - * ClearType. Any issues on widths would still apply, though. - * - */ - - - /************************************************************************** - * - * @property: - * interpreter-version - * - * @description: - * Currently, three versions are available, two representing the - * bytecode interpreter with subpixel hinting support (old `Infinality' - * code and new stripped-down and higher performance `minimal' code) and - * one without, respectively. The default is subpixel support if - * TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel support - * otherwise (since it isn't available then). - * - * If subpixel hinting is on, many TrueType bytecode instructions behave - * differently compared to B/W or grayscale rendering (except if `native - * ClearType' is selected by the font). Microsoft's main idea is to - * render at a much increased horizontal resolution, then sampling down - * the created output to subpixel precision. However, many older fonts - * are not suited to this and must be specially taken care of by - * applying (hardcoded) tweaks in Microsoft's interpreter. - * - * Details on subpixel hinting and some of the necessary tweaks can be - * found in Greg Hitchcock's whitepaper at - * `http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. - * Note that FreeType currently doesn't really `subpixel hint' (6x1, 6x2, - * or 6x5 supersampling) like discussed in the paper. Depending on the - * chosen interpreter, it simply ignores instructions on vertical stems - * to arrive at very similar results. - * - * The following example code demonstrates how to deactivate subpixel - * hinting (omitting the error handling). - * - * { - * FT_Library library; - * FT_Face face; - * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_35; - * - * - * FT_Init_FreeType( &library ); - * - * FT_Property_Set( library, "truetype", - * "interpreter-version", - * &interpreter_version ); - * } - * - * @note: - * This property can be used with @FT_Property_Get also. - * - * This property can be set via the `FREETYPE_PROPERTIES' environment - * variable (using values `35', `38', or `40'). - */ - - - /************************************************************************** - * - * @enum: - * TT_INTERPRETER_VERSION_XXX - * - * @description: - * A list of constants used for the @interpreter-version property to - * select the hinting engine for Truetype fonts. - * - * The numeric value in the constant names represents the version - * number as returned by the `GETINFO' bytecode instruction. - * - * @values: - * TT_INTERPRETER_VERSION_35 :: - * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in - * Windows~98; only grayscale and B/W rasterizing is supported. - * - * TT_INTERPRETER_VERSION_38 :: - * Version~38 corresponds to MS rasterizer v.1.9; it is roughly - * equivalent to the hinting provided by DirectWrite ClearType (as can - * be found, for example, in the Internet Explorer~9 running on - * Windows~7). It is used in FreeType to select the `Infinality' - * subpixel hinting code. The code may be removed in a future - * version. - * - * TT_INTERPRETER_VERSION_40 :: - * Version~40 corresponds to MS rasterizer v.2.1; it is roughly - * equivalent to the hinting provided by DirectWrite ClearType (as can - * be found, for example, in Microsoft's Edge Browser on Windows~10). - * It is used in FreeType to select the `minimal' subpixel hinting - * code, a stripped-down and higher performance version of the - * `Infinality' code. - * - * @note: - * This property controls the behaviour of the bytecode interpreter - * and thus how outlines get hinted. It does *not* control how glyph - * get rasterized! In particular, it does not control subpixel color - * filtering. - * - * If FreeType has not been compiled with the configuration option - * FT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 or~40 causes - * an `FT_Err_Unimplemented_Feature' error. - * - * Depending on the graphics framework, Microsoft uses different - * bytecode and rendering engines. As a consequence, the version - * numbers returned by a call to the `GETINFO' bytecode instruction are - * more convoluted than desired. - * - * Here are two tables that try to shed some light on the possible - * values for the MS rasterizer engine, together with the additional - * features introduced by it. - * - * { - * GETINFO framework version feature - * ------------------------------------------------------------------- - * 3 GDI (Win 3.1), v1.0 16-bit, first version - * TrueImage - * 33 GDI (Win NT 3.1), v1.5 32-bit - * HP Laserjet - * 34 GDI (Win 95) v1.6 font smoothing, - * new SCANTYPE opcode - * 35 GDI (Win 98/2000) v1.7 (UN)SCALED_COMPONENT_OFFSET - * bits in composite glyphs - * 36 MGDI (Win CE 2) v1.6+ classic ClearType - * 37 GDI (XP and later), v1.8 ClearType - * GDI+ old (before Vista) - * 38 GDI+ old (Vista, Win 7), v1.9 subpixel ClearType, - * WPF Y-direction ClearType, - * additional error checking - * 39 DWrite (before Win 8) v2.0 subpixel ClearType flags - * in GETINFO opcode, - * bug fixes - * 40 GDI+ (after Win 7), v2.1 Y-direction ClearType flag - * DWrite (Win 8) in GETINFO opcode, - * Gray ClearType - * } - * - * The `version' field gives a rough orientation only, since some - * applications provided certain features much earlier (as an example, - * Microsoft Reader used subpixel and Y-direction ClearType already in - * Windows 2000). Similarly, updates to a given framework might include - * improved hinting support. - * - * { - * version sampling rendering comment - * x y x y - * -------------------------------------------------------------- - * v1.0 normal normal B/W B/W bi-level - * v1.6 high high gray gray grayscale - * v1.8 high normal color-filter B/W (GDI) ClearType - * v1.9 high high color-filter gray Color ClearType - * v2.1 high normal gray B/W Gray ClearType - * v2.1 high high gray gray Gray ClearType - * } - * - * Color and Gray ClearType are the two available variants of - * `Y-direction ClearType', meaning grayscale rasterization along the - * Y-direction; the name used in the TrueType specification for this - * feature is `symmetric smoothing'. `Classic ClearType' is the - * original algorithm used before introducing a modified version in - * Win~XP. Another name for v1.6's grayscale rendering is `font - * smoothing', and `Color ClearType' is sometimes also called `DWrite - * ClearType'. To differentiate between today's Color ClearType and the - * earlier ClearType variant with B/W rendering along the vertical axis, - * the latter is sometimes called `GDI ClearType'. - * - * `Normal' and `high' sampling describe the (virtual) resolution to - * access the rasterized outline after the hinting process. `Normal' - * means 1 sample per grid line (i.e., B/W). In the current Microsoft - * implementation, `high' means an extra virtual resolution of 16x16 (or - * 16x1) grid lines per pixel for bytecode instructions like `MIRP'. - * After hinting, these 16 grid lines are mapped to 6x5 (or 6x1) grid - * lines for color filtering if Color ClearType is activated. - * - * Note that `Gray ClearType' is essentially the same as v1.6's - * grayscale rendering. However, the GETINFO instruction handles it - * differently: v1.6 returns bit~12 (hinting for grayscale), while v2.1 - * returns bits~13 (hinting for ClearType), 18 (symmetrical smoothing), - * and~19 (Gray ClearType). Also, this mode respects bits 2 and~3 for - * the version~1 gasp table exclusively (like Color ClearType), while - * v1.6 only respects the values of version~0 (bits 0 and~1). - * - * Keep in mind that the features of the above interpreter versions - * might not map exactly to FreeType features or behavior because it is - * a fundamentally different library with different internals. - * - */ -#define TT_INTERPRETER_VERSION_35 35 -#define TT_INTERPRETER_VERSION_38 38 -#define TT_INTERPRETER_VERSION_40 40 - - /* */ - - -FT_END_HEADER - - -#endif /* FTTTDRV_H_ */ - - -/* END */ diff --git a/include/freetype/fttypes.h b/include/freetype/fttypes.h index eab8adaad..f638c2e54 100644 --- a/include/freetype/fttypes.h +++ b/include/freetype/fttypes.h @@ -4,7 +4,7 @@ /* */ /* FreeType simple types definitions (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -425,7 +425,7 @@ FT_BEGIN_HEADER /* The address of the FreeType object that is under finalization. */ /* Its client data is accessed through its `generic' field. */ /* */ - typedef void (*FT_Generic_Finalizer)(void* object); + typedef void (*FT_Generic_Finalizer)( void* object ); /*************************************************************************/ diff --git a/include/freetype/ftwinfnt.h b/include/freetype/ftwinfnt.h index 1eeef6c8b..461c65b77 100644 --- a/include/freetype/ftwinfnt.h +++ b/include/freetype/ftwinfnt.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing Windows fnt-specific data. */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -78,7 +78,7 @@ FT_BEGIN_HEADER * Mac Roman encoding. * * FT_WinFNT_ID_OEM :: - * From Michael Pöttgen : + * From Michael Poettgen : * * The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM * is used for the charset of vector fonts, like `modern.fon', diff --git a/include/freetype/internal/autohint.h b/include/freetype/internal/autohint.h index bae83e738..f4d308f68 100644 --- a/include/freetype/internal/autohint.h +++ b/include/freetype/internal/autohint.h @@ -4,7 +4,7 @@ /* */ /* High-level `autohint' module-specific interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/cffotypes.h b/include/freetype/internal/cffotypes.h new file mode 100644 index 000000000..57e7591d4 --- /dev/null +++ b/include/freetype/internal/cffotypes.h @@ -0,0 +1,108 @@ +/***************************************************************************/ +/* */ +/* cffotypes.h */ +/* */ +/* Basic OpenType/CFF object type definitions (specification). */ +/* */ +/* Copyright 2017-2018 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef CFFOTYPES_H_ +#define CFFOTYPES_H_ + +#include +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_CFF_TYPES_H +#include FT_INTERNAL_TRUETYPE_TYPES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H +#include FT_INTERNAL_POSTSCRIPT_HINTS_H + + +FT_BEGIN_HEADER + + + typedef TT_Face CFF_Face; + + + /*************************************************************************/ + /* */ + /* */ + /* CFF_Size */ + /* */ + /* */ + /* A handle to an OpenType size object. */ + /* */ + typedef struct CFF_SizeRec_ + { + FT_SizeRec root; + FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */ + + } CFF_SizeRec, *CFF_Size; + + + /*************************************************************************/ + /* */ + /* */ + /* CFF_GlyphSlot */ + /* */ + /* */ + /* A handle to an OpenType glyph slot object. */ + /* */ + typedef struct CFF_GlyphSlotRec_ + { + FT_GlyphSlotRec root; + + FT_Bool hint; + FT_Bool scaled; + + FT_Fixed x_scale; + FT_Fixed y_scale; + + } CFF_GlyphSlotRec, *CFF_GlyphSlot; + + + /*************************************************************************/ + /* */ + /* */ + /* CFF_Internal */ + /* */ + /* */ + /* The interface to the `internal' field of `FT_Size'. */ + /* */ + typedef struct CFF_InternalRec_ + { + PSH_Globals topfont; + PSH_Globals subfonts[CFF_MAX_CID_FONTS]; + + } CFF_InternalRec, *CFF_Internal; + + + /*************************************************************************/ + /* */ + /* Subglyph transformation record. */ + /* */ + typedef struct CFF_Transform_ + { + FT_Fixed xx, xy; /* transformation matrix coefficients */ + FT_Fixed yx, yy; + FT_F26Dot6 ox, oy; /* offsets */ + + } CFF_Transform; + + +FT_END_HEADER + + +#endif /* CFFOTYPES_H_ */ + + +/* END */ diff --git a/src/cff/cfftypes.h b/include/freetype/internal/cfftypes.h similarity index 97% rename from src/cff/cfftypes.h rename to include/freetype/internal/cfftypes.h index 8d43e2834..7c07e1a37 100644 --- a/src/cff/cfftypes.h +++ b/include/freetype/internal/cfftypes.h @@ -5,7 +5,7 @@ /* Basic OpenType/CFF type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,6 +27,7 @@ #include FT_INTERNAL_SERVICE_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H +#include FT_INTERNAL_TYPE1_TYPES_H FT_BEGIN_HEADER @@ -112,8 +113,8 @@ FT_BEGIN_HEADER FT_UInt shortDeltaCount; /* not used; always zero */ #endif - FT_UInt regionIdxCount; /* number of regions in this var data */ - FT_UInt* regionIndices; /* array of `regionCount' indices; */ + FT_UInt regionIdxCount; /* number of region indexes */ + FT_UInt* regionIndices; /* array of `regionIdxCount' indices; */ /* these index `varRegionList' */ } CFF_VarData; @@ -381,6 +382,9 @@ FT_BEGIN_HEADER /* interface to Postscript Names service */ FT_Service_PsCMaps psnames; + /* interface to CFFLoad service */ + const void* cffload; + /* since version 2.3.0 */ PS_FontInfoRec* font_info; /* font info dictionary */ @@ -394,6 +398,9 @@ FT_BEGIN_HEADER /* since version 2.7.1 */ CFF_VStoreRec vstore; /* parsed vstore structure */ + /* since version 2.9 */ + PS_FontExtraRec* font_extra; + } CFF_FontRec; diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index c9ac9d824..818a81235 100644 --- a/include/freetype/internal/ftcalc.h +++ b/include/freetype/internal/ftcalc.h @@ -4,7 +4,7 @@ /* */ /* Arithmetic computations (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -399,16 +399,42 @@ FT_BEGIN_HEADER #endif /* 0 */ -#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 ) -#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 ) -#define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 ) -#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 ) -#define FLOAT_TO_FIXED( x ) ( (FT_Long)( x * 65536.0 ) ) +#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) * 64 ) /* << 6 */ +#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) * 16384 ) /* << 14 */ +#define INT_TO_FIXED( x ) ( (FT_Long)(x) * 65536 ) /* << 16 */ +#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) * 4 ) /* << 2 */ #define FIXED_TO_INT( x ) ( FT_RoundFix( x ) >> 16 ) #define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \ : ( -( ( 32 - (x) ) & -64 ) ) ) + /* + * The following macros have two purposes. + * + * . Tag places where overflow is expected and harmless. + * + * . Avoid run-time sanitizer errors. + * + * Use with care! + */ +#define ADD_LONG( a, b ) \ + (FT_Long)( (FT_ULong)(a) + (FT_ULong)(b) ) +#define SUB_LONG( a, b ) \ + (FT_Long)( (FT_ULong)(a) - (FT_ULong)(b) ) +#define MUL_LONG( a, b ) \ + (FT_Long)( (FT_ULong)(a) * (FT_ULong)(b) ) +#define NEG_LONG( a ) \ + (FT_Long)( (FT_ULong)0 - (FT_ULong)(a) ) + +#define ADD_INT32( a, b ) \ + (FT_Int32)( (FT_UInt32)(a) + (FT_UInt32)(b) ) +#define SUB_INT32( a, b ) \ + (FT_Int32)( (FT_UInt32)(a) - (FT_UInt32)(b) ) +#define MUL_INT32( a, b ) \ + (FT_Int32)( (FT_UInt32)(a) * (FT_UInt32)(b) ) +#define NEG_INT32( a ) \ + (FT_Int32)( (FT_UInt32)0 - (FT_UInt32)(a) ) + FT_END_HEADER diff --git a/include/freetype/internal/ftdebug.h b/include/freetype/internal/ftdebug.h index 5dcd2b174..292a4eedb 100644 --- a/include/freetype/internal/ftdebug.h +++ b/include/freetype/internal/ftdebug.h @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftdriver.h b/include/freetype/internal/ftdrv.h similarity index 98% rename from include/freetype/internal/ftdriver.h rename to include/freetype/internal/ftdrv.h index e82fa8d41..58dd35a93 100644 --- a/include/freetype/internal/ftdriver.h +++ b/include/freetype/internal/ftdrv.h @@ -1,10 +1,10 @@ /***************************************************************************/ /* */ -/* ftdriver.h */ +/* ftdrv.h */ /* */ -/* FreeType font driver interface (specification). */ +/* FreeType internal font driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -16,8 +16,8 @@ /***************************************************************************/ -#ifndef FTDRIVER_H_ -#define FTDRIVER_H_ +#ifndef FTDRV_H_ +#define FTDRV_H_ #include @@ -394,7 +394,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* FTDRIVER_H_ */ +#endif /* FTDRV_H_ */ /* END */ diff --git a/include/freetype/internal/ftgloadr.h b/include/freetype/internal/ftgloadr.h index f41c3df55..a002fdbfc 100644 --- a/include/freetype/internal/ftgloadr.h +++ b/include/freetype/internal/ftgloadr.h @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph loader (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h index 59e5b58a5..054eaec31 100644 --- a/include/freetype/internal/ftmemory.h +++ b/include/freetype/internal/ftmemory.h @@ -4,7 +4,7 @@ /* */ /* The FreeType memory management macros (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -210,7 +210,7 @@ extern "C++" NULL, \ &error ) ) -#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \ +#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \ FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ (FT_Long)(itmsz), \ (FT_Long)(oldcnt), \ diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 2f18d07b7..1c3c6ad45 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -36,6 +36,7 @@ #include FT_INTERNAL_AUTOHINT_H #include FT_INTERNAL_SERVICE_H #include FT_INTERNAL_PIC_H +#include FT_INTERNAL_CALC_H #ifdef FT_CONFIG_OPTION_INCREMENTAL #include FT_INCREMENTAL_H @@ -84,14 +85,30 @@ FT_BEGIN_HEADER : y + ( 3 * x >> 3 ) ) /* we use FT_TYPEOF to suppress signedness compilation warnings */ -#define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n)-1 ) ) -#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n ) -#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n ) +#define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n) - 1 ) ) +#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + (n) / 2, n ) +#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + (n) - 1, n ) #define FT_PIX_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 ) #define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 ) #define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 ) + /* specialized versions (for signed values) */ + /* that don't produce run-time errors due to integer overflow */ +#define FT_PAD_ROUND_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) / 2 ), \ + n ) +#define FT_PAD_CEIL_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) - 1 ), \ + n ) +#define FT_PIX_ROUND_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 32 ) ) +#define FT_PIX_CEIL_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 63 ) ) + +#define FT_PAD_ROUND_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) / 2 ), \ + n ) +#define FT_PAD_CEIL_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) - 1 ), \ + n ) +#define FT_PIX_ROUND_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 32 ) ) +#define FT_PIX_CEIL_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 63 ) ) + /* * character classification functions -- since these are used to parse @@ -138,8 +155,8 @@ FT_BEGIN_HEADER } FT_CMapRec; - /* typecase any pointer to a charmap handle */ -#define FT_CMAP( x ) ((FT_CMap)( x )) + /* typecast any pointer to a charmap handle */ +#define FT_CMAP( x ) ( (FT_CMap)( x ) ) /* obvious macros */ #define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id @@ -295,6 +312,27 @@ FT_BEGIN_HEADER FT_CMap_Done( FT_CMap cmap ); + /* adds LCD padding to Min and Max boundaries */ + FT_BASE( void ) + ft_lcd_padding( FT_Pos* Min, + FT_Pos* Max, + FT_GlyphSlot slot ); + +#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + + typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap, + FT_Render_Mode render_mode, + FT_Byte* weights ); + + + /* This is the default LCD filter, an in-place, 5-tap FIR filter. */ + FT_BASE( void ) + ft_lcd_filter_fir( FT_Bitmap* bitmap, + FT_Render_Mode mode, + FT_LcdFiveTapFilter weights ); + +#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ + /*************************************************************************/ /* */ /* */ @@ -352,9 +390,10 @@ FT_BEGIN_HEADER /* operator. Value~0 means to use the font's value. Value~-1 */ /* means to use the CFF driver's default. */ /* */ - /* lcd_weights :: */ - /* Overrides the library default with custom weights for the 5-tap */ - /* FIR filter. `{0, 0, 0, 0, 0}' means to use the library default. */ + /* lcd_weights :: */ + /* lcd_filter_func :: */ + /* If subpixel rendering is activated, the LCD filtering weights */ + /* and callback function. */ /* */ /* refcount :: */ /* A counter initialized to~1 at the time an @FT_Face structure is */ @@ -376,8 +415,10 @@ FT_BEGIN_HEADER FT_Char no_stem_darkening; FT_Int32 random_seed; + #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - FT_LcdFiveTapFilter lcd_weights; /* preset or custom filter weights */ + FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */ + FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */ #endif FT_Int refcount; @@ -433,8 +474,6 @@ FT_BEGIN_HEADER } FT_GlyphSlot_InternalRec; -#if 0 - /*************************************************************************/ /* */ /* */ @@ -442,17 +481,25 @@ FT_BEGIN_HEADER /* */ /* */ /* This structure contains the internal fields of each FT_Size */ - /* object. Currently, it's empty. */ + /* object. */ + /* */ + /* */ + /* module_data :: Data specific to a driver module. */ + /* */ + /* autohint_mode :: The used auto-hinting mode. */ + /* */ + /* autohint_metrics :: Metrics used by the auto-hinter. */ /* */ /*************************************************************************/ typedef struct FT_Size_InternalRec_ { - /* empty */ + void* module_data; - } FT_Size_InternalRec; + FT_Render_Mode autohint_mode; + FT_Size_Metrics autohint_metrics; -#endif + } FT_Size_InternalRec; /*************************************************************************/ @@ -493,7 +540,8 @@ FT_BEGIN_HEADER /* typecast an object to an FT_Module */ -#define FT_MODULE( x ) ((FT_Module)( x )) +#define FT_MODULE( x ) ( (FT_Module)(x) ) + #define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz #define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library #define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory @@ -579,9 +627,9 @@ FT_BEGIN_HEADER /* a few macros used to perform easy typecasts with minimal brain damage */ -#define FT_FACE( x ) ((FT_Face)(x)) -#define FT_SIZE( x ) ((FT_Size)(x)) -#define FT_SLOT( x ) ((FT_GlyphSlot)(x)) +#define FT_FACE( x ) ( (FT_Face)(x) ) +#define FT_SIZE( x ) ( (FT_Size)(x) ) +#define FT_SLOT( x ) ( (FT_GlyphSlot)(x) ) #define FT_FACE_DRIVER( x ) FT_FACE( x )->driver #define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library @@ -682,6 +730,12 @@ FT_BEGIN_HEADER ft_glyphslot_free_bitmap( FT_GlyphSlot slot ); + /* Preset bitmap metrics of an outline glyphslot prior to rendering. */ + FT_BASE( void ) + ft_glyphslot_preset_bitmap( FT_GlyphSlot slot, + FT_Render_Mode mode, + const FT_Vector* origin ); + /* Allocate a new bitmap buffer in a glyph slot. */ FT_BASE( FT_Error ) ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot, @@ -708,10 +762,10 @@ FT_BEGIN_HEADER /*************************************************************************/ -#define FT_RENDERER( x ) ((FT_Renderer)( x )) -#define FT_GLYPH( x ) ((FT_Glyph)( x )) -#define FT_BITMAP_GLYPH( x ) ((FT_BitmapGlyph)( x )) -#define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x )) +#define FT_RENDERER( x ) ( (FT_Renderer)(x) ) +#define FT_GLYPH( x ) ( (FT_Glyph)(x) ) +#define FT_BITMAP_GLYPH( x ) ( (FT_BitmapGlyph)(x) ) +#define FT_OUTLINE_GLYPH( x ) ( (FT_OutlineGlyph)(x) ) typedef struct FT_RendererRec_ @@ -742,7 +796,7 @@ FT_BEGIN_HEADER /* typecast a module into a driver easily */ -#define FT_DRIVER( x ) ((FT_Driver)(x)) +#define FT_DRIVER( x ) ( (FT_Driver)(x) ) /* typecast a module as a driver, and get its driver class */ #define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz @@ -798,18 +852,6 @@ FT_BEGIN_HEADER #define FT_DEBUG_HOOK_TRUETYPE 0 - typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap, - FT_Render_Mode render_mode, - FT_Byte* weights ); - - - /* This is the default LCD filter, an in-place, 5-tap FIR filter. */ - FT_BASE( void ) - ft_lcd_filter_fir( FT_Bitmap* bitmap, - FT_Render_Mode mode, - FT_LcdFiveTapFilter weights ); - - /*************************************************************************/ /* */ /* */ @@ -850,22 +892,11 @@ FT_BEGIN_HEADER /* */ /* auto_hinter :: The auto-hinter module interface. */ /* */ - /* raster_pool :: The raster object's render pool. This can */ - /* ideally be changed dynamically at run-time. */ - /* */ - /* raster_pool_size :: The size of the render pool in bytes. */ - /* */ /* debug_hooks :: An array of four function pointers that allow */ /* debuggers to hook into a font format's */ /* interpreter. Currently, only the TrueType */ /* bytecode debugger uses this. */ /* */ - /* lcd_filter :: If subpixel rendering is activated, the */ - /* selected LCD filter mode. */ - /* */ - /* lcd_extra :: If subpixel rendering is activated, the number */ - /* of extra pixels needed for the LCD filter. */ - /* */ /* lcd_weights :: If subpixel rendering is activated, the LCD */ /* filter weights, if any. */ /* */ @@ -897,15 +928,9 @@ FT_BEGIN_HEADER FT_Renderer cur_renderer; /* current outline renderer */ FT_Module auto_hinter; - FT_Byte* raster_pool; /* scan-line conversion */ - /* render pool */ - FT_ULong raster_pool_size; /* size of render pool in bytes */ - FT_DebugHook_Func debug_hooks[4]; #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - FT_LcdFilter lcd_filter; - FT_Int lcd_extra; /* number of extra pixels */ FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */ FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */ #endif diff --git a/include/freetype/internal/ftpic.h b/include/freetype/internal/ftpic.h index 0d43ed20f..5214f0598 100644 --- a/include/freetype/internal/ftpic.h +++ b/include/freetype/internal/ftpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services (declaration). */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftpsprop.h b/include/freetype/internal/ftpsprop.h new file mode 100644 index 000000000..abbb62862 --- /dev/null +++ b/include/freetype/internal/ftpsprop.h @@ -0,0 +1,48 @@ +/***************************************************************************/ +/* */ +/* ftpsprop.h */ +/* */ +/* Get and set properties of PostScript drivers (specification). */ +/* */ +/* Copyright 2017-2018 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef FTPSPROP_H_ +#define FTPSPROP_H_ + + +#include +#include FT_FREETYPE_H + + +FT_BEGIN_HEADER + + + FT_BASE_CALLBACK( FT_Error ) + ps_property_set( FT_Module module, /* PS_Driver */ + const char* property_name, + const void* value, + FT_Bool value_is_string ); + + FT_BASE_CALLBACK( FT_Error ) + ps_property_get( FT_Module module, /* PS_Driver */ + const char* property_name, + void* value ); + + +FT_END_HEADER + + +#endif /* FTPSPROP_H_ */ + + +/* END */ diff --git a/include/freetype/internal/ftrfork.h b/include/freetype/internal/ftrfork.h index 25a44a448..1aca48a0e 100644 --- a/include/freetype/internal/ftrfork.h +++ b/include/freetype/internal/ftrfork.h @@ -4,7 +4,7 @@ /* */ /* Embedded resource forks accessor (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO and Redhat K.K. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h index 71ef9cac3..e01c1679b 100644 --- a/include/freetype/internal/ftserv.h +++ b/include/freetype/internal/ftserv.h @@ -4,7 +4,7 @@ /* */ /* The FreeType services (specification only). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -330,6 +330,32 @@ FT_BEGIN_HEADER { NULL, NULL } \ }; +#define FT_DEFINE_SERVICEDESCREC10( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4, \ + serv_id_5, serv_data_5, \ + serv_id_6, serv_data_6, \ + serv_id_7, serv_data_7, \ + serv_id_8, serv_data_8, \ + serv_id_9, serv_data_9, \ + serv_id_10, serv_data_10 ) \ + static const FT_ServiceDescRec class_[] = \ + { \ + { serv_id_1, serv_data_1 }, \ + { serv_id_2, serv_data_2 }, \ + { serv_id_3, serv_data_3 }, \ + { serv_id_4, serv_data_4 }, \ + { serv_id_5, serv_data_5 }, \ + { serv_id_6, serv_data_6 }, \ + { serv_id_7, serv_data_7 }, \ + { serv_id_8, serv_data_8 }, \ + { serv_id_9, serv_data_9 }, \ + { serv_id_10, serv_data_10 }, \ + { NULL, NULL } \ + }; + #else /* FT_CONFIG_OPTION_PIC */ #define FT_DEFINE_SERVICEDESCREC1( class_, \ @@ -557,7 +583,7 @@ FT_BEGIN_HEADER \ FT_Error \ FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ + FT_ServiceDescRec** output_class ) \ { \ FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ @@ -608,7 +634,7 @@ FT_BEGIN_HEADER \ FT_Error \ FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ + FT_ServiceDescRec** output_class ) \ { \ FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ @@ -662,7 +688,7 @@ FT_BEGIN_HEADER \ FT_Error \ FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ + FT_ServiceDescRec** output_class ) \ { \ FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ @@ -719,7 +745,7 @@ FT_BEGIN_HEADER \ FT_Error \ FT_Create_Class_ ## class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ + FT_ServiceDescRec** output_class ) \ { \ FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ @@ -755,6 +781,68 @@ FT_BEGIN_HEADER return FT_Err_Ok; \ } +#define FT_DEFINE_SERVICEDESCREC10( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4, \ + serv_id_5, serv_data_5, \ + serv_id_6, serv_data_6, \ + serv_id_7, serv_data_7, \ + serv_id_8, serv_data_8, \ + serv_id_9, serv_data_9, \ + serv_id_10, serv_data_10 ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + \ + \ + if ( clazz ) \ + FT_FREE( clazz ); \ + } \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec** output_class ) \ + { \ + FT_ServiceDescRec* clazz = NULL; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 11 ) ) \ + return error; \ + \ + clazz[ 0].serv_id = serv_id_1; \ + clazz[ 0].serv_data = serv_data_1; \ + clazz[ 1].serv_id = serv_id_2; \ + clazz[ 1].serv_data = serv_data_2; \ + clazz[ 2].serv_id = serv_id_3; \ + clazz[ 2].serv_data = serv_data_3; \ + clazz[ 3].serv_id = serv_id_4; \ + clazz[ 3].serv_data = serv_data_4; \ + clazz[ 4].serv_id = serv_id_5; \ + clazz[ 4].serv_data = serv_data_5; \ + clazz[ 5].serv_id = serv_id_6; \ + clazz[ 5].serv_data = serv_data_6; \ + clazz[ 6].serv_id = serv_id_7; \ + clazz[ 6].serv_data = serv_data_7; \ + clazz[ 7].serv_id = serv_id_8; \ + clazz[ 7].serv_data = serv_data_8; \ + clazz[ 8].serv_id = serv_id_9; \ + clazz[ 8].serv_data = serv_data_9; \ + clazz[ 9].serv_id = serv_id_10; \ + clazz[ 9].serv_data = serv_data_10; \ + clazz[10].serv_id = NULL; \ + clazz[10].serv_data = NULL; \ + \ + *output_class = clazz; \ + \ + return FT_Err_Ok; \ + } + #endif /* FT_CONFIG_OPTION_PIC */ @@ -898,7 +986,9 @@ FT_BEGIN_HEADER */ #define FT_SERVICE_BDF_H +#define FT_SERVICE_CFF_TABLE_LOAD_H #define FT_SERVICE_CID_H +#define FT_SERVICE_FONT_FORMAT_H #define FT_SERVICE_GLYPH_DICT_H #define FT_SERVICE_GX_VALIDATE_H #define FT_SERVICE_KERNING_H @@ -912,10 +1002,9 @@ FT_BEGIN_HEADER #define FT_SERVICE_PROPERTIES_H #define FT_SERVICE_SFNT_H #define FT_SERVICE_TRUETYPE_ENGINE_H +#define FT_SERVICE_TRUETYPE_GLYF_H #define FT_SERVICE_TT_CMAP_H #define FT_SERVICE_WINFNT_H -#define FT_SERVICE_FONT_FORMAT_H -#define FT_SERVICE_TRUETYPE_GLYF_H /* */ diff --git a/include/freetype/internal/ftstream.h b/include/freetype/internal/ftstream.h index 3e2c07b26..f90002fe7 100644 --- a/include/freetype/internal/ftstream.h +++ b/include/freetype/internal/ftstream.h @@ -4,7 +4,7 @@ /* */ /* Stream handling (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -165,8 +165,8 @@ FT_BEGIN_HEADER #define FT_BYTE_U32( p, i, s ) ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) ) -#define FT_PEEK_SHORT( p ) FT_INT16( FT_BYTE_U16( p, 0, 8) | \ - FT_BYTE_U16( p, 1, 0) ) +#define FT_PEEK_SHORT( p ) FT_INT16( FT_BYTE_U16( p, 0, 8 ) | \ + FT_BYTE_U16( p, 1, 0 ) ) #define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \ FT_BYTE_U16( p, 1, 0 ) ) diff --git a/include/freetype/internal/fttrace.h b/include/freetype/internal/fttrace.h index caf5fc946..8092e41fd 100644 --- a/include/freetype/internal/fttrace.h +++ b/include/freetype/internal/fttrace.h @@ -4,7 +4,7 @@ /* */ /* Tracing handling (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -39,6 +39,7 @@ FT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */ FT_TRACE_DEF( raccess ) /* resource fork accessor (ftrfork.c) */ FT_TRACE_DEF( synth ) /* bold/slant synthesizer (ftsynth.c) */ FT_TRACE_DEF( bitmap ) /* bitmap checksum (ftobjs.c) */ +FT_TRACE_DEF( psprops ) /* PS driver properties (ftpsprop.c) */ /* Cache sub-system */ FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */ @@ -66,20 +67,19 @@ FT_TRACE_DEF( ttgxvar ) /* TrueType GX var handler (ttgxvar.c) */ FT_TRACE_DEF( t1afm ) FT_TRACE_DEF( t1driver ) FT_TRACE_DEF( t1gload ) -FT_TRACE_DEF( t1hint ) FT_TRACE_DEF( t1load ) FT_TRACE_DEF( t1objs ) FT_TRACE_DEF( t1parse ) /* PostScript helper module `psaux' */ FT_TRACE_DEF( t1decode ) +FT_TRACE_DEF( cffdecode ) FT_TRACE_DEF( psobjs ) FT_TRACE_DEF( psconv ) /* PostScript hinting module `pshinter' */ FT_TRACE_DEF( pshrec ) -FT_TRACE_DEF( pshalgo1 ) -FT_TRACE_DEF( pshalgo2 ) +FT_TRACE_DEF( pshalgo ) /* Type 2 driver components */ FT_TRACE_DEF( cffdriver ) @@ -96,7 +96,6 @@ FT_TRACE_DEF( cf2interp ) FT_TRACE_DEF( t42 ) /* CID driver components */ -FT_TRACE_DEF( cidafm ) FT_TRACE_DEF( ciddriver ) FT_TRACE_DEF( cidgload ) FT_TRACE_DEF( cidload ) diff --git a/include/freetype/internal/ftvalid.h b/include/freetype/internal/ftvalid.h index df6f7c577..cad47a556 100644 --- a/include/freetype/internal/ftvalid.h +++ b/include/freetype/internal/ftvalid.h @@ -4,7 +4,7 @@ /* */ /* FreeType validation support (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/internal.h b/include/freetype/internal/internal.h index 02046813a..8f546e443 100644 --- a/include/freetype/internal/internal.h +++ b/include/freetype/internal/internal.h @@ -4,7 +4,7 @@ /* */ /* Internal header files (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,7 +31,7 @@ #define FT_INTERNAL_DEBUG_H #define FT_INTERNAL_CALC_H #define FT_INTERNAL_HASH_H -#define FT_INTERNAL_DRIVER_H +#define FT_INTERNAL_DRIVER_H #define FT_INTERNAL_TRACE_H #define FT_INTERNAL_GLYPH_LOADER_H #define FT_INTERNAL_SFNT_H @@ -44,9 +44,13 @@ #define FT_INTERNAL_POSTSCRIPT_AUX_H #define FT_INTERNAL_POSTSCRIPT_HINTS_H +#define FT_INTERNAL_POSTSCRIPT_PROPS_H #define FT_INTERNAL_AUTOHINT_H +#define FT_INTERNAL_CFF_TYPES_H +#define FT_INTERNAL_CFF_OBJECTS_TYPES_H + #if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 286d6040c..f77380d25 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -5,7 +5,7 @@ /* Auxiliary functions and data structures related to PostScript fonts */ /* (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,12 +25,32 @@ #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_TYPE1_TYPES_H #include FT_INTERNAL_HASH_H +#include FT_INTERNAL_TRUETYPE_TYPES_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H +#include FT_INTERNAL_CFF_TYPES_H +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H + FT_BEGIN_HEADER + /***********************************************************************/ + /* */ + /* PostScript modules driver class. */ + /* */ + typedef struct PS_DriverRec_ + { + FT_DriverRec root; + + FT_UInt hinting_engine; + FT_Bool no_stem_darkening; + FT_Int darken_params[8]; + FT_Int32 random_seed; + + } PS_DriverRec, *PS_Driver; + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -439,6 +459,202 @@ FT_BEGIN_HEADER } PS_ParserRec; + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** PS BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + typedef struct PS_Builder_ PS_Builder; + typedef const struct PS_Builder_FuncsRec_* PS_Builder_Funcs; + + typedef struct PS_Builder_FuncsRec_ + { + void + (*init)( PS_Builder* ps_builder, + void* builder, + FT_Bool is_t1 ); + + void + (*done)( PS_Builder* builder ); + + } PS_Builder_FuncsRec; + + + /*************************************************************************/ + /* */ + /* */ + /* PS_Builder */ + /* */ + /* */ + /* A structure used during glyph loading to store its outline. */ + /* */ + /* */ + /* memory :: The current memory object. */ + /* */ + /* face :: The current face object. */ + /* */ + /* glyph :: The current glyph slot. */ + /* */ + /* loader :: XXX */ + /* */ + /* base :: The base glyph outline. */ + /* */ + /* current :: The current glyph outline. */ + /* */ + /* pos_x :: The horizontal translation (if composite glyph). */ + /* */ + /* pos_y :: The vertical translation (if composite glyph). */ + /* */ + /* left_bearing :: The left side bearing point. */ + /* */ + /* advance :: The horizontal advance vector. */ + /* */ + /* bbox :: Unused. */ + /* */ + /* path_begun :: A flag which indicates that a new path has begun. */ + /* */ + /* load_points :: If this flag is not set, no points are loaded. */ + /* */ + /* no_recurse :: Set but not used. */ + /* */ + /* metrics_only :: A boolean indicating that we only want to compute */ + /* the metrics of a given glyph, not load all of its */ + /* points. */ + /* */ + /* is_t1 :: Set if current font type is Type 1. */ + /* */ + /* funcs :: An array of function pointers for the builder. */ + /* */ + struct PS_Builder_ + { + FT_Memory memory; + FT_Face face; + CFF_GlyphSlot glyph; + FT_GlyphLoader loader; + FT_Outline* base; + FT_Outline* current; + + FT_Pos* pos_x; + FT_Pos* pos_y; + + FT_Vector* left_bearing; + FT_Vector* advance; + + FT_BBox* bbox; /* bounding box */ + FT_Bool path_begun; + FT_Bool load_points; + FT_Bool no_recurse; + + FT_Bool metrics_only; + FT_Bool is_t1; + + PS_Builder_FuncsRec funcs; + + }; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** PS DECODER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + +#define PS_MAX_OPERANDS 48 +#define PS_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */ + /* only 10 are allowed but there exist */ + /* fonts like `HiraKakuProN-W3.ttf' */ + /* (Hiragino Kaku Gothic ProN W3; */ + /* 8.2d6e1; 2014-12-19) that exceed */ + /* this limit */ + + /* execution context charstring zone */ + + typedef struct PS_Decoder_Zone_ + { + FT_Byte* base; + FT_Byte* limit; + FT_Byte* cursor; + + } PS_Decoder_Zone; + + + typedef FT_Error + (*CFF_Decoder_Get_Glyph_Callback)( TT_Face face, + FT_UInt glyph_index, + FT_Byte** pointer, + FT_ULong* length ); + + typedef void + (*CFF_Decoder_Free_Glyph_Callback)( TT_Face face, + FT_Byte** pointer, + FT_ULong length ); + + + typedef struct PS_Decoder_ + { + PS_Builder builder; + + FT_Fixed stack[PS_MAX_OPERANDS + 1]; + FT_Fixed* top; + + PS_Decoder_Zone zones[PS_MAX_SUBRS_CALLS + 1]; + PS_Decoder_Zone* zone; + + FT_Int flex_state; + FT_Int num_flex_vectors; + FT_Vector flex_vectors[7]; + + CFF_Font cff; + CFF_SubFont current_subfont; /* for current glyph_index */ + FT_Generic* cf2_instance; + + FT_Pos* glyph_width; + FT_Bool width_only; + FT_Int num_hints; + + FT_UInt num_locals; + FT_UInt num_globals; + + FT_Int locals_bias; + FT_Int globals_bias; + + FT_Byte** locals; + FT_Byte** globals; + + FT_Byte** glyph_names; /* for pure CFF fonts only */ + FT_UInt num_glyphs; /* number of glyphs in font */ + + FT_Render_Mode hint_mode; + + FT_Bool seac; + + CFF_Decoder_Get_Glyph_Callback get_glyph_callback; + CFF_Decoder_Free_Glyph_Callback free_glyph_callback; + + /* Type 1 stuff */ + FT_Service_PsCMaps psnames; /* for seac */ + + FT_Int lenIV; /* internal for sub routine calls */ + FT_UInt* locals_len; /* array of subrs length (optional) */ + FT_Hash locals_hash; /* used if `num_subrs' was massaged */ + + FT_Matrix font_matrix; + FT_Vector font_offset; + + PS_Blend blend; /* for multiple master support */ + + FT_Long* buildchar; + FT_UInt len_buildchar; + + } PS_Decoder; + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -653,10 +869,23 @@ FT_BEGIN_HEADER void (*done)( T1_Decoder decoder ); +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + FT_Error + (*parse_charstrings_old)( T1_Decoder decoder, + FT_Byte* base, + FT_UInt len ); +#else + FT_Error + (*parse_metrics)( T1_Decoder decoder, + FT_Byte* base, + FT_UInt len ); +#endif + FT_Error - (*parse_charstrings)( T1_Decoder decoder, - FT_Byte* base, - FT_UInt len ); + (*parse_charstrings)( PS_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len ); + } T1_Decoder_FuncsRec; @@ -700,9 +929,258 @@ FT_BEGIN_HEADER FT_Bool seac; + FT_Generic cf2_instance; + } T1_DecoderRec; + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CFF BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + typedef struct CFF_Builder_ CFF_Builder; + + + typedef FT_Error + (*CFF_Builder_Check_Points_Func)( CFF_Builder* builder, + FT_Int count ); + + typedef void + (*CFF_Builder_Add_Point_Func)( CFF_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ); + typedef FT_Error + (*CFF_Builder_Add_Point1_Func)( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + typedef FT_Error + (*CFF_Builder_Start_Point_Func)( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + typedef void + (*CFF_Builder_Close_Contour_Func)( CFF_Builder* builder ); + + typedef FT_Error + (*CFF_Builder_Add_Contour_Func)( CFF_Builder* builder ); + + typedef const struct CFF_Builder_FuncsRec_* CFF_Builder_Funcs; + + typedef struct CFF_Builder_FuncsRec_ + { + void + (*init)( CFF_Builder* builder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot glyph, + FT_Bool hinting ); + + void + (*done)( CFF_Builder* builder ); + + CFF_Builder_Check_Points_Func check_points; + CFF_Builder_Add_Point_Func add_point; + CFF_Builder_Add_Point1_Func add_point1; + CFF_Builder_Add_Contour_Func add_contour; + CFF_Builder_Start_Point_Func start_point; + CFF_Builder_Close_Contour_Func close_contour; + + } CFF_Builder_FuncsRec; + + + /*************************************************************************/ + /* */ + /* */ + /* CFF_Builder */ + /* */ + /* */ + /* A structure used during glyph loading to store its outline. */ + /* */ + /* */ + /* memory :: The current memory object. */ + /* */ + /* face :: The current face object. */ + /* */ + /* glyph :: The current glyph slot. */ + /* */ + /* loader :: The current glyph loader. */ + /* */ + /* base :: The base glyph outline. */ + /* */ + /* current :: The current glyph outline. */ + /* */ + /* pos_x :: The horizontal translation (if composite glyph). */ + /* */ + /* pos_y :: The vertical translation (if composite glyph). */ + /* */ + /* left_bearing :: The left side bearing point. */ + /* */ + /* advance :: The horizontal advance vector. */ + /* */ + /* bbox :: Unused. */ + /* */ + /* path_begun :: A flag which indicates that a new path has begun. */ + /* */ + /* load_points :: If this flag is not set, no points are loaded. */ + /* */ + /* no_recurse :: Set but not used. */ + /* */ + /* metrics_only :: A boolean indicating that we only want to compute */ + /* the metrics of a given glyph, not load all of its */ + /* points. */ + /* */ + /* hints_funcs :: Auxiliary pointer for hinting. */ + /* */ + /* hints_globals :: Auxiliary pointer for hinting. */ + /* */ + /* funcs :: A table of method pointers for this object. */ + /* */ + struct CFF_Builder_ + { + FT_Memory memory; + TT_Face face; + CFF_GlyphSlot glyph; + FT_GlyphLoader loader; + FT_Outline* base; + FT_Outline* current; + + FT_Pos pos_x; + FT_Pos pos_y; + + FT_Vector left_bearing; + FT_Vector advance; + + FT_BBox bbox; /* bounding box */ + + FT_Bool path_begun; + FT_Bool load_points; + FT_Bool no_recurse; + + FT_Bool metrics_only; + + void* hints_funcs; /* hinter-specific */ + void* hints_globals; /* hinter-specific */ + + CFF_Builder_FuncsRec funcs; + }; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CFF DECODER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + +#define CFF_MAX_OPERANDS 48 +#define CFF_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */ + /* only 10 are allowed but there exist */ + /* fonts like `HiraKakuProN-W3.ttf' */ + /* (Hiragino Kaku Gothic ProN W3; */ + /* 8.2d6e1; 2014-12-19) that exceed */ + /* this limit */ +#define CFF_MAX_TRANS_ELEMENTS 32 + + /* execution context charstring zone */ + + typedef struct CFF_Decoder_Zone_ + { + FT_Byte* base; + FT_Byte* limit; + FT_Byte* cursor; + + } CFF_Decoder_Zone; + + + typedef struct CFF_Decoder_ + { + CFF_Builder builder; + CFF_Font cff; + + FT_Fixed stack[CFF_MAX_OPERANDS + 1]; + FT_Fixed* top; + + CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1]; + CFF_Decoder_Zone* zone; + + FT_Int flex_state; + FT_Int num_flex_vectors; + FT_Vector flex_vectors[7]; + + FT_Pos glyph_width; + FT_Pos nominal_width; + + FT_Bool read_width; + FT_Bool width_only; + FT_Int num_hints; + FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS]; + + FT_UInt num_locals; + FT_UInt num_globals; + + FT_Int locals_bias; + FT_Int globals_bias; + + FT_Byte** locals; + FT_Byte** globals; + + FT_Byte** glyph_names; /* for pure CFF fonts only */ + FT_UInt num_glyphs; /* number of glyphs in font */ + + FT_Render_Mode hint_mode; + + FT_Bool seac; + + CFF_SubFont current_subfont; /* for current glyph_index */ + + CFF_Decoder_Get_Glyph_Callback get_glyph_callback; + CFF_Decoder_Free_Glyph_Callback free_glyph_callback; + + } CFF_Decoder; + + + typedef const struct CFF_Decoder_FuncsRec_* CFF_Decoder_Funcs; + + typedef struct CFF_Decoder_FuncsRec_ + { + void + (*init)( CFF_Decoder* decoder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot slot, + FT_Bool hinting, + FT_Render_Mode hint_mode, + CFF_Decoder_Get_Glyph_Callback get_callback, + CFF_Decoder_Free_Glyph_Callback free_callback ); + + FT_Error + (*prepare)( CFF_Decoder* decoder, + CFF_Size size, + FT_UInt glyph_index ); + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + FT_Error + (*parse_charstrings_old)( CFF_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len, + FT_Bool in_dict ); +#endif + + FT_Error + (*parse_charstrings)( PS_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len ); + + } CFF_Decoder_FuncsRec; + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -810,14 +1288,29 @@ FT_BEGIN_HEADER FT_Offset length, FT_UShort seed ); + FT_UInt32 + (*cff_random)( FT_UInt32 r ); + + void + (*ps_decoder_init)( PS_Decoder* ps_decoder, + void* decoder, + FT_Bool is_t1 ); + + void + (*t1_make_subfont)( FT_Face face, + PS_Private priv, + CFF_SubFont subfont ); + T1_CMap_Classes t1_cmap_classes; /* fields after this comment line were added after version 2.1.10 */ const AFM_Parser_FuncsRec* afm_parser_funcs; + const CFF_Decoder_FuncsRec* cff_decoder_funcs; + } PSAux_ServiceRec, *PSAux_Service; - /* backwards-compatible type definition */ + /* backward compatible type definition */ typedef PSAux_ServiceRec PSAux_Interface; diff --git a/include/freetype/internal/pshints.h b/include/freetype/internal/pshints.h index 49116eb44..d29314ec2 100644 --- a/include/freetype/internal/pshints.h +++ b/include/freetype/internal/pshints.h @@ -6,7 +6,7 @@ /* recorders (specification only). These are used to support native */ /* T1/T2 hints in the `type1', `cid', and `cff' font drivers. */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svbdf.h b/include/freetype/internal/services/svbdf.h index eeebf67da..4a9ec2007 100644 --- a/include/freetype/internal/services/svbdf.h +++ b/include/freetype/internal/services/svbdf.h @@ -4,7 +4,7 @@ /* */ /* The FreeType BDF services (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svcfftl.h b/include/freetype/internal/services/svcfftl.h new file mode 100644 index 000000000..db623e684 --- /dev/null +++ b/include/freetype/internal/services/svcfftl.h @@ -0,0 +1,112 @@ +/***************************************************************************/ +/* */ +/* svcfftl.h */ +/* */ +/* The FreeType CFF tables loader service (specification). */ +/* */ +/* Copyright 2017-2018 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef SVCFFTL_H_ +#define SVCFFTL_H_ + +#include FT_INTERNAL_SERVICE_H +#include FT_INTERNAL_CFF_TYPES_H + + +FT_BEGIN_HEADER + + +#define FT_SERVICE_ID_CFF_LOAD "cff-load" + + + typedef FT_UShort + (*FT_Get_Standard_Encoding_Func)( FT_UInt charcode ); + + typedef FT_Error + (*FT_Load_Private_Dict_Func)( CFF_Font font, + CFF_SubFont subfont, + FT_UInt lenNDV, + FT_Fixed* NDV ); + + typedef FT_Byte + (*FT_FD_Select_Get_Func)( CFF_FDSelect fdselect, + FT_UInt glyph_index ); + + typedef FT_Bool + (*FT_Blend_Check_Vector_Func)( CFF_Blend blend, + FT_UInt vsindex, + FT_UInt lenNDV, + FT_Fixed* NDV ); + + typedef FT_Error + (*FT_Blend_Build_Vector_Func)( CFF_Blend blend, + FT_UInt vsindex, + FT_UInt lenNDV, + FT_Fixed* NDV ); + + + FT_DEFINE_SERVICE( CFFLoad ) + { + FT_Get_Standard_Encoding_Func get_standard_encoding; + FT_Load_Private_Dict_Func load_private_dict; + FT_FD_Select_Get_Func fd_select_get; + FT_Blend_Check_Vector_Func blend_check_vector; + FT_Blend_Build_Vector_Func blend_build_vector; + }; + + +#ifndef FT_CONFIG_OPTION_PIC + +#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \ + get_standard_encoding_, \ + load_private_dict_, \ + fd_select_get_, \ + blend_check_vector_, \ + blend_build_vector_ ) \ + static const FT_Service_CFFLoadRec class_ = \ + { \ + get_standard_encoding_, \ + load_private_dict_, \ + fd_select_get_, \ + blend_check_vector_, \ + blend_build_vector_ \ + }; + +#else /* FT_CONFIG_OPTION_PIC */ + +#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \ + get_standard_encoding_, \ + load_private_dict_, \ + fd_select_get_, \ + blend_check_vector_, \ + blend_build_vector_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Service_CFFLoadRec* clazz ) \ + { \ + clazz->get_standard_encoding = get_standard_encoding_; \ + clazz->load_private_dict = load_private_dict_; \ + clazz->fd_select_get = fd_select_get_; \ + clazz->blend_check_vector = blend_check_vector_; \ + clazz->blend_build_vector = blend_build_vector_; \ + } + +#endif /* FT_CONFIG_OPTION_PIC */ + + +FT_END_HEADER + + +#endif + + +/* END */ diff --git a/include/freetype/internal/services/svcid.h b/include/freetype/internal/services/svcid.h index cce94d8df..cb59ac6a2 100644 --- a/include/freetype/internal/services/svcid.h +++ b/include/freetype/internal/services/svcid.h @@ -4,7 +4,7 @@ /* */ /* The FreeType CID font services (specification). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* Derek Clegg and Michael Toftdal. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svfntfmt.h b/include/freetype/internal/services/svfntfmt.h index 376d9255b..3b732be1a 100644 --- a/include/freetype/internal/services/svfntfmt.h +++ b/include/freetype/internal/services/svfntfmt.h @@ -4,7 +4,7 @@ /* */ /* The FreeType font format service (specification only). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svgldict.h b/include/freetype/internal/services/svgldict.h index 0cd13618d..f1a68e311 100644 --- a/include/freetype/internal/services/svgldict.h +++ b/include/freetype/internal/services/svgldict.h @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph dictionary services (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -56,7 +56,7 @@ FT_BEGIN_HEADER #define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \ get_name_, \ - name_index_) \ + name_index_ ) \ static const FT_Service_GlyphDictRec class_ = \ { \ get_name_, name_index_ \ @@ -66,7 +66,7 @@ FT_BEGIN_HEADER #define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \ get_name_, \ - name_index_) \ + name_index_ ) \ void \ FT_Init_Class_ ## class_( FT_Library library, \ FT_Service_GlyphDictRec* clazz ) \ diff --git a/include/freetype/internal/services/svgxval.h b/include/freetype/internal/services/svgxval.h index 71bfa97af..ed79ebeaa 100644 --- a/include/freetype/internal/services/svgxval.h +++ b/include/freetype/internal/services/svgxval.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating TrueTypeGX/AAT tables (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/include/freetype/internal/services/svkern.h b/include/freetype/internal/services/svkern.h index b8344e96e..c7e8f6ef2 100644 --- a/include/freetype/internal/services/svkern.h +++ b/include/freetype/internal/services/svkern.h @@ -4,7 +4,7 @@ /* */ /* The FreeType Kerning service (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svmetric.h b/include/freetype/internal/services/svmetric.h index 1f7d5ddd0..abaacddbb 100644 --- a/include/freetype/internal/services/svmetric.h +++ b/include/freetype/internal/services/svmetric.h @@ -4,7 +4,7 @@ /* */ /* The FreeType services for metrics variations (specification). */ /* */ -/* Copyright 2016-2017 by */ +/* Copyright 2016-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svmm.h b/include/freetype/internal/services/svmm.h index 97af1ac98..bcbb38e2c 100644 --- a/include/freetype/internal/services/svmm.h +++ b/include/freetype/internal/services/svmm.h @@ -4,7 +4,7 @@ /* */ /* The FreeType Multiple Masters and GX var services (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -48,11 +48,15 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Long* coords ); + /* use return value -1 to indicate that the new coordinates */ + /* are equal to the current ones; no changes are thus needed */ typedef FT_Error (*FT_Set_Var_Design_Func)( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); + /* use return value -1 to indicate that the new coordinates */ + /* are equal to the current ones; no changes are thus needed */ typedef FT_Error (*FT_Set_MM_Blend_Func)( FT_Face face, FT_UInt num_coords, @@ -63,6 +67,10 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Fixed* coords ); + typedef FT_Error + (*FT_Set_Instance_Func)( FT_Face face, + FT_UInt instance_index ); + typedef FT_Error (*FT_Get_MM_Blend_Func)( FT_Face face, FT_UInt num_coords, @@ -72,6 +80,7 @@ FT_BEGIN_HEADER (*FT_Get_Var_Blend_Func)( FT_Face face, FT_UInt *num_coords, FT_Fixed* *coords, + FT_Fixed* *normalizedcoords, FT_MM_Var* *mm_var ); typedef void @@ -87,6 +96,7 @@ FT_BEGIN_HEADER FT_Get_MM_Var_Func get_mm_var; FT_Set_Var_Design_Func set_var_design; FT_Get_Var_Design_Func get_var_design; + FT_Set_Instance_Func set_instance; /* for internal use; only needed for code sharing between modules */ FT_Get_Var_Blend_Func get_var_blend; @@ -96,27 +106,29 @@ FT_BEGIN_HEADER #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \ - get_mm_, \ - set_mm_design_, \ - set_mm_blend_, \ - get_mm_blend_, \ - get_mm_var_, \ - set_var_design_, \ - get_var_design_, \ - get_var_blend_, \ - done_blend_ ) \ - static const FT_Service_MultiMastersRec class_ = \ - { \ - get_mm_, \ - set_mm_design_, \ - set_mm_blend_, \ - get_mm_blend_, \ - get_mm_var_, \ - set_var_design_, \ - get_var_design_, \ - get_var_blend_, \ - done_blend_ \ +#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \ + get_mm_, \ + set_mm_design_, \ + set_mm_blend_, \ + get_mm_blend_, \ + get_mm_var_, \ + set_var_design_, \ + get_var_design_, \ + set_instance_, \ + get_var_blend_, \ + done_blend_ ) \ + static const FT_Service_MultiMastersRec class_ = \ + { \ + get_mm_, \ + set_mm_design_, \ + set_mm_blend_, \ + get_mm_blend_, \ + get_mm_var_, \ + set_var_design_, \ + get_var_design_, \ + set_instance_, \ + get_var_blend_, \ + done_blend_ \ }; #else /* FT_CONFIG_OPTION_PIC */ @@ -129,6 +141,7 @@ FT_BEGIN_HEADER get_mm_var_, \ set_var_design_, \ get_var_design_, \ + set_instance_, \ get_var_blend_, \ done_blend_ ) \ void \ @@ -141,6 +154,7 @@ FT_BEGIN_HEADER clazz->get_mm_var = get_mm_var_; \ clazz->set_var_design = set_var_design_; \ clazz->get_var_design = get_var_design_; \ + clazz->set_instance = set_instance_; \ clazz->get_var_blend = get_var_blend_; \ clazz->done_blend = done_blend_; \ } diff --git a/include/freetype/internal/services/svotval.h b/include/freetype/internal/services/svotval.h index ac84abee4..31294296a 100644 --- a/include/freetype/internal/services/svotval.h +++ b/include/freetype/internal/services/svotval.h @@ -4,7 +4,7 @@ /* */ /* The FreeType OpenType validation service (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svpfr.h b/include/freetype/internal/services/svpfr.h index c9a182fe3..e65d57e91 100644 --- a/include/freetype/internal/services/svpfr.h +++ b/include/freetype/internal/services/svpfr.h @@ -4,7 +4,7 @@ /* */ /* Internal PFR service functions (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svpostnm.h b/include/freetype/internal/services/svpostnm.h index 022cdec19..4a49d8b05 100644 --- a/include/freetype/internal/services/svpostnm.h +++ b/include/freetype/internal/services/svpostnm.h @@ -4,7 +4,7 @@ /* */ /* The FreeType PostScript name services (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svprop.h b/include/freetype/internal/services/svprop.h index eb2d4eed1..adc0bcf43 100644 --- a/include/freetype/internal/services/svprop.h +++ b/include/freetype/internal/services/svprop.h @@ -4,7 +4,7 @@ /* */ /* The FreeType property service (specification). */ /* */ -/* Copyright 2012-2017 by */ +/* Copyright 2012-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svpscmap.h b/include/freetype/internal/services/svpscmap.h index b32122e5d..5589575b9 100644 --- a/include/freetype/internal/services/svpscmap.h +++ b/include/freetype/internal/services/svpscmap.h @@ -4,7 +4,7 @@ /* */ /* The FreeType PostScript charmap service (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svpsinfo.h b/include/freetype/internal/services/svpsinfo.h index 0220ce529..408f406df 100644 --- a/include/freetype/internal/services/svpsinfo.h +++ b/include/freetype/internal/services/svpsinfo.h @@ -4,7 +4,7 @@ /* */ /* The FreeType PostScript info service (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svsfnt.h b/include/freetype/internal/services/svsfnt.h index 49d18e43e..e8b37bc47 100644 --- a/include/freetype/internal/services/svsfnt.h +++ b/include/freetype/internal/services/svsfnt.h @@ -4,7 +4,7 @@ /* */ /* The FreeType SFNT table loading service (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svttcmap.h b/include/freetype/internal/services/svttcmap.h index 30f7feec7..cd0e6fda6 100644 --- a/include/freetype/internal/services/svttcmap.h +++ b/include/freetype/internal/services/svttcmap.h @@ -4,7 +4,7 @@ /* */ /* The FreeType TrueType/sfnt cmap extra information service. */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* Masatake YAMATO, Redhat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/include/freetype/internal/services/svtteng.h b/include/freetype/internal/services/svtteng.h index e4b368ad4..92e3c541f 100644 --- a/include/freetype/internal/services/svtteng.h +++ b/include/freetype/internal/services/svtteng.h @@ -4,7 +4,7 @@ /* */ /* The FreeType TrueType engine query service (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svttglyf.h b/include/freetype/internal/services/svttglyf.h index b7793059f..16fac1ca1 100644 --- a/include/freetype/internal/services/svttglyf.h +++ b/include/freetype/internal/services/svttglyf.h @@ -4,7 +4,7 @@ /* */ /* The FreeType TrueType glyph service. */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/services/svwinfnt.h b/include/freetype/internal/services/svwinfnt.h index c94b7e107..80d481cbd 100644 --- a/include/freetype/internal/services/svwinfnt.h +++ b/include/freetype/internal/services/svwinfnt.h @@ -4,7 +4,7 @@ /* */ /* The FreeType Windows FNT/FONT service (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h index b8667a003..fb1e327ae 100644 --- a/include/freetype/internal/sfnt.h +++ b/include/freetype/internal/sfnt.h @@ -4,7 +4,7 @@ /* */ /* High-level `sfnt' driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h index b2e35d42d..2118e3367 100644 --- a/include/freetype/internal/t1types.h +++ b/include/freetype/internal/t1types.h @@ -5,7 +5,7 @@ /* Basic Type1/Type2 type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index abe4dcd64..10dd336a8 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -5,7 +5,7 @@ /* Basic SFNT/TrueType type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -148,7 +148,7 @@ FT_BEGIN_HEADER /* */ /* See */ /* */ - /* http://www.w3.org/TR/WOFF/#WOFFHeader */ + /* https://www.w3.org/TR/WOFF/#WOFFHeader */ /* */ typedef struct WOFF_HeaderRec_ { @@ -1299,16 +1299,21 @@ FT_BEGIN_HEADER /* variation tables (rather like Multiple */ /* Master data). */ /* */ - /* is_default_instance :: Set if the glyph outlines can be used */ - /* unmodified (i.e., without applying glyph */ - /* variation deltas). */ - /* */ /* variation_support :: Flags that indicate which OpenType */ /* functionality related to font variation */ /* support is present, valid, and usable. */ /* For example, TT_FACE_FLAG_VAR_FVAR is only */ /* set if we have at least one design axis. */ /* */ + /* var_postscript_prefix :: */ + /* The PostScript name prefix needed for */ + /* constructing a variation font instance's */ + /* PS name . */ + /* */ + /* var_postscript_prefix_len :: */ + /* The length of the `var_postscript_prefix' */ + /* string. */ + /* */ /* horz_metrics_size :: The size of the `hmtx' table. */ /* */ /* vert_metrics_size :: The size of the `vmtx' table. */ @@ -1374,7 +1379,7 @@ FT_BEGIN_HEADER /* */ /* sph_compatibility_mode :: */ /* This flag is set if we are in ClearType */ - /* backwards compatibility mode (used by the */ + /* backward compatibility mode (used by the */ /* v38 implementation of the bytecode */ /* interpreter). */ /* */ @@ -1436,6 +1441,9 @@ FT_BEGIN_HEADER void* var; #endif + /* a typeless pointer to the PostScript Aux service */ + void* psaux; + /***********************************************************************/ /* */ @@ -1500,8 +1508,11 @@ FT_BEGIN_HEADER FT_Bool doblend; GX_Blend blend; - FT_Bool is_default_instance; /* since 2.7.1 */ FT_UInt32 variation_support; /* since 2.7.1 */ + + const char* var_postscript_prefix; /* since 2.7.2 */ + FT_UInt var_postscript_prefix_len; /* since 2.7.2 */ + #endif /* since version 2.2 */ diff --git a/include/freetype/t1tables.h b/include/freetype/t1tables.h index 81c903453..3503c2616 100644 --- a/include/freetype/t1tables.h +++ b/include/freetype/t1tables.h @@ -5,7 +5,7 @@ /* Basic Type 1/Type 2 tables definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -291,7 +291,7 @@ FT_BEGIN_HEADER } PS_DesignMapRec, *PS_DesignMap; - /* backwards-compatible definition */ + /* backward compatible definition */ typedef PS_DesignMapRec T1_DesignMap; @@ -326,7 +326,7 @@ FT_BEGIN_HEADER } PS_BlendRec, *PS_Blend; - /* backwards-compatible definition */ + /* backward compatible definition */ typedef PS_BlendRec T1_Blend; @@ -554,6 +554,9 @@ FT_BEGIN_HEADER /* T1_ENCODING_TYPE_ISOLATIN1 :: */ /* T1_ENCODING_TYPE_EXPERT :: */ /* */ + /* */ + /* 2.4.8 */ + /* */ typedef enum T1_EncodingType_ { T1_ENCODING_TYPE_NONE = 0, @@ -622,6 +625,9 @@ FT_BEGIN_HEADER /* PS_DICT_FS_TYPE :: */ /* PS_DICT_ITALIC_ANGLE :: */ /* */ + /* */ + /* 2.4.8 */ + /* */ typedef enum PS_Dict_Keys_ { /* conventionally in the font dictionary */ @@ -743,6 +749,9 @@ FT_BEGIN_HEADER * If the font's format is not PostScript-based, this function returns * the `FT_Err_Invalid_Argument' error code. * + * @since: + * 2.4.8 + * */ FT_EXPORT( FT_Long ) FT_Get_PS_Font_Value( FT_Face face, diff --git a/include/freetype/ttnameid.h b/include/freetype/ttnameid.h index 04be3f77c..8605183dc 100644 --- a/include/freetype/ttnameid.h +++ b/include/freetype/ttnameid.h @@ -4,7 +4,7 @@ /* */ /* TrueType name ID definitions (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -437,7 +437,7 @@ FT_BEGIN_HEADER * * The canonical source for Microsoft's IDs is * - * http://www.microsoft.com/globaldev/reference/lcid-all.mspx , + * https://www.microsoft.com/globaldev/reference/lcid-all.mspx , * * however, we only provide macros for language identifiers present in * the OpenType specification: Microsoft has abandoned the concept of @@ -1216,7 +1216,7 @@ FT_BEGIN_HEADER /* */ - /* for backwards compatibility with older FreeType versions */ + /* for backward compatibility with older FreeType versions */ #define TT_UCR_ARABIC_PRESENTATION_A \ TT_UCR_ARABIC_PRESENTATION_FORMS_A #define TT_UCR_ARABIC_PRESENTATION_B \ diff --git a/include/freetype/tttables.h b/include/freetype/tttables.h index 58312044c..ce6a61779 100644 --- a/include/freetype/tttables.h +++ b/include/freetype/tttables.h @@ -5,7 +5,7 @@ /* Basic SFNT/TrueType tables definitions and interface */ /* (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/include/freetype/tttags.h b/include/freetype/tttags.h index 32eb2fdc2..e5cee68a1 100644 --- a/include/freetype/tttags.h +++ b/include/freetype/tttags.h @@ -4,7 +4,7 @@ /* */ /* Tags for TrueType and OpenType tables (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -106,6 +106,12 @@ FT_BEGIN_HEADER #define TTAG_VVAR FT_MAKE_TAG( 'V', 'V', 'A', 'R' ) #define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' ) +/* used by "Keyboard.dfont" on legacy Mac OS X */ +#define TTAG_0xA5kbd FT_MAKE_TAG( 0xA5, 'k', 'b', 'd' ) + +/* used by "LastResort.dfont" on legacy Mac OS X */ +#define TTAG_0xA5lst FT_MAKE_TAG( 0xA5, 'l', 's', 't' ) + FT_END_HEADER diff --git a/include/freetype/ttunpat.h b/include/freetype/ttunpat.h deleted file mode 100644 index 11f6dedc4..000000000 --- a/include/freetype/ttunpat.h +++ /dev/null @@ -1,63 +0,0 @@ -/***************************************************************************/ -/* */ -/* ttunpat.h */ -/* */ -/* Definitions for the unpatented TrueType hinting system. */ -/* Obsolete, retained for backwards compatibility. */ -/* */ -/* Copyright 2003-2017 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* Written by Graham Asher */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef TTUNPAT_H_ -#define TTUNPAT_H_ - - -#include -#include FT_FREETYPE_H - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - -FT_BEGIN_HEADER - - - /*************************************************************************** - * - * @constant: - * FT_PARAM_TAG_UNPATENTED_HINTING - * - * @description: - * Deprecated. - * - * Previously: A constant used as the tag of an @FT_Parameter structure to - * indicate that unpatented methods only should be used by the TrueType - * bytecode interpreter for a typeface opened by @FT_Open_Face. - * - */ -#define FT_PARAM_TAG_UNPATENTED_HINTING FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) - - /* */ - - -FT_END_HEADER - - -#endif /* TTUNPAT_H_ */ - - -/* END */ diff --git a/include/ft2build.h b/include/ft2build.h index e7d808f3f..e7ce99bc9 100644 --- a/include/ft2build.h +++ b/include/ft2build.h @@ -4,7 +4,7 @@ /* */ /* FreeType 2 build and setup macros. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/modules.cfg b/modules.cfg index 517111efe..4bf344524 100644 --- a/modules.cfg +++ b/modules.cfg @@ -1,6 +1,6 @@ # modules.cfg # -# Copyright 2005-2017 by +# Copyright 2005-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -42,7 +42,7 @@ FONT_MODULES += type1 # CFF/OpenType font driver. # -# This driver needs the `sfnt', `pshinter', and `psnames' modules. +# This driver needs the `sfnt', `psaux', `pshinter', and `psnames' modules. FONT_MODULES += cff # Type 1 CID-keyed font driver. @@ -66,7 +66,7 @@ FONT_MODULES += type42 # No FT_CONFIG_OPTION_PIC support. FONT_MODULES += winfonts -# PCF font driver. +# PCF font driver. If debugging and tracing is enabled, needs `ftbitmap.c'. # No FT_CONFIG_OPTION_PIC support. FONT_MODULES += pcf @@ -113,11 +113,11 @@ RASTER_MODULES += smooth # FreeType's cache sub-system (quite stable but still in beta -- this means # that its public API is subject to change if necessary). See -# include/freetype/ftcache.h. Needs ftglyph.c. +# include/freetype/ftcache.h. Needs `ftglyph.c'. # No FT_CONFIG_OPTION_PIC support. AUX_MODULES += cache -# TrueType GX/AAT table validation. Needs ftgxval.c below. +# TrueType GX/AAT table validation. Needs `ftgxval.c' below. # # No FT_CONFIG_OPTION_PIC support. # AUX_MODULES += gxvalid @@ -140,7 +140,7 @@ AUX_MODULES += lzw # No FT_CONFIG_OPTION_PIC support. AUX_MODULES += bzip2 -# OpenType table validation. Needs ftotval.c below. +# OpenType table validation. Needs `ftotval.c' below. # # No FT_CONFIG_OPTION_PIC support. # AUX_MODULES += otvalid @@ -183,12 +183,7 @@ BASE_EXTENSIONS += ftbitmap.c # See include/freetype/ftcid.h for the API. BASE_EXTENSIONS += ftcid.c -# Support functions for font formats. -# -# See include/freetype/ftfntfmt.h for the API. -BASE_EXTENSIONS += ftfntfmt.c - -# Access FSType information. Needs fttype1.c. +# Access FSType information. Needs `fttype1.c'. # # See include/freetype/freetype.h for the API. BASE_EXTENSIONS += ftfstype.c @@ -198,7 +193,7 @@ BASE_EXTENSIONS += ftfstype.c # See include/freetype/ftgasp.h for the API. BASE_EXTENSIONS += ftgasp.c -# Convenience functions to handle glyphs. Needs ftbitmap.c. +# Convenience functions to handle glyphs. Needs `ftbitmap.c'. # # See include/freetype/ftglyph.h for the API. BASE_EXTENSIONS += ftglyph.c @@ -208,11 +203,6 @@ BASE_EXTENSIONS += ftglyph.c # See include/freetype/ftgxval.h for the API. BASE_EXTENSIONS += ftgxval.c -# Support for LCD color filtering of subpixel bitmaps. -# -# See include/freetype/ftlcdfil.h for the API. -BASE_EXTENSIONS += ftlcdfil.c - # Multiple Master font interface. # # See include/freetype/ftmm.h for the API. @@ -233,12 +223,13 @@ BASE_EXTENSIONS += ftpatent.c # See include/freetype/ftpfr.h for the API. BASE_EXTENSIONS += ftpfr.c -# Path stroker. Needs ftglyph.c. +# Path stroker. Needs `ftglyph.c'. # # See include/freetype/ftstroke.h for the API. BASE_EXTENSIONS += ftstroke.c -# Support for synthetic emboldening and slanting of fonts. Needs ftbitmap.c. +# Support for synthetic emboldening and slanting of fonts. Needs +# `ftbitmap.c'. # # See include/freetype/ftsynth.h for the API. BASE_EXTENSIONS += ftsynth.c diff --git a/objs/.gitignore b/objs/.gitignore index 21b67f6ab..f8476208f 100644 --- a/objs/.gitignore +++ b/objs/.gitignore @@ -1,15 +1,3 @@ -apinames -freetype.def -freetype.lib -ftexport.sym -ftmodule.h -ftoption.h -libfreetype.la -.libs -*.lo -*.o -*.a -debug*/ -release*/ -win32/ -win64/ +* +!README +!.gitignore diff --git a/src/Jamfile b/src/Jamfile index c0bc02249..562480c94 100644 --- a/src/Jamfile +++ b/src/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/autofit/Jamfile b/src/autofit/Jamfile index 9a3dc8a4f..01b866ec6 100644 --- a/src/autofit/Jamfile +++ b/src/autofit/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/autofit Jamfile # -# Copyright 2003-2017 by +# Copyright 2003-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/autofit/afangles.c b/src/autofit/afangles.c index ccdae8413..c65a3ae23 100644 --- a/src/autofit/afangles.c +++ b/src/autofit/afangles.c @@ -5,7 +5,7 @@ /* Routines used to compute vector angles with limited accuracy */ /* and very high speed. It also contains sorting routines (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afblue.c b/src/autofit/afblue.c index 524f68874..e4078fd04 100644 --- a/src/autofit/afblue.c +++ b/src/autofit/afblue.c @@ -7,7 +7,7 @@ /* */ /* Auto-fitter data for blue strings (body). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -26,6 +26,14 @@ af_blue_strings[] = { /* */ + '\xF0', '\x9E', '\xA4', '\x8C', ' ', '\xF0', '\x9E', '\xA4', '\x85', ' ', '\xF0', '\x9E', '\xA4', '\x88', ' ', '\xF0', '\x9E', '\xA4', '\x8F', ' ', '\xF0', '\x9E', '\xA4', '\x94', ' ', '\xF0', '\x9E', '\xA4', '\x9A', /* 𞤌 𞤅 𞤈 𞤏 𞤔 𞤚 */ + '\0', + '\xF0', '\x9E', '\xA4', '\x82', ' ', '\xF0', '\x9E', '\xA4', '\x96', /* 𞤂 𞤖 */ + '\0', + '\xF0', '\x9E', '\xA4', '\xAC', ' ', '\xF0', '\x9E', '\xA4', '\xAE', ' ', '\xF0', '\x9E', '\xA4', '\xBB', ' ', '\xF0', '\x9E', '\xA4', '\xBC', ' ', '\xF0', '\x9E', '\xA4', '\xBE', /* 𞤬 𞤮 𞤻 𞤼 𞤾 */ + '\0', + '\xF0', '\x9E', '\xA4', '\xA4', ' ', '\xF0', '\x9E', '\xA4', '\xA8', ' ', '\xF0', '\x9E', '\xA4', '\xA9', ' ', '\xF0', '\x9E', '\xA4', '\xAD', ' ', '\xF0', '\x9E', '\xA4', '\xB4', ' ', '\xF0', '\x9E', '\xA4', '\xB8', ' ', '\xF0', '\x9E', '\xA4', '\xBA', ' ', '\xF0', '\x9E', '\xA5', '\x80', /* 𞤤 𞤨 𞤩 𞤭 𞤴 𞤸 𞤺 𞥀 */ + '\0', '\xD8', '\xA7', ' ', '\xD8', '\xA5', ' ', '\xD9', '\x84', ' ', '\xD9', '\x83', ' ', '\xD8', '\xB7', ' ', '\xD8', '\xB8', /* ا إ ل ك ط ظ */ '\0', '\xD8', '\xAA', ' ', '\xD8', '\xAB', ' ', '\xD8', '\xB7', ' ', '\xD8', '\xB8', ' ', '\xD9', '\x83', /* ت ث ط ظ ك */ @@ -44,12 +52,50 @@ '\0', '\xD5', '\xA2', ' ', '\xD5', '\xA8', ' ', '\xD5', '\xAB', ' ', '\xD5', '\xAC', ' ', '\xD5', '\xB2', ' ', '\xD5', '\xBA', ' ', '\xD6', '\x83', ' ', '\xD6', '\x81', /* բ ը ի լ ղ պ փ ց */ '\0', + '\xF0', '\x90', '\xAC', '\x80', ' ', '\xF0', '\x90', '\xAC', '\x81', ' ', '\xF0', '\x90', '\xAC', '\x90', ' ', '\xF0', '\x90', '\xAC', '\x9B', /* 𐬀 𐬁 𐬐 𐬛 */ + '\0', + '\xF0', '\x90', '\xAC', '\x80', ' ', '\xF0', '\x90', '\xAC', '\x81', /* 𐬀 𐬁 */ + '\0', + '\xEA', '\x9A', '\xA7', ' ', '\xEA', '\x9A', '\xA8', ' ', '\xEA', '\x9B', '\x9B', ' ', '\xEA', '\x9B', '\x89', ' ', '\xEA', '\x9B', '\x81', ' ', '\xEA', '\x9B', '\x88', ' ', '\xEA', '\x9B', '\xAB', ' ', '\xEA', '\x9B', '\xAF', /* ꚧ ꚨ ꛛ ꛉ ꛁ ꛈ ꛫ ꛯ */ + '\0', + '\xEA', '\x9A', '\xAD', ' ', '\xEA', '\x9A', '\xB3', ' ', '\xEA', '\x9A', '\xB6', ' ', '\xEA', '\x9B', '\xAC', ' ', '\xEA', '\x9A', '\xA2', ' ', '\xEA', '\x9A', '\xBD', ' ', '\xEA', '\x9B', '\xAF', ' ', '\xEA', '\x9B', '\xB2', /* ꚭ ꚳ ꚶ ꛬ ꚢ ꚽ ꛯ ꛲ */ + '\0', '\xE0', '\xA6', '\x85', ' ', '\xE0', '\xA6', '\xA1', ' ', '\xE0', '\xA6', '\xA4', ' ', '\xE0', '\xA6', '\xA8', ' ', '\xE0', '\xA6', '\xAC', ' ', '\xE0', '\xA6', '\xAD', ' ', '\xE0', '\xA6', '\xB2', ' ', '\xE0', '\xA6', '\x95', /* অ ড ত ন ব ভ ল ক */ '\0', '\xE0', '\xA6', '\x87', ' ', '\xE0', '\xA6', '\x9F', ' ', '\xE0', '\xA6', '\xA0', ' ', '\xE0', '\xA6', '\xBF', ' ', '\xE0', '\xA7', '\x80', ' ', '\xE0', '\xA7', '\x88', ' ', '\xE0', '\xA7', '\x97', /* ই ট ঠ ি ী ৈ ৗ */ '\0', '\xE0', '\xA6', '\x93', ' ', '\xE0', '\xA6', '\x8F', ' ', '\xE0', '\xA6', '\xA1', ' ', '\xE0', '\xA6', '\xA4', ' ', '\xE0', '\xA6', '\xA8', ' ', '\xE0', '\xA6', '\xAC', ' ', '\xE0', '\xA6', '\xB2', ' ', '\xE0', '\xA6', '\x95', /* ও এ ড ত ন ব ল ক */ '\0', + '\xE1', '\x9D', '\x90', ' ', '\xE1', '\x9D', '\x88', /* ᝐ ᝈ */ + '\0', + '\xE1', '\x9D', '\x85', ' ', '\xE1', '\x9D', '\x8A', ' ', '\xE1', '\x9D', '\x8E', /* ᝅ ᝊ ᝎ */ + '\0', + '\xE1', '\x9D', '\x82', ' ', '\xE1', '\x9D', '\x83', ' ', '\xE1', '\x9D', '\x89', ' ', '\xE1', '\x9D', '\x8C', /* ᝂ ᝃ ᝉ ᝌ */ + '\0', + '\xE1', '\x9D', '\x80', ' ', '\xE1', '\x9D', '\x83', ' ', '\xE1', '\x9D', '\x86', ' ', '\xE1', '\x9D', '\x89', ' ', '\xE1', '\x9D', '\x8B', ' ', '\xE1', '\x9D', '\x8F', ' ', '\xE1', '\x9D', '\x91', /* ᝀ ᝃ ᝆ ᝉ ᝋ ᝏ ᝑ */ + '\0', + '\xE1', '\x97', '\x9C', ' ', '\xE1', '\x96', '\xB4', ' ', '\xE1', '\x90', '\x81', ' ', '\xE1', '\x92', '\xA3', ' ', '\xE1', '\x91', '\xAB', ' ', '\xE1', '\x91', '\x8E', ' ', '\xE1', '\x94', '\x91', ' ', '\xE1', '\x97', '\xB0', /* ᗜ ᖴ ᐁ ᒣ ᑫ ᑎ ᔑ ᗰ */ + '\0', + '\xE1', '\x97', '\xB6', ' ', '\xE1', '\x96', '\xB5', ' ', '\xE1', '\x92', '\xA7', ' ', '\xE1', '\x90', '\x83', ' ', '\xE1', '\x91', '\x8C', ' ', '\xE1', '\x92', '\x8D', ' ', '\xE1', '\x94', '\x91', ' ', '\xE1', '\x97', '\xA2', /* ᗶ ᖵ ᒧ ᐃ ᑌ ᒍ ᔑ ᗢ */ + '\0', + '\xE1', '\x93', '\x93', ' ', '\xE1', '\x93', '\x95', ' ', '\xE1', '\x93', '\x80', ' ', '\xE1', '\x93', '\x82', ' ', '\xE1', '\x93', '\x84', ' ', '\xE1', '\x95', '\x84', ' ', '\xE1', '\x95', '\x86', ' ', '\xE1', '\x98', '\xA3', /* ᓓ ᓕ ᓀ ᓂ ᓄ ᕄ ᕆ ᘣ */ + '\0', + '\xE1', '\x95', '\x83', ' ', '\xE1', '\x93', '\x82', ' ', '\xE1', '\x93', '\x80', ' ', '\xE1', '\x95', '\x82', ' ', '\xE1', '\x93', '\x97', ' ', '\xE1', '\x93', '\x9A', ' ', '\xE1', '\x95', '\x86', ' ', '\xE1', '\x98', '\xA3', /* ᕃ ᓂ ᓀ ᕂ ᓗ ᓚ ᕆ ᘣ */ + '\0', + '\xE1', '\x90', '\xAA', ' ', '\xE1', '\x99', '\x86', ' ', '\xE1', '\xA3', '\x98', ' ', '\xE1', '\x90', '\xA2', ' ', '\xE1', '\x92', '\xBE', ' ', '\xE1', '\xA3', '\x97', ' ', '\xE1', '\x94', '\x86', /* ᐪ ᙆ ᣘ ᐢ ᒾ ᣗ ᔆ */ + '\0', + '\xE1', '\x99', '\x86', ' ', '\xE1', '\x97', '\xAE', ' ', '\xE1', '\x92', '\xBB', ' ', '\xE1', '\x90', '\x9E', ' ', '\xE1', '\x94', '\x86', ' ', '\xE1', '\x92', '\xA1', ' ', '\xE1', '\x92', '\xA2', ' ', '\xE1', '\x93', '\x91', /* ᙆ ᗮ ᒻ ᐞ ᔆ ᒡ ᒢ ᓑ */ + '\0', + '\xF0', '\x90', '\x8A', '\xA7', ' ', '\xF0', '\x90', '\x8A', '\xAB', ' ', '\xF0', '\x90', '\x8A', '\xAC', ' ', '\xF0', '\x90', '\x8A', '\xAD', ' ', '\xF0', '\x90', '\x8A', '\xB1', ' ', '\xF0', '\x90', '\x8A', '\xBA', ' ', '\xF0', '\x90', '\x8A', '\xBC', ' ', '\xF0', '\x90', '\x8A', '\xBF', /* 𐊧 𐊫 𐊬 𐊭 𐊱 𐊺 𐊼 𐊿 */ + '\0', + '\xF0', '\x90', '\x8A', '\xA3', ' ', '\xF0', '\x90', '\x8A', '\xA7', ' ', '\xF0', '\x90', '\x8A', '\xB7', ' ', '\xF0', '\x90', '\x8B', '\x80', ' ', '\xF0', '\x90', '\x8A', '\xAB', ' ', '\xF0', '\x90', '\x8A', '\xB8', ' ', '\xF0', '\x90', '\x8B', '\x89', /* 𐊣 𐊧 𐊷 𐋀 𐊫 𐊸 𐋉 */ + '\0', + '\xF0', '\x91', '\x84', '\x83', ' ', '\xF0', '\x91', '\x84', '\x85', ' ', '\xF0', '\x91', '\x84', '\x89', ' ', '\xF0', '\x91', '\x84', '\x99', ' ', '\xF0', '\x91', '\x84', '\x97', /* 𑄃 𑄅 𑄉 𑄙 𑄗 */ + '\0', + '\xF0', '\x91', '\x84', '\x85', ' ', '\xF0', '\x91', '\x84', '\x9B', ' ', '\xF0', '\x91', '\x84', '\x9D', ' ', '\xF0', '\x91', '\x84', '\x97', ' ', '\xF0', '\x91', '\x84', '\x93', /* 𑄅 𑄛 𑄝 𑄗 𑄓 */ + '\0', + '\xF0', '\x91', '\x84', '\x96', '\xF0', '\x91', '\x84', '\xB3', '\xF0', '\x91', '\x84', '\xA2', ' ', '\xF0', '\x91', '\x84', '\x98', '\xF0', '\x91', '\x84', '\xB3', '\xF0', '\x91', '\x84', '\xA2', ' ', '\xF0', '\x91', '\x84', '\x99', '\xF0', '\x91', '\x84', '\xB3', '\xF0', '\x91', '\x84', '\xA2', ' ', '\xF0', '\x91', '\x84', '\xA4', '\xF0', '\x91', '\x84', '\xB3', '\xF0', '\x91', '\x84', '\xA2', ' ', '\xF0', '\x91', '\x84', '\xA5', '\xF0', '\x91', '\x84', '\xB3', '\xF0', '\x91', '\x84', '\xA2', /* 𑄖𑄳𑄢 𑄘𑄳𑄢 𑄙𑄳𑄢 𑄤𑄳𑄢 𑄥𑄳𑄢 */ + '\0', '\xE1', '\x8F', '\x86', ' ', '\xE1', '\x8E', '\xBB', ' ', '\xE1', '\x8E', '\xAC', ' ', '\xE1', '\x8F', '\x83', ' ', '\xE1', '\x8E', '\xA4', ' ', '\xE1', '\x8F', '\xA3', ' ', '\xE1', '\x8E', '\xA6', ' ', '\xE1', '\x8F', '\x95', /* Ꮖ Ꮋ Ꭼ Ꮓ Ꭴ Ꮳ Ꭶ Ꮥ */ '\0', '\xEA', '\xAE', '\x92', ' ', '\xEA', '\xAE', '\xA4', ' ', '\xEA', '\xAE', '\xB6', ' ', '\xEA', '\xAD', '\xB4', ' ', '\xEA', '\xAD', '\xBE', ' ', '\xEA', '\xAE', '\x97', ' ', '\xEA', '\xAE', '\x9D', ' ', '\xEA', '\xAE', '\xBF', /* ꮒ ꮤ ꮶ ꭴ ꭾ ꮗ ꮝ ꮿ */ @@ -58,6 +104,20 @@ '\0', '\xE1', '\x8F', '\xB8', ' ', '\xEA', '\xAE', '\x90', ' ', '\xEA', '\xAD', '\xB9', ' ', '\xEA', '\xAD', '\xBB', /* ᏸ ꮐ ꭹ ꭻ */ '\0', + '\xE2', '\xB2', '\x8C', ' ', '\xE2', '\xB2', '\x8E', ' ', '\xE2', '\xB2', '\xA0', ' ', '\xE2', '\xB3', '\x9E', ' ', '\xE2', '\xB2', '\x9E', ' ', '\xE2', '\xB2', '\x90', ' ', '\xE2', '\xB2', '\xA4', ' ', '\xE2', '\xB3', '\x8A', /* Ⲍ Ⲏ Ⲡ Ⳟ Ⲟ Ⲑ Ⲥ Ⳋ */ + '\0', + '\xE2', '\xB3', '\x90', ' ', '\xE2', '\xB3', '\x98', ' ', '\xE2', '\xB3', '\x9E', ' ', '\xE2', '\xB2', '\x8E', ' ', '\xE2', '\xB2', '\x9E', ' ', '\xE2', '\xB2', '\x90', ' ', '\xE2', '\xB3', '\x9C', ' ', '\xE2', '\xB2', '\xB0', /* Ⳑ Ⳙ Ⳟ Ⲏ Ⲟ Ⲑ Ⳝ Ⲱ */ + '\0', + '\xE2', '\xB2', '\x8D', ' ', '\xE2', '\xB2', '\x8F', ' ', '\xE2', '\xB2', '\xA1', ' ', '\xE2', '\xB3', '\x9F', ' ', '\xE2', '\xB2', '\x9F', ' ', '\xE2', '\xB2', '\x91', ' ', '\xE2', '\xB2', '\xA5', ' ', '\xE2', '\xB3', '\x8B', /* ⲍ ⲏ ⲡ ⳟ ⲟ ⲑ ⲥ ⳋ */ + '\0', + '\xE2', '\xB3', '\x91', ' ', '\xE2', '\xB3', '\x99', ' ', '\xE2', '\xB3', '\x9F', ' ', '\xE2', '\xB2', '\x8F', ' ', '\xE2', '\xB2', '\x9F', ' ', '\xE2', '\xB2', '\x91', ' ', '\xE2', '\xB3', '\x9D', ' ', '\xE2', '\xB3', '\x92', /* ⳑ ⳙ ⳟ ⲏ ⲟ ⲑ ⳝ Ⳓ */ + '\0', + '\xF0', '\x90', '\xA0', '\x8D', ' ', '\xF0', '\x90', '\xA0', '\x99', ' ', '\xF0', '\x90', '\xA0', '\xB3', ' ', '\xF0', '\x90', '\xA0', '\xB1', ' ', '\xF0', '\x90', '\xA0', '\x85', ' ', '\xF0', '\x90', '\xA0', '\x93', ' ', '\xF0', '\x90', '\xA0', '\xA3', ' ', '\xF0', '\x90', '\xA0', '\xA6', /* 𐠍 𐠙 𐠳 𐠱 𐠅 𐠓 𐠣 𐠦 */ + '\0', + '\xF0', '\x90', '\xA0', '\x83', ' ', '\xF0', '\x90', '\xA0', '\x8A', ' ', '\xF0', '\x90', '\xA0', '\x9B', ' ', '\xF0', '\x90', '\xA0', '\xA3', ' ', '\xF0', '\x90', '\xA0', '\xB3', ' ', '\xF0', '\x90', '\xA0', '\xB5', ' ', '\xF0', '\x90', '\xA0', '\x90', /* 𐠃 𐠊 𐠛 𐠣 𐠳 𐠵 𐠐 */ + '\0', + '\xF0', '\x90', '\xA0', '\x88', ' ', '\xF0', '\x90', '\xA0', '\x8F', ' ', '\xF0', '\x90', '\xA0', '\x96', /* 𐠈 𐠏 𐠖 */ + '\0', '\xD0', '\x91', ' ', '\xD0', '\x92', ' ', '\xD0', '\x95', ' ', '\xD0', '\x9F', ' ', '\xD0', '\x97', ' ', '\xD0', '\x9E', ' ', '\xD0', '\xA1', ' ', '\xD0', '\xAD', /* Б В Е П З О С Э */ '\0', '\xD0', '\x91', ' ', '\xD0', '\x92', ' ', '\xD0', '\x95', ' ', '\xD0', '\xA8', ' ', '\xD0', '\x97', ' ', '\xD0', '\x9E', ' ', '\xD0', '\xA1', ' ', '\xD0', '\xAD', /* Б В Е Ш З О С Э */ @@ -66,6 +126,14 @@ '\0', '\xD1', '\x80', ' ', '\xD1', '\x83', ' ', '\xD1', '\x84', /* р у ф */ '\0', + '\xF0', '\x90', '\x90', '\x82', ' ', '\xF0', '\x90', '\x90', '\x84', ' ', '\xF0', '\x90', '\x90', '\x8B', ' ', '\xF0', '\x90', '\x90', '\x97', ' ', '\xF0', '\x90', '\x90', '\x91', /* 𐐂 𐐄 𐐋 𐐗 𐐑 */ + '\0', + '\xF0', '\x90', '\x90', '\x80', ' ', '\xF0', '\x90', '\x90', '\x82', ' ', '\xF0', '\x90', '\x90', '\x84', ' ', '\xF0', '\x90', '\x90', '\x97', ' ', '\xF0', '\x90', '\x90', '\x9B', /* 𐐀 𐐂 𐐄 𐐗 𐐛 */ + '\0', + '\xF0', '\x90', '\x90', '\xAA', ' ', '\xF0', '\x90', '\x90', '\xAC', ' ', '\xF0', '\x90', '\x90', '\xB3', ' ', '\xF0', '\x90', '\x90', '\xBF', ' ', '\xF0', '\x90', '\x90', '\xB9', /* 𐐪 𐐬 𐐳 𐐿 𐐹 */ + '\0', + '\xF0', '\x90', '\x90', '\xA8', ' ', '\xF0', '\x90', '\x90', '\xAA', ' ', '\xF0', '\x90', '\x90', '\xAC', ' ', '\xF0', '\x90', '\x90', '\xBF', ' ', '\xF0', '\x90', '\x91', '\x83', /* 𐐨 𐐪 𐐬 𐐿 𐑃 */ + '\0', '\xE0', '\xA4', '\x95', ' ', '\xE0', '\xA4', '\xAE', ' ', '\xE0', '\xA4', '\x85', ' ', '\xE0', '\xA4', '\x86', ' ', '\xE0', '\xA4', '\xA5', ' ', '\xE0', '\xA4', '\xA7', ' ', '\xE0', '\xA4', '\xAD', ' ', '\xE0', '\xA4', '\xB6', /* क म अ आ थ ध भ श */ '\0', '\xE0', '\xA4', '\x88', ' ', '\xE0', '\xA4', '\x90', ' ', '\xE0', '\xA4', '\x93', ' ', '\xE0', '\xA4', '\x94', ' ', '\xE0', '\xA4', '\xBF', ' ', '\xE0', '\xA5', '\x80', ' ', '\xE0', '\xA5', '\x8B', ' ', '\xE0', '\xA5', '\x8C', /* ई ऐ ओ औ ि ी ो ौ */ @@ -98,6 +166,22 @@ '\0', '\xE2', '\xB4', '\x84', ' ', '\xE2', '\xB4', '\x85', ' ', '\xE2', '\xB4', '\x94', ' ', '\xE2', '\xB4', '\x95', ' ', '\xE2', '\xB4', '\x81', ' ', '\xE2', '\xB4', '\x82', ' ', '\xE2', '\xB4', '\x98', ' ', '\xE2', '\xB4', '\x9D', /* ⴄ ⴅ ⴔ ⴕ ⴁ ⴂ ⴘ ⴝ */ '\0', + '\xE1', '\xB2', '\x9C', ' ', '\xE1', '\xB2', '\x9F', ' ', '\xE1', '\xB2', '\xB3', ' ', '\xE1', '\xB2', '\xB8', ' ', '\xE1', '\xB2', '\x92', ' ', '\xE1', '\xB2', '\x94', ' ', '\xE1', '\xB2', '\x9D', ' ', '\xE1', '\xB2', '\xB4', /* Ნ Ჟ Ჳ Ჸ Გ Ე Ო Ჴ */ + '\0', + '\xE1', '\xB2', '\x98', ' ', '\xE1', '\xB2', '\xB2', ' ', '\xE1', '\xB2', '\x9D', ' ', '\xE1', '\xB2', '\xA9', ' ', '\xE1', '\xB2', '\x9B', ' ', '\xE1', '\xB2', '\xA8', ' ', '\xE1', '\xB2', '\xAF', ' ', '\xE1', '\xB2', '\xBD', /* Ი Ჲ Ო Ჩ Მ Შ Ჯ Ჽ */ + '\0', + '\xE2', '\xB0', '\x85', ' ', '\xE2', '\xB0', '\x94', ' ', '\xE2', '\xB0', '\xAA', ' ', '\xE2', '\xB0', '\x84', ' ', '\xE2', '\xB0', '\x82', ' ', '\xE2', '\xB0', '\x8A', ' ', '\xE2', '\xB0', '\xAB', ' ', '\xE2', '\xB0', '\x8B', /* Ⰵ Ⱄ Ⱚ Ⰴ Ⰲ Ⰺ Ⱛ Ⰻ */ + '\0', + '\xE2', '\xB0', '\x85', ' ', '\xE2', '\xB0', '\x84', ' ', '\xE2', '\xB0', '\x82', ' ', '\xE2', '\xB0', '\xAA', ' ', '\xE2', '\xB0', '\x9E', ' ', '\xE2', '\xB0', '\xA1', ' ', '\xE2', '\xB0', '\x8A', ' ', '\xE2', '\xB0', '\x94', /* Ⰵ Ⰴ Ⰲ Ⱚ Ⱎ Ⱑ Ⰺ Ⱄ */ + '\0', + '\xE2', '\xB0', '\xB5', ' ', '\xE2', '\xB1', '\x84', ' ', '\xE2', '\xB1', '\x9A', ' ', '\xE2', '\xB0', '\xB4', ' ', '\xE2', '\xB0', '\xB2', ' ', '\xE2', '\xB0', '\xBA', ' ', '\xE2', '\xB1', '\x9B', ' ', '\xE2', '\xB0', '\xBB', /* ⰵ ⱄ ⱚ ⰴ ⰲ ⰺ ⱛ ⰻ */ + '\0', + '\xE2', '\xB0', '\xB5', ' ', '\xE2', '\xB0', '\xB4', ' ', '\xE2', '\xB0', '\xB2', ' ', '\xE2', '\xB1', '\x9A', ' ', '\xE2', '\xB1', '\x8E', ' ', '\xE2', '\xB1', '\x91', ' ', '\xE2', '\xB0', '\xBA', ' ', '\xE2', '\xB1', '\x84', /* ⰵ ⰴ ⰲ ⱚ ⱎ ⱑ ⰺ ⱄ */ + '\0', + '\xF0', '\x90', '\x8C', '\xB2', ' ', '\xF0', '\x90', '\x8C', '\xB6', ' ', '\xF0', '\x90', '\x8D', '\x80', ' ', '\xF0', '\x90', '\x8D', '\x84', ' ', '\xF0', '\x90', '\x8C', '\xB4', ' ', '\xF0', '\x90', '\x8D', '\x83', ' ', '\xF0', '\x90', '\x8D', '\x88', ' ', '\xF0', '\x90', '\x8C', '\xBE', /* 𐌲 𐌶 𐍀 𐍄 𐌴 𐍃 𐍈 𐌾 */ + '\0', + '\xF0', '\x90', '\x8C', '\xB6', ' ', '\xF0', '\x90', '\x8C', '\xB4', ' ', '\xF0', '\x90', '\x8D', '\x83', ' ', '\xF0', '\x90', '\x8D', '\x88', /* 𐌶 𐌴 𐍃 𐍈 */ + '\0', '\xCE', '\x93', ' ', '\xCE', '\x92', ' ', '\xCE', '\x95', ' ', '\xCE', '\x96', ' ', '\xCE', '\x98', ' ', '\xCE', '\x9F', ' ', '\xCE', '\xA9', /* Γ Β Ε Ζ Θ Ο Ω */ '\0', '\xCE', '\x92', ' ', '\xCE', '\x94', ' ', '\xCE', '\x96', ' ', '\xCE', '\x9E', ' ', '\xCE', '\x98', ' ', '\xCE', '\x9F', /* Β Δ Ζ Ξ Θ Ο */ @@ -138,6 +222,16 @@ '\0', '\xE0', '\xB2', '\x85', ' ', '\xE0', '\xB2', '\x89', ' ', '\xE0', '\xB2', '\x8E', ' ', '\xE0', '\xB2', '\xB2', ' ', '\xE0', '\xB3', '\xA6', ' ', '\xE0', '\xB3', '\xA8', ' ', '\xE0', '\xB3', '\xAC', ' ', '\xE0', '\xB3', '\xAD', /* ಅ ಉ ಎ ಲ ೦ ೨ ೬ ೭ */ '\0', + '\xEA', '\xA4', '\x85', ' ', '\xEA', '\xA4', '\x8F', ' ', '\xEA', '\xA4', '\x81', ' ', '\xEA', '\xA4', '\x8B', ' ', '\xEA', '\xA4', '\x80', ' ', '\xEA', '\xA4', '\x8D', /* ꤅ ꤏ ꤁ ꤋ ꤀ ꤍ */ + '\0', + '\xEA', '\xA4', '\x88', ' ', '\xEA', '\xA4', '\x98', ' ', '\xEA', '\xA4', '\x80', ' ', '\xEA', '\xA4', '\x8D', ' ', '\xEA', '\xA4', '\xA2', /* ꤈ ꤘ ꤀ ꤍ ꤢ */ + '\0', + '\xEA', '\xA4', '\x96', ' ', '\xEA', '\xA4', '\xA1', /* ꤖ ꤡ */ + '\0', + '\xEA', '\xA4', '\x91', ' ', '\xEA', '\xA4', '\x9C', ' ', '\xEA', '\xA4', '\x9E', /* ꤑ ꤜ ꤞ */ + '\0', + '\xEA', '\xA4', '\x91', '\xEA', '\xA4', '\xAC', ' ', '\xEA', '\xA4', '\x9C', '\xEA', '\xA4', '\xAD', ' ', '\xEA', '\xA4', '\x94', '\xEA', '\xA4', '\xAC', /* ꤑ꤬ ꤜ꤭ ꤔ꤬ */ + '\0', '\xE1', '\x9E', '\x81', ' ', '\xE1', '\x9E', '\x91', ' ', '\xE1', '\x9E', '\x93', ' ', '\xE1', '\x9E', '\xA7', ' ', '\xE1', '\x9E', '\xA9', ' ', '\xE1', '\x9E', '\xB6', /* ខ ទ ន ឧ ឩ ា */ '\0', '\xE1', '\x9E', '\x80', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x80', ' ', '\xE1', '\x9E', '\x80', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x81', ' ', '\xE1', '\x9E', '\x80', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x82', ' ', '\xE1', '\x9E', '\x80', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x90', /* ក្ក ក្ខ ក្គ ក្ថ */ @@ -194,6 +288,10 @@ '\0', '\xE1', '\xB5', '\x96', ' ', '\xCA', '\xB8', ' ', '\xE1', '\xB5', '\x8D', /* ᵖ ʸ ᵍ */ '\0', + '\xEA', '\x93', '\xA1', ' ', '\xEA', '\x93', '\xA7', ' ', '\xEA', '\x93', '\xB1', ' ', '\xEA', '\x93', '\xB6', ' ', '\xEA', '\x93', '\xA9', ' ', '\xEA', '\x93', '\x9A', ' ', '\xEA', '\x93', '\xB5', ' ', '\xEA', '\x93', '\xB3', /* ꓡ ꓧ ꓱ ꓶ ꓩ ꓚ ꓵ ꓳ */ + '\0', + '\xEA', '\x93', '\x95', ' ', '\xEA', '\x93', '\x9C', ' ', '\xEA', '\x93', '\x9E', ' ', '\xEA', '\x93', '\xA1', ' ', '\xEA', '\x93', '\x9B', ' ', '\xEA', '\x93', '\xA2', ' ', '\xEA', '\x93', '\xB3', ' ', '\xEA', '\x93', '\xB4', /* ꓕ ꓜ ꓞ ꓡ ꓛ ꓢ ꓳ ꓴ */ + '\0', '\xE0', '\xB4', '\x92', ' ', '\xE0', '\xB4', '\x9F', ' ', '\xE0', '\xB4', '\xA0', ' ', '\xE0', '\xB4', '\xB1', ' ', '\xE0', '\xB4', '\x9A', ' ', '\xE0', '\xB4', '\xAA', ' ', '\xE0', '\xB4', '\x9A', '\xE0', '\xB5', '\x8D', '\xE0', '\xB4', '\x9A', ' ', '\xE0', '\xB4', '\xAA', '\xE0', '\xB5', '\x8D', '\xE0', '\xB4', '\xAA', /* ഒ ട ഠ റ ച പ ച്ച പ്പ */ '\0', '\xE0', '\xB4', '\x9F', ' ', '\xE0', '\xB4', '\xA0', ' ', '\xE0', '\xB4', '\xA7', ' ', '\xE0', '\xB4', '\xB6', ' ', '\xE0', '\xB4', '\x98', ' ', '\xE0', '\xB4', '\x9A', ' ', '\xE0', '\xB4', '\xA5', ' ', '\xE0', '\xB4', '\xB2', /* ട ഠ ധ ശ ഘ ച ഥ ല */ @@ -206,12 +304,68 @@ '\0', '\xE1', '\x80', '\x89', ' ', '\xE1', '\x80', '\x8A', ' ', '\xE1', '\x80', '\xA5', ' ', '\xE1', '\x80', '\xA9', ' ', '\xE1', '\x80', '\xA8', ' ', '\xE1', '\x81', '\x82', ' ', '\xE1', '\x81', '\x85', ' ', '\xE1', '\x81', '\x89', /* ဉ ည ဥ ဩ ဨ ၂ ၅ ၉ */ '\0', + '\xDF', '\x90', ' ', '\xDF', '\x89', ' ', '\xDF', '\x92', ' ', '\xDF', '\x9F', ' ', '\xDF', '\x96', ' ', '\xDF', '\x9C', ' ', '\xDF', '\xA0', ' ', '\xDF', '\xA5', /* ߐ ߉ ߒ ߟ ߖ ߜ ߠ ߥ */ + '\0', + '\xDF', '\x80', ' ', '\xDF', '\x98', ' ', '\xDF', '\xA1', ' ', '\xDF', '\xA0', ' ', '\xDF', '\xA5', /* ߀ ߘ ߡ ߠ ߥ */ + '\0', + '\xDF', '\x8F', ' ', '\xDF', '\x9B', ' ', '\xDF', '\x8B', /* ߏ ߛ ߋ */ + '\0', + '\xDF', '\x8E', ' ', '\xDF', '\x8F', ' ', '\xDF', '\x9B', ' ', '\xDF', '\x8B', /* ߎ ߏ ߛ ߋ */ + '\0', + '\xE1', '\xB1', '\x9B', ' ', '\xE1', '\xB1', '\x9C', ' ', '\xE1', '\xB1', '\x9D', ' ', '\xE1', '\xB1', '\xA1', ' ', '\xE1', '\xB1', '\xA2', ' ', '\xE1', '\xB1', '\xA5', /* ᱛ ᱜ ᱝ ᱡ ᱢ ᱥ */ + '\0', + '\xF0', '\x90', '\xB0', '\x97', ' ', '\xF0', '\x90', '\xB0', '\x98', ' ', '\xF0', '\x90', '\xB0', '\xA7', /* 𐰗 𐰘 𐰧 */ + '\0', + '\xF0', '\x90', '\xB0', '\x89', ' ', '\xF0', '\x90', '\xB0', '\x97', ' ', '\xF0', '\x90', '\xB0', '\xA6', ' ', '\xF0', '\x90', '\xB0', '\xA7', /* 𐰉 𐰗 𐰦 𐰧 */ + '\0', + '\xF0', '\x90', '\x92', '\xBE', ' ', '\xF0', '\x90', '\x93', '\x8D', ' ', '\xF0', '\x90', '\x93', '\x92', ' ', '\xF0', '\x90', '\x93', '\x93', ' ', '\xF0', '\x90', '\x92', '\xBB', ' ', '\xF0', '\x90', '\x93', '\x82', ' ', '\xF0', '\x90', '\x92', '\xB5', ' ', '\xF0', '\x90', '\x93', '\x86', /* 𐒾 𐓍 𐓒 𐓓 𐒻 𐓂 𐒵 𐓆 */ + '\0', + '\xF0', '\x90', '\x92', '\xB0', ' ', '\xF0', '\x90', '\x93', '\x8D', ' ', '\xF0', '\x90', '\x93', '\x82', ' ', '\xF0', '\x90', '\x92', '\xBF', ' ', '\xF0', '\x90', '\x93', '\x8E', ' ', '\xF0', '\x90', '\x92', '\xB9', /* 𐒰 𐓍 𐓂 𐒿 𐓎 𐒹 */ + '\0', + '\xF0', '\x90', '\x92', '\xBC', ' ', '\xF0', '\x90', '\x92', '\xBD', ' ', '\xF0', '\x90', '\x92', '\xBE', /* 𐒼 𐒽 𐒾 */ + '\0', + '\xF0', '\x90', '\x93', '\xB5', ' ', '\xF0', '\x90', '\x93', '\xB6', ' ', '\xF0', '\x90', '\x93', '\xBA', ' ', '\xF0', '\x90', '\x93', '\xBB', ' ', '\xF0', '\x90', '\x93', '\x9D', ' ', '\xF0', '\x90', '\x93', '\xA3', ' ', '\xF0', '\x90', '\x93', '\xAA', ' ', '\xF0', '\x90', '\x93', '\xAE', /* 𐓵 𐓶 𐓺 𐓻 𐓝 𐓣 𐓪 𐓮 */ + '\0', + '\xF0', '\x90', '\x93', '\x98', ' ', '\xF0', '\x90', '\x93', '\x9A', ' ', '\xF0', '\x90', '\x93', '\xA3', ' ', '\xF0', '\x90', '\x93', '\xB5', ' ', '\xF0', '\x90', '\x93', '\xA1', ' ', '\xF0', '\x90', '\x93', '\xA7', ' ', '\xF0', '\x90', '\x93', '\xAA', ' ', '\xF0', '\x90', '\x93', '\xB6', /* 𐓘 𐓚 𐓣 𐓵 𐓡 𐓧 𐓪 𐓶 */ + '\0', + '\xF0', '\x90', '\x93', '\xA4', ' ', '\xF0', '\x90', '\x93', '\xA6', ' ', '\xF0', '\x90', '\x93', '\xB8', ' ', '\xF0', '\x90', '\x93', '\xB9', ' ', '\xF0', '\x90', '\x93', '\x9B', /* 𐓤 𐓦 𐓸 𐓹 𐓛 */ + '\0', + '\xF0', '\x90', '\x93', '\xA4', ' ', '\xF0', '\x90', '\x93', '\xA5', ' ', '\xF0', '\x90', '\x93', '\xA6', /* 𐓤 𐓥 𐓦 */ + '\0', + '\xF0', '\x90', '\x92', '\x86', ' ', '\xF0', '\x90', '\x92', '\x89', ' ', '\xF0', '\x90', '\x92', '\x90', ' ', '\xF0', '\x90', '\x92', '\x92', ' ', '\xF0', '\x90', '\x92', '\x98', ' ', '\xF0', '\x90', '\x92', '\x9B', ' ', '\xF0', '\x90', '\x92', '\xA0', ' ', '\xF0', '\x90', '\x92', '\xA3', /* 𐒆 𐒉 𐒐 𐒒 𐒘 𐒛 𐒠 𐒣 */ + '\0', + '\xF0', '\x90', '\x92', '\x80', ' ', '\xF0', '\x90', '\x92', '\x82', ' ', '\xF0', '\x90', '\x92', '\x86', ' ', '\xF0', '\x90', '\x92', '\x88', ' ', '\xF0', '\x90', '\x92', '\x8A', ' ', '\xF0', '\x90', '\x92', '\x92', ' ', '\xF0', '\x90', '\x92', '\xA0', ' ', '\xF0', '\x90', '\x92', '\xA9', /* 𐒀 𐒂 𐒆 𐒈 𐒊 𐒒 𐒠 𐒩 */ + '\0', + '\xEA', '\xA2', '\x9C', ' ', '\xEA', '\xA2', '\x9E', ' ', '\xEA', '\xA2', '\xB3', ' ', '\xEA', '\xA2', '\x82', ' ', '\xEA', '\xA2', '\x96', ' ', '\xEA', '\xA2', '\x92', ' ', '\xEA', '\xA2', '\x9D', ' ', '\xEA', '\xA2', '\x9B', /* ꢜ ꢞ ꢳ ꢂ ꢖ ꢒ ꢝ ꢛ */ + '\0', + '\xEA', '\xA2', '\x82', ' ', '\xEA', '\xA2', '\xA8', ' ', '\xEA', '\xA2', '\xBA', ' ', '\xEA', '\xA2', '\xA4', ' ', '\xEA', '\xA2', '\x8E', /* ꢂ ꢨ ꢺ ꢤ ꢎ */ + '\0', + '\xF0', '\x90', '\x91', '\x95', ' ', '\xF0', '\x90', '\x91', '\x99', /* 𐑕 𐑙 */ + '\0', + '\xF0', '\x90', '\x91', '\x94', ' ', '\xF0', '\x90', '\x91', '\x96', ' ', '\xF0', '\x90', '\x91', '\x97', ' ', '\xF0', '\x90', '\x91', '\xB9', ' ', '\xF0', '\x90', '\x91', '\xBB', /* 𐑔 𐑖 𐑗 𐑹 𐑻 */ + '\0', + '\xF0', '\x90', '\x91', '\x9F', ' ', '\xF0', '\x90', '\x91', '\xA3', /* 𐑟 𐑣 */ + '\0', + '\xF0', '\x90', '\x91', '\xB1', ' ', '\xF0', '\x90', '\x91', '\xB2', ' ', '\xF0', '\x90', '\x91', '\xB3', ' ', '\xF0', '\x90', '\x91', '\xB4', ' ', '\xF0', '\x90', '\x91', '\xB8', ' ', '\xF0', '\x90', '\x91', '\xBA', ' ', '\xF0', '\x90', '\x91', '\xBC', /* 𐑱 𐑲 𐑳 𐑴 𐑸 𐑺 𐑼 */ + '\0', + '\xF0', '\x90', '\x91', '\xB4', ' ', '\xF0', '\x90', '\x91', '\xBB', ' ', '\xF0', '\x90', '\x91', '\xB9', /* 𐑴 𐑻 𐑹 */ + '\0', '\xE0', '\xB6', '\x89', ' ', '\xE0', '\xB6', '\x9A', ' ', '\xE0', '\xB6', '\x9D', ' ', '\xE0', '\xB6', '\xB3', ' ', '\xE0', '\xB6', '\xB4', ' ', '\xE0', '\xB6', '\xBA', ' ', '\xE0', '\xB6', '\xBD', ' ', '\xE0', '\xB7', '\x86', /* ඉ ක ඝ ඳ ප ය ල ෆ */ '\0', '\xE0', '\xB6', '\x91', ' ', '\xE0', '\xB6', '\x94', ' ', '\xE0', '\xB6', '\x9D', ' ', '\xE0', '\xB6', '\xA2', ' ', '\xE0', '\xB6', '\xA7', ' ', '\xE0', '\xB6', '\xAE', ' ', '\xE0', '\xB6', '\xB0', ' ', '\xE0', '\xB6', '\xBB', /* එ ඔ ඝ ජ ට ථ ධ ර */ '\0', '\xE0', '\xB6', '\xAF', ' ', '\xE0', '\xB6', '\xB3', ' ', '\xE0', '\xB6', '\x8B', ' ', '\xE0', '\xB6', '\xBD', ' ', '\xE0', '\xB6', '\xAD', '\xE0', '\xB7', '\x96', ' ', '\xE0', '\xB6', '\xAD', '\xE0', '\xB7', '\x94', ' ', '\xE0', '\xB6', '\xB6', '\xE0', '\xB7', '\x94', ' ', '\xE0', '\xB6', '\xAF', '\xE0', '\xB7', '\x94', /* ද ඳ උ ල තූ තු බු දු */ '\0', + '\xE1', '\xAE', '\x8B', ' ', '\xE1', '\xAE', '\x9E', ' ', '\xE1', '\xAE', '\xAE', ' ', '\xE1', '\xAE', '\xBD', ' ', '\xE1', '\xAE', '\xB0', ' ', '\xE1', '\xAE', '\x88', /* ᮋ ᮞ ᮮ ᮽ ᮰ ᮈ */ + '\0', + '\xE1', '\xAE', '\x84', ' ', '\xE1', '\xAE', '\x94', ' ', '\xE1', '\xAE', '\x95', ' ', '\xE1', '\xAE', '\x97', ' ', '\xE1', '\xAE', '\xB0', ' ', '\xE1', '\xAE', '\x86', ' ', '\xE1', '\xAE', '\x88', ' ', '\xE1', '\xAE', '\x89', /* ᮄ ᮔ ᮕ ᮗ ᮰ ᮆ ᮈ ᮉ */ + '\0', + '\xE1', '\xAE', '\xBC', ' ', '\xE1', '\xB3', '\x84', /* ᮼ ᳄ */ + '\0', + '\xEA', '\xAA', '\x86', ' ', '\xEA', '\xAA', '\x94', ' ', '\xEA', '\xAA', '\x92', ' ', '\xEA', '\xAA', '\x96', ' ', '\xEA', '\xAA', '\xAB', /* ꪆ ꪔ ꪒ ꪖ ꪫ */ + '\0', + '\xEA', '\xAA', '\x89', ' ', '\xEA', '\xAA', '\xAB', ' ', '\xEA', '\xAA', '\xAE', /* ꪉ ꪫ ꪮ */ + '\0', '\xE0', '\xAE', '\x89', ' ', '\xE0', '\xAE', '\x92', ' ', '\xE0', '\xAE', '\x93', ' ', '\xE0', '\xAE', '\xB1', ' ', '\xE0', '\xAE', '\x88', ' ', '\xE0', '\xAE', '\x95', ' ', '\xE0', '\xAE', '\x99', ' ', '\xE0', '\xAE', '\x9A', /* உ ஒ ஓ ற ஈ க ங ச */ '\0', '\xE0', '\xAE', '\x95', ' ', '\xE0', '\xAE', '\x9A', ' ', '\xE0', '\xAE', '\xB2', ' ', '\xE0', '\xAE', '\xB6', ' ', '\xE0', '\xAE', '\x89', ' ', '\xE0', '\xAE', '\x99', ' ', '\xE0', '\xAE', '\x9F', ' ', '\xE0', '\xAE', '\xAA', /* க ச ல ஶ உ ங ட ப */ @@ -233,6 +387,12 @@ '\xE0', '\xB8', '\x8D', ' ', '\xE0', '\xB8', '\x90', /* ญ ฐ */ '\0', '\xE0', '\xB9', '\x90', ' ', '\xE0', '\xB9', '\x91', ' ', '\xE0', '\xB9', '\x93', /* ๐ ๑ ๓ */ + '\0', + '\xE2', '\xB5', '\x94', ' ', '\xE2', '\xB5', '\x99', ' ', '\xE2', '\xB5', '\x9B', ' ', '\xE2', '\xB5', '\x9E', ' ', '\xE2', '\xB4', '\xB5', ' ', '\xE2', '\xB4', '\xBC', ' ', '\xE2', '\xB4', '\xB9', ' ', '\xE2', '\xB5', '\x8E', /* ⵔ ⵙ ⵛ ⵞ ⴵ ⴼ ⴹ ⵎ */ + '\0', + '\xEA', '\x97', '\x8D', ' ', '\xEA', '\x98', '\x96', ' ', '\xEA', '\x98', '\x99', ' ', '\xEA', '\x98', '\x9C', ' ', '\xEA', '\x96', '\x9C', ' ', '\xEA', '\x96', '\x9D', ' ', '\xEA', '\x94', '\x85', ' ', '\xEA', '\x95', '\xA2', /* ꗍ ꘖ ꘙ ꘜ ꖜ ꖝ ꔅ ꕢ */ + '\0', + '\xEA', '\x97', '\x8D', ' ', '\xEA', '\x98', '\x96', ' ', '\xEA', '\x98', '\x99', ' ', '\xEA', '\x97', '\x9E', ' ', '\xEA', '\x94', '\x85', ' ', '\xEA', '\x95', '\xA2', ' ', '\xEA', '\x96', '\x9C', ' ', '\xEA', '\x94', '\x86', /* ꗍ ꘖ ꘙ ꗞ ꔅ ꕢ ꖜ ꔆ */ #ifdef AF_CONFIG_OPTION_CJK '\0', '\xE4', '\xBB', '\x96', ' ', '\xE4', '\xBB', '\xAC', ' ', '\xE4', '\xBD', '\xA0', ' ', '\xE4', '\xBE', '\x86', ' ', '\xE5', '\x80', '\x91', ' ', '\xE5', '\x88', '\xB0', ' ', '\xE5', '\x92', '\x8C', ' ', '\xE5', '\x9C', '\xB0', /* 他 们 你 來 們 到 和 地 */ @@ -283,6 +443,12 @@ af_blue_stringsets[] = { /* */ + { AF_BLUE_STRING_ADLAM_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_ADLAM_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_ADLAM_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_ADLAM_SMALL_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_ARABIC_BOTTOM, 0 }, { AF_BLUE_STRING_ARABIC_JOIN, AF_BLUE_PROPERTY_LATIN_NEUTRAL }, @@ -295,6 +461,12 @@ { AF_BLUE_STRING_ARMENIAN_SMALL_BOTTOM, 0 }, { AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_AVESTAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_AVESTAN_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_BAMUM_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_BAMUM_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_BENGALI_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_BENGALI_HEAD, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_BENGALI_BASE, AF_BLUE_PROPERTY_LATIN_TOP | @@ -302,6 +474,27 @@ AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_BENGALI_BASE, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_BUHID_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_BUHID_LARGE, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_BUHID_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_BUHID_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_CHAKMA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_CHAKMA_BOTTOM, 0 }, + { AF_BLUE_STRING_CHAKMA_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0 }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_CARIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_CARIAN_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_CHEROKEE_CAPITAL, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_CHEROKEE_CAPITAL, 0 }, { AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, @@ -310,6 +503,17 @@ { AF_BLUE_STRING_CHEROKEE_SMALL, 0 }, { AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_COPTIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_COPTIC_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_COPTIC_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_COPTIC_SMALL_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_CYPRIOT_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_CYPRIOT_BOTTOM, 0 }, + { AF_BLUE_STRING_CYPRIOT_SMALL, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_CYPRIOT_SMALL, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM, 0 }, { AF_BLUE_STRING_CYRILLIC_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | @@ -325,6 +529,12 @@ { AF_BLUE_STRING_DEVANAGARI_BASE, 0 }, { AF_BLUE_STRING_DEVANAGARI_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_DESERET_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_DESERET_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_DESERET_SMALL_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_ETHIOPIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_ETHIOPIC_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, @@ -333,6 +543,8 @@ { AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM, 0 }, { AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER, 0 }, + { AF_BLUE_STRING_GEORGIAN_MTAVRULI_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_GEORGIAN_MTAVRULI_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM, 0 }, @@ -342,6 +554,15 @@ { AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_GOTHIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_GOTHIC_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_GREEK_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM, 0 }, { AF_BLUE_STRING_GREEK_SMALL_BETA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, @@ -370,9 +591,13 @@ { AF_BLUE_STRING_HEBREW_BOTTOM, 0 }, { AF_BLUE_STRING_HEBREW_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_KANNADA_BOTTOM, 0 }, - { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_KAYAH_LI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_KAYAH_LI_BOTTOM, 0 }, + { AF_BLUE_STRING_KAYAH_LI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_KAYAH_LI_DESCENDER, 0 }, + { AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_KHMER_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP, AF_BLUE_PROPERTY_LATIN_SUB_TOP }, @@ -384,6 +609,9 @@ AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_KANNADA_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_LAO_BOTTOM, 0 }, @@ -415,6 +643,9 @@ { AF_BLUE_STRING_LATIN_SUPS_SMALL, 0 }, { AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_LISU_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LISU_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_MALAYALAM_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_MALAYALAM_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, @@ -424,17 +655,61 @@ { AF_BLUE_STRING_MYANMAR_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_MYANMAR_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_NKO_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_NKO_BOTTOM, 0 }, + { AF_BLUE_STRING_NKO_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_NKO_SMALL_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_OL_CHIKI, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_OL_CHIKI, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_OLD_TURKIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_OLD_TURKIC_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_OSAGE_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER, 0 }, + { AF_BLUE_STRING_OSAGE_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_OSAGE_SMALL_BOTTOM, 0 }, + { AF_BLUE_STRING_OSAGE_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_OSAGE_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_OSMANYA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_OSMANYA_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_SAURASHTRA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_SAURASHTRA_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_SHAVIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_SHAVIAN_BOTTOM, 0 }, + { AF_BLUE_STRING_SHAVIAN_DESCENDER, 0 }, + { AF_BLUE_STRING_SHAVIAN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_SINHALA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_SINHALA_BOTTOM, 0 }, { AF_BLUE_STRING_SINHALA_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_SUNDANESE_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_SUNDANESE_BOTTOM, 0 }, + { AF_BLUE_STRING_SUNDANESE_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_TAMIL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_TAMIL_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_TAI_VIET_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_TAI_VIET_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_TELUGU_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_TELUGU_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_TIFINAGH, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_THAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_THAI_BOTTOM, 0 }, @@ -444,6 +719,9 @@ { AF_BLUE_STRING_THAI_LARGE_DESCENDER, 0 }, { AF_BLUE_STRING_THAI_DIGIT_TOP, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_VAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_VAI_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, #ifdef AF_CONFIG_OPTION_CJK { AF_BLUE_STRING_CJK_TOP, AF_BLUE_PROPERTY_CJK_TOP }, { AF_BLUE_STRING_CJK_BOTTOM, 0 }, diff --git a/src/autofit/afblue.cin b/src/autofit/afblue.cin index f9080c54d..4913e2eb6 100644 --- a/src/autofit/afblue.cin +++ b/src/autofit/afblue.cin @@ -4,7 +4,7 @@ /* */ /* Auto-fitter data for blue strings (body). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat index 8b75aecf3..bc2f0d275 100644 --- a/src/autofit/afblue.dat +++ b/src/autofit/afblue.dat @@ -2,7 +2,7 @@ // // Auto-fitter data for blue strings. // -// Copyright 2013-2017 by +// Copyright 2013-2018 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, @@ -74,6 +74,15 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: + AF_BLUE_STRING_ADLAM_CAPITAL_TOP + "𞤌 𞤅 𞤈 𞤏 𞤔 𞤚" + AF_BLUE_STRING_ADLAM_CAPITAL_BOTTOM + "𞤂 𞤖" + AF_BLUE_STRING_ADLAM_SMALL_TOP + "𞤬 𞤮 𞤻 𞤼 𞤾" + AF_BLUE_STRING_ADLAM_SMALL_BOTTOM + "𞤤 𞤨 𞤩 𞤭 𞤴 𞤸 𞤺 𞥀" + AF_BLUE_STRING_ARABIC_TOP "ا إ ل ك ط ظ" AF_BLUE_STRING_ARABIC_BOTTOM @@ -99,6 +108,16 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER "բ ը ի լ ղ պ փ ց" + AF_BLUE_STRING_AVESTAN_TOP + "𐬀 𐬁 𐬐 𐬛" + AF_BLUE_STRING_AVESTAN_BOTTOM + "𐬀 𐬁" + + AF_BLUE_STRING_BAMUM_TOP + "ꚧ ꚨ ꛛ ꛉ ꛁ ꛈ ꛫ ꛯ" + AF_BLUE_STRING_BAMUM_BOTTOM + "ꚭ ꚳ ꚶ ꛬ ꚢ ꚽ ꛯ ꛲" + AF_BLUE_STRING_BENGALI_BASE "অ ড ত ন ব ভ ল ক" AF_BLUE_STRING_BENGALI_TOP @@ -106,6 +125,40 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_BENGALI_HEAD "ও এ ড ত ন ব ল ক" + AF_BLUE_STRING_BUHID_TOP + "ᝐ ᝈ" + AF_BLUE_STRING_BUHID_LARGE + "ᝅ ᝊ ᝎ" + AF_BLUE_STRING_BUHID_SMALL + "ᝂ ᝃ ᝉ ᝌ" + AF_BLUE_STRING_BUHID_BOTTOM + "ᝀ ᝃ ᝆ ᝉ ᝋ ᝏ ᝑ" + + AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP + "ᗜ ᖴ ᐁ ᒣ ᑫ ᑎ ᔑ ᗰ" + AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM + "ᗶ ᖵ ᒧ ᐃ ᑌ ᒍ ᔑ ᗢ" + AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP + "ᓓ ᓕ ᓀ ᓂ ᓄ ᕄ ᕆ ᘣ" + AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM + "ᕃ ᓂ ᓀ ᕂ ᓗ ᓚ ᕆ ᘣ" + AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP + "ᐪ ᙆ ᣘ ᐢ ᒾ ᣗ ᔆ" + AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM + "ᙆ ᗮ ᒻ ᐞ ᔆ ᒡ ᒢ ᓑ" + + AF_BLUE_STRING_CARIAN_TOP + "𐊧 𐊫 𐊬 𐊭 𐊱 𐊺 𐊼 𐊿" + AF_BLUE_STRING_CARIAN_BOTTOM + "𐊣 𐊧 𐊷 𐋀 𐊫 𐊸 𐋉" + + AF_BLUE_STRING_CHAKMA_TOP + "𑄃 𑄅 𑄉 𑄙 𑄗" + AF_BLUE_STRING_CHAKMA_BOTTOM + "𑄅 𑄛 𑄝 𑄗 𑄓" + AF_BLUE_STRING_CHAKMA_DESCENDER + "𑄖𑄳𑄢 𑄘𑄳𑄢 𑄙𑄳𑄢 𑄤𑄳𑄢 𑄥𑄳𑄢" + AF_BLUE_STRING_CHEROKEE_CAPITAL "Ꮖ Ꮋ Ꭼ Ꮓ Ꭴ Ꮳ Ꭶ Ꮥ" AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER @@ -115,6 +168,22 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER "ᏸ ꮐ ꭹ ꭻ" + AF_BLUE_STRING_COPTIC_CAPITAL_TOP + "Ⲍ Ⲏ Ⲡ Ⳟ Ⲟ Ⲑ Ⲥ Ⳋ" + AF_BLUE_STRING_COPTIC_CAPITAL_BOTTOM + "Ⳑ Ⳙ Ⳟ Ⲏ Ⲟ Ⲑ Ⳝ Ⲱ" + AF_BLUE_STRING_COPTIC_SMALL_TOP + "ⲍ ⲏ ⲡ ⳟ ⲟ ⲑ ⲥ ⳋ" + AF_BLUE_STRING_COPTIC_SMALL_BOTTOM + "ⳑ ⳙ ⳟ ⲏ ⲟ ⲑ ⳝ Ⳓ" + + AF_BLUE_STRING_CYPRIOT_TOP + "𐠍 𐠙 𐠳 𐠱 𐠅 𐠓 𐠣 𐠦" + AF_BLUE_STRING_CYPRIOT_BOTTOM + "𐠃 𐠊 𐠛 𐠣 𐠳 𐠵 𐠐" + AF_BLUE_STRING_CYPRIOT_SMALL + "𐠈 𐠏 𐠖" + AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP "Б В Е П З О С Э" AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM @@ -124,6 +193,15 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER "р у ф" + AF_BLUE_STRING_DESERET_CAPITAL_TOP + "𐐂 𐐄 𐐋 𐐗 𐐑" + AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM + "𐐀 𐐂 𐐄 𐐗 𐐛" + AF_BLUE_STRING_DESERET_SMALL_TOP + "𐐪 𐐬 𐐳 𐐿 𐐹" + AF_BLUE_STRING_DESERET_SMALL_BOTTOM + "𐐨 𐐪 𐐬 𐐿 𐑃" + AF_BLUE_STRING_DEVANAGARI_BASE "क म अ आ थ ध भ श" AF_BLUE_STRING_DEVANAGARI_TOP @@ -164,6 +242,25 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER "ⴄ ⴅ ⴔ ⴕ ⴁ ⴂ ⴘ ⴝ" + AF_BLUE_STRING_GEORGIAN_MTAVRULI_TOP + "Ნ Ჟ Ჳ Ჸ Გ Ე Ო Ჴ" + AF_BLUE_STRING_GEORGIAN_MTAVRULI_BOTTOM + "Ი Ჲ Ო Ჩ Მ Შ Ჯ Ჽ" + + AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP + "Ⰵ Ⱄ Ⱚ Ⰴ Ⰲ Ⰺ Ⱛ Ⰻ" + AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM + "Ⰵ Ⰴ Ⰲ Ⱚ Ⱎ Ⱑ Ⰺ Ⱄ" + AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP + "ⰵ ⱄ ⱚ ⰴ ⰲ ⰺ ⱛ ⰻ" + AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM + "ⰵ ⰴ ⰲ ⱚ ⱎ ⱑ ⰺ ⱄ" + + AF_BLUE_STRING_GOTHIC_TOP + "𐌲 𐌶 𐍀 𐍄 𐌴 𐍃 𐍈 𐌾" + AF_BLUE_STRING_GOTHIC_BOTTOM + "𐌶 𐌴 𐍃 𐍈" + AF_BLUE_STRING_GREEK_CAPITAL_TOP "Γ Β Ε Ζ Θ Ο Ω" AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM @@ -209,6 +306,17 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_KANNADA_BOTTOM "ಅ ಉ ಎ ಲ ೦ ೨ ೬ ೭" + AF_BLUE_STRING_KAYAH_LI_TOP + "꤅ ꤏ ꤁ ꤋ ꤀ ꤍ" + AF_BLUE_STRING_KAYAH_LI_BOTTOM + "꤈ ꤘ ꤀ ꤍ ꤢ" + AF_BLUE_STRING_KAYAH_LI_ASCENDER + "ꤖ ꤡ" + AF_BLUE_STRING_KAYAH_LI_DESCENDER + "ꤑ ꤜ ꤞ" + AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER + "ꤑ꤬ ꤜ꤭ ꤔ꤬" + AF_BLUE_STRING_KHMER_TOP "ខ ទ ន ឧ ឩ ា" AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP @@ -274,6 +382,11 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER "ᵖ ʸ ᵍ" + AF_BLUE_STRING_LISU_TOP + "ꓡ ꓧ ꓱ ꓶ ꓩ ꓚ ꓵ ꓳ" + AF_BLUE_STRING_LISU_BOTTOM + "ꓕ ꓜ ꓞ ꓡ ꓛ ꓢ ꓳ ꓴ" + AF_BLUE_STRING_MALAYALAM_TOP "ഒ ട ഠ റ ച പ ച്ച പ്പ" AF_BLUE_STRING_MALAYALAM_BOTTOM @@ -288,6 +401,59 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_MYANMAR_DESCENDER "ဉ ည ဥ ဩ ဨ ၂ ၅ ၉" + AF_BLUE_STRING_NKO_TOP + "ߐ ߉ ߒ ߟ ߖ ߜ ߠ ߥ" + AF_BLUE_STRING_NKO_BOTTOM + "߀ ߘ ߡ ߠ ߥ" + AF_BLUE_STRING_NKO_SMALL_TOP + "ߏ ߛ ߋ" + AF_BLUE_STRING_NKO_SMALL_BOTTOM + "ߎ ߏ ߛ ߋ" + + AF_BLUE_STRING_OL_CHIKI + "ᱛ ᱜ ᱝ ᱡ ᱢ ᱥ" + + AF_BLUE_STRING_OLD_TURKIC_TOP + "𐰗 𐰘 𐰧" + AF_BLUE_STRING_OLD_TURKIC_BOTTOM + "𐰉 𐰗 𐰦 𐰧" + + AF_BLUE_STRING_OSAGE_CAPITAL_TOP + "𐒾 𐓍 𐓒 𐓓 𐒻 𐓂 𐒵 𐓆" + AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM + "𐒰 𐓍 𐓂 𐒿 𐓎 𐒹" + AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER + "𐒼 𐒽 𐒾" + AF_BLUE_STRING_OSAGE_SMALL_TOP + "𐓵 𐓶 𐓺 𐓻 𐓝 𐓣 𐓪 𐓮" + AF_BLUE_STRING_OSAGE_SMALL_BOTTOM + "𐓘 𐓚 𐓣 𐓵 𐓡 𐓧 𐓪 𐓶" + AF_BLUE_STRING_OSAGE_SMALL_ASCENDER + "𐓤 𐓦 𐓸 𐓹 𐓛" + AF_BLUE_STRING_OSAGE_SMALL_DESCENDER + "𐓤 𐓥 𐓦" + + AF_BLUE_STRING_OSMANYA_TOP + "𐒆 𐒉 𐒐 𐒒 𐒘 𐒛 𐒠 𐒣" + AF_BLUE_STRING_OSMANYA_BOTTOM + "𐒀 𐒂 𐒆 𐒈 𐒊 𐒒 𐒠 𐒩" + + AF_BLUE_STRING_SAURASHTRA_TOP + "ꢜ ꢞ ꢳ ꢂ ꢖ ꢒ ꢝ ꢛ" + AF_BLUE_STRING_SAURASHTRA_BOTTOM + "ꢂ ꢨ ꢺ ꢤ ꢎ" + + AF_BLUE_STRING_SHAVIAN_TOP + "𐑕 𐑙" + AF_BLUE_STRING_SHAVIAN_BOTTOM + "𐑔 𐑖 𐑗 𐑹 𐑻" + AF_BLUE_STRING_SHAVIAN_DESCENDER + "𐑟 𐑣" + AF_BLUE_STRING_SHAVIAN_SMALL_TOP + "𐑱 𐑲 𐑳 𐑴 𐑸 𐑺 𐑼" + AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM + "𐑴 𐑻 𐑹" + AF_BLUE_STRING_SINHALA_TOP "ඉ ක ඝ ඳ ප ය ල ෆ" AF_BLUE_STRING_SINHALA_BOTTOM @@ -295,6 +461,18 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_SINHALA_DESCENDER "ද ඳ උ ල තූ තු බු දු" + AF_BLUE_STRING_SUNDANESE_TOP + "ᮋ ᮞ ᮮ ᮽ ᮰ ᮈ" + AF_BLUE_STRING_SUNDANESE_BOTTOM + "ᮄ ᮔ ᮕ ᮗ ᮰ ᮆ ᮈ ᮉ" + AF_BLUE_STRING_SUNDANESE_DESCENDER + "ᮼ ᳄" + + AF_BLUE_STRING_TAI_VIET_TOP + "ꪆ ꪔ ꪒ ꪖ ꪫ" + AF_BLUE_STRING_TAI_VIET_BOTTOM + "ꪉ ꪫ ꪮ" + AF_BLUE_STRING_TAMIL_TOP "உ ஒ ஓ ற ஈ க ங ச" AF_BLUE_STRING_TAMIL_BOTTOM @@ -320,6 +498,14 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_THAI_DIGIT_TOP "๐ ๑ ๓" + AF_BLUE_STRING_TIFINAGH + "ⵔ ⵙ ⵛ ⵞ ⴵ ⴼ ⴹ ⵎ" + + AF_BLUE_STRING_VAI_TOP + "ꗍ ꘖ ꘙ ꘜ ꖜ ꖝ ꔅ ꕢ" + AF_BLUE_STRING_VAI_BOTTOM + "ꗍ ꘖ ꘙ ꗞ ꔅ ꕢ ꖜ ꔆ" + #ifdef AF_CONFIG_OPTION_CJK @@ -485,6 +671,14 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: + AF_BLUE_STRINGSET_ADLM + { AF_BLUE_STRING_ADLAM_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_ADLAM_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_ADLAM_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_ADLAM_SMALL_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_ARAB { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_ARABIC_BOTTOM, 0 } @@ -501,6 +695,16 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_AVST + { AF_BLUE_STRING_AVESTAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_AVESTAN_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_BAMU + { AF_BLUE_STRING_BAMUM_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_BAMUM_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_BENG { AF_BLUE_STRING_BENGALI_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_BENGALI_HEAD, AF_BLUE_PROPERTY_LATIN_TOP } @@ -510,6 +714,35 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_BENGALI_BASE, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_BUHD + { AF_BLUE_STRING_BUHID_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_BUHID_LARGE, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_BUHID_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_BUHID_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_CAKM + { AF_BLUE_STRING_CHAKMA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_CHAKMA_BOTTOM, 0 } + { AF_BLUE_STRING_CHAKMA_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_CANS + { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0 } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_CARI + { AF_BLUE_STRING_CARIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_CARIAN_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_CHER { AF_BLUE_STRING_CHEROKEE_CAPITAL, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_CHEROKEE_CAPITAL, 0 } @@ -520,6 +753,21 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_COPT + { AF_BLUE_STRING_COPTIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_COPTIC_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_COPTIC_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_COPTIC_SMALL_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_CPRT + { AF_BLUE_STRING_CYPRIOT_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_CYPRIOT_BOTTOM, 0 } + { AF_BLUE_STRING_CYPRIOT_SMALL, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_CYPRIOT_SMALL, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_CYRL { AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM, 0 } @@ -539,18 +787,27 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_DEVANAGARI_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_DSRT + { AF_BLUE_STRING_DESERET_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_DESERET_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_DESERET_SMALL_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_ETHI { AF_BLUE_STRING_ETHIOPIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_ETHIOPIC_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } - // blue zones for Mtavruli are missing (not yet defined in Unicode) AF_BLUE_STRINGSET_GEOR { AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT } { AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM, 0 } { AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER, 0 } + { AF_BLUE_STRING_GEORGIAN_MTAVRULI_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_GEORGIAN_MTAVRULI_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_GEOK @@ -563,6 +820,19 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_GLAG + { AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_GOTH + { AF_BLUE_STRING_GOTHIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_GOTHIC_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_GREK { AF_BLUE_STRING_GREEK_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM, 0 } @@ -599,10 +869,14 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_HEBREW_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } - AF_BLUE_STRINGSET_KNDA - { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_KANNADA_BOTTOM, 0 } - { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_KALI + { AF_BLUE_STRING_KAYAH_LI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_KAYAH_LI_BOTTOM, 0 } + { AF_BLUE_STRING_KAYAH_LI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_KAYAH_LI_DESCENDER, 0 } + { AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_KHMR { AF_BLUE_STRING_KHMER_TOP, AF_BLUE_PROPERTY_LATIN_TOP | @@ -619,6 +893,11 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_KNDA + { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_KANNADA_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_LAO { AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT } @@ -658,6 +937,11 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_LISU + { AF_BLUE_STRING_LISU_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LISU_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_MLYM { AF_BLUE_STRING_MALAYALAM_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_MALAYALAM_BOTTOM, 0 } @@ -671,25 +955,89 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MYANMAR_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_NKOO + { AF_BLUE_STRING_NKO_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_NKO_BOTTOM, 0 } + { AF_BLUE_STRING_NKO_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_NKO_SMALL_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_NONE { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_OLCK + { AF_BLUE_STRING_OL_CHIKI, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_OL_CHIKI, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_ORKH + { AF_BLUE_STRING_OLD_TURKIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_OLD_TURKIC_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_OSGE + { AF_BLUE_STRING_OSAGE_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER, 0 } + { AF_BLUE_STRING_OSAGE_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_OSAGE_SMALL_BOTTOM, 0 } + { AF_BLUE_STRING_OSAGE_SMALL_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_OSAGE_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_OSMA + { AF_BLUE_STRING_OSMANYA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_OSMANYA_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_SAUR + { AF_BLUE_STRING_SAURASHTRA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_SAURASHTRA_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_SHAW + { AF_BLUE_STRING_SHAVIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_SHAVIAN_BOTTOM, 0 } + { AF_BLUE_STRING_SHAVIAN_DESCENDER, 0 } + { AF_BLUE_STRING_SHAVIAN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_SINH { AF_BLUE_STRING_SINHALA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_SINHALA_BOTTOM, 0 } { AF_BLUE_STRING_SINHALA_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_SUND + { AF_BLUE_STRING_SUNDANESE_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_SUNDANESE_BOTTOM, 0 } + { AF_BLUE_STRING_SUNDANESE_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_TAML { AF_BLUE_STRING_TAMIL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_TAMIL_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_TAVT + { AF_BLUE_STRING_TAI_VIET_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_TAI_VIET_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_TELU { AF_BLUE_STRING_TELUGU_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_TELUGU_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_TFNG + { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_TIFINAGH, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_THAI { AF_BLUE_STRING_THAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT } @@ -701,6 +1049,10 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_THAI_DIGIT_TOP, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_VAII + { AF_BLUE_STRING_VAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_VAI_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } #ifdef AF_CONFIG_OPTION_CJK diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h index f4720edd5..de31e259c 100644 --- a/src/autofit/afblue.h +++ b/src/autofit/afblue.h @@ -7,7 +7,7 @@ /* */ /* Auto-fitter data for blue strings (specification). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -77,111 +77,191 @@ FT_BEGIN_HEADER typedef enum AF_Blue_String_ { - AF_BLUE_STRING_ARABIC_TOP = 0, - AF_BLUE_STRING_ARABIC_BOTTOM = 18, - AF_BLUE_STRING_ARABIC_JOIN = 33, - AF_BLUE_STRING_ARMENIAN_CAPITAL_TOP = 36, - AF_BLUE_STRING_ARMENIAN_CAPITAL_BOTTOM = 60, - AF_BLUE_STRING_ARMENIAN_SMALL_ASCENDER = 84, - AF_BLUE_STRING_ARMENIAN_SMALL_TOP = 105, - AF_BLUE_STRING_ARMENIAN_SMALL_BOTTOM = 129, - AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER = 153, - AF_BLUE_STRING_BENGALI_BASE = 177, - AF_BLUE_STRING_BENGALI_TOP = 209, - AF_BLUE_STRING_BENGALI_HEAD = 237, - AF_BLUE_STRING_CHEROKEE_CAPITAL = 269, - AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER = 301, - AF_BLUE_STRING_CHEROKEE_SMALL = 333, - AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER = 365, - AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 381, - AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 405, - AF_BLUE_STRING_CYRILLIC_SMALL = 429, - AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 453, - AF_BLUE_STRING_DEVANAGARI_BASE = 462, - AF_BLUE_STRING_DEVANAGARI_TOP = 494, - AF_BLUE_STRING_DEVANAGARI_HEAD = 526, - AF_BLUE_STRING_DEVANAGARI_BOTTOM = 558, - AF_BLUE_STRING_ETHIOPIC_TOP = 566, - AF_BLUE_STRING_ETHIOPIC_BOTTOM = 598, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP = 630, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM = 662, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER = 694, - AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER = 726, - AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP = 758, - AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM = 790, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_TOP = 822, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 854, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 886, - AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 918, - AF_BLUE_STRING_GREEK_CAPITAL_TOP = 950, - AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 971, - AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 989, - AF_BLUE_STRING_GREEK_SMALL = 1007, - AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 1031, - AF_BLUE_STRING_GUJARATI_TOP = 1055, - AF_BLUE_STRING_GUJARATI_BOTTOM = 1087, - AF_BLUE_STRING_GUJARATI_ASCENDER = 1119, - AF_BLUE_STRING_GUJARATI_DESCENDER = 1169, - AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 1202, - AF_BLUE_STRING_GURMUKHI_BASE = 1222, - AF_BLUE_STRING_GURMUKHI_HEAD = 1254, - AF_BLUE_STRING_GURMUKHI_TOP = 1286, - AF_BLUE_STRING_GURMUKHI_BOTTOM = 1318, - AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 1350, - AF_BLUE_STRING_HEBREW_TOP = 1370, - AF_BLUE_STRING_HEBREW_BOTTOM = 1394, - AF_BLUE_STRING_HEBREW_DESCENDER = 1412, - AF_BLUE_STRING_KANNADA_TOP = 1427, - AF_BLUE_STRING_KANNADA_BOTTOM = 1471, - AF_BLUE_STRING_KHMER_TOP = 1503, - AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 1527, - AF_BLUE_STRING_KHMER_BOTTOM = 1567, - AF_BLUE_STRING_KHMER_DESCENDER = 1599, - AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 1633, - AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 1720, - AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 1728, - AF_BLUE_STRING_LAO_TOP = 1736, - AF_BLUE_STRING_LAO_BOTTOM = 1768, - AF_BLUE_STRING_LAO_ASCENDER = 1800, - AF_BLUE_STRING_LAO_LARGE_ASCENDER = 1816, - AF_BLUE_STRING_LAO_DESCENDER = 1828, - AF_BLUE_STRING_LATIN_CAPITAL_TOP = 1852, - AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 1868, - AF_BLUE_STRING_LATIN_SMALL_F_TOP = 1884, - AF_BLUE_STRING_LATIN_SMALL_TOP = 1898, - AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 1914, - AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 1930, - AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 1940, - AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 1960, - AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 1980, - AF_BLUE_STRING_LATIN_SUBS_SMALL = 2000, - AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 2036, - AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 2056, - AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 2087, - AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 2116, - AF_BLUE_STRING_LATIN_SUPS_SMALL = 2142, - AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 2167, - AF_BLUE_STRING_MALAYALAM_TOP = 2178, - AF_BLUE_STRING_MALAYALAM_BOTTOM = 2222, - AF_BLUE_STRING_MYANMAR_TOP = 2254, - AF_BLUE_STRING_MYANMAR_BOTTOM = 2286, - AF_BLUE_STRING_MYANMAR_ASCENDER = 2318, - AF_BLUE_STRING_MYANMAR_DESCENDER = 2346, - AF_BLUE_STRING_SINHALA_TOP = 2378, - AF_BLUE_STRING_SINHALA_BOTTOM = 2410, - AF_BLUE_STRING_SINHALA_DESCENDER = 2442, - AF_BLUE_STRING_TAMIL_TOP = 2486, - AF_BLUE_STRING_TAMIL_BOTTOM = 2518, - AF_BLUE_STRING_TELUGU_TOP = 2550, - AF_BLUE_STRING_TELUGU_BOTTOM = 2578, - AF_BLUE_STRING_THAI_TOP = 2606, - AF_BLUE_STRING_THAI_BOTTOM = 2630, - AF_BLUE_STRING_THAI_ASCENDER = 2658, - AF_BLUE_STRING_THAI_LARGE_ASCENDER = 2670, - AF_BLUE_STRING_THAI_DESCENDER = 2682, - AF_BLUE_STRING_THAI_LARGE_DESCENDER = 2698, - AF_BLUE_STRING_THAI_DIGIT_TOP = 2706, - af_blue_1_1 = 2717, + AF_BLUE_STRING_ADLAM_CAPITAL_TOP = 0, + AF_BLUE_STRING_ADLAM_CAPITAL_BOTTOM = 30, + AF_BLUE_STRING_ADLAM_SMALL_TOP = 40, + AF_BLUE_STRING_ADLAM_SMALL_BOTTOM = 65, + AF_BLUE_STRING_ARABIC_TOP = 105, + AF_BLUE_STRING_ARABIC_BOTTOM = 123, + AF_BLUE_STRING_ARABIC_JOIN = 138, + AF_BLUE_STRING_ARMENIAN_CAPITAL_TOP = 141, + AF_BLUE_STRING_ARMENIAN_CAPITAL_BOTTOM = 165, + AF_BLUE_STRING_ARMENIAN_SMALL_ASCENDER = 189, + AF_BLUE_STRING_ARMENIAN_SMALL_TOP = 210, + AF_BLUE_STRING_ARMENIAN_SMALL_BOTTOM = 234, + AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER = 258, + AF_BLUE_STRING_AVESTAN_TOP = 282, + AF_BLUE_STRING_AVESTAN_BOTTOM = 302, + AF_BLUE_STRING_BAMUM_TOP = 312, + AF_BLUE_STRING_BAMUM_BOTTOM = 344, + AF_BLUE_STRING_BENGALI_BASE = 376, + AF_BLUE_STRING_BENGALI_TOP = 408, + AF_BLUE_STRING_BENGALI_HEAD = 436, + AF_BLUE_STRING_BUHID_TOP = 468, + AF_BLUE_STRING_BUHID_LARGE = 476, + AF_BLUE_STRING_BUHID_SMALL = 488, + AF_BLUE_STRING_BUHID_BOTTOM = 504, + AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP = 532, + AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM = 564, + AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP = 596, + AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM = 628, + AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP = 660, + AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM = 688, + AF_BLUE_STRING_CARIAN_TOP = 720, + AF_BLUE_STRING_CARIAN_BOTTOM = 760, + AF_BLUE_STRING_CHAKMA_TOP = 795, + AF_BLUE_STRING_CHAKMA_BOTTOM = 820, + AF_BLUE_STRING_CHAKMA_DESCENDER = 845, + AF_BLUE_STRING_CHEROKEE_CAPITAL = 910, + AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER = 942, + AF_BLUE_STRING_CHEROKEE_SMALL = 974, + AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER = 1006, + AF_BLUE_STRING_COPTIC_CAPITAL_TOP = 1022, + AF_BLUE_STRING_COPTIC_CAPITAL_BOTTOM = 1054, + AF_BLUE_STRING_COPTIC_SMALL_TOP = 1086, + AF_BLUE_STRING_COPTIC_SMALL_BOTTOM = 1118, + AF_BLUE_STRING_CYPRIOT_TOP = 1150, + AF_BLUE_STRING_CYPRIOT_BOTTOM = 1190, + AF_BLUE_STRING_CYPRIOT_SMALL = 1225, + AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 1240, + AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 1264, + AF_BLUE_STRING_CYRILLIC_SMALL = 1288, + AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 1312, + AF_BLUE_STRING_DESERET_CAPITAL_TOP = 1321, + AF_BLUE_STRING_DESERET_CAPITAL_BOTTOM = 1346, + AF_BLUE_STRING_DESERET_SMALL_TOP = 1371, + AF_BLUE_STRING_DESERET_SMALL_BOTTOM = 1396, + AF_BLUE_STRING_DEVANAGARI_BASE = 1421, + AF_BLUE_STRING_DEVANAGARI_TOP = 1453, + AF_BLUE_STRING_DEVANAGARI_HEAD = 1485, + AF_BLUE_STRING_DEVANAGARI_BOTTOM = 1517, + AF_BLUE_STRING_ETHIOPIC_TOP = 1525, + AF_BLUE_STRING_ETHIOPIC_BOTTOM = 1557, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP = 1589, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM = 1621, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER = 1653, + AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER = 1685, + AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP = 1717, + AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM = 1749, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_TOP = 1781, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 1813, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 1845, + AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 1877, + AF_BLUE_STRING_GEORGIAN_MTAVRULI_TOP = 1909, + AF_BLUE_STRING_GEORGIAN_MTAVRULI_BOTTOM = 1941, + AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP = 1973, + AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM = 2005, + AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP = 2037, + AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM = 2069, + AF_BLUE_STRING_GOTHIC_TOP = 2101, + AF_BLUE_STRING_GOTHIC_BOTTOM = 2141, + AF_BLUE_STRING_GREEK_CAPITAL_TOP = 2161, + AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 2182, + AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 2200, + AF_BLUE_STRING_GREEK_SMALL = 2218, + AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 2242, + AF_BLUE_STRING_GUJARATI_TOP = 2266, + AF_BLUE_STRING_GUJARATI_BOTTOM = 2298, + AF_BLUE_STRING_GUJARATI_ASCENDER = 2330, + AF_BLUE_STRING_GUJARATI_DESCENDER = 2380, + AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 2413, + AF_BLUE_STRING_GURMUKHI_BASE = 2433, + AF_BLUE_STRING_GURMUKHI_HEAD = 2465, + AF_BLUE_STRING_GURMUKHI_TOP = 2497, + AF_BLUE_STRING_GURMUKHI_BOTTOM = 2529, + AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 2561, + AF_BLUE_STRING_HEBREW_TOP = 2581, + AF_BLUE_STRING_HEBREW_BOTTOM = 2605, + AF_BLUE_STRING_HEBREW_DESCENDER = 2623, + AF_BLUE_STRING_KANNADA_TOP = 2638, + AF_BLUE_STRING_KANNADA_BOTTOM = 2682, + AF_BLUE_STRING_KAYAH_LI_TOP = 2714, + AF_BLUE_STRING_KAYAH_LI_BOTTOM = 2738, + AF_BLUE_STRING_KAYAH_LI_ASCENDER = 2758, + AF_BLUE_STRING_KAYAH_LI_DESCENDER = 2766, + AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER = 2778, + AF_BLUE_STRING_KHMER_TOP = 2799, + AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 2823, + AF_BLUE_STRING_KHMER_BOTTOM = 2863, + AF_BLUE_STRING_KHMER_DESCENDER = 2895, + AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 2929, + AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 3016, + AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 3024, + AF_BLUE_STRING_LAO_TOP = 3032, + AF_BLUE_STRING_LAO_BOTTOM = 3064, + AF_BLUE_STRING_LAO_ASCENDER = 3096, + AF_BLUE_STRING_LAO_LARGE_ASCENDER = 3112, + AF_BLUE_STRING_LAO_DESCENDER = 3124, + AF_BLUE_STRING_LATIN_CAPITAL_TOP = 3148, + AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 3164, + AF_BLUE_STRING_LATIN_SMALL_F_TOP = 3180, + AF_BLUE_STRING_LATIN_SMALL_TOP = 3194, + AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 3210, + AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 3226, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 3236, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 3256, + AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 3276, + AF_BLUE_STRING_LATIN_SUBS_SMALL = 3296, + AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 3332, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 3352, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 3383, + AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 3412, + AF_BLUE_STRING_LATIN_SUPS_SMALL = 3438, + AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 3463, + AF_BLUE_STRING_LISU_TOP = 3474, + AF_BLUE_STRING_LISU_BOTTOM = 3506, + AF_BLUE_STRING_MALAYALAM_TOP = 3538, + AF_BLUE_STRING_MALAYALAM_BOTTOM = 3582, + AF_BLUE_STRING_MYANMAR_TOP = 3614, + AF_BLUE_STRING_MYANMAR_BOTTOM = 3646, + AF_BLUE_STRING_MYANMAR_ASCENDER = 3678, + AF_BLUE_STRING_MYANMAR_DESCENDER = 3706, + AF_BLUE_STRING_NKO_TOP = 3738, + AF_BLUE_STRING_NKO_BOTTOM = 3762, + AF_BLUE_STRING_NKO_SMALL_TOP = 3777, + AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3786, + AF_BLUE_STRING_OL_CHIKI = 3798, + AF_BLUE_STRING_OLD_TURKIC_TOP = 3822, + AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3837, + AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3857, + AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3897, + AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3927, + AF_BLUE_STRING_OSAGE_SMALL_TOP = 3942, + AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 3982, + AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 4022, + AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 4047, + AF_BLUE_STRING_OSMANYA_TOP = 4062, + AF_BLUE_STRING_OSMANYA_BOTTOM = 4102, + AF_BLUE_STRING_SAURASHTRA_TOP = 4142, + AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4174, + AF_BLUE_STRING_SHAVIAN_TOP = 4194, + AF_BLUE_STRING_SHAVIAN_BOTTOM = 4204, + AF_BLUE_STRING_SHAVIAN_DESCENDER = 4229, + AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4239, + AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4274, + AF_BLUE_STRING_SINHALA_TOP = 4289, + AF_BLUE_STRING_SINHALA_BOTTOM = 4321, + AF_BLUE_STRING_SINHALA_DESCENDER = 4353, + AF_BLUE_STRING_SUNDANESE_TOP = 4397, + AF_BLUE_STRING_SUNDANESE_BOTTOM = 4421, + AF_BLUE_STRING_SUNDANESE_DESCENDER = 4453, + AF_BLUE_STRING_TAI_VIET_TOP = 4461, + AF_BLUE_STRING_TAI_VIET_BOTTOM = 4481, + AF_BLUE_STRING_TAMIL_TOP = 4493, + AF_BLUE_STRING_TAMIL_BOTTOM = 4525, + AF_BLUE_STRING_TELUGU_TOP = 4557, + AF_BLUE_STRING_TELUGU_BOTTOM = 4585, + AF_BLUE_STRING_THAI_TOP = 4613, + AF_BLUE_STRING_THAI_BOTTOM = 4637, + AF_BLUE_STRING_THAI_ASCENDER = 4665, + AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4677, + AF_BLUE_STRING_THAI_DESCENDER = 4689, + AF_BLUE_STRING_THAI_LARGE_DESCENDER = 4705, + AF_BLUE_STRING_THAI_DIGIT_TOP = 4713, + AF_BLUE_STRING_TIFINAGH = 4725, + AF_BLUE_STRING_VAI_TOP = 4757, + AF_BLUE_STRING_VAI_BOTTOM = 4789, + af_blue_1_1 = 4820, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1, AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203, @@ -240,34 +320,59 @@ FT_BEGIN_HEADER typedef enum AF_Blue_Stringset_ { - AF_BLUE_STRINGSET_ARAB = 0, - AF_BLUE_STRINGSET_ARMN = 4, - AF_BLUE_STRINGSET_BENG = 11, - AF_BLUE_STRINGSET_CHER = 16, - AF_BLUE_STRINGSET_CYRL = 23, - AF_BLUE_STRINGSET_DEVA = 29, - AF_BLUE_STRINGSET_ETHI = 35, - AF_BLUE_STRINGSET_GEOR = 38, - AF_BLUE_STRINGSET_GEOK = 43, - AF_BLUE_STRINGSET_GREK = 50, - AF_BLUE_STRINGSET_GUJR = 57, - AF_BLUE_STRINGSET_GURU = 63, - AF_BLUE_STRINGSET_HEBR = 69, - AF_BLUE_STRINGSET_KNDA = 73, - AF_BLUE_STRINGSET_KHMR = 76, - AF_BLUE_STRINGSET_KHMS = 82, - AF_BLUE_STRINGSET_LAO = 85, - AF_BLUE_STRINGSET_LATN = 91, - AF_BLUE_STRINGSET_LATB = 98, - AF_BLUE_STRINGSET_LATP = 105, - AF_BLUE_STRINGSET_MLYM = 112, - AF_BLUE_STRINGSET_MYMR = 115, - AF_BLUE_STRINGSET_NONE = 120, - AF_BLUE_STRINGSET_SINH = 121, - AF_BLUE_STRINGSET_TAML = 125, - AF_BLUE_STRINGSET_TELU = 128, - AF_BLUE_STRINGSET_THAI = 131, - af_blue_2_1 = 139, + AF_BLUE_STRINGSET_ADLM = 0, + AF_BLUE_STRINGSET_ARAB = 5, + AF_BLUE_STRINGSET_ARMN = 9, + AF_BLUE_STRINGSET_AVST = 16, + AF_BLUE_STRINGSET_BAMU = 19, + AF_BLUE_STRINGSET_BENG = 22, + AF_BLUE_STRINGSET_BUHD = 27, + AF_BLUE_STRINGSET_CAKM = 32, + AF_BLUE_STRINGSET_CANS = 36, + AF_BLUE_STRINGSET_CARI = 43, + AF_BLUE_STRINGSET_CHER = 46, + AF_BLUE_STRINGSET_COPT = 53, + AF_BLUE_STRINGSET_CPRT = 58, + AF_BLUE_STRINGSET_CYRL = 63, + AF_BLUE_STRINGSET_DEVA = 69, + AF_BLUE_STRINGSET_DSRT = 75, + AF_BLUE_STRINGSET_ETHI = 80, + AF_BLUE_STRINGSET_GEOR = 83, + AF_BLUE_STRINGSET_GEOK = 90, + AF_BLUE_STRINGSET_GLAG = 97, + AF_BLUE_STRINGSET_GOTH = 102, + AF_BLUE_STRINGSET_GREK = 105, + AF_BLUE_STRINGSET_GUJR = 112, + AF_BLUE_STRINGSET_GURU = 118, + AF_BLUE_STRINGSET_HEBR = 124, + AF_BLUE_STRINGSET_KALI = 128, + AF_BLUE_STRINGSET_KHMR = 134, + AF_BLUE_STRINGSET_KHMS = 140, + AF_BLUE_STRINGSET_KNDA = 143, + AF_BLUE_STRINGSET_LAO = 146, + AF_BLUE_STRINGSET_LATN = 152, + AF_BLUE_STRINGSET_LATB = 159, + AF_BLUE_STRINGSET_LATP = 166, + AF_BLUE_STRINGSET_LISU = 173, + AF_BLUE_STRINGSET_MLYM = 176, + AF_BLUE_STRINGSET_MYMR = 179, + AF_BLUE_STRINGSET_NKOO = 184, + AF_BLUE_STRINGSET_NONE = 189, + AF_BLUE_STRINGSET_OLCK = 190, + AF_BLUE_STRINGSET_ORKH = 193, + AF_BLUE_STRINGSET_OSGE = 196, + AF_BLUE_STRINGSET_OSMA = 204, + AF_BLUE_STRINGSET_SAUR = 207, + AF_BLUE_STRINGSET_SHAW = 210, + AF_BLUE_STRINGSET_SINH = 216, + AF_BLUE_STRINGSET_SUND = 220, + AF_BLUE_STRINGSET_TAML = 224, + AF_BLUE_STRINGSET_TAVT = 227, + AF_BLUE_STRINGSET_TELU = 230, + AF_BLUE_STRINGSET_TFNG = 233, + AF_BLUE_STRINGSET_THAI = 236, + AF_BLUE_STRINGSET_VAII = 244, + af_blue_2_1 = 247, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0, af_blue_2_1_1 = af_blue_2_1 + 2, diff --git a/src/autofit/afblue.hin b/src/autofit/afblue.hin index 268bcbc53..682147cb3 100644 --- a/src/autofit/afblue.hin +++ b/src/autofit/afblue.hin @@ -4,7 +4,7 @@ /* */ /* Auto-fitter data for blue strings (specification). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index c828e25b9..21b6bffa3 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for CJK writing system (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -16,9 +16,9 @@ /***************************************************************************/ /* - * The algorithm is based on akito's autohint patch, available here: + * The algorithm is based on akito's autohint patch, archived at * - * http://www.kde.gr.jp/~akito/patch/freetype2/ + * https://web.archive.org/web/20051219160454/http://www.kde.gr.jp:80/~akito/patch/freetype2/2.1.7/ * */ @@ -29,13 +29,13 @@ #include "afglobal.h" #include "afpic.h" #include "aflatin.h" +#include "afcjk.h" #ifdef AF_CONFIG_OPTION_CJK #undef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT -#include "afcjk.h" #include "aferrors.h" @@ -2272,13 +2272,7 @@ goto Exit; /* analyze glyph outline */ -#ifdef AF_CONFIG_OPTION_USE_WARPER - if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) || - AF_HINTS_DO_HORIZONTAL( hints ) ) -#else if ( AF_HINTS_DO_HORIZONTAL( hints ) ) -#endif { error = af_cjk_hints_detect_features( hints, AF_DIMENSION_HORZ ); if ( error ) @@ -2304,9 +2298,9 @@ { #ifdef AF_CONFIG_OPTION_USE_WARPER - if ( dim == AF_DIMENSION_HORZ && - metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) + if ( dim == AF_DIMENSION_HORZ && + metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL && + AF_HINTS_DO_WARP( hints ) ) { AF_WarperRec warper; FT_Fixed scale; diff --git a/src/autofit/afcjk.h b/src/autofit/afcjk.h index 84f892f90..d229c0c9c 100644 --- a/src/autofit/afcjk.h +++ b/src/autofit/afcjk.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for CJK writing system (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afcover.h b/src/autofit/afcover.h index 1b18c666a..6eeb8fc9f 100644 --- a/src/autofit/afcover.h +++ b/src/autofit/afcover.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter coverages (specification only). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afdummy.c b/src/autofit/afdummy.c index 61c32db5b..f30c517cb 100644 --- a/src/autofit/afdummy.c +++ b/src/autofit/afdummy.c @@ -5,7 +5,7 @@ /* Auto-fitter dummy routines to be used if no hinting should be */ /* performed (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afdummy.h b/src/autofit/afdummy.h index ebaa7d76e..b382acd92 100644 --- a/src/autofit/afdummy.h +++ b/src/autofit/afdummy.h @@ -5,7 +5,7 @@ /* Auto-fitter dummy routines to be used if no hinting should be */ /* performed (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/aferrors.h b/src/autofit/aferrors.h index dde182f3c..e5de54360 100644 --- a/src/autofit/aferrors.h +++ b/src/autofit/aferrors.h @@ -4,7 +4,7 @@ /* */ /* Autofitter error codes (specification only). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c index 85bef001f..3d09c53e8 100644 --- a/src/autofit/afglobal.c +++ b/src/autofit/afglobal.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter routines to compute global hinting values (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afglobal.h b/src/autofit/afglobal.h index de6142ea2..489ed46d9 100644 --- a/src/autofit/afglobal.h +++ b/src/autofit/afglobal.h @@ -5,7 +5,7 @@ /* Auto-fitter routines to compute global hinting values */ /* (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c index f1ff0baef..0666dbc8e 100644 --- a/src/autofit/afhints.c +++ b/src/autofit/afhints.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -314,8 +314,12 @@ AF_DUMP(( "Table of points:\n" )); if ( hints->num_points ) + { AF_DUMP(( " index hedge hseg vedge vseg flags " + /* " XXXXX XXXXX XXXXX XXXXX XXXXX XXXXXX" */ " xorg yorg xscale yscale xfit yfit" )); + /* " XXXXX XXXXX XXXX.XX XXXX.XX XXXX.XX XXXX.XX" */ + } else AF_DUMP(( " (none)\n" )); @@ -420,9 +424,14 @@ dimension == AF_DIMENSION_HORZ ? "vertical" : "horizontal" )); if ( axis->num_segments ) + { AF_DUMP(( " index pos delta dir from to " + /* " XXXXX XXXXX XXXXX XXXXX XXXX XXXX" */ " link serif edge" + /* " XXXX XXXXX XXXX" */ " height extra flags\n" )); + /* " XXXXXX XXXXX XXXXXXXXXXX" */ + } else AF_DUMP(( " (none)\n" )); @@ -507,15 +516,15 @@ return FT_THROW( Invalid_Argument ); seg = &axis->segments[idx]; - *offset = ( dim == AF_DIMENSION_HORZ ) ? seg->first->ox - : seg->first->oy; + *offset = ( dim == AF_DIMENSION_HORZ ) ? seg->first->fx + : seg->first->fy; if ( seg->edge ) *is_blue = (FT_Bool)( seg->edge->blue_edge != 0 ); else *is_blue = FALSE; if ( *is_blue ) - *blue_offset = seg->edge->blue_edge->cur; + *blue_offset = seg->edge->blue_edge->org; else *blue_offset = 0; @@ -564,8 +573,12 @@ 10.0 * hints->y_scale / 65536.0 / 64.0 )); if ( axis->num_edges ) + { AF_DUMP(( " index pos dir link serif" + /* " XXXXX XXXX.XX XXXXX XXXX XXXXX" */ " blue opos pos flags\n" )); + /* " X XXXX.XX XXXX.XX XXXXXXXXXXX" */ + } else AF_DUMP(( " (none)\n" )); diff --git a/src/autofit/afhints.h b/src/autofit/afhints.h index 16638b103..3326ebc44 100644 --- a/src/autofit/afhints.h +++ b/src/autofit/afhints.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -62,7 +62,7 @@ FT_BEGIN_HEADER * * by David Turner and Werner Lemberg * - * http://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf + * https://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf * * with appropriate updates. * diff --git a/src/autofit/afindic.c b/src/autofit/afindic.c index 03c611b9f..dfbea5f34 100644 --- a/src/autofit/afindic.c +++ b/src/autofit/afindic.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for Indic writing system (body). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* Rahul Bhalerao , . */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,13 +18,13 @@ #include "aftypes.h" #include "aflatin.h" +#include "afcjk.h" #ifdef AF_CONFIG_OPTION_INDIC #include "afindic.h" #include "aferrors.h" -#include "afcjk.h" #ifdef AF_CONFIG_OPTION_USE_WARPER diff --git a/src/autofit/afindic.h b/src/autofit/afindic.h index ec9e26316..5688738e6 100644 --- a/src/autofit/afindic.h +++ b/src/autofit/afindic.h @@ -5,7 +5,7 @@ /* Auto-fitter hinting routines for Indic writing system */ /* (specification). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* Rahul Bhalerao , . */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index 11fa523c8..9f1b54056 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin writing system (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -1690,9 +1690,11 @@ if ( prev_max_on_coord > max_on_coord ) max_on_coord = prev_max_on_coord; - prev_segment->last = point; - prev_segment->pos = (FT_Short)( ( min_pos + - max_pos ) >> 1 ); + prev_segment->last = point; + prev_segment->pos = (FT_Short)( ( min_pos + + max_pos ) >> 1 ); + prev_segment->delta = (FT_Short)( ( max_pos - + min_pos ) >> 1 ); if ( ( min_flags | max_flags ) & AF_FLAG_CONTROL && ( max_on_coord - min_on_coord ) < flat_threshold ) @@ -1720,9 +1722,11 @@ if ( max_pos > prev_max_pos ) prev_max_pos = max_pos; - prev_segment->last = point; - prev_segment->pos = (FT_Short)( ( prev_min_pos + - prev_max_pos ) >> 1 ); + prev_segment->last = point; + prev_segment->pos = (FT_Short)( ( prev_min_pos + + prev_max_pos ) >> 1 ); + prev_segment->delta = (FT_Short)( ( prev_max_pos - + prev_min_pos ) >> 1 ); } else { @@ -1733,8 +1737,9 @@ if ( prev_max_pos > max_pos ) max_pos = prev_max_pos; - segment->last = point; - segment->pos = (FT_Short)( ( min_pos + max_pos ) >> 1 ); + segment->last = point; + segment->pos = (FT_Short)( ( min_pos + max_pos ) >> 1 ); + segment->delta = (FT_Short)( ( max_pos - min_pos ) >> 1 ); if ( ( min_flags | max_flags ) & AF_FLAG_CONTROL && ( max_on_coord - min_on_coord ) < flat_threshold ) @@ -3492,13 +3497,7 @@ goto Exit; /* analyze glyph outline */ -#ifdef AF_CONFIG_OPTION_USE_WARPER - if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) || - AF_HINTS_DO_HORIZONTAL( hints ) ) -#else if ( AF_HINTS_DO_HORIZONTAL( hints ) ) -#endif { axis = &metrics->axis[AF_DIMENSION_HORZ]; error = af_latin_hints_detect_features( hints, @@ -3528,9 +3527,9 @@ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { #ifdef AF_CONFIG_OPTION_USE_WARPER - if ( dim == AF_DIMENSION_HORZ && - metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) + if ( dim == AF_DIMENSION_HORZ && + metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL && + AF_HINTS_DO_WARP( hints ) ) { AF_WarperRec warper; FT_Fixed scale; diff --git a/src/autofit/aflatin.h b/src/autofit/aflatin.h index d80e125dd..432cccce4 100644 --- a/src/autofit/aflatin.h +++ b/src/autofit/aflatin.h @@ -5,7 +5,7 @@ /* Auto-fitter hinting routines for latin writing system */ /* (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c index 5cfc25dda..5c7137811 100644 --- a/src/autofit/aflatin2.c +++ b/src/autofit/aflatin2.c @@ -9,7 +9,7 @@ /* */ /* Auto-fitter hinting routines for latin writing system (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,6 +23,9 @@ #include FT_ADVANCES_H + +#ifdef FT_OPTION_AUTOFIT2 + #include "afglobal.h" #include "aflatin.h" #include "aflatin2.h" @@ -2337,13 +2340,7 @@ goto Exit; /* analyze glyph outline */ -#ifdef AF_CONFIG_OPTION_USE_WARPER - if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) || - AF_HINTS_DO_HORIZONTAL( hints ) ) -#else if ( AF_HINTS_DO_HORIZONTAL( hints ) ) -#endif { error = af_latin2_hints_detect_features( hints, AF_DIMENSION_HORZ ); if ( error ) @@ -2363,9 +2360,9 @@ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { #ifdef AF_CONFIG_OPTION_USE_WARPER - if ( dim == AF_DIMENSION_HORZ && - metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && - AF_HINTS_DO_WARP( hints ) ) + if ( dim == AF_DIMENSION_HORZ && + metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL && + AF_HINTS_DO_WARP( hints ) ) { AF_WarperRec warper; FT_Fixed scale; @@ -2419,5 +2416,12 @@ (AF_WritingSystem_ApplyHintsFunc) af_latin2_hints_apply /* style_hints_apply */ ) +#else /* !FT_OPTION_AUTOFIT2 */ + + /* ANSI C doesn't like empty source files */ + typedef int _af_latin2_dummy; + +#endif /* !FT_OPTION_AUTOFIT2 */ + /* END */ diff --git a/src/autofit/aflatin2.h b/src/autofit/aflatin2.h index 2d0b154f5..0129dc707 100644 --- a/src/autofit/aflatin2.h +++ b/src/autofit/aflatin2.h @@ -10,7 +10,7 @@ /* Auto-fitter hinting routines for latin writing system */ /* (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c index fb8ea3ce1..a55550b33 100644 --- a/src/autofit/afloader.c +++ b/src/autofit/afloader.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter glyph loading routines (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -97,11 +97,13 @@ AF_FaceGlobals globals = loader->globals; AF_WritingSystemClass writing_system_class; + FT_Size_Metrics* size_metrics = &face->size->internal->autohint_metrics; + FT_Pos stdVW = 0; FT_Pos stdHW = 0; - FT_Bool size_changed = face->size->metrics.x_ppem - != globals->stem_darkening_for_ppem; + FT_Bool size_changed = size_metrics->x_ppem != + globals->stem_darkening_for_ppem; FT_Fixed em_size = af_intToFixed( face->units_per_EM ); FT_Fixed em_ratio = FT_DivFix( af_intToFixed( 1000 ), em_size ); @@ -145,11 +147,11 @@ face, stdVW ) ); darken_x = FT_DivFix( FT_MulFix( darken_by_font_units_x, - face->size->metrics.x_scale ), + size_metrics->x_scale ), em_ratio ); globals->standard_vertical_width = stdVW; - globals->stem_darkening_for_ppem = face->size->metrics.x_ppem; + globals->stem_darkening_for_ppem = size_metrics->x_ppem; globals->darken_x = af_fixedToInt( darken_x ); } @@ -164,11 +166,11 @@ face, stdHW ) ); darken_y = FT_DivFix( FT_MulFix( darken_by_font_units_y, - face->size->metrics.y_scale ), + size_metrics->y_scale ), em_ratio ); globals->standard_horizontal_width = stdHW; - globals->stem_darkening_for_ppem = face->size->metrics.x_ppem; + globals->stem_darkening_for_ppem = size_metrics->x_ppem; globals->darken_y = af_fixedToInt( darken_y ); /* @@ -217,10 +219,11 @@ { FT_Error error; - FT_Size size = face->size; - FT_GlyphSlot slot = face->glyph; - FT_Slot_Internal internal = slot->internal; - FT_GlyphLoader gloader = internal->loader; + FT_Size size = face->size; + FT_Size_Internal size_internal = size->internal; + FT_GlyphSlot slot = face->glyph; + FT_Slot_Internal slot_internal = slot->internal; + FT_GlyphLoader gloader = slot_internal->loader; AF_GlyphHints hints = loader->hints; AF_ScalerRec scaler; @@ -239,6 +242,45 @@ FT_ZERO( &scaler ); + if ( !size_internal->autohint_metrics.x_scale || + size_internal->autohint_mode != FT_LOAD_TARGET_MODE( load_flags ) ) + { + /* switching between hinting modes usually means different scaling */ + /* values; this later on enforces recomputation of everything */ + /* related to the current size */ + + size_internal->autohint_mode = FT_LOAD_TARGET_MODE( load_flags ); + size_internal->autohint_metrics = size->metrics; + +#ifdef AF_CONFIG_OPTION_TT_SIZE_METRICS + { + FT_Size_Metrics* size_metrics = &size_internal->autohint_metrics; + + + /* set metrics to integer values and adjust scaling accordingly; */ + /* this is the same setup as with TrueType fonts, cf. function */ + /* `tt_size_reset' in file `ttobjs.c' */ + size_metrics->ascender = FT_PIX_ROUND( + FT_MulFix( face->ascender, + size_metrics->y_scale ) ); + size_metrics->descender = FT_PIX_ROUND( + FT_MulFix( face->descender, + size_metrics->y_scale ) ); + size_metrics->height = FT_PIX_ROUND( + FT_MulFix( face->height, + size_metrics->y_scale ) ); + + size_metrics->x_scale = FT_DivFix( size_metrics->x_ppem << 6, + face->units_per_EM ); + size_metrics->y_scale = FT_DivFix( size_metrics->y_ppem << 6, + face->units_per_EM ); + size_metrics->max_advance = FT_PIX_ROUND( + FT_MulFix( face->max_advance_width, + size_metrics->x_scale ) ); + } +#endif /* AF_CONFIG_OPTION_TT_SIZE_METRICS */ + } + /* * TODO: This code currently doesn't support fractional advance widths, * i.e., placing hinted glyphs at anything other than integer @@ -249,16 +291,16 @@ * values of the scaler would need to be adjusted. */ scaler.face = face; - scaler.x_scale = size->metrics.x_scale; + scaler.x_scale = size_internal->autohint_metrics.x_scale; scaler.x_delta = 0; - scaler.y_scale = size->metrics.y_scale; + scaler.y_scale = size_internal->autohint_metrics.y_scale; scaler.y_delta = 0; scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags ); scaler.flags = 0; /* note that the fallback style can't be changed anymore */ - /* after the first call of `ta_loader_load_glyph' */ + /* after the first call of `af_loader_load_glyph' */ error = af_loader_reset( loader, module, face ); if ( error ) goto Exit; @@ -346,14 +388,14 @@ !module->no_stem_darkening ) ) ) af_loader_embolden_glyph_in_slot( loader, face, style_metrics ); - loader->transformed = internal->glyph_transformed; + loader->transformed = slot_internal->glyph_transformed; if ( loader->transformed ) { FT_Matrix inverse; - loader->trans_matrix = internal->glyph_matrix; - loader->trans_delta = internal->glyph_delta; + loader->trans_matrix = slot_internal->glyph_matrix; + loader->trans_delta = slot_internal->glyph_delta; inverse = loader->trans_matrix; if ( !FT_Matrix_Invert( &inverse ) ) @@ -441,21 +483,23 @@ FT_Pos pp2x = loader->pp2.x; - loader->pp1.x = FT_PIX_ROUND( pp1x ); - loader->pp2.x = FT_PIX_ROUND( pp2x ); + loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta ); + loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta ); slot->lsb_delta = loader->pp1.x - pp1x; slot->rsb_delta = loader->pp2.x - pp2x; } } + /* `light' mode uses integer advance widths */ + /* but sets `lsb_delta' and `rsb_delta' */ else { FT_Pos pp1x = loader->pp1.x; FT_Pos pp2x = loader->pp2.x; - loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta ); - loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta ); + loader->pp1.x = FT_PIX_ROUND( pp1x ); + loader->pp2.x = FT_PIX_ROUND( pp2x ); slot->lsb_delta = loader->pp1.x - pp1x; slot->rsb_delta = loader->pp2.x - pp2x; diff --git a/src/autofit/afloader.h b/src/autofit/afloader.h index 2578abed1..d4d72d158 100644 --- a/src/autofit/afloader.h +++ b/src/autofit/afloader.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter glyph loading routines (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c index 9d7ba224d..dcaa17a27 100644 --- a/src/autofit/afmodule.c +++ b/src/autofit/afmodule.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module implementation (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -56,7 +56,7 @@ #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H -#include FT_AUTOHINTER_H +#include FT_DRIVER_H #include FT_SERVICE_PROPERTIES_H diff --git a/src/autofit/afmodule.h b/src/autofit/afmodule.h index 0571d14d5..56f64eaf2 100644 --- a/src/autofit/afmodule.h +++ b/src/autofit/afmodule.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module implementation (specification). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afpic.c b/src/autofit/afpic.c index 3125e03e2..d48d016a0 100644 --- a/src/autofit/afpic.c +++ b/src/autofit/afpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for autofit module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afpic.h b/src/autofit/afpic.h index 8cd339212..0c7345678 100644 --- a/src/autofit/afpic.h +++ b/src/autofit/afpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for autofit module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c index fdd28006f..cf67fafb1 100644 --- a/src/autofit/afranges.c +++ b/src/autofit/afranges.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter Unicode script ranges (body). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -52,8 +52,21 @@ /* not be affected by blue zones, regardless of whether this is a */ /* spacing or no-spacing glyph */ - /* the `ta_xxxx_nonbase_uniranges' ranges must be strict subsets */ - /* of the corresponding `ta_xxxx_uniranges' ranges */ + /* the `af_xxxx_nonbase_uniranges' ranges must be strict subsets */ + /* of the corresponding `af_xxxx_uniranges' ranges */ + + + const AF_Script_UniRangeRec af_adlm_uniranges[] = + { + AF_UNIRANGE_REC( 0x1E900, 0x1E95F ), /* Adlam */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_adlm_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x1D944, 0x1E94A ), + AF_UNIRANGE_REC( 0, 0 ) + }; const AF_Script_UniRangeRec af_arab_uniranges[] = @@ -78,7 +91,7 @@ AF_UNIRANGE_REC( 0x06E7, 0x06E8 ), AF_UNIRANGE_REC( 0x06EA, 0x06ED ), AF_UNIRANGE_REC( 0x08D4, 0x08E1 ), - AF_UNIRANGE_REC( 0x08E3, 0x08FF ), + AF_UNIRANGE_REC( 0x08D3, 0x08FF ), AF_UNIRANGE_REC( 0xFBB2, 0xFBC1 ), AF_UNIRANGE_REC( 0xFE70, 0xFE70 ), AF_UNIRANGE_REC( 0xFE72, 0xFE72 ), @@ -106,6 +119,37 @@ }; + const AF_Script_UniRangeRec af_avst_uniranges[] = + { + AF_UNIRANGE_REC( 0x10B00, 0x10B3F ), /* Avestan */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_avst_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x10B39, 0x10B3F ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + + const AF_Script_UniRangeRec af_bamu_uniranges[] = + { + AF_UNIRANGE_REC( 0xA6A0, 0xA6FF ), /* Bamum */ +#if 0 + /* The characters in the Bamum supplement are pictograms, */ + /* not (directly) related to the syllabic Bamum script */ + AF_UNIRANGE_REC( 0x16800, 0x16A3F ), /* Bamum Supplement */ +#endif + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_bamu_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0xA6F0, 0xA6F1 ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_beng_uniranges[] = { AF_UNIRANGE_REC( 0x0980, 0x09FF ), /* Bengali */ @@ -119,10 +163,64 @@ AF_UNIRANGE_REC( 0x09C1, 0x09C4 ), AF_UNIRANGE_REC( 0x09CD, 0x09CD ), AF_UNIRANGE_REC( 0x09E2, 0x09E3 ), + AF_UNIRANGE_REC( 0x09FE, 0x09FE ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + + const AF_Script_UniRangeRec af_buhd_uniranges[] = + { + AF_UNIRANGE_REC( 0x1740, 0x175F ), /* Buhid */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_buhd_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x1752, 0x1753 ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + + const AF_Script_UniRangeRec af_cakm_uniranges[] = + { + AF_UNIRANGE_REC( 0x11100, 0x1114F ), /* Chakma */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_cakm_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x11100, 0x11102 ), + AF_UNIRANGE_REC( 0x11127, 0x11134 ), + AF_UNIRANGE_REC( 0x11146, 0x11146 ), AF_UNIRANGE_REC( 0, 0 ) }; + const AF_Script_UniRangeRec af_cans_uniranges[] = + { + AF_UNIRANGE_REC( 0x1400, 0x167F ), /* Unified Canadian Aboriginal Syllabics */ + AF_UNIRANGE_REC( 0x18B0, 0x18FF ), /* Unified Canadian Aboriginal Syllabics Extended */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_cans_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + + const AF_Script_UniRangeRec af_cari_uniranges[] = + { + AF_UNIRANGE_REC( 0x102A0, 0x102DF ), /* Carian */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_cari_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_cher_uniranges[] = { AF_UNIRANGE_REC( 0x13A0, 0x13FF ), /* Cherokee */ @@ -136,6 +234,31 @@ }; + const AF_Script_UniRangeRec af_copt_uniranges[] = + { + AF_UNIRANGE_REC( 0x2C80, 0x2CFF ), /* Coptic */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_copt_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x2CEF, 0x2CF1 ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + + const AF_Script_UniRangeRec af_cprt_uniranges[] = + { + AF_UNIRANGE_REC( 0x10800, 0x1083F ), /* Cypriot */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_cprt_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_cyrl_uniranges[] = { AF_UNIRANGE_REC( 0x0400, 0x04FF ), /* Cyrillic */ @@ -183,10 +306,23 @@ AF_UNIRANGE_REC( 0x0953, 0x0957 ), AF_UNIRANGE_REC( 0x0962, 0x0963 ), AF_UNIRANGE_REC( 0xA8E0, 0xA8F1 ), + AF_UNIRANGE_REC( 0xA8FF, 0xA8FF ), AF_UNIRANGE_REC( 0, 0 ) }; + const AF_Script_UniRangeRec af_dsrt_uniranges[] = + { + AF_UNIRANGE_REC( 0x10400, 0x1044F ), /* Deseret */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_dsrt_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_ethi_uniranges[] = { AF_UNIRANGE_REC( 0x1200, 0x137F ), /* Ethiopic */ @@ -205,11 +341,8 @@ const AF_Script_UniRangeRec af_geor_uniranges[] = { - AF_UNIRANGE_REC( 0x10D0, 0x10FF ), /* Georgian (Mkhedruli) */ -#if 0 - /* the following range is proposed for inclusion in Unicode */ - AF_UNIRANGE_REC( 0x1C90, 0x1CBF ), /* Georgian (Mtavruli) */ -#endif + AF_UNIRANGE_REC( 0x10D0, 0x10FF ), /* Georgian (Mkhedruli) */ + AF_UNIRANGE_REC( 0x1C90, 0x1CBF ), /* Georgian Extended (Mtavruli) */ AF_UNIRANGE_REC( 0, 0 ) }; @@ -222,8 +355,8 @@ const AF_Script_UniRangeRec af_geok_uniranges[] = { /* Khutsuri */ - AF_UNIRANGE_REC( 0x10A0, 0x10CD ), /* Georgian (Asomtavruli) */ - AF_UNIRANGE_REC( 0x2D00, 0x2D2D ), /* Georgian (Nuskhuri) */ + AF_UNIRANGE_REC( 0x10A0, 0x10CD ), /* Georgian (Asomtavruli) */ + AF_UNIRANGE_REC( 0x2D00, 0x2D2D ), /* Georgian Supplement (Nuskhuri) */ AF_UNIRANGE_REC( 0, 0 ) }; @@ -233,6 +366,32 @@ }; + const AF_Script_UniRangeRec af_glag_uniranges[] = + { + AF_UNIRANGE_REC( 0x2C00, 0x2C5F ), /* Glagolitic */ + AF_UNIRANGE_REC( 0x1E000, 0x1E02F ), /* Glagolitic Supplement */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_glag_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x1E000, 0x1E02F ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + + const AF_Script_UniRangeRec af_goth_uniranges[] = + { + AF_UNIRANGE_REC( 0x10330, 0x1034F ), /* Gothic */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_goth_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_grek_uniranges[] = { AF_UNIRANGE_REC( 0x0370, 0x03FF ), /* Greek and Coptic */ @@ -266,6 +425,7 @@ AF_UNIRANGE_REC( 0x0AC1, 0x0AC8 ), AF_UNIRANGE_REC( 0x0ACD, 0x0ACD ), AF_UNIRANGE_REC( 0x0AE2, 0x0AE3 ), + AF_UNIRANGE_REC( 0x0AFA, 0x0AFF ), AF_UNIRANGE_REC( 0, 0 ) }; @@ -305,6 +465,19 @@ }; + const AF_Script_UniRangeRec af_kali_uniranges[] = + { + AF_UNIRANGE_REC( 0xA900, 0xA92F ), /* Kayah Li */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_kali_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0xA926, 0xA92D ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_knda_uniranges[] = { AF_UNIRANGE_REC( 0x0C80, 0x0CFF ), /* Kannada */ @@ -463,6 +636,18 @@ }; + const AF_Script_UniRangeRec af_lisu_uniranges[] = + { + AF_UNIRANGE_REC( 0xA4D0, 0xA4FF ), /* Lisu */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_lisu_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_mlym_uniranges[] = { AF_UNIRANGE_REC( 0x0D00, 0x0D7F ), /* Malayalam */ @@ -471,7 +656,8 @@ const AF_Script_UniRangeRec af_mlym_nonbase_uniranges[] = { - AF_UNIRANGE_REC( 0x0D01, 0x0D01 ), + AF_UNIRANGE_REC( 0x0D00, 0x0D01 ), + AF_UNIRANGE_REC( 0x0D3B, 0x0D3C ), AF_UNIRANGE_REC( 0x0D4D, 0x0D4E ), AF_UNIRANGE_REC( 0x0D62, 0x0D63 ), AF_UNIRANGE_REC( 0, 0 ) @@ -480,27 +666,41 @@ const AF_Script_UniRangeRec af_mymr_uniranges[] = { - AF_UNIRANGE_REC( 0x1000, 0x109F ), /* Myanmar */ - AF_UNIRANGE_REC( 0xA9E0, 0xA9FF ), /* Myanmar Extended-B */ - AF_UNIRANGE_REC( 0xAA60, 0xAA7F ), /* Myanmar Extended-A */ - AF_UNIRANGE_REC( 0, 0 ) + AF_UNIRANGE_REC( 0x1000, 0x109F ), /* Myanmar */ + AF_UNIRANGE_REC( 0xA9E0, 0xA9FF ), /* Myanmar Extended-B */ + AF_UNIRANGE_REC( 0xAA60, 0xAA7F ), /* Myanmar Extended-A */ + AF_UNIRANGE_REC( 0, 0 ) }; const AF_Script_UniRangeRec af_mymr_nonbase_uniranges[] = { - AF_UNIRANGE_REC( 0x102D, 0x1030 ), - AF_UNIRANGE_REC( 0x1032, 0x1037 ), - AF_UNIRANGE_REC( 0x103A, 0x103A ), - AF_UNIRANGE_REC( 0x103D, 0x103E ), - AF_UNIRANGE_REC( 0x1058, 0x1059 ), - AF_UNIRANGE_REC( 0x105E, 0x1060 ), - AF_UNIRANGE_REC( 0x1071, 0x1074 ), - AF_UNIRANGE_REC( 0x1082, 0x1082 ), - AF_UNIRANGE_REC( 0x1085, 0x1086 ), - AF_UNIRANGE_REC( 0x108D, 0x108D ), - AF_UNIRANGE_REC( 0xA9E5, 0xA9E5 ), - AF_UNIRANGE_REC( 0xAA7C, 0xAA7C ), - AF_UNIRANGE_REC( 0, 0 ) + AF_UNIRANGE_REC( 0x102D, 0x1030 ), + AF_UNIRANGE_REC( 0x1032, 0x1037 ), + AF_UNIRANGE_REC( 0x103A, 0x103A ), + AF_UNIRANGE_REC( 0x103D, 0x103E ), + AF_UNIRANGE_REC( 0x1058, 0x1059 ), + AF_UNIRANGE_REC( 0x105E, 0x1060 ), + AF_UNIRANGE_REC( 0x1071, 0x1074 ), + AF_UNIRANGE_REC( 0x1082, 0x1082 ), + AF_UNIRANGE_REC( 0x1085, 0x1086 ), + AF_UNIRANGE_REC( 0x108D, 0x108D ), + AF_UNIRANGE_REC( 0xA9E5, 0xA9E5 ), + AF_UNIRANGE_REC( 0xAA7C, 0xAA7C ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + + const AF_Script_UniRangeRec af_nkoo_uniranges[] = + { + AF_UNIRANGE_REC( 0x07C0, 0x07FF ), /* N'Ko */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_nkoo_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x07EB, 0x07F5 ), + AF_UNIRANGE_REC( 0x07FD, 0x07FD ), + AF_UNIRANGE_REC( 0, 0 ) }; @@ -515,6 +715,80 @@ }; + const AF_Script_UniRangeRec af_olck_uniranges[] = + { + AF_UNIRANGE_REC( 0x1C50, 0x1C7F ), /* Ol Chiki */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_olck_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + + const AF_Script_UniRangeRec af_orkh_uniranges[] = + { + AF_UNIRANGE_REC( 0x10C00, 0x10C4F ), /* Old Turkic */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_orkh_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + + const AF_Script_UniRangeRec af_osge_uniranges[] = + { + AF_UNIRANGE_REC( 0x104B0, 0x104FF ), /* Osage */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_osge_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + + const AF_Script_UniRangeRec af_osma_uniranges[] = + { + AF_UNIRANGE_REC( 0x10480, 0x104AF ), /* Osmanya */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_osma_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + + const AF_Script_UniRangeRec af_saur_uniranges[] = + { + AF_UNIRANGE_REC( 0xA880, 0xA8DF ), /* Saurashtra */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_saur_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0xA880, 0xA881 ), + AF_UNIRANGE_REC( 0xA8B4, 0xA8C5 ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + + const AF_Script_UniRangeRec af_shaw_uniranges[] = + { + AF_UNIRANGE_REC( 0x10450, 0x1047F ), /* Shavian */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_shaw_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_sinh_uniranges[] = { AF_UNIRANGE_REC( 0x0D80, 0x0DFF ), /* Sinhala */ @@ -529,6 +803,21 @@ }; + const AF_Script_UniRangeRec af_sund_uniranges[] = + { + AF_UNIRANGE_REC( 0x1B80, 0x1BBF ), /* Sundanese */ + AF_UNIRANGE_REC( 0x1CC0, 0x1CCF ), /* Sundanese Supplement */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_sund_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x1B80, 0x1B82 ), + AF_UNIRANGE_REC( 0x1BA1, 0x1BAD ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_taml_uniranges[] = { AF_UNIRANGE_REC( 0x0B80, 0x0BFF ), /* Tamil */ @@ -544,6 +833,23 @@ }; + const AF_Script_UniRangeRec af_tavt_uniranges[] = + { + AF_UNIRANGE_REC( 0xAA80, 0xAADF ), /* Tai Viet */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_tavt_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0xAAB0, 0xAAB0 ), + AF_UNIRANGE_REC( 0xAAB2, 0xAAB4 ), + AF_UNIRANGE_REC( 0xAAB7, 0xAAB8 ), + AF_UNIRANGE_REC( 0xAABE, 0xAABF ), + AF_UNIRANGE_REC( 0xAAC1, 0xAAC1 ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_telu_uniranges[] = { AF_UNIRANGE_REC( 0x0C00, 0x0C7F ), /* Telugu */ @@ -553,6 +859,7 @@ const AF_Script_UniRangeRec af_telu_nonbase_uniranges[] = { AF_UNIRANGE_REC( 0x0C00, 0x0C00 ), + AF_UNIRANGE_REC( 0x0C04, 0x0C04 ), AF_UNIRANGE_REC( 0x0C3E, 0x0C40 ), AF_UNIRANGE_REC( 0x0C46, 0x0C56 ), AF_UNIRANGE_REC( 0x0C62, 0x0C63 ), @@ -575,6 +882,30 @@ }; + const AF_Script_UniRangeRec af_tfng_uniranges[] = + { + AF_UNIRANGE_REC( 0x2D30, 0x2D7F ), /* Tifinagh */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_tfng_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + + const AF_Script_UniRangeRec af_vaii_uniranges[] = + { + AF_UNIRANGE_REC( 0xA500, 0xA63F ), /* Vai */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_vaii_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + #ifdef AF_CONFIG_OPTION_INDIC const AF_Script_UniRangeRec af_limb_uniranges[] = @@ -610,21 +941,6 @@ }; - const AF_Script_UniRangeRec af_sund_uniranges[] = - { - AF_UNIRANGE_REC( 0x1B80, 0x1BBF ), /* Sundanese */ - AF_UNIRANGE_REC( 0x1CC0, 0x1CCF ), /* Sundanese Supplement */ - AF_UNIRANGE_REC( 0, 0 ) - }; - - const AF_Script_UniRangeRec af_sund_nonbase_uniranges[] = - { - AF_UNIRANGE_REC( 0x1B80, 0x1B82 ), - AF_UNIRANGE_REC( 0x1BA1, 0x1BAD ), - AF_UNIRANGE_REC( 0, 0 ) - }; - - const AF_Script_UniRangeRec af_sylo_uniranges[] = { AF_UNIRANGE_REC( 0xA800, 0xA82F ), /* Syloti Nagri */ @@ -694,10 +1010,13 @@ AF_UNIRANGE_REC( 0xFE30, 0xFE4F ), /* CJK Compatibility Forms */ AF_UNIRANGE_REC( 0xFF00, 0xFFEF ), /* Halfwidth and Fullwidth Forms */ AF_UNIRANGE_REC( 0x1B000, 0x1B0FF ), /* Kana Supplement */ + AF_UNIRANGE_REC( 0x1B100, 0x1B12F ), /* Kana Extended-A */ AF_UNIRANGE_REC( 0x1D300, 0x1D35F ), /* Tai Xuan Hing Symbols */ AF_UNIRANGE_REC( 0x20000, 0x2A6DF ), /* CJK Unified Ideographs Extension B */ AF_UNIRANGE_REC( 0x2A700, 0x2B73F ), /* CJK Unified Ideographs Extension C */ AF_UNIRANGE_REC( 0x2B740, 0x2B81F ), /* CJK Unified Ideographs Extension D */ + AF_UNIRANGE_REC( 0x2B820, 0x2CEAF ), /* CJK Unified Ideographs Extension E */ + AF_UNIRANGE_REC( 0x2CEB0, 0x2EBEF ), /* CJK Unified Ideographs Extension F */ AF_UNIRANGE_REC( 0x2F800, 0x2FA1F ), /* CJK Compatibility Ideographs Supplement */ AF_UNIRANGE_REC( 0, 0 ) }; diff --git a/src/autofit/afranges.h b/src/autofit/afranges.h index 72d9eaad2..ba3b5e7cc 100644 --- a/src/autofit/afranges.h +++ b/src/autofit/afranges.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter Unicode script ranges (specification). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h index c656c7839..623a1734a 100644 --- a/src/autofit/afscript.h +++ b/src/autofit/afscript.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter scripts (specification only). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -30,6 +30,12 @@ /* use `HB_SCRIPT_INVALID' as the HarfBuzz script name tag for */ /* them. */ + SCRIPT( adlm, ADLM, + "Adlam", + HB_SCRIPT_ADLAM, + HINTING_BOTTOM_TO_TOP, + "\xF0\x9E\xA4\x8C \xF0\x9E\xA4\xAE" ) /* 𞤌 𞤮 */ + SCRIPT( arab, ARAB, "Arabic", HB_SCRIPT_ARABIC, @@ -42,6 +48,18 @@ HINTING_BOTTOM_TO_TOP, "\xD5\xBD \xD5\x8D" ) /* ս Ս */ + SCRIPT( avst, AVST, + "Avestan", + HB_SCRIPT_AVESTAN, + HINTING_BOTTOM_TO_TOP, + "\xF0\x90\xAC\x9A" ) /* 𐬚 */ + + SCRIPT( bamu, BAMU, + "Bamum", + HB_SCRIPT_BAMUM, + HINTING_BOTTOM_TO_TOP, + "\xEA\x9B\x81 \xEA\x9B\xAF" ) /* ꛁ ꛯ */ + /* there are no simple forms for letters; we thus use two digit shapes */ SCRIPT( beng, BENG, "Bengali", @@ -49,12 +67,48 @@ HINTING_TOP_TO_BOTTOM, "\xE0\xA7\xA6 \xE0\xA7\xAA" ) /* ০ ৪ */ + SCRIPT( buhd, BUHD, + "Buhid", + HB_SCRIPT_BUHID, + HINTING_BOTTOM_TO_TOP, + "\xE1\x9D\x8B \xE1\x9D\x8F" ) /* ᝋ ᝏ */ + + SCRIPT( cakm, CAKM, + "Chakma", + HB_SCRIPT_CHAKMA, + HINTING_BOTTOM_TO_TOP, + "\xF0\x91\x84\xA4 \xF0\x91\x84\x89 \xF0\x91\x84\x9B" ) /* 𑄤 𑄉 𑄛 */ + + SCRIPT( cans, CANS, + "Canadian Syllabics", + HB_SCRIPT_CANADIAN_SYLLABICS, + HINTING_BOTTOM_TO_TOP, + "\xE1\x91\x8C \xE1\x93\x9A" ) /* ᑌ ᓚ */ + + SCRIPT( cari, CARI, + "Carian", + HB_SCRIPT_CARIAN, + HINTING_BOTTOM_TO_TOP, + "\xF0\x90\x8A\xAB \xF0\x90\x8B\x89" ) /* 𐊫 𐋉 */ + SCRIPT( cher, CHER, "Cherokee", HB_SCRIPT_CHEROKEE, HINTING_BOTTOM_TO_TOP, "\xE1\x8E\xA4 \xE1\x8F\x85 \xEA\xAE\x95" ) /* Ꭴ Ꮕ ꮕ */ + SCRIPT( copt, COPT, + "Coptic", + HB_SCRIPT_COPTIC, + HINTING_BOTTOM_TO_TOP, + "\xE2\xB2\x9E \xE2\xB2\x9F" ) /* Ⲟ ⲟ */ + + SCRIPT( cprt, CPRT, + "Cypriot", + HB_SCRIPT_CYPRIOT, + HINTING_BOTTOM_TO_TOP, + "\xF0\x90\xA0\x85 \xF0\x90\xA0\xA3" ) /* 𐠅 𐠣 */ + SCRIPT( cyrl, CYRL, "Cyrillic", HB_SCRIPT_CYRILLIC, @@ -67,6 +121,12 @@ HINTING_TOP_TO_BOTTOM, "\xE0\xA4\xA0 \xE0\xA4\xB5 \xE0\xA4\x9F" ) /* ठ व ट */ + SCRIPT( dsrt, DSRT, + "Deseret", + HB_SCRIPT_DESERET, + HINTING_BOTTOM_TO_TOP, + "\xF0\x90\x90\x84 \xF0\x90\x90\xAC" ) /* 𐐄 𐐬 */ + SCRIPT( ethi, ETHI, "Ethiopic", HB_SCRIPT_ETHIOPIC, @@ -77,7 +137,7 @@ "Georgian (Mkhedruli)", HB_SCRIPT_GEORGIAN, HINTING_BOTTOM_TO_TOP, - "\xE1\x83\x98 \xE1\x83\x94 \xE1\x83\x90" ) /* ი ე ა */ + "\xE1\x83\x98 \xE1\x83\x94 \xE1\x83\x90 \xE1\xB2\xBF" ) /* ი ე ა Ი */ SCRIPT( geok, GEOK, "Georgian (Khutsuri)", @@ -85,6 +145,18 @@ HINTING_BOTTOM_TO_TOP, "\xE1\x82\xB6 \xE1\x82\xB1 \xE2\xB4\x99" ) /* Ⴖ Ⴑ ⴙ */ + SCRIPT( glag, GLAG, + "Glagolitic", + HB_SCRIPT_GLAGOLITIC, + HINTING_BOTTOM_TO_TOP, + "\xE2\xB0\x95 \xE2\xB1\x85" ) /* Ⱅ ⱅ */ + + SCRIPT( goth, GOTH, + "Gothic", + HB_SCRIPT_GOTHIC, + HINTING_TOP_TO_BOTTOM, + "\xF0\x90\x8C\xB4 \xF0\x90\x8C\xBE \xF0\x90\x8D\x83" ) /* 𐌴 𐌾 𐍃 */ + SCRIPT( grek, GREK, "Greek", HB_SCRIPT_GREEK, @@ -109,11 +181,11 @@ HINTING_BOTTOM_TO_TOP, "\xD7\x9D" ) /* ם */ - SCRIPT( knda, KNDA, - "Kannada", - HB_SCRIPT_KANNADA, + SCRIPT( kali, KALI, + "Kayah Li", + HB_SCRIPT_KAYAH_LI, HINTING_BOTTOM_TO_TOP, - "\xE0\xB3\xA6 \xE0\xB2\xAC" ) /* ೦ ಬ */ + "\xEA\xA4\x8D \xEA\xA4\x80" ) /* ꤍ ꤀ */ /* only digit zero has a simple shape in the Khmer script */ SCRIPT( khmr, KHMR, @@ -128,6 +200,12 @@ HINTING_BOTTOM_TO_TOP, "\xE1\xA7\xA1 \xE1\xA7\xAA" ) /* ᧡ ᧪ */ + SCRIPT( knda, KNDA, + "Kannada", + HB_SCRIPT_KANNADA, + HINTING_BOTTOM_TO_TOP, + "\xE0\xB3\xA6 \xE0\xB2\xAC" ) /* ೦ ಬ */ + /* only digit zero has a simple shape in the Lao script */ SCRIPT( lao, LAO, "Lao", @@ -153,6 +231,12 @@ HINTING_BOTTOM_TO_TOP, "\xE1\xB5\x92 \xE1\xB4\xBC \xE2\x81\xB0" ) /* ᵒ ᴼ ⁰ */ + SCRIPT( lisu, LISU, + "Lisu", + HB_SCRIPT_LISU, + HINTING_BOTTOM_TO_TOP, + "\xEA\x93\xB3" ) /* ꓳ */ + SCRIPT( mlym, MLYM, "Malayalam", HB_SCRIPT_MALAYALAM, @@ -165,18 +249,67 @@ HINTING_BOTTOM_TO_TOP, "\xE1\x80\x9D \xE1\x80\x84 \xE1\x80\x82" ) /* ဝ င ဂ */ + SCRIPT( nkoo, NKOO, + "N'Ko", + HB_SCRIPT_NKO, + HINTING_BOTTOM_TO_TOP, + "\xDF\x8B \xDF\x80" ) /* ߋ ߀ */ + SCRIPT( none, NONE, "no script", HB_SCRIPT_INVALID, HINTING_BOTTOM_TO_TOP, "" ) + SCRIPT( olck, OLCK, + "Ol Chiki", + HB_SCRIPT_OL_CHIKI, + HINTING_BOTTOM_TO_TOP, + "\xE1\xB1\x9B" ) /* ᱛ */ + + SCRIPT( orkh, ORKH, + "Old Turkic", + HB_SCRIPT_OLD_TURKIC, + HINTING_BOTTOM_TO_TOP, + "\xF0\x90\xB0\x97" ) /* 𐰗 */ + + SCRIPT( osge, OSGE, + "Osage", + HB_SCRIPT_OSAGE, + HINTING_BOTTOM_TO_TOP, + "\xF0\x90\x93\x82 \xF0\x90\x93\xAA" ) /* 𐓂 𐓪 */ + + SCRIPT( osma, OSMA, + "Osmanya", + HB_SCRIPT_OSMANYA, + HINTING_BOTTOM_TO_TOP, + "\xF0\x90\x92\x86 \xF0\x90\x92\xA0" ) /* 𐒆 𐒠 */ + + SCRIPT( saur, SAUR, + "Saurashtra", + HB_SCRIPT_SAURASHTRA, + HINTING_BOTTOM_TO_TOP, + "\xEA\xA2\x9D \xEA\xA3\x90" ) /* ꢝ ꣐ */ + + SCRIPT( shaw, SHAW, + "Shavian", + HB_SCRIPT_SHAVIAN, + HINTING_BOTTOM_TO_TOP, + "\xF0\x90\x91\xB4" ) /* 𐑴 */ + SCRIPT( sinh, SINH, "Sinhala", HB_SCRIPT_SINHALA, HINTING_BOTTOM_TO_TOP, "\xE0\xB6\xA7" ) /* ට */ + /* only digit zero has a simple (round) shape in the Sundanese script */ + SCRIPT( sund, SUND, + "Sundanese", + HB_SCRIPT_SUNDANESE, + HINTING_BOTTOM_TO_TOP, + "\xE1\xAE\xB0" ) /* ᮰ */ + /* only digit zero has a simple (round) shape in the Tamil script */ SCRIPT( taml, TAML, "Tamil", @@ -184,6 +317,12 @@ HINTING_BOTTOM_TO_TOP, "\xE0\xAF\xA6" ) /* ௦ */ + SCRIPT( tavt, TAVT, + "Tai Viet", + HB_SCRIPT_TAI_VIET, + HINTING_BOTTOM_TO_TOP, + "\xEA\xAA\x92 \xEA\xAA\xAB" ) /* ꪒ ꪫ */ + /* there are no simple forms for letters; we thus use two digit shapes */ SCRIPT( telu, TELU, "Telugu", @@ -191,12 +330,24 @@ HINTING_BOTTOM_TO_TOP, "\xE0\xB1\xA6 \xE0\xB1\xA7" ) /* ౦ ౧ */ + SCRIPT( tfng, TFNG, + "Tifinagh", + HB_SCRIPT_TIFINAGH, + HINTING_BOTTOM_TO_TOP, + "\xE2\xB5\x94" ) /* ⵔ */ + SCRIPT( thai, THAI, "Thai", HB_SCRIPT_THAI, HINTING_BOTTOM_TO_TOP, "\xE0\xB8\xB2 \xE0\xB9\x85 \xE0\xB9\x90" ) /* า ๅ ๐ */ + SCRIPT( vaii, VAII, + "Vai", + HB_SCRIPT_VAI, + HINTING_BOTTOM_TO_TOP, + "\xEA\x98\x93 \xEA\x96\x9C \xEA\x96\xB4" ) /* ꘓ ꖜ ꖴ */ + #ifdef AF_CONFIG_OPTION_INDIC SCRIPT( limb, LIMB, @@ -211,12 +362,6 @@ HINTING_BOTTOM_TO_TOP, "o" ) /* XXX */ - SCRIPT( sund, SUND, - "Sundanese", - HB_SCRIPT_SUNDANESE, - HINTING_BOTTOM_TO_TOP, - "o" ) /* XXX */ - SCRIPT( sylo, SYLO, "Syloti Nagri", HB_SCRIPT_SYLOTI_NAGRI, diff --git a/src/autofit/afshaper.c b/src/autofit/afshaper.c index da92fad3e..f30828173 100644 --- a/src/autofit/afshaper.c +++ b/src/autofit/afshaper.c @@ -4,7 +4,7 @@ /* */ /* HarfBuzz interface for accessing OpenType features (body). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,6 +18,7 @@ #include #include FT_FREETYPE_H +#include FT_ADVANCES_H #include "afglobal.h" #include "aftypes.h" #include "afshaper.h" @@ -103,10 +104,10 @@ { hb_face_t* face; - hb_set_t* gsub_lookups; /* GSUB lookups for a given script */ - hb_set_t* gsub_glyphs; /* glyphs covered by GSUB lookups */ - hb_set_t* gpos_lookups; /* GPOS lookups for a given script */ - hb_set_t* gpos_glyphs; /* glyphs covered by GPOS lookups */ + hb_set_t* gsub_lookups = NULL; /* GSUB lookups for a given script */ + hb_set_t* gsub_glyphs = NULL; /* glyphs covered by GSUB lookups */ + hb_set_t* gpos_lookups = NULL; /* GPOS lookups for a given script */ + hb_set_t* gpos_glyphs = NULL; /* glyphs covered by GPOS lookups */ hb_script_t script; const hb_tag_t* coverage_tags; @@ -126,11 +127,6 @@ face = hb_font_get_face( globals->hb_font ); - gsub_lookups = hb_set_create(); - gsub_glyphs = hb_set_create(); - gpos_lookups = hb_set_create(); - gpos_glyphs = hb_set_create(); - coverage_tags = coverages[style_class->coverage]; script = scripts[style_class->script]; @@ -167,6 +163,7 @@ script_tags[1] = HB_TAG_NONE; } + gsub_lookups = hb_set_create(); hb_ot_layout_collect_lookups( face, HB_OT_TAG_GSUB, script_tags, @@ -177,13 +174,6 @@ if ( hb_set_is_empty( gsub_lookups ) ) goto Exit; /* nothing to do */ - hb_ot_layout_collect_lookups( face, - HB_OT_TAG_GPOS, - script_tags, - NULL, - coverage_tags, - gpos_lookups ); - FT_TRACE4(( "GSUB lookups (style `%s'):\n" " ", af_style_names[style_class->style] )); @@ -192,6 +182,7 @@ count = 0; #endif + gsub_glyphs = hb_set_create(); for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, &idx ); ) { #ifdef FT_DEBUG_LEVEL_TRACE @@ -219,10 +210,19 @@ " ", af_style_names[style_class->style] )); + gpos_lookups = hb_set_create(); + hb_ot_layout_collect_lookups( face, + HB_OT_TAG_GPOS, + script_tags, + NULL, + coverage_tags, + gpos_lookups ); + #ifdef FT_DEBUG_LEVEL_TRACE count = 0; #endif + gpos_glyphs = hb_set_create(); for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gpos_lookups, &idx ); ) { #ifdef FT_DEBUG_LEVEL_TRACE diff --git a/src/autofit/afshaper.h b/src/autofit/afshaper.h index 9185d1900..7efd9f6a4 100644 --- a/src/autofit/afshaper.h +++ b/src/autofit/afshaper.h @@ -4,7 +4,7 @@ /* */ /* HarfBuzz interface for accessing OpenType features (specification). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h index 3afa8395e..e2688b3fc 100644 --- a/src/autofit/afstyles.h +++ b/src/autofit/afstyles.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter styles (specification only). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -83,6 +83,13 @@ DEFAULT ) + STYLE( adlm_dflt, ADLM_DFLT, + "Adlam default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_ADLM, + AF_BLUE_STRINGSET_ADLM, + AF_COVERAGE_DEFAULT ) + STYLE( arab_dflt, ARAB_DFLT, "Arabic default style", AF_WRITING_SYSTEM_LATIN, @@ -97,6 +104,20 @@ AF_BLUE_STRINGSET_ARMN, AF_COVERAGE_DEFAULT ) + STYLE( avst_dflt, AVST_DFLT, + "Avestan default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_AVST, + AF_BLUE_STRINGSET_AVST, + AF_COVERAGE_DEFAULT ) + + STYLE( bamu_dflt, BAMU_DFLT, + "Bamum default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_BAMU, + AF_BLUE_STRINGSET_BAMU, + AF_COVERAGE_DEFAULT ) + STYLE( beng_dflt, BENG_DFLT, "Bengali default style", AF_WRITING_SYSTEM_LATIN, @@ -104,6 +125,34 @@ AF_BLUE_STRINGSET_BENG, AF_COVERAGE_DEFAULT ) + STYLE( buhd_dflt, BUHD_DFLT, + "Buhid default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_BUHD, + AF_BLUE_STRINGSET_BUHD, + AF_COVERAGE_DEFAULT ) + + STYLE( cakm_dflt, CAKM_DFLT, + "Chakma default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_CAKM, + AF_BLUE_STRINGSET_CAKM, + AF_COVERAGE_DEFAULT ) + + STYLE( cans_dflt, CANS_DFLT, + "Canadian Syllabics default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_CANS, + AF_BLUE_STRINGSET_CANS, + AF_COVERAGE_DEFAULT ) + + STYLE( cari_dflt, CARI_DFLT, + "Carian default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_CARI, + AF_BLUE_STRINGSET_CARI, + AF_COVERAGE_DEFAULT ) + STYLE( cher_dflt, CHER_DFLT, "Cherokee default style", AF_WRITING_SYSTEM_LATIN, @@ -111,6 +160,20 @@ AF_BLUE_STRINGSET_CHER, AF_COVERAGE_DEFAULT ) + STYLE( copt_dflt, COPT_DFLT, + "Coptic default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_COPT, + AF_BLUE_STRINGSET_COPT, + AF_COVERAGE_DEFAULT ) + + STYLE( cprt_dflt, CPRT_DFLT, + "Cypriot default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_CPRT, + AF_BLUE_STRINGSET_CPRT, + AF_COVERAGE_DEFAULT ) + META_STYLE_LATIN( cyrl, CYRL, "Cyrillic" ) STYLE( deva_dflt, DEVA_DFLT, @@ -120,6 +183,13 @@ AF_BLUE_STRINGSET_DEVA, AF_COVERAGE_DEFAULT ) + STYLE( dsrt_dflt, DSRT_DFLT, + "Deseret default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_DSRT, + AF_BLUE_STRINGSET_DSRT, + AF_COVERAGE_DEFAULT ) + STYLE( ethi_dflt, ETHI_DFLT, "Ethiopic default style", AF_WRITING_SYSTEM_LATIN, @@ -141,6 +211,20 @@ AF_BLUE_STRINGSET_GEOK, AF_COVERAGE_DEFAULT ) + STYLE( glag_dflt, GLAG_DFLT, + "Glagolitic default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_GLAG, + AF_BLUE_STRINGSET_GLAG, + AF_COVERAGE_DEFAULT ) + + STYLE( goth_dflt, GOTH_DFLT, + "Gothic default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_GOTH, + AF_BLUE_STRINGSET_GOTH, + AF_COVERAGE_DEFAULT ) + META_STYLE_LATIN( grek, GREK, "Greek" ) STYLE( gujr_dflt, GUJR_DFLT, @@ -164,11 +248,11 @@ AF_BLUE_STRINGSET_HEBR, AF_COVERAGE_DEFAULT ) - STYLE( knda_dflt, KNDA_DFLT, - "Kannada default style", + STYLE( kali_dflt, KALI_DFLT, + "Kayah Li default style", AF_WRITING_SYSTEM_LATIN, - AF_SCRIPT_KNDA, - AF_BLUE_STRINGSET_KNDA, + AF_SCRIPT_KALI, + AF_BLUE_STRINGSET_KALI, AF_COVERAGE_DEFAULT ) STYLE( khmr_dflt, KHMR_DFLT, @@ -185,6 +269,13 @@ AF_BLUE_STRINGSET_KHMS, AF_COVERAGE_DEFAULT ) + STYLE( knda_dflt, KNDA_DFLT, + "Kannada default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_KNDA, + AF_BLUE_STRINGSET_KNDA, + AF_COVERAGE_DEFAULT ) + STYLE( lao_dflt, LAO_DFLT, "Lao default style", AF_WRITING_SYSTEM_LATIN, @@ -217,6 +308,13 @@ AF_COVERAGE_DEFAULT ) #endif + STYLE( lisu_dflt, LISU_DFLT, + "Lisu default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_LISU, + AF_BLUE_STRINGSET_LISU, + AF_COVERAGE_DEFAULT ) + STYLE( mlym_dflt, MLYM_DFLT, "Malayalam default style", AF_WRITING_SYSTEM_LATIN, @@ -231,6 +329,13 @@ AF_BLUE_STRINGSET_MYMR, AF_COVERAGE_DEFAULT ) + STYLE( nkoo_dflt, NKOO_DFLT, + "N'Ko default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_NKOO, + AF_BLUE_STRINGSET_NKOO, + AF_COVERAGE_DEFAULT ) + STYLE( none_dflt, NONE_DFLT, "no style", AF_WRITING_SYSTEM_DUMMY, @@ -238,6 +343,48 @@ AF_BLUE_STRINGSET_NONE, AF_COVERAGE_DEFAULT ) + STYLE( olck_dflt, OLCK_DFLT, + "Ol Chiki default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_OLCK, + AF_BLUE_STRINGSET_OLCK, + AF_COVERAGE_DEFAULT ) + + STYLE( orkh_dflt, ORKH_DFLT, + "Old Turkic default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_ORKH, + AF_BLUE_STRINGSET_ORKH, + AF_COVERAGE_DEFAULT ) + + STYLE( osge_dflt, OSGE_DFLT, + "Osage default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_OSGE, + AF_BLUE_STRINGSET_OSGE, + AF_COVERAGE_DEFAULT ) + + STYLE( osma_dflt, OSMA_DFLT, + "Osmanya default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_OSMA, + AF_BLUE_STRINGSET_OSMA, + AF_COVERAGE_DEFAULT ) + + STYLE( saur_dflt, SAUR_DFLT, + "Saurashtra default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_SAUR, + AF_BLUE_STRINGSET_SAUR, + AF_COVERAGE_DEFAULT ) + + STYLE( shaw_dflt, SHAW_DFLT, + "Shavian default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_SHAW, + AF_BLUE_STRINGSET_SHAW, + AF_COVERAGE_DEFAULT ) + STYLE( sinh_dflt, SINH_DFLT, "Sinhala default style", AF_WRITING_SYSTEM_LATIN, @@ -245,6 +392,13 @@ AF_BLUE_STRINGSET_SINH, AF_COVERAGE_DEFAULT ) + STYLE( sund_dflt, SUND_DFLT, + "Sundanese default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_SUND, + AF_BLUE_STRINGSET_SUND, + AF_COVERAGE_DEFAULT ) + STYLE( taml_dflt, TAML_DFLT, "Tamil default style", AF_WRITING_SYSTEM_LATIN, @@ -252,6 +406,13 @@ AF_BLUE_STRINGSET_TAML, AF_COVERAGE_DEFAULT ) + STYLE( tavt_dflt, TAVT_DFLT, + "Tai Viet default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_TAVT, + AF_BLUE_STRINGSET_TAVT, + AF_COVERAGE_DEFAULT ) + STYLE( telu_dflt, TELU_DFLT, "Telugu default style", AF_WRITING_SYSTEM_LATIN, @@ -259,6 +420,13 @@ AF_BLUE_STRINGSET_TELU, AF_COVERAGE_DEFAULT ) + STYLE( tfng_dflt, TFNG_DFLT, + "Tifinagh default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_TFNG, + AF_BLUE_STRINGSET_TFNG, + AF_COVERAGE_DEFAULT ) + STYLE( thai_dflt, THAI_DFLT, "Thai default style", AF_WRITING_SYSTEM_LATIN, @@ -266,6 +434,13 @@ AF_BLUE_STRINGSET_THAI, AF_COVERAGE_DEFAULT ) + STYLE( vaii_dflt, VAII_DFLT, + "Vai default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_VAII, + AF_BLUE_STRINGSET_VAII, + AF_COVERAGE_DEFAULT ) + #ifdef AF_CONFIG_OPTION_INDIC /* no blue stringset support for the Indic writing system yet */ @@ -280,7 +455,6 @@ STYLE_DEFAULT_INDIC( limb, LIMB, "Limbu" ) STYLE_DEFAULT_INDIC( orya, ORYA, "Oriya" ) - STYLE_DEFAULT_INDIC( sund, SUND, "Sundanese" ) STYLE_DEFAULT_INDIC( sylo, SYLO, "Syloti Nagri" ) STYLE_DEFAULT_INDIC( tibt, TIBT, "Tibetan" ) diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h index 718dab70b..6bd8c895b 100644 --- a/src/autofit/aftypes.h +++ b/src/autofit/aftypes.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter types (specification only). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -76,9 +76,9 @@ extern void* _af_debug_hints; typedef struct AF_WidthRec_ { - FT_Pos org; /* original position/width in font units */ - FT_Pos cur; /* current/scaled position/width in device sub-pixels */ - FT_Pos fit; /* current/fitted position/width in device sub-pixels */ + FT_Pos org; /* original position/width in font units */ + FT_Pos cur; /* current/scaled position/width in device subpixels */ + FT_Pos fit; /* current/fitted position/width in device subpixels */ } AF_WidthRec, *AF_Width; diff --git a/src/autofit/afwarp.c b/src/autofit/afwarp.c index 44dd49b6f..2a75ea7b3 100644 --- a/src/autofit/afwarp.c +++ b/src/autofit/afwarp.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter warping algorithm (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -98,7 +98,6 @@ if ( xx1min + w < warper->x2min ) xx1min = warper->x2min - w; - xx1max = warper->x1max; if ( xx1max + w > warper->x2max ) xx1max = warper->x2max - w; diff --git a/src/autofit/afwarp.h b/src/autofit/afwarp.h index 2e85cbd85..520b1be90 100644 --- a/src/autofit/afwarp.h +++ b/src/autofit/afwarp.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter warping algorithm (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/afwrtsys.h b/src/autofit/afwrtsys.h index 86749a2a8..4675f3242 100644 --- a/src/autofit/afwrtsys.h +++ b/src/autofit/afwrtsys.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter writing systems (specification only). */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/autofit/autofit.c b/src/autofit/autofit.c index 60060c9c7..c1605160a 100644 --- a/src/autofit/autofit.c +++ b/src/autofit/autofit.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,29 +18,22 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT #include -#include "afpic.c" + #include "afangles.c" #include "afblue.c" +#include "afcjk.c" +#include "afdummy.c" #include "afglobal.c" #include "afhints.c" - -#include "afranges.c" - -#include "afdummy.c" +#include "afindic.c" #include "aflatin.c" -#ifdef FT_OPTION_AUTOFIT2 #include "aflatin2.c" -#endif -#include "afcjk.c" -#include "afindic.c" - -#include "afshaper.c" - #include "afloader.c" #include "afmodule.c" - -#ifdef AF_CONFIG_OPTION_USE_WARPER +#include "afpic.c" +#include "afranges.c" +#include "afshaper.c" #include "afwarp.c" -#endif + /* END */ diff --git a/src/autofit/module.mk b/src/autofit/module.mk index c4e249b6f..ff05f83e7 100644 --- a/src/autofit/module.mk +++ b/src/autofit/module.mk @@ -3,7 +3,7 @@ # -# Copyright 2003-2017 by +# Copyright 2003-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/autofit/rules.mk b/src/autofit/rules.mk index ec4e1302d..75171b412 100644 --- a/src/autofit/rules.mk +++ b/src/autofit/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2003-2017 by +# Copyright 2003-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/base/Jamfile b/src/base/Jamfile index 9e9a91b20..4994c1b4c 100644 --- a/src/base/Jamfile +++ b/src/base/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/base Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -21,11 +21,14 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ; ftadvanc ftcalc ftdbgmem + ftfntfmt ftgloadr fthash + ftlcdfil ftobjs ftoutln ftpic + ftpsprop ftrfork ftsnames ftstream @@ -50,13 +53,11 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ; ftbitmap ftcid ftdebug - ftfntfmt ftfstype ftgasp ftglyph ftgxval ftinit - ftlcdfil ftmm ftotval ftpatent diff --git a/src/base/basepic.c b/src/base/basepic.c index 57fb8169a..bc8040644 100644 --- a/src/base/basepic.c +++ b/src/base/basepic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for base. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/basepic.h b/src/base/basepic.h index 258d4ce2b..492d1ede5 100644 --- a/src/base/basepic.h +++ b/src/base/basepic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for base. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftadvanc.c b/src/base/ftadvanc.c index 1557607fc..230c84d6a 100644 --- a/src/base/ftadvanc.c +++ b/src/base/ftadvanc.c @@ -4,7 +4,7 @@ /* */ /* Quick computation of advance widths (body). */ /* */ -/* Copyright 2008-2017 by */ +/* Copyright 2008-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -116,9 +116,12 @@ FT_Int32 flags, FT_Fixed *padvances ) { + FT_Error error = FT_Err_Ok; + FT_Face_GetAdvancesFunc func; - FT_UInt num, end, nn; - FT_Error error = FT_Err_Ok; + + FT_UInt num, end, nn; + FT_Int factor; if ( !face ) @@ -152,16 +155,17 @@ return FT_THROW( Unimplemented_Feature ); flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY; + factor = ( flags & FT_LOAD_NO_SCALE ) ? 1 : 1024; for ( nn = 0; nn < count; nn++ ) { error = FT_Load_Glyph( face, start + nn, flags ); if ( error ) break; - /* scale from 26.6 to 16.16 */ + /* scale from 26.6 to 16.16, unless NO_SCALE was requested */ padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT ) - ? face->glyph->advance.y * 1024 - : face->glyph->advance.x * 1024; + ? face->glyph->advance.y * factor + : face->glyph->advance.x * factor; } return error; diff --git a/src/base/ftapi.c b/src/base/ftapi.c index 1e6c718d9..32d6e95d1 100644 --- a/src/base/ftapi.c +++ b/src/base/ftapi.c @@ -4,7 +4,7 @@ /* */ /* The FreeType compatibility functions (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -38,7 +38,7 @@ /*************************************************************************/ /*************************************************************************/ - /* backwards compatibility API */ + /* backward compatibility API */ FT_BASE_DEF( void ) FT_New_Memory_Stream( FT_Library library, diff --git a/src/base/ftbase.c b/src/base/ftbase.c index 993ac7228..f914b9b24 100644 --- a/src/base/ftbase.c +++ b/src/base/ftbase.c @@ -4,7 +4,7 @@ /* */ /* Single object library component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,26 +17,26 @@ #include - #define FT_MAKE_OPTION_SINGLE_OBJECT -#include "ftpic.c" #include "basepic.c" #include "ftadvanc.c" #include "ftcalc.c" #include "ftdbgmem.c" +#include "ftfntfmt.c" #include "ftgloadr.c" #include "fthash.c" +#include "ftlcdfil.c" +#include "ftmac.c" #include "ftobjs.c" #include "ftoutln.c" +#include "ftpic.c" +#include "ftpsprop.c" #include "ftrfork.c" #include "ftsnames.c" #include "ftstream.c" #include "fttrigon.c" #include "ftutil.c" -#ifdef FT_MACINTOSH -#include "ftmac.c" -#endif /* END */ diff --git a/src/base/ftbase.h b/src/base/ftbase.h index 2072284f0..7e8cfad95 100644 --- a/src/base/ftbase.h +++ b/src/base/ftbase.h @@ -2,9 +2,9 @@ /* */ /* ftbase.h */ /* */ -/* The FreeType private functions used in base module (specification). */ +/* Private functions used in the `base' module (specification). */ /* */ -/* Copyright 2008-2017 by */ +/* Copyright 2008-2018 by */ /* David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,6 +27,8 @@ FT_BEGIN_HEADER +#ifdef FT_CONFIG_OPTION_MAC_FONTS + /* MacOS resource fork cannot exceed 16MB at least for Carbon code; */ /* see https://support.microsoft.com/en-us/kb/130437 */ #define FT_MAC_RFORK_MAX_LEN 0x00FFFFFFUL @@ -65,6 +67,8 @@ FT_BEGIN_HEADER ft_raccess_rule_by_darwin_vfs( FT_Library library, FT_UInt rule_index ); #endif +#endif /* FT_CONFIG_OPTION_MAC_FONTS */ + FT_END_HEADER diff --git a/src/base/ftbbox.c b/src/base/ftbbox.c index 6e19da63c..151e85c97 100644 --- a/src/base/ftbbox.c +++ b/src/base/ftbbox.c @@ -4,7 +4,7 @@ /* */ /* FreeType bbox computation (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ diff --git a/src/base/ftbdf.c b/src/base/ftbdf.c index 40f0ca2bb..c4ea502fb 100644 --- a/src/base/ftbdf.c +++ b/src/base/ftbdf.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing BDF-specific strings (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c index 88c88c4c1..a9746663f 100644 --- a/src/base/ftbitmap.c +++ b/src/base/ftbitmap.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility functions for bitmaps (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -153,38 +153,36 @@ FT_UInt ypixels ) { FT_Error error; - int pitch; - int new_pitch; + unsigned int pitch; + unsigned int new_pitch; FT_UInt bpp; - FT_UInt i, width, height; + FT_UInt width, height; unsigned char* buffer = NULL; width = bitmap->width; height = bitmap->rows; - pitch = bitmap->pitch; - if ( pitch < 0 ) - pitch = -pitch; + pitch = (unsigned int)FT_ABS( bitmap->pitch ); switch ( bitmap->pixel_mode ) { case FT_PIXEL_MODE_MONO: bpp = 1; - new_pitch = (int)( ( width + xpixels + 7 ) >> 3 ); + new_pitch = ( width + xpixels + 7 ) >> 3; break; case FT_PIXEL_MODE_GRAY2: bpp = 2; - new_pitch = (int)( ( width + xpixels + 3 ) >> 2 ); + new_pitch = ( width + xpixels + 3 ) >> 2; break; case FT_PIXEL_MODE_GRAY4: bpp = 4; - new_pitch = (int)( ( width + xpixels + 1 ) >> 1 ); + new_pitch = ( width + xpixels + 1 ) >> 1; break; case FT_PIXEL_MODE_GRAY: case FT_PIXEL_MODE_LCD: case FT_PIXEL_MODE_LCD_V: bpp = 8; - new_pitch = (int)( width + xpixels ); + new_pitch = width + xpixels; break; default: return FT_THROW( Invalid_Glyph_Format ); @@ -194,7 +192,7 @@ if ( ypixels == 0 && new_pitch <= pitch ) { /* zero the padding */ - FT_UInt bit_width = (FT_UInt)pitch * 8; + FT_UInt bit_width = pitch * 8; FT_UInt bit_last = ( width + xpixels ) * bpp; @@ -226,7 +224,7 @@ } /* otherwise allocate new buffer */ - if ( FT_QALLOC_MULT( buffer, new_pitch, bitmap->rows + ypixels ) ) + if ( FT_QALLOC_MULT( buffer, bitmap->rows + ypixels, new_pitch ) ) return error; /* new rows get added at the top of the bitmap, */ @@ -235,31 +233,60 @@ { FT_UInt len = ( width * bpp + 7 ) >> 3; + unsigned char* in = bitmap->buffer; + unsigned char* out = buffer; + + unsigned char* limit = bitmap->buffer + pitch * bitmap->rows; + unsigned int delta = new_pitch - len; + + + FT_MEM_ZERO( out, new_pitch * ypixels ); + out += new_pitch * ypixels; - for ( i = 0; i < bitmap->rows; i++ ) - FT_MEM_COPY( buffer + (FT_UInt)new_pitch * ( ypixels + i ), - bitmap->buffer + (FT_UInt)pitch * i, - len ); + while ( in < limit ) + { + FT_MEM_COPY( out, in, len ); + in += pitch; + out += len; + + /* we use FT_QALLOC_MULT, which doesn't zero out the buffer; */ + /* consequently, we have to manually zero out the remaining bytes */ + FT_MEM_ZERO( out, delta ); + out += delta; + } } else { FT_UInt len = ( width * bpp + 7 ) >> 3; + unsigned char* in = bitmap->buffer; + unsigned char* out = buffer; + + unsigned char* limit = bitmap->buffer + pitch * bitmap->rows; + unsigned int delta = new_pitch - len; + - for ( i = 0; i < bitmap->rows; i++ ) - FT_MEM_COPY( buffer + (FT_UInt)new_pitch * i, - bitmap->buffer + (FT_UInt)pitch * i, - len ); + while ( in < limit ) + { + FT_MEM_COPY( out, in, len ); + in += pitch; + out += len; + + FT_MEM_ZERO( out, delta ); + out += delta; + } + + FT_MEM_ZERO( out, new_pitch * ypixels ); } FT_FREE( bitmap->buffer ); bitmap->buffer = buffer; - if ( bitmap->pitch < 0 ) - new_pitch = -new_pitch; - /* set pitch only, width and height are left untouched */ - bitmap->pitch = new_pitch; + if ( bitmap->pitch < 0 ) + bitmap->pitch = -(int)new_pitch; + else + bitmap->pitch = (int)new_pitch; return FT_Err_Ok; } @@ -444,7 +471,7 @@ * A gamma of 2.2 is fair to assume. And then, we need to * undo the premultiplication too. * - * http://accessibility.kde.org/hsl-adjusted.php + * https://accessibility.kde.org/hsl-adjusted.php * * We do the computation with integers only, applying a gamma of 2.0. * We guarantee 32-bit arithmetic to avoid overflow but the resulting @@ -534,8 +561,7 @@ (FT_ULong)target->rows > FT_ULONG_MAX / (FT_ULong)target_pitch ) return FT_THROW( Invalid_Argument ); - if ( target->rows * (FT_ULong)target_pitch > old_size && - FT_QREALLOC( target->buffer, + if ( FT_QREALLOC( target->buffer, old_size, target->rows * (FT_UInt)target_pitch ) ) return error; diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index f0525502f..f4ff45f8e 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -4,7 +4,7 @@ /* */ /* Arithmetic computations (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -68,14 +68,15 @@ #define FT_COMPONENT trace_calc - /* transfer sign leaving a positive number */ -#define FT_MOVE_SIGN( x, s ) \ - FT_BEGIN_STMNT \ - if ( x < 0 ) \ - { \ - x = -x; \ - s = -s; \ - } \ + /* transfer sign, leaving a positive number; */ + /* we need an unsigned value to safely negate INT_MIN (or LONG_MIN) */ +#define FT_MOVE_SIGN( x, x_unsigned, s ) \ + FT_BEGIN_STMNT \ + if ( x < 0 ) \ + { \ + x_unsigned = 0U - (x_unsigned); \ + s = -s; \ + } \ FT_END_STMNT /* The following three functions are available regardless of whether */ @@ -86,7 +87,7 @@ FT_EXPORT_DEF( FT_Fixed ) FT_RoundFix( FT_Fixed a ) { - return ( a + 0x8000L - ( a < 0 ) ) & ~0xFFFFL; + return ( ADD_LONG( a, 0x8000L - ( a < 0 ) ) ) & ~0xFFFFL; } @@ -95,7 +96,7 @@ FT_EXPORT_DEF( FT_Fixed ) FT_CeilFix( FT_Fixed a ) { - return ( a + 0xFFFFL ) & ~0xFFFFL; + return ( ADD_LONG( a, 0xFFFFL ) ) & ~0xFFFFL; } @@ -179,20 +180,20 @@ FT_Long d_; - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - FT_MOVE_SIGN( c_, s ); - a = (FT_UInt64)a_; b = (FT_UInt64)b_; c = (FT_UInt64)c_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + FT_MOVE_SIGN( c_, c, s ); + d = c > 0 ? ( a * b + ( c >> 1 ) ) / c : 0x7FFFFFFFUL; d_ = (FT_Long)d; - return s < 0 ? -d_ : d_; + return s < 0 ? NEG_LONG( d_ ) : d_; } @@ -208,20 +209,20 @@ FT_Long d_; - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - FT_MOVE_SIGN( c_, s ); - a = (FT_UInt64)a_; b = (FT_UInt64)b_; c = (FT_UInt64)c_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + FT_MOVE_SIGN( c_, c, s ); + d = c > 0 ? a * b / c : 0x7FFFFFFFUL; d_ = (FT_Long)d; - return s < 0 ? -d_ : d_; + return s < 0 ? NEG_LONG( d_ ) : d_; } @@ -257,18 +258,18 @@ FT_Long q_; - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - a = (FT_UInt64)a_; b = (FT_UInt64)b_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + q = b > 0 ? ( ( a << 16 ) + ( b >> 1 ) ) / b : 0x7FFFFFFFUL; q_ = (FT_Long)q; - return s < 0 ? -q_ : q_; + return s < 0 ? NEG_LONG( q_ ) : q_; } @@ -422,14 +423,14 @@ /* XXX: this function does not allow 64-bit arguments */ - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - FT_MOVE_SIGN( c_, s ); - a = (FT_UInt32)a_; b = (FT_UInt32)b_; c = (FT_UInt32)c_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + FT_MOVE_SIGN( c_, c, s ); + if ( c == 0 ) a = 0x7FFFFFFFUL; @@ -455,7 +456,7 @@ a_ = (FT_Long)a; - return s < 0 ? -a_ : a_; + return s < 0 ? NEG_LONG( a_ ) : a_; } @@ -470,14 +471,14 @@ /* XXX: this function does not allow 64-bit arguments */ - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - FT_MOVE_SIGN( c_, s ); - a = (FT_UInt32)a_; b = (FT_UInt32)b_; c = (FT_UInt32)c_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + FT_MOVE_SIGN( c_, c, s ); + if ( c == 0 ) a = 0x7FFFFFFFUL; @@ -498,7 +499,7 @@ a_ = (FT_Long)a; - return s < 0 ? -a_ : a_; + return s < 0 ? NEG_LONG( a_ ) : a_; } @@ -575,12 +576,12 @@ /* XXX: this function does not allow 64-bit arguments */ - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - a = (FT_UInt32)a_; b = (FT_UInt32)b_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + if ( a + ( b >> 8 ) <= 8190UL ) a = ( a * b + 0x8000UL ) >> 16; else @@ -594,7 +595,7 @@ a_ = (FT_Long)a; - return s < 0 ? -a_ : a_; + return s < 0 ? NEG_LONG( a_ ) : a_; #endif /* 0 */ @@ -614,12 +615,12 @@ /* XXX: this function does not allow 64-bit arguments */ - FT_MOVE_SIGN( a_, s ); - FT_MOVE_SIGN( b_, s ); - a = (FT_UInt32)a_; b = (FT_UInt32)b_; + FT_MOVE_SIGN( a_, a, s ); + FT_MOVE_SIGN( b_, b, s ); + if ( b == 0 ) { /* check for division by 0 */ @@ -647,7 +648,7 @@ q_ = (FT_Long)q; - return s < 0 ? -q_ : q_; + return s < 0 ? NEG_LONG( q_ ) : q_; } @@ -666,13 +667,19 @@ if ( !a || !b ) return; - xx = FT_MulFix( a->xx, b->xx ) + FT_MulFix( a->xy, b->yx ); - xy = FT_MulFix( a->xx, b->xy ) + FT_MulFix( a->xy, b->yy ); - yx = FT_MulFix( a->yx, b->xx ) + FT_MulFix( a->yy, b->yx ); - yy = FT_MulFix( a->yx, b->xy ) + FT_MulFix( a->yy, b->yy ); - - b->xx = xx; b->xy = xy; - b->yx = yx; b->yy = yy; + xx = ADD_LONG( FT_MulFix( a->xx, b->xx ), + FT_MulFix( a->xy, b->yx ) ); + xy = ADD_LONG( FT_MulFix( a->xx, b->xy ), + FT_MulFix( a->xy, b->yy ) ); + yx = ADD_LONG( FT_MulFix( a->yx, b->xx ), + FT_MulFix( a->yy, b->yx ) ); + yy = ADD_LONG( FT_MulFix( a->yx, b->xy ), + FT_MulFix( a->yy, b->yy ) ); + + b->xx = xx; + b->xy = xy; + b->yx = yx; + b->yy = yy; } @@ -722,13 +729,19 @@ if ( !a || !b ) return; - xx = FT_MulDiv( a->xx, b->xx, val ) + FT_MulDiv( a->xy, b->yx, val ); - xy = FT_MulDiv( a->xx, b->xy, val ) + FT_MulDiv( a->xy, b->yy, val ); - yx = FT_MulDiv( a->yx, b->xx, val ) + FT_MulDiv( a->yy, b->yx, val ); - yy = FT_MulDiv( a->yx, b->xy, val ) + FT_MulDiv( a->yy, b->yy, val ); - - b->xx = xx; b->xy = xy; - b->yx = yx; b->yy = yy; + xx = ADD_LONG( FT_MulDiv( a->xx, b->xx, val ), + FT_MulDiv( a->xy, b->yx, val ) ); + xy = ADD_LONG( FT_MulDiv( a->xx, b->xy, val ), + FT_MulDiv( a->xy, b->yy, val ) ); + yx = ADD_LONG( FT_MulDiv( a->yx, b->xx, val ), + FT_MulDiv( a->yy, b->yx, val ) ); + yy = ADD_LONG( FT_MulDiv( a->yx, b->xy, val ), + FT_MulDiv( a->yy, b->yy, val ) ); + + b->xx = xx; + b->xy = xy; + b->yx = yx; + b->yy = yy; } @@ -747,11 +760,10 @@ if ( !vector || !matrix ) return; - xz = FT_MulDiv( vector->x, matrix->xx, val ) + - FT_MulDiv( vector->y, matrix->xy, val ); - - yz = FT_MulDiv( vector->x, matrix->yx, val ) + - FT_MulDiv( vector->y, matrix->yy, val ); + xz = ADD_LONG( FT_MulDiv( vector->x, matrix->xx, val ), + FT_MulDiv( vector->y, matrix->xy, val ) ); + yz = ADD_LONG( FT_MulDiv( vector->x, matrix->yx, val ), + FT_MulDiv( vector->y, matrix->yy, val ) ); vector->x = xz; vector->y = yz; @@ -770,12 +782,12 @@ FT_Int sx = 1, sy = 1, shift; - FT_MOVE_SIGN( x_, sx ); - FT_MOVE_SIGN( y_, sy ); - x = (FT_UInt32)x_; y = (FT_UInt32)y_; + FT_MOVE_SIGN( x_, x, sx ); + FT_MOVE_SIGN( y_, y, sy ); + /* trivial cases */ if ( x == 0 ) { @@ -913,11 +925,13 @@ FT_Int result; - if ( (FT_ULong)FT_ABS( in_x ) + (FT_ULong)FT_ABS( out_y ) <= 131071UL && - (FT_ULong)FT_ABS( in_y ) + (FT_ULong)FT_ABS( out_x ) <= 131071UL ) + /* we silently ignore overflow errors, since such large values */ + /* lead to even more (harmless) rendering errors later on */ + if ( ADD_LONG( FT_ABS( in_x ), FT_ABS( out_y ) ) <= 131071L && + ADD_LONG( FT_ABS( in_y ), FT_ABS( out_x ) ) <= 131071L ) { - FT_Long z1 = in_x * out_y; - FT_Long z2 = in_y * out_x; + FT_Long z1 = MUL_LONG( in_x, out_y ); + FT_Long z2 = MUL_LONG( in_y, out_x ); if ( z1 > z2 ) diff --git a/src/base/ftcid.c b/src/base/ftcid.c index 398396b84..f5184649b 100644 --- a/src/base/ftcid.c +++ b/src/base/ftcid.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing CID font information. */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* Derek Clegg and Michael Toftdal. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c index 242246bfd..c33d8acb4 100644 --- a/src/base/ftdbgmem.c +++ b/src/base/ftdbgmem.c @@ -4,7 +4,7 @@ /* */ /* Memory debugger (body). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -826,7 +826,7 @@ FT_Int result = 0; - if ( getenv( "FT2_DEBUG_MEMORY" ) ) + if ( ft_getenv( "FT2_DEBUG_MEMORY" ) ) { table = ft_mem_table_new( memory ); if ( table ) @@ -839,7 +839,7 @@ memory->realloc = ft_mem_debug_realloc; memory->free = ft_mem_debug_free; - p = getenv( "FT2_ALLOC_TOTAL_MAX" ); + p = ft_getenv( "FT2_ALLOC_TOTAL_MAX" ); if ( p ) { FT_Long total_max = ft_strtol( p, NULL, 10 ); @@ -852,7 +852,7 @@ } } - p = getenv( "FT2_ALLOC_COUNT_MAX" ); + p = ft_getenv( "FT2_ALLOC_COUNT_MAX" ); if ( p ) { FT_Long total_count = ft_strtol( p, NULL, 10 ); @@ -865,7 +865,7 @@ } } - p = getenv( "FT2_KEEP_ALIVE" ); + p = ft_getenv( "FT2_KEEP_ALIVE" ); if ( p ) { FT_Long keep_alive = ft_strtol( p, NULL, 10 ); diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c index 20c617089..fe2630910 100644 --- a/src/base/ftdebug.c +++ b/src/base/ftdebug.c @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -161,7 +161,7 @@ FT_BASE_DEF( void ) ft_debug_init( void ) { - const char* ft2_debug = getenv( "FT2_DEBUG" ); + const char* ft2_debug = ft_getenv( "FT2_DEBUG" ); if ( ft2_debug ) diff --git a/src/base/ftfntfmt.c b/src/base/ftfntfmt.c index dcbeba005..a2900ceb0 100644 --- a/src/base/ftfntfmt.c +++ b/src/base/ftfntfmt.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file for font formats (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftfstype.c b/src/base/ftfstype.c index cec4fb302..e6cdf6e2e 100644 --- a/src/base/ftfstype.c +++ b/src/base/ftfstype.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file to access FSType data (body). */ /* */ -/* Copyright 2008-2017 by */ +/* Copyright 2008-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftgasp.c b/src/base/ftgasp.c index 477b72558..4f80bba63 100644 --- a/src/base/ftgasp.c +++ b/src/base/ftgasp.c @@ -4,7 +4,7 @@ /* */ /* Access of TrueType's `gasp' table (body). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftgloadr.c b/src/base/ftgloadr.c index 8134003b4..47202496b 100644 --- a/src/base/ftgloadr.c +++ b/src/base/ftgloadr.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph loader (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c index 9bfb33050..6759aa25d 100644 --- a/src/base/ftglyph.c +++ b/src/base/ftglyph.c @@ -4,7 +4,7 @@ /* */ /* FreeType convenience functions to handle glyphs (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -408,12 +408,28 @@ goto Exit; /* copy advance while converting 26.6 to 16.16 format */ + if ( slot->advance.x >= 0x8000L * 64 || + slot->advance.x <= -0x8000L * 64 ) + { + FT_ERROR(( "FT_Get_Glyph: advance width too large\n" )); + error = FT_THROW( Invalid_Argument ); + goto Exit2; + } + if ( slot->advance.y >= 0x8000L * 64 || + slot->advance.y <= -0x8000L * 64 ) + { + FT_ERROR(( "FT_Get_Glyph: advance height too large\n" )); + error = FT_THROW( Invalid_Argument ); + goto Exit2; + } + glyph->advance.x = slot->advance.x * 1024; glyph->advance.y = slot->advance.y * 1024; /* now import the image from the glyph slot */ error = clazz->glyph_init( glyph, slot ); + Exit2: /* if an error occurred, destroy the glyph */ if ( error ) FT_Done_Glyph( glyph ); diff --git a/src/base/ftgxval.c b/src/base/ftgxval.c index ff24d336d..19e2d6acb 100644 --- a/src/base/ftgxval.c +++ b/src/base/ftgxval.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating TrueTypeGX/AAT tables (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO, Redhat K.K, */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/base/ftinit.c b/src/base/ftinit.c index b3b08fa54..1fa472109 100644 --- a/src/base/ftinit.c +++ b/src/base/ftinit.c @@ -4,7 +4,7 @@ /* */ /* FreeType initialization layer (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c index 515d8adab..71e7eca05 100644 --- a/src/base/ftlcdfil.c +++ b/src/base/ftlcdfil.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for color filtering of subpixel bitmap glyphs (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,141 +29,140 @@ /* define USE_LEGACY to implement the legacy filter */ #define USE_LEGACY +#define FT_SHIFTCLAMP( x ) ( x >>= 8, (FT_Byte)( x > 255 ? 255 : x ) ) + + + /* add padding according to filter weights */ + FT_BASE_DEF (void) + ft_lcd_padding( FT_Pos* Min, + FT_Pos* Max, + FT_GlyphSlot slot ) + { + FT_Byte* lcd_weights; + FT_Bitmap_LcdFilterFunc lcd_filter_func; + + + /* Per-face LCD filtering takes priority if set up. */ + if ( slot->face && slot->face->internal->lcd_filter_func ) + { + lcd_weights = slot->face->internal->lcd_weights; + lcd_filter_func = slot->face->internal->lcd_filter_func; + } + else + { + lcd_weights = slot->library->lcd_weights; + lcd_filter_func = slot->library->lcd_filter_func; + } + + if ( lcd_filter_func == ft_lcd_filter_fir ) + { + *Min -= lcd_weights[0] ? 43 : + lcd_weights[1] ? 22 : 0; + *Max += lcd_weights[4] ? 43 : + lcd_weights[3] ? 22 : 0; + } + } + + /* FIR filter used by the default and light filters */ - FT_BASE( void ) + FT_BASE_DEF( void ) ft_lcd_filter_fir( FT_Bitmap* bitmap, FT_Render_Mode mode, FT_LcdFiveTapFilter weights ) { - FT_UInt width = (FT_UInt)bitmap->width; - FT_UInt height = (FT_UInt)bitmap->rows; + FT_UInt width = (FT_UInt)bitmap->width; + FT_UInt height = (FT_UInt)bitmap->rows; + FT_Int pitch = bitmap->pitch; + FT_Byte* origin = bitmap->buffer; + + /* take care of bitmap flow */ + if ( pitch > 0 && height > 0 ) + origin += pitch * (FT_Int)( height - 1 ); /* horizontal in-place FIR filter */ - if ( mode == FT_RENDER_MODE_LCD && width >= 4 ) + if ( mode == FT_RENDER_MODE_LCD && width >= 2 ) { - FT_Byte* line = bitmap->buffer; - + FT_Byte* line = origin; - /* take care of bitmap flow */ - if ( bitmap->pitch < 0 ) - line -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); - /* `fir' and `pix' must be at least 32 bit wide, since the sum of */ - /* the values in `weights' can exceed 0xFF */ + /* `fir' must be at least 32 bit wide, since the sum of */ + /* the values in `weights' can exceed 0xFF */ - for ( ; height > 0; height--, line += bitmap->pitch ) + for ( ; height > 0; height--, line -= pitch ) { - FT_UInt fir[4]; /* below, `pix' is used as the 5th element */ - FT_UInt val1, xx; + FT_UInt fir[5]; + FT_UInt val, xx; - val1 = line[0]; - fir[0] = weights[2] * val1; - fir[1] = weights[3] * val1; - fir[2] = weights[4] * val1; - fir[3] = 0; + val = line[0]; + fir[2] = weights[2] * val; + fir[3] = weights[3] * val; + fir[4] = weights[4] * val; - val1 = line[1]; - fir[0] += weights[1] * val1; - fir[1] += weights[2] * val1; - fir[2] += weights[3] * val1; - fir[3] += weights[4] * val1; + val = line[1]; + fir[1] = fir[2] + weights[1] * val; + fir[2] = fir[3] + weights[2] * val; + fir[3] = fir[4] + weights[3] * val; + fir[4] = weights[4] * val; for ( xx = 2; xx < width; xx++ ) { - FT_UInt val, pix; - - val = line[xx]; - pix = fir[0] + weights[0] * val; - fir[0] = fir[1] + weights[1] * val; - fir[1] = fir[2] + weights[2] * val; - fir[2] = fir[3] + weights[3] * val; - fir[3] = weights[4] * val; - - pix >>= 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - line[xx - 2] = (FT_Byte)pix; - } - - { - FT_UInt pix; + fir[0] = fir[1] + weights[0] * val; + fir[1] = fir[2] + weights[1] * val; + fir[2] = fir[3] + weights[2] * val; + fir[3] = fir[4] + weights[3] * val; + fir[4] = weights[4] * val; - - pix = fir[0] >> 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - line[xx - 2] = (FT_Byte)pix; - - pix = fir[1] >> 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - line[xx - 1] = (FT_Byte)pix; + line[xx - 2] = FT_SHIFTCLAMP( fir[0] ); } + + line[xx - 2] = FT_SHIFTCLAMP( fir[1] ); + line[xx - 1] = FT_SHIFTCLAMP( fir[2] ); } } /* vertical in-place FIR filter */ - else if ( mode == FT_RENDER_MODE_LCD_V && height >= 4 ) + else if ( mode == FT_RENDER_MODE_LCD_V && height >= 2 ) { - FT_Byte* column = bitmap->buffer; - FT_Int pitch = bitmap->pitch; + FT_Byte* column = origin; - /* take care of bitmap flow */ - if ( bitmap->pitch < 0 ) - column -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); - for ( ; width > 0; width--, column++ ) { FT_Byte* col = column; - FT_UInt fir[4]; /* below, `pix' is used as the 5th element */ - FT_UInt val1, yy; + FT_UInt fir[5]; + FT_UInt val, yy; - val1 = col[0]; - fir[0] = weights[2] * val1; - fir[1] = weights[3] * val1; - fir[2] = weights[4] * val1; - fir[3] = 0; - col += pitch; + val = col[0]; + fir[2] = weights[2] * val; + fir[3] = weights[3] * val; + fir[4] = weights[4] * val; + col -= pitch; - val1 = col[0]; - fir[0] += weights[1] * val1; - fir[1] += weights[2] * val1; - fir[2] += weights[3] * val1; - fir[3] += weights[4] * val1; - col += pitch; + val = col[0]; + fir[1] = fir[2] + weights[1] * val; + fir[2] = fir[3] + weights[2] * val; + fir[3] = fir[4] + weights[3] * val; + fir[4] = weights[4] * val; + col -= pitch; - for ( yy = 2; yy < height; yy++ ) + for ( yy = 2; yy < height; yy++, col -= pitch ) { - FT_UInt val, pix; - - val = col[0]; - pix = fir[0] + weights[0] * val; - fir[0] = fir[1] + weights[1] * val; - fir[1] = fir[2] + weights[2] * val; - fir[2] = fir[3] + weights[3] * val; - fir[3] = weights[4] * val; - - pix >>= 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - col[-2 * pitch] = (FT_Byte)pix; - col += pitch; - } - - { - FT_UInt pix; - - - pix = fir[0] >> 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - col[-2 * pitch] = (FT_Byte)pix; + fir[0] = fir[1] + weights[0] * val; + fir[1] = fir[2] + weights[1] * val; + fir[2] = fir[3] + weights[2] * val; + fir[3] = fir[4] + weights[3] * val; + fir[4] = weights[4] * val; - pix = fir[1] >> 8; - pix |= (FT_UInt)-(FT_Int)( pix >> 8 ); - col[-pitch] = (FT_Byte)pix; + col[pitch * 2] = FT_SHIFTCLAMP( fir[0] ); } + + col[pitch * 2] = FT_SHIFTCLAMP( fir[1] ); + col[pitch] = FT_SHIFTCLAMP( fir[2] ); } } } @@ -177,9 +176,10 @@ FT_Render_Mode mode, FT_Byte* weights ) { - FT_UInt width = (FT_UInt)bitmap->width; - FT_UInt height = (FT_UInt)bitmap->rows; - FT_Int pitch = bitmap->pitch; + FT_UInt width = (FT_UInt)bitmap->width; + FT_UInt height = (FT_UInt)bitmap->rows; + FT_Int pitch = bitmap->pitch; + FT_Byte* origin = bitmap->buffer; static const unsigned int filters[3][3] = { @@ -191,33 +191,31 @@ FT_UNUSED( weights ); + /* take care of bitmap flow */ + if ( pitch > 0 && height > 0 ) + origin += pitch * (FT_Int)( height - 1 ); + /* horizontal in-place intra-pixel filter */ if ( mode == FT_RENDER_MODE_LCD && width >= 3 ) { - FT_Byte* line = bitmap->buffer; - + FT_Byte* line = origin; - /* take care of bitmap flow */ - if ( bitmap->pitch < 0 ) - line -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); - for ( ; height > 0; height--, line += pitch ) + for ( ; height > 0; height--, line -= pitch ) { FT_UInt xx; for ( xx = 0; xx < width; xx += 3 ) { - FT_UInt r = 0; - FT_UInt g = 0; - FT_UInt b = 0; + FT_UInt r, g, b; FT_UInt p; p = line[xx]; - r += filters[0][0] * p; - g += filters[0][1] * p; - b += filters[0][2] * p; + r = filters[0][0] * p; + g = filters[0][1] * p; + b = filters[0][2] * p; p = line[xx + 1]; r += filters[1][0] * p; @@ -237,31 +235,24 @@ } else if ( mode == FT_RENDER_MODE_LCD_V && height >= 3 ) { - FT_Byte* column = bitmap->buffer; + FT_Byte* column = origin; - /* take care of bitmap flow */ - if ( bitmap->pitch < 0 ) - column -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); - for ( ; width > 0; width--, column++ ) { - FT_Byte* col = column; - FT_Byte* col_end = col + (FT_Int)height * pitch; + FT_Byte* col = column - 2 * pitch; - for ( ; col < col_end; col += 3 * pitch ) + for ( ; height > 0; height -= 3, col -= 3 * pitch ) { - FT_UInt r = 0; - FT_UInt g = 0; - FT_UInt b = 0; + FT_UInt r, g, b; FT_UInt p; p = col[0]; - r += filters[0][0] * p; - g += filters[0][1] * p; - b += filters[0][2] * p; + r = filters[0][0] * p; + g = filters[0][1] * p; + b = filters[0][2] * p; p = col[pitch]; r += filters[1][0] * p; @@ -275,7 +266,7 @@ col[0] = (FT_Byte)( r / 65536 ); col[pitch] = (FT_Byte)( g / 65536 ); - col[2 * pitch] = (FT_Byte)( b / 65536 ); + col[pitch * 2] = (FT_Byte)( b / 65536 ); } } } @@ -296,7 +287,6 @@ ft_memcpy( library->lcd_weights, weights, FT_LCD_FILTER_FIVE_TAPS ); library->lcd_filter_func = ft_lcd_filter_fir; - library->lcd_extra = 2; return FT_Err_Ok; } @@ -319,7 +309,6 @@ { case FT_LCD_FILTER_NONE: library->lcd_filter_func = NULL; - library->lcd_extra = 0; break; case FT_LCD_FILTER_DEFAULT: @@ -327,7 +316,6 @@ default_weights, FT_LCD_FILTER_FIVE_TAPS ); library->lcd_filter_func = ft_lcd_filter_fir; - library->lcd_extra = 2; break; case FT_LCD_FILTER_LIGHT: @@ -335,7 +323,6 @@ light_weights, FT_LCD_FILTER_FIVE_TAPS ); library->lcd_filter_func = ft_lcd_filter_fir; - library->lcd_extra = 2; break; #ifdef USE_LEGACY @@ -343,7 +330,6 @@ case FT_LCD_FILTER_LEGACY: case FT_LCD_FILTER_LEGACY1: library->lcd_filter_func = _ft_lcd_filter_legacy; - library->lcd_extra = 0; break; #endif @@ -352,21 +338,21 @@ return FT_THROW( Invalid_Argument ); } - library->lcd_filter = filter; - return FT_Err_Ok; } #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - FT_BASE( void ) - ft_lcd_filter_fir( FT_Bitmap* bitmap, - FT_Render_Mode mode, - FT_LcdFiveTapFilter weights ) + /* add padding according to accommodate outline shifts */ + FT_BASE_DEF (void) + ft_lcd_padding( FT_Pos* Min, + FT_Pos* Max, + FT_GlyphSlot slot ) { - FT_UNUSED( bitmap ); - FT_UNUSED( mode ); - FT_UNUSED( weights ); + FT_UNUSED( slot ); + + *Min -= 21; + *Max += 21; } diff --git a/src/base/ftmac.c b/src/base/ftmac.c index fb70606b7..fd4c0cc27 100644 --- a/src/base/ftmac.c +++ b/src/base/ftmac.c @@ -8,7 +8,7 @@ /* This file is for Mac OS X only; see builds/mac/ftoldmac.c for */ /* classic platforms built by MPW. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -71,6 +71,9 @@ #include FT_INTERNAL_STREAM_H #include "ftbase.h" + +#ifdef FT_MACINTOSH + /* This is for Mac OS X. Without redefinition, OS_INLINE */ /* expands to `static inline' which doesn't survive the */ /* -ansi compilation flag of GCC. */ @@ -118,8 +121,6 @@ #endif -#ifdef FT_MACINTOSH - /* This function is deprecated because FSSpec is deprecated in Mac OS X */ FT_EXPORT_DEF( FT_Error ) FT_GetFile_From_Mac_Name( const char* fontName, @@ -1004,7 +1005,7 @@ /* accepts an FSRef instead of a path. */ /* */ /* This function is deprecated because Carbon data types (FSRef) */ - /* are not cross-platform, and thus not suitable for the freetype API. */ + /* are not cross-platform, and thus not suitable for the FreeType API. */ FT_EXPORT_DEF( FT_Error ) FT_New_Face_From_FSRef( FT_Library library, const FSRef* ref, @@ -1076,7 +1077,12 @@ #endif } -#endif /* FT_MACINTOSH */ +#else /* !FT_MACINTOSH */ + + /* ANSI C doesn't like empty source files */ + typedef int _ft_mac_dummy; + +#endif /* !FT_MACINTOSH */ /* END */ diff --git a/src/base/ftmm.c b/src/base/ftmm.c index 6aaa5f8b0..800441bca 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -4,7 +4,7 @@ /* */ /* Multiple Master font support (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -145,6 +145,25 @@ } + /* documentation is in ftmm.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Done_MM_Var( FT_Library library, + FT_MM_Var* amaster ) + { + FT_Memory memory; + + + if ( !library ) + return FT_THROW( Invalid_Library_Handle ); + + memory = library->memory; + FT_FREE( amaster ); + + return FT_Err_Ok; + } + + /* documentation is in ftmm.h */ FT_EXPORT_DEF( FT_Error ) @@ -158,7 +177,7 @@ /* check of `face' delayed to `ft_face_get_mm_service' */ - if ( !coords ) + if ( num_coords && !coords ) return FT_THROW( Invalid_Argument ); error = ft_face_get_mm_service( face, &service ); @@ -194,7 +213,7 @@ /* check of `face' delayed to `ft_face_get_mm_service' */ - if ( !coords ) + if ( num_coords && !coords ) return FT_THROW( Invalid_Argument ); error = ft_face_get_mm_service( face, &service_mm ); @@ -203,14 +222,17 @@ error = FT_ERR( Invalid_Argument ); if ( service_mm->set_var_design ) error = service_mm->set_var_design( face, num_coords, coords ); - } - if ( !error ) - error = ft_face_get_mvar_service( face, &service_mvar ); + /* internal error code -1 means `no change'; we can exit immediately */ + if ( error == -1 ) + return FT_Err_Ok; + } if ( !error ) { - if ( service_mvar->metrics_adjust ) + (void)ft_face_get_mvar_service( face, &service_mvar ); + + if ( service_mvar && service_mvar->metrics_adjust ) service_mvar->metrics_adjust( face ); } @@ -267,7 +289,7 @@ /* check of `face' delayed to `ft_face_get_mm_service' */ - if ( !coords ) + if ( num_coords && !coords ) return FT_THROW( Invalid_Argument ); error = ft_face_get_mm_service( face, &service_mm ); @@ -276,14 +298,17 @@ error = FT_ERR( Invalid_Argument ); if ( service_mm->set_mm_blend ) error = service_mm->set_mm_blend( face, num_coords, coords ); - } - if ( !error ) - error = ft_face_get_mvar_service( face, &service_mvar ); + /* internal error code -1 means `no change'; we can exit immediately */ + if ( error == -1 ) + return FT_Err_Ok; + } if ( !error ) { - if ( service_mvar->metrics_adjust ) + (void)ft_face_get_mvar_service( face, &service_mvar ); + + if ( service_mvar && service_mvar->metrics_adjust ) service_mvar->metrics_adjust( face ); } @@ -315,7 +340,7 @@ /* check of `face' delayed to `ft_face_get_mm_service' */ - if ( !coords ) + if ( num_coords && !coords ) return FT_THROW( Invalid_Argument ); error = ft_face_get_mm_service( face, &service_mm ); @@ -324,14 +349,17 @@ error = FT_ERR( Invalid_Argument ); if ( service_mm->set_mm_blend ) error = service_mm->set_mm_blend( face, num_coords, coords ); - } - if ( !error ) - error = ft_face_get_mvar_service( face, &service_mvar ); + /* internal error code -1 means `no change'; we can exit immediately */ + if ( error == -1 ) + return FT_Err_Ok; + } if ( !error ) { - if ( service_mvar->metrics_adjust ) + (void)ft_face_get_mvar_service( face, &service_mvar ); + + if ( service_mvar && service_mvar->metrics_adjust ) service_mvar->metrics_adjust( face ); } @@ -405,4 +433,76 @@ } + /* documentation is in ftmm.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Get_Var_Axis_Flags( FT_MM_Var* master, + FT_UInt axis_index, + FT_UInt* flags ) + { + FT_UShort* axis_flags; + + + if ( !master || !flags ) + return FT_THROW( Invalid_Argument ); + + if ( axis_index >= master->num_axis ) + return FT_THROW( Invalid_Argument ); + + /* the axis flags array immediately follows the data of `master' */ + axis_flags = (FT_UShort*)&( master[1] ); + *flags = axis_flags[axis_index]; + + return FT_Err_Ok; + } + + + /* documentation is in ftmm.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Set_Named_Instance( FT_Face face, + FT_UInt instance_index ) + { + FT_Error error; + + FT_Service_MultiMasters service_mm = NULL; + FT_Service_MetricsVariations service_mvar = NULL; + + + /* check of `face' delayed to `ft_face_get_mm_service' */ + + error = ft_face_get_mm_service( face, &service_mm ); + if ( !error ) + { + error = FT_ERR( Invalid_Argument ); + if ( service_mm->set_instance ) + error = service_mm->set_instance( face, instance_index ); + } + + if ( !error ) + { + (void)ft_face_get_mvar_service( face, &service_mvar ); + + if ( service_mvar && service_mvar->metrics_adjust ) + service_mvar->metrics_adjust( face ); + } + + /* enforce recomputation of auto-hinting data */ + if ( !error && face->autohint.finalizer ) + { + face->autohint.finalizer( face->autohint.data ); + face->autohint.data = NULL; + } + + if ( !error ) + { + face->face_index = ( instance_index << 16 ) | + ( face->face_index & 0xFFFFL ); + face->face_flags &= ~FT_FACE_FLAG_VARIATION; + } + + return error; + } + + /* END */ diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index f86369e18..8d07e35ae 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,12 +19,16 @@ #include #include FT_LIST_H #include FT_OUTLINE_H +#include FT_FONT_FORMATS_H + #include FT_INTERNAL_VALIDATE_H #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_RFORK_H #include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_SFNT_H /* for SFNT_Load_Table_Func */ +#include FT_INTERNAL_SFNT_H /* for SFNT_Load_Table_Func */ +#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for PS_Driver */ + #include FT_TRUETYPE_TABLES_H #include FT_TRUETYPE_TAGS_H #include FT_TRUETYPE_IDS_H @@ -37,8 +41,7 @@ #include FT_SERVICE_KERNING_H #include FT_SERVICE_TRUETYPE_ENGINE_H -#include FT_AUTOHINTER_H -#include FT_CFF_DRIVER_H +#include FT_DRIVER_H #ifdef FT_CONFIG_OPTION_MAC_FONTS #include "ftbase.h" @@ -327,6 +330,138 @@ } + FT_BASE_DEF( void ) + ft_glyphslot_preset_bitmap( FT_GlyphSlot slot, + FT_Render_Mode mode, + const FT_Vector* origin ) + { + FT_Outline* outline = &slot->outline; + FT_Bitmap* bitmap = &slot->bitmap; + + FT_Pixel_Mode pixel_mode; + + FT_BBox cbox; + FT_Pos x_shift = 0; + FT_Pos y_shift = 0; + FT_Pos x_left, y_top; + FT_Pos width, height, pitch; + + + if ( slot->internal && ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) ) + return; + + if ( origin ) + { + x_shift = origin->x; + y_shift = origin->y; + } + + /* compute the control box, and grid-fit it, */ + /* taking into account the origin shift */ + FT_Outline_Get_CBox( outline, &cbox ); + + cbox.xMin += x_shift; + cbox.yMin += y_shift; + cbox.xMax += x_shift; + cbox.yMax += y_shift; + + switch ( mode ) + { + case FT_RENDER_MODE_MONO: + pixel_mode = FT_PIXEL_MODE_MONO; +#if 1 + /* undocumented but confirmed: bbox values get rounded */ + /* unless the rounded box can collapse for a narrow glyph */ + if ( cbox.xMax - cbox.xMin < 64 ) + { + cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); + cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax ); + } + else + { + cbox.xMin = FT_PIX_ROUND_LONG( cbox.xMin ); + cbox.xMax = FT_PIX_ROUND_LONG( cbox.xMax ); + } + + if ( cbox.yMax - cbox.yMin < 64 ) + { + cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); + cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax ); + } + else + { + cbox.yMin = FT_PIX_ROUND_LONG( cbox.yMin ); + cbox.yMax = FT_PIX_ROUND_LONG( cbox.yMax ); + } +#else + cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); + cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); + cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax ); + cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax ); +#endif + break; + + case FT_RENDER_MODE_LCD: + pixel_mode = FT_PIXEL_MODE_LCD; + ft_lcd_padding( &cbox.xMin, &cbox.xMax, slot ); + goto Round; + + case FT_RENDER_MODE_LCD_V: + pixel_mode = FT_PIXEL_MODE_LCD_V; + ft_lcd_padding( &cbox.yMin, &cbox.yMax, slot ); + goto Round; + + case FT_RENDER_MODE_NORMAL: + case FT_RENDER_MODE_LIGHT: + default: + pixel_mode = FT_PIXEL_MODE_GRAY; + Round: + cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); + cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); + cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax ); + cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax ); + } + + x_shift = SUB_LONG( x_shift, cbox.xMin ); + y_shift = SUB_LONG( y_shift, cbox.yMin ); + + x_left = cbox.xMin >> 6; + y_top = cbox.yMax >> 6; + + width = ( (FT_ULong)cbox.xMax - (FT_ULong)cbox.xMin ) >> 6; + height = ( (FT_ULong)cbox.yMax - (FT_ULong)cbox.yMin ) >> 6; + + switch ( pixel_mode ) + { + case FT_PIXEL_MODE_MONO: + pitch = ( ( width + 15 ) >> 4 ) << 1; + break; + + case FT_PIXEL_MODE_LCD: + width *= 3; + pitch = FT_PAD_CEIL( width, 4 ); + break; + + case FT_PIXEL_MODE_LCD_V: + height *= 3; + /* fall through */ + + case FT_PIXEL_MODE_GRAY: + default: + pitch = width; + } + + slot->bitmap_left = (FT_Int)x_left; + slot->bitmap_top = (FT_Int)y_top; + + bitmap->pixel_mode = (unsigned char)pixel_mode; + bitmap->num_grays = 256; + bitmap->width = (unsigned int)width; + bitmap->rows = (unsigned int)height; + bitmap->pitch = pitch; + } + + FT_BASE_DEF( void ) ft_glyphslot_set_bitmap( FT_GlyphSlot slot, FT_Byte* buffer ) @@ -579,34 +714,42 @@ if ( vertical ) { metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX ); - metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY ); + metrics->horiBearingY = FT_PIX_CEIL_LONG( metrics->horiBearingY ); - right = FT_PIX_CEIL( metrics->vertBearingX + metrics->width ); - bottom = FT_PIX_CEIL( metrics->vertBearingY + metrics->height ); + right = FT_PIX_CEIL_LONG( ADD_LONG( metrics->vertBearingX, + metrics->width ) ); + bottom = FT_PIX_CEIL_LONG( ADD_LONG( metrics->vertBearingY, + metrics->height ) ); metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX ); metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY ); - metrics->width = right - metrics->vertBearingX; - metrics->height = bottom - metrics->vertBearingY; + metrics->width = SUB_LONG( right, + metrics->vertBearingX ); + metrics->height = SUB_LONG( bottom, + metrics->vertBearingY ); } else { metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX ); metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY ); - right = FT_PIX_CEIL ( metrics->horiBearingX + metrics->width ); - bottom = FT_PIX_FLOOR( metrics->horiBearingY - metrics->height ); + right = FT_PIX_CEIL_LONG( ADD_LONG( metrics->horiBearingX, + metrics->width ) ); + bottom = FT_PIX_FLOOR( SUB_LONG( metrics->horiBearingY, + metrics->height ) ); metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX ); - metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY ); + metrics->horiBearingY = FT_PIX_CEIL_LONG( metrics->horiBearingY ); - metrics->width = right - metrics->horiBearingX; - metrics->height = metrics->horiBearingY - bottom; + metrics->width = SUB_LONG( right, + metrics->horiBearingX ); + metrics->height = SUB_LONG( metrics->horiBearingY, + bottom ); } - metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance ); - metrics->vertAdvance = FT_PIX_ROUND( metrics->vertAdvance ); + metrics->horiAdvance = FT_PIX_ROUND_LONG( metrics->horiAdvance ); + metrics->vertAdvance = FT_PIX_ROUND_LONG( metrics->vertAdvance ); } #endif /* GRID_FIT_METRICS */ @@ -661,9 +804,13 @@ * Determine whether we need to auto-hint or not. * The general rules are: * - * - Do only auto-hinting if we have a hinter module, a scalable font - * format dealing with outlines, and no transforms except simple - * slants and/or rotations by integer multiples of 90 degrees. + * - Do only auto-hinting if we have + * + * - a hinter module, + * - a scalable font format dealing with outlines, + * - not a tricky font, and + * - no transforms except simple slants and/or rotations by + * integer multiples of 90 degrees. * * - Then, auto-hint if FT_LOAD_FORCE_AUTOHINT is set or if we don't * have a native font hinter. @@ -693,7 +840,14 @@ else { FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags ); + FT_Bool is_light_type1; + + /* only the new Adobe engine (for both CFF and Type 1) is `light'; */ + /* we use `strstr' to catch both `Type 1' and `CID Type 1' */ + is_light_type1 = + ft_strstr( FT_Get_Font_Format( face ), "Type 1" ) != NULL && + ((PS_Driver)driver)->hinting_engine == FT_HINTING_ADOBE; /* the check for `num_locations' assures that we actually */ /* test for instructions in a TTF and not in a CFF-based OTF */ @@ -702,8 +856,9 @@ /* check the size of the `fpgm' and `prep' tables, too -- */ /* the assumption is that there don't exist real TTFs where */ /* both `fpgm' and `prep' tables are missing */ - if ( ( mode == FT_RENDER_MODE_LIGHT && - !FT_DRIVER_HINTS_LIGHTLY( driver ) ) || + if ( ( mode == FT_RENDER_MODE_LIGHT && + ( !FT_DRIVER_HINTS_LIGHTLY( driver ) && + !is_light_type1 ) ) || ( FT_IS_SFNT( face ) && ttface->num_locations && ttface->max_profile.maxSizeOfInstructions == 0 && @@ -723,8 +878,8 @@ /* XXX: This is really a temporary hack that should disappear */ /* promptly with FreeType 2.1! */ /* */ - if ( FT_HAS_FIXED_SIZES( face ) && - ( load_flags & FT_LOAD_NO_BITMAP ) == 0 ) + if ( FT_HAS_FIXED_SIZES( face ) && + ( load_flags & FT_LOAD_NO_BITMAP ) == 0 ) { error = driver->clazz->load_glyph( slot, face->size, glyph_index, @@ -792,7 +947,7 @@ /* compute the linear advance in 16.16 pixels */ if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 && - ( FT_IS_SCALABLE( face ) ) ) + FT_IS_SCALABLE( face ) ) { FT_Size_Metrics* metrics = &face->size->metrics; @@ -840,28 +995,37 @@ } } - FT_TRACE5(( " x advance: %d\n" , slot->advance.x )); - FT_TRACE5(( " y advance: %d\n" , slot->advance.y )); - - FT_TRACE5(( " linear x advance: %d\n" , slot->linearHoriAdvance )); - FT_TRACE5(( " linear y advance: %d\n" , slot->linearVertAdvance )); - - /* do we need to render the image now? */ + /* do we need to render the image or preset the bitmap now? */ if ( !error && + ( load_flags & FT_LOAD_NO_SCALE ) == 0 && slot->format != FT_GLYPH_FORMAT_BITMAP && - slot->format != FT_GLYPH_FORMAT_COMPOSITE && - load_flags & FT_LOAD_RENDER ) + slot->format != FT_GLYPH_FORMAT_COMPOSITE ) { FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags ); - if ( mode == FT_RENDER_MODE_NORMAL && - (load_flags & FT_LOAD_MONOCHROME ) ) + if ( mode == FT_RENDER_MODE_NORMAL && + load_flags & FT_LOAD_MONOCHROME ) mode = FT_RENDER_MODE_MONO; - error = FT_Render_Glyph( slot, mode ); + if ( load_flags & FT_LOAD_RENDER ) + error = FT_Render_Glyph( slot, mode ); + else + ft_glyphslot_preset_bitmap( slot, mode, NULL ); } + FT_TRACE5(( "FT_Load_Glyph: index %d, flags %x\n", + glyph_index, load_flags )); + FT_TRACE5(( " x advance: %f\n", slot->advance.x / 64.0 )); + FT_TRACE5(( " y advance: %f\n", slot->advance.y / 64.0 )); + FT_TRACE5(( " linear x advance: %f\n", + slot->linearHoriAdvance / 65536.0 )); + FT_TRACE5(( " linear y advance: %f\n", + slot->linearVertAdvance / 65536.0 )); + FT_TRACE5(( " bitmap %dx%d, mode %d\n", + slot->bitmap.width, slot->bitmap.rows, + slot->bitmap.pixel_mode )); + Exit: return error; } @@ -2404,7 +2568,7 @@ if ( bsize->height < 0 || bsize->x_ppem < 0 || bsize->y_ppem < 0 ) { FT_TRACE0(( "FT_Open_Face:" - " Invalid bitmap dimensions for stroke %d," + " Invalid bitmap dimensions for strike %d," " now disabled\n", i )); bsize->width = 0; bsize->height = 0; @@ -2433,7 +2597,8 @@ internal->no_stem_darkening = -1; #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - ft_memset( internal->lcd_weights, 0, FT_LCD_FILTER_FIVE_TAPS ); + /* Per-face filtering can only be set up by FT_Face_Properties */ + internal->lcd_filter_func = NULL; #endif } @@ -2605,6 +2770,8 @@ FT_Size size = NULL; FT_ListNode node = NULL; + FT_Size_Internal internal = NULL; + if ( !face ) return FT_THROW( Invalid_Face_Handle ); @@ -2627,8 +2794,10 @@ size->face = face; - /* for now, do not use any internal fields in size objects */ - size->internal = NULL; + if ( FT_NEW( internal ) ) + goto Exit; + + size->internal = internal; if ( clazz->init_size ) error = clazz->init_size( size ); @@ -2852,18 +3021,6 @@ metrics->height = bsize->height << 6; metrics->max_advance = bsize->x_ppem; } - - FT_TRACE5(( "FT_Select_Metrics:\n" )); - FT_TRACE5(( " x scale: %d (%f)\n", - metrics->x_scale, metrics->x_scale / 65536.0 )); - FT_TRACE5(( " y scale: %d (%f)\n", - metrics->y_scale, metrics->y_scale / 65536.0 )); - FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); - FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); - FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); - FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); - FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); - FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); } @@ -2972,18 +3129,6 @@ metrics->x_scale = 1L << 16; metrics->y_scale = 1L << 16; } - - FT_TRACE5(( "FT_Request_Metrics:\n" )); - FT_TRACE5(( " x scale: %d (%f)\n", - metrics->x_scale, metrics->x_scale / 65536.0 )); - FT_TRACE5(( " y scale: %d (%f)\n", - metrics->y_scale, metrics->y_scale / 65536.0 )); - FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); - FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); - FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); - FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); - FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); - FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); } @@ -2993,6 +3138,7 @@ FT_Select_Size( FT_Face face, FT_Int strike_index ) { + FT_Error error = FT_Err_Ok; FT_Driver_Class clazz; @@ -3006,36 +3152,37 @@ if ( clazz->select_size ) { - FT_Error error; + error = clazz->select_size( face->size, (FT_ULong)strike_index ); + FT_TRACE5(( "FT_Select_Size (%s driver):\n", + face->driver->root.clazz->module_name )); + } + else + { + FT_Select_Metrics( face, (FT_ULong)strike_index ); - error = clazz->select_size( face->size, (FT_ULong)strike_index ); + FT_TRACE5(( "FT_Select_Size:\n" )); + } #ifdef FT_DEBUG_LEVEL_TRACE - { - FT_Size_Metrics* metrics = &face->size->metrics; - - - FT_TRACE5(( "FT_Select_Size (font driver's `select_size'):\n" )); - FT_TRACE5(( " x scale: %d (%f)\n", - metrics->x_scale, metrics->x_scale / 65536.0 )); - FT_TRACE5(( " y scale: %d (%f)\n", - metrics->y_scale, metrics->y_scale / 65536.0 )); - FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); - FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); - FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); - FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); - FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); - FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); - } -#endif + { + FT_Size_Metrics* metrics = &face->size->metrics; - return error; - } - FT_Select_Metrics( face, (FT_ULong)strike_index ); + FT_TRACE5(( " x scale: %d (%f)\n", + metrics->x_scale, metrics->x_scale / 65536.0 )); + FT_TRACE5(( " y scale: %d (%f)\n", + metrics->y_scale, metrics->y_scale / 65536.0 )); + FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); + FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); + FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); + FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); + FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); + FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); + } +#endif - return FT_Err_Ok; + return error; } @@ -3045,6 +3192,7 @@ FT_Request_Size( FT_Face face, FT_Size_Request req ) { + FT_Error error = FT_Err_Ok; FT_Driver_Class clazz; FT_ULong strike_index; @@ -3056,59 +3204,60 @@ req->type >= FT_SIZE_REQUEST_TYPE_MAX ) return FT_THROW( Invalid_Argument ); + /* signal the auto-hinter to recompute its size metrics */ + /* (if requested) */ + face->size->internal->autohint_metrics.x_scale = 0; + clazz = face->driver->clazz; if ( clazz->request_size ) { - FT_Error error; - - error = clazz->request_size( face->size, req ); -#ifdef FT_DEBUG_LEVEL_TRACE - { - FT_Size_Metrics* metrics = &face->size->metrics; - - - FT_TRACE5(( "FT_Request_Size (font driver's `request_size'):\n" )); - FT_TRACE5(( " x scale: %d (%f)\n", - metrics->x_scale, metrics->x_scale / 65536.0 )); - FT_TRACE5(( " y scale: %d (%f)\n", - metrics->y_scale, metrics->y_scale / 65536.0 )); - FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); - FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); - FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); - FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); - FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); - FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); - } -#endif - - return error; + FT_TRACE5(( "FT_Request_Size (%s driver):\n", + face->driver->root.clazz->module_name )); } - - /* - * The reason that a driver doesn't have `request_size' defined is - * either that the scaling here suffices or that the supported formats - * are bitmap-only and size matching is not implemented. - * - * In the latter case, a simple size matching is done. - */ - if ( !FT_IS_SCALABLE( face ) && FT_HAS_FIXED_SIZES( face ) ) + else if ( !FT_IS_SCALABLE( face ) && FT_HAS_FIXED_SIZES( face ) ) { - FT_Error error; - - + /* + * The reason that a driver doesn't have `request_size' defined is + * either that the scaling here suffices or that the supported formats + * are bitmap-only and size matching is not implemented. + * + * In the latter case, a simple size matching is done. + */ error = FT_Match_Size( face, req, 0, &strike_index ); if ( error ) return error; return FT_Select_Size( face, (FT_Int)strike_index ); } + else + { + FT_Request_Metrics( face, req ); - FT_Request_Metrics( face, req ); + FT_TRACE5(( "FT_Request_Size:\n" )); + } - return FT_Err_Ok; +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_Size_Metrics* metrics = &face->size->metrics; + + + FT_TRACE5(( " x scale: %d (%f)\n", + metrics->x_scale, metrics->x_scale / 65536.0 )); + FT_TRACE5(( " y scale: %d (%f)\n", + metrics->y_scale, metrics->y_scale / 65536.0 )); + FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); + FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); + FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); + FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); + FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); + FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); + } +#endif + + return error; } @@ -3637,16 +3786,11 @@ { #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING if ( properties->data ) + { ft_memcpy( face->internal->lcd_weights, properties->data, FT_LCD_FILTER_FIVE_TAPS ); - else - { - /* Value NULL indicates `no custom weights, use library */ - /* defaults', signaled by filling the weight field with zeros. */ - ft_memset( face->internal->lcd_weights, - 0, - FT_LCD_FILTER_FIVE_TAPS ); + face->internal->lcd_filter_func = ft_lcd_filter_fir; } #else error = FT_THROW( Unimplemented_Feature ); @@ -3709,12 +3853,14 @@ if ( charcode > 0xFFFFFFFFUL ) { - FT_TRACE1(( "FT_Get_Char_Index: too large charcode" )); + FT_TRACE1(( "FT_Face_GetCharVariantIndex:" + " too large charcode" )); FT_TRACE1(( " 0x%x is truncated\n", charcode )); } if ( variantSelector > 0xFFFFFFFFUL ) { - FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" )); + FT_TRACE1(( "FT_Face_GetCharVariantIndex:" + " too large variantSelector" )); FT_TRACE1(( " 0x%x is truncated\n", variantSelector )); } @@ -3750,12 +3896,14 @@ if ( charcode > 0xFFFFFFFFUL ) { - FT_TRACE1(( "FT_Get_Char_Index: too large charcode" )); + FT_TRACE1(( "FT_Face_GetCharVariantIsDefault:" + " too large charcode" )); FT_TRACE1(( " 0x%x is truncated\n", charcode )); } if ( variantSelector > 0xFFFFFFFFUL ) { - FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" )); + FT_TRACE1(( "FT_Face_GetCharVariantIsDefault:" + " too large variantSelector" )); FT_TRACE1(( " 0x%x is truncated\n", variantSelector )); } @@ -3818,7 +3966,7 @@ if ( charcode > 0xFFFFFFFFUL ) { - FT_TRACE1(( "FT_Get_Char_Index: too large charcode" )); + FT_TRACE1(( "FT_Face_GetVariantsOfChar: too large charcode" )); FT_TRACE1(( " 0x%x is truncated\n", charcode )); } @@ -4394,43 +4542,97 @@ */ /* we use FT_TRACE3 in this block */ - if ( ft_trace_levels[trace_bitmap] >= 3 ) + if ( !error && + ft_trace_levels[trace_bitmap] >= 3 && + slot->bitmap.buffer ) { + FT_Bitmap bitmap; + FT_Error err; + + + FT_Bitmap_Init( &bitmap ); + /* we convert to a single bitmap format for computing the checksum */ - if ( !error && slot->bitmap.buffer ) + /* this also converts the bitmap flow to `down' (i.e., pitch > 0) */ + err = FT_Bitmap_Convert( library, &slot->bitmap, &bitmap, 1 ); + if ( !err ) { - FT_Bitmap bitmap; - FT_Error err; + MD5_CTX ctx; + unsigned char md5[16]; + unsigned long coverage = 0; + int i, j; + int rows = (int)bitmap.rows; + int pitch = bitmap.pitch; + + + FT_TRACE3(( "FT_Render_Glyph: bitmap %dx%d, mode %d\n", + rows, pitch, slot->bitmap.pixel_mode )); + + for ( i = 0; i < rows; i++ ) + for ( j = 0; j < pitch; j++ ) + coverage += bitmap.buffer[i * pitch + j]; + FT_TRACE3(( " Total coverage: %lu\n", coverage )); - FT_Bitmap_Init( &bitmap ); + MD5_Init( &ctx ); + if ( bitmap.buffer ) + MD5_Update( &ctx, bitmap.buffer, + (unsigned long)rows * (unsigned long)pitch ); + MD5_Final( md5, &ctx ); - /* this also converts the bitmap flow to `down' (i.e., pitch > 0) */ - err = FT_Bitmap_Convert( library, &slot->bitmap, &bitmap, 1 ); - if ( !err ) + FT_TRACE3(( " MD5 checksum: " )); + for ( i = 0; i < 16; i++ ) + FT_TRACE3(( "%02X", md5[i] )); + FT_TRACE3(( "\n" )); + } + + FT_Bitmap_Done( library, &bitmap ); + } + + /* + * Dump bitmap in Netpbm format (PBM or PGM). + */ + + /* we use FT_TRACE7 in this block */ + if ( !error && + ft_trace_levels[trace_bitmap] >= 7 && + slot->bitmap.rows < 128U && + slot->bitmap.width < 128U && + slot->bitmap.buffer ) + { + int rows = (int)slot->bitmap.rows; + int width = (int)slot->bitmap.width; + int pitch = slot->bitmap.pitch; + int i, j, m; + unsigned char* topleft = slot->bitmap.buffer; + + if ( pitch < 0 ) + topleft -= pitch * ( rows - 1 ); + + FT_TRACE7(( "Netpbm image: start\n" )); + switch ( slot->bitmap.pixel_mode ) + { + case FT_PIXEL_MODE_MONO: + FT_TRACE7(( "P1 %d %d\n", width, rows )); + for ( i = 0; i < rows; i++ ) { - MD5_CTX ctx; - unsigned char md5[16]; - int i; - unsigned int rows = bitmap.rows; - unsigned int pitch = (unsigned int)bitmap.pitch; - - - MD5_Init( &ctx ); - if ( bitmap.buffer ) - MD5_Update( &ctx, bitmap.buffer, rows * pitch ); - MD5_Final( md5, &ctx ); - - FT_TRACE3(( "MD5 checksum for %dx%d bitmap:\n" - " ", - rows, pitch )); - for ( i = 0; i < 16; i++ ) - FT_TRACE3(( "%02X", md5[i] )); - FT_TRACE3(( "\n" )); + for ( j = 0; j < width; ) + for ( m = 128; m > 0 && j < width; m >>= 1, j++ ) + FT_TRACE7(( " %d", ( topleft[i * pitch + j / 8] & m ) != 0 )); + FT_TRACE7(( "\n" )); } + break; - FT_Bitmap_Done( library, &bitmap ); + default: + FT_TRACE7(( "P2 %d %d 255\n", width, rows )); + for ( i = 0; i < rows; i++ ) + { + for ( j = 0; j < width; j += 1 ) + FT_TRACE7(( " %3u", topleft[i * pitch + j] )); + FT_TRACE7(( "\n" )); + } } + FT_TRACE7(( "Netpbm image: end\n" )); } #undef FT_COMPONENT @@ -4537,7 +4739,7 @@ if ( !clazz ) return FT_THROW( Invalid_Argument ); - /* check freetype version */ + /* check FreeType version */ if ( clazz->module_requires > FREETYPE_VER_FIXED ) return FT_THROW( Invalid_Version ); @@ -4961,10 +5163,6 @@ goto Fail; #endif - /* we don't use raster_pool anymore. */ - library->raster_pool_size = 0; - library->raster_pool = NULL; - library->version_major = FREETYPE_MAJOR; library->version_minor = FREETYPE_MINOR; library->version_patch = FREETYPE_PATCH; @@ -4979,9 +5177,9 @@ #ifdef FT_CONFIG_OPTION_PIC Fail: ft_pic_container_destroy( library ); -#endif FT_FREE( library ); return error; +#endif } diff --git a/src/base/ftotval.c b/src/base/ftotval.c index 5fa098691..a2944a795 100644 --- a/src/base/ftotval.c +++ b/src/base/ftotval.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating OpenType tables (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index 464a066dc..cb91321de 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -4,7 +4,7 @@ /* */ /* FreeType outline management (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -286,12 +286,13 @@ FT_TRACE5(( "FT_Outline_Decompose: Done\n", n )); return FT_Err_Ok; + Invalid_Outline: + error = FT_THROW( Invalid_Outline ); + /* fall through */ + Exit: FT_TRACE5(( "FT_Outline_Decompose: Error 0x%x\n", error )); return error; - - Invalid_Outline: - return FT_THROW( Invalid_Outline ); } @@ -540,8 +541,8 @@ for ( n = 0; n < outline->n_points; n++ ) { - vec->x += xOffset; - vec->y += yOffset; + vec->x = ADD_LONG( vec->x, xOffset ); + vec->y = ADD_LONG( vec->y, yOffset ); vec++; } } @@ -1088,7 +1089,8 @@ v_cur.x = points[n].x >> xshift; v_cur.y = points[n].y >> yshift; - area += ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ); + area = ADD_LONG( area, + ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ) ); v_prev = v_cur; } diff --git a/src/base/ftpatent.c b/src/base/ftpatent.c index 0925a6256..e23ee2e3f 100644 --- a/src/base/ftpatent.c +++ b/src/base/ftpatent.c @@ -3,9 +3,9 @@ /* ftpatent.c */ /* */ /* FreeType API for checking patented TrueType bytecode instructions */ -/* (body). Obsolete, retained for backwards compatibility. */ +/* (body). Obsolete, retained for backward compatibility. */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftpfr.c b/src/base/ftpfr.c index 5cc0b7072..bfe13520e 100644 --- a/src/base/ftpfr.c +++ b/src/base/ftpfr.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing PFR-specific data (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftpic.c b/src/base/ftpic.c index 0f84fddc9..1492e1809 100644 --- a/src/base/ftpic.c +++ b/src/base/ftpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services (body). */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftpsprop.c b/src/base/ftpsprop.c new file mode 100644 index 000000000..459b5e605 --- /dev/null +++ b/src/base/ftpsprop.c @@ -0,0 +1,285 @@ +/***************************************************************************/ +/* */ +/* ftpsprop.c */ +/* */ +/* Get and set properties of PostScript drivers (body). */ +/* See `ftdriver.h' for available properties. */ +/* */ +/* Copyright 2017-2018 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include +#include FT_DRIVER_H +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_POSTSCRIPT_PROPS_H + + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_psprops + + + FT_BASE_CALLBACK_DEF( FT_Error ) + ps_property_set( FT_Module module, /* PS_Driver */ + const char* property_name, + const void* value, + FT_Bool value_is_string ) + { + FT_Error error = FT_Err_Ok; + PS_Driver driver = (PS_Driver)module; + +#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + FT_UNUSED( value_is_string ); +#endif + + + if ( !ft_strcmp( property_name, "darkening-parameters" ) ) + { + FT_Int* darken_params; + FT_Int x1, y1, x2, y2, x3, y3, x4, y4; + +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + FT_Int dp[8]; + + + if ( value_is_string ) + { + const char* s = (const char*)value; + char* ep; + int i; + + + /* eight comma-separated numbers */ + for ( i = 0; i < 7; i++ ) + { + dp[i] = (FT_Int)ft_strtol( s, &ep, 10 ); + if ( *ep != ',' || s == ep ) + return FT_THROW( Invalid_Argument ); + + s = ep + 1; + } + + dp[7] = (FT_Int)ft_strtol( s, &ep, 10 ); + if ( !( *ep == '\0' || *ep == ' ' ) || s == ep ) + return FT_THROW( Invalid_Argument ); + + darken_params = dp; + } + else +#endif + darken_params = (FT_Int*)value; + + x1 = darken_params[0]; + y1 = darken_params[1]; + x2 = darken_params[2]; + y2 = darken_params[3]; + x3 = darken_params[4]; + y3 = darken_params[5]; + x4 = darken_params[6]; + y4 = darken_params[7]; + + if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 || + y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 || + x1 > x2 || x2 > x3 || x3 > x4 || + y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 ) + return FT_THROW( Invalid_Argument ); + + driver->darken_params[0] = x1; + driver->darken_params[1] = y1; + driver->darken_params[2] = x2; + driver->darken_params[3] = y2; + driver->darken_params[4] = x3; + driver->darken_params[5] = y3; + driver->darken_params[6] = x4; + driver->darken_params[7] = y4; + + return error; + } + + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) + { +#if defined( CFF_CONFIG_OPTION_OLD_ENGINE ) || \ + defined( T1_CONFIG_OPTION_OLD_ENGINE ) + const char* module_name = module->clazz->module_name; +#endif + + +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + if ( value_is_string ) + { + const char* s = (const char*)value; + + + if ( !ft_strcmp( s, "adobe" ) ) + driver->hinting_engine = FT_HINTING_ADOBE; + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + else if ( !ft_strcmp( module_name, "cff" ) && + !ft_strcmp( s, "freetype" ) ) + driver->hinting_engine = FT_HINTING_FREETYPE; +#endif + +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + else if ( ( !ft_strcmp( module_name, "type1" ) || + !ft_strcmp( module_name, "t1cid" ) ) && + !ft_strcmp( s, "freetype" ) ) + driver->hinting_engine = FT_HINTING_FREETYPE; +#endif + + else + return FT_THROW( Invalid_Argument ); + } + else +#endif /* FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES */ + { + FT_UInt* hinting_engine = (FT_UInt*)value; + + + if ( *hinting_engine == FT_HINTING_ADOBE +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + || ( *hinting_engine == FT_HINTING_FREETYPE && + !ft_strcmp( module_name, "cff" ) ) +#endif +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + || ( *hinting_engine == FT_HINTING_FREETYPE && + ( !ft_strcmp( module_name, "type1" ) || + !ft_strcmp( module_name, "t1cid" ) ) ) +#endif + ) + driver->hinting_engine = *hinting_engine; + else + error = FT_ERR( Unimplemented_Feature ); + + return error; + } + } + + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) + { +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + if ( value_is_string ) + { + const char* s = (const char*)value; + long nsd = ft_strtol( s, NULL, 10 ); + + + if ( !nsd ) + driver->no_stem_darkening = FALSE; + else + driver->no_stem_darkening = TRUE; + } + else +#endif + { + FT_Bool* no_stem_darkening = (FT_Bool*)value; + + + driver->no_stem_darkening = *no_stem_darkening; + } + + return error; + } + + else if ( !ft_strcmp( property_name, "random-seed" ) ) + { + FT_Int32 random_seed; + + +#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + if ( value_is_string ) + { + const char* s = (const char*)value; + + + random_seed = (FT_Int32)ft_strtol( s, NULL, 10 ); + } + else +#endif + random_seed = *(FT_Int32*)value; + + if ( random_seed < 0 ) + random_seed = 0; + + driver->random_seed = random_seed; + + return error; + } + + FT_TRACE0(( "ps_property_set: missing property `%s'\n", + property_name )); + return FT_THROW( Missing_Property ); + } + + + FT_BASE_CALLBACK_DEF( FT_Error ) + ps_property_get( FT_Module module, /* PS_Driver */ + const char* property_name, + void* value ) + { + FT_Error error = FT_Err_Ok; + PS_Driver driver = (PS_Driver)module; + + + if ( !ft_strcmp( property_name, "darkening-parameters" ) ) + { + FT_Int* darken_params = driver->darken_params; + FT_Int* val = (FT_Int*)value; + + + val[0] = darken_params[0]; + val[1] = darken_params[1]; + val[2] = darken_params[2]; + val[3] = darken_params[3]; + val[4] = darken_params[4]; + val[5] = darken_params[5]; + val[6] = darken_params[6]; + val[7] = darken_params[7]; + + return error; + } + + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) + { + FT_UInt hinting_engine = driver->hinting_engine; + FT_UInt* val = (FT_UInt*)value; + + + *val = hinting_engine; + + return error; + } + + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) + { + FT_Bool no_stem_darkening = driver->no_stem_darkening; + FT_Bool* val = (FT_Bool*)value; + + + *val = no_stem_darkening; + + return error; + } + + FT_TRACE0(( "ps_property_get: missing property `%s'\n", + property_name )); + return FT_THROW( Missing_Property ); + } + + +/* END */ diff --git a/src/base/ftrfork.c b/src/base/ftrfork.c index f7b81375d..c3a2b9151 100644 --- a/src/base/ftrfork.c +++ b/src/base/ftrfork.c @@ -4,7 +4,7 @@ /* */ /* Embedded resource forks accessor (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO and Redhat K.K. */ /* */ /* FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are */ @@ -271,7 +271,13 @@ if ( FT_STREAM_SKIP( 4 ) ) /* mbz */ goto Exit; - if ( ref[j].res_id < 0 || temp < 0 ) + /* + * According to Inside Macintosh: More Macintosh Toolbox, + * "Resource IDs" (1-46), there are some reserved IDs. + * However, FreeType2 is not a font synthesizer, no need + * to check the acceptable resource ID. + */ + if ( temp < 0 ) { error = FT_THROW( Invalid_Table ); goto Exit; @@ -281,7 +287,7 @@ FT_TRACE3(( " [%d]:" " resource_id=0x%04x, offset=0x%08x\n", - j, ref[j].res_id, ref[j].offset )); + j, (FT_UShort)ref[j].res_id, ref[j].offset )); } if ( sort_by_res_id ) @@ -472,7 +478,7 @@ } -#ifndef FT_MACINTOSH +#if defined( FT_CONFIG_OPTION_MAC_FONTS ) && !defined( FT_MACINTOSH ) static FT_RFork_Rule raccess_get_rule_type_from_rule_index( FT_Library library, FT_UInt rule_index ) diff --git a/src/base/ftsnames.c b/src/base/ftsnames.c index 868b42943..90ea1e2be 100644 --- a/src/base/ftsnames.c +++ b/src/base/ftsnames.c @@ -7,7 +7,7 @@ /* */ /* This is _not_ used to retrieve glyph names! */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,6 +20,8 @@ #include +#include FT_INTERNAL_DEBUG_H + #include FT_SFNT_NAMES_H #include FT_INTERNAL_TRUETYPE_TYPES_H #include FT_INTERNAL_STREAM_H diff --git a/src/base/ftstream.c b/src/base/ftstream.c index a3f8c8b3c..18df7dcfe 100644 --- a/src/base/ftstream.c +++ b/src/base/ftstream.c @@ -4,7 +4,7 @@ /* */ /* I/O stream support (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c index d32de0d62..6ae181906 100644 --- a/src/base/ftstroke.c +++ b/src/base/ftstroke.c @@ -4,7 +4,7 @@ /* */ /* FreeType path stroker (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c index 66dae6037..c28346707 100644 --- a/src/base/ftsynth.c +++ b/src/base/ftsynth.c @@ -4,7 +4,7 @@ /* */ /* FreeType synthesizing code for emboldening and slanting (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -123,7 +123,7 @@ /* * XXX: overflow check for 16-bit system, for compatibility - * with FT_GlyphSlot_Embolden() since freetype-2.1.10. + * with FT_GlyphSlot_Embolden() since FreeType 2.1.10. * unfortunately, this function return no informations * about the cause of error. */ diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c index 324f949a4..6adebdb93 100644 --- a/src/base/ftsystem.c +++ b/src/base/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* ANSI-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/fttrigon.c b/src/base/fttrigon.c index 7a4d17c82..d6dd098c4 100644 --- a/src/base/fttrigon.c +++ b/src/base/fttrigon.c @@ -4,7 +4,7 @@ /* */ /* FreeType trigonometric functions (body). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/fttype1.c b/src/base/fttype1.c index 4d16a6371..aa8f8ccbb 100644 --- a/src/base/fttype1.c +++ b/src/base/fttype1.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file for PS names support (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/ftutil.c b/src/base/ftutil.c index dccc209f4..4de5f2c14 100644 --- a/src/base/ftutil.c +++ b/src/base/ftutil.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file for memory and list management (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -135,7 +135,7 @@ ft_mem_free( memory, block ); block = NULL; } - else if ( new_count > FT_INT_MAX/item_size ) + else if ( new_count > FT_INT_MAX / item_size ) { error = FT_THROW( Array_Too_Large ); } @@ -143,13 +143,15 @@ { FT_ASSERT( !block ); - block = ft_mem_alloc( memory, new_count*item_size, &error ); + block = memory->alloc( memory, new_count * item_size ); + if ( block == NULL ) + error = FT_THROW( Out_Of_Memory ); } else { FT_Pointer block2; - FT_Long cur_size = cur_count*item_size; - FT_Long new_size = new_count*item_size; + FT_Long cur_size = cur_count * item_size; + FT_Long new_size = new_count * item_size; block2 = memory->realloc( memory, cur_size, new_size, block ); diff --git a/src/base/ftver.rc b/src/base/ftver.rc new file mode 100644 index 000000000..cdff99f7f --- /dev/null +++ b/src/base/ftver.rc @@ -0,0 +1,61 @@ +/***************************************************************************/ +/* */ +/* ftver.rc */ +/* */ +/* FreeType VERSIONINFO resource for Windows DLLs. */ +/* */ +/* Copyright 2018 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include + +#define FT_VERSION 2,9,0,0 +#define FT_VERSION_STR "2.9.0" + +VS_VERSION_INFO VERSIONINFO +FILEVERSION FT_VERSION +PRODUCTVERSION FT_VERSION +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG +FILEFLAGS VS_FF_DEBUG +#endif +#ifdef _DLL +FILETYPE VFT_DLL +#define FT_FILENAME "freetype.dll" +#else +FILETYPE VFT_STATIC_LIB +#define FT_FILENAME "freetype.lib" +#endif +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "CompanyName", "The FreeType Project" + VALUE "FileDescription", "Font Rendering Library" + VALUE "FileVersion", FT_VERSION_STR + VALUE "ProductName", "FreeType" + VALUE "ProductVersion", FT_VERSION_STR + VALUE "LegalCopyright", "\251 2018 The FreeType Project www.freetype.org. All rights reserved." + VALUE "InternalName", "freetype" + VALUE "OriginalFilename", FT_FILENAME + END + END + + BLOCK "VarFileInfo" + BEGIN + /* The following line should only be modified for localized versions. */ + /* It consists of any number of WORD,WORD pairs, with each pair */ + /* describing a "language,codepage" combination supported by the file. */ + VALUE "Translation", 0x409, 1252 + END +END diff --git a/src/base/ftwinfnt.c b/src/base/ftwinfnt.c index 05baa02da..11bd28afb 100644 --- a/src/base/ftwinfnt.c +++ b/src/base/ftwinfnt.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing Windows FNT specific info (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/base/rules.mk b/src/base/rules.mk index 2a1e93cb0..e9805bd06 100644 --- a/src/base/rules.mk +++ b/src/base/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -40,11 +40,14 @@ BASE_SRC := $(BASE_DIR)/basepic.c \ $(BASE_DIR)/ftadvanc.c \ $(BASE_DIR)/ftcalc.c \ $(BASE_DIR)/ftdbgmem.c \ + $(BASE_DIR)/ftfntfmt.c \ $(BASE_DIR)/ftgloadr.c \ $(BASE_DIR)/fthash.c \ + $(BASE_DIR)/ftlcdfil.c \ $(BASE_DIR)/ftobjs.c \ $(BASE_DIR)/ftoutln.c \ $(BASE_DIR)/ftpic.c \ + $(BASE_DIR)/ftpsprop.c \ $(BASE_DIR)/ftrfork.c \ $(BASE_DIR)/ftsnames.c \ $(BASE_DIR)/ftstream.c \ diff --git a/src/bdf/Jamfile b/src/bdf/Jamfile index f382b51db..d9e441c18 100644 --- a/src/bdf/Jamfile +++ b/src/bdf/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/bdf Jamfile # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/bdf/README b/src/bdf/README index b761aba2b..996ac2d2a 100644 --- a/src/bdf/README +++ b/src/bdf/README @@ -13,7 +13,7 @@ This code implements a BDF driver for the FreeType library, following the Adobe Specification V 2.2. The specification of the BDF font format is available from Adobe's web site: - http://partners.adobe.com/public/developer/en/font/5005.BDF_Spec.pdf + https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5005.BDF_Spec.pdf Many good bitmap fonts in bdf format come with XFree86 (www.XFree86.org). They do not define vertical metrics, because the X Consortium BDF diff --git a/src/bdf/bdf.c b/src/bdf/bdf.c index f95fb7622..e54df6649 100644 --- a/src/bdf/bdf.c +++ b/src/bdf/bdf.c @@ -24,9 +24,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#define FT_MAKE_OPTION_SINGLE_OBJECT +#define FT_MAKE_OPTION_SINGLE_OBJECT #include + #include "bdflib.c" #include "bdfdrivr.c" diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index a2242be01..ca937f89c 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -373,7 +373,7 @@ THE SOFTWARE. /* we have a bdf font: let's construct the face object */ face->bdffont = font; - /* BDF could not have multiple face in single font file. + /* BDF cannot have multiple faces in a single font file. * XXX: non-zero face_index is already invalid argument, but * Type1, Type42 driver has a convention to return * an invalid argument error when the font could be @@ -437,46 +437,156 @@ THE SOFTWARE. { FT_Bitmap_Size* bsize = bdfface->available_sizes; FT_Short resolution_x = 0, resolution_y = 0; + long value; FT_ZERO( bsize ); + /* 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 %d\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 %d\n", + font->font_descent )); + } + bsize->height = (FT_Short)( font->font_ascent + font->font_descent ); prop = bdf_get_font_property( font, "AVERAGE_WIDTH" ); if ( prop ) - bsize->width = (FT_Short)( ( prop->value.l + 5 ) / 10 ); + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "BDF_Face_Init: negative average width\n" )); +#endif + if ( prop->value.l > 0x7FFFL * 10 - 5 || + prop->value.l < -( 0x7FFFL * 10 - 5 ) ) + { + bsize->width = 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping average width to value %d\n", + bsize->width )); + } + else + bsize->width = FT_ABS( (FT_Short)( ( prop->value.l + 5 ) / 10 ) ); + } else - bsize->width = (FT_Short)( bsize->height * 2/3 ); + { + /* this is a heuristical value */ + bsize->width = (FT_Short)FT_MulDiv( bsize->height, 2, 3 ); + } prop = bdf_get_font_property( font, "POINT_SIZE" ); if ( prop ) + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "BDF_Face_Init: negative point size\n" )); +#endif /* convert from 722.7 decipoints to 72 points per inch */ - bsize->size = - (FT_Pos)( ( prop->value.l * 64 * 7200 + 36135L ) / 72270L ); + if ( prop->value.l > 0x504C2L || /* 0x7FFF * 72270/7200 */ + prop->value.l < -0x504C2L ) + { + bsize->size = 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n", + bsize->size )); + } + else + bsize->size = FT_MulDiv( FT_ABS( prop->value.l ), + 64 * 7200, + 72270L ); + } + else if ( font->point_size ) + { + if ( font->point_size > 0x7FFF ) + { + bsize->size = 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n", + bsize->size )); + } + else + bsize->size = (FT_Pos)font->point_size << 6; + } else - bsize->size = bsize->width << 6; + { + /* this is a heuristical value */ + bsize->size = bsize->width * 64; + } prop = bdf_get_font_property( font, "PIXEL_SIZE" ); if ( prop ) - bsize->y_ppem = (FT_Short)prop->value.l << 6; + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( prop->value.l < 0 ) + FT_TRACE0(( "BDF_Face_Init: negative pixel size\n" )); +#endif + if ( prop->value.l > 0x7FFF || prop->value.l < -0x7FFF ) + { + bsize->y_ppem = 0x7FFF << 6; + FT_TRACE0(( "BDF_Face_Init: clamping pixel size to value %d\n", + bsize->y_ppem )); + } + else + bsize->y_ppem = FT_ABS( (FT_Short)prop->value.l ) << 6; + } prop = bdf_get_font_property( font, "RESOLUTION_X" ); if ( prop ) - resolution_x = (FT_Short)prop->value.l; + value = prop->value.l; + else + value = (long)font->resolution_x; + if ( value ) + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( value < 0 ) + FT_TRACE0(( "BDF_Face_Init: negative X resolution\n" )); +#endif + if ( value > 0x7FFF || value < -0x7FFF ) + { + resolution_x = 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping X resolution to value %d\n", + resolution_x )); + } + else + resolution_x = FT_ABS( (FT_Short)value ); + } prop = bdf_get_font_property( font, "RESOLUTION_Y" ); if ( prop ) - resolution_y = (FT_Short)prop->value.l; + value = prop->value.l; + else + value = (long)font->resolution_y; + if ( value ) + { +#ifdef FT_DEBUG_LEVEL_TRACE + if ( value < 0 ) + FT_TRACE0(( "BDF_Face_Init: negative Y resolution\n" )); +#endif + if ( value > 0x7FFF || value < -0x7FFF ) + { + resolution_y = 0x7FFF; + FT_TRACE0(( "BDF_Face_Init: clamping Y resolution to value %d\n", + resolution_y )); + } + else + resolution_y = FT_ABS( (FT_Short)value ); + } if ( bsize->y_ppem == 0 ) { bsize->y_ppem = bsize->size; if ( resolution_y ) - bsize->y_ppem = bsize->y_ppem * resolution_y / 72; + bsize->y_ppem = FT_MulDiv( bsize->y_ppem, resolution_y, 72 ); } if ( resolution_x && resolution_y ) - bsize->x_ppem = bsize->y_ppem * resolution_x / resolution_y; + bsize->x_ppem = FT_MulDiv( bsize->y_ppem, + resolution_x, + resolution_y ); else bsize->x_ppem = bsize->y_ppem; } @@ -545,7 +655,11 @@ THE SOFTWARE. if ( !ft_strcmp( s, "10646" ) || ( !ft_strcmp( s, "8859" ) && !ft_strcmp( face->charset_encoding, "1" ) ) ) - unicode_charmap = 1; + unicode_charmap = 1; + /* another name for ASCII */ + else if ( !ft_strcmp( s, "646.1991" ) && + !ft_strcmp( face->charset_encoding, "IRV" ) ) + unicode_charmap = 1; } { @@ -566,12 +680,6 @@ THE SOFTWARE. } error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL ); - -#if 0 - /* Select default charmap */ - if ( bdfface->num_charmaps ) - bdfface->charmap = bdfface->charmaps[0]; -#endif } goto Exit; @@ -705,7 +813,7 @@ THE SOFTWARE. bitmap->rows = glyph.bbx.height; bitmap->width = glyph.bbx.width; - if ( glyph.bpr > INT_MAX ) + if ( glyph.bpr > FT_INT_MAX ) FT_TRACE1(( "BDF_Glyph_Load: too large pitch %d is truncated\n", glyph.bpr )); bitmap->pitch = (int)glyph.bpr; /* same as FT_Bitmap.pitch */ diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c index 7fd95a738..2f5c99d54 100644 --- a/src/bdf/bdflib.c +++ b/src/bdf/bdflib.c @@ -704,7 +704,15 @@ return 0; for ( v = 0; sbitset( ddigits, *s ); s++ ) - v = v * 10 + a2i[(int)*s]; + { + if ( v < ( FT_ULONG_MAX - 9 ) / 10 ) + v = v * 10 + a2i[(int)*s]; + else + { + v = FT_ULONG_MAX; + break; + } + } return v; } @@ -729,7 +737,15 @@ } for ( v = 0; sbitset( ddigits, *s ); s++ ) - v = v * 10 + a2i[(int)*s]; + { + if ( v < ( FT_LONG_MAX - 9 ) / 10 ) + v = v * 10 + a2i[(int)*s]; + else + { + v = FT_LONG_MAX; + break; + } + } return ( !neg ) ? v : -v; } @@ -746,7 +762,15 @@ return 0; for ( v = 0; sbitset( ddigits, *s ); s++ ) - v = (unsigned short)( v * 10 + a2i[(int)*s] ); + { + if ( v < ( FT_USHORT_MAX - 9 ) / 10 ) + v = (unsigned short)( v * 10 + a2i[(int)*s] ); + else + { + v = FT_USHORT_MAX; + break; + } + } return v; } @@ -771,7 +795,15 @@ } for ( v = 0; sbitset( ddigits, *s ); s++ ) - v = (short)( v * 10 + a2i[(int)*s] ); + { + if ( v < ( SHRT_MAX - 9 ) / 10 ) + v = (short)( v * 10 + a2i[(int)*s] ); + else + { + v = SHRT_MAX; + break; + } + } return (short)( ( !neg ) ? v : -v ); } diff --git a/src/bzip2/Jamfile b/src/bzip2/Jamfile index f369d4ace..3548eab59 100644 --- a/src/bzip2/Jamfile +++ b/src/bzip2/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/bzip2 Jamfile # -# Copyright 2010-2017 by +# Copyright 2010-2018 by # Joel Klinghed # # based on `src/lzw/Jamfile' diff --git a/src/bzip2/ftbzip2.c b/src/bzip2/ftbzip2.c index 7fc71e707..16019485a 100644 --- a/src/bzip2/ftbzip2.c +++ b/src/bzip2/ftbzip2.c @@ -8,7 +8,7 @@ /* parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2010-2017 by */ +/* Copyright 2010-2018 by */ /* Joel Klinghed. */ /* */ /* based on `src/gzip/ftgzip.c' */ diff --git a/src/bzip2/rules.mk b/src/bzip2/rules.mk index f63ddc4d3..95954d752 100644 --- a/src/bzip2/rules.mk +++ b/src/bzip2/rules.mk @@ -2,7 +2,7 @@ # FreeType 2 BZIP2 support configuration rules # -# Copyright 2010-2017 by +# Copyright 2010-2018 by # Joel Klinghed. # # based on `src/lzw/rules.mk' diff --git a/src/cache/Jamfile b/src/cache/Jamfile index 0880af838..53f4c7b60 100644 --- a/src/cache/Jamfile +++ b/src/cache/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/cache Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/cache/ftcache.c b/src/cache/ftcache.c index 052ff2547..1b425af91 100644 --- a/src/cache/ftcache.c +++ b/src/cache/ftcache.c @@ -4,7 +4,7 @@ /* */ /* The FreeType Caching sub-system (body only). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,15 +17,16 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "ftcmru.c" -#include "ftcmanag.c" + +#include "ftcbasic.c" #include "ftccache.c" #include "ftccmap.c" #include "ftcglyph.c" #include "ftcimage.c" +#include "ftcmanag.c" +#include "ftcmru.c" #include "ftcsbits.c" -#include "ftcbasic.c" + /* END */ diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c index 289bd5c43..994aa1228 100644 --- a/src/cache/ftcbasic.c +++ b/src/cache/ftcbasic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType basic cache interface (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -304,10 +304,18 @@ if ( anode ) *anode = NULL; - if ( (FT_ULong)( type->flags - FT_INT_MIN ) > FT_UINT_MAX ) + /* + * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt', + * but public `FT_ImageType->flags' is of type `FT_Int32'. + * + * On 16bit systems, higher bits of type->flags cannot be handled. + */ +#if 0xFFFFFFFFUL > FT_UINT_MAX + if ( (type->flags & (FT_ULong)FT_UINT_MAX) ) FT_TRACE1(( "FTC_ImageCache_Lookup:" " higher bits in load_flags 0x%x are dropped\n", (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) )); +#endif query.attrs.scaler.face_id = type->face_id; query.attrs.scaler.width = type->width; @@ -377,11 +385,18 @@ if ( anode ) *anode = NULL; - /* `FT_Load_Glyph' and `FT_Load_Char' take FT_UInt flags */ + /* + * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt', + * but public `FT_Face->face_flags' is of type `FT_Long'. + * + * On long > int systems, higher bits of load_flags cannot be handled. + */ +#if FT_ULONG_MAX > FT_UINT_MAX if ( load_flags > FT_UINT_MAX ) FT_TRACE1(( "FTC_ImageCache_LookupScaler:" " higher bits in load_flags 0x%x are dropped\n", load_flags & ~((FT_ULong)FT_UINT_MAX) )); +#endif query.attrs.scaler = scaler[0]; query.attrs.load_flags = (FT_UInt)load_flags; @@ -487,10 +502,18 @@ *ansbit = NULL; - if ( (FT_ULong)( type->flags - FT_INT_MIN ) > FT_UINT_MAX ) + /* + * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt', + * but public `FT_ImageType->flags' is of type `FT_Int32'. + * + * On 16bit systems, higher bits of type->flags cannot be handled. + */ +#if 0xFFFFFFFFUL > FT_UINT_MAX + if ( (type->flags & (FT_ULong)FT_UINT_MAX) ) FT_TRACE1(( "FTC_ImageCache_Lookup:" " higher bits in load_flags 0x%x are dropped\n", (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) )); +#endif query.attrs.scaler.face_id = type->face_id; query.attrs.scaler.width = type->width; @@ -562,11 +585,18 @@ *ansbit = NULL; - /* `FT_Load_Glyph' and `FT_Load_Char' take FT_UInt flags */ + /* + * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt', + * but public `FT_Face->face_flags' is of type `FT_Long'. + * + * On long > int systems, higher bits of load_flags cannot be handled. + */ +#if FT_ULONG_MAX > FT_UINT_MAX if ( load_flags > FT_UINT_MAX ) FT_TRACE1(( "FTC_ImageCache_LookupScaler:" " higher bits in load_flags 0x%x are dropped\n", load_flags & ~((FT_ULong)FT_UINT_MAX) )); +#endif query.attrs.scaler = scaler[0]; query.attrs.load_flags = (FT_UInt)load_flags; diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c index 37dc3abb1..12ec585a2 100644 --- a/src/cache/ftccache.c +++ b/src/cache/ftccache.c @@ -4,7 +4,7 @@ /* */ /* The FreeType internal cache interface (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftccache.h b/src/cache/ftccache.h index d3c11ce08..859c547e4 100644 --- a/src/cache/ftccache.h +++ b/src/cache/ftccache.h @@ -4,7 +4,7 @@ /* */ /* FreeType internal cache interface (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftccback.h b/src/cache/ftccback.h index 2681e8c02..e51d8d6e5 100644 --- a/src/cache/ftccback.h +++ b/src/cache/ftccback.h @@ -4,7 +4,7 @@ /* */ /* Callback functions of the caching sub-system (specification only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c index 2fa84979c..d20b0f48f 100644 --- a/src/cache/ftccmap.c +++ b/src/cache/ftccmap.c @@ -4,7 +4,7 @@ /* */ /* FreeType CharMap cache (body) */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcerror.h b/src/cache/ftcerror.h index 84fe52f54..a26cd5935 100644 --- a/src/cache/ftcerror.h +++ b/src/cache/ftcerror.h @@ -4,7 +4,7 @@ /* */ /* Caching sub-system error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcglyph.c b/src/cache/ftcglyph.c index d2468f2f4..782cc0ed0 100644 --- a/src/cache/ftcglyph.c +++ b/src/cache/ftcglyph.c @@ -4,7 +4,7 @@ /* */ /* FreeType Glyph Image (FT_Glyph) cache (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcglyph.h b/src/cache/ftcglyph.h index cab58ed31..23c24d223 100644 --- a/src/cache/ftcglyph.h +++ b/src/cache/ftcglyph.h @@ -4,7 +4,7 @@ /* */ /* FreeType abstract glyph cache (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c index 359f818cc..77a100153 100644 --- a/src/cache/ftcimage.c +++ b/src/cache/ftcimage.c @@ -4,7 +4,7 @@ /* */ /* FreeType Image cache (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcimage.h b/src/cache/ftcimage.h index 14049af9d..24a221053 100644 --- a/src/cache/ftcimage.h +++ b/src/cache/ftcimage.h @@ -4,7 +4,7 @@ /* */ /* FreeType Generic Image cache (specification) */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c index edec2b6b5..2bcd9df50 100644 --- a/src/cache/ftcmanag.c +++ b/src/cache/ftcmanag.c @@ -4,7 +4,7 @@ /* */ /* FreeType Cache Manager (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcmanag.h b/src/cache/ftcmanag.h index 556842e13..b4b475535 100644 --- a/src/cache/ftcmanag.h +++ b/src/cache/ftcmanag.h @@ -4,7 +4,7 @@ /* */ /* FreeType Cache Manager (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcmru.c b/src/cache/ftcmru.c index e293269f2..1087be4d8 100644 --- a/src/cache/ftcmru.c +++ b/src/cache/ftcmru.c @@ -4,7 +4,7 @@ /* */ /* FreeType MRU support (body). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcmru.h b/src/cache/ftcmru.h index c4c330d55..82396b917 100644 --- a/src/cache/ftcmru.h +++ b/src/cache/ftcmru.h @@ -4,7 +4,7 @@ /* */ /* Simple MRU list-cache (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index 2f9336dec..018f1ecdb 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -4,7 +4,7 @@ /* */ /* FreeType sbits manager (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/ftcsbits.h b/src/cache/ftcsbits.h index 1e15ce976..206a1bb3f 100644 --- a/src/cache/ftcsbits.h +++ b/src/cache/ftcsbits.h @@ -4,7 +4,7 @@ /* */ /* A small-bitmap cache (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cache/rules.mk b/src/cache/rules.mk index 620468950..558935976 100644 --- a/src/cache/rules.mk +++ b/src/cache/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2000-2017 by +# Copyright 2000-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/cff/Jamfile b/src/cff/Jamfile index e6dd05fc1..53c904fcf 100644 --- a/src/cff/Jamfile +++ b/src/cff/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/cff Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -23,15 +23,6 @@ SubDir FT2_TOP $(FT2_SRC_DIR) cff ; cffobjs cffparse cffpic - cf2arrst - cf2blues - cf2error - cf2font - cf2ft - cf2hints - cf2intrp - cf2read - cf2stack ; } else diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c deleted file mode 100644 index 62c696d08..000000000 --- a/src/cff/cf2intrp.c +++ /dev/null @@ -1,1920 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2intrp.c */ -/* */ -/* Adobe's CFF Interpreter (body). */ -/* */ -/* Copyright 2007-2014 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#include "cf2ft.h" -#include FT_INTERNAL_DEBUG_H - -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2stack.h" -#include "cf2hints.h" -#include "cf2intrp.h" - -#include "cf2error.h" - -#include "cffload.h" - - - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ -#undef FT_COMPONENT -#define FT_COMPONENT trace_cf2interp - - - FT_LOCAL_DEF( void ) - cf2_hintmask_init( CF2_HintMask hintmask, - FT_Error* error ) - { - FT_ZERO( hintmask ); - - hintmask->error = error; - } - - - FT_LOCAL_DEF( FT_Bool ) - cf2_hintmask_isValid( const CF2_HintMask hintmask ) - { - return hintmask->isValid; - } - - - FT_LOCAL_DEF( FT_Bool ) - cf2_hintmask_isNew( const CF2_HintMask hintmask ) - { - return hintmask->isNew; - } - - - FT_LOCAL_DEF( void ) - cf2_hintmask_setNew( CF2_HintMask hintmask, - FT_Bool val ) - { - hintmask->isNew = val; - } - - - /* clients call `getMaskPtr' in order to iterate */ - /* through hint mask */ - - FT_LOCAL_DEF( FT_Byte* ) - cf2_hintmask_getMaskPtr( CF2_HintMask hintmask ) - { - return hintmask->mask; - } - - - static size_t - cf2_hintmask_setCounts( CF2_HintMask hintmask, - size_t bitCount ) - { - if ( bitCount > CF2_MAX_HINTS ) - { - /* total of h and v stems must be <= 96 */ - CF2_SET_ERROR( hintmask->error, Invalid_Glyph_Format ); - return 0; - } - - hintmask->bitCount = bitCount; - hintmask->byteCount = ( hintmask->bitCount + 7 ) / 8; - - hintmask->isValid = TRUE; - hintmask->isNew = TRUE; - - return bitCount; - } - - - /* consume the hintmask bytes from the charstring, advancing the src */ - /* pointer */ - static void - cf2_hintmask_read( CF2_HintMask hintmask, - CF2_Buffer charstring, - size_t bitCount ) - { - size_t i; - -#ifndef CF2_NDEBUG - /* these are the bits in the final mask byte that should be zero */ - /* Note: this variable is only used in an assert expression below */ - /* and then only if CF2_NDEBUG is not defined */ - CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1; -#endif - - - /* initialize counts and isValid */ - if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 ) - return; - - FT_ASSERT( hintmask->byteCount > 0 ); - - FT_TRACE4(( " (maskbytes:" )); - - /* set mask and advance interpreter's charstring pointer */ - for ( i = 0; i < hintmask->byteCount; i++ ) - { - hintmask->mask[i] = (FT_Byte)cf2_buf_readByte( charstring ); - FT_TRACE4(( " 0x%02X", hintmask->mask[i] )); - } - - FT_TRACE4(( ")\n" )); - - /* assert any unused bits in last byte are zero unless there's a prior */ - /* error */ - /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */ -#ifndef CF2_NDEBUG - FT_ASSERT( ( hintmask->mask[hintmask->byteCount - 1] & mask ) == 0 || - *hintmask->error ); -#endif - } - - - FT_LOCAL_DEF( void ) - cf2_hintmask_setAll( CF2_HintMask hintmask, - size_t bitCount ) - { - size_t i; - CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1; - - - /* initialize counts and isValid */ - if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 ) - return; - - FT_ASSERT( hintmask->byteCount > 0 ); - FT_ASSERT( hintmask->byteCount <= - sizeof ( hintmask->mask ) / sizeof ( hintmask->mask[0] ) ); - - /* set mask to all ones */ - for ( i = 0; i < hintmask->byteCount; i++ ) - hintmask->mask[i] = 0xFF; - - /* clear unused bits */ - /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */ - hintmask->mask[hintmask->byteCount - 1] &= ~mask; - } - - - /* Type2 charstring opcodes */ - enum - { - cf2_cmdRESERVED_0, /* 0 */ - cf2_cmdHSTEM, /* 1 */ - cf2_cmdRESERVED_2, /* 2 */ - cf2_cmdVSTEM, /* 3 */ - cf2_cmdVMOVETO, /* 4 */ - cf2_cmdRLINETO, /* 5 */ - cf2_cmdHLINETO, /* 6 */ - cf2_cmdVLINETO, /* 7 */ - cf2_cmdRRCURVETO, /* 8 */ - cf2_cmdRESERVED_9, /* 9 */ - cf2_cmdCALLSUBR, /* 10 */ - cf2_cmdRETURN, /* 11 */ - cf2_cmdESC, /* 12 */ - cf2_cmdRESERVED_13, /* 13 */ - cf2_cmdENDCHAR, /* 14 */ - cf2_cmdVSINDEX, /* 15 */ - cf2_cmdBLEND, /* 16 */ - cf2_cmdRESERVED_17, /* 17 */ - cf2_cmdHSTEMHM, /* 18 */ - cf2_cmdHINTMASK, /* 19 */ - cf2_cmdCNTRMASK, /* 20 */ - cf2_cmdRMOVETO, /* 21 */ - cf2_cmdHMOVETO, /* 22 */ - cf2_cmdVSTEMHM, /* 23 */ - cf2_cmdRCURVELINE, /* 24 */ - cf2_cmdRLINECURVE, /* 25 */ - cf2_cmdVVCURVETO, /* 26 */ - cf2_cmdHHCURVETO, /* 27 */ - cf2_cmdEXTENDEDNMBR, /* 28 */ - cf2_cmdCALLGSUBR, /* 29 */ - cf2_cmdVHCURVETO, /* 30 */ - cf2_cmdHVCURVETO /* 31 */ - }; - - enum - { - cf2_escDOTSECTION, /* 0 */ - cf2_escRESERVED_1, /* 1 */ - cf2_escRESERVED_2, /* 2 */ - cf2_escAND, /* 3 */ - cf2_escOR, /* 4 */ - cf2_escNOT, /* 5 */ - cf2_escRESERVED_6, /* 6 */ - cf2_escRESERVED_7, /* 7 */ - cf2_escRESERVED_8, /* 8 */ - cf2_escABS, /* 9 */ - cf2_escADD, /* 10 like otherADD */ - cf2_escSUB, /* 11 like otherSUB */ - cf2_escDIV, /* 12 */ - cf2_escRESERVED_13, /* 13 */ - cf2_escNEG, /* 14 */ - cf2_escEQ, /* 15 */ - cf2_escRESERVED_16, /* 16 */ - cf2_escRESERVED_17, /* 17 */ - cf2_escDROP, /* 18 */ - cf2_escRESERVED_19, /* 19 */ - cf2_escPUT, /* 20 like otherPUT */ - cf2_escGET, /* 21 like otherGET */ - cf2_escIFELSE, /* 22 like otherIFELSE */ - cf2_escRANDOM, /* 23 like otherRANDOM */ - cf2_escMUL, /* 24 like otherMUL */ - cf2_escRESERVED_25, /* 25 */ - cf2_escSQRT, /* 26 */ - cf2_escDUP, /* 27 like otherDUP */ - cf2_escEXCH, /* 28 like otherEXCH */ - cf2_escINDEX, /* 29 */ - cf2_escROLL, /* 30 */ - cf2_escRESERVED_31, /* 31 */ - cf2_escRESERVED_32, /* 32 */ - cf2_escRESERVED_33, /* 33 */ - cf2_escHFLEX, /* 34 */ - cf2_escFLEX, /* 35 */ - cf2_escHFLEX1, /* 36 */ - cf2_escFLEX1, /* 37 */ - cf2_escRESERVED_38 /* 38 & all higher */ - }; - - - /* `stemHintArray' does not change once we start drawing the outline. */ - static void - cf2_doStems( const CF2_Font font, - CF2_Stack opStack, - CF2_ArrStack stemHintArray, - CF2_Fixed* width, - FT_Bool* haveWidth, - CF2_Fixed hintOffset ) - { - CF2_UInt i; - CF2_UInt count = cf2_stack_count( opStack ); - FT_Bool hasWidthArg = (FT_Bool)( count & 1 ); - - /* variable accumulates delta values from operand stack */ - CF2_Fixed position = hintOffset; - - - if ( hasWidthArg && !*haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + - cf2_getNominalWidthX( font->decoder ); - - if ( font->decoder->width_only ) - goto exit; - - for ( i = hasWidthArg ? 1 : 0; i < count; i += 2 ) - { - /* construct a CF2_StemHint and push it onto the list */ - CF2_StemHintRec stemhint; - - - stemhint.min = - position += cf2_stack_getReal( opStack, i ); - stemhint.max = - position += cf2_stack_getReal( opStack, i + 1 ); - - stemhint.used = FALSE; - stemhint.maxDS = - stemhint.minDS = 0; - - cf2_arrstack_push( stemHintArray, &stemhint ); /* defer error check */ - } - - cf2_stack_clear( opStack ); - - exit: - /* cf2_doStems must define a width (may be default) */ - *haveWidth = TRUE; - } - - - static void - cf2_doFlex( CF2_Stack opStack, - CF2_Fixed* curX, - CF2_Fixed* curY, - CF2_GlyphPath glyphPath, - const FT_Bool* readFromStack, - FT_Bool doConditionalLastRead ) - { - CF2_Fixed vals[14]; - CF2_UInt index; - FT_Bool isHFlex; - CF2_Int top, i, j; - - - vals[0] = *curX; - vals[1] = *curY; - index = 0; - isHFlex = FT_BOOL( readFromStack[9] == FALSE ); - top = isHFlex ? 9 : 10; - - for ( i = 0; i < top; i++ ) - { - vals[i + 2] = vals[i]; - if ( readFromStack[i] ) - vals[i + 2] += cf2_stack_getReal( opStack, index++ ); - } - - if ( isHFlex ) - vals[9 + 2] = *curY; - - if ( doConditionalLastRead ) - { - FT_Bool lastIsX = (FT_Bool)( cf2_fixedAbs( vals[10] - *curX ) > - cf2_fixedAbs( vals[11] - *curY ) ); - CF2_Fixed lastVal = cf2_stack_getReal( opStack, index ); - - - if ( lastIsX ) - { - vals[12] = vals[10] + lastVal; - vals[13] = *curY; - } - else - { - vals[12] = *curX; - vals[13] = vals[11] + lastVal; - } - } - else - { - if ( readFromStack[10] ) - vals[12] = vals[10] + cf2_stack_getReal( opStack, index++ ); - else - vals[12] = *curX; - - if ( readFromStack[11] ) - vals[13] = vals[11] + cf2_stack_getReal( opStack, index ); - else - vals[13] = *curY; - } - - for ( j = 0; j < 2; j++ ) - cf2_glyphpath_curveTo( glyphPath, vals[j * 6 + 2], - vals[j * 6 + 3], - vals[j * 6 + 4], - vals[j * 6 + 5], - vals[j * 6 + 6], - vals[j * 6 + 7] ); - - cf2_stack_clear( opStack ); - - *curX = vals[12]; - *curY = vals[13]; - } - - - /* Blend numOperands on the stack, */ - /* store results into the first numBlends values, */ - /* then pop remaining arguments. */ - static void - cf2_doBlend( const CFF_Blend blend, - CF2_Stack opStack, - CF2_UInt numBlends ) - { - CF2_UInt delta; - CF2_UInt base; - CF2_UInt i, j; - CF2_UInt numOperands = (CF2_UInt)( numBlends * blend->lenBV ); - - - base = cf2_stack_count( opStack ) - numOperands; - delta = base + numBlends; - - for ( i = 0; i < numBlends; i++ ) - { - const CF2_Fixed* weight = &blend->BV[1]; - - /* start with first term */ - CF2_Fixed sum = cf2_stack_getReal( opStack, i + base ); - - - for ( j = 1; j < blend->lenBV; j++ ) - sum += FT_MulFix( *weight++, cf2_stack_getReal( opStack, delta++ ) ); - - /* store blended result */ - cf2_stack_setReal( opStack, i + base, sum ); - } - - /* leave only `numBlends' results on stack */ - cf2_stack_pop( opStack, numOperands - numBlends ); - } - - - /* - * `error' is a shared error code used by many objects in this - * routine. Before the code continues from an error, it must check and - * record the error in `*error'. The idea is that this shared - * error code will record the first error encountered. If testing - * for an error anyway, the cost of `goto exit' is small, so we do it, - * even if continuing would be safe. In this case, `lastError' is - * set, so the testing and storing can be done in one place, at `exit'. - * - * Continuing after an error is intended for objects which do their own - * testing of `*error', e.g., array stack functions. This allows us to - * avoid an extra test after the call. - * - * Unimplemented opcodes are ignored. - * - */ - FT_LOCAL_DEF( void ) - cf2_interpT2CharString( CF2_Font font, - CF2_Buffer buf, - CF2_OutlineCallbacks callbacks, - const FT_Vector* translation, - FT_Bool doingSeac, - CF2_Fixed curX, - CF2_Fixed curY, - CF2_Fixed* width ) - { - /* lastError is used for errors that are immediately tested */ - FT_Error lastError = FT_Err_Ok; - - /* pointer to parsed font object */ - CFF_Decoder* decoder = font->decoder; - - FT_Error* error = &font->error; - FT_Memory memory = font->memory; - - CF2_Fixed scaleY = font->innerTransform.d; - CF2_Fixed nominalWidthX = cf2_getNominalWidthX( decoder ); - - /* save this for hinting seac accents */ - CF2_Fixed hintOriginY = curY; - - CF2_Stack opStack = NULL; - FT_UInt stackSize; - FT_Byte op1; /* first opcode byte */ - - CF2_F16Dot16 storage[CF2_STORAGE_SIZE]; /* for `put' and `get' */ - - /* instruction limit; 20,000,000 matches Avalon */ - FT_UInt32 instructionLimit = 20000000UL; - - CF2_ArrStackRec subrStack; - - FT_Bool haveWidth; - CF2_Buffer charstring = NULL; - - CF2_Int charstringIndex = -1; /* initialize to empty */ - - /* TODO: placeholders for hint structures */ - - /* objects used for hinting */ - CF2_ArrStackRec hStemHintArray; - CF2_ArrStackRec vStemHintArray; - - CF2_HintMaskRec hintMask; - CF2_GlyphPathRec glyphPath; - - - FT_ZERO( &storage ); - - /* initialize the remaining objects */ - cf2_arrstack_init( &subrStack, - memory, - error, - sizeof ( CF2_BufferRec ) ); - cf2_arrstack_init( &hStemHintArray, - memory, - error, - sizeof ( CF2_StemHintRec ) ); - cf2_arrstack_init( &vStemHintArray, - memory, - error, - sizeof ( CF2_StemHintRec ) ); - - /* initialize CF2_StemHint arrays */ - cf2_hintmask_init( &hintMask, error ); - - /* initialize path map to manage drawing operations */ - - /* Note: last 4 params are used to handle `MoveToPermissive', which */ - /* may need to call `hintMap.Build' */ - /* TODO: MoveToPermissive is gone; are these still needed? */ - cf2_glyphpath_init( &glyphPath, - font, - callbacks, - scaleY, - /* hShift, */ - &hStemHintArray, - &vStemHintArray, - &hintMask, - hintOriginY, - &font->blues, - translation ); - - /* - * Initialize state for width parsing. From the CFF Spec: - * - * The first stack-clearing operator, which must be one of hstem, - * hstemhm, vstem, vstemhm, cntrmask, hintmask, hmoveto, vmoveto, - * rmoveto, or endchar, takes an additional argument - the width (as - * described earlier), which may be expressed as zero or one numeric - * argument. - * - * What we implement here uses the first validly specified width, but - * does not detect errors for specifying more than one width. - * - * If one of the above operators occurs without explicitly specifying - * a width, we assume the default width. - * - * CFF2 charstrings always return the default width (0). - * - */ - haveWidth = font->isCFF2 ? TRUE : FALSE; - *width = cf2_getDefaultWidthX( decoder ); - - /* - * Note: At this point, all pointers to resources must be NULL - * and all local objects must be initialized. - * There must be no branches to `exit:' above this point. - * - */ - - /* allocate an operand stack */ - stackSize = font->isCFF2 ? cf2_getMaxstack( decoder ) - : CF2_OPERAND_STACK_SIZE; - opStack = cf2_stack_init( memory, error, stackSize ); - - if ( !opStack ) - { - lastError = FT_THROW( Out_Of_Memory ); - goto exit; - } - - /* initialize subroutine stack by placing top level charstring as */ - /* first element (max depth plus one for the charstring) */ - /* Note: Caller owns and must finalize the first charstring. */ - /* Our copy of it does not change that requirement. */ - cf2_arrstack_setCount( &subrStack, CF2_MAX_SUBR + 1 ); - - charstring = (CF2_Buffer)cf2_arrstack_getBuffer( &subrStack ); - *charstring = *buf; /* structure copy */ - - charstringIndex = 0; /* entry is valid now */ - - /* catch errors so far */ - if ( *error ) - goto exit; - - /* main interpreter loop */ - while ( 1 ) - { - if ( cf2_buf_isEnd( charstring ) ) - { - /* If we've reached the end of the charstring, simulate a */ - /* cf2_cmdRETURN or cf2_cmdENDCHAR. */ - /* We do this for both CFF and CFF2. */ - if ( charstringIndex ) - op1 = cf2_cmdRETURN; /* end of buffer for subroutine */ - else - op1 = cf2_cmdENDCHAR; /* end of buffer for top level charstring */ - } - else - { - op1 = (FT_Byte)cf2_buf_readByte( charstring ); - - /* Explicit RETURN and ENDCHAR in CFF2 should be ignored. */ - /* Note: Trace message will report 0 instead of 11 or 14. */ - if ( ( op1 == cf2_cmdRETURN || op1 == cf2_cmdENDCHAR ) && - font->isCFF2 ) - op1 = cf2_cmdRESERVED_0; - } - - /* check for errors once per loop */ - if ( *error ) - goto exit; - - instructionLimit--; - if ( instructionLimit == 0 ) - { - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; - } - - switch( op1 ) - { - case cf2_cmdRESERVED_0: - case cf2_cmdRESERVED_2: - case cf2_cmdRESERVED_9: - case cf2_cmdRESERVED_13: - case cf2_cmdRESERVED_17: - /* we may get here if we have a prior error */ - FT_TRACE4(( " unknown op (%d)\n", op1 )); - break; - - case cf2_cmdVSINDEX: - FT_TRACE4(( " vsindex\n" )); - - if ( !font->isCFF2 ) - break; /* clear stack & ignore */ - - if ( font->blend.usedBV ) - { - /* vsindex not allowed after blend */ - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; - } - - { - FT_Int temp = cf2_stack_popInt( opStack ); - - - if ( temp >= 0 ) - font->vsindex = (FT_UInt)temp; - } - break; - - case cf2_cmdBLEND: - { - FT_UInt numBlends; - - - FT_TRACE4(( " blend\n" )); - - if ( !font->isCFF2 ) - break; /* clear stack & ignore */ - - /* do we have a `blend' op in a non-variant font? */ - if ( !font->blend.font ) - { - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; - } - - /* check cached blend vector */ - if ( cff_blend_check_vector( &font->blend, - font->vsindex, - font->lenNDV, - font->NDV ) ) - { - lastError = cff_blend_build_vector( &font->blend, - font->vsindex, - font->lenNDV, - font->NDV ); - if ( lastError ) - goto exit; - } - - /* do the blend */ - numBlends = (FT_UInt)cf2_stack_popInt( opStack ); - if ( numBlends > stackSize ) - { - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; - } - - cf2_doBlend( &font->blend, opStack, numBlends ); - - font->blend.usedBV = TRUE; - } - continue; /* do not clear the stack */ - - case cf2_cmdHSTEMHM: - case cf2_cmdHSTEM: - FT_TRACE4(( op1 == cf2_cmdHSTEMHM ? " hstemhm\n" : " hstem\n" )); - - /* never add hints after the mask is computed */ - if ( cf2_hintmask_isValid( &hintMask ) ) - { - FT_TRACE4(( "cf2_interpT2CharString:" - " invalid horizontal hint mask\n" )); - break; - } - - cf2_doStems( font, - opStack, - &hStemHintArray, - width, - &haveWidth, - 0 ); - - if ( font->decoder->width_only ) - goto exit; - - break; - - case cf2_cmdVSTEMHM: - case cf2_cmdVSTEM: - FT_TRACE4(( op1 == cf2_cmdVSTEMHM ? " vstemhm\n" : " vstem\n" )); - - /* never add hints after the mask is computed */ - if ( cf2_hintmask_isValid( &hintMask ) ) - { - FT_TRACE4(( "cf2_interpT2CharString:" - " invalid vertical hint mask\n" )); - break; - } - - cf2_doStems( font, - opStack, - &vStemHintArray, - width, - &haveWidth, - 0 ); - - if ( font->decoder->width_only ) - goto exit; - - break; - - case cf2_cmdVMOVETO: - FT_TRACE4(( " vmoveto\n" )); - - if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; - - /* width is defined or default after this */ - haveWidth = TRUE; - - if ( font->decoder->width_only ) - goto exit; - - curY += cf2_stack_popFixed( opStack ); - - cf2_glyphpath_moveTo( &glyphPath, curX, curY ); - - break; - - case cf2_cmdRLINETO: - { - CF2_UInt index; - CF2_UInt count = cf2_stack_count( opStack ); - - - FT_TRACE4(( " rlineto\n" )); - - for ( index = 0; index < count; index += 2 ) - { - curX += cf2_stack_getReal( opStack, index + 0 ); - curY += cf2_stack_getReal( opStack, index + 1 ); - - cf2_glyphpath_lineTo( &glyphPath, curX, curY ); - } - - cf2_stack_clear( opStack ); - } - continue; /* no need to clear stack again */ - - case cf2_cmdHLINETO: - case cf2_cmdVLINETO: - { - CF2_UInt index; - CF2_UInt count = cf2_stack_count( opStack ); - - FT_Bool isX = FT_BOOL( op1 == cf2_cmdHLINETO ); - - - FT_TRACE4(( isX ? " hlineto\n" : " vlineto\n" )); - - for ( index = 0; index < count; index++ ) - { - CF2_Fixed v = cf2_stack_getReal( opStack, index ); - - - if ( isX ) - curX += v; - else - curY += v; - - isX = !isX; - - cf2_glyphpath_lineTo( &glyphPath, curX, curY ); - } - - cf2_stack_clear( opStack ); - } - continue; - - case cf2_cmdRCURVELINE: - case cf2_cmdRRCURVETO: - { - CF2_UInt count = cf2_stack_count( opStack ); - CF2_UInt index = 0; - - - FT_TRACE4(( op1 == cf2_cmdRCURVELINE ? " rcurveline\n" - : " rrcurveto\n" )); - - while ( index + 6 <= count ) - { - CF2_Fixed x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; - CF2_Fixed y1 = cf2_stack_getReal( opStack, index + 1 ) + curY; - CF2_Fixed x2 = cf2_stack_getReal( opStack, index + 2 ) + x1; - CF2_Fixed y2 = cf2_stack_getReal( opStack, index + 3 ) + y1; - CF2_Fixed x3 = cf2_stack_getReal( opStack, index + 4 ) + x2; - CF2_Fixed y3 = cf2_stack_getReal( opStack, index + 5 ) + y2; - - - cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); - - curX = x3; - curY = y3; - index += 6; - } - - if ( op1 == cf2_cmdRCURVELINE ) - { - curX += cf2_stack_getReal( opStack, index + 0 ); - curY += cf2_stack_getReal( opStack, index + 1 ); - - cf2_glyphpath_lineTo( &glyphPath, curX, curY ); - } - - cf2_stack_clear( opStack ); - } - continue; /* no need to clear stack again */ - - case cf2_cmdCALLGSUBR: - case cf2_cmdCALLSUBR: - { - CF2_Int subrNum; - - - FT_TRACE4(( op1 == cf2_cmdCALLGSUBR ? " callgsubr" - : " callsubr" )); - - if ( charstringIndex > CF2_MAX_SUBR ) - { - /* max subr plus one for charstring */ - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; /* overflow of stack */ - } - - /* push our current CFF charstring region on subrStack */ - charstring = (CF2_Buffer) - cf2_arrstack_getPointer( - &subrStack, - (size_t)charstringIndex + 1 ); - - /* set up the new CFF region and pointer */ - subrNum = cf2_stack_popInt( opStack ); - - switch ( op1 ) - { - case cf2_cmdCALLGSUBR: - FT_TRACE4(( " (idx %d, entering level %d)\n", - subrNum + decoder->globals_bias, - charstringIndex + 1 )); - - if ( cf2_initGlobalRegionBuffer( decoder, - subrNum, - charstring ) ) - { - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; /* subroutine lookup or stream error */ - } - break; - - default: - /* cf2_cmdCALLSUBR */ - FT_TRACE4(( " (idx %d, entering level %d)\n", - subrNum + decoder->locals_bias, - charstringIndex + 1 )); - - if ( cf2_initLocalRegionBuffer( decoder, - subrNum, - charstring ) ) - { - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; /* subroutine lookup or stream error */ - } - } - - charstringIndex += 1; /* entry is valid now */ - } - continue; /* do not clear the stack */ - - case cf2_cmdRETURN: - FT_TRACE4(( " return (leaving level %d)\n", charstringIndex )); - - if ( charstringIndex < 1 ) - { - /* Note: cannot return from top charstring */ - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; /* underflow of stack */ - } - - /* restore position in previous charstring */ - charstring = (CF2_Buffer) - cf2_arrstack_getPointer( - &subrStack, - (CF2_UInt)--charstringIndex ); - continue; /* do not clear the stack */ - - case cf2_cmdESC: - { - FT_Byte op2 = (FT_Byte)cf2_buf_readByte( charstring ); - - - /* first switch for 2-byte operators handles CFF2 */ - /* and opcodes that are reserved for both CFF and CFF2 */ - switch ( op2 ) - { - case cf2_escHFLEX: - { - static const FT_Bool readFromStack[12] = - { - TRUE /* dx1 */, FALSE /* dy1 */, - TRUE /* dx2 */, TRUE /* dy2 */, - TRUE /* dx3 */, FALSE /* dy3 */, - TRUE /* dx4 */, FALSE /* dy4 */, - TRUE /* dx5 */, FALSE /* dy5 */, - TRUE /* dx6 */, FALSE /* dy6 */ - }; - - - FT_TRACE4(( " hflex\n" )); - - cf2_doFlex( opStack, - &curX, - &curY, - &glyphPath, - readFromStack, - FALSE /* doConditionalLastRead */ ); - } - continue; - - case cf2_escFLEX: - { - static const FT_Bool readFromStack[12] = - { - TRUE /* dx1 */, TRUE /* dy1 */, - TRUE /* dx2 */, TRUE /* dy2 */, - TRUE /* dx3 */, TRUE /* dy3 */, - TRUE /* dx4 */, TRUE /* dy4 */, - TRUE /* dx5 */, TRUE /* dy5 */, - TRUE /* dx6 */, TRUE /* dy6 */ - }; - - - FT_TRACE4(( " flex\n" )); - - cf2_doFlex( opStack, - &curX, - &curY, - &glyphPath, - readFromStack, - FALSE /* doConditionalLastRead */ ); - } - break; /* TODO: why is this not a continue? */ - - case cf2_escHFLEX1: - { - static const FT_Bool readFromStack[12] = - { - TRUE /* dx1 */, TRUE /* dy1 */, - TRUE /* dx2 */, TRUE /* dy2 */, - TRUE /* dx3 */, FALSE /* dy3 */, - TRUE /* dx4 */, FALSE /* dy4 */, - TRUE /* dx5 */, TRUE /* dy5 */, - TRUE /* dx6 */, FALSE /* dy6 */ - }; - - - FT_TRACE4(( " hflex1\n" )); - - cf2_doFlex( opStack, - &curX, - &curY, - &glyphPath, - readFromStack, - FALSE /* doConditionalLastRead */ ); - } - continue; - - case cf2_escFLEX1: - { - static const FT_Bool readFromStack[12] = - { - TRUE /* dx1 */, TRUE /* dy1 */, - TRUE /* dx2 */, TRUE /* dy2 */, - TRUE /* dx3 */, TRUE /* dy3 */, - TRUE /* dx4 */, TRUE /* dy4 */, - TRUE /* dx5 */, TRUE /* dy5 */, - FALSE /* dx6 */, FALSE /* dy6 */ - }; - - - FT_TRACE4(( " flex1\n" )); - - cf2_doFlex( opStack, - &curX, - &curY, - &glyphPath, - readFromStack, - TRUE /* doConditionalLastRead */ ); - } - continue; - - /* these opcodes are reserved in both CFF & CFF2 */ - case cf2_escRESERVED_1: - case cf2_escRESERVED_2: - case cf2_escRESERVED_6: - case cf2_escRESERVED_7: - case cf2_escRESERVED_8: - case cf2_escRESERVED_13: - case cf2_escRESERVED_16: - case cf2_escRESERVED_17: - case cf2_escRESERVED_19: - case cf2_escRESERVED_25: - case cf2_escRESERVED_31: - case cf2_escRESERVED_32: - case cf2_escRESERVED_33: - FT_TRACE4(( " unknown op (12, %d)\n", op2 )); - break; - - default: - { - if ( font->isCFF2 || op2 >= cf2_escRESERVED_38 ) - FT_TRACE4(( " unknown op (12, %d)\n", op2 )); - else - { - /* second switch for 2-byte operators handles just CFF */ - switch ( op2 ) - { - - case cf2_escDOTSECTION: - /* something about `flip type of locking' -- ignore it */ - FT_TRACE4(( " dotsection\n" )); - - break; - - case cf2_escAND: - { - CF2_F16Dot16 arg1; - CF2_F16Dot16 arg2; - - - FT_TRACE4(( " and\n" )); - - arg2 = cf2_stack_popFixed( opStack ); - arg1 = cf2_stack_popFixed( opStack ); - - cf2_stack_pushInt( opStack, arg1 && arg2 ); - } - continue; /* do not clear the stack */ - - case cf2_escOR: - { - CF2_F16Dot16 arg1; - CF2_F16Dot16 arg2; - - - FT_TRACE4(( " or\n" )); - - arg2 = cf2_stack_popFixed( opStack ); - arg1 = cf2_stack_popFixed( opStack ); - - cf2_stack_pushInt( opStack, arg1 || arg2 ); - } - continue; /* do not clear the stack */ - - case cf2_escNOT: - { - CF2_F16Dot16 arg; - - - FT_TRACE4(( " not\n" )); - - arg = cf2_stack_popFixed( opStack ); - - cf2_stack_pushInt( opStack, !arg ); - } - continue; /* do not clear the stack */ - - case cf2_escABS: - { - CF2_F16Dot16 arg; - - - FT_TRACE4(( " abs\n" )); - - arg = cf2_stack_popFixed( opStack ); - - cf2_stack_pushFixed( opStack, FT_ABS( arg ) ); - } - continue; /* do not clear the stack */ - - case cf2_escADD: - { - CF2_F16Dot16 summand1; - CF2_F16Dot16 summand2; - - - FT_TRACE4(( " add\n" )); - - summand2 = cf2_stack_popFixed( opStack ); - summand1 = cf2_stack_popFixed( opStack ); - - cf2_stack_pushFixed( opStack, summand1 + summand2 ); - } - continue; /* do not clear the stack */ - - case cf2_escSUB: - { - CF2_F16Dot16 minuend; - CF2_F16Dot16 subtrahend; - - - FT_TRACE4(( " sub\n" )); - - subtrahend = cf2_stack_popFixed( opStack ); - minuend = cf2_stack_popFixed( opStack ); - - cf2_stack_pushFixed( opStack, minuend - subtrahend ); - } - continue; /* do not clear the stack */ - - case cf2_escDIV: - { - CF2_F16Dot16 dividend; - CF2_F16Dot16 divisor; - - - FT_TRACE4(( " div\n" )); - - divisor = cf2_stack_popFixed( opStack ); - dividend = cf2_stack_popFixed( opStack ); - - cf2_stack_pushFixed( opStack, FT_DivFix( dividend, divisor ) ); - } - continue; /* do not clear the stack */ - - case cf2_escNEG: - { - CF2_F16Dot16 arg; - - - FT_TRACE4(( " neg\n" )); - - arg = cf2_stack_popFixed( opStack ); - - cf2_stack_pushFixed( opStack, -arg ); - } - continue; /* do not clear the stack */ - - case cf2_escEQ: - { - CF2_F16Dot16 arg1; - CF2_F16Dot16 arg2; - - - FT_TRACE4(( " eq\n" )); - - arg2 = cf2_stack_popFixed( opStack ); - arg1 = cf2_stack_popFixed( opStack ); - - cf2_stack_pushInt( opStack, arg1 == arg2 ); - } - continue; /* do not clear the stack */ - - case cf2_escDROP: - FT_TRACE4(( " drop\n" )); - - (void)cf2_stack_popFixed( opStack ); - continue; /* do not clear the stack */ - - case cf2_escPUT: - { - CF2_F16Dot16 val; - CF2_Int idx; - - - FT_TRACE4(( " put\n" )); - - idx = cf2_stack_popInt( opStack ); - val = cf2_stack_popFixed( opStack ); - - if ( idx >= 0 && idx < CF2_STORAGE_SIZE ) - storage[idx] = val; - } - continue; /* do not clear the stack */ - - case cf2_escGET: - { - CF2_Int idx; - - - FT_TRACE4(( " get\n" )); - - idx = cf2_stack_popInt( opStack ); - - if ( idx >= 0 && idx < CF2_STORAGE_SIZE ) - cf2_stack_pushFixed( opStack, storage[idx] ); - } - continue; /* do not clear the stack */ - - case cf2_escIFELSE: - { - CF2_F16Dot16 arg1; - CF2_F16Dot16 arg2; - CF2_F16Dot16 cond1; - CF2_F16Dot16 cond2; - - - FT_TRACE4(( " ifelse\n" )); - - cond2 = cf2_stack_popFixed( opStack ); - cond1 = cf2_stack_popFixed( opStack ); - arg2 = cf2_stack_popFixed( opStack ); - arg1 = cf2_stack_popFixed( opStack ); - - cf2_stack_pushFixed( opStack, cond1 <= cond2 ? arg1 : arg2 ); - } - continue; /* do not clear the stack */ - - case cf2_escRANDOM: /* in spec */ - { - CF2_F16Dot16 r; - - - FT_TRACE4(( " random\n" )); - - /* only use the lower 16 bits of `random' */ - /* to generate a number in the range (0;1] */ - r = (CF2_F16Dot16) - ( ( decoder->current_subfont->random & 0xFFFF ) + 1 ); - - decoder->current_subfont->random = - cff_random( decoder->current_subfont->random ); - - cf2_stack_pushFixed( opStack, r ); - } - continue; /* do not clear the stack */ - - case cf2_escMUL: - { - CF2_F16Dot16 factor1; - CF2_F16Dot16 factor2; - - - FT_TRACE4(( " mul\n" )); - - factor2 = cf2_stack_popFixed( opStack ); - factor1 = cf2_stack_popFixed( opStack ); - - cf2_stack_pushFixed( opStack, FT_MulFix( factor1, factor2 ) ); - } - continue; /* do not clear the stack */ - - case cf2_escSQRT: - { - CF2_F16Dot16 arg; - - - FT_TRACE4(( " sqrt\n" )); - - arg = cf2_stack_popFixed( opStack ); - if ( arg > 0 ) - { - FT_Fixed root = arg; - FT_Fixed new_root; - - - /* Babylonian method */ - for (;;) - { - new_root = ( root + FT_DivFix( arg, root ) + 1 ) >> 1; - if ( new_root == root ) - break; - root = new_root; - } - arg = new_root; - } - else - arg = 0; - - cf2_stack_pushFixed( opStack, arg ); - } - continue; /* do not clear the stack */ - - case cf2_escDUP: - { - CF2_F16Dot16 arg; - - - FT_TRACE4(( " dup\n" )); - - arg = cf2_stack_popFixed( opStack ); - - cf2_stack_pushFixed( opStack, arg ); - cf2_stack_pushFixed( opStack, arg ); - } - continue; /* do not clear the stack */ - - case cf2_escEXCH: - { - CF2_F16Dot16 arg1; - CF2_F16Dot16 arg2; - - - FT_TRACE4(( " exch\n" )); - - arg2 = cf2_stack_popFixed( opStack ); - arg1 = cf2_stack_popFixed( opStack ); - - cf2_stack_pushFixed( opStack, arg2 ); - cf2_stack_pushFixed( opStack, arg1 ); - } - continue; /* do not clear the stack */ - - case cf2_escINDEX: - { - CF2_Int idx; - CF2_UInt size; - - - FT_TRACE4(( " index\n" )); - - idx = cf2_stack_popInt( opStack ); - size = cf2_stack_count( opStack ); - - if ( size > 0 ) - { - /* for `cf2_stack_getReal', index 0 is bottom of stack */ - CF2_UInt gr_idx; - - - if ( idx < 0 ) - gr_idx = size - 1; - else if ( (CF2_UInt)idx >= size ) - gr_idx = 0; - else - gr_idx = size - 1 - (CF2_UInt)idx; - - cf2_stack_pushFixed( opStack, - cf2_stack_getReal( opStack, gr_idx ) ); - } - } - continue; /* do not clear the stack */ - - case cf2_escROLL: - { - CF2_Int idx; - CF2_Int count; - - - FT_TRACE4(( " roll\n" )); - - idx = cf2_stack_popInt( opStack ); - count = cf2_stack_popInt( opStack ); - - cf2_stack_roll( opStack, count, idx ); - } - continue; /* do not clear the stack */ - - } /* end of 2nd switch checking op2 */ - } - } - } /* end of 1st switch checking op2 */ - } /* case cf2_cmdESC */ - - break; - - case cf2_cmdENDCHAR: - FT_TRACE4(( " endchar\n" )); - - if ( cf2_stack_count( opStack ) == 1 || - cf2_stack_count( opStack ) == 5 ) - { - if ( !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; - } - - /* width is defined or default after this */ - haveWidth = TRUE; - - if ( font->decoder->width_only ) - goto exit; - - /* close path if still open */ - cf2_glyphpath_closeOpenPath( &glyphPath ); - - /* disable seac for CFF2 (charstring ending with args on stack) */ - if ( !font->isCFF2 && cf2_stack_count( opStack ) > 1 ) - { - /* must be either 4 or 5 -- */ - /* this is a (deprecated) implied `seac' operator */ - - CF2_Int achar; - CF2_Int bchar; - CF2_BufferRec component; - CF2_Fixed dummyWidth; /* ignore component width */ - FT_Error error2; - - - if ( doingSeac ) - { - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; /* nested seac */ - } - - achar = cf2_stack_popInt( opStack ); - bchar = cf2_stack_popInt( opStack ); - - curY = cf2_stack_popFixed( opStack ); - curX = cf2_stack_popFixed( opStack ); - - error2 = cf2_getSeacComponent( decoder, achar, &component ); - if ( error2 ) - { - lastError = error2; /* pass FreeType error through */ - goto exit; - } - cf2_interpT2CharString( font, - &component, - callbacks, - translation, - TRUE, - curX, - curY, - &dummyWidth ); - cf2_freeSeacComponent( decoder, &component ); - - error2 = cf2_getSeacComponent( decoder, bchar, &component ); - if ( error2 ) - { - lastError = error2; /* pass FreeType error through */ - goto exit; - } - cf2_interpT2CharString( font, - &component, - callbacks, - translation, - TRUE, - 0, - 0, - &dummyWidth ); - cf2_freeSeacComponent( decoder, &component ); - } - goto exit; - - case cf2_cmdCNTRMASK: - case cf2_cmdHINTMASK: - /* the final \n in the tracing message gets added in */ - /* `cf2_hintmask_read' (which also traces the mask bytes) */ - FT_TRACE4(( op1 == cf2_cmdCNTRMASK ? " cntrmask" : " hintmask" )); - - /* never add hints after the mask is computed */ - if ( cf2_stack_count( opStack ) > 1 && - cf2_hintmask_isValid( &hintMask ) ) - { - FT_TRACE4(( "cf2_interpT2CharString: invalid hint mask\n" )); - break; - } - - /* if there are arguments on the stack, there this is an */ - /* implied cf2_cmdVSTEMHM */ - cf2_doStems( font, - opStack, - &vStemHintArray, - width, - &haveWidth, - 0 ); - - if ( font->decoder->width_only ) - goto exit; - - if ( op1 == cf2_cmdHINTMASK ) - { - /* consume the hint mask bytes which follow the operator */ - cf2_hintmask_read( &hintMask, - charstring, - cf2_arrstack_size( &hStemHintArray ) + - cf2_arrstack_size( &vStemHintArray ) ); - } - else - { - /* - * Consume the counter mask bytes which follow the operator: - * Build a temporary hint map, just to place and lock those - * stems participating in the counter mask. These are most - * likely the dominant hstems, and are grouped together in a - * few counter groups, not necessarily in correspondence - * with the hint groups. This reduces the chances of - * conflicts between hstems that are initially placed in - * separate hint groups and then brought together. The - * positions are copied back to `hStemHintArray', so we can - * discard `counterMask' and `counterHintMap'. - * - */ - CF2_HintMapRec counterHintMap; - CF2_HintMaskRec counterMask; - - - cf2_hintmap_init( &counterHintMap, - font, - &glyphPath.initialHintMap, - &glyphPath.hintMoves, - scaleY ); - cf2_hintmask_init( &counterMask, error ); - - cf2_hintmask_read( &counterMask, - charstring, - cf2_arrstack_size( &hStemHintArray ) + - cf2_arrstack_size( &vStemHintArray ) ); - cf2_hintmap_build( &counterHintMap, - &hStemHintArray, - &vStemHintArray, - &counterMask, - 0, - FALSE ); - } - break; - - case cf2_cmdRMOVETO: - FT_TRACE4(( " rmoveto\n" )); - - if ( cf2_stack_count( opStack ) > 2 && !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; - - /* width is defined or default after this */ - haveWidth = TRUE; - - if ( font->decoder->width_only ) - goto exit; - - curY += cf2_stack_popFixed( opStack ); - curX += cf2_stack_popFixed( opStack ); - - cf2_glyphpath_moveTo( &glyphPath, curX, curY ); - - break; - - case cf2_cmdHMOVETO: - FT_TRACE4(( " hmoveto\n" )); - - if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; - - /* width is defined or default after this */ - haveWidth = TRUE; - - if ( font->decoder->width_only ) - goto exit; - - curX += cf2_stack_popFixed( opStack ); - - cf2_glyphpath_moveTo( &glyphPath, curX, curY ); - - break; - - case cf2_cmdRLINECURVE: - { - CF2_UInt count = cf2_stack_count( opStack ); - CF2_UInt index = 0; - - - FT_TRACE4(( " rlinecurve\n" )); - - while ( index + 6 < count ) - { - curX += cf2_stack_getReal( opStack, index + 0 ); - curY += cf2_stack_getReal( opStack, index + 1 ); - - cf2_glyphpath_lineTo( &glyphPath, curX, curY ); - index += 2; - } - - while ( index < count ) - { - CF2_Fixed x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; - CF2_Fixed y1 = cf2_stack_getReal( opStack, index + 1 ) + curY; - CF2_Fixed x2 = cf2_stack_getReal( opStack, index + 2 ) + x1; - CF2_Fixed y2 = cf2_stack_getReal( opStack, index + 3 ) + y1; - CF2_Fixed x3 = cf2_stack_getReal( opStack, index + 4 ) + x2; - CF2_Fixed y3 = cf2_stack_getReal( opStack, index + 5 ) + y2; - - - cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); - - curX = x3; - curY = y3; - index += 6; - } - - cf2_stack_clear( opStack ); - } - continue; /* no need to clear stack again */ - - case cf2_cmdVVCURVETO: - { - CF2_UInt count, count1 = cf2_stack_count( opStack ); - CF2_UInt index = 0; - - - /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */ - /* we enforce it by clearing the second bit */ - /* (and sorting the stack indexing to suit) */ - count = count1 & ~2U; - index += count1 - count; - - FT_TRACE4(( " vvcurveto\n" )); - - while ( index < count ) - { - CF2_Fixed x1, y1, x2, y2, x3, y3; - - - if ( ( count - index ) & 1 ) - { - x1 = cf2_stack_getReal( opStack, index ) + curX; - - index++; - } - else - x1 = curX; - - y1 = cf2_stack_getReal( opStack, index + 0 ) + curY; - x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; - x3 = x2; - y3 = cf2_stack_getReal( opStack, index + 3 ) + y2; - - cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); - - curX = x3; - curY = y3; - index += 4; - } - - cf2_stack_clear( opStack ); - } - continue; /* no need to clear stack again */ - - case cf2_cmdHHCURVETO: - { - CF2_UInt count, count1 = cf2_stack_count( opStack ); - CF2_UInt index = 0; - - - /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */ - /* we enforce it by clearing the second bit */ - /* (and sorting the stack indexing to suit) */ - count = count1 & ~2U; - index += count1 - count; - - FT_TRACE4(( " hhcurveto\n" )); - - while ( index < count ) - { - CF2_Fixed x1, y1, x2, y2, x3, y3; - - - if ( ( count - index ) & 1 ) - { - y1 = cf2_stack_getReal( opStack, index ) + curY; - - index++; - } - else - y1 = curY; - - x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; - x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; - x3 = cf2_stack_getReal( opStack, index + 3 ) + x2; - y3 = y2; - - cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); - - curX = x3; - curY = y3; - index += 4; - } - - cf2_stack_clear( opStack ); - } - continue; /* no need to clear stack again */ - - case cf2_cmdVHCURVETO: - case cf2_cmdHVCURVETO: - { - CF2_UInt count, count1 = cf2_stack_count( opStack ); - CF2_UInt index = 0; - - FT_Bool alternate = FT_BOOL( op1 == cf2_cmdHVCURVETO ); - - - /* if `cf2_stack_count' isn't of the form 8n, 8n+1, */ - /* 8n+4, or 8n+5, we enforce it by clearing the */ - /* second bit */ - /* (and sorting the stack indexing to suit) */ - count = count1 & ~2U; - index += count1 - count; - - FT_TRACE4(( alternate ? " hvcurveto\n" : " vhcurveto\n" )); - - while ( index < count ) - { - CF2_Fixed x1, x2, x3, y1, y2, y3; - - - if ( alternate ) - { - x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; - y1 = curY; - x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; - y3 = cf2_stack_getReal( opStack, index + 3 ) + y2; - - if ( count - index == 5 ) - { - x3 = cf2_stack_getReal( opStack, index + 4 ) + x2; - - index++; - } - else - x3 = x2; - - alternate = FALSE; - } - else - { - x1 = curX; - y1 = cf2_stack_getReal( opStack, index + 0 ) + curY; - x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; - x3 = cf2_stack_getReal( opStack, index + 3 ) + x2; - - if ( count - index == 5 ) - { - y3 = cf2_stack_getReal( opStack, index + 4 ) + y2; - - index++; - } - else - y3 = y2; - - alternate = TRUE; - } - - cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); - - curX = x3; - curY = y3; - index += 4; - } - - cf2_stack_clear( opStack ); - } - continue; /* no need to clear stack again */ - - case cf2_cmdEXTENDEDNMBR: - { - CF2_Int v; - - CF2_Int byte1 = cf2_buf_readByte( charstring ); - CF2_Int byte2 = cf2_buf_readByte( charstring ); - - - v = (FT_Short)( ( byte1 << 8 ) | - byte2 ); - - FT_TRACE4(( " %d", v )); - - cf2_stack_pushInt( opStack, v ); - } - continue; - - default: - /* numbers */ - { - if ( /* op1 >= 32 && */ op1 <= 246 ) - { - CF2_Int v; - - - v = op1 - 139; - - FT_TRACE4(( " %d", v )); - - /* -107 .. 107 */ - cf2_stack_pushInt( opStack, v ); - } - - else if ( /* op1 >= 247 && */ op1 <= 250 ) - { - CF2_Int v; - - - v = op1; - v -= 247; - v *= 256; - v += cf2_buf_readByte( charstring ); - v += 108; - - FT_TRACE4(( " %d", v )); - - /* 108 .. 1131 */ - cf2_stack_pushInt( opStack, v ); - } - - else if ( /* op1 >= 251 && */ op1 <= 254 ) - { - CF2_Int v; - - - v = op1; - v -= 251; - v *= 256; - v += cf2_buf_readByte( charstring ); - v = -v - 108; - - FT_TRACE4(( " %d", v )); - - /* -1131 .. -108 */ - cf2_stack_pushInt( opStack, v ); - } - - else /* op1 == 255 */ - { - CF2_Fixed v; - - FT_UInt32 byte1 = (FT_UInt32)cf2_buf_readByte( charstring ); - FT_UInt32 byte2 = (FT_UInt32)cf2_buf_readByte( charstring ); - FT_UInt32 byte3 = (FT_UInt32)cf2_buf_readByte( charstring ); - FT_UInt32 byte4 = (FT_UInt32)cf2_buf_readByte( charstring ); - - - v = (CF2_Fixed)( ( byte1 << 24 ) | - ( byte2 << 16 ) | - ( byte3 << 8 ) | - byte4 ); - - FT_TRACE4(( " %.5f", v / 65536.0 )); - - cf2_stack_pushFixed( opStack, v ); - } - } - continue; /* don't clear stack */ - - } /* end of switch statement checking `op1' */ - - cf2_stack_clear( opStack ); - - } /* end of main interpreter loop */ - - /* we get here if the charstring ends without cf2_cmdENDCHAR */ - FT_TRACE4(( "cf2_interpT2CharString:" - " charstring ends without ENDCHAR\n" )); - - exit: - /* check whether last error seen is also the first one */ - cf2_setError( error, lastError ); - - if ( *error ) - FT_TRACE4(( "charstring error %d\n", *error )); - - /* free resources from objects we've used */ - cf2_glyphpath_finalize( &glyphPath ); - cf2_arrstack_finalize( &vStemHintArray ); - cf2_arrstack_finalize( &hStemHintArray ); - cf2_arrstack_finalize( &subrStack ); - cf2_stack_free( opStack ); - - FT_TRACE4(( "\n" )); - - return; - } - - -/* END */ diff --git a/src/cff/cff.c b/src/cff/cff.c index 545fb202c..1a755d5da 100644 --- a/src/cff/cff.c +++ b/src/cff/cff.c @@ -4,7 +4,7 @@ /* */ /* FreeType OpenType driver component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,25 +17,14 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "cffpic.c" +#include "cffcmap.c" #include "cffdrivr.c" +#include "cffgload.c" #include "cffparse.c" +#include "cffpic.c" #include "cffload.c" #include "cffobjs.c" -#include "cffgload.c" -#include "cffcmap.c" - -#include "cf2arrst.c" -#include "cf2blues.c" -#include "cf2error.c" -#include "cf2font.c" -#include "cf2ft.c" -#include "cf2hints.c" -#include "cf2intrp.c" -#include "cf2read.c" -#include "cf2stack.c" /* END */ diff --git a/src/cff/cffcmap.c b/src/cff/cffcmap.c index 4adce7a54..e45ae1127 100644 --- a/src/cff/cffcmap.c +++ b/src/cff/cffcmap.c @@ -4,7 +4,7 @@ /* */ /* CFF character mapping table (cmap) support (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffcmap.h b/src/cff/cffcmap.h index 7792e0424..856a43dd1 100644 --- a/src/cff/cffcmap.h +++ b/src/cff/cffcmap.h @@ -4,7 +4,7 @@ /* */ /* CFF character mapping table (cmap) support (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,7 +19,7 @@ #ifndef CFFCMAP_H_ #define CFFCMAP_H_ -#include "cffobjs.h" +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H FT_BEGIN_HEADER diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 38bfc2ca3..df896848d 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -4,7 +4,7 @@ /* */ /* OpenType font driver implementation (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,16 +21,20 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_POSTSCRIPT_PROPS_H #include FT_SERVICE_CID_H #include FT_SERVICE_POSTSCRIPT_INFO_H #include FT_SERVICE_POSTSCRIPT_NAME_H #include FT_SERVICE_TT_CMAP_H +#include FT_SERVICE_CFF_TABLE_LOAD_H #include "cffdrivr.h" #include "cffgload.h" #include "cffload.h" #include "cffcmap.h" #include "cffparse.h" +#include "cffobjs.h" #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #include FT_SERVICE_MULTIPLE_MASTERS_H @@ -43,7 +47,7 @@ #include FT_SERVICE_FONT_FORMAT_H #include FT_SERVICE_GLYPH_DICT_H #include FT_SERVICE_PROPERTIES_H -#include FT_CFF_DRIVER_H +#include FT_DRIVER_H /*************************************************************************/ @@ -214,8 +218,8 @@ { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without VVAR table */ - if ( !ttface->is_default_instance && - !( ttface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) + if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) && + !( ttface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) return FT_THROW( Unimplemented_Feature ); #endif @@ -237,8 +241,10 @@ &dummy, &ah ); - FT_TRACE5(( " idx %d: advance height %d font units\n", - start + nn, ah )); + FT_TRACE5(( " idx %d: advance height %d font unit%s\n", + start + nn, + ah, + ah == 1 ? "" : "s" )); advances[nn] = ah; } } @@ -246,8 +252,8 @@ { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without HVAR table */ - if ( !ttface->is_default_instance && - !( ttface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) + if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) && + !( ttface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) return FT_THROW( Unimplemented_Feature ); #endif @@ -266,8 +272,10 @@ &dummy, &aw ); - FT_TRACE5(( " idx %d: advance width %d font units\n", - start + nn, aw )); + FT_TRACE5(( " idx %d: advance width %d font unit%s\n", + start + nn, + aw, + aw == 1 ? "" : "s" )); advances[nn] = aw; } } @@ -493,11 +501,89 @@ } + static FT_Error + cff_ps_get_font_extra( CFF_Face face, + PS_FontExtraRec* afont_extra ) + { + CFF_Font cff = (CFF_Font)face->extra.data; + FT_Error error = FT_Err_Ok; + + + if ( cff && cff->font_extra == NULL ) + { + CFF_FontRecDict dict = &cff->top_font.font_dict; + PS_FontExtraRec* font_extra = NULL; + FT_Memory memory = face->root.memory; + FT_String* embedded_postscript; + + + if ( FT_ALLOC( font_extra, sizeof ( *font_extra ) ) ) + goto Fail; + + font_extra->fs_type = 0U; + + embedded_postscript = cff_index_get_sid_string( + cff, + dict->embedded_postscript ); + if ( embedded_postscript ) + { + FT_String* start_fstype; + FT_String* start_def; + + + /* Identify the XYZ integer in `/FSType XYZ def' substring. */ + if ( ( start_fstype = ft_strstr( embedded_postscript, + "/FSType" ) ) != NULL && + ( start_def = ft_strstr( start_fstype + + sizeof ( "/FSType" ) - 1, + "def" ) ) != NULL ) + { + FT_String* s; + + + for ( s = start_fstype + sizeof ( "/FSType" ) - 1; + s != start_def; + s++ ) + { + if ( *s >= '0' && *s <= '9' ) + { + if ( font_extra->fs_type >= ( FT_USHORT_MAX - 9 ) / 10 ) + { + /* Overflow - ignore the FSType value. */ + font_extra->fs_type = 0U; + break; + } + + font_extra->fs_type *= 10; + font_extra->fs_type += (FT_UShort)( *s - '0' ); + } + else if ( *s != ' ' && *s != '\n' && *s != '\r' ) + { + /* Non-whitespace character between `/FSType' and next `def' */ + /* - ignore the FSType value. */ + font_extra->fs_type = 0U; + break; + } + } + } + } + + cff->font_extra = font_extra; + } + + if ( cff ) + *afont_extra = *cff->font_extra; + + Fail: + return error; + } + + FT_DEFINE_SERVICE_PSINFOREC( cff_service_ps_info, (PS_GetFontInfoFunc) cff_ps_get_font_info, /* ps_get_font_info */ - (PS_GetFontExtraFunc) NULL, /* ps_get_font_extra */ + (PS_GetFontExtraFunc) cff_ps_get_font_extra, /* ps_get_font_extra */ (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names, /* ps_has_glyph_names */ /* unsupported with CFF fonts */ (PS_GetFontPrivateFunc)NULL, /* ps_get_font_private */ @@ -735,231 +821,12 @@ * PROPERTY SERVICE * */ - static FT_Error - cff_property_set( FT_Module module, /* CFF_Driver */ - const char* property_name, - const void* value, - FT_Bool value_is_string ) - { - FT_Error error = FT_Err_Ok; - CFF_Driver driver = (CFF_Driver)module; - -#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - FT_UNUSED( value_is_string ); -#endif - - - if ( !ft_strcmp( property_name, "darkening-parameters" ) ) - { - FT_Int* darken_params; - FT_Int x1, y1, x2, y2, x3, y3, x4, y4; - -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - FT_Int dp[8]; - - - if ( value_is_string ) - { - const char* s = (const char*)value; - char* ep; - int i; - - - /* eight comma-separated numbers */ - for ( i = 0; i < 7; i++ ) - { - dp[i] = (FT_Int)ft_strtol( s, &ep, 10 ); - if ( *ep != ',' || s == ep ) - return FT_THROW( Invalid_Argument ); - - s = ep + 1; - } - - dp[7] = (FT_Int)ft_strtol( s, &ep, 10 ); - if ( !( *ep == '\0' || *ep == ' ' ) || s == ep ) - return FT_THROW( Invalid_Argument ); - - darken_params = dp; - } - else -#endif - darken_params = (FT_Int*)value; - - x1 = darken_params[0]; - y1 = darken_params[1]; - x2 = darken_params[2]; - y2 = darken_params[3]; - x3 = darken_params[4]; - y3 = darken_params[5]; - x4 = darken_params[6]; - y4 = darken_params[7]; - - if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 || - y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 || - x1 > x2 || x2 > x3 || x3 > x4 || - y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 ) - return FT_THROW( Invalid_Argument ); - - driver->darken_params[0] = x1; - driver->darken_params[1] = y1; - driver->darken_params[2] = x2; - driver->darken_params[3] = y2; - driver->darken_params[4] = x3; - driver->darken_params[5] = y3; - driver->darken_params[6] = x4; - driver->darken_params[7] = y4; - - return error; - } - else if ( !ft_strcmp( property_name, "hinting-engine" ) ) - { -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - if ( value_is_string ) - { - const char* s = (const char*)value; - - - if ( !ft_strcmp( s, "adobe" ) ) - driver->hinting_engine = FT_CFF_HINTING_ADOBE; -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - else if ( !ft_strcmp( s, "freetype" ) ) - driver->hinting_engine = FT_CFF_HINTING_FREETYPE; -#endif - else - return FT_THROW( Invalid_Argument ); - } - else -#endif - { - FT_UInt* hinting_engine = (FT_UInt*)value; - - - if ( *hinting_engine == FT_CFF_HINTING_ADOBE -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - || *hinting_engine == FT_CFF_HINTING_FREETYPE -#endif - ) - driver->hinting_engine = *hinting_engine; - else - error = FT_ERR( Unimplemented_Feature ); - - return error; - } - } - else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) - { -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - if ( value_is_string ) - { - const char* s = (const char*)value; - long nsd = ft_strtol( s, NULL, 10 ); - - - if ( !nsd ) - driver->no_stem_darkening = FALSE; - else - driver->no_stem_darkening = TRUE; - } - else -#endif - { - FT_Bool* no_stem_darkening = (FT_Bool*)value; - - - driver->no_stem_darkening = *no_stem_darkening; - } - - return error; - } - else if ( !ft_strcmp( property_name, "random-seed" ) ) - { - FT_Int32 random_seed; - - -#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES - if ( value_is_string ) - { - const char* s = (const char*)value; - - - random_seed = (FT_Int32)ft_strtol( s, NULL, 10 ); - } - else -#endif - random_seed = *(FT_Int32*)value; - - if ( random_seed < 0 ) - random_seed = 0; - - driver->random_seed = random_seed; - - return error; - } - - FT_TRACE0(( "cff_property_set: missing property `%s'\n", - property_name )); - return FT_THROW( Missing_Property ); - } - - - static FT_Error - cff_property_get( FT_Module module, /* CFF_Driver */ - const char* property_name, - const void* value ) - { - FT_Error error = FT_Err_Ok; - CFF_Driver driver = (CFF_Driver)module; - - - if ( !ft_strcmp( property_name, "darkening-parameters" ) ) - { - FT_Int* darken_params = driver->darken_params; - FT_Int* val = (FT_Int*)value; - - - val[0] = darken_params[0]; - val[1] = darken_params[1]; - val[2] = darken_params[2]; - val[3] = darken_params[3]; - val[4] = darken_params[4]; - val[5] = darken_params[5]; - val[6] = darken_params[6]; - val[7] = darken_params[7]; - - return error; - } - else if ( !ft_strcmp( property_name, "hinting-engine" ) ) - { - FT_UInt hinting_engine = driver->hinting_engine; - FT_UInt* val = (FT_UInt*)value; - - - *val = hinting_engine; - - return error; - } - else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) - { - FT_Bool no_stem_darkening = driver->no_stem_darkening; - FT_Bool* val = (FT_Bool*)value; - - - *val = no_stem_darkening; - - return error; - } - - FT_TRACE0(( "cff_property_get: missing property `%s'\n", - property_name )); - return FT_THROW( Missing_Property ); - } - FT_DEFINE_SERVICE_PROPERTIESREC( cff_service_properties, - (FT_Properties_SetFunc)cff_property_set, /* set_property */ - (FT_Properties_GetFunc)cff_property_get ) /* get_property */ + (FT_Properties_SetFunc)ps_property_set, /* set_property */ + (FT_Properties_GetFunc)ps_property_get ) /* get_property */ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT @@ -1028,6 +895,17 @@ } + static FT_Error + cff_set_instance( CFF_Face face, + FT_UInt instance_index ) + { + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + + return mm->set_instance( FT_FACE( face ), instance_index ); + } + + FT_DEFINE_SERVICE_MULTIMASTERSREC( cff_service_multi_masters, @@ -1038,6 +916,7 @@ (FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */ (FT_Set_Var_Design_Func)cff_set_var_design, /* set_var_design */ (FT_Get_Var_Design_Func)cff_get_var_design, /* get_var_design */ + (FT_Set_Instance_Func) cff_set_instance, /* set_instance */ (FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */ (FT_Done_Blend_Func) cff_done_blend /* done_blend */ @@ -1088,6 +967,22 @@ #endif + /* + * CFFLOAD SERVICE + * + */ + + FT_DEFINE_SERVICE_CFFLOADREC( + cff_service_cff_load, + + (FT_Get_Standard_Encoding_Func)cff_get_standard_encoding, + (FT_Load_Private_Dict_Func) cff_load_private_dict, + (FT_FD_Select_Get_Func) cff_fd_select_get, + (FT_Blend_Check_Vector_Func) cff_blend_check_vector, + (FT_Blend_Build_Vector_Func) cff_blend_build_vector + ) + + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -1102,7 +997,7 @@ #if !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES && \ defined TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_DEFINE_SERVICEDESCREC9( + FT_DEFINE_SERVICEDESCREC10( cff_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, @@ -1113,10 +1008,11 @@ FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET, FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET ) #elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES - FT_DEFINE_SERVICEDESCREC7( + FT_DEFINE_SERVICEDESCREC8( cff_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, @@ -1125,10 +1021,11 @@ FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET, FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET ) #elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_DEFINE_SERVICEDESCREC8( + FT_DEFINE_SERVICEDESCREC9( cff_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, @@ -1138,10 +1035,11 @@ FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET ) #else - FT_DEFINE_SERVICEDESCREC6( + FT_DEFINE_SERVICEDESCREC7( cff_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, @@ -1149,7 +1047,8 @@ FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET ) #endif @@ -1208,7 +1107,7 @@ FT_MODULE_DRIVER_HAS_HINTER | FT_MODULE_DRIVER_HINTS_LIGHTLY, - sizeof ( CFF_DriverRec ), + sizeof ( PS_DriverRec ), "cff", 0x10000L, 0x20000L, diff --git a/src/cff/cffdrivr.h b/src/cff/cffdrivr.h index 05381e66d..ad7c3ad70 100644 --- a/src/cff/cffdrivr.h +++ b/src/cff/cffdrivr.h @@ -4,7 +4,7 @@ /* */ /* High-level OpenType driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cfferrs.h b/src/cff/cfferrs.h index 40808c105..b2e1bfaf9 100644 --- a/src/cff/cfferrs.h +++ b/src/cff/cfferrs.h @@ -4,7 +4,7 @@ /* */ /* CFF error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 4803b4bbc..c58471ce8 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,13 +20,13 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H +#include FT_INTERNAL_CALC_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_OUTLINE_H -#include FT_CFF_DRIVER_H +#include FT_DRIVER_H -#include "cffobjs.h" #include "cffload.h" #include "cffgload.h" -#include "cf2ft.h" /* for cf2_decoder_parse_charstrings */ #include "cfferrs.h" @@ -41,2602 +41,76 @@ #define FT_COMPONENT trace_cffgload -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - - typedef enum CFF_Operator_ - { - cff_op_unknown = 0, - - cff_op_rmoveto, - cff_op_hmoveto, - cff_op_vmoveto, - - cff_op_rlineto, - cff_op_hlineto, - cff_op_vlineto, - - cff_op_rrcurveto, - cff_op_hhcurveto, - cff_op_hvcurveto, - cff_op_rcurveline, - cff_op_rlinecurve, - cff_op_vhcurveto, - cff_op_vvcurveto, - - cff_op_flex, - cff_op_hflex, - cff_op_hflex1, - cff_op_flex1, - - cff_op_endchar, - - cff_op_hstem, - cff_op_vstem, - cff_op_hstemhm, - cff_op_vstemhm, - - cff_op_hintmask, - cff_op_cntrmask, - cff_op_dotsection, /* deprecated, acts as no-op */ - - cff_op_abs, - cff_op_add, - cff_op_sub, - cff_op_div, - cff_op_neg, - cff_op_random, - cff_op_mul, - cff_op_sqrt, - - cff_op_blend, - - cff_op_drop, - cff_op_exch, - cff_op_index, - cff_op_roll, - cff_op_dup, - - cff_op_put, - cff_op_get, - cff_op_store, - cff_op_load, - - cff_op_and, - cff_op_or, - cff_op_not, - cff_op_eq, - cff_op_ifelse, - - cff_op_callsubr, - cff_op_callgsubr, - cff_op_return, - - /* Type 1 opcodes: invalid but seen in real life */ - cff_op_hsbw, - cff_op_closepath, - cff_op_callothersubr, - cff_op_pop, - cff_op_seac, - cff_op_sbw, - cff_op_setcurrentpoint, - - /* do not remove */ - cff_op_max - - } CFF_Operator; - - -#define CFF_COUNT_CHECK_WIDTH 0x80 -#define CFF_COUNT_EXACT 0x40 -#define CFF_COUNT_CLEAR_STACK 0x20 - - /* count values which have the `CFF_COUNT_CHECK_WIDTH' flag set are */ - /* used for checking the width and requested numbers of arguments */ - /* only; they are set to zero afterwards */ - - /* the other two flags are informative only and unused currently */ - - static const FT_Byte cff_argument_counts[] = - { - 0, /* unknown */ - - 2 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, /* rmoveto */ - 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, - 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, - - 0 | CFF_COUNT_CLEAR_STACK, /* rlineto */ - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - - 0 | CFF_COUNT_CLEAR_STACK, /* rrcurveto */ - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - 0 | CFF_COUNT_CLEAR_STACK, - - 13, /* flex */ - 7, - 9, - 11, - - 0 | CFF_COUNT_CHECK_WIDTH, /* endchar */ - - 2 | CFF_COUNT_CHECK_WIDTH, /* hstem */ - 2 | CFF_COUNT_CHECK_WIDTH, - 2 | CFF_COUNT_CHECK_WIDTH, - 2 | CFF_COUNT_CHECK_WIDTH, - - 0 | CFF_COUNT_CHECK_WIDTH, /* hintmask */ - 0 | CFF_COUNT_CHECK_WIDTH, /* cntrmask */ - 0, /* dotsection */ - - 1, /* abs */ - 2, - 2, - 2, - 1, - 0, - 2, - 1, - - 1, /* blend */ - - 1, /* drop */ - 2, - 1, - 2, - 1, - - 2, /* put */ - 1, - 4, - 3, - - 2, /* and */ - 2, - 1, - 2, - 4, - - 1, /* callsubr */ - 1, - 0, - - 2, /* hsbw */ - 0, - 0, - 0, - 5, /* seac */ - 4, /* sbw */ - 2 /* setcurrentpoint */ - }; - -#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /********** *********/ - /********** *********/ - /********** GENERIC CHARSTRING PARSING *********/ - /********** *********/ - /********** *********/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* */ - /* cff_builder_init */ - /* */ - /* */ - /* Initializes a given glyph builder. */ - /* */ - /* */ - /* builder :: A pointer to the glyph builder to initialize. */ - /* */ - /* */ - /* face :: The current face object. */ - /* */ - /* size :: The current size object. */ - /* */ - /* glyph :: The current glyph object. */ - /* */ - /* hinting :: Whether hinting is active. */ - /* */ - static void - cff_builder_init( CFF_Builder* builder, - TT_Face face, - CFF_Size size, - CFF_GlyphSlot glyph, - FT_Bool hinting ) - { - builder->path_begun = 0; - builder->load_points = 1; - - builder->face = face; - builder->glyph = glyph; - builder->memory = face->root.memory; - - if ( glyph ) - { - FT_GlyphLoader loader = glyph->root.internal->loader; - - - builder->loader = loader; - builder->base = &loader->base.outline; - builder->current = &loader->current.outline; - FT_GlyphLoader_Rewind( loader ); - - builder->hints_globals = NULL; - builder->hints_funcs = NULL; - - if ( hinting && size ) - { - CFF_Internal internal = (CFF_Internal)size->root.internal; - - - builder->hints_globals = (void *)internal->topfont; - builder->hints_funcs = glyph->root.internal->glyph_hints; - } - } - - builder->pos_x = 0; - builder->pos_y = 0; - - builder->left_bearing.x = 0; - builder->left_bearing.y = 0; - builder->advance.x = 0; - builder->advance.y = 0; - } - - - /*************************************************************************/ - /* */ - /* */ - /* cff_builder_done */ - /* */ - /* */ - /* Finalizes a given glyph builder. Its contents can still be used */ - /* after the call, but the function saves important information */ - /* within the corresponding glyph slot. */ - /* */ - /* */ - /* builder :: A pointer to the glyph builder to finalize. */ - /* */ - static void - cff_builder_done( CFF_Builder* builder ) - { - CFF_GlyphSlot glyph = builder->glyph; - - - if ( glyph ) - glyph->root.outline = *builder->base; - } - - - /*************************************************************************/ - /* */ - /* */ - /* cff_compute_bias */ - /* */ - /* */ - /* Computes the bias value in dependence of the number of glyph */ - /* subroutines. */ - /* */ - /* */ - /* in_charstring_type :: The `CharstringType' value of the top DICT */ - /* dictionary. */ - /* */ - /* num_subrs :: The number of glyph subroutines. */ - /* */ - /* */ - /* The bias value. */ - static FT_Int - cff_compute_bias( FT_Int in_charstring_type, - FT_UInt num_subrs ) - { - FT_Int result; - - - if ( in_charstring_type == 1 ) - result = 0; - else if ( num_subrs < 1240 ) - result = 107; - else if ( num_subrs < 33900U ) - result = 1131; - else - result = 32768U; - - return result; - } - - - /*************************************************************************/ - /* */ - /* */ - /* cff_decoder_init */ - /* */ - /* */ - /* Initializes a given glyph decoder. */ - /* */ - /* */ - /* decoder :: A pointer to the glyph builder to initialize. */ - /* */ - /* */ - /* face :: The current face object. */ - /* */ - /* size :: The current size object. */ - /* */ - /* slot :: The current glyph object. */ - /* */ - /* hinting :: Whether hinting is active. */ - /* */ - /* hint_mode :: The hinting mode. */ - /* */ - FT_LOCAL_DEF( void ) - cff_decoder_init( CFF_Decoder* decoder, - TT_Face face, - CFF_Size size, - CFF_GlyphSlot slot, - FT_Bool hinting, - FT_Render_Mode hint_mode ) - { - CFF_Font cff = (CFF_Font)face->extra.data; - - - /* clear everything */ - FT_ZERO( decoder ); - - /* initialize builder */ - cff_builder_init( &decoder->builder, face, size, slot, hinting ); - - /* initialize Type2 decoder */ - decoder->cff = cff; - decoder->num_globals = cff->global_subrs_index.count; - decoder->globals = cff->global_subrs; - decoder->globals_bias = cff_compute_bias( - cff->top_font.font_dict.charstring_type, - decoder->num_globals ); - - decoder->hint_mode = hint_mode; - } - - - /* this function is used to select the subfont */ - /* and the locals subrs array */ - FT_LOCAL_DEF( FT_Error ) - cff_decoder_prepare( CFF_Decoder* decoder, - CFF_Size size, - FT_UInt glyph_index ) - { - CFF_Builder *builder = &decoder->builder; - CFF_Font cff = (CFF_Font)builder->face->extra.data; - CFF_SubFont sub = &cff->top_font; - FT_Error error = FT_Err_Ok; - - - /* manage CID fonts */ - if ( cff->num_subfonts ) - { - FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, glyph_index ); - - - if ( fd_index >= cff->num_subfonts ) - { - FT_TRACE4(( "cff_decoder_prepare: invalid CID subfont index\n" )); - error = FT_THROW( Invalid_File_Format ); - goto Exit; - } - - FT_TRACE3(( " in subfont %d:\n", fd_index )); - - sub = cff->subfonts[fd_index]; - - if ( builder->hints_funcs && size ) - { - CFF_Internal internal = (CFF_Internal)size->root.internal; - - - /* for CFFs without subfonts, this value has already been set */ - builder->hints_globals = (void *)internal->subfonts[fd_index]; - } - } - - decoder->num_locals = sub->local_subrs_index.count; - decoder->locals = sub->local_subrs; - decoder->locals_bias = cff_compute_bias( - decoder->cff->top_font.font_dict.charstring_type, - decoder->num_locals ); - - decoder->glyph_width = sub->private_dict.default_width; - decoder->nominal_width = sub->private_dict.nominal_width; - - decoder->current_subfont = sub; - - Exit: - return error; - } - - - /* check that there is enough space for `count' more points */ - FT_LOCAL_DEF( FT_Error ) - cff_check_points( CFF_Builder* builder, - FT_Int count ) - { - return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 ); - } - - - /* add a new point, do not check space */ - FT_LOCAL_DEF( void ) - cff_builder_add_point( CFF_Builder* builder, - FT_Pos x, - FT_Pos y, - FT_Byte flag ) - { - FT_Outline* outline = builder->current; - - - if ( builder->load_points ) - { - FT_Vector* point = outline->points + outline->n_points; - FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; - -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); - - - if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) - { - point->x = x >> 16; - point->y = y >> 16; - } - else -#endif - { - /* cf2_decoder_parse_charstrings uses 16.16 coordinates */ - point->x = x >> 10; - point->y = y >> 10; - } - *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC ); - } - - outline->n_points++; - } - - - /* check space for a new on-curve point, then add it */ - FT_LOCAL_DEF( FT_Error ) - cff_builder_add_point1( CFF_Builder* builder, - FT_Pos x, - FT_Pos y ) - { - FT_Error error; - - - error = cff_check_points( builder, 1 ); - if ( !error ) - cff_builder_add_point( builder, x, y, 1 ); - - return error; - } - - - /* check space for a new contour, then add it */ - static FT_Error - cff_builder_add_contour( CFF_Builder* builder ) - { - FT_Outline* outline = builder->current; - FT_Error error; - - - if ( !builder->load_points ) - { - outline->n_contours++; - return FT_Err_Ok; - } - - error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 ); - if ( !error ) - { - if ( outline->n_contours > 0 ) - outline->contours[outline->n_contours - 1] = - (short)( outline->n_points - 1 ); - - outline->n_contours++; - } - - return error; - } - - - /* if a path was begun, add its first on-curve point */ - FT_LOCAL_DEF( FT_Error ) - cff_builder_start_point( CFF_Builder* builder, - FT_Pos x, - FT_Pos y ) - { - FT_Error error = FT_Err_Ok; - - - /* test whether we are building a new contour */ - if ( !builder->path_begun ) - { - builder->path_begun = 1; - error = cff_builder_add_contour( builder ); - if ( !error ) - error = cff_builder_add_point1( builder, x, y ); - } - - return error; - } - - - /* close the current contour */ - FT_LOCAL_DEF( void ) - cff_builder_close_contour( CFF_Builder* builder ) - { - FT_Outline* outline = builder->current; - FT_Int first; - - - if ( !outline ) - return; - - first = outline->n_contours <= 1 - ? 0 : outline->contours[outline->n_contours - 2] + 1; - - /* We must not include the last point in the path if it */ - /* is located on the first point. */ - if ( outline->n_points > 1 ) - { - FT_Vector* p1 = outline->points + first; - FT_Vector* p2 = outline->points + outline->n_points - 1; - FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1; - - - /* `delete' last point only if it coincides with the first */ - /* point and if it is not a control point (which can happen). */ - if ( p1->x == p2->x && p1->y == p2->y ) - if ( *control == FT_CURVE_TAG_ON ) - outline->n_points--; - } - - if ( outline->n_contours > 0 ) - { - /* Don't add contours only consisting of one point, i.e., */ - /* check whether begin point and last point are the same. */ - if ( first == outline->n_points - 1 ) - { - outline->n_contours--; - outline->n_points--; - } - else - outline->contours[outline->n_contours - 1] = - (short)( outline->n_points - 1 ); - } - } - - - FT_LOCAL_DEF( FT_Int ) - cff_lookup_glyph_by_stdcharcode( CFF_Font cff, - FT_Int charcode ) - { - FT_UInt n; - FT_UShort glyph_sid; - - - /* CID-keyed fonts don't have glyph names */ - if ( !cff->charset.sids ) - return -1; - - /* check range of standard char code */ - if ( charcode < 0 || charcode > 255 ) - return -1; - - /* Get code to SID mapping from `cff_standard_encoding'. */ - glyph_sid = cff_get_standard_encoding( (FT_UInt)charcode ); - - for ( n = 0; n < cff->num_glyphs; n++ ) - { - if ( cff->charset.sids[n] == glyph_sid ) - return (FT_Int)n; - } - - return -1; - } - - - FT_LOCAL_DEF( FT_Error ) - cff_get_glyph_data( TT_Face face, - FT_UInt glyph_index, - FT_Byte** pointer, - FT_ULong* length ) - { -#ifdef FT_CONFIG_OPTION_INCREMENTAL - /* For incremental fonts get the character data using the */ - /* callback function. */ - if ( face->root.internal->incremental_interface ) - { - FT_Data data; - FT_Error error = - face->root.internal->incremental_interface->funcs->get_glyph_data( - face->root.internal->incremental_interface->object, - glyph_index, &data ); - - - *pointer = (FT_Byte*)data.pointer; - *length = (FT_ULong)data.length; - - return error; - } - else -#endif /* FT_CONFIG_OPTION_INCREMENTAL */ - - { - CFF_Font cff = (CFF_Font)(face->extra.data); - - - return cff_index_access_element( &cff->charstrings_index, glyph_index, - pointer, length ); - } - } - - - FT_LOCAL_DEF( void ) - cff_free_glyph_data( TT_Face face, - FT_Byte** pointer, - FT_ULong length ) - { -#ifndef FT_CONFIG_OPTION_INCREMENTAL - FT_UNUSED( length ); -#endif - -#ifdef FT_CONFIG_OPTION_INCREMENTAL - /* For incremental fonts get the character data using the */ - /* callback function. */ - if ( face->root.internal->incremental_interface ) - { - FT_Data data; - - - data.pointer = *pointer; - data.length = (FT_Int)length; - - face->root.internal->incremental_interface->funcs->free_glyph_data( - face->root.internal->incremental_interface->object, &data ); - } - else -#endif /* FT_CONFIG_OPTION_INCREMENTAL */ - - { - CFF_Font cff = (CFF_Font)(face->extra.data); - - - cff_index_forget_element( &cff->charstrings_index, pointer ); - } - } - - -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - - static FT_Error - cff_operator_seac( CFF_Decoder* decoder, - FT_Pos asb, - FT_Pos adx, - FT_Pos ady, - FT_Int bchar, - FT_Int achar ) - { - FT_Error error; - CFF_Builder* builder = &decoder->builder; - FT_Int bchar_index, achar_index; - TT_Face face = decoder->builder.face; - FT_Vector left_bearing, advance; - FT_Byte* charstring; - FT_ULong charstring_len; - FT_Pos glyph_width; - - - if ( decoder->seac ) - { - FT_ERROR(( "cff_operator_seac: invalid nested seac\n" )); - return FT_THROW( Syntax_Error ); - } - - adx += decoder->builder.left_bearing.x; - ady += decoder->builder.left_bearing.y; - -#ifdef FT_CONFIG_OPTION_INCREMENTAL - /* Incremental fonts don't necessarily have valid charsets. */ - /* They use the character code, not the glyph index, in this case. */ - if ( face->root.internal->incremental_interface ) - { - bchar_index = bchar; - achar_index = achar; - } - else -#endif /* FT_CONFIG_OPTION_INCREMENTAL */ - { - CFF_Font cff = (CFF_Font)(face->extra.data); - - - bchar_index = cff_lookup_glyph_by_stdcharcode( cff, bchar ); - achar_index = cff_lookup_glyph_by_stdcharcode( cff, achar ); - } - - if ( bchar_index < 0 || achar_index < 0 ) - { - FT_ERROR(( "cff_operator_seac:" - " invalid seac character code arguments\n" )); - return FT_THROW( Syntax_Error ); - } - - /* If we are trying to load a composite glyph, do not load the */ - /* accent character and return the array of subglyphs. */ - if ( builder->no_recurse ) - { - FT_GlyphSlot glyph = (FT_GlyphSlot)builder->glyph; - FT_GlyphLoader loader = glyph->internal->loader; - FT_SubGlyph subg; - - - /* reallocate subglyph array if necessary */ - error = FT_GlyphLoader_CheckSubGlyphs( loader, 2 ); - if ( error ) - goto Exit; - - subg = loader->current.subglyphs; - - /* subglyph 0 = base character */ - subg->index = bchar_index; - subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES | - FT_SUBGLYPH_FLAG_USE_MY_METRICS; - subg->arg1 = 0; - subg->arg2 = 0; - subg++; - - /* subglyph 1 = accent character */ - subg->index = achar_index; - subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES; - subg->arg1 = (FT_Int)( adx >> 16 ); - subg->arg2 = (FT_Int)( ady >> 16 ); - - /* set up remaining glyph fields */ - glyph->num_subglyphs = 2; - glyph->subglyphs = loader->base.subglyphs; - glyph->format = FT_GLYPH_FORMAT_COMPOSITE; - - loader->current.num_subglyphs = 2; - } - - FT_GlyphLoader_Prepare( builder->loader ); - - /* First load `bchar' in builder */ - error = cff_get_glyph_data( face, (FT_UInt)bchar_index, - &charstring, &charstring_len ); - if ( !error ) - { - /* the seac operator must not be nested */ - decoder->seac = TRUE; - error = cff_decoder_parse_charstrings( decoder, charstring, - charstring_len, 0 ); - decoder->seac = FALSE; - - cff_free_glyph_data( face, &charstring, charstring_len ); - - if ( error ) - goto Exit; - } - - /* Save the left bearing, advance and glyph width of the base */ - /* character as they will be erased by the next load. */ - - left_bearing = builder->left_bearing; - advance = builder->advance; - glyph_width = decoder->glyph_width; - - builder->left_bearing.x = 0; - builder->left_bearing.y = 0; - - builder->pos_x = adx - asb; - builder->pos_y = ady; - - /* Now load `achar' on top of the base outline. */ - error = cff_get_glyph_data( face, (FT_UInt)achar_index, - &charstring, &charstring_len ); - if ( !error ) - { - /* the seac operator must not be nested */ - decoder->seac = TRUE; - error = cff_decoder_parse_charstrings( decoder, charstring, - charstring_len, 0 ); - decoder->seac = FALSE; - - cff_free_glyph_data( face, &charstring, charstring_len ); - - if ( error ) - goto Exit; - } - - /* Restore the left side bearing, advance and glyph width */ - /* of the base character. */ - builder->left_bearing = left_bearing; - builder->advance = advance; - decoder->glyph_width = glyph_width; - - builder->pos_x = 0; - builder->pos_y = 0; - - Exit: - return error; - } - - - /*************************************************************************/ - /* */ - /* */ - /* cff_decoder_parse_charstrings */ - /* */ - /* */ - /* Parses a given Type 2 charstrings program. */ - /* */ - /* */ - /* decoder :: The current Type 1 decoder. */ - /* */ - /* */ - /* charstring_base :: The base of the charstring stream. */ - /* */ - /* charstring_len :: The length in bytes of the charstring stream. */ - /* */ - /* in_dict :: Set to 1 if function is called from top or */ - /* private DICT (needed for Multiple Master CFFs). */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - FT_LOCAL_DEF( FT_Error ) - cff_decoder_parse_charstrings( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len, - FT_Bool in_dict ) - { - FT_Error error; - CFF_Decoder_Zone* zone; - FT_Byte* ip; - FT_Byte* limit; - CFF_Builder* builder = &decoder->builder; - FT_Pos x, y; - FT_Fixed* stack; - FT_Int charstring_type = - decoder->cff->top_font.font_dict.charstring_type; - FT_UShort num_designs = - decoder->cff->top_font.font_dict.num_designs; - FT_UShort num_axes = - decoder->cff->top_font.font_dict.num_axes; - - T2_Hints_Funcs hinter; - - - /* set default width */ - decoder->num_hints = 0; - decoder->read_width = 1; - - /* initialize the decoder */ - decoder->top = decoder->stack; - decoder->zone = decoder->zones; - zone = decoder->zones; - stack = decoder->top; - - hinter = (T2_Hints_Funcs)builder->hints_funcs; - - builder->path_begun = 0; - - zone->base = charstring_base; - limit = zone->limit = charstring_base + charstring_len; - ip = zone->cursor = zone->base; - - error = FT_Err_Ok; - - x = builder->pos_x; - y = builder->pos_y; - - /* begin hints recording session, if any */ - if ( hinter ) - hinter->open( hinter->hints ); - - /* now execute loop */ - while ( ip < limit ) - { - CFF_Operator op; - FT_Byte v; - - - /********************************************************************/ - /* */ - /* Decode operator or operand */ - /* */ - v = *ip++; - if ( v >= 32 || v == 28 ) - { - FT_Int shift = 16; - FT_Int32 val; - - - /* this is an operand, push it on the stack */ - - /* if we use shifts, all computations are done with unsigned */ - /* values; the conversion to a signed value is the last step */ - if ( v == 28 ) - { - if ( ip + 1 >= limit ) - goto Syntax_Error; - val = (FT_Short)( ( (FT_UShort)ip[0] << 8 ) | ip[1] ); - ip += 2; - } - else if ( v < 247 ) - val = (FT_Int32)v - 139; - else if ( v < 251 ) - { - if ( ip >= limit ) - goto Syntax_Error; - val = ( (FT_Int32)v - 247 ) * 256 + *ip++ + 108; - } - else if ( v < 255 ) - { - if ( ip >= limit ) - goto Syntax_Error; - val = -( (FT_Int32)v - 251 ) * 256 - *ip++ - 108; - } - else - { - if ( ip + 3 >= limit ) - goto Syntax_Error; - val = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) | - ( (FT_UInt32)ip[1] << 16 ) | - ( (FT_UInt32)ip[2] << 8 ) | - (FT_UInt32)ip[3] ); - ip += 4; - if ( charstring_type == 2 ) - shift = 0; - } - if ( decoder->top - stack >= CFF_MAX_OPERANDS ) - goto Stack_Overflow; - - val = (FT_Int32)( (FT_UInt32)val << shift ); - *decoder->top++ = val; - -#ifdef FT_DEBUG_LEVEL_TRACE - if ( !( val & 0xFFFFL ) ) - FT_TRACE4(( " %hd", (FT_Short)( (FT_UInt32)val >> 16 ) )); - else - FT_TRACE4(( " %.5f", val / 65536.0 )); -#endif - - } - else - { - /* The specification says that normally arguments are to be taken */ - /* from the bottom of the stack. However, this seems not to be */ - /* correct, at least for Acroread 7.0.8 on GNU/Linux: It pops the */ - /* arguments similar to a PS interpreter. */ - - FT_Fixed* args = decoder->top; - FT_Int num_args = (FT_Int)( args - decoder->stack ); - FT_Int req_args; - - - /* find operator */ - op = cff_op_unknown; - - switch ( v ) - { - case 1: - op = cff_op_hstem; - break; - case 3: - op = cff_op_vstem; - break; - case 4: - op = cff_op_vmoveto; - break; - case 5: - op = cff_op_rlineto; - break; - case 6: - op = cff_op_hlineto; - break; - case 7: - op = cff_op_vlineto; - break; - case 8: - op = cff_op_rrcurveto; - break; - case 9: - op = cff_op_closepath; - break; - case 10: - op = cff_op_callsubr; - break; - case 11: - op = cff_op_return; - break; - case 12: - { - if ( ip >= limit ) - goto Syntax_Error; - v = *ip++; - - switch ( v ) - { - case 0: - op = cff_op_dotsection; - break; - case 1: /* this is actually the Type1 vstem3 operator */ - op = cff_op_vstem; - break; - case 2: /* this is actually the Type1 hstem3 operator */ - op = cff_op_hstem; - break; - case 3: - op = cff_op_and; - break; - case 4: - op = cff_op_or; - break; - case 5: - op = cff_op_not; - break; - case 6: - op = cff_op_seac; - break; - case 7: - op = cff_op_sbw; - break; - case 8: - op = cff_op_store; - break; - case 9: - op = cff_op_abs; - break; - case 10: - op = cff_op_add; - break; - case 11: - op = cff_op_sub; - break; - case 12: - op = cff_op_div; - break; - case 13: - op = cff_op_load; - break; - case 14: - op = cff_op_neg; - break; - case 15: - op = cff_op_eq; - break; - case 16: - op = cff_op_callothersubr; - break; - case 17: - op = cff_op_pop; - break; - case 18: - op = cff_op_drop; - break; - case 20: - op = cff_op_put; - break; - case 21: - op = cff_op_get; - break; - case 22: - op = cff_op_ifelse; - break; - case 23: - op = cff_op_random; - break; - case 24: - op = cff_op_mul; - break; - case 26: - op = cff_op_sqrt; - break; - case 27: - op = cff_op_dup; - break; - case 28: - op = cff_op_exch; - break; - case 29: - op = cff_op_index; - break; - case 30: - op = cff_op_roll; - break; - case 33: - op = cff_op_setcurrentpoint; - break; - case 34: - op = cff_op_hflex; - break; - case 35: - op = cff_op_flex; - break; - case 36: - op = cff_op_hflex1; - break; - case 37: - op = cff_op_flex1; - break; - default: - FT_TRACE4(( " unknown op (12, %d)\n", v )); - break; - } - } - break; - case 13: - op = cff_op_hsbw; - break; - case 14: - op = cff_op_endchar; - break; - case 16: - op = cff_op_blend; - break; - case 18: - op = cff_op_hstemhm; - break; - case 19: - op = cff_op_hintmask; - break; - case 20: - op = cff_op_cntrmask; - break; - case 21: - op = cff_op_rmoveto; - break; - case 22: - op = cff_op_hmoveto; - break; - case 23: - op = cff_op_vstemhm; - break; - case 24: - op = cff_op_rcurveline; - break; - case 25: - op = cff_op_rlinecurve; - break; - case 26: - op = cff_op_vvcurveto; - break; - case 27: - op = cff_op_hhcurveto; - break; - case 29: - op = cff_op_callgsubr; - break; - case 30: - op = cff_op_vhcurveto; - break; - case 31: - op = cff_op_hvcurveto; - break; - default: - FT_TRACE4(( " unknown op (%d)\n", v )); - break; - } - - if ( op == cff_op_unknown ) - continue; - - /* in Multiple Master CFFs, T2 charstrings can appear in */ - /* dictionaries, but some operators are prohibited */ - if ( in_dict ) - { - switch ( op ) - { - case cff_op_hstem: - case cff_op_vstem: - case cff_op_vmoveto: - case cff_op_rlineto: - case cff_op_hlineto: - case cff_op_vlineto: - case cff_op_rrcurveto: - case cff_op_hstemhm: - case cff_op_hintmask: - case cff_op_cntrmask: - case cff_op_rmoveto: - case cff_op_hmoveto: - case cff_op_vstemhm: - case cff_op_rcurveline: - case cff_op_rlinecurve: - case cff_op_vvcurveto: - case cff_op_hhcurveto: - case cff_op_vhcurveto: - case cff_op_hvcurveto: - case cff_op_hflex: - case cff_op_flex: - case cff_op_hflex1: - case cff_op_flex1: - case cff_op_callsubr: - case cff_op_callgsubr: - goto MM_Error; - - default: - break; - } - } - - /* check arguments */ - req_args = cff_argument_counts[op]; - if ( req_args & CFF_COUNT_CHECK_WIDTH ) - { - if ( num_args > 0 && decoder->read_width ) - { - /* If `nominal_width' is non-zero, the number is really a */ - /* difference against `nominal_width'. Else, the number here */ - /* is truly a width, not a difference against `nominal_width'. */ - /* If the font does not set `nominal_width', then */ - /* `nominal_width' defaults to zero, and so we can set */ - /* `glyph_width' to `nominal_width' plus number on the stack */ - /* -- for either case. */ - - FT_Int set_width_ok; - - - switch ( op ) - { - case cff_op_hmoveto: - case cff_op_vmoveto: - set_width_ok = num_args & 2; - break; - - case cff_op_hstem: - case cff_op_vstem: - case cff_op_hstemhm: - case cff_op_vstemhm: - case cff_op_rmoveto: - case cff_op_hintmask: - case cff_op_cntrmask: - set_width_ok = num_args & 1; - break; - - case cff_op_endchar: - /* If there is a width specified for endchar, we either have */ - /* 1 argument or 5 arguments. We like to argue. */ - set_width_ok = in_dict - ? 0 - : ( ( num_args == 5 ) || ( num_args == 1 ) ); - break; - - default: - set_width_ok = 0; - break; - } - - if ( set_width_ok ) - { - decoder->glyph_width = decoder->nominal_width + - ( stack[0] >> 16 ); - - if ( decoder->width_only ) - { - /* we only want the advance width; stop here */ - break; - } - - /* Consumed an argument. */ - num_args--; - } - } - - decoder->read_width = 0; - req_args = 0; - } - - req_args &= 0x000F; - if ( num_args < req_args ) - goto Stack_Underflow; - args -= req_args; - num_args -= req_args; - - /* At this point, `args' points to the first argument of the */ - /* operand in case `req_args' isn't zero. Otherwise, we have */ - /* to adjust `args' manually. */ - - /* Note that we only pop arguments from the stack which we */ - /* really need and can digest so that we can continue in case */ - /* of superfluous stack elements. */ - - switch ( op ) - { - case cff_op_hstem: - case cff_op_vstem: - case cff_op_hstemhm: - case cff_op_vstemhm: - /* the number of arguments is always even here */ - FT_TRACE4(( - op == cff_op_hstem ? " hstem\n" : - ( op == cff_op_vstem ? " vstem\n" : - ( op == cff_op_hstemhm ? " hstemhm\n" : " vstemhm\n" ) ) )); - - if ( hinter ) - hinter->stems( hinter->hints, - ( op == cff_op_hstem || op == cff_op_hstemhm ), - num_args / 2, - args - ( num_args & ~1 ) ); - - decoder->num_hints += num_args / 2; - args = stack; - break; - - case cff_op_hintmask: - case cff_op_cntrmask: - FT_TRACE4(( op == cff_op_hintmask ? " hintmask" : " cntrmask" )); - - /* implement vstem when needed -- */ - /* the specification doesn't say it, but this also works */ - /* with the 'cntrmask' operator */ - /* */ - if ( num_args > 0 ) - { - if ( hinter ) - hinter->stems( hinter->hints, - 0, - num_args / 2, - args - ( num_args & ~1 ) ); - - decoder->num_hints += num_args / 2; - } - - /* In a valid charstring there must be at least one byte */ - /* after `hintmask' or `cntrmask' (e.g., for a `return' */ - /* instruction). Additionally, there must be space for */ - /* `num_hints' bits. */ - - if ( ( ip + ( ( decoder->num_hints + 7 ) >> 3 ) ) >= limit ) - goto Syntax_Error; - - if ( hinter ) - { - if ( op == cff_op_hintmask ) - hinter->hintmask( hinter->hints, - (FT_UInt)builder->current->n_points, - (FT_UInt)decoder->num_hints, - ip ); - else - hinter->counter( hinter->hints, - (FT_UInt)decoder->num_hints, - ip ); - } - -#ifdef FT_DEBUG_LEVEL_TRACE - { - FT_UInt maskbyte; - - - FT_TRACE4(( " (maskbytes:" )); - - for ( maskbyte = 0; - maskbyte < (FT_UInt)( ( decoder->num_hints + 7 ) >> 3 ); - maskbyte++, ip++ ) - FT_TRACE4(( " 0x%02X", *ip )); - - FT_TRACE4(( ")\n" )); - } -#else - ip += ( decoder->num_hints + 7 ) >> 3; -#endif - args = stack; - break; - - case cff_op_rmoveto: - FT_TRACE4(( " rmoveto\n" )); - - cff_builder_close_contour( builder ); - builder->path_begun = 0; - x += args[-2]; - y += args[-1]; - args = stack; - break; - - case cff_op_vmoveto: - FT_TRACE4(( " vmoveto\n" )); - - cff_builder_close_contour( builder ); - builder->path_begun = 0; - y += args[-1]; - args = stack; - break; - - case cff_op_hmoveto: - FT_TRACE4(( " hmoveto\n" )); - - cff_builder_close_contour( builder ); - builder->path_begun = 0; - x += args[-1]; - args = stack; - break; - - case cff_op_rlineto: - FT_TRACE4(( " rlineto\n" )); - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, num_args / 2 ) ) - goto Fail; - - if ( num_args < 2 ) - goto Stack_Underflow; - - args -= num_args & ~1; - while ( args < decoder->top ) - { - x += args[0]; - y += args[1]; - cff_builder_add_point( builder, x, y, 1 ); - args += 2; - } - args = stack; - break; - - case cff_op_hlineto: - case cff_op_vlineto: - { - FT_Int phase = ( op == cff_op_hlineto ); - - - FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n" - : " vlineto\n" )); - - if ( num_args < 0 ) - goto Stack_Underflow; - - /* there exist subsetted fonts (found in PDFs) */ - /* which call `hlineto' without arguments */ - if ( num_args == 0 ) - break; - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, num_args ) ) - goto Fail; - - args = stack; - while ( args < decoder->top ) - { - if ( phase ) - x += args[0]; - else - y += args[0]; - - if ( cff_builder_add_point1( builder, x, y ) ) - goto Fail; - - args++; - phase ^= 1; - } - args = stack; - } - break; - - case cff_op_rrcurveto: - { - FT_Int nargs; - - - FT_TRACE4(( " rrcurveto\n" )); - - if ( num_args < 6 ) - goto Stack_Underflow; - - nargs = num_args - num_args % 6; - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, nargs / 2 ) ) - goto Fail; - - args -= nargs; - while ( args < decoder->top ) - { - x += args[0]; - y += args[1]; - cff_builder_add_point( builder, x, y, 0 ); - x += args[2]; - y += args[3]; - cff_builder_add_point( builder, x, y, 0 ); - x += args[4]; - y += args[5]; - cff_builder_add_point( builder, x, y, 1 ); - args += 6; - } - args = stack; - } - break; - - case cff_op_vvcurveto: - { - FT_Int nargs; - - - FT_TRACE4(( " vvcurveto\n" )); - - if ( num_args < 4 ) - goto Stack_Underflow; - - /* if num_args isn't of the form 4n or 4n+1, */ - /* we enforce it by clearing the second bit */ - - nargs = num_args & ~2; - - if ( cff_builder_start_point( builder, x, y ) ) - goto Fail; - - args -= nargs; - - if ( nargs & 1 ) - { - x += args[0]; - args++; - nargs--; - } - - if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) ) - goto Fail; - - while ( args < decoder->top ) - { - y += args[0]; - cff_builder_add_point( builder, x, y, 0 ); - x += args[1]; - y += args[2]; - cff_builder_add_point( builder, x, y, 0 ); - y += args[3]; - cff_builder_add_point( builder, x, y, 1 ); - args += 4; - } - args = stack; - } - break; - - case cff_op_hhcurveto: - { - FT_Int nargs; - - - FT_TRACE4(( " hhcurveto\n" )); - - if ( num_args < 4 ) - goto Stack_Underflow; - - /* if num_args isn't of the form 4n or 4n+1, */ - /* we enforce it by clearing the second bit */ - - nargs = num_args & ~2; - - if ( cff_builder_start_point( builder, x, y ) ) - goto Fail; - - args -= nargs; - if ( nargs & 1 ) - { - y += args[0]; - args++; - nargs--; - } - - if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) ) - goto Fail; - - while ( args < decoder->top ) - { - x += args[0]; - cff_builder_add_point( builder, x, y, 0 ); - x += args[1]; - y += args[2]; - cff_builder_add_point( builder, x, y, 0 ); - x += args[3]; - cff_builder_add_point( builder, x, y, 1 ); - args += 4; - } - args = stack; - } - break; - - case cff_op_vhcurveto: - case cff_op_hvcurveto: - { - FT_Int phase; - FT_Int nargs; - - - FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto\n" - : " hvcurveto\n" )); - - if ( cff_builder_start_point( builder, x, y ) ) - goto Fail; - - if ( num_args < 4 ) - goto Stack_Underflow; - - /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */ - /* we enforce it by clearing the second bit */ - - nargs = num_args & ~2; - - args -= nargs; - if ( cff_check_points( builder, ( nargs / 4 ) * 3 ) ) - goto Stack_Underflow; - - phase = ( op == cff_op_hvcurveto ); - - while ( nargs >= 4 ) - { - nargs -= 4; - if ( phase ) - { - x += args[0]; - cff_builder_add_point( builder, x, y, 0 ); - x += args[1]; - y += args[2]; - cff_builder_add_point( builder, x, y, 0 ); - y += args[3]; - if ( nargs == 1 ) - x += args[4]; - cff_builder_add_point( builder, x, y, 1 ); - } - else - { - y += args[0]; - cff_builder_add_point( builder, x, y, 0 ); - x += args[1]; - y += args[2]; - cff_builder_add_point( builder, x, y, 0 ); - x += args[3]; - if ( nargs == 1 ) - y += args[4]; - cff_builder_add_point( builder, x, y, 1 ); - } - args += 4; - phase ^= 1; - } - args = stack; - } - break; - - case cff_op_rlinecurve: - { - FT_Int num_lines; - FT_Int nargs; - - - FT_TRACE4(( " rlinecurve\n" )); - - if ( num_args < 8 ) - goto Stack_Underflow; - - nargs = num_args & ~1; - num_lines = ( nargs - 6 ) / 2; - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, num_lines + 3 ) ) - goto Fail; - - args -= nargs; - - /* first, add the line segments */ - while ( num_lines > 0 ) - { - x += args[0]; - y += args[1]; - cff_builder_add_point( builder, x, y, 1 ); - args += 2; - num_lines--; - } - - /* then the curve */ - x += args[0]; - y += args[1]; - cff_builder_add_point( builder, x, y, 0 ); - x += args[2]; - y += args[3]; - cff_builder_add_point( builder, x, y, 0 ); - x += args[4]; - y += args[5]; - cff_builder_add_point( builder, x, y, 1 ); - args = stack; - } - break; - - case cff_op_rcurveline: - { - FT_Int num_curves; - FT_Int nargs; - - - FT_TRACE4(( " rcurveline\n" )); - - if ( num_args < 8 ) - goto Stack_Underflow; - - nargs = num_args - 2; - nargs = nargs - nargs % 6 + 2; - num_curves = ( nargs - 2 ) / 6; - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, num_curves * 3 + 2 ) ) - goto Fail; - - args -= nargs; - - /* first, add the curves */ - while ( num_curves > 0 ) - { - x += args[0]; - y += args[1]; - cff_builder_add_point( builder, x, y, 0 ); - x += args[2]; - y += args[3]; - cff_builder_add_point( builder, x, y, 0 ); - x += args[4]; - y += args[5]; - cff_builder_add_point( builder, x, y, 1 ); - args += 6; - num_curves--; - } - - /* then the final line */ - x += args[0]; - y += args[1]; - cff_builder_add_point( builder, x, y, 1 ); - args = stack; - } - break; - - case cff_op_hflex1: - { - FT_Pos start_y; - - - FT_TRACE4(( " hflex1\n" )); - - /* adding five more points: 4 control points, 1 on-curve point */ - /* -- make sure we have enough space for the start point if it */ - /* needs to be added */ - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, 6 ) ) - goto Fail; - - /* record the starting point's y position for later use */ - start_y = y; - - /* first control point */ - x += args[0]; - y += args[1]; - cff_builder_add_point( builder, x, y, 0 ); - - /* second control point */ - x += args[2]; - y += args[3]; - cff_builder_add_point( builder, x, y, 0 ); - - /* join point; on curve, with y-value the same as the last */ - /* control point's y-value */ - x += args[4]; - cff_builder_add_point( builder, x, y, 1 ); - - /* third control point, with y-value the same as the join */ - /* point's y-value */ - x += args[5]; - cff_builder_add_point( builder, x, y, 0 ); - - /* fourth control point */ - x += args[6]; - y += args[7]; - cff_builder_add_point( builder, x, y, 0 ); - - /* ending point, with y-value the same as the start */ - x += args[8]; - y = start_y; - cff_builder_add_point( builder, x, y, 1 ); - - args = stack; - break; - } - - case cff_op_hflex: - { - FT_Pos start_y; - - - FT_TRACE4(( " hflex\n" )); - - /* adding six more points; 4 control points, 2 on-curve points */ - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, 6 ) ) - goto Fail; - - /* record the starting point's y-position for later use */ - start_y = y; - - /* first control point */ - x += args[0]; - cff_builder_add_point( builder, x, y, 0 ); - - /* second control point */ - x += args[1]; - y += args[2]; - cff_builder_add_point( builder, x, y, 0 ); - - /* join point; on curve, with y-value the same as the last */ - /* control point's y-value */ - x += args[3]; - cff_builder_add_point( builder, x, y, 1 ); - - /* third control point, with y-value the same as the join */ - /* point's y-value */ - x += args[4]; - cff_builder_add_point( builder, x, y, 0 ); - - /* fourth control point */ - x += args[5]; - y = start_y; - cff_builder_add_point( builder, x, y, 0 ); - - /* ending point, with y-value the same as the start point's */ - /* y-value -- we don't add this point, though */ - x += args[6]; - cff_builder_add_point( builder, x, y, 1 ); - - args = stack; - break; - } - - case cff_op_flex1: - { - FT_Pos start_x, start_y; /* record start x, y values for */ - /* alter use */ - FT_Fixed dx = 0, dy = 0; /* used in horizontal/vertical */ - /* algorithm below */ - FT_Int horizontal, count; - FT_Fixed* temp; - - - FT_TRACE4(( " flex1\n" )); - - /* adding six more points; 4 control points, 2 on-curve points */ - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, 6 ) ) - goto Fail; - - /* record the starting point's x, y position for later use */ - start_x = x; - start_y = y; - - /* XXX: figure out whether this is supposed to be a horizontal */ - /* or vertical flex; the Type 2 specification is vague... */ - - temp = args; - - /* grab up to the last argument */ - for ( count = 5; count > 0; count-- ) - { - dx += temp[0]; - dy += temp[1]; - temp += 2; - } - - if ( dx < 0 ) - dx = -dx; - if ( dy < 0 ) - dy = -dy; - - /* strange test, but here it is... */ - horizontal = ( dx > dy ); - - for ( count = 5; count > 0; count-- ) - { - x += args[0]; - y += args[1]; - cff_builder_add_point( builder, x, y, - (FT_Bool)( count == 3 ) ); - args += 2; - } - - /* is last operand an x- or y-delta? */ - if ( horizontal ) - { - x += args[0]; - y = start_y; - } - else - { - x = start_x; - y += args[0]; - } - - cff_builder_add_point( builder, x, y, 1 ); - - args = stack; - break; - } - - case cff_op_flex: - { - FT_UInt count; - - - FT_TRACE4(( " flex\n" )); - - if ( cff_builder_start_point( builder, x, y ) || - cff_check_points( builder, 6 ) ) - goto Fail; - - for ( count = 6; count > 0; count-- ) - { - x += args[0]; - y += args[1]; - cff_builder_add_point( builder, x, y, - (FT_Bool)( count == 4 || count == 1 ) ); - args += 2; - } - - args = stack; - } - break; - - case cff_op_seac: - FT_TRACE4(( " seac\n" )); - - error = cff_operator_seac( decoder, - args[0], args[1], args[2], - (FT_Int)( args[3] >> 16 ), - (FT_Int)( args[4] >> 16 ) ); - - /* add current outline to the glyph slot */ - FT_GlyphLoader_Add( builder->loader ); - - /* return now! */ - FT_TRACE4(( "\n" )); - return error; - - case cff_op_endchar: - /* in dictionaries, `endchar' simply indicates end of data */ - if ( in_dict ) - return error; - - FT_TRACE4(( " endchar\n" )); - - /* We are going to emulate the seac operator. */ - if ( num_args >= 4 ) - { - /* Save glyph width so that the subglyphs don't overwrite it. */ - FT_Pos glyph_width = decoder->glyph_width; - - - error = cff_operator_seac( decoder, - 0L, args[-4], args[-3], - (FT_Int)( args[-2] >> 16 ), - (FT_Int)( args[-1] >> 16 ) ); - - decoder->glyph_width = glyph_width; - } - else - { - cff_builder_close_contour( builder ); - - /* close hints recording session */ - if ( hinter ) - { - if ( hinter->close( hinter->hints, - (FT_UInt)builder->current->n_points ) ) - goto Syntax_Error; - - /* apply hints to the loaded glyph outline now */ - error = hinter->apply( hinter->hints, - builder->current, - (PSH_Globals)builder->hints_globals, - decoder->hint_mode ); - if ( error ) - goto Fail; - } - - /* add current outline to the glyph slot */ - FT_GlyphLoader_Add( builder->loader ); - } - - /* return now! */ - FT_TRACE4(( "\n" )); - return error; - - case cff_op_abs: - FT_TRACE4(( " abs\n" )); - - if ( args[0] < 0 ) - args[0] = -args[0]; - args++; - break; - - case cff_op_add: - FT_TRACE4(( " add\n" )); - - args[0] += args[1]; - args++; - break; - - case cff_op_sub: - FT_TRACE4(( " sub\n" )); - - args[0] -= args[1]; - args++; - break; - - case cff_op_div: - FT_TRACE4(( " div\n" )); - - args[0] = FT_DivFix( args[0], args[1] ); - args++; - break; - - case cff_op_neg: - FT_TRACE4(( " neg\n" )); - - args[0] = -args[0]; - args++; - break; - - case cff_op_random: - FT_TRACE4(( " random\n" )); - - /* only use the lower 16 bits of `random' */ - /* to generate a number in the range (0;1] */ - args[0] = (FT_Fixed) - ( ( decoder->current_subfont->random & 0xFFFF ) + 1 ); - args++; - - decoder->current_subfont->random = - cff_random( decoder->current_subfont->random ); - break; - - case cff_op_mul: - FT_TRACE4(( " mul\n" )); - - args[0] = FT_MulFix( args[0], args[1] ); - args++; - break; - - case cff_op_sqrt: - FT_TRACE4(( " sqrt\n" )); - - if ( args[0] > 0 ) - { - FT_Fixed root = args[0]; - FT_Fixed new_root; - - - for (;;) - { - new_root = ( root + FT_DivFix( args[0], root ) + 1 ) >> 1; - if ( new_root == root ) - break; - root = new_root; - } - args[0] = new_root; - } - else - args[0] = 0; - args++; - break; - - case cff_op_drop: - /* nothing */ - FT_TRACE4(( " drop\n" )); - - break; - - case cff_op_exch: - { - FT_Fixed tmp; - - - FT_TRACE4(( " exch\n" )); - - tmp = args[0]; - args[0] = args[1]; - args[1] = tmp; - args += 2; - } - break; - - case cff_op_index: - { - FT_Int idx = (FT_Int)( args[0] >> 16 ); - - - FT_TRACE4(( " index\n" )); - - if ( idx < 0 ) - idx = 0; - else if ( idx > num_args - 2 ) - idx = num_args - 2; - args[0] = args[-( idx + 1 )]; - args++; - } - break; - - case cff_op_roll: - { - FT_Int count = (FT_Int)( args[0] >> 16 ); - FT_Int idx = (FT_Int)( args[1] >> 16 ); - - - FT_TRACE4(( " roll\n" )); - - if ( count <= 0 ) - count = 1; - - args -= count; - if ( args < stack ) - goto Stack_Underflow; - - if ( idx >= 0 ) - { - while ( idx > 0 ) - { - FT_Fixed tmp = args[count - 1]; - FT_Int i; - - - for ( i = count - 2; i >= 0; i-- ) - args[i + 1] = args[i]; - args[0] = tmp; - idx--; - } - } - else - { - while ( idx < 0 ) - { - FT_Fixed tmp = args[0]; - FT_Int i; - - - for ( i = 0; i < count - 1; i++ ) - args[i] = args[i + 1]; - args[count - 1] = tmp; - idx++; - } - } - args += count; - } - break; - - case cff_op_dup: - FT_TRACE4(( " dup\n" )); - - args[1] = args[0]; - args += 2; - break; - - case cff_op_put: - { - FT_Fixed val = args[0]; - FT_Int idx = (FT_Int)( args[1] >> 16 ); - - - FT_TRACE4(( " put\n" )); - - /* the Type2 specification before version 16-March-2000 */ - /* didn't give a hard-coded size limit of the temporary */ - /* storage array; instead, an argument of the */ - /* `MultipleMaster' operator set the size */ - if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS ) - decoder->buildchar[idx] = val; - } - break; - - case cff_op_get: - { - FT_Int idx = (FT_Int)( args[0] >> 16 ); - FT_Fixed val = 0; - - - FT_TRACE4(( " get\n" )); - - if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS ) - val = decoder->buildchar[idx]; - - args[0] = val; - args++; - } - break; - - case cff_op_store: - /* this operator was removed from the Type2 specification */ - /* in version 16-March-2000 */ - - /* since we currently don't handle interpolation of multiple */ - /* master fonts, this is a no-op */ - FT_TRACE4(( " store\n")); - break; - - case cff_op_load: - /* this operator was removed from the Type2 specification */ - /* in version 16-March-2000 */ - { - FT_Int reg_idx = (FT_Int)args[0]; - FT_Int idx = (FT_Int)args[1]; - FT_Int count = (FT_Int)args[2]; - - - FT_TRACE4(( " load\n" )); - - /* since we currently don't handle interpolation of multiple */ - /* master fonts, we store a vector [1 0 0 ...] in the */ - /* temporary storage array regardless of the Registry index */ - if ( reg_idx >= 0 && reg_idx <= 2 && - idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS && - count >= 0 && count <= num_axes ) - { - FT_Int end, i; - - - end = FT_MIN( idx + count, CFF_MAX_TRANS_ELEMENTS ); - - if ( idx < end ) - decoder->buildchar[idx] = 1 << 16; - - for ( i = idx + 1; i < end; i++ ) - decoder->buildchar[i] = 0; - } - } - break; - - case cff_op_blend: - /* this operator was removed from the Type2 specification */ - /* in version 16-March-2000 */ - { - FT_Int num_results = (FT_Int)( args[0] >> 16 ); - - - FT_TRACE4(( " blend\n" )); - - if ( num_results < 0 ) - goto Syntax_Error; - - if ( num_results * (FT_Int)num_designs > num_args ) - goto Stack_Underflow; - - /* since we currently don't handle interpolation of multiple */ - /* master fonts, return the `num_results' values of the */ - /* first master */ - args -= num_results * ( num_designs - 1 ); - num_args -= num_results * ( num_designs - 1 ); - } - break; - - case cff_op_dotsection: - /* this operator is deprecated and ignored by the parser */ - FT_TRACE4(( " dotsection\n" )); - break; - - case cff_op_closepath: - /* this is an invalid Type 2 operator; however, there */ - /* exist fonts which are incorrectly converted from probably */ - /* Type 1 to CFF, and some parsers seem to accept it */ - - FT_TRACE4(( " closepath (invalid op)\n" )); - - args = stack; - break; - - case cff_op_hsbw: - /* this is an invalid Type 2 operator; however, there */ - /* exist fonts which are incorrectly converted from probably */ - /* Type 1 to CFF, and some parsers seem to accept it */ - - FT_TRACE4(( " hsbw (invalid op)\n" )); - - decoder->glyph_width = decoder->nominal_width + ( args[1] >> 16 ); - - decoder->builder.left_bearing.x = args[0]; - decoder->builder.left_bearing.y = 0; - - x = decoder->builder.pos_x + args[0]; - y = decoder->builder.pos_y; - args = stack; - break; - - case cff_op_sbw: - /* this is an invalid Type 2 operator; however, there */ - /* exist fonts which are incorrectly converted from probably */ - /* Type 1 to CFF, and some parsers seem to accept it */ - - FT_TRACE4(( " sbw (invalid op)\n" )); - - decoder->glyph_width = decoder->nominal_width + ( args[2] >> 16 ); - - decoder->builder.left_bearing.x = args[0]; - decoder->builder.left_bearing.y = args[1]; - - x = decoder->builder.pos_x + args[0]; - y = decoder->builder.pos_y + args[1]; - args = stack; - break; - - case cff_op_setcurrentpoint: - /* this is an invalid Type 2 operator; however, there */ - /* exist fonts which are incorrectly converted from probably */ - /* Type 1 to CFF, and some parsers seem to accept it */ - - FT_TRACE4(( " setcurrentpoint (invalid op)\n" )); - - x = decoder->builder.pos_x + args[0]; - y = decoder->builder.pos_y + args[1]; - args = stack; - break; - - case cff_op_callothersubr: - /* this is an invalid Type 2 operator; however, there */ - /* exist fonts which are incorrectly converted from probably */ - /* Type 1 to CFF, and some parsers seem to accept it */ - - FT_TRACE4(( " callothersubr (invalid op)\n" )); - - /* subsequent `pop' operands should add the arguments, */ - /* this is the implementation described for `unknown' other */ - /* subroutines in the Type1 spec. */ - /* */ - /* XXX Fix return arguments (see discussion below). */ - args -= 2 + ( args[-2] >> 16 ); - if ( args < stack ) - goto Stack_Underflow; - break; - - case cff_op_pop: - /* this is an invalid Type 2 operator; however, there */ - /* exist fonts which are incorrectly converted from probably */ - /* Type 1 to CFF, and some parsers seem to accept it */ - - FT_TRACE4(( " pop (invalid op)\n" )); - - /* XXX Increasing `args' is wrong: After a certain number of */ - /* `pop's we get a stack overflow. Reason for doing it is */ - /* code like this (actually found in a CFF font): */ - /* */ - /* 17 1 3 callothersubr */ - /* pop */ - /* callsubr */ - /* */ - /* Since we handle `callothersubr' as a no-op, and */ - /* `callsubr' needs at least one argument, `pop' can't be a */ - /* no-op too as it basically should be. */ - /* */ - /* The right solution would be to provide real support for */ - /* `callothersubr' as done in `t1decode.c', however, given */ - /* the fact that CFF fonts with `pop' are invalid, it is */ - /* questionable whether it is worth the time. */ - args++; - break; - - case cff_op_and: - { - FT_Fixed cond = ( args[0] && args[1] ); - - - FT_TRACE4(( " and\n" )); - - args[0] = cond ? 0x10000L : 0; - args++; - } - break; - - case cff_op_or: - { - FT_Fixed cond = ( args[0] || args[1] ); - - - FT_TRACE4(( " or\n" )); - - args[0] = cond ? 0x10000L : 0; - args++; - } - break; - - case cff_op_not: - { - FT_Fixed cond = !args[0]; - - - FT_TRACE4(( " not\n" )); - - args[0] = cond ? 0x10000L : 0; - args++; - } - break; - - case cff_op_eq: - { - FT_Fixed cond = ( args[0] == args[1] ); - - - FT_TRACE4(( " eq\n" )); - - args[0] = cond ? 0x10000L : 0; - args++; - } - break; - - case cff_op_ifelse: - { - FT_Fixed cond = ( args[2] <= args[3] ); - - - FT_TRACE4(( " ifelse\n" )); - - if ( !cond ) - args[0] = args[1]; - args++; - } - break; - - case cff_op_callsubr: - { - FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + - decoder->locals_bias ); - - - FT_TRACE4(( " callsubr (idx %d, entering level %d)\n", - idx, - zone - decoder->zones + 1 )); - - if ( idx >= decoder->num_locals ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " invalid local subr index\n" )); - goto Syntax_Error; - } - - if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " too many nested subrs\n" )); - goto Syntax_Error; - } - - zone->cursor = ip; /* save current instruction pointer */ - - zone++; - zone->base = decoder->locals[idx]; - zone->limit = decoder->locals[idx + 1]; - zone->cursor = zone->base; - - if ( !zone->base || zone->limit == zone->base ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " invoking empty subrs\n" )); - goto Syntax_Error; - } - - decoder->zone = zone; - ip = zone->base; - limit = zone->limit; - } - break; - - case cff_op_callgsubr: - { - FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + - decoder->globals_bias ); - - - FT_TRACE4(( " callgsubr (idx %d, entering level %d)\n", - idx, - zone - decoder->zones + 1 )); - - if ( idx >= decoder->num_globals ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " invalid global subr index\n" )); - goto Syntax_Error; - } - - if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " too many nested subrs\n" )); - goto Syntax_Error; - } - - zone->cursor = ip; /* save current instruction pointer */ - - zone++; - zone->base = decoder->globals[idx]; - zone->limit = decoder->globals[idx + 1]; - zone->cursor = zone->base; - - if ( !zone->base || zone->limit == zone->base ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " invoking empty subrs\n" )); - goto Syntax_Error; - } - - decoder->zone = zone; - ip = zone->base; - limit = zone->limit; - } - break; - - case cff_op_return: - FT_TRACE4(( " return (leaving level %d)\n", - decoder->zone - decoder->zones )); + FT_LOCAL_DEF( FT_Error ) + cff_get_glyph_data( TT_Face face, + FT_UInt glyph_index, + FT_Byte** pointer, + FT_ULong* length ) + { +#ifdef FT_CONFIG_OPTION_INCREMENTAL + /* For incremental fonts get the character data using the */ + /* callback function. */ + if ( face->root.internal->incremental_interface ) + { + FT_Data data; + FT_Error error = + face->root.internal->incremental_interface->funcs->get_glyph_data( + face->root.internal->incremental_interface->object, + glyph_index, &data ); - if ( decoder->zone <= decoder->zones ) - { - FT_ERROR(( "cff_decoder_parse_charstrings:" - " unexpected return\n" )); - goto Syntax_Error; - } - decoder->zone--; - zone = decoder->zone; - ip = zone->cursor; - limit = zone->limit; - break; + *pointer = (FT_Byte*)data.pointer; + *length = (FT_ULong)data.length; - default: - FT_ERROR(( "Unimplemented opcode: %d", ip[-1] )); + return error; + } + else +#endif /* FT_CONFIG_OPTION_INCREMENTAL */ - if ( ip[-1] == 12 ) - FT_ERROR(( " %d", ip[0] )); - FT_ERROR(( "\n" )); + { + CFF_Font cff = (CFF_Font)(face->extra.data); - return FT_THROW( Unimplemented_Feature ); - } - decoder->top = args; + return cff_index_access_element( &cff->charstrings_index, glyph_index, + pointer, length ); + } + } - if ( decoder->top - stack >= CFF_MAX_OPERANDS ) - goto Stack_Overflow; - } /* general operator processing */ + FT_LOCAL_DEF( void ) + cff_free_glyph_data( TT_Face face, + FT_Byte** pointer, + FT_ULong length ) + { +#ifndef FT_CONFIG_OPTION_INCREMENTAL + FT_UNUSED( length ); +#endif - } /* while ip < limit */ +#ifdef FT_CONFIG_OPTION_INCREMENTAL + /* For incremental fonts get the character data using the */ + /* callback function. */ + if ( face->root.internal->incremental_interface ) + { + FT_Data data; - FT_TRACE4(( "..end..\n\n" )); - Fail: - return error; + data.pointer = *pointer; + data.length = (FT_Int)length; - MM_Error: - FT_TRACE4(( "cff_decoder_parse_charstrings:" - " invalid opcode found in top DICT charstring\n")); - return FT_THROW( Invalid_File_Format ); + face->root.internal->incremental_interface->funcs->free_glyph_data( + face->root.internal->incremental_interface->object, &data ); + } + else +#endif /* FT_CONFIG_OPTION_INCREMENTAL */ - Syntax_Error: - FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error\n" )); - return FT_THROW( Invalid_File_Format ); + { + CFF_Font cff = (CFF_Font)(face->extra.data); - Stack_Underflow: - FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow\n" )); - return FT_THROW( Too_Few_Arguments ); - Stack_Overflow: - FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow\n" )); - return FT_THROW( Stack_Overflow ); + cff_index_forget_element( &cff->charstrings_index, pointer ); + } } -#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ - /*************************************************************************/ /*************************************************************************/ @@ -2668,11 +142,14 @@ FT_Int glyph_index; CFF_Font cff = (CFF_Font)face->other; + PSAux_Service psaux = (PSAux_Service)face->psaux; + const CFF_Decoder_Funcs decoder_funcs = psaux->cff_decoder_funcs; + *max_advance = 0; /* Initialize load decoder */ - cff_decoder_init( &decoder, face, 0, 0, 0, 0 ); + decoder_funcs->init( &decoder, face, 0, 0, 0, 0, 0, 0 ); decoder.builder.metrics_only = 1; decoder.builder.load_points = 0; @@ -2691,12 +168,12 @@ &charstring, &charstring_len ); if ( !error ) { - error = cff_decoder_prepare( &decoder, size, glyph_index ); + error = decoder_funcs->prepare( &decoder, size, glyph_index ); if ( !error ) - error = cff_decoder_parse_charstrings( &decoder, - charstring, - charstring_len, - 0 ); + error = decoder_funcs->parse_charstrings_old( &decoder, + charstring, + charstring_len, + 0 ); cff_free_glyph_data( face, &charstring, &charstring_len ); } @@ -2722,10 +199,14 @@ { FT_Error error; CFF_Decoder decoder; + PS_Decoder psdecoder; TT_Face face = (TT_Face)glyph->root.face; FT_Bool hinting, scaled, force_scaling; CFF_Font cff = (CFF_Font)face->extra.data; + PSAux_Service psaux = (PSAux_Service)face->psaux; + const CFF_Decoder_Funcs decoder_funcs = psaux->cff_decoder_funcs; + FT_Matrix font_matrix; FT_Vector font_offset; @@ -2915,7 +396,7 @@ { #ifdef CFF_CONFIG_OPTION_OLD_ENGINE - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( face ); + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face ); #endif @@ -2923,8 +404,10 @@ FT_ULong charstring_len; - cff_decoder_init( &decoder, face, size, glyph, hinting, - FT_LOAD_TARGET_MODE( load_flags ) ); + decoder_funcs->init( &decoder, face, size, glyph, hinting, + FT_LOAD_TARGET_MODE( load_flags ), + cff_get_glyph_data, + cff_free_glyph_data ); /* this is for pure CFFs */ if ( load_flags & FT_LOAD_ADVANCE_ONLY ) @@ -2939,23 +422,25 @@ if ( error ) goto Glyph_Build_Finished; - error = cff_decoder_prepare( &decoder, size, glyph_index ); + error = decoder_funcs->prepare( &decoder, size, glyph_index ); if ( error ) goto Glyph_Build_Finished; #ifdef CFF_CONFIG_OPTION_OLD_ENGINE /* choose which CFF renderer to use */ - if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) - error = cff_decoder_parse_charstrings( &decoder, - charstring, - charstring_len, - 0 ); + if ( driver->hinting_engine == FT_HINTING_FREETYPE ) + error = decoder_funcs->parse_charstrings_old( &decoder, + charstring, + charstring_len, + 0 ); else #endif { - error = cf2_decoder_parse_charstrings( &decoder, - charstring, - charstring_len ); + psaux->ps_decoder_init( &psdecoder, &decoder, FALSE ); + + error = decoder_funcs->parse_charstrings( &psdecoder, + charstring, + charstring_len ); /* Adobe's engine uses 16.16 numbers everywhere; */ /* as a consequence, glyphs larger than 2000ppem get rejected */ @@ -2968,9 +453,9 @@ force_scaling = TRUE; glyph->hint = hinting; - error = cf2_decoder_parse_charstrings( &decoder, - charstring, - charstring_len ); + error = decoder_funcs->parse_charstrings( &psdecoder, + charstring, + charstring_len ); } } @@ -3008,7 +493,7 @@ Glyph_Build_Finished: /* save new glyph tables, if no error */ if ( !error ) - cff_builder_done( &decoder.builder ); + decoder.builder.funcs.done( &decoder.builder ); /* XXX: anything to do for broken glyph entry? */ } diff --git a/src/cff/cffgload.h b/src/cff/cffgload.h index 0fa93b439..803f3974f 100644 --- a/src/cff/cffgload.h +++ b/src/cff/cffgload.h @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,119 +22,11 @@ #include #include FT_FREETYPE_H -#include "cffobjs.h" +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H FT_BEGIN_HEADER - -#define CFF_MAX_OPERANDS 48 -#define CFF_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */ - /* only 10 are allowed but there exist */ - /* fonts like `HiraKakuProN-W3.ttf' */ - /* (Hiragino Kaku Gothic ProN W3; */ - /* 8.2d6e1; 2014-12-19) that exceed */ - /* this limit */ -#define CFF_MAX_TRANS_ELEMENTS 32 - - - /*************************************************************************/ - /* */ - /* */ - /* CFF_Builder */ - /* */ - /* */ - /* A structure used during glyph loading to store its outline. */ - /* */ - /* */ - /* memory :: The current memory object. */ - /* */ - /* face :: The current face object. */ - /* */ - /* glyph :: The current glyph slot. */ - /* */ - /* loader :: The current glyph loader. */ - /* */ - /* base :: The base glyph outline. */ - /* */ - /* current :: The current glyph outline. */ - /* */ - /* pos_x :: The horizontal translation (if composite glyph). */ - /* */ - /* pos_y :: The vertical translation (if composite glyph). */ - /* */ - /* left_bearing :: The left side bearing point. */ - /* */ - /* advance :: The horizontal advance vector. */ - /* */ - /* bbox :: Unused. */ - /* */ - /* path_begun :: A flag which indicates that a new path has begun. */ - /* */ - /* load_points :: If this flag is not set, no points are loaded. */ - /* */ - /* no_recurse :: Set but not used. */ - /* */ - /* metrics_only :: A boolean indicating that we only want to compute */ - /* the metrics of a given glyph, not load all of its */ - /* points. */ - /* */ - /* hints_funcs :: Auxiliary pointer for hinting. */ - /* */ - /* hints_globals :: Auxiliary pointer for hinting. */ - /* */ - typedef struct CFF_Builder_ - { - FT_Memory memory; - TT_Face face; - CFF_GlyphSlot glyph; - FT_GlyphLoader loader; - FT_Outline* base; - FT_Outline* current; - - FT_Pos pos_x; - FT_Pos pos_y; - - FT_Vector left_bearing; - FT_Vector advance; - - FT_BBox bbox; /* bounding box */ - FT_Bool path_begun; - FT_Bool load_points; - FT_Bool no_recurse; - - FT_Bool metrics_only; - - void* hints_funcs; /* hinter-specific */ - void* hints_globals; /* hinter-specific */ - - } CFF_Builder; - - - FT_LOCAL( FT_Error ) - cff_check_points( CFF_Builder* builder, - FT_Int count ); - - FT_LOCAL( void ) - cff_builder_add_point( CFF_Builder* builder, - FT_Pos x, - FT_Pos y, - FT_Byte flag ); - FT_LOCAL( FT_Error ) - cff_builder_add_point1( CFF_Builder* builder, - FT_Pos x, - FT_Pos y ); - FT_LOCAL( FT_Error ) - cff_builder_start_point( CFF_Builder* builder, - FT_Pos x, - FT_Pos y ); - FT_LOCAL( void ) - cff_builder_close_contour( CFF_Builder* builder ); - - - FT_LOCAL( FT_Int ) - cff_lookup_glyph_by_stdcharcode( CFF_Font cff, - FT_Int charcode ); FT_LOCAL( FT_Error ) cff_get_glyph_data( TT_Face face, FT_UInt glyph_index, @@ -146,74 +38,6 @@ FT_BEGIN_HEADER FT_ULong length ); - /* execution context charstring zone */ - - typedef struct CFF_Decoder_Zone_ - { - FT_Byte* base; - FT_Byte* limit; - FT_Byte* cursor; - - } CFF_Decoder_Zone; - - - typedef struct CFF_Decoder_ - { - CFF_Builder builder; - CFF_Font cff; - - FT_Fixed stack[CFF_MAX_OPERANDS + 1]; - FT_Fixed* top; - - CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1]; - CFF_Decoder_Zone* zone; - - FT_Int flex_state; - FT_Int num_flex_vectors; - FT_Vector flex_vectors[7]; - - FT_Pos glyph_width; - FT_Pos nominal_width; - - FT_Bool read_width; - FT_Bool width_only; - FT_Int num_hints; - FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS]; - - FT_UInt num_locals; - FT_UInt num_globals; - - FT_Int locals_bias; - FT_Int globals_bias; - - FT_Byte** locals; - FT_Byte** globals; - - FT_Byte** glyph_names; /* for pure CFF fonts only */ - FT_UInt num_glyphs; /* number of glyphs in font */ - - FT_Render_Mode hint_mode; - - FT_Bool seac; - - CFF_SubFont current_subfont; /* for current glyph_index */ - - } CFF_Decoder; - - - FT_LOCAL( void ) - cff_decoder_init( CFF_Decoder* decoder, - TT_Face face, - CFF_Size size, - CFF_GlyphSlot slot, - FT_Bool hinting, - FT_Render_Mode hint_mode ); - - FT_LOCAL( FT_Error ) - cff_decoder_prepare( CFF_Decoder* decoder, - CFF_Size size, - FT_UInt glyph_index ); - #if 0 /* unused until we support pure CFF fonts */ /* Compute the maximum advance width of a font through quick parsing */ @@ -223,13 +47,6 @@ FT_BEGIN_HEADER #endif /* 0 */ -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - FT_LOCAL( FT_Error ) - cff_decoder_parse_charstrings( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len, - FT_Bool in_dict ); -#endif FT_LOCAL( FT_Error ) cff_slot_load( CFF_GlyphSlot glyph, diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 47626a714..1c6fe5156 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -4,7 +4,7 @@ /* */ /* OpenType and CFF data/program tables loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,6 +22,7 @@ #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H #include FT_TYPE1_TABLES_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #include FT_MULTIPLE_MASTERS_H @@ -1297,7 +1298,9 @@ if ( numOperands > count ) { - FT_TRACE4(( " cff_blend_doBlend: Stack underflow %d args\n", count )); + FT_TRACE4(( " cff_blend_doBlend: Stack underflow %d argument%s\n", + count, + count == 1 ? "" : "s" )); error = FT_THROW( Stack_Underflow ); goto Exit; @@ -1345,16 +1348,14 @@ for ( i = 0; i < numBlends; i++ ) { const FT_Int32* weight = &blend->BV[1]; - FT_Int32 sum; + FT_UInt32 sum; /* convert inputs to 16.16 fixed point */ - sum = cff_parse_num( parser, &parser->stack[i + base] ) * 65536; + sum = cff_parse_num( parser, &parser->stack[i + base] ) * 0x10000; for ( j = 1; j < blend->lenBV; j++ ) - sum += FT_MulFix( *weight++, - cff_parse_num( parser, - &parser->stack[delta++] ) * 65536 ); + sum += cff_parse_num( parser, &parser->stack[delta++] ) * *weight++; /* point parser stack to new value on blend_stack */ parser->stack[i + base] = subFont->blend_top; @@ -1364,10 +1365,10 @@ /* opcode in both CFF and CFF2 DICTs. See `cff_parse_num' for */ /* decode of this, which rounds to an integer. */ *subFont->blend_top++ = 255; - *subFont->blend_top++ = ( (FT_UInt32)sum & 0xFF000000U ) >> 24; - *subFont->blend_top++ = ( (FT_UInt32)sum & 0x00FF0000U ) >> 16; - *subFont->blend_top++ = ( (FT_UInt32)sum & 0x0000FF00U ) >> 8; - *subFont->blend_top++ = (FT_UInt32)sum & 0x000000FFU; + *subFont->blend_top++ = (FT_Byte)( sum >> 24 ); + *subFont->blend_top++ = (FT_Byte)( sum >> 16 ); + *subFont->blend_top++ = (FT_Byte)( sum >> 8 ); + *subFont->blend_top++ = (FT_Byte)sum; } /* leave only numBlends results on parser stack */ @@ -1463,10 +1464,15 @@ /* Note: `lenNDV' could be zero. */ /* In that case, build default blend vector (1,0,0...). */ - /* In the normal case, initialize each component to 1 */ - /* before inner loop. */ - if ( lenNDV != 0 ) - blend->BV[master] = FT_FIXED_ONE; /* default */ + if ( !lenNDV ) + { + blend->BV[master] = 0; + continue; + } + + /* In the normal case, initialize each component to 1 */ + /* before inner loop. */ + blend->BV[master] = FT_FIXED_ONE; /* default */ /* inner loop steps through axes in this region */ for ( j = 0; j < lenNDV; j++ ) @@ -1529,12 +1535,12 @@ lenNDV * sizeof ( *NDV ) ) ) goto Exit; - blend->lenNDV = lenNDV; FT_MEM_COPY( blend->lastNDV, NDV, lenNDV * sizeof ( *NDV ) ); } + blend->lenNDV = lenNDV; blend->builtBV = TRUE; Exit: @@ -1550,13 +1556,13 @@ FT_UInt lenNDV, FT_Fixed* NDV ) { - if ( !blend->builtBV || - blend->lastVsindex != vsindex || - blend->lenNDV != lenNDV || - ( lenNDV && - memcmp( NDV, - blend->lastNDV, - lenNDV * sizeof ( *NDV ) ) != 0 ) ) + if ( !blend->builtBV || + blend->lastVsindex != vsindex || + blend->lenNDV != lenNDV || + ( lenNDV && + ft_memcmp( NDV, + blend->lastNDV, + lenNDV * sizeof ( *NDV ) ) != 0 ) ) { /* need to build blend vector */ return TRUE; @@ -1572,12 +1578,17 @@ cff_get_var_blend( CFF_Face face, FT_UInt *num_coords, FT_Fixed* *coords, + FT_Fixed* *normalizedcoords, FT_MM_Var* *mm_var ) { FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; - return mm->get_var_blend( FT_FACE( face ), num_coords, coords, mm_var ); + return mm->get_var_blend( FT_FACE( face ), + num_coords, + coords, + normalizedcoords, + mm_var ); } @@ -1587,7 +1598,8 @@ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; - mm->done_blend( FT_FACE( face ) ); + if (mm) + mm->done_blend( FT_FACE( face ) ); } #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ @@ -1885,7 +1897,8 @@ subfont->lenNDV = lenNDV; subfont->NDV = NDV; - stackSize = font->cff2 ? font->top_font.font_dict.maxstack + /* add 1 for the operator */ + stackSize = font->cff2 ? font->top_font.font_dict.maxstack + 1 : CFF_MAX_STACK_DEPTH + 1; if ( cff_parser_init( &parser, @@ -1920,6 +1933,24 @@ else if ( priv->initial_random_seed == 0 ) priv->initial_random_seed = 987654321; + /* some sanitizing to avoid overflows later on; */ + /* the upper limits are ad-hoc values */ + if ( priv->blue_shift > 1000 || priv->blue_shift < 0 ) + { + FT_TRACE2(( "cff_load_private_dict:" + " setting unlikely BlueShift value %d to default (7)\n", + priv->blue_shift )); + priv->blue_shift = 7; + } + + if ( priv->blue_fuzz > 1000 || priv->blue_fuzz < 0 ) + { + FT_TRACE2(( "cff_load_private_dict:" + " setting unlikely BlueFuzz value %d to default (1)\n", + priv->blue_fuzz )); + priv->blue_fuzz = 1; + } + Exit: /* clean up */ cff_blend_clear( subfont ); /* clear blend stack */ @@ -1931,18 +1962,6 @@ } - FT_LOCAL_DEF( FT_UInt32 ) - cff_random( FT_UInt32 r ) - { - /* a 32bit version of the `xorshift' algorithm */ - r ^= r << 13; - r ^= r >> 17; - r ^= r << 5; - - return r; - } - - /* There are 3 ways to call this function, distinguished by code. */ /* */ /* . CFF_CODE_TOPDICT for either a CFF Top DICT or a CFF Font DICT */ @@ -1966,6 +1985,8 @@ CFF_FontRecDict top = &subfont->font_dict; CFF_Private priv = &subfont->private_dict; + PSAux_Service psaux = (PSAux_Service)face->psaux; + FT_Bool cff2 = FT_BOOL( code == CFF2_CODE_TOPDICT || code == CFF2_CODE_FONTDICT ); FT_UInt stackSize = cff2 ? CFF2_DEFAULT_STACK @@ -2071,7 +2092,7 @@ */ if ( face->root.internal->random_seed == -1 ) { - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( face ); + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face ); subfont->random = (FT_UInt32)driver->random_seed; @@ -2079,7 +2100,8 @@ { do { - driver->random_seed = (FT_Int32)cff_random( driver->random_seed ); + driver->random_seed = + (FT_Int32)psaux->cff_random( (FT_UInt32)driver->random_seed ); } while ( driver->random_seed < 0 ); } @@ -2092,7 +2114,8 @@ do { face->root.internal->random_seed = - (FT_Int32)cff_random( face->root.internal->random_seed ); + (FT_Int32)psaux->cff_random( + (FT_UInt32)face->root.internal->random_seed ); } while ( face->root.internal->random_seed < 0 ); } @@ -2268,8 +2291,10 @@ goto Exit; } - /* font names must not be empty */ - if ( font->name_index.data_size < font->name_index.count ) + /* if we have an empty font name, */ + /* it must be the only font in the CFF */ + if ( font->name_index.count > 1 && + font->name_index.data_size < font->name_index.count ) { /* for pure CFFs, we still haven't checked enough bytes */ /* to be sure that it is a CFF at all */ @@ -2531,6 +2556,8 @@ font->cf2_instance.finalizer( font->cf2_instance.data ); FT_FREE( font->cf2_instance.data ); } + + FT_FREE( font->font_extra ); } diff --git a/src/cff/cffload.h b/src/cff/cffload.h index 1709a661e..14d14e211 100644 --- a/src/cff/cffload.h +++ b/src/cff/cffload.h @@ -4,7 +4,7 @@ /* */ /* OpenType & CFF data/program tables loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,9 +21,9 @@ #include -#include "cfftypes.h" +#include FT_INTERNAL_CFF_TYPES_H #include "cffparse.h" -#include "cffobjs.h" /* for CFF_Face */ +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H /* for CFF_Face */ FT_BEGIN_HEADER @@ -61,9 +61,6 @@ FT_BEGIN_HEADER FT_UInt cid ); - FT_LOCAL( FT_UInt32 ) - cff_random( FT_UInt32 r ); - FT_LOCAL( FT_Error ) cff_font_load( FT_Library library, FT_Stream stream, @@ -112,6 +109,7 @@ FT_BEGIN_HEADER cff_get_var_blend( CFF_Face face, FT_UInt *num_coords, FT_Fixed* *coords, + FT_Fixed* *normalizedcoords, FT_MM_Var* *mm_var ); FT_LOCAL( void ) diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index bcda2a913..a2d7aec65 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -4,7 +4,7 @@ /* */ /* OpenType objects manager (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,8 +25,15 @@ #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H #include FT_INTERNAL_SFNT_H -#include FT_CFF_DRIVER_H +#include FT_DRIVER_H +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include FT_MULTIPLE_MASTERS_H +#include FT_SERVICE_MULTIPLE_MASTERS_H +#include FT_SERVICE_METRICS_VARIATIONS_H +#endif + +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H #include "cffobjs.h" #include "cffload.h" #include "cffcmap.h" @@ -34,6 +41,9 @@ #include "cfferrs.h" +#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_SERVICE_CFF_TABLE_LOAD_H + /*************************************************************************/ /* */ @@ -49,9 +59,6 @@ /* */ /* SIZE FUNCTIONS */ /* */ - /* Note that we store the global hints in the size's `internal' root */ - /* field. */ - /* */ /*************************************************************************/ @@ -75,10 +82,11 @@ FT_LOCAL_DEF( void ) cff_size_done( FT_Size cffsize ) /* CFF_Size */ { + FT_Memory memory = cffsize->face->memory; CFF_Size size = (CFF_Size)cffsize; CFF_Face face = (CFF_Face)size->root.face; CFF_Font font = (CFF_Font)face->extra.data; - CFF_Internal internal = (CFF_Internal)cffsize->internal; + CFF_Internal internal = (CFF_Internal)cffsize->internal->module_data; if ( internal ) @@ -98,7 +106,7 @@ funcs->destroy( internal->subfonts[i - 1] ); } - /* `internal' is freed by destroy_size (in ftobjs.c) */ + FT_FREE( internal ); } } @@ -194,7 +202,7 @@ goto Exit; } - cffsize->internal = (FT_Size_Internal)(void*)internal; + cffsize->internal->module_data = internal; } size->strike_index = 0xFFFFFFFFUL; @@ -224,7 +232,7 @@ { CFF_Face face = (CFF_Face)size->face; CFF_Font font = (CFF_Font)face->extra.data; - CFF_Internal internal = (CFF_Internal)size->internal; + CFF_Internal internal = (CFF_Internal)size->internal->module_data; FT_Long top_upm = (FT_Long)font->top_font.font_dict.units_per_em; FT_UInt i; @@ -296,7 +304,7 @@ { CFF_Face cffface = (CFF_Face)size->face; CFF_Font font = (CFF_Font)cffface->extra.data; - CFF_Internal internal = (CFF_Internal)size->internal; + CFF_Internal internal = (CFF_Internal)size->internal->module_data; FT_Long top_upm = (FT_Long)font->top_font.font_dict.units_per_em; FT_UInt i; @@ -405,7 +413,7 @@ remove_subset_prefix( FT_String* name ) { FT_Int32 idx = 0; - FT_Int32 length = (FT_Int32)strlen( name ) + 1; + FT_Int32 length = (FT_Int32)ft_strlen( name ) + 1; FT_Bool continue_search = 1; @@ -442,8 +450,8 @@ FT_Int32 family_name_length, style_name_length; - family_name_length = (FT_Int32)strlen( family_name ); - style_name_length = (FT_Int32)strlen( style_name ); + family_name_length = (FT_Int32)ft_strlen( family_name ); + style_name_length = (FT_Int32)ft_strlen( style_name ); if ( family_name_length > style_name_length ) { @@ -490,14 +498,16 @@ SFNT_Service sfnt; FT_Service_PsCMaps psnames; PSHinter_Service pshinter; + PSAux_Service psaux; + FT_Service_CFFLoad cffload; FT_Bool pure_cff = 1; FT_Bool cff2 = 0; FT_Bool sfnt_format = 0; FT_Library library = cffface->driver->root.library; - sfnt = (SFNT_Service)FT_Get_Module_Interface( - library, "sfnt" ); + sfnt = (SFNT_Service)FT_Get_Module_Interface( library, + "sfnt" ); if ( !sfnt ) { FT_ERROR(( "cff_face_init: cannot access `sfnt' module\n" )); @@ -507,8 +517,20 @@ FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); - pshinter = (PSHinter_Service)FT_Get_Module_Interface( - library, "pshinter" ); + pshinter = (PSHinter_Service)FT_Get_Module_Interface( library, + "pshinter" ); + + psaux = (PSAux_Service)FT_Get_Module_Interface( library, + "psaux" ); + if ( !psaux ) + { + FT_ERROR(( "cff_face_init: cannot access `psaux' module\n" )); + error = FT_THROW( Missing_Module ); + goto Exit; + } + face->psaux = psaux; + + FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD ); FT_TRACE2(( "CFF driver\n" )); @@ -611,6 +633,7 @@ cff->pshinter = pshinter; cff->psnames = psnames; + cff->cffload = cffload; cffface->face_index = face_index & 0xFFFF; @@ -687,50 +710,22 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + FT_Service_MetricsVariations var = (FT_Service_MetricsVariations)face->var; - FT_Int instance_index = face_index >> 16; + FT_UInt instance_index = (FT_UInt)face_index >> 16; if ( FT_HAS_MULTIPLE_MASTERS( cffface ) && mm && instance_index > 0 ) { - FT_MM_Var* mm_var; - - - error = mm->get_mm_var( cffface, NULL ); + error = mm->set_instance( cffface, instance_index ); if ( error ) goto Exit; - mm->get_var_blend( cffface, NULL, NULL, &mm_var ); - - if ( mm_var->namedstyle ) - { - FT_Var_Named_Style* named_style; - FT_String* style_name; - - - /* in `face_index', the instance index starts with value 1 */ - named_style = mm_var->namedstyle + instance_index - 1; - error = sfnt->get_name( face, - (FT_UShort)named_style->strid, - &style_name ); - if ( error ) - goto Exit; - - /* set style name; if already set, replace it */ - if ( face->root.style_name ) - FT_FREE( face->root.style_name ); - face->root.style_name = style_name; - - /* finally, select the named instance */ - error = mm->set_var_design( cffface, - mm_var->num_axis, - named_style->coords ); - if ( error ) - goto Exit; - } + if ( var ) + var->metrics_adjust( cffface ); } } #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ @@ -873,7 +868,8 @@ cffface->height = (FT_Short)( ( cffface->units_per_EM * 12 ) / 10 ); if ( cffface->height < cffface->ascender - cffface->descender ) - cffface->height = (FT_Short)( cffface->ascender - cffface->descender ); + cffface->height = (FT_Short)( cffface->ascender - + cffface->descender ); cffface->underline_position = (FT_Short)( dict->underline_position >> 16 ); @@ -881,27 +877,32 @@ (FT_Short)( dict->underline_thickness >> 16 ); /* retrieve font family & style name */ - cffface->family_name = cff_index_get_name( - cff, - (FT_UInt)( face_index & 0xFFFF ) ); + if ( dict->family_name ) + { + char* family_name; + + + family_name = cff_index_get_sid_string( cff, dict->family_name ); + if ( family_name ) + cffface->family_name = cff_strcpy( memory, family_name ); + } + + if ( !cffface->family_name ) + { + cffface->family_name = cff_index_get_name( + cff, + (FT_UInt)( face_index & 0xFFFF ) ); + if ( cffface->family_name ) + remove_subset_prefix( cffface->family_name ); + } + if ( cffface->family_name ) { char* full = cff_index_get_sid_string( cff, dict->full_name ); char* fullp = full; char* family = cffface->family_name; - char* family_name = NULL; - - remove_subset_prefix( cffface->family_name ); - - if ( dict->family_name ) - { - family_name = cff_index_get_sid_string( cff, - dict->family_name ); - if ( family_name ) - family = family_name; - } /* We try to extract the style name from the full name. */ /* We need to ignore spaces and dashes during the search. */ @@ -1156,16 +1157,16 @@ FT_LOCAL_DEF( FT_Error ) cff_driver_init( FT_Module module ) /* CFF_Driver */ { - CFF_Driver driver = (CFF_Driver)module; + PS_Driver driver = (PS_Driver)module; FT_UInt32 seed; /* set default property values, cf. `ftcffdrv.h' */ #ifdef CFF_CONFIG_OPTION_OLD_ENGINE - driver->hinting_engine = FT_CFF_HINTING_FREETYPE; + driver->hinting_engine = FT_HINTING_FREETYPE; #else - driver->hinting_engine = FT_CFF_HINTING_ADOBE; + driver->hinting_engine = FT_HINTING_ADOBE; #endif driver->no_stem_darkening = TRUE; diff --git a/src/cff/cffobjs.h b/src/cff/cffobjs.h index 1dba694c5..616a25b3b 100644 --- a/src/cff/cffobjs.h +++ b/src/cff/cffobjs.h @@ -4,7 +4,7 @@ /* */ /* OpenType objects manager (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,111 +21,11 @@ #include -#include FT_INTERNAL_OBJECTS_H -#include "cfftypes.h" -#include FT_INTERNAL_TRUETYPE_TYPES_H -#include FT_SERVICE_POSTSCRIPT_CMAPS_H -#include FT_INTERNAL_POSTSCRIPT_HINTS_H FT_BEGIN_HEADER - /*************************************************************************/ - /* */ - /* */ - /* CFF_Driver */ - /* */ - /* */ - /* A handle to an OpenType driver object. */ - /* */ - typedef struct CFF_DriverRec_* CFF_Driver; - - typedef TT_Face CFF_Face; - - - /*************************************************************************/ - /* */ - /* */ - /* CFF_Size */ - /* */ - /* */ - /* A handle to an OpenType size object. */ - /* */ - typedef struct CFF_SizeRec_ - { - FT_SizeRec root; - FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */ - - } CFF_SizeRec, *CFF_Size; - - - /*************************************************************************/ - /* */ - /* */ - /* CFF_GlyphSlot */ - /* */ - /* */ - /* A handle to an OpenType glyph slot object. */ - /* */ - typedef struct CFF_GlyphSlotRec_ - { - FT_GlyphSlotRec root; - - FT_Bool hint; - FT_Bool scaled; - - FT_Fixed x_scale; - FT_Fixed y_scale; - - } CFF_GlyphSlotRec, *CFF_GlyphSlot; - - - /*************************************************************************/ - /* */ - /* */ - /* CFF_Internal */ - /* */ - /* */ - /* The interface to the `internal' field of `FT_Size'. */ - /* */ - typedef struct CFF_InternalRec_ - { - PSH_Globals topfont; - PSH_Globals subfonts[CFF_MAX_CID_FONTS]; - - } CFF_InternalRec, *CFF_Internal; - - - /*************************************************************************/ - /* */ - /* Subglyph transformation record. */ - /* */ - typedef struct CFF_Transform_ - { - FT_Fixed xx, xy; /* transformation matrix coefficients */ - FT_Fixed yx, yy; - FT_F26Dot6 ox, oy; /* offsets */ - - } CFF_Transform; - - - /***********************************************************************/ - /* */ - /* CFF driver class. */ - /* */ - typedef struct CFF_DriverRec_ - { - FT_DriverRec root; - - FT_UInt hinting_engine; - FT_Bool no_stem_darkening; - FT_Int darken_params[8]; - FT_Int32 random_seed; - - } CFF_DriverRec; - - FT_LOCAL( FT_Error ) cff_size_init( FT_Size size ); /* CFF_Size */ @@ -171,10 +71,10 @@ FT_BEGIN_HEADER /* Driver functions */ /* */ FT_LOCAL( FT_Error ) - cff_driver_init( FT_Module module ); /* CFF_Driver */ + cff_driver_init( FT_Module module ); /* PS_Driver */ FT_LOCAL( void ) - cff_driver_done( FT_Module module ); /* CFF_Driver */ + cff_driver_done( FT_Module module ); /* PS_Driver */ FT_END_HEADER diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 59fa2908a..b9611cf54 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -4,7 +4,7 @@ /* */ /* CFF token stream parser (body) */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,10 +20,11 @@ #include "cffparse.h" #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_CALC_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H #include "cfferrs.h" #include "cffpic.h" -#include "cffgload.h" #include "cffload.h" @@ -156,6 +157,22 @@ 1000000000L }; + /* maximum values allowed for multiplying */ + /* with the corresponding `power_tens' element */ + static const FT_Long power_ten_limits[] = + { + FT_LONG_MAX / 1L, + FT_LONG_MAX / 10L, + FT_LONG_MAX / 100L, + FT_LONG_MAX / 1000L, + FT_LONG_MAX / 10000L, + FT_LONG_MAX / 100000L, + FT_LONG_MAX / 1000000L, + FT_LONG_MAX / 10000000L, + FT_LONG_MAX / 100000000L, + FT_LONG_MAX / 1000000000L, + }; + /* read a real */ static FT_Fixed @@ -484,7 +501,15 @@ if ( scaling ) + { + if ( FT_ABS( val ) > power_ten_limits[scaling] ) + { + val = val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFL; + goto Overflow; + } + val *= power_tens[scaling]; + } if ( val > 0x7FFF ) { @@ -894,8 +919,6 @@ FT_Error error; - error = FT_ERR( Stack_Underflow ); - if ( !priv || !priv->subfont ) { error = FT_THROW( Invalid_File_Format ); @@ -926,7 +949,9 @@ goto Exit; } - FT_TRACE4(( " %d values blended\n", numBlends )); + FT_TRACE4(( " %d value%s blended\n", + numBlends, + numBlends == 1 ? "" : "s" )); error = cff_blend_doBlend( subFont, parser, numBlends ); @@ -1276,9 +1301,14 @@ FT_Byte* start, FT_Byte* limit ) { +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + PSAux_Service psaux; +#endif + FT_Byte* p = start; FT_Error error = FT_Err_Ok; FT_Library library = parser->library; + FT_UNUSED( library ); @@ -1365,10 +1395,16 @@ cff_rec.top_font.font_dict.num_axes = parser->num_axes; decoder.cff = &cff_rec; - error = cff_decoder_parse_charstrings( &decoder, - charstring_base, - charstring_len, - 1 ); + psaux = (PSAux_Service)FT_Get_Module_Interface( library, "psaux" ); + if ( !psaux ) + { + FT_ERROR(( "cff_parser_run: cannot access `psaux' module\n" )); + error = FT_THROW( Missing_Module ); + goto Exit; + } + + error = psaux->cff_decoder_funcs->parse_charstrings_old( + &decoder, charstring_base, charstring_len, 1 ); /* Now copy the stack data in the temporary decoder object, */ /* converting it back to charstring number representations */ @@ -1587,7 +1623,7 @@ val = 0; while ( num_args > 0 ) { - val += cff_parse_num( parser, data++ ); + val = ADD_LONG( val, cff_parse_num( parser, data++ ) ); switch ( field->size ) { case (8 / FT_CHAR_BIT): diff --git a/src/cff/cffparse.h b/src/cff/cffparse.h index 9976d42b1..8a8caeca4 100644 --- a/src/cff/cffparse.h +++ b/src/cff/cffparse.h @@ -4,7 +4,7 @@ /* */ /* CFF token stream parser (specification) */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,7 +21,7 @@ #include -#include "cfftypes.h" +#include FT_INTERNAL_CFF_TYPES_H #include FT_INTERNAL_OBJECTS_H @@ -31,8 +31,16 @@ FT_BEGIN_HEADER /* CFF uses constant parser stack size; */ /* CFF2 can increase from default 193 */ #define CFF_MAX_STACK_DEPTH 96 + + /* + * There are plans to remove the `maxstack' operator in a forthcoming + * revision of the CFF2 specification, increasing the (then static) stack + * size to 513. By making the default stack size equal to the maximum + * stack size, the operator is essentially disabled, which has the + * desired effect in FreeType. + */ #define CFF2_MAX_STACK 513 -#define CFF2_DEFAULT_STACK 193 +#define CFF2_DEFAULT_STACK 513 #define CFF_CODE_TOPDICT 0x1000 #define CFF_CODE_PRIVATE 0x2000 diff --git a/src/cff/cffpic.c b/src/cff/cffpic.c index 4e9ba12b3..08b74c7cf 100644 --- a/src/cff/cffpic.c +++ b/src/cff/cffpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for cff module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cffpic.h b/src/cff/cffpic.h index 5db39cd62..8ba4203a8 100644 --- a/src/cff/cffpic.h +++ b/src/cff/cffpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for cff module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,7 +22,6 @@ #include FT_INTERNAL_PIC_H - #ifndef FT_CONFIG_OPTION_PIC #define CFF_SERVICE_PS_INFO_GET cff_service_ps_info @@ -34,6 +33,7 @@ #define CFF_SERVICES_GET cff_services #define CFF_SERVICE_MULTI_MASTERS_GET cff_service_multi_masters #define CFF_SERVICE_METRICS_VAR_GET cff_service_metrics_variations +#define CFF_SERVICE_CFF_LOAD_GET cff_service_cff_load #define CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec #define CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec #define CFF_FIELD_HANDLERS_GET cff_field_handlers @@ -65,6 +65,7 @@ FT_BEGIN_HEADER FT_Service_PropertiesRec cff_service_properties; FT_Service_MultiMastersRec cff_service_multi_masters; FT_Service_MetricsVariationsRec cff_service_metrics_variations; + FT_Service_CFFLoadRec cff_service_cff_load; FT_CMap_ClassRec cff_cmap_encoding_class_rec; FT_CMap_ClassRec cff_cmap_unicode_class_rec; @@ -92,6 +93,8 @@ FT_BEGIN_HEADER ( GET_PIC( library )->cff_service_multi_masters ) #define CFF_SERVICE_METRICS_VAR_GET \ ( GET_PIC( library )->cff_service_metrics_variations ) +#define CFF_SERVICE_CFF_LOAD_GET \ + ( GET_PIC( library )->cff_service_cff_load ) #define CFF_CMAP_ENCODING_CLASS_REC_GET \ ( GET_PIC( library )->cff_cmap_encoding_class_rec ) #define CFF_CMAP_UNICODE_CLASS_REC_GET \ diff --git a/src/cff/cfftoken.h b/src/cff/cfftoken.h index 3222e933f..fec1ca20b 100644 --- a/src/cff/cfftoken.h +++ b/src/cff/cfftoken.h @@ -4,7 +4,7 @@ /* */ /* CFF token definitions (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/module.mk b/src/cff/module.mk index 2975aeed8..8013d5dca 100644 --- a/src/cff/module.mk +++ b/src/cff/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/cff/rules.mk b/src/cff/rules.mk index 86840bfe3..bce672927 100644 --- a/src/cff/rules.mk +++ b/src/cff/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -32,27 +32,14 @@ CFF_DRV_SRC := $(CFF_DIR)/cffcmap.c \ $(CFF_DIR)/cffload.c \ $(CFF_DIR)/cffobjs.c \ $(CFF_DIR)/cffparse.c \ - $(CFF_DIR)/cffpic.c \ - $(CFF_DIR)/cf2arrst.c \ - $(CFF_DIR)/cf2blues.c \ - $(CFF_DIR)/cf2error.c \ - $(CFF_DIR)/cf2font.c \ - $(CFF_DIR)/cf2ft.c \ - $(CFF_DIR)/cf2hints.c \ - $(CFF_DIR)/cf2intrp.c \ - $(CFF_DIR)/cf2read.c \ - $(CFF_DIR)/cf2stack.c + $(CFF_DIR)/cffpic.c # CFF driver headers # CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \ $(CFF_DIR)/cfferrs.h \ - $(CFF_DIR)/cfftoken.h \ - $(CFF_DIR)/cfftypes.h \ - $(CFF_DIR)/cf2fixed.h \ - $(CFF_DIR)/cf2glue.h \ - $(CFF_DIR)/cf2types.h + $(CFF_DIR)/cfftoken.h # CFF driver object(s) diff --git a/src/cid/Jamfile b/src/cid/Jamfile index 8d3ba6a47..1c232fda3 100644 --- a/src/cid/Jamfile +++ b/src/cid/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/cid Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/cid/ciderrs.h b/src/cid/ciderrs.h index 709dc8cd1..a5a86e3fc 100644 --- a/src/cid/ciderrs.h +++ b/src/cid/ciderrs.h @@ -4,7 +4,7 @@ /* */ /* CID error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index b96c33334..d14f9a2cc 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 Glyph Loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -24,6 +24,10 @@ #include FT_OUTLINE_H #include FT_INTERNAL_CALC_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_CFF_TYPES_H +#include FT_DRIVER_H + #include "ciderrs.h" @@ -52,9 +56,11 @@ FT_ULong glyph_length = 0; PSAux_Service psaux = (PSAux_Service)face->psaux; + FT_Bool force_scaling = FALSE; + #ifdef FT_CONFIG_OPTION_INCREMENTAL - FT_Incremental_InterfaceRec *inc = - face->root.internal->incremental_interface; + FT_Incremental_InterfaceRec *inc = + face->root.internal->incremental_interface; #endif @@ -169,9 +175,57 @@ if ( decoder->lenIV >= 0 ) psaux->t1_decrypt( charstring, glyph_length, 4330 ); - error = decoder->funcs.parse_charstrings( - decoder, charstring + cs_offset, - glyph_length - cs_offset ); + /* choose which renderer to use */ +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + if ( ( (PS_Driver)FT_FACE_DRIVER( face ) )->hinting_engine == + FT_HINTING_FREETYPE || + decoder->builder.metrics_only ) + error = psaux->t1_decoder_funcs->parse_charstrings_old( + decoder, + charstring + cs_offset, + glyph_length - cs_offset ); +#else + if ( decoder->builder.metrics_only ) + error = psaux->t1_decoder_funcs->parse_metrics( + decoder, + charstring + cs_offset, + glyph_length - cs_offset ); +#endif + else + { + PS_Decoder psdecoder; + CFF_SubFontRec subfont; + + + psaux->ps_decoder_init( &psdecoder, decoder, TRUE ); + + psaux->t1_make_subfont( FT_FACE( face ), + &dict->private_dict, + &subfont ); + psdecoder.current_subfont = &subfont; + + error = psaux->t1_decoder_funcs->parse_charstrings( + &psdecoder, + charstring + cs_offset, + glyph_length - cs_offset ); + + /* Adobe's engine uses 16.16 numbers everywhere; */ + /* as a consequence, glyphs larger than 2000ppem get rejected */ + if ( FT_ERR_EQ( error, Glyph_Too_Big ) ) + { + /* this time, we retry unhinted and scale up the glyph later on */ + /* (the engine uses and sets the hardcoded value 0x10000 / 64 = */ + /* 0x400 for both `x_scale' and `y_scale' in this case) */ + ((CID_GlyphSlot)decoder->builder.glyph)->hint = FALSE; + + force_scaling = TRUE; + + error = psaux->t1_decoder_funcs->parse_charstrings( + &psdecoder, + charstring + cs_offset, + glyph_length - cs_offset ); + } + } } #ifdef FT_CONFIG_OPTION_INCREMENTAL @@ -200,6 +254,8 @@ Exit: FT_FREE( charstring ); + ((CID_GlyphSlot)decoder->builder.glyph)->scaled = force_scaling; + return error; } @@ -288,10 +344,12 @@ T1_DecoderRec decoder; CID_Face face = (CID_Face)cidglyph->face; FT_Bool hinting; + FT_Bool scaled; PSAux_Service psaux = (PSAux_Service)face->psaux; FT_Matrix font_matrix; FT_Vector font_offset; + FT_Bool must_finish_decoder = FALSE; if ( glyph_index >= (FT_UInt)face->root.num_glyphs ) @@ -311,7 +369,10 @@ 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, @@ -329,6 +390,8 @@ /* TODO: initialize decoder.len_buildchar and decoder.buildchar */ /* if we ever support CID-keyed multiple master fonts */ + must_finish_decoder = TRUE; + /* set up the decoder */ decoder.builder.no_recurse = FT_BOOL( ( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ) ); @@ -337,12 +400,18 @@ if ( error ) goto Exit; + /* copy flags back for forced scaling */ + hinting = glyph->hint; + scaled = glyph->scaled; + font_matrix = decoder.font_matrix; font_offset = decoder.font_offset; /* save new glyph tables */ psaux->t1_decoder_funcs->done( &decoder ); + 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 */ @@ -410,7 +479,7 @@ metrics->vertAdvance += font_offset.y; } - if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ) + if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || scaled ) { /* scale the outline and the metrics */ FT_Int n; @@ -451,6 +520,10 @@ } Exit: + + if ( must_finish_decoder ) + psaux->t1_decoder_funcs->done( &decoder ); + return error; } diff --git a/src/cid/cidgload.h b/src/cid/cidgload.h index 7f816b5bc..4811852ae 100644 --- a/src/cid/cidgload.h +++ b/src/cid/cidgload.h @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidload.c b/src/cid/cidload.c index ff0722110..27cd09b3c 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 font loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidload.h b/src/cid/cidload.h index 45a0e6df2..3f8bd0862 100644 --- a/src/cid/cidload.h +++ b/src/cid/cidload.h @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 font loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index 7830e1f68..77afe1c87 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -4,7 +4,7 @@ /* */ /* CID objects manager (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -26,6 +26,7 @@ #include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H +#include FT_DRIVER_H #include "ciderrs.h" @@ -113,16 +114,16 @@ CID_Size size = (CID_Size)cidsize; - if ( cidsize->internal ) + if ( cidsize->internal->module_data ) { PSH_Globals_Funcs funcs; funcs = cid_size_get_globals_funcs( size ); if ( funcs ) - funcs->destroy( (PSH_Globals)cidsize->internal ); + funcs->destroy( (PSH_Globals)cidsize->internal->module_data ); - cidsize->internal = NULL; + cidsize->internal->module_data = NULL; } } @@ -145,7 +146,7 @@ error = funcs->create( cidsize->face->memory, priv, &globals ); if ( !error ) - cidsize->internal = (FT_Size_Internal)(void*)globals; + cidsize->internal->module_data = globals; } return error; @@ -164,7 +165,7 @@ funcs = cid_size_get_globals_funcs( (CID_Size)size ); if ( funcs ) - funcs->set_scale( (PSH_Globals)size->internal, + funcs->set_scale( (PSH_Globals)size->internal->module_data, size->metrics.x_scale, size->metrics.y_scale, 0, 0 ); @@ -463,9 +464,42 @@ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF( FT_Error ) - cid_driver_init( FT_Module driver ) + cid_driver_init( FT_Module module ) { - FT_UNUSED( driver ); + PS_Driver driver = (PS_Driver)module; + + FT_UInt32 seed; + + + /* set default property values, cf. `ftt1drv.h' */ +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + driver->hinting_engine = FT_HINTING_FREETYPE; +#else + driver->hinting_engine = FT_HINTING_ADOBE; +#endif + + driver->no_stem_darkening = TRUE; + + driver->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1; + driver->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1; + driver->darken_params[2] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2; + driver->darken_params[3] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2; + driver->darken_params[4] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3; + driver->darken_params[5] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3; + driver->darken_params[6] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4; + driver->darken_params[7] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4; + + /* compute random seed from some memory addresses */ + seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^ + (FT_Offset)(char*)&module ^ + (FT_Offset)(char*)module->memory ); + seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 ); + + driver->random_seed = (FT_Int32)seed; + if ( driver->random_seed < 0 ) + driver->random_seed = -driver->random_seed; + else if ( driver->random_seed == 0 ) + driver->random_seed = 123456789; return FT_Err_Ok; } diff --git a/src/cid/cidobjs.h b/src/cid/cidobjs.h index 8bcf886e1..0221f017d 100644 --- a/src/cid/cidobjs.h +++ b/src/cid/cidobjs.h @@ -4,7 +4,7 @@ /* */ /* CID objects manager (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c index 007609bbd..b1c7f3cb2 100644 --- a/src/cid/cidparse.c +++ b/src/cid/cidparse.c @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 parser (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidparse.h b/src/cid/cidparse.h index 20bebb942..61602f767 100644 --- a/src/cid/cidparse.h +++ b/src/cid/cidparse.h @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 parser (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index bb611a961..d9faf353e 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -4,7 +4,7 @@ /* */ /* CID driver interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,6 +20,7 @@ #include "cidriver.h" #include "cidgload.h" #include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_POSTSCRIPT_PROPS_H #include "ciderrs.h" @@ -27,6 +28,10 @@ #include FT_SERVICE_FONT_FORMAT_H #include FT_SERVICE_POSTSCRIPT_INFO_H #include FT_SERVICE_CID_H +#include FT_SERVICE_PROPERTIES_H +#include FT_DRIVER_H + +#include FT_INTERNAL_POSTSCRIPT_AUX_H /*************************************************************************/ @@ -167,6 +172,18 @@ }; + /* + * PROPERTY SERVICE + * + */ + + FT_DEFINE_SERVICE_PROPERTIESREC( + cid_service_properties, + + (FT_Properties_SetFunc)ps_property_set, /* set_property */ + (FT_Properties_GetFunc)ps_property_get ) /* get_property */ + + /* * SERVICE LIST * @@ -178,6 +195,7 @@ { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name }, { FT_SERVICE_ID_POSTSCRIPT_INFO, &cid_service_ps_info }, { FT_SERVICE_ID_CID, &cid_service_cid_info }, + { FT_SERVICE_ID_PROPERTIES, &cid_service_properties }, { NULL, NULL } }; @@ -200,7 +218,7 @@ FT_MODULE_FONT_DRIVER | FT_MODULE_DRIVER_SCALABLE | FT_MODULE_DRIVER_HAS_HINTER, - sizeof ( FT_DriverRec ), + sizeof ( PS_DriverRec ), "t1cid", /* module name */ 0x10000L, /* version 1.0 of driver */ diff --git a/src/cid/cidriver.h b/src/cid/cidriver.h index 76640c57b..59d9ded90 100644 --- a/src/cid/cidriver.h +++ b/src/cid/cidriver.h @@ -4,7 +4,7 @@ /* */ /* High-level CID driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/cidtoken.h b/src/cid/cidtoken.h index 653cc5586..b0e2dac6a 100644 --- a/src/cid/cidtoken.h +++ b/src/cid/cidtoken.h @@ -4,7 +4,7 @@ /* */ /* CID token definitions (specification only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cid/module.mk b/src/cid/module.mk index b30b8679b..9010e339a 100644 --- a/src/cid/module.mk +++ b/src/cid/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/cid/rules.mk b/src/cid/rules.mk index fcddd92ec..94333bda0 100644 --- a/src/cid/rules.mk +++ b/src/cid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/cid/type1cid.c b/src/cid/type1cid.c index aeb9c3eab..61770e3f1 100644 --- a/src/cid/type1cid.c +++ b/src/cid/type1cid.c @@ -4,7 +4,7 @@ /* */ /* FreeType OpenType driver component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,13 +17,13 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "cidparse.c" + +#include "cidgload.c" #include "cidload.c" #include "cidobjs.c" +#include "cidparse.c" #include "cidriver.c" -#include "cidgload.c" /* END */ diff --git a/src/gxvalid/Jamfile b/src/gxvalid/Jamfile index a120128ae..74f3c51ff 100644 --- a/src/gxvalid/Jamfile +++ b/src/gxvalid/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/gxvalid Jamfile # -# Copyright 2005-2017 by +# Copyright 2005-2018 by # suzuki toshiya, Masatake YAMATO and Red Hat K.K. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/gxvalid/README b/src/gxvalid/README index 7201459aa..af8128e0e 100644 --- a/src/gxvalid/README +++ b/src/gxvalid/README @@ -9,7 +9,7 @@ gxvalid: TrueType GX validator additional tables in TrueType font which are used by `QuickDraw GX Text', Apple Advanced Typography (AAT). In addition, gxvalid can validates `kern' tables which have been extended for AAT. Like the - otvalid module, gxvalid uses Freetype 2's validator framework + otvalid module, gxvalid uses FreeType 2's validator framework (ftvalid). You can link gxvalid with your program; before running your own layout @@ -287,11 +287,11 @@ gxvalid: TrueType GX validator 4-5. invalid feature number (117/183) ------------------------------------- - The GX/AAT extension can include 255 different layout features, but - popular layout features are predefined (see - http://developer.apple.com/fonts/Registry/index.html). Some fonts - include feature numbers which are incompatible with the predefined - feature registry. + The GX/AAT extension can include 255 different layout features, + but popular layout features are predefined (see + https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html). + Some fonts include feature numbers which are incompatible with the + predefined feature registry. In our survey, there are 140 fonts including `feat' table. @@ -518,7 +518,7 @@ gxvalid: TrueType GX validator ------------------------------------------------------------------------ -Copyright 2004-2017 by +Copyright 2004-2018 by suzuki toshiya, Masatake YAMATO, Red hat K.K., David Turner, Robert Wilhelm, and Werner Lemberg. diff --git a/src/gxvalid/gxvalid.c b/src/gxvalid/gxvalid.c index f0648ea39..d0577a247 100644 --- a/src/gxvalid/gxvalid.c +++ b/src/gxvalid/gxvalid.c @@ -4,7 +4,7 @@ /* */ /* FreeType validator for TrueTypeGX/AAT tables (body only). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ @@ -16,15 +16,17 @@ /* */ /***************************************************************************/ -#define FT_MAKE_OPTION_SINGLE_OBJECT +#define FT_MAKE_OPTION_SINGLE_OBJECT #include -#include "gxvfeat.c" -#include "gxvcommn.c" #include "gxvbsln.c" -#include "gxvtrak.c" +#include "gxvcommn.c" +#include "gxvfeat.c" #include "gxvjust.c" +#include "gxvkern.c" +#include "gxvlcar.c" +#include "gxvmod.c" #include "gxvmort.c" #include "gxvmort0.c" #include "gxvmort1.c" @@ -37,11 +39,9 @@ #include "gxvmorx2.c" #include "gxvmorx4.c" #include "gxvmorx5.c" -#include "gxvkern.c" #include "gxvopbd.c" #include "gxvprop.c" -#include "gxvlcar.c" -#include "gxvmod.c" +#include "gxvtrak.c" /* END */ diff --git a/src/gxvalid/gxvalid.h b/src/gxvalid/gxvalid.h index 78116ef85..19f037998 100644 --- a/src/gxvalid/gxvalid.h +++ b/src/gxvalid/gxvalid.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT table validation (specification only). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvbsln.c b/src/gxvalid/gxvbsln.c index 81dff7304..c367d3848 100644 --- a/src/gxvalid/gxvbsln.c +++ b/src/gxvalid/gxvbsln.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT bsln table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvcommn.c b/src/gxvalid/gxvcommn.c index db0a91ea7..b96601108 100644 --- a/src/gxvalid/gxvcommn.c +++ b/src/gxvalid/gxvcommn.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT common tables validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvcommn.h b/src/gxvalid/gxvcommn.h index 10b1c800f..8e4ff9caf 100644 --- a/src/gxvalid/gxvcommn.h +++ b/src/gxvalid/gxvcommn.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT common tables validation (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxverror.h b/src/gxvalid/gxverror.h index 80a2b8a26..d1151258a 100644 --- a/src/gxvalid/gxverror.h +++ b/src/gxvalid/gxverror.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT validation module error codes (specification only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvfeat.c b/src/gxvalid/gxvfeat.c index 2e3ec6f9b..2c805d1d1 100644 --- a/src/gxvalid/gxvfeat.c +++ b/src/gxvalid/gxvfeat.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT feat table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvfeat.h b/src/gxvalid/gxvfeat.h index 8c0e847eb..2d943806c 100644 --- a/src/gxvalid/gxvfeat.h +++ b/src/gxvalid/gxvfeat.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT feat table validation (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvfgen.c b/src/gxvalid/gxvfgen.c index 8cc08cd9c..840c0f352 100644 --- a/src/gxvalid/gxvfgen.c +++ b/src/gxvalid/gxvfgen.c @@ -5,7 +5,7 @@ /* Generate feature registry data for gxv `feat' validator. */ /* This program is derived from gxfeatreg.c in gxlayout. */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Masatake YAMATO and Redhat K.K. */ /* */ /* This file may only be used, */ @@ -21,7 +21,7 @@ /* gxfeatreg.c */ /* */ /* Database of font features pre-defined by Apple Computer, Inc. */ -/* http://developer.apple.com/fonts/Registry/ */ +/* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html */ /* (body). */ /* */ /* Copyright 2003 by */ diff --git a/src/gxvalid/gxvjust.c b/src/gxvalid/gxvjust.c index c8cfd83ea..00c429319 100644 --- a/src/gxvalid/gxvjust.c +++ b/src/gxvalid/gxvjust.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT just table validation (body). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvkern.c b/src/gxvalid/gxvkern.c index 9f9037387..9c0efd7a4 100644 --- a/src/gxvalid/gxvkern.c +++ b/src/gxvalid/gxvkern.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT kern table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvlcar.c b/src/gxvalid/gxvlcar.c index 775d5229f..0f261a9ac 100644 --- a/src/gxvalid/gxvlcar.c +++ b/src/gxvalid/gxvlcar.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT lcar table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmod.c b/src/gxvalid/gxvmod.c index 84e9275ba..1a3c86292 100644 --- a/src/gxvalid/gxvmod.c +++ b/src/gxvalid/gxvmod.c @@ -4,7 +4,7 @@ /* */ /* FreeType's TrueTypeGX/AAT validation module implementation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmod.h b/src/gxvalid/gxvmod.h index df25e60cb..745c62e10 100644 --- a/src/gxvalid/gxvmod.h +++ b/src/gxvalid/gxvmod.h @@ -5,7 +5,7 @@ /* FreeType's TrueTypeGX/AAT validation module implementation */ /* (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmort.c b/src/gxvalid/gxvmort.c index 184a6317c..b361cb2b9 100644 --- a/src/gxvalid/gxvmort.c +++ b/src/gxvalid/gxvmort.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT mort table validation (body). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmort.h b/src/gxvalid/gxvmort.h index d0543adcc..d8030645e 100644 --- a/src/gxvalid/gxvmort.h +++ b/src/gxvalid/gxvmort.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT common definition for mort table (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmort0.c b/src/gxvalid/gxvmort0.c index a75fad776..95cf53d5e 100644 --- a/src/gxvalid/gxvmort0.c +++ b/src/gxvalid/gxvmort0.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT mort table validation */ /* body for type0 (Indic Script Rearrangement) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmort1.c b/src/gxvalid/gxvmort1.c index 361ef2262..a7683a17b 100644 --- a/src/gxvalid/gxvmort1.c +++ b/src/gxvalid/gxvmort1.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT mort table validation */ /* body for type1 (Contextual Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmort2.c b/src/gxvalid/gxvmort2.c index c17e51e32..c23c2775a 100644 --- a/src/gxvalid/gxvmort2.c +++ b/src/gxvalid/gxvmort2.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT mort table validation */ /* body for type2 (Ligature Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmort4.c b/src/gxvalid/gxvmort4.c index 041bab369..9d21a5fc2 100644 --- a/src/gxvalid/gxvmort4.c +++ b/src/gxvalid/gxvmort4.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT mort table validation */ /* body for type4 (Non-Contextual Glyph Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmort5.c b/src/gxvalid/gxvmort5.c index 4751eceaa..42cb428aa 100644 --- a/src/gxvalid/gxvmort5.c +++ b/src/gxvalid/gxvmort5.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT mort table validation */ /* body for type5 (Contextual Glyph Insertion) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmorx.c b/src/gxvalid/gxvmorx.c index 2bb4f3b8b..9fd6e6b97 100644 --- a/src/gxvalid/gxvmorx.c +++ b/src/gxvalid/gxvmorx.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT morx table validation (body). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmorx.h b/src/gxvalid/gxvmorx.h index 20cec5867..6d9925e92 100644 --- a/src/gxvalid/gxvmorx.h +++ b/src/gxvalid/gxvmorx.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT common definition for morx table (specification). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmorx0.c b/src/gxvalid/gxvmorx0.c index e0a0a9243..302261b7f 100644 --- a/src/gxvalid/gxvmorx0.c +++ b/src/gxvalid/gxvmorx0.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for type0 (Indic Script Rearrangement) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmorx1.c b/src/gxvalid/gxvmorx1.c index 9afebdbfa..890ca74b1 100644 --- a/src/gxvalid/gxvmorx1.c +++ b/src/gxvalid/gxvmorx1.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for type1 (Contextual Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmorx2.c b/src/gxvalid/gxvmorx2.c index 3a60cf68a..3135031d4 100644 --- a/src/gxvalid/gxvmorx2.c +++ b/src/gxvalid/gxvmorx2.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for type2 (Ligature Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmorx4.c b/src/gxvalid/gxvmorx4.c index 29555685a..1e2397b0c 100644 --- a/src/gxvalid/gxvmorx4.c +++ b/src/gxvalid/gxvmorx4.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for "morx" type4 (Non-Contextual Glyph Substitution) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvmorx5.c b/src/gxvalid/gxvmorx5.c index 05c11417e..db4f9290c 100644 --- a/src/gxvalid/gxvmorx5.c +++ b/src/gxvalid/gxvmorx5.c @@ -5,7 +5,7 @@ /* TrueTypeGX/AAT morx table validation */ /* body for type5 (Contextual Glyph Insertion) subtable. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvopbd.c b/src/gxvalid/gxvopbd.c index 11580d8b2..e2c167ea5 100644 --- a/src/gxvalid/gxvopbd.c +++ b/src/gxvalid/gxvopbd.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT opbd table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvprop.c b/src/gxvalid/gxvprop.c index 7d398b7e6..a67b6bdd0 100644 --- a/src/gxvalid/gxvprop.c +++ b/src/gxvalid/gxvprop.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT prop table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/gxvtrak.c b/src/gxvalid/gxvtrak.c index dd4982556..d501b5014 100644 --- a/src/gxvalid/gxvtrak.c +++ b/src/gxvalid/gxvtrak.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT trak table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ diff --git a/src/gxvalid/module.mk b/src/gxvalid/module.mk index 7f87e1081..b64879dce 100644 --- a/src/gxvalid/module.mk +++ b/src/gxvalid/module.mk @@ -2,7 +2,7 @@ # FreeType 2 gxvalid module definition # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # suzuki toshiya, Masatake YAMATO, Red Hat K.K., # David Turner, Robert Wilhelm, and Werner Lemberg. # diff --git a/src/gxvalid/rules.mk b/src/gxvalid/rules.mk index 10ec08c5b..3a17c030a 100644 --- a/src/gxvalid/rules.mk +++ b/src/gxvalid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # suzuki toshiya, Masatake YAMATO, Red Hat K.K., # David Turner, Robert Wilhelm, and Werner Lemberg. # diff --git a/src/gzip/Jamfile b/src/gzip/Jamfile index 170c13a4c..a7b4c8c95 100644 --- a/src/gzip/Jamfile +++ b/src/gzip/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/gzip Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c index c487786d9..f8011c2dd 100644 --- a/src/gzip/ftgzip.c +++ b/src/gzip/ftgzip.c @@ -8,7 +8,7 @@ /* parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/gzip/rules.mk b/src/gzip/rules.mk index bc7d5fa63..1a2e48beb 100644 --- a/src/gzip/rules.mk +++ b/src/gzip/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/lzw/Jamfile b/src/lzw/Jamfile index 8e61f080a..cb83aa4a5 100644 --- a/src/lzw/Jamfile +++ b/src/lzw/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/lzw Jamfile # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/lzw/ftlzw.c b/src/lzw/ftlzw.c index 941f6cef4..cb46f93c6 100644 --- a/src/lzw/ftlzw.c +++ b/src/lzw/ftlzw.c @@ -8,7 +8,7 @@ /* be used to parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* Albert Chin-A-Young. */ /* */ /* based on code in `src/gzip/ftgzip.c' */ diff --git a/src/lzw/ftzopen.c b/src/lzw/ftzopen.c index 486c546c1..2b868ba9f 100644 --- a/src/lzw/ftzopen.c +++ b/src/lzw/ftzopen.c @@ -8,7 +8,7 @@ /* be used to parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/lzw/ftzopen.h b/src/lzw/ftzopen.h index a108862c0..4fd267eb9 100644 --- a/src/lzw/ftzopen.h +++ b/src/lzw/ftzopen.h @@ -8,7 +8,7 @@ /* be used to parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/lzw/rules.mk b/src/lzw/rules.mk index e7bf68a06..18933c41c 100644 --- a/src/lzw/rules.mk +++ b/src/lzw/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # Albert Chin-A-Young. # # based on `src/lzw/rules.mk' diff --git a/src/otvalid/Jamfile b/src/otvalid/Jamfile index a755f2bcf..21b8e0cb0 100644 --- a/src/otvalid/Jamfile +++ b/src/otvalid/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/otvalid Jamfile # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/otvalid/module.mk b/src/otvalid/module.mk index 5ee1265db..34f3dab32 100644 --- a/src/otvalid/module.mk +++ b/src/otvalid/module.mk @@ -3,7 +3,7 @@ # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/otvalid/otvalid.c b/src/otvalid/otvalid.c index 3901c54c4..4423ca101 100644 --- a/src/otvalid/otvalid.c +++ b/src/otvalid/otvalid.c @@ -4,7 +4,7 @@ /* */ /* FreeType validator for OpenType tables (body only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -15,8 +15,8 @@ /* */ /***************************************************************************/ -#define FT_MAKE_OPTION_SINGLE_OBJECT +#define FT_MAKE_OPTION_SINGLE_OBJECT #include #include "otvbase.c" @@ -28,4 +28,5 @@ #include "otvmath.c" #include "otvmod.c" + /* END */ diff --git a/src/otvalid/otvalid.h b/src/otvalid/otvalid.h index f2969cccc..d7801abae 100644 --- a/src/otvalid/otvalid.h +++ b/src/otvalid/otvalid.h @@ -4,7 +4,7 @@ /* */ /* OpenType table validation (specification only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvbase.c b/src/otvalid/otvbase.c index 3adad8439..a01d45c70 100644 --- a/src/otvalid/otvbase.c +++ b/src/otvalid/otvbase.c @@ -4,7 +4,7 @@ /* */ /* OpenType BASE table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -284,22 +284,41 @@ OTV_Validator otvalid = &otvalidrec; FT_Bytes p = table; FT_UInt table_size; + FT_UShort version; OTV_OPTIONAL_TABLE( HorizAxis ); OTV_OPTIONAL_TABLE( VertAxis ); + OTV_OPTIONAL_TABLE32( itemVarStore ); + otvalid->root = ftvalid; FT_TRACE3(( "validating BASE table\n" )); OTV_INIT; - OTV_LIMIT_CHECK( 6 ); + OTV_LIMIT_CHECK( 4 ); - if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */ FT_INVALID_FORMAT; - table_size = 6; + version = FT_NEXT_USHORT( p ); /* minorVersion */ + + table_size = 8; + switch ( version ) + { + case 0: + OTV_LIMIT_CHECK( 4 ); + break; + + case 1: + OTV_LIMIT_CHECK( 8 ); + table_size += 4; + break; + + default: + FT_INVALID_FORMAT; + } OTV_OPTIONAL_OFFSET( HorizAxis ); OTV_SIZE_CHECK( HorizAxis ); @@ -311,6 +330,14 @@ if ( VertAxis ) otv_Axis_validate( table + VertAxis, otvalid ); + if ( version > 0 ) + { + OTV_OPTIONAL_OFFSET32( itemVarStore ); + OTV_SIZE_CHECK32( itemVarStore ); + if ( itemVarStore ) + OTV_TRACE(( " [omitting itemVarStore validation]\n" )); /* XXX */ + } + FT_TRACE4(( "\n" )); } diff --git a/src/otvalid/otvcommn.c b/src/otvalid/otvcommn.c index 3407d2ad4..0ccfb03c0 100644 --- a/src/otvalid/otvcommn.c +++ b/src/otvalid/otvcommn.c @@ -4,7 +4,7 @@ /* */ /* OpenType common tables validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -313,19 +313,26 @@ OTV_NAME_ENTER( "Device" ); - OTV_LIMIT_CHECK( 8 ); + OTV_LIMIT_CHECK( 6 ); StartSize = FT_NEXT_USHORT( p ); EndSize = FT_NEXT_USHORT( p ); DeltaFormat = FT_NEXT_USHORT( p ); - if ( DeltaFormat < 1 || DeltaFormat > 3 ) - FT_INVALID_FORMAT; + if ( DeltaFormat == 0x8000U ) + { + /* VariationIndex, nothing to do */ + } + else + { + if ( DeltaFormat < 1 || DeltaFormat > 3 ) + FT_INVALID_FORMAT; - if ( EndSize < StartSize ) - FT_INVALID_DATA; + if ( EndSize < StartSize ) + FT_INVALID_DATA; - count = EndSize - StartSize + 1; - OTV_LIMIT_CHECK( ( 1 << DeltaFormat ) * count / 8 ); /* DeltaValue */ + count = EndSize - StartSize + 1; + OTV_LIMIT_CHECK( ( 1 << DeltaFormat ) * count / 8 ); /* DeltaValue */ + } OTV_EXIT; } @@ -347,7 +354,7 @@ OTV_Validator otvalid ) { FT_Bytes p = table; - FT_UInt LookupType, SubTableCount; + FT_UInt LookupType, LookupFlag, SubTableCount; OTV_Validate_Func validate; @@ -355,7 +362,7 @@ OTV_LIMIT_CHECK( 6 ); LookupType = FT_NEXT_USHORT( p ); - p += 2; /* skip LookupFlag */ + LookupFlag = FT_NEXT_USHORT( p ); SubTableCount = FT_NEXT_USHORT( p ); OTV_TRACE(( " (type %d)\n", LookupType )); @@ -373,6 +380,9 @@ for ( ; SubTableCount > 0; SubTableCount-- ) validate( table + FT_NEXT_USHORT( p ), otvalid ); + if ( LookupFlag & 0x10 ) + OTV_LIMIT_CHECK( 2 ); /* MarkFilteringSet */ + OTV_EXIT; } diff --git a/src/otvalid/otvcommn.h b/src/otvalid/otvcommn.h index 10a603ebb..a392784cf 100644 --- a/src/otvalid/otvcommn.h +++ b/src/otvalid/otvcommn.h @@ -4,7 +4,7 @@ /* */ /* OpenType common tables validation (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -67,29 +67,38 @@ FT_BEGIN_HEADER #undef FT_INVALID_ -#define FT_INVALID_( _error ) \ +#define FT_INVALID_( _error ) \ ft_validator_error( otvalid->root, FT_THROW( _error ) ) #define OTV_OPTIONAL_TABLE( _table ) FT_UShort _table; \ FT_Bytes _table ## _p +#define OTV_OPTIONAL_TABLE32( _table ) FT_ULong _table; \ + FT_Bytes _table ## _p + #define OTV_OPTIONAL_OFFSET( _offset ) \ FT_BEGIN_STMNT \ _offset ## _p = p; \ _offset = FT_NEXT_USHORT( p ); \ FT_END_STMNT -#define OTV_LIMIT_CHECK( _count ) \ - FT_BEGIN_STMNT \ +#define OTV_OPTIONAL_OFFSET32( _offset ) \ + FT_BEGIN_STMNT \ + _offset ## _p = p; \ + _offset = FT_NEXT_ULONG( p ); \ + FT_END_STMNT + +#define OTV_LIMIT_CHECK( _count ) \ + FT_BEGIN_STMNT \ if ( p + (_count) > otvalid->root->limit ) \ - FT_INVALID_TOO_SHORT; \ + FT_INVALID_TOO_SHORT; \ FT_END_STMNT #define OTV_SIZE_CHECK( _size ) \ FT_BEGIN_STMNT \ if ( _size > 0 && _size < table_size ) \ { \ - if ( otvalid->root->level == FT_VALIDATE_PARANOID ) \ + if ( otvalid->root->level == FT_VALIDATE_PARANOID ) \ FT_INVALID_OFFSET; \ else \ { \ @@ -102,12 +111,33 @@ FT_BEGIN_HEADER " set to zero.\n" \ "\n", #_size )); \ \ - /* always assume 16bit entities */ \ _size = pp[0] = pp[1] = 0; \ } \ } \ FT_END_STMNT +#define OTV_SIZE_CHECK32( _size ) \ + FT_BEGIN_STMNT \ + if ( _size > 0 && _size < table_size ) \ + { \ + if ( otvalid->root->level == FT_VALIDATE_PARANOID ) \ + FT_INVALID_OFFSET; \ + else \ + { \ + /* strip off `const' */ \ + FT_Byte* pp = (FT_Byte*)_size ## _p; \ + \ + \ + FT_TRACE3(( "\n" \ + "Invalid offset to optional table `%s'" \ + " set to zero.\n" \ + "\n", #_size )); \ + \ + _size = pp[0] = pp[1] = pp[2] = pp[3] = 0; \ + } \ + } \ + FT_END_STMNT + #define OTV_NAME_(x) #x #define OTV_NAME(x) OTV_NAME_(x) @@ -146,11 +176,11 @@ FT_BEGIN_HEADER #define OTV_INIT otvalid->debug_indent = 0 -#define OTV_ENTER \ - FT_BEGIN_STMNT \ - otvalid->debug_indent += 2; \ - FT_TRACE4(( "%*.s", otvalid->debug_indent, 0 )); \ - FT_TRACE4(( "%s table\n", \ +#define OTV_ENTER \ + FT_BEGIN_STMNT \ + otvalid->debug_indent += 2; \ + FT_TRACE4(( "%*.s", otvalid->debug_indent, 0 )); \ + FT_TRACE4(( "%s table\n", \ otvalid->debug_function_name[otvalid->nesting_level] )); \ FT_END_STMNT diff --git a/src/otvalid/otverror.h b/src/otvalid/otverror.h index 699903987..2fcf42e38 100644 --- a/src/otvalid/otverror.h +++ b/src/otvalid/otverror.h @@ -4,7 +4,7 @@ /* */ /* OpenType validation module error codes (specification only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvgdef.c b/src/otvalid/otvgdef.c index 27b9a69ca..08f317154 100644 --- a/src/otvalid/otvgdef.c +++ b/src/otvalid/otvgdef.c @@ -4,7 +4,7 @@ /* */ /* OpenType GDEF table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -68,7 +68,7 @@ OTV_LIMIT_CHECK( GlyphCount * 2 ); otvalid->nesting_level++; - func = otvalid->func[otvalid->nesting_level]; + func = otvalid->func[otvalid->nesting_level]; otvalid->extra1 = 0; for ( ; GlyphCount > 0; GlyphCount-- ) @@ -133,6 +133,40 @@ } + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** MARK GLYPH SETS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + static void + otv_MarkGlyphSets_validate( FT_Bytes table, + OTV_Validator otvalid ) + { + FT_Bytes p = table; + FT_UInt MarkGlyphSetCount; + + + OTV_NAME_ENTER( "MarkGlyphSets" ); + + p += 2; /* skip Format */ + + OTV_LIMIT_CHECK( 2 ); + MarkGlyphSetCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (MarkGlyphSetCount = %d)\n", MarkGlyphSetCount )); + + OTV_LIMIT_CHECK( MarkGlyphSetCount * 4 ); /* CoverageOffsets */ + + for ( ; MarkGlyphSetCount > 0; MarkGlyphSetCount-- ) + otv_Coverage_validate( table + FT_NEXT_ULONG( p ), otvalid, -1 ); + + OTV_EXIT; + } + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -152,14 +186,18 @@ { OTV_ValidatorRec otvalidrec; OTV_Validator otvalid = &otvalidrec; - FT_Bytes p = table; + FT_Bytes p = table; FT_UInt table_size; - FT_Bool need_MarkAttachClassDef; + FT_UShort version; + FT_Bool need_MarkAttachClassDef = 1; OTV_OPTIONAL_TABLE( GlyphClassDef ); OTV_OPTIONAL_TABLE( AttachListOffset ); OTV_OPTIONAL_TABLE( LigCaretListOffset ); OTV_OPTIONAL_TABLE( MarkAttachClassDef ); + OTV_OPTIONAL_TABLE( MarkGlyphSetsDef ); + + OTV_OPTIONAL_TABLE32( itemVarStore ); otvalid->root = ftvalid; @@ -167,24 +205,49 @@ FT_TRACE3(( "validating GDEF table\n" )); OTV_INIT; - OTV_LIMIT_CHECK( 12 ); + OTV_LIMIT_CHECK( 4 ); - if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */ FT_INVALID_FORMAT; - /* MarkAttachClassDef has been added to the OpenType */ - /* specification without increasing GDEF's version, */ - /* so we use this ugly hack to find out whether the */ - /* table is needed actually. */ + version = FT_NEXT_USHORT( p ); /* minorVersion */ - need_MarkAttachClassDef = FT_BOOL( - otv_GSUBGPOS_have_MarkAttachmentType_flag( gsub ) || - otv_GSUBGPOS_have_MarkAttachmentType_flag( gpos ) ); + table_size = 10; + switch ( version ) + { + case 0: + /* MarkAttachClassDef has been added to the OpenType */ + /* specification without increasing GDEF's version, */ + /* so we use this ugly hack to find out whether the */ + /* table is needed actually. */ + + need_MarkAttachClassDef = FT_BOOL( + otv_GSUBGPOS_have_MarkAttachmentType_flag( gsub ) || + otv_GSUBGPOS_have_MarkAttachmentType_flag( gpos ) ); + + if ( need_MarkAttachClassDef ) + { + OTV_LIMIT_CHECK( 8 ); + table_size += 2; + } + else + OTV_LIMIT_CHECK( 6 ); /* OpenType < 1.2 */ - if ( need_MarkAttachClassDef ) - table_size = 12; /* OpenType >= 1.2 */ - else - table_size = 10; /* OpenType < 1.2 */ + break; + + case 2: + OTV_LIMIT_CHECK( 10 ); + table_size += 4; + break; + + case 3: + OTV_LIMIT_CHECK( 14 ); + table_size += 8; + break; + + default: + FT_INVALID_FORMAT; + } otvalid->glyph_count = glyph_count; @@ -217,6 +280,22 @@ otv_ClassDef_validate( table + MarkAttachClassDef, otvalid ); } + if ( version > 0 ) + { + OTV_OPTIONAL_OFFSET( MarkGlyphSetsDef ); + OTV_SIZE_CHECK( MarkGlyphSetsDef ); + if ( MarkGlyphSetsDef ) + otv_MarkGlyphSets_validate( table + MarkGlyphSetsDef, otvalid ); + } + + if ( version > 2 ) + { + OTV_OPTIONAL_OFFSET32( itemVarStore ); + OTV_SIZE_CHECK32( itemVarStore ); + if ( itemVarStore ) + OTV_TRACE(( " [omitting itemVarStore validation]\n" )); /* XXX */ + } + FT_TRACE4(( "\n" )); } diff --git a/src/otvalid/otvgpos.c b/src/otvalid/otvgpos.c index 0fbcc2077..696b35cae 100644 --- a/src/otvalid/otvgpos.c +++ b/src/otvalid/otvgpos.c @@ -4,7 +4,7 @@ /* */ /* OpenType GPOS table validation (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -130,7 +130,7 @@ otv_MarkArray_validate( table + Array1, otvalid ); otvalid->nesting_level++; - func = otvalid->func[otvalid->nesting_level]; + func = otvalid->func[otvalid->nesting_level]; otvalid->extra1 = ClassCount; func( table + Array2, otvalid ); @@ -218,10 +218,6 @@ OTV_LIMIT_CHECK( 2 ); OTV_OPTIONAL_OFFSET( device ); - /* XXX: this value is usually too small, especially if the current */ - /* ValueRecord is part of an array -- getting the correct table */ - /* size is probably not worth the trouble */ - table_size = p - otvalid->extra3; OTV_SIZE_CHECK( device ); @@ -271,7 +267,7 @@ case 3: { - FT_UInt table_size; + FT_UInt table_size; OTV_OPTIONAL_TABLE( XDeviceTable ); OTV_OPTIONAL_TABLE( YDeviceTable ); @@ -426,6 +422,8 @@ /*************************************************************************/ /*************************************************************************/ + /* sets otvalid->extra3 (pointer to base table) */ + static void otv_PairSet_validate( FT_Bytes table, FT_UInt format1, @@ -438,6 +436,8 @@ OTV_NAME_ENTER( "PairSet" ); + otvalid->extra3 = table; + OTV_LIMIT_CHECK( 2 ); PairValueCount = FT_NEXT_USHORT( p ); @@ -483,8 +483,6 @@ OTV_TRACE(( " (format %d)\n", PosFormat )); - otvalid->extra3 = table; - switch ( PosFormat ) { case 1: /* PairPosFormat1 */ @@ -537,7 +535,9 @@ otv_ClassDef_validate( table + ClassDef2, otvalid ); OTV_LIMIT_CHECK( ClassCount1 * ClassCount2 * - ( len_value1 + len_value2 ) ); + ( len_value1 + len_value2 ) ); + + otvalid->extra3 = table; /* Class1Record */ for ( ; ClassCount1 > 0; ClassCount1-- ) @@ -985,20 +985,42 @@ { OTV_ValidatorRec validrec; OTV_Validator otvalid = &validrec; - FT_Bytes p = table; + FT_Bytes p = table; + FT_UInt table_size; + FT_UShort version; FT_UInt ScriptList, FeatureList, LookupList; + OTV_OPTIONAL_TABLE32( featureVariations ); + otvalid->root = ftvalid; FT_TRACE3(( "validating GPOS table\n" )); OTV_INIT; - OTV_LIMIT_CHECK( 10 ); + OTV_LIMIT_CHECK( 4 ); - if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */ FT_INVALID_FORMAT; + version = FT_NEXT_USHORT( p ); /* minorVersion */ + + table_size = 10; + switch ( version ) + { + case 0: + OTV_LIMIT_CHECK( 6 ); + break; + + case 1: + OTV_LIMIT_CHECK( 10 ); + table_size += 4; + break; + + default: + FT_INVALID_FORMAT; + } + ScriptList = FT_NEXT_USHORT( p ); FeatureList = FT_NEXT_USHORT( p ); LookupList = FT_NEXT_USHORT( p ); @@ -1014,6 +1036,14 @@ otv_ScriptList_validate( table + ScriptList, table + FeatureList, otvalid ); + if ( version > 0 ) + { + OTV_OPTIONAL_OFFSET32( featureVariations ); + OTV_SIZE_CHECK32( featureVariations ); + if ( featureVariations ) + OTV_TRACE(( " [omitting featureVariations validation]\n" )); /* XXX */ + } + FT_TRACE4(( "\n" )); } diff --git a/src/otvalid/otvgpos.h b/src/otvalid/otvgpos.h index 99b0ad391..95f9ac3ee 100644 --- a/src/otvalid/otvgpos.h +++ b/src/otvalid/otvgpos.h @@ -4,7 +4,7 @@ /* */ /* OpenType GPOS table validator (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvgsub.c b/src/otvalid/otvgsub.c index f9bd8dc5d..d35ea67f3 100644 --- a/src/otvalid/otvgsub.c +++ b/src/otvalid/otvgsub.c @@ -4,7 +4,7 @@ /* */ /* OpenType GSUB table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -552,18 +552,40 @@ OTV_ValidatorRec otvalidrec; OTV_Validator otvalid = &otvalidrec; FT_Bytes p = table; + FT_UInt table_size; + FT_UShort version; FT_UInt ScriptList, FeatureList, LookupList; + OTV_OPTIONAL_TABLE32( featureVariations ); + otvalid->root = ftvalid; FT_TRACE3(( "validating GSUB table\n" )); OTV_INIT; - OTV_LIMIT_CHECK( 10 ); + OTV_LIMIT_CHECK( 4 ); + + if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */ + FT_INVALID_FORMAT; + + version = FT_NEXT_USHORT( p ); /* minorVersion */ + + table_size = 10; + switch ( version ) + { + case 0: + OTV_LIMIT_CHECK( 6 ); + break; + + case 1: + OTV_LIMIT_CHECK( 10 ); + table_size += 4; + break; - if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + default: FT_INVALID_FORMAT; + } ScriptList = FT_NEXT_USHORT( p ); FeatureList = FT_NEXT_USHORT( p ); @@ -580,6 +602,14 @@ otv_ScriptList_validate( table + ScriptList, table + FeatureList, otvalid ); + if ( version > 0 ) + { + OTV_OPTIONAL_OFFSET32( featureVariations ); + OTV_SIZE_CHECK32( featureVariations ); + if ( featureVariations ) + OTV_TRACE(( " [omitting featureVariations validation]\n" )); /* XXX */ + } + FT_TRACE4(( "\n" )); } diff --git a/src/otvalid/otvjstf.c b/src/otvalid/otvjstf.c index 57a38f95c..94d4af90f 100644 --- a/src/otvalid/otvjstf.c +++ b/src/otvalid/otvjstf.c @@ -4,7 +4,7 @@ /* */ /* OpenType JSTF table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvmath.c b/src/otvalid/otvmath.c index a14d36970..b9800f60a 100644 --- a/src/otvalid/otvmath.c +++ b/src/otvalid/otvmath.c @@ -4,7 +4,7 @@ /* */ /* OpenType MATH table validation (body). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* Written by George Williams. */ diff --git a/src/otvalid/otvmod.c b/src/otvalid/otvmod.c index 35ffc43d3..89ee449d1 100644 --- a/src/otvalid/otvmod.c +++ b/src/otvalid/otvmod.c @@ -4,7 +4,7 @@ /* */ /* FreeType's OpenType validation module implementation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/otvmod.h b/src/otvalid/otvmod.h index 30d401ddc..6917bccee 100644 --- a/src/otvalid/otvmod.h +++ b/src/otvalid/otvmod.h @@ -5,7 +5,7 @@ /* FreeType's OpenType validation module implementation */ /* (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/otvalid/rules.mk b/src/otvalid/rules.mk index 10329a96e..d4fc72374 100644 --- a/src/otvalid/rules.mk +++ b/src/otvalid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/pcf/Jamfile b/src/pcf/Jamfile index 794f27dfb..7b92b12dd 100644 --- a/src/pcf/Jamfile +++ b/src/pcf/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/pcf Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/pcf/README b/src/pcf/README index 10eff15fb..09ea970ed 100644 --- a/src/pcf/README +++ b/src/pcf/README @@ -41,8 +41,8 @@ value given as argument into the corresponding glyph number. Known problems ************** -- dealing explicitly with encodings breaks the uniformity of freetype2 - api. +- dealing explicitly with encodings breaks the uniformity of FreeType 2 + API. - except for encodings properties, client applications have no visibility of the PCF_Face object. This means that applications diff --git a/src/pcf/pcf.c b/src/pcf/pcf.c index 11d5b7b2a..8ffd6e280 100644 --- a/src/pcf/pcf.c +++ b/src/pcf/pcf.c @@ -26,11 +26,11 @@ THE SOFTWARE. #define FT_MAKE_OPTION_SINGLE_OBJECT - - #include -#include "pcfutil.c" -#include "pcfread.c" + #include "pcfdrivr.c" +#include "pcfread.c" +#include "pcfutil.c" + /* END */ diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c index bc6542372..0119d9485 100644 --- a/src/pcf/pcfdrivr.c +++ b/src/pcf/pcfdrivr.c @@ -50,7 +50,7 @@ THE SOFTWARE. #include FT_SERVICE_BDF_H #include FT_SERVICE_FONT_FORMAT_H #include FT_SERVICE_PROPERTIES_H -#include FT_PCF_DRIVER_H +#include FT_DRIVER_H /*************************************************************************/ @@ -387,7 +387,11 @@ THE SOFTWARE. if ( !ft_strcmp( s, "10646" ) || ( !ft_strcmp( s, "8859" ) && !ft_strcmp( face->charset_encoding, "1" ) ) ) - unicode_charmap = 1; + unicode_charmap = 1; + /* another name for ASCII */ + else if ( !ft_strcmp( s, "646.1991" ) && + !ft_strcmp( face->charset_encoding, "IRV" ) ) + unicode_charmap = 1; } } @@ -409,12 +413,6 @@ THE SOFTWARE. } error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL ); - -#if 0 - /* Select default charmap */ - if ( pcfface->num_charmaps ) - pcfface->charmap = pcfface->charmaps[0]; -#endif } } @@ -722,6 +720,9 @@ THE SOFTWARE. FT_UNUSED( module ); FT_UNUSED( value ); FT_UNUSED( value_is_string ); +#ifndef FT_DEBUG_LEVEL_TRACE + FT_UNUSED( property_name ); +#endif #endif /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */ @@ -757,6 +758,9 @@ THE SOFTWARE. FT_UNUSED( module ); FT_UNUSED( value ); +#ifndef FT_DEBUG_LEVEL_TRACE + FT_UNUSED( property_name ); +#endif #endif /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */ diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c index 3eacf2baf..537da0dc7 100644 --- a/src/pcf/pcfread.c +++ b/src/pcf/pcfread.c @@ -840,7 +840,7 @@ THE SOFTWARE. FT_TRACE4(( "pcf_get_bitmaps:\n" " format: 0x%lX\n" " (%s, %s,\n" - " padding=%d bits, scanning=%d bits)\n", + " padding=%d bit%s, scanning=%d bit%s)\n", format, PCF_BYTE_ORDER( format ) == MSBFirst ? "most significant byte first" @@ -849,7 +849,9 @@ THE SOFTWARE. ? "most significant bit first" : "least significant bit first", 8 << PCF_GLYPH_PAD_INDEX( format ), - 8 << PCF_SCAN_UNIT_INDEX( format ) )); + ( 8 << PCF_GLYPH_PAD_INDEX( format ) ) == 1 ? "" : "s", + 8 << PCF_SCAN_UNIT_INDEX( format ), + ( 8 << PCF_SCAN_UNIT_INDEX( format ) ) == 1 ? "" : "s" )); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) return FT_THROW( Invalid_File_Format ); @@ -1162,6 +1164,20 @@ THE SOFTWARE. accel->fontDescent, accel->maxOverlap )); + /* sanity checks */ + if ( FT_ABS( accel->fontAscent ) > 0x7FFF ) + { + accel->fontAscent = accel->fontAscent < 0 ? -0x7FFF : 0x7FFF; + FT_TRACE0(( "pfc_get_accel: clamping font ascent to value %d\n", + accel->fontAscent )); + } + if ( FT_ABS( accel->fontDescent ) > 0x7FFF ) + { + accel->fontDescent = accel->fontDescent < 0 ? -0x7FFF : 0x7FFF; + FT_TRACE0(( "pfc_get_accel: clamping font descent to value %d\n", + accel->fontDescent )); + } + FT_TRACE5(( " minbounds:" )); error = pcf_get_metric( stream, format & ( ~PCF_FORMAT_MASK ), @@ -1496,8 +1512,16 @@ THE SOFTWARE. if ( face->accel.fontAscent + face->accel.fontDescent < 0 ) FT_TRACE0(( "pcf_load_font: negative height\n" )); #endif - bsize->height = FT_ABS( (FT_Short)( face->accel.fontAscent + - face->accel.fontDescent ) ); + if ( FT_ABS( face->accel.fontAscent + + face->accel.fontDescent ) > 0x7FFF ) + { + bsize->height = 0x7FFF; + FT_TRACE0(( "pcf_load_font: clamping height to value %d\n", + bsize->height )); + } + else + bsize->height = FT_ABS( (FT_Short)( face->accel.fontAscent + + face->accel.fontDescent ) ); prop = pcf_find_property( face, "AVERAGE_WIDTH" ); if ( prop ) @@ -1506,10 +1530,20 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "pcf_load_font: negative average width\n" )); #endif - bsize->width = FT_ABS( (FT_Short)( ( prop->value.l ) + 5 ) / 10 ); + if ( ( FT_ABS( prop->value.l ) > 0x7FFFL * 10 - 5 ) ) + { + bsize->width = 0x7FFF; + FT_TRACE0(( "pcf_load_font: clamping average width to value %d\n", + bsize->width )); + } + else + bsize->width = FT_ABS( (FT_Short)( ( prop->value.l + 5 ) / 10 ) ); } else + { + /* this is a heuristical value */ bsize->width = (FT_Short)FT_MulDiv( bsize->height, 2, 3 ); + } prop = pcf_find_property( face, "POINT_SIZE" ); if ( prop ) @@ -1519,9 +1553,16 @@ THE SOFTWARE. FT_TRACE0(( "pcf_load_font: negative point size\n" )); #endif /* convert from 722.7 decipoints to 72 points per inch */ - bsize->size = FT_MulDiv( FT_ABS( prop->value.l ), - 64 * 7200, - 72270L ); + if ( FT_ABS( prop->value.l ) > 0x504C2L ) /* 0x7FFF * 72270/7200 */ + { + bsize->size = 0x7FFF; + FT_TRACE0(( "pcf_load_font: clamping point size to value %d\n", + bsize->size )); + } + else + bsize->size = FT_MulDiv( FT_ABS( prop->value.l ), + 64 * 7200, + 72270L ); } prop = pcf_find_property( face, "PIXEL_SIZE" ); @@ -1531,7 +1572,14 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "pcf_load_font: negative pixel size\n" )); #endif - bsize->y_ppem = FT_ABS( (FT_Short)prop->value.l ) << 6; + if ( FT_ABS( prop->value.l ) > 0x7FFF ) + { + bsize->y_ppem = 0x7FFF << 6; + FT_TRACE0(( "pcf_load_font: clamping pixel size to value %d\n", + bsize->y_ppem )); + } + else + bsize->y_ppem = FT_ABS( (FT_Short)prop->value.l ) << 6; } prop = pcf_find_property( face, "RESOLUTION_X" ); @@ -1541,7 +1589,14 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "pcf_load_font: negative X resolution\n" )); #endif - resolution_x = FT_ABS( (FT_Short)prop->value.l ); + if ( FT_ABS( prop->value.l ) > 0x7FFF ) + { + resolution_x = 0x7FFF; + FT_TRACE0(( "pcf_load_font: clamping X resolution to value %d\n", + resolution_x )); + } + else + resolution_x = FT_ABS( (FT_Short)prop->value.l ); } prop = pcf_find_property( face, "RESOLUTION_Y" ); @@ -1551,7 +1606,14 @@ THE SOFTWARE. if ( prop->value.l < 0 ) FT_TRACE0(( "pcf_load_font: negative Y resolution\n" )); #endif - resolution_y = FT_ABS( (FT_Short)prop->value.l ); + if ( FT_ABS( prop->value.l ) > 0x7FFF ) + { + resolution_y = 0x7FFF; + FT_TRACE0(( "pcf_load_font: clamping Y resolution to value %d\n", + resolution_y )); + } + else + resolution_y = FT_ABS( (FT_Short)prop->value.l ); } if ( bsize->y_ppem == 0 ) diff --git a/src/pfr/Jamfile b/src/pfr/Jamfile index 178317162..cb55a7ee8 100644 --- a/src/pfr/Jamfile +++ b/src/pfr/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/pfr Jamfile # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/pfr/module.mk b/src/pfr/module.mk index 7b84da970..27fec8e5f 100644 --- a/src/pfr/module.mk +++ b/src/pfr/module.mk @@ -3,7 +3,7 @@ # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/pfr/pfr.c b/src/pfr/pfr.c index 2d0e72ce5..1760882fc 100644 --- a/src/pfr/pfr.c +++ b/src/pfr/pfr.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR driver component. */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -15,15 +15,16 @@ /* */ /***************************************************************************/ -#define FT_MAKE_OPTION_SINGLE_OBJECT +#define FT_MAKE_OPTION_SINGLE_OBJECT #include -#include "pfrload.c" -#include "pfrgload.c" #include "pfrcmap.c" -#include "pfrobjs.c" #include "pfrdrivr.c" +#include "pfrgload.c" +#include "pfrload.c" +#include "pfrobjs.c" #include "pfrsbit.c" + /* END */ diff --git a/src/pfr/pfrcmap.c b/src/pfr/pfrcmap.c index 1d6b15be4..60643780a 100644 --- a/src/pfr/pfrcmap.c +++ b/src/pfr/pfrcmap.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR cmap handling (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrcmap.h b/src/pfr/pfrcmap.h index 957bf65b4..c70a0c83c 100644 --- a/src/pfr/pfrcmap.h +++ b/src/pfr/pfrcmap.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR cmap handling (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrdrivr.c b/src/pfr/pfrdrivr.c index 195cdb76a..6c7e50128 100644 --- a/src/pfr/pfrdrivr.c +++ b/src/pfr/pfrdrivr.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR driver interface (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrdrivr.h b/src/pfr/pfrdrivr.h index b81d56017..cab852789 100644 --- a/src/pfr/pfrdrivr.h +++ b/src/pfr/pfrdrivr.h @@ -4,7 +4,7 @@ /* */ /* High-level Type PFR driver interface (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrerror.h b/src/pfr/pfrerror.h index ef044e32c..7027c818e 100644 --- a/src/pfr/pfrerror.h +++ b/src/pfr/pfrerror.h @@ -4,7 +4,7 @@ /* */ /* PFR error codes (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrgload.c b/src/pfr/pfrgload.c index 93f5fc709..b7990196b 100644 --- a/src/pfr/pfrgload.c +++ b/src/pfr/pfrgload.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR glyph loader (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -756,8 +756,10 @@ count = glyph->num_subs - old_count; - FT_TRACE4(( "compound glyph with %d elements (offset %lu):\n", - count, offset )); + FT_TRACE4(( "compound glyph with %d element%s (offset %lu):\n", + count, + count == 1 ? "" : "s", + offset )); /* now, load each individual glyph */ for ( n = 0; n < count; n++ ) @@ -810,7 +812,9 @@ /* proceed to next sub-glyph */ } - FT_TRACE4(( "end compound glyph with %d elements\n", count )); + FT_TRACE4(( "end compound glyph with %d element%s\n", + count, + count == 1 ? "" : "s" )); } else { diff --git a/src/pfr/pfrgload.h b/src/pfr/pfrgload.h index 661232387..01f48d770 100644 --- a/src/pfr/pfrgload.h +++ b/src/pfr/pfrgload.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR glyph loader (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrload.c b/src/pfr/pfrload.c index 4f8416582..2776da462 100644 --- a/src/pfr/pfrload.c +++ b/src/pfr/pfrload.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR loader (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrload.h b/src/pfr/pfrload.h index f9475ae06..36e809a76 100644 --- a/src/pfr/pfrload.h +++ b/src/pfr/pfrload.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR loader (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrobjs.c b/src/pfr/pfrobjs.c index 4b1703f51..737b97b5f 100644 --- a/src/pfr/pfrobjs.c +++ b/src/pfr/pfrobjs.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR object methods (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -264,12 +264,6 @@ charmap.encoding = FT_ENCODING_UNICODE; error = FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL ); - -#if 0 - /* select default charmap */ - if ( pfrface->num_charmaps ) - pfrface->charmap = pfrface->charmaps[0]; -#endif } /* check whether we have loaded any kerning pairs */ diff --git a/src/pfr/pfrobjs.h b/src/pfr/pfrobjs.h index d6ad6562d..59c709f58 100644 --- a/src/pfr/pfrobjs.h +++ b/src/pfr/pfrobjs.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR object methods (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrsbit.c b/src/pfr/pfrsbit.c index 54e7d0e6c..ba909ddca 100644 --- a/src/pfr/pfrsbit.c +++ b/src/pfr/pfrsbit.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR bitmap loader (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrsbit.h b/src/pfr/pfrsbit.h index fc270f50a..07b27bc06 100644 --- a/src/pfr/pfrsbit.h +++ b/src/pfr/pfrsbit.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR bitmap loader (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/pfrtypes.h b/src/pfr/pfrtypes.h index c3d542c20..058d6aadc 100644 --- a/src/pfr/pfrtypes.h +++ b/src/pfr/pfrtypes.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR data structures (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pfr/rules.mk b/src/pfr/rules.mk index 9940f6228..3acb79569 100644 --- a/src/pfr/rules.mk +++ b/src/pfr/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/psaux/Jamfile b/src/psaux/Jamfile index 798b73d1c..a231d5974 100644 --- a/src/psaux/Jamfile +++ b/src/psaux/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/psaux Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -22,6 +22,16 @@ SubDir FT2_TOP $(FT2_SRC_DIR) psaux ; psobjs t1cmap t1decode + cffdecode + psarrst + psblues + pserror + psfont + psft + pshints + psintrp + psread + psstack ; } else diff --git a/src/psaux/afmparse.c b/src/psaux/afmparse.c index dbe7ddd70..0c33d5949 100644 --- a/src/psaux/afmparse.c +++ b/src/psaux/afmparse.c @@ -4,7 +4,7 @@ /* */ /* AFM parser (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,6 +20,8 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_POSTSCRIPT_AUX_H +#ifndef T1_CONFIG_OPTION_NO_AFM + #include "afmparse.h" #include "psconv.h" @@ -973,5 +975,12 @@ return error; } +#else /* T1_CONFIG_OPTION_NO_AFM */ + + /* ANSI C doesn't like empty source files */ + typedef int _afm_parse_dummy; + +#endif /* T1_CONFIG_OPTION_NO_AFM */ + /* END */ diff --git a/src/psaux/afmparse.h b/src/psaux/afmparse.h index cd2beb780..86f852a24 100644 --- a/src/psaux/afmparse.h +++ b/src/psaux/afmparse.h @@ -4,7 +4,7 @@ /* */ /* AFM parser (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/cffdecode.c b/src/psaux/cffdecode.c new file mode 100644 index 000000000..80d622c0e --- /dev/null +++ b/src/psaux/cffdecode.c @@ -0,0 +1,2370 @@ +/***************************************************************************/ +/* */ +/* cffdecode.c */ +/* */ +/* PostScript CFF (Type 2) decoding routines (body). */ +/* */ +/* Copyright 2017-2018 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include +#include FT_FREETYPE_H +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_SERVICE_H +#include FT_SERVICE_CFF_TABLE_LOAD_H + +#include "cffdecode.h" +#include "psobjs.h" + +#include "psauxerr.h" + + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_cffdecode + + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + + typedef enum CFF_Operator_ + { + cff_op_unknown = 0, + + cff_op_rmoveto, + cff_op_hmoveto, + cff_op_vmoveto, + + cff_op_rlineto, + cff_op_hlineto, + cff_op_vlineto, + + cff_op_rrcurveto, + cff_op_hhcurveto, + cff_op_hvcurveto, + cff_op_rcurveline, + cff_op_rlinecurve, + cff_op_vhcurveto, + cff_op_vvcurveto, + + cff_op_flex, + cff_op_hflex, + cff_op_hflex1, + cff_op_flex1, + + cff_op_endchar, + + cff_op_hstem, + cff_op_vstem, + cff_op_hstemhm, + cff_op_vstemhm, + + cff_op_hintmask, + cff_op_cntrmask, + cff_op_dotsection, /* deprecated, acts as no-op */ + + cff_op_abs, + cff_op_add, + cff_op_sub, + cff_op_div, + cff_op_neg, + cff_op_random, + cff_op_mul, + cff_op_sqrt, + + cff_op_blend, + + cff_op_drop, + cff_op_exch, + cff_op_index, + cff_op_roll, + cff_op_dup, + + cff_op_put, + cff_op_get, + cff_op_store, + cff_op_load, + + cff_op_and, + cff_op_or, + cff_op_not, + cff_op_eq, + cff_op_ifelse, + + cff_op_callsubr, + cff_op_callgsubr, + cff_op_return, + + /* Type 1 opcodes: invalid but seen in real life */ + cff_op_hsbw, + cff_op_closepath, + cff_op_callothersubr, + cff_op_pop, + cff_op_seac, + cff_op_sbw, + cff_op_setcurrentpoint, + + /* do not remove */ + cff_op_max + + } CFF_Operator; + + +#define CFF_COUNT_CHECK_WIDTH 0x80 +#define CFF_COUNT_EXACT 0x40 +#define CFF_COUNT_CLEAR_STACK 0x20 + + /* count values which have the `CFF_COUNT_CHECK_WIDTH' flag set are */ + /* used for checking the width and requested numbers of arguments */ + /* only; they are set to zero afterwards */ + + /* the other two flags are informative only and unused currently */ + + static const FT_Byte cff_argument_counts[] = + { + 0, /* unknown */ + + 2 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, /* rmoveto */ + 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, + 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, + + 0 | CFF_COUNT_CLEAR_STACK, /* rlineto */ + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + + 0 | CFF_COUNT_CLEAR_STACK, /* rrcurveto */ + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + 0 | CFF_COUNT_CLEAR_STACK, + + 13, /* flex */ + 7, + 9, + 11, + + 0 | CFF_COUNT_CHECK_WIDTH, /* endchar */ + + 2 | CFF_COUNT_CHECK_WIDTH, /* hstem */ + 2 | CFF_COUNT_CHECK_WIDTH, + 2 | CFF_COUNT_CHECK_WIDTH, + 2 | CFF_COUNT_CHECK_WIDTH, + + 0 | CFF_COUNT_CHECK_WIDTH, /* hintmask */ + 0 | CFF_COUNT_CHECK_WIDTH, /* cntrmask */ + 0, /* dotsection */ + + 1, /* abs */ + 2, + 2, + 2, + 1, + 0, + 2, + 1, + + 1, /* blend */ + + 1, /* drop */ + 2, + 1, + 2, + 1, + + 2, /* put */ + 1, + 4, + 3, + + 2, /* and */ + 2, + 1, + 2, + 4, + + 1, /* callsubr */ + 1, + 0, + + 2, /* hsbw */ + 0, + 0, + 0, + 5, /* seac */ + 4, /* sbw */ + 2 /* setcurrentpoint */ + }; + + + static FT_Error + cff_operator_seac( CFF_Decoder* decoder, + FT_Pos asb, + FT_Pos adx, + FT_Pos ady, + FT_Int bchar, + FT_Int achar ) + { + FT_Error error; + CFF_Builder* builder = &decoder->builder; + FT_Int bchar_index, achar_index; + TT_Face face = decoder->builder.face; + FT_Vector left_bearing, advance; + FT_Byte* charstring; + FT_ULong charstring_len; + FT_Pos glyph_width; + + + if ( decoder->seac ) + { + FT_ERROR(( "cff_operator_seac: invalid nested seac\n" )); + return FT_THROW( Syntax_Error ); + } + + adx += decoder->builder.left_bearing.x; + ady += decoder->builder.left_bearing.y; + +#ifdef FT_CONFIG_OPTION_INCREMENTAL + /* Incremental fonts don't necessarily have valid charsets. */ + /* They use the character code, not the glyph index, in this case. */ + if ( face->root.internal->incremental_interface ) + { + bchar_index = bchar; + achar_index = achar; + } + else +#endif /* FT_CONFIG_OPTION_INCREMENTAL */ + { + CFF_Font cff = (CFF_Font)(face->extra.data); + + + bchar_index = cff_lookup_glyph_by_stdcharcode( cff, bchar ); + achar_index = cff_lookup_glyph_by_stdcharcode( cff, achar ); + } + + if ( bchar_index < 0 || achar_index < 0 ) + { + FT_ERROR(( "cff_operator_seac:" + " invalid seac character code arguments\n" )); + return FT_THROW( Syntax_Error ); + } + + /* If we are trying to load a composite glyph, do not load the */ + /* accent character and return the array of subglyphs. */ + if ( builder->no_recurse ) + { + FT_GlyphSlot glyph = (FT_GlyphSlot)builder->glyph; + FT_GlyphLoader loader = glyph->internal->loader; + FT_SubGlyph subg; + + + /* reallocate subglyph array if necessary */ + error = FT_GlyphLoader_CheckSubGlyphs( loader, 2 ); + if ( error ) + goto Exit; + + subg = loader->current.subglyphs; + + /* subglyph 0 = base character */ + subg->index = bchar_index; + subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES | + FT_SUBGLYPH_FLAG_USE_MY_METRICS; + subg->arg1 = 0; + subg->arg2 = 0; + subg++; + + /* subglyph 1 = accent character */ + subg->index = achar_index; + subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES; + subg->arg1 = (FT_Int)( adx >> 16 ); + subg->arg2 = (FT_Int)( ady >> 16 ); + + /* set up remaining glyph fields */ + glyph->num_subglyphs = 2; + glyph->subglyphs = loader->base.subglyphs; + glyph->format = FT_GLYPH_FORMAT_COMPOSITE; + + loader->current.num_subglyphs = 2; + } + + FT_GlyphLoader_Prepare( builder->loader ); + + /* First load `bchar' in builder */ + error = decoder->get_glyph_callback( face, (FT_UInt)bchar_index, + &charstring, &charstring_len ); + if ( !error ) + { + /* the seac operator must not be nested */ + decoder->seac = TRUE; + error = cff_decoder_parse_charstrings( decoder, charstring, + charstring_len, 0 ); + decoder->seac = FALSE; + + decoder->free_glyph_callback( face, &charstring, charstring_len ); + + if ( error ) + goto Exit; + } + + /* Save the left bearing, advance and glyph width of the base */ + /* character as they will be erased by the next load. */ + + left_bearing = builder->left_bearing; + advance = builder->advance; + glyph_width = decoder->glyph_width; + + builder->left_bearing.x = 0; + builder->left_bearing.y = 0; + + builder->pos_x = adx - asb; + builder->pos_y = ady; + + /* Now load `achar' on top of the base outline. */ + error = decoder->get_glyph_callback( face, (FT_UInt)achar_index, + &charstring, &charstring_len ); + if ( !error ) + { + /* the seac operator must not be nested */ + decoder->seac = TRUE; + error = cff_decoder_parse_charstrings( decoder, charstring, + charstring_len, 0 ); + decoder->seac = FALSE; + + decoder->free_glyph_callback( face, &charstring, charstring_len ); + + if ( error ) + goto Exit; + } + + /* Restore the left side bearing, advance and glyph width */ + /* of the base character. */ + builder->left_bearing = left_bearing; + builder->advance = advance; + decoder->glyph_width = glyph_width; + + builder->pos_x = 0; + builder->pos_y = 0; + + Exit: + return error; + } + +#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /********** *********/ + /********** *********/ + /********** GENERIC CHARSTRING PARSING *********/ + /********** *********/ + /********** *********/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* */ + /* cff_compute_bias */ + /* */ + /* */ + /* Computes the bias value in dependence of the number of glyph */ + /* subroutines. */ + /* */ + /* */ + /* in_charstring_type :: The `CharstringType' value of the top DICT */ + /* dictionary. */ + /* */ + /* num_subrs :: The number of glyph subroutines. */ + /* */ + /* */ + /* The bias value. */ + static FT_Int + cff_compute_bias( FT_Int in_charstring_type, + FT_UInt num_subrs ) + { + FT_Int result; + + + if ( in_charstring_type == 1 ) + result = 0; + else if ( num_subrs < 1240 ) + result = 107; + else if ( num_subrs < 33900U ) + result = 1131; + else + result = 32768U; + + return result; + } + + + FT_LOCAL_DEF( FT_Int ) + cff_lookup_glyph_by_stdcharcode( CFF_Font cff, + FT_Int charcode ) + { + FT_UInt n; + FT_UShort glyph_sid; + + FT_Service_CFFLoad cffload; + + + /* CID-keyed fonts don't have glyph names */ + if ( !cff->charset.sids ) + return -1; + + /* check range of standard char code */ + if ( charcode < 0 || charcode > 255 ) + return -1; + +#if 0 + /* retrieve cffload from list of current modules */ + FT_Service_CFFLoad cffload; + + + FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD ); + if ( !cffload ) + { + FT_ERROR(( "cff_lookup_glyph_by_stdcharcode:" + " the `cffload' module is not available\n" )); + return FT_THROW( Unimplemented_Feature ); + } +#endif + + cffload = (FT_Service_CFFLoad)cff->cffload; + + /* Get code to SID mapping from `cff_standard_encoding'. */ + glyph_sid = cffload->get_standard_encoding( (FT_UInt)charcode ); + + for ( n = 0; n < cff->num_glyphs; n++ ) + { + if ( cff->charset.sids[n] == glyph_sid ) + return (FT_Int)n; + } + + return -1; + } + + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + + /*************************************************************************/ + /* */ + /* */ + /* cff_decoder_parse_charstrings */ + /* */ + /* */ + /* Parses a given Type 2 charstrings program. */ + /* */ + /* */ + /* decoder :: The current Type 1 decoder. */ + /* */ + /* */ + /* charstring_base :: The base of the charstring stream. */ + /* */ + /* charstring_len :: The length in bytes of the charstring stream. */ + /* */ + /* in_dict :: Set to 1 if function is called from top or */ + /* private DICT (needed for Multiple Master CFFs). */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + cff_decoder_parse_charstrings( CFF_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len, + FT_Bool in_dict ) + { + FT_Error error; + CFF_Decoder_Zone* zone; + FT_Byte* ip; + FT_Byte* limit; + CFF_Builder* builder = &decoder->builder; + FT_Pos x, y; + FT_Fixed* stack; + FT_Int charstring_type = + decoder->cff->top_font.font_dict.charstring_type; + FT_UShort num_designs = + decoder->cff->top_font.font_dict.num_designs; + FT_UShort num_axes = + decoder->cff->top_font.font_dict.num_axes; + + T2_Hints_Funcs hinter; + + + /* set default width */ + decoder->num_hints = 0; + decoder->read_width = 1; + + /* initialize the decoder */ + decoder->top = decoder->stack; + decoder->zone = decoder->zones; + zone = decoder->zones; + stack = decoder->top; + + hinter = (T2_Hints_Funcs)builder->hints_funcs; + + builder->path_begun = 0; + + zone->base = charstring_base; + limit = zone->limit = charstring_base + charstring_len; + ip = zone->cursor = zone->base; + + error = FT_Err_Ok; + + x = builder->pos_x; + y = builder->pos_y; + + /* begin hints recording session, if any */ + if ( hinter ) + hinter->open( hinter->hints ); + + /* now execute loop */ + while ( ip < limit ) + { + CFF_Operator op; + FT_Byte v; + + + /********************************************************************/ + /* */ + /* Decode operator or operand */ + /* */ + v = *ip++; + if ( v >= 32 || v == 28 ) + { + FT_Int shift = 16; + FT_Int32 val; + + + /* this is an operand, push it on the stack */ + + /* if we use shifts, all computations are done with unsigned */ + /* values; the conversion to a signed value is the last step */ + if ( v == 28 ) + { + if ( ip + 1 >= limit ) + goto Syntax_Error; + val = (FT_Short)( ( (FT_UShort)ip[0] << 8 ) | ip[1] ); + ip += 2; + } + else if ( v < 247 ) + val = (FT_Int32)v - 139; + else if ( v < 251 ) + { + if ( ip >= limit ) + goto Syntax_Error; + val = ( (FT_Int32)v - 247 ) * 256 + *ip++ + 108; + } + else if ( v < 255 ) + { + if ( ip >= limit ) + goto Syntax_Error; + val = -( (FT_Int32)v - 251 ) * 256 - *ip++ - 108; + } + else + { + if ( ip + 3 >= limit ) + goto Syntax_Error; + val = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) | + ( (FT_UInt32)ip[1] << 16 ) | + ( (FT_UInt32)ip[2] << 8 ) | + (FT_UInt32)ip[3] ); + ip += 4; + if ( charstring_type == 2 ) + shift = 0; + } + if ( decoder->top - stack >= CFF_MAX_OPERANDS ) + goto Stack_Overflow; + + val = (FT_Int32)( (FT_UInt32)val << shift ); + *decoder->top++ = val; + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( !( val & 0xFFFFL ) ) + FT_TRACE4(( " %hd", (FT_Short)( (FT_UInt32)val >> 16 ) )); + else + FT_TRACE4(( " %.5f", val / 65536.0 )); +#endif + + } + else + { + /* The specification says that normally arguments are to be taken */ + /* from the bottom of the stack. However, this seems not to be */ + /* correct, at least for Acroread 7.0.8 on GNU/Linux: It pops the */ + /* arguments similar to a PS interpreter. */ + + FT_Fixed* args = decoder->top; + FT_Int num_args = (FT_Int)( args - decoder->stack ); + FT_Int req_args; + + + /* find operator */ + op = cff_op_unknown; + + switch ( v ) + { + case 1: + op = cff_op_hstem; + break; + case 3: + op = cff_op_vstem; + break; + case 4: + op = cff_op_vmoveto; + break; + case 5: + op = cff_op_rlineto; + break; + case 6: + op = cff_op_hlineto; + break; + case 7: + op = cff_op_vlineto; + break; + case 8: + op = cff_op_rrcurveto; + break; + case 9: + op = cff_op_closepath; + break; + case 10: + op = cff_op_callsubr; + break; + case 11: + op = cff_op_return; + break; + case 12: + if ( ip >= limit ) + goto Syntax_Error; + v = *ip++; + + switch ( v ) + { + case 0: + op = cff_op_dotsection; + break; + case 1: /* this is actually the Type1 vstem3 operator */ + op = cff_op_vstem; + break; + case 2: /* this is actually the Type1 hstem3 operator */ + op = cff_op_hstem; + break; + case 3: + op = cff_op_and; + break; + case 4: + op = cff_op_or; + break; + case 5: + op = cff_op_not; + break; + case 6: + op = cff_op_seac; + break; + case 7: + op = cff_op_sbw; + break; + case 8: + op = cff_op_store; + break; + case 9: + op = cff_op_abs; + break; + case 10: + op = cff_op_add; + break; + case 11: + op = cff_op_sub; + break; + case 12: + op = cff_op_div; + break; + case 13: + op = cff_op_load; + break; + case 14: + op = cff_op_neg; + break; + case 15: + op = cff_op_eq; + break; + case 16: + op = cff_op_callothersubr; + break; + case 17: + op = cff_op_pop; + break; + case 18: + op = cff_op_drop; + break; + case 20: + op = cff_op_put; + break; + case 21: + op = cff_op_get; + break; + case 22: + op = cff_op_ifelse; + break; + case 23: + op = cff_op_random; + break; + case 24: + op = cff_op_mul; + break; + case 26: + op = cff_op_sqrt; + break; + case 27: + op = cff_op_dup; + break; + case 28: + op = cff_op_exch; + break; + case 29: + op = cff_op_index; + break; + case 30: + op = cff_op_roll; + break; + case 33: + op = cff_op_setcurrentpoint; + break; + case 34: + op = cff_op_hflex; + break; + case 35: + op = cff_op_flex; + break; + case 36: + op = cff_op_hflex1; + break; + case 37: + op = cff_op_flex1; + break; + default: + FT_TRACE4(( " unknown op (12, %d)\n", v )); + break; + } + break; + case 13: + op = cff_op_hsbw; + break; + case 14: + op = cff_op_endchar; + break; + case 16: + op = cff_op_blend; + break; + case 18: + op = cff_op_hstemhm; + break; + case 19: + op = cff_op_hintmask; + break; + case 20: + op = cff_op_cntrmask; + break; + case 21: + op = cff_op_rmoveto; + break; + case 22: + op = cff_op_hmoveto; + break; + case 23: + op = cff_op_vstemhm; + break; + case 24: + op = cff_op_rcurveline; + break; + case 25: + op = cff_op_rlinecurve; + break; + case 26: + op = cff_op_vvcurveto; + break; + case 27: + op = cff_op_hhcurveto; + break; + case 29: + op = cff_op_callgsubr; + break; + case 30: + op = cff_op_vhcurveto; + break; + case 31: + op = cff_op_hvcurveto; + break; + default: + FT_TRACE4(( " unknown op (%d)\n", v )); + break; + } + + if ( op == cff_op_unknown ) + continue; + + /* in Multiple Master CFFs, T2 charstrings can appear in */ + /* dictionaries, but some operators are prohibited */ + if ( in_dict ) + { + switch ( op ) + { + case cff_op_hstem: + case cff_op_vstem: + case cff_op_vmoveto: + case cff_op_rlineto: + case cff_op_hlineto: + case cff_op_vlineto: + case cff_op_rrcurveto: + case cff_op_hstemhm: + case cff_op_hintmask: + case cff_op_cntrmask: + case cff_op_rmoveto: + case cff_op_hmoveto: + case cff_op_vstemhm: + case cff_op_rcurveline: + case cff_op_rlinecurve: + case cff_op_vvcurveto: + case cff_op_hhcurveto: + case cff_op_vhcurveto: + case cff_op_hvcurveto: + case cff_op_hflex: + case cff_op_flex: + case cff_op_hflex1: + case cff_op_flex1: + case cff_op_callsubr: + case cff_op_callgsubr: + goto MM_Error; + + default: + break; + } + } + + /* check arguments */ + req_args = cff_argument_counts[op]; + if ( req_args & CFF_COUNT_CHECK_WIDTH ) + { + if ( num_args > 0 && decoder->read_width ) + { + /* If `nominal_width' is non-zero, the number is really a */ + /* difference against `nominal_width'. Else, the number here */ + /* is truly a width, not a difference against `nominal_width'. */ + /* If the font does not set `nominal_width', then */ + /* `nominal_width' defaults to zero, and so we can set */ + /* `glyph_width' to `nominal_width' plus number on the stack */ + /* -- for either case. */ + + FT_Int set_width_ok; + + + switch ( op ) + { + case cff_op_hmoveto: + case cff_op_vmoveto: + set_width_ok = num_args & 2; + break; + + case cff_op_hstem: + case cff_op_vstem: + case cff_op_hstemhm: + case cff_op_vstemhm: + case cff_op_rmoveto: + case cff_op_hintmask: + case cff_op_cntrmask: + set_width_ok = num_args & 1; + break; + + case cff_op_endchar: + /* If there is a width specified for endchar, we either have */ + /* 1 argument or 5 arguments. We like to argue. */ + set_width_ok = in_dict + ? 0 + : ( ( num_args == 5 ) || ( num_args == 1 ) ); + break; + + default: + set_width_ok = 0; + break; + } + + if ( set_width_ok ) + { + decoder->glyph_width = decoder->nominal_width + + ( stack[0] >> 16 ); + + if ( decoder->width_only ) + { + /* we only want the advance width; stop here */ + break; + } + + /* Consumed an argument. */ + num_args--; + } + } + + decoder->read_width = 0; + req_args = 0; + } + + req_args &= 0x000F; + if ( num_args < req_args ) + goto Stack_Underflow; + args -= req_args; + num_args -= req_args; + + /* At this point, `args' points to the first argument of the */ + /* operand in case `req_args' isn't zero. Otherwise, we have */ + /* to adjust `args' manually. */ + + /* Note that we only pop arguments from the stack which we */ + /* really need and can digest so that we can continue in case */ + /* of superfluous stack elements. */ + + switch ( op ) + { + case cff_op_hstem: + case cff_op_vstem: + case cff_op_hstemhm: + case cff_op_vstemhm: + /* the number of arguments is always even here */ + FT_TRACE4(( + op == cff_op_hstem ? " hstem\n" : + ( op == cff_op_vstem ? " vstem\n" : + ( op == cff_op_hstemhm ? " hstemhm\n" : " vstemhm\n" ) ) )); + + if ( hinter ) + hinter->stems( hinter->hints, + ( op == cff_op_hstem || op == cff_op_hstemhm ), + num_args / 2, + args - ( num_args & ~1 ) ); + + decoder->num_hints += num_args / 2; + args = stack; + break; + + case cff_op_hintmask: + case cff_op_cntrmask: + FT_TRACE4(( op == cff_op_hintmask ? " hintmask" : " cntrmask" )); + + /* implement vstem when needed -- */ + /* the specification doesn't say it, but this also works */ + /* with the 'cntrmask' operator */ + /* */ + if ( num_args > 0 ) + { + if ( hinter ) + hinter->stems( hinter->hints, + 0, + num_args / 2, + args - ( num_args & ~1 ) ); + + decoder->num_hints += num_args / 2; + } + + /* In a valid charstring there must be at least one byte */ + /* after `hintmask' or `cntrmask' (e.g., for a `return' */ + /* instruction). Additionally, there must be space for */ + /* `num_hints' bits. */ + + if ( ( ip + ( ( decoder->num_hints + 7 ) >> 3 ) ) >= limit ) + goto Syntax_Error; + + if ( hinter ) + { + if ( op == cff_op_hintmask ) + hinter->hintmask( hinter->hints, + (FT_UInt)builder->current->n_points, + (FT_UInt)decoder->num_hints, + ip ); + else + hinter->counter( hinter->hints, + (FT_UInt)decoder->num_hints, + ip ); + } + +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_UInt maskbyte; + + + FT_TRACE4(( " (maskbytes:" )); + + for ( maskbyte = 0; + maskbyte < (FT_UInt)( ( decoder->num_hints + 7 ) >> 3 ); + maskbyte++, ip++ ) + FT_TRACE4(( " 0x%02X", *ip )); + + FT_TRACE4(( ")\n" )); + } +#else + ip += ( decoder->num_hints + 7 ) >> 3; +#endif + args = stack; + break; + + case cff_op_rmoveto: + FT_TRACE4(( " rmoveto\n" )); + + cff_builder_close_contour( builder ); + builder->path_begun = 0; + x = ADD_LONG( x, args[-2] ); + y = ADD_LONG( y, args[-1] ); + args = stack; + break; + + case cff_op_vmoveto: + FT_TRACE4(( " vmoveto\n" )); + + cff_builder_close_contour( builder ); + builder->path_begun = 0; + y = ADD_LONG( y, args[-1] ); + args = stack; + break; + + case cff_op_hmoveto: + FT_TRACE4(( " hmoveto\n" )); + + cff_builder_close_contour( builder ); + builder->path_begun = 0; + x = ADD_LONG( x, args[-1] ); + args = stack; + break; + + case cff_op_rlineto: + FT_TRACE4(( " rlineto\n" )); + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, num_args / 2 ) ) + goto Fail; + + if ( num_args < 2 ) + goto Stack_Underflow; + + args -= num_args & ~1; + while ( args < decoder->top ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 1 ); + args += 2; + } + args = stack; + break; + + case cff_op_hlineto: + case cff_op_vlineto: + { + FT_Int phase = ( op == cff_op_hlineto ); + + + FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n" + : " vlineto\n" )); + + if ( num_args < 0 ) + goto Stack_Underflow; + + /* there exist subsetted fonts (found in PDFs) */ + /* which call `hlineto' without arguments */ + if ( num_args == 0 ) + break; + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, num_args ) ) + goto Fail; + + args = stack; + while ( args < decoder->top ) + { + if ( phase ) + x = ADD_LONG( x, args[0] ); + else + y = ADD_LONG( y, args[0] ); + + if ( cff_builder_add_point1( builder, x, y ) ) + goto Fail; + + args++; + phase ^= 1; + } + args = stack; + } + break; + + case cff_op_rrcurveto: + { + FT_Int nargs; + + + FT_TRACE4(( " rrcurveto\n" )); + + if ( num_args < 6 ) + goto Stack_Underflow; + + nargs = num_args - num_args % 6; + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, nargs / 2 ) ) + goto Fail; + + args -= nargs; + while ( args < decoder->top ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[4] ); + y = ADD_LONG( y, args[5] ); + cff_builder_add_point( builder, x, y, 1 ); + + args += 6; + } + args = stack; + } + break; + + case cff_op_vvcurveto: + { + FT_Int nargs; + + + FT_TRACE4(( " vvcurveto\n" )); + + if ( num_args < 4 ) + goto Stack_Underflow; + + /* if num_args isn't of the form 4n or 4n+1, */ + /* we enforce it by clearing the second bit */ + + nargs = num_args & ~2; + + if ( cff_builder_start_point( builder, x, y ) ) + goto Fail; + + args -= nargs; + + if ( nargs & 1 ) + { + x = ADD_LONG( x, args[0] ); + args++; + nargs--; + } + + if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) ) + goto Fail; + + while ( args < decoder->top ) + { + y = ADD_LONG( y, args[0] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); + cff_builder_add_point( builder, x, y, 0 ); + + y = ADD_LONG( y, args[3] ); + cff_builder_add_point( builder, x, y, 1 ); + + args += 4; + } + args = stack; + } + break; + + case cff_op_hhcurveto: + { + FT_Int nargs; + + + FT_TRACE4(( " hhcurveto\n" )); + + if ( num_args < 4 ) + goto Stack_Underflow; + + /* if num_args isn't of the form 4n or 4n+1, */ + /* we enforce it by clearing the second bit */ + + nargs = num_args & ~2; + + if ( cff_builder_start_point( builder, x, y ) ) + goto Fail; + + args -= nargs; + if ( nargs & 1 ) + { + y = ADD_LONG( y, args[0] ); + args++; + nargs--; + } + + if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) ) + goto Fail; + + while ( args < decoder->top ) + { + x = ADD_LONG( x, args[0] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[3] ); + cff_builder_add_point( builder, x, y, 1 ); + + args += 4; + } + args = stack; + } + break; + + case cff_op_vhcurveto: + case cff_op_hvcurveto: + { + FT_Int phase; + FT_Int nargs; + + + FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto\n" + : " hvcurveto\n" )); + + if ( cff_builder_start_point( builder, x, y ) ) + goto Fail; + + if ( num_args < 4 ) + goto Stack_Underflow; + + /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */ + /* we enforce it by clearing the second bit */ + + nargs = num_args & ~2; + + args -= nargs; + if ( cff_check_points( builder, ( nargs / 4 ) * 3 ) ) + goto Stack_Underflow; + + phase = ( op == cff_op_hvcurveto ); + + while ( nargs >= 4 ) + { + nargs -= 4; + if ( phase ) + { + x = ADD_LONG( x, args[0] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); + cff_builder_add_point( builder, x, y, 0 ); + + y = ADD_LONG( y, args[3] ); + if ( nargs == 1 ) + x = ADD_LONG( x, args[4] ); + cff_builder_add_point( builder, x, y, 1 ); + } + else + { + y = ADD_LONG( y, args[0] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[3] ); + if ( nargs == 1 ) + y = ADD_LONG( y, args[4] ); + cff_builder_add_point( builder, x, y, 1 ); + } + args += 4; + phase ^= 1; + } + args = stack; + } + break; + + case cff_op_rlinecurve: + { + FT_Int num_lines; + FT_Int nargs; + + + FT_TRACE4(( " rlinecurve\n" )); + + if ( num_args < 8 ) + goto Stack_Underflow; + + nargs = num_args & ~1; + num_lines = ( nargs - 6 ) / 2; + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, num_lines + 3 ) ) + goto Fail; + + args -= nargs; + + /* first, add the line segments */ + while ( num_lines > 0 ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 1 ); + + args += 2; + num_lines--; + } + + /* then the curve */ + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[4] ); + y = ADD_LONG( y, args[5] ); + cff_builder_add_point( builder, x, y, 1 ); + + args = stack; + } + break; + + case cff_op_rcurveline: + { + FT_Int num_curves; + FT_Int nargs; + + + FT_TRACE4(( " rcurveline\n" )); + + if ( num_args < 8 ) + goto Stack_Underflow; + + nargs = num_args - 2; + nargs = nargs - nargs % 6 + 2; + num_curves = ( nargs - 2 ) / 6; + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, num_curves * 3 + 2 ) ) + goto Fail; + + args -= nargs; + + /* first, add the curves */ + while ( num_curves > 0 ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); + cff_builder_add_point( builder, x, y, 0 ); + + x = ADD_LONG( x, args[4] ); + y = ADD_LONG( y, args[5] ); + cff_builder_add_point( builder, x, y, 1 ); + + args += 6; + num_curves--; + } + + /* then the final line */ + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 1 ); + + args = stack; + } + break; + + case cff_op_hflex1: + { + FT_Pos start_y; + + + FT_TRACE4(( " hflex1\n" )); + + /* adding five more points: 4 control points, 1 on-curve point */ + /* -- make sure we have enough space for the start point if it */ + /* needs to be added */ + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, 6 ) ) + goto Fail; + + /* record the starting point's y position for later use */ + start_y = y; + + /* first control point */ + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* second control point */ + x = ADD_LONG( x, args[2] ); + y = ADD_LONG( y, args[3] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* join point; on curve, with y-value the same as the last */ + /* control point's y-value */ + x = ADD_LONG( x, args[4] ); + cff_builder_add_point( builder, x, y, 1 ); + + /* third control point, with y-value the same as the join */ + /* point's y-value */ + x = ADD_LONG( x, args[5] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* fourth control point */ + x = ADD_LONG( x, args[6] ); + y = ADD_LONG( y, args[7] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* ending point, with y-value the same as the start */ + x = ADD_LONG( x, args[8] ); + y = start_y; + cff_builder_add_point( builder, x, y, 1 ); + + args = stack; + break; + } + + case cff_op_hflex: + { + FT_Pos start_y; + + + FT_TRACE4(( " hflex\n" )); + + /* adding six more points; 4 control points, 2 on-curve points */ + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, 6 ) ) + goto Fail; + + /* record the starting point's y-position for later use */ + start_y = y; + + /* first control point */ + x = ADD_LONG( x, args[0] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* second control point */ + x = ADD_LONG( x, args[1] ); + y = ADD_LONG( y, args[2] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* join point; on curve, with y-value the same as the last */ + /* control point's y-value */ + x = ADD_LONG( x, args[3] ); + cff_builder_add_point( builder, x, y, 1 ); + + /* third control point, with y-value the same as the join */ + /* point's y-value */ + x = ADD_LONG( x, args[4] ); + cff_builder_add_point( builder, x, y, 0 ); + + /* fourth control point */ + x = ADD_LONG( x, args[5] ); + y = start_y; + cff_builder_add_point( builder, x, y, 0 ); + + /* ending point, with y-value the same as the start point's */ + /* y-value -- we don't add this point, though */ + x = ADD_LONG( x, args[6] ); + cff_builder_add_point( builder, x, y, 1 ); + + args = stack; + break; + } + + case cff_op_flex1: + { + FT_Pos start_x, start_y; /* record start x, y values for */ + /* alter use */ + FT_Fixed dx = 0, dy = 0; /* used in horizontal/vertical */ + /* algorithm below */ + FT_Int horizontal, count; + FT_Fixed* temp; + + + FT_TRACE4(( " flex1\n" )); + + /* adding six more points; 4 control points, 2 on-curve points */ + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, 6 ) ) + goto Fail; + + /* record the starting point's x, y position for later use */ + start_x = x; + start_y = y; + + /* XXX: figure out whether this is supposed to be a horizontal */ + /* or vertical flex; the Type 2 specification is vague... */ + + temp = args; + + /* grab up to the last argument */ + for ( count = 5; count > 0; count-- ) + { + dx = ADD_LONG( dx, temp[0] ); + dy = ADD_LONG( dy, temp[1] ); + temp += 2; + } + + if ( dx < 0 ) + dx = -dx; + if ( dy < 0 ) + dy = -dy; + + /* strange test, but here it is... */ + horizontal = ( dx > dy ); + + for ( count = 5; count > 0; count-- ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, + (FT_Bool)( count == 3 ) ); + args += 2; + } + + /* is last operand an x- or y-delta? */ + if ( horizontal ) + { + x = ADD_LONG( x, args[0] ); + y = start_y; + } + else + { + x = start_x; + y = ADD_LONG( y, args[0] ); + } + + cff_builder_add_point( builder, x, y, 1 ); + + args = stack; + break; + } + + case cff_op_flex: + { + FT_UInt count; + + + FT_TRACE4(( " flex\n" )); + + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, 6 ) ) + goto Fail; + + for ( count = 6; count > 0; count-- ) + { + x = ADD_LONG( x, args[0] ); + y = ADD_LONG( y, args[1] ); + cff_builder_add_point( builder, x, y, + (FT_Bool)( count == 4 || count == 1 ) ); + args += 2; + } + + args = stack; + } + break; + + case cff_op_seac: + FT_TRACE4(( " seac\n" )); + + error = cff_operator_seac( decoder, + args[0], args[1], args[2], + (FT_Int)( args[3] >> 16 ), + (FT_Int)( args[4] >> 16 ) ); + + /* add current outline to the glyph slot */ + FT_GlyphLoader_Add( builder->loader ); + + /* return now! */ + FT_TRACE4(( "\n" )); + return error; + + case cff_op_endchar: + /* in dictionaries, `endchar' simply indicates end of data */ + if ( in_dict ) + return error; + + FT_TRACE4(( " endchar\n" )); + + /* We are going to emulate the seac operator. */ + if ( num_args >= 4 ) + { + /* Save glyph width so that the subglyphs don't overwrite it. */ + FT_Pos glyph_width = decoder->glyph_width; + + + error = cff_operator_seac( decoder, + 0L, args[-4], args[-3], + (FT_Int)( args[-2] >> 16 ), + (FT_Int)( args[-1] >> 16 ) ); + + decoder->glyph_width = glyph_width; + } + else + { + cff_builder_close_contour( builder ); + + /* close hints recording session */ + if ( hinter ) + { + if ( hinter->close( hinter->hints, + (FT_UInt)builder->current->n_points ) ) + goto Syntax_Error; + + /* apply hints to the loaded glyph outline now */ + error = hinter->apply( hinter->hints, + builder->current, + (PSH_Globals)builder->hints_globals, + decoder->hint_mode ); + if ( error ) + goto Fail; + } + + /* add current outline to the glyph slot */ + FT_GlyphLoader_Add( builder->loader ); + } + + /* return now! */ + FT_TRACE4(( "\n" )); + return error; + + case cff_op_abs: + FT_TRACE4(( " abs\n" )); + + if ( args[0] < 0 ) + { + if ( args[0] == FT_LONG_MIN ) + args[0] = FT_LONG_MAX; + else + args[0] = -args[0]; + } + args++; + break; + + case cff_op_add: + FT_TRACE4(( " add\n" )); + + args[0] = ADD_LONG( args[0], args[1] ); + args++; + break; + + case cff_op_sub: + FT_TRACE4(( " sub\n" )); + + args[0] = SUB_LONG( args[0], args[1] ); + args++; + break; + + case cff_op_div: + FT_TRACE4(( " div\n" )); + + args[0] = FT_DivFix( args[0], args[1] ); + args++; + break; + + case cff_op_neg: + FT_TRACE4(( " neg\n" )); + + if ( args[0] == FT_LONG_MIN ) + args[0] = FT_LONG_MAX; + args[0] = -args[0]; + args++; + break; + + case cff_op_random: + FT_TRACE4(( " random\n" )); + + /* only use the lower 16 bits of `random' */ + /* to generate a number in the range (0;1] */ + args[0] = (FT_Fixed) + ( ( decoder->current_subfont->random & 0xFFFF ) + 1 ); + args++; + + decoder->current_subfont->random = + cff_random( decoder->current_subfont->random ); + break; + + case cff_op_mul: + FT_TRACE4(( " mul\n" )); + + args[0] = FT_MulFix( args[0], args[1] ); + args++; + break; + + case cff_op_sqrt: + FT_TRACE4(( " sqrt\n" )); + + if ( args[0] > 0 ) + { + FT_Fixed root = args[0]; + FT_Fixed new_root; + + + for (;;) + { + new_root = ( root + FT_DivFix( args[0], root ) + 1 ) >> 1; + if ( new_root == root ) + break; + root = new_root; + } + args[0] = new_root; + } + else + args[0] = 0; + args++; + break; + + case cff_op_drop: + /* nothing */ + FT_TRACE4(( " drop\n" )); + + break; + + case cff_op_exch: + { + FT_Fixed tmp; + + + FT_TRACE4(( " exch\n" )); + + tmp = args[0]; + args[0] = args[1]; + args[1] = tmp; + args += 2; + } + break; + + case cff_op_index: + { + FT_Int idx = (FT_Int)( args[0] >> 16 ); + + + FT_TRACE4(( " index\n" )); + + if ( idx < 0 ) + idx = 0; + else if ( idx > num_args - 2 ) + idx = num_args - 2; + args[0] = args[-( idx + 1 )]; + args++; + } + break; + + case cff_op_roll: + { + FT_Int count = (FT_Int)( args[0] >> 16 ); + FT_Int idx = (FT_Int)( args[1] >> 16 ); + + + FT_TRACE4(( " roll\n" )); + + if ( count <= 0 ) + count = 1; + + args -= count; + if ( args < stack ) + goto Stack_Underflow; + + if ( idx >= 0 ) + { + while ( idx > 0 ) + { + FT_Fixed tmp = args[count - 1]; + FT_Int i; + + + for ( i = count - 2; i >= 0; i-- ) + args[i + 1] = args[i]; + args[0] = tmp; + idx--; + } + } + else + { + while ( idx < 0 ) + { + FT_Fixed tmp = args[0]; + FT_Int i; + + + for ( i = 0; i < count - 1; i++ ) + args[i] = args[i + 1]; + args[count - 1] = tmp; + idx++; + } + } + args += count; + } + break; + + case cff_op_dup: + FT_TRACE4(( " dup\n" )); + + args[1] = args[0]; + args += 2; + break; + + case cff_op_put: + { + FT_Fixed val = args[0]; + FT_Int idx = (FT_Int)( args[1] >> 16 ); + + + FT_TRACE4(( " put\n" )); + + /* the Type2 specification before version 16-March-2000 */ + /* didn't give a hard-coded size limit of the temporary */ + /* storage array; instead, an argument of the */ + /* `MultipleMaster' operator set the size */ + if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS ) + decoder->buildchar[idx] = val; + } + break; + + case cff_op_get: + { + FT_Int idx = (FT_Int)( args[0] >> 16 ); + FT_Fixed val = 0; + + + FT_TRACE4(( " get\n" )); + + if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS ) + val = decoder->buildchar[idx]; + + args[0] = val; + args++; + } + break; + + case cff_op_store: + /* this operator was removed from the Type2 specification */ + /* in version 16-March-2000 */ + + /* since we currently don't handle interpolation of multiple */ + /* master fonts, this is a no-op */ + FT_TRACE4(( " store\n" )); + break; + + case cff_op_load: + /* this operator was removed from the Type2 specification */ + /* in version 16-March-2000 */ + { + FT_Int reg_idx = (FT_Int)args[0]; + FT_Int idx = (FT_Int)args[1]; + FT_Int count = (FT_Int)args[2]; + + + FT_TRACE4(( " load\n" )); + + /* since we currently don't handle interpolation of multiple */ + /* master fonts, we store a vector [1 0 0 ...] in the */ + /* temporary storage array regardless of the Registry index */ + if ( reg_idx >= 0 && reg_idx <= 2 && + idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS && + count >= 0 && count <= num_axes ) + { + FT_Int end, i; + + + end = FT_MIN( idx + count, CFF_MAX_TRANS_ELEMENTS ); + + if ( idx < end ) + decoder->buildchar[idx] = 1 << 16; + + for ( i = idx + 1; i < end; i++ ) + decoder->buildchar[i] = 0; + } + } + break; + + case cff_op_blend: + /* this operator was removed from the Type2 specification */ + /* in version 16-March-2000 */ + { + FT_Int num_results = (FT_Int)( args[0] >> 16 ); + + + FT_TRACE4(( " blend\n" )); + + if ( num_results < 0 ) + goto Syntax_Error; + + if ( num_results * (FT_Int)num_designs > num_args ) + goto Stack_Underflow; + + /* since we currently don't handle interpolation of multiple */ + /* master fonts, return the `num_results' values of the */ + /* first master */ + args -= num_results * ( num_designs - 1 ); + num_args -= num_results * ( num_designs - 1 ); + } + break; + + case cff_op_dotsection: + /* this operator is deprecated and ignored by the parser */ + FT_TRACE4(( " dotsection\n" )); + break; + + case cff_op_closepath: + /* this is an invalid Type 2 operator; however, there */ + /* exist fonts which are incorrectly converted from probably */ + /* Type 1 to CFF, and some parsers seem to accept it */ + + FT_TRACE4(( " closepath (invalid op)\n" )); + + args = stack; + break; + + case cff_op_hsbw: + /* this is an invalid Type 2 operator; however, there */ + /* exist fonts which are incorrectly converted from probably */ + /* Type 1 to CFF, and some parsers seem to accept it */ + + FT_TRACE4(( " hsbw (invalid op)\n" )); + + decoder->glyph_width = + ADD_LONG( decoder->nominal_width, ( args[1] >> 16 ) ); + + decoder->builder.left_bearing.x = args[0]; + decoder->builder.left_bearing.y = 0; + + x = ADD_LONG( decoder->builder.pos_x, args[0] ); + y = decoder->builder.pos_y; + args = stack; + break; + + case cff_op_sbw: + /* this is an invalid Type 2 operator; however, there */ + /* exist fonts which are incorrectly converted from probably */ + /* Type 1 to CFF, and some parsers seem to accept it */ + + FT_TRACE4(( " sbw (invalid op)\n" )); + + decoder->glyph_width = + ADD_LONG( decoder->nominal_width, ( args[2] >> 16 ) ); + + decoder->builder.left_bearing.x = args[0]; + decoder->builder.left_bearing.y = args[1]; + + x = ADD_LONG( decoder->builder.pos_x, args[0] ); + y = ADD_LONG( decoder->builder.pos_y, args[1] ); + args = stack; + break; + + case cff_op_setcurrentpoint: + /* this is an invalid Type 2 operator; however, there */ + /* exist fonts which are incorrectly converted from probably */ + /* Type 1 to CFF, and some parsers seem to accept it */ + + FT_TRACE4(( " setcurrentpoint (invalid op)\n" )); + + x = ADD_LONG( decoder->builder.pos_x, args[0] ); + y = ADD_LONG( decoder->builder.pos_y, args[1] ); + args = stack; + break; + + case cff_op_callothersubr: + /* this is an invalid Type 2 operator; however, there */ + /* exist fonts which are incorrectly converted from probably */ + /* Type 1 to CFF, and some parsers seem to accept it */ + + FT_TRACE4(( " callothersubr (invalid op)\n" )); + + /* subsequent `pop' operands should add the arguments, */ + /* this is the implementation described for `unknown' other */ + /* subroutines in the Type1 spec. */ + /* */ + /* XXX Fix return arguments (see discussion below). */ + args -= 2 + ( args[-2] >> 16 ); + if ( args < stack ) + goto Stack_Underflow; + break; + + case cff_op_pop: + /* this is an invalid Type 2 operator; however, there */ + /* exist fonts which are incorrectly converted from probably */ + /* Type 1 to CFF, and some parsers seem to accept it */ + + FT_TRACE4(( " pop (invalid op)\n" )); + + /* XXX Increasing `args' is wrong: After a certain number of */ + /* `pop's we get a stack overflow. Reason for doing it is */ + /* code like this (actually found in a CFF font): */ + /* */ + /* 17 1 3 callothersubr */ + /* pop */ + /* callsubr */ + /* */ + /* Since we handle `callothersubr' as a no-op, and */ + /* `callsubr' needs at least one argument, `pop' can't be a */ + /* no-op too as it basically should be. */ + /* */ + /* The right solution would be to provide real support for */ + /* `callothersubr' as done in `t1decode.c', however, given */ + /* the fact that CFF fonts with `pop' are invalid, it is */ + /* questionable whether it is worth the time. */ + args++; + break; + + case cff_op_and: + { + FT_Fixed cond = ( args[0] && args[1] ); + + + FT_TRACE4(( " and\n" )); + + args[0] = cond ? 0x10000L : 0; + args++; + } + break; + + case cff_op_or: + { + FT_Fixed cond = ( args[0] || args[1] ); + + + FT_TRACE4(( " or\n" )); + + args[0] = cond ? 0x10000L : 0; + args++; + } + break; + + case cff_op_not: + { + FT_Fixed cond = !args[0]; + + + FT_TRACE4(( " not\n" )); + + args[0] = cond ? 0x10000L : 0; + args++; + } + break; + + case cff_op_eq: + { + FT_Fixed cond = ( args[0] == args[1] ); + + + FT_TRACE4(( " eq\n" )); + + args[0] = cond ? 0x10000L : 0; + args++; + } + break; + + case cff_op_ifelse: + { + FT_Fixed cond = ( args[2] <= args[3] ); + + + FT_TRACE4(( " ifelse\n" )); + + if ( !cond ) + args[0] = args[1]; + args++; + } + break; + + case cff_op_callsubr: + { + FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + + decoder->locals_bias ); + + + FT_TRACE4(( " callsubr (idx %d, entering level %d)\n", + idx, + zone - decoder->zones + 1 )); + + if ( idx >= decoder->num_locals ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " invalid local subr index\n" )); + goto Syntax_Error; + } + + if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " too many nested subrs\n" )); + goto Syntax_Error; + } + + zone->cursor = ip; /* save current instruction pointer */ + + zone++; + zone->base = decoder->locals[idx]; + zone->limit = decoder->locals[idx + 1]; + zone->cursor = zone->base; + + if ( !zone->base || zone->limit == zone->base ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " invoking empty subrs\n" )); + goto Syntax_Error; + } + + decoder->zone = zone; + ip = zone->base; + limit = zone->limit; + } + break; + + case cff_op_callgsubr: + { + FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + + decoder->globals_bias ); + + + FT_TRACE4(( " callgsubr (idx %d, entering level %d)\n", + idx, + zone - decoder->zones + 1 )); + + if ( idx >= decoder->num_globals ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " invalid global subr index\n" )); + goto Syntax_Error; + } + + if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " too many nested subrs\n" )); + goto Syntax_Error; + } + + zone->cursor = ip; /* save current instruction pointer */ + + zone++; + zone->base = decoder->globals[idx]; + zone->limit = decoder->globals[idx + 1]; + zone->cursor = zone->base; + + if ( !zone->base || zone->limit == zone->base ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " invoking empty subrs\n" )); + goto Syntax_Error; + } + + decoder->zone = zone; + ip = zone->base; + limit = zone->limit; + } + break; + + case cff_op_return: + FT_TRACE4(( " return (leaving level %d)\n", + decoder->zone - decoder->zones )); + + if ( decoder->zone <= decoder->zones ) + { + FT_ERROR(( "cff_decoder_parse_charstrings:" + " unexpected return\n" )); + goto Syntax_Error; + } + + decoder->zone--; + zone = decoder->zone; + ip = zone->cursor; + limit = zone->limit; + break; + + default: + FT_ERROR(( "Unimplemented opcode: %d", ip[-1] )); + + if ( ip[-1] == 12 ) + FT_ERROR(( " %d", ip[0] )); + FT_ERROR(( "\n" )); + + return FT_THROW( Unimplemented_Feature ); + } + + decoder->top = args; + + if ( decoder->top - stack >= CFF_MAX_OPERANDS ) + goto Stack_Overflow; + + } /* general operator processing */ + + } /* while ip < limit */ + + FT_TRACE4(( "..end..\n\n" )); + + Fail: + return error; + + MM_Error: + FT_TRACE4(( "cff_decoder_parse_charstrings:" + " invalid opcode found in top DICT charstring\n")); + return FT_THROW( Invalid_File_Format ); + + Syntax_Error: + FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error\n" )); + return FT_THROW( Invalid_File_Format ); + + Stack_Underflow: + FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow\n" )); + return FT_THROW( Too_Few_Arguments ); + + Stack_Overflow: + FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow\n" )); + return FT_THROW( Stack_Overflow ); + } + +#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ + + + /*************************************************************************/ + /* */ + /* */ + /* cff_decoder_init */ + /* */ + /* */ + /* Initializes a given glyph decoder. */ + /* */ + /* */ + /* decoder :: A pointer to the glyph builder to initialize. */ + /* */ + /* */ + /* face :: The current face object. */ + /* */ + /* size :: The current size object. */ + /* */ + /* slot :: The current glyph object. */ + /* */ + /* hinting :: Whether hinting is active. */ + /* */ + /* hint_mode :: The hinting mode. */ + /* */ + FT_LOCAL_DEF( void ) + cff_decoder_init( CFF_Decoder* decoder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot slot, + FT_Bool hinting, + FT_Render_Mode hint_mode, + CFF_Decoder_Get_Glyph_Callback get_callback, + CFF_Decoder_Free_Glyph_Callback free_callback ) + { + CFF_Font cff = (CFF_Font)face->extra.data; + + + /* clear everything */ + FT_ZERO( decoder ); + + /* initialize builder */ + cff_builder_init( &decoder->builder, face, size, slot, hinting ); + + /* initialize Type2 decoder */ + decoder->cff = cff; + decoder->num_globals = cff->global_subrs_index.count; + decoder->globals = cff->global_subrs; + decoder->globals_bias = cff_compute_bias( + cff->top_font.font_dict.charstring_type, + decoder->num_globals ); + + decoder->hint_mode = hint_mode; + + decoder->get_glyph_callback = get_callback; + decoder->free_glyph_callback = free_callback; + } + + + /* this function is used to select the subfont */ + /* and the locals subrs array */ + FT_LOCAL_DEF( FT_Error ) + cff_decoder_prepare( CFF_Decoder* decoder, + CFF_Size size, + FT_UInt glyph_index ) + { + CFF_Builder *builder = &decoder->builder; + CFF_Font cff = (CFF_Font)builder->face->extra.data; + CFF_SubFont sub = &cff->top_font; + FT_Error error = FT_Err_Ok; + + FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)cff->cffload; + + + /* manage CID fonts */ + if ( cff->num_subfonts ) + { + FT_Byte fd_index = cffload->fd_select_get( &cff->fd_select, + glyph_index ); + + + if ( fd_index >= cff->num_subfonts ) + { + FT_TRACE4(( "cff_decoder_prepare: invalid CID subfont index\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } + + FT_TRACE3(( " in subfont %d:\n", fd_index )); + + sub = cff->subfonts[fd_index]; + + if ( builder->hints_funcs && size ) + { + FT_Size ftsize = FT_SIZE( size ); + CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data; + + + /* for CFFs without subfonts, this value has already been set */ + builder->hints_globals = (void *)internal->subfonts[fd_index]; + } + } + + decoder->num_locals = sub->local_subrs_index.count; + decoder->locals = sub->local_subrs; + decoder->locals_bias = cff_compute_bias( + decoder->cff->top_font.font_dict.charstring_type, + decoder->num_locals ); + + decoder->glyph_width = sub->private_dict.default_width; + decoder->nominal_width = sub->private_dict.nominal_width; + + decoder->current_subfont = sub; + + Exit: + return error; + } + + +/* END */ diff --git a/src/psaux/cffdecode.h b/src/psaux/cffdecode.h new file mode 100644 index 000000000..0d4f5fef6 --- /dev/null +++ b/src/psaux/cffdecode.h @@ -0,0 +1,64 @@ +/***************************************************************************/ +/* */ +/* cffdecode.h */ +/* */ +/* PostScript CFF (Type 2) decoding routines (specification). */ +/* */ +/* Copyright 2017-2018 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef CFFDECODE_H_ +#define CFFDECODE_H_ + + +#include +#include FT_INTERNAL_POSTSCRIPT_AUX_H + + +FT_BEGIN_HEADER + + FT_LOCAL( void ) + cff_decoder_init( CFF_Decoder* decoder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot slot, + FT_Bool hinting, + FT_Render_Mode hint_mode, + CFF_Decoder_Get_Glyph_Callback get_callback, + CFF_Decoder_Free_Glyph_Callback free_callback ); + + FT_LOCAL( FT_Error ) + cff_decoder_prepare( CFF_Decoder* decoder, + CFF_Size size, + FT_UInt glyph_index ); + + + FT_LOCAL( FT_Int ) + cff_lookup_glyph_by_stdcharcode( CFF_Font cff, + FT_Int charcode ); + + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + FT_LOCAL( FT_Error ) + cff_decoder_parse_charstrings( CFF_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len, + FT_Bool in_dict ); +#endif + + +FT_END_HEADER + +#endif + + +/* END */ diff --git a/src/psaux/module.mk b/src/psaux/module.mk index c70a22716..6584d075a 100644 --- a/src/psaux/module.mk +++ b/src/psaux/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/cff/cf2arrst.c b/src/psaux/psarrst.c similarity index 98% rename from src/cff/cf2arrst.c rename to src/psaux/psarrst.c index 6796450fe..a8780947f 100644 --- a/src/cff/cf2arrst.c +++ b/src/psaux/psarrst.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2arrst.c */ +/* psarrst.c */ /* */ /* Adobe's code for Array Stacks (body). */ /* */ @@ -36,13 +36,13 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2glue.h" -#include "cf2arrst.h" +#include "psglue.h" +#include "psarrst.h" -#include "cf2error.h" +#include "pserror.h" /* diff --git a/src/cff/cf2arrst.h b/src/psaux/psarrst.h similarity index 96% rename from src/cff/cf2arrst.h rename to src/psaux/psarrst.h index 3c21a3b67..b3568eb61 100644 --- a/src/cff/cf2arrst.h +++ b/src/psaux/psarrst.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2arrst.h */ +/* psarrst.h */ /* */ /* Adobe's code for Array Stacks (specification). */ /* */ @@ -36,11 +36,11 @@ /***************************************************************************/ -#ifndef CF2ARRST_H_ -#define CF2ARRST_H_ +#ifndef PSARRST_H_ +#define PSARRST_H_ -#include "cf2error.h" +#include "pserror.h" FT_BEGIN_HEADER @@ -94,7 +94,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2ARRST_H_ */ +#endif /* PSARRST_H_ */ /* END */ diff --git a/src/psaux/psaux.c b/src/psaux/psaux.c index f8f19d0f3..fb447fcdb 100644 --- a/src/psaux/psaux.c +++ b/src/psaux/psaux.c @@ -4,7 +4,7 @@ /* */ /* FreeType auxiliary PostScript driver component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,18 +17,25 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "psobjs.c" -#include "psauxmod.c" -#include "t1decode.c" -#include "t1cmap.c" -#ifndef T1_CONFIG_OPTION_NO_AFM #include "afmparse.c" -#endif - +#include "psauxmod.c" #include "psconv.c" +#include "psobjs.c" +#include "t1cmap.c" +#include "t1decode.c" +#include "cffdecode.c" + +#include "psarrst.c" +#include "psblues.c" +#include "pserror.c" +#include "psfont.c" +#include "psft.c" +#include "pshints.c" +#include "psintrp.c" +#include "psread.c" +#include "psstack.c" /* END */ diff --git a/src/psaux/psauxerr.h b/src/psaux/psauxerr.h index 1d7ac6001..cc33fd2ee 100644 --- a/src/psaux/psauxerr.h +++ b/src/psaux/psauxerr.h @@ -4,7 +4,7 @@ /* */ /* PS auxiliary module error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index 1f589cefc..ee497085c 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -4,7 +4,7 @@ /* */ /* FreeType auxiliary PostScript module implementation (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,6 +21,8 @@ #include "psobjs.h" #include "t1decode.h" #include "t1cmap.h" +#include "psft.h" +#include "cffdecode.h" #ifndef T1_CONFIG_OPTION_NO_AFM #include "afmparse.h" @@ -59,6 +61,14 @@ }; + FT_CALLBACK_TABLE_DEF + const PS_Builder_FuncsRec ps_builder_funcs = + { + ps_builder_init, /* init */ + ps_builder_done /* done */ + }; + + FT_CALLBACK_TABLE_DEF const T1_Builder_FuncsRec t1_builder_funcs = { @@ -77,9 +87,14 @@ FT_CALLBACK_TABLE_DEF const T1_Decoder_FuncsRec t1_decoder_funcs = { - t1_decoder_init, /* init */ - t1_decoder_done, /* done */ - t1_decoder_parse_charstrings /* parse_charstrings */ + t1_decoder_init, /* init */ + t1_decoder_done, /* done */ +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + t1_decoder_parse_charstrings, /* parse_charstrings_old */ +#else + t1_decoder_parse_metrics, /* parse_metrics */ +#endif + cf2_decoder_parse_charstrings /* parse_charstrings */ }; @@ -104,6 +119,34 @@ }; + FT_CALLBACK_TABLE_DEF + const CFF_Builder_FuncsRec cff_builder_funcs = + { + cff_builder_init, /* init */ + cff_builder_done, /* done */ + + cff_check_points, /* check_points */ + cff_builder_add_point, /* add_point */ + cff_builder_add_point1, /* add_point1 */ + cff_builder_add_contour, /* add_contour */ + cff_builder_start_point, /* start_point */ + cff_builder_close_contour /* close_contour */ + }; + + + FT_CALLBACK_TABLE_DEF + const CFF_Decoder_FuncsRec cff_decoder_funcs = + { + cff_decoder_init, /* init */ + cff_decoder_prepare, /* prepare */ + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + cff_decoder_parse_charstrings, /* parse_charstrings_old */ +#endif + cf2_decoder_parse_charstrings /* parse_charstrings */ + }; + + static const PSAux_Interface psaux_interface = { @@ -112,6 +155,9 @@ &t1_builder_funcs, &t1_decoder_funcs, t1_decrypt, + cff_random, + ps_decoder_init, + t1_make_subfont, (const T1_CMap_ClassesRec*) &t1_cmap_classes, @@ -120,6 +166,8 @@ #else 0, #endif + + &cff_decoder_funcs, }; diff --git a/src/psaux/psauxmod.h b/src/psaux/psauxmod.h index 926f37eba..f30978f02 100644 --- a/src/psaux/psauxmod.h +++ b/src/psaux/psauxmod.h @@ -4,7 +4,7 @@ /* */ /* FreeType auxiliary PostScript module implementation (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,6 +23,8 @@ #include #include FT_MODULE_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H + FT_BEGIN_HEADER @@ -31,6 +33,13 @@ FT_BEGIN_HEADER #endif + FT_CALLBACK_TABLE + const CFF_Builder_FuncsRec cff_builder_funcs; + + FT_CALLBACK_TABLE + const PS_Builder_FuncsRec ps_builder_funcs; + + FT_EXPORT_VAR( const FT_Module_Class ) psaux_driver_class; diff --git a/src/cff/cf2blues.c b/src/psaux/psblues.c similarity index 91% rename from src/cff/cf2blues.c rename to src/psaux/psblues.c index 250f89e0d..ae39d03c7 100644 --- a/src/cff/cf2blues.c +++ b/src/psaux/psblues.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2blues.c */ +/* psblues.c */ /* */ /* Adobe's code for handling Blue Zones (body). */ /* */ @@ -36,12 +36,12 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2blues.h" -#include "cf2hints.h" -#include "cf2font.h" +#include "psblues.h" +#include "pshints.h" +#include "psfont.h" /*************************************************************************/ @@ -67,7 +67,7 @@ CF2_Font font ) { /* pointer to parsed font object */ - CFF_Decoder* decoder = font->decoder; + PS_Decoder* decoder = font->decoder; CF2_Fixed zoneHeight; CF2_Fixed maxZoneHeight = 0; @@ -194,8 +194,8 @@ blues->zone[blues->count].csTopEdge = cf2_blueToFixed( blueValues[i + 1] ); - zoneHeight = blues->zone[blues->count].csTopEdge - - blues->zone[blues->count].csBottomEdge; + zoneHeight = SUB_INT32( blues->zone[blues->count].csTopEdge, + blues->zone[blues->count].csBottomEdge ); if ( zoneHeight < 0 ) { @@ -243,8 +243,8 @@ blues->zone[blues->count].csTopEdge = cf2_blueToFixed( otherBlues[i + 1] ); - zoneHeight = blues->zone[blues->count].csTopEdge - - blues->zone[blues->count].csBottomEdge; + zoneHeight = SUB_INT32( blues->zone[blues->count].csTopEdge, + blues->zone[blues->count].csBottomEdge ); if ( zoneHeight < 0 ) { @@ -301,7 +301,7 @@ /* top edge */ flatFamilyEdge = cf2_blueToFixed( familyOtherBlues[j + 1] ); - diff = cf2_fixedAbs( flatEdge - flatFamilyEdge ); + diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) ); if ( diff < minDiff && diff < csUnitsPerPixel ) { @@ -319,7 +319,7 @@ /* top edge */ flatFamilyEdge = cf2_blueToFixed( familyBlues[1] ); - diff = cf2_fixedAbs( flatEdge - flatFamilyEdge ); + diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) ); if ( diff < minDiff && diff < csUnitsPerPixel ) blues->zone[i].csFlatEdge = flatFamilyEdge; @@ -342,7 +342,7 @@ /* adjust edges of top zone upward by twice darkening amount */ flatFamilyEdge += 2 * font->darkenY; /* bottom edge */ - diff = cf2_fixedAbs( flatEdge - flatFamilyEdge ); + diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) ); if ( diff < minDiff && diff < csUnitsPerPixel ) { @@ -408,8 +408,8 @@ /* Note: constant changed from 0.5 to 0.6 to avoid a problem with */ /* 10ppem Arial */ - blues->boost = cf2_floatToFixed( .6 ) - - FT_MulDiv( cf2_floatToFixed ( .6 ), + blues->boost = cf2_doubleToFixed( .6 ) - + FT_MulDiv( cf2_doubleToFixed ( .6 ), blues->scale, blues->blueScale ); if ( blues->boost > 0x7FFF ) @@ -489,17 +489,18 @@ if ( blues->zone[i].bottomZone && cf2_hint_isBottom( bottomHintEdge ) ) { - if ( ( blues->zone[i].csBottomEdge - csFuzz ) <= - bottomHintEdge->csCoord && + if ( SUB_INT32( blues->zone[i].csBottomEdge, csFuzz ) <= + bottomHintEdge->csCoord && bottomHintEdge->csCoord <= - ( blues->zone[i].csTopEdge + csFuzz ) ) + ADD_INT32( blues->zone[i].csTopEdge, csFuzz ) ) { /* bottom edge captured by bottom zone */ if ( blues->suppressOvershoot ) dsNew = blues->zone[i].dsFlatEdge; - else if ( ( blues->zone[i].csTopEdge - bottomHintEdge->csCoord ) >= + else if ( SUB_INT32( blues->zone[i].csTopEdge, + bottomHintEdge->csCoord ) >= blues->blueShift ) { /* guarantee minimum of 1 pixel overshoot */ @@ -514,7 +515,7 @@ dsNew = cf2_fixedRound( bottomHintEdge->dsCoord ); } - dsMove = dsNew - bottomHintEdge->dsCoord; + dsMove = SUB_INT32( dsNew, bottomHintEdge->dsCoord ); captured = TRUE; break; @@ -523,17 +524,18 @@ if ( !blues->zone[i].bottomZone && cf2_hint_isTop( topHintEdge ) ) { - if ( ( blues->zone[i].csBottomEdge - csFuzz ) <= - topHintEdge->csCoord && + if ( SUB_INT32( blues->zone[i].csBottomEdge, csFuzz ) <= + topHintEdge->csCoord && topHintEdge->csCoord <= - ( blues->zone[i].csTopEdge + csFuzz ) ) + ADD_INT32( blues->zone[i].csTopEdge, csFuzz ) ) { /* top edge captured by top zone */ if ( blues->suppressOvershoot ) dsNew = blues->zone[i].dsFlatEdge; - else if ( ( topHintEdge->csCoord - blues->zone[i].csBottomEdge ) >= + else if ( SUB_INT32( topHintEdge->csCoord, + blues->zone[i].csBottomEdge ) >= blues->blueShift ) { /* guarantee minimum of 1 pixel overshoot */ @@ -548,7 +550,7 @@ dsNew = cf2_fixedRound( topHintEdge->dsCoord ); } - dsMove = dsNew - topHintEdge->dsCoord; + dsMove = SUB_INT32( dsNew, topHintEdge->dsCoord ); captured = TRUE; break; @@ -561,13 +563,14 @@ /* move both edges and flag them `locked' */ if ( cf2_hint_isValid( bottomHintEdge ) ) { - bottomHintEdge->dsCoord += dsMove; + bottomHintEdge->dsCoord = ADD_INT32( bottomHintEdge->dsCoord, + dsMove ); cf2_hint_lock( bottomHintEdge ); } if ( cf2_hint_isValid( topHintEdge ) ) { - topHintEdge->dsCoord += dsMove; + topHintEdge->dsCoord = ADD_INT32( topHintEdge->dsCoord, dsMove ); cf2_hint_lock( topHintEdge ); } } diff --git a/src/cff/cf2blues.h b/src/psaux/psblues.h similarity index 97% rename from src/cff/cf2blues.h rename to src/psaux/psblues.h index 96fb60f38..25ef6849c 100644 --- a/src/cff/cf2blues.h +++ b/src/psaux/psblues.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2blues.h */ +/* psblues.h */ /* */ /* Adobe's code for handling Blue Zones (specification). */ /* */ @@ -65,11 +65,11 @@ */ -#ifndef CF2BLUES_H_ -#define CF2BLUES_H_ +#ifndef PSBLUES_H_ +#define PSBLUES_H_ -#include "cf2glue.h" +#include "psglue.h" FT_BEGIN_HEADER @@ -111,7 +111,7 @@ FT_BEGIN_HEADER * Constant used for hint adjustment and for synthetic em box hint * placement. */ -#define CF2_MIN_COUNTER cf2_floatToFixed( 0.5 ) +#define CF2_MIN_COUNTER cf2_doubleToFixed( 0.5 ) /* shared typedef is in cf2glue.h */ @@ -179,7 +179,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2BLUES_H_ */ +#endif /* PSBLUES_H_ */ /* END */ diff --git a/src/psaux/psconv.c b/src/psaux/psconv.c index b09248219..a03385000 100644 --- a/src/psaux/psconv.c +++ b/src/psaux/psconv.c @@ -4,7 +4,7 @@ /* */ /* Some convenience conversions (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -111,6 +111,10 @@ p++; if ( p == limit ) goto Bad; + + /* only a single sign is allowed */ + if ( *p == '-' || *p == '+' ) + return 0; } num_limit = 0x7FFFFFFFL / base; @@ -215,6 +219,10 @@ p++; if ( p == limit ) goto Bad; + + /* only a single sign is allowed */ + if ( *p == '-' || *p == '+' ) + return 0; } /* read the integer part */ diff --git a/src/psaux/psconv.h b/src/psaux/psconv.h index cab254ac5..d643ffcfc 100644 --- a/src/psaux/psconv.h +++ b/src/psaux/psconv.h @@ -4,7 +4,7 @@ /* */ /* Some convenience conversions (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/cff/cf2error.c b/src/psaux/pserror.c similarity index 96% rename from src/cff/cf2error.c rename to src/psaux/pserror.c index e3dd69f50..9169e5222 100644 --- a/src/cff/cf2error.c +++ b/src/psaux/pserror.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2error.c */ +/* pserror.c */ /* */ /* Adobe's code for error handling (body). */ /* */ @@ -36,8 +36,8 @@ /***************************************************************************/ -#include "cf2ft.h" -#include "cf2error.h" +#include "psft.h" +#include "pserror.h" FT_LOCAL_DEF( void ) diff --git a/src/cff/cf2error.h b/src/psaux/pserror.h similarity index 96% rename from src/cff/cf2error.h rename to src/psaux/pserror.h index d2c770d29..13d52062b 100644 --- a/src/cff/cf2error.h +++ b/src/psaux/pserror.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2error.h */ +/* pserror.h */ /* */ /* Adobe's code for error handling (specification). */ /* */ @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2ERROR_H_ -#define CF2ERROR_H_ +#ifndef PSERROR_H_ +#define PSERROR_H_ #include FT_MODULE_ERRORS_H @@ -50,7 +50,7 @@ #include FT_ERRORS_H -#include "cf2ft.h" +#include "psft.h" FT_BEGIN_HEADER @@ -113,7 +113,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2ERROR_H_ */ +#endif /* PSERROR_H_ */ /* END */ diff --git a/src/cff/cf2fixed.h b/src/psaux/psfixed.h similarity index 95% rename from src/cff/cf2fixed.h rename to src/psaux/psfixed.h index 2e4b5032f..219589e7f 100644 --- a/src/cff/cf2fixed.h +++ b/src/psaux/psfixed.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2fixed.h */ +/* psfixed.h */ /* */ /* Adobe's code for Fixed Point Mathematics (specification only). */ /* */ @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2FIXED_H_ -#define CF2FIXED_H_ +#ifndef PSFIXED_H_ +#define PSFIXED_H_ FT_BEGIN_HEADER @@ -63,10 +63,10 @@ FT_BEGIN_HEADER ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) ) #define cf2_fixedRound( x ) \ ( (CF2_Fixed)( ( (FT_UInt32)(x) + 0x8000U ) & 0xFFFF0000UL ) ) -#define cf2_floatToFixed( f ) \ +#define cf2_doubleToFixed( f ) \ ( (CF2_Fixed)( (f) * 65536.0 + 0.5 ) ) #define cf2_fixedAbs( x ) \ - ( (x) < 0 ? -(x) : (x) ) + ( (x) < 0 ? NEG_INT32( x ) : (x) ) #define cf2_fixedFloor( x ) \ ( (CF2_Fixed)( (FT_UInt32)(x) & 0xFFFF0000UL ) ) #define cf2_fixedFraction( x ) \ @@ -89,7 +89,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2FIXED_H_ */ +#endif /* PSFIXED_H_ */ /* END */ diff --git a/src/cff/cf2font.c b/src/psaux/psfont.c similarity index 91% rename from src/cff/cf2font.c rename to src/psaux/psfont.c index a86e3619b..dde67a739 100644 --- a/src/cff/cf2font.c +++ b/src/psaux/psfont.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2font.c */ +/* psfont.c */ /* */ /* Adobe's code for font instances (body). */ /* */ @@ -39,12 +39,12 @@ #include #include FT_INTERNAL_CALC_H -#include "cf2ft.h" +#include "psft.h" -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2error.h" -#include "cf2intrp.h" +#include "psglue.h" +#include "psfont.h" +#include "pserror.h" +#include "psintrp.h" /* Compute a stem darkening amount in character space. */ @@ -117,7 +117,7 @@ return; /* protect against range problems and divide by zero */ - if ( emRatio < cf2_floatToFixed( .01 ) ) + if ( emRatio < cf2_doubleToFixed( .01 ) ) return; if ( stemDarkened ) @@ -243,7 +243,7 @@ const CF2_Matrix* transform ) { /* pointer to parsed font object */ - CFF_Decoder* decoder = font->decoder; + PS_Decoder* decoder = font->decoder; FT_Bool needExtraSetup = FALSE; @@ -260,7 +260,6 @@ CF2_UInt lenNormalizedV = 0; FT_Fixed* normalizedV = NULL; - /* clear previous error */ font->error = FT_Err_Ok; @@ -273,46 +272,52 @@ needExtraSetup = TRUE; } - /* check for variation vectors */ - vstore = cf2_getVStore( decoder ); - hasVariations = ( vstore->dataCount != 0 ); - - if ( hasVariations ) + if ( !font->isT1 ) { -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - /* check whether Private DICT in this subfont needs to be reparsed */ - font->error = cf2_getNormalizedVector( decoder, - &lenNormalizedV, - &normalizedV ); - if ( font->error ) - return; + FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)font->cffload; + + + /* check for variation vectors */ + vstore = cf2_getVStore( decoder ); + hasVariations = ( vstore->dataCount != 0 ); - if ( cff_blend_check_vector( &subFont->blend, - subFont->private_dict.vsindex, - lenNormalizedV, - normalizedV ) ) + if ( hasVariations ) { - /* blend has changed, reparse */ - cff_load_private_dict( decoder->cff, - subFont, - lenNormalizedV, - normalizedV ); - needExtraSetup = TRUE; - } +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /* check whether Private DICT in this subfont needs to be reparsed */ + font->error = cf2_getNormalizedVector( decoder, + &lenNormalizedV, + &normalizedV ); + if ( font->error ) + return; + + if ( cffload->blend_check_vector( &subFont->blend, + subFont->private_dict.vsindex, + lenNormalizedV, + normalizedV ) ) + { + /* blend has changed, reparse */ + cffload->load_private_dict( decoder->cff, + subFont, + lenNormalizedV, + normalizedV ); + needExtraSetup = TRUE; + } #endif - /* copy from subfont */ - font->blend.font = subFont->blend.font; + /* copy from subfont */ + font->blend.font = subFont->blend.font; - /* clear state of charstring blend */ - font->blend.usedBV = FALSE; + /* clear state of charstring blend */ + font->blend.usedBV = FALSE; - /* initialize value for charstring */ - font->vsindex = subFont->private_dict.vsindex; + /* initialize value for charstring */ + font->vsindex = subFont->private_dict.vsindex; - /* store vector inputs for blends in charstring */ - font->lenNDV = lenNormalizedV; - font->NDV = normalizedV; + /* store vector inputs for blends in charstring */ + font->lenNDV = lenNormalizedV; + font->NDV = normalizedV; + } } /* if ppem has changed, we need to recompute some cached data */ @@ -447,7 +452,7 @@ /* choose a constant for StdHW that depends on font contrast */ stdHW = cf2_getStdHW( decoder ); - if ( stdHW > 0 && font->stdVW > 2 * stdHW ) + if ( stdHW > 0 && font->stdVW > MUL_INT32( 2, stdHW ) ) font->stdHW = FT_DivFix( cf2_intToFixed( 75 ), emRatio ); else { diff --git a/src/cff/cf2font.h b/src/psaux/psfont.h similarity index 94% rename from src/cff/cf2font.h rename to src/psaux/psfont.h index 17ecd17bb..e611ac4bd 100644 --- a/src/cff/cf2font.h +++ b/src/psaux/psfont.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2font.h */ +/* psfont.h */ /* */ /* Adobe's code for font instances (specification). */ /* */ @@ -36,13 +36,14 @@ /***************************************************************************/ -#ifndef CF2FONT_H_ -#define CF2FONT_H_ +#ifndef PSFONT_H_ +#define PSFONT_H_ -#include "cf2ft.h" -#include "cf2blues.h" -#include "cffload.h" +#include FT_SERVICE_CFF_TABLE_LOAD_H + +#include "psft.h" +#include "psblues.h" FT_BEGIN_HEADER @@ -64,6 +65,7 @@ FT_BEGIN_HEADER FT_Memory memory; FT_Error error; /* shared error for this instance */ + FT_Bool isT1; FT_Bool isCFF2; CF2_RenderingFlags renderingFlags; @@ -89,7 +91,7 @@ FT_BEGIN_HEADER /* FreeType related members */ CF2_OutlineRec outline; /* freetype glyph outline functions */ - CFF_Decoder* decoder; + PS_Decoder* decoder; CFF_SubFont lastSubfont; /* FreeType parsed data; */ /* top font or subfont */ @@ -111,6 +113,8 @@ FT_BEGIN_HEADER /* counterclockwise winding */ CF2_BluesRec blues; /* computed zone data */ + + FT_Service_CFFLoad cffload; /* pointer to cff functions */ }; @@ -124,7 +128,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2FONT_H_ */ +#endif /* PSFONT_H_ */ /* END */ diff --git a/src/cff/cf2ft.c b/src/psaux/psft.c similarity index 65% rename from src/cff/cf2ft.c rename to src/psaux/psft.c index 5cca92a11..1f750174a 100644 --- a/src/cff/cf2ft.c +++ b/src/psaux/psft.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2ft.c */ +/* psft.c */ /* */ /* FreeType Glue Component to Adobe's Interpreter (body). */ /* */ @@ -36,11 +36,20 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2font.h" -#include "cf2error.h" +#include "psfont.h" +#include "pserror.h" +#include "psobjs.h" +#include "cffdecode.h" + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include FT_MULTIPLE_MASTERS_H +#include FT_SERVICE_MULTIPLE_MASTERS_H +#endif + +#include FT_SERVICE_CFF_TABLE_LOAD_H #define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */ @@ -83,12 +92,13 @@ cf2_setGlyphWidth( CF2_Outline outline, CF2_Fixed width ) { - CFF_Decoder* decoder = outline->decoder; + PS_Decoder* decoder = outline->decoder; FT_ASSERT( decoder ); - decoder->glyph_width = cf2_fixedToInt( width ); + if ( !decoder->builder.is_t1 ) + *decoder->glyph_width = cf2_fixedToInt( width ); } @@ -122,8 +132,8 @@ const CF2_CallbackParams params ) { /* downcast the object pointer */ - CF2_Outline outline = (CF2_Outline)callbacks; - CFF_Builder* builder; + CF2_Outline outline = (CF2_Outline)callbacks; + PS_Builder* builder; (void)params; /* only used in debug mode */ @@ -134,7 +144,7 @@ builder = &outline->decoder->builder; /* note: two successive moves simply close the contour twice */ - cff_builder_close_contour( builder ); + ps_builder_close_contour( builder ); builder->path_begun = 0; } @@ -146,8 +156,8 @@ FT_Error error; /* downcast the object pointer */ - CF2_Outline outline = (CF2_Outline)callbacks; - CFF_Builder* builder; + CF2_Outline outline = (CF2_Outline)callbacks; + PS_Builder* builder; FT_ASSERT( outline && outline->decoder ); @@ -159,9 +169,9 @@ { /* record the move before the line; also check points and set */ /* `path_begun' */ - error = cff_builder_start_point( builder, - params->pt0.x, - params->pt0.y ); + error = ps_builder_start_point( builder, + params->pt0.x, + params->pt0.y ); if ( error ) { if ( !*callbacks->error ) @@ -170,10 +180,10 @@ } } - /* `cff_builder_add_point1' includes a check_points call for one point */ - error = cff_builder_add_point1( builder, - params->pt1.x, - params->pt1.y ); + /* `ps_builder_add_point1' includes a check_points call for one point */ + error = ps_builder_add_point1( builder, + params->pt1.x, + params->pt1.y ); if ( error ) { if ( !*callbacks->error ) @@ -190,8 +200,8 @@ FT_Error error; /* downcast the object pointer */ - CF2_Outline outline = (CF2_Outline)callbacks; - CFF_Builder* builder; + CF2_Outline outline = (CF2_Outline)callbacks; + PS_Builder* builder; FT_ASSERT( outline && outline->decoder ); @@ -203,9 +213,9 @@ { /* record the move before the line; also check points and set */ /* `path_begun' */ - error = cff_builder_start_point( builder, - params->pt0.x, - params->pt0.y ); + error = ps_builder_start_point( builder, + params->pt0.x, + params->pt0.y ); if ( error ) { if ( !*callbacks->error ) @@ -215,7 +225,7 @@ } /* prepare room for 3 points: 2 off-curve, 1 on-curve */ - error = cff_check_points( builder, 3 ); + error = ps_builder_check_points( builder, 3 ); if ( error ) { if ( !*callbacks->error ) @@ -223,15 +233,15 @@ return; } - cff_builder_add_point( builder, - params->pt1.x, - params->pt1.y, 0 ); - cff_builder_add_point( builder, - params->pt2.x, - params->pt2.y, 0 ); - cff_builder_add_point( builder, - params->pt3.x, - params->pt3.y, 1 ); + ps_builder_add_point( builder, + params->pt1.x, + params->pt1.y, 0 ); + ps_builder_add_point( builder, + params->pt2.x, + params->pt2.y, 0 ); + ps_builder_add_point( builder, + params->pt3.x, + params->pt3.y, 1 ); } @@ -253,11 +263,11 @@ /* get scaling and hint flag from GlyphSlot */ static void - cf2_getScaleAndHintFlag( CFF_Decoder* decoder, - CF2_Fixed* x_scale, - CF2_Fixed* y_scale, - FT_Bool* hinted, - FT_Bool* scaled ) + cf2_getScaleAndHintFlag( PS_Decoder* decoder, + CF2_Fixed* x_scale, + CF2_Fixed* y_scale, + FT_Bool* hinted, + FT_Bool* scaled ) { FT_ASSERT( decoder && decoder->builder.glyph ); @@ -267,8 +277,8 @@ if ( *hinted ) { - *x_scale = ( decoder->builder.glyph->x_scale + 32 ) / 64; - *y_scale = ( decoder->builder.glyph->y_scale + 32 ) / 64; + *x_scale = ADD_INT32( decoder->builder.glyph->x_scale, 32 ) / 64; + *y_scale = ADD_INT32( decoder->builder.glyph->y_scale, 32 ) / 64; } else { @@ -284,47 +294,60 @@ /* get units per em from `FT_Face' */ /* TODO: should handle font matrix concatenation? */ static FT_UShort - cf2_getUnitsPerEm( CFF_Decoder* decoder ) + cf2_getUnitsPerEm( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->builder.face ); - FT_ASSERT( decoder->builder.face->root.units_per_EM ); + FT_ASSERT( decoder->builder.face->units_per_EM ); - return decoder->builder.face->root.units_per_EM; + return decoder->builder.face->units_per_EM; } /* Main entry point: Render one glyph. */ FT_LOCAL_DEF( FT_Error ) - cf2_decoder_parse_charstrings( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len ) + cf2_decoder_parse_charstrings( PS_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len ) { FT_Memory memory; FT_Error error = FT_Err_Ok; CF2_Font font; + FT_Bool is_t1 = decoder->builder.is_t1; - FT_ASSERT( decoder && decoder->cff ); + + FT_ASSERT( decoder && + ( is_t1 || decoder->cff ) ); + + if ( is_t1 && !decoder->current_subfont ) + { + FT_ERROR(( "cf2_decoder_parse_charstrings (Type 1): " + "SubFont missing. Use `t1_make_subfont' first\n" )); + return FT_THROW( Invalid_Table ); + } memory = decoder->builder.memory; /* CF2 data is saved here across glyphs */ - font = (CF2_Font)decoder->cff->cf2_instance.data; + font = (CF2_Font)decoder->cf2_instance->data; /* on first glyph, allocate instance structure */ - if ( !decoder->cff->cf2_instance.data ) + if ( !decoder->cf2_instance->data ) { - decoder->cff->cf2_instance.finalizer = + decoder->cf2_instance->finalizer = (FT_Generic_Finalizer)cf2_free_instance; - if ( FT_ALLOC( decoder->cff->cf2_instance.data, + if ( FT_ALLOC( decoder->cf2_instance->data, sizeof ( CF2_FontRec ) ) ) return FT_THROW( Out_Of_Memory ); - font = (CF2_Font)decoder->cff->cf2_instance.data; + font = (CF2_Font)decoder->cf2_instance->data; font->memory = memory; + if ( !is_t1 ) + font->cffload = (FT_Service_CFFLoad)decoder->cff->cffload; + /* initialize a client outline, to be shared by each glyph rendered */ cf2_outline_init( &font->outline, font->memory, &font->error ); } @@ -337,13 +360,13 @@ { /* build parameters for Adobe engine */ - CFF_Builder* builder = &decoder->builder; - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); + PS_Builder* builder = &decoder->builder; + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); FT_Bool no_stem_darkening_driver = driver->no_stem_darkening; FT_Char no_stem_darkening_font = - builder->face->root.internal->no_stem_darkening; + builder->face->internal->no_stem_darkening; /* local error */ FT_Error error2 = FT_Err_Ok; @@ -372,8 +395,14 @@ &hinted, &scaled ); - /* copy isCFF2 boolean from TT_Face to CF2_Font */ - font->isCFF2 = builder->face->is_cff2; + if ( is_t1 ) + font->isCFF2 = FALSE; + else + { + /* copy isCFF2 boolean from TT_Face to CF2_Font */ + font->isCFF2 = ((TT_Face)builder->face)->is_cff2; + } + font->isT1 = is_t1; font->renderingFlags = 0; if ( hinted ) @@ -416,7 +445,7 @@ /* get pointer to current FreeType subfont (based on current glyphID) */ FT_LOCAL_DEF( CFF_SubFont ) - cf2_getSubfont( CFF_Decoder* decoder ) + cf2_getSubfont( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -426,7 +455,7 @@ /* get pointer to VStore structure */ FT_LOCAL_DEF( CFF_VStore ) - cf2_getVStore( CFF_Decoder* decoder ) + cf2_getVStore( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->cff ); @@ -436,7 +465,7 @@ /* get maxstack value from CFF2 Top DICT */ FT_LOCAL_DEF( FT_UInt ) - cf2_getMaxstack( CFF_Decoder* decoder ) + cf2_getMaxstack( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->cff ); @@ -450,25 +479,33 @@ /* */ /* Note: Uses FT_Fixed not CF2_Fixed for the vector. */ FT_LOCAL_DEF( FT_Error ) - cf2_getNormalizedVector( CFF_Decoder* decoder, + cf2_getNormalizedVector( PS_Decoder* decoder, CF2_UInt *len, FT_Fixed* *vec ) { + TT_Face face; + FT_Service_MultiMasters mm; + + FT_ASSERT( decoder && decoder->builder.face ); FT_ASSERT( vec && len ); + FT_ASSERT( !decoder->builder.is_t1 ); - return cff_get_var_blend( decoder->builder.face, len, vec, NULL ); + face = (TT_Face)decoder->builder.face; + mm = (FT_Service_MultiMasters)face->mm; + + return mm->get_var_blend( FT_FACE( face ), len, NULL, vec, NULL ); } #endif /* get `y_ppem' from `CFF_Size' */ FT_LOCAL_DEF( CF2_Fixed ) - cf2_getPpemY( CFF_Decoder* decoder ) + cf2_getPpemY( PS_Decoder* decoder ) { - FT_ASSERT( decoder && - decoder->builder.face && - decoder->builder.face->root.size ); + FT_ASSERT( decoder && + decoder->builder.face && + decoder->builder.face->size ); /* * Note that `y_ppem' can be zero if there wasn't a call to @@ -480,7 +517,7 @@ * */ return cf2_intToFixed( - decoder->builder.face->root.size->metrics.y_ppem ); + decoder->builder.face->size->metrics.y_ppem ); } @@ -488,7 +525,7 @@ /* FreeType stores these as integer font units */ /* (note: variable names seem swapped) */ FT_LOCAL_DEF( CF2_Fixed ) - cf2_getStdVW( CFF_Decoder* decoder ) + cf2_getStdVW( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -498,7 +535,7 @@ FT_LOCAL_DEF( CF2_Fixed ) - cf2_getStdHW( CFF_Decoder* decoder ) + cf2_getStdHW( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -509,10 +546,10 @@ /* note: FreeType stores 1000 times the actual value for `BlueScale' */ FT_LOCAL_DEF( void ) - cf2_getBlueMetrics( CFF_Decoder* decoder, - CF2_Fixed* blueScale, - CF2_Fixed* blueShift, - CF2_Fixed* blueFuzz ) + cf2_getBlueMetrics( PS_Decoder* decoder, + CF2_Fixed* blueScale, + CF2_Fixed* blueShift, + CF2_Fixed* blueFuzz ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -529,9 +566,9 @@ /* get blue values counts and arrays; the FreeType parser has validated */ /* the counts and verified that each is an even number */ FT_LOCAL_DEF( void ) - cf2_getBlueValues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) + cf2_getBlueValues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -542,9 +579,9 @@ FT_LOCAL_DEF( void ) - cf2_getOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) + cf2_getOtherBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -555,9 +592,9 @@ FT_LOCAL_DEF( void ) - cf2_getFamilyBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) + cf2_getFamilyBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -568,9 +605,9 @@ FT_LOCAL_DEF( void ) - cf2_getFamilyOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) + cf2_getFamilyOtherBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -581,7 +618,7 @@ FT_LOCAL_DEF( CF2_Int ) - cf2_getLanguageGroup( CFF_Decoder* decoder ) + cf2_getLanguageGroup( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -592,9 +629,9 @@ /* convert unbiased subroutine index to `CF2_Buffer' and */ /* return 0 on success */ FT_LOCAL_DEF( CF2_Int ) - cf2_initGlobalRegionBuffer( CFF_Decoder* decoder, - CF2_Int subrNum, - CF2_Buffer buf ) + cf2_initGlobalRegionBuffer( PS_Decoder* decoder, + CF2_Int subrNum, + CF2_Buffer buf ) { CF2_UInt idx; @@ -620,9 +657,9 @@ /* convert AdobeStandardEncoding code to CF2_Buffer; */ /* used for seac component */ FT_LOCAL_DEF( FT_Error ) - cf2_getSeacComponent( CFF_Decoder* decoder, - CF2_Int code, - CF2_Buffer buf ) + cf2_getSeacComponent( PS_Decoder* decoder, + CF2_Int code, + CF2_Buffer buf ) { CF2_Int gid; FT_Byte* charstring; @@ -631,13 +668,14 @@ FT_ASSERT( decoder ); + FT_ASSERT( !decoder->builder.is_t1 ); FT_ZERO( buf ); #ifdef FT_CONFIG_OPTION_INCREMENTAL /* Incremental fonts don't necessarily have valid charsets. */ /* They use the character code, not the glyph index, in this case. */ - if ( decoder->builder.face->root.internal->incremental_interface ) + if ( decoder->builder.face->internal->incremental_interface ) gid = code; else #endif /* FT_CONFIG_OPTION_INCREMENTAL */ @@ -647,10 +685,10 @@ return FT_THROW( Invalid_Glyph_Format ); } - error = cff_get_glyph_data( decoder->builder.face, - (CF2_UInt)gid, - &charstring, - &len ); + error = decoder->get_glyph_callback( (TT_Face)decoder->builder.face, + (CF2_UInt)gid, + &charstring, + &len ); /* TODO: for now, just pass the FreeType error through */ if ( error ) return error; @@ -667,21 +705,92 @@ FT_LOCAL_DEF( void ) - cf2_freeSeacComponent( CFF_Decoder* decoder, - CF2_Buffer buf ) + cf2_freeSeacComponent( PS_Decoder* decoder, + CF2_Buffer buf ) + { + FT_ASSERT( decoder ); + FT_ASSERT( !decoder->builder.is_t1 ); + + decoder->free_glyph_callback( (TT_Face)decoder->builder.face, + (FT_Byte**)&buf->start, + (FT_ULong)( buf->end - buf->start ) ); + } + + + FT_LOCAL_DEF( FT_Error ) + cf2_getT1SeacComponent( PS_Decoder* decoder, + FT_UInt glyph_index, + CF2_Buffer buf ) + { + FT_Data glyph_data; + FT_Error error = FT_Err_Ok; + T1_Face face = (T1_Face)decoder->builder.face; + T1_Font type1 = &face->type1; + +#ifdef FT_CONFIG_OPTION_INCREMENTAL + FT_Incremental_InterfaceRec *inc = + face->root.internal->incremental_interface; + + + /* For incremental fonts get the character data using the */ + /* callback function. */ + if ( inc ) + error = inc->funcs->get_glyph_data( inc->object, + glyph_index, &glyph_data ); + else +#endif + /* For ordinary fonts get the character data stored in the face record. */ + { + glyph_data.pointer = type1->charstrings[glyph_index]; + glyph_data.length = (FT_Int)type1->charstrings_len[glyph_index]; + } + + if ( !error ) + { + FT_Byte* charstring_base = (FT_Byte*)glyph_data.pointer; + FT_ULong charstring_len = (FT_ULong)glyph_data.length; + + + FT_ASSERT( charstring_base + charstring_len >= charstring_base ); + + FT_ZERO( buf ); + buf->start = + buf->ptr = charstring_base; + buf->end = charstring_base + charstring_len; + } + + return error; + } + + + FT_LOCAL_DEF( void ) + cf2_freeT1SeacComponent( PS_Decoder* decoder, + CF2_Buffer buf ) { + T1_Face face; + FT_Data data; + + FT_ASSERT( decoder ); - cff_free_glyph_data( decoder->builder.face, - (FT_Byte**)&buf->start, - (FT_ULong)( buf->end - buf->start ) ); +#ifdef FT_CONFIG_OPTION_INCREMENTAL + face = (T1_Face)decoder->builder.face; + + data.pointer = buf->start; + data.length = (FT_Int)( buf->end - buf->start ); + + if ( face->root.internal->incremental_interface ) + face->root.internal->incremental_interface->funcs->free_glyph_data( + face->root.internal->incremental_interface->object, + &data ); +#endif /* FT_CONFIG_OPTION_INCREMENTAL */ } FT_LOCAL_DEF( CF2_Int ) - cf2_initLocalRegionBuffer( CFF_Decoder* decoder, - CF2_Int subrNum, - CF2_Buffer buf ) + cf2_initLocalRegionBuffer( PS_Decoder* decoder, + CF2_Int subrNum, + CF2_Buffer buf ) { CF2_UInt idx; @@ -696,16 +805,42 @@ FT_ASSERT( decoder->locals ); - buf->start = - buf->ptr = decoder->locals[idx]; - buf->end = decoder->locals[idx + 1]; + buf->start = decoder->locals[idx]; + + if ( decoder->builder.is_t1 ) + { + /* The Type 1 driver stores subroutines without the seed bytes. */ + /* The CID driver stores subroutines with seed bytes. This */ + /* case is taken care of when decoder->subrs_len == 0. */ + if ( decoder->locals_len ) + buf->end = buf->start + decoder->locals_len[idx]; + else + { + /* We are using subroutines from a CID font. We must adjust */ + /* for the seed bytes. */ + buf->start += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 ); + buf->end = decoder->locals[idx + 1]; + } + + if ( !buf->start ) + { + FT_ERROR(( "cf2_initLocalRegionBuffer (Type 1 mode):" + " invoking empty subrs\n" )); + } + } + else + { + buf->end = decoder->locals[idx + 1]; + } + + buf->ptr = buf->start; return FALSE; /* success */ } FT_LOCAL_DEF( CF2_Fixed ) - cf2_getDefaultWidthX( CFF_Decoder* decoder ) + cf2_getDefaultWidthX( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -715,7 +850,7 @@ FT_LOCAL_DEF( CF2_Fixed ) - cf2_getNominalWidthX( CFF_Decoder* decoder ) + cf2_getNominalWidthX( PS_Decoder* decoder ) { FT_ASSERT( decoder && decoder->current_subfont ); @@ -727,7 +862,7 @@ FT_LOCAL_DEF( void ) cf2_outline_reset( CF2_Outline outline ) { - CFF_Decoder* decoder = outline->decoder; + PS_Decoder* decoder = outline->decoder; FT_ASSERT( decoder ); @@ -741,12 +876,12 @@ FT_LOCAL_DEF( void ) cf2_outline_close( CF2_Outline outline ) { - CFF_Decoder* decoder = outline->decoder; + PS_Decoder* decoder = outline->decoder; FT_ASSERT( decoder ); - cff_builder_close_contour( &decoder->builder ); + ps_builder_close_contour( &decoder->builder ); FT_GlyphLoader_Add( decoder->builder.loader ); } diff --git a/src/cff/cf2ft.h b/src/psaux/psft.h similarity index 60% rename from src/cff/cf2ft.h rename to src/psaux/psft.h index b054a6e95..ab172110b 100644 --- a/src/cff/cf2ft.h +++ b/src/psaux/psft.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2ft.h */ +/* psft.h */ /* */ /* FreeType Glue Component to Adobe's Interpreter (specification). */ /* */ @@ -36,11 +36,11 @@ /***************************************************************************/ -#ifndef CF2FT_H_ -#define CF2FT_H_ +#ifndef PSFT_H_ +#define PSFT_H_ -#include "cf2types.h" +#include "pstypes.h" /* TODO: disable asserts for now */ @@ -49,88 +49,96 @@ #include FT_SYSTEM_H -#include "cf2glue.h" -#include "cffgload.h" /* for CFF_Decoder */ +#include "psglue.h" +#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for PS_Decoder */ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) - cf2_decoder_parse_charstrings( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len ); + cf2_decoder_parse_charstrings( PS_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len ); FT_LOCAL( CFF_SubFont ) - cf2_getSubfont( CFF_Decoder* decoder ); + cf2_getSubfont( PS_Decoder* decoder ); FT_LOCAL( CFF_VStore ) - cf2_getVStore( CFF_Decoder* decoder ); + cf2_getVStore( PS_Decoder* decoder ); FT_LOCAL( FT_UInt ) - cf2_getMaxstack( CFF_Decoder* decoder ); + cf2_getMaxstack( PS_Decoder* decoder ); #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_LOCAL( FT_Error ) - cf2_getNormalizedVector( CFF_Decoder* decoder, - CF2_UInt *len, - FT_Fixed* *vec ); + cf2_getNormalizedVector( PS_Decoder* decoder, + CF2_UInt *len, + FT_Fixed* *vec ); #endif FT_LOCAL( CF2_Fixed ) - cf2_getPpemY( CFF_Decoder* decoder ); + cf2_getPpemY( PS_Decoder* decoder ); FT_LOCAL( CF2_Fixed ) - cf2_getStdVW( CFF_Decoder* decoder ); + cf2_getStdVW( PS_Decoder* decoder ); FT_LOCAL( CF2_Fixed ) - cf2_getStdHW( CFF_Decoder* decoder ); + cf2_getStdHW( PS_Decoder* decoder ); FT_LOCAL( void ) - cf2_getBlueMetrics( CFF_Decoder* decoder, - CF2_Fixed* blueScale, - CF2_Fixed* blueShift, - CF2_Fixed* blueFuzz ); + cf2_getBlueMetrics( PS_Decoder* decoder, + CF2_Fixed* blueScale, + CF2_Fixed* blueShift, + CF2_Fixed* blueFuzz ); FT_LOCAL( void ) - cf2_getBlueValues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); + cf2_getBlueValues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ); FT_LOCAL( void ) - cf2_getOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); + cf2_getOtherBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ); FT_LOCAL( void ) - cf2_getFamilyBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); + cf2_getFamilyBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ); FT_LOCAL( void ) - cf2_getFamilyOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); + cf2_getFamilyOtherBlues( PS_Decoder* decoder, + size_t* count, + FT_Pos* *data ); FT_LOCAL( CF2_Int ) - cf2_getLanguageGroup( CFF_Decoder* decoder ); + cf2_getLanguageGroup( PS_Decoder* decoder ); FT_LOCAL( CF2_Int ) - cf2_initGlobalRegionBuffer( CFF_Decoder* decoder, - CF2_Int subrNum, - CF2_Buffer buf ); + cf2_initGlobalRegionBuffer( PS_Decoder* decoder, + CF2_Int subrNum, + CF2_Buffer buf ); FT_LOCAL( FT_Error ) - cf2_getSeacComponent( CFF_Decoder* decoder, - CF2_Int code, - CF2_Buffer buf ); + cf2_getSeacComponent( PS_Decoder* decoder, + CF2_Int code, + CF2_Buffer buf ); FT_LOCAL( void ) - cf2_freeSeacComponent( CFF_Decoder* decoder, - CF2_Buffer buf ); + cf2_freeSeacComponent( PS_Decoder* decoder, + CF2_Buffer buf ); FT_LOCAL( CF2_Int ) - cf2_initLocalRegionBuffer( CFF_Decoder* decoder, - CF2_Int subrNum, - CF2_Buffer buf ); + cf2_initLocalRegionBuffer( PS_Decoder* decoder, + CF2_Int subrNum, + CF2_Buffer buf ); FT_LOCAL( CF2_Fixed ) - cf2_getDefaultWidthX( CFF_Decoder* decoder ); + cf2_getDefaultWidthX( PS_Decoder* decoder ); FT_LOCAL( CF2_Fixed ) - cf2_getNominalWidthX( CFF_Decoder* decoder ); + cf2_getNominalWidthX( PS_Decoder* decoder ); + FT_LOCAL( FT_Error ) + cf2_getT1SeacComponent( PS_Decoder* decoder, + FT_UInt glyph_index, + CF2_Buffer buf ); + FT_LOCAL( void ) + cf2_freeT1SeacComponent( PS_Decoder* decoder, + CF2_Buffer buf ); + /* * FreeType client outline * @@ -139,7 +147,7 @@ FT_BEGIN_HEADER typedef struct CF2_OutlineRec_ { CF2_OutlineCallbacksRec root; /* base class must be first */ - CFF_Decoder* decoder; + PS_Decoder* decoder; } CF2_OutlineRec, *CF2_Outline; @@ -153,7 +161,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2FT_H_ */ +#endif /* PSFT_H_ */ /* END */ diff --git a/src/cff/cf2glue.h b/src/psaux/psglue.h similarity index 96% rename from src/cff/cf2glue.h rename to src/psaux/psglue.h index 56a7c248f..5545e12a5 100644 --- a/src/cff/cf2glue.h +++ b/src/psaux/psglue.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2glue.h */ +/* psglue.h */ /* */ /* Adobe's code for shared stuff (specification only). */ /* */ @@ -36,15 +36,15 @@ /***************************************************************************/ -#ifndef CF2GLUE_H_ -#define CF2GLUE_H_ +#ifndef PSGLUE_H_ +#define PSGLUE_H_ /* common includes for other modules */ -#include "cf2error.h" -#include "cf2fixed.h" -#include "cf2arrst.h" -#include "cf2read.h" +#include "pserror.h" +#include "psfixed.h" +#include "psarrst.h" +#include "psread.h" FT_BEGIN_HEADER @@ -138,7 +138,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2GLUE_H_ */ +#endif /* PSGLUE_H_ */ /* END */ diff --git a/src/cff/cf2hints.c b/src/psaux/pshints.c similarity index 86% rename from src/cff/cf2hints.c rename to src/psaux/pshints.c index c8f7dfeba..361519642 100644 --- a/src/cff/cf2hints.c +++ b/src/psaux/pshints.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2hints.c */ +/* pshints.c */ /* */ /* Adobe's code for handling CFF hints (body). */ /* */ @@ -36,13 +36,13 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2hints.h" -#include "cf2intrp.h" +#include "psglue.h" +#include "psfont.h" +#include "pshints.h" +#include "psintrp.h" /*************************************************************************/ @@ -74,8 +74,8 @@ /* cross product of pt1 position from origin with pt2 position from */ /* pt1; we reduce the precision so that the result fits into 32 bits */ - return ( x1 >> 16 ) * ( ( y2 - y1 ) >> 16 ) - - ( y1 >> 16 ) * ( ( x2 - x1 ) >> 16 ); + return ( x1 >> 16 ) * ( SUB_INT32( y2, y1 ) >> 16 ) - + ( y1 >> 16 ) * ( SUB_INT32( x2, x1 ) >> 16 ); } @@ -105,7 +105,7 @@ stemHintArray, indexStemHint ); - width = stemHint->max - stemHint->min; + width = SUB_INT32( stemHint->max, stemHint->min ); if ( width == cf2_intToFixed( -21 ) ) { @@ -185,11 +185,11 @@ /* darkening. Bottoms are not changed; tops are incremented by twice */ /* `darkenY'. */ if ( cf2_hint_isTop( hint ) ) - hint->csCoord += 2 * font->darkenY; + hint->csCoord = ADD_INT32( hint->csCoord, 2 * font->darkenY ); - hint->csCoord += hintOrigin; - hint->scale = scale; - hint->index = indexStemHint; /* index in original stem hint array */ + hint->csCoord = ADD_INT32( hint->csCoord, hintOrigin ); + hint->scale = scale; + hint->index = indexStemHint; /* index in original stem hint array */ /* if original stem hint has been used, use the same position */ if ( hint->flags != 0 && stemHint->used ) @@ -299,6 +299,36 @@ } + static void + cf2_hintmap_dump( CF2_HintMap hintmap ) + { +#ifdef FT_DEBUG_LEVEL_TRACE + CF2_UInt i; + + + FT_TRACE6(( " index csCoord dsCoord scale flags\n" )); + + for ( i = 0; i < hintmap->count; i++ ) + { + CF2_Hint hint = &hintmap->edge[i]; + + + FT_TRACE6(( " %3d %7.2f %7.2f %5d %s%s%s%s\n", + hint->index, + hint->csCoord / 65536.0, + hint->dsCoord / ( hint->scale * 1.0 ), + hint->scale, + ( cf2_hint_isPair( hint ) ? "p" : "g" ), + ( cf2_hint_isTop( hint ) ? "t" : "b" ), + ( cf2_hint_isLocked( hint ) ? "L" : ""), + ( cf2_hint_isSynthetic( hint ) ? "S" : "" ) )); + } +#else + FT_UNUSED( hintmap ); +#endif + } + + /* transform character space coordinate to device space using hint map */ static CF2_Fixed cf2_hintmap_map( CF2_HintMap hintmap, @@ -314,6 +344,7 @@ /* start linear search from last hit */ CF2_UInt i = hintmap->lastIndex; + FT_ASSERT( hintmap->lastIndex < CF2_MAX_HINT_EDGES ); /* search up */ @@ -330,9 +361,10 @@ if ( i == 0 && csCoord < hintmap->edge[0].csCoord ) { /* special case for points below first edge: use uniform scale */ - return FT_MulFix( csCoord - hintmap->edge[0].csCoord, - hintmap->scale ) + - hintmap->edge[0].dsCoord; + return ADD_INT32( FT_MulFix( SUB_INT32( csCoord, + hintmap->edge[0].csCoord ), + hintmap->scale ), + hintmap->edge[0].dsCoord ); } else { @@ -340,9 +372,10 @@ * Note: entries with duplicate csCoord are allowed. * Use edge[i], the highest entry where csCoord >= entry[i].csCoord */ - return FT_MulFix( csCoord - hintmap->edge[i].csCoord, - hintmap->edge[i].scale ) + - hintmap->edge[i].dsCoord; + return ADD_INT32( FT_MulFix( SUB_INT32( csCoord, + hintmap->edge[i].csCoord ), + hintmap->edge[i].scale ), + hintmap->edge[i].dsCoord ); } } } @@ -437,14 +470,16 @@ /* is there room to move up? */ /* there is if we are at top of array or the next edge is at or */ /* beyond proposed move up? */ - if ( j >= hintmap->count - 1 || + if ( j >= hintmap->count - 1 || hintmap->edge[j + 1].dsCoord >= - hintmap->edge[j].dsCoord + moveUp + upMinCounter ) + ADD_INT32( hintmap->edge[j].dsCoord, + moveUp + upMinCounter ) ) { /* there is room to move up; is there also room to move down? */ - if ( i == 0 || + if ( i == 0 || hintmap->edge[i - 1].dsCoord <= - hintmap->edge[i].dsCoord + moveDown - downMinCounter ) + ADD_INT32( hintmap->edge[i].dsCoord, + moveDown - downMinCounter ) ) { /* move smaller absolute amount */ move = ( -moveDown < moveUp ) ? moveDown : moveUp; /* optimum */ @@ -455,9 +490,10 @@ else { /* is there room to move down? */ - if ( i == 0 || + if ( i == 0 || hintmap->edge[i - 1].dsCoord <= - hintmap->edge[i].dsCoord + moveDown - downMinCounter ) + ADD_INT32( hintmap->edge[i].dsCoord, + moveDown - downMinCounter ) ) { move = moveDown; /* true if non-optimum move */ @@ -491,9 +527,11 @@ } /* move the edge(s) */ - hintmap->edge[i].dsCoord += move; + hintmap->edge[i].dsCoord = ADD_INT32( hintmap->edge[i].dsCoord, + move ); if ( isPair ) - hintmap->edge[j].dsCoord += move; + hintmap->edge[j].dsCoord = ADD_INT32( hintmap->edge[j].dsCoord, + move ); } /* assert there are no overlaps in device space */ @@ -507,18 +545,20 @@ { if ( hintmap->edge[i].csCoord != hintmap->edge[i - 1].csCoord ) hintmap->edge[i - 1].scale = - FT_DivFix( - hintmap->edge[i].dsCoord - hintmap->edge[i - 1].dsCoord, - hintmap->edge[i].csCoord - hintmap->edge[i - 1].csCoord ); + FT_DivFix( SUB_INT32( hintmap->edge[i].dsCoord, + hintmap->edge[i - 1].dsCoord ), + SUB_INT32( hintmap->edge[i].csCoord, + hintmap->edge[i - 1].csCoord ) ); } if ( isPair ) { if ( hintmap->edge[j].csCoord != hintmap->edge[j - 1].csCoord ) hintmap->edge[j - 1].scale = - FT_DivFix( - hintmap->edge[j].dsCoord - hintmap->edge[j - 1].dsCoord, - hintmap->edge[j].csCoord - hintmap->edge[j - 1].csCoord ); + FT_DivFix( SUB_INT32( hintmap->edge[j].dsCoord, + hintmap->edge[j - 1].dsCoord ), + SUB_INT32( hintmap->edge[j].csCoord, + hintmap->edge[j - 1].csCoord ) ); i += 1; /* skip upper edge on next loop */ } @@ -539,15 +579,18 @@ /* is there room to move up? */ if ( hintmap->edge[j + 1].dsCoord >= - hintmap->edge[j].dsCoord + hintMove->moveUp + CF2_MIN_COUNTER ) + ADD_INT32( hintmap->edge[j].dsCoord, + hintMove->moveUp + CF2_MIN_COUNTER ) ) { /* there is more room now, move edge up */ - hintmap->edge[j].dsCoord += hintMove->moveUp; + hintmap->edge[j].dsCoord = ADD_INT32( hintmap->edge[j].dsCoord, + hintMove->moveUp ); if ( cf2_hint_isPair( &hintmap->edge[j] ) ) { FT_ASSERT( j > 0 ); - hintmap->edge[j - 1].dsCoord += hintMove->moveUp; + hintmap->edge[j - 1].dsCoord = + ADD_INT32( hintmap->edge[j - 1].dsCoord, hintMove->moveUp ); } } } @@ -599,6 +642,14 @@ break; } + FT_TRACE7(( " Got hint at %.2f (%.2f)\n", + firstHintEdge->csCoord / 65536.0, + firstHintEdge->dsCoord / 65536.0 )); + if ( isPair ) + FT_TRACE7(( " Got hint at %.2f (%.2f)\n", + secondHintEdge->csCoord / 65536.0, + secondHintEdge->dsCoord / 65536.0 )); + /* * Discard any hints that overlap in character space. Most often, this * is while building the initial map, where captured hints from all @@ -635,18 +686,19 @@ { /* Use hint map to position the center of stem, and nominal scale */ /* to position the two edges. This preserves the stem width. */ - CF2_Fixed midpoint = cf2_hintmap_map( - hintmap->initialHintMap, - ( secondHintEdge->csCoord + - firstHintEdge->csCoord ) / 2 ); - CF2_Fixed halfWidth = FT_MulFix( - ( secondHintEdge->csCoord - - firstHintEdge->csCoord ) / 2, - hintmap->scale ); - - - firstHintEdge->dsCoord = midpoint - halfWidth; - secondHintEdge->dsCoord = midpoint + halfWidth; + CF2_Fixed midpoint = + cf2_hintmap_map( + hintmap->initialHintMap, + ADD_INT32( secondHintEdge->csCoord, + firstHintEdge->csCoord ) / 2 ); + CF2_Fixed halfWidth = + FT_MulFix( SUB_INT32( secondHintEdge->csCoord, + firstHintEdge->csCoord ) / 2, + hintmap->scale ); + + + firstHintEdge->dsCoord = SUB_INT32( midpoint, halfWidth ); + secondHintEdge->dsCoord = ADD_INT32( midpoint, halfWidth ); } else firstHintEdge->dsCoord = cf2_hintmap_map( hintmap->initialHintMap, @@ -715,13 +767,22 @@ /* insert first edge */ hintmap->edge[indexInsert] = *firstHintEdge; /* copy struct */ - hintmap->count += 1; + hintmap->count += 1; + + FT_TRACE7(( " Inserting hint %.2f (%.2f)\n", + firstHintEdge->csCoord / 65536.0, + firstHintEdge->dsCoord / 65536.0 )); if ( isPair ) { /* insert second edge */ hintmap->edge[indexInsert + 1] = *secondHintEdge; /* copy struct */ hintmap->count += 1; + + FT_TRACE7(( " Inserting hint %.2f (%.2f)\n", + secondHintEdge->csCoord / 65536.0, + secondHintEdge->dsCoord / 65536.0 )); + } } @@ -781,7 +842,15 @@ cf2_arrstack_size( hStemHintArray ) + cf2_arrstack_size( vStemHintArray ) ); if ( !cf2_hintmask_isValid( hintMask ) ) - return; /* too many stem hints */ + { + if ( font->isT1 ) + { + /* no error, just continue unhinted */ + *hintMask->error = FT_Err_Ok; + hintmap->hinted = FALSE; + } + return; /* too many stem hints */ + } } /* begin by clearing the map */ @@ -797,7 +866,7 @@ /* Defense-in-depth. Should never return here. */ if ( bitCount > hintMask->bitCount ) - return; + return; /* synthetic embox hints get highest priority */ if ( font->blues.doEmBoxHints ) @@ -956,6 +1025,12 @@ } } + FT_TRACE6(( initialMap ? "flags: [p]air [g]host [t]op " + "[b]ottom [L]ocked [S]ynthetic\n" + "Initial hintmap\n" + : "Hints:\n" )); + cf2_hintmap_dump( hintmap ); + /* * Note: The following line is a convenient place to break when * debugging hinting. Examine `hintmap->edge' for the list of @@ -968,6 +1043,9 @@ /* adjust positions of hint edges that are not locked to blue zones */ cf2_hintmap_adjustHints( hintmap ); + FT_TRACE6(( "(adjusted)\n" )); + cf2_hintmap_dump( hintmap ); + /* save the position of all hints that were used in this hint map; */ /* if we use them again, we'll locate them in the same position */ if ( !initialMap ) @@ -1063,7 +1141,7 @@ cf2_fixedAbs( glyphpath->yOffset ) ); /* .1 character space unit */ - glyphpath->snapThreshold = cf2_floatToFixed( 0.1f ); + glyphpath->snapThreshold = cf2_doubleToFixed( 0.1 ); glyphpath->moveIsPending = TRUE; glyphpath->pathIsOpen = FALSE; @@ -1095,16 +1173,20 @@ FT_Vector pt; /* hinted point in upright DS */ - pt.x = FT_MulFix( glyphpath->scaleX, x ) + - FT_MulFix( glyphpath->scaleC, y ); + pt.x = ADD_INT32( FT_MulFix( glyphpath->scaleX, x ), + FT_MulFix( glyphpath->scaleC, y ) ); pt.y = cf2_hintmap_map( hintmap, y ); - ppt->x = FT_MulFix( glyphpath->font->outerTransform.a, pt.x ) + - FT_MulFix( glyphpath->font->outerTransform.c, pt.y ) + - glyphpath->fractionalTranslation.x; - ppt->y = FT_MulFix( glyphpath->font->outerTransform.b, pt.x ) + - FT_MulFix( glyphpath->font->outerTransform.d, pt.y ) + - glyphpath->fractionalTranslation.y; + ppt->x = ADD_INT32( + FT_MulFix( glyphpath->font->outerTransform.a, pt.x ), + ADD_INT32( + FT_MulFix( glyphpath->font->outerTransform.c, pt.y ), + glyphpath->fractionalTranslation.x ) ); + ppt->y = ADD_INT32( + FT_MulFix( glyphpath->font->outerTransform.b, pt.x ), + ADD_INT32( + FT_MulFix( glyphpath->font->outerTransform.d, pt.y ), + glyphpath->fractionalTranslation.y ) ); } @@ -1128,7 +1210,7 @@ * second segment. * Let `w 'be the zero-based vector from `u1' to `v1'. * `perp' is the `perpendicular dot product'; see - * http://mathworld.wolfram.com/PerpDotProduct.html. + * https://mathworld.wolfram.com/PerpDotProduct.html. * `s' is the parameter for the parametric line for the first segment * (`u'). * @@ -1154,12 +1236,12 @@ CF2_Fixed denominator, s; - u.x = CF2_CS_SCALE( u2->x - u1->x ); - u.y = CF2_CS_SCALE( u2->y - u1->y ); - v.x = CF2_CS_SCALE( v2->x - v1->x ); - v.y = CF2_CS_SCALE( v2->y - v1->y ); - w.x = CF2_CS_SCALE( v1->x - u1->x ); - w.y = CF2_CS_SCALE( v1->y - u1->y ); + u.x = CF2_CS_SCALE( SUB_INT32( u2->x, u1->x ) ); + u.y = CF2_CS_SCALE( SUB_INT32( u2->y, u1->y ) ); + v.x = CF2_CS_SCALE( SUB_INT32( v2->x, v1->x ) ); + v.y = CF2_CS_SCALE( SUB_INT32( v2->y, v1->y ) ); + w.x = CF2_CS_SCALE( SUB_INT32( v1->x, u1->x ) ); + w.y = CF2_CS_SCALE( SUB_INT32( v1->y, u1->y ) ); denominator = cf2_perp( u, v ); @@ -1168,8 +1250,11 @@ s = FT_DivFix( cf2_perp( w, v ), denominator ); - intersection->x = u1->x + FT_MulFix( s, u2->x - u1->x ); - intersection->y = u1->y + FT_MulFix( s, u2->y - u1->y ); + intersection->x = ADD_INT32( u1->x, + FT_MulFix( s, SUB_INT32( u2->x, u1->x ) ) ); + intersection->y = ADD_INT32( u1->y, + FT_MulFix( s, SUB_INT32( u2->y, u1->y ) ) ); + /* * Special case snapping for horizontal and vertical lines. @@ -1180,25 +1265,29 @@ * */ - if ( u1->x == u2->x && - cf2_fixedAbs( intersection->x - u1->x ) < glyphpath->snapThreshold ) + if ( u1->x == u2->x && + cf2_fixedAbs( SUB_INT32( intersection->x, + u1->x ) ) < glyphpath->snapThreshold ) intersection->x = u1->x; - if ( u1->y == u2->y && - cf2_fixedAbs( intersection->y - u1->y ) < glyphpath->snapThreshold ) + if ( u1->y == u2->y && + cf2_fixedAbs( SUB_INT32( intersection->y, + u1->y ) ) < glyphpath->snapThreshold ) intersection->y = u1->y; - if ( v1->x == v2->x && - cf2_fixedAbs( intersection->x - v1->x ) < glyphpath->snapThreshold ) + if ( v1->x == v2->x && + cf2_fixedAbs( SUB_INT32( intersection->x, + v1->x ) ) < glyphpath->snapThreshold ) intersection->x = v1->x; - if ( v1->y == v2->y && - cf2_fixedAbs( intersection->y - v1->y ) < glyphpath->snapThreshold ) + if ( v1->y == v2->y && + cf2_fixedAbs( SUB_INT32( intersection->y, + v1->y ) ) < glyphpath->snapThreshold ) intersection->y = v1->y; /* limit the intersection distance from midpoint of u2 and v1 */ - if ( cf2_fixedAbs( intersection->x - ( u2->x + v1->x ) / 2 ) > - glyphpath->miterLimit || - cf2_fixedAbs( intersection->y - ( u2->y + v1->y ) / 2 ) > - glyphpath->miterLimit ) + if ( cf2_fixedAbs( intersection->x - ADD_INT32( u2->x, v1->x ) / 2 ) > + glyphpath->miterLimit || + cf2_fixedAbs( intersection->y - ADD_INT32( u2->y, v1->y ) / 2 ) > + glyphpath->miterLimit ) return FALSE; return TRUE; @@ -1446,16 +1535,16 @@ CF2_Fixed* x, CF2_Fixed* y ) { - CF2_Fixed dx = x2 - x1; - CF2_Fixed dy = y2 - y1; + CF2_Fixed dx = SUB_INT32( x2, x1 ); + CF2_Fixed dy = SUB_INT32( y2, y1 ); /* note: negative offsets don't work here; negate deltas to change */ /* quadrants, below */ if ( glyphpath->font->reverseWinding ) { - dx = -dx; - dy = -dy; + dx = NEG_INT32( dx ); + dy = NEG_INT32( dy ); } *x = *y = 0; @@ -1464,8 +1553,9 @@ return; /* add momentum for this path element */ - glyphpath->callbacks->windingMomentum += - cf2_getWindingMomentum( x1, y1, x2, y2 ); + glyphpath->callbacks->windingMomentum = + ADD_INT32( glyphpath->callbacks->windingMomentum, + cf2_getWindingMomentum( x1, y1, x2, y2 ) ); /* note: allow mixed integer and fixed multiplication here */ if ( dx >= 0 ) @@ -1474,13 +1564,13 @@ { /* first quadrant, +x +y */ - if ( dx > 2 * dy ) + if ( dx > MUL_INT32( 2, dy ) ) { /* +x */ *x = 0; *y = 0; } - else if ( dy > 2 * dx ) + else if ( dy > MUL_INT32( 2, dx ) ) { /* +y */ *x = glyphpath->xOffset; @@ -1489,9 +1579,9 @@ else { /* +x +y */ - *x = FT_MulFix( cf2_floatToFixed( 0.7 ), + *x = FT_MulFix( cf2_doubleToFixed( 0.7 ), glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ), + *y = FT_MulFix( cf2_doubleToFixed( 1.0 - 0.7 ), glyphpath->yOffset ); } } @@ -1499,24 +1589,24 @@ { /* fourth quadrant, +x -y */ - if ( dx > -2 * dy ) + if ( dx > MUL_INT32( -2, dy ) ) { /* +x */ *x = 0; *y = 0; } - else if ( -dy > 2 * dx ) + else if ( NEG_INT32( dy ) > MUL_INT32( 2, dx ) ) { /* -y */ - *x = -glyphpath->xOffset; + *x = NEG_INT32( glyphpath->xOffset ); *y = glyphpath->yOffset; } else { /* +x -y */ - *x = FT_MulFix( cf2_floatToFixed( -0.7 ), + *x = FT_MulFix( cf2_doubleToFixed( -0.7 ), glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ), + *y = FT_MulFix( cf2_doubleToFixed( 1.0 - 0.7 ), glyphpath->yOffset ); } } @@ -1527,13 +1617,13 @@ { /* second quadrant, -x +y */ - if ( -dx > 2 * dy ) + if ( NEG_INT32( dx ) > MUL_INT32( 2, dy ) ) { /* -x */ *x = 0; - *y = 2 * glyphpath->yOffset; + *y = MUL_INT32( 2, glyphpath->yOffset ); } - else if ( dy > -2 * dx ) + else if ( dy > MUL_INT32( -2, dx ) ) { /* +y */ *x = glyphpath->xOffset; @@ -1542,9 +1632,9 @@ else { /* -x +y */ - *x = FT_MulFix( cf2_floatToFixed( 0.7 ), + *x = FT_MulFix( cf2_doubleToFixed( 0.7 ), glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ), + *y = FT_MulFix( cf2_doubleToFixed( 1.0 + 0.7 ), glyphpath->yOffset ); } } @@ -1552,24 +1642,24 @@ { /* third quadrant, -x -y */ - if ( -dx > -2 * dy ) + if ( NEG_INT32( dx ) > MUL_INT32( -2, dy ) ) { /* -x */ *x = 0; - *y = 2 * glyphpath->yOffset; + *y = MUL_INT32( 2, glyphpath->yOffset ); } - else if ( -dy > -2 * dx ) + else if ( NEG_INT32( dy ) > MUL_INT32( -2, dx ) ) { /* -y */ - *x = -glyphpath->xOffset; + *x = NEG_INT32( glyphpath->xOffset ); *y = glyphpath->yOffset; } else { /* -x -y */ - *x = FT_MulFix( cf2_floatToFixed( -0.7 ), + *x = FT_MulFix( cf2_doubleToFixed( -0.7 ), glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ), + *y = FT_MulFix( cf2_doubleToFixed( 1.0 + 0.7 ), glyphpath->yOffset ); } } @@ -1675,10 +1765,10 @@ &yOffset ); /* construct offset points */ - P0.x = glyphpath->currentCS.x + xOffset; - P0.y = glyphpath->currentCS.y + yOffset; - P1.x = x + xOffset; - P1.y = y + yOffset; + P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset ); + P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset ); + P1.x = ADD_INT32( x, xOffset ); + P1.y = ADD_INT32( y, yOffset ); if ( glyphpath->moveIsPending ) { @@ -1753,19 +1843,20 @@ &yOffset3 ); /* add momentum from the middle segment */ - glyphpath->callbacks->windingMomentum += - cf2_getWindingMomentum( x1, y1, x2, y2 ); + glyphpath->callbacks->windingMomentum = + ADD_INT32( glyphpath->callbacks->windingMomentum, + cf2_getWindingMomentum( x1, y1, x2, y2 ) ); /* construct offset points */ - P0.x = glyphpath->currentCS.x + xOffset1; - P0.y = glyphpath->currentCS.y + yOffset1; - P1.x = x1 + xOffset1; - P1.y = y1 + yOffset1; + P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset1 ); + P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset1 ); + P1.x = ADD_INT32( x1, xOffset1 ); + P1.y = ADD_INT32( y1, yOffset1 ); /* note: preserve angle of final segment by using offset3 at both ends */ - P2.x = x2 + xOffset3; - P2.y = y2 + yOffset3; - P3.x = x3 + xOffset3; - P3.y = y3 + yOffset3; + P2.x = ADD_INT32( x2, xOffset3 ); + P2.y = ADD_INT32( y2, yOffset3 ); + P3.x = ADD_INT32( x3, xOffset3 ); + P3.y = ADD_INT32( y3, yOffset3 ); if ( glyphpath->moveIsPending ) { diff --git a/src/cff/cf2hints.h b/src/psaux/pshints.h similarity index 98% rename from src/cff/cf2hints.h rename to src/psaux/pshints.h index a8984542a..92e37e98a 100644 --- a/src/cff/cf2hints.h +++ b/src/psaux/pshints.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2hints.h */ +/* pshints.h */ /* */ /* Adobe's code for handling CFF hints (body). */ /* */ @@ -36,9 +36,8 @@ /***************************************************************************/ -#ifndef CF2HINTS_H_ -#define CF2HINTS_H_ - +#ifndef PSHINT_H_ +#define PSHINT_H_ FT_BEGIN_HEADER @@ -283,7 +282,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2HINTS_H_ */ +#endif /* PSHINT_H_ */ /* END */ diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c new file mode 100644 index 000000000..da5a8dad1 --- /dev/null +++ b/src/psaux/psintrp.c @@ -0,0 +1,3040 @@ +/***************************************************************************/ +/* */ +/* psintrp.c */ +/* */ +/* Adobe's CFF Interpreter (body). */ +/* */ +/* Copyright 2007-2014 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#include "psft.h" +#include FT_INTERNAL_DEBUG_H +#include FT_SERVICE_CFF_TABLE_LOAD_H + +#include "psglue.h" +#include "psfont.h" +#include "psstack.h" +#include "pshints.h" +#include "psintrp.h" + +#include "pserror.h" + +#include "psobjs.h" /* for cff_random */ +#include "t1decode.h" /* for t1 seac */ + + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_cf2interp + + + FT_LOCAL_DEF( void ) + cf2_hintmask_init( CF2_HintMask hintmask, + FT_Error* error ) + { + FT_ZERO( hintmask ); + + hintmask->error = error; + } + + + FT_LOCAL_DEF( FT_Bool ) + cf2_hintmask_isValid( const CF2_HintMask hintmask ) + { + return hintmask->isValid; + } + + + FT_LOCAL_DEF( FT_Bool ) + cf2_hintmask_isNew( const CF2_HintMask hintmask ) + { + return hintmask->isNew; + } + + + FT_LOCAL_DEF( void ) + cf2_hintmask_setNew( CF2_HintMask hintmask, + FT_Bool val ) + { + hintmask->isNew = val; + } + + + /* clients call `getMaskPtr' in order to iterate */ + /* through hint mask */ + + FT_LOCAL_DEF( FT_Byte* ) + cf2_hintmask_getMaskPtr( CF2_HintMask hintmask ) + { + return hintmask->mask; + } + + + static size_t + cf2_hintmask_setCounts( CF2_HintMask hintmask, + size_t bitCount ) + { + if ( bitCount > CF2_MAX_HINTS ) + { + /* total of h and v stems must be <= 96 */ + CF2_SET_ERROR( hintmask->error, Invalid_Glyph_Format ); + return 0; + } + + hintmask->bitCount = bitCount; + hintmask->byteCount = ( hintmask->bitCount + 7 ) / 8; + + hintmask->isValid = TRUE; + hintmask->isNew = TRUE; + + return bitCount; + } + + + /* consume the hintmask bytes from the charstring, advancing the src */ + /* pointer */ + static void + cf2_hintmask_read( CF2_HintMask hintmask, + CF2_Buffer charstring, + size_t bitCount ) + { + size_t i; + +#ifndef CF2_NDEBUG + /* these are the bits in the final mask byte that should be zero */ + /* Note: this variable is only used in an assert expression below */ + /* and then only if CF2_NDEBUG is not defined */ + CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1; +#endif + + + /* initialize counts and isValid */ + if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 ) + return; + + FT_ASSERT( hintmask->byteCount > 0 ); + + FT_TRACE4(( " (maskbytes:" )); + + /* set mask and advance interpreter's charstring pointer */ + for ( i = 0; i < hintmask->byteCount; i++ ) + { + hintmask->mask[i] = (FT_Byte)cf2_buf_readByte( charstring ); + FT_TRACE4(( " 0x%02X", hintmask->mask[i] )); + } + + FT_TRACE4(( ")\n" )); + + /* assert any unused bits in last byte are zero unless there's a prior */ + /* error */ + /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */ +#ifndef CF2_NDEBUG + FT_ASSERT( ( hintmask->mask[hintmask->byteCount - 1] & mask ) == 0 || + *hintmask->error ); +#endif + } + + + FT_LOCAL_DEF( void ) + cf2_hintmask_setAll( CF2_HintMask hintmask, + size_t bitCount ) + { + size_t i; + CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1; + + + /* initialize counts and isValid */ + if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 ) + return; + + FT_ASSERT( hintmask->byteCount > 0 ); + FT_ASSERT( hintmask->byteCount <= + sizeof ( hintmask->mask ) / sizeof ( hintmask->mask[0] ) ); + + /* set mask to all ones */ + for ( i = 0; i < hintmask->byteCount; i++ ) + hintmask->mask[i] = 0xFF; + + /* clear unused bits */ + /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */ + hintmask->mask[hintmask->byteCount - 1] &= ~mask; + } + + + /* Type2 charstring opcodes */ + enum + { + cf2_cmdRESERVED_0, /* 0 */ + cf2_cmdHSTEM, /* 1 */ + cf2_cmdRESERVED_2, /* 2 */ + cf2_cmdVSTEM, /* 3 */ + cf2_cmdVMOVETO, /* 4 */ + cf2_cmdRLINETO, /* 5 */ + cf2_cmdHLINETO, /* 6 */ + cf2_cmdVLINETO, /* 7 */ + cf2_cmdRRCURVETO, /* 8 */ + cf2_cmdCLOSEPATH, /* 9 T1 only */ + cf2_cmdCALLSUBR, /* 10 */ + cf2_cmdRETURN, /* 11 */ + cf2_cmdESC, /* 12 */ + cf2_cmdHSBW, /* 13 T1 only */ + cf2_cmdENDCHAR, /* 14 */ + cf2_cmdVSINDEX, /* 15 */ + cf2_cmdBLEND, /* 16 */ + cf2_cmdRESERVED_17, /* 17 */ + cf2_cmdHSTEMHM, /* 18 */ + cf2_cmdHINTMASK, /* 19 */ + cf2_cmdCNTRMASK, /* 20 */ + cf2_cmdRMOVETO, /* 21 */ + cf2_cmdHMOVETO, /* 22 */ + cf2_cmdVSTEMHM, /* 23 */ + cf2_cmdRCURVELINE, /* 24 */ + cf2_cmdRLINECURVE, /* 25 */ + cf2_cmdVVCURVETO, /* 26 */ + cf2_cmdHHCURVETO, /* 27 */ + cf2_cmdEXTENDEDNMBR, /* 28 */ + cf2_cmdCALLGSUBR, /* 29 */ + cf2_cmdVHCURVETO, /* 30 */ + cf2_cmdHVCURVETO /* 31 */ + }; + + enum + { + cf2_escDOTSECTION, /* 0 */ + cf2_escVSTEM3, /* 1 T1 only */ + cf2_escHSTEM3, /* 2 T1 only */ + cf2_escAND, /* 3 */ + cf2_escOR, /* 4 */ + cf2_escNOT, /* 5 */ + cf2_escSEAC, /* 6 T1 only */ + cf2_escSBW, /* 7 T1 only */ + cf2_escRESERVED_8, /* 8 */ + cf2_escABS, /* 9 */ + cf2_escADD, /* 10 like otherADD */ + cf2_escSUB, /* 11 like otherSUB */ + cf2_escDIV, /* 12 */ + cf2_escRESERVED_13, /* 13 */ + cf2_escNEG, /* 14 */ + cf2_escEQ, /* 15 */ + cf2_escCALLOTHERSUBR,/* 16 T1 only */ + cf2_escPOP, /* 17 T1 only */ + cf2_escDROP, /* 18 */ + cf2_escRESERVED_19, /* 19 */ + cf2_escPUT, /* 20 like otherPUT */ + cf2_escGET, /* 21 like otherGET */ + cf2_escIFELSE, /* 22 like otherIFELSE */ + cf2_escRANDOM, /* 23 like otherRANDOM */ + cf2_escMUL, /* 24 like otherMUL */ + cf2_escRESERVED_25, /* 25 */ + cf2_escSQRT, /* 26 */ + cf2_escDUP, /* 27 like otherDUP */ + cf2_escEXCH, /* 28 like otherEXCH */ + cf2_escINDEX, /* 29 */ + cf2_escROLL, /* 30 */ + cf2_escRESERVED_31, /* 31 */ + cf2_escRESERVED_32, /* 32 */ + cf2_escSETCURRENTPT, /* 33 T1 only */ + cf2_escHFLEX, /* 34 */ + cf2_escFLEX, /* 35 */ + cf2_escHFLEX1, /* 36 */ + cf2_escFLEX1, /* 37 */ + cf2_escRESERVED_38 /* 38 & all higher */ + }; + + + /* `stemHintArray' does not change once we start drawing the outline. */ + static void + cf2_doStems( const CF2_Font font, + CF2_Stack opStack, + CF2_ArrStack stemHintArray, + CF2_Fixed* width, + FT_Bool* haveWidth, + CF2_Fixed hintOffset ) + { + CF2_UInt i; + CF2_UInt count = cf2_stack_count( opStack ); + FT_Bool hasWidthArg = (FT_Bool)( count & 1 ); + + /* variable accumulates delta values from operand stack */ + CF2_Fixed position = hintOffset; + + if ( font->isT1 && !font->decoder->flex_state && !*haveWidth ) + FT_ERROR(( "cf2_doStems (Type 1 mode):" + " No width. Use hsbw/sbw as first op\n" )); + + if ( !font->isT1 && hasWidthArg && !*haveWidth ) + *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + cf2_getNominalWidthX( font->decoder ) ); + + if ( font->decoder->width_only ) + goto exit; + + for ( i = hasWidthArg ? 1 : 0; i < count; i += 2 ) + { + /* construct a CF2_StemHint and push it onto the list */ + CF2_StemHintRec stemhint; + + + stemhint.min = + position = ADD_INT32( position, + cf2_stack_getReal( opStack, i ) ); + stemhint.max = + position = ADD_INT32( position, + cf2_stack_getReal( opStack, i + 1 ) ); + + stemhint.used = FALSE; + stemhint.maxDS = + stemhint.minDS = 0; + + cf2_arrstack_push( stemHintArray, &stemhint ); /* defer error check */ + } + + cf2_stack_clear( opStack ); + + exit: + /* cf2_doStems must define a width (may be default) */ + *haveWidth = TRUE; + } + + + static void + cf2_doFlex( CF2_Stack opStack, + CF2_Fixed* curX, + CF2_Fixed* curY, + CF2_GlyphPath glyphPath, + const FT_Bool* readFromStack, + FT_Bool doConditionalLastRead ) + { + CF2_Fixed vals[14]; + CF2_UInt idx; + FT_Bool isHFlex; + CF2_Int top, i, j; + + + vals[0] = *curX; + vals[1] = *curY; + idx = 0; + isHFlex = FT_BOOL( readFromStack[9] == FALSE ); + top = isHFlex ? 9 : 10; + + for ( i = 0; i < top; i++ ) + { + vals[i + 2] = vals[i]; + if ( readFromStack[i] ) + vals[i + 2] = ADD_INT32( vals[i + 2], cf2_stack_getReal( opStack, + idx++ ) ); + } + + if ( isHFlex ) + vals[9 + 2] = *curY; + + if ( doConditionalLastRead ) + { + FT_Bool lastIsX = (FT_Bool)( + cf2_fixedAbs( SUB_INT32( vals[10], *curX ) ) > + cf2_fixedAbs( SUB_INT32( vals[11], *curY ) ) ); + CF2_Fixed lastVal = cf2_stack_getReal( opStack, idx ); + + + if ( lastIsX ) + { + vals[12] = ADD_INT32( vals[10], lastVal ); + vals[13] = *curY; + } + else + { + vals[12] = *curX; + vals[13] = ADD_INT32( vals[11], lastVal ); + } + } + else + { + if ( readFromStack[10] ) + vals[12] = ADD_INT32( vals[10], + cf2_stack_getReal( opStack, idx++ ) ); + else + vals[12] = *curX; + + if ( readFromStack[11] ) + vals[13] = ADD_INT32( vals[11], + cf2_stack_getReal( opStack, idx ) ); + else + vals[13] = *curY; + } + + for ( j = 0; j < 2; j++ ) + cf2_glyphpath_curveTo( glyphPath, vals[j * 6 + 2], + vals[j * 6 + 3], + vals[j * 6 + 4], + vals[j * 6 + 5], + vals[j * 6 + 6], + vals[j * 6 + 7] ); + + cf2_stack_clear( opStack ); + + *curX = vals[12]; + *curY = vals[13]; + } + + + /* Blend numOperands on the stack, */ + /* store results into the first numBlends values, */ + /* then pop remaining arguments. */ + static void + cf2_doBlend( const CFF_Blend blend, + CF2_Stack opStack, + CF2_UInt numBlends ) + { + CF2_UInt delta; + CF2_UInt base; + CF2_UInt i, j; + CF2_UInt numOperands = (CF2_UInt)( numBlends * blend->lenBV ); + + + base = cf2_stack_count( opStack ) - numOperands; + delta = base + numBlends; + + for ( i = 0; i < numBlends; i++ ) + { + const CF2_Fixed* weight = &blend->BV[1]; + + /* start with first term */ + CF2_Fixed sum = cf2_stack_getReal( opStack, i + base ); + + + for ( j = 1; j < blend->lenBV; j++ ) + sum = ADD_INT32( sum, + FT_MulFix( *weight++, + cf2_stack_getReal( opStack, + delta++ ) ) ); + + /* store blended result */ + cf2_stack_setReal( opStack, i + base, sum ); + } + + /* leave only `numBlends' results on stack */ + cf2_stack_pop( opStack, numOperands - numBlends ); + } + + + /* + * `error' is a shared error code used by many objects in this + * routine. Before the code continues from an error, it must check and + * record the error in `*error'. The idea is that this shared + * error code will record the first error encountered. If testing + * for an error anyway, the cost of `goto exit' is small, so we do it, + * even if continuing would be safe. In this case, `lastError' is + * set, so the testing and storing can be done in one place, at `exit'. + * + * Continuing after an error is intended for objects which do their own + * testing of `*error', e.g., array stack functions. This allows us to + * avoid an extra test after the call. + * + * Unimplemented opcodes are ignored. + * + */ + FT_LOCAL_DEF( void ) + cf2_interpT2CharString( CF2_Font font, + CF2_Buffer buf, + CF2_OutlineCallbacks callbacks, + const FT_Vector* translation, + FT_Bool doingSeac, + CF2_Fixed curX, + CF2_Fixed curY, + CF2_Fixed* width ) + { + /* lastError is used for errors that are immediately tested */ + FT_Error lastError = FT_Err_Ok; + + /* pointer to parsed font object */ + PS_Decoder* decoder = font->decoder; + + FT_Error* error = &font->error; + FT_Memory memory = font->memory; + + CF2_Fixed scaleY = font->innerTransform.d; + CF2_Fixed nominalWidthX = cf2_getNominalWidthX( decoder ); + + /* stuff for Type 1 */ + FT_Int known_othersubr_result_cnt = 0; + FT_Bool large_int = FALSE; + FT_Bool initial_map_ready = FALSE; + +#define PS_STORAGE_SIZE 3 + CF2_F16Dot16 results[PS_STORAGE_SIZE]; /* for othersubr results */ + FT_Int result_cnt = 0; + + /* save this for hinting seac accents */ + CF2_Fixed hintOriginY = curY; + + CF2_Stack opStack = NULL; + FT_UInt stackSize; + FT_Byte op1; /* first opcode byte */ + + CF2_F16Dot16 storage[CF2_STORAGE_SIZE]; /* for `put' and `get' */ + CF2_F16Dot16 flexStore[6]; /* for Type 1 flex */ + + /* instruction limit; 20,000,000 matches Avalon */ + FT_UInt32 instructionLimit = 20000000UL; + + CF2_ArrStackRec subrStack; + + FT_Bool haveWidth; + CF2_Buffer charstring = NULL; + + CF2_Int charstringIndex = -1; /* initialize to empty */ + + /* TODO: placeholders for hint structures */ + + /* objects used for hinting */ + CF2_ArrStackRec hStemHintArray; + CF2_ArrStackRec vStemHintArray; + + CF2_HintMaskRec hintMask; + CF2_GlyphPathRec glyphPath; + + + FT_ZERO( &storage ); + FT_ZERO( &results ); + FT_ZERO( &flexStore ); + + /* initialize the remaining objects */ + cf2_arrstack_init( &subrStack, + memory, + error, + sizeof ( CF2_BufferRec ) ); + cf2_arrstack_init( &hStemHintArray, + memory, + error, + sizeof ( CF2_StemHintRec ) ); + cf2_arrstack_init( &vStemHintArray, + memory, + error, + sizeof ( CF2_StemHintRec ) ); + + /* initialize CF2_StemHint arrays */ + cf2_hintmask_init( &hintMask, error ); + + /* initialize path map to manage drawing operations */ + + /* Note: last 4 params are used to handle `MoveToPermissive', which */ + /* may need to call `hintMap.Build' */ + /* TODO: MoveToPermissive is gone; are these still needed? */ + cf2_glyphpath_init( &glyphPath, + font, + callbacks, + scaleY, + /* hShift, */ + &hStemHintArray, + &vStemHintArray, + &hintMask, + hintOriginY, + &font->blues, + translation ); + + /* + * Initialize state for width parsing. From the CFF Spec: + * + * The first stack-clearing operator, which must be one of hstem, + * hstemhm, vstem, vstemhm, cntrmask, hintmask, hmoveto, vmoveto, + * rmoveto, or endchar, takes an additional argument - the width (as + * described earlier), which may be expressed as zero or one numeric + * argument. + * + * What we implement here uses the first validly specified width, but + * does not detect errors for specifying more than one width. + * + * If one of the above operators occurs without explicitly specifying + * a width, we assume the default width. + * + * CFF2 charstrings always return the default width (0). + * + */ + haveWidth = font->isCFF2 ? TRUE : FALSE; + *width = cf2_getDefaultWidthX( decoder ); + + /* + * Note: At this point, all pointers to resources must be NULL + * and all local objects must be initialized. + * There must be no branches to `exit:' above this point. + * + */ + + /* allocate an operand stack */ + stackSize = font->isCFF2 ? cf2_getMaxstack( decoder ) + : CF2_OPERAND_STACK_SIZE; + opStack = cf2_stack_init( memory, error, stackSize ); + + if ( !opStack ) + { + lastError = FT_THROW( Out_Of_Memory ); + goto exit; + } + + /* initialize subroutine stack by placing top level charstring as */ + /* first element (max depth plus one for the charstring) */ + /* Note: Caller owns and must finalize the first charstring. */ + /* Our copy of it does not change that requirement. */ + cf2_arrstack_setCount( &subrStack, CF2_MAX_SUBR + 1 ); + + charstring = (CF2_Buffer)cf2_arrstack_getBuffer( &subrStack ); + *charstring = *buf; /* structure copy */ + + charstringIndex = 0; /* entry is valid now */ + + /* catch errors so far */ + if ( *error ) + goto exit; + + /* main interpreter loop */ + while ( 1 ) + { + if ( font->isT1 ) + FT_ASSERT( known_othersubr_result_cnt == 0 || + result_cnt == 0 ); + + if ( cf2_buf_isEnd( charstring ) ) + { + /* If we've reached the end of the charstring, simulate a */ + /* cf2_cmdRETURN or cf2_cmdENDCHAR. */ + /* We do this for both CFF and CFF2. */ + if ( charstringIndex ) + op1 = cf2_cmdRETURN; /* end of buffer for subroutine */ + else + op1 = cf2_cmdENDCHAR; /* end of buffer for top level charstring */ + } + else + { + op1 = (FT_Byte)cf2_buf_readByte( charstring ); + + /* Explicit RETURN and ENDCHAR in CFF2 should be ignored. */ + /* Note: Trace message will report 0 instead of 11 or 14. */ + if ( ( op1 == cf2_cmdRETURN || op1 == cf2_cmdENDCHAR ) && + font->isCFF2 ) + op1 = cf2_cmdRESERVED_0; + } + + if ( font->isT1 ) + { + if ( !initial_map_ready && + !( op1 == cf2_cmdHSTEM || + op1 == cf2_cmdVSTEM || + op1 == cf2_cmdHSBW || + op1 == cf2_cmdCALLSUBR || + op1 == cf2_cmdRETURN || + op1 == cf2_cmdESC || + op1 == cf2_cmdENDCHAR || + op1 >= 32 /* Numbers */ ) ) + { + /* Skip outline commands first time round. */ + /* `endchar' will trigger initial hintmap build */ + /* and rewind the charstring. */ + cf2_stack_clear( opStack ); + continue; + } + + if ( result_cnt > 0 && + !( op1 == cf2_cmdCALLSUBR || + op1 == cf2_cmdRETURN || + op1 == cf2_cmdESC || + op1 >= 32 /* Numbers */ ) ) + { + /* all operands have been transferred by previous pops */ + result_cnt = 0; + } + + if ( large_int && !( op1 >= 32 || op1 == cf2_escDIV ) ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " no `div' after large integer\n" )); + + large_int = FALSE; + } + } + + /* check for errors once per loop */ + if ( *error ) + goto exit; + + instructionLimit--; + if ( instructionLimit == 0 ) + { + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + switch( op1 ) + { + case cf2_cmdRESERVED_0: + case cf2_cmdRESERVED_2: + case cf2_cmdRESERVED_17: + /* we may get here if we have a prior error */ + FT_TRACE4(( " unknown op (%d)\n", op1 )); + break; + + case cf2_cmdVSINDEX: + FT_TRACE4(( " vsindex\n" )); + + if ( !font->isCFF2 ) + break; /* clear stack & ignore */ + + if ( font->blend.usedBV ) + { + /* vsindex not allowed after blend */ + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + { + FT_Int temp = cf2_stack_popInt( opStack ); + + + if ( temp >= 0 ) + font->vsindex = (FT_UInt)temp; + } + break; + + case cf2_cmdBLEND: + { + FT_UInt numBlends; + + + FT_TRACE4(( " blend\n" )); + + if ( !font->isCFF2 ) + break; /* clear stack & ignore */ + + /* do we have a `blend' op in a non-variant font? */ + if ( !font->blend.font ) + { + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* check cached blend vector */ + if ( font->cffload->blend_check_vector( &font->blend, + font->vsindex, + font->lenNDV, + font->NDV ) ) + { + lastError = font->cffload->blend_build_vector( &font->blend, + font->vsindex, + font->lenNDV, + font->NDV ); + if ( lastError ) + goto exit; + } + + /* do the blend */ + numBlends = (FT_UInt)cf2_stack_popInt( opStack ); + if ( numBlends > stackSize ) + { + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + cf2_doBlend( &font->blend, opStack, numBlends ); + + font->blend.usedBV = TRUE; + } + continue; /* do not clear the stack */ + + case cf2_cmdHSTEMHM: + case cf2_cmdHSTEM: + FT_TRACE4(( op1 == cf2_cmdHSTEMHM ? " hstemhm\n" : " hstem\n" )); + + if ( !font->isT1 ) + { + /* never add hints after the mask is computed */ + /* except if in Type 1 mode (no hintmask op) */ + if ( cf2_hintmask_isValid( &hintMask ) ) + { + FT_TRACE4(( "cf2_interpT2CharString:" + " invalid horizontal hint mask\n" )); + break; + } + } + + /* add left-sidebearing correction in Type 1 mode */ + cf2_doStems( font, + opStack, + &hStemHintArray, + width, + &haveWidth, + font->isT1 ? decoder->builder.left_bearing->y + : 0 ); + + if ( decoder->width_only ) + goto exit; + + break; + + case cf2_cmdVSTEMHM: + case cf2_cmdVSTEM: + FT_TRACE4(( op1 == cf2_cmdVSTEMHM ? " vstemhm\n" : " vstem\n" )); + + if ( !font->isT1 ) + { + /* never add hints after the mask is computed */ + /* except if in Type 1 mode (no hintmask op) */ + if ( cf2_hintmask_isValid( &hintMask ) ) + { + FT_TRACE4(( "cf2_interpT2CharString:" + " invalid vertical hint mask\n" )); + break; + } + } + + /* add left-sidebearing correction in Type 1 mode */ + cf2_doStems( font, + opStack, + &vStemHintArray, + width, + &haveWidth, + font->isT1 ? decoder->builder.left_bearing->x + : 0 ); + + if ( decoder->width_only ) + goto exit; + + break; + + case cf2_cmdVMOVETO: + FT_TRACE4(( " vmoveto\n" )); + + if ( font->isT1 && !decoder->flex_state && !haveWidth ) + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " No width. Use hsbw/sbw as first op\n" )); + + if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) + *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + nominalWidthX ); + + /* width is defined or default after this */ + haveWidth = TRUE; + + if ( decoder->width_only ) + goto exit; + + curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); + + if ( !decoder->flex_state ) + cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + + break; + + case cf2_cmdRLINETO: + { + CF2_UInt idx; + CF2_UInt count = cf2_stack_count( opStack ); + + + FT_TRACE4(( " rlineto\n" )); + + for ( idx = 0; idx < count; idx += 2 ) + { + curX = ADD_INT32( curX, cf2_stack_getReal( opStack, + idx + 0 ) ); + curY = ADD_INT32( curY, cf2_stack_getReal( opStack, + idx + 1 ) ); + + cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + } + + cf2_stack_clear( opStack ); + } + continue; /* no need to clear stack again */ + + case cf2_cmdHLINETO: + case cf2_cmdVLINETO: + { + CF2_UInt idx; + CF2_UInt count = cf2_stack_count( opStack ); + + FT_Bool isX = FT_BOOL( op1 == cf2_cmdHLINETO ); + + + FT_TRACE4(( isX ? " hlineto\n" : " vlineto\n" )); + + for ( idx = 0; idx < count; idx++ ) + { + CF2_Fixed v = cf2_stack_getReal( opStack, idx ); + + + if ( isX ) + curX = ADD_INT32( curX, v ); + else + curY = ADD_INT32( curY, v ); + + isX = !isX; + + cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + } + + cf2_stack_clear( opStack ); + } + continue; + + case cf2_cmdRCURVELINE: + case cf2_cmdRRCURVETO: + { + CF2_UInt count = cf2_stack_count( opStack ); + CF2_UInt idx = 0; + + + FT_TRACE4(( op1 == cf2_cmdRCURVELINE ? " rcurveline\n" + : " rrcurveto\n" )); + + while ( idx + 6 <= count ) + { + CF2_Fixed x1, y1, x2, y2, x3, y3; + + + x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX ); + y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), curY ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y1 ); + x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 ); + y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), y2 ); + + cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + + curX = x3; + curY = y3; + idx += 6; + } + + if ( op1 == cf2_cmdRCURVELINE ) + { + curX = ADD_INT32( curX, cf2_stack_getReal( opStack, + idx + 0 ) ); + curY = ADD_INT32( curY, cf2_stack_getReal( opStack, + idx + 1 ) ); + + cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + } + + cf2_stack_clear( opStack ); + } + continue; /* no need to clear stack again */ + + case cf2_cmdCLOSEPATH: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (%d)\n", op1 )); + else + { + FT_TRACE4(( " closepath" )); + + /* if there is no path, `closepath' is a no-op */ + ps_builder_close_contour( &decoder->builder ); + + haveWidth = TRUE; + } + break; + + case cf2_cmdCALLGSUBR: + case cf2_cmdCALLSUBR: + { + CF2_Int subrNum; + + + FT_TRACE4(( op1 == cf2_cmdCALLGSUBR ? " callgsubr" + : " callsubr" )); + + if ( ( !font->isT1 && charstringIndex > CF2_MAX_SUBR ) || + ( font->isT1 && charstringIndex > T1_MAX_SUBRS_CALLS ) ) + { + /* max subr plus one for charstring */ + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* overflow of stack */ + } + + /* push our current CFF charstring region on subrStack */ + charstring = (CF2_Buffer) + cf2_arrstack_getPointer( + &subrStack, + (size_t)charstringIndex + 1 ); + + /* set up the new CFF region and pointer */ + subrNum = cf2_stack_popInt( opStack ); + + if ( font->isT1 && decoder->locals_hash ) + { + size_t* val = ft_hash_num_lookup( subrNum, + decoder->locals_hash ); + + + if ( val ) + subrNum = *val; + else + subrNum = -1; + } + + switch ( op1 ) + { + case cf2_cmdCALLGSUBR: + FT_TRACE4(( " (idx %d, entering level %d)\n", + subrNum + decoder->globals_bias, + charstringIndex + 1 )); + + if ( cf2_initGlobalRegionBuffer( decoder, + subrNum, + charstring ) ) + { + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* subroutine lookup or stream error */ + } + break; + + default: + /* cf2_cmdCALLSUBR */ + FT_TRACE4(( " (idx %d, entering level %d)\n", + subrNum + decoder->locals_bias, + charstringIndex + 1 )); + + if ( cf2_initLocalRegionBuffer( decoder, + subrNum, + charstring ) ) + { + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* subroutine lookup or stream error */ + } + } + + charstringIndex += 1; /* entry is valid now */ + } + continue; /* do not clear the stack */ + + case cf2_cmdRETURN: + FT_TRACE4(( " return (leaving level %d)\n", charstringIndex )); + + if ( charstringIndex < 1 ) + { + /* Note: cannot return from top charstring */ + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* underflow of stack */ + } + + /* restore position in previous charstring */ + charstring = (CF2_Buffer) + cf2_arrstack_getPointer( + &subrStack, + (CF2_UInt)--charstringIndex ); + continue; /* do not clear the stack */ + + case cf2_cmdESC: + { + FT_Byte op2 = (FT_Byte)cf2_buf_readByte( charstring ); + + + /* first switch for 2-byte operators handles CFF2 */ + /* and opcodes that are reserved for both CFF and CFF2 */ + switch ( op2 ) + { + case cf2_escHFLEX: + { + static const FT_Bool readFromStack[12] = + { + TRUE /* dx1 */, FALSE /* dy1 */, + TRUE /* dx2 */, TRUE /* dy2 */, + TRUE /* dx3 */, FALSE /* dy3 */, + TRUE /* dx4 */, FALSE /* dy4 */, + TRUE /* dx5 */, FALSE /* dy5 */, + TRUE /* dx6 */, FALSE /* dy6 */ + }; + + + FT_TRACE4(( " hflex\n" )); + + cf2_doFlex( opStack, + &curX, + &curY, + &glyphPath, + readFromStack, + FALSE /* doConditionalLastRead */ ); + } + continue; + + case cf2_escFLEX: + { + static const FT_Bool readFromStack[12] = + { + TRUE /* dx1 */, TRUE /* dy1 */, + TRUE /* dx2 */, TRUE /* dy2 */, + TRUE /* dx3 */, TRUE /* dy3 */, + TRUE /* dx4 */, TRUE /* dy4 */, + TRUE /* dx5 */, TRUE /* dy5 */, + TRUE /* dx6 */, TRUE /* dy6 */ + }; + + + FT_TRACE4(( " flex\n" )); + + cf2_doFlex( opStack, + &curX, + &curY, + &glyphPath, + readFromStack, + FALSE /* doConditionalLastRead */ ); + } + break; /* TODO: why is this not a continue? */ + + case cf2_escHFLEX1: + { + static const FT_Bool readFromStack[12] = + { + TRUE /* dx1 */, TRUE /* dy1 */, + TRUE /* dx2 */, TRUE /* dy2 */, + TRUE /* dx3 */, FALSE /* dy3 */, + TRUE /* dx4 */, FALSE /* dy4 */, + TRUE /* dx5 */, TRUE /* dy5 */, + TRUE /* dx6 */, FALSE /* dy6 */ + }; + + + FT_TRACE4(( " hflex1\n" )); + + cf2_doFlex( opStack, + &curX, + &curY, + &glyphPath, + readFromStack, + FALSE /* doConditionalLastRead */ ); + } + continue; + + case cf2_escFLEX1: + { + static const FT_Bool readFromStack[12] = + { + TRUE /* dx1 */, TRUE /* dy1 */, + TRUE /* dx2 */, TRUE /* dy2 */, + TRUE /* dx3 */, TRUE /* dy3 */, + TRUE /* dx4 */, TRUE /* dy4 */, + TRUE /* dx5 */, TRUE /* dy5 */, + FALSE /* dx6 */, FALSE /* dy6 */ + }; + + + FT_TRACE4(( " flex1\n" )); + + cf2_doFlex( opStack, + &curX, + &curY, + &glyphPath, + readFromStack, + TRUE /* doConditionalLastRead */ ); + } + continue; + + /* these opcodes are always reserved */ + case cf2_escRESERVED_8: + case cf2_escRESERVED_13: + case cf2_escRESERVED_19: + case cf2_escRESERVED_25: + case cf2_escRESERVED_31: + case cf2_escRESERVED_32: + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + break; + + default: + { + if ( font->isCFF2 || op2 >= cf2_escRESERVED_38 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else if ( font->isT1 && result_cnt > 0 && op2 != cf2_escPOP ) + { + /* all operands have been transferred by previous pops */ + result_cnt = 0; + } + else + { + /* second switch for 2-byte operators handles */ + /* CFF and Type 1 */ + switch ( op2 ) + { + + case cf2_escDOTSECTION: + /* something about `flip type of locking' -- ignore it */ + FT_TRACE4(( " dotsection\n" )); + + break; + + case cf2_escVSTEM3: + case cf2_escHSTEM3: + /* + * Type 1: Type 2: + * x0 dx0 x1 dx1 x2 dx2 vstem3 x dx {dxa dxb}* vstem + * y0 dy0 y1 dy1 y2 dy2 hstem3 y dy {dya dyb}* hstem + * relative to lsb point relative to zero + * + */ + { + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + CF2_F16Dot16 v0, v1, v2; + + FT_Bool isV = FT_BOOL( op2 == cf2_escVSTEM3 ); + + + FT_TRACE4(( isV ? " vstem3\n" + : " hstem3\n" )); + + FT_ASSERT( cf2_stack_count( opStack ) == 6 ); + + v0 = cf2_stack_getReal( opStack, 0 ); + v1 = cf2_stack_getReal( opStack, 2 ); + v2 = cf2_stack_getReal( opStack, 4 ); + + cf2_stack_setReal( + opStack, 2, + SUB_INT32( SUB_INT32( v1, v0 ), + cf2_stack_getReal( opStack, 1 ) ) ); + cf2_stack_setReal( + opStack, 4, + SUB_INT32( SUB_INT32( v2, v1 ), + cf2_stack_getReal( opStack, 3 ) ) ); + + /* add left-sidebearing correction */ + cf2_doStems( font, + opStack, + isV ? &vStemHintArray : &hStemHintArray, + width, + &haveWidth, + isV ? decoder->builder.left_bearing->x + : decoder->builder.left_bearing->y ); + + if ( decoder->width_only ) + goto exit; + } + } + break; + + case cf2_escAND: + { + CF2_F16Dot16 arg1; + CF2_F16Dot16 arg2; + + + FT_TRACE4(( " and\n" )); + + arg2 = cf2_stack_popFixed( opStack ); + arg1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushInt( opStack, arg1 && arg2 ); + } + continue; /* do not clear the stack */ + + case cf2_escOR: + { + CF2_F16Dot16 arg1; + CF2_F16Dot16 arg2; + + + FT_TRACE4(( " or\n" )); + + arg2 = cf2_stack_popFixed( opStack ); + arg1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushInt( opStack, arg1 || arg2 ); + } + continue; /* do not clear the stack */ + + case cf2_escNOT: + { + CF2_F16Dot16 arg; + + + FT_TRACE4(( " not\n" )); + + arg = cf2_stack_popFixed( opStack ); + + cf2_stack_pushInt( opStack, !arg ); + } + continue; /* do not clear the stack */ + + case cf2_escSEAC: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + FT_Error error2; + CF2_Int bchar_index, achar_index; + FT_Vector left_bearing, advance; + +#ifdef FT_CONFIG_OPTION_INCREMENTAL + T1_Face face = (T1_Face)decoder->builder.face; +#endif + CF2_BufferRec component; + CF2_Fixed dummyWidth; + + CF2_Int achar = cf2_stack_popInt( opStack ); + CF2_Int bchar = cf2_stack_popInt( opStack ); + + FT_Pos ady = cf2_stack_popFixed ( opStack ); + FT_Pos adx = cf2_stack_popFixed ( opStack ); + FT_Pos asb = cf2_stack_popFixed ( opStack ); + + + FT_TRACE4(( " seac\n" )); + + if ( doingSeac ) + { + FT_ERROR(( " nested seac\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* nested seac */ + } + + if ( decoder->builder.metrics_only ) + { + FT_ERROR(( " unexpected seac\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* unexpected seac */ + } + + /* `glyph_names' is set to 0 for CID fonts which do */ + /* not include an encoding. How can we deal with */ + /* these? */ +#ifdef FT_CONFIG_OPTION_INCREMENTAL + if ( decoder->glyph_names == 0 && + !face->root.internal->incremental_interface ) +#else + if ( decoder->glyph_names == 0 ) +#endif /* FT_CONFIG_OPTION_INCREMENTAL */ + { + FT_ERROR(( + "cf2_interpT2CharString: (Type 1 seac)" + " glyph names table not available in this font\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* seac weirdness */ + adx += decoder->builder.left_bearing->x; + +#ifdef FT_CONFIG_OPTION_INCREMENTAL + if ( face->root.internal->incremental_interface ) + { + /* the caller must handle the font encoding also */ + bchar_index = bchar; + achar_index = achar; + } + else +#endif + { + bchar_index = t1_lookup_glyph_by_stdcharcode_ps( + decoder, bchar ); + achar_index = t1_lookup_glyph_by_stdcharcode_ps( + decoder, achar ); + } + + if ( bchar_index < 0 || achar_index < 0 ) + { + FT_ERROR(( + "cf2_interpT2CharString: (Type 1 seac)" + " invalid seac character code arguments\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* if we are trying to load a composite glyph, */ + /* do not load the accent character and return */ + /* the array of subglyphs. */ + if ( decoder->builder.no_recurse ) + { + FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph; + FT_GlyphLoader loader = glyph->internal->loader; + FT_SubGlyph subg; + + + /* reallocate subglyph array if necessary */ + error2 = FT_GlyphLoader_CheckSubGlyphs( loader, 2 ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ + goto exit; + } + + subg = loader->current.subglyphs; + + /* subglyph 0 = base character */ + subg->index = bchar_index; + subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES | + FT_SUBGLYPH_FLAG_USE_MY_METRICS; + subg->arg1 = 0; + subg->arg2 = 0; + subg++; + + /* subglyph 1 = accent character */ + subg->index = achar_index; + subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES; + subg->arg1 = (FT_Int)FIXED_TO_INT( adx - asb ); + subg->arg2 = (FT_Int)FIXED_TO_INT( ady ); + + /* set up remaining glyph fields */ + glyph->num_subglyphs = 2; + glyph->subglyphs = loader->base.subglyphs; + glyph->format = FT_GLYPH_FORMAT_COMPOSITE; + + loader->current.num_subglyphs = 2; + + goto exit; + } + + /* First load `bchar' in builder */ + /* now load the unscaled outline */ + + /* prepare loader */ + FT_GlyphLoader_Prepare( decoder->builder.loader ); + + error2 = cf2_getT1SeacComponent( decoder, + (FT_UInt)bchar_index, + &component ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ + goto exit; + } + cf2_interpT2CharString( font, + &component, + callbacks, + translation, + TRUE, + 0, + 0, + &dummyWidth ); + cf2_freeT1SeacComponent( decoder, &component ); + + /* save the left bearing and width of the base */ + /* character as they will be erased by the next load */ + + left_bearing = *decoder->builder.left_bearing; + advance = *decoder->builder.advance; + + decoder->builder.left_bearing->x = 0; + decoder->builder.left_bearing->y = 0; + + /* Now load `achar' on top of */ + /* the base outline */ + + error2 = cf2_getT1SeacComponent( decoder, + (FT_UInt)achar_index, + &component ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ + goto exit; + } + cf2_interpT2CharString( font, + &component, + callbacks, + translation, + TRUE, + adx - asb, + ady, + &dummyWidth ); + cf2_freeT1SeacComponent( decoder, &component ); + + /* restore the left side bearing and */ + /* advance width of the base character */ + + *decoder->builder.left_bearing = left_bearing; + *decoder->builder.advance = advance; + + goto exit; + } + break; + + case cf2_escSBW: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + CF2_Fixed lsb_x, lsb_y; + PS_Builder* builder; + + + FT_TRACE4(( " sbw" )); + + builder = &decoder->builder; + + builder->advance->y = cf2_stack_popFixed( opStack ); + builder->advance->x = cf2_stack_popFixed( opStack ); + + lsb_y = cf2_stack_popFixed( opStack ); + lsb_x = cf2_stack_popFixed( opStack ); + + builder->left_bearing->x = + ADD_INT32( builder->left_bearing->x, lsb_x ); + builder->left_bearing->y = + ADD_INT32( builder->left_bearing->y, lsb_y ); + + haveWidth = TRUE; + + /* the `metrics_only' indicates that we only want */ + /* to compute the glyph's metrics (lsb + advance */ + /* width), not load the rest of it; so exit */ + /* immediately */ + if ( builder->metrics_only ) + goto exit; + + if ( initial_map_ready ) + { + curX = ADD_INT32( curX, lsb_x ); + curY = ADD_INT32( curY, lsb_y ); + } + } + break; + + case cf2_escABS: + { + CF2_F16Dot16 arg; + + + FT_TRACE4(( " abs\n" )); + + arg = cf2_stack_popFixed( opStack ); + + if ( arg < -CF2_FIXED_MAX ) + cf2_stack_pushFixed( opStack, CF2_FIXED_MAX ); + else + cf2_stack_pushFixed( opStack, FT_ABS( arg ) ); + } + continue; /* do not clear the stack */ + + case cf2_escADD: + { + CF2_F16Dot16 summand1; + CF2_F16Dot16 summand2; + + + FT_TRACE4(( " add\n" )); + + summand2 = cf2_stack_popFixed( opStack ); + summand1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + ADD_INT32( summand1, + summand2 ) ); + } + continue; /* do not clear the stack */ + + case cf2_escSUB: + { + CF2_F16Dot16 minuend; + CF2_F16Dot16 subtrahend; + + + FT_TRACE4(( " sub\n" )); + + subtrahend = cf2_stack_popFixed( opStack ); + minuend = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + SUB_INT32( minuend, subtrahend ) ); + } + continue; /* do not clear the stack */ + + case cf2_escDIV: + { + CF2_F16Dot16 dividend; + CF2_F16Dot16 divisor; + + + FT_TRACE4(( " div\n" )); + + if ( font->isT1 && large_int ) + { + divisor = (CF2_F16Dot16)cf2_stack_popInt( opStack ); + dividend = (CF2_F16Dot16)cf2_stack_popInt( opStack ); + + large_int = FALSE; + } + else + { + divisor = cf2_stack_popFixed( opStack ); + dividend = cf2_stack_popFixed( opStack ); + } + + cf2_stack_pushFixed( opStack, + FT_DivFix( dividend, divisor ) ); + + } + continue; /* do not clear the stack */ + + case cf2_escNEG: + { + CF2_F16Dot16 arg; + + + FT_TRACE4(( " neg\n" )); + + arg = cf2_stack_popFixed( opStack ); + + if ( arg < -CF2_FIXED_MAX ) + cf2_stack_pushFixed( opStack, CF2_FIXED_MAX ); + else + cf2_stack_pushFixed( opStack, -arg ); + } + continue; /* do not clear the stack */ + + case cf2_escEQ: + { + CF2_F16Dot16 arg1; + CF2_F16Dot16 arg2; + + + FT_TRACE4(( " eq\n" )); + + arg2 = cf2_stack_popFixed( opStack ); + arg1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushInt( opStack, arg1 == arg2 ); + } + continue; /* do not clear the stack */ + + case cf2_escCALLOTHERSUBR: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + CF2_Int subr_no; + CF2_Int arg_cnt; + CF2_UInt count; + CF2_UInt opIdx = 0; + + + FT_TRACE4(( " callothersubr\n" )); + + subr_no = cf2_stack_popInt( opStack ); + arg_cnt = cf2_stack_popInt( opStack ); + + /*******************************************************/ + /* */ + /* remove all operands to callothersubr from the stack */ + /* */ + /* for handled othersubrs, where we know the number of */ + /* arguments, we increase the stack by the value of */ + /* known_othersubr_result_cnt */ + /* */ + /* for unhandled othersubrs the following pops adjust */ + /* the stack pointer as necessary */ + + count = cf2_stack_count( opStack ); + FT_ASSERT( (CF2_UInt)arg_cnt <= count ); + + opIdx += count - (CF2_UInt)arg_cnt; + + known_othersubr_result_cnt = 0; + result_cnt = 0; + + /* XXX TODO: The checks to `arg_count == ' */ + /* might not be correct; an othersubr expects a */ + /* certain number of operands on the PostScript stack */ + /* (as opposed to the T1 stack) but it doesn't have to */ + /* put them there by itself; previous othersubrs might */ + /* have left the operands there if they were not */ + /* followed by an appropriate number of pops */ + /* */ + /* On the other hand, Adobe Reader 7.0.8 for Linux */ + /* doesn't accept a font that contains charstrings */ + /* like */ + /* */ + /* 100 200 2 20 callothersubr */ + /* 300 1 20 callothersubr pop */ + /* */ + /* Perhaps this is the reason why BuildCharArray */ + /* exists. */ + + switch ( subr_no ) + { + case 0: /* end flex feature */ + if ( arg_cnt != 3 ) + goto Unexpected_OtherSubr; + + if ( initial_map_ready && + ( !decoder->flex_state || + decoder->num_flex_vectors != 7 ) ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " unexpected flex end\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* the two `results' are popped */ + /* by the following setcurrentpoint */ + cf2_stack_pushFixed( opStack, curX ); + cf2_stack_pushFixed( opStack, curY ); + known_othersubr_result_cnt = 2; + break; + + case 1: /* start flex feature */ + if ( arg_cnt != 0 ) + goto Unexpected_OtherSubr; + + if ( !initial_map_ready ) + break; + + if ( ps_builder_check_points( &decoder->builder, 6 ) ) + goto exit; + + decoder->flex_state = 1; + decoder->num_flex_vectors = 0; + break; + + case 2: /* add flex vectors */ + { + FT_Int idx; + FT_Int idx2; + + + if ( arg_cnt != 0 ) + goto Unexpected_OtherSubr; + + if ( !initial_map_ready ) + break; + + if ( !decoder->flex_state ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " missing flex start\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* note that we should not add a point for */ + /* index 0; this will move our current position */ + /* to the flex point without adding any point */ + /* to the outline */ + idx = decoder->num_flex_vectors++; + if ( idx > 0 && idx < 7 ) + { + /* in malformed fonts it is possible to have */ + /* other opcodes in the middle of a flex (which */ + /* don't increase `num_flex_vectors'); we thus */ + /* have to check whether we can add a point */ + + if ( ps_builder_check_points( &decoder->builder, + 1 ) ) + { + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* map: 1->2 2->4 3->6 4->2 5->4 6->6 */ + idx2 = ( idx > 3 ? idx - 3 : idx ) * 2; + + flexStore[idx2 - 2] = curX; + flexStore[idx2 - 1] = curY; + + if ( idx == 3 || idx == 6 ) + cf2_glyphpath_curveTo( &glyphPath, + flexStore[0], + flexStore[1], + flexStore[2], + flexStore[3], + flexStore[4], + flexStore[5] ); + } + } + break; + + case 3: /* change hints */ + if ( arg_cnt != 1 ) + goto Unexpected_OtherSubr; + + if ( initial_map_ready ) + { + /* do not clear hints if initial hintmap */ + /* is not ready - we need to collate all */ + cf2_arrstack_clear( &vStemHintArray ); + cf2_arrstack_clear( &hStemHintArray ); + + cf2_hintmask_init( &hintMask, error ); + hintMask.isValid = FALSE; + hintMask.isNew = TRUE; + } + + known_othersubr_result_cnt = 1; + break; + + case 12: + case 13: + /* counter control hints, clear stack */ + cf2_stack_clear( opStack ); + break; + + case 14: + case 15: + case 16: + case 17: + case 18: /* multiple masters */ + { + PS_Blend blend = decoder->blend; + FT_UInt num_points, nn, mm; + CF2_UInt delta; + CF2_UInt values; + + + if ( !blend ) + { + FT_ERROR(( + "cf2_interpT2CharString:" + " unexpected multiple masters operator\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + num_points = (FT_UInt)subr_no - 13 + + ( subr_no == 18 ); + if ( arg_cnt != (FT_Int)( num_points * + blend->num_designs ) ) + { + FT_ERROR(( + "cf2_interpT2CharString:" + " incorrect number of multiple masters arguments\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + /* We want to compute */ + /* */ + /* a0*w0 + a1*w1 + ... + ak*wk */ + /* */ + /* but we only have a0, a1-a0, a2-a0, ..., ak-a0. */ + /* */ + /* However, given that w0 + w1 + ... + wk == 1, we */ + /* can rewrite it easily as */ + /* */ + /* a0 + (a1-a0)*w1 + (a2-a0)*w2 + ... + (ak-a0)*wk */ + /* */ + /* where k == num_designs-1. */ + /* */ + /* I guess that's why it's written in this `compact' */ + /* form. */ + /* */ + delta = opIdx + num_points; + values = opIdx; + for ( nn = 0; nn < num_points; nn++ ) + { + CF2_Fixed tmp = cf2_stack_getReal( opStack, + values ); + + + for ( mm = 1; mm < blend->num_designs; mm++ ) + tmp = ADD_INT32( tmp, + FT_MulFix( + cf2_stack_getReal( opStack, + delta++ ), + blend->weight_vector[mm] ) ); + + cf2_stack_setReal( opStack, values++, tmp ); + } + cf2_stack_pop( opStack, + (CF2_UInt)arg_cnt - num_points ); + + known_othersubr_result_cnt = (FT_Int)num_points; + break; + } + + case 19: + /* 1 19 callothersubr */ + /* ==> replace elements starting from index */ + /* cvi( ) of BuildCharArray with */ + /* WeightVector */ + { + FT_Int idx; + PS_Blend blend = decoder->blend; + + + if ( arg_cnt != 1 || !blend ) + goto Unexpected_OtherSubr; + + idx = cf2_stack_popInt( opStack ); + + if ( idx < 0 || + (FT_UInt)idx + blend->num_designs > + decoder->len_buildchar ) + goto Unexpected_OtherSubr; + + ft_memcpy( &decoder->buildchar[idx], + blend->weight_vector, + blend->num_designs * + sizeof ( blend->weight_vector[0] ) ); + } + break; + + case 20: + /* 2 20 callothersubr pop */ + /* ==> push + onto T1 stack */ + { + CF2_F16Dot16 summand1; + CF2_F16Dot16 summand2; + + + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; + + summand2 = cf2_stack_popFixed( opStack ); + summand1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + ADD_INT32( summand1, + summand2 ) ); + known_othersubr_result_cnt = 1; + } + break; + + case 21: + /* 2 21 callothersubr pop */ + /* ==> push - onto T1 stack */ + { + CF2_F16Dot16 minuend; + CF2_F16Dot16 subtrahend; + + + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; + + subtrahend = cf2_stack_popFixed( opStack ); + minuend = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + SUB_INT32( minuend, + subtrahend ) ); + known_othersubr_result_cnt = 1; + } + break; + + case 22: + /* 2 22 callothersubr pop */ + /* ==> push * onto T1 stack */ + { + CF2_F16Dot16 factor1; + CF2_F16Dot16 factor2; + + + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; + + factor2 = cf2_stack_popFixed( opStack ); + factor1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + FT_MulFix( factor1, factor2 ) ); + known_othersubr_result_cnt = 1; + } + break; + + case 23: + /* 2 23 callothersubr pop */ + /* ==> push / onto T1 stack */ + { + CF2_F16Dot16 dividend; + CF2_F16Dot16 divisor; + + + if ( arg_cnt != 2 ) + goto Unexpected_OtherSubr; + + divisor = cf2_stack_popFixed( opStack ); + dividend = cf2_stack_popFixed( opStack ); + + if ( divisor == 0 ) + goto Unexpected_OtherSubr; + + cf2_stack_pushFixed( opStack, + FT_DivFix( dividend, + divisor ) ); + known_othersubr_result_cnt = 1; + } + break; + + case 24: + /* 2 24 callothersubr */ + /* ==> set BuildCharArray[cvi( )] = */ + { + CF2_Int idx; + PS_Blend blend = decoder->blend; + + + if ( arg_cnt != 2 || !blend ) + goto Unexpected_OtherSubr; + + idx = cf2_stack_popInt( opStack ); + + if ( idx < 0 || + (FT_UInt)idx >= decoder->len_buildchar ) + goto Unexpected_OtherSubr; + + decoder->buildchar[idx] = + cf2_stack_popFixed( opStack ); + } + break; + + case 25: + /* 1 25 callothersubr pop */ + /* ==> push BuildCharArray[cvi( idx )] */ + /* onto T1 stack */ + { + CF2_Int idx; + PS_Blend blend = decoder->blend; + + + if ( arg_cnt != 1 || !blend ) + goto Unexpected_OtherSubr; + + idx = cf2_stack_popInt( opStack ); + + if ( idx < 0 || + (FT_UInt)idx >= decoder->len_buildchar ) + goto Unexpected_OtherSubr; + + cf2_stack_pushFixed( opStack, + decoder->buildchar[idx] ); + known_othersubr_result_cnt = 1; + } + break; + +#if 0 + case 26: + /* mark */ + /* ==> set BuildCharArray[cvi( )] = , */ + /* leave mark on T1 stack */ + /* */ + /* ==> set BuildCharArray[cvi( )] = */ + XXX which routine has left its mark on the + XXX (PostScript) stack?; + break; +#endif + + case 27: + /* 4 27 callothersubr pop */ + /* ==> push onto T1 stack if <= , */ + /* otherwise push */ + { + CF2_F16Dot16 arg1; + CF2_F16Dot16 arg2; + CF2_F16Dot16 cond1; + CF2_F16Dot16 cond2; + + + if ( arg_cnt != 4 ) + goto Unexpected_OtherSubr; + + cond2 = cf2_stack_popFixed( opStack ); + cond1 = cf2_stack_popFixed( opStack ); + arg2 = cf2_stack_popFixed( opStack ); + arg1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + cond1 <= cond2 ? arg1 : arg2 ); + known_othersubr_result_cnt = 1; + } + break; + + case 28: + /* 0 28 callothersubr pop */ + /* ==> push random value from interval [0, 1) */ + /* onto stack */ + { + CF2_F16Dot16 r; + + + if ( arg_cnt != 0 ) + goto Unexpected_OtherSubr; + + /* only use the lower 16 bits of `random' */ + /* to generate a number in the range (0;1] */ + r = (CF2_F16Dot16) + ( ( decoder->current_subfont->random & 0xFFFF ) + 1 ); + + decoder->current_subfont->random = + cff_random( decoder->current_subfont->random ); + + cf2_stack_pushFixed( opStack, r ); + known_othersubr_result_cnt = 1; + } + break; + + default: + if ( arg_cnt >= 0 && subr_no >= 0 ) + { + FT_Int i; + + + FT_ERROR(( + "cf2_interpT2CharString (Type 1 mode):" + " unknown othersubr [%d %d], wish me luck\n", + arg_cnt, subr_no )); + + /* store the unused args */ + /* for this unhandled OtherSubr */ + + if ( arg_cnt > PS_STORAGE_SIZE ) + arg_cnt = PS_STORAGE_SIZE; + result_cnt = arg_cnt; + + for ( i = 1; i <= arg_cnt; i++ ) + results[result_cnt - i] = + cf2_stack_popFixed( opStack ); + + break; + } + /* fall through */ + + Unexpected_OtherSubr: + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " invalid othersubr [%d %d]\n", + arg_cnt, subr_no )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + } + continue; /* do not clear the stack */ + + case cf2_escPOP: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + FT_TRACE4(( " pop" )); + + if ( known_othersubr_result_cnt > 0 ) + { + known_othersubr_result_cnt--; + /* ignore, we pushed the operands ourselves */ + continue; + } + + if ( result_cnt == 0 ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " no more operands for othersubr\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + result_cnt--; + cf2_stack_pushFixed( opStack, results[result_cnt] ); + } + continue; /* do not clear the stack */ + + case cf2_escDROP: + FT_TRACE4(( " drop\n" )); + + (void)cf2_stack_popFixed( opStack ); + continue; /* do not clear the stack */ + + case cf2_escPUT: + { + CF2_F16Dot16 val; + CF2_Int idx; + + + FT_TRACE4(( " put\n" )); + + idx = cf2_stack_popInt( opStack ); + val = cf2_stack_popFixed( opStack ); + + if ( idx >= 0 && idx < CF2_STORAGE_SIZE ) + storage[idx] = val; + } + continue; /* do not clear the stack */ + + case cf2_escGET: + { + CF2_Int idx; + + + FT_TRACE4(( " get\n" )); + + idx = cf2_stack_popInt( opStack ); + + if ( idx >= 0 && idx < CF2_STORAGE_SIZE ) + cf2_stack_pushFixed( opStack, storage[idx] ); + } + continue; /* do not clear the stack */ + + case cf2_escIFELSE: + { + CF2_F16Dot16 arg1; + CF2_F16Dot16 arg2; + CF2_F16Dot16 cond1; + CF2_F16Dot16 cond2; + + + FT_TRACE4(( " ifelse\n" )); + + cond2 = cf2_stack_popFixed( opStack ); + cond1 = cf2_stack_popFixed( opStack ); + arg2 = cf2_stack_popFixed( opStack ); + arg1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + cond1 <= cond2 ? arg1 : arg2 ); + } + continue; /* do not clear the stack */ + + case cf2_escRANDOM: /* in spec */ + { + CF2_F16Dot16 r; + + + FT_TRACE4(( " random\n" )); + + /* only use the lower 16 bits of `random' */ + /* to generate a number in the range (0;1] */ + r = (CF2_F16Dot16) + ( ( decoder->current_subfont->random & 0xFFFF ) + 1 ); + + decoder->current_subfont->random = + cff_random( decoder->current_subfont->random ); + + cf2_stack_pushFixed( opStack, r ); + } + continue; /* do not clear the stack */ + + case cf2_escMUL: + { + CF2_F16Dot16 factor1; + CF2_F16Dot16 factor2; + + + FT_TRACE4(( " mul\n" )); + + factor2 = cf2_stack_popFixed( opStack ); + factor1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, + FT_MulFix( factor1, factor2 ) ); + } + continue; /* do not clear the stack */ + + case cf2_escSQRT: + { + CF2_F16Dot16 arg; + + + FT_TRACE4(( " sqrt\n" )); + + arg = cf2_stack_popFixed( opStack ); + if ( arg > 0 ) + { + /* use a start value that doesn't make */ + /* the algorithm's addition overflow */ + FT_Fixed root = arg < 10 ? arg : arg >> 1; + FT_Fixed new_root; + + + /* Babylonian method */ + for (;;) + { + new_root = ( root + FT_DivFix( arg, root ) + 1 ) >> 1; + if ( new_root == root ) + break; + root = new_root; + } + arg = new_root; + } + else + arg = 0; + + cf2_stack_pushFixed( opStack, arg ); + } + continue; /* do not clear the stack */ + + case cf2_escDUP: + { + CF2_F16Dot16 arg; + + + FT_TRACE4(( " dup\n" )); + + arg = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, arg ); + cf2_stack_pushFixed( opStack, arg ); + } + continue; /* do not clear the stack */ + + case cf2_escEXCH: + { + CF2_F16Dot16 arg1; + CF2_F16Dot16 arg2; + + + FT_TRACE4(( " exch\n" )); + + arg2 = cf2_stack_popFixed( opStack ); + arg1 = cf2_stack_popFixed( opStack ); + + cf2_stack_pushFixed( opStack, arg2 ); + cf2_stack_pushFixed( opStack, arg1 ); + } + continue; /* do not clear the stack */ + + case cf2_escINDEX: + { + CF2_Int idx; + CF2_UInt size; + + + FT_TRACE4(( " index\n" )); + + idx = cf2_stack_popInt( opStack ); + size = cf2_stack_count( opStack ); + + if ( size > 0 ) + { + /* for `cf2_stack_getReal', */ + /* index 0 is bottom of stack */ + CF2_UInt gr_idx; + + + if ( idx < 0 ) + gr_idx = size - 1; + else if ( (CF2_UInt)idx >= size ) + gr_idx = 0; + else + gr_idx = size - 1 - (CF2_UInt)idx; + + cf2_stack_pushFixed( opStack, + cf2_stack_getReal( opStack, + gr_idx ) ); + } + } + continue; /* do not clear the stack */ + + case cf2_escROLL: + { + CF2_Int idx; + CF2_Int count; + + + FT_TRACE4(( " roll\n" )); + + idx = cf2_stack_popInt( opStack ); + count = cf2_stack_popInt( opStack ); + + cf2_stack_roll( opStack, count, idx ); + } + continue; /* do not clear the stack */ + + case cf2_escSETCURRENTPT: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + else + { + FT_TRACE4(( " setcurrentpoint" )); + + if ( !initial_map_ready ) + break; + + /* From the T1 specification, section 6.4: */ + /* */ + /* The setcurrentpoint command is used only in */ + /* conjunction with results from OtherSubrs */ + /* procedures. */ + + /* known_othersubr_result_cnt != 0 is already handled */ + /* above. */ + + /* Note, however, that both Ghostscript and Adobe */ + /* Distiller handle this situation by silently */ + /* ignoring the inappropriate `setcurrentpoint' */ + /* instruction. So we do the same. */ +#if 0 + + if ( decoder->flex_state != 1 ) + { + FT_ERROR(( "cf2_interpT2CharString:" + " unexpected `setcurrentpoint'\n" )); + goto Syntax_Error; + } + else + ... +#endif + + curY = cf2_stack_popFixed( opStack ); + curX = cf2_stack_popFixed( opStack ); + + decoder->flex_state = 0; + } + break; + + } /* end of 2nd switch checking op2 */ + } + } + } /* end of 1st switch checking op2 */ + } /* case cf2_cmdESC */ + + break; + + case cf2_cmdHSBW: + if ( !font->isT1 ) + FT_TRACE4(( " unknown op (%d)\n", op1 )); + else + { + CF2_Fixed lsb_x; + PS_Builder* builder; + + + FT_TRACE4(( " hsbw" )); + + builder = &decoder->builder; + + builder->advance->x = cf2_stack_popFixed( opStack ); + builder->advance->y = 0; + + lsb_x = cf2_stack_popFixed( opStack ); + + builder->left_bearing->x = ADD_INT32( builder->left_bearing->x, + lsb_x ); + + haveWidth = TRUE; + + /* the `metrics_only' indicates that we only want to compute */ + /* the glyph's metrics (lsb + advance width), not load the */ + /* rest of it; so exit immediately */ + if ( builder->metrics_only ) + goto exit; + + if ( initial_map_ready ) + curX = ADD_INT32( curX, lsb_x ); + } + break; + + case cf2_cmdENDCHAR: + FT_TRACE4(( " endchar\n" )); + + if ( font->isT1 && !initial_map_ready ) + { + FT_TRACE5(( "cf2_interpT2CharString (Type 1 mode): " + "Build initial hintmap, rewinding...\n" )); + + /* trigger initial hintmap build */ + cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + + initial_map_ready = TRUE; + + /* change hints routine - clear for rewind */ + cf2_arrstack_clear( &vStemHintArray ); + cf2_arrstack_clear( &hStemHintArray ); + + cf2_hintmask_init( &hintMask, error ); + hintMask.isValid = FALSE; + hintMask.isNew = TRUE; + + /* rewind charstring */ + /* some charstrings use endchar from a final subroutine call */ + /* without returning, detect these and exit to the top level */ + /* charstring */ + while ( charstringIndex > 0 ) + { + FT_TRACE4(( " return (leaving level %d)\n", charstringIndex )); + + /* restore position in previous charstring */ + charstring = (CF2_Buffer) + cf2_arrstack_getPointer( + &subrStack, + (CF2_UInt)--charstringIndex ); + } + charstring->ptr = charstring->start; + + break; + } + + if ( cf2_stack_count( opStack ) == 1 || + cf2_stack_count( opStack ) == 5 ) + { + if ( !haveWidth ) + *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + nominalWidthX ); + } + + /* width is defined or default after this */ + haveWidth = TRUE; + + if ( decoder->width_only ) + goto exit; + + /* close path if still open */ + cf2_glyphpath_closeOpenPath( &glyphPath ); + + /* disable seac for CFF2 and Type1 */ + /* (charstring ending with args on stack) */ + if ( !font->isCFF2 && !font->isT1 && cf2_stack_count( opStack ) > 1 ) + { + /* must be either 4 or 5 -- */ + /* this is a (deprecated) implied `seac' operator */ + + CF2_Int achar; + CF2_Int bchar; + CF2_BufferRec component; + CF2_Fixed dummyWidth; /* ignore component width */ + FT_Error error2; + + + if ( doingSeac ) + { + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* nested seac */ + } + + achar = cf2_stack_popInt( opStack ); + bchar = cf2_stack_popInt( opStack ); + + curY = cf2_stack_popFixed( opStack ); + curX = cf2_stack_popFixed( opStack ); + + error2 = cf2_getSeacComponent( decoder, achar, &component ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ + goto exit; + } + cf2_interpT2CharString( font, + &component, + callbacks, + translation, + TRUE, + curX, + curY, + &dummyWidth ); + cf2_freeSeacComponent( decoder, &component ); + + error2 = cf2_getSeacComponent( decoder, bchar, &component ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ + goto exit; + } + cf2_interpT2CharString( font, + &component, + callbacks, + translation, + TRUE, + 0, + 0, + &dummyWidth ); + cf2_freeSeacComponent( decoder, &component ); + } + goto exit; + + case cf2_cmdCNTRMASK: + case cf2_cmdHINTMASK: + /* the final \n in the tracing message gets added in */ + /* `cf2_hintmask_read' (which also traces the mask bytes) */ + FT_TRACE4(( op1 == cf2_cmdCNTRMASK ? " cntrmask" : " hintmask" )); + + /* never add hints after the mask is computed */ + if ( cf2_stack_count( opStack ) > 1 && + cf2_hintmask_isValid( &hintMask ) ) + { + FT_TRACE4(( "cf2_interpT2CharString: invalid hint mask\n" )); + break; + } + + /* if there are arguments on the stack, there this is an */ + /* implied cf2_cmdVSTEMHM */ + cf2_doStems( font, + opStack, + &vStemHintArray, + width, + &haveWidth, + 0 ); + + if ( decoder->width_only ) + goto exit; + + if ( op1 == cf2_cmdHINTMASK ) + { + /* consume the hint mask bytes which follow the operator */ + cf2_hintmask_read( &hintMask, + charstring, + cf2_arrstack_size( &hStemHintArray ) + + cf2_arrstack_size( &vStemHintArray ) ); + } + else + { + /* + * Consume the counter mask bytes which follow the operator: + * Build a temporary hint map, just to place and lock those + * stems participating in the counter mask. These are most + * likely the dominant hstems, and are grouped together in a + * few counter groups, not necessarily in correspondence + * with the hint groups. This reduces the chances of + * conflicts between hstems that are initially placed in + * separate hint groups and then brought together. The + * positions are copied back to `hStemHintArray', so we can + * discard `counterMask' and `counterHintMap'. + * + */ + CF2_HintMapRec counterHintMap; + CF2_HintMaskRec counterMask; + + + cf2_hintmap_init( &counterHintMap, + font, + &glyphPath.initialHintMap, + &glyphPath.hintMoves, + scaleY ); + cf2_hintmask_init( &counterMask, error ); + + cf2_hintmask_read( &counterMask, + charstring, + cf2_arrstack_size( &hStemHintArray ) + + cf2_arrstack_size( &vStemHintArray ) ); + cf2_hintmap_build( &counterHintMap, + &hStemHintArray, + &vStemHintArray, + &counterMask, + 0, + FALSE ); + } + break; + + case cf2_cmdRMOVETO: + FT_TRACE4(( " rmoveto\n" )); + + if ( font->isT1 && !decoder->flex_state && !haveWidth ) + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " No width. Use hsbw/sbw as first op\n" )); + + if ( cf2_stack_count( opStack ) > 2 && !haveWidth ) + *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + nominalWidthX ); + + /* width is defined or default after this */ + haveWidth = TRUE; + + if ( decoder->width_only ) + goto exit; + + curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) ); + curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); + + if ( !decoder->flex_state ) + cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + + break; + + case cf2_cmdHMOVETO: + FT_TRACE4(( " hmoveto\n" )); + + if ( font->isT1 && !decoder->flex_state && !haveWidth ) + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " No width. Use hsbw/sbw as first op\n" )); + + if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) + *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ), + nominalWidthX ); + + /* width is defined or default after this */ + haveWidth = TRUE; + + if ( decoder->width_only ) + goto exit; + + curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) ); + + if ( !decoder->flex_state ) + cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + + break; + + case cf2_cmdRLINECURVE: + { + CF2_UInt count = cf2_stack_count( opStack ); + CF2_UInt idx = 0; + + + FT_TRACE4(( " rlinecurve\n" )); + + while ( idx + 6 < count ) + { + curX = ADD_INT32( curX, cf2_stack_getReal( opStack, + idx + 0 ) ); + curY = ADD_INT32( curY, cf2_stack_getReal( opStack, + idx + 1 ) ); + + cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + idx += 2; + } + + while ( idx < count ) + { + CF2_Fixed x1, y1, x2, y2, x3, y3; + + + x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX ); + y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), curY ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y1 ); + x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 ); + y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), y2 ); + + cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + + curX = x3; + curY = y3; + idx += 6; + } + + cf2_stack_clear( opStack ); + } + continue; /* no need to clear stack again */ + + case cf2_cmdVVCURVETO: + { + CF2_UInt count, count1 = cf2_stack_count( opStack ); + CF2_UInt idx = 0; + + + /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */ + /* we enforce it by clearing the second bit */ + /* (and sorting the stack indexing to suit) */ + count = count1 & ~2U; + idx += count1 - count; + + FT_TRACE4(( " vvcurveto\n" )); + + while ( idx < count ) + { + CF2_Fixed x1, y1, x2, y2, x3, y3; + + + if ( ( count - idx ) & 1 ) + { + x1 = ADD_INT32( cf2_stack_getReal( opStack, idx ), curX ); + + idx++; + } + else + x1 = curX; + + y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curY ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 ); + x3 = x2; + y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y2 ); + + cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + + curX = x3; + curY = y3; + idx += 4; + } + + cf2_stack_clear( opStack ); + } + continue; /* no need to clear stack again */ + + case cf2_cmdHHCURVETO: + { + CF2_UInt count, count1 = cf2_stack_count( opStack ); + CF2_UInt idx = 0; + + + /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */ + /* we enforce it by clearing the second bit */ + /* (and sorting the stack indexing to suit) */ + count = count1 & ~2U; + idx += count1 - count; + + FT_TRACE4(( " hhcurveto\n" )); + + while ( idx < count ) + { + CF2_Fixed x1, y1, x2, y2, x3, y3; + + + if ( ( count - idx ) & 1 ) + { + y1 = ADD_INT32( cf2_stack_getReal( opStack, idx ), curY ); + + idx++; + } + else + y1 = curY; + + x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 ); + x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), x2 ); + y3 = y2; + + cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + + curX = x3; + curY = y3; + idx += 4; + } + + cf2_stack_clear( opStack ); + } + continue; /* no need to clear stack again */ + + case cf2_cmdVHCURVETO: + case cf2_cmdHVCURVETO: + { + CF2_UInt count, count1 = cf2_stack_count( opStack ); + CF2_UInt idx = 0; + + FT_Bool alternate = FT_BOOL( op1 == cf2_cmdHVCURVETO ); + + + /* if `cf2_stack_count' isn't of the form 8n, 8n+1, */ + /* 8n+4, or 8n+5, we enforce it by clearing the */ + /* second bit */ + /* (and sorting the stack indexing to suit) */ + count = count1 & ~2U; + idx += count1 - count; + + FT_TRACE4(( alternate ? " hvcurveto\n" : " vhcurveto\n" )); + + while ( idx < count ) + { + CF2_Fixed x1, x2, x3, y1, y2, y3; + + + if ( alternate ) + { + x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX ); + y1 = curY; + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 ); + y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y2 ); + + if ( count - idx == 5 ) + { + x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 ); + + idx++; + } + else + x3 = x2; + + alternate = FALSE; + } + else + { + x1 = curX; + y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curY ); + x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 ); + y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 ); + x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), x2 ); + + if ( count - idx == 5 ) + { + y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), y2 ); + + idx++; + } + else + y3 = y2; + + alternate = TRUE; + } + + cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + + curX = x3; + curY = y3; + idx += 4; + } + + cf2_stack_clear( opStack ); + } + continue; /* no need to clear stack again */ + + case cf2_cmdEXTENDEDNMBR: + { + CF2_Int v; + + CF2_Int byte1 = cf2_buf_readByte( charstring ); + CF2_Int byte2 = cf2_buf_readByte( charstring ); + + + v = (FT_Short)( ( byte1 << 8 ) | + byte2 ); + + FT_TRACE4(( " %d", v )); + + cf2_stack_pushInt( opStack, v ); + } + continue; + + default: + /* numbers */ + { + if ( /* op1 >= 32 && */ op1 <= 246 ) + { + CF2_Int v; + + + v = op1 - 139; + + FT_TRACE4(( " %d", v )); + + /* -107 .. 107 */ + cf2_stack_pushInt( opStack, v ); + } + + else if ( /* op1 >= 247 && */ op1 <= 250 ) + { + CF2_Int v; + + + v = op1; + v -= 247; + v *= 256; + v += cf2_buf_readByte( charstring ); + v += 108; + + FT_TRACE4(( " %d", v )); + + /* 108 .. 1131 */ + cf2_stack_pushInt( opStack, v ); + } + + else if ( /* op1 >= 251 && */ op1 <= 254 ) + { + CF2_Int v; + + + v = op1; + v -= 251; + v *= 256; + v += cf2_buf_readByte( charstring ); + v = -v - 108; + + FT_TRACE4(( " %d", v )); + + /* -1131 .. -108 */ + cf2_stack_pushInt( opStack, v ); + } + + else /* op1 == 255 */ + { + CF2_Fixed v; + + FT_UInt32 byte1 = (FT_UInt32)cf2_buf_readByte( charstring ); + FT_UInt32 byte2 = (FT_UInt32)cf2_buf_readByte( charstring ); + FT_UInt32 byte3 = (FT_UInt32)cf2_buf_readByte( charstring ); + FT_UInt32 byte4 = (FT_UInt32)cf2_buf_readByte( charstring ); + + + v = (CF2_Fixed)( ( byte1 << 24 ) | + ( byte2 << 16 ) | + ( byte3 << 8 ) | + byte4 ); + + /* + * For Type 1: + * + * According to the specification, values > 32000 or < -32000 + * must be followed by a `div' operator to make the result be + * in the range [-32000;32000]. We expect that the second + * argument of `div' is not a large number. Additionally, we + * don't handle stuff like ` div + * div' or div div'. This is probably + * not allowed anyway. + * + * + div is not checked but should not be + * allowed as the large value remains untouched. + * + */ + if ( font->isT1 ) + { + if ( v > 32000 || v < -32000 ) + { + if ( large_int ) + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " no `div' after large integer\n" )); + else + large_int = TRUE; + } + + FT_TRACE4(( " %d", v )); + + cf2_stack_pushInt( opStack, (CF2_Int)v ); + } + else + { + FT_TRACE4(( " %.5fF", v / 65536.0 )); + + cf2_stack_pushFixed( opStack, v ); + } + } + } + continue; /* don't clear stack */ + + } /* end of switch statement checking `op1' */ + + cf2_stack_clear( opStack ); + + } /* end of main interpreter loop */ + + /* we get here if the charstring ends without cf2_cmdENDCHAR */ + FT_TRACE4(( "cf2_interpT2CharString:" + " charstring ends without ENDCHAR\n" )); + + exit: + /* check whether last error seen is also the first one */ + cf2_setError( error, lastError ); + + if ( *error ) + FT_TRACE4(( "charstring error %d\n", *error )); + + /* free resources from objects we've used */ + cf2_glyphpath_finalize( &glyphPath ); + cf2_arrstack_finalize( &vStemHintArray ); + cf2_arrstack_finalize( &hStemHintArray ); + cf2_arrstack_finalize( &subrStack ); + cf2_stack_free( opStack ); + + FT_TRACE4(( "\n" )); + + return; + } + + +/* END */ diff --git a/src/cff/cf2intrp.h b/src/psaux/psintrp.h similarity index 95% rename from src/cff/cf2intrp.h rename to src/psaux/psintrp.h index ec030e894..4790aaa30 100644 --- a/src/cff/cf2intrp.h +++ b/src/psaux/psintrp.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2font.h */ +/* psintrp.h */ /* */ /* Adobe's CFF Interpreter (specification). */ /* */ @@ -36,12 +36,12 @@ /***************************************************************************/ -#ifndef CF2INTRP_H_ -#define CF2INTRP_H_ +#ifndef PSINTRP_H_ +#define PSINTRP_H_ -#include "cf2ft.h" -#include "cf2hints.h" +#include "psft.h" +#include "pshints.h" FT_BEGIN_HEADER @@ -77,7 +77,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2INTRP_H_ */ +#endif /* PSINTRP_H_ */ /* END */ diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index d18e821a9..f54bc7e41 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -4,7 +4,7 @@ /* */ /* Auxiliary functions for PostScript fonts (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,11 +20,13 @@ #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H +#include FT_DRIVER_H #include "psobjs.h" #include "psconv.h" #include "psauxerr.h" +#include "psauxmod.h" /*************************************************************************/ @@ -1551,7 +1553,7 @@ builder->current = &loader->current.outline; FT_GlyphLoader_Rewind( loader ); - builder->hints_globals = size->internal; + builder->hints_globals = size->internal->module_data; builder->hints_funcs = NULL; if ( hinting ) @@ -1718,6 +1720,581 @@ first = outline->n_contours <= 1 ? 0 : outline->contours[outline->n_contours - 2] + 1; + /* in malformed fonts it can happen that a contour was started */ + /* but no points were added */ + if ( outline->n_contours && first == outline->n_points ) + { + outline->n_contours--; + return; + } + + /* We must not include the last point in the path if it */ + /* is located on the first point. */ + if ( outline->n_points > 1 ) + { + FT_Vector* p1 = outline->points + first; + FT_Vector* p2 = outline->points + outline->n_points - 1; + FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1; + + + /* `delete' last point only if it coincides with the first */ + /* point and it is not a control point (which can happen). */ + if ( p1->x == p2->x && p1->y == p2->y ) + if ( *control == FT_CURVE_TAG_ON ) + outline->n_points--; + } + + if ( outline->n_contours > 0 ) + { + /* Don't add contours only consisting of one point, i.e., */ + /* check whether the first and the last point is the same. */ + if ( first == outline->n_points - 1 ) + { + outline->n_contours--; + outline->n_points--; + } + else + outline->contours[outline->n_contours - 1] = + (short)( outline->n_points - 1 ); + } + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CFF BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* */ + /* cff_builder_init */ + /* */ + /* */ + /* Initializes a given glyph builder. */ + /* */ + /* */ + /* builder :: A pointer to the glyph builder to initialize. */ + /* */ + /* */ + /* face :: The current face object. */ + /* */ + /* size :: The current size object. */ + /* */ + /* glyph :: The current glyph object. */ + /* */ + /* hinting :: Whether hinting is active. */ + /* */ + FT_LOCAL_DEF( void ) + cff_builder_init( CFF_Builder* builder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot glyph, + FT_Bool hinting ) + { + builder->path_begun = 0; + builder->load_points = 1; + + builder->face = face; + builder->glyph = glyph; + builder->memory = face->root.memory; + + if ( glyph ) + { + FT_GlyphLoader loader = glyph->root.internal->loader; + + + builder->loader = loader; + builder->base = &loader->base.outline; + builder->current = &loader->current.outline; + FT_GlyphLoader_Rewind( loader ); + + builder->hints_globals = NULL; + builder->hints_funcs = NULL; + + if ( hinting && size ) + { + FT_Size ftsize = FT_SIZE( size ); + CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data; + + if ( internal ) + { + builder->hints_globals = (void *)internal->topfont; + builder->hints_funcs = glyph->root.internal->glyph_hints; + } + } + } + + builder->pos_x = 0; + builder->pos_y = 0; + + builder->left_bearing.x = 0; + builder->left_bearing.y = 0; + builder->advance.x = 0; + builder->advance.y = 0; + + builder->funcs = cff_builder_funcs; + } + + + /*************************************************************************/ + /* */ + /* */ + /* cff_builder_done */ + /* */ + /* */ + /* Finalizes a given glyph builder. Its contents can still be used */ + /* after the call, but the function saves important information */ + /* within the corresponding glyph slot. */ + /* */ + /* */ + /* builder :: A pointer to the glyph builder to finalize. */ + /* */ + FT_LOCAL_DEF( void ) + cff_builder_done( CFF_Builder* builder ) + { + CFF_GlyphSlot glyph = builder->glyph; + + + if ( glyph ) + glyph->root.outline = *builder->base; + } + + + /* check that there is enough space for `count' more points */ + FT_LOCAL_DEF( FT_Error ) + cff_check_points( CFF_Builder* builder, + FT_Int count ) + { + return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 ); + } + + + /* add a new point, do not check space */ + FT_LOCAL_DEF( void ) + cff_builder_add_point( CFF_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ) + { + FT_Outline* outline = builder->current; + + + if ( builder->load_points ) + { + FT_Vector* point = outline->points + outline->n_points; + FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); + + + if ( driver->hinting_engine == FT_HINTING_FREETYPE ) + { + point->x = x >> 16; + point->y = y >> 16; + } + else +#endif + { + /* cf2_decoder_parse_charstrings uses 16.16 coordinates */ + point->x = x >> 10; + point->y = y >> 10; + } + *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC ); + } + + outline->n_points++; + } + + + /* check space for a new on-curve point, then add it */ + FT_LOCAL_DEF( FT_Error ) + cff_builder_add_point1( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ) + { + FT_Error error; + + + error = cff_check_points( builder, 1 ); + if ( !error ) + cff_builder_add_point( builder, x, y, 1 ); + + return error; + } + + + /* check space for a new contour, then add it */ + FT_LOCAL_DEF( FT_Error ) + cff_builder_add_contour( CFF_Builder* builder ) + { + FT_Outline* outline = builder->current; + FT_Error error; + + + if ( !builder->load_points ) + { + outline->n_contours++; + return FT_Err_Ok; + } + + error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 ); + if ( !error ) + { + if ( outline->n_contours > 0 ) + outline->contours[outline->n_contours - 1] = + (short)( outline->n_points - 1 ); + + outline->n_contours++; + } + + return error; + } + + + /* if a path was begun, add its first on-curve point */ + FT_LOCAL_DEF( FT_Error ) + cff_builder_start_point( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ) + { + FT_Error error = FT_Err_Ok; + + + /* test whether we are building a new contour */ + if ( !builder->path_begun ) + { + builder->path_begun = 1; + error = cff_builder_add_contour( builder ); + if ( !error ) + error = cff_builder_add_point1( builder, x, y ); + } + + return error; + } + + + /* close the current contour */ + FT_LOCAL_DEF( void ) + cff_builder_close_contour( CFF_Builder* builder ) + { + FT_Outline* outline = builder->current; + FT_Int first; + + + if ( !outline ) + return; + + first = outline->n_contours <= 1 + ? 0 : outline->contours[outline->n_contours - 2] + 1; + + /* We must not include the last point in the path if it */ + /* is located on the first point. */ + if ( outline->n_points > 1 ) + { + FT_Vector* p1 = outline->points + first; + FT_Vector* p2 = outline->points + outline->n_points - 1; + FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1; + + + /* `delete' last point only if it coincides with the first */ + /* point and if it is not a control point (which can happen). */ + if ( p1->x == p2->x && p1->y == p2->y ) + if ( *control == FT_CURVE_TAG_ON ) + outline->n_points--; + } + + if ( outline->n_contours > 0 ) + { + /* Don't add contours only consisting of one point, i.e., */ + /* check whether begin point and last point are the same. */ + if ( first == outline->n_points - 1 ) + { + outline->n_contours--; + outline->n_points--; + } + else + outline->contours[outline->n_contours - 1] = + (short)( outline->n_points - 1 ); + } + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** PS BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* */ + /* ps_builder_init */ + /* */ + /* */ + /* Initializes a given glyph builder. */ + /* */ + /* */ + /* builder :: A pointer to the glyph builder to initialize. */ + /* */ + /* */ + /* face :: The current face object. */ + /* */ + /* size :: The current size object. */ + /* */ + /* glyph :: The current glyph object. */ + /* */ + /* hinting :: Whether hinting should be applied. */ + /* */ + FT_LOCAL_DEF( void ) + ps_builder_init( PS_Builder* ps_builder, + void* builder, + FT_Bool is_t1 ) + { + FT_ZERO( ps_builder ); + + if ( is_t1 ) + { + T1_Builder t1builder = (T1_Builder)builder; + + + ps_builder->memory = t1builder->memory; + ps_builder->face = (FT_Face)t1builder->face; + ps_builder->glyph = (CFF_GlyphSlot)t1builder->glyph; + ps_builder->loader = t1builder->loader; + ps_builder->base = t1builder->base; + ps_builder->current = t1builder->current; + + ps_builder->pos_x = &t1builder->pos_x; + ps_builder->pos_y = &t1builder->pos_y; + + ps_builder->left_bearing = &t1builder->left_bearing; + ps_builder->advance = &t1builder->advance; + + ps_builder->bbox = &t1builder->bbox; + ps_builder->path_begun = 0; + ps_builder->load_points = t1builder->load_points; + ps_builder->no_recurse = t1builder->no_recurse; + + ps_builder->metrics_only = t1builder->metrics_only; + } + else + { + CFF_Builder* cffbuilder = (CFF_Builder*)builder; + + + ps_builder->memory = cffbuilder->memory; + ps_builder->face = (FT_Face)cffbuilder->face; + ps_builder->glyph = cffbuilder->glyph; + ps_builder->loader = cffbuilder->loader; + ps_builder->base = cffbuilder->base; + ps_builder->current = cffbuilder->current; + + ps_builder->pos_x = &cffbuilder->pos_x; + ps_builder->pos_y = &cffbuilder->pos_y; + + ps_builder->left_bearing = &cffbuilder->left_bearing; + ps_builder->advance = &cffbuilder->advance; + + ps_builder->bbox = &cffbuilder->bbox; + ps_builder->path_begun = cffbuilder->path_begun; + ps_builder->load_points = cffbuilder->load_points; + ps_builder->no_recurse = cffbuilder->no_recurse; + + ps_builder->metrics_only = cffbuilder->metrics_only; + } + + ps_builder->is_t1 = is_t1; + ps_builder->funcs = ps_builder_funcs; + } + + + /*************************************************************************/ + /* */ + /* */ + /* ps_builder_done */ + /* */ + /* */ + /* Finalizes a given glyph builder. Its contents can still be used */ + /* after the call, but the function saves important information */ + /* within the corresponding glyph slot. */ + /* */ + /* */ + /* builder :: A pointer to the glyph builder to finalize. */ + /* */ + FT_LOCAL_DEF( void ) + ps_builder_done( PS_Builder* builder ) + { + CFF_GlyphSlot glyph = builder->glyph; + + + if ( glyph ) + glyph->root.outline = *builder->base; + } + + + /* check that there is enough space for `count' more points */ + FT_LOCAL_DEF( FT_Error ) + ps_builder_check_points( PS_Builder* builder, + FT_Int count ) + { + return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 ); + } + + + /* add a new point, do not check space */ + FT_LOCAL_DEF( void ) + ps_builder_add_point( PS_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ) + { + FT_Outline* outline = builder->current; + + + if ( builder->load_points ) + { + FT_Vector* point = outline->points + outline->n_points; + FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; + +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); + + + if ( !builder->is_t1 && + driver->hinting_engine == FT_HINTING_FREETYPE ) + { + point->x = x >> 16; + point->y = y >> 16; + } + else +#endif +#ifdef T1_CONFIG_OPTION_OLD_ENGINE +#ifndef CFF_CONFIG_OPTION_OLD_ENGINE + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face ); +#endif + if ( builder->is_t1 && + driver->hinting_engine == FT_HINTING_FREETYPE ) + { + point->x = FIXED_TO_INT( x ); + point->y = FIXED_TO_INT( y ); + } + else +#endif + { + /* cf2_decoder_parse_charstrings uses 16.16 coordinates */ + point->x = x >> 10; + point->y = y >> 10; + } + *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC ); + } + outline->n_points++; + } + + + /* check space for a new on-curve point, then add it */ + FT_LOCAL_DEF( FT_Error ) + ps_builder_add_point1( PS_Builder* builder, + FT_Pos x, + FT_Pos y ) + { + FT_Error error; + + + error = ps_builder_check_points( builder, 1 ); + if ( !error ) + ps_builder_add_point( builder, x, y, 1 ); + + return error; + } + + + /* check space for a new contour, then add it */ + FT_LOCAL_DEF( FT_Error ) + ps_builder_add_contour( PS_Builder* builder ) + { + FT_Outline* outline = builder->current; + FT_Error error; + + + /* this might happen in invalid fonts */ + if ( !outline ) + { + FT_ERROR(( "ps_builder_add_contour: no outline to add points to\n" )); + return FT_THROW( Invalid_File_Format ); + } + + if ( !builder->load_points ) + { + outline->n_contours++; + return FT_Err_Ok; + } + + error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 ); + if ( !error ) + { + if ( outline->n_contours > 0 ) + outline->contours[outline->n_contours - 1] = + (short)( outline->n_points - 1 ); + + outline->n_contours++; + } + + return error; + } + + + /* if a path was begun, add its first on-curve point */ + FT_LOCAL_DEF( FT_Error ) + ps_builder_start_point( PS_Builder* builder, + FT_Pos x, + FT_Pos y ) + { + FT_Error error = FT_Err_Ok; + + + /* test whether we are building a new contour */ + if ( !builder->path_begun ) + { + builder->path_begun = 1; + error = ps_builder_add_contour( builder ); + if ( !error ) + error = ps_builder_add_point1( builder, x, y ); + } + + return error; + } + + + /* close the current contour */ + FT_LOCAL_DEF( void ) + ps_builder_close_contour( PS_Builder* builder ) + { + FT_Outline* outline = builder->current; + FT_Int first; + + + if ( !outline ) + return; + + first = outline->n_contours <= 1 + ? 0 : outline->contours[outline->n_contours - 2] + 1; + + /* in malformed fonts it can happen that a contour was started */ + /* but no points were added */ + if ( outline->n_contours && first == outline->n_points ) + { + outline->n_contours--; + return; + } + /* We must not include the last point in the path if it */ /* is located on the first point. */ if ( outline->n_points > 1 ) @@ -1758,6 +2335,176 @@ /*************************************************************************/ /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* */ + /* ps_decoder_init */ + /* */ + /* */ + /* Creates a wrapper decoder for use in the combined */ + /* Type 1 / CFF interpreter. */ + /* */ + /* */ + /* ps_decoder :: A pointer to the decoder to initialize. */ + /* */ + /* */ + /* decoder :: A pointer to the original decoder. */ + /* */ + /* is_t1 :: Flag indicating Type 1 or CFF */ + /* */ + FT_LOCAL_DEF( void ) + ps_decoder_init( PS_Decoder* ps_decoder, + void* decoder, + FT_Bool is_t1 ) + { + FT_ZERO( ps_decoder ); + + if ( is_t1 ) + { + T1_Decoder t1_decoder = (T1_Decoder)decoder; + + + ps_builder_init( &ps_decoder->builder, + &t1_decoder->builder, + is_t1 ); + + ps_decoder->cf2_instance = &t1_decoder->cf2_instance; + ps_decoder->psnames = t1_decoder->psnames; + + ps_decoder->num_glyphs = t1_decoder->num_glyphs; + ps_decoder->glyph_names = t1_decoder->glyph_names; + ps_decoder->hint_mode = t1_decoder->hint_mode; + ps_decoder->blend = t1_decoder->blend; + + ps_decoder->num_locals = (FT_UInt)t1_decoder->num_subrs; + ps_decoder->locals = t1_decoder->subrs; + ps_decoder->locals_len = t1_decoder->subrs_len; + ps_decoder->locals_hash = t1_decoder->subrs_hash; + + ps_decoder->buildchar = t1_decoder->buildchar; + ps_decoder->len_buildchar = t1_decoder->len_buildchar; + + ps_decoder->lenIV = t1_decoder->lenIV; + } + else + { + CFF_Decoder* cff_decoder = (CFF_Decoder*)decoder; + + + ps_builder_init( &ps_decoder->builder, + &cff_decoder->builder, + is_t1 ); + + ps_decoder->cff = cff_decoder->cff; + ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance; + ps_decoder->current_subfont = cff_decoder->current_subfont; + + ps_decoder->num_globals = cff_decoder->num_globals; + ps_decoder->globals = cff_decoder->globals; + ps_decoder->globals_bias = cff_decoder->globals_bias; + ps_decoder->num_locals = cff_decoder->num_locals; + ps_decoder->locals = cff_decoder->locals; + ps_decoder->locals_bias = cff_decoder->locals_bias; + + ps_decoder->glyph_width = &cff_decoder->glyph_width; + ps_decoder->width_only = cff_decoder->width_only; + + ps_decoder->hint_mode = cff_decoder->hint_mode; + + ps_decoder->get_glyph_callback = cff_decoder->get_glyph_callback; + ps_decoder->free_glyph_callback = cff_decoder->free_glyph_callback; + } + } + + + /* Synthesize a SubFont object for Type 1 fonts, for use in the */ + /* new interpreter to access Private dict data. */ + FT_LOCAL_DEF( void ) + t1_make_subfont( FT_Face face, + PS_Private priv, + CFF_SubFont subfont ) + { + CFF_Private cpriv = &subfont->private_dict; + FT_UInt n, count; + + + FT_ZERO( subfont ); + FT_ZERO( cpriv ); + + count = cpriv->num_blue_values = priv->num_blue_values; + for ( n = 0; n < count; n++ ) + cpriv->blue_values[n] = (FT_Pos)priv->blue_values[n]; + + count = cpriv->num_other_blues = priv->num_other_blues; + for ( n = 0; n < count; n++ ) + cpriv->other_blues[n] = (FT_Pos)priv->other_blues[n]; + + count = cpriv->num_family_blues = priv->num_family_blues; + for ( n = 0; n < count; n++ ) + cpriv->family_blues[n] = (FT_Pos)priv->family_blues[n]; + + count = cpriv->num_family_other_blues = priv->num_family_other_blues; + for ( n = 0; n < count; n++ ) + cpriv->family_other_blues[n] = (FT_Pos)priv->family_other_blues[n]; + + cpriv->blue_scale = priv->blue_scale; + cpriv->blue_shift = (FT_Pos)priv->blue_shift; + cpriv->blue_fuzz = (FT_Pos)priv->blue_fuzz; + + cpriv->standard_width = (FT_Pos)priv->standard_width[0]; + cpriv->standard_height = (FT_Pos)priv->standard_height[0]; + + count = cpriv->num_snap_widths = priv->num_snap_widths; + for ( n = 0; n < count; n++ ) + cpriv->snap_widths[n] = (FT_Pos)priv->snap_widths[n]; + + count = cpriv->num_snap_heights = priv->num_snap_heights; + for ( n = 0; n < count; n++ ) + cpriv->snap_heights[n] = (FT_Pos)priv->snap_heights[n]; + + cpriv->force_bold = priv->force_bold; + cpriv->lenIV = priv->lenIV; + cpriv->language_group = priv->language_group; + cpriv->expansion_factor = priv->expansion_factor; + + cpriv->subfont = subfont; + + + /* Initialize the random number generator. */ + if ( face->internal->random_seed != -1 ) + { + /* If we have a face-specific seed, use it. */ + /* If non-zero, update it to a positive value. */ + subfont->random = (FT_UInt32)face->internal->random_seed; + if ( face->internal->random_seed ) + { + do + { + face->internal->random_seed = (FT_Int32)cff_random( + (FT_UInt32)face->internal->random_seed ); + + } while ( face->internal->random_seed < 0 ); + } + } + if ( !subfont->random ) + { + FT_UInt32 seed; + + + /* compute random seed from some memory addresses */ + seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^ + (FT_Offset)(char*)&face ^ + (FT_Offset)(char*)&subfont ); + seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 ); + if ( seed == 0 ) + seed = 0x7384; + + subfont->random = seed; + } + } + + FT_LOCAL_DEF( void ) t1_decrypt( FT_Byte* buffer, FT_Offset length, @@ -1771,4 +2518,16 @@ } + FT_LOCAL_DEF( FT_UInt32 ) + cff_random( FT_UInt32 r ) + { + /* a 32bit version of the `xorshift' algorithm */ + r ^= r << 13; + r ^= r >> 17; + r ^= r << 5; + + return r; + } + + /* END */ diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index 202e5b241..8e0fe5fa4 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -4,7 +4,7 @@ /* */ /* Auxiliary functions for PostScript fonts (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,6 +22,7 @@ #include #include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_CFF_OBJECTS_TYPES_H FT_BEGIN_HEADER @@ -190,6 +191,92 @@ FT_BEGIN_HEADER t1_builder_close_contour( T1_Builder builder ); + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CFF BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL( void ) + cff_builder_init( CFF_Builder* builder, + TT_Face face, + CFF_Size size, + CFF_GlyphSlot glyph, + FT_Bool hinting ); + + FT_LOCAL( void ) + cff_builder_done( CFF_Builder* builder ); + + FT_LOCAL( FT_Error ) + cff_check_points( CFF_Builder* builder, + FT_Int count ); + + FT_LOCAL( void ) + cff_builder_add_point( CFF_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ); + FT_LOCAL( FT_Error ) + cff_builder_add_point1( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + FT_LOCAL( FT_Error ) + cff_builder_start_point( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + FT_LOCAL( void ) + cff_builder_close_contour( CFF_Builder* builder ); + + FT_LOCAL( FT_Error ) + cff_builder_add_contour( CFF_Builder* builder ); + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** PS BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL( void ) + ps_builder_init( PS_Builder* ps_builder, + void* builder, + FT_Bool is_t1 ); + + + FT_LOCAL( void ) + ps_builder_done( PS_Builder* builder ); + + FT_LOCAL( FT_Error ) + ps_builder_check_points( PS_Builder* builder, + FT_Int count ); + + FT_LOCAL( void ) + ps_builder_add_point( PS_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ); + + FT_LOCAL( FT_Error ) + ps_builder_add_point1( PS_Builder* builder, + FT_Pos x, + FT_Pos y ); + + FT_LOCAL( FT_Error ) + ps_builder_add_contour( PS_Builder* builder ); + + FT_LOCAL( FT_Error ) + ps_builder_start_point( PS_Builder* builder, + FT_Pos x, + FT_Pos y ); + + FT_LOCAL( void ) + ps_builder_close_contour( PS_Builder* builder ); + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -198,12 +285,26 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ + FT_LOCAL( void ) + ps_decoder_init( PS_Decoder* ps_decoder, + void* decoder, + FT_Bool is_t1 ); + + FT_LOCAL( void ) + t1_make_subfont( FT_Face face, + PS_Private priv, + CFF_SubFont subfont ); + FT_LOCAL( void ) t1_decrypt( FT_Byte* buffer, FT_Offset length, FT_UShort seed ); + FT_LOCAL( FT_UInt32 ) + cff_random( FT_UInt32 r ); + + FT_END_HEADER #endif /* PSOBJS_H_ */ diff --git a/src/cff/cf2read.c b/src/psaux/psread.c similarity index 97% rename from src/cff/cf2read.c rename to src/psaux/psread.c index 2b429e3ee..719863ce1 100644 --- a/src/cff/cf2read.c +++ b/src/psaux/psread.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2read.c */ +/* psread.c */ /* */ /* Adobe's code for stream handling (body). */ /* */ @@ -36,12 +36,12 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2glue.h" +#include "psglue.h" -#include "cf2error.h" +#include "pserror.h" /* Define CF2_IO_FAIL as 1 to enable random errors and random */ diff --git a/src/cff/cf2read.h b/src/psaux/psread.h similarity index 96% rename from src/cff/cf2read.h rename to src/psaux/psread.h index b0b0db803..464b29ba7 100644 --- a/src/cff/cf2read.h +++ b/src/psaux/psread.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2read.h */ +/* psread.h */ /* */ /* Adobe's code for stream handling (specification). */ /* */ @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2READ_H_ -#define CF2READ_H_ +#ifndef PSREAD_H_ +#define PSREAD_H_ FT_BEGIN_HEADER @@ -62,7 +62,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2READ_H_ */ +#endif /* PSREAD_H_ */ /* END */ diff --git a/src/cff/cf2stack.c b/src/psaux/psstack.c similarity index 98% rename from src/cff/cf2stack.c rename to src/psaux/psstack.c index 12a026d21..69d063349 100644 --- a/src/cff/cf2stack.c +++ b/src/psaux/psstack.c @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2stack.c */ +/* psstack.c */ /* */ /* Adobe's code for emulating a CFF stack (body). */ /* */ @@ -36,14 +36,14 @@ /***************************************************************************/ -#include "cf2ft.h" +#include "psft.h" #include FT_INTERNAL_DEBUG_H -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2stack.h" +#include "psglue.h" +#include "psfont.h" +#include "psstack.h" -#include "cf2error.h" +#include "pserror.h" /* Allocate and initialize an instance of CF2_Stack. */ diff --git a/src/cff/cf2stack.h b/src/psaux/psstack.h similarity index 97% rename from src/cff/cf2stack.h rename to src/psaux/psstack.h index ef08eefe4..38f7b41c6 100644 --- a/src/cff/cf2stack.h +++ b/src/psaux/psstack.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2stack.h */ +/* psstack.h */ /* */ /* Adobe's code for emulating a CFF stack (specification). */ /* */ @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2STACK_H_ -#define CF2STACK_H_ +#ifndef PSSTACK_H_ +#define PSSTACK_H_ FT_BEGIN_HEADER @@ -115,7 +115,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2STACK_H_ */ +#endif /* PSSTACK_H_ */ /* END */ diff --git a/src/cff/cf2types.h b/src/psaux/pstypes.h similarity index 96% rename from src/cff/cf2types.h rename to src/psaux/pstypes.h index 5b7e1239a..dfbaa3d47 100644 --- a/src/cff/cf2types.h +++ b/src/psaux/pstypes.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cf2types.h */ +/* pstypes.h */ /* */ /* Adobe's code for defining data types (specification only). */ /* */ @@ -36,8 +36,8 @@ /***************************************************************************/ -#ifndef CF2TYPES_H_ -#define CF2TYPES_H_ +#ifndef PSTYPES_H_ +#define PSTYPES_H_ #include #include FT_FREETYPE_H @@ -72,7 +72,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* CF2TYPES_H_ */ +#endif /* PSTYPES_H_ */ /* END */ diff --git a/src/psaux/rules.mk b/src/psaux/rules.mk index 542ae12d2..a87bfe968 100644 --- a/src/psaux/rules.mk +++ b/src/psaux/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -33,12 +33,25 @@ PSAUX_DRV_SRC := $(PSAUX_DIR)/psobjs.c \ $(PSAUX_DIR)/t1cmap.c \ $(PSAUX_DIR)/afmparse.c \ $(PSAUX_DIR)/psconv.c \ - $(PSAUX_DIR)/psauxmod.c + $(PSAUX_DIR)/psauxmod.c \ + $(PSAUX_DIR)/psarrst.c \ + $(PSAUX_DIR)/psblues.c \ + $(PSAUX_DIR)/pserror.c \ + $(PSAUX_DIR)/psfont.c \ + $(PSAUX_DIR)/psft.c \ + $(PSAUX_DIR)/pshints.c \ + $(PSAUX_DIR)/psintrp.c \ + $(PSAUX_DIR)/psread.c \ + $(PSAUX_DIR)/psstack.c \ + $(PSAUX_DIR)/cffdecode.c # PSAUX driver headers # PSAUX_DRV_H := $(PSAUX_DRV_SRC:%c=%h) \ - $(PSAUX_DIR)/psauxerr.h + $(PSAUX_DIR)/psauxerr.h \ + $(PSAUX_DIR)/psfixed.h \ + $(PSAUX_DIR)/psglue.h \ + $(PSAUX_DIR)/pstypes.h # PSAUX driver object(s) diff --git a/src/psaux/t1cmap.c b/src/psaux/t1cmap.c index 45b713eb7..112a7892b 100644 --- a/src/psaux/t1cmap.c +++ b/src/psaux/t1cmap.c @@ -4,7 +4,7 @@ /* */ /* Type 1 character map support (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/t1cmap.h b/src/psaux/t1cmap.h index 7870245a3..4308e31d2 100644 --- a/src/psaux/t1cmap.h +++ b/src/psaux/t1cmap.h @@ -4,7 +4,7 @@ /* */ /* Type 1 character map support (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index af7b465ed..6ad145661 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -4,7 +4,7 @@ /* */ /* PostScript Type 1 decoding routines (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -109,6 +109,56 @@ }; + /*************************************************************************/ + /* */ + /* */ + /* t1_lookup_glyph_by_stdcharcode_ps */ + /* */ + /* */ + /* Looks up a given glyph by its StandardEncoding charcode. Used to */ + /* implement the SEAC Type 1 operator in the Adobe engine */ + /* */ + /* */ + /* face :: The current face object. */ + /* */ + /* charcode :: The character code to look for. */ + /* */ + /* */ + /* A glyph index in the font face. Returns -1 if the corresponding */ + /* glyph wasn't found. */ + /* */ + FT_LOCAL_DEF( FT_Int ) + t1_lookup_glyph_by_stdcharcode_ps( PS_Decoder* decoder, + FT_Int charcode ) + { + FT_UInt n; + const FT_String* glyph_name; + FT_Service_PsCMaps psnames = decoder->psnames; + + + /* check range of standard char code */ + if ( charcode < 0 || charcode > 255 ) + return -1; + + glyph_name = psnames->adobe_std_strings( + psnames->adobe_std_encoding[charcode]); + + for ( n = 0; n < decoder->num_glyphs; n++ ) + { + FT_String* name = (FT_String*)decoder->glyph_names[n]; + + + if ( name && + name[0] == glyph_name[0] && + ft_strcmp( name, glyph_name ) == 0 ) + return (FT_Int)n; + } + + return -1; + } + + +#ifdef T1_CONFIG_OPTION_OLD_ENGINE /*************************************************************************/ /* */ /* */ @@ -158,6 +208,15 @@ } + /* parse a single Type 1 glyph */ + FT_LOCAL_DEF( FT_Error ) + t1_decoder_parse_glyph( T1_Decoder decoder, + FT_UInt glyph ) + { + return decoder->parse_callback( decoder, glyph ); + } + + /*************************************************************************/ /* */ /* */ @@ -780,10 +839,19 @@ /* point without adding any point to the outline */ idx = decoder->num_flex_vectors++; if ( idx > 0 && idx < 7 ) + { + /* in malformed fonts it is possible to have other */ + /* opcodes in the middle of a flex (which don't */ + /* increase `num_flex_vectors'); we thus have to */ + /* check whether we can add a point */ + if ( FT_SET_ERROR( t1_builder_check_points( builder, 1 ) ) ) + goto Syntax_Error; + t1_builder_add_point( builder, x, y, (FT_Byte)( idx == 3 || idx == 6 ) ); + } } break; @@ -855,7 +923,9 @@ for ( mm = 1; mm < blend->num_designs; mm++ ) - tmp += FT_MulFix( *delta++, blend->weight_vector[mm] ); + tmp = ADD_LONG( tmp, + FT_MulFix( *delta++, + blend->weight_vector[mm] ) ); *values++ = tmp; } @@ -895,7 +965,7 @@ if ( arg_cnt != 2 ) goto Unexpected_OtherSubr; - top[0] += top[1]; /* XXX (over|under)flow */ + top[0] = ADD_LONG( top[0], top[1] ); known_othersubr_result_cnt = 1; break; @@ -906,7 +976,7 @@ if ( arg_cnt != 2 ) goto Unexpected_OtherSubr; - top[0] -= top[1]; /* XXX (over|under)flow */ + top[0] = SUB_LONG( top[0], top[1] ); known_othersubr_result_cnt = 1; break; @@ -1138,11 +1208,13 @@ builder->parse_state = T1_Parse_Have_Width; - builder->left_bearing.x += top[0]; - builder->advance.x = top[1]; - builder->advance.y = 0; + builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, + top[0] ); + + builder->advance.x = top[1]; + builder->advance.y = 0; - orig_x = x = builder->pos_x + top[0]; + orig_x = x = ADD_LONG( builder->pos_x, top[0] ); orig_y = y = builder->pos_y; FT_UNUSED( orig_y ); @@ -1168,13 +1240,16 @@ builder->parse_state = T1_Parse_Have_Width; - builder->left_bearing.x += top[0]; - builder->left_bearing.y += top[1]; - builder->advance.x = top[2]; - builder->advance.y = top[3]; + builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, + top[0] ); + builder->left_bearing.y = ADD_LONG( builder->left_bearing.y, + top[1] ); - x = builder->pos_x + top[0]; - y = builder->pos_y + top[1]; + builder->advance.x = top[2]; + builder->advance.y = top[3]; + + x = ADD_LONG( builder->pos_x, top[0] ); + y = ADD_LONG( builder->pos_y, top[1] ); /* the `metrics_only' indicates that we only want to compute */ /* the glyph's metrics (lsb + advance width), not load the */ @@ -1201,13 +1276,14 @@ if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ) goto Fail; - x += top[0]; + x = ADD_LONG( x, top[0] ); goto Add_Line; case op_hmoveto: FT_TRACE4(( " hmoveto" )); - x += top[0]; + x = ADD_LONG( x, top[0] ); + if ( !decoder->flex_state ) { if ( builder->parse_state == T1_Parse_Start ) @@ -1223,12 +1299,14 @@ FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) ) goto Fail; - x += top[0]; + x = ADD_LONG( x, top[0] ); t1_builder_add_point( builder, x, y, 0 ); - x += top[1]; - y += top[2]; + + x = ADD_LONG( x, top[1] ); + y = ADD_LONG( y, top[2] ); t1_builder_add_point( builder, x, y, 0 ); - y += top[3]; + + y = ADD_LONG( y, top[3] ); t1_builder_add_point( builder, x, y, 1 ); break; @@ -1238,8 +1316,8 @@ if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ) goto Fail; - x += top[0]; - y += top[1]; + x = ADD_LONG( x, top[0] ); + y = ADD_LONG( y, top[1] ); Add_Line: if ( FT_SET_ERROR( t1_builder_add_point1( builder, x, y ) ) ) @@ -1249,8 +1327,9 @@ case op_rmoveto: FT_TRACE4(( " rmoveto" )); - x += top[0]; - y += top[1]; + x = ADD_LONG( x, top[0] ); + y = ADD_LONG( y, top[1] ); + if ( !decoder->flex_state ) { if ( builder->parse_state == T1_Parse_Start ) @@ -1266,16 +1345,16 @@ FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) ) goto Fail; - x += top[0]; - y += top[1]; + x = ADD_LONG( x, top[0] ); + y = ADD_LONG( y, top[1] ); t1_builder_add_point( builder, x, y, 0 ); - x += top[2]; - y += top[3]; + x = ADD_LONG( x, top[2] ); + y = ADD_LONG( y, top[3] ); t1_builder_add_point( builder, x, y, 0 ); - x += top[4]; - y += top[5]; + x = ADD_LONG( x, top[4] ); + y = ADD_LONG( y, top[5] ); t1_builder_add_point( builder, x, y, 1 ); break; @@ -1286,12 +1365,14 @@ FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) ) goto Fail; - y += top[0]; + y = ADD_LONG( y, top[0] ); t1_builder_add_point( builder, x, y, 0 ); - x += top[1]; - y += top[2]; + + x = ADD_LONG( x, top[1] ); + y = ADD_LONG( y, top[2] ); t1_builder_add_point( builder, x, y, 0 ); - x += top[3]; + + x = ADD_LONG( x, top[3] ); t1_builder_add_point( builder, x, y, 1 ); break; @@ -1301,13 +1382,14 @@ if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ) goto Fail; - y += top[0]; + y = ADD_LONG( y, top[0] ); goto Add_Line; case op_vmoveto: FT_TRACE4(( " vmoveto" )); - y += top[0]; + y = ADD_LONG( y, top[0] ); + if ( !decoder->flex_state ) { if ( builder->parse_state == T1_Parse_Start ) @@ -1464,7 +1546,7 @@ /* record vertical hint */ if ( hinter ) { - top[0] += orig_x; + top[0] = ADD_LONG( top[0], orig_x ); hinter->stem( hinter->hints, 0, top ); } break; @@ -1478,9 +1560,9 @@ FT_Pos dx = orig_x; - top[0] += dx; - top[2] += dx; - top[4] += dx; + top[0] = ADD_LONG( top[0], dx ); + top[2] = ADD_LONG( top[2], dx ); + top[4] = ADD_LONG( top[4], dx ); hinter->stem3( hinter->hints, 0, top ); } break; @@ -1556,14 +1638,286 @@ return FT_THROW( Stack_Underflow ); } +#else /* T1_CONFIG_OPTION_OLD_ENGINE */ - /* parse a single Type 1 glyph */ + /*************************************************************************/ + /* */ + /* */ + /* t1_decoder_parse_metrics */ + /* */ + /* */ + /* Parses a given Type 1 charstrings program to extract width */ + /* */ + /* */ + /* decoder :: The current Type 1 decoder. */ + /* */ + /* charstring_base :: The base address of the charstring stream. */ + /* */ + /* charstring_len :: The length in bytes of the charstring stream. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ FT_LOCAL_DEF( FT_Error ) - t1_decoder_parse_glyph( T1_Decoder decoder, - FT_UInt glyph ) + t1_decoder_parse_metrics( T1_Decoder decoder, + FT_Byte* charstring_base, + FT_UInt charstring_len ) { - return decoder->parse_callback( decoder, glyph ); + T1_Decoder_Zone zone; + FT_Byte* ip; + FT_Byte* limit; + T1_Builder builder = &decoder->builder; + +#ifdef FT_DEBUG_LEVEL_TRACE + FT_Bool bol = TRUE; +#endif + + + /* First of all, initialize the decoder */ + decoder->top = decoder->stack; + decoder->zone = decoder->zones; + zone = decoder->zones; + + builder->parse_state = T1_Parse_Start; + + FT_TRACE4(( "\n" + "Start charstring: get width\n" )); + + zone->base = charstring_base; + limit = zone->limit = charstring_base + charstring_len; + ip = zone->cursor = zone->base; + + /* now, execute loop */ + while ( ip < limit ) + { + FT_Long* top = decoder->top; + T1_Operator op = op_none; + FT_Int32 value = 0; + + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( bol ) + { + FT_TRACE5(( " (%d)", decoder->top - decoder->stack )); + bol = FALSE; + } +#endif + + /*********************************************************************/ + /* */ + /* Decode operator or operand */ + /* */ + /* */ + + /* first of all, decompress operator or value */ + switch ( *ip++ ) + { + case 1: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 14: + case 15: + case 21: + case 22: + case 30: + case 31: + goto No_Width; + + case 13: + op = op_hsbw; + break; + + case 12: + if ( ip >= limit ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " invalid escape (12+EOF)\n" )); + goto Syntax_Error; + } + + switch ( *ip++ ) + { + case 7: + op = op_sbw; + break; + + default: + goto No_Width; + } + break; + + case 255: /* four bytes integer */ + if ( ip + 4 > limit ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " unexpected EOF in integer\n" )); + goto Syntax_Error; + } + + value = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) | + ( (FT_UInt32)ip[1] << 16 ) | + ( (FT_UInt32)ip[2] << 8 ) | + (FT_UInt32)ip[3] ); + ip += 4; + + /* According to the specification, values > 32000 or < -32000 must */ + /* be followed by a `div' operator to make the result be in the */ + /* range [-32000;32000]. We expect that the second argument of */ + /* `div' is not a large number. Additionally, we don't handle */ + /* stuff like ` div div' or */ + /* div div'. This is probably not allowed */ + /* anyway. */ + if ( value > 32000 || value < -32000 ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " large integer found for width\n" )); + goto Syntax_Error; + } + else + { + value = (FT_Int32)( (FT_UInt32)value << 16 ); + } + + break; + + default: + if ( ip[-1] >= 32 ) + { + if ( ip[-1] < 247 ) + value = (FT_Int32)ip[-1] - 139; + else + { + if ( ++ip > limit ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " unexpected EOF in integer\n" )); + goto Syntax_Error; + } + + if ( ip[-2] < 251 ) + value = ( ( ip[-2] - 247 ) * 256 ) + ip[-1] + 108; + else + value = -( ( ( ip[-2] - 251 ) * 256 ) + ip[-1] + 108 ); + } + + value = (FT_Int32)( (FT_UInt32)value << 16 ); + } + else + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " invalid byte (%d)\n", ip[-1] )); + goto Syntax_Error; + } + } + + /*********************************************************************/ + /* */ + /* Push value on stack, or process operator */ + /* */ + /* */ + if ( op == op_none ) + { + if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS ) + { + FT_ERROR(( "t1_decoder_parse_metrics: stack overflow\n" )); + goto Syntax_Error; + } + +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE4(( " %d", value / 65536 )); +#endif + + *top++ = value; + decoder->top = top; + } + else /* general operator */ + { + FT_Int num_args = t1_args_count[op]; + + + FT_ASSERT( num_args >= 0 ); + + if ( top - decoder->stack < num_args ) + goto Stack_Underflow; + +#ifdef FT_DEBUG_LEVEL_TRACE + + if ( top - decoder->stack != num_args ) + FT_TRACE0(( "t1_decoder_parse_metrics:" + " too much operands on the stack" + " (seen %d, expected %d)\n", + top - decoder->stack, num_args )); + +#endif /* FT_DEBUG_LEVEL_TRACE */ + + top -= num_args; + + switch ( op ) + { + case op_hsbw: + FT_TRACE4(( " hsbw" )); + + builder->parse_state = T1_Parse_Have_Width; + + builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, + top[0] ); + + builder->advance.x = top[1]; + builder->advance.y = 0; + + /* we only want to compute the glyph's metrics */ + /* (lsb + advance width), not load the rest of */ + /* it; so exit immediately */ + return FT_Err_Ok; + + case op_sbw: + FT_TRACE4(( " sbw" )); + + builder->parse_state = T1_Parse_Have_Width; + + builder->left_bearing.x = ADD_LONG( builder->left_bearing.x, + top[0] ); + builder->left_bearing.y = ADD_LONG( builder->left_bearing.y, + top[1] ); + + builder->advance.x = top[2]; + builder->advance.y = top[3]; + + /* we only want to compute the glyph's metrics */ + /* (lsb + advance width), not load the rest of */ + /* it; so exit immediately */ + return FT_Err_Ok; + + default: + FT_ERROR(( "t1_decoder_parse_metrics:" + " unhandled opcode %d\n", op )); + goto Syntax_Error; + } + + } /* general operator processing */ + + } /* while ip < limit */ + + FT_TRACE4(( "..end..\n\n" )); + + No_Width: + FT_ERROR(( "t1_decoder_parse_metrics:" + " no width, found op %d instead\n", + ip[-1] )); + Syntax_Error: + return FT_THROW( Syntax_Error ); + + Stack_Underflow: + return FT_THROW( Stack_Underflow ); } +#endif /* T1_CONFIG_OPTION_OLD_ENGINE */ /* initialize T1 decoder */ @@ -1618,7 +1972,16 @@ FT_LOCAL_DEF( void ) t1_decoder_done( T1_Decoder decoder ) { + FT_Memory memory = decoder->builder.memory; + + t1_builder_done( &decoder->builder ); + + if ( decoder->cf2_instance.finalizer ) + { + decoder->cf2_instance.finalizer( decoder->cf2_instance.data ); + FT_FREE( decoder->cf2_instance.data ); + } } diff --git a/src/psaux/t1decode.h b/src/psaux/t1decode.h index 12c27de77..1d9718d67 100644 --- a/src/psaux/t1decode.h +++ b/src/psaux/t1decode.h @@ -4,7 +4,7 @@ /* */ /* PostScript Type 1 decoding routines (specification). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,7 +31,11 @@ FT_BEGIN_HEADER FT_CALLBACK_TABLE const T1_Decoder_FuncsRec t1_decoder_funcs; + FT_LOCAL( FT_Int ) + t1_lookup_glyph_by_stdcharcode_ps( PS_Decoder* decoder, + FT_Int charcode ); +#ifdef T1_CONFIG_OPTION_OLD_ENGINE FT_LOCAL( FT_Error ) t1_decoder_parse_glyph( T1_Decoder decoder, FT_UInt glyph_index ); @@ -40,6 +44,12 @@ FT_BEGIN_HEADER t1_decoder_parse_charstrings( T1_Decoder decoder, FT_Byte* base, FT_UInt len ); +#else + FT_LOCAL( FT_Error ) + t1_decoder_parse_metrics( T1_Decoder decoder, + FT_Byte* charstring_base, + FT_UInt charstring_len ); +#endif FT_LOCAL( FT_Error ) t1_decoder_init( T1_Decoder decoder, diff --git a/src/pshinter/Jamfile b/src/pshinter/Jamfile index 2b65271cc..3f5f0ae40 100644 --- a/src/pshinter/Jamfile +++ b/src/pshinter/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/pshinter Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/pshinter/module.mk b/src/pshinter/module.mk index 77e35c4c1..06707be3b 100644 --- a/src/pshinter/module.mk +++ b/src/pshinter/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c index 9ad1a3a02..b98077c62 100644 --- a/src/pshinter/pshalgo.c +++ b/src/pshinter/pshalgo.c @@ -4,7 +4,7 @@ /* */ /* PostScript hinting algorithm (body). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -26,7 +26,7 @@ #undef FT_COMPONENT -#define FT_COMPONENT trace_pshalgo2 +#define FT_COMPONENT trace_pshalgo #ifdef DEBUG_HINTER diff --git a/src/pshinter/pshalgo.h b/src/pshinter/pshalgo.h index 62e97d152..c50683fbe 100644 --- a/src/pshinter/pshalgo.h +++ b/src/pshinter/pshalgo.h @@ -4,7 +4,7 @@ /* */ /* PostScript hinting algorithm (specification). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshglob.c b/src/pshinter/pshglob.c index c68770c73..accc04921 100644 --- a/src/pshinter/pshglob.c +++ b/src/pshinter/pshglob.c @@ -5,7 +5,7 @@ /* PostScript hinter global hinting management (body). */ /* Inspired by the new auto-hinter module. */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -227,8 +227,8 @@ } - /* Re-read blue zones from the original fonts and store them into out */ - /* private structure. This function re-orders, sanitizes and */ + /* Re-read blue zones from the original fonts and store them into our */ + /* private structure. This function re-orders, sanitizes, and */ /* fuzz-expands the zones as well. */ static void psh_blues_set_zones( PSH_Blues target, diff --git a/src/pshinter/pshglob.h b/src/pshinter/pshglob.h index 8801cbada..cf80bf40e 100644 --- a/src/pshinter/pshglob.h +++ b/src/pshinter/pshglob.h @@ -4,7 +4,7 @@ /* */ /* PostScript hinter global hinting management. */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshinter.c b/src/pshinter/pshinter.c index e6727aea1..0eedac452 100644 --- a/src/pshinter/pshinter.c +++ b/src/pshinter/pshinter.c @@ -4,7 +4,7 @@ /* */ /* FreeType PostScript Hinting module */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,13 +17,13 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "pshpic.c" -#include "pshrec.c" -#include "pshglob.c" + #include "pshalgo.c" +#include "pshglob.c" #include "pshmod.c" +#include "pshpic.c" +#include "pshrec.c" /* END */ diff --git a/src/pshinter/pshmod.c b/src/pshinter/pshmod.c index 860dc0ae8..0b8f6f99b 100644 --- a/src/pshinter/pshmod.c +++ b/src/pshinter/pshmod.c @@ -4,7 +4,7 @@ /* */ /* FreeType PostScript hinter module implementation (body). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshmod.h b/src/pshinter/pshmod.h index 1d2b40fa1..556de2fbc 100644 --- a/src/pshinter/pshmod.h +++ b/src/pshinter/pshmod.h @@ -4,7 +4,7 @@ /* */ /* PostScript hinter module interface (specification). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshnterr.h b/src/pshinter/pshnterr.h index 73d144e34..b9d02d295 100644 --- a/src/pshinter/pshnterr.h +++ b/src/pshinter/pshnterr.h @@ -4,7 +4,7 @@ /* */ /* PS Hinter error codes (specification only). */ /* */ -/* Copyright 2003-2017 by */ +/* Copyright 2003-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshpic.c b/src/pshinter/pshpic.c index c0d3a64f2..465ad3188 100644 --- a/src/pshinter/pshpic.c +++ b/src/pshinter/pshpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for pshinter module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshpic.h b/src/pshinter/pshpic.h index 8d9a01c9c..4469ba87c 100644 --- a/src/pshinter/pshpic.h +++ b/src/pshinter/pshpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for pshinter module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshrec.c b/src/pshinter/pshrec.c index fff6d3425..6648d13d6 100644 --- a/src/pshinter/pshrec.c +++ b/src/pshinter/pshrec.c @@ -4,7 +4,7 @@ /* */ /* FreeType PostScript hints recorder (body). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/pshrec.h b/src/pshinter/pshrec.h index e10bc2b12..7e3dfe0d5 100644 --- a/src/pshinter/pshrec.h +++ b/src/pshinter/pshrec.h @@ -4,7 +4,7 @@ /* */ /* Postscript (Type1/Type2) hints recorder (specification). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/pshinter/rules.mk b/src/pshinter/rules.mk index 2be640438..966690efc 100644 --- a/src/pshinter/rules.mk +++ b/src/pshinter/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/psnames/Jamfile b/src/psnames/Jamfile index 5a6e2c0bd..a0fd37397 100644 --- a/src/psnames/Jamfile +++ b/src/psnames/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/psnames Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/psnames/module.mk b/src/psnames/module.mk index ddd22960c..410f48a19 100644 --- a/src/psnames/module.mk +++ b/src/psnames/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c index 3ff8cb911..8929ebe75 100644 --- a/src/psnames/psmodule.c +++ b/src/psnames/psmodule.c @@ -4,7 +4,7 @@ /* */ /* PSNames module implementation (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,8 +23,21 @@ #include "psmodule.h" + /* + * The file `pstables.h' with its arrays and its function + * `ft_get_adobe_glyph_index' is useful for other projects also (for + * example, `pdfium' is using it). However, if used as a C++ header, + * including it in two different source files makes it necessary to use + * `extern const' for the declaration of its arrays, otherwise the data + * would be duplicated as mandated by the C++ standard. + * + * For this reason, we use `DEFINE_PS_TABLES' to guard the function + * definitions, and `DEFINE_PS_TABLES_DATA' to provide both proper array + * declarations and definitions. + */ #include "pstables.h" #define DEFINE_PS_TABLES +#define DEFINE_PS_TABLES_DATA #include "pstables.h" #include "psnamerr.h" diff --git a/src/psnames/psmodule.h b/src/psnames/psmodule.h index 6983b7923..3e94f8b43 100644 --- a/src/psnames/psmodule.h +++ b/src/psnames/psmodule.h @@ -4,7 +4,7 @@ /* */ /* High-level PSNames module interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psnames/psnamerr.h b/src/psnames/psnamerr.h index f90bf5ea4..14eb76c99 100644 --- a/src/psnames/psnamerr.h +++ b/src/psnames/psnamerr.h @@ -4,7 +4,7 @@ /* */ /* PS names module error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psnames/psnames.c b/src/psnames/psnames.c index 5b7bc8b68..febb80d59 100644 --- a/src/psnames/psnames.c +++ b/src/psnames/psnames.c @@ -4,7 +4,7 @@ /* */ /* FreeType PSNames module component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,10 +17,10 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "pspic.c" + #include "psmodule.c" +#include "pspic.c" /* END */ diff --git a/src/psnames/pspic.c b/src/psnames/pspic.c index 8b9003439..85a06f360 100644 --- a/src/psnames/pspic.c +++ b/src/psnames/pspic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for psnames module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psnames/pspic.h b/src/psnames/pspic.h index 14497e73f..889780cc0 100644 --- a/src/psnames/pspic.h +++ b/src/psnames/pspic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for psnames module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/psnames/pstables.h b/src/psnames/pstables.h index e0f5e3080..79545ee03 100644 --- a/src/psnames/pstables.h +++ b/src/psnames/pstables.h @@ -4,7 +4,7 @@ /* */ /* PostScript glyph names. */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,7 +19,7 @@ /* This file has been generated automatically -- do not edit! */ -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -27,7 +27,7 @@ #endif #endif const char ft_standard_glyph_names[3696] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { '.','n','u','l','l', 0, @@ -451,7 +451,7 @@ 'R','o','m','a','n', 0, 'S','e','m','i','b','o','l','d', 0, } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; @@ -459,7 +459,7 @@ /* Values are offsets into the `ft_standard_glyph_names' table */ -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -467,7 +467,7 @@ #endif #endif const short ft_mac_names[FT_NUM_MAC_NAMES] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { 253, 0, 6, 261, 267, 274, 283, 294, 301, 309, 758, 330, 340, 351, @@ -490,7 +490,7 @@ 1270,1313,1323,1171,1290,1332,1211,1235,1276, 169, 175, 182, 189, 200, 209, 218, 225, 232, 239, 246 } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; @@ -498,7 +498,7 @@ /* Values are offsets into the `ft_standard_glyph_names' table */ -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -506,7 +506,7 @@ #endif #endif const short ft_sid_names[FT_NUM_SID_NAMES] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { 253, 261, 267, 274, 283, 294, 301, 309, 319, 330, 340, 351, 360, 365, @@ -538,12 +538,12 @@ 3418,3430,3442,3454,3471,3483,3498,3506,3518,3530,3542,3559,3574,3586, 3597,3612,3620,3628,3636,3644,3650,3655,3660,3666,3673,3681,3687 } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; /* the following are indices into the SID name table */ -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -551,7 +551,7 @@ #endif #endif const unsigned short t1_standard_encoding[256] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -571,12 +571,12 @@ 0,138, 0,139, 0, 0, 0, 0,140,141,142,143, 0, 0, 0, 0, 0,144, 0, 0, 0,145, 0, 0,146,147,148,149, 0, 0, 0, 0 } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; /* the following are indices into the SID name table */ -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -584,7 +584,7 @@ #endif #endif const unsigned short t1_expert_encoding[256] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -604,7 +604,7 @@ 347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362, 363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378 } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; @@ -619,7 +619,7 @@ #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST -#ifndef DEFINE_PS_TABLES +#ifndef DEFINE_PS_TABLES_DATA #ifdef __cplusplus extern "C" #else @@ -627,7 +627,7 @@ #endif #endif const unsigned char ft_adobe_glyph_list[55997L] -#ifdef DEFINE_PS_TABLES +#ifdef DEFINE_PS_TABLES_DATA = { 0, 52, 0,106, 2,167, 3, 63, 4,220, 6,125, 9,143, 10, 23, @@ -4131,7 +4131,7 @@ 182,117, 2,218,167,218,178,232,233,242,225,231,225,238, 97,128, 48, 90,235,225,244,225,235,225,238, 97,128, 48,186 } -#endif /* DEFINE_PS_TABLES */ +#endif /* DEFINE_PS_TABLES_DATA */ ; diff --git a/src/psnames/rules.mk b/src/psnames/rules.mk index 69fa73220..4d629d841 100644 --- a/src/psnames/rules.mk +++ b/src/psnames/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/raster/Jamfile b/src/raster/Jamfile index c9f3d6c63..838e7ef57 100644 --- a/src/raster/Jamfile +++ b/src/raster/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/raster Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/raster/ftmisc.h b/src/raster/ftmisc.h index d1e6627ab..7e4011907 100644 --- a/src/raster/ftmisc.h +++ b/src/raster/ftmisc.h @@ -5,7 +5,7 @@ /* Miscellaneous macros for stand-alone rasterizer (specification */ /* only). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c index c5643f633..4354730d5 100644 --- a/src/raster/ftraster.c +++ b/src/raster/ftraster.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/raster/ftraster.h b/src/raster/ftraster.h index 6b3050cb3..40b5d6d32 100644 --- a/src/raster/ftraster.h +++ b/src/raster/ftraster.h @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c index 1a83e9e47..a7ce9731d 100644 --- a/src/raster/ftrend1.c +++ b/src/raster/ftrend1.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,12 +31,7 @@ static FT_Error ft_raster1_init( FT_Renderer render ) { - FT_Library library = FT_MODULE_LIBRARY( render ); - - - render->clazz->raster_class->raster_reset( render->raster, - library->raster_pool, - library->raster_pool_size ); + render->clazz->raster_class->raster_reset( render->raster, NULL, 0 ); return FT_Err_Ok; } @@ -102,12 +97,12 @@ FT_Render_Mode mode, const FT_Vector* origin ) { - FT_Error error; - FT_Outline* outline; - FT_BBox cbox, cbox0; - FT_UInt width, height, pitch; - FT_Bitmap* bitmap; - FT_Memory memory; + FT_Error error = FT_Err_Ok; + FT_Outline* outline = &slot->outline; + FT_Bitmap* bitmap = &slot->bitmap; + FT_Memory memory = render->root.memory; + FT_Pos x_shift = 0; + FT_Pos y_shift = 0; FT_Raster_Params params; @@ -126,60 +121,6 @@ return FT_THROW( Cannot_Render_Glyph ); } - outline = &slot->outline; - - /* translate the outline to the new origin if needed */ - if ( origin ) - FT_Outline_Translate( outline, origin->x, origin->y ); - - /* compute the control box, and grid fit it */ - FT_Outline_Get_CBox( outline, &cbox0 ); - - /* undocumented but confirmed: bbox values get rounded */ -#if 1 - cbox.xMin = FT_PIX_ROUND( cbox0.xMin ); - cbox.yMin = FT_PIX_ROUND( cbox0.yMin ); - cbox.xMax = FT_PIX_ROUND( cbox0.xMax ); - cbox.yMax = FT_PIX_ROUND( cbox0.yMax ); -#else - cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); - cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); - cbox.xMax = FT_PIX_CEIL( cbox.xMax ); - cbox.yMax = FT_PIX_CEIL( cbox.yMax ); -#endif - - /* If either `width' or `height' round to 0, try */ - /* explicitly rounding up/down. In the case of */ - /* glyphs containing only one very narrow feature, */ - /* this gives the drop-out compensation in the scan */ - /* conversion code a chance to do its stuff. */ - width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); - if ( width == 0 ) - { - cbox.xMin = FT_PIX_FLOOR( cbox0.xMin ); - cbox.xMax = FT_PIX_CEIL( cbox0.xMax ); - - width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); - } - - height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); - if ( height == 0 ) - { - cbox.yMin = FT_PIX_FLOOR( cbox0.yMin ); - cbox.yMax = FT_PIX_CEIL( cbox0.yMax ); - - height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); - } - - if ( width > FT_USHORT_MAX || height > FT_USHORT_MAX ) - { - error = FT_THROW( Invalid_Argument ); - goto Exit; - } - - bitmap = &slot->bitmap; - memory = render->root.memory; - /* release old bitmap buffer */ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { @@ -187,39 +128,48 @@ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } - pitch = ( ( width + 15 ) >> 4 ) << 1; - bitmap->pixel_mode = FT_PIXEL_MODE_MONO; + ft_glyphslot_preset_bitmap( slot, mode, origin ); - bitmap->width = width; - bitmap->rows = height; - bitmap->pitch = (int)pitch; - - if ( FT_ALLOC_MULT( bitmap->buffer, pitch, height ) ) + /* allocate new one */ + if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) ) goto Exit; slot->internal->flags |= FT_GLYPH_OWN_BITMAP; + x_shift = -slot->bitmap_left * 64; + y_shift = ( (FT_Int)bitmap->rows - slot->bitmap_top ) * 64; + + if ( origin ) + { + x_shift += origin->x; + y_shift += origin->y; + } + /* translate outline to render it into the bitmap */ - FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin ); + if ( x_shift || y_shift ) + FT_Outline_Translate( outline, x_shift, y_shift ); /* set up parameters */ params.target = bitmap; params.source = outline; - params.flags = 0; + params.flags = FT_RASTER_FLAG_DEFAULT; /* render outline into the bitmap */ error = render->raster_render( render->raster, ¶ms ); - FT_Outline_Translate( outline, cbox.xMin, cbox.yMin ); - - if ( error ) - goto Exit; + Exit: + if ( !error ) + /* everything is fine; the glyph is now officially a bitmap */ + slot->format = FT_GLYPH_FORMAT_BITMAP; + else if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) + { + FT_FREE( bitmap->buffer ); + slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; + } - slot->format = FT_GLYPH_FORMAT_BITMAP; - slot->bitmap_left = (FT_Int)( cbox.xMin >> 6 ); - slot->bitmap_top = (FT_Int)( cbox.yMax >> 6 ); + if ( x_shift || y_shift ) + FT_Outline_Translate( outline, -x_shift, -y_shift ); - Exit: return error; } diff --git a/src/raster/ftrend1.h b/src/raster/ftrend1.h index cff702d14..2abdf2d70 100644 --- a/src/raster/ftrend1.h +++ b/src/raster/ftrend1.h @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/raster/module.mk b/src/raster/module.mk index aad39cb56..b115f416b 100644 --- a/src/raster/module.mk +++ b/src/raster/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/raster/raster.c b/src/raster/raster.c index ee54ae19f..76edd21e1 100644 --- a/src/raster/raster.c +++ b/src/raster/raster.c @@ -4,7 +4,7 @@ /* */ /* FreeType monochrome rasterer module component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,11 +17,11 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "rastpic.c" + #include "ftraster.c" #include "ftrend1.c" +#include "rastpic.c" /* END */ diff --git a/src/raster/rasterrs.h b/src/raster/rasterrs.h index 0d646908a..22a3e1534 100644 --- a/src/raster/rasterrs.h +++ b/src/raster/rasterrs.h @@ -4,7 +4,7 @@ /* */ /* monochrome renderer error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/raster/rastpic.c b/src/raster/rastpic.c index 7085339b7..1dc8981b8 100644 --- a/src/raster/rastpic.c +++ b/src/raster/rastpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for raster module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/raster/rastpic.h b/src/raster/rastpic.h index dcd691310..6d0877c42 100644 --- a/src/raster/rastpic.h +++ b/src/raster/rastpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for raster module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/raster/rules.mk b/src/raster/rules.mk index 0462c9317..9aef1f0ba 100644 --- a/src/raster/rules.mk +++ b/src/raster/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/sfnt/Jamfile b/src/sfnt/Jamfile index 5971b251c..57977fc96 100644 --- a/src/sfnt/Jamfile +++ b/src/sfnt/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/sfnt Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/sfnt/module.mk b/src/sfnt/module.mk index 81dea17de..51ca67e78 100644 --- a/src/sfnt/module.mk +++ b/src/sfnt/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/sfnt/pngshim.c b/src/sfnt/pngshim.c index 96fc08e3b..16020266a 100644 --- a/src/sfnt/pngshim.c +++ b/src/sfnt/pngshim.c @@ -4,7 +4,7 @@ /* */ /* PNG Bitmap glyph support. */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* Google, Inc. */ /* Written by Stuart Gill and Behdad Esfahbod. */ /* */ @@ -24,7 +24,8 @@ #include FT_CONFIG_STANDARD_LIBRARY_H -#ifdef FT_CONFIG_OPTION_USE_PNG +#if defined( TT_CONFIG_OPTION_EMBEDDED_BITMAPS ) && \ + defined( FT_CONFIG_OPTION_USE_PNG ) /* We always include , so make libpng shut up! */ #define PNG_SKIP_SETJMP_CHECK 1 @@ -48,18 +49,85 @@ } - /* Premultiplies data and converts RGBA bytes => native endian. */ + /* Premultiplies data and converts RGBA bytes => BGRA. */ static void premultiply_data( png_structp png, png_row_infop row_info, png_bytep data ) { - unsigned int i; + unsigned int i = 0, limit; + + /* The `vector_size' attribute was introduced in gcc 3.1, which */ + /* predates clang; the `__BYTE_ORDER__' preprocessor symbol was */ + /* introduced in gcc 4.6 and clang 3.2, respectively. */ + /* `__builtin_shuffle' for gcc was introduced in gcc 4.7.0. */ +#if ( ( defined( __GNUC__ ) && \ + ( ( __GNUC__ >= 5 ) || \ + ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 7 ) ) ) ) || \ + ( defined( __clang__ ) && \ + ( ( __clang_major__ >= 4 ) || \ + ( ( __clang_major__ == 3 ) && ( __clang_minor__ >= 2 ) ) ) ) ) && \ + defined( __OPTIMIZE__ ) && \ + __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + +#ifdef __clang__ + /* the clang documentation doesn't cover the two-argument case of */ + /* `__builtin_shufflevector'; however, it is is implemented since */ + /* version 2.8 */ +#define vector_shuffle __builtin_shufflevector +#else +#define vector_shuffle __builtin_shuffle +#endif - FT_UNUSED( png ); + typedef unsigned short v82 __attribute__(( vector_size( 16 ) )); - for ( i = 0; i < row_info->rowbytes; i += 4 ) + if ( row_info->rowbytes > 15 ) + { + /* process blocks of 16 bytes in one rush, which gives a nice speed-up */ + limit = row_info->rowbytes - 16 + 1; + for ( ; i < limit; i += 16 ) + { + unsigned char* base = &data[i]; + + v82 s, s0, s1, a; + + /* clang <= 3.9 can't apply scalar values to vectors */ + /* (or rather, it needs a different syntax) */ + v82 n0x80 = { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }; + v82 n0xFF = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; + v82 n8 = { 8, 8, 8, 8, 8, 8, 8, 8 }; + + v82 ma = { 1, 1, 3, 3, 5, 5, 7, 7 }; + v82 o1 = { 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF }; + v82 m0 = { 1, 0, 3, 2, 5, 4, 7, 6 }; + + + ft_memcpy( &s, base, 16 ); /* RGBA RGBA RGBA RGBA */ + s0 = s & n0xFF; /* R B R B R B R B */ + s1 = s >> n8; /* G A G A G A G A */ + + a = vector_shuffle( s1, ma ); /* A A A A A A A A */ + s1 |= o1; /* G 1 G 1 G 1 G 1 */ + s0 = vector_shuffle( s0, m0 ); /* B R B R B R B R */ + + s0 *= a; + s1 *= a; + s0 += n0x80; + s1 += n0x80; + s0 = ( s0 + ( s0 >> n8 ) ) >> n8; + s1 = ( s1 + ( s1 >> n8 ) ) >> n8; + + s = s0 | ( s1 << n8 ); + ft_memcpy( base, &s, 16 ); + } + } +#endif /* use `vector_size' */ + + FT_UNUSED( png ); + + limit = row_info->rowbytes; + for ( ; i < limit; i += 4 ) { unsigned char* base = &data[i]; unsigned int alpha = base[3]; @@ -169,7 +237,7 @@ return; } - memcpy( data, stream->cursor, length ); + ft_memcpy( data, stream->cursor, length ); FT_FRAME_EXIT(); } @@ -377,7 +445,12 @@ return error; } -#endif /* FT_CONFIG_OPTION_USE_PNG */ +#else /* !(TT_CONFIG_OPTION_EMBEDDED_BITMAPS && FT_CONFIG_OPTION_USE_PNG) */ + + /* ANSI C doesn't like empty source files */ + typedef int _pngshim_dummy; + +#endif /* !(TT_CONFIG_OPTION_EMBEDDED_BITMAPS && FT_CONFIG_OPTION_USE_PNG) */ /* END */ diff --git a/src/sfnt/pngshim.h b/src/sfnt/pngshim.h index 344eceac1..194238c3a 100644 --- a/src/sfnt/pngshim.h +++ b/src/sfnt/pngshim.h @@ -4,7 +4,7 @@ /* */ /* PNG Bitmap glyph support. */ /* */ -/* Copyright 2013-2017 by */ +/* Copyright 2013-2018 by */ /* Google, Inc. */ /* Written by Stuart Gill and Behdad Esfahbod. */ /* */ diff --git a/src/sfnt/rules.mk b/src/sfnt/rules.mk index 230d56c94..83acc66a8 100644 --- a/src/sfnt/rules.mk +++ b/src/sfnt/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index f13266975..303e1ca9f 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -4,7 +4,7 @@ /* */ /* High-level SFNT driver interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,6 +20,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_SFNT_H #include FT_INTERNAL_OBJECTS_H +#include FT_TRUETYPE_IDS_H #include "sfdriver.h" #include "ttload.h" @@ -50,6 +51,11 @@ #include FT_SERVICE_SFNT_H #include FT_SERVICE_TT_CMAP_H +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include FT_MULTIPLE_MASTERS_H +#include FT_SERVICE_MULTIPLE_MASTERS_H +#endif + /*************************************************************************/ /* */ @@ -250,6 +256,207 @@ } +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + + /* Only ASCII letters and digits are taken for a variation font */ + /* instance's PostScript name. */ + /* */ + /* `ft_isalnum' is a macro, but we need a function here, thus */ + /* this definition. */ + static int + sfnt_is_alphanumeric( int c ) + { + return ft_isalnum( c ); + } + + + /* the implementation of MurmurHash3 is taken and adapted from */ + /* https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp */ + +#define ROTL32( x, r ) ( x << r ) | ( x >> ( 32 - r ) ) + + + static FT_UInt32 + fmix32( FT_UInt32 h ) + { + h ^= h >> 16; + h *= 0x85ebca6b; + h ^= h >> 13; + h *= 0xc2b2ae35; + h ^= h >> 16; + + return h; + } + + + static void + murmur_hash_3_128( const void* key, + const unsigned int len, + FT_UInt32 seed, + void* out ) + { + const FT_Byte* data = (const FT_Byte*)key; + const int nblocks = (int)len / 16; + + FT_UInt32 h1 = seed; + FT_UInt32 h2 = seed; + FT_UInt32 h3 = seed; + FT_UInt32 h4 = seed; + + const FT_UInt32 c1 = 0x239b961b; + const FT_UInt32 c2 = 0xab0e9789; + const FT_UInt32 c3 = 0x38b34ae5; + const FT_UInt32 c4 = 0xa1e38b93; + + const FT_UInt32* blocks = (const FT_UInt32*)( data + nblocks * 16 ); + + int i; + + + for( i = -nblocks; i; i++ ) + { + FT_UInt32 k1 = blocks[i * 4 + 0]; + FT_UInt32 k2 = blocks[i * 4 + 1]; + FT_UInt32 k3 = blocks[i * 4 + 2]; + FT_UInt32 k4 = blocks[i * 4 + 3]; + + + k1 *= c1; + k1 = ROTL32( k1, 15 ); + k1 *= c2; + h1 ^= k1; + + h1 = ROTL32( h1, 19 ); + h1 += h2; + h1 = h1 * 5 + 0x561ccd1b; + + k2 *= c2; + k2 = ROTL32( k2, 16 ); + k2 *= c3; + h2 ^= k2; + + h2 = ROTL32( h2, 17 ); + h2 += h3; + h2 = h2 * 5 + 0x0bcaa747; + + k3 *= c3; + k3 = ROTL32( k3, 17 ); + k3 *= c4; + h3 ^= k3; + + h3 = ROTL32( h3, 15 ); + h3 += h4; + h3 = h3 * 5 + 0x96cd1c35; + + k4 *= c4; + k4 = ROTL32( k4, 18 ); + k4 *= c1; + h4 ^= k4; + + h4 = ROTL32( h4, 13 ); + h4 += h1; + h4 = h4 * 5 + 0x32ac3b17; + } + + { + const FT_Byte* tail = (const FT_Byte*)( data + nblocks * 16 ); + + FT_UInt32 k1 = 0; + FT_UInt32 k2 = 0; + FT_UInt32 k3 = 0; + FT_UInt32 k4 = 0; + + + switch ( len & 15 ) + { + case 15: + k4 ^= (FT_UInt32)tail[14] << 16; + case 14: + k4 ^= (FT_UInt32)tail[13] << 8; + case 13: + k4 ^= (FT_UInt32)tail[12]; + k4 *= c4; + k4 = ROTL32( k4, 18 ); + k4 *= c1; + h4 ^= k4; + + case 12: + k3 ^= (FT_UInt32)tail[11] << 24; + case 11: + k3 ^= (FT_UInt32)tail[10] << 16; + case 10: + k3 ^= (FT_UInt32)tail[9] << 8; + case 9: + k3 ^= (FT_UInt32)tail[8]; + k3 *= c3; + k3 = ROTL32( k3, 17 ); + k3 *= c4; + h3 ^= k3; + + case 8: + k2 ^= (FT_UInt32)tail[7] << 24; + case 7: + k2 ^= (FT_UInt32)tail[6] << 16; + case 6: + k2 ^= (FT_UInt32)tail[5] << 8; + case 5: + k2 ^= (FT_UInt32)tail[4]; + k2 *= c2; + k2 = ROTL32( k2, 16 ); + k2 *= c3; + h2 ^= k2; + + case 4: + k1 ^= (FT_UInt32)tail[3] << 24; + case 3: + k1 ^= (FT_UInt32)tail[2] << 16; + case 2: + k1 ^= (FT_UInt32)tail[1] << 8; + case 1: + k1 ^= (FT_UInt32)tail[0]; + k1 *= c1; + k1 = ROTL32( k1, 15 ); + k1 *= c2; + h1 ^= k1; + } + } + + h1 ^= len; + h2 ^= len; + h3 ^= len; + h4 ^= len; + + h1 += h2; + h1 += h3; + h1 += h4; + + h2 += h1; + h3 += h1; + h4 += h1; + + h1 = fmix32( h1 ); + h2 = fmix32( h2 ); + h3 = fmix32( h3 ); + h4 = fmix32( h4 ); + + h1 += h2; + h1 += h3; + h1 += h4; + + h2 += h1; + h3 += h1; + h4 += h1; + + ((FT_UInt32*)out)[0] = h1; + ((FT_UInt32*)out)[1] = h2; + ((FT_UInt32*)out)[2] = h3; + ((FT_UInt32*)out)[3] = h4; + } + + +#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + + typedef int (*char_type_func)( int c ); @@ -262,7 +469,7 @@ (n)->encodingID == 0 && \ (n)->languageID == 0 ) - static const char* + static char* get_win_string( FT_Memory memory, FT_Stream stream, TT_Name entry, @@ -271,10 +478,10 @@ { FT_Error error = FT_Err_Ok; - const char* result; - FT_String* r; - FT_Char* p; - FT_UInt len; + char* result = NULL; + FT_String* r; + FT_Char* p; + FT_UInt len; FT_UNUSED( error ); @@ -323,7 +530,7 @@ } - static const char* + static char* get_apple_string( FT_Memory memory, FT_Stream stream, TT_Name entry, @@ -332,10 +539,10 @@ { FT_Error error = FT_Err_Ok; - const char* result; - FT_String* r; - FT_Char* p; - FT_UInt len; + char* result = NULL; + FT_String* r; + FT_Char* p; + FT_UInt len; FT_UNUSED( error ); @@ -412,36 +619,445 @@ } +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + + /* + The maximum length of an axis value descriptor. + + We need 65536 different values for the decimal fraction; this fits + nicely into five decimal places. Consequently, it consists of + + . the minus sign if the number is negative, + . up to five characters for the digits before the decimal point, + . the decimal point if there is a fractional part, and + . up to five characters for the digits after the decimal point. + + We also need one byte for the leading `_' character and up to four + bytes for the axis tag. + */ +#define MAX_VALUE_DESCRIPTOR_LEN ( 1 + 5 + 1 + 5 + 1 + 4 ) + + + /* the maximum length of PostScript font names */ +#define MAX_PS_NAME_LEN 127 + + + /* + * Find the shortest decimal representation of a 16.16 fixed point + * number. The function fills `buf' with the result, returning a pointer + * to the position after the representation's last byte. + */ + + static char* + fixed2float( FT_Int fixed, + char* buf ) + { + char* p; + char* q; + char tmp[5]; + + FT_Int int_part; + FT_Int frac_part; + + FT_Int i; + + + p = buf; + + if ( fixed == 0 ) + { + *p++ = '0'; + return p; + } + + if ( fixed < 0 ) + { + *p++ = '-'; + fixed = -fixed; + } + + int_part = ( fixed >> 16 ) & 0xFFFF; + frac_part = fixed & 0xFFFF; + + /* get digits of integer part (in reverse order) */ + q = tmp; + while ( int_part > 0 ) + { + *q++ = '0' + int_part % 10; + int_part /= 10; + } + + /* copy digits in correct order to buffer */ + while ( q > tmp ) + *p++ = *--q; + + if ( !frac_part ) + return p; + + /* save position of point */ + q = p; + *p++ = '.'; + + /* apply rounding */ + frac_part = frac_part * 10 + 5; + + /* get digits of fractional part */ + for ( i = 0; i < 5; i++ ) + { + *p++ = '0' + (char)( frac_part / 0x10000L ); + + frac_part %= 0x10000L; + if ( !frac_part ) + break; + + frac_part *= 10; + } + + /* + If the remainder stored in `frac_part' (after the last FOR loop) is + smaller than 34480*10, the resulting decimal value minus 0.00001 is + an equivalent representation of `fixed'. + + The above FOR loop always finds the larger of the two values; I + verified this by iterating over all possible fixed point numbers. + + If the remainder is 17232*10, both values are equally good, and we + take the next even number (following IEEE 754's `round to nearest, + ties to even' rounding rule). + + If the remainder is smaller than 17232*10, the lower of the two + numbers is nearer to the exact result (values 17232 and 34480 were + also found by testing all possible fixed point values). + + We use this to find a shorter decimal representation. If not ending + with digit zero, we take the representation with less error. + */ + p--; + if ( p - q == 5 ) /* five digits? */ + { + /* take the representation that has zero as the last digit */ + if ( frac_part < 34480 * 10 && + *p == '1' ) + *p = '0'; + + /* otherwise use the one with less error */ + else if ( frac_part == 17232 * 10 && + *p & 1 ) + *p -= 1; + + else if ( frac_part < 17232 * 10 && + *p != '0' ) + *p -= 1; + } + + /* remove trailing zeros */ + while ( *p == '0' ) + *p-- = '\0'; + + return p + 1; + } + + + static const char hexdigits[16] = + { + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' + }; + + static const char* - sfnt_get_ps_name( TT_Face face ) + sfnt_get_var_ps_name( TT_Face face ) { - FT_Int found, win, apple; - const char* result = NULL; + FT_Error error; + FT_Memory memory = face->root.memory; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; - if ( face->postscript_name ) - return face->postscript_name; + FT_UInt num_coords; + FT_Fixed* coords; + FT_MM_Var* mm_var; - /* scan the name table to see whether we have a Postscript name here, */ - /* either in Macintosh or Windows platform encodings */ - found = sfnt_get_name_id( face, 6, &win, &apple ); + FT_Int found, win, apple; + FT_UInt i, j; + + char* result = NULL; + char* p; - if ( found ) + + if ( !face->var_postscript_prefix ) { + FT_UInt len; + + + /* check whether we have a Variations PostScript Name Prefix */ + found = sfnt_get_name_id( face, + TT_NAME_ID_VARIATIONS_PREFIX, + &win, + &apple ); + if ( !found ) + { + /* otherwise use the typographic family name */ + found = sfnt_get_name_id( face, + TT_NAME_ID_TYPOGRAPHIC_FAMILY, + &win, + &apple ); + } + + if ( !found ) + { + /* as a last resort we try the family name; note that this is */ + /* not in the Adobe TechNote, but GX fonts (which predate the */ + /* TechNote) benefit from this behaviour */ + found = sfnt_get_name_id( face, + TT_NAME_ID_FONT_FAMILY, + &win, + &apple ); + } + + if ( !found ) + { + FT_TRACE0(( "sfnt_get_var_ps_name:" + " Can't construct PS name prefix for font instances\n" )); + return NULL; + } + /* prefer Windows entries over Apple */ if ( win != -1 ) result = get_win_string( face->root.memory, face->name_table.stream, face->name_table.names + win, - sfnt_is_postscript, - 1 ); + sfnt_is_alphanumeric, + 0 ); else result = get_apple_string( face->root.memory, face->name_table.stream, face->name_table.names + apple, - sfnt_is_postscript, - 1 ); + sfnt_is_alphanumeric, + 0 ); + + len = ft_strlen( result ); + + /* sanitize if necessary; we reserve space for 36 bytes (a 128bit */ + /* checksum as a hex number, preceded by `-' and followed by three */ + /* ASCII dots, to be used if the constructed PS name would be too */ + /* long); this is also sufficient for a single instance */ + if ( len > MAX_PS_NAME_LEN - ( 1 + 32 + 3 ) ) + { + len = MAX_PS_NAME_LEN - ( 1 + 32 + 3 ); + result[len] = '\0'; + + FT_TRACE0(( "sfnt_get_var_ps_name:" + " Shortening variation PS name prefix\n" + " " + " to %d characters\n", len )); + } + + face->var_postscript_prefix = result; + face->var_postscript_prefix_len = len; + } + + mm->get_var_blend( FT_FACE( face ), + &num_coords, + &coords, + NULL, + &mm_var ); + + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) && + !FT_IS_VARIATION( FT_FACE( face ) ) ) + { + SFNT_Service sfnt = (SFNT_Service)face->sfnt; + + FT_Long instance = ( ( face->root.face_index & 0x7FFF0000L ) >> 16 ) - 1; + FT_UInt psid = mm_var->namedstyle[instance].psid; + + char* ps_name = NULL; + + + /* try first to load the name string with index `postScriptNameID' */ + if ( psid == 6 || + ( psid > 255 && psid < 32768 ) ) + (void)sfnt->get_name( face, (FT_UShort)psid, &ps_name ); + + if ( ps_name ) + { + result = ps_name; + p = result + ft_strlen( result ) + 1; + + goto check_length; + } + else + { + /* otherwise construct a name using `subfamilyNameID' */ + FT_UInt strid = mm_var->namedstyle[instance].strid; + + char* subfamily_name; + char* s; + + + (void)sfnt->get_name( face, (FT_UShort)strid, &subfamily_name ); + + if ( !subfamily_name ) + { + FT_TRACE1(( "sfnt_get_var_ps_name:" + " can't construct named instance PS name;\n" + " " + " trying to construct normal instance PS name\n" )); + goto construct_instance_name; + } + + /* after the prefix we have character `-' followed by the */ + /* subfamily name (using only characters a-z, A-Z, and 0-9) */ + if ( FT_ALLOC( result, face->var_postscript_prefix_len + + 1 + ft_strlen( subfamily_name ) + 1 ) ) + return NULL; + + ft_strcpy( result, face->var_postscript_prefix ); + + p = result + face->var_postscript_prefix_len; + *p++ = '-'; + + s = subfamily_name; + while ( *s ) + { + if ( ft_isalnum( *s ) ) + *p++ = *s; + s++; + } + *p++ = '\0'; + + FT_FREE( subfamily_name ); + } } + else + { + FT_Var_Axis* axis; + + + construct_instance_name: + axis = mm_var->axis; + + if ( FT_ALLOC( result, + face->var_postscript_prefix_len + + num_coords * MAX_VALUE_DESCRIPTOR_LEN + 1 ) ) + return NULL; + + p = result; + + ft_strcpy( p, face->var_postscript_prefix ); + p += face->var_postscript_prefix_len; + + for ( i = 0; i < num_coords; i++, coords++, axis++ ) + { + char t; + + + /* omit axis value descriptor if it is identical */ + /* to the default axis value */ + if ( *coords == axis->def ) + continue; + + *p++ = '_'; + p = fixed2float( *coords, p ); + + t = (char)( axis->tag >> 24 ); + if ( t != ' ' && ft_isalnum( t ) ) + *p++ = t; + t = (char)( axis->tag >> 16 ); + if ( t != ' ' && ft_isalnum( t ) ) + *p++ = t; + t = (char)( axis->tag >> 8 ); + if ( t != ' ' && ft_isalnum( t ) ) + *p++ = t; + t = (char)axis->tag; + if ( t != ' ' && ft_isalnum( t ) ) + *p++ = t; + } + } + + check_length: + if ( p - result > MAX_PS_NAME_LEN ) + { + /* the PS name is too long; replace the part after the prefix with */ + /* a checksum; we use MurmurHash 3 with a hash length of 128 bit */ + + FT_UInt32 seed = 123456789; + + FT_UInt32 hash[4]; + FT_UInt32* h; + + + murmur_hash_3_128( result, p - result, seed, hash ); + + p = result + face->var_postscript_prefix_len; + *p++ = '-'; + + /* we convert the hash value to hex digits from back to front */ + p += 32 + 3; + h = hash + 3; + + *p-- = '\0'; + *p-- = '.'; + *p-- = '.'; + *p-- = '.'; + + for ( i = 0; i < 4; i++, h-- ) + { + FT_UInt32 v = *h; + + + for ( j = 0; j < 8; j++ ) + { + *p-- = hexdigits[v & 0xF]; + v >>= 4; + } + } + } + + return result; + } + +#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + + + static const char* + sfnt_get_ps_name( TT_Face face ) + { + FT_Int found, win, apple; + const char* result = NULL; + + + if ( face->postscript_name ) + return face->postscript_name; + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( face->blend && + ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) || + FT_IS_VARIATION( FT_FACE( face ) ) ) ) + { + face->postscript_name = sfnt_get_var_ps_name( face ); + return face->postscript_name; + } +#endif + + /* scan the name table to see whether we have a Postscript name here, */ + /* either in Macintosh or Windows platform encodings */ + found = sfnt_get_name_id( face, TT_NAME_ID_PS_NAME, &win, &apple ); + if ( !found ) + return NULL; + + /* prefer Windows entries over Apple */ + if ( win != -1 ) + result = get_win_string( face->root.memory, + face->name_table.stream, + face->name_table.names + win, + sfnt_is_postscript, + 1 ); + else + result = get_apple_string( face->root.memory, + face->name_table.stream, + face->name_table.names + apple, + sfnt_is_postscript, + 1 ); face->postscript_name = result; diff --git a/src/sfnt/sfdriver.h b/src/sfnt/sfdriver.h index 38710b60f..81c22d288 100644 --- a/src/sfnt/sfdriver.h +++ b/src/sfnt/sfdriver.h @@ -4,7 +4,7 @@ /* */ /* High-level SFNT driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/sferrors.h b/src/sfnt/sferrors.h index 3cf73d725..74003d4b3 100644 --- a/src/sfnt/sferrors.h +++ b/src/sfnt/sferrors.h @@ -4,7 +4,7 @@ /* */ /* SFNT error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/sfnt.c b/src/sfnt/sfnt.c index cffda6e6d..8b9a6b345 100644 --- a/src/sfnt/sfnt.c +++ b/src/sfnt/sfnt.c @@ -4,7 +4,7 @@ /* */ /* Single object library component. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,27 +17,19 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include + +#include "pngshim.c" +#include "sfdriver.c" #include "sfntpic.c" -#include "ttload.c" -#include "ttmtx.c" +#include "sfobjs.c" +#include "ttbdf.c" #include "ttcmap.c" #include "ttkern.c" -#include "sfobjs.c" -#include "sfdriver.c" - -#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS -#include "pngshim.c" -#include "ttsbit.c" -#endif - -#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES +#include "ttload.c" +#include "ttmtx.c" #include "ttpost.c" -#endif +#include "ttsbit.c" -#ifdef TT_CONFIG_OPTION_BDF -#include "ttbdf.c" -#endif /* END */ diff --git a/src/sfnt/sfntpic.c b/src/sfnt/sfntpic.c index 8eadd601f..db2d816ce 100644 --- a/src/sfnt/sfntpic.c +++ b/src/sfnt/sfntpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for sfnt module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/sfntpic.h b/src/sfnt/sfntpic.h index 3afb668db..8f43122d8 100644 --- a/src/sfnt/sfntpic.h +++ b/src/sfnt/sfntpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for sfnt module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 54912c500..6ba8509f5 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -4,7 +4,7 @@ /* */ /* SFNT object management (base). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -787,6 +787,8 @@ tag != TTAG_OTTO && tag != TTAG_true && tag != TTAG_typ1 && + tag != TTAG_0xA5kbd && + tag != TTAG_0xA5lst && tag != 0x00020000UL ) { FT_TRACE2(( " not a font using the SFNT container format\n" )); @@ -856,7 +858,6 @@ FT_Parameter* params ) { FT_Error error; - FT_Memory memory = face->root.memory; FT_Library library = face->root.driver->root.library; SFNT_Service sfnt; FT_Int face_index; @@ -943,6 +944,8 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT { + FT_Memory memory = face->root.memory; + FT_ULong fvar_len; FT_ULong version; @@ -959,8 +962,6 @@ FT_Byte* instance_values = NULL; - face->is_default_instance = 1; - instance_index = FT_ABS( face_instance_index ) >> 16; /* test whether current face is a GX font with named instances */ @@ -1011,8 +1012,9 @@ * later on. Here, we have to adjust `num_instances' accordingly. */ - if ( !( FT_ALLOC( default_values, num_axes * 2 ) || - FT_ALLOC( instance_values, num_axes * 2 ) ) ) + if ( ( face->variation_support & TT_FACE_FLAG_VAR_FVAR ) && + !( FT_ALLOC( default_values, num_axes * 4 ) || + FT_ALLOC( instance_values, num_axes * 4 ) ) ) { /* the current stream position is 16 bytes after the table start */ FT_ULong array_start = FT_STREAM_POS() - 16 + offset; @@ -1027,10 +1029,10 @@ for ( i = 0; i < num_axes; i++ ) { - (void)FT_STREAM_READ_AT( default_value_offset, p, 2 ); + (void)FT_STREAM_READ_AT( default_value_offset, p, 4 ); default_value_offset += axis_size; - p += 2; + p += 4; } instance_offset = array_start + axis_size * num_axes + 4; @@ -1039,9 +1041,9 @@ { (void)FT_STREAM_READ_AT( instance_offset, instance_values, - num_axes * 2 ); + num_axes * 4 ); - if ( !ft_memcmp( default_values, instance_values, num_axes * 2 ) ) + if ( !ft_memcmp( default_values, instance_values, num_axes * 4 ) ) break; instance_offset += instance_size; @@ -1142,6 +1144,8 @@ FT_Bool has_outline; FT_Bool is_apple_sbit; FT_Bool is_apple_sbix; + FT_Bool has_CBLC; + FT_Bool has_CBDT; FT_Bool ignore_typographic_family = FALSE; FT_Bool ignore_typographic_subfamily = FALSE; @@ -1222,7 +1226,17 @@ goto Exit; } - if ( face->header.Units_Per_EM == 0 ) + has_CBLC = !face->goto_table( face, TTAG_CBLC, stream, 0 ); + has_CBDT = !face->goto_table( face, TTAG_CBDT, stream, 0 ); + + /* Ignore outlines for CBLC/CBDT fonts. */ + if ( has_CBLC || has_CBDT ) + has_outline = FALSE; + + /* OpenType 1.8.2 introduced limits to this value; */ + /* however, they make sense for older SFNT fonts also */ + if ( face->header.Units_Per_EM < 16 || + face->header.Units_Per_EM > 16384 ) { error = FT_THROW( Invalid_Table ); @@ -1462,7 +1476,8 @@ /* Polish the charmaps. */ /* */ /* Try to set the charmap encoding according to the platform & */ - /* encoding ID of each charmap. */ + /* encoding ID of each charmap. Emulate Unicode charmap if one */ + /* is missing. */ /* */ tt_face_build_cmaps( face ); /* ignore errors */ @@ -1470,7 +1485,10 @@ /* set the encoding fields */ { - FT_Int m; + FT_Int m; +#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES + FT_Bool has_unicode = FALSE; +#endif for ( m = 0; m < root->num_charmaps; m++ ) @@ -1481,14 +1499,34 @@ charmap->encoding = sfnt_find_encoding( charmap->platform_id, charmap->encoding_id ); -#if 0 - if ( !root->charmap && - charmap->encoding == FT_ENCODING_UNICODE ) - { - /* set 'root->charmap' to the first Unicode encoding we find */ - root->charmap = charmap; - } -#endif +#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES + + if ( charmap->encoding == FT_ENCODING_UNICODE || + charmap->encoding == FT_ENCODING_MS_SYMBOL ) /* PUA */ + has_unicode = TRUE; + } + + /* synthesize Unicode charmap if one is missing */ + if ( !has_unicode ) + { + FT_CharMapRec cmaprec; + + + cmaprec.face = root; + cmaprec.platform_id = TT_PLATFORM_MICROSOFT; + cmaprec.encoding_id = TT_MS_ID_UNICODE_CS; + cmaprec.encoding = FT_ENCODING_UNICODE; + + + error = FT_CMap_New( (FT_CMap_Class)&tt_cmap_unicode_class_rec, + NULL, &cmaprec, NULL ); + if ( error && + FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) ) + goto Exit; + error = FT_Err_Ok; + +#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ + } } @@ -1655,9 +1693,9 @@ (FT_Short)( face->vertical_info ? face->vertical.advance_Height_Max : root->height ); - /* See http://www.microsoft.com/OpenType/OTSpec/post.htm -- */ - /* Adjust underline position from top edge to centre of */ - /* stroke to convert TrueType meaning to FreeType meaning. */ + /* See https://www.microsoft.com/typography/otspec/post.htm -- */ + /* Adjust underline position from top edge to centre of */ + /* stroke to convert TrueType meaning to FreeType meaning. */ root->underline_position = face->postscript.underlinePosition - face->postscript.underlineThickness / 2; root->underline_thickness = face->postscript.underlineThickness; @@ -1754,7 +1792,10 @@ FT_FREE( face->sbit_strike_map ); face->root.num_fixed_sizes = 0; +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_FREE( face->postscript_name ); + FT_FREE( face->var_postscript_prefix ); +#endif face->sfnt = NULL; } diff --git a/src/sfnt/sfobjs.h b/src/sfnt/sfobjs.h index 705381459..1b8d1be5b 100644 --- a/src/sfnt/sfobjs.h +++ b/src/sfnt/sfobjs.h @@ -4,7 +4,7 @@ /* */ /* SFNT object management (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttbdf.c b/src/sfnt/ttbdf.c index e7e72209d..534201f22 100644 --- a/src/sfnt/ttbdf.c +++ b/src/sfnt/ttbdf.c @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded BDF properties (body). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -246,7 +246,12 @@ return error; } -#endif /* TT_CONFIG_OPTION_BDF */ +#else /* !TT_CONFIG_OPTION_BDF */ + + /* ANSI C doesn't like empty source files */ + typedef int _tt_bdf_dummy; + +#endif /* !TT_CONFIG_OPTION_BDF */ /* END */ diff --git a/src/sfnt/ttbdf.h b/src/sfnt/ttbdf.h index 398b62060..809a66300 100644 --- a/src/sfnt/ttbdf.h +++ b/src/sfnt/ttbdf.h @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded BDF properties (specification). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -28,6 +28,8 @@ FT_BEGIN_HEADER +#ifdef TT_CONFIG_OPTION_BDF + FT_LOCAL( void ) tt_face_free_bdf_props( TT_Face face ); @@ -37,6 +39,8 @@ FT_BEGIN_HEADER const char* property_name, BDF_PropertyRec *aprop ); +#endif /* TT_CONFIG_OPTION_BDF */ + FT_END_HEADER diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index 5afa6ae4b..996e66485 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -4,7 +4,7 @@ /* */ /* TrueType character mapping table (cmap) support (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,8 +23,10 @@ #include FT_INTERNAL_VALIDATE_H #include FT_INTERNAL_STREAM_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H #include "ttload.h" #include "ttcmap.h" +#include "ttpost.h" #include "sfntpic.h" @@ -220,10 +222,10 @@ /***** The following charmap lookup and iteration functions all *****/ /***** assume that the value `charcode' fulfills the following. *****/ /***** *****/ - /***** - For one byte characters, `charcode' is simply the *****/ + /***** - For one-byte characters, `charcode' is simply the *****/ /***** character code. *****/ /***** *****/ - /***** - For two byte characters, `charcode' is the 2-byte *****/ + /***** - For two-byte characters, `charcode' is the 2-byte *****/ /***** character code in big endian format. More precisely: *****/ /***** *****/ /***** (charcode >> 8) is the first byte value *****/ @@ -250,11 +252,11 @@ /* subs 518 SUBHEAD[NSUBS] sub-headers array */ /* glyph_ids 518+NSUB*8 USHORT[] glyph ID array */ /* */ - /* The `keys' table is used to map charcode high-bytes to sub-headers. */ + /* The `keys' table is used to map charcode high bytes to sub-headers. */ /* The value of `NSUBS' is the number of sub-headers defined in the */ /* table and is computed by finding the maximum of the `keys' table. */ /* */ - /* Note that for any n, `keys[n]' is a byte offset within the `subs' */ + /* Note that for any `n', `keys[n]' is a byte offset within the `subs' */ /* table, i.e., it is the corresponding sub-header index multiplied */ /* by 8. */ /* */ @@ -267,8 +269,8 @@ /* delta 4 SHORT see below */ /* offset 6 USHORT see below */ /* */ - /* A sub-header defines, for each high-byte, the range of valid */ - /* low-bytes within the charmap. Note that the range defined by `first' */ + /* A sub-header defines, for each high byte, the range of valid */ + /* low bytes within the charmap. Note that the range defined by `first' */ /* and `count' must be completely included in the interval [0..255] */ /* according to the specification. */ /* */ @@ -358,7 +360,7 @@ /* check range within 0..255 */ if ( valid->level >= FT_VALIDATE_PARANOID ) { - if ( first_code >= 256 || first_code + code_count > 256 ) + if ( first_code >= 256 || code_count > 256 - first_code ) FT_INVALID_DATA; } @@ -410,7 +412,7 @@ { FT_UInt char_lo = (FT_UInt)( char_code & 0xFF ); FT_UInt char_hi = (FT_UInt)( char_code >> 8 ); - FT_Byte* p = table + 6; /* keys table */ + FT_Byte* p = table + 6; /* keys table */ FT_Byte* subs = table + 518; /* subheaders table */ FT_Byte* sub; @@ -423,8 +425,8 @@ sub = subs; /* jump to first sub-header */ /* check that the sub-header for this byte is 0, which */ - /* indicates that it is really a valid one-byte value */ - /* Otherwise, return 0 */ + /* indicates that it is really a valid one-byte value; */ + /* otherwise, return 0 */ /* */ p += char_lo * 2; if ( TT_PEEK_USHORT( p ) != 0 ) @@ -443,6 +445,7 @@ if ( sub == subs ) goto Exit; } + result = sub; } @@ -515,8 +518,19 @@ FT_UInt pos, idx; + if ( char_lo >= start + count && charcode <= 0xFF ) + { + /* this happens only for a malformed cmap */ + charcode = 0x100; + continue; + } + if ( offset == 0 ) + { + if ( charcode == 0x100 ) + goto Exit; /* this happens only for a malformed cmap */ goto Next_SubHeader; + } if ( char_lo < start ) { @@ -543,11 +557,20 @@ } } } + + /* if unsuccessful, avoid `charcode' leaving */ + /* the current 256-character block */ + if ( count ) + charcode--; } - /* jump to next sub-header, i.e. higher byte value */ + /* If `charcode' is <= 0xFF, retry with `charcode + 1'. */ + /* Otherwise jump to the next 256-character block and retry. */ Next_SubHeader: - charcode = FT_PAD_FLOOR( charcode, 256 ) + 256; + if ( charcode <= 0xFF ) + charcode++; + else + charcode = FT_PAD_FLOOR( charcode, 0x100 ) + 0x100; } Exit: @@ -3622,6 +3645,110 @@ #endif /* TT_CONFIG_CMAP_FORMAT_14 */ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** SYNTHETIC UNICODE *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* This charmap is generated using postscript glyph names. */ + +#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES + + FT_CALLBACK_DEF( const char * ) + tt_get_glyph_name( TT_Face face, + FT_UInt idx ) + { + FT_String* PSname; + + + tt_face_get_ps_name( face, idx, &PSname ); + + return PSname; + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap_unicode_init( PS_Unicodes unicodes, + FT_Pointer pointer ) + { + TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes ); + FT_Memory memory = FT_FACE_MEMORY( face ); + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; + + FT_UNUSED( pointer ); + + + return psnames->unicodes_init( memory, + unicodes, + face->root.num_glyphs, + (PS_GetGlyphNameFunc)&tt_get_glyph_name, + (PS_FreeGlyphNameFunc)NULL, + (FT_Pointer)face ); + } + + + FT_CALLBACK_DEF( void ) + tt_cmap_unicode_done( PS_Unicodes unicodes ) + { + FT_Face face = FT_CMAP_FACE( unicodes ); + FT_Memory memory = FT_FACE_MEMORY( face ); + + + FT_FREE( unicodes->maps ); + unicodes->num_maps = 0; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap_unicode_char_index( PS_Unicodes unicodes, + FT_UInt32 char_code ) + { + TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes ); + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; + + + return psnames->unicodes_char_index( unicodes, char_code ); + } + + + FT_CALLBACK_DEF( FT_UInt32 ) + tt_cmap_unicode_char_next( PS_Unicodes unicodes, + FT_UInt32 *pchar_code ) + { + TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes ); + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; + + + return psnames->unicodes_char_next( unicodes, pchar_code ); + } + + + FT_DEFINE_TT_CMAP( + tt_cmap_unicode_class_rec, + + sizeof ( PS_UnicodesRec ), + + (FT_CMap_InitFunc) tt_cmap_unicode_init, /* init */ + (FT_CMap_DoneFunc) tt_cmap_unicode_done, /* done */ + (FT_CMap_CharIndexFunc)tt_cmap_unicode_char_index, /* char_index */ + (FT_CMap_CharNextFunc) tt_cmap_unicode_char_next, /* char_next */ + + (FT_CMap_CharVarIndexFunc) NULL, /* char_var_index */ + (FT_CMap_CharVarIsDefaultFunc)NULL, /* char_var_default */ + (FT_CMap_VariantListFunc) NULL, /* variant_list */ + (FT_CMap_CharVariantListFunc) NULL, /* charvariant_list */ + (FT_CMap_VariantCharListFunc) NULL, /* variantchar_list */ + + ~0U, + (TT_CMap_ValidateFunc)NULL, /* validate */ + (TT_CMap_Info_GetFunc)NULL /* get_cmap_info */ + ) + +#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ + #ifndef FT_CONFIG_OPTION_PIC static const TT_CMap_Class tt_cmap_classes[] = @@ -3801,8 +3928,10 @@ FT_CMap cmap = (FT_CMap)charmap; TT_CMap_Class clazz = (TT_CMap_Class)cmap->clazz; - - return clazz->get_cmap_info( charmap, cmap_info ); + if ( clazz->get_cmap_info ) + return clazz->get_cmap_info( charmap, cmap_info ); + else + return FT_THROW( Invalid_CharMap_Format ); } diff --git a/src/sfnt/ttcmap.h b/src/sfnt/ttcmap.h index 83f12df24..d264d99d2 100644 --- a/src/sfnt/ttcmap.h +++ b/src/sfnt/ttcmap.h @@ -4,7 +4,7 @@ /* */ /* TrueType character mapping table (cmap) support (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -141,6 +141,8 @@ FT_BEGIN_HEADER #define TT_VALID_GLYPH_COUNT( x ) TT_VALIDATOR( x )->num_glyphs + FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap_unicode_class_rec; + FT_LOCAL( FT_Error ) tt_face_build_cmaps( TT_Face face ); diff --git a/src/sfnt/ttcmapc.h b/src/sfnt/ttcmapc.h index 9a5e70825..4980e9dd3 100644 --- a/src/sfnt/ttcmapc.h +++ b/src/sfnt/ttcmapc.h @@ -4,7 +4,7 @@ /* */ /* TT CMAP classes definitions (specification only). */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttkern.c b/src/sfnt/ttkern.c index 78dc5eb87..68f15a201 100644 --- a/src/sfnt/ttkern.c +++ b/src/sfnt/ttkern.c @@ -5,7 +5,7 @@ /* Load the basic TrueType kerning table. This doesn't handle */ /* kerning data within the GPOS table at the moment. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -85,7 +85,7 @@ for ( nn = 0; nn < num_tables; nn++ ) { - FT_UInt num_pairs, length, coverage; + FT_UInt num_pairs, length, coverage, format; FT_Byte* p_next; FT_UInt32 mask = (FT_UInt32)1UL << nn; @@ -107,9 +107,15 @@ if ( p_next > p_limit ) /* handle broken table */ p_next = p_limit; + format = coverage >> 8; + + /* we currently only support format 0 kerning tables */ + if ( format != 0 ) + goto NextTable; + /* only use horizontal kerning tables */ - if ( ( coverage & ~8U ) != 0x0001 || - p + 8 > p_limit ) + if ( ( coverage & 3U ) != 0x0001 || + p + 8 > p_next ) goto NextTable; num_pairs = FT_NEXT_USHORT( p ); @@ -214,8 +220,7 @@ if ( ( face->kern_avail_bits & mask ) == 0 ) goto NextTable; - if ( p + 8 > next ) - goto NextTable; + FT_ASSERT( p + 8 <= next ); /* tested in tt_face_load_kern */ num_pairs = FT_NEXT_USHORT( p ); p += 6; diff --git a/src/sfnt/ttkern.h b/src/sfnt/ttkern.h index db1a30bdb..4e45d0964 100644 --- a/src/sfnt/ttkern.h +++ b/src/sfnt/ttkern.h @@ -5,7 +5,7 @@ /* Load the basic TrueType kerning table. This doesn't handle */ /* kerning data within the GPOS table at the moment. */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index 4695253f2..a86a546c3 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -5,7 +5,7 @@ /* Load the basic TrueType tables, i.e., tables that can be either in */ /* TTF or OTF fonts (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -338,7 +338,7 @@ SFNT_HeaderRec sfnt; FT_Error error; FT_Memory memory = stream->memory; - FT_UShort nn, valid_entries; + FT_UShort nn, valid_entries = 0; static const FT_Frame_Field offset_table_fields[] = { @@ -984,7 +984,7 @@ /*************************************************************************/ /* */ /* */ - /* tt_face_free_names */ + /* tt_face_free_name */ /* */ /* */ /* Frees the name records. */ diff --git a/src/sfnt/ttload.h b/src/sfnt/ttload.h index 296da86ed..f94be8b7b 100644 --- a/src/sfnt/ttload.h +++ b/src/sfnt/ttload.h @@ -5,7 +5,7 @@ /* Load the basic TrueType tables, i.e., tables that can be either in */ /* TTF or OTF fonts (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttmtx.c b/src/sfnt/ttmtx.c index 394c6db85..6ddda95b5 100644 --- a/src/sfnt/ttmtx.c +++ b/src/sfnt/ttmtx.c @@ -4,7 +4,7 @@ /* */ /* Load the metrics tables common to TTF and OTF fonts (body). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttmtx.h b/src/sfnt/ttmtx.h index 2b93ab2f0..ab00acd79 100644 --- a/src/sfnt/ttmtx.h +++ b/src/sfnt/ttmtx.h @@ -4,7 +4,7 @@ /* */ /* Load the metrics tables common to TTF and OTF fonts (specification). */ /* */ -/* Copyright 2006-2017 by */ +/* Copyright 2006-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index 6548e8513..6de99ef97 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -5,7 +5,7 @@ /* PostScript name table processing for TrueType and OpenType fonts */ /* (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,6 +29,10 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H + + +#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES + #include "ttpost.h" #include "sferrors.h" @@ -321,7 +325,6 @@ FT_UNUSED( post_limit ); - /* UNDOCUMENTED! This value appears only in the Apple TT specs. */ if ( FT_READ_USHORT( num_glyphs ) ) goto Exit; @@ -404,7 +407,7 @@ /* now read postscript table */ if ( format == 0x00020000L ) error = load_format_20( face, stream, post_limit ); - else if ( format == 0x00028000L ) + else if ( format == 0x00025000L ) error = load_format_25( face, stream, post_limit ); else error = FT_THROW( Invalid_File_Format ); @@ -443,7 +446,7 @@ FT_FREE( table->glyph_names ); table->num_names = 0; } - else if ( format == 0x00028000L ) + else if ( format == 0x00025000L ) { TT_Post_25 table = &names->names.format_25; @@ -470,8 +473,8 @@ /* idx :: The glyph index. */ /* */ /* */ - /* PSname :: The address of a string pointer. Will be NULL in case */ - /* of error, otherwise it is a pointer to the glyph name. */ + /* PSname :: The address of a string pointer. Undefined in case of */ + /* error, otherwise it is a pointer to the glyph name. */ /* */ /* You must not modify the returned string! */ /* */ @@ -539,7 +542,7 @@ *PSname = (FT_String*)table->glyph_names[name_index - 258]; } } - else if ( format == 0x00028000L ) + else if ( format == 0x00025000L ) { TT_Post_25 table = &names->names.format_25; @@ -561,5 +564,12 @@ return FT_Err_Ok; } +#else /* !TT_CONFIG_OPTION_POSTSCRIPT_NAMES */ + + /* ANSI C doesn't like empty source files */ + typedef int _tt_post_dummy; + +#endif /* !TT_CONFIG_OPTION_POSTSCRIPT_NAMES */ + /* END */ diff --git a/src/sfnt/ttpost.h b/src/sfnt/ttpost.h index 722485e32..3bec07e44 100644 --- a/src/sfnt/ttpost.h +++ b/src/sfnt/ttpost.h @@ -5,7 +5,7 @@ /* PostScript name table processing for TrueType and OpenType fonts */ /* (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index 98295932d..33b8640bc 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded bitmap support (body). */ /* */ -/* Copyright 2005-2017 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* Copyright 2013 by Google, Inc. */ @@ -24,6 +24,10 @@ #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H #include FT_BITMAP_H + + +#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS + #include "ttsbit.h" #include "sferrors.h" @@ -444,6 +448,15 @@ metrics->max_advance = FT_MulDiv( hori->advance_Width_Max, ppem_ * 64, upem ); + /* set the scale values (in 16.16 units) so advances */ + /* from the hmtx and vmtx table are scaled correctly */ + metrics->x_scale = FT_MulDiv( metrics->x_ppem, + 64 * 0x10000, + face->header.Units_Per_EM ); + metrics->y_scale = FT_MulDiv( metrics->y_ppem, + 64 * 0x10000, + face->header.Units_Per_EM ); + return error; } @@ -994,8 +1007,9 @@ goto Fail; } - FT_TRACE3(( "tt_sbit_decoder_load_compound: loading %d components\n", - num_components )); + FT_TRACE3(( "tt_sbit_decoder_load_compound: loading %d component%s\n", + num_components, + num_components == 1 ? "" : "s" )); for ( nn = 0; nn < num_components; nn++ ) { @@ -1435,10 +1449,17 @@ return FT_THROW( Invalid_Table ); NoBitmap: + if ( recurse_count ) + { + FT_TRACE4(( "tt_sbit_decoder_load_image:" + " missing subglyph sbit with glyph index %d\n", + glyph_index )); + return FT_THROW( Invalid_Composite ); + } + FT_TRACE4(( "tt_sbit_decoder_load_image:" " no sbit found for glyph index %d\n", glyph_index )); - - return FT_THROW( Invalid_Argument ); + return FT_THROW( Missing_Bitmap ); } @@ -1460,6 +1481,9 @@ FT_Byte* p; FT_UNUSED( map ); +#ifndef FT_CONFIG_OPTION_USE_PNG + FT_UNUSED( metrics_only ); +#endif strike_index = face->sbit_strike_map[strike_index]; @@ -1490,7 +1514,7 @@ FT_FRAME_EXIT(); if ( glyph_start == glyph_end ) - return FT_THROW( Invalid_Argument ); + return FT_THROW( Missing_Bitmap ); if ( glyph_start > glyph_end || glyph_end - glyph_start < 8 || face->ebdt_size - strike_offset < glyph_end ) @@ -1647,5 +1671,12 @@ return error; } +#else /* !TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ + + /* ANSI C doesn't like empty source files */ + typedef int _tt_sbit_dummy; + +#endif /* !TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ + -/* EOF */ +/* END */ diff --git a/src/sfnt/ttsbit.h b/src/sfnt/ttsbit.h index e859ddda4..ce2af3c16 100644 --- a/src/sfnt/ttsbit.h +++ b/src/sfnt/ttsbit.h @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded bitmap support (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/smooth/Jamfile b/src/smooth/Jamfile index 4cd0769ee..9957d5e91 100644 --- a/src/smooth/Jamfile +++ b/src/smooth/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/smooth Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index e9a3ce7a7..803a19e41 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -4,7 +4,7 @@ /* */ /* A new `perfect' anti-aliasing renderer (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -141,6 +141,16 @@ #define FT_INT_MAX INT_MAX #define FT_ULONG_MAX ULONG_MAX +#define ADD_LONG( a, b ) \ + (long)( (unsigned long)(a) + (unsigned long)(b) ) +#define SUB_LONG( a, b ) \ + (long)( (unsigned long)(a) - (unsigned long)(b) ) +#define MUL_LONG( a, b ) \ + (long)( (unsigned long)(a) * (unsigned long)(b) ) +#define NEG_LONG( a ) \ + (long)( -(unsigned long)(a) ) + + #define ft_memset memset #define ft_setjmp setjmp @@ -264,6 +274,7 @@ typedef ptrdiff_t FT_PtrDist; #include "ftgrays.h" #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_CALC_H #include FT_OUTLINE_H #include "ftsmerrs.h" @@ -359,7 +370,7 @@ typedef ptrdiff_t FT_PtrDist; /* optimize a division and modulo operation on the same parameters */ /* into a single call to `__aeabi_idivmod'. See */ /* */ - /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43721 */ + /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43721 */ #undef FT_DIV_MOD #define FT_DIV_MOD( type, dividend, divisor, quotient, remainder ) \ FT_BEGIN_STMNT \ @@ -393,7 +404,7 @@ typedef ptrdiff_t FT_PtrDist; /* need to define them to "float" or "double" when experimenting with */ /* new algorithms */ - typedef long TPos; /* sub-pixel coordinate */ + typedef long TPos; /* subpixel coordinate */ typedef int TCoord; /* integer scanline/pixel coordinate */ typedef int TArea; /* cell areas, coordinate products */ @@ -571,8 +582,8 @@ typedef ptrdiff_t FT_PtrDist; if ( ex < ras.min_ex ) ex = ras.min_ex - 1; - /* record the current one if it is valid */ - if ( !ras.invalid ) + /* record the current one if it is valid and substantial */ + if ( !ras.invalid && ( ras.area || ras.cover ) ) gray_record_cell( RAS_VAR ); ras.area = 0; @@ -1135,7 +1146,7 @@ typedef ptrdiff_t FT_PtrDist; /* s is L * the perpendicular distance from P1 to the line P0-P3. */ dx1 = arc[1].x - arc[0].x; dy1 = arc[1].y - arc[0].y; - s = FT_ABS( dy * dx1 - dx * dy1 ); + s = FT_ABS( SUB_LONG( MUL_LONG( dy, dx1 ), MUL_LONG( dx, dy1 ) ) ); if ( s > s_limit ) goto Split; @@ -1143,7 +1154,7 @@ typedef ptrdiff_t FT_PtrDist; /* s is L * the perpendicular distance from P2 to the line P0-P3. */ dx2 = arc[2].x - arc[0].x; dy2 = arc[2].y - arc[0].y; - s = FT_ABS( dy * dx2 - dx * dy2 ); + s = FT_ABS( SUB_LONG( MUL_LONG( dy, dx2 ), MUL_LONG( dx, dy2 ) ) ); if ( s > s_limit ) goto Split; @@ -1289,8 +1300,6 @@ typedef ptrdiff_t FT_PtrDist; int y; - FT_TRACE7(( "gray_sweep: start\n" )); - for ( y = ras.min_ey; y < ras.max_ey; y++ ) { PCell cell = ras.ycells[y - ras.min_ey]; @@ -1316,8 +1325,6 @@ typedef ptrdiff_t FT_PtrDist; if ( cover != 0 ) gray_hline( RAS_VAR_ x, y, cover, ras.max_ex - x ); } - - FT_TRACE7(( "gray_sweep: end\n" )); } @@ -1711,8 +1718,11 @@ typedef ptrdiff_t FT_PtrDist; if ( !ras.invalid ) gray_record_cell( RAS_VAR ); - FT_TRACE7(( "band [%d..%d]: %d cells\n", - ras.min_ey, ras.max_ey, ras.num_cells )); + FT_TRACE7(( "band [%d..%d]: %d cell%s\n", + ras.min_ey, + ras.max_ey, + ras.num_cells, + ras.num_cells == 1 ? "" : "s" )); } else { @@ -1729,35 +1739,43 @@ typedef ptrdiff_t FT_PtrDist; static int gray_convert_glyph( RAS_ARG ) { + const TCoord yMin = ras.min_ey; + const TCoord yMax = ras.max_ey; + const TCoord xMin = ras.min_ex; + const TCoord xMax = ras.max_ex; + TCell buffer[FT_MAX_GRAY_POOL]; - TCoord band_size = FT_MAX_GRAY_POOL / 8; - TCoord count = ras.max_ey - ras.min_ey; - int num_bands; - TCoord min, max, max_y; + size_t height = (size_t)( yMax - yMin ); + size_t n = FT_MAX_GRAY_POOL / 8; + TCoord y; TCoord bands[32]; /* enough to accommodate bisections */ TCoord* band; /* set up vertical bands */ - if ( count > band_size ) + if ( height > n ) { /* two divisions rounded up */ - num_bands = (int)( ( count + band_size - 1) / band_size ); - band_size = ( count + num_bands - 1 ) / num_bands; + n = ( height + n - 1 ) / n; + height = ( height + n - 1 ) / n; } - min = ras.min_ey; - max_y = ras.max_ey; + /* memory management */ + n = ( height * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) / sizeof ( TCell ); + + ras.cells = buffer + n; + ras.max_cells = (FT_PtrDist)( FT_MAX_GRAY_POOL - n ); + ras.ycells = (PCell*)buffer; - for ( ; min < max_y; min = max ) + for ( y = yMin; y < yMax; ) { - max = min + band_size; - if ( max > max_y ) - max = max_y; + ras.min_ey = y; + y += height; + ras.max_ey = FT_MIN( y, yMax ); band = bands; - band[1] = min; - band[0] = max; + band[1] = xMin; + band[0] = xMax; do { @@ -1765,27 +1783,12 @@ typedef ptrdiff_t FT_PtrDist; int error; - /* memory management */ - { - size_t ycount = (size_t)width; - size_t cell_start; - - - cell_start = ( ycount * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) / - sizeof ( TCell ); - - ras.cells = buffer + cell_start; - ras.max_cells = (FT_PtrDist)( FT_MAX_GRAY_POOL - cell_start ); - ras.num_cells = 0; - - ras.ycells = (PCell*)buffer; - while ( ycount ) - ras.ycells[--ycount] = NULL; - } + FT_MEM_ZERO( ras.ycells, height * sizeof ( PCell ) ); + ras.num_cells = 0; ras.invalid = 1; - ras.min_ey = band[1]; - ras.max_ey = band[0]; + ras.min_ex = band[1]; + ras.max_ex = band[0]; error = gray_convert_glyph_inner( RAS_VAR ); @@ -1801,8 +1804,7 @@ typedef ptrdiff_t FT_PtrDist; /* render pool overflow; we will reduce the render band by half */ width >>= 1; - /* This is too complex for a single scanline; there must */ - /* be some problems. */ + /* this should never happen even with tiny rendering pool */ if ( width == 0 ) { FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" )); diff --git a/src/smooth/ftgrays.h b/src/smooth/ftgrays.h index a5447da1a..9e11ca675 100644 --- a/src/smooth/ftgrays.h +++ b/src/smooth/ftgrays.h @@ -4,7 +4,7 @@ /* */ /* FreeType smooth renderer declaration */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/smooth/ftsmerrs.h b/src/smooth/ftsmerrs.h index a528c6183..226dc1b00 100644 --- a/src/smooth/ftsmerrs.h +++ b/src/smooth/ftsmerrs.h @@ -4,7 +4,7 @@ /* */ /* smooth renderer error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index d8007ebe0..ef176bdf1 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -4,7 +4,7 @@ /* */ /* Anti-aliasing renderer interface (body). */ /* */ -/* Copyright 2000-2017 by */ +/* Copyright 2000-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,12 +31,7 @@ static FT_Error ft_smooth_init( FT_Renderer render ) { - FT_Library library = FT_MODULE_LIBRARY( render ); - - - render->clazz->raster_class->raster_reset( render->raster, - library->raster_pool, - library->raster_pool_size ); + render->clazz->raster_class->raster_reset( render->raster, NULL, 0 ); return 0; } @@ -102,77 +97,17 @@ const FT_Vector* origin, FT_Render_Mode required_mode ) { - FT_Error error; + FT_Error error = FT_Err_Ok; FT_Outline* outline = &slot->outline; FT_Bitmap* bitmap = &slot->bitmap; FT_Memory memory = render->root.memory; - FT_BBox cbox; - FT_Int lcd_extra = 2; FT_Pos x_shift = 0; FT_Pos y_shift = 0; - FT_Pos x_left, y_top; - FT_Pos width, height, pitch; FT_Int hmul = ( mode == FT_RENDER_MODE_LCD ); FT_Int vmul = ( mode == FT_RENDER_MODE_LCD_V ); FT_Raster_Params params; - FT_Bool have_outline_shifted = FALSE; - FT_Bool have_buffer = FALSE; - -#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - - FT_LcdFiveTapFilter lcd_weights = { 0 }; - FT_Bool have_custom_weight = FALSE; - FT_Bitmap_LcdFilterFunc lcd_filter_func = NULL; - - - if ( slot->face ) - { - FT_Char i; - - - for ( i = 0; i < FT_LCD_FILTER_FIVE_TAPS; i++ ) - if ( slot->face->internal->lcd_weights[i] != 0 ) - { - have_custom_weight = TRUE; - break; - } - } - - /* - * The LCD filter can be set library-wide and per-face. Face overrides - * library. If the face filter weights are all zero (the default), it - * means that the library default should be used. - */ - if ( have_custom_weight ) - { - /* - * A per-font filter is set. It always uses the default 5-tap - * in-place FIR filter that needs 2 extra pixels. - */ - ft_memcpy( lcd_weights, - slot->face->internal->lcd_weights, - FT_LCD_FILTER_FIVE_TAPS ); - lcd_filter_func = ft_lcd_filter_fir; - lcd_extra = 2; - } - else - { - /* - * The face's lcd_weights is {0, 0, 0, 0, 0}, meaning `use library - * default'. If the library is set to use no LCD filtering - * (lcd_filter_func == NULL), `lcd_filter_func' here is also set to - * NULL and the tests further below pass over the filtering process. - */ - ft_memcpy( lcd_weights, - slot->library->lcd_weights, - FT_LCD_FILTER_FIVE_TAPS ); - lcd_filter_func = slot->library->lcd_filter_func; - lcd_extra = slot->library->lcd_extra; - } - -#endif /*FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ /* check glyph image format */ if ( slot->format != render->glyph_format ) @@ -188,68 +123,6 @@ goto Exit; } - if ( origin ) - { - x_shift = origin->x; - y_shift = origin->y; - } - - /* compute the control box, and grid fit it */ - /* taking into account the origin shift */ - FT_Outline_Get_CBox( outline, &cbox ); - - cbox.xMin = FT_PIX_FLOOR( cbox.xMin + x_shift ); - cbox.yMin = FT_PIX_FLOOR( cbox.yMin + y_shift ); - cbox.xMax = FT_PIX_CEIL( cbox.xMax + x_shift ); - cbox.yMax = FT_PIX_CEIL( cbox.yMax + y_shift ); - - x_shift -= cbox.xMin; - y_shift -= cbox.yMin; - - x_left = cbox.xMin >> 6; - y_top = cbox.yMax >> 6; - - width = (FT_ULong)( cbox.xMax - cbox.xMin ) >> 6; - height = (FT_ULong)( cbox.yMax - cbox.yMin ) >> 6; - - if ( hmul ) - { - x_shift += 64 * ( lcd_extra >> 1 ); - x_left -= lcd_extra >> 1; - width = 3 * ( width + lcd_extra ); - pitch = FT_PAD_CEIL( width, 4 ); - } - else if ( vmul ) - { - y_shift += 64 * ( lcd_extra >> 1 ); - y_top += lcd_extra >> 1; - height = 3 * ( height + lcd_extra ); - pitch = width; - } - else - pitch = width; - - /* - * XXX: on 16bit system, we return an error for huge bitmap - * to prevent an overflow. - */ - if ( x_left > FT_INT_MAX || y_top > FT_INT_MAX || - x_left < FT_INT_MIN || y_top < FT_INT_MIN ) - { - error = FT_THROW( Invalid_Pixel_Size ); - goto Exit; - } - - /* Required check is (pitch * height < FT_ULONG_MAX), */ - /* but we care realistic cases only. Always pitch <= width. */ - if ( width > 0x7FFF || height > 0x7FFF ) - { - FT_ERROR(( "ft_smooth_render_generic: glyph too large: %u x %u\n", - width, height )); - error = FT_THROW( Raster_Overflow ); - goto Exit; - } - /* release old bitmap buffer */ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { @@ -257,30 +130,30 @@ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } + ft_glyphslot_preset_bitmap( slot, mode, origin ); + /* allocate new one */ - if ( FT_ALLOC( bitmap->buffer, (FT_ULong)( pitch * height ) ) ) + if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) ) goto Exit; - else - have_buffer = TRUE; slot->internal->flags |= FT_GLYPH_OWN_BITMAP; - slot->format = FT_GLYPH_FORMAT_BITMAP; - slot->bitmap_left = (FT_Int)x_left; - slot->bitmap_top = (FT_Int)y_top; + x_shift = 64 * -slot->bitmap_left; + y_shift = 64 * -slot->bitmap_top; + if ( bitmap->pixel_mode == FT_PIXEL_MODE_LCD_V ) + y_shift += 64 * (FT_Int)bitmap->rows / 3; + else + y_shift += 64 * (FT_Int)bitmap->rows; - bitmap->pixel_mode = FT_PIXEL_MODE_GRAY; - bitmap->num_grays = 256; - bitmap->width = (unsigned int)width; - bitmap->rows = (unsigned int)height; - bitmap->pitch = pitch; + if ( origin ) + { + x_shift += origin->x; + y_shift += origin->y; + } /* translate outline to render it into the bitmap */ if ( x_shift || y_shift ) - { FT_Outline_Translate( outline, x_shift, y_shift ); - have_outline_shifted = TRUE; - } /* set up parameters */ params.target = bitmap; @@ -327,44 +200,68 @@ if ( error ) goto Exit; - if ( lcd_filter_func ) - lcd_filter_func( bitmap, mode, lcd_weights ); + /* finally apply filtering */ + if ( hmul || vmul ) + { + FT_Byte* lcd_weights; + FT_Bitmap_LcdFilterFunc lcd_filter_func; + + + /* Per-face LCD filtering takes priority if set up. */ + if ( slot->face && slot->face->internal->lcd_filter_func ) + { + lcd_weights = slot->face->internal->lcd_weights; + lcd_filter_func = slot->face->internal->lcd_filter_func; + } + else + { + lcd_weights = slot->library->lcd_weights; + lcd_filter_func = slot->library->lcd_filter_func; + } + + if ( lcd_filter_func ) + lcd_filter_func( bitmap, mode, lcd_weights ); + } #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ if ( hmul ) /* lcd */ { FT_Byte* line; - FT_Byte* temp; - FT_Int i, j; + FT_Byte* temp = NULL; + FT_UInt i, j; + + unsigned int height = bitmap->rows; + unsigned int width = bitmap->width; + int pitch = bitmap->pitch; + /* Render 3 separate monochrome bitmaps, shifting the outline */ /* by 1/3 pixel. */ width /= 3; - FT_Outline_Translate( outline, 21, 0 ); + bitmap->buffer += width; error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; FT_Outline_Translate( outline, -21, 0 ); + x_shift -= 21; bitmap->buffer += width; error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; - FT_Outline_Translate( outline, -21, 0 ); - bitmap->buffer += width; + FT_Outline_Translate( outline, 42, 0 ); + x_shift += 42; + bitmap->buffer -= 2 * width; error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; - FT_Outline_Translate( outline, 21, 0 ); - bitmap->buffer -= 2 * width; - /* XXX: Rearrange the bytes according to FT_PIXEL_MODE_LCD. */ /* XXX: It is more efficient to render every third byte above. */ @@ -373,7 +270,7 @@ for ( i = 0; i < height; i++ ) { - line = bitmap->buffer + i * pitch; + line = bitmap->buffer + i * (FT_ULong)pitch; for ( j = 0; j < width; j++ ) { temp[3 * j ] = line[j]; @@ -387,60 +284,59 @@ } else if ( vmul ) /* lcd_v */ { + int pitch = bitmap->pitch; + + /* Render 3 separate monochrome bitmaps, shifting the outline */ /* by 1/3 pixel. Triple the pitch to render on each third row. */ bitmap->pitch *= 3; bitmap->rows /= 3; - FT_Outline_Translate( outline, 0, 21 ); - bitmap->buffer += 2 * pitch; + bitmap->buffer += pitch; error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; - FT_Outline_Translate( outline, 0, -21 ); - bitmap->buffer -= pitch; + FT_Outline_Translate( outline, 0, 21 ); + y_shift += 21; + bitmap->buffer += pitch; error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; - FT_Outline_Translate( outline, 0, -21 ); - bitmap->buffer -= pitch; + FT_Outline_Translate( outline, 0, -42 ); + y_shift -= 42; + bitmap->buffer -= 2 * pitch; error = render->raster_render( render->raster, ¶ms ); if ( error ) goto Exit; - FT_Outline_Translate( outline, 0, 21 ); - bitmap->pitch /= 3; bitmap->rows *= 3; } else /* grayscale */ - { error = render->raster_render( render->raster, ¶ms ); - if ( error ) - goto Exit; - } #endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - /* everything is fine; don't deallocate buffer */ - have_buffer = FALSE; - - error = FT_Err_Ok; - Exit: - if ( have_outline_shifted ) - FT_Outline_Translate( outline, -x_shift, -y_shift ); - if ( have_buffer ) + if ( !error ) + { + /* everything is fine; the glyph is now officially a bitmap */ + slot->format = FT_GLYPH_FORMAT_BITMAP; + } + else if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { FT_FREE( bitmap->buffer ); slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } + if ( x_shift || y_shift ) + FT_Outline_Translate( outline, -x_shift, -y_shift ); + return error; } @@ -467,14 +363,8 @@ FT_Render_Mode mode, const FT_Vector* origin ) { - FT_Error error; - - error = ft_smooth_render_generic( render, slot, mode, origin, - FT_RENDER_MODE_LCD ); - if ( !error ) - slot->bitmap.pixel_mode = FT_PIXEL_MODE_LCD; - - return error; + return ft_smooth_render_generic( render, slot, mode, origin, + FT_RENDER_MODE_LCD ); } @@ -485,14 +375,8 @@ FT_Render_Mode mode, const FT_Vector* origin ) { - FT_Error error; - - error = ft_smooth_render_generic( render, slot, mode, origin, - FT_RENDER_MODE_LCD_V ); - if ( !error ) - slot->bitmap.pixel_mode = FT_PIXEL_MODE_LCD_V; - - return error; + return ft_smooth_render_generic( render, slot, mode, origin, + FT_RENDER_MODE_LCD_V ); } diff --git a/src/smooth/ftsmooth.h b/src/smooth/ftsmooth.h index 929e26078..c76ffc503 100644 --- a/src/smooth/ftsmooth.h +++ b/src/smooth/ftsmooth.h @@ -4,7 +4,7 @@ /* */ /* Anti-aliasing renderer interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,18 +27,11 @@ FT_BEGIN_HEADER -#ifndef FT_CONFIG_OPTION_NO_STD_RASTER - FT_DECLARE_RENDERER( ft_std_renderer_class ) -#endif - -#ifndef FT_CONFIG_OPTION_NO_SMOOTH_RASTER FT_DECLARE_RENDERER( ft_smooth_renderer_class ) FT_DECLARE_RENDERER( ft_smooth_lcd_renderer_class ) - FT_DECLARE_RENDERER( ft_smooth_lcd_v_renderer_class ) -#endif - + FT_DECLARE_RENDERER( ft_smooth_lcdv_renderer_class ) FT_END_HEADER diff --git a/src/smooth/ftspic.c b/src/smooth/ftspic.c index fb89be348..10f04cf4c 100644 --- a/src/smooth/ftspic.c +++ b/src/smooth/ftspic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for smooth module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/smooth/ftspic.h b/src/smooth/ftspic.h index 9ddd1c790..80fb64cff 100644 --- a/src/smooth/ftspic.h +++ b/src/smooth/ftspic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for smooth module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/smooth/module.mk b/src/smooth/module.mk index 804e9b138..5b8bc3be3 100644 --- a/src/smooth/module.mk +++ b/src/smooth/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/smooth/rules.mk b/src/smooth/rules.mk index dfdc9bc30..f30824a36 100644 --- a/src/smooth/rules.mk +++ b/src/smooth/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/smooth/smooth.c b/src/smooth/smooth.c index 200f5dcb9..5249a8931 100644 --- a/src/smooth/smooth.c +++ b/src/smooth/smooth.c @@ -4,7 +4,7 @@ /* */ /* FreeType anti-aliasing rasterer module component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,11 +17,11 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "ftspic.c" + #include "ftgrays.c" #include "ftsmooth.c" +#include "ftspic.c" /* END */ diff --git a/src/tools/afblue.pl b/src/tools/afblue.pl index 027b63041..7c6f1a7df 100644 --- a/src/tools/afblue.pl +++ b/src/tools/afblue.pl @@ -5,7 +5,7 @@ # # Process a blue zone character data file. # -# Copyright 2013-2017 by +# Copyright 2013-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, diff --git a/src/tools/apinames.c b/src/tools/apinames.c index 73bc99de5..06c326043 100644 --- a/src/tools/apinames.c +++ b/src/tools/apinames.c @@ -22,7 +22,7 @@ #include #define PROGRAM_NAME "apinames" -#define PROGRAM_VERSION "0.2" +#define PROGRAM_VERSION "0.3" #define LINEBUFF_SIZE 1024 @@ -32,7 +32,8 @@ typedef enum OutputFormat_ OUTPUT_WINDOWS_DEF, /* output a Windows .DEF file for Visual C++ or Mingw */ OUTPUT_BORLAND_DEF, /* output a Windows .DEF file for Borland C++ */ OUTPUT_WATCOM_LBC, /* output a Watcom Linker Command File */ - OUTPUT_NETWARE_IMP /* output a NetWare ImportFile */ + OUTPUT_NETWARE_IMP, /* output a NetWare ImportFile */ + OUTPUT_GNU_VERMAP /* output a version map for GNU or Solaris linker */ } OutputFormat; @@ -198,6 +199,15 @@ names_dump( FILE* out, } break; + case OUTPUT_GNU_VERMAP: + { + fprintf( out, "{\n\tglobal:\n" ); + for ( nn = 0; nn < num_names; nn++ ) + fprintf( out, "\t\t%s;\n", the_names[nn].name ); + fprintf( out, "\tlocal:\n\t\t*;\n};\n" ); + } + break; + default: /* LIST */ for ( nn = 0; nn < num_names; nn++ ) fprintf( out, "%s\n", the_names[nn].name ); @@ -323,6 +333,7 @@ usage( void ) " -wB : output .DEF file for Borland C++\n" " -wW : output Watcom Linker Response File\n" " -wN : output NetWare Import File\n" + " -wL : output version map for GNU or Solaris linker\n" "\n"; fprintf( stderr, @@ -410,6 +421,10 @@ int main( int argc, const char* const* argv ) format = OUTPUT_NETWARE_IMP; break; + case 'L': + format = OUTPUT_GNU_VERMAP; + break; + case 0: break; diff --git a/src/tools/docmaker/content.py b/src/tools/docmaker/content.py index 283d81518..198780aee 100644 --- a/src/tools/docmaker/content.py +++ b/src/tools/docmaker/content.py @@ -3,7 +3,7 @@ # # Parse comment blocks to build content blocks (library file). # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, @@ -109,7 +109,7 @@ class DocCode: def dump( self, prefix = "", width = 60 ): lines = self.dump_lines( 0, width ) for l in lines: - print prefix + l + print( prefix + l ) def dump_lines( self, margin = 0, width = 60 ): result = [] @@ -139,7 +139,7 @@ class DocPara: def dump( self, prefix = "", width = 60 ): lines = self.dump_lines( 0, width ) for l in lines: - print prefix + l + print( prefix + l ) def dump_lines( self, margin = 0, width = 60 ): cur = "" # current line @@ -243,13 +243,13 @@ class DocField: def dump( self, prefix = "" ): if self.field: - print prefix + self.field + " ::" + print( prefix + self.field + " ::" ) prefix = prefix + "----" first = 1 for p in self.items: if not first: - print "" + print( "" ) p.dump( prefix ) first = 0 @@ -330,10 +330,10 @@ class DocMarkup: return None def dump( self, margin ): - print " " * margin + "<" + self.tag + ">" + print( " " * margin + "<" + self.tag + ">" ) for f in self.fields: f.dump( " " ) - print " " * margin + "" + print( " " * margin + "" ) ################################################################ @@ -453,15 +453,32 @@ class ContentProcessor: markup_lines = [] first = 1 + margin = -1 + in_code = 0 + for line in content: - found = None - for t in re_markup_tags: - m = t.match( line ) + if in_code: + m = re_code_end.match( line ) + if m and len( m.group( 1 ) ) <= margin: + in_code = 0 + margin = -1 + else: + m = re_code_start.match( line ) if m: - found = string.lower( m.group( 1 ) ) - prefix = len( m.group( 0 ) ) - line = " " * prefix + line[prefix:] # remove markup from line - break + in_code = 1 + margin = len( m.group( 1 ) ) + + found = None + + if not in_code: + for t in re_markup_tags: + m = t.match( line ) + if m: + found = string.lower( m.group( 1 ) ) + prefix = len( m.group( 0 ) ) + # remove markup from line + line = " " * prefix + line[prefix:] + break # is it the start of a new markup section ? if found: diff --git a/src/tools/docmaker/docbeauty.py b/src/tools/docmaker/docbeauty.py index 3ddf4a94a..0b021fa6c 100644 --- a/src/tools/docmaker/docbeauty.py +++ b/src/tools/docmaker/docbeauty.py @@ -10,9 +10,7 @@ from sources import * from content import * from utils import * -import utils - -import sys, os, time, string, getopt +import sys, os, string, getopt content_processor = ContentProcessor() @@ -40,13 +38,13 @@ def beautify_block( block ): def usage(): - print "\nDocBeauty 0.1 Usage information\n" - print " docbeauty [options] file1 [file2 ...]\n" - print "using the following options:\n" - print " -h : print this page" - print " -b : backup original files with the 'orig' extension" - print "" - print " --backup : same as -b" + print( "\nDocBeauty 0.1 Usage information\n" ) + print( " docbeauty [options] file1 [file2 ...]\n" ) + print( "using the following options:\n" ) + print( " -h : print this page" ) + print( " -b : backup original files with the 'orig' extension" ) + print( "" ) + print( " --backup : same as -b" ) def main( argv ): diff --git a/src/tools/docmaker/docmaker.py b/src/tools/docmaker/docmaker.py index 4e25ff0f8..eb49afb0a 100644 --- a/src/tools/docmaker/docmaker.py +++ b/src/tools/docmaker/docmaker.py @@ -4,7 +4,7 @@ # # Convert source code markup to HTML documentation. # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, @@ -31,21 +31,21 @@ from tohtml import * import utils -import sys, os, time, string, glob, getopt +import sys, glob, getopt def usage(): - print "\nDocMaker Usage information\n" - print " docmaker [options] file1 [file2 ...]\n" - print "using the following options:\n" - print " -h : print this page" - print " -t : set project title, as in '-t \"My Project\"'" - print " -o : set output directory, as in '-o mydir'" - print " -p : set documentation prefix, as in '-p ft2'" - print "" - print " --title : same as -t, as in '--title=\"My Project\"'" - print " --output : same as -o, as in '--output=mydir'" - print " --prefix : same as -p, as in '--prefix=ft2'" + print( "\nDocMaker Usage information\n" ) + print( " docmaker [options] file1 [file2 ...]\n" ) + print( "using the following options:\n" ) + print( " -h : print this page" ) + print( " -t : set project title, as in '-t \"My Project\"'" ) + print( " -o : set output directory, as in '-o mydir'" ) + print( " -p : set documentation prefix, as in '-p ft2'" ) + print( "" ) + print( " --title : same as -t, as in '--title=\"My Project\"'" ) + print( " --output : same as -o, as in '--output=mydir'" ) + print( " --prefix : same as -p, as in '--prefix=ft2'" ) def main( argv ): diff --git a/src/tools/docmaker/formatter.py b/src/tools/docmaker/formatter.py index 2745754f3..2708fd40d 100644 --- a/src/tools/docmaker/formatter.py +++ b/src/tools/docmaker/formatter.py @@ -3,7 +3,7 @@ # # Convert parsed content blocks to a structured document (library file). # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, diff --git a/src/tools/docmaker/sources.py b/src/tools/docmaker/sources.py index 06407e164..e3b95e0fa 100644 --- a/src/tools/docmaker/sources.py +++ b/src/tools/docmaker/sources.py @@ -3,7 +3,7 @@ # # Convert source code comments to multi-line blocks (library file). # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, @@ -29,7 +29,7 @@ # -import fileinput, re, sys, os, string +import fileinput, re, string ################################################################ @@ -171,7 +171,7 @@ re_bold = re.compile( r"\*((?:\w|-)(?:\w|'|-)*)\*(.*)" ) # *bold* # # This regular expression code to identify an URL has been taken from # -# http://mail.python.org/pipermail/tutor/2002-September/017228.html +# https://mail.python.org/pipermail/tutor/2002-September/017228.html # # (with slight modifications). # @@ -296,10 +296,10 @@ class SourceBlock: # debugging only -- not used in normal operations def dump( self ): if self.content: - print "{{{content start---" + print( "{{{content start---" ) for l in self.content: - print l - print "---content end}}}" + print( l ) + print( "---content end}}}" ) return fmt = "" @@ -307,7 +307,7 @@ class SourceBlock: fmt = repr( self.format.id ) + " " for line in self.lines: - print line + print( line ) ################################################################ diff --git a/src/tools/docmaker/tohtml.py b/src/tools/docmaker/tohtml.py index 012b55e49..9f318a2a4 100644 --- a/src/tools/docmaker/tohtml.py +++ b/src/tools/docmaker/tohtml.py @@ -3,7 +3,7 @@ # # A sub-class container of the `Formatter' class to produce HTML. # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, @@ -25,7 +25,7 @@ import time # The following strings define the HTML header used by all generated pages. html_header_1 = """\ +"https://www.w3.org/TR/html4/loose.dtd"> @@ -406,7 +406,7 @@ class HtmlFormatter( Formatter ): return string.join( lines, '\n' ) def print_html_items( self, items ): - print self.make_html_items( items ) + print( self.make_html_items( items ) ) def print_html_field( self, field ): if field.name: @@ -414,10 +414,10 @@ class HtmlFormatter( Formatter ): + field.name + "" ) - print self.make_html_items( field.items ) + print( self.make_html_items( field.items ) ) if field.name: - print "" + print( "" ) def html_source_quote( self, line, block_name = None ): result = "" @@ -468,14 +468,14 @@ class HtmlFormatter( Formatter ): return result def print_html_field_list( self, fields ): - print '' + print( '
    ' ) for field in fields: - print ( '" - print "
    ' - + field.name - + '' ) + print( '
    ' + + field.name + + '' ) self.print_html_items( field.items ) - print "
    " + print( "" ) + print( "" ) def print_html_markup( self, markup ): table_fields = [] @@ -499,7 +499,7 @@ class HtmlFormatter( Formatter ): # formatting the index # def index_enter( self ): - print self.html_index_header + print( self.html_index_header ) self.index_items = {} def index_name_enter( self, name ): @@ -512,7 +512,7 @@ class HtmlFormatter( Formatter ): count = len( self.block_index ) rows = ( count + self.columns - 1 ) // self.columns - print '' + print( '
    ' ) for r in range( rows ): line = "" for c in range( self.columns ): @@ -531,15 +531,15 @@ class HtmlFormatter( Formatter ): else: line = line + '' line = line + "" - print line + print( line ) - print "
    " + print( "" ) print( index_footer_start + self.file_prefix + "toc.html" + index_footer_end ) - print self.html_footer + print( self.html_footer ) self.index_items = {} @@ -553,25 +553,25 @@ class HtmlFormatter( Formatter ): # formatting the table of contents # def toc_enter( self ): - print self.html_toc_header - print "

    Table of Contents

    " + print( self.html_toc_header ) + print( "

    Table of Contents

    " ) def toc_chapter_enter( self, chapter ): - print chapter_header + string.join( chapter.title ) + chapter_inter - print '' + print( chapter_header + string.join( chapter.title ) + chapter_inter ) + print( '
    ' ) def toc_section_enter( self, section ): - print ( '" + print( "" ) def toc_chapter_exit( self, chapter ): - print "
    ' ) - print self.make_html_para( section.abstract ) + print( '
    ' ) + print( self.make_html_para( section.abstract ) ) def toc_section_exit( self, section ): - print "
    " - print chapter_footer + print( "" ) + print( chapter_footer ) def toc_index( self, index_filename ): print( chapter_header @@ -583,7 +583,7 @@ class HtmlFormatter( Formatter ): + self.file_prefix + "index.html" + toc_footer_end ) - print self.html_footer + print( self.html_footer ) def toc_dump( self, toc_filename = None, index_filename = None ): if toc_filename == None: @@ -598,11 +598,11 @@ class HtmlFormatter( Formatter ): # formatting sections # def section_enter( self, section ): - print self.html_header + print( self.html_header ) - print ( section_title_header1 + section.name + section_title_header2 - + section.title - + section_title_footer ) + print( section_title_header1 + section.name + section_title_header2 + + section.title + + section_title_footer ) maxwidth = 0 for b in section.blocks.values(): @@ -612,8 +612,8 @@ class HtmlFormatter( Formatter ): width = 70 # XXX magic number if maxwidth > 0: # print section synopsis - print section_synopsis_header - print '' + print( section_synopsis_header ) + print( '
    ' ) columns = width // maxwidth if columns < 1: @@ -650,17 +650,17 @@ class HtmlFormatter( Formatter ): line = line + '' line = line + "" - print line + print( line ) - print "
    " - print section_synopsis_footer + print( "" ) + print( section_synopsis_footer ) - print description_header - print self.make_html_items( section.description ) - print description_footer + print( description_header ) + print( self.make_html_items( section.description ) ) + print( description_footer ) def block_enter( self, block ): - print block_header + print( block_header ) # place html anchor if needed if block.name: @@ -686,28 +686,28 @@ class HtmlFormatter( Formatter ): # + " '" + block.source.filename + "'.\n" ) if header: - print ( header_location_header - + 'Defined in ' + header + '.' - + header_location_footer ) + print( header_location_header + + 'Defined in ' + header + '.' + + header_location_footer ) - print source_header + print( source_header ) for l in block.code: - print self.html_source_quote( l, block.name ) - print source_footer + print( self.html_source_quote( l, block.name ) ) + print( source_footer ) def markup_enter( self, markup, block ): if markup.tag == "description": - print description_header + print( description_header ) else: - print marker_header + markup.tag + marker_inter + print( marker_header + markup.tag + marker_inter ) self.print_html_markup( markup ) def markup_exit( self, markup, block ): if markup.tag == "description": - print description_footer + print( description_footer ) else: - print marker_footer + print( marker_footer ) def block_exit( self, block ): print( block_footer_start + self.file_prefix + "index.html" @@ -715,7 +715,7 @@ class HtmlFormatter( Formatter ): + block_footer_end ) def section_exit( self, section ): - print html_footer + print( html_footer ) def section_dump_all( self ): for section in self.sections: diff --git a/src/tools/docmaker/utils.py b/src/tools/docmaker/utils.py index ba5b2e759..f40f1674a 100644 --- a/src/tools/docmaker/utils.py +++ b/src/tools/docmaker/utils.py @@ -3,7 +3,7 @@ # # Auxiliary functions for the `docmaker' tool (library file). # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner. # # This file is part of the FreeType project, and may only be used, diff --git a/src/tools/ftfuzzer/README b/src/tools/ftfuzzer/README index 53f907177..09d8e9f32 100644 --- a/src/tools/ftfuzzer/README +++ b/src/tools/ftfuzzer/README @@ -6,7 +6,7 @@ ftfuzzer.cc ----------- This file contains a target function for FreeType fuzzing. It can be -used with libFuzzer (http://llvm.org/docs/LibFuzzer.html) or +used with libFuzzer (https://llvm.org/docs/LibFuzzer.html) or potentially any other similar fuzzer. Usage: @@ -20,7 +20,7 @@ Usage: -fsanitize=address,signed-integer-overflow,shift You also need the header files from the `libarchive' library - (http://www.libarchive.org/) for handling tar files (see file + (https://www.libarchive.org/) for handling tar files (see file `ftmutator.cc' below for more). 2. Link with `libFuzzer' (it contains `main') and `libarchive'. @@ -29,10 +29,14 @@ Usage: The exact flags and commands may vary. + https://github.com/google/oss-fuzz/tree/master/projects/freetype2 There is a continuous fuzzing bot that runs ftfuzzer. - https://github.com/google/libfuzzer-bot/tree/master/freetype + https://oss-fuzz.com + +(You need an account to be able to see coverage reports and the like +on oss-fuzz.com.) Check the bot configuration for the most current settings. @@ -64,7 +68,7 @@ a convenience `main' function. Link it with `ftfuzzer.cc', ---------------------------------------------------------------------- -Copyright 2015-2017 by +Copyright 2015-2018 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/src/tools/ftfuzzer/ftfuzzer.cc b/src/tools/ftfuzzer/ftfuzzer.cc index 475b23266..acf2bc982 100644 --- a/src/tools/ftfuzzer/ftfuzzer.cc +++ b/src/tools/ftfuzzer/ftfuzzer.cc @@ -2,7 +2,7 @@ // // A fuzzing function to test FreeType with libFuzzer. // -// Copyright 2015-2017 by +// Copyright 2015-2018 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, @@ -43,8 +43,7 @@ #include FT_OUTLINE_H #include FT_BBOX_H #include FT_MODULE_H -#include FT_CFF_DRIVER_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include FT_MULTIPLE_MASTERS_H @@ -61,7 +60,7 @@ return; // try to activate Adobe's CFF engine; it might not be the default - unsigned int cff_hinting_engine = FT_CFF_HINTING_ADOBE; + unsigned int cff_hinting_engine = FT_HINTING_ADOBE; FT_Property_Set( library, "cff", "hinting-engine", &cff_hinting_engine ); @@ -270,11 +269,20 @@ long num_faces = face->num_faces; FT_Done_Face( face ); - // loop over all faces - for ( long face_index = 0; - face_index < num_faces; - face_index++ ) + // loop over up to 20 arbitrarily selected faces + // from index range [0;num-faces-1] + long max_face_cnt = num_faces < 20 + ? num_faces + : 20; + + Random faces_pool( (int)max_face_cnt, (int)num_faces ); + + for ( long face_cnt = 0; + face_cnt < max_face_cnt; + face_cnt++ ) { + long face_index = faces_pool.get() - 1; + // get number of instances if ( FT_New_Memory_Face( library, files[0].data(), @@ -285,17 +293,41 @@ long num_instances = face->style_flags >> 16; FT_Done_Face( face ); - // load face with and without instances - for ( long instance_index = 0; - instance_index < num_instances + 1; - instance_index++ ) + // loop over the face without instance (index 0) + // and up to 20 arbitrarily selected instances + // from index range [1;num_instances] + long max_instance_cnt = num_instances < 20 + ? num_instances + : 20; + + Random instances_pool( (int)max_instance_cnt, (int)num_instances ); + + for ( long instance_cnt = 0; + instance_cnt <= max_instance_cnt; + instance_cnt++ ) { - if ( FT_New_Memory_Face( library, - files[0].data(), - (FT_Long)files[0].size(), - ( instance_index << 16 ) + face_index, - &face ) ) - continue; + long instance_index = 0; + + if ( !instance_cnt ) + { + if ( FT_New_Memory_Face( library, + files[0].data(), + (FT_Long)files[0].size(), + face_index, + &face ) ) + continue; + } + else + { + instance_index = instances_pool.get(); + + if ( FT_New_Memory_Face( library, + files[0].data(), + (FT_Long)files[0].size(), + ( instance_index << 16 ) + face_index, + &face ) ) + continue; + } // if we have more than a single input file coming from an archive, // attach them (starting with the second file) using the order given @@ -314,19 +346,24 @@ FT_Attach_Stream( face, &open_args ); } - // loop over an arbitrary size for outlines (index 0) - // and up to ten arbitrarily selected bitmap stroke sizes (index 1-10) - int max_idx = face->num_fixed_sizes < 10 - ? face->num_fixed_sizes - : 10; + // loop over an arbitrary size for outlines + // and up to ten arbitrarily selected bitmap strike sizes + // from the range [0;num_fixed_sizes - 1] + int max_size_cnt = face->num_fixed_sizes < 10 + ? face->num_fixed_sizes + : 10; - Random pool( max_idx, face->num_fixed_sizes ); + Random sizes_pool( max_size_cnt, face->num_fixed_sizes ); - for ( int idx = 0; idx <= max_idx; idx++ ) + for ( int size_cnt = 0; + size_cnt <= max_size_cnt; + size_cnt++ ) { FT_Int32 flags = load_flags; - if ( !idx ) + int size_index = 0; + + if ( !size_cnt ) { // set up 20pt at 72dpi as an arbitrary size if ( FT_Set_Char_Size( face, 20 * 64, 20 * 64, 72, 72 ) ) @@ -335,17 +372,20 @@ } else { - // bitmap strokes are not active for glyph variations + // bitmap strikes are not active for font variations if ( instance_index ) continue; - if ( FT_Select_Size( face, pool.get() - 1 ) ) + size_index = sizes_pool.get() - 1; + + if ( FT_Select_Size( face, size_index ) ) continue; flags |= FT_LOAD_COLOR; } // test MM interface only for a face without a selected instance - if ( instance_index == 0 ) + // and without a selected bitmap strike + if ( !instance_index && !size_cnt ) setIntermediateAxis( face ); // loop over all glyphs diff --git a/src/tools/ftfuzzer/ftmutator.cc b/src/tools/ftfuzzer/ftmutator.cc index 22aa5a777..ae4b14040 100644 --- a/src/tools/ftfuzzer/ftmutator.cc +++ b/src/tools/ftfuzzer/ftmutator.cc @@ -2,7 +2,7 @@ // // A custom fuzzer mutator to test for FreeType with libFuzzer. // -// Copyright 2015-2017 by +// Copyright 2015-2018 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, diff --git a/src/tools/ftfuzzer/rasterfuzzer.cc b/src/tools/ftfuzzer/rasterfuzzer.cc index ae9b1a56d..c69b95ea0 100644 --- a/src/tools/ftfuzzer/rasterfuzzer.cc +++ b/src/tools/ftfuzzer/rasterfuzzer.cc @@ -2,7 +2,7 @@ // // A fuzzing function to test FreeType's rasterizers with libFuzzer. // -// Copyright 2016-2017 by +// Copyright 2016-2018 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, diff --git a/src/tools/ftfuzzer/runinput.cc b/src/tools/ftfuzzer/runinput.cc index 15261207e..2b02f5758 100644 --- a/src/tools/ftfuzzer/runinput.cc +++ b/src/tools/ftfuzzer/runinput.cc @@ -2,7 +2,7 @@ // // A `main' function for fuzzers like `ftfuzzer.cc'. // -// Copyright 2015-2017 by +// Copyright 2015-2018 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, diff --git a/src/tools/glnames.py b/src/tools/glnames.py index 9ed158862..b048d2936 100644 --- a/src/tools/glnames.py +++ b/src/tools/glnames.py @@ -6,7 +6,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -151,7 +151,7 @@ mac_standard_names = \ # The list of standard `SID' glyph names. For the official list, # see Annex A of document at # -# http://partners.adobe.com/public/developer/en/font/5176.CFF.pdf . +# https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5176.CFF.pdf . # sid_standard_names = \ [ @@ -4920,7 +4920,7 @@ class StringTable: def dump( self, file ): write = file.write - write( "#ifndef DEFINE_PS_TABLES\n" ) + write( "#ifndef DEFINE_PS_TABLES_DATA\n" ) write( "#ifdef __cplusplus\n" ) write( ' extern "C"\n' ) write( "#else\n" ) @@ -4929,7 +4929,7 @@ class StringTable: write( "#endif\n" ) write( " const char " + self.master_table + "[" + repr( self.total ) + "]\n" ) - write( "#ifdef DEFINE_PS_TABLES\n" ) + write( "#ifdef DEFINE_PS_TABLES_DATA\n" ) write( " =\n" ) write( " {\n" ) @@ -4941,7 +4941,7 @@ class StringTable: write( line ) write( " }\n" ) - write( "#endif /* DEFINE_PS_TABLES */\n" ) + write( "#endif /* DEFINE_PS_TABLES_DATA */\n" ) write( " ;\n\n\n" ) def dump_sublist( self, file, table_name, macro_name, sublist ): @@ -4950,7 +4950,7 @@ class StringTable: write( " /* Values are offsets into the `" + self.master_table + "' table */\n\n" ) - write( "#ifndef DEFINE_PS_TABLES\n" ) + write( "#ifndef DEFINE_PS_TABLES_DATA\n" ) write( "#ifdef __cplusplus\n" ) write( ' extern "C"\n' ) write( "#else\n" ) @@ -4959,7 +4959,7 @@ class StringTable: write( "#endif\n" ) write( " const short " + table_name + "[" + macro_name + "]\n" ) - write( "#ifdef DEFINE_PS_TABLES\n" ) + write( "#ifdef DEFINE_PS_TABLES_DATA\n" ) write( " =\n" ) write( " {\n" ) @@ -4979,7 +4979,7 @@ class StringTable: write( line ) write( "\n" ) write( " }\n" ) - write( "#endif /* DEFINE_PS_TABLES */\n" ) + write( "#endif /* DEFINE_PS_TABLES_DATA */\n" ) write( " ;\n\n\n" ) @@ -5213,7 +5213,7 @@ def dump_encoding( file, encoding_name, encoding_list ): write = file.write write( " /* the following are indices into the SID name table */\n" ) - write( "#ifndef DEFINE_PS_TABLES\n" ) + write( "#ifndef DEFINE_PS_TABLES_DATA\n" ) write( "#ifdef __cplusplus\n" ) write( ' extern "C"\n' ) write( "#else\n" ) @@ -5222,7 +5222,7 @@ def dump_encoding( file, encoding_name, encoding_list ): write( "#endif\n" ) write( " const unsigned short " + encoding_name + "[" + repr( len( encoding_list ) ) + "]\n" ) - write( "#ifdef DEFINE_PS_TABLES\n" ) + write( "#ifdef DEFINE_PS_TABLES_DATA\n" ) write( " =\n" ) write( " {\n" ) @@ -5241,14 +5241,14 @@ def dump_encoding( file, encoding_name, encoding_list ): write( line ) write( "\n" ) write( " }\n" ) - write( "#endif /* DEFINE_PS_TABLES */\n" ) + write( "#endif /* DEFINE_PS_TABLES_DATA */\n" ) write( " ;\n\n\n" ) def dump_array( the_array, write, array_name ): """dumps a given encoding""" - write( "#ifndef DEFINE_PS_TABLES\n" ) + write( "#ifndef DEFINE_PS_TABLES_DATA\n" ) write( "#ifdef __cplusplus\n" ) write( ' extern "C"\n' ) write( "#else\n" ) @@ -5257,7 +5257,7 @@ def dump_array( the_array, write, array_name ): write( "#endif\n" ) write( " const unsigned char " + array_name + "[" + repr( len( the_array ) ) + "L]\n" ) - write( "#ifdef DEFINE_PS_TABLES\n" ) + write( "#ifdef DEFINE_PS_TABLES_DATA\n" ) write( " =\n" ) write( " {\n" ) @@ -5282,7 +5282,7 @@ def dump_array( the_array, write, array_name ): write( line ) write( "\n" ) write( " }\n" ) - write( "#endif /* DEFINE_PS_TABLES */\n" ) + write( "#endif /* DEFINE_PS_TABLES_DATA */\n" ) write( " ;\n\n\n" ) @@ -5293,7 +5293,7 @@ def main(): print __doc__ % sys.argv[0] sys.exit( 1 ) - file = open( sys.argv[1], "w\n" ) + file = open( sys.argv[1], "wb" ) write = file.write count_sid = len( sid_standard_names ) @@ -5318,7 +5318,7 @@ def main(): write( "/* */\n" ) write( "/* PostScript glyph names. */\n" ) write( "/* */\n" ) - write( "/* Copyright 2005-2017 by */\n" ) + write( "/* Copyright 2005-2018 by */\n" ) write( "/* David Turner, Robert Wilhelm, and Werner Lemberg. */\n" ) write( "/* */\n" ) write( "/* This file is part of the FreeType project, and may only be used, */\n" ) diff --git a/src/tools/update-copyright-year b/src/tools/update-copyright-year index 4b04bfc99..934f11cf0 100755 --- a/src/tools/update-copyright-year +++ b/src/tools/update-copyright-year @@ -2,7 +2,7 @@ eval '(exit $?0)' && eval 'exec perl -wS -i "$0" ${1+"$@"}' & eval 'exec perl -wS -i "$0" $argv:q' if 0; -# Copyright 2015-2017 by +# Copyright 2015-2018 by # Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/truetype/Jamfile b/src/truetype/Jamfile index 22d406cd7..e321fba14 100644 --- a/src/truetype/Jamfile +++ b/src/truetype/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/truetype Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/truetype/module.mk b/src/truetype/module.mk index 563c584e2..16bc9c8b2 100644 --- a/src/truetype/module.mk +++ b/src/truetype/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/truetype/rules.mk b/src/truetype/rules.mk index ad3d00745..e16113f12 100644 --- a/src/truetype/rules.mk +++ b/src/truetype/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/truetype/truetype.c b/src/truetype/truetype.c index 4866103a7..484370975 100644 --- a/src/truetype/truetype.c +++ b/src/truetype/truetype.c @@ -4,7 +4,7 @@ /* */ /* FreeType TrueType driver component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,22 +17,16 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "ttpic.c" + #include "ttdriver.c" /* driver interface */ -#include "ttpload.c" /* tables loader */ #include "ttgload.c" /* glyph loader */ -#include "ttobjs.c" /* object manager */ - -#ifdef TT_USE_BYTECODE_INTERPRETER +#include "ttgxvar.c" /* gx distortable font */ #include "ttinterp.c" +#include "ttobjs.c" /* object manager */ +#include "ttpic.c" +#include "ttpload.c" /* tables loader */ #include "ttsubpix.c" -#endif - -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include "ttgxvar.c" /* gx distortable font */ -#endif /* END */ diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 6f9b74691..820cafbb8 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -4,7 +4,7 @@ /* */ /* TrueType font driver implementation (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,7 +31,7 @@ #include FT_SERVICE_TRUETYPE_ENGINE_H #include FT_SERVICE_TRUETYPE_GLYF_H #include FT_SERVICE_PROPERTIES_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include "ttdriver.h" #include "ttgload.h" @@ -233,8 +233,8 @@ { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without VVAR table */ - if ( !face->is_default_instance && - !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) + if ( ( FT_IS_NAMED_INSTANCE( ttface ) || FT_IS_VARIATION( ttface ) ) && + !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) return FT_THROW( Unimplemented_Feature ); #endif @@ -253,8 +253,8 @@ { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without HVAR table */ - if ( !face->is_default_instance && - !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) + if ( ( FT_IS_NAMED_INSTANCE( ttface ) || FT_IS_VARIATION( ttface ) ) && + !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) return FT_THROW( Unimplemented_Feature ); #endif @@ -308,11 +308,13 @@ } else { - SFNT_Service sfnt = (SFNT_Service)ttface->sfnt; - FT_Size_Metrics* metrics = &size->metrics; + SFNT_Service sfnt = (SFNT_Service)ttface->sfnt; + FT_Size_Metrics* size_metrics = &size->metrics; - error = sfnt->load_strike_metrics( ttface, strike_index, metrics ); + error = sfnt->load_strike_metrics( ttface, + strike_index, + size_metrics ); if ( error ) ttsize->strike_index = 0xFFFFFFFFUL; } @@ -354,15 +356,16 @@ if ( FT_IS_SCALABLE( size->face ) ) { - error = tt_size_reset( ttsize, 0 ); - ttsize->root.metrics = ttsize->metrics; + error = tt_size_reset( ttsize, 0 ); #ifdef TT_USE_BYTECODE_INTERPRETER /* for the `MPS' bytecode instruction we need the point size */ + if ( !error ) { - FT_UInt resolution = ttsize->metrics.x_ppem > ttsize->metrics.y_ppem - ? req->horiResolution - : req->vertResolution; + FT_UInt resolution = + ttsize->metrics->x_ppem > ttsize->metrics->y_ppem + ? req->horiResolution + : req->vertResolution; /* if we don't have a resolution value, assume 72dpi */ @@ -456,6 +459,11 @@ load_flags |= FT_LOAD_NO_HINTING; } + /* use hinted metrics only if we load a glyph with hinting */ + size->metrics = ( load_flags & FT_LOAD_NO_HINTING ) + ? &ttsize->metrics + : &size->hinted_metrics; + /* now load the glyph outline if necessary */ error = TT_Load_Glyph( size, slot, glyph_index, load_flags ); @@ -490,6 +498,7 @@ (FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */ (FT_Set_Var_Design_Func)TT_Set_Var_Design, /* set_var_design */ (FT_Get_Var_Design_Func)TT_Get_Var_Design, /* get_var_design */ + (FT_Set_Instance_Func) TT_Set_Named_Instance, /* set_instance */ (FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */ (FT_Done_Blend_Func) tt_done_blend /* done_blend */ diff --git a/src/truetype/ttdriver.h b/src/truetype/ttdriver.h index 3bcba7f74..707aa68ed 100644 --- a/src/truetype/ttdriver.h +++ b/src/truetype/ttdriver.h @@ -4,7 +4,7 @@ /* */ /* High-level TrueType driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/tterrors.h b/src/truetype/tterrors.h index a49f20515..88bca3a04 100644 --- a/src/truetype/tterrors.h +++ b/src/truetype/tterrors.h @@ -4,7 +4,7 @@ /* */ /* TrueType error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 0fdaa85f2..39d9c3f73 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -4,7 +4,7 @@ /* */ /* TrueType Glyph Loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,12 +18,13 @@ #include #include FT_INTERNAL_DEBUG_H +#include FT_CONFIG_CONFIG_H #include FT_INTERNAL_CALC_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_TAGS_H #include FT_OUTLINE_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include FT_LIST_H #include "ttgload.h" @@ -86,7 +87,7 @@ /*************************************************************************/ /* */ /* Return the vertical metrics in font units for a given glyph. */ - /* See macro `TT_LOADER_SET_PP' below for explanations. */ + /* See function `tt_loader_set_pp' below for explanations. */ /* */ FT_LOCAL_DEF( void ) TT_Get_VMetrics( TT_Face face, @@ -162,7 +163,7 @@ /* This may not be the right place for this, but it works... */ /* Note that we have to unconditionally load the tweaks since */ /* it is possible that glyphs individually switch ClearType's */ - /* backwards compatibility mode on and off. */ + /* backward compatibility mode on and off. */ sph_set_tweaks( loader, glyph_index ); } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ @@ -194,39 +195,39 @@ if ( face->root.internal->incremental_interface && face->root.internal->incremental_interface->funcs->get_glyph_metrics ) { - FT_Incremental_MetricsRec metrics; + FT_Incremental_MetricsRec incr_metrics; FT_Error error; - metrics.bearing_x = loader->left_bearing; - metrics.bearing_y = 0; - metrics.advance = loader->advance; - metrics.advance_v = 0; + incr_metrics.bearing_x = loader->left_bearing; + incr_metrics.bearing_y = 0; + incr_metrics.advance = loader->advance; + incr_metrics.advance_v = 0; error = face->root.internal->incremental_interface->funcs->get_glyph_metrics( face->root.internal->incremental_interface->object, - glyph_index, FALSE, &metrics ); + glyph_index, FALSE, &incr_metrics ); if ( error ) goto Exit; - left_bearing = (FT_Short)metrics.bearing_x; - advance_width = (FT_UShort)metrics.advance; + left_bearing = (FT_Short)incr_metrics.bearing_x; + advance_width = (FT_UShort)incr_metrics.advance; #if 0 /* GWW: Do I do the same for vertical metrics? */ - metrics.bearing_x = 0; - metrics.bearing_y = loader->top_bearing; - metrics.advance = loader->vadvance; + incr_metrics.bearing_x = 0; + incr_metrics.bearing_y = loader->top_bearing; + incr_metrics.advance = loader->vadvance; error = face->root.internal->incremental_interface->funcs->get_glyph_metrics( face->root.internal->incremental_interface->object, - glyph_index, TRUE, &metrics ); + glyph_index, TRUE, &incr_metrics ); if ( error ) goto Exit; - top_bearing = (FT_Short)metrics.bearing_y; - advance_height = (FT_UShort)metrics.advance; + top_bearing = (FT_Short)incr_metrics.bearing_y; + advance_height = (FT_UShort)incr_metrics.advance; #endif /* 0 */ @@ -332,7 +333,6 @@ FT_Outline* outline; FT_UShort n_ins; FT_Int n_points; - FT_ULong tmp; FT_Byte *flag, *flag_limit; FT_Byte c, count; @@ -402,6 +402,9 @@ if ( IS_HINTED( load->load_flags ) ) { + FT_ULong tmp; + + /* check instructions size */ if ( ( limit - p ) < n_ins ) { @@ -661,7 +664,52 @@ } while ( subglyph->flags & MORE_COMPONENTS ); gloader->current.num_subglyphs = num_subglyphs; - FT_TRACE5(( " %d components\n", num_subglyphs )); + FT_TRACE5(( " %d component%s\n", + num_subglyphs, + num_subglyphs > 1 ? "s" : "" )); + +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_UInt i; + + + subglyph = gloader->current.subglyphs; + + for ( i = 0; i < num_subglyphs; i++ ) + { + if ( num_subglyphs > 1 ) + FT_TRACE7(( " subglyph %d:\n", i )); + + FT_TRACE7(( " glyph index: %d\n", subglyph->index )); + + if ( subglyph->flags & ARGS_ARE_XY_VALUES ) + FT_TRACE7(( " offset: x=%d, y=%d\n", + subglyph->arg1, + subglyph->arg2 )); + else + FT_TRACE7(( " matching points: base=%d, component=%d\n", + subglyph->arg1, + subglyph->arg2 )); + + if ( subglyph->flags & WE_HAVE_A_SCALE ) + FT_TRACE7(( " scaling: %f\n", + subglyph->transform.xx / 65536.0 )); + else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE ) + FT_TRACE7(( " scaling: x=%f, y=%f\n", + subglyph->transform.xx / 65536.0, + subglyph->transform.yy / 65536.0 )); + else if ( subglyph->flags & WE_HAVE_A_2X2 ) + FT_TRACE7(( " scaling: xx=%f, yx=%f\n" + " xy=%f, yy=%f\n", + subglyph->transform.xx / 65536.0, + subglyph->transform.yx / 65536.0, + subglyph->transform.xy / 65536.0, + subglyph->transform.yy / 65536.0 )); + + subglyph++; + } + } +#endif /* FT_DEBUG_LEVEL_TRACE */ #ifdef TT_USE_BYTECODE_INTERPRETER @@ -753,7 +801,7 @@ { FT_TRACE1(( "TT_Hint_Glyph: too long instructions" )); FT_TRACE1(( " (0x%lx byte) is truncated\n", - loader->glyph->control_len )); + loader->glyph->control_len )); } n_ins = loader->glyph->control_len; @@ -775,8 +823,8 @@ } else { - loader->exec->metrics.x_scale = loader->size->metrics.x_scale; - loader->exec->metrics.y_scale = loader->size->metrics.y_scale; + loader->exec->metrics.x_scale = loader->size->metrics->x_scale; + loader->exec->metrics.y_scale = loader->size->metrics->y_scale; } #endif @@ -818,11 +866,11 @@ #endif #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* Save possibly modified glyph phantom points unless in v40 backwards */ + /* Save possibly modified glyph phantom points unless in v40 backward */ /* compatibility mode, where no movement on the x axis means no reason */ /* to change bearings or advance widths. */ if ( !( driver->interpreter_version == TT_INTERPRETER_VERSION_40 && - !loader->exec->backwards_compatibility ) ) + loader->exec->backward_compatibility ) ) { #endif loader->pp1 = zone->cur[zone->n_points - 4]; @@ -886,7 +934,8 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( !loader->face->is_default_instance ) + if ( FT_IS_NAMED_INSTANCE( FT_FACE( loader->face ) ) || + FT_IS_VARIATION( FT_FACE( loader->face ) ) ) { /* Deltas apply to the unscaled data. */ error = TT_Vary_Apply_Glyph_Deltas( loader->face, @@ -923,7 +972,7 @@ TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); FT_String* family = face->root.family_name; - FT_UInt ppem = loader->size->metrics.x_ppem; + FT_UInt ppem = loader->size->metrics->x_ppem; FT_String* style = face->root.style_name; FT_UInt x_scale_factor = 1000; #endif @@ -952,9 +1001,9 @@ if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 || x_scale_factor != 1000 ) { - x_scale = FT_MulDiv( loader->size->metrics.x_scale, + x_scale = FT_MulDiv( loader->size->metrics->x_scale, (FT_Long)x_scale_factor, 1000 ); - y_scale = loader->size->metrics.y_scale; + y_scale = loader->size->metrics->y_scale; /* compensate for any scaling by de/emboldening; */ /* the amount was determined via experimentation */ @@ -974,8 +1023,8 @@ /* scale the glyph */ if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) { - x_scale = loader->size->metrics.x_scale; - y_scale = loader->size->metrics.y_scale; + x_scale = loader->size->metrics->x_scale; + y_scale = loader->size->metrics->y_scale; do_scale = TRUE; } @@ -988,9 +1037,24 @@ vec->x = FT_MulFix( vec->x, x_scale ); vec->y = FT_MulFix( vec->y, y_scale ); } + } +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /* if we have a HVAR table, `pp1' and/or `pp2' are already adjusted */ + if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) || + !IS_HINTED( loader->load_flags ) ) +#endif + { loader->pp1 = outline->points[n_points - 4]; loader->pp2 = outline->points[n_points - 3]; + } + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /* if we have a VVAR table, `pp3' and/or `pp4' are already adjusted */ + if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) || + !IS_HINTED( loader->load_flags ) ) +#endif + { loader->pp3 = outline->points[n_points - 2]; loader->pp4 = outline->points[n_points - 1]; } @@ -1133,8 +1197,8 @@ if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) ) { - FT_Fixed x_scale = loader->size->metrics.x_scale; - FT_Fixed y_scale = loader->size->metrics.y_scale; + FT_Fixed x_scale = loader->size->metrics->x_scale; + FT_Fixed y_scale = loader->size->metrics->y_scale; x = FT_MulFix( x, x_scale ); @@ -1142,8 +1206,28 @@ if ( subglyph->flags & ROUND_XY_TO_GRID ) { - x = FT_PIX_ROUND( x ); - y = FT_PIX_ROUND( y ); + TT_Face face = loader->face; + TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); + + + if ( IS_HINTED( loader->load_flags ) ) + { + /* + * We round the horizontal offset only if there is hinting along + * the x axis; this corresponds to integer advance width values. + * + * Theoretically, a glyph's bytecode can toggle ClearType's + * `backward compatibility' mode, which would allow modification + * of the advance width. In reality, however, applications + * neither allow nor expect modified advance widths if subpixel + * rendering is active. + * + */ + if ( driver->interpreter_version == TT_INTERPRETER_VERSION_35 ) + x = FT_PIX_ROUND( x ); + + y = FT_PIX_ROUND( y ); + } } } } @@ -1356,6 +1440,7 @@ TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( loader->face ); #endif + #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 ) { @@ -1392,7 +1477,7 @@ /* a utility function to retrieve i-th node from given FT_List */ static FT_ListNode ft_list_get_node_at( FT_List list, - FT_UInt index ) + FT_UInt idx ) { FT_ListNode cur; @@ -1402,10 +1487,10 @@ for ( cur = list->head; cur; cur = cur->next ) { - if ( !index ) + if ( !idx ) return cur; - index--; + idx--; } return NULL; @@ -1467,8 +1552,8 @@ if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) { - x_scale = loader->size->metrics.x_scale; - y_scale = loader->size->metrics.y_scale; + x_scale = loader->size->metrics->x_scale; + y_scale = loader->size->metrics->y_scale; } else { @@ -1574,7 +1659,8 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( !loader->face->is_default_instance ) + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) || + FT_IS_VARIATION( FT_FACE( face ) ) ) { /* a small outline structure with four elements for */ /* communication with `TT_Vary_Apply_Glyph_Deltas' */ @@ -1683,7 +1769,7 @@ /***********************************************************************/ /* otherwise, load a composite! */ - else if ( loader->n_contours == -1 ) + else if ( loader->n_contours < 0 ) { FT_Memory memory = face->root.memory; @@ -1694,6 +1780,9 @@ FT_ListNode node, node2; + /* normalize the `n_contours' value */ + loader->n_contours = -1; + /* * We store the glyph index directly in the `node->data' pointer, * following the glib solution (cf. macro `GUINT_TO_POINTER') with a @@ -1705,11 +1794,11 @@ /* clear the nodes filled by sibling chains */ node = ft_list_get_node_at( &loader->composites, recurse_count ); for ( node2 = node; node2; node2 = node2->next ) - node2->data = (void*)ULONG_MAX; + node2->data = (void*)FT_ULONG_MAX; /* check whether we already have a composite glyph with this index */ if ( FT_List_Find( &loader->composites, - (void*)(unsigned long)glyph_index ) ) + FT_UINT_TO_POINTER( glyph_index ) ) ) { FT_TRACE1(( "TT_Load_Composite_Glyph:" " infinite recursion detected\n" )); @@ -1718,13 +1807,13 @@ } else if ( node ) - node->data = (void*)(unsigned long)glyph_index; + node->data = FT_UINT_TO_POINTER( glyph_index ); else { if ( FT_NEW( node ) ) goto Exit; - node->data = (void*)(unsigned long)glyph_index; + node->data = FT_UINT_TO_POINTER( glyph_index ); FT_List_Add( &loader->composites, node ); } @@ -1745,7 +1834,8 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( !face->is_default_instance ) + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) || + FT_IS_VARIATION( FT_FACE( face ) ) ) { short i, limit; FT_SubGlyph subglyph; @@ -1988,12 +2078,6 @@ } } } - else - { - /* invalid composite count (negative but not -1) */ - error = FT_THROW( Invalid_Outline ); - goto Exit; - } /***********************************************************************/ /***********************************************************************/ @@ -2035,7 +2119,7 @@ y_scale = 0x10000L; if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) - y_scale = size->root.metrics.y_scale; + y_scale = size->metrics->y_scale; if ( glyph->format != FT_GLYPH_FORMAT_COMPOSITE ) FT_Outline_Get_CBox( &glyph->outline, &bbox ); @@ -2050,24 +2134,24 @@ glyph->metrics.horiBearingY = bbox.yMax; glyph->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; - /* Adjust advance width to the value contained in the hdmx table */ - /* unless FT_LOAD_COMPUTE_METRICS is set or backwards compatibility */ - /* mode of the v40 interpreter is active. See `ttinterp.h' for */ - /* details on backwards compatibility mode. */ + /* Adjust advance width to the value contained in the hdmx table */ + /* unless FT_LOAD_COMPUTE_METRICS is set or backward compatibility */ + /* mode of the v40 interpreter is active. See `ttinterp.h' for */ + /* details on backward compatibility mode. */ if ( #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - !( driver->interpreter_version == TT_INTERPRETER_VERSION_40 && - ( loader->exec && loader->exec->backwards_compatibility ) ) && + !( driver->interpreter_version == TT_INTERPRETER_VERSION_40 && + ( loader->exec && loader->exec->backward_compatibility ) ) && #endif - !face->postscript.isFixedPitch && - IS_HINTED( loader->load_flags ) && - !( loader->load_flags & FT_LOAD_COMPUTE_METRICS ) ) + !face->postscript.isFixedPitch && + IS_HINTED( loader->load_flags ) && + !( loader->load_flags & FT_LOAD_COMPUTE_METRICS ) ) { FT_Byte* widthp; widthp = tt_face_get_device_metrics( face, - size->root.metrics.x_ppem, + size->metrics->x_ppem, glyph_index ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY @@ -2097,8 +2181,8 @@ } /* set glyph dimensions */ - glyph->metrics.width = bbox.xMax - bbox.xMin; - glyph->metrics.height = bbox.yMax - bbox.yMin; + glyph->metrics.width = SUB_LONG( bbox.xMax, bbox.xMin ); + glyph->metrics.height = SUB_LONG( bbox.yMax, bbox.yMin ); /* Now take care of vertical metrics. In the case where there is */ /* no vertical information within the font (relatively common), */ @@ -2134,7 +2218,8 @@ /* table in the font. Otherwise, we use the */ /* values defined in the horizontal header. */ - height = (FT_Short)FT_DivFix( bbox.yMax - bbox.yMin, + height = (FT_Short)FT_DivFix( SUB_LONG( bbox.yMax, + bbox.yMin ), y_scale ); if ( face->os2.version != 0xFFFFU ) advance = (FT_Pos)( face->os2.sTypoAscender - @@ -2149,7 +2234,7 @@ #ifdef FT_CONFIG_OPTION_INCREMENTAL { FT_Incremental_InterfaceRec* incr; - FT_Incremental_MetricsRec metrics; + FT_Incremental_MetricsRec incr_metrics; FT_Error error; @@ -2159,19 +2244,19 @@ /* overriding metrics for this glyph. */ if ( incr && incr->funcs->get_glyph_metrics ) { - metrics.bearing_x = 0; - metrics.bearing_y = top; - metrics.advance = advance; + incr_metrics.bearing_x = 0; + incr_metrics.bearing_y = top; + incr_metrics.advance = advance; error = incr->funcs->get_glyph_metrics( incr->object, glyph_index, TRUE, - &metrics ); + &incr_metrics ); if ( error ) return error; - top = metrics.bearing_y; - advance = metrics.advance; + top = incr_metrics.bearing_y; + advance = incr_metrics.advance; } } @@ -2213,7 +2298,7 @@ SFNT_Service sfnt; FT_Stream stream; FT_Error error; - TT_SBit_MetricsRec metrics; + TT_SBit_MetricsRec sbit_metrics; face = (TT_Face)glyph->face; @@ -2226,34 +2311,34 @@ (FT_UInt)load_flags, stream, &glyph->bitmap, - &metrics ); + &sbit_metrics ); if ( !error ) { glyph->outline.n_points = 0; glyph->outline.n_contours = 0; - glyph->metrics.width = (FT_Pos)metrics.width * 64; - glyph->metrics.height = (FT_Pos)metrics.height * 64; + glyph->metrics.width = (FT_Pos)sbit_metrics.width * 64; + glyph->metrics.height = (FT_Pos)sbit_metrics.height * 64; - glyph->metrics.horiBearingX = (FT_Pos)metrics.horiBearingX * 64; - glyph->metrics.horiBearingY = (FT_Pos)metrics.horiBearingY * 64; - glyph->metrics.horiAdvance = (FT_Pos)metrics.horiAdvance * 64; + glyph->metrics.horiBearingX = (FT_Pos)sbit_metrics.horiBearingX * 64; + glyph->metrics.horiBearingY = (FT_Pos)sbit_metrics.horiBearingY * 64; + glyph->metrics.horiAdvance = (FT_Pos)sbit_metrics.horiAdvance * 64; - glyph->metrics.vertBearingX = (FT_Pos)metrics.vertBearingX * 64; - glyph->metrics.vertBearingY = (FT_Pos)metrics.vertBearingY * 64; - glyph->metrics.vertAdvance = (FT_Pos)metrics.vertAdvance * 64; + glyph->metrics.vertBearingX = (FT_Pos)sbit_metrics.vertBearingX * 64; + glyph->metrics.vertBearingY = (FT_Pos)sbit_metrics.vertBearingY * 64; + glyph->metrics.vertAdvance = (FT_Pos)sbit_metrics.vertAdvance * 64; glyph->format = FT_GLYPH_FORMAT_BITMAP; if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) { - glyph->bitmap_left = metrics.vertBearingX; - glyph->bitmap_top = metrics.vertBearingY; + glyph->bitmap_left = sbit_metrics.vertBearingX; + glyph->bitmap_top = sbit_metrics.vertBearingY; } else { - glyph->bitmap_left = metrics.horiBearingX; - glyph->bitmap_top = metrics.horiBearingY; + glyph->bitmap_left = sbit_metrics.horiBearingX; + glyph->bitmap_top = sbit_metrics.horiBearingY; } } @@ -2270,17 +2355,17 @@ FT_Int32 load_flags, FT_Bool glyf_table_only ) { - FT_Error error; - TT_Face face; FT_Stream stream; + #ifdef TT_USE_BYTECODE_INTERPRETER + FT_Error error; FT_Bool pedantic = FT_BOOL( load_flags & FT_LOAD_PEDANTIC ); -#endif #if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \ defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( (TT_Face)glyph->face ); #endif +#endif face = (TT_Face)glyph->face; @@ -2336,13 +2421,19 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 ) { - subpixel_hinting_lean = TRUE; - grayscale_cleartype = !FT_BOOL( load_flags & - FT_LOAD_TARGET_LCD || - load_flags & - FT_LOAD_TARGET_LCD_V ); - exec->vertical_lcd_lean = FT_BOOL( load_flags & - FT_LOAD_TARGET_LCD_V ); + subpixel_hinting_lean = + FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != + FT_RENDER_MODE_MONO ); + grayscale_cleartype = + FT_BOOL( subpixel_hinting_lean && + !( ( load_flags & + FT_LOAD_TARGET_LCD ) || + ( load_flags & + FT_LOAD_TARGET_LCD_V ) ) ); + exec->vertical_lcd_lean = + FT_BOOL( subpixel_hinting_lean && + ( load_flags & + FT_LOAD_TARGET_LCD_V ) ); } else { @@ -2602,7 +2693,8 @@ TT_LoaderRec loader; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#define IS_DEFAULT_INSTANCE ( ( (TT_Face)glyph->face )->is_default_instance ) +#define IS_DEFAULT_INSTANCE ( !( FT_IS_NAMED_INSTANCE( glyph->face ) || \ + FT_IS_VARIATION( glyph->face ) ) ) #else #define IS_DEFAULT_INSTANCE 1 #endif @@ -2617,8 +2709,73 @@ ( load_flags & FT_LOAD_NO_BITMAP ) == 0 && IS_DEFAULT_INSTANCE ) { + 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 ( !error ) + 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 ) ) + { + TT_Face face = (TT_Face)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 ( FT_IS_SCALABLE( glyph->face ) ) { @@ -2632,13 +2789,11 @@ /* sanity checks: if `xxxAdvance' in the sbit metric */ /* structure isn't set, use `linearXXXAdvance' */ if ( !glyph->metrics.horiAdvance && glyph->linearHoriAdvance ) - glyph->metrics.horiAdvance = - FT_MulFix( glyph->linearHoriAdvance, - size->root.metrics.x_scale ); + glyph->metrics.horiAdvance = FT_MulFix( glyph->linearHoriAdvance, + x_scale ); if ( !glyph->metrics.vertAdvance && glyph->linearVertAdvance ) - glyph->metrics.vertAdvance = - FT_MulFix( glyph->linearVertAdvance, - size->root.metrics.y_scale ); + glyph->metrics.vertAdvance = FT_MulFix( glyph->linearVertAdvance, + y_scale ); } return FT_Err_Ok; @@ -2734,7 +2889,7 @@ /* TrueType glyphs at all sizes using the bytecode interpreter. */ /* */ if ( !( load_flags & FT_LOAD_NO_SCALE ) && - size->root.metrics.y_ppem < 24 ) + size->metrics->y_ppem < 24 ) glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; Exit: diff --git a/src/truetype/ttgload.h b/src/truetype/ttgload.h index 1dd6c841d..d237cfd28 100644 --- a/src/truetype/ttgload.h +++ b/src/truetype/ttgload.h @@ -4,7 +4,7 @@ /* */ /* TrueType Glyph Loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index fa614ca1a..29ab2a4ef 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -4,7 +4,7 @@ /* */ /* TrueType GX Font Variation loader */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -60,8 +60,11 @@ #define FT_Stream_FTell( stream ) \ (FT_ULong)( (stream)->cursor - (stream)->base ) -#define FT_Stream_SeekSet( stream, off ) \ - ( (stream)->cursor = (stream)->base + (off) ) +#define FT_Stream_SeekSet( stream, off ) \ + (stream)->cursor = \ + ( (off) < (FT_ULong)( (stream)->limit - (stream)->base ) ) \ + ? (stream)->base + (off) \ + : (stream)->limit /*************************************************************************/ @@ -320,7 +323,7 @@ FT_TRACE2(( "AVAR " )); - blend->avar_checked = TRUE; + blend->avar_loaded = TRUE; error = face->goto_table( face, TTAG_avar, stream, &table_len ); if ( error ) { @@ -392,14 +395,14 @@ /* some macros we need */ - #define FT_FIXED_ONE ( (FT_Fixed)0x10000 ) +#define FT_FIXED_ONE ( (FT_Fixed)0x10000 ) - #define FT_fdot14ToFixed( x ) \ - ( (FT_Fixed)( (FT_ULong)(x) << 2 ) ) - #define FT_intToFixed( i ) \ - ( (FT_Fixed)( (FT_ULong)(i) << 16 ) ) - #define FT_fixedToInt( x ) \ - ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) ) +#define FT_fdot14ToFixed( x ) \ + ( (FT_Fixed)( (FT_ULong)(x) << 2 ) ) +#define FT_intToFixed( i ) \ + ( (FT_Fixed)( (FT_ULong)(i) << 16 ) ) +#define FT_fixedToInt( x ) \ + ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) ) static FT_Error @@ -1007,16 +1010,15 @@ if ( table->widthMap.innerIndex ) { - if ( gindex >= table->widthMap.mapCount ) - { - FT_TRACE2(( "gindex %d out of range\n", gindex )); - error = FT_THROW( Invalid_Argument ); - goto Exit; - } + FT_UInt idx = gindex; + + + if ( idx >= table->widthMap.mapCount ) + idx = table->widthMap.mapCount - 1; /* trust that HVAR parser has checked indices */ - outerIndex = table->widthMap.outerIndex[gindex]; - innerIndex = table->widthMap.innerIndex[gindex]; + outerIndex = table->widthMap.outerIndex[idx]; + innerIndex = table->widthMap.innerIndex[idx]; } else { @@ -1041,10 +1043,11 @@ outerIndex, innerIndex ); - FT_TRACE5(( "%s value %d adjusted by %d units (%s)\n", + FT_TRACE5(( "%s value %d adjusted by %d unit%s (%s)\n", vertical ? "vertical height" : "horizontal width", *avalue, delta, + delta == 1 ? "" : "s", vertical ? "VVAR" : "HVAR" )); *avalue += delta; @@ -1263,7 +1266,16 @@ FT_Short* p = ft_var_get_value_pointer( face, value->tag ); - value->unmodified = *p; + if ( p ) + value->unmodified = *p; +#ifdef FT_DEBUG_LEVEL_TRACE + else + FT_TRACE1(( "ft_var_load_mvar: Ignoring unknown tag `%c%c%c%c'\n", + (FT_Char)( value->tag >> 24 ), + (FT_Char)( value->tag >> 16 ), + (FT_Char)( value->tag >> 8 ), + (FT_Char)( value->tag ) )); +#endif } face->variation_support |= TT_FACE_FLAG_VAR_MVAR; @@ -1320,17 +1332,22 @@ value->outerIndex, value->innerIndex ); - FT_TRACE5(( "value %c%c%c%c (%d units) adjusted by %d units (MVAR)\n", - (FT_Char)( value->tag >> 24 ), - (FT_Char)( value->tag >> 16 ), - (FT_Char)( value->tag >> 8 ), - (FT_Char)( value->tag ), - value->unmodified, - delta )); + if ( p ) + { + FT_TRACE5(( "value %c%c%c%c (%d unit%s) adjusted by %d unit%s (MVAR)\n", + (FT_Char)( value->tag >> 24 ), + (FT_Char)( value->tag >> 16 ), + (FT_Char)( value->tag >> 8 ), + (FT_Char)( value->tag ), + value->unmodified, + value->unmodified == 1 ? "" : "s", + delta, + delta == 1 ? "" : "s" )); - /* since we handle both signed and unsigned values as FT_Short, */ - /* ensure proper overflow arithmetic */ - *p = (FT_Short)( value->unmodified + (FT_Short)delta ); + /* since we handle both signed and unsigned values as FT_Short, */ + /* ensure proper overflow arithmetic */ + *p = (FT_Short)( value->unmodified + (FT_Short)delta ); + } } /* adjust all derived values */ @@ -1485,8 +1502,10 @@ blend->gv_glyphcnt = gvar_head.glyphCount; offsetToData = gvar_start + gvar_head.offsetToData; - FT_TRACE5(( "gvar: there are %d shared coordinates:\n", - blend->tuplecount )); + FT_TRACE5(( "gvar: there %s %d shared coordinate%s:\n", + blend->tuplecount == 1 ? "is" : "are", + blend->tuplecount, + blend->tuplecount == 1 ? "" : "s" )); if ( FT_NEW_ARRAY( blend->glyphoffsets, blend->gv_glyphcnt + 1 ) ) goto Exit; @@ -1714,15 +1733,13 @@ /* based on the [min,def,max] values for the axis to be [-1,0,1]. */ /* Then, if there's an `avar' table, we renormalize this range. */ - FT_TRACE5(( "design coordinates:\n" )); - a = mmvar->axis; for ( i = 0; i < num_coords; i++, a++ ) { FT_Fixed coord = coords[i]; - FT_TRACE5(( " %.5f\n", coord / 65536.0 )); + FT_TRACE5(( " %d: %.5f\n", i, coord / 65536.0 )); if ( coord > a->maximum || coord < a->minimum ) { FT_TRACE1(( @@ -1732,17 +1749,17 @@ a->minimum / 65536.0, a->maximum / 65536.0 )); - if ( coord > a->maximum) + if ( coord > a->maximum ) coord = a->maximum; else coord = a->minimum; } if ( coord < a->def ) - normalized[i] = -FT_DivFix( coords[i] - a->def, + normalized[i] = -FT_DivFix( coord - a->def, a->minimum - a->def ); else if ( coord > a->def ) - normalized[i] = FT_DivFix( coords[i] - a->def, + normalized[i] = FT_DivFix( coord - a->def, a->maximum - a->def ); else normalized[i] = 0; @@ -1808,16 +1825,8 @@ nc = blend->num_axis; } - if ( face->doblend ) - { - for ( i = 0; i < nc; i++ ) - design[i] = coords[i]; - } - else - { - for ( i = 0; i < nc; i++ ) - design[i] = 0; - } + for ( i = 0; i < nc; i++ ) + design[i] = coords[i]; for ( ; i < num_coords; i++ ) design[i] = 0; @@ -1926,11 +1935,11 @@ TT_Get_MM_Var( TT_Face face, FT_MM_Var* *master ) { - FT_Stream stream = face->root.stream; - FT_Memory memory = face->root.memory; + FT_Stream stream = face->root.stream; + FT_Memory memory = face->root.memory; FT_ULong table_len; - FT_Error error = FT_Err_Ok; - FT_ULong fvar_start; + FT_Error error = FT_Err_Ok; + FT_ULong fvar_start = 0; FT_UInt i, j; FT_MM_Var* mmvar = NULL; FT_Fixed* next_coords; @@ -1940,8 +1949,19 @@ FT_Fixed* c; FT_Var_Named_Style* ns; GX_FVar_Head fvar_head; - FT_Bool usePsName; + FT_Bool usePsName = 0; FT_UInt num_instances; + FT_UInt num_axes; + FT_UShort* axis_flags; + + FT_Offset mmvar_size; + FT_Offset axis_flags_size; + FT_Offset axis_size; + FT_Offset namedstyle_size; + FT_Offset next_coords_size; + FT_Offset next_name_size; + + FT_Bool need_init; static const FT_Frame_Field fvar_fields[] = { @@ -1980,7 +2000,9 @@ /* read the font data and set up the internal representation */ /* if not already done */ - if ( !face->blend ) + need_init = !face->blend; + + if ( need_init ) { FT_TRACE2(( "FVAR " )); @@ -2017,24 +2039,57 @@ FT_TRACE2(( "loaded\n" )); - FT_TRACE5(( "number of GX style axes: %d\n", fvar_head.axisCount )); + FT_TRACE5(( "%d variation ax%s\n", + fvar_head.axisCount, + fvar_head.axisCount == 1 ? "is" : "es" )); if ( FT_NEW( face->blend ) ) goto Exit; - /* `num_instances' holds the number of all named instances, */ - /* including the default instance which might be missing */ - /* in fvar's table of named instances */ - num_instances = face->root.style_flags >> 16; - - /* cannot overflow 32-bit arithmetic because of the size limits */ - /* used in the `fvar' table validity check in `sfnt_init_face' */ - face->blend->mmvar_len = - sizeof ( FT_MM_Var ) + - fvar_head.axisCount * sizeof ( FT_Var_Axis ) + - num_instances * sizeof ( FT_Var_Named_Style ) + - num_instances * fvar_head.axisCount * sizeof ( FT_Fixed ) + - 5 * fvar_head.axisCount; + num_axes = fvar_head.axisCount; + face->blend->num_axis = num_axes; + } + else + num_axes = face->blend->num_axis; + + /* `num_instances' holds the number of all named instances, */ + /* including the default instance which might be missing */ + /* in fvar's table of named instances */ + num_instances = (FT_UInt)face->root.style_flags >> 16; + + /* prepare storage area for MM data; this cannot overflow */ + /* 32-bit arithmetic because of the size limits used in the */ + /* `fvar' table validity check in `sfnt_init_face' */ + + /* the various `*_size' variables, which we also use as */ + /* offsets into the `mmlen' array, must be multiples of the */ + /* pointer size (except the last one); without such an */ + /* alignment there might be runtime errors due to */ + /* misaligned addresses */ +#undef ALIGN_SIZE +#define ALIGN_SIZE( n ) \ + ( ( (n) + sizeof (void*) - 1 ) & ~( sizeof (void*) - 1 ) ) + + mmvar_size = ALIGN_SIZE( sizeof ( FT_MM_Var ) ); + axis_flags_size = ALIGN_SIZE( num_axes * + sizeof ( FT_UShort ) ); + axis_size = ALIGN_SIZE( num_axes * + sizeof ( FT_Var_Axis ) ); + namedstyle_size = ALIGN_SIZE( num_instances * + sizeof ( FT_Var_Named_Style ) ); + next_coords_size = ALIGN_SIZE( num_instances * + num_axes * + sizeof ( FT_Fixed ) ); + next_name_size = num_axes * 5; + + if ( need_init ) + { + face->blend->mmvar_len = mmvar_size + + axis_flags_size + + axis_size + + namedstyle_size + + next_coords_size + + next_name_size; if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) ) goto Exit; @@ -2044,28 +2099,33 @@ /* the data gets filled in later on */ mmvar->num_axis = - fvar_head.axisCount; + num_axes; mmvar->num_designs = ~0U; /* meaningless in this context; each glyph */ /* may have a different number of designs */ /* (or tuples, as called by Apple) */ mmvar->num_namedstyles = num_instances; + + /* alas, no public field in `FT_Var_Axis' for axis flags */ + axis_flags = + (FT_UShort*)( (char*)mmvar + mmvar_size ); mmvar->axis = - (FT_Var_Axis*)&( mmvar[1] ); + (FT_Var_Axis*)( (char*)axis_flags + axis_flags_size ); mmvar->namedstyle = - (FT_Var_Named_Style*)&( mmvar->axis[fvar_head.axisCount] ); + (FT_Var_Named_Style*)( (char*)mmvar->axis + axis_size ); - next_coords = - (FT_Fixed*)&( mmvar->namedstyle[num_instances] ); + next_coords = (FT_Fixed*)( (char*)mmvar->namedstyle + + namedstyle_size ); for ( i = 0; i < num_instances; i++ ) { mmvar->namedstyle[i].coords = next_coords; - next_coords += fvar_head.axisCount; + next_coords += num_axes; } - next_name = (FT_String*)next_coords; - for ( i = 0; i < fvar_head.axisCount; i++ ) + next_name = (FT_String*)( (char*)mmvar->namedstyle + + namedstyle_size + next_coords_size ); + for ( i = 0; i < num_axes; i++ ) { mmvar->axis[i].name = next_name; next_name += 5; @@ -2077,10 +2137,14 @@ goto Exit; a = mmvar->axis; - for ( i = 0; i < fvar_head.axisCount; i++ ) + for ( i = 0; i < num_axes; i++ ) { GX_FVar_Axis axis_rec; +#ifdef FT_DEBUG_LEVEL_TRACE + int invalid = 0; +#endif + if ( FT_STREAM_READ_FIELDS( fvaraxis_fields, &axis_rec ) ) goto Exit; @@ -2096,24 +2160,39 @@ a->name[3] = (FT_String)( ( a->tag ) & 0xFF ); a->name[4] = '\0'; + *axis_flags = axis_rec.flags; + if ( a->minimum > a->def || a->def > a->maximum ) { - FT_TRACE2(( "TT_Get_MM_Var:" - " invalid \"%s\" axis record; disabling\n", - a->name )); - a->minimum = a->def; a->maximum = a->def; + +#ifdef FT_DEBUG_LEVEL_TRACE + invalid = 1; +#endif } - FT_TRACE5(( " \"%s\": minimum=%.5f, default=%.5f, maximum=%.5f\n", +#ifdef FT_DEBUG_LEVEL_TRACE + if ( i == 0 ) + FT_TRACE5(( " idx tag " + /* " XXX `XXXX'" */ + " minimum default maximum flags\n" )); + /* " XXXX.XXXXX XXXX.XXXXX XXXX.XXXXX 0xXXXX" */ + + FT_TRACE5(( " %3d `%s'" + " %10.5f %10.5f %10.5f 0x%04X%s\n", + i, a->name, a->minimum / 65536.0, a->def / 65536.0, - a->maximum / 65536.0 )); + a->maximum / 65536.0, + *axis_flags, + invalid ? " (invalid, disabled)" : "" )); +#endif a++; + axis_flags++; } FT_TRACE5(( "\n" )); @@ -2121,36 +2200,94 @@ /* named instance coordinates are stored as design coordinates; */ /* we have to convert them to normalized coordinates also */ if ( FT_NEW_ARRAY( face->blend->normalized_stylecoords, - fvar_head.axisCount * num_instances ) ) + num_axes * num_instances ) ) goto Exit; - if ( fvar_head.instanceCount && !face->blend->avar_checked ) + if ( fvar_head.instanceCount && !face->blend->avar_loaded ) + { + FT_ULong offset = FT_STREAM_POS(); + + ft_var_load_avar( face ); + if ( FT_STREAM_SEEK( offset ) ) + goto Exit; + } + + FT_TRACE5(( "%d instance%s\n", + fvar_head.instanceCount, + fvar_head.instanceCount == 1 ? "" : "s" )); + ns = mmvar->namedstyle; nsc = face->blend->normalized_stylecoords; for ( i = 0; i < fvar_head.instanceCount; i++, ns++ ) { /* PostScript names add 2 bytes to the instance record size */ if ( FT_FRAME_ENTER( ( usePsName ? 6L : 4L ) + - 4L * fvar_head.axisCount ) ) + 4L * num_axes ) ) goto Exit; ns->strid = FT_GET_USHORT(); (void) /* flags = */ FT_GET_USHORT(); c = ns->coords; - for ( j = 0; j < fvar_head.axisCount; j++, c++ ) + for ( j = 0; j < num_axes; j++, c++ ) *c = FT_GET_LONG(); + /* valid psid values are 6, [256;32767], and 0xFFFF */ if ( usePsName ) ns->psid = FT_GET_USHORT(); + else + ns->psid = 0xFFFF; + +#ifdef FT_DEBUG_LEVEL_TRACE + { + SFNT_Service sfnt = (SFNT_Service)face->sfnt; - ft_var_to_normalized( face, - fvar_head.axisCount, - ns->coords, - nsc ); - nsc += fvar_head.axisCount; + FT_String* strname = NULL; + FT_String* psname = NULL; + + FT_ULong pos; + + + pos = FT_STREAM_POS(); + + if ( ns->strid != 0xFFFF ) + { + (void)sfnt->get_name( face, + (FT_UShort)ns->strid, + &strname ); + if ( strname && !ft_strcmp( strname, ".notdef" ) ) + strname = NULL; + } + + if ( ns->psid != 0xFFFF ) + { + (void)sfnt->get_name( face, + (FT_UShort)ns->psid, + &psname ); + if ( psname && !ft_strcmp( psname, ".notdef" ) ) + psname = NULL; + } + + (void)FT_STREAM_SEEK( pos ); + + FT_TRACE5(( " instance %d (%s%s%s, %s%s%s)\n", + i, + strname ? "name: `" : "", + strname ? strname : "unnamed", + strname ? "'" : "", + psname ? "PS name: `" : "", + psname ? psname : "no PS name", + psname ? "'" : "" )); + + FT_FREE( strname ); + FT_FREE( psname ); + } +#endif /* FT_DEBUG_LEVEL_TRACE */ + + ft_var_to_normalized( face, num_axes, ns->coords, nsc ); + nsc += num_axes; FT_FRAME_EXIT(); } @@ -2159,46 +2296,47 @@ { SFNT_Service sfnt = (SFNT_Service)face->sfnt; - FT_Int found, win, apple; + FT_Int found, dummy1, dummy2; + FT_UInt strid = ~0U; /* the default instance is missing in array the */ /* of named instances; try to synthesize an entry */ found = sfnt->get_name_id( face, TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY, - &win, - &apple ); - if ( !found ) + &dummy1, + &dummy2 ); + if ( found ) + strid = TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY; + else + { found = sfnt->get_name_id( face, TT_NAME_ID_FONT_SUBFAMILY, - &win, - &apple ); + &dummy1, + &dummy2 ); + if ( found ) + strid = TT_NAME_ID_FONT_SUBFAMILY; + } if ( found ) { - FT_Int strid = win >= 0 ? win : apple; - - found = sfnt->get_name_id( face, TT_NAME_ID_PS_NAME, - &win, - &apple ); + &dummy1, + &dummy2 ); if ( found ) { - FT_Int psid = win >= 0 ? win : apple; - - FT_TRACE5(( "TT_Get_MM_Var:" " Adding default instance to named instances\n" )); ns = &mmvar->namedstyle[fvar_head.instanceCount]; ns->strid = strid; - ns->psid = psid; + ns->psid = TT_NAME_ID_PS_NAME; a = mmvar->axis; c = ns->coords; - for ( j = 0; j < fvar_head.axisCount; j++, a++, c++ ) + for ( j = 0; j < num_axes; j++, a++, c++ ) *c = a->def; } } @@ -2218,22 +2356,25 @@ goto Exit; FT_MEM_COPY( mmvar, face->blend->mmvar, face->blend->mmvar_len ); + axis_flags = + (FT_UShort*)( (char*)mmvar + mmvar_size ); mmvar->axis = - (FT_Var_Axis*)&( mmvar[1] ); + (FT_Var_Axis*)( (char*)axis_flags + axis_flags_size ); mmvar->namedstyle = - (FT_Var_Named_Style*)&( mmvar->axis[mmvar->num_axis] ); - next_coords = - (FT_Fixed*)&( mmvar->namedstyle[mmvar->num_namedstyles] ); + (FT_Var_Named_Style*)( (char*)mmvar->axis+ axis_size ); + next_coords = (FT_Fixed*)( (char*)mmvar->namedstyle + + namedstyle_size ); for ( n = 0; n < mmvar->num_namedstyles; n++ ) { mmvar->namedstyle[n].coords = next_coords; - next_coords += mmvar->num_axis; + next_coords += num_axes; } a = mmvar->axis; - next_name = (FT_String*)next_coords; - for ( n = 0; n < mmvar->num_axis; n++ ) + next_name = (FT_String*)( (char*)mmvar->namedstyle + + namedstyle_size + next_coords_size ); + for ( n = 0; n < num_axes; n++ ) { a->name = next_name; @@ -2259,41 +2400,19 @@ } - /*************************************************************************/ - /* */ - /* */ - /* TT_Set_MM_Blend */ - /* */ - /* */ - /* Set the blend (normalized) coordinates for this instance of the */ - /* font. Check that the `gvar' table is reasonable and does some */ - /* initial preparation. */ - /* */ - /* */ - /* face :: The font. */ - /* Initialize the blend structure with `gvar' data. */ - /* */ - /* */ - /* num_coords :: The number of available coordinates. If it is */ - /* larger than the number of axes, ignore the excess */ - /* values. If it is smaller than the number of axes, */ - /* use the default value (0) for the remaining axes. */ - /* */ - /* coords :: An array of `num_coords', each between [-1,1]. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - FT_LOCAL_DEF( FT_Error ) - TT_Set_MM_Blend( TT_Face face, + static FT_Error + tt_set_mm_blend( TT_Face face, FT_UInt num_coords, - FT_Fixed* coords ) + FT_Fixed* coords, + FT_Bool set_design_coords ) { FT_Error error = FT_Err_Ok; GX_Blend blend; FT_MM_Var* mmvar; - FT_UInt i, j; - FT_Bool is_default_instance = 1; + FT_UInt i; + + FT_Bool all_design_coords = FALSE; + FT_Memory memory = face->root.memory; enum @@ -2318,16 +2437,18 @@ if ( num_coords > mmvar->num_axis ) { - FT_TRACE2(( "TT_Set_MM_Blend: only using first %d of %d coordinates\n", + FT_TRACE2(( "TT_Set_MM_Blend:" + " only using first %d of %d coordinates\n", mmvar->num_axis, num_coords )); num_coords = mmvar->num_axis; } - FT_TRACE5(( "normalized design coordinates:\n" )); + FT_TRACE5(( "TT_Set_MM_Blend:\n" + " normalized design coordinates:\n" )); for ( i = 0; i < num_coords; i++ ) { - FT_TRACE5(( " %.5f\n", coords[i] / 65536.0 )); + FT_TRACE5(( " %.5f\n", coords[i] / 65536.0 )); if ( coords[i] < -0x00010000L || coords[i] > 0x00010000L ) { FT_TRACE1(( "TT_Set_MM_Blend: normalized design coordinate %.5f\n" @@ -2336,9 +2457,6 @@ error = FT_THROW( Invalid_Argument ); goto Exit; } - - if ( coords[i] != 0 ) - is_default_instance = 0; } FT_TRACE5(( "\n" )); @@ -2347,6 +2465,15 @@ if ( FT_SET_ERROR( ft_var_load_gvar( face ) ) ) goto Exit; + if ( !blend->coords ) + { + if ( FT_NEW_ARRAY( blend->coords, mmvar->num_axis ) ) + goto Exit; + + /* the first time we have to compute all design coordinates */ + all_design_coords = TRUE; + } + if ( !blend->normalizedcoords ) { if ( FT_NEW_ARRAY( blend->normalizedcoords, mmvar->num_axis ) ) @@ -2360,6 +2487,12 @@ } else { + FT_Bool have_diff = 0; + FT_UInt j; + FT_Fixed* c; + FT_Fixed* n; + + manageCvt = mcvt_retain; for ( i = 0; i < num_coords; i++ ) @@ -2367,10 +2500,34 @@ if ( blend->normalizedcoords[i] != coords[i] ) { manageCvt = mcvt_load; + have_diff = 1; break; } } + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ) + { + FT_UInt idx = (FT_UInt)face->root.face_index >> 16; + + + c = blend->normalizedcoords + i; + n = blend->normalized_stylecoords + idx * mmvar->num_axis + i; + for ( j = i; j < mmvar->num_axis; j++, n++, c++ ) + if ( *c != *n ) + have_diff = 1; + } + else + { + c = blend->normalizedcoords + i; + for ( j = i; j < mmvar->num_axis; j++, c++ ) + if ( *c != 0 ) + have_diff = 1; + } + + /* return value -1 indicates `no change' */ + if ( !have_diff ) + return -1; + for ( ; i < mmvar->num_axis; i++ ) { if ( blend->normalizedcoords[i] != 0 ) @@ -2391,6 +2548,12 @@ coords, num_coords * sizeof ( FT_Fixed ) ); + if ( set_design_coords ) + ft_var_to_design( face, + all_design_coords ? blend->num_axis : num_coords, + blend->normalizedcoords, + blend->coords ); + face->doblend = TRUE; if ( face->cvt ) @@ -2418,34 +2581,58 @@ } } - /* check whether the current variation tuple coincides */ - /* with a named instance */ + /* enforce recomputation of the PostScript name; */ + FT_FREE( face->postscript_name ); + face->postscript_name = NULL; - for ( i = 0; i < blend->mmvar->num_namedstyles; i++ ) - { - FT_Fixed* nsc = blend->normalized_stylecoords + i * blend->num_axis; - FT_Fixed* ns = blend->normalizedcoords; + Exit: + return error; + } - for ( j = 0; j < blend->num_axis; j++, nsc++, ns++ ) - { - if ( *nsc != *ns ) - break; - } + /*************************************************************************/ + /* */ + /* */ + /* TT_Set_MM_Blend */ + /* */ + /* */ + /* Set the blend (normalized) coordinates for this instance of the */ + /* font. Check that the `gvar' table is reasonable and does some */ + /* initial preparation. */ + /* */ + /* */ + /* face :: The font. */ + /* Initialize the blend structure with `gvar' data. */ + /* */ + /* */ + /* num_coords :: The number of available coordinates. If it is */ + /* larger than the number of axes, ignore the excess */ + /* values. If it is smaller than the number of axes, */ + /* use the default value (0) for the remaining axes. */ + /* */ + /* coords :: An array of `num_coords', each between [-1,1]. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + TT_Set_MM_Blend( TT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ) + { + FT_Error error; - if ( j == blend->num_axis ) - break; - } - /* adjust named instance index */ - face->root.face_index &= 0xFFFF; - if ( i < blend->mmvar->num_namedstyles ) - face->root.face_index |= ( i + 1 ) << 16; + error = tt_set_mm_blend( face, num_coords, coords, 1 ); + if ( error ) + return error; - face->is_default_instance = is_default_instance; + if ( num_coords ) + face->root.face_flags |= FT_FACE_FLAG_VARIATION; + else + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; - Exit: - return error; + return FT_Err_Ok; } @@ -2490,10 +2677,19 @@ blend = face->blend; + if ( !blend->coords ) + { + /* select default instance coordinates */ + /* if no instance is selected yet */ + if ( FT_SET_ERROR( tt_set_mm_blend( face, 0, NULL, 1 ) ) ) + return error; + } + nc = num_coords; if ( num_coords > blend->num_axis ) { - FT_TRACE2(( "TT_Get_MM_Blend: only using first %d of %d coordinates\n", + FT_TRACE2(( "TT_Get_MM_Blend:" + " only using first %d of %d coordinates\n", blend->num_axis, num_coords )); nc = blend->num_axis; } @@ -2546,11 +2742,17 @@ FT_UInt num_coords, FT_Fixed* coords ) { - FT_Error error = FT_Err_Ok; - FT_Memory memory = face->root.memory; + FT_Error error = FT_Err_Ok; + GX_Blend blend; + FT_MM_Var* mmvar; + FT_UInt i; + FT_Memory memory = face->root.memory; + FT_Fixed* c; + FT_Fixed* n; FT_Fixed* normalized = NULL; - FT_UInt num_axes; + + FT_Bool have_diff = 0; if ( !face->blend ) @@ -2559,17 +2761,92 @@ goto Exit; } - num_axes = face->blend->mmvar->num_axis; + blend = face->blend; + mmvar = blend->mmvar; - if ( FT_NEW_ARRAY( normalized, num_axes ) ) + if ( num_coords > mmvar->num_axis ) + { + FT_TRACE2(( "TT_Set_Var_Design:" + " only using first %d of %d coordinates\n", + mmvar->num_axis, num_coords )); + num_coords = mmvar->num_axis; + } + + if ( !blend->coords ) + { + if ( FT_NEW_ARRAY( blend->coords, mmvar->num_axis ) ) + goto Exit; + } + + c = blend->coords; + n = coords; + for ( i = 0; i < num_coords; i++, n++, c++ ) + { + if ( *c != *n ) + { + *c = *n; + have_diff = 1; + } + } + + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ) + { + FT_UInt instance_index; + FT_Var_Named_Style* named_style; + + + instance_index = (FT_UInt)face->root.face_index >> 16; + named_style = mmvar->namedstyle + instance_index - 1; + + n = named_style->coords + num_coords; + for ( ; i < mmvar->num_axis; i++, n++, c++ ) + { + if ( *c != *n ) + { + *c = *n; + have_diff = 1; + } + } + } + else + { + FT_Var_Axis* a; + + + a = mmvar->axis + num_coords; + for ( ; i < mmvar->num_axis; i++, a++, c++ ) + { + if ( *c != a->def ) + { + *c = a->def; + have_diff = 1; + } + } + } + + /* return value -1 indicates `no change'; */ + /* we can exit early if `normalizedcoords' is already computed */ + if ( blend->normalizedcoords && !have_diff ) + return -1; + + if ( FT_NEW_ARRAY( normalized, mmvar->num_axis ) ) goto Exit; - if ( !face->blend->avar_checked ) + if ( !face->blend->avar_loaded ) ft_var_load_avar( face ); - ft_var_to_normalized( face, num_coords, coords, normalized ); + FT_TRACE5(( "TT_Set_Var_Design:\n" + " normalized design coordinates:\n" )); + ft_var_to_normalized( face, num_coords, blend->coords, normalized ); - error = TT_Set_MM_Blend( face, num_axes, normalized ); + error = tt_set_mm_blend( face, mmvar->num_axis, normalized, 0 ); + if ( error ) + goto Exit; + + if ( num_coords ) + face->root.face_flags |= FT_FACE_FLAG_VARIATION; + else + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; Exit: FT_FREE( normalized ); @@ -2605,6 +2882,8 @@ FT_Fixed* coords ) { FT_Error error = FT_Err_Ok; + GX_Blend blend; + FT_UInt i, nc; if ( !face->blend ) @@ -2613,18 +2892,127 @@ return error; } - if ( !face->blend->avar_checked ) - ft_var_load_avar( face ); + blend = face->blend; - ft_var_to_design( face, - num_coords, - face->blend->normalizedcoords, - coords ); + if ( !blend->coords ) + { + /* select default instance coordinates */ + /* if no instance is selected yet */ + if ( FT_SET_ERROR( tt_set_mm_blend( face, 0, NULL, 1 ) ) ) + return error; + } + + nc = num_coords; + if ( num_coords > blend->num_axis ) + { + FT_TRACE2(( "TT_Get_Var_Design:" + " only using first %d of %d coordinates\n", + blend->num_axis, num_coords )); + nc = blend->num_axis; + } + + if ( face->doblend ) + { + for ( i = 0; i < nc; i++ ) + coords[i] = blend->coords[i]; + } + else + { + for ( i = 0; i < nc; i++ ) + coords[i] = 0; + } + + for ( ; i < num_coords; i++ ) + coords[i] = 0; return FT_Err_Ok; } + /*************************************************************************/ + /* */ + /* */ + /* TT_Set_Named_Instance */ + /* */ + /* */ + /* Set the given named instance, also resetting any further */ + /* variation. */ + /* */ + /* */ + /* face :: A handle to the source face. */ + /* */ + /* instance_index :: The instance index, starting with value 1. */ + /* Value 0 indicates to not use an instance. */ + /* */ + /* */ + /* FreeType error code. 0~means success. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + TT_Set_Named_Instance( TT_Face face, + FT_UInt instance_index ) + { + FT_Error error = FT_ERR( Invalid_Argument ); + GX_Blend blend; + FT_MM_Var* mmvar; + + FT_UInt num_instances; + + + if ( !face->blend ) + { + if ( FT_SET_ERROR( TT_Get_MM_Var( face, NULL ) ) ) + goto Exit; + } + + blend = face->blend; + mmvar = blend->mmvar; + + num_instances = (FT_UInt)face->root.style_flags >> 16; + + /* `instance_index' starts with value 1, thus `>' */ + if ( instance_index > num_instances ) + goto Exit; + + if ( instance_index > 0 && mmvar->namedstyle ) + { + FT_Memory memory = face->root.memory; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; + + FT_Var_Named_Style* named_style; + FT_String* style_name; + + + named_style = mmvar->namedstyle + instance_index - 1; + + error = sfnt->get_name( face, + (FT_UShort)named_style->strid, + &style_name ); + if ( error ) + goto Exit; + + /* set (or replace) style name */ + FT_FREE( face->root.style_name ); + face->root.style_name = style_name; + + /* finally, select the named instance */ + error = TT_Set_Var_Design( face, + mmvar->num_axis, + named_style->coords ); + if ( error ) + goto Exit; + } + else + error = TT_Set_Var_Design( face, 0, NULL ); + + face->root.face_index = ( instance_index << 16 ) | + ( face->root.face_index & 0xFFFFL ); + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; + + Exit: + return error; + } + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -2671,8 +3059,10 @@ FT_Fixed* im_start_coords = NULL; FT_Fixed* im_end_coords = NULL; GX_Blend blend = face->blend; - FT_UInt point_count; - FT_UShort* localpoints; + FT_UInt point_count, spoint_count = 0; + FT_UShort* sharedpoints = NULL; + FT_UShort* localpoints = NULL; + FT_UShort* points; FT_Short* deltas; @@ -2741,11 +3131,24 @@ offsetToData += table_start; - /* The documentation implies there are flags packed into */ - /* `tupleCount', but John Jenkins says that shared points don't apply */ - /* to `cvar', and no other flags are defined. */ + if ( tupleCount & GX_TC_TUPLES_SHARE_POINT_NUMBERS ) + { + here = FT_Stream_FTell( stream ); + + FT_Stream_SeekSet( stream, offsetToData ); + + sharedpoints = ft_var_readpackedpoints( stream, + table_len, + &spoint_count ); + offsetToData = FT_Stream_FTell( stream ); + + FT_Stream_SeekSet( stream, here ); + } - FT_TRACE5(( "cvar: there are %d tuples:\n", tupleCount & 0xFFF )); + FT_TRACE5(( "cvar: there %s %d tuple%s:\n", + ( tupleCount & 0xFFF ) == 1 ? "is" : "are", + tupleCount & 0xFFF, + ( tupleCount & 0xFFF ) == 1 ? "" : "s" )); for ( i = 0; i < ( tupleCount & 0xFFF ); i++ ) { @@ -2759,26 +3162,25 @@ tupleDataSize = FT_GET_USHORT(); tupleIndex = FT_GET_USHORT(); - /* There is no provision here for a global tuple coordinate section, */ - /* so John says. There are no tuple indices, just embedded tuples. */ - if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD ) { for ( j = 0; j < blend->num_axis; j++ ) tuple_coords[j] = FT_GET_SHORT() * 4; /* convert from */ /* short frac to fixed */ } - else + else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount ) { - /* skip this tuple; it makes no sense */ - - if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) - for ( j = 0; j < 2 * blend->num_axis; j++ ) - (void)FT_GET_SHORT(); + FT_TRACE2(( "tt_face_vary_cvt:" + " invalid tuple index\n" )); - offsetToData += tupleDataSize; - continue; + error = FT_THROW( Invalid_Table ); + goto Exit; } + else + FT_MEM_COPY( + tuple_coords, + &blend->tuplecoords[( tupleIndex & 0xFFF ) * blend->num_axis], + blend->num_axis * sizeof ( FT_Fixed ) ); if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) { @@ -2793,11 +3195,8 @@ tuple_coords, im_start_coords, im_end_coords ); - if ( /* tuple isn't active for our blend */ - apply == 0 || - /* global points not allowed, */ - /* if they aren't local, makes no sense */ - !( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS ) ) + + if ( apply == 0 ) /* tuple isn't active for our blend */ { offsetToData += tupleDataSize; continue; @@ -2807,14 +3206,27 @@ FT_Stream_SeekSet( stream, offsetToData ); - localpoints = ft_var_readpackedpoints( stream, - table_len, - &point_count ); - deltas = ft_var_readpackeddeltas( stream, - table_len, - point_count == 0 ? face->cvt_size - : point_count ); - if ( !localpoints || !deltas ) + if ( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS ) + { + localpoints = ft_var_readpackedpoints( stream, + table_len, + &point_count ); + points = localpoints; + } + else + { + points = sharedpoints; + point_count = spoint_count; + } + + deltas = ft_var_readpackeddeltas( stream, + table_len, + point_count == 0 ? face->cvt_size + : point_count ); + + if ( !points || + !deltas || + ( localpoints == ALL_POINTS && point_count != face->cvt_size ) ) ; /* failure, ignore it */ else if ( localpoints == ALL_POINTS ) @@ -2866,7 +3278,7 @@ FT_Long orig_cvt; - pindex = localpoints[j]; + pindex = points[j]; if ( (FT_ULong)pindex >= face->cvt_size ) continue; @@ -2905,6 +3317,8 @@ FT_FRAME_EXIT(); Exit: + if ( sharedpoints != ALL_POINTS ) + FT_FREE( sharedpoints ); FT_FREE( tuple_coords ); FT_FREE( im_start_coords ); FT_FREE( im_end_coords ); @@ -2993,25 +3407,12 @@ d1 = out1 - in1; d2 = out2 - in2; - if ( out1 == out2 || in1 == in2 ) - { - for ( p = p1; p <= p2; p++ ) - { - out = in_points[p].x; - - if ( out <= in1 ) - out += d1; - else if ( out >= in2 ) - out += d2; - else - out = out1; - - out_points[p].x = out; - } - } - else + /* If the reference points have the same coordinate but different */ + /* delta, inferred delta is zero. Otherwise interpolate. */ + if ( in1 != in2 || out1 == out2 ) { - FT_Fixed scale = FT_DivFix( out2 - out1, in2 - in1 ); + FT_Fixed scale = in1 != in2 ? FT_DivFix( out2 - out1, in2 - in1 ) + : 0; for ( p = p1; p <= p2; p++ ) @@ -3204,7 +3605,6 @@ glyph_start = FT_Stream_FTell( stream ); /* each set of glyph variation data is formatted similarly to `cvar' */ - /* (except we get shared points and global tuples) */ if ( FT_NEW_ARRAY( tuple_coords, blend->num_axis ) || FT_NEW_ARRAY( im_start_coords, blend->num_axis ) || @@ -3241,8 +3641,10 @@ FT_Stream_SeekSet( stream, here ); } - FT_TRACE5(( "gvar: there are %d tuples:\n", - tupleCount & GX_TC_TUPLE_COUNT_MASK )); + FT_TRACE5(( "gvar: there %s %d tuple%s:\n", + ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "is" : "are", + tupleCount & GX_TC_TUPLE_COUNT_MASK, + ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "" : "s" )); for ( j = 0; j < n_points; j++ ) points_org[j] = outline->points[j]; @@ -3344,7 +3746,7 @@ FT_Pos delta_y = FT_MulFix( deltas_y[j], apply ); - if ( j < n_points - 3 ) + if ( j < n_points - 4 ) { outline->points[j].x += delta_x; outline->points[j].y += delta_y; @@ -3354,25 +3756,25 @@ /* To avoid double adjustment of advance width or height, */ /* adjust phantom points only if there is no HVAR or VVAR */ /* support, respectively. */ - if ( j == ( n_points - 3 ) && - !( face->variation_support & - TT_FACE_FLAG_VAR_HADVANCE ) ) + if ( j == ( n_points - 4 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_LSB ) ) + outline->points[j].x += delta_x; + + else if ( j == ( n_points - 3 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_HADVANCE ) ) outline->points[j].x += delta_x; else if ( j == ( n_points - 2 ) && !( face->variation_support & - TT_FACE_FLAG_VAR_LSB ) ) - outline->points[j].x += delta_x; + TT_FACE_FLAG_VAR_TSB ) ) + outline->points[j].y += delta_y; else if ( j == ( n_points - 1 ) && !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) outline->points[j].y += delta_y; - - else if ( j == ( n_points - 0 ) && - !( face->variation_support & - TT_FACE_FLAG_VAR_TSB ) ) - outline->points[j].y += delta_y; } #ifdef FT_DEBUG_LEVEL_TRACE @@ -3439,8 +3841,36 @@ FT_Pos delta_y = points_out[j].y - points_org[j].y; - outline->points[j].x += delta_x; - outline->points[j].y += delta_y; + if ( j < n_points - 4 ) + { + outline->points[j].x += delta_x; + outline->points[j].y += delta_y; + } + else + { + /* To avoid double adjustment of advance width or height, */ + /* adjust phantom points only if there is no HVAR or VVAR */ + /* support, respectively. */ + if ( j == ( n_points - 4 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_LSB ) ) + outline->points[j].x += delta_x; + + else if ( j == ( n_points - 3 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_HADVANCE ) ) + outline->points[j].x += delta_x; + + else if ( j == ( n_points - 2 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_TSB ) ) + outline->points[j].y += delta_y; + + else if ( j == ( n_points - 1 ) && + !( face->variation_support & + TT_FACE_FLAG_VAR_VADVANCE ) ) + outline->points[j].y += delta_y; + } #ifdef FT_DEBUG_LEVEL_TRACE if ( delta_x || delta_y ) @@ -3506,16 +3936,19 @@ tt_get_var_blend( TT_Face face, FT_UInt *num_coords, FT_Fixed* *coords, + FT_Fixed* *normalizedcoords, FT_MM_Var* *mm_var ) { if ( face->blend ) { if ( num_coords ) - *num_coords = face->blend->num_axis; + *num_coords = face->blend->num_axis; if ( coords ) - *coords = face->blend->normalizedcoords; + *coords = face->blend->coords; + if ( normalizedcoords ) + *normalizedcoords = face->blend->normalizedcoords; if ( mm_var ) - *mm_var = face->blend->mmvar; + *mm_var = face->blend->mmvar; } else { @@ -3583,6 +4016,7 @@ /* blend->num_axis might not be set up yet */ num_axes = blend->mmvar->num_axis; + FT_FREE( blend->coords ); FT_FREE( blend->normalizedcoords ); FT_FREE( blend->normalized_stylecoords ); FT_FREE( blend->mmvar ); @@ -3604,6 +4038,16 @@ FT_FREE( blend->hvar_table ); } + if ( blend->vvar_table ) + { + ft_var_done_item_variation_store( face, + &blend->vvar_table->itemStore ); + + FT_FREE( blend->vvar_table->widthMap.innerIndex ); + FT_FREE( blend->vvar_table->widthMap.outerIndex ); + FT_FREE( blend->vvar_table ); + } + if ( blend->mvar_table ) { ft_var_done_item_variation_store( face, @@ -3619,7 +4063,12 @@ } } -#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ +#else /* !TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + + /* ANSI C doesn't like empty source files */ + typedef int _tt_gxvar_dummy; + +#endif /* !TT_CONFIG_OPTION_GX_VAR_SUPPORT */ /* END */ diff --git a/src/truetype/ttgxvar.h b/src/truetype/ttgxvar.h index c59d52809..a37bb9026 100644 --- a/src/truetype/ttgxvar.h +++ b/src/truetype/ttgxvar.h @@ -4,7 +4,7 @@ /* */ /* TrueType GX Font Variation loader (specification) */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, Werner Lemberg and George Williams. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,6 +27,8 @@ FT_BEGIN_HEADER +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /*************************************************************************/ /* */ /* */ @@ -214,19 +216,92 @@ FT_BEGIN_HEADER /* */ /* */ /* Data for interpolating a font from a distortable font specified */ - /* by the GX *var tables ([fgca]var). */ + /* by the GX *var tables ([fgcahvm]var). */ /* */ /* */ - /* num_axis :: The number of axes along which interpolation */ - /* may happen */ + /* num_axis :: */ + /* The number of axes along which interpolation may happen. */ + /* */ + /* coords :: */ + /* An array of design coordinates (in user space) indicating the */ + /* contribution along each axis to the final interpolated font. */ + /* `normalizedcoords' holds the same values. */ + /* */ + /* normalizedcoords :: */ + /* An array of normalized values (between [-1,1]) indicating the */ + /* contribution along each axis to the final interpolated font. */ + /* `coords' holds the same values. */ + /* */ + /* mmvar :: */ + /* Data from the `fvar' table. */ + /* */ + /* mmvar_len :: */ + /* The length of the `mmvar' structure. */ + /* */ + /* normalized_stylecoords :: */ + /* A two-dimensional array that holds the named instance data from */ + /* `mmvar' as normalized values. */ + /* */ + /* avar_loaded :: */ + /* A Boolean; if set, FreeType tried to load (and parse) the `avar' */ + /* table. */ + /* */ + /* avar_segment :: */ + /* Data from the `avar' table. */ + /* */ + /* hvar_loaded :: */ + /* A Boolean; if set, FreeType tried to load (and parse) the `hvar' */ + /* table. */ + /* */ + /* hvar_checked :: */ + /* A Boolean; if set, FreeType successfully loaded and parsed the */ + /* `hvar' table. */ + /* */ + /* hvar_error :: */ + /* If loading and parsing of the `hvar' table failed, this field */ + /* holds the corresponding error code. */ + /* */ + /* hvar_table :: */ + /* Data from the `hvar' table. */ /* */ - /* normalizedcoords :: A normalized value (between [-1,1]) indicating */ - /* the contribution along each axis to the final */ - /* interpolated font. */ + /* vvar_loaded :: */ + /* A Boolean; if set, FreeType tried to load (and parse) the `vvar' */ + /* table. */ + /* */ + /* vvar_checked :: */ + /* A Boolean; if set, FreeType successfully loaded and parsed the */ + /* `vvar' table. */ + /* */ + /* vvar_error :: */ + /* If loading and parsing of the `vvar' table failed, this field */ + /* holds the corresponding error code. */ + /* */ + /* vvar_table :: */ + /* Data from the `vvar' table. */ + /* */ + /* mvar_table :: */ + /* Data from the `mvar' table. */ + /* */ + /* tuplecount :: */ + /* The number of shared tuples in the `gvar' table. */ + /* */ + /* tuplecoords :: */ + /* A two-dimensional array that holds the shared tuple coordinates */ + /* in the `gvar' table. */ + /* */ + /* gv_glyphcnt :: */ + /* The number of glyphs handled in the `gvar' table. */ + /* */ + /* glyphoffsets :: */ + /* Offsets into the glyph variation data array. */ + /* */ + /* gvar_size :: */ + /* The size of the `gvar' table. */ /* */ typedef struct GX_BlendRec_ { FT_UInt num_axis; + FT_Fixed* coords; FT_Fixed* normalizedcoords; FT_MM_Var* mmvar; @@ -235,8 +310,8 @@ FT_BEGIN_HEADER FT_Fixed* normalized_stylecoords; /* normalized_stylecoords[num_namedstyles][num_axis] */ - FT_Bool avar_checked; - GX_AVarSegment avar_segment; + FT_Bool avar_loaded; + GX_AVarSegment avar_segment; /* avar_segment[num_axis] */ FT_Bool hvar_loaded; FT_Bool hvar_checked; @@ -250,11 +325,11 @@ FT_BEGIN_HEADER GX_MVarTable mvar_table; - FT_UInt tuplecount; /* shared tuples in `gvar' */ - FT_Fixed* tuplecoords; /* tuplecoords[tuplecount][num_axis] */ + FT_UInt tuplecount; + FT_Fixed* tuplecoords; /* tuplecoords[tuplecount][num_axis] */ FT_UInt gv_glyphcnt; - FT_ULong* glyphoffsets; + FT_ULong* glyphoffsets; /* glyphoffsets[gv_glyphcnt + 1] */ FT_ULong gvar_size; @@ -328,6 +403,10 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Fixed* coords ); + FT_LOCAL( FT_Error ) + TT_Set_Named_Instance( TT_Face face, + FT_UInt instance_index ); + FT_LOCAL( FT_Error ) tt_face_vary_cvt( TT_Face face, FT_Stream stream ); @@ -356,11 +435,14 @@ FT_BEGIN_HEADER tt_get_var_blend( TT_Face face, FT_UInt *num_coords, FT_Fixed* *coords, + FT_Fixed* *normalizedcoords, FT_MM_Var* *mm_var ); FT_LOCAL( void ) tt_done_blend( TT_Face face ); +#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + FT_END_HEADER diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 7179ffd77..da9b595ab 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -4,7 +4,7 @@ /* */ /* TrueType bytecode interpreter (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,7 +25,7 @@ #include FT_INTERNAL_CALC_H #include FT_TRIGONOMETRY_H #include FT_SYSTEM_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include FT_MULTIPLE_MASTERS_H #include "ttinterp.h" @@ -65,11 +65,15 @@ TT_INTERPRETER_VERSION_40 ) #endif -#define PROJECT( v1, v2 ) \ - exc->func_project( exc, (v1)->x - (v2)->x, (v1)->y - (v2)->y ) +#define PROJECT( v1, v2 ) \ + exc->func_project( exc, \ + SUB_LONG( (v1)->x, (v2)->x ), \ + SUB_LONG( (v1)->y, (v2)->y ) ) -#define DUALPROJ( v1, v2 ) \ - exc->func_dualproj( exc, (v1)->x - (v2)->x, (v1)->y - (v2)->y ) +#define DUALPROJ( v1, v2 ) \ + exc->func_dualproj( exc, \ + SUB_LONG( (v1)->x, (v2)->x ), \ + SUB_LONG( (v1)->y, (v2)->y ) ) #define FAST_PROJECT( v ) \ exc->func_project( exc, (v)->x, (v)->y ) @@ -402,7 +406,7 @@ exec->IDefs = size->instruction_defs; exec->pointSize = size->point_size; exec->tt_metrics = size->ttmetrics; - exec->metrics = size->metrics; + exec->metrics = *size->metrics; exec->maxFunc = size->max_func; exec->maxIns = size->max_ins; @@ -1656,7 +1660,7 @@ /* zone :: The affected glyph zone. */ /* */ /* */ - /* See `ttinterp.h' for details on backwards compatibility mode. */ + /* See `ttinterp.h' for details on backward compatibility mode. */ /* `Touches' the point. */ /* */ static void @@ -1676,7 +1680,10 @@ if ( SUBPIXEL_HINTING_INFINALITY && ( !exc->ignore_x_mode || ( exc->sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVE ) ) ) - zone->cur[point].x += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->cur[point].x = ADD_LONG( zone->cur[point].x, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); else #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ @@ -1684,13 +1691,19 @@ /* Exception to the post-IUP curfew: Allow the x component of */ /* diagonal moves, but only post-IUP. DejaVu tries to adjust */ /* diagonal stems like on `Z' and `z' post-IUP. */ - if ( SUBPIXEL_HINTING_MINIMAL && !exc->backwards_compatibility ) - zone->cur[point].x += FT_MulDiv( distance, v, exc->F_dot_P ); + if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility ) + zone->cur[point].x = ADD_LONG( zone->cur[point].x, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); else #endif if ( NO_SUBPIXEL_HINTING ) - zone->cur[point].x += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->cur[point].x = ADD_LONG( zone->cur[point].x, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; } @@ -1700,12 +1713,15 @@ if ( v != 0 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( !( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility && - exc->iupx_called && - exc->iupy_called ) ) + if ( !( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility && + exc->iupx_called && + exc->iupy_called ) ) #endif - zone->cur[point].y += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->cur[point].y = ADD_LONG( zone->cur[point].y, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y; } @@ -1741,12 +1757,18 @@ v = exc->GS.freeVector.x; if ( v != 0 ) - zone->org[point].x += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->org[point].x = ADD_LONG( zone->org[point].x, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); v = exc->GS.freeVector.y; if ( v != 0 ) - zone->org[point].y += FT_MulDiv( distance, v, exc->F_dot_P ); + zone->org[point].y = ADD_LONG( zone->org[point].y, + FT_MulDiv( distance, + v, + exc->F_dot_P ) ); } @@ -1756,7 +1778,7 @@ /* */ /* The following versions are used whenever both vectors are both */ /* along one of the coordinate unit vectors, i.e. in 90% of the cases. */ - /* See `ttinterp.h' for details on backwards compatibility mode. */ + /* See `ttinterp.h' for details on backward compatibility mode. */ /* */ /*************************************************************************/ @@ -1769,18 +1791,18 @@ { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && !exc->ignore_x_mode ) - zone->cur[point].x += distance; + zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance ); else #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( SUBPIXEL_HINTING_MINIMAL && !exc->backwards_compatibility ) - zone->cur[point].x += distance; + if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility ) + zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance ); else #endif if ( NO_SUBPIXEL_HINTING ) - zone->cur[point].x += distance; + zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; } @@ -1796,10 +1818,10 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL if ( !( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility && + exc->backward_compatibility && exc->iupx_called && exc->iupy_called ) ) #endif - zone->cur[point].y += distance; + zone->cur[point].y = ADD_LONG( zone->cur[point].y, distance ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y; } @@ -1823,7 +1845,7 @@ { FT_UNUSED( exc ); - zone->org[point].x += distance; + zone->org[point].x = ADD_LONG( zone->org[point].x, distance ); } @@ -1835,7 +1857,7 @@ { FT_UNUSED( exc ); - zone->org[point].y += distance; + zone->org[point].y = ADD_LONG( zone->org[point].y, distance ); } @@ -1873,13 +1895,13 @@ if ( distance >= 0 ) { - val = distance + compensation; + val = ADD_LONG( distance, compensation ); if ( val < 0 ) val = 0; } else { - val = distance - compensation; + val = SUB_LONG( distance, compensation ); if ( val > 0 ) val = 0; } @@ -1915,13 +1937,14 @@ if ( distance >= 0 ) { - val = FT_PIX_ROUND( distance + compensation ); + val = FT_PIX_ROUND_LONG( ADD_LONG( distance, compensation ) ); if ( val < 0 ) val = 0; } else { - val = -FT_PIX_ROUND( compensation - distance ); + val = NEG_LONG( FT_PIX_ROUND_LONG( SUB_LONG( compensation, + distance ) ) ); if ( val > 0 ) val = 0; } @@ -1958,13 +1981,16 @@ if ( distance >= 0 ) { - val = FT_PIX_FLOOR( distance + compensation ) + 32; + val = ADD_LONG( FT_PIX_FLOOR( ADD_LONG( distance, compensation ) ), + 32 ); if ( val < 0 ) val = 32; } else { - val = -( FT_PIX_FLOOR( compensation - distance ) + 32 ); + val = NEG_LONG( ADD_LONG( FT_PIX_FLOOR( SUB_LONG( compensation, + distance ) ), + 32 ) ); if ( val > 0 ) val = -32; } @@ -2001,13 +2027,13 @@ if ( distance >= 0 ) { - val = FT_PIX_FLOOR( distance + compensation ); + val = FT_PIX_FLOOR( ADD_LONG( distance, compensation ) ); if ( val < 0 ) val = 0; } else { - val = -FT_PIX_FLOOR( compensation - distance ); + val = NEG_LONG( FT_PIX_FLOOR( SUB_LONG( compensation, distance ) ) ); if ( val > 0 ) val = 0; } @@ -2044,13 +2070,14 @@ if ( distance >= 0 ) { - val = FT_PIX_CEIL( distance + compensation ); + val = FT_PIX_CEIL_LONG( ADD_LONG( distance, compensation ) ); if ( val < 0 ) val = 0; } else { - val = -FT_PIX_CEIL( compensation - distance ); + val = NEG_LONG( FT_PIX_CEIL_LONG( SUB_LONG( compensation, + distance ) ) ); if ( val > 0 ) val = 0; } @@ -2087,13 +2114,14 @@ if ( distance >= 0 ) { - val = FT_PAD_ROUND( distance + compensation, 32 ); + val = FT_PAD_ROUND_LONG( ADD_LONG( distance, compensation ), 32 ); if ( val < 0 ) val = 0; } else { - val = -FT_PAD_ROUND( compensation - distance, 32 ); + val = NEG_LONG( FT_PAD_ROUND_LONG( SUB_LONG( compensation, distance ), + 32 ) ); if ( val > 0 ) val = 0; } @@ -2134,17 +2162,19 @@ if ( distance >= 0 ) { - val = ( distance - exc->phase + exc->threshold + compensation ) & + val = ADD_LONG( distance, + exc->threshold - exc->phase + compensation ) & -exc->period; - val += exc->phase; + val = ADD_LONG( val, exc->phase ); if ( val < 0 ) val = exc->phase; } else { - val = -( ( exc->threshold - exc->phase - distance + compensation ) & - -exc->period ); - val -= exc->phase; + val = NEG_LONG( SUB_LONG( exc->threshold - exc->phase + compensation, + distance ) & + -exc->period ); + val = SUB_LONG( val, exc->phase ); if ( val > 0 ) val = -exc->phase; } @@ -2183,17 +2213,19 @@ if ( distance >= 0 ) { - val = ( ( distance - exc->phase + exc->threshold + compensation ) / + val = ( ADD_LONG( distance, + exc->threshold - exc->phase + compensation ) / exc->period ) * exc->period; - val += exc->phase; + val = ADD_LONG( val, exc->phase ); if ( val < 0 ) val = exc->phase; } else { - val = -( ( ( exc->threshold - exc->phase - distance + compensation ) / - exc->period ) * exc->period ); - val -= exc->phase; + val = NEG_LONG( ( SUB_LONG( exc->threshold - exc->phase + compensation, + distance ) / + exc->period ) * exc->period ); + val = SUB_LONG( val, exc->phase ); if ( val > 0 ) val = -exc->phase; } @@ -2826,7 +2858,7 @@ static void Ins_ADD( FT_Long* args ) { - args[0] += args[1]; + args[0] = ADD_LONG( args[0], args[1] ); } @@ -2839,7 +2871,7 @@ static void Ins_SUB( FT_Long* args ) { - args[0] -= args[1]; + args[0] = SUB_LONG( args[0], args[1] ); } @@ -2882,7 +2914,8 @@ static void Ins_ABS( FT_Long* args ) { - args[0] = FT_ABS( args[0] ); + if ( args[0] < 0 ) + args[0] = NEG_LONG( args[0] ); } @@ -2895,7 +2928,7 @@ static void Ins_NEG( FT_Long* args ) { - args[0] = -args[0]; + args[0] = NEG_LONG( args[0] ); } @@ -2921,7 +2954,7 @@ static void Ins_CEILING( FT_Long* args ) { - args[0] = FT_PIX_CEIL( args[0] ); + args[0] = FT_PIX_CEIL_LONG( args[0] ); } @@ -3256,7 +3289,10 @@ if ( args[0] < 0 ) exc->error = FT_THROW( Bad_Argument ); else - exc->GS.loop = args[0]; + { + /* we heuristically limit the number of loops to 16 bits */ + exc->GS.loop = args[0] > 0xFFFFL ? 0xFFFFL : args[0]; + } } @@ -3564,6 +3600,13 @@ #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ + /* FDEF is only allowed in `prep' or `fpgm' */ + if ( exc->curRange == tt_coderange_glyph ) + { + exc->error = FT_THROW( DEF_In_Glyf_Bytecode ); + return; + } + /* some font programs are broken enough to redefine functions! */ /* We will then parse the current table. */ @@ -3990,6 +4033,13 @@ TT_DefRecord* limit; + /* we enable IDEF only in `prep' or `fpgm' */ + if ( exc->curRange == tt_coderange_glyph ) + { + exc->error = FT_THROW( DEF_In_Glyf_Bytecode ); + return; + } + /* First of all, look for the same function in our table */ def = exc->IDefs; @@ -4197,8 +4247,8 @@ p1 = exc->zp1.cur + aIdx2; p2 = exc->zp2.cur + aIdx1; - A = p1->x - p2->x; - B = p1->y - p2->y; + A = SUB_LONG( p1->x, p2->x ); + B = SUB_LONG( p1->y, p2->y ); /* If p1 == p2, SPvTL and SFvTL behave the same as */ /* SPvTCA[X] and SFvTCA[X], respectively. */ @@ -4213,9 +4263,9 @@ if ( ( opcode & 1 ) != 0 ) { - C = B; /* counter clockwise rotation */ - B = A; - A = -C; + C = B; /* counter clockwise rotation */ + B = A; + A = NEG_LONG( C ); } Normalize( A, B, Vec ); @@ -4756,7 +4806,7 @@ K = FAST_PROJECT( &exc->zp2.cur[L] ); - exc->func_move( exc, &exc->zp2, L, args[1] - K ); + exc->func_move( exc, &exc->zp2, L, SUB_LONG( args[1], K ) ); /* UNDOCUMENTED! The MS rasterizer does that with */ /* twilight points (confirmed by Greg Hitchcock) */ @@ -4880,12 +4930,12 @@ } { - FT_Vector* v1 = exc->zp1.org + p2; - FT_Vector* v2 = exc->zp2.org + p1; + FT_Vector* v1 = exc->zp1.org + p2; + FT_Vector* v2 = exc->zp2.org + p1; - A = v1->x - v2->x; - B = v1->y - v2->y; + A = SUB_LONG( v1->x, v2->x ); + B = SUB_LONG( v1->y, v2->y ); /* If v1 == v2, SDPvTL behaves the same as */ /* SVTCA[X], respectively. */ @@ -4901,9 +4951,9 @@ if ( ( opcode & 1 ) != 0 ) { - C = B; /* counter clockwise rotation */ - B = A; - A = -C; + C = B; /* counter clockwise rotation */ + B = A; + A = NEG_LONG( C ); } Normalize( A, B, &exc->GS.dualVector ); @@ -4913,8 +4963,8 @@ FT_Vector* v2 = exc->zp2.cur + p1; - A = v1->x - v2->x; - B = v1->y - v2->y; + A = SUB_LONG( v1->x, v2->x ); + B = SUB_LONG( v1->y, v2->y ); if ( A == 0 && B == 0 ) { @@ -4925,9 +4975,9 @@ if ( ( opcode & 1 ) != 0 ) { - C = B; /* counter clockwise rotation */ - B = A; - A = -C; + C = B; /* counter clockwise rotation */ + B = A; + A = NEG_LONG( C ); } Normalize( A, B, &exc->GS.projVector ); @@ -5112,11 +5162,11 @@ #endif #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* Native ClearType fonts sign a waiver that turns off all backwards */ + /* Native ClearType fonts sign a waiver that turns off all backward */ /* compatibility hacks and lets them program points to the grid like */ /* it's 1996. They might sign a waiver for just one glyph, though. */ if ( SUBPIXEL_HINTING_MINIMAL ) - exc->backwards_compatibility = !FT_BOOL( L == 4 ); + exc->backward_compatibility = !FT_BOOL( L == 4 ); #endif } } @@ -5204,11 +5254,11 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* See `ttinterp.h' for details on backwards compatibility mode. */ - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility && - exc->iupx_called && - exc->iupy_called ) + /* See `ttinterp.h' for details on backward compatibility mode. */ + if ( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility && + exc->iupx_called && + exc->iupy_called ) goto Fail; #endif @@ -5259,11 +5309,11 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* See `ttinterp.h' for details on backwards compatibility mode. */ - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility && - exc->iupx_called && - exc->iupy_called ) + /* See `ttinterp.h' for details on backward compatibility mode. */ + if ( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility && + exc->iupx_called && + exc->iupy_called ) return; #endif @@ -5297,11 +5347,11 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* See `ttinterp.h' for details on backwards compatibility mode. */ - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility && - exc->iupx_called && - exc->iupy_called ) + /* See `ttinterp.h' for details on backward compatibility mode. */ + if ( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility && + exc->iupx_called && + exc->iupy_called ) return; #endif @@ -5364,7 +5414,7 @@ } - /* See `ttinterp.h' for details on backwards compatibility mode. */ + /* See `ttinterp.h' for details on backward compatibility mode. */ static void Move_Zp2_Point( TT_ExecContext exc, FT_UShort point, @@ -5375,10 +5425,10 @@ if ( exc->GS.freeVector.x != 0 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( !( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility ) ) + if ( !( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility ) ) #endif - exc->zp2.cur[point].x += dx; + exc->zp2.cur[point].x = ADD_LONG( exc->zp2.cur[point].x, dx ); if ( touch ) exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X; @@ -5387,12 +5437,12 @@ if ( exc->GS.freeVector.y != 0 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( !( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility && - exc->iupx_called && - exc->iupy_called ) ) + if ( !( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility && + exc->iupx_called && + exc->iupy_called ) ) #endif - exc->zp2.cur[point].y += dy; + exc->zp2.cur[point].y = ADD_LONG( exc->zp2.cur[point].y, dy ); if ( touch ) exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_Y; @@ -5643,7 +5693,11 @@ ( B1 & 63 ) != 0 && ( B2 & 63 ) != 0 && B1 != B2 ) - Move_Zp2_Point( exc, point, -dx, -dy, TRUE ); + Move_Zp2_Point( exc, + point, + NEG_LONG( dx ), + NEG_LONG( dy ), + TRUE ); } } else if ( exc->face->sph_compatibility_mode ) @@ -5675,7 +5729,7 @@ if ( ( B1 & 63 ) == 0 && ( B2 & 63 ) != 0 && B1 != B2 ) - Move_Zp2_Point( exc, point, 0, -dy, TRUE ); + Move_Zp2_Point( exc, point, 0, NEG_LONG( dy ), TRUE ); } } else if ( exc->sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL ) @@ -5687,8 +5741,8 @@ else #endif #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility ) + if ( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility ) { /* Special case: allow SHPIX to move points in the twilight zone. */ /* Otherwise, treat SHPIX the same as DELTAP. Unbreaks various */ @@ -5731,6 +5785,7 @@ FT_F26Dot6 distance; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY FT_F26Dot6 control_value_cutin = 0; + FT_F26Dot6 delta; if ( SUBPIXEL_HINTING_INFINALITY ) @@ -5766,15 +5821,22 @@ distance = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY + delta = SUB_LONG( distance, args[1] ); + if ( delta < 0 ) + delta = NEG_LONG( delta ); + /* subpixel hinting - make MSIRP respect CVT cut-in; */ - if ( SUBPIXEL_HINTING_INFINALITY && - exc->ignore_x_mode && - exc->GS.freeVector.x != 0 && - FT_ABS( distance - args[1] ) >= control_value_cutin ) + if ( SUBPIXEL_HINTING_INFINALITY && + exc->ignore_x_mode && + exc->GS.freeVector.x != 0 && + delta >= control_value_cutin ) distance = args[1]; #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ - exc->func_move( exc, &exc->zp1, point, args[1] - distance ); + exc->func_move( exc, + &exc->zp1, + point, + SUB_LONG( args[1], distance ) ); exc->GS.rp1 = exc->GS.rp0; exc->GS.rp2 = point; @@ -5815,16 +5877,18 @@ if ( SUBPIXEL_HINTING_INFINALITY && exc->ignore_x_mode && exc->GS.freeVector.x != 0 ) - distance = Round_None( - exc, - cur_dist, - exc->tt_metrics.compensations[0] ) - cur_dist; + distance = SUB_LONG( + Round_None( exc, + cur_dist, + exc->tt_metrics.compensations[0] ), + cur_dist ); else #endif - distance = exc->func_round( - exc, - cur_dist, - exc->tt_metrics.compensations[0] ) - cur_dist; + distance = SUB_LONG( + exc->func_round( exc, + cur_dist, + exc->tt_metrics.compensations[0] ), + cur_dist ); } else distance = 0; @@ -5924,7 +5988,14 @@ if ( ( exc->opcode & 1 ) != 0 ) /* rounding and control cut-in flag */ { - if ( FT_ABS( distance - org_dist ) > control_value_cutin ) + FT_F26Dot6 delta; + + + delta = SUB_LONG( distance, org_dist ); + if ( delta < 0 ) + delta = NEG_LONG( delta ); + + if ( delta > control_value_cutin ) distance = org_dist; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY @@ -5941,7 +6012,7 @@ exc->tt_metrics.compensations[0] ); } - exc->func_move( exc, &exc->zp0, point, distance - org_dist ); + exc->func_move( exc, &exc->zp0, point, SUB_LONG( distance, org_dist ) ); Fail: exc->GS.rp0 = point; @@ -6013,8 +6084,10 @@ FT_Vector vec; - vec.x = FT_MulFix( vec1->x - vec2->x, exc->metrics.x_scale ); - vec.y = FT_MulFix( vec1->y - vec2->y, exc->metrics.y_scale ); + vec.x = FT_MulFix( SUB_LONG( vec1->x, vec2->x ), + exc->metrics.x_scale ); + vec.y = FT_MulFix( SUB_LONG( vec1->y, vec2->y ), + exc->metrics.y_scale ); org_dist = FAST_DUALPROJ( &vec ); } @@ -6022,8 +6095,12 @@ /* single width cut-in test */ - if ( FT_ABS( org_dist - exc->GS.single_width_value ) < - exc->GS.single_width_cutin ) + /* |org_dist - single_width_value| < single_width_cutin */ + if ( exc->GS.single_width_cutin > 0 && + org_dist < exc->GS.single_width_value + + exc->GS.single_width_cutin && + org_dist > exc->GS.single_width_value - + exc->GS.single_width_cutin ) { if ( org_dist >= 0 ) org_dist = exc->GS.single_width_value; @@ -6067,8 +6144,8 @@ } else { - if ( distance > -minimum_distance ) - distance = -minimum_distance; + if ( distance > NEG_LONG( minimum_distance ) ) + distance = NEG_LONG( minimum_distance ); } } @@ -6076,7 +6153,7 @@ org_dist = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 ); - exc->func_move( exc, &exc->zp1, point, distance - org_dist ); + exc->func_move( exc, &exc->zp1, point, SUB_LONG( distance, org_dist ) ); Fail: exc->GS.rp1 = exc->GS.rp0; @@ -6116,7 +6193,7 @@ minimum_distance = exc->GS.minimum_distance; control_value_cutin = exc->GS.control_value_cutin; point = (FT_UShort)args[0]; - cvtEntry = (FT_ULong)( args[1] + 1 ); + cvtEntry = (FT_ULong)( ADD_LONG( args[1], 1 ) ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && @@ -6199,6 +6276,9 @@ if ( exc->GS.gep0 == exc->GS.gep1 ) { + FT_F26Dot6 delta; + + /* XXX: According to Greg Hitchcock, the following wording is */ /* the right one: */ /* */ @@ -6211,7 +6291,11 @@ /* `ttinst2.doc', version 1.66, is thus incorrect since */ /* it implies `>=' instead of `>'. */ - if ( FT_ABS( cvt_dist - org_dist ) > control_value_cutin ) + delta = SUB_LONG( cvt_dist, org_dist ); + if ( delta < 0 ) + delta = NEG_LONG( delta ); + + if ( delta > control_value_cutin ) cvt_dist = org_dist; } @@ -6229,7 +6313,14 @@ exc->ignore_x_mode && exc->GS.gep0 == exc->GS.gep1 ) { - if ( FT_ABS( cvt_dist - org_dist ) > control_value_cutin ) + FT_F26Dot6 delta; + + + delta = SUB_LONG( cvt_dist, org_dist ); + if ( delta < 0 ) + delta = NEG_LONG( delta ); + + if ( delta > control_value_cutin ) cvt_dist = org_dist; } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ @@ -6251,8 +6342,8 @@ } else { - if ( distance > -minimum_distance ) - distance = -minimum_distance; + if ( distance > NEG_LONG( minimum_distance ) ) + distance = NEG_LONG( minimum_distance ); } } @@ -6276,7 +6367,10 @@ } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ - exc->func_move( exc, &exc->zp1, point, distance - cur_dist ); + exc->func_move( exc, + &exc->zp1, + point, + SUB_LONG( distance, cur_dist ) ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY ) @@ -6300,7 +6394,10 @@ } if ( reverse_move ) - exc->func_move( exc, &exc->zp1, point, -( distance - cur_dist ) ); + exc->func_move( exc, + &exc->zp1, + point, + SUB_LONG( cur_dist, distance ) ); } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ @@ -6366,7 +6463,7 @@ distance = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 ); - exc->func_move( exc, &exc->zp1, point, -distance ); + exc->func_move( exc, &exc->zp1, point, NEG_LONG( distance ) ); } exc->GS.loop--; @@ -6423,19 +6520,19 @@ /* Cramer's rule */ - dbx = exc->zp0.cur[b1].x - exc->zp0.cur[b0].x; - dby = exc->zp0.cur[b1].y - exc->zp0.cur[b0].y; + dbx = SUB_LONG( exc->zp0.cur[b1].x, exc->zp0.cur[b0].x ); + dby = SUB_LONG( exc->zp0.cur[b1].y, exc->zp0.cur[b0].y ); - dax = exc->zp1.cur[a1].x - exc->zp1.cur[a0].x; - day = exc->zp1.cur[a1].y - exc->zp1.cur[a0].y; + dax = SUB_LONG( exc->zp1.cur[a1].x, exc->zp1.cur[a0].x ); + day = SUB_LONG( exc->zp1.cur[a1].y, exc->zp1.cur[a0].y ); - dx = exc->zp0.cur[b0].x - exc->zp1.cur[a0].x; - dy = exc->zp0.cur[b0].y - exc->zp1.cur[a0].y; + dx = SUB_LONG( exc->zp0.cur[b0].x, exc->zp1.cur[a0].x ); + dy = SUB_LONG( exc->zp0.cur[b0].y, exc->zp1.cur[a0].y ); - discriminant = FT_MulDiv( dax, -dby, 0x40 ) + - FT_MulDiv( day, dbx, 0x40 ); - dotproduct = FT_MulDiv( dax, dbx, 0x40 ) + - FT_MulDiv( day, dby, 0x40 ); + discriminant = ADD_LONG( FT_MulDiv( dax, NEG_LONG( dby ), 0x40 ), + FT_MulDiv( day, dbx, 0x40 ) ); + dotproduct = ADD_LONG( FT_MulDiv( dax, dbx, 0x40 ), + FT_MulDiv( day, dby, 0x40 ) ); /* The discriminant above is actually a cross product of vectors */ /* da and db. Together with the dot product, they can be used as */ @@ -6445,30 +6542,29 @@ /* discriminant = |da||db|sin(angle) . */ /* We use these equations to reject grazing intersections by */ /* thresholding abs(tan(angle)) at 1/19, corresponding to 3 degrees. */ - if ( 19 * FT_ABS( discriminant ) > FT_ABS( dotproduct ) ) + if ( MUL_LONG( 19, FT_ABS( discriminant ) ) > FT_ABS( dotproduct ) ) { - val = FT_MulDiv( dx, -dby, 0x40 ) + FT_MulDiv( dy, dbx, 0x40 ); + val = ADD_LONG( FT_MulDiv( dx, NEG_LONG( dby ), 0x40 ), + FT_MulDiv( dy, dbx, 0x40 ) ); R.x = FT_MulDiv( val, dax, discriminant ); R.y = FT_MulDiv( val, day, discriminant ); - /* XXX: Block in backwards_compatibility and/or post-IUP? */ - exc->zp2.cur[point].x = exc->zp1.cur[a0].x + R.x; - exc->zp2.cur[point].y = exc->zp1.cur[a0].y + R.y; + /* XXX: Block in backward_compatibility and/or post-IUP? */ + exc->zp2.cur[point].x = ADD_LONG( exc->zp1.cur[a0].x, R.x ); + exc->zp2.cur[point].y = ADD_LONG( exc->zp1.cur[a0].y, R.y ); } else { /* else, take the middle of the middles of A and B */ - /* XXX: Block in backwards_compatibility and/or post-IUP? */ - exc->zp2.cur[point].x = ( exc->zp1.cur[a0].x + - exc->zp1.cur[a1].x + - exc->zp0.cur[b0].x + - exc->zp0.cur[b1].x ) / 4; - exc->zp2.cur[point].y = ( exc->zp1.cur[a0].y + - exc->zp1.cur[a1].y + - exc->zp0.cur[b0].y + - exc->zp0.cur[b1].y ) / 4; + /* XXX: Block in backward_compatibility and/or post-IUP? */ + exc->zp2.cur[point].x = + ADD_LONG( ADD_LONG( exc->zp1.cur[a0].x, exc->zp1.cur[a1].x ), + ADD_LONG( exc->zp0.cur[b0].x, exc->zp0.cur[b1].x ) ) / 4; + exc->zp2.cur[point].y = + ADD_LONG( ADD_LONG( exc->zp1.cur[a0].y, exc->zp1.cur[a1].y ), + ADD_LONG( exc->zp0.cur[b0].y, exc->zp0.cur[b1].y ) ) / 4; } exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_BOTH; @@ -6503,7 +6599,7 @@ distance = PROJECT( exc->zp0.cur + p2, exc->zp1.cur + p1 ) / 2; exc->func_move( exc, &exc->zp1, p1, distance ); - exc->func_move( exc, &exc->zp0, p2, -distance ); + exc->func_move( exc, &exc->zp0, p2, NEG_LONG( distance ) ); } @@ -6576,9 +6672,11 @@ FT_Vector vec; - vec.x = FT_MulFix( exc->zp1.orus[exc->GS.rp2].x - orus_base->x, + vec.x = FT_MulFix( SUB_LONG( exc->zp1.orus[exc->GS.rp2].x, + orus_base->x ), exc->metrics.x_scale ); - vec.y = FT_MulFix( exc->zp1.orus[exc->GS.rp2].y - orus_base->y, + vec.y = FT_MulFix( SUB_LONG( exc->zp1.orus[exc->GS.rp2].y, + orus_base->y ), exc->metrics.y_scale ); old_range = FAST_DUALPROJ( &vec ); @@ -6613,9 +6711,11 @@ FT_Vector vec; - vec.x = FT_MulFix( exc->zp2.orus[point].x - orus_base->x, + vec.x = FT_MulFix( SUB_LONG( exc->zp2.orus[point].x, + orus_base->x ), exc->metrics.x_scale ); - vec.y = FT_MulFix( exc->zp2.orus[point].y - orus_base->y, + vec.y = FT_MulFix( SUB_LONG( exc->zp2.orus[point].y, + orus_base->y ), exc->metrics.y_scale ); org_dist = FAST_DUALPROJ( &vec ); @@ -6654,7 +6754,7 @@ exc->func_move( exc, &exc->zp2, (FT_UShort)point, - new_dist - cur_dist ); + SUB_LONG( new_dist, cur_dist ) ); } Fail: @@ -6719,14 +6819,14 @@ FT_F26Dot6 dx; - dx = worker->curs[p].x - worker->orgs[p].x; + dx = SUB_LONG( worker->curs[p].x, worker->orgs[p].x ); if ( dx != 0 ) { for ( i = p1; i < p; i++ ) - worker->curs[i].x += dx; + worker->curs[i].x = ADD_LONG( worker->curs[i].x, dx ); for ( i = p + 1; i <= p2; i++ ) - worker->curs[i].x += dx; + worker->curs[i].x = ADD_LONG( worker->curs[i].x, dx ); } } @@ -6771,8 +6871,8 @@ org2 = worker->orgs[ref2].x; cur1 = worker->curs[ref1].x; cur2 = worker->curs[ref2].x; - delta1 = cur1 - org1; - delta2 = cur2 - org2; + delta1 = SUB_LONG( cur1, org1 ); + delta2 = SUB_LONG( cur2, org2 ); if ( cur1 == cur2 || orus1 == orus2 ) { @@ -6784,10 +6884,10 @@ if ( x <= org1 ) - x += delta1; + x = ADD_LONG( x, delta1 ); else if ( x >= org2 ) - x += delta2; + x = ADD_LONG( x, delta2 ); else x = cur1; @@ -6808,20 +6908,23 @@ if ( x <= org1 ) - x += delta1; + x = ADD_LONG( x, delta1 ); else if ( x >= org2 ) - x += delta2; + x = ADD_LONG( x, delta2 ); else { if ( !scale_valid ) { scale_valid = 1; - scale = FT_DivFix( cur2 - cur1, orus2 - orus1 ); + scale = FT_DivFix( SUB_LONG( cur2, cur1 ), + SUB_LONG( orus2, orus1 ) ); } - x = cur1 + FT_MulFix( worker->orus[i].x - orus1, scale ); + x = ADD_LONG( cur1, + FT_MulFix( SUB_LONG( worker->orus[i].x, orus1 ), + scale ) ); } worker->curs[i].x = x; } @@ -6852,11 +6955,11 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* See `ttinterp.h' for details on backwards compatibility mode. */ + /* See `ttinterp.h' for details on backward compatibility mode. */ /* Allow IUP until it has been called on both axes. Immediately */ /* return on subsequent ones. */ - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility ) + if ( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility ) { if ( exc->iupx_called && exc->iupy_called ) return; @@ -7089,7 +7192,7 @@ SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP ) && ( B1 & 63 ) != 0 && ( B2 & 63 ) != 0 ) ) ) - exc->func_move( exc, &exc->zp0, A, -B ); + exc->func_move( exc, &exc->zp0, A, NEG_LONG( B ) ); } } else @@ -7098,10 +7201,10 @@ { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* See `ttinterp.h' for details on backwards compatibility */ - /* mode. */ - if ( SUBPIXEL_HINTING_MINIMAL && - exc->backwards_compatibility ) + /* See `ttinterp.h' for details on backward compatibility */ + /* mode. */ + if ( SUBPIXEL_HINTING_MINIMAL && + exc->backward_compatibility ) { if ( !( exc->iupx_called && exc->iupy_called ) && ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) || @@ -7245,7 +7348,7 @@ { if ( exc->ignore_x_mode ) { - /* if in ClearType backwards compatibility mode, */ + /* if in ClearType backward compatibility mode, */ /* we sometimes change the TrueType version dynamically */ K = exc->rasterizer_version; FT_TRACE6(( "Setting rasterizer version %d\n", @@ -7296,7 +7399,11 @@ K |= 1 << 12; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - if ( SUBPIXEL_HINTING_MINIMAL ) + /* Toggle the following flags only outside of monochrome mode. */ + /* Otherwise, instructions may behave weirdly and rendering results */ + /* may differ between v35 and v40 mode, e.g., in `Times New Roman */ + /* Bold Italic'. */ + if ( SUBPIXEL_HINTING_MINIMAL && exc->subpixel_hinting_lean ) { /********************************/ /* HINTING FOR SUBPIXEL */ @@ -7331,7 +7438,7 @@ /* */ /* The only smoothing method FreeType supports unless someone sets */ /* FT_LOAD_TARGET_MONO. */ - if ( ( args[0] & 2048 ) != 0 ) + if ( ( args[0] & 2048 ) != 0 && exc->subpixel_hinting_lean ) K |= 1 << 18; /********************************/ @@ -7456,8 +7563,16 @@ return; } - for ( i = 0; i < num_axes; i++ ) - args[i] = coords[i] >> 2; /* convert 16.16 to 2.14 format */ + if ( coords ) + { + for ( i = 0; i < num_axes; i++ ) + args[i] = coords[i] >> 2; /* convert 16.16 to 2.14 format */ + } + else + { + for ( i = 0; i < num_axes; i++ ) + args[i] = 0; + } } @@ -7575,15 +7690,25 @@ #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - /* Toggle backwards compatibility according to what font says, except */ - /* when it's a `tricky' font that heavily relies on the interpreter to */ - /* render glyphs correctly, e.g. DFKai-SB. Backwards compatibility */ - /* hacks may break it. */ + /* + * Toggle backward compatibility according to what font wants, except + * when + * + * 1) we have a `tricky' font that heavily relies on the interpreter to + * render glyphs correctly, for example DFKai-SB, or + * 2) FT_RENDER_MODE_MONO (i.e, monochome rendering) is requested. + * + * In those cases, backward compatibility needs to be turned off to get + * correct rendering. The rendering is then completely up to the + * font's programming. + * + */ if ( SUBPIXEL_HINTING_MINIMAL && + exc->subpixel_hinting_lean && !FT_IS_TRICKY( &exc->face->root ) ) - exc->backwards_compatibility = !( exc->GS.instruct_control & 4 ); + exc->backward_compatibility = !( exc->GS.instruct_control & 4 ); else - exc->backwards_compatibility = FALSE; + exc->backward_compatibility = FALSE; exc->iupx_called = FALSE; exc->iupy_called = FALSE; @@ -7605,15 +7730,16 @@ exc->twilight.n_points = (FT_UShort)num_twilight_points; } - /* Set up loop detectors. We restrict the number of LOOPCALL loops */ - /* and the number of JMPR, JROT, and JROF calls with a negative */ - /* argument to values that depend on the size of the CVT table and */ - /* the number of points in the current glyph (if applicable). */ - /* */ - /* The idea is that in real-world bytecode you either iterate over */ - /* all CVT entries (in the `prep' table), or over all points (or */ - /* contours, in the `glyf' table) of a glyph, and such iterations */ - /* don't happen very often. */ + /* Set up loop detectors. We restrict the number of LOOPCALL loops */ + /* and the number of JMPR, JROT, and JROF calls with a negative */ + /* argument to values that depend on various parameters like the */ + /* size of the CVT table or the number of points in the current */ + /* glyph (if applicable). */ + /* */ + /* The idea is that in real-world bytecode you either iterate over */ + /* all CVT entries (in the `prep' table), or over all points (or */ + /* contours, in the `glyf' table) of a glyph, and such iterations */ + /* don't happen very often. */ exc->loopcall_counter = 0; exc->neg_jump_counter = 0; @@ -7624,8 +7750,14 @@ FT_MAX( 50, exc->cvtSize / 10 ); else - exc->loopcall_counter_max = FT_MAX( 100, - 5 * exc->cvtSize ); + exc->loopcall_counter_max = 300 + 8 * exc->cvtSize; + + /* as a protection against an unreasonable number of CVT entries */ + /* we assume at most 100 control values per glyph for the counter */ + if ( exc->loopcall_counter_max > + 100 * (FT_ULong)exc->face->root.num_glyphs ) + exc->loopcall_counter_max = 100 * (FT_ULong)exc->face->root.num_glyphs; + FT_TRACE5(( "TT_RunIns: Limiting total number of loops in LOOPCALL" " to %d\n", exc->loopcall_counter_max )); @@ -8393,30 +8525,27 @@ } while ( !exc->instruction_trap ); LNo_Error_: - FT_TRACE4(( " %d instructions executed\n", ins_counter )); + FT_TRACE4(( " %d instruction%s executed\n", + ins_counter, + ins_counter == 1 ? "" : "s" )); return FT_Err_Ok; LErrorCodeOverflow_: exc->error = FT_THROW( Code_Overflow ); LErrorLabel_: - /* If any errors have occurred, function tables may be broken. */ - /* Force a re-execution of `prep' and `fpgm' tables if no */ - /* bytecode debugger is run. */ - if ( exc->error && - !exc->instruction_trap && - exc->curRange == tt_coderange_glyph ) - { + if ( exc->error && !exc->instruction_trap ) FT_TRACE1(( " The interpreter returned error 0x%x\n", exc->error )); - exc->size->bytecode_ready = -1; - exc->size->cvt_ready = -1; - } return exc->error; } +#else /* !TT_USE_BYTECODE_INTERPRETER */ + + /* ANSI C doesn't like empty source files */ + typedef int _tt_interp_dummy; -#endif /* TT_USE_BYTECODE_INTERPRETER */ +#endif /* !TT_USE_BYTECODE_INTERPRETER */ /* END */ diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h index 6625e16c7..2966439ea 100644 --- a/src/truetype/ttinterp.h +++ b/src/truetype/ttinterp.h @@ -4,7 +4,7 @@ /* */ /* TrueType bytecode interpreter (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -253,23 +253,38 @@ FT_BEGIN_HEADER #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* - * Modern TrueType fonts are usually rendered through Microsoft's - * collection of rendering techniques called ClearType (e.g., subpixel - * rendering and subpixel hinting). When ClearType was introduced, most - * fonts were not ready. Microsoft decided to implement a backwards - * compatibility mode that employed several simple to complicated - * assumptions and tricks that modified the interpretation of the - * bytecode contained in these fonts to make them look ClearType-y - * somehow. Most (web)fonts that were released since then have come to - * rely on these hacks to render correctly, even some of Microsoft's - * flagship ClearType fonts (Calibri, Cambria, Segoe UI). + * FreeType supports ClearType-like hinting of TrueType fonts through + * the version 40 interpreter. This is achieved through several hacks + * in the base (v35) interpreter, as detailed below. * - * The minimal subpixel hinting code (interpreter version 40) employs a - * small list of font-agnostic hacks to bludgeon non-native-ClearType - * fonts (except tricky ones[1]) into submission. It will not try to - * toggle hacks for specific fonts for performance and complexity - * reasons. The focus is on modern (web)fonts rather than legacy fonts - * that were made for black-and-white rendering. + * ClearType is an umbrella term for several rendering techniques + * employed by Microsoft's various GUI and rendering toolkit + * implementations, most importantly: subpixel rendering for using the + * RGB subpixels of LCDs to approximately triple the perceived + * resolution on the x-axis and subpixel hinting for positioning stems + * on subpixel borders. TrueType programming is explicit, i.e., fonts + * must be programmed to take advantage of ClearType's possibilities. + * + * When ClearType was introduced, it seemed unlikely that all fonts + * would be reprogrammed, so Microsoft decided to implement a backward + * compatibility mode. It employs several simple to complicated + * assumptions and tricks, many of them font-dependent, that modify the + * interpretation of the bytecode contained in these fonts to retrofit + * them into a ClearType-y look. The quality of the results varies. + * Most (web)fonts that were released since then have come to rely on + * these hacks to render correctly, even some of Microsoft's flagship + * fonts (e.g., Calibri, Cambria, Segoe UI). + * + * FreeType's minimal subpixel hinting code (interpreter version 40) + * employs a small list of font-agnostic hacks loosely based on the + * public information available on Microsoft's compatibility mode[2]. + * The focus is on modern (web)fonts rather than legacy fonts that were + * made for monochrome rendering. It will not match ClearType rendering + * exactly. Unlike the `Infinality' code (interpreter version 38) that + * came before, it will not try to toggle hacks for specific fonts for + * performance and complexity reasons. It will fall back to version 35 + * behavior for tricky fonts[1] or when monochrome rendering is + * requested. * * Major hacks * @@ -316,12 +331,12 @@ FT_BEGIN_HEADER * very specific patterns (`superhinting') for pre-ClearType-displays, * the worse the results. * - * Microsoft defines a way to turn off backwards compatibility and + * Microsoft defines a way to turn off backward compatibility and * interpret instructions as before (called `native ClearType')[2][3]. * The font designer then regains full control and is responsible for * making the font work correctly with ClearType without any * hand-holding by the interpreter or rasterizer[4]. The v40 - * interpreter assumes backwards compatibility by default, which can be + * interpreter assumes backward compatibility by default, which can be * turned off the same way by executing the following in the control * program (cf. `Ins_INSTCTRL'). * @@ -331,7 +346,7 @@ FT_BEGIN_HEADER * [1] Tricky fonts as FreeType defines them rely on the bytecode * interpreter to display correctly. Hacks can interfere with them, * so they get treated like native ClearType fonts (v40 with - * backwards compatibility turned off). Cf. `TT_RunIns'. + * backward compatibility turned off). Cf. `TT_RunIns'. * * [2] Proposed by Microsoft's Greg Hitchcock in * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx @@ -347,7 +362,8 @@ FT_BEGIN_HEADER * */ - /* Using v40 implies subpixel hinting. Used to detect interpreter */ + /* Using v40 implies subpixel hinting, unless FT_RENDER_MODE_MONO has been + * requested. Used to detect interpreter */ /* version switches. `_lean' to differentiate from the Infinality */ /* `subpixel_hinting', which is managed differently. */ FT_Bool subpixel_hinting_lean; @@ -357,10 +373,10 @@ FT_BEGIN_HEADER /* is managed differently. */ FT_Bool vertical_lcd_lean; - /* Default to backwards compatibility mode in v40 interpreter. If */ + /* Default to backward compatibility mode in v40 interpreter. If */ /* this is false, it implies the interpreter is in v35 or in native */ /* ClearType mode. */ - FT_Bool backwards_compatibility; + FT_Bool backward_compatibility; /* Useful for detecting and denying post-IUP trickery that is usually */ /* used to fix pixel patterns (`superhinting'). */ diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index fd0c4ddd3..6685dc819 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -4,7 +4,7 @@ /* */ /* Objects manager (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,7 +21,7 @@ #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H #include FT_INTERNAL_SFNT_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include "ttgload.h" #include "ttpload.h" @@ -147,20 +147,51 @@ { #define TRICK_NAMES_MAX_CHARACTERS 19 -#define TRICK_NAMES_COUNT 9 +#define TRICK_NAMES_COUNT 26 static const char trick_names[TRICK_NAMES_COUNT] [TRICK_NAMES_MAX_CHARACTERS + 1] = { + /* + PostScript names are given in brackets if they differ from the + family name. The version numbers, together with the copyright or + release year data, are taken from fonts available to the + developers. + + Note that later versions of the fonts might be no longer tricky; + for example, `MingLiU' version 7.00 (file `mingliu.ttc' from + Windows 7) is an ordinary TTC with non-tricky subfonts. + */ + + "cpop", /* dftt-p7.ttf; version 1.00, 1992 [DLJGyShoMedium] */ + "DFGirl-W6-WIN-BF", /* dftt-h6.ttf; version 1.00, 1993 */ + "DFGothic-EB", /* DynaLab Inc. 1992-1995 */ + "DFGyoSho-Lt", /* DynaLab Inc. 1992-1995 */ + "DFHei-Md-HK-BF", /* maybe DynaLab Inc. */ + "DFHSGothic-W5", /* DynaLab Inc. 1992-1995 */ + "DFHSMincho-W3", /* DynaLab Inc. 1992-1995 */ + "DFHSMincho-W7", /* DynaLab Inc. 1992-1995 */ "DFKaiSho-SB", /* dfkaisb.ttf */ "DFKaiShu", - "DFKai-SB", /* kaiu.ttf */ + "DFKaiShu-Md-HK-BF", /* maybe DynaLab Inc. */ + "DFKai-SB", /* kaiu.ttf; version 3.00, 1998 [DFKaiShu-SB-Estd-BF] */ + "DFMing-Bd-HK-BF", /* maybe DynaLab Inc. */ + "DLC", /* dftt-m7.ttf; version 1.00, 1993 [DLCMingBold] */ + /* dftt-f5.ttf; version 1.00, 1993 [DLCFongSung] */ + "DLCHayMedium", /* dftt-b5.ttf; version 1.00, 1993 */ + "DLCHayBold", /* dftt-b7.ttf; version 1.00, 1993 */ + "DLCKaiMedium", /* dftt-k5.ttf; version 1.00, 1992 */ + "DLCLiShu", /* dftt-l5.ttf; version 1.00, 1992 */ + "DLCRoundBold", /* dftt-r7.ttf; version 1.00, 1993 */ "HuaTianKaiTi?", /* htkt2.ttf */ "HuaTianSongTi?", /* htst3.ttf */ - "Ming(for ISO10646)", /* hkscsiic.ttf & iicore.ttf */ - "MingLiU", /* mingliu.ttf & mingliu.ttc */ - "PMingLiU", /* mingliu.ttc */ - "MingLi43", /* mingli.ttf */ + "Ming(for ISO10646)", /* hkscsiic.ttf; version 0.12, 2007 [Ming] */ + /* iicore.ttf; version 0.07, 2007 [Ming] */ + "MingLiU", /* mingliu.ttf */ + /* mingliu.ttc; version 3.21, 2001 */ + "MingMedium", /* dftt-m5.ttf; version 1.00, 1993 [DLCMingMedium] */ + "PMingLiU", /* mingliu.ttc; version 3.21, 2001 */ + "MingLi43", /* mingli.ttf; version 1.00, 1992 */ }; int nn; @@ -242,7 +273,7 @@ tt_check_trickyness_sfnt_ids( TT_Face face ) { #define TRICK_SFNT_IDS_PER_FACE 3 -#define TRICK_SFNT_IDS_NUM_FACES 18 +#define TRICK_SFNT_IDS_NUM_FACES 29 static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES] [TRICK_SFNT_IDS_PER_FACE] = { @@ -261,16 +292,66 @@ { 0x28233BF1UL, 0x000087C4UL }, /* fpgm */ { 0xA344A1EBUL, 0x000001E1UL } /* prep */ }, + { /* DFGothic-EB */ + { 0x12C3EBB2UL, 0x00000350UL }, /* cvt */ + { 0xB680EE64UL, 0x000087A7UL }, /* fpgm */ + { 0xCE939563UL, 0x00000758UL } /* prep */ + }, + { /* DFGyoSho-Lt */ + { 0x11E5EAD4UL, 0x00000350UL }, /* cvt */ + { 0xCE5956E9UL, 0x0000BC85UL }, /* fpgm */ + { 0x8272F416UL, 0x00000045UL } /* prep */ + }, + { /* DFHei-Md-HK-BF */ + { 0x1257EB46UL, 0x00000350UL }, /* cvt */ + { 0xF699D160UL, 0x0000715FUL }, /* fpgm */ + { 0xD222F568UL, 0x000003BCUL } /* prep */ + }, + { /* DFHSGothic-W5 */ + { 0x1262EB4EUL, 0x00000350UL }, /* cvt */ + { 0xE86A5D64UL, 0x00007940UL }, /* fpgm */ + { 0x7850F729UL, 0x000005FFUL } /* prep */ + }, + { /* DFHSMincho-W3 */ + { 0x122DEB0AUL, 0x00000350UL }, /* cvt */ + { 0x3D16328AUL, 0x0000859BUL }, /* fpgm */ + { 0xA93FC33BUL, 0x000002CBUL } /* prep */ + }, + { /* DFHSMincho-W7 */ + { 0x125FEB26UL, 0x00000350UL }, /* cvt */ + { 0xA5ACC982UL, 0x00007EE1UL }, /* fpgm */ + { 0x90999196UL, 0x0000041FUL } /* prep */ + }, { /* DFKaiShu */ { 0x11E5EAD4UL, 0x00000350UL }, /* cvt */ { 0x5A30CA3BUL, 0x00009063UL }, /* fpgm */ { 0x13A42602UL, 0x0000007EUL } /* prep */ }, - { /* DFKaiShu2 */ + { /* DFKaiShu, variant */ { 0x11E5EAD4UL, 0x00000350UL }, /* cvt */ { 0xA6E78C01UL, 0x00008998UL }, /* fpgm */ { 0x13A42602UL, 0x0000007EUL } /* prep */ }, + { /* DFKaiShu-Md-HK-BF */ + { 0x11E5EAD4UL, 0x00000360UL }, /* cvt */ + { 0x9DB282B2UL, 0x0000C06EUL }, /* fpgm */ + { 0x53E6D7CAUL, 0x00000082UL } /* prep */ + }, + { /* DFMing-Bd-HK-BF */ + { 0x1243EB18UL, 0x00000350UL }, /* cvt */ + { 0xBA0A8C30UL, 0x000074ADUL }, /* fpgm */ + { 0xF3D83409UL, 0x0000037BUL } /* prep */ + }, + { /* DLCLiShu */ + { 0x07DCF546UL, 0x00000308UL }, /* cvt */ + { 0x40FE7C90UL, 0x00008E2AUL }, /* fpgm */ + { 0x608174B5UL, 0x0000007AUL } /* prep */ + }, + { /* DLCHayBold */ + { 0xEB891238UL, 0x00000308UL }, /* cvt */ + { 0xD2E4DCD4UL, 0x0000676FUL }, /* fpgm */ + { 0x8EA5F293UL, 0x000003B8UL } /* prep */ + }, { /* HuaTianKaiTi */ { 0xFFFBFFFCUL, 0x00000008UL }, /* cvt */ { 0x9C9E48B8UL, 0x0000BEA2UL }, /* fpgm */ @@ -340,6 +421,11 @@ { 0x00000000UL, 0x00000000UL }, /* cvt */ { 0xF055FC48UL, 0x000001C2UL }, /* fpgm */ { 0x3900DED3UL, 0x00001E18UL } /* prep */ + }, + { /* MINGLI.TTF, 1992 */ + { 0x00170003UL, 0x00000060UL }, /* cvt */ + { 0xDBB4306EUL, 0x000058AAUL }, /* fpgm */ + { 0xD643482AUL, 0x00000035UL } /* prep */ } }; @@ -548,9 +634,11 @@ /* We must also be able to accept Mac/GX fonts, as well as OT ones. */ /* The 0x00020000 tag is completely undocumented; some fonts from */ /* Arphic made for Chinese Windows 3.1 have this. */ - if ( face->format_tag != 0x00010000L && /* MS fonts */ - face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */ - face->format_tag != TTAG_true ) /* Mac fonts */ + if ( face->format_tag != 0x00010000L && /* MS fonts */ + face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */ + face->format_tag != TTAG_true && /* Mac fonts */ + face->format_tag != TTAG_0xA5kbd && /* `Keyboard.dfont' (legacy Mac OS X) */ + face->format_tag != TTAG_0xA5lst ) /* `LastResort.dfont' (legacy Mac OS X) */ { FT_TRACE2(( " not a TTF font\n" )); goto Bad_Format; @@ -627,46 +715,17 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT { - FT_Int instance_index = face_index >> 16; + FT_UInt instance_index = (FT_UInt)face_index >> 16; if ( FT_HAS_MULTIPLE_MASTERS( ttface ) && instance_index > 0 ) { - error = TT_Get_MM_Var( face, NULL ); + error = TT_Set_Named_Instance( face, instance_index ); if ( error ) goto Exit; - if ( face->blend->mmvar->namedstyle ) - { - FT_Memory memory = ttface->memory; - - FT_Var_Named_Style* named_style; - FT_String* style_name; - - - /* in `face_index', the instance index starts with value 1 */ - named_style = face->blend->mmvar->namedstyle + instance_index - 1; - error = sfnt->get_name( face, - (FT_UShort)named_style->strid, - &style_name ); - if ( error ) - goto Exit; - - /* set style name; if already set, replace it */ - if ( face->root.style_name ) - FT_FREE( face->root.style_name ); - face->root.style_name = style_name; - - /* finally, select the named instance */ - error = TT_Set_Var_Design( face, - face->blend->mmvar->num_axis, - named_style->coords ); - if ( error ) - goto Exit; - - tt_apply_mvar( face ); - } + tt_apply_mvar( face ); } } @@ -792,14 +851,14 @@ exec->pedantic_hinting = pedantic; { - FT_Size_Metrics* metrics = &exec->metrics; - TT_Size_Metrics* tt_metrics = &exec->tt_metrics; + FT_Size_Metrics* size_metrics = &exec->metrics; + TT_Size_Metrics* tt_metrics = &exec->tt_metrics; - metrics->x_ppem = 0; - metrics->y_ppem = 0; - metrics->x_scale = 0; - metrics->y_scale = 0; + size_metrics->x_ppem = 0; + size_metrics->y_ppem = 0; + size_metrics->x_scale = 0; + size_metrics->y_scale = 0; tt_metrics->ppem = 0; tt_metrics->scale = 0; @@ -1014,17 +1073,17 @@ /* Set default metrics */ { - TT_Size_Metrics* metrics = &size->ttmetrics; + TT_Size_Metrics* tt_metrics = &size->ttmetrics; - metrics->rotated = FALSE; - metrics->stretched = FALSE; + tt_metrics->rotated = FALSE; + tt_metrics->stretched = FALSE; /* set default engine compensation */ - metrics->compensations[0] = 0; /* gray */ - metrics->compensations[1] = 0; /* black */ - metrics->compensations[2] = 0; /* white */ - metrics->compensations[3] = 0; /* reserved */ + tt_metrics->compensations[0] = 0; /* gray */ + tt_metrics->compensations[1] = 0; /* black */ + tt_metrics->compensations[2] = 0; /* white */ + tt_metrics->compensations[3] = 0; /* reserved */ } /* allocate function defs, instruction defs, cvt, and storage area */ @@ -1202,14 +1261,16 @@ /* */ /* size :: A handle to the target size object. */ /* */ - /* only_height :: Only recompute ascender, descender, and height. */ + /* only_height :: Only recompute ascender, descender, and height; */ + /* this flag is used for variation fonts where */ + /* `tt_size_reset' is used as an iterator function. */ /* */ FT_LOCAL_DEF( FT_Error ) tt_size_reset( TT_Size size, FT_Bool only_height ) { TT_Face face; - FT_Size_Metrics* metrics; + FT_Size_Metrics* size_metrics; face = (TT_Face)size->root.face; @@ -1220,12 +1281,12 @@ size->ttmetrics.valid = FALSE; - metrics = &size->metrics; + size_metrics = &size->hinted_metrics; /* copy the result from base layer */ - *metrics = size->root.metrics; + *size_metrics = size->root.metrics; - if ( metrics->x_ppem < 1 || metrics->y_ppem < 1 ) + if ( size_metrics->x_ppem < 1 || size_metrics->y_ppem < 1 ) return FT_THROW( Invalid_PPem ); /* This bit flag, if set, indicates that the ppems must be */ @@ -1234,49 +1295,61 @@ /* */ if ( face->header.Flags & 8 ) { - metrics->ascender = - FT_PIX_ROUND( FT_MulFix( face->root.ascender, metrics->y_scale ) ); - metrics->descender = - FT_PIX_ROUND( FT_MulFix( face->root.descender, metrics->y_scale ) ); - metrics->height = - FT_PIX_ROUND( FT_MulFix( face->root.height, metrics->y_scale ) ); + /* the TT spec always asks for ROUND, not FLOOR or CEIL */ + size_metrics->ascender = FT_PIX_ROUND( + FT_MulFix( face->root.ascender, + size_metrics->y_scale ) ); + size_metrics->descender = FT_PIX_ROUND( + FT_MulFix( face->root.descender, + size_metrics->y_scale ) ); + size_metrics->height = FT_PIX_ROUND( + FT_MulFix( face->root.height, + size_metrics->y_scale ) ); } size->ttmetrics.valid = TRUE; if ( only_height ) + { + /* we must not recompute the scaling values here since */ + /* `tt_size_reset' was already called (with only_height = 0) */ return FT_Err_Ok; + } if ( face->header.Flags & 8 ) { - metrics->x_scale = FT_DivFix( metrics->x_ppem << 6, - face->root.units_per_EM ); - metrics->y_scale = FT_DivFix( metrics->y_ppem << 6, - face->root.units_per_EM ); - - metrics->max_advance = - FT_PIX_ROUND( FT_MulFix( face->root.max_advance_width, - metrics->x_scale ) ); + /* base scaling values on integer ppem values, */ + /* as mandated by the TrueType specification */ + size_metrics->x_scale = FT_DivFix( size_metrics->x_ppem << 6, + face->root.units_per_EM ); + size_metrics->y_scale = FT_DivFix( size_metrics->y_ppem << 6, + face->root.units_per_EM ); + + size_metrics->max_advance = FT_PIX_ROUND( + FT_MulFix( face->root.max_advance_width, + size_metrics->x_scale ) ); } /* compute new transformation */ - if ( metrics->x_ppem >= metrics->y_ppem ) + if ( size_metrics->x_ppem >= size_metrics->y_ppem ) { - size->ttmetrics.scale = metrics->x_scale; - size->ttmetrics.ppem = metrics->x_ppem; + size->ttmetrics.scale = size_metrics->x_scale; + size->ttmetrics.ppem = size_metrics->x_ppem; size->ttmetrics.x_ratio = 0x10000L; - size->ttmetrics.y_ratio = FT_DivFix( metrics->y_ppem, - metrics->x_ppem ); + size->ttmetrics.y_ratio = FT_DivFix( size_metrics->y_ppem, + size_metrics->x_ppem ); } else { - size->ttmetrics.scale = metrics->y_scale; - size->ttmetrics.ppem = metrics->y_ppem; - size->ttmetrics.x_ratio = FT_DivFix( metrics->x_ppem, - metrics->y_ppem ); + size->ttmetrics.scale = size_metrics->y_scale; + size->ttmetrics.ppem = size_metrics->y_ppem; + size->ttmetrics.x_ratio = FT_DivFix( size_metrics->x_ppem, + size_metrics->y_ppem ); size->ttmetrics.y_ratio = 0x10000L; } + size->metrics = size_metrics; + #ifdef TT_USE_BYTECODE_INTERPRETER size->cvt_ready = -1; #endif /* TT_USE_BYTECODE_INTERPRETER */ diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h index 65929e592..38fa30e4e 100644 --- a/src/truetype/ttobjs.h +++ b/src/truetype/ttobjs.h @@ -4,7 +4,7 @@ /* */ /* Objects manager (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -278,7 +278,8 @@ FT_BEGIN_HEADER /* we have our own copy of metrics so that we can modify */ /* it without affecting auto-hinting (when used) */ - FT_Size_Metrics metrics; + FT_Size_Metrics* metrics; /* for the current rendering mode */ + FT_Size_Metrics hinted_metrics; /* for the hinted rendering mode */ TT_Size_Metrics ttmetrics; diff --git a/src/truetype/ttpic.c b/src/truetype/ttpic.c index 66bd7e193..cdbb80639 100644 --- a/src/truetype/ttpic.c +++ b/src/truetype/ttpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for truetype module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttpic.h b/src/truetype/ttpic.h index 1410cd73c..df878ae6f 100644 --- a/src/truetype/ttpic.h +++ b/src/truetype/ttpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for truetype module. */ /* */ -/* Copyright 2009-2017 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c index 70ac15da4..d9526ad08 100644 --- a/src/truetype/ttpload.c +++ b/src/truetype/ttpload.c @@ -4,7 +4,7 @@ /* */ /* TrueType-specific tables loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -247,13 +247,13 @@ if ( pos2 > face->glyf_len ) { /* We try to sanitize the last `loca' entry. */ - if ( gindex == face->num_locations - 1 ) + if ( gindex == face->num_locations - 2 ) { FT_TRACE1(( "tt_face_get_location:" - " too large offset (0x%08lx) found for glyph index %ld,\n" + " too large size (%ld bytes) found for glyph index %ld,\n" " " - " truncating at the end of `glyf' table (0x%08lx)\n", - pos2, gindex + 1, face->glyf_len )); + " truncating at the end of `glyf' table to %ld bytes\n", + pos2 - pos1, gindex, face->glyf_len - pos1 )); pos2 = face->glyf_len; } else diff --git a/src/truetype/ttpload.h b/src/truetype/ttpload.h index 79079f345..fa1252724 100644 --- a/src/truetype/ttpload.h +++ b/src/truetype/ttpload.h @@ -4,7 +4,7 @@ /* */ /* TrueType-specific tables loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/truetype/ttsubpix.c b/src/truetype/ttsubpix.c index 5d803cde1..d94bcc8b5 100644 --- a/src/truetype/ttsubpix.c +++ b/src/truetype/ttsubpix.c @@ -4,7 +4,7 @@ /* */ /* TrueType Subpixel Hinting. */ /* */ -/* Copyright 2010-2017 by */ +/* Copyright 2010-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,12 +22,13 @@ #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_TAGS_H #include FT_OUTLINE_H -#include FT_TRUETYPE_DRIVER_H +#include FT_DRIVER_H #include "ttsubpix.h" -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY +#if defined( TT_USE_BYTECODE_INTERPRETER ) && \ + defined( TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY ) /*************************************************************************/ /* */ @@ -752,24 +753,24 @@ /* Does font name match rule family? */ - if ( strcmp( detected_font_name, rule_font_name ) == 0 ) + if ( ft_strcmp( detected_font_name, rule_font_name ) == 0 ) return TRUE; /* Is font name a wildcard ""? */ - if ( strcmp( rule_font_name, "" ) == 0 ) + if ( ft_strcmp( rule_font_name, "" ) == 0 ) return TRUE; /* Is font name contained in a class list? */ for ( i = 0; i < FAMILY_CLASS_RULES_SIZE; i++ ) { - if ( strcmp( FAMILY_CLASS_Rules[i].name, rule_font_name ) == 0 ) + if ( ft_strcmp( FAMILY_CLASS_Rules[i].name, rule_font_name ) == 0 ) { for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ ) { - if ( strcmp( FAMILY_CLASS_Rules[i].member[j], "" ) == 0 ) + if ( ft_strcmp( FAMILY_CLASS_Rules[i].member[j], "" ) == 0 ) continue; - if ( strcmp( FAMILY_CLASS_Rules[i].member[j], - detected_font_name ) == 0 ) + if ( ft_strcmp( FAMILY_CLASS_Rules[i].member[j], + detected_font_name ) == 0 ) return TRUE; } } @@ -787,24 +788,24 @@ /* Does font style match rule style? */ - if ( strcmp( detected_font_style, rule_font_style ) == 0 ) + if ( ft_strcmp( detected_font_style, rule_font_style ) == 0 ) return TRUE; /* Is font style a wildcard ""? */ - if ( strcmp( rule_font_style, "" ) == 0 ) + if ( ft_strcmp( rule_font_style, "" ) == 0 ) return TRUE; /* Is font style contained in a class list? */ for ( i = 0; i < STYLE_CLASS_RULES_SIZE; i++ ) { - if ( strcmp( STYLE_CLASS_Rules[i].name, rule_font_style ) == 0 ) + if ( ft_strcmp( STYLE_CLASS_Rules[i].name, rule_font_style ) == 0 ) { for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ ) { - if ( strcmp( STYLE_CLASS_Rules[i].member[j], "" ) == 0 ) + if ( ft_strcmp( STYLE_CLASS_Rules[i].member[j], "" ) == 0 ) continue; - if ( strcmp( STYLE_CLASS_Rules[i].member[j], - detected_font_style ) == 0 ) + if ( ft_strcmp( STYLE_CLASS_Rules[i].member[j], + detected_font_style ) == 0 ) return TRUE; } } @@ -905,7 +906,7 @@ { TT_Face face = loader->face; FT_String* family = face->root.family_name; - FT_UInt ppem = loader->size->metrics.x_ppem; + FT_UInt ppem = loader->size->metrics->x_ppem; FT_String* style = face->root.style_name; @@ -1000,12 +1001,14 @@ } } -#else /* !TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ +#else /* !(TT_USE_BYTECODE_INTERPRETER && */ + /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY) */ /* ANSI C doesn't like empty source files */ typedef int _tt_subpix_dummy; -#endif /* !TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ +#endif /* !(TT_USE_BYTECODE_INTERPRETER && */ + /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY) */ /* END */ diff --git a/src/truetype/ttsubpix.h b/src/truetype/ttsubpix.h index c68f97ff0..1070bb016 100644 --- a/src/truetype/ttsubpix.h +++ b/src/truetype/ttsubpix.h @@ -4,7 +4,7 @@ /* */ /* TrueType Subpixel Hinting. */ /* */ -/* Copyright 2010-2017 by */ +/* Copyright 2010-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/Jamfile b/src/type1/Jamfile index 6c10a31a1..b94b7d0aa 100644 --- a/src/type1/Jamfile +++ b/src/type1/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/type1 Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/type1/module.mk b/src/type1/module.mk index f299d6fe8..3fea5cc16 100644 --- a/src/type1/module.mk +++ b/src/type1/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/type1/rules.mk b/src/type1/rules.mk index 97bef288f..cb1a14286 100644 --- a/src/type1/rules.mk +++ b/src/type1/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c index 792ea2ff9..61053d9a6 100644 --- a/src/type1/t1afm.c +++ b/src/type1/t1afm.c @@ -4,7 +4,7 @@ /* */ /* AFM support for Type 1 fonts (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -24,6 +24,8 @@ #include "t1errors.h" +#ifndef T1_CONFIG_OPTION_NO_AFM + /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ @@ -402,5 +404,12 @@ return FT_Err_Ok; } +#else /* T1_CONFIG_OPTION_NO_AFM */ + + /* ANSI C doesn't like empty source files */ + typedef int _t1_afm_dummy; + +#endif /* T1_CONFIG_OPTION_NO_AFM */ + /* END */ diff --git a/src/type1/t1afm.h b/src/type1/t1afm.h index 9f62cd013..cb8d302b4 100644 --- a/src/type1/t1afm.h +++ b/src/type1/t1afm.h @@ -4,7 +4,7 @@ /* */ /* AFM support for Type 1 fonts (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index c2089947f..029b410b4 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -4,7 +4,7 @@ /* */ /* Type 1 driver interface (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -30,6 +30,8 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_HASH_H +#include FT_INTERNAL_POSTSCRIPT_PROPS_H +#include FT_DRIVER_H #include FT_SERVICE_MULTIPLE_MASTERS_H #include FT_SERVICE_GLYPH_DICT_H @@ -37,6 +39,7 @@ #include FT_SERVICE_POSTSCRIPT_NAME_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_SERVICE_POSTSCRIPT_INFO_H +#include FT_SERVICE_PROPERTIES_H #include FT_SERVICE_KERNING_H @@ -126,6 +129,7 @@ (FT_Get_MM_Var_Func) T1_Get_MM_Var, /* get_mm_var */ (FT_Set_Var_Design_Func)T1_Set_Var_Design, /* set_var_design */ (FT_Get_Var_Design_Func)T1_Get_Var_Design, /* get_var_design */ + (FT_Set_Instance_Func) T1_Reset_MM_Blend, /* set_instance */ (FT_Get_Var_Blend_Func) NULL, /* get_var_blend */ (FT_Done_Blend_Func) T1_Done_Blend /* done_blend */ @@ -613,6 +617,18 @@ #endif + /* + * PROPERTY SERVICE + * + */ + + FT_DEFINE_SERVICE_PROPERTIESREC( + t1_service_properties, + + (FT_Properties_SetFunc)ps_property_set, /* set_property */ + (FT_Properties_GetFunc)ps_property_get ) /* get_property */ + + /* * SERVICE LIST * @@ -624,6 +640,7 @@ { FT_SERVICE_ID_GLYPH_DICT, &t1_service_glyph_dict }, { FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_TYPE_1 }, { FT_SERVICE_ID_POSTSCRIPT_INFO, &t1_service_ps_info }, + { FT_SERVICE_ID_PROPERTIES, &t1_service_properties }, #ifndef T1_CONFIG_OPTION_NO_AFM { FT_SERVICE_ID_KERNING, &t1_service_kerning }, @@ -713,7 +730,7 @@ FT_MODULE_DRIVER_SCALABLE | FT_MODULE_DRIVER_HAS_HINTER, - sizeof ( FT_DriverRec ), + sizeof ( PS_DriverRec ), "type1", 0x10000L, diff --git a/src/type1/t1driver.h b/src/type1/t1driver.h index 292786448..2b1507233 100644 --- a/src/type1/t1driver.h +++ b/src/type1/t1driver.h @@ -4,7 +4,7 @@ /* */ /* High-level Type 1 driver interface (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1errors.h b/src/type1/t1errors.h index 492dbb4a4..9e0151b95 100644 --- a/src/type1/t1errors.h +++ b/src/type1/t1errors.h @@ -4,7 +4,7 @@ /* */ /* Type 1 error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index aaf19b6dc..87d40e756 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -4,7 +4,7 @@ /* */ /* Type 1 Glyph Loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,6 +23,8 @@ #include FT_INTERNAL_STREAM_H #include FT_OUTLINE_H #include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_CFF_TYPES_H +#include FT_DRIVER_H #include "t1errors.h" @@ -37,37 +39,28 @@ #define FT_COMPONENT trace_t1gload - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /********** *********/ - /********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/ - /********** *********/ - /********** The following code is in charge of computing *********/ - /********** the maximum advance width of the font. It *********/ - /********** quickly processes each glyph charstring to *********/ - /********** extract the value from either a `sbw' or `seac' *********/ - /********** operator. *********/ - /********** *********/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - static FT_Error T1_Parse_Glyph_And_Get_Char_String( T1_Decoder decoder, FT_UInt glyph_index, - FT_Data* char_string ) + FT_Data* char_string, + FT_Bool* force_scaling ) { T1_Face face = (T1_Face)decoder->builder.face; T1_Font type1 = &face->type1; FT_Error error = FT_Err_Ok; + PSAux_Service psaux = (PSAux_Service)face->psaux; + const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs; + PS_Decoder psdecoder; + #ifdef FT_CONFIG_OPTION_INCREMENTAL FT_Incremental_InterfaceRec *inc = face->root.internal->incremental_interface; #endif +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face ); +#endif decoder->font_matrix = type1->font_matrix; decoder->font_offset = type1->font_offset; @@ -90,9 +83,56 @@ } if ( !error ) - error = decoder->funcs.parse_charstrings( - decoder, (FT_Byte*)char_string->pointer, - (FT_UInt)char_string->length ); + { + /* choose which renderer to use */ +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + if ( driver->hinting_engine == FT_HINTING_FREETYPE || + decoder->builder.metrics_only ) + error = decoder_funcs->parse_charstrings_old( + decoder, + (FT_Byte*)char_string->pointer, + (FT_UInt)char_string->length ); +#else + if ( decoder->builder.metrics_only ) + error = decoder_funcs->parse_metrics( + decoder, + (FT_Byte*)char_string->pointer, + (FT_UInt)char_string->length ); +#endif + else + { + CFF_SubFontRec subfont; + + + psaux->ps_decoder_init( &psdecoder, decoder, TRUE ); + + psaux->t1_make_subfont( FT_FACE( face ), + &face->type1.private_dict, &subfont ); + psdecoder.current_subfont = &subfont; + + error = decoder_funcs->parse_charstrings( + &psdecoder, + (FT_Byte*)char_string->pointer, + (FT_ULong)char_string->length ); + + /* Adobe's engine uses 16.16 numbers everywhere; */ + /* as a consequence, glyphs larger than 2000ppem get rejected */ + if ( FT_ERR_EQ( error, Glyph_Too_Big ) ) + { + /* this time, we retry unhinted and scale up the glyph later on */ + /* (the engine uses and sets the hardcoded value 0x10000 / 64 = */ + /* 0x400 for both `x_scale' and `y_scale' in this case) */ + ((T1_GlyphSlot)decoder->builder.glyph)->hint = FALSE; + + *force_scaling = TRUE; + + error = decoder_funcs->parse_charstrings( + &psdecoder, + (FT_Byte*)char_string->pointer, + (FT_ULong)char_string->length ); + } + } + } #ifdef FT_CONFIG_OPTION_INCREMENTAL @@ -126,8 +166,10 @@ FT_UInt glyph_index ) { FT_Data glyph_data; - FT_Error error = T1_Parse_Glyph_And_Get_Char_String( - decoder, glyph_index, &glyph_data ); + FT_Bool force_scaling = FALSE; + FT_Error error = T1_Parse_Glyph_And_Get_Char_String( + decoder, glyph_index, &glyph_data, + &force_scaling ); #ifdef FT_CONFIG_OPTION_INCREMENTAL @@ -149,6 +191,23 @@ } + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /********** *********/ + /********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/ + /********** *********/ + /********** The following code is in charge of computing *********/ + /********** the maximum advance width of the font. It *********/ + /********** quickly processes each glyph charstring to *********/ + /********** extract the value from either a `sbw' or `seac' *********/ + /********** operator. *********/ + /********** *********/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL_DEF( FT_Error ) T1_Compute_Max_Advance( T1_Face face, FT_Pos* max_advance ) @@ -278,6 +337,8 @@ T1_DecoderRec decoder; T1_Face face = (T1_Face)t1glyph->face; FT_Bool hinting; + FT_Bool scaled; + FT_Bool force_scaling = FALSE; T1_Font type1 = &face->type1; PSAux_Service psaux = (PSAux_Service)face->psaux; const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs; @@ -325,7 +386,10 @@ 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; t1glyph->format = FT_GLYPH_FORMAT_OUTLINE; error = decoder_funcs->init( &decoder, @@ -355,13 +419,15 @@ /* now load the unscaled outline */ error = T1_Parse_Glyph_And_Get_Char_String( &decoder, glyph_index, - &glyph_data ); + &glyph_data, + &force_scaling ); if ( error ) goto Exit; #ifdef FT_CONFIG_OPTION_INCREMENTAL glyph_data_loaded = 1; #endif + hinting = glyph->hint; font_matrix = decoder.font_matrix; font_offset = decoder.font_offset; @@ -451,7 +517,7 @@ } #endif - if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ) + if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || force_scaling ) { /* scale the outline and the metrics */ FT_Int n; diff --git a/src/type1/t1gload.h b/src/type1/t1gload.h index cc4d5e734..72ef76f6a 100644 --- a/src/type1/t1gload.h +++ b/src/type1/t1gload.h @@ -4,7 +4,7 @@ /* */ /* Type 1 Glyph Loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1load.c b/src/type1/t1load.c index f5c661f7d..9dfa637a6 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -4,7 +4,7 @@ /* */ /* Type 1 font loader (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -329,8 +329,8 @@ for ( i = 0; i < mmaster.num_axis; i++ ) { mmvar->axis[i].name = mmaster.axis[i].name; - mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum); - mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum); + mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum ); + mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum ); mmvar->axis[i].def = ( mmvar->axis[i].minimum + mmvar->axis[i].maximum ) / 2; /* Does not apply. But this value is in range */ @@ -366,14 +366,16 @@ } - FT_LOCAL_DEF( FT_Error ) - T1_Set_MM_Blend( T1_Face face, + static FT_Error + t1_set_mm_blend( T1_Face face, FT_UInt num_coords, FT_Fixed* coords ) { PS_Blend blend = face->blend; FT_UInt n, m; + FT_Bool have_diff = 0; + if ( !blend ) return FT_THROW( Invalid_Argument ); @@ -405,9 +407,36 @@ result = FT_MulFix( result, factor ); } - blend->weight_vector[n] = result; + + if ( blend->weight_vector[n] != result ) + { + blend->weight_vector[n] = result; + have_diff = 1; + } } + /* return value -1 indicates `no change' */ + return have_diff ? FT_Err_Ok : -1; + } + + + FT_LOCAL_DEF( FT_Error ) + T1_Set_MM_Blend( T1_Face face, + FT_UInt num_coords, + FT_Fixed* coords ) + { + FT_Error error; + + + error = t1_set_mm_blend( face, num_coords, coords ); + if ( error ) + return error; + + if ( num_coords ) + face->root.face_flags |= FT_FACE_FLAG_VARIATION; + else + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; + return FT_Err_Ok; } @@ -452,6 +481,7 @@ FT_UInt num_coords, FT_Long* coords ) { + FT_Error error; PS_Blend blend = face->blend; FT_UInt n, p; FT_Fixed final_blends[T1_MAX_MM_DESIGNS]; @@ -518,7 +548,28 @@ final_blends[n] = the_blend; } - return T1_Set_MM_Blend( face, blend->num_axis, final_blends ); + error = t1_set_mm_blend( face, blend->num_axis, final_blends ); + if ( error ) + return error; + + if ( num_coords ) + face->root.face_flags |= FT_FACE_FLAG_VARIATION; + else + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; + + return FT_Err_Ok; + } + + + /* MM fonts don't have named instances, so only the design is reset */ + + FT_LOCAL_DEF( FT_Error ) + T1_Reset_MM_Blend( T1_Face face, + FT_UInt instance_index ) + { + FT_UNUSED( instance_index ); + + return T1_Set_MM_Blend( face, 0, NULL ); } @@ -1266,7 +1317,7 @@ if ( ft_isdigit( *cur ) || *cur == '[' ) { T1_Encoding encode = &face->type1.encoding; - FT_Int count, n; + FT_Int count, array_size, n; PS_Table char_table = &loader->encoding_table; FT_Memory memory = parser->root.memory; FT_Error error; @@ -1283,13 +1334,12 @@ else count = (FT_Int)T1_ToInt( parser ); - /* only composite fonts (which we don't support) */ - /* can have larger values */ + array_size = count; if ( count > 256 ) { - FT_ERROR(( "parse_encoding: invalid encoding array size\n" )); - parser->root.error = FT_THROW( Invalid_File_Format ); - return; + FT_TRACE2(( "parse_encoding:" + " only using first 256 encoding array entries\n" )); + array_size = 256; } T1_Skip_Spaces( parser ); @@ -1305,18 +1355,18 @@ } /* we use a T1_Table to store our charnames */ - loader->num_chars = encode->num_chars = count; - if ( FT_NEW_ARRAY( encode->char_index, count ) || - FT_NEW_ARRAY( encode->char_name, count ) || + loader->num_chars = encode->num_chars = array_size; + if ( FT_NEW_ARRAY( encode->char_index, array_size ) || + FT_NEW_ARRAY( encode->char_name, array_size ) || FT_SET_ERROR( psaux->ps_table_funcs->init( - char_table, count, memory ) ) ) + char_table, array_size, memory ) ) ) { parser->root.error = error; return; } /* We need to `zero' out encoding_table.elements */ - for ( n = 0; n < count; n++ ) + for ( n = 0; n < array_size; n++ ) { char* notdef = (char *)".notdef"; @@ -1409,11 +1459,14 @@ len = (FT_UInt)( parser->root.cursor - cur ); - parser->root.error = T1_Add_Table( char_table, charcode, - cur, len + 1 ); - if ( parser->root.error ) - return; - char_table->elements[charcode][len] = '\0'; + if ( n < array_size ) + { + parser->root.error = T1_Add_Table( char_table, charcode, + cur, len + 1 ); + if ( parser->root.error ) + return; + char_table->elements[charcode][len] = '\0'; + } n++; } @@ -2440,6 +2493,24 @@ type1->encoding.num_chars = loader.num_chars; } + /* some sanitizing to avoid overflows later on; */ + /* the upper limits are ad-hoc values */ + if ( priv->blue_shift > 1000 || priv->blue_shift < 0 ) + { + FT_TRACE2(( "T1_Open_Face:" + " setting unlikely BlueShift value %d to default (7)\n", + priv->blue_shift )); + priv->blue_shift = 7; + } + + if ( priv->blue_fuzz > 1000 || priv->blue_fuzz < 0 ) + { + FT_TRACE2(( "T1_Open_Face:" + " setting unlikely BlueFuzz value %d to default (1)\n", + priv->blue_fuzz )); + priv->blue_fuzz = 1; + } + Exit: t1_done_loader( &loader ); return error; diff --git a/src/type1/t1load.h b/src/type1/t1load.h index 2d86984f0..03be3f7f9 100644 --- a/src/type1/t1load.h +++ b/src/type1/t1load.h @@ -4,7 +4,7 @@ /* */ /* Type 1 font loader (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -89,6 +89,10 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Long* coords ); + FT_LOCAL( FT_Error ) + T1_Reset_MM_Blend( T1_Face face, + FT_UInt instance_index ); + FT_LOCAL( FT_Error ) T1_Get_Var_Design( T1_Face face, FT_UInt num_coords, diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 5637035c8..7333c4c95 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -4,7 +4,7 @@ /* */ /* Type 1 objects manager (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,6 +21,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_IDS_H +#include FT_DRIVER_H #include "t1gload.h" #include "t1load.h" @@ -49,9 +50,6 @@ /* */ /* SIZE FUNCTIONS */ /* */ - /* note that we store the global hints in the size's "internal" root */ - /* field */ - /* */ /*************************************************************************/ @@ -77,16 +75,16 @@ T1_Size size = (T1_Size)t1size; - if ( size->root.internal ) + if ( t1size->internal->module_data ) { PSH_Globals_Funcs funcs; funcs = T1_Size_Get_Globals_Funcs( size ); if ( funcs ) - funcs->destroy( (PSH_Globals)size->root.internal ); + funcs->destroy( (PSH_Globals)t1size->internal->module_data ); - size->root.internal = NULL; + t1size->internal->module_data = NULL; } } @@ -108,7 +106,7 @@ error = funcs->create( size->root.face->memory, &face->type1.private_dict, &globals ); if ( !error ) - size->root.internal = (FT_Size_Internal)(void*)globals; + t1size->internal->module_data = globals; } return error; @@ -126,7 +124,7 @@ FT_Request_Metrics( size->root.face, req ); if ( funcs ) - funcs->set_scale( (PSH_Globals)size->root.internal, + funcs->set_scale( (PSH_Globals)t1size->internal->module_data, size->root.metrics.x_scale, size->root.metrics.y_scale, 0, 0 ); @@ -382,7 +380,7 @@ /* simplistic and might get some things wrong. For a full-featured */ /* algorithm you might have a look at the whitepaper given at */ /* */ - /* http://blogs.msdn.com/text/archive/2007/04/23/wpf-font-selection-model.aspx */ + /* https://blogs.msdn.com/text/archive/2007/04/23/wpf-font-selection-model.aspx */ /* get style name -- be careful, some broken fonts only */ /* have a `/FontName' dictionary entry! */ @@ -558,12 +556,6 @@ if ( clazz ) error = FT_CMap_New( clazz, NULL, &charmap, NULL ); - -#if 0 - /* Select default charmap */ - if (root->num_charmaps) - root->charmap = root->charmaps[0]; -#endif } } @@ -587,9 +579,42 @@ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF( FT_Error ) - T1_Driver_Init( FT_Module driver ) + T1_Driver_Init( FT_Module module ) { - FT_UNUSED( driver ); + PS_Driver driver = (PS_Driver)module; + + FT_UInt32 seed; + + + /* set default property values, cf. `ftt1drv.h' */ +#ifdef T1_CONFIG_OPTION_OLD_ENGINE + driver->hinting_engine = FT_HINTING_FREETYPE; +#else + driver->hinting_engine = FT_HINTING_ADOBE; +#endif + + driver->no_stem_darkening = TRUE; + + driver->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1; + driver->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1; + driver->darken_params[2] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2; + driver->darken_params[3] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2; + driver->darken_params[4] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3; + driver->darken_params[5] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3; + driver->darken_params[6] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4; + driver->darken_params[7] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4; + + /* compute random seed from some memory addresses */ + seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^ + (FT_Offset)(char*)&module ^ + (FT_Offset)(char*)module->memory ); + seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 ); + + driver->random_seed = (FT_Int32)seed; + if ( driver->random_seed < 0 ) + driver->random_seed = -driver->random_seed; + else if ( driver->random_seed == 0 ) + driver->random_seed = 123456789; return FT_Err_Ok; } diff --git a/src/type1/t1objs.h b/src/type1/t1objs.h index 39d26bf8b..8298e036f 100644 --- a/src/type1/t1objs.h +++ b/src/type1/t1objs.h @@ -4,7 +4,7 @@ /* */ /* Type 1 objects manager (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -120,12 +120,12 @@ FT_BEGIN_HEADER FT_Bool hint; FT_Bool scaled; - FT_Int max_points; - FT_Int max_contours; - FT_Fixed x_scale; FT_Fixed y_scale; + FT_Int max_points; + FT_Int max_contours; + } T1_GlyphSlotRec; diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c index 18dd26434..8e201e5ef 100644 --- a/src/type1/t1parse.c +++ b/src/type1/t1parse.c @@ -4,7 +4,7 @@ /* */ /* Type 1 parser (body). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1parse.h b/src/type1/t1parse.h index 3396680d1..4ac82ae91 100644 --- a/src/type1/t1parse.h +++ b/src/type1/t1parse.h @@ -4,7 +4,7 @@ /* */ /* Type 1 parser (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/t1tokens.h b/src/type1/t1tokens.h index ca0c55f90..43a65d88e 100644 --- a/src/type1/t1tokens.h +++ b/src/type1/t1tokens.h @@ -4,7 +4,7 @@ /* */ /* Type 1 tokenizer (specification). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type1/type1.c b/src/type1/type1.c index bfe0e439f..72eff59bf 100644 --- a/src/type1/type1.c +++ b/src/type1/type1.c @@ -4,7 +4,7 @@ /* */ /* FreeType Type 1 driver component (body only). */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,17 +17,14 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "t1parse.c" -#include "t1load.c" -#include "t1objs.c" -#include "t1driver.c" -#include "t1gload.c" -#ifndef T1_CONFIG_OPTION_NO_AFM #include "t1afm.c" -#endif +#include "t1driver.c" +#include "t1gload.c" +#include "t1load.c" +#include "t1objs.c" +#include "t1parse.c" /* END */ diff --git a/src/type42/Jamfile b/src/type42/Jamfile index b826bbc46..b98de05a7 100644 --- a/src/type42/Jamfile +++ b/src/type42/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/type42 Jamfile # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/type42/module.mk b/src/type42/module.mk index 2f5280680..3d4732bb6 100644 --- a/src/type42/module.mk +++ b/src/type42/module.mk @@ -3,7 +3,7 @@ # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/type42/rules.mk b/src/type42/rules.mk index d7e896501..9325d3898 100644 --- a/src/type42/rules.mk +++ b/src/type42/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2002-2017 by +# Copyright 2002-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/type42/t42drivr.c b/src/type42/t42drivr.c index 366cfb3a1..f579b2708 100644 --- a/src/type42/t42drivr.c +++ b/src/type42/t42drivr.c @@ -4,7 +4,7 @@ /* */ /* High-level Type 42 driver interface (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/t42drivr.h b/src/type42/t42drivr.h index 1ac4a0a1a..3667f3e06 100644 --- a/src/type42/t42drivr.h +++ b/src/type42/t42drivr.h @@ -4,7 +4,7 @@ /* */ /* High-level Type 42 driver interface (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/t42error.h b/src/type42/t42error.h index fda92abf5..e3978a760 100644 --- a/src/type42/t42error.h +++ b/src/type42/t42error.h @@ -4,7 +4,7 @@ /* */ /* Type 42 error codes (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c index 87e5206b7..66e5c4038 100644 --- a/src/type42/t42objs.c +++ b/src/type42/t42objs.c @@ -4,7 +4,7 @@ /* */ /* Type 42 objects manager (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -394,12 +394,6 @@ if ( clazz ) error = FT_CMap_New( clazz, NULL, &charmap, NULL ); - -#if 0 - /* Select default charmap */ - if ( root->num_charmaps ) - root->charmap = root->charmaps[0]; -#endif } } Exit: diff --git a/src/type42/t42objs.h b/src/type42/t42objs.h index eb4c5bf69..3bad5135e 100644 --- a/src/type42/t42objs.h +++ b/src/type42/t42objs.h @@ -4,7 +4,7 @@ /* */ /* Type 42 objects manager (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c index e7c6770bd..4813d1f3f 100644 --- a/src/type42/t42parse.c +++ b/src/type42/t42parse.c @@ -4,7 +4,7 @@ /* */ /* Type 42 font parser (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/t42parse.h b/src/type42/t42parse.h index 7a68606f2..f35d23de6 100644 --- a/src/type42/t42parse.h +++ b/src/type42/t42parse.h @@ -4,7 +4,7 @@ /* */ /* Type 42 font parser (specification). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/t42types.h b/src/type42/t42types.h index 2306ab6c7..d0aa2de57 100644 --- a/src/type42/t42types.h +++ b/src/type42/t42types.h @@ -4,7 +4,7 @@ /* */ /* Type 42 font data types (specification only). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/type42/type42.c b/src/type42/type42.c index 4e7c9d1a4..6a89cfbed 100644 --- a/src/type42/type42.c +++ b/src/type42/type42.c @@ -4,7 +4,7 @@ /* */ /* FreeType Type 42 driver component. */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -15,11 +15,13 @@ /* */ /***************************************************************************/ -#define FT_MAKE_OPTION_SINGLE_OBJECT +#define FT_MAKE_OPTION_SINGLE_OBJECT #include + +#include "t42drivr.c" #include "t42objs.c" #include "t42parse.c" -#include "t42drivr.c" + /* END */ diff --git a/src/winfonts/Jamfile b/src/winfonts/Jamfile index 52aa7f936..4385e3b39 100644 --- a/src/winfonts/Jamfile +++ b/src/winfonts/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/winfonts Jamfile # -# Copyright 2001-2017 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/winfonts/fnterrs.h b/src/winfonts/fnterrs.h index 4251021a7..3a86af5aa 100644 --- a/src/winfonts/fnterrs.h +++ b/src/winfonts/fnterrs.h @@ -4,7 +4,7 @@ /* */ /* Win FNT/FON error codes (specification only). */ /* */ -/* Copyright 2001-2017 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/winfonts/module.mk b/src/winfonts/module.mk index ffc53a19f..13f9077cf 100644 --- a/src/winfonts/module.mk +++ b/src/winfonts/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/winfonts/rules.mk b/src/winfonts/rules.mk index 73e825d9a..d694d1a77 100644 --- a/src/winfonts/rules.mk +++ b/src/winfonts/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2017 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index 9811fbb05..36bd3148d 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -4,7 +4,7 @@ /* */ /* FreeType font driver for Windows FNT/FON files */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* Copyright 2003 Huw D M Davies for Codeweavers */ /* Copyright 2007 Dmitry Timoshkov for Codeweavers */ @@ -859,10 +859,6 @@ NULL ); if ( error ) goto Fail; - - /* Select default charmap */ - if ( root->num_charmaps ) - root->charmap = root->charmaps[0]; } /* set up remaining flags */ @@ -1095,7 +1091,7 @@ /* note: since glyphs are stored in columns and not in rows we */ /* can't use ft_glyphslot_set_bitmap */ - if ( FT_ALLOC_MULT( bitmap->buffer, pitch, bitmap->rows ) ) + if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, pitch ) ) goto Exit; column = (FT_Byte*)bitmap->buffer; diff --git a/src/winfonts/winfnt.h b/src/winfonts/winfnt.h index 884b645a2..4885c9d74 100644 --- a/src/winfonts/winfnt.h +++ b/src/winfonts/winfnt.h @@ -4,7 +4,7 @@ /* */ /* FreeType font driver for Windows FNT/FON files */ /* */ -/* Copyright 1996-2017 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* Copyright 2007 Dmitry Timoshkov for Codeweavers */ /* */ diff --git a/vms_make.com b/vms_make.com index ea5631826..7b8a49b3b 100644 --- a/vms_make.com +++ b/vms_make.com @@ -1,6 +1,6 @@ -$! make Freetype2 under OpenVMS +$! make FreeType 2 under OpenVMS $! -$! Copyright 2003-2017 by +$! Copyright 2003-2018 by $! David Turner, Robert Wilhelm, and Werner Lemberg. $! $! This file is part of the FreeType project, and may only be used, modified, @@ -10,7 +10,7 @@ $! indicate that you have read the license and understand and accept it $! fully. $! $! -$! External libraries (like Freetype, XPM, etc.) are supported via the +$! External libraries (like FreeType, XPM, etc.) are supported via the $! config file VMSLIB.DAT. Please check the sample file, which is part of this $! distribution, for the information you need to provide $! @@ -26,12 +26,12 @@ $! In case of problems with the install you might contact me at $! zinser@zinser.no-ip.info (preferred) or $! zinser@sysdev.deutsche-boerse.com (work) $! -$! Make procedure history for Freetype2 +$! Make procedure history for FreeType 2 $! $!------------------------------------------------------------------------------ $! Version history $! 0.01 20040401 First version to receive a number -$! 0.02 20041030 Add error handling, Freetype 2.1.9 +$! 0.02 20041030 Add error handling, FreeType 2.1.9 $! $ on error then goto err_exit $ true = 1 @@ -128,7 +128,7 @@ $ERR_LIB: $ write sys$output "Error reading config file vmslib.dat" $ goto err_exit $FT2_ERR: -$ write sys$output "Could not locate Freetype 2 include files" +$ write sys$output "Could not locate FreeType 2 include files" $ goto err_exit $ERR_EXIT: $ set message/facil/ident/sever/text @@ -356,8 +356,8 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.builds.vms],[--.include],[--.src.base]) OBJS=ftbase.obj,ftinit.obj,ftglyph.obj,ftdebug.obj,ftbdf.obj,ftmm.obj,\ - fttype1.obj,ftfntfmt.obj,ftpfr.obj,ftstroke.obj,ftwinfnt.obj,ftbbox.obj,\ - ftbitmap.obj,ftlcdfil.obj,ftgasp.obj + fttype1.obj,ftpfr.obj,ftstroke.obj,ftwinfnt.obj,ftbbox.obj,\ + ftbitmap.obj,ftgasp.obj all : $(OBJS) library [--.lib]freetype.olb $(OBJS) @@ -1070,7 +1070,7 @@ $ then $ type/out=vmslib.dat sys$input ! ! This is a simple driver file with information used by vms_make.com to -! check if external libraries (like t1lib and freetype) are available on +! check if external libraries (like t1lib and FreeType) are available on ! the system. ! ! Layout of the file: @@ -1148,7 +1148,7 @@ $ if f$locate("EXE",libtype) .lt. f$length(libtype) then lqual = "/share" $ write optf libloc , lqual $ if (f$trnlnm("topt") .nes. "") then write topt libloc , lqual $! -$! Nasty hack to get the freetype includes to work +$! Nasty hack to get the FreeType includes to work $! $ ft2def = false $ if ((libname .eqs. "FREETYPE") .and. -