diff options
Diffstat (limited to 'Build/source/libs/graphite2')
17 files changed, 120 insertions, 36 deletions
diff --git a/Build/source/libs/graphite2/ChangeLog b/Build/source/libs/graphite2/ChangeLog index b1f9119ae12..10c5e6eb1c7 100644 --- a/Build/source/libs/graphite2/ChangeLog +++ b/Build/source/libs/graphite2/ChangeLog @@ -1,3 +1,8 @@ +2020-04-10 Akira Kakuto <kakuto@w32tex.org> + + Import graphite2-1.3.14. + * version.ac: Adjusted. + 2018-12-21 Akira Kakuto <kakuto@fuk.kindai.ac.jp> Import graphite2-1.3.13. diff --git a/Build/source/libs/graphite2/TLpatches/ChangeLog b/Build/source/libs/graphite2/TLpatches/ChangeLog index 30c3417f6f7..b3ed08c04b9 100644 --- a/Build/source/libs/graphite2/TLpatches/ChangeLog +++ b/Build/source/libs/graphite2/TLpatches/ChangeLog @@ -1,3 +1,8 @@ +2020-04-10 Akira Kakuto <kakuto@w32tex.org> + + Imported graphite2-1.3.14 source tree from: + http://sourceforge.net/projects/silgraphite/files/graphite2/ + 2018-12-21 Akira Kakuto <kakuto@fuk.kindai.ac.jp> Imported graphite2-1.3.13 source tree from: diff --git a/Build/source/libs/graphite2/TLpatches/TL-Changes b/Build/source/libs/graphite2/TLpatches/TL-Changes index 2f56db0f1cc..2c2b402e2b9 100644 --- a/Build/source/libs/graphite2/TLpatches/TL-Changes +++ b/Build/source/libs/graphite2/TLpatches/TL-Changes @@ -1,4 +1,4 @@ -Changes applied to the graphite2-1.3.13/ tree as obtained from: +Changes applied to the graphite2-1.3.14/ tree as obtained from: http://sourceforge.net/projects/silgraphite/files/graphite2/ Removed setup.py diff --git a/Build/source/libs/graphite2/configure b/Build/source/libs/graphite2/configure index 62316e40d6e..cf704da8e46 100755 --- a/Build/source/libs/graphite2/configure +++ b/Build/source/libs/graphite2/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for graphite2 (TeX Live) 1.3.13. +# Generated by GNU Autoconf 2.69 for graphite2 (TeX Live) 1.3.14. # # Report bugs to <tex-k@tug.org>. # @@ -579,8 +579,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='graphite2 (TeX Live)' PACKAGE_TARNAME='graphite2--tex-live-' -PACKAGE_VERSION='1.3.13' -PACKAGE_STRING='graphite2 (TeX Live) 1.3.13' +PACKAGE_VERSION='1.3.14' +PACKAGE_STRING='graphite2 (TeX Live) 1.3.14' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1253,7 +1253,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures graphite2 (TeX Live) 1.3.13 to adapt to many kinds of systems. +\`configure' configures graphite2 (TeX Live) 1.3.14 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1320,7 +1320,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of graphite2 (TeX Live) 1.3.13:";; + short | recursive ) echo "Configuration of graphite2 (TeX Live) 1.3.14:";; esac cat <<\_ACEOF @@ -1418,7 +1418,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -graphite2 (TeX Live) configure 1.3.13 +graphite2 (TeX Live) configure 1.3.14 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1557,7 +1557,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by graphite2 (TeX Live) $as_me 1.3.13, which was +It was created by graphite2 (TeX Live) $as_me 1.3.14, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3481,7 +3481,7 @@ fi # Define the identity of the package. PACKAGE='graphite2--tex-live-' - VERSION='1.3.13' + VERSION='1.3.14' cat >>confdefs.h <<_ACEOF @@ -6544,7 +6544,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by graphite2 (TeX Live) $as_me 1.3.13, which was +This file was extended by graphite2 (TeX Live) $as_me 1.3.14, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6610,7 +6610,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -graphite2 (TeX Live) config.status 1.3.13 +graphite2 (TeX Live) config.status 1.3.14 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/graphite2/graphite2-src/ChangeLog b/Build/source/libs/graphite2/graphite2-src/ChangeLog index ac8b23aa1ad..e36110e1c18 100644 --- a/Build/source/libs/graphite2/graphite2-src/ChangeLog +++ b/Build/source/libs/graphite2/graphite2-src/ChangeLog @@ -1,3 +1,9 @@ +1.3.14 + . Bug fixes + . Allow features to be hidden (for aliases) + . Move to python3 + . Rename doc files from .txt to .asc + 1.3.13 . Resolve minor spacing issue in rtl non-overlap kerning . python3 for graphite.py diff --git a/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h b/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h index 3e8214d46b5..fe569295a53 100644 --- a/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h +++ b/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h @@ -30,7 +30,7 @@ #define GR2_VERSION_MAJOR 1 #define GR2_VERSION_MINOR 3 -#define GR2_VERSION_BUGFIX 13 +#define GR2_VERSION_BUGFIX 14 #ifdef __cplusplus extern "C" diff --git a/Build/source/libs/graphite2/graphite2-src/src/CMakeLists.txt b/Build/source/libs/graphite2/graphite2-src/src/CMakeLists.txt index 389cf5a2389..b6ac26bfc2f 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/CMakeLists.txt +++ b/Build/source/libs/graphite2/graphite2-src/src/CMakeLists.txt @@ -111,7 +111,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") add_definitions(-mfpmath=sse -msse2) endif() if (CMAKE_COMPILER_IS_GNUCXX) - add_definitions(-Wdouble-promotion) + add_definitions(-Wno-class-memaccess -Wdouble-promotion) endif() message(STATUS "Compiler ID is: ${CMAKE_CXX_COMPILER_ID}") if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") @@ -136,9 +136,12 @@ endif() if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") set_target_properties(graphite2 PROPERTIES - COMPILE_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wimplicit-fallthrough -Wendif-labels -Wshadow -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -mfpmath=sse -msse2" + COMPILE_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wimplicit-fallthrough -Wendif-labels -Wshadow -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" LINK_FLAGS "-nodefaultlibs" LINKER_LANGUAGE C) + if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86|i.86") + add_definitions(-mfpmath=sse -msse2) + endif() target_link_libraries(graphite2 c) include(Graphite) nolib_test(stdc++ $<TARGET_SONAME_FILE:graphite2>) diff --git a/Build/source/libs/graphite2/graphite2-src/src/Code.cpp b/Build/source/libs/graphite2/graphite2-src/src/Code.cpp index 5cff6b534ea..ec5ab298ca4 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/Code.cpp +++ b/Build/source/libs/graphite2/graphite2-src/src/Code.cpp @@ -101,6 +101,7 @@ private: bool valid_upto(const uint16 limit, const uint16 x) const throw(); bool test_context() const throw(); bool test_ref(int8 index) const throw(); + bool test_attr(attrCode attr) const throw(); void failure(const status_t s) const throw() { _code.failure(s); } Code & _code; @@ -381,6 +382,7 @@ opcode Machine::Code::decoder::fetch_opcode(const byte * bc) valid_upto(gr_slatMax, bc[0]); if (attrCode(bc[0]) == gr_slatUserDefn) // use IATTR for user attributes failure(out_of_range_data); + test_attr(attrCode(bc[0])); test_context(); break; case IATTR_SET_SLOT : @@ -388,6 +390,7 @@ opcode Machine::Code::decoder::fetch_opcode(const byte * bc) failure(underfull_stack); if (valid_upto(gr_slatMax, bc[0])) valid_upto(_max.attrid[bc[0]], bc[1]); + test_attr(attrCode(bc[0])); test_context(); break; case PUSH_SLOT_ATTR : @@ -396,6 +399,7 @@ opcode Machine::Code::decoder::fetch_opcode(const byte * bc) test_ref(int8(bc[1])); if (attrCode(bc[0]) == gr_slatUserDefn) // use IATTR for user attributes failure(out_of_range_data); + test_attr(attrCode(bc[0])); break; case PUSH_GLYPH_ATTR_OBS : case PUSH_ATT_TO_GATTR_OBS : @@ -422,6 +426,7 @@ opcode Machine::Code::decoder::fetch_opcode(const byte * bc) test_ref(int8(bc[1])); valid_upto(_max.attrid[bc[0]], bc[2]); } + test_attr(attrCode(bc[0])); break; case PUSH_IGLYPH_ATTR :// not implemented ++_stack_depth; @@ -441,6 +446,7 @@ opcode Machine::Code::decoder::fetch_opcode(const byte * bc) failure(underfull_stack); if (valid_upto(gr_slatMax, bc[0])) valid_upto(_max.attrid[bc[0]], bc[1]); + test_attr(attrCode(bc[0])); test_context(); break; case PUSH_PROC_STATE : // dummy: dp[0] no check necessary @@ -681,7 +687,15 @@ bool Machine::Code::decoder::test_ref(int8 index) const throw() } } else - return valid_upto(_max.rule_length, _slotref + _max.pre_context + index); + { + if (_max.rule_length == 0 + || (_slotref + _max.pre_context + index >= _max.rule_length) + || (_slotref + _max.pre_context + index < 0)) + { + failure(out_of_range_data); + return false; + } + } return true; } @@ -695,6 +709,22 @@ bool Machine::Code::decoder::test_context() const throw() return true; } +bool Machine::Code::decoder::test_attr(attrCode) const throw() +{ +#if 0 // This code is coming but causes backward compatibility problems. + if (_passtype < PASS_TYPE_POSITIONING) + { + if (attr != gr_slatBreak && attr != gr_slatDir && attr != gr_slatUserDefn + && attr != gr_slatCompRef) + { + failure(out_of_range_data); + return false; + } + } +#endif + return true; +} + inline void Machine::Code::failure(const status_t s) throw() { release_buffers(); diff --git a/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp b/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp index 6b20a91c9bc..1929b39a58e 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp +++ b/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp @@ -1081,8 +1081,8 @@ void SlotCollision::initFromSlot(Segment *seg, Slot *slot) return; const sparse &p = glyphFace->attrs(); _flags = p[aCol]; - _limit = Rect(Position(p[aCol+1], p[aCol+2]), - Position(p[aCol+3], p[aCol+4])); + _limit = Rect(Position(int16(p[aCol+1]), int16(p[aCol+2])), + Position(int16(p[aCol+3]), int16(p[aCol+4]))); _margin = p[aCol+5]; _marginWt = p[aCol+6]; diff --git a/Build/source/libs/graphite2/graphite2-src/src/FeatureMap.cpp b/Build/source/libs/graphite2/graphite2-src/src/FeatureMap.cpp index e63415dd1c8..014a88fd08e 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/FeatureMap.cpp +++ b/Build/source/libs/graphite2/graphite2-src/src/FeatureMap.cpp @@ -71,7 +71,7 @@ namespace FeatureRef::FeatureRef(const Face & face, unsigned short & bits_offset, uint32 max_val, - uint32 name, uint16 uiName, uint16 flags, + uint32 name, uint16 uiName, flags_t flags, FeatureSetting *settings, uint16 num_set) throw() : m_face(&face), m_nameValues(settings), @@ -79,8 +79,8 @@ FeatureRef::FeatureRef(const Face & face, m_max(max_val), m_id(name), m_nameid(uiName), - m_flags(flags), - m_numSet(num_set) + m_numSet(num_set), + m_flags(flags) { const uint8 need_bits = bit_set_count(m_mask); m_index = (bits_offset + need_bits) / SIZEOF_CHUNK; @@ -163,7 +163,8 @@ bool FeatureMap::readFeats(const Face & face) } ::new (m_feats + i) FeatureRef (face, bits, maxVal, - label, uiName, flags, + label, uiName, + FeatureRef::flags_t(flags), uiSet, num_settings); } new (&m_defaultFeatures) Features(bits/(sizeof(uint32)*8) + 1, *this); diff --git a/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp b/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp index 76d4983aee5..db31c22d46b 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp +++ b/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp @@ -704,7 +704,7 @@ void Pass::adjustSlot(int delta, Slot * & slot_out, SlotMap & smap) const { slot_out = smap.segment.last(); ++delta; - if (!smap.highwater()) + if (!smap.highwater() || smap.highwater() == slot_out) smap.highpassed(false); } else diff --git a/Build/source/libs/graphite2/graphite2-src/src/direct_machine.cpp b/Build/source/libs/graphite2/graphite2-src/src/direct_machine.cpp index e6545223685..86206cfe37b 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/direct_machine.cpp +++ b/Build/source/libs/graphite2/graphite2-src/src/direct_machine.cpp @@ -56,6 +56,26 @@ using namespace vm; namespace { +// The GCC manual has this to say about labels as values: +// The &&foo expressions for the same label might have different values +// if the containing function is inlined or cloned. If a program relies +// on them being always the same, __attribute__((__noinline__,__noclone__)) +// should be used to prevent inlining and cloning. +// +// is_return in Code.cpp relies on being able to do comparisons, so it needs +// them to be always the same. +// +// The GCC manual further adds: +// If &&foo is used in a static variable initializer, inlining and +// cloning is forbidden. +// +// In this file, &&foo *is* used in a static variable initializer, and it's not +// entirely clear whether this should prevent inlining of the function or not. +// In practice, though, clang 7 can end up inlining the function with ThinLTO, +// which breaks at least is_return. https://bugs.llvm.org/show_bug.cgi?id=39241 +// So all in all, we need at least the __noinline__ attribute. __noclone__ +// is not supported by clang. +__attribute__((__noinline__)) const void * direct_run(const bool get_table_mode, const instr * program, const byte * data, diff --git a/Build/source/libs/graphite2/graphite2-src/src/files.mk b/Build/source/libs/graphite2/graphite2-src/src/files.mk index 15ebb2ef0d1..63063567bf7 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/files.mk +++ b/Build/source/libs/graphite2/graphite2-src/src/files.mk @@ -47,7 +47,6 @@ $(_NS)_SOURCES = \ $($(_NS)_BASE)/src/gr_segment.cpp \ $($(_NS)_BASE)/src/gr_slot.cpp \ $($(_NS)_BASE)/src/json.cpp \ - $($(_NS)_BASE)/src/CachedFace.cpp \ $($(_NS)_BASE)/src/CmapCache.cpp \ $($(_NS)_BASE)/src/Code.cpp \ $($(_NS)_BASE)/src/Collider.cpp \ @@ -74,7 +73,6 @@ $(_NS)_PRIVATE_HEADERS = \ $($(_NS)_BASE)/src/inc/bits.h \ $($(_NS)_BASE)/src/inc/debug.h \ $($(_NS)_BASE)/src/inc/json.h \ - $($(_NS)_BASE)/src/inc/CachedFace.h \ $($(_NS)_BASE)/src/inc/CharInfo.h \ $($(_NS)_BASE)/src/inc/CmapCache.h \ $($(_NS)_BASE)/src/inc/Code.h \ diff --git a/Build/source/libs/graphite2/graphite2-src/src/gr_face.cpp b/Build/source/libs/graphite2/graphite2-src/src/gr_face.cpp index 712aa115fa7..baa469727bb 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/gr_face.cpp +++ b/Build/source/libs/graphite2/graphite2-src/src/gr_face.cpp @@ -163,14 +163,25 @@ const gr_feature_ref* gr_face_find_fref(const gr_face* pFace, gr_uint32 featId) unsigned short gr_face_n_fref(const gr_face* pFace) { assert(pFace); - return pFace->numFeatures(); + int res = 0; + for (int i = 0; i < pFace->numFeatures(); ++i) + if (!(pFace->feature(i)->getFlags() & FeatureRef::HIDDEN)) + ++res; + return res; } const gr_feature_ref* gr_face_fref(const gr_face* pFace, gr_uint16 i) //When finished with the FeatureRef, call destroy_FeatureRef { assert(pFace); - const FeatureRef* pRef = pFace->feature(i); - return static_cast<const gr_feature_ref*>(pRef); + int count = 0; + for (int j = 0; j < pFace->numFeatures(); ++j) + { + const FeatureRef* pRef = pFace->feature(j); + if (!(pRef->getFlags() & FeatureRef::HIDDEN)) + if (count++ == i) + return static_cast<const gr_feature_ref*>(pRef); + } + return 0; } unsigned short gr_face_n_languages(const gr_face* pFace) diff --git a/Build/source/libs/graphite2/graphite2-src/src/gr_slot.cpp b/Build/source/libs/graphite2/graphite2-src/src/gr_slot.cpp index 21a00fdcd51..a3c6b46a7f4 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/gr_slot.cpp +++ b/Build/source/libs/graphite2/graphite2-src/src/gr_slot.cpp @@ -95,8 +95,9 @@ float gr_slot_advance_X(const gr_slot* p/*not NULL*/, const gr_face *face, const if (font) { scale = font->scale(); - if (face && font->isHinted()) - res = (res - face->glyphs().glyph(p->gid())->theAdvance().x) * scale + font->advance(p->gid()); + int gid = p->glyph(); + if (face && font->isHinted() && gid < face->glyphs().numGlyphs()) + res = (res - face->glyphs().glyph(gid)->theAdvance().x) * scale + font->advance(gid); else res = res * scale; } diff --git a/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureMap.h b/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureMap.h index 142a00e7e9f..0f05e941a27 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureMap.h +++ b/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureMap.h @@ -56,9 +56,12 @@ class FeatureRef static const uint8 SIZEOF_CHUNK = sizeof(chunk_t)*8; public: + enum flags_t : uint16 { + HIDDEN = 0x0800 + }; FeatureRef() throw(); FeatureRef(const Face & face, unsigned short & bits_offset, uint32 max_val, - uint32 name, uint16 uiName, uint16 flags, + uint32 name, uint16 uiName, flags_t flags, FeatureSetting *settings, uint16 num_set) throw(); ~FeatureRef() throw(); @@ -75,6 +78,7 @@ public: uint16 getNumSettings() const { return m_numSet; } uint16 getSettingName(uint16 index) const { return m_nameValues[index].label(); } int16 getSettingValue(uint16 index) const { return m_nameValues[index].value(); } + flags_t getFlags() const { return m_flags; } uint32 maxVal() const { return m_max; } const Face & getFace() const { assert(m_face); return *m_face;} const FeatureMap* getFeatureMap() const;// { return m_pFace;} @@ -88,9 +92,9 @@ private: chunk_t m_mask, // bit mask to get the value from the vector m_max; // max value the value can take uint32 m_id; // feature identifier/name - uint16 m_nameid, // Name table id for feature name - m_flags, // feature flags (unused at the moment but read from the font) - m_numSet; // number of values (number of entries in m_nameValues) + uint16 m_nameid, // Name table id for feature name + m_numSet; // number of values (number of entries in m_nameValues) + flags_t m_flags; // feature flags see FeatureRef::flags_t. byte m_bits, // how many bits to shift the value into place m_index; // index into the array to find the ulong to mask @@ -103,8 +107,8 @@ FeatureRef::FeatureRef() throw() : m_face(0), m_nameValues(0), m_mask(0), m_max(0), - m_id(0), - m_nameid(0), m_flags(0), m_numSet(0), + m_id(0), m_nameid(0), m_numSet(0), + m_flags(flags_t(0)), m_bits(0), m_index(0) { } diff --git a/Build/source/libs/graphite2/version.ac b/Build/source/libs/graphite2/version.ac index 3cab71ac1dd..6bf4c109a36 100644 --- a/Build/source/libs/graphite2/version.ac +++ b/Build/source/libs/graphite2/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current graphite2 version -m4_define([graphite2_version], [1.3.13]) +m4_define([graphite2_version], [1.3.14]) |