texlive[48409] Build/source/libs: graphite2 1.3.12

commits+kakuto at tug.org commits+kakuto at tug.org
Thu Aug 16 02:30:02 CEST 2018


Revision: 48409
          http://tug.org/svn/texlive?view=revision&revision=48409
Author:   kakuto
Date:     2018-08-16 02:30:02 +0200 (Thu, 16 Aug 2018)
Log Message:
-----------
graphite2 1.3.12

Modified Paths:
--------------
    trunk/Build/source/libs/README
    trunk/Build/source/libs/graphite2/ChangeLog
    trunk/Build/source/libs/graphite2/Makefile.am
    trunk/Build/source/libs/graphite2/Makefile.in
    trunk/Build/source/libs/graphite2/TLpatches/ChangeLog
    trunk/Build/source/libs/graphite2/TLpatches/TL-Changes
    trunk/Build/source/libs/graphite2/config.h.in
    trunk/Build/source/libs/graphite2/configure
    trunk/Build/source/libs/graphite2/configure.ac
    trunk/Build/source/libs/graphite2/graphite2-src/CMakeLists.txt
    trunk/Build/source/libs/graphite2/graphite2-src/COPYING
    trunk/Build/source/libs/graphite2/graphite2-src/ChangeLog
    trunk/Build/source/libs/graphite2/graphite2-src/Graphite.cmake
    trunk/Build/source/libs/graphite2/graphite2-src/README.md
    trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h
    trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Log.h
    trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Segment.h
    trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Types.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/CMakeLists.txt
    trunk/Build/source/libs/graphite2/graphite2-src/src/Code.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Decompressor.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Face.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/FeatureMap.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/FileFace.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Font.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/GlyphCache.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/GlyphFace.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Intervals.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Justifier.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/NameTable.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Position.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Segment.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Silf.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/Slot.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/TtfUtil.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/UtfCodec.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/call_machine.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/direct_machine.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/files.mk
    trunk/Build/source/libs/graphite2/graphite2-src/src/gr_char_info.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/gr_face.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/gr_features.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/gr_font.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/gr_logging.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/gr_segment.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/gr_slot.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/CharInfo.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Code.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Collider.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Compression.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Decompressor.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Endian.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Error.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Face.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureMap.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureVal.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/FileFace.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Font.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/GlyphCache.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/GlyphFace.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Intervals.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/List.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Main.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Pass.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Position.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Rule.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Segment.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Silf.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Slot.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Sparse.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/TtfTypes.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/TtfUtil.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/UtfCodec.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/bits.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/json.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/opcode_table.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/opcodes.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/json.cpp
    trunk/Build/source/libs/graphite2/version.ac

Removed Paths:
-------------
    trunk/Build/source/libs/graphite2/graphite2-src/src/CachedFace.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/SegCache.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/SegCacheEntry.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/SegCacheStore.cpp
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/CachedFace.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/SegCache.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/SegCacheEntry.h
    trunk/Build/source/libs/graphite2/graphite2-src/src/inc/SegCacheStore.h

Modified: trunk/Build/source/libs/README
===================================================================
--- trunk/Build/source/libs/README	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/README	2018-08-16 00:30:02 UTC (rev 48409)
@@ -21,7 +21,7 @@
 gmp 6.1.2 - checked 16dec16
   http://ftp.gnu.org/gnu/gmp/
 
-graphite2 1.3.11 - checked 05mar18
+graphite2 1.3.12 - checked 16aug18
   http://sourceforge.net/projects/silgraphite/files/graphite2/
 
 harfbuzz 1.8.8 - checked 15aug18

Modified: trunk/Build/source/libs/graphite2/ChangeLog
===================================================================
--- trunk/Build/source/libs/graphite2/ChangeLog	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/ChangeLog	2018-08-16 00:30:02 UTC (rev 48409)
@@ -1,3 +1,8 @@
+2018-08-16  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
+
+	Import graphite2-1.3.12.
+	* configure.ac, version.ac, Makefile.am: Adjusted.
+
 2018-03-05  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	Import graphite2-1.3.11.

Modified: trunk/Build/source/libs/graphite2/Makefile.am
===================================================================
--- trunk/Build/source/libs/graphite2/Makefile.am	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/Makefile.am	2018-08-16 00:30:02 UTC (rev 48409)
@@ -31,7 +31,6 @@
 AM_CPPFLAGS = -I$(top_srcdir)/$(GRAPHITE2_SRC) -I$(top_srcdir)/$(GRAPHITE2_INC)
 AM_CPPFLAGS += -DGRAPHITE2_STATIC -DGRAPHITE2_CUSTOM_HEADER='<config.h>'
 libgraphite2_a_SOURCES =  \
-	@GRAPHITE2_TREE@/src/CachedFace.cpp \
 	@GRAPHITE2_TREE@/src/CmapCache.cpp \
 	@GRAPHITE2_TREE@/src/Code.cpp \
 	@GRAPHITE2_TREE@/src/Collider.cpp \
@@ -66,14 +65,7 @@
 libgraphite2_a_SOURCES += @GRAPHITE2_TREE@/src/call_machine.cpp
 endif !DIRECT_TYPE
 
-if WITH_SEGCACHE
-libgraphite2_a_SOURCES += \
-	@GRAPHITE2_TREE@/src/SegCache.cpp \
-	@GRAPHITE2_TREE@/src/SegCacheEntry.cpp \
-	@GRAPHITE2_TREE@/src/SegCacheStore.cpp
-else !WITH_SEGCACHE
 AM_CPPFLAGS += -DGRAPHITE2_NSEGCACHE
-endif !WITH_SEGCACHE
 
 if WITH_FILEFACE
 libgraphite2_a_SOURCES += @GRAPHITE2_TREE@/src/FileFace.cpp 

Modified: trunk/Build/source/libs/graphite2/Makefile.in
===================================================================
--- trunk/Build/source/libs/graphite2/Makefile.in	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/Makefile.in	2018-08-16 00:30:02 UTC (rev 48409)
@@ -88,16 +88,10 @@
 POST_UNINSTALL = :
 @DIRECT_TYPE_TRUE at am__append_1 = @GRAPHITE2_TREE@/src/direct_machine.cpp
 @DIRECT_TYPE_FALSE at am__append_2 = @GRAPHITE2_TREE@/src/call_machine.cpp
- at WITH_SEGCACHE_TRUE@am__append_3 = \
- at WITH_SEGCACHE_TRUE@	@GRAPHITE2_TREE@/src/SegCache.cpp \
- at WITH_SEGCACHE_TRUE@	@GRAPHITE2_TREE@/src/SegCacheEntry.cpp \
- at WITH_SEGCACHE_TRUE@	@GRAPHITE2_TREE@/src/SegCacheStore.cpp
-
- at WITH_SEGCACHE_FALSE@am__append_4 = -DGRAPHITE2_NSEGCACHE
- at WITH_FILEFACE_TRUE@am__append_5 = @GRAPHITE2_TREE@/src/FileFace.cpp 
- at WITH_FILEFACE_FALSE@am__append_6 = -DGRAPHITE2_NFILEFACE
- at WITH_TRACING_TRUE@am__append_7 = @GRAPHITE2_TREE@/src/json.cpp
- at WITH_TRACING_FALSE@am__append_8 = -DGRAPHITE2_NTRACING
+ at WITH_FILEFACE_TRUE@am__append_3 = @GRAPHITE2_TREE@/src/FileFace.cpp 
+ at WITH_FILEFACE_FALSE@am__append_4 = -DGRAPHITE2_NFILEFACE
+ at WITH_TRACING_TRUE@am__append_5 = @GRAPHITE2_TREE@/src/json.cpp
+ at WITH_TRACING_FALSE@am__append_6 = -DGRAPHITE2_NTRACING
 @build_TRUE at check_PROGRAMS = gr2test$(EXEEXT)
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -124,8 +118,7 @@
 am__v_AR_1 = 
 libgraphite2_a_AR = $(AR) $(ARFLAGS)
 libgraphite2_a_LIBADD =
-am__libgraphite2_a_SOURCES_DIST = @GRAPHITE2_TREE@/src/CachedFace.cpp \
-	@GRAPHITE2_TREE@/src/CmapCache.cpp \
+am__libgraphite2_a_SOURCES_DIST = @GRAPHITE2_TREE@/src/CmapCache.cpp \
 	@GRAPHITE2_TREE@/src/Code.cpp \
 	@GRAPHITE2_TREE@/src/Collider.cpp \
 	@GRAPHITE2_TREE@/src/Decompressor.cpp \
@@ -152,24 +145,16 @@
 	@GRAPHITE2_TREE@/src/gr_slot.cpp \
 	@GRAPHITE2_TREE@/src/direct_machine.cpp \
 	@GRAPHITE2_TREE@/src/call_machine.cpp \
-	@GRAPHITE2_TREE@/src/SegCache.cpp \
-	@GRAPHITE2_TREE@/src/SegCacheEntry.cpp \
-	@GRAPHITE2_TREE@/src/SegCacheStore.cpp \
 	@GRAPHITE2_TREE@/src/FileFace.cpp \
 	@GRAPHITE2_TREE@/src/json.cpp
 am__dirstamp = $(am__leading_dot)dirstamp
 @DIRECT_TYPE_TRUE at am__objects_1 = @GRAPHITE2_TREE@/src/direct_machine.$(OBJEXT)
 @DIRECT_TYPE_FALSE at am__objects_2 = @GRAPHITE2_TREE@/src/call_machine.$(OBJEXT)
- at WITH_SEGCACHE_TRUE@am__objects_3 =  \
- at WITH_SEGCACHE_TRUE@	@GRAPHITE2_TREE@/src/SegCache.$(OBJEXT) \
- at WITH_SEGCACHE_TRUE@	@GRAPHITE2_TREE@/src/SegCacheEntry.$(OBJEXT) \
- at WITH_SEGCACHE_TRUE@	@GRAPHITE2_TREE@/src/SegCacheStore.$(OBJEXT)
- at WITH_FILEFACE_TRUE@am__objects_4 =  \
+ at WITH_FILEFACE_TRUE@am__objects_3 =  \
 @WITH_FILEFACE_TRUE@	@GRAPHITE2_TREE@/src/FileFace.$(OBJEXT)
- at WITH_TRACING_TRUE@am__objects_5 =  \
+ at WITH_TRACING_TRUE@am__objects_4 =  \
 @WITH_TRACING_TRUE@	@GRAPHITE2_TREE@/src/json.$(OBJEXT)
-am_libgraphite2_a_OBJECTS = @GRAPHITE2_TREE@/src/CachedFace.$(OBJEXT) \
-	@GRAPHITE2_TREE@/src/CmapCache.$(OBJEXT) \
+am_libgraphite2_a_OBJECTS = @GRAPHITE2_TREE@/src/CmapCache.$(OBJEXT) \
 	@GRAPHITE2_TREE@/src/Code.$(OBJEXT) \
 	@GRAPHITE2_TREE@/src/Collider.$(OBJEXT) \
 	@GRAPHITE2_TREE@/src/Decompressor.$(OBJEXT) \
@@ -196,8 +181,7 @@
 	@GRAPHITE2_TREE@/src/gr_logging.$(OBJEXT) \
 	@GRAPHITE2_TREE@/src/gr_segment.$(OBJEXT) \
 	@GRAPHITE2_TREE@/src/gr_slot.$(OBJEXT) $(am__objects_1) \
-	$(am__objects_2) $(am__objects_3) $(am__objects_4) \
-	$(am__objects_5)
+	$(am__objects_2) $(am__objects_3) $(am__objects_4)
 libgraphite2_a_OBJECTS = $(am_libgraphite2_a_OBJECTS)
 am_gr2test_OBJECTS = gr2test-gr2test.$(OBJEXT)
 gr2test_OBJECTS = $(am_gr2test_OBJECTS)
@@ -221,7 +205,6 @@
 am__maybe_remake_depfiles = depfiles
 am__depfiles_remade = ./$(DEPDIR)/gr2test-dummy.Po \
 	./$(DEPDIR)/gr2test-gr2test.Po \
-	@GRAPHITE2_TREE@/src/$(DEPDIR)/CachedFace.Po \
 	@GRAPHITE2_TREE@/src/$(DEPDIR)/CmapCache.Po \
 	@GRAPHITE2_TREE@/src/$(DEPDIR)/Code.Po \
 	@GRAPHITE2_TREE@/src/$(DEPDIR)/Collider.Po \
@@ -237,9 +220,6 @@
 	@GRAPHITE2_TREE@/src/$(DEPDIR)/NameTable.Po \
 	@GRAPHITE2_TREE@/src/$(DEPDIR)/Pass.Po \
 	@GRAPHITE2_TREE@/src/$(DEPDIR)/Position.Po \
-	@GRAPHITE2_TREE@/src/$(DEPDIR)/SegCache.Po \
-	@GRAPHITE2_TREE@/src/$(DEPDIR)/SegCacheEntry.Po \
-	@GRAPHITE2_TREE@/src/$(DEPDIR)/SegCacheStore.Po \
 	@GRAPHITE2_TREE@/src/$(DEPDIR)/Segment.Po \
 	@GRAPHITE2_TREE@/src/$(DEPDIR)/Silf.Po \
 	@GRAPHITE2_TREE@/src/$(DEPDIR)/Slot.Po \
@@ -695,10 +675,9 @@
 noinst_LIBRARIES = libgraphite2.a
 AM_CPPFLAGS = -I$(top_srcdir)/$(GRAPHITE2_SRC) \
 	-I$(top_srcdir)/$(GRAPHITE2_INC) -DGRAPHITE2_STATIC \
-	-DGRAPHITE2_CUSTOM_HEADER='<config.h>' $(am__append_4) \
-	$(am__append_6) $(am__append_8)
-libgraphite2_a_SOURCES = @GRAPHITE2_TREE@/src/CachedFace.cpp \
-	@GRAPHITE2_TREE@/src/CmapCache.cpp \
+	-DGRAPHITE2_CUSTOM_HEADER='<config.h>' -DGRAPHITE2_NSEGCACHE \
+	$(am__append_4) $(am__append_6)
+libgraphite2_a_SOURCES = @GRAPHITE2_TREE@/src/CmapCache.cpp \
 	@GRAPHITE2_TREE@/src/Code.cpp \
 	@GRAPHITE2_TREE@/src/Collider.cpp \
 	@GRAPHITE2_TREE@/src/Decompressor.cpp \
@@ -723,8 +702,7 @@
 	@GRAPHITE2_TREE@/src/gr_logging.cpp \
 	@GRAPHITE2_TREE@/src/gr_segment.cpp \
 	@GRAPHITE2_TREE@/src/gr_slot.cpp $(am__append_1) \
-	$(am__append_2) $(am__append_3) $(am__append_5) \
-	$(am__append_7)
+	$(am__append_2) $(am__append_3) $(am__append_5)
 @build_TRUE at dist_check_SCRIPTS = graphite2.test
 @build_TRUE at TESTS = graphite2.test
 gr2test_SOURCES = gr2test.c
@@ -804,9 +782,6 @@
 @GRAPHITE2_TREE@/src/$(DEPDIR)/$(am__dirstamp):
 	@$(MKDIR_P) @GRAPHITE2_TREE@/src/$(DEPDIR)
 	@: > @GRAPHITE2_TREE@/src/$(DEPDIR)/$(am__dirstamp)
- at GRAPHITE2_TREE@/src/CachedFace.$(OBJEXT):  \
-	@GRAPHITE2_TREE@/src/$(am__dirstamp) \
-	@GRAPHITE2_TREE@/src/$(DEPDIR)/$(am__dirstamp)
 @GRAPHITE2_TREE@/src/CmapCache.$(OBJEXT):  \
 	@GRAPHITE2_TREE@/src/$(am__dirstamp) \
 	@GRAPHITE2_TREE@/src/$(DEPDIR)/$(am__dirstamp)
@@ -894,15 +869,6 @@
 @GRAPHITE2_TREE@/src/call_machine.$(OBJEXT):  \
 	@GRAPHITE2_TREE@/src/$(am__dirstamp) \
 	@GRAPHITE2_TREE@/src/$(DEPDIR)/$(am__dirstamp)
- at GRAPHITE2_TREE@/src/SegCache.$(OBJEXT):  \
-	@GRAPHITE2_TREE@/src/$(am__dirstamp) \
-	@GRAPHITE2_TREE@/src/$(DEPDIR)/$(am__dirstamp)
- at GRAPHITE2_TREE@/src/SegCacheEntry.$(OBJEXT):  \
-	@GRAPHITE2_TREE@/src/$(am__dirstamp) \
-	@GRAPHITE2_TREE@/src/$(DEPDIR)/$(am__dirstamp)
- at GRAPHITE2_TREE@/src/SegCacheStore.$(OBJEXT):  \
-	@GRAPHITE2_TREE@/src/$(am__dirstamp) \
-	@GRAPHITE2_TREE@/src/$(DEPDIR)/$(am__dirstamp)
 @GRAPHITE2_TREE@/src/FileFace.$(OBJEXT):  \
 	@GRAPHITE2_TREE@/src/$(am__dirstamp) \
 	@GRAPHITE2_TREE@/src/$(DEPDIR)/$(am__dirstamp)
@@ -928,7 +894,6 @@
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gr2test-dummy.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gr2test-gr2test.Po at am__quote@ # am--include-marker
- at AMDEP_TRUE@@am__include@ @am__quote@@GRAPHITE2_TREE@/src/$(DEPDIR)/CachedFace.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@GRAPHITE2_TREE@/src/$(DEPDIR)/CmapCache.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@GRAPHITE2_TREE@/src/$(DEPDIR)/Code.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@GRAPHITE2_TREE@/src/$(DEPDIR)/Collider.Po at am__quote@ # am--include-marker
@@ -944,9 +909,6 @@
 @AMDEP_TRUE@@am__include@ @am__quote@@GRAPHITE2_TREE@/src/$(DEPDIR)/NameTable.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@GRAPHITE2_TREE@/src/$(DEPDIR)/Pass.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@GRAPHITE2_TREE@/src/$(DEPDIR)/Position.Po at am__quote@ # am--include-marker
- at AMDEP_TRUE@@am__include@ @am__quote@@GRAPHITE2_TREE@/src/$(DEPDIR)/SegCache.Po at am__quote@ # am--include-marker
- at AMDEP_TRUE@@am__include@ @am__quote@@GRAPHITE2_TREE@/src/$(DEPDIR)/SegCacheEntry.Po at am__quote@ # am--include-marker
- at AMDEP_TRUE@@am__include@ @am__quote@@GRAPHITE2_TREE@/src/$(DEPDIR)/SegCacheStore.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@GRAPHITE2_TREE@/src/$(DEPDIR)/Segment.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@GRAPHITE2_TREE@/src/$(DEPDIR)/Silf.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@GRAPHITE2_TREE@/src/$(DEPDIR)/Slot.Po at am__quote@ # am--include-marker
@@ -1555,7 +1517,6 @@
 	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
 		-rm -f ./$(DEPDIR)/gr2test-dummy.Po
 	-rm -f ./$(DEPDIR)/gr2test-gr2test.Po
-	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/CachedFace.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/CmapCache.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/Code.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/Collider.Po
@@ -1571,9 +1532,6 @@
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/NameTable.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/Pass.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/Position.Po
-	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/SegCache.Po
-	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/SegCacheEntry.Po
-	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/SegCacheStore.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/Segment.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/Silf.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/Slot.Po
@@ -1639,7 +1597,6 @@
 	-rm -rf $(top_srcdir)/autom4te.cache
 		-rm -f ./$(DEPDIR)/gr2test-dummy.Po
 	-rm -f ./$(DEPDIR)/gr2test-gr2test.Po
-	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/CachedFace.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/CmapCache.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/Code.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/Collider.Po
@@ -1655,9 +1612,6 @@
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/NameTable.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/Pass.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/Position.Po
-	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/SegCache.Po
-	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/SegCacheEntry.Po
-	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/SegCacheStore.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/Segment.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/Silf.Po
 	-rm -f @GRAPHITE2_TREE@/src/$(DEPDIR)/Slot.Po

Modified: trunk/Build/source/libs/graphite2/TLpatches/ChangeLog
===================================================================
--- trunk/Build/source/libs/graphite2/TLpatches/ChangeLog	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/TLpatches/ChangeLog	2018-08-16 00:30:02 UTC (rev 48409)
@@ -1,3 +1,8 @@
+2018-08-16  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
+
+	Imported graphite2-1.3.12 source tree from:
+	  http://sourceforge.net/projects/silgraphite/files/graphite2/
+
 2018-03-05  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	Imported graphite2-1.3.11 source tree from:

Modified: trunk/Build/source/libs/graphite2/TLpatches/TL-Changes
===================================================================
--- trunk/Build/source/libs/graphite2/TLpatches/TL-Changes	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/TLpatches/TL-Changes	2018-08-16 00:30:02 UTC (rev 48409)
@@ -1,4 +1,4 @@
-Changes applied to the graphite2-1.3.11/ tree as obtained from:
+Changes applied to the graphite2-1.3.12/ tree as obtained from:
 	http://sourceforge.net/projects/silgraphite/files/graphite2/
 
 Removed unused dirs:

Modified: trunk/Build/source/libs/graphite2/config.h.in
===================================================================
--- trunk/Build/source/libs/graphite2/config.h.in	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/config.h.in	2018-08-16 00:30:02 UTC (rev 48409)
@@ -3,9 +3,6 @@
 /* Define to 1 to disable fileface support. */
 #undef GRAPHITE2_NFILEFACE
 
-/* Define to 1 to disable segcache support. */
-#undef GRAPHITE2_NSEGCACHE
-
 /* Define to 1 to disable tracing support. */
 #undef GRAPHITE2_NTRACING
 

Modified: trunk/Build/source/libs/graphite2/configure
===================================================================
--- trunk/Build/source/libs/graphite2/configure	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/configure	2018-08-16 00:30:02 UTC (rev 48409)
@@ -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.11.
+# Generated by GNU Autoconf 2.69 for graphite2 (TeX Live) 1.3.12.
 #
 # Report bugs to <tex-k at tug.org>.
 #
@@ -579,8 +579,8 @@
 # Identity of this package.
 PACKAGE_NAME='graphite2 (TeX Live)'
 PACKAGE_TARNAME='graphite2--tex-live-'
-PACKAGE_VERSION='1.3.11'
-PACKAGE_STRING='graphite2 (TeX Live) 1.3.11'
+PACKAGE_VERSION='1.3.12'
+PACKAGE_STRING='graphite2 (TeX Live) 1.3.12'
 PACKAGE_BUGREPORT='tex-k at tug.org'
 PACKAGE_URL=''
 
@@ -594,8 +594,6 @@
 WITH_TRACING_TRUE
 WITH_FILEFACE_FALSE
 WITH_FILEFACE_TRUE
-WITH_SEGCACHE_FALSE
-WITH_SEGCACHE_TRUE
 DIRECT_TYPE_FALSE
 DIRECT_TYPE_TRUE
 build_FALSE
@@ -1254,7 +1252,7 @@
   # 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.11 to adapt to many kinds of systems.
+\`configure' configures graphite2 (TeX Live) 1.3.12 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1321,7 +1319,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of graphite2 (TeX Live) 1.3.11:";;
+     short | recursive ) echo "Configuration of graphite2 (TeX Live) 1.3.12:";;
    esac
   cat <<\_ACEOF
 
@@ -1419,7 +1417,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-graphite2 (TeX Live) configure 1.3.11
+graphite2 (TeX Live) configure 1.3.12
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1558,7 +1556,7 @@
 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.11, which was
+It was created by graphite2 (TeX Live) $as_me 1.3.12, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3481,7 +3479,7 @@
 
 # Define the identity of the package.
  PACKAGE='graphite2--tex-live-'
- VERSION='1.3.11'
+ VERSION='1.3.12'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -4964,21 +4962,6 @@
 fi
 
 
-enable_segcache=no
- if test "x$enable_segcache" != xno; then
-  WITH_SEGCACHE_TRUE=
-  WITH_SEGCACHE_FALSE='#'
-else
-  WITH_SEGCACHE_TRUE='#'
-  WITH_SEGCACHE_FALSE=
-fi
-
-if test "x$enable_segcache" = no; then
-
-$as_echo "#define GRAPHITE2_NSEGCACHE 1" >>confdefs.h
-
-fi
-
 enable_fileface=yes
  if test "x$enable_fileface" != xno; then
   WITH_FILEFACE_TRUE=
@@ -5168,10 +5151,6 @@
   as_fn_error $? "conditional \"DIRECT_TYPE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${WITH_SEGCACHE_TRUE}" && test -z "${WITH_SEGCACHE_FALSE}"; then
-  as_fn_error $? "conditional \"WITH_SEGCACHE\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${WITH_FILEFACE_TRUE}" && test -z "${WITH_FILEFACE_FALSE}"; then
   as_fn_error $? "conditional \"WITH_FILEFACE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -5577,7 +5556,7 @@
 # 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.11, which was
+This file was extended by graphite2 (TeX Live) $as_me 1.3.12, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5643,7 +5622,7 @@
 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.11
+graphite2 (TeX Live) config.status 1.3.12
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 

Modified: trunk/Build/source/libs/graphite2/configure.ac
===================================================================
--- trunk/Build/source/libs/graphite2/configure.ac	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/configure.ac	2018-08-16 00:30:02 UTC (rev 48409)
@@ -26,13 +26,6 @@
 
 AM_CONDITIONAL([DIRECT_TYPE], [test "x$GCC" = xyes])
 
-enable_segcache=no
-AM_CONDITIONAL([WITH_SEGCACHE], [test "x$enable_segcache" != xno])
-if test "x$enable_segcache" = no; then
-  AC_DEFINE([GRAPHITE2_NSEGCACHE], 1,
-            [Define to 1 to disable segcache support.])
-fi
-
 enable_fileface=yes
 AM_CONDITIONAL([WITH_FILEFACE], [test "x$enable_fileface" != xno])
 if test "x$enable_fileface" = no; then

Modified: trunk/Build/source/libs/graphite2/graphite2-src/CMakeLists.txt
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/CMakeLists.txt	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/CMakeLists.txt	2018-08-16 00:30:02 UTC (rev 48409)
@@ -1,6 +1,7 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
 cmake_policy(SET CMP0012 NEW)
 include(TestBigEndian)
+include(FindPythonInterp)
 
 project(graphite2)
 set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
@@ -11,6 +12,8 @@
 option(BUILD_SHARED_LIBS "Make library a shared library instead of static" ON)
 
 enable_language(CXX C)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED 11)
 
 include_directories(${PROJECT_SOURCE_DIR}/include)
 
@@ -17,33 +20,32 @@
 enable_testing()
 
 set(GRAPHITE2_VM_TYPE auto CACHE STRING "Choose the type of vm machine: Auto, Direct or Call.")
-option(GRAPHITE2_NSEGCACHE "Compile out the gr_*_with_seg_cache APIs")
 option(GRAPHITE2_NFILEFACE "Compile out the gr_make_file_face* APIs")
-option(GRAPHITE2_NTRACING "Compile out log segment tracing capability")
+option(GRAPHITE2_NTRACING "Compile out log segment tracing capability" ON)
 option(GRAPHITE2_TELEMETRY "Add memory usage telemetry")
-option(GRAPHITE2_ASAN "Enable Address Sanitizing")
+set(GRAPHITE2_SANITIZERS "" CACHE STRING "Set compiler sanitizers passed to -fsanitize")
 
-
 message(STATUS "Build: " ${CMAKE_BUILD_TYPE})
 string(REPLACE "ON"  "shared"  _LIB_OBJECT_TYPE ${BUILD_SHARED_LIBS})
 string(REPLACE "OFF" "static"  _LIB_OBJECT_TYPE ${_LIB_OBJECT_TYPE})
-string(REPLACE "ON" "disabled" _SEGCACHE_SUPPORT ${GRAPHITE2_NSEGCACHE})
-string(REPLACE "OFF" "enabled" _SEGCACHE_SUPPORT ${_SEGCACHE_SUPPORT})
 string(REPLACE "ON" "disabled" _FILEFACE_SUPPORT ${GRAPHITE2_NFILEFACE})
 string(REPLACE "OFF" "enabled" _FILEFACE_SUPPORT ${_FILEFACE_SUPPORT})
 string(REPLACE "ON" "disabled" _TRACING_SUPPORT ${GRAPHITE2_NTRACING})
 string(REPLACE "OFF" "enabled" _TRACING_SUPPORT ${_TRACING_SUPPORT})
 message(STATUS "Building library: " ${_LIB_OBJECT_TYPE})
-message(STATUS "Segment Cache support: " ${_SEGCACHE_SUPPORT})
 message(STATUS "File Face support: " ${_FILEFACE_SUPPORT})
 message(STATUS "Tracing support: " ${_TRACING_SUPPORT})
 
-if (GRAPHITE2_ASAN)
-    add_definitions(-fsanitize=address -fno-omit-frame-pointer -g)
-    find_program(ASAN_SYMBOLIZER llvm-symbolizer
-            PATHS "/usr/lib" "/usr/local/lib"
-            PATH_SUFFIXES "llvm-3.5/bin" "llvm-3.4/bin" "llvm-3.3/bin")
-endif (GRAPHITE2_ASAN)
+if (GRAPHITE2_SANITIZERS)
+    string(STRIP ${GRAPHITE2_SANITIZERS} GRAPHITE2_SANITIZERS)
+    add_compile_options(-fsanitize=${GRAPHITE2_SANITIZERS} -fno-omit-frame-pointer -g -O1)
+    message(STATUS "Sanitizer support: " ${GRAPHITE2_SANITIZERS})
+    string(REGEX REPLACE "(,?fuzzer|fuzzer,?)" "" SANITIZERS_LINK  ${GRAPHITE2_SANITIZERS})
+    if (GRAPHITE2_SANITIZERS MATCHES "fuzzer")
+      set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize-coverage=trace-pc-guard")
+    endif ()
+    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${SANITIZERS_LINK}")
+endif ()
 
 string(TOLOWER ${GRAPHITE2_VM_TYPE} GRAPHITE2_VM_TYPE)
 if (NOT GRAPHITE2_VM_TYPE MATCHES "auto|direct|call")
@@ -62,12 +64,27 @@
 endif (GRAPHITE2_VM_TYPE STREQUAL "direct" AND NOT (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
 message(STATUS "Using vm machine type: ${GRAPHITE2_VM_TYPE}")
 
+if (BUILD_SHARED_LIBS)
+    if (PYTHONINTERP_FOUND)
+        EXEC_PROGRAM(${PYTHON_EXECUTABLE}
+            ARGS -c \"import ctypes\; print(ctypes.sizeof(ctypes.c_void_p)) \"
+            OUTPUT_VARIABLE PYTHON_SIZEOF_VOID_P)
+        if ((PYTHON_SIZEOF_VOID_P STREQUAL CMAKE_SIZEOF_VOID_P) AND (NOT GRAPHITE2_NFILEFACE) AND ((NOT GRAPHITE2_SANITIZERS MATCHES "address") OR CMAKE_COMPILER_IS_GNUCXX))
+            set(PYTHON_CTYPES_COMPATBILE TRUE)
+        else ()
+            if ((NOT GRAPHITE2_SANITIZERS MATCHES "address") OR CMAKE_COMPILER_IS_GNUCXX)
+                message(WARNING "Python ctypes is incompatible with built DLL. Disabling some tests.")
+            endif ()
+        endif ()
+    endif (PYTHONINTERP_FOUND)
+endif (BUILD_SHARED_LIBS)
+
 add_subdirectory(src)
 add_subdirectory(tests)
 add_subdirectory(doc)
-if (NOT (GRAPHITE2_NSEGCACHE OR GRAPHITE2_NFILEFACE))
+if (NOT GRAPHITE2_NFILEFACE)
     add_subdirectory(gr2fonttest)
-endif (NOT (GRAPHITE2_NSEGCACHE OR GRAPHITE2_NFILEFACE))
+endif (NOT GRAPHITE2_NFILEFACE)
 
 set(version 3.0.1)
 set(libdir ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
@@ -76,4 +93,3 @@
 configure_file(graphite2.pc.in graphite2.pc)
 
 install(FILES ${PROJECT_BINARY_DIR}/graphite2.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig)
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/COPYING
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/COPYING	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/COPYING	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
     Alternatively, you may use this library under the terms of the Mozilla

Modified: trunk/Build/source/libs/graphite2/graphite2-src/ChangeLog
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/ChangeLog	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/ChangeLog	2018-08-16 00:30:02 UTC (rev 48409)
@@ -1,3 +1,12 @@
+1.3.12
+    . Graphite no longer does dumb rendering for fonts with no smarts
+    . Segment caching code removed. Anything attempting to use the segment cache gets given a regular face instead
+    . Add libfuzzer support
+    . Builds now require C++11
+    . Improvements to Windows 64 bit builds
+    . Support different versions of python including 32 bit and python 3
+    . Various minor bug fixes
+
 1.3.11
     . Fixes due to security review
     . Minor collision avoidance fixes

Modified: trunk/Build/source/libs/graphite2/graphite2-src/Graphite.cmake
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/Graphite.cmake	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/Graphite.cmake	2018-08-16 00:30:02 UTC (rev 48409)
@@ -5,12 +5,12 @@
     if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
         add_test(NAME nolib-${LIBNAME}-${PROJECT_NAME}
             COMMAND otool -L ${OBJECTFILE})
-        set_tests_properties(nolib-${LIBNAME}-${PROJECT_NAME} PROPERTIES 
+        set_tests_properties(nolib-${LIBNAME}-${PROJECT_NAME} PROPERTIES
             FAIL_REGULAR_EXPRESSION "${CMAKE_SHARED_LIBRARY_PREFIX}${LIBNAME_REGEX}[.0-9]+${CMAKE_SHARED_LIBRARY_SUFFIX}")
     else (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
         add_test(NAME nolib-${LIBNAME}-${PROJECT_NAME}
             COMMAND readelf --dynamic ${OBJECTFILE})
-        set_tests_properties(nolib-${LIBNAME}-${PROJECT_NAME} PROPERTIES 
+        set_tests_properties(nolib-${LIBNAME}-${PROJECT_NAME} PROPERTIES
             FAIL_REGULAR_EXPRESSION "0x[0-9a-f]+ \\(NEEDED\\)[ \\t]+Shared library: \\[${CMAKE_SHARED_LIBRARY_PREFIX}${LIBNAME_REGEX}${CMAKE_SHARED_LIBRARY_SUFFIX}.*\\]")
     endif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
 endfunction(nolib_test)
@@ -34,7 +34,7 @@
   GET_TARGET_PROPERTY_WITH_DEFAULT(_target_shouldnotlink ${_target} LT_SHOULDNOTLINK no)
   GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlopen ${_target} LT_DLOPEN "")
   GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlpreopen ${_target} LT_DLPREOPEN "")
-  
+
   SET(_lanamewe ${CMAKE_SHARED_LIBRARY_PREFIX}${_target})
   SET(_soname ${_lanamewe}${CMAKE_SHARED_LIBRARY_SUFFIX})
   SET(_soext ${CMAKE_SHARED_LIBRARY_SUFFIX})
@@ -77,19 +77,16 @@
     if (EXISTS ${PROJECT_SOURCE_DIR}/standards/${TESTNAME}${CMAKE_SYSTEM_NAME}.log)
         set(PLATFORM_TEST_SUFFIX ${CMAKE_SYSTEM_NAME})
     endif (EXISTS ${PROJECT_SOURCE_DIR}/standards/${TESTNAME}${CMAKE_SYSTEM_NAME}.log)
-    if (NOT (GRAPHITE2_NSEGCACHE OR GRAPHITE2_NFILEFACE))
+    if (NOT GRAPHITE2_NFILEFACE)
         add_test(NAME ${TESTNAME} COMMAND $<TARGET_FILE:gr2fonttest> -trace ${PROJECT_BINARY_DIR}/${TESTNAME}.json -log ${PROJECT_BINARY_DIR}/${TESTNAME}.log ${PROJECT_SOURCE_DIR}/fonts/${FONTFILE} -codes ${ARGN})
         set_tests_properties(${TESTNAME} PROPERTIES TIMEOUT 3)
-        if (GRAPHITE2_ASAN)
-            set_property(TEST ${TESTNAME} APPEND PROPERTY ENVIRONMENT "ASAN_SYMBOLIZER_PATH=${ASAN_SYMBOLIZER}")
-        endif (GRAPHITE2_ASAN)
         add_test(NAME ${TESTNAME}Output COMMAND ${CMAKE_COMMAND} -E compare_files ${PROJECT_BINARY_DIR}/${TESTNAME}.log ${PROJECT_SOURCE_DIR}/standards/${TESTNAME}${PLATFORM_TEST_SUFFIX}.log)
-        if (NOT GRAPHITE2_NTRACING)
-            add_test(NAME ${TESTNAME}Debug COMMAND python ${PROJECT_SOURCE_DIR}/jsoncmp ${PROJECT_BINARY_DIR}/${TESTNAME}.json ${PROJECT_SOURCE_DIR}/standards/${TESTNAME}.json)
+        if ((NOT GRAPHITE2_NTRACING) AND PYTHONINTERP_FOUND)
+            add_test(NAME ${TESTNAME}Debug COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/jsoncmp ${PROJECT_BINARY_DIR}/${TESTNAME}.json ${PROJECT_SOURCE_DIR}/standards/${TESTNAME}.json)
             set_tests_properties(${TESTNAME}Debug  PROPERTIES DEPENDS ${TESTNAME})
-        endif (NOT GRAPHITE2_NTRACING)
+        endif ((NOT GRAPHITE2_NTRACING) AND PYTHONINTERP_FOUND)
         set_tests_properties(${TESTNAME}Output PROPERTIES DEPENDS ${TESTNAME})
-    endif (NOT (GRAPHITE2_NSEGCACHE OR GRAPHITE2_NFILEFACE))
+    endif (NOT GRAPHITE2_NFILEFACE)
 endfunction(fonttest)
 
 
@@ -97,29 +94,21 @@
     if (EXISTS ${PROJECT_SOURCE_DIR}/standards/${TESTNAME}${CMAKE_SYSTEM_NAME}.log)
         set(PLATFORM_TEST_SUFFIX ${CMAKE_SYSTEM_NAME})
     endif (EXISTS ${PROJECT_SOURCE_DIR}/standards/${TESTNAME}${CMAKE_SYSTEM_NAME}.log)
-    if (NOT (GRAPHITE2_NSEGCACHE OR GRAPHITE2_NFILEFACE))
+    if (NOT GRAPHITE2_NFILEFACE)
         add_test(NAME ${TESTNAME} COMMAND $<TARGET_FILE:gr2fonttest> -log ${PROJECT_BINARY_DIR}/${TESTNAME}.log ${PROJECT_SOURCE_DIR}/fonts/${FONTFILE})
         set_tests_properties(${TESTNAME} PROPERTIES TIMEOUT 3)
-        if (GRAPHITE2_ASAN)
-            set_property(TEST ${TESTNAME} APPEND PROPERTY ENVIRONMENT "ASAN_SYMBOLIZER_PATH=${ASAN_SYMBOLIZER}")
-        endif (GRAPHITE2_ASAN)
         add_test(NAME ${TESTNAME}Output COMMAND ${CMAKE_COMMAND} -E compare_files ${PROJECT_BINARY_DIR}/${TESTNAME}.log ${PROJECT_SOURCE_DIR}/standards/${TESTNAME}${PLATFORM_TEST_SUFFIX}.log)
         set_tests_properties(${TESTNAME}Output PROPERTIES DEPENDS ${TESTNAME})
-    endif (NOT (GRAPHITE2_NSEGCACHE OR GRAPHITE2_NFILEFACE))
+    endif (NOT GRAPHITE2_NFILEFACE)
 endfunction(feattest)
 
 function(cmptest TESTNAME FONTFILE TEXTFILE)
+  if (NOT GRAPHITE2_SANITIZERS)
     if (EXISTS ${PROJECT_SOURCE_DIR}/standards/${TESTNAME}${CMAKE_SYSTEM_NAME}.json)
         set(PLATFORM_TEST_SUFFIX ${CMAKE_SYSTEM_NAME})
     endif (EXISTS ${PROJECT_SOURCE_DIR}/standards/${TESTNAME}${CMAKE_SYSTEM_NAME}.json)
-    if ((NOT GRAPHITE2_NFILEFACE) AND ((NOT GRAPHITE2_ASAN) OR CMAKE_COMPILER_IS_GNUCXX))
-        add_test(NAME ${TESTNAME} COMMAND python ${PROJECT_SOURCE_DIR}/fnttxtrender --graphite_library=$<TARGET_FILE:graphite2> -t ${PROJECT_SOURCE_DIR}/texts/${TEXTFILE} -o ${PROJECT_BINARY_DIR}/${TESTNAME}.json -c ${PROJECT_SOURCE_DIR}/standards/${TESTNAME}${PLATFORM_TEST_SUFFIX}.json ${ARGN} ${PROJECT_SOURCE_DIR}/fonts/${FONTFILE})
-        if (GRAPHITE2_ASAN)
-            set_property(TEST ${TESTNAME} APPEND 
-                    PROPERTY ENVIRONMENT "ASAN_SYMBOLIZER_PATH=${ASAN_SYMBOLIZER}"
-                                         "LD_PRELOAD=libasan.so.1")
-        endif (GRAPHITE2_ASAN)
-    endif ((NOT GRAPHITE2_NFILEFACE) AND ((NOT GRAPHITE2_ASAN) OR CMAKE_COMPILER_IS_GNUCXX))
+    if (PYTHON_CTYPES_COMPATBILE)
+        add_test(NAME ${TESTNAME} COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/fnttxtrender --graphite_library=$<TARGET_FILE:graphite2> -t ${PROJECT_SOURCE_DIR}/texts/${TEXTFILE} -o ${PROJECT_BINARY_DIR}/${TESTNAME}.json -c ${PROJECT_SOURCE_DIR}/standards/${TESTNAME}${PLATFORM_TEST_SUFFIX}.json ${ARGN} ${PROJECT_SOURCE_DIR}/fonts/${FONTFILE})
+    endif (PYTHON_CTYPES_COMPATBILE)
+  endif ()
 endfunction(cmptest)
-
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/README.md
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/README.md	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/README.md	2018-08-16 00:30:02 UTC (rev 48409)
@@ -1,12 +1,11 @@
 # Graphite engine
 
-## Project CI status 
-Linux -- Intel 64bit:[![Build Status](http://build.palaso.org/app/rest/builds/buildType:bt124/statusIcon)](http://build.palaso.org/viewType.html?buildTypeId=bt124&guest=1)
-Intel 32bit:[![Build Status](http://build.palaso.org/app/rest/builds/buildType:bt123/statusIcon)](http://build.palaso.org/viewType.html?buildTypeId=bt123&guest=1)
-ARM 32bit:[![Build Status](http://build.palaso.org/app/rest/builds/buildType:Graphite_Linux32bitArm/statusIcon)](http://build.palaso.org/viewType.html?buildTypeId=Graphite_Linux32bitArm&guest=1)
+## Project CI status
+| OS      | Intel 64 bit | Intel 32 bit | Arm 32 bit |
+|---------|:------------:|:------------:|:----------:|
+| Linux   | [![Build Status](http://build.palaso.org/app/rest/builds/buildType:bt124/statusIcon)](http://build.palaso.org/viewType.html?buildTypeId=bt124&guest=1) | [![Build Status](http://build.palaso.org/app/rest/builds/buildType:bt123/statusIcon)](http://build.palaso.org/viewType.html?buildTypeId=bt123&guest=1) | [![Build Status](http://build.palaso.org/app/rest/builds/buildType:Graphite_Linux32bitArm/statusIcon)](http://build.palaso.org/viewType.html?buildTypeId=Graphite_Linux32bitArm&guest=1) |
+| Windows | [![Build Status](http://build.palaso.org/app/rest/builds/buildType:Graphite_Windows64bitProduction/statusIcon)](http://build.palaso.org/viewType.html?buildTypeId=Graphite_Windows64bitProduction&guest=1) | [![Build Status](http://build.palaso.org/app/rest/builds/buildType:bt91/statusIcon)](http://build.palaso.org/viewType.html?buildTypeId=bt91&guest=1)| |
 
-Windows -- Intel 64bit:[![Build Status](http://build.palaso.org/app/rest/builds/buildType:Graphite_Windows64bitProduction/statusIcon)](http://build.palaso.org/viewType.html?buildTypeId=Graphite_Windows64bitProduction&guest=1)
-
 ## What is Graphite?
 
 Graphite is a system that can be used to create “smart fonts” capable of displaying writing systems with various complex behaviors. A smart font contains not only letter shapes but also additional instructions indicating how to combine and position the letters in complex ways.

Modified: trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Font.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -30,7 +30,7 @@
 
 #define GR2_VERSION_MAJOR   1
 #define GR2_VERSION_MINOR   3
-#define GR2_VERSION_BUGFIX  11
+#define GR2_VERSION_BUGFIX  12
 
 #ifdef __cplusplus
 extern "C"
@@ -51,12 +51,12 @@
 * The Face Options allow the application to require that certain tables are
 * read during face construction. This may be of concern if the appFaceHandle
 * used in the gr_get_table_fn may change.
-* The values can be combined 
+* The values can be combined
 */
 enum gr_face_options {
     /** No preload, no cmap caching, fail if the graphite tables are invalid */
     gr_face_default = 0,
-    /** Dumb rendering will be enabled if the graphite tables are invalid */
+    /** Dumb rendering will be enabled if the graphite tables are invalid. @deprecated Since 1.311 */
     gr_face_dumbRendering = 1,
     /** preload glyphs at construction time */
     gr_face_preloadGlyphs = 2,
@@ -113,7 +113,7 @@
 	gr_get_table_fn 	get_table;
         /** is a pointer to a function to notify the client the a table can be released.
           * This can be NULL to signify that the client does not wish to do any release handling. */
-	gr_release_table_fn	release_table;  
+	gr_release_table_fn	release_table;
 };
 typedef struct gr_face_ops	gr_face_ops;
 
@@ -130,8 +130,8 @@
   */
 GR2_API gr_face* gr_make_face_with_ops(const void* appFaceHandle/*non-NULL*/, const gr_face_ops *face_ops, unsigned int faceOptions);
 
-/** Create a gr_face object given application information and a getTable function. This function is deprecated as of v1.2.0 in
-  * favour of gr_make_face_with_ops.
+/** @deprecated Since v1.2.0 in favour of gr_make_face_with_ops.
+  * Create a gr_face object given application information and a getTable function.
   *
   * @return gr_face or NULL if the font fails to load for some reason.
   * @param appFaceHandle This is application specific information that is passed
@@ -140,22 +140,25 @@
   * @param getTable      Callback function to get table data.
   * @param faceOptions   Bitfield describing various options. See enum gr_face_options for details.
   */
-GR2_API gr_face* gr_make_face(const void* appFaceHandle/*non-NULL*/, gr_get_table_fn getTable, unsigned int faceOptions);
+GR2_DEPRECATED_API gr_face* gr_make_face(const void* appFaceHandle/*non-NULL*/, gr_get_table_fn getTable, unsigned int faceOptions);
 
-//#ifndef GRAPHITE2_NSEGCACHE
-/** Create a gr_face object given application information, with subsegmental caching support
+/** @deprecated   Since 1.3.7 this function is now an alias for gr_make_face_with_ops().
   *
+  * Create a gr_face object given application information, with subsegmental caching support
+  *
   * @return gr_face or NULL if the font fails to load.
   * @param appFaceHandle is a pointer to application specific information that is passed to getTable.
   *                      This may not be NULL and must stay alive as long as the gr_face is alive.
   * @param face_ops      Pointer to face specific callback structure for table management. Must stay
   *                      alive for the duration of the call only.
-  * @param segCacheMaxSize   How large the segment cache is.
+  * @param segCacheMaxSize Unused.
   * @param faceOptions   Bitfield of values from enum gr_face_options
   */
-GR2_API gr_face* gr_make_face_with_seg_cache_and_ops(const void* appFaceHandle, const gr_face_ops *face_ops, unsigned int segCacheMaxSize, unsigned int faceOptions);
+GR2_DEPRECATED_API gr_face* gr_make_face_with_seg_cache_and_ops(const void* appFaceHandle, const gr_face_ops *face_ops, unsigned int segCacheMaxSize, unsigned int faceOptions);
 
-/** Create a gr_face object given application information, with subsegmental caching support.
+/** @deprecated   Since 1.3.7 this function is now an alias for gr_make_face().
+  *
+  * Create a gr_face object given application information, with subsegmental caching support.
   * This function is deprecated as of v1.2.0 in favour of gr_make_face_with_seg_cache_and_ops.
   *
   * @return gr_face or NULL if the font fails to load.
@@ -165,8 +168,7 @@
   * @param segCacheMaxSize   How large the segment cache is.
   * @param faceOptions   Bitfield of values from enum gr_face_options
   */
-GR2_API gr_face* gr_make_face_with_seg_cache(const void* appFaceHandle, gr_get_table_fn getTable, unsigned int segCacheMaxSize, unsigned int faceOptions);
-//#endif
+GR2_DEPRECATED_API gr_face* gr_make_face_with_seg_cache(const void* appFaceHandle, gr_get_table_fn getTable, unsigned int segCacheMaxSize, unsigned int faceOptions);
 
 /** Convert a tag in a string into a gr_uint32
   *
@@ -243,16 +245,16 @@
   */
 GR2_API gr_face* gr_make_file_face(const char *filename, unsigned int faceOptions);
 
-//#ifndef GRAPHITE2_NSEGCACHE
-/** Create gr_face from a font file, with subsegment caching support.
+/** @deprecated   Since 1.3.7. This function is now an alias for gr_make_file_face().
   *
+  * Create gr_face from a font file, with subsegment caching support.
+  *
   * @return gr_face that accesses a font file directly. Returns NULL on failure.
   * @param filename Full path and filename to font file
   * @param segCacheMaxSize Specifies how big to make the cache in segments.
   * @param faceOptions   Bitfield from enum gr_face_options to control face options.
   */
-GR2_API gr_face* gr_make_file_face_with_seg_cache(const char *filename, unsigned int segCacheMaxSize, unsigned int faceOptions);
-//#endif
+GR2_DEPRECATED_API gr_face* gr_make_file_face_with_seg_cache(const char *filename, unsigned int segCacheMaxSize, unsigned int faceOptions);
 #endif      // !GRAPHITE2_NFILEFACE
 
 /** Create a font from a face
@@ -347,7 +349,7 @@
   * @param pfeatureref gr_feature_ref of the feature of interest
   * @param settingno   Index up to the return value of gr_fref_n_values() of the value
   */
-GR2_API gr_int16 gr_fref_value(const gr_feature_ref* pfeatureref, gr_uint16 settingno);   
+GR2_API gr_int16 gr_fref_value(const gr_feature_ref* pfeatureref, gr_uint16 settingno);
 
 /** Returns a string of the UI name of a feature
   *
@@ -385,4 +387,3 @@
 #ifdef __cplusplus
 }
 #endif
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Log.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Log.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Log.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -42,7 +42,7 @@
     GRLOG_SEGMENT = 0x02,
     GRLOG_PASS = 0x04,
     GRLOG_CACHE = 0x08,
-    
+
     GRLOG_OPCODE = 0x80,
     GRLOG_ALL = 0xFF
 } GrLogMask;

Modified: trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Segment.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Segment.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Segment.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -62,63 +62,63 @@
 /** Used for looking up slot attributes. Most are already available in other functions **/
 enum gr_attrCode {
     /// adjusted glyph advance in x direction in design units
-    gr_slatAdvX = 0,        
+    gr_slatAdvX = 0,
     /// adjusted glyph advance in y direction (usually 0) in design units
-    gr_slatAdvY,            
+    gr_slatAdvY,
     /// returns 0. Deprecated.
-    gr_slatAttTo,           
+    gr_slatAttTo,
     /// This slot attaches to its parent at the given design units in the x direction
-    gr_slatAttX,            
+    gr_slatAttX,
     /// This slot attaches to its parent at the given design units in the y direction
-    gr_slatAttY,            
+    gr_slatAttY,
     /// This slot attaches to its parent at the given glyph point (not implemented)
-    gr_slatAttGpt,          
+    gr_slatAttGpt,
     /// x-direction adjustment from the given glyph point (not implemented)
-    gr_slatAttXOff,         
+    gr_slatAttXOff,
     /// y-direction adjustment from the given glyph point (not implemented)
-    gr_slatAttYOff,         
+    gr_slatAttYOff,
     /// Where on this glyph should align with the attachment point on the parent glyph in the x-direction.
-    gr_slatAttWithX,        
+    gr_slatAttWithX,
     /// Where on this glyph should align with the attachment point on the parent glyph in the y-direction
-    gr_slatAttWithY,        
+    gr_slatAttWithY,
     /// Which glyph point on this glyph should align with the attachment point on the parent glyph (not implemented).
-    gr_slatWithGpt,         
+    gr_slatWithGpt,
     /// Adjustment to gr_slatWithGpt in x-direction (not implemented)
-    gr_slatAttWithXOff,     
+    gr_slatAttWithXOff,
     /// Adjustment to gr_slatWithGpt in y-direction (not implemented)
-    gr_slatAttWithYOff,     
+    gr_slatAttWithYOff,
     /// Attach at given nesting level (not implemented)
-    gr_slatAttLevel,        
+    gr_slatAttLevel,
     /// Line break breakweight for this glyph
-    gr_slatBreak,           
+    gr_slatBreak,
     /// Ligature component reference (not implemented)
-    gr_slatCompRef,         
+    gr_slatCompRef,
     /// bidi directionality of this glyph (not implemented)
-    gr_slatDir,             
+    gr_slatDir,
     /// Whether insertion is allowed before this glyph
     gr_slatInsert,
     /// Final positioned position of this glyph relative to its parent in x-direction in pixels
-    gr_slatPosX,            
+    gr_slatPosX,
     /// Final positioned position of this glyph relative to its parent in y-direction in pixels
-    gr_slatPosY,            
+    gr_slatPosY,
     /// Amount to shift glyph by in x-direction design units
-    gr_slatShiftX,          
+    gr_slatShiftX,
     /// Amount to shift glyph by in y-direction design units
-    gr_slatShiftY,          
+    gr_slatShiftY,
     /// attribute user1
-    gr_slatUserDefnV1,      
+    gr_slatUserDefnV1,
     /// not implemented
-    gr_slatMeasureSol,      
+    gr_slatMeasureSol,
     /// not implemented
-    gr_slatMeasureEol,      
+    gr_slatMeasureEol,
     /// Amount this slot can stretch (not implemented)
-    gr_slatJStretch,        
+    gr_slatJStretch,
     /// Amount this slot can shrink (not implemented)
-    gr_slatJShrink,         
+    gr_slatJShrink,
     /// Granularity by which this slot can stretch or shrink (not implemented)
-    gr_slatJStep,           
+    gr_slatJStep,
     /// Justification weight for this glyph (not implemented)
-    gr_slatJWeight,         
+    gr_slatJWeight,
     /// Amount this slot mush shrink or stretch in design units
     gr_slatJWidth = 29,
     /// SubSegment split point
@@ -159,11 +159,11 @@
     gr_slatSeqBelowWt,
     gr_slatSeqValignHt,
     gr_slatSeqValignWt,
-                            
+
     /// not implemented
-    gr_slatMax,             
+    gr_slatMax,
     /// not implemented
-    gr_slatNoEffect = gr_slatMax + 1    
+    gr_slatNoEffect = gr_slatMax + 1
 };
 
 enum gr_bidirtl {
@@ -182,13 +182,13 @@
 typedef struct gr_slot          gr_slot;
 
 /** Returns Unicode character for a charinfo.
-  * 
+  *
   * @param p Pointer to charinfo to return information on.
   */
 GR2_API unsigned int gr_cinfo_unicode_char(const gr_char_info* p/*not NULL*/);
 
 /** Returns breakweight for a charinfo.
-  * 
+  *
   * @return Breakweight is a number between -50 and 50 indicating the cost of a
   * break before or after this character. If the value < 0, the absolute value
   * is this character's contribution to the overall breakweight before it. If the value

Modified: trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Types.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Types.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/include/graphite2/Types.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -40,33 +40,40 @@
   gr_utf8 = 1/*sizeof(uint8)*/, gr_utf16 = 2/*sizeof(uint16)*/, gr_utf32 = 4/*sizeof(uint32)*/
 };
 
-// Definitions for library publicly exported symbols
+
+// Define API function declspec/attributes and how each supported compiler or OS
+// allows us to specify them.
+#if defined __GNUC__
+  #define _gr2_and ,
+  #define _gr2_tag_fn(a)        __attribute__((a))
+  #define _gr2_deprecated_flag  deprecated
+  #define _gr2_export_flag      visibility("default")
+  #define _gr2_import_flag      visibility("default")
+  #define _gr2_static_flag      visibility("hidden")
+#endif
+
 #if defined _WIN32 || defined __CYGWIN__
-  #if defined GRAPHITE2_STATIC
-    #define GR2_API
-  #elif defined GRAPHITE2_EXPORTING
-    #if defined __GNUC__
-      #define GR2_API    __attribute__((dllexport))
-    #else
-      #define GR2_API    __declspec(dllexport)
-    #endif
-  #else
-    #if defined __GNUC__
-      #define GR2_API    __attribute__((dllimport))
-    #else
-      #define GR2_API    __declspec(dllimport)
-    #endif
+  #if defined __GNUC__  // These three will be redefined for Windows
+    #undef _gr2_export_flag
+    #undef _gr2_import_flag
+    #undef _gr2_static_flag
+  #else  // How MSVC sepcifies function level attributes adn deprecation
+    #define _gr2_and
+    #define _gr2_tag_fn(a)       __declspec(a)
+    #define _gr2_deprecated_flag deprecated
   #endif
-  #define GR2_LOCAL
-#elif __GNUC__ >= 4
-  #if defined GRAPHITE2_STATIC
-    #define GR2_API      __attribute__ ((visibility("hidden")))
-  #else
-    #define GR2_API      __attribute__ ((visibility("default")))
-  #endif
-  #define GR2_LOCAL      __attribute__ ((visibility("hidden")))
+  #define _gr2_export_flag     dllexport
+  #define _gr2_import_flag     dllimport
+  #define _gr2_static_flag
+#endif
+
+#if defined GRAPHITE2_STATIC
+  #define GR2_API             _gr2_tag_fn(_gr2_static_flag)
+  #define GR2_DEPRECATED_API  _gr2_tag_fn(_gr2_deprecated_flag _gr2_and _gr2_static_flag)
+#elif defined GRAPHITE2_EXPORTING
+  #define GR2_API             _gr2_tag_fn(_gr2_export_flag)
+  #define GR2_DEPRECATED_API  _gr2_tag_fn(_gr2_deprecated_flag _gr2_and _gr2_export_flag)
 #else
-  #define GR2_API
-  #define GR2_LOCAL
+  #define GR2_API             _gr2_tag_fn(_gr2_import_flag)
+  #define GR2_DEPRECATED_API  _gr2_tag_fn(_gr2_deprecated_flag _gr2_and _gr2_import_flag)
 #endif
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/CMakeLists.txt
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/CMakeLists.txt	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/CMakeLists.txt	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 #
 #    You should also have received a copy of the GNU Lesser General Public
 #    License along with this library in the file named "LICENSE".
-#    If not, write to the Free Software Foundation, 51 Franklin Street, 
-#    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+#    If not, write to the Free Software Foundation, 51 Franklin Street,
+#    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
 #    internet at http://www.fsf.org/licenses/lgpl.html.
 
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
@@ -25,7 +25,7 @@
 INCLUDE(CheckCXXSourceCompiles)
 
 set(GRAPHITE_API_CURRENT 3)
-set(GRAPHITE_API_REVISION 0)
+set(GRAPHITE_API_REVISION 2)
 set(GRAPHITE_API_AGE 1)
 set(GRAPHITE_VERSION ${GRAPHITE_API_CURRENT}.${GRAPHITE_API_REVISION}.${GRAPHITE_API_AGE})
 set(GRAPHITE_SO_VERSION ${GRAPHITE_API_CURRENT})
@@ -34,12 +34,6 @@
 
 include_directories(${PROJECT_SOURCE_DIR})
 
-set(SEGCACHE SegCache.cpp SegCacheEntry.cpp SegCacheStore.cpp)
-if (GRAPHITE2_NSEGCACHE)
-    add_definitions(-DGRAPHITE2_NSEGCACHE)
-    set(SEGCACHE)
-endif (GRAPHITE2_NSEGCACHE)
-
 set(FILEFACE FileFace.cpp)
 if (GRAPHITE2_NFILEFACE)
     add_definitions(-DGRAPHITE2_NFILEFACE)
@@ -60,7 +54,7 @@
     add_definitions(-DGRAPHITE2_STATIC)
 endif (NOT BUILD_SHARED_LIBS)
 
-set(GRAPHITE_HEADERS 
+set(GRAPHITE_HEADERS
     ../include/graphite2/Font.h
     ../include/graphite2/Segment.h
     ../include/graphite2/Types.h
@@ -67,7 +61,7 @@
     ../include/graphite2/Log.h
     )
 
-file(GLOB PRIVATE_HEADERS inc/*.h) 
+file(GLOB PRIVATE_HEADERS inc/*.h)
 
 add_library(graphite2
     ${GRAPHITE2_VM_TYPE}_machine.cpp
@@ -78,7 +72,6 @@
     gr_logging.cpp
     gr_segment.cpp
     gr_slot.cpp
-    CachedFace.cpp
     CmapCache.cpp
     Code.cpp
     Collider.cpp
@@ -100,7 +93,6 @@
     TtfUtil.cpp
     UtfCodec.cpp
     ${FILEFACE}
-    ${SEGCACHE}
     ${TRACING})
 
 set_target_properties(graphite2 PROPERTIES  PUBLIC_HEADER "${GRAPHITE_HEADERS}"
@@ -123,21 +115,21 @@
     endif (CMAKE_COMPILER_IS_GNUCXX)
     message(STATUS "Compiler ID is: ${CMAKE_CXX_COMPILER_ID}")
     if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
-        add_definitions(-Wimplicit-fallthrough)
+        add_definitions(-Wimplicit-fallthrough -Wshorten-64-to-32)
     endif (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
     if (${CMAKE_CXX_COMPILER} MATCHES  ".*mingw.*")
         target_link_libraries(graphite2 kernel32 msvcr90 mingw32 gcc user32)
     else (${CMAKE_CXX_COMPILER} MATCHES  ".*mingw.*")
-        if (GRAPHITE2_ASAN)
+        if (GRAPHITE2_SANITIZERS)
             target_link_libraries(graphite2 c gcc_s)
-        else (GRAPHITE2_ASAN)
+        else ()
             target_link_libraries(graphite2 c gcc)
-        endif (GRAPHITE2_ASAN)
-        include(Graphite)
-        if (BUILD_SHARED_LIBS)
-            nolib_test(stdc++ $<TARGET_SONAME_FILE:graphite2>)
-        endif (BUILD_SHARED_LIBS)
+        endif ()
     endif (${CMAKE_CXX_COMPILER} MATCHES  ".*mingw.*")
+    include(Graphite)
+    if (BUILD_SHARED_LIBS)
+        nolib_test(stdc++ $<TARGET_SONAME_FILE:graphite2>)
+    endif ()
     set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
     CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}")
 endif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
@@ -155,7 +147,7 @@
 endif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
 
 if  (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
-    set_target_properties(graphite2 PROPERTIES 
+    set_target_properties(graphite2 PROPERTIES
         COMPILE_DEFINITIONS "_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;UNICODE;GRAPHITE2_EXPORTING")
 endif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
 

Deleted: trunk/Build/source/libs/graphite2/graphite2-src/src/CachedFace.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/CachedFace.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/CachedFace.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -1,127 +0,0 @@
-/*  GRAPHITE2 LICENSING
-
-    Copyright 2010, SIL International
-    All rights reserved.
-
-    This library is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published
-    by the Free Software Foundation; either version 2.1 of License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should also have received a copy of the GNU Lesser General Public
-    License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street,
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
-    internet at http://www.fsf.org/licenses/lgpl.html.
-
-Alternatively, the contents of this file may be used under the terms of the
-Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public
-License, as published by the Free Software Foundation, either version 2
-of the License or (at your option) any later version.
-*/
-
-#ifndef GRAPHITE2_NSEGCACHE
-
-#include <graphite2/Segment.h>
-#include "inc/CachedFace.h"
-#include "inc/SegCacheStore.h"
-
-
-using namespace graphite2;
-
-CachedFace::CachedFace(const void* appFaceHandle/*non-NULL*/, const gr_face_ops & ops)
-: Face(appFaceHandle, ops), m_cacheStore(0)
-{
-}
-
-CachedFace::~CachedFace()
-{
-    delete m_cacheStore;
-}
-
-bool CachedFace::setupCache(unsigned int cacheSize)
-{
-    m_cacheStore = new SegCacheStore(*this, m_numSilf, cacheSize);
-    return bool(m_cacheStore);
-}
-
-
-bool CachedFace::runGraphite(Segment *seg, const Silf *pSilf) const
-{
-    assert(pSilf);
-    pSilf->runGraphite(seg, 0, pSilf->substitutionPass());
-
-    unsigned int silfIndex = 0;
-    for (; silfIndex < m_numSilf && &(m_silfs[silfIndex]) != pSilf; ++silfIndex);
-    if (silfIndex == m_numSilf)  return false;
-    SegCache * const segCache = m_cacheStore->getOrCreate(silfIndex, seg->getFeatures(0));
-    if (!segCache)
-        return false;
-
-    assert(m_cacheStore);
-    // find where the segment can be broken
-    Slot * subSegStartSlot = seg->first();
-    Slot * subSegEndSlot = subSegStartSlot;
-    uint16 cmapGlyphs[eMaxSpliceSize];
-    int subSegStart = 0;
-    for (unsigned int i = 0; i < seg->charInfoCount() && subSegEndSlot; ++i)
-    {
-        const unsigned int length = i - subSegStart + 1;
-        if (length < eMaxSpliceSize && subSegEndSlot->gid() < m_cacheStore->maxCmapGid())
-            cmapGlyphs[length-1] = subSegEndSlot->gid();
-        else return false;
-        const bool spaceOnly = m_cacheStore->isSpaceGlyph(subSegEndSlot->gid());
-        // at this stage the character to slot mapping is still 1 to 1
-        const int   breakWeight = seg->charinfo(i)->breakWeight(),
-                    nextBreakWeight = (i + 1 < seg->charInfoCount())?
-                            seg->charinfo(i+1)->breakWeight() : 0;
-        const uint8 f = seg->charinfo(i)->flags();
-        if (((spaceOnly
-                || (breakWeight > 0 && breakWeight <= gr_breakWord)
-                || i + 1 == seg->charInfoCount()
-                || ((nextBreakWeight < 0 && nextBreakWeight >= gr_breakBeforeWord)
-                    || (subSegEndSlot->next() && m_cacheStore->isSpaceGlyph(subSegEndSlot->next()->gid()))))
-                && f != 1)
-            || f == 2)
-        {
-            // record the next slot before any splicing
-            Slot * nextSlot = subSegEndSlot->next();
-            // spaces should be left untouched by graphite rules in any sane font
-            if (!spaceOnly)
-            {
-                // found a break position, check for a cache of the sub sequence
-                const SegCacheEntry * entry = segCache->find(cmapGlyphs, length);
-                // TODO disable cache for words at start/end of line with contextuals
-                if (!entry)
-                {
-                    SegmentScopeState scopeState = seg->setScope(subSegStartSlot, subSegEndSlot, length);
-                    pSilf->runGraphite(seg, pSilf->substitutionPass(), pSilf->numPasses());
-                    if (length < eMaxSpliceSize)
-                    {
-                        seg->associateChars(subSegStart, length);
-                        segCache->cache(m_cacheStore, cmapGlyphs, length, seg, subSegStart);
-                    }
-                    seg->removeScope(scopeState);
-                }
-                else
-                    seg->splice(subSegStart, length, subSegStartSlot, subSegEndSlot,
-                        entry->first(), entry->glyphLength());
-            }
-            subSegStartSlot = subSegEndSlot = nextSlot;
-            subSegStart = i + 1;
-        }
-        else
-        {
-            subSegEndSlot = subSegEndSlot->next();
-        }
-    }
-    return true;
-}
-
-#endif
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Code.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Code.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Code.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -24,7 +24,7 @@
 License, as published by the Free Software Foundation, either version 2
 of the License or (at your option) any later version.
 */
-// This class represents loaded graphite stack machine code.  It performs 
+// This class represents loaded graphite stack machine code.  It performs
 // basic sanity checks, on the incoming code to prevent more obvious problems
 // from crashing graphite.
 // Author: Tim Eves
@@ -67,7 +67,7 @@
 struct context
 {
     context(uint8 ref=0) : codeRef(ref) {flags.changed=false; flags.referenced=false;}
-    struct { 
+    struct {
         uint8   changed:1,
                 referenced:1;
     } flags;
@@ -82,14 +82,14 @@
 public:
     struct limits;
     static const int NUMCONTEXTS = 256;
-    
+
     decoder(limits & lims, Code &code, enum passtype pt) throw();
-    
+
     bool        load(const byte * bc_begin, const byte * bc_end);
     void        apply_analysis(instr * const code, instr * code_end);
     byte        max_ref() { return _max_ref; }
     int         out_index() const { return _out_index; }
-    
+
 private:
     void        set_ref(int index) throw();
     void        set_noref(int index) throw();
@@ -102,7 +102,7 @@
     bool        test_context() const throw();
     bool        test_ref(int8 index) const throw();
     void        failure(const status_t s) const throw() { _code.failure(s); }
-    
+
     Code              & _code;
     int                 _out_index;
     uint16              _out_length;
@@ -128,11 +128,11 @@
                      features;
   const byte         attrid[gr_slatMax];
 };
-   
+
 inline Machine::Code::decoder::decoder(limits & lims, Code &code, enum passtype pt) throw()
 : _code(code),
-  _out_index(code._constraint ? 0 : lims.pre_context), 
-  _out_length(code._constraint ? 1 : lims.rule_length), 
+  _out_index(code._constraint ? 0 : lims.pre_context),
+  _out_length(code._constraint ? 1 : lims.rule_length),
   _instr(code._code), _data(code._data), _max(lims), _passtype(pt),
   _stack_depth(0),
   _in_ctxt_item(false),
@@ -139,9 +139,9 @@
   _slotref(0),
   _max_ref(0)
 { }
-    
 
 
+
 Machine::Code::Code(bool is_constraint, const byte * bytecode_begin, const byte * const bytecode_end,
            uint8 pre_context, uint16 rule_length, const Silf & silf, const Face & face,
            enum passtype pt, byte * * const _out)
@@ -159,18 +159,18 @@
     }
     assert(bytecode_end > bytecode_begin);
     const opcode_t *    op_to_fn = Machine::getOpcodeTable();
-    
+
     // Allocate code and data target buffers, these sizes are a worst case
     // estimate.  Once we know their real sizes the we'll shrink them.
     if (_out)   _code = reinterpret_cast<instr *>(*_out);
     else        _code = static_cast<instr *>(malloc(estimateCodeDataOut(bytecode_end-bytecode_begin, 1, is_constraint ? 0 : rule_length)));
     _data = reinterpret_cast<byte *>(_code + (bytecode_end - bytecode_begin));
-    
+
     if (!_code || !_data) {
         failure(alloc_failed);
         return;
     }
-    
+
     decoder::limits lims = {
         bytecode_end,
         pre_context,
@@ -177,20 +177,20 @@
         rule_length,
         silf.numClasses(),
         face.glyphs().numAttrs(),
-        face.numFeatures(), 
-        {1,1,1,1,1,1,1,1, 
+        face.numFeatures(),
+        {1,1,1,1,1,1,1,1,
          1,1,1,1,1,1,1,255,
-         1,1,1,1,1,1,1,1, 
-         1,1,1,1,1,1,0,0, 
-         0,0,0,0,0,0,0,0, 
-         0,0,0,0,0,0,0,0, 
+         1,1,1,1,1,1,1,1,
+         1,1,1,1,1,1,0,0,
+         0,0,0,0,0,0,0,0,
+         0,0,0,0,0,0,0,0,
          0,0,0,0,0,0,0, silf.numUser()}
     };
-    
+
     decoder dec(lims, *this, pt);
     if(!dec.load(bytecode_begin, bytecode_end))
        return;
-    
+
     // Is this an empty program?
     if (_instr_count == 0)
     {
@@ -198,7 +198,7 @@
       ::new (this) Code();
       return;
     }
-    
+
     // When we reach the end check we've terminated it correctly
     if (!is_return(_code[_instr_count-1])) {
         failure(missing_return);
@@ -208,9 +208,9 @@
     assert((_constraint && immutable()) || !_constraint);
     dec.apply_analysis(_code, _code + _instr_count);
     _max_ref = dec.max_ref();
-    
+
     // Now we know exactly how much code and data the program really needs
-    // realloc the buffers to exactly the right size so we don't waste any 
+    // realloc the buffers to exactly the right size so we don't waste any
     // memory.
     assert((bytecode_end - bytecode_begin) >= ptrdiff_t(_instr_count));
     assert((bytecode_end - bytecode_begin) >= ptrdiff_t(_data_size));
@@ -255,13 +255,13 @@
         const opcode opc = fetch_opcode(bc++);
         if (opc == vm::MAX_OPCODE)
             return false;
-        
+
         analyse_opcode(opc, reinterpret_cast<const int8 *>(bc));
-        
+
         if (!emit_opcode(opc, bc))
             return false;
     }
-    
+
     return bool(_code);
 }
 
@@ -275,7 +275,7 @@
     // Do some basic sanity checks based on what we know about the opcode
     if (!validate_opcode(opc, bc))  return MAX_OPCODE;
 
-    // And check it's arguments as far as possible
+    // And check its arguments as far as possible
     switch (opcode(opc))
     {
         case NOP :
@@ -509,7 +509,7 @@
     case NEXT :
     case COPY_NEXT :
       ++_slotref;
-      _contexts[_slotref] = context(_code._instr_count+1);
+      _contexts[_slotref] = context(uint8(_code._instr_count+1));
       // if (_analysis.slotref > _analysis.max_ref) _analysis.max_ref = _analysis.slotref;
       break;
     case INSERT :
@@ -517,7 +517,7 @@
       _code._modify = true;
       break;
     case PUT_SUBS_8BIT_OBS :    // slotref on 1st parameter
-    case PUT_SUBS : 
+    case PUT_SUBS :
       _code._modify = true;
       set_changed(0);
       GR_FALLTHROUGH;
@@ -559,7 +559,7 @@
     const size_t     param_sz = op.param_sz == VARARGS ? bc[0] + 1 : op.param_sz;
 
     // Add this instruction
-    *_instr++ = op.impl[_code._constraint]; 
+    *_instr++ = op.impl[_code._constraint];
     ++_code._instr_count;
 
     // Grab the parameters
@@ -569,8 +569,8 @@
         _data            += param_sz;
         _code._data_size += param_sz;
     }
-    
-    // recursively decode a context item so we can split the skip into 
+
+    // recursively decode a context item so we can split the skip into
     // instruction and data portions.
     if (opc == CNTXT_ITEM)
     {
@@ -589,8 +589,8 @@
         if (load(bc, bc + instr_skip))
         {
             bc += instr_skip;
-            data_skip  = instr_skip - (_code._instr_count - ctxt_start);
-            instr_skip = _code._instr_count - ctxt_start;
+            data_skip  = instr_skip - byte(_code._instr_count - ctxt_start);
+            instr_skip =  byte(_code._instr_count - ctxt_start);
             _max.bytecode = curr_end;
 
             _out_length = 1;
@@ -605,7 +605,7 @@
             return false;
         }
     }
-    
+
     return bool(_code);
 }
 
@@ -620,8 +620,8 @@
     for (const context * c = _contexts, * const ce = c + _slotref; c < ce; ++c)
     {
         if (!c->flags.referenced || !c->flags.changed) continue;
-        
-        instr * const tip = code + c->codeRef + tempcount;        
+
+        instr * const tip = code + c->codeRef + tempcount;
         memmove(tip+1, tip, (code_end - tip) * sizeof(instr));
         *tip = temp_copy;
         ++code_end;
@@ -628,7 +628,7 @@
         ++tempcount;
         _code._delete = true;
     }
-    
+
     _code._instr_count = code_end - code;
 }
 
@@ -695,7 +695,7 @@
     return true;
 }
 
-inline 
+inline
 void Machine::Code::failure(const status_t s) throw() {
     release_buffers();
     _status = s;
@@ -750,4 +750,3 @@
 
     return  m.run(_code, _data, map);
 }
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Collider.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -37,7 +37,7 @@
 
 #define ISQRT2 0.707106781f
 
-// Possible rounding error for subbox boundaries: 0.016 = 1/64 = 1/256 * 4 
+// Possible rounding error for subbox boundaries: 0.016 = 1/64 = 1/256 * 4
 // (values in font range from 0..256)
 // #define SUBBOX_RND_ERR 0.016
 
@@ -118,7 +118,7 @@
 
 	_margin = margin;
 	_marginWt = marginWeight;
-    
+
     SlotCollision *c = seg->collisionInfo(aSlot);
     _seqClass = c->seqClass();
 	_seqProxClass = c->seqProxClass();
@@ -166,7 +166,7 @@
                     _ranges[axis].weighted<XY>(box.bl.y - c, box.tr.y - c, weight, a, 0, 0, org.x,
                                                 m * (a * a + sqr((minright ? box.tr.x : box.bl.x) - 0.5f * (bb.xi + bb.xa))), false);
                 else
-                    _ranges[axis].weighted<XY>(box.bl.y - c, box.tr.y - c, weight, a, m, 
+                    _ranges[axis].weighted<XY>(box.bl.y - c, box.tr.y - c, weight, a, m,
                                                 (minright ? box.tr.y : box.bl.y) - c, a, 0, false);
             }
             break;
@@ -230,7 +230,7 @@
             }
             break;
         case 2 :
-            if (box.bl.x - box.tr.y < org.x - org.y + sb.da && box.tr.x - box.bl.y > org.x - org.y + sb.di 
+            if (box.bl.x - box.tr.y < org.x - org.y + sb.da && box.tr.x - box.bl.y > org.x - org.y + sb.di
                 && box.width() > 0 && box.height() > 0)
             {
                 float di = org.x - org.y + sb.di;
@@ -242,7 +242,7 @@
             }
             break;
         case 3 :
-            if (box.bl.x + box.bl.y < org.x + org.y + sb.sa && box.tr.x + box.tr.y > org.x + org.y + sb.si 
+            if (box.bl.x + box.bl.y < org.x + org.y + sb.sa && box.tr.x + box.tr.y > org.x + org.y + sb.si
                 && box.width() > 0 && box.height() > 0)
             {
                 float si = org.x + org.y + sb.si;
@@ -285,7 +285,7 @@
     // SlotCollision * cslot = seg->collisionInfo(slot);
     int orderFlags = 0;
     bool sameClass = _seqProxClass == 0 && cslot->seqClass() == _seqClass;
-    if (sameCluster && _seqClass 
+    if (sameCluster && _seqClass
         && (sameClass || (_seqProxClass != 0 && cslot->seqClass() == _seqProxClass)))
 		// Force the target glyph to be in the specified direction from the slot we're testing.
         orderFlags = _seqOrder;
@@ -378,7 +378,7 @@
                 default :
                     continue;
             }
-            
+
 #if !defined GRAPHITE2_NTRACING
             if (dbgout)
                 dbgout->setenv(1, reinterpret_cast<void *>(-1));
@@ -400,7 +400,7 @@
                         float r1Xedge = cslot->seqAboveXoff() + 0.5f * (bb.xi + bb.xa) + sx;
                         float r3Xedge = cslot->seqBelowXlim() + bb.xa + sx + 0.5f * (tbb.xa - tbb.xi);
                         float r2Yedge = 0.5f * (bb.yi + bb.ya) + sy;
-                        
+
                         // DBGTAG(1x) means the regions are up and right
                         // region 1
                         DBGTAG(11)
@@ -452,7 +452,7 @@
                     }
                     case SlotCollision::SEQ_ORDER_NOABOVE : // enforce neighboring glyph being above
                         DBGTAG(31);
-                        removeBox(Rect(Position(bb.xi - tbb.xa + sx, sy + bb.ya), 
+                        removeBox(Rect(Position(bb.xi - tbb.xa + sx, sy + bb.ya),
                                         Position(bb.xa - tbb.xi + sx, ypinf)), tbb, tsb, org, i);
                         break;
                     case SlotCollision::SEQ_ORDER_NOBELOW :	// enforce neighboring glyph being below
@@ -569,7 +569,7 @@
     }
     hasCol |= isCol;
     return res;
-    
+
 }   // end of ShiftCollider::mergeSlot
 
 
@@ -666,7 +666,7 @@
     {
         *dbgout << json::flat << json::array << _ranges[iAxis].position();
         for (Zones::const_iterator s = _ranges[iAxis].begin(), e = _ranges[iAxis].end(); s != e; ++s)
-            *dbgout << json::flat << json::array 
+            *dbgout << json::flat << json::array
                         << Position(s->x, s->xm) << s->sm << s->smx << s->c
                     << json::close;
         *dbgout << json::close;
@@ -703,7 +703,7 @@
 }
 
 void ShiftCollider::outputJsonDbgOneVector(json * const dbgout, Segment *seg, int axis,
-	float tleft, float bestCost, float bestVal) 
+	float tleft, float bestCost, float bestVal)
 {
 	const char * label;
 	switch (axis)
@@ -718,9 +718,9 @@
 	*dbgout << json::object // vector
 		<< "direction" << label
 		<< "targetMin" << tleft;
-            
+
 	outputJsonDbgRemovals(dbgout, axis, seg);
-    	
+
     *dbgout << "ranges";
     outputJsonDbg(dbgout, seg, axis);
 
@@ -756,7 +756,7 @@
     if (bl > al)
     { if (bu > au) return bl > x ? bl : x; }
     else if (au > bu) return al > x ? al : x;
-    return x;        
+    return x;
 }
 
 // Return the given edge of the glyph at height y, taking any slant box into account.
@@ -835,7 +835,7 @@
 
     _limit = limit;
     _offsetPrev = offsetPrev; // kern from a previous pass
-    
+
     // Calculate the height of the glyph and how many horizontal slices to use.
     if (_maxy >= 1e37f)
     {
@@ -877,7 +877,7 @@
         }
         goto done;
     }
-    numSlices = _edges.size();
+    numSlices = int(_edges.size());
 
 #if !defined GRAPHITE2_NTRACING
     // Debugging
@@ -887,7 +887,7 @@
     _nearEdges.clear();
     _nearEdges.insert(_nearEdges.begin(), numSlices, (dir & 1) ? -1e38f : +1e38f);
 #endif
-    
+
     // Determine the trailing edge of each slice (ie, left edge for a RTL glyph).
     for (s = base; s; s = s->nextInCluster(s))
     {
@@ -997,7 +997,7 @@
     if (collides && !nooverlap)
         _hit = true;
     return collides | nooverlap;   // note that true is not a necessarily reliable value
-    
+
 }   // end of KernCollider::mergeSlot
 
 
@@ -1027,19 +1027,19 @@
                     << "slantBox" << seg->getFace()->glyphs().slant(_target->gid())
                     << "fix" << "kern"
                     << json::close; // target object
-        
+
         *dbgout << "slices" << json::array;
         for (int is = 0; is < (int)_edges.size(); is++)
         {
-            *dbgout << json::flat << json::object 
-                << "i" << is 
+            *dbgout << json::flat << json::object
+                << "i" << is
                 << "targetEdge" << _edges[is]
                 << "neighbor" << objectid(dslot(seg, _slotNear[is]))
-                << "nearEdge" << _nearEdges[is] 
+                << "nearEdge" << _nearEdges[is]
                 << json::close;
         }
         *dbgout << json::close; // slices array
-            
+
         *dbgout
             << "xbound" << _xbound
             << "minGap" << _mingap
@@ -1051,7 +1051,7 @@
 #endif
 
     return Position(result, 0.);
-    
+
 }   // end of KernCollider::resolve
 
 void KernCollider::shift(const Position &mv, int dir)
@@ -1072,7 +1072,7 @@
 void SlotCollision::initFromSlot(Segment *seg, Slot *slot)
 {
     // Initialize slot attributes from glyph attributes.
-	// The order here must match the order in the grcompiler code, 
+	// The order here must match the order in the grcompiler code,
 	// GrcSymbolTable::AssignInternalGlyphAttrIDs.
     uint16 gid = slot->gid();
     uint16 aCol = seg->silf()->aCollision(); // flags attr ID
@@ -1094,7 +1094,7 @@
 	_seqBelowXlim = p[aCol+12];
 	_seqBelowWt = p[aCol+13];
 	_seqValignHt = p[aCol+14];
-	_seqValignWt = p[aCol+15];    
+	_seqValignWt = p[aCol+15];
 
     // These attributes do not have corresponding glyph attribute:
     _exclGlyph = 0;

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Decompressor.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Decompressor.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Decompressor.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -47,7 +47,7 @@
                     u32 & literal_len, u32 & match_len, u32 & match_dist)
 {
     u8 const token = *src++;
-    
+
     literal_len = read_literal(src, end, token >> 4);
     literal = src;
     src += literal_len;
@@ -55,7 +55,7 @@
     // Normal exit for end of stream, wrap arround check and parital match check.
     if (src > end - sizeof(u16) || src < literal)
         return false;
-    
+
     match_dist  = *src++;
     match_dist |= *src++ << 8;
     match_len = read_literal(src, end, token & 0xf) + MINMATCH;
@@ -70,7 +70,7 @@
 {
     if (out_size <= in_size || in_size < MINSRCSIZE)
         return -1;
-    
+
     u8 const *       src     = static_cast<u8 const *>(in),
              *       literal = 0,
              * const src_end = src + in_size;
@@ -100,7 +100,7 @@
             dst = overrun_copy(dst, literal, literal_len);
             out_size -= literal_len;
         }
-        
+
         // Copy, possibly repeating, match from earlier in the
         //  decoded output.
         u8 const * const pcpy = dst - match_dist;
@@ -120,7 +120,6 @@
     if (literal > src_end - literal_len || literal_len > out_size)
         return -1;
     dst = fast_copy(dst, literal, literal_len);
-    
-    return dst - (u8*)out;
+
+    return int(dst - (u8*)out);
 }
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Face.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Face.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Face.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -34,7 +34,6 @@
 #include "inc/FileFace.h"
 #include "inc/GlyphFace.h"
 #include "inc/json.h"
-#include "inc/SegCacheStore.h"
 #include "inc/Segment.h"
 #include "inc/NameTable.h"
 #include "inc/Error.h"
@@ -142,7 +141,7 @@
     {
         error_context(EC_ASILF + (i << 8));
         const uint32 offset = be::read<uint32>(p),
-                     next   = i == m_numSilf - 1 ? silf.size() : be::peek<uint32>(p);
+                     next   = i == m_numSilf - 1 ? uint32(silf.size()) : be::peek<uint32>(p);
         if (e.test(next > silf.size() || offset >= next, E_BADSIZE))
             return error(e);
 
@@ -201,7 +200,7 @@
                 << "advance" << seg->advance()
                 << "chars"   << json::array;
         for(size_t i = 0, n = seg->charInfoCount(); i != n; ++i)
-            *dbgout     << json::flat << *seg->charinfo(i);
+            *dbgout     << json::flat << *seg->charinfo(int(i));
         *dbgout         << json::close  // Close up the chars array
                     << json::close;     // Close up the segment object
     }
@@ -239,7 +238,7 @@
     {
         case kgmetAscent : return m_ascent;
         case kgmetDescent : return m_descent;
-        default: 
+        default:
             if (gid >= glyphs().numGlyphs()) return 0;
             return glyphs().glyph(gid)->getMetric(metric);
     }
@@ -250,7 +249,7 @@
 #ifndef GRAPHITE2_NFILEFACE
     if (m_pFileFace==pFileFace)
       return;
-    
+
     delete m_pFileFace;
     m_pFileFace = pFileFace;
 #endif
@@ -276,15 +275,13 @@
 
 
 Face::Table::Table(const Face & face, const Tag n, uint32 version) throw()
-: _f(&face), _compressed(false)
+: _f(&face), _sz(0), _compressed(false)
 {
-    size_t sz = 0;
-    _p = static_cast<const byte *>((*_f->m_ops.get_table)(_f->m_appFaceHandle, n, &sz));
-    _sz = uint32(sz);
+    _p = static_cast<const byte *>((*_f->m_ops.get_table)(_f->m_appFaceHandle, n, &_sz));
 
     if (!TtfUtil::CheckTable(n, _p, _sz))
     {
-        releaseBuffers();     // Make sure we release the table buffer even if the table failed it's checks
+        release();     // Make sure we release the table buffer even if the table failed its checks
         return;
     }
 
@@ -292,7 +289,7 @@
         decompress();
 }
 
-void Face::Table::releaseBuffers()
+void Face::Table::release()
 {
     if (_compressed)
         free(const_cast<byte *>(_p));
@@ -301,12 +298,11 @@
     _p = 0; _sz = 0;
 }
 
-Face::Table & Face::Table::operator = (const Table & rhs) throw()
+Face::Table & Face::Table::operator = (const Table && rhs) throw()
 {
-    if (_p == rhs._p)   return *this;
-
-    this->~Table();
-    new (this) Table(rhs);
+    if (this == &rhs)   return *this;
+    release();
+    new (this) Table(std::move(rhs));
     return *this;
 }
 
@@ -353,7 +349,7 @@
 
     // Tell the provider to release the compressed form since were replacing
     //   it anyway.
-    releaseBuffers();
+    release();
 
     if (e)
     {

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/FeatureMap.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/FeatureMap.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/FeatureMap.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -73,7 +73,7 @@
     unsigned short & bits_offset, uint32 max_val,
     uint32 name, uint16 uiName, uint16 flags,
     FeatureSetting *settings, uint16 num_set) throw()
-: m_face(face),
+: m_face(&face),
   m_nameValues(settings),
   m_mask(mask_over_val(max_val)),
   m_max(max_val),
@@ -120,7 +120,7 @@
         return false;
     }
 
-    m_feats = grzeroalloc<FeatureRef>(m_numFeats);
+    m_feats = new FeatureRef [m_numFeats];
     uint16 * const  defVals = gralloc<uint16>(m_numFeats);
     if (!defVals || !m_feats) return false;
     unsigned short bits = 0;     //to cause overflow on first Feature
@@ -135,7 +135,7 @@
         const uint16    flags  = be::read<uint16>(p),
                         uiName = be::read<uint16>(p);
 
-        if (settings_offset > size_t(feat_end - feat_start) 
+        if (settings_offset > size_t(feat_end - feat_start)
             || settings_offset + num_settings * FEATURE_SETTING_SIZE > size_t(feat_end - feat_start))
         {
             free(defVals);
@@ -259,7 +259,7 @@
 const FeatureRef *FeatureMap::findFeatureRef(uint32 name) const
 {
     NameAndFeatureRef *it;
-    
+
     for (it = m_pNamedFeats; it < m_pNamedFeats + m_numFeats; ++it)
         if (it->m_name == name)
             return it->m_pFRef;
@@ -268,12 +268,12 @@
 
 bool FeatureRef::applyValToFeature(uint32 val, Features & pDest) const
 {
-    if (val>maxVal())
+    if (val>maxVal() || !m_face)
       return false;
     if (pDest.m_pMap==NULL)
-      pDest.m_pMap = &m_face.theSill().theFeatureMap();
+      pDest.m_pMap = &m_face->theSill().theFeatureMap();
     else
-      if (pDest.m_pMap!=&m_face.theSill().theFeatureMap())
+      if (pDest.m_pMap!=&m_face->theSill().theFeatureMap())
         return false;       //incompatible
     if (m_index >= pDest.size())
         pDest.resize(m_index+1);
@@ -284,7 +284,8 @@
 
 uint32 FeatureRef::getFeatureVal(const Features& feats) const
 {
-  if (m_index < feats.size() && &m_face.theSill().theFeatureMap()==feats.m_pMap)
+  if (m_index < feats.size() && m_face
+      && &m_face->theSill().theFeatureMap()==feats.m_pMap)
     return (feats[m_index] & m_mask) >> m_bits;
   else
     return 0;

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/FileFace.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/FileFace.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/FileFace.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -48,7 +48,7 @@
 
     // Get the header.
     if (!TtfUtil::GetHeaderInfo(tbl_offset, tbl_len)) return;
-    if (fseek(_file, tbl_offset, SEEK_SET)) return;
+    if (fseek(_file, long(tbl_offset), SEEK_SET)) return;
     _header_tbl = (TtfUtil::Sfnt::OffsetSubTable*)gralloc<char>(tbl_len);
     if (_header_tbl)
     {
@@ -59,7 +59,7 @@
     // Get the table directory
     if (!TtfUtil::GetTableDirInfo(_header_tbl, tbl_offset, tbl_len)) return;
     _table_dir = (TtfUtil::Sfnt::OffsetSubTable::Entry*)gralloc<char>(tbl_len);
-    if (fseek(_file, tbl_offset, SEEK_SET)) return;
+    if (fseek(_file, long(tbl_offset), SEEK_SET)) return;
     if (_table_dir && fread(_table_dir, 1, tbl_len, _file) != tbl_len)
     {
         free(_table_dir);
@@ -88,7 +88,7 @@
         return 0;
 
     if (tbl_offset > file_face._file_len || tbl_len > file_face._file_len - tbl_offset
-            || fseek(file_face._file, tbl_offset, SEEK_SET) != 0)
+            || fseek(file_face._file, long(tbl_offset), SEEK_SET) != 0)
         return 0;
 
     tbl = malloc(tbl_len);

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Font.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Font.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Font.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -56,6 +56,3 @@
 {
     free(m_advances);
 }
-
-
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/GlyphCache.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/GlyphCache.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/GlyphCache.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -46,7 +46,7 @@
     template<typename W>
     class _glat_iterator : public std::iterator<std::input_iterator_tag, std::pair<sparse::key_type, sparse::mapped_type> >
     {
-        unsigned short  key() const             { return be::peek<W>(_e) + _n; }
+        unsigned short  key() const             { return uint16(be::peek<W>(_e) + _n); }
         unsigned int    run() const             { return be::peek<W>(_e+sizeof(W)); }
         void            advance_entry()         { _n = 0; _e = _v; be::skip<W>(_v,2); }
     public:
@@ -84,7 +84,7 @@
 class GlyphCache::Loader
 {
 public:
-    Loader(const Face & face, const bool dumb_font);    //return result indicates success. Do not use if failed.
+    Loader(const Face & face);    //return result indicates success. Do not use if failed.
 
     operator bool () const throw();
     unsigned short int units_per_em() const throw();
@@ -115,7 +115,7 @@
 
 
 GlyphCache::GlyphCache(const Face & face, const uint32 face_options)
-: _glyph_loader(new Loader(face, bool(face_options & gr_face_dumbRendering))),
+: _glyph_loader(new Loader(face)),
   _glyphs(_glyph_loader && *_glyph_loader && _glyph_loader->num_glyphs()
         ? grzeroalloc<const GlyphFace *>(_glyph_loader->num_glyphs()) : 0),
   _boxes(_glyph_loader && _glyph_loader->has_boxes() && _glyph_loader->num_glyphs()
@@ -210,7 +210,7 @@
 }
 
 const GlyphFace *GlyphCache::glyph(unsigned short glyphid) const      //result may be changed by subsequent call with a different glyphid
-{ 
+{
     if (glyphid >= numGlyphs())
         return _glyphs[0];
     const GlyphFace * & p = _glyphs[glyphid];
@@ -239,7 +239,7 @@
 
 
 
-GlyphCache::Loader::Loader(const Face & face, const bool dumb_font)
+GlyphCache::Loader::Loader(const Face & face)
 : _head(face, Tag::head),
   _hhea(face, Tag::hhea),
   _hmtx(face, Tag::hmtx),
@@ -257,7 +257,7 @@
     const Face::Table maxp = Face::Table(face, Tag::maxp);
     if (!maxp) { _head = Face::Table(); return; }
 
-    _num_glyphs_graphics = TtfUtil::GlyphCount(maxp);
+    _num_glyphs_graphics = static_cast<unsigned short>(TtfUtil::GlyphCount(maxp));
     // This will fail if the number of glyphs is wildly out of range.
     if (_glyf && TtfUtil::LocaLookup(_num_glyphs_graphics-1, _loca, _loca.size(), _head) == size_t(-2))
     {
@@ -265,53 +265,50 @@
         return;
     }
 
-    if (!dumb_font)
+    if ((m_pGlat = Face::Table(face, Tag::Glat, 0x00030000)) == NULL
+        || (m_pGloc = Face::Table(face, Tag::Gloc)) == NULL
+        || m_pGloc.size() < 8)
     {
-        if ((m_pGlat = Face::Table(face, Tag::Glat, 0x00030000)) == NULL
-            || (m_pGloc = Face::Table(face, Tag::Gloc)) == NULL
-            || m_pGloc.size() < 8)
-        {
-            _head = Face::Table();
-            return;
-        }
-        const byte    * p = m_pGloc;
-        int       version = be::read<uint32>(p);
-        const uint16    flags = be::read<uint16>(p);
-        _num_attrs = be::read<uint16>(p);
-        // We can accurately calculate the number of attributed glyphs by
-        //  subtracting the length of the attribids array (numAttribs long if present)
-        //  and dividing by either 2 or 4 depending on shor or lonf format
-        _long_fmt              = flags & 1;
-        int tmpnumgattrs       = (m_pGloc.size()
-                                   - (p - m_pGloc)
-                                   - sizeof(uint16)*(flags & 0x2 ? _num_attrs : 0))
-                                       / (_long_fmt ? sizeof(uint32) : sizeof(uint16)) - 1;
+        _head = Face::Table();
+        return;
+    }
+    const byte    * p = m_pGloc;
+    int       version = be::read<uint32>(p);
+    const uint16    flags = be::read<uint16>(p);
+    _num_attrs = be::read<uint16>(p);
+    // We can accurately calculate the number of attributed glyphs by
+    //  subtracting the length of the attribids array (numAttribs long if present)
+    //  and dividing by either 2 or 4 depending on shor or lonf format
+    _long_fmt              = flags & 1;
+    ptrdiff_t tmpnumgattrs       = (m_pGloc.size()
+                               - (p - m_pGloc)
+                               - sizeof(uint16)*(flags & 0x2 ? _num_attrs : 0))
+                                   / (_long_fmt ? sizeof(uint32) : sizeof(uint16)) - 1;
 
-        if (version >= 0x00020000 || tmpnumgattrs < 0 || tmpnumgattrs > 65535
-            || _num_attrs == 0 || _num_attrs > 0x3000  // is this hard limit appropriate?
-            || _num_glyphs_graphics > tmpnumgattrs
-            || m_pGlat.size() < 4)
-        {
-            _head = Face::Table();
-            return;
-        }
+    if (version >= 0x00020000 || tmpnumgattrs < 0 || tmpnumgattrs > 65535
+        || _num_attrs == 0 || _num_attrs > 0x3000  // is this hard limit appropriate?
+        || _num_glyphs_graphics > tmpnumgattrs
+        || m_pGlat.size() < 4)
+    {
+        _head = Face::Table();
+        return;
+    }
 
-        _num_glyphs_attributes = static_cast<unsigned short>(tmpnumgattrs);
-        p = m_pGlat;
-        version = be::read<uint32>(p);
-        if (version >= 0x00040000 || (version >= 0x00030000 && m_pGlat.size() < 8))       // reject Glat tables that are too new
-        {
-            _head = Face::Table();
-            return;
-        }
-        else if (version >= 0x00030000)
-        {
-            unsigned int glatflags = be::read<uint32>(p);
-            _has_boxes = glatflags & 1;
-            // delete this once the compiler is fixed
-            _has_boxes = true;
-        }
+    _num_glyphs_attributes = static_cast<unsigned short>(tmpnumgattrs);
+    p = m_pGlat;
+    version = be::read<uint32>(p);
+    if (version >= 0x00040000 || (version >= 0x00030000 && m_pGlat.size() < 8))       // reject Glat tables that are too new
+    {
+        _head = Face::Table();
+        return;
     }
+    else if (version >= 0x00030000)
+    {
+        unsigned int glatflags = be::read<uint32>(p);
+        _has_boxes = glatflags & 1;
+        // delete this once the compiler is fixed
+        _has_boxes = true;
+    }
 }
 
 inline
@@ -486,7 +483,6 @@
         Rect box = readbox((i & 1) ? diamax : bbox, p[0], p[2], p[1], p[3]);
         curr->addSubBox(i >> 1, i & 1, &box);
         be::skip<uint8>(p, 4);
-    } 
+    }
     return (GlyphBox *)((char *)(curr) + sizeof(GlyphBox) + 2 * num * sizeof(Rect));
 }
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/GlyphFace.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/GlyphFace.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/GlyphFace.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -33,16 +33,16 @@
 {
     switch (metrics(metric))
     {
-        case kgmetLsb       : return m_bbox.bl.x;
-        case kgmetRsb       : return m_advance.x - m_bbox.tr.x;
-        case kgmetBbTop     : return m_bbox.tr.y;
-        case kgmetBbBottom  : return m_bbox.bl.y;
-        case kgmetBbLeft    : return m_bbox.bl.x;
-        case kgmetBbRight   : return m_bbox.tr.x;
-        case kgmetBbHeight  : return m_bbox.tr.y - m_bbox.bl.y;
-        case kgmetBbWidth   : return m_bbox.tr.x - m_bbox.bl.x;
-        case kgmetAdvWidth  : return m_advance.x;
-        case kgmetAdvHeight : return m_advance.y;
+        case kgmetLsb       : return int32(m_bbox.bl.x);
+        case kgmetRsb       : return int32(m_advance.x - m_bbox.tr.x);
+        case kgmetBbTop     : return int32(m_bbox.tr.y);
+        case kgmetBbBottom  : return int32(m_bbox.bl.y);
+        case kgmetBbLeft    : return int32(m_bbox.bl.x);
+        case kgmetBbRight   : return int32(m_bbox.tr.x);
+        case kgmetBbHeight  : return int32(m_bbox.tr.y - m_bbox.bl.y);
+        case kgmetBbWidth   : return int32(m_bbox.tr.x - m_bbox.bl.x);
+        case kgmetAdvWidth  : return int32(m_advance.x);
+        case kgmetAdvHeight : return int32(m_advance.y);
         default : return 0;
     }
 }

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Intervals.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Intervals.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Intervals.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -183,16 +183,16 @@
 
 Zones::const_iterator Zones::find_exclusion_under(float x) const
 {
-    int l = 0, h = _exclusions.size();
+    size_t l = 0, h = _exclusions.size();
 
     while (l < h)
     {
-        int const p = (l+h) >> 1;
+        size_t const p = (l+h) >> 1;
         switch (_exclusions[p].outcode(x))
         {
         case 0 : return _exclusions.begin()+p;
         case 1 : h = p; break;
-        case 2 : 
+        case 2 :
         case 3 : l = p+1; break;
         }
     }
@@ -287,7 +287,7 @@
                 *_dbg << "remove" << Position(s->_excl.x, s->_excl.xm);
             else
                 *_dbg << "exclude" << json::flat << json::array
-                    << s->_excl.x << s->_excl.xm 
+                    << s->_excl.x << s->_excl.xm
                     << s->_excl.sm << s->_excl.smx << s->_excl.c
                     << json::close;
             *_dbg << json::close;
@@ -296,4 +296,3 @@
 }
 
 #endif
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Justifier.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Justifier.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Justifier.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -62,7 +62,7 @@
 
 float Segment::justify(Slot *pSlot, const Font *font, float width, GR_MAYBE_UNUSED justFlags jflags, Slot *pFirst, Slot *pLast)
 {
-    Slot *s, *end;
+    Slot *end = last();
     float currWidth = 0.0;
     const float scale = font ? font->scale() : 1.0f;
     Position res;
@@ -73,9 +73,7 @@
     if ((m_dir & 1) != m_silf->dir() && m_silf->bidiPass() != m_silf->numPasses())
     {
         reverseSlots();
-        s = pFirst;
-        pFirst = pLast;
-        pLast = s;
+        std::swap(pFirst, pLast);
     }
     if (!pFirst) pFirst = pSlot;
     while (!pFirst->isBase()) pFirst = pFirst->attachedTo();
@@ -85,22 +83,25 @@
     width = width / scale;
     if ((jflags & gr_justEndInline) == 0)
     {
-        do {
+        while (pLast != pFirst && pLast)
+        {
             Rect bbox = theGlyphBBoxTemporary(pLast->glyph());
             if (bbox.bl.x != 0.f || bbox.bl.y != 0.f || bbox.tr.x != 0.f || bbox.tr.y == 0.f)
                 break;
             pLast = pLast->prev();
-        } while (pLast != pFirst);
+        }
     }
 
-    end = pLast->nextSibling();
-    pFirst = pFirst->nextSibling();
+    if (pLast)
+        end = pLast->nextSibling();
+    if (pFirst)
+        pFirst = pFirst->nextSibling();
 
     int icount = 0;
     int numLevels = silf()->numJustLevels();
     if (!numLevels)
     {
-        for (s = pSlot; s && s != end; s = s->nextSibling())
+        for (Slot *s = pSlot; s && s != end; s = s->nextSibling())
         {
             CharInfo *c = charinfo(s->before());
             if (isWhitespace(c->unicodeChar()))
@@ -113,7 +114,7 @@
         }
         if (!icount)
         {
-            for (s = pSlot; s && s != end; s = s->nextSibling())
+            for (Slot *s = pSlot; s && s != end; s = s->nextSibling())
             {
                 s->setJustify(this, 0, 3, 1);
                 s->setJustify(this, 0, 2, 1);
@@ -124,7 +125,7 @@
     }
 
     Vector<JustifyTotal> stats(numLevels);
-    for (s = pFirst; s && s != end; s = s->nextSibling())
+    for (Slot *s = pFirst; s && s != end; s = s->nextSibling())
     {
         float w = s->origin().x / scale + s->advance() - base;
         if (w > currWidth) currWidth = w;
@@ -146,7 +147,7 @@
             diff = width - currWidth;
             diffpw = diff / tWeight;
             tWeight = 0;
-            for (s = pFirst; s && s != end; s = s->nextSibling()) // don't include final glyph
+            for (Slot *s = pFirst; s && s != end; s = s->nextSibling()) // don't include final glyph
             {
                 int w = s->getJustify(this, i, 3);
                 float pref = diffpw * w + error;
@@ -224,8 +225,10 @@
 
     if (silf()->flags() & 1)
     {
-        delLineEnd(m_first);
-        delLineEnd(m_last);
+        if (m_first)
+            delLineEnd(m_first);
+        if (m_last)
+            delLineEnd(m_last);
     }
     m_first = oldFirst;
     m_last = oldLast;
@@ -277,4 +280,3 @@
         s->prev()->next(NULL);
     freeSlot(s);
 }
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/NameTable.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/NameTable.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/NameTable.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -51,7 +51,7 @@
         {
             m_nameData = reinterpret_cast<const uint8*>(pdata) + offset;
             setPlatformEncoding(platformId, encodingID);
-            m_nameDataLength = length - offset;
+            m_nameDataLength = uint16(length - offset);
             return;
         }
     }
@@ -180,7 +180,7 @@
         utf8::iterator d = uniBuffer;
         for (utf16::const_iterator s = utf16Name, e = utf16Name + utf16Length; s != e; ++s, ++d)
             *d = *s;
-        length = d - uniBuffer;
+        length = uint32(d - uniBuffer);
         uniBuffer[length] = 0;
         free(utf16Name);
         return uniBuffer;
@@ -201,7 +201,7 @@
         utf32::iterator d = uniBuffer;
         for (utf16::const_iterator s = utf16Name, e = utf16Name + utf16Length; s != e; ++s, ++d)
             *d = *s;
-        length = d - uniBuffer;
+        length = uint32(d - uniBuffer);
         uniBuffer[length] = 0;
         free(utf16Name);
         return uniBuffer;
@@ -252,4 +252,3 @@
     }
     return localeId;
 }
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Pass.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -97,10 +97,10 @@
                * const pass_end = p + pass_length;
     size_t numRanges;
 
-    if (e.test(pass_length < 40, E_BADPASSLENGTH)) return face.error(e); 
+    if (e.test(pass_length < 40, E_BADPASSLENGTH)) return face.error(e);
     // Read in basic values
     const byte flags = be::read<byte>(p);
-    if (e.test((flags & 0x1f) && 
+    if (e.test((flags & 0x1f) &&
             (pt < PASS_TYPE_POSITIONING || !m_silf->aCollision() || !face.glyphs().hasBoxes() || !(m_silf->flags() & 0x20)),
             E_BADCOLLISIONPASS))
         return face.error(e);
@@ -191,7 +191,7 @@
     if (pass_constraint_len)
     {
         face.error_context(face.error_context() + 1);
-        m_cPConstraint = vm::Machine::Code(true, pcCode, pcCode + pass_constraint_len, 
+        m_cPConstraint = vm::Machine::Code(true, pcCode, pcCode + pass_constraint_len,
                                   precontext[0], be::peek<uint16>(sort_keys), *m_silf, face, PASS_TYPE_UNKNOWN);
         if (e.test(!m_cPConstraint, E_OUTOFMEM)
                 || e.test(m_cPConstraint.status() != Code::loaded, m_cPConstraint.status() + E_CODEFAILURE))
@@ -246,11 +246,11 @@
     Rule * r = m_rules + m_numRules - 1;
     for (size_t n = m_numRules; r >= m_rules; --n, --r, ac_end = ac_begin, rc_end = rc_begin)
     {
-        face.error_context((face.error_context() & 0xFFFF00) + EC_ARULE + ((n - 1) << 24));
+        face.error_context((face.error_context() & 0xFFFF00) + EC_ARULE + int((n - 1) << 24));
         r->preContext = *--precontext;
         r->sort       = be::peek<uint16>(--sort_key);
 #ifndef NDEBUG
-        r->rule_idx   = n - 1;
+        r->rule_idx   = uint16(n - 1);
 #endif
         if (r->sort > 63 || r->preContext >= r->sort || r->preContext > m_maxPreCtxt || r->preContext < m_minPreCtxt)
             return false;
@@ -291,7 +291,7 @@
 
     // Load the rule entries map
     face.error_context((face.error_context() & 0xFFFF00) + EC_APASS);
-    //TODO: Coverty: 1315804: FORWARD_NULL
+    //TODO: Coverity: 1315804: FORWARD_NULL
     RuleEntry * re = m_ruleMap = gralloc<RuleEntry>(num_entries);
     if (e.test(!re, E_OUTOFMEM)) return face.error(e);
     for (size_t n = num_entries; n; --n, ++re)
@@ -330,7 +330,7 @@
         *s = be::read<uint16>(starts);
         if (e.test(*s >= m_numStates, E_BADSTATE))
         {
-            face.error_context((face.error_context() & 0xFFFF00) + EC_ASTARTS + ((s - m_startStates) << 24));
+            face.error_context((face.error_context() & 0xFFFF00) + EC_ASTARTS + int((s - m_startStates) << 24));
             return face.error(e); // true;
         }
     }
@@ -342,7 +342,7 @@
         *t = be::read<uint16>(states);
         if (e.test(*t >= m_numStates, E_BADSTATE))
         {
-            face.error_context((face.error_context() & 0xFFFF00) + EC_ATRANS + (((t - m_transitions) / m_numColumns) << 8));
+            face.error_context((face.error_context() & 0xFFFF00) + EC_ATRANS + int(((t - m_transitions) / m_numColumns) << 8));
             return face.error(e);
         }
     }
@@ -357,7 +357,7 @@
 
         if (e.test(begin >= rule_map_end || end > rule_map_end || begin > end, E_BADRULEMAPPING))
         {
-            face.error_context((face.error_context() & 0xFFFF00) + EC_ARULEMAP + (n << 24));
+            face.error_context((face.error_context() & 0xFFFF00) + EC_ARULEMAP + int(n << 24));
             return face.error(e);
         }
         s->rules = begin;
@@ -774,7 +774,7 @@
             *dbgout << json::close << json::close; // phase-1
 #endif
 
-        // phase 2 : loop until happy. 
+        // phase 2 : loop until happy.
         for (int i = 0; i < m_numCollRuns - 1; ++i)
         {
             if (hasCollisions || moved)
@@ -820,10 +820,10 @@
                         << json::object << "phase" << "2b" << "loop" << i << "moves" << json::array;
 #endif
 
-                // phase 2b : redo basic diacritic positioning pass for ALL glyphs. Each successive loop adjusts 
-                // glyphs from their current adjusted position, which has the effect of gradually minimizing the  
-                // resulting adjustment; ie, the final result will be gradually closer to the original location.  
-                // Also it allows more flexibility in the final adjustment, since it is moving along the  
+                // phase 2b : redo basic diacritic positioning pass for ALL glyphs. Each successive loop adjusts
+                // glyphs from their current adjusted position, which has the effect of gradually minimizing the
+                // resulting adjustment; ie, the final result will be gradually closer to the original location.
+                // Also it allows more flexibility in the final adjustment, since it is moving along the
                 // possible 8 vectors from successively different starting locations.
                 if (moved)
                 {
@@ -962,7 +962,7 @@
     while (base->attachedTo())
         base = base->attachedTo();
     Position zero(0., 0.);
-    
+
     // Look for collisions with the neighboring glyphs.
     for (nbor = start; nbor; nbor = isRev ? nbor->prev() : nbor->next())
     {
@@ -982,7 +982,7 @@
         else if (nbor == slotFix)
             // Switching sides of this glyph - if we were ignoring kernable stuff before, don't anymore.
             ignoreForKern = !ignoreForKern;
-            
+
         if (nbor != start && (cNbor->flags() & (isRev ? SlotCollision::COLL_START : SlotCollision::COLL_END)))
             break;
     }
@@ -1011,7 +1011,7 @@
 #if !defined GRAPHITE2_NTRACING
         if (dbgout)
         {
-            *dbgout << json::object 
+            *dbgout << json::object
                             << "missed" << objectid(dslot(seg, slotFix));
             coll.outputJsonDbg(dbgout, seg, -1);
             *dbgout << json::close;
@@ -1072,7 +1072,7 @@
         }
         else
         {
-            space_count = 0; 
+            space_count = 0;
             if (nbor != slotFix && !cNbor->ignore())
             {
                 seenEnd = true;
@@ -1105,4 +1105,3 @@
     }
     return 0.;
 }
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Position.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Position.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Position.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -95,4 +95,3 @@
     return res;
 }
 #endif
-

Deleted: trunk/Build/source/libs/graphite2/graphite2-src/src/SegCache.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/SegCache.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/SegCache.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -1,224 +0,0 @@
-/*  GRAPHITE2 LICENSING
-
-    Copyright 2010, SIL International
-    All rights reserved.
-
-    This library is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published
-    by the Free Software Foundation; either version 2.1 of License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should also have received a copy of the GNU Lesser General Public
-    License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street,
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
-    internet at http://www.fsf.org/licenses/lgpl.html.
-
-Alternatively, the contents of this file may be used under the terms of the
-Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public
-License, as published by the Free Software Foundation, either version 2
-of the License or (at your option) any later version.
-*/
-
-#include "inc/Main.h"
-#include "inc/TtfTypes.h"
-#include "inc/TtfUtil.h"
-#include "inc/SegCache.h"
-#include "inc/SegCacheEntry.h"
-#include "inc/SegCacheStore.h"
-#include "inc/CmapCache.h"
-
-
-using namespace graphite2;
-
-#ifndef GRAPHITE2_NSEGCACHE
-
-SegCache::SegCache(const SegCacheStore * store, const Features & feats)
-: m_prefixLength(ePrefixLength),
-//  m_maxCachedSegLength(eMaxSpliceSize),
-  m_segmentCount(0),
-  m_features(feats),
-  m_totalAccessCount(0l), m_totalMisses(0l),
-  m_purgeFactor(1.0f / (ePurgeFactor * store->maxSegmentCount()))
-{
-    m_prefixes.raw = grzeroalloc<void*>(store->maxCmapGid() + 2);
-    m_prefixes.range[SEG_CACHE_MIN_INDEX] = SEG_CACHE_UNSET_INDEX;
-    m_prefixes.range[SEG_CACHE_MAX_INDEX] = SEG_CACHE_UNSET_INDEX;
-}
-
-void SegCache::freeLevel(SegCacheStore * store, SegCachePrefixArray prefixes, size_t level)
-{
-    for (size_t i = 0; i < store->maxCmapGid(); i++)
-    {
-        if (prefixes.array[i].raw)
-        {
-            if (level + 1 < ePrefixLength)
-                freeLevel(store, prefixes.array[i], level + 1);
-            else
-            {
-                SegCachePrefixEntry * prefixEntry = prefixes.prefixEntries[i];
-                delete prefixEntry;
-            }
-        }
-    }
-    free(prefixes.raw);
-}
-
-void SegCache::clear(SegCacheStore * store)
-{
-    freeLevel(store, m_prefixes, 0);
-    m_prefixes.raw = NULL;
-}
-
-SegCache::~SegCache()
-{
-    assert(m_prefixes.raw == NULL);
-}
-
-SegCacheEntry* SegCache::cache(SegCacheStore * store, const uint16* cmapGlyphs, size_t length, Segment * seg, size_t charOffset)
-{
-    uint16 pos = 0;
-    if (!length) return NULL;
-//    assert(length < m_maxCachedSegLength);
-    SegCachePrefixArray pArray = m_prefixes;
-    while (pos + 1 < m_prefixLength)
-    {
-        uint16 gid = (pos < length)? cmapGlyphs[pos] : 0;
-        if (!pArray.array[gid].raw)
-        {
-            pArray.array[gid].raw = grzeroalloc<void*>(store->maxCmapGid() + 2);
-            if (!pArray.array[gid].raw)
-                return NULL; // malloc failed
-            if (pArray.range[SEG_CACHE_MIN_INDEX] == SEG_CACHE_UNSET_INDEX)
-            {
-                pArray.range[SEG_CACHE_MIN_INDEX] = gid;
-                pArray.range[SEG_CACHE_MAX_INDEX] = gid;
-            }
-            else
-            {
-                if (gid < pArray.range[SEG_CACHE_MIN_INDEX])
-                    pArray.range[SEG_CACHE_MIN_INDEX] = gid;
-                else if (gid > pArray.range[SEG_CACHE_MAX_INDEX])
-                    pArray.range[SEG_CACHE_MAX_INDEX] = gid;
-            }
-        }
-        pArray = pArray.array[gid];
-        ++pos;
-    }
-    uint16 gid = (pos < length)? cmapGlyphs[pos] : 0;
-    SegCachePrefixEntry * prefixEntry = pArray.prefixEntries[gid];
-    if (!prefixEntry)
-    {
-        prefixEntry = new SegCachePrefixEntry();
-        pArray.prefixEntries[gid] = prefixEntry;
-        if (pArray.range[SEG_CACHE_MIN_INDEX] == SEG_CACHE_UNSET_INDEX)
-        {
-            pArray.range[SEG_CACHE_MIN_INDEX] = gid;
-            pArray.range[SEG_CACHE_MAX_INDEX] = gid;
-        }
-        else
-        {
-            if (gid < pArray.range[SEG_CACHE_MIN_INDEX])
-                pArray.range[SEG_CACHE_MIN_INDEX] = gid;
-            else if (gid > pArray.range[SEG_CACHE_MAX_INDEX])
-                pArray.range[SEG_CACHE_MAX_INDEX] = gid;
-        }
-    }
-    if (!prefixEntry) return NULL;
-    // if the cache is full run a purge - this is slow, since it walks the tree
-    if (m_segmentCount + 1 > store->maxSegmentCount())
-    {
-        purge(store);
-        assert(m_segmentCount < store->maxSegmentCount());
-    }
-    SegCacheEntry * pEntry = prefixEntry->cache(cmapGlyphs, length, seg, charOffset, m_totalAccessCount);
-    if (pEntry) ++m_segmentCount;
-    return pEntry;
-}
-
-void SegCache::purge(SegCacheStore * store)
-{
-    unsigned long long minAccessCount = static_cast<unsigned long long>(m_totalAccessCount * m_purgeFactor + 1);
-    if (minAccessCount < 2) minAccessCount = 2;
-    unsigned long long oldAccessTime = m_totalAccessCount - store->maxSegmentCount() / eAgeFactor;
-    purgeLevel(store, m_prefixes, 0, minAccessCount, oldAccessTime);
-}
-
-void SegCache::purgeLevel(SegCacheStore * store, SegCachePrefixArray prefixes, size_t level,
-                          unsigned long long minAccessCount, unsigned long long oldAccessTime)
-{
-    if (prefixes.range[SEG_CACHE_MIN_INDEX] == SEG_CACHE_UNSET_INDEX) return;
-    size_t maxGlyphCached = prefixes.range[SEG_CACHE_MAX_INDEX];
-    for (size_t i = prefixes.range[SEG_CACHE_MIN_INDEX]; i <= maxGlyphCached; i++)
-    {
-        if (prefixes.array[i].raw)
-        {
-            if (level + 1 < ePrefixLength)
-                purgeLevel(store, prefixes.array[i], level + 1, minAccessCount, oldAccessTime);
-            else
-            {
-                SegCachePrefixEntry * prefixEntry = prefixes.prefixEntries[i];
-                m_segmentCount -= prefixEntry->purge(minAccessCount,
-                    oldAccessTime, m_totalAccessCount);
-            }
-        }
-    }
-}
-
-uint32 SegCachePrefixEntry::purge(unsigned long long minAccessCount,
-                                              unsigned long long oldAccessTime,
-                                              unsigned long long currentTime)
-{
-    // ignore the purge request if another has been done recently
-    //if (m_lastPurge > oldAccessTime)
-    //    return 0;
-
-    uint32 totalPurged = 0;
-    // real length is length + 1 in this loop
-    for (uint16 length = 0; length < eMaxSpliceSize; length++)
-    {
-        if (m_entryCounts[length] == 0)
-            continue;
-        uint16 purgeCount = 0;
-        uint16 newIndex = 0;
-        for (uint16 j = 0; j < m_entryCounts[length]; j++)
-        {
-            SegCacheEntry & tempEntry = m_entries[length][j];
-            // purge entries with a low access count which haven't been
-            // accessed recently
-            if (tempEntry.accessCount() <= minAccessCount &&
-                tempEntry.lastAccess() <= oldAccessTime)
-            {
-                tempEntry.clear();
-                ++purgeCount;
-            }
-            else
-            {
-                memcpy(m_entries[length] + newIndex++, m_entries[length] + j, sizeof(SegCacheEntry));
-            }
-        }
-        if (purgeCount == m_entryCounts[length])
-        {
-            assert(newIndex == 0);
-            m_entryCounts[length] = 0;
-            m_entryBSIndex[length] = 0;
-            free(m_entries[length]);
-            m_entries[length] = NULL;
-        }
-        else if (purgeCount > 0)
-        {
-            assert(m_entryCounts[length] == newIndex + purgeCount);
-            m_entryCounts[length] = newIndex;
-        }
-        totalPurged += purgeCount;
-    }
-    m_lastPurge = currentTime;
-    return totalPurged;
-}
-
-#endif

Deleted: trunk/Build/source/libs/graphite2/graphite2-src/src/SegCacheEntry.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/SegCacheEntry.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/SegCacheEntry.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -1,108 +0,0 @@
-/*  GRAPHITE2 LICENSING
-
-    Copyright 2010, SIL International
-    All rights reserved.
-
-    This library is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published
-    by the Free Software Foundation; either version 2.1 of License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should also have received a copy of the GNU Lesser General Public
-    License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street,
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
-    internet at http://www.fsf.org/licenses/lgpl.html.
-
-Alternatively, the contents of this file may be used under the terms of the
-Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public
-License, as published by the Free Software Foundation, either version 2
-of the License or (at your option) any later version.
-*/
-
-#ifndef GRAPHITE2_NSEGCACHE
-
-#include "inc/Main.h"
-#include "inc/Slot.h"
-#include "inc/Segment.h"
-#include "inc/SegCache.h"
-#include "inc/SegCacheEntry.h"
-
-
-using namespace graphite2;
-
-SegCacheEntry::SegCacheEntry(const uint16* cmapGlyphs, size_t length, Segment * seg, size_t charOffset, long long cacheTime)
-    : m_glyphLength(0), m_unicode(gralloc<uint16>(length)), m_glyph(NULL),
-    m_attr(NULL), m_justs(NULL),
-    m_accessCount(0), m_lastAccess(cacheTime)
-{
-    if (m_unicode)
-        for (size_t i = 0; i < length; i++)
-            m_unicode[i] = cmapGlyphs[i];
-
-    const size_t    glyphCount = seg->slotCount(),
-                    sizeof_sjust = SlotJustify::size_of(seg->silf()->numJustLevels());
-    if (!glyphCount) return;
-    size_t num_justs = 0,
-           justs_pos = 0;
-    if (seg->hasJustification())
-    {
-        for (const Slot * s = seg->first(); s; s = s->next())
-        {
-            if (s->m_justs == 0)    continue;
-            ++num_justs;
-        }
-        m_justs = gralloc<byte>(sizeof_sjust * num_justs);
-    }
-    const Slot * slot = seg->first();
-    m_glyph = new Slot[glyphCount];
-    m_attr = gralloc<int16>(glyphCount * seg->numAttrs());
-    if (!m_glyph || (!m_attr && seg->numAttrs())) return;
-    m_glyphLength = glyphCount;
-    Slot * slotCopy = m_glyph;
-    m_glyph->prev(NULL);
-
-    uint16 pos = 0;
-    while (slot)
-    {
-        slotCopy->userAttrs(m_attr + pos * seg->numAttrs());
-        slotCopy->m_justs = m_justs ? reinterpret_cast<SlotJustify *>(m_justs + justs_pos++ * sizeof_sjust) : 0;
-        slotCopy->set(*slot, -static_cast<int32>(charOffset), seg->numAttrs(), seg->silf()->numJustLevels(), length);
-        slotCopy->index(pos);
-        if (slot->firstChild())
-            slotCopy->m_child = m_glyph + slot->firstChild()->index();
-        if (slot->attachedTo())
-            slotCopy->attachTo(m_glyph + slot->attachedTo()->index());
-        if (slot->nextSibling())
-            slotCopy->m_sibling = m_glyph + slot->nextSibling()->index();
-        slot = slot->next();
-        ++slotCopy;
-        ++pos;
-        if (slot)
-        {
-            slotCopy->prev(slotCopy-1);
-            (slotCopy-1)->next(slotCopy);
-        }
-    }
-}
-
-
-void SegCacheEntry::clear()
-{
-    free(m_unicode);
-    free(m_attr);
-    free(m_justs);
-    delete [] m_glyph;
-    m_unicode = NULL;
-    m_glyph = NULL;
-    m_glyphLength = 0;
-    m_attr = NULL;
-}
-
-#endif
-

Deleted: trunk/Build/source/libs/graphite2/graphite2-src/src/SegCacheStore.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/SegCacheStore.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/SegCacheStore.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -1,47 +0,0 @@
-/*  GRAPHITE2 LICENSING
-
-    Copyright 2010, SIL International
-    All rights reserved.
-
-    This library is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published
-    by the Free Software Foundation; either version 2.1 of License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should also have received a copy of the GNU Lesser General Public
-    License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street,
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
-    internet at http://www.fsf.org/licenses/lgpl.html.
-
-Alternatively, the contents of this file may be used under the terms of the
-Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public
-License, as published by the Free Software Foundation, either version 2
-of the License or (at your option) any later version.
-*/
-
-#ifndef GRAPHITE2_NSEGCACHE
-
-#include "inc/SegCacheStore.h"
-#include "inc/Face.h"
-
-
-using namespace graphite2;
-
-SegCacheStore::SegCacheStore(const Face & face, unsigned int numSilf, size_t maxSegments)
-: m_caches(new SilfSegCache[numSilf]),
-  m_numSilf(numSilf),
-  m_maxSegments(maxSegments),
-  m_maxCmapGid(face.glyphs().numGlyphs()),
-  m_spaceGid(face.cmap()[0x20]),
-  m_zwspGid(face.cmap()[0x200B])
-{
-}
-
-#endif
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Segment.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Segment.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Segment.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -42,7 +42,7 @@
 
 using namespace graphite2;
 
-Segment::Segment(unsigned int numchars, const Face* face, uint32 script, int textDir)
+Segment::Segment(size_t numchars, const Face* face, uint32 script, int textDir)
 : m_freeSlots(NULL),
   m_freeJustifies(NULL),
   m_charinfo(new CharInfo[numchars]),
@@ -54,14 +54,12 @@
   m_bufSize(numchars + 10),
   m_numGlyphs(numchars),
   m_numCharinfo(numchars),
-  m_passBits(m_silf->aPassBits() ? -1 : 0),
   m_defaultOriginal(0),
   m_dir(textDir),
-  m_flags(((m_silf->flags() & 0x20) != 0) << 1)
+  m_flags(((m_silf->flags() & 0x20) != 0) << 1),
+  m_passBits(m_silf->aPassBits() ? -1 : 0)
 {
-    Slot *s = newSlot();
-    if (s)
-        freeSlot(s);
+    freeSlot(newSlot());
     m_bufSize = log_binary(numchars)+1;
 }
 
@@ -77,75 +75,10 @@
     free(m_collisions);
 }
 
-#ifndef GRAPHITE2_NSEGCACHE
-SegmentScopeState Segment::setScope(Slot * firstSlot, Slot * lastSlot, size_t subLength)
-{
-    SegmentScopeState state;
-    state.numGlyphsOutsideScope = m_numGlyphs - subLength;
-    state.realFirstSlot = m_first;
-    state.slotBeforeScope = firstSlot->prev();
-    state.slotAfterScope = lastSlot->next();
-    state.realLastSlot = m_last;
-    firstSlot->prev(NULL);
-    lastSlot->next(NULL);
-    assert(m_defaultOriginal == 0);
-    m_defaultOriginal = firstSlot->original();
-    m_numGlyphs = subLength;
-    m_first = firstSlot;
-    m_last = lastSlot;
-    return state;
-}
-
-void Segment::removeScope(SegmentScopeState & state)
-{
-    m_numGlyphs = state.numGlyphsOutsideScope + m_numGlyphs;
-    if (state.slotBeforeScope)
-    {
-        state.slotBeforeScope->next(m_first);
-        m_first->prev(state.slotBeforeScope);
-        m_first = state.realFirstSlot;
-    }
-    if (state.slotAfterScope)
-    {
-        state.slotAfterScope->prev(m_last);
-        m_last->next(state.slotAfterScope);
-        m_last = state.realLastSlot;
-    }
-    m_defaultOriginal = 0;
-}
-
-#if 0
-void Segment::append(const Segment &other)
-{
-    Rect bbox = other.m_bbox + m_advance;
-
-    m_slots.insert(m_slots.end(), other.m_slots.begin(), other.m_slots.end());
-    CharInfo* pNewCharInfo = new CharInfo[m_numCharinfo+other.m_numCharinfo];       //since CharInfo has no constructor, this doesn't do much
-    for (unsigned int i=0 ; i<m_numCharinfo ; ++i)
-    pNewCharInfo[i] = m_charinfo[i];
-    m_last->next(other.m_first);
-    other.m_last->prev(m_last);
-    m_userAttrs.insert(m_userAttrs.end(), other.m_userAttrs.begin(), other.m_userAttrs.end());
-    
-    delete[] m_charinfo;
-    m_charinfo = pNewCharInfo;
-    pNewCharInfo += m_numCharinfo ;
-    for (unsigned int i=0 ; i<m_numCharinfo ; ++i)
-        pNewCharInfo[i] = other.m_charinfo[i];
- 
-    m_numCharinfo += other.m_numCharinfo;
-    m_numGlyphs += other.m_numGlyphs;
-    m_advance = m_advance + other.m_advance;
-    m_bbox = m_bbox.widen(bbox);
-    m_passBits &= other.passBits();
-}
-#endif
-#endif // GRAPHITE2_NSEGCACHE
-
 void Segment::appendSlot(int id, int cid, int gid, int iFeats, size_t coffset)
 {
     Slot *aSlot = newSlot();
-    
+
     if (!aSlot) return;
     m_charinfo[id].init(cid);
     m_charinfo[id].feats(iFeats);
@@ -152,7 +85,7 @@
     m_charinfo[id].base(coffset);
     const GlyphFace * theGlyph = m_face->glyphs().glyphSafe(gid);
     m_charinfo[id].breakWeight(theGlyph ? theGlyph->attrs()[m_silf->aBreak()] : 0);
-    
+
     aSlot->child(NULL);
     aSlot->setGlyph(this, gid, theGlyph);
     aSlot->originate(id);
@@ -163,7 +96,7 @@
     m_last = aSlot;
     if (!m_first) m_first = aSlot;
     if (theGlyph && m_silf->aPassBits())
-        m_passBits &= theGlyph->attrs()[m_silf->aPassBits()] 
+        m_passBits &= theGlyph->attrs()[m_silf->aPassBits()]
                     | (m_silf->numPasses() > 16 ? (theGlyph->attrs()[m_silf->aPassBits() + 1] << 16) : 0);
 }
 
@@ -206,6 +139,7 @@
 
 void Segment::freeSlot(Slot *aSlot)
 {
+    if (aSlot == nullptr) return;
     if (m_last == aSlot) m_last = aSlot->prev();
     if (m_first == aSlot) m_first = aSlot->next();
     if (aSlot->attachedTo())
@@ -214,11 +148,11 @@
     {
         if (aSlot->firstChild()->attachedTo() == aSlot)
         {
-            aSlot->firstChild()->attachTo(NULL);
+            aSlot->firstChild()->attachTo(nullptr);
             aSlot->removeChild(aSlot->firstChild());
         }
         else
-            aSlot->firstChild(NULL);
+            aSlot->firstChild(nullptr);
     }
     // reset the slot incase it is reused
     ::new (aSlot) Slot(aSlot->userAttrs());
@@ -230,7 +164,7 @@
 #endif
     // update next pointer
     if (!m_freeSlots)
-        aSlot->next(NULL);
+        aSlot->next(nullptr);
     else
         aSlot->next(m_freeSlots);
     m_freeSlots = aSlot;
@@ -243,7 +177,7 @@
         const size_t justSize = SlotJustify::size_of(m_silf->numJustLevels());
         byte *justs = grzeroalloc<byte>(justSize * m_bufSize);
         if (!justs) return NULL;
-        for (int i = m_bufSize - 2; i >= 0; --i)
+        for (ptrdiff_t i = m_bufSize - 2; i >= 0; --i)
         {
             SlotJustify *p = reinterpret_cast<SlotJustify *>(justs + justSize * i);
             SlotJustify *next = reinterpret_cast<SlotJustify *>(justs + justSize * (i + 1));
@@ -267,64 +201,6 @@
     m_freeJustifies = aJustify;
 }
 
-#ifndef GRAPHITE2_NSEGCACHE
-void Segment::splice(size_t offset, size_t length, Slot * const startSlot,
-                       Slot * endSlot, const Slot * srcSlot,
-                       const size_t numGlyphs)
-{
-    size_t numChars = length;
-    extendLength(numGlyphs - length);
-    // remove any extra
-    if (numGlyphs < length)
-    {
-        Slot * end = endSlot->next();
-        do
-        {
-            endSlot = endSlot->prev();
-            freeSlot(endSlot->next());
-        } while (numGlyphs < --length);
-        endSlot->next(end);
-        if (end)
-            end->prev(endSlot);
-    }
-    else
-    {
-        // insert extra slots if needed
-        while (numGlyphs > length)
-        {
-            Slot * extra = newSlot();
-            if (!extra) return;
-            extra->prev(endSlot);
-            extra->next(endSlot->next());
-            endSlot->next(extra);
-            if (extra->next())
-                extra->next()->prev(extra);
-            if (m_last == endSlot)
-                m_last = extra;
-            endSlot = extra;
-            ++length;
-        }
-    }
-
-    endSlot = endSlot->next();
-    assert(numGlyphs == length);
-    assert(offset + numChars <= m_numCharinfo);
-    Slot * indexmap[eMaxSpliceSize*3];
-    assert(numGlyphs < sizeof indexmap/sizeof *indexmap);
-    Slot * slot = startSlot;
-    for (uint16 i=0; i < numGlyphs; slot = slot->next(), ++i)
-        indexmap[i] = slot;
-
-    for (slot = startSlot; slot != endSlot; slot = slot->next(), srcSlot = srcSlot->next())
-    {
-        slot->set(*srcSlot, offset, m_silf->numUser(), m_silf->numJustLevels(), numChars);
-        if (srcSlot->attachedTo())  slot->attachTo(indexmap[srcSlot->attachedTo()->index()]);
-        if (srcSlot->nextSibling()) slot->m_sibling = indexmap[srcSlot->nextSibling()->index()];
-        if (srcSlot->firstChild())  slot->m_child = indexmap[srcSlot->firstChild()->index()];
-    }
-}
-#endif // GRAPHITE2_NSEGCACHE
-
 // reverse the slots but keep diacritics in their same position after their bases
 void Segment::reverseSlots()
 {
@@ -452,7 +328,7 @@
 }
 
 
-void Segment::associateChars(int offset, int numChars)
+void Segment::associateChars(int offset, size_t numChars)
 {
     int i = 0, j = 0;
     CharInfo *c, *cend;
@@ -476,7 +352,7 @@
     for (Slot *s = m_first; s; s = s->next())
     {
         int a;
-        for (a = s->after() + 1; a < offset + numChars && charinfo(a)->after() < 0; ++a)
+        for (a = s->after() + 1; a < offset + int(numChars) && charinfo(a)->after() < 0; ++a)
         { charinfo(a)->after(s->index()); }
         --a;
         s->after(a);

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Silf.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Silf.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Silf.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -199,8 +199,8 @@
     {
         uint32 pass_start = be::read<uint32>(o_passes);
         uint32 pass_end = be::peek<uint32>(o_passes);
-        face.error_context((face.error_context() & 0xFF00) + EC_ASILF + (i << 16));
-        if (e.test(pass_start > pass_end, E_BADPASSSTART) 
+        face.error_context((face.error_context() & 0xFF00) + EC_ASILF + unsigned(i << 16));
+        if (e.test(pass_start > pass_end, E_BADPASSSTART)
                 || e.test(pass_start < passes_start, E_BADPASSSTART)
                 || e.test(pass_end > lSilf, E_BADPASSEND)) {
             releaseBuffers(); return face.error(e);
@@ -233,9 +233,9 @@
 template<typename T> inline uint32 Silf::readClassOffsets(const byte *&p, size_t data_len, Error &e)
 {
     const T cls_off = 2*sizeof(uint16) + sizeof(T)*(m_nClass+1);
-    const size_t max_off = (be::peek<T>(p + sizeof(T)*m_nClass) - cls_off)/sizeof(uint16);
+    const uint32 max_off = (be::peek<T>(p + sizeof(T)*m_nClass) - cls_off)/sizeof(uint16);
     // Check that the last+1 offset is less than or equal to the class map length.
-    if (e.test(be::peek<T>(p) != cls_off, E_MISALIGNEDCLASSES) 
+    if (e.test(be::peek<T>(p) != cls_off, E_MISALIGNEDCLASSES)
             || e.test(max_off > (data_len - cls_off)/sizeof(uint16), E_HIGHCLASSOFFSET))
         return ERROROFFSET;
 
@@ -357,7 +357,7 @@
 bool Silf::runGraphite(Segment *seg, uint8 firstPass, uint8 lastPass, int dobidi) const
 {
     assert(seg != 0);
-    unsigned int       maxSize = seg->slotCount() * MAX_SEG_GROWTH_FACTOR;
+    size_t             maxSize = seg->slotCount() * MAX_SEG_GROWTH_FACTOR;
     SlotMap            map(*seg, m_dir, maxSize);
     FiniteStateMachine fsm(map, seg->getFace()->logger());
     vm::Machine        m(map);

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/Slot.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/Slot.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/Slot.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -40,7 +40,7 @@
     m_index(0), m_parent(NULL), m_child(NULL), m_sibling(NULL),
     m_position(0, 0), m_shift(0, 0), m_advance(0, 0),
     m_attach(0, 0), m_with(0, 0), m_just(0.),
-    m_flags(0), m_attLevel(0), m_bidiCls(-1), m_bidiLevel(0), 
+    m_flags(0), m_attLevel(0), m_bidiCls(-1), m_bidiLevel(0),
     m_userAttr(user_attrs), m_justs(NULL)
 {
 }
@@ -57,7 +57,7 @@
     else
         m_before = orig.m_before + charOffset;
     if (charOffset <= 0 && orig.m_after + charOffset >= numChars)
-        m_after = numChars - 1;
+        m_after = int(numChars) - 1;
     else
         m_after = orig.m_after + charOffset;
     m_parent = NULL;
@@ -107,7 +107,7 @@
             tAdvance = (m_advance.x - glyphFace->theAdvance().x + m_just) * scale + font->advance(glyph());
         else
             tAdvance *= scale;
-    }    
+    }
     Position res;
 
     m_position = base + shift;
@@ -142,7 +142,7 @@
         Position tRes = m_sibling->finalise(seg, font, base, bbox, attrLevel, clusterMin, rtl, isFinal, depth + 1);
         if (tRes.x > res.x) res = tRes;
     }
-    
+
     if (!m_parent && clusterMin < base.x)
     {
         Position adj = Position(m_position.x - clusterMin, 0.);
@@ -165,25 +165,25 @@
     switch (metrics(metric))
     {
     case kgmetLsb :
-        return bbox.bl.x;
+        return int32(bbox.bl.x);
     case kgmetRsb :
-        return res.x - bbox.tr.x;
+        return int32(res.x - bbox.tr.x);
     case kgmetBbTop :
-        return bbox.tr.y;
+        return int32(bbox.tr.y);
     case kgmetBbBottom :
-        return bbox.bl.y;
+        return int32(bbox.bl.y);
     case kgmetBbLeft :
-        return bbox.bl.x;
+        return int32(bbox.bl.x);
     case kgmetBbRight :
-        return bbox.tr.x;
+        return int32(bbox.tr.x);
     case kgmetBbWidth :
-        return bbox.tr.x - bbox.bl.x;
+        return int32(bbox.tr.x - bbox.bl.x);
     case kgmetBbHeight :
-        return bbox.tr.y - bbox.bl.y;
+        return int32(bbox.tr.y - bbox.bl.y);
     case kgmetAdvWidth :
-        return res.x;
+        return int32(res.x);
     case kgmetAdvHeight :
-        return res.y;
+        return int32(res.y);
     default :
         return 0;
     }
@@ -193,15 +193,8 @@
 
 int Slot::getAttr(const Segment *seg, attrCode ind, uint8 subindex) const
 {
-    if (ind == gr_slatUserDefnV1)
+    if (ind >= gr_slatJStretch && ind < gr_slatJStretch + 20 && ind != gr_slatJWidth)
     {
-        ind = gr_slatUserDefn;
-        subindex = 0;
-        if (seg->numAttrs() == 0)
-            return 0;
-    }
-    else if (ind >= gr_slatJStretch && ind < gr_slatJStretch + 20 && ind != gr_slatJWidth)
-    {
         int indx = ind - gr_slatJStretch;
         return getJustify(seg, indx / 5, indx % 5);
     }
@@ -231,30 +224,32 @@
     case gr_slatMeasureSol: return -1; // err what's this?
     case gr_slatMeasureEol: return -1;
     case gr_slatJWidth:     return int(m_just);
-    case gr_slatUserDefn :  return m_userAttr[subindex];
+    case gr_slatUserDefnV1: subindex = 0; GR_FALLTHROUGH;
+      // no break
+    case gr_slatUserDefn :  return subindex < seg->numAttrs() ?  m_userAttr[subindex] : 0;
     case gr_slatSegSplit :  return seg->charinfo(m_original)->flags() & 3;
     case gr_slatBidiLevel:  return m_bidiLevel;
     case gr_slatColFlags :		{ SlotCollision *c = seg->collisionInfo(this); return c ? c->flags() : 0; }
-    case gr_slatColLimitblx :	SLOTGETCOLATTR(limit().bl.x)
-    case gr_slatColLimitbly :	SLOTGETCOLATTR(limit().bl.y)
-    case gr_slatColLimittrx :	SLOTGETCOLATTR(limit().tr.x)
-    case gr_slatColLimittry :	SLOTGETCOLATTR(limit().tr.y)
-    case gr_slatColShiftx :		SLOTGETCOLATTR(offset().x)
-    case gr_slatColShifty :		SLOTGETCOLATTR(offset().y)
-    case gr_slatColMargin :		SLOTGETCOLATTR(margin())
-    case gr_slatColMarginWt :	SLOTGETCOLATTR(marginWt())
-    case gr_slatColExclGlyph :	SLOTGETCOLATTR(exclGlyph())
-    case gr_slatColExclOffx :	SLOTGETCOLATTR(exclOffset().x)
-    case gr_slatColExclOffy :	SLOTGETCOLATTR(exclOffset().y)
-    case gr_slatSeqClass :		SLOTGETCOLATTR(seqClass())
-	case gr_slatSeqProxClass :	SLOTGETCOLATTR(seqProxClass())
-    case gr_slatSeqOrder :		SLOTGETCOLATTR(seqOrder())
-    case gr_slatSeqAboveXoff :	SLOTGETCOLATTR(seqAboveXoff())
-    case gr_slatSeqAboveWt :	SLOTGETCOLATTR(seqAboveWt())
-    case gr_slatSeqBelowXlim :	SLOTGETCOLATTR(seqBelowXlim())
-    case gr_slatSeqBelowWt :	SLOTGETCOLATTR(seqBelowWt())
-    case gr_slatSeqValignHt :	SLOTGETCOLATTR(seqValignHt())
-    case gr_slatSeqValignWt :	SLOTGETCOLATTR(seqValignWt())
+    case gr_slatColLimitblx:SLOTGETCOLATTR(limit().bl.x)
+    case gr_slatColLimitbly:SLOTGETCOLATTR(limit().bl.y)
+    case gr_slatColLimittrx:SLOTGETCOLATTR(limit().tr.x)
+    case gr_slatColLimittry:SLOTGETCOLATTR(limit().tr.y)
+    case gr_slatColShiftx :	SLOTGETCOLATTR(offset().x)
+    case gr_slatColShifty :	SLOTGETCOLATTR(offset().y)
+    case gr_slatColMargin :	SLOTGETCOLATTR(margin())
+    case gr_slatColMarginWt:SLOTGETCOLATTR(marginWt())
+    case gr_slatColExclGlyph:SLOTGETCOLATTR(exclGlyph())
+    case gr_slatColExclOffx:SLOTGETCOLATTR(exclOffset().x)
+    case gr_slatColExclOffy:SLOTGETCOLATTR(exclOffset().y)
+    case gr_slatSeqClass :	SLOTGETCOLATTR(seqClass())
+    case gr_slatSeqProxClass:SLOTGETCOLATTR(seqProxClass())
+    case gr_slatSeqOrder :	SLOTGETCOLATTR(seqOrder())
+    case gr_slatSeqAboveXoff:SLOTGETCOLATTR(seqAboveXoff())
+    case gr_slatSeqAboveWt: SLOTGETCOLATTR(seqAboveWt())
+    case gr_slatSeqBelowXlim:SLOTGETCOLATTR(seqBelowXlim())
+    case gr_slatSeqBelowWt:	SLOTGETCOLATTR(seqBelowWt())
+    case gr_slatSeqValignHt:SLOTGETCOLATTR(seqValignHt())
+    case gr_slatSeqValignWt:SLOTGETCOLATTR(seqValignWt())
     default : return 0;
     }
 }
@@ -480,7 +475,7 @@
     m_advance = Position(aGlyph->theAdvance().x, 0.);
     if (seg->silf()->aPassBits())
     {
-        seg->mergePassBits(theGlyph->attrs()[seg->silf()->aPassBits()]);
+        seg->mergePassBits(uint8(theGlyph->attrs()[seg->silf()->aPassBits()]));
         if (seg->silf()->numPasses() > 16)
             seg->mergePassBits(theGlyph->attrs()[seg->silf()->aPassBits()+1] << 16);
     }
@@ -532,4 +527,3 @@
             return true;
     return false;
 }
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/TtfUtil.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/TtfUtil.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/TtfUtil.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -31,7 +31,7 @@
 Last reviewed: Not yet.
 
 Description
-    Implements the methods for TtfUtil class. This file should remain portable to any C++ 
+    Implements the methods for TtfUtil class. This file should remain portable to any C++
     environment by only using standard C++ and the TTF structurs defined in Tt.h.
 -------------------------------------------------------------------------------*//*:End Ignore*/
 
@@ -60,7 +60,7 @@
 /***********************************************************************************************
     Local Constants and static variables
 ***********************************************************************************************/
-namespace 
+namespace
 {
 #ifdef ALL_TTFUTILS
     // max number of components allowed in composite glyphs
@@ -79,45 +79,45 @@
     const int kcPostNames = 258;
 
     const char * rgPostName[kcPostNames] = {
-        ".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", 
-        "dollar", "percent", "ampersand", "quotesingle", "parenleft", 
-        "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", 
-        "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", 
-        "nine", "colon", "semicolon", "less", "equal", "greater", "question", 
-        "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", 
-        "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", 
-        "bracketleft", "backslash", "bracketright", "asciicircum", 
-        "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", 
-        "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", 
-        "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", 
-        "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", 
-        "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", 
-        "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", 
-        "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", 
-        "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", 
-        "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", 
-        "section", "bullet", "paragraph", "germandbls", "registered", 
-        "copyright", "trademark", "acute", "dieresis", "notequal", "AE", 
-        "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", 
-        "mu", "partialdiff", "summation", "product", "pi", "integral", 
-        "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", 
-        "exclamdown", "logicalnot", "radical", "florin", "approxequal", 
-        "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace", 
-        "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", 
-        "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", 
-        "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", 
-        "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", 
-        "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", 
-        "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", 
-        "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", 
-        "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", 
-        "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", 
-        "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", 
-        "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth", 
-        "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply", 
-        "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", 
-        "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla", 
-        "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", 
+        ".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign",
+        "dollar", "percent", "ampersand", "quotesingle", "parenleft",
+        "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash",
+        "zero", "one", "two", "three", "four", "five", "six", "seven", "eight",
+        "nine", "colon", "semicolon", "less", "equal", "greater", "question",
+        "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
+        "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
+        "bracketleft", "backslash", "bracketright", "asciicircum",
+        "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i",
+        "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w",
+        "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde",
+        "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis",
+        "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde",
+        "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis",
+        "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute",
+        "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave",
+        "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling",
+        "section", "bullet", "paragraph", "germandbls", "registered",
+        "copyright", "trademark", "acute", "dieresis", "notequal", "AE",
+        "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen",
+        "mu", "partialdiff", "summation", "product", "pi", "integral",
+        "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown",
+        "exclamdown", "logicalnot", "radical", "florin", "approxequal",
+        "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace",
+        "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash",
+        "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide",
+        "lozenge", "ydieresis", "Ydieresis", "fraction", "currency",
+        "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered",
+        "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex",
+        "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute",
+        "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex",
+        "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi",
+        "circumflex", "tilde", "macron", "breve", "dotaccent", "ring",
+        "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash",
+        "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth",
+        "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply",
+        "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter",
+        "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla",
+        "scedilla", "Cacute", "cacute", "Ccaron", "ccaron",
         "dcroat" };
 #endif
 
@@ -128,18 +128,18 @@
 ***********************************************************************************************/
 
 /* Note on error processing: The code guards against bad glyph ids being used to look up data
-in open ended tables (loca, hmtx). If the glyph id comes from a cmap this shouldn't happen 
-but it seems prudent to check for user errors here. The code does assume that data obtained 
-from the TTF file is valid otherwise (though the CheckTable method seeks to check for 
-obvious problems that might accompany a change in table versions). For example an invalid 
+in open ended tables (loca, hmtx). If the glyph id comes from a cmap this shouldn't happen
+but it seems prudent to check for user errors here. The code does assume that data obtained
+from the TTF file is valid otherwise (though the CheckTable method seeks to check for
+obvious problems that might accompany a change in table versions). For example an invalid
 offset in the loca table which could exceed the size of the glyf table is NOT trapped.
-Likewise if numberOf_LongHorMetrics in the hhea table is wrong, this will NOT be trapped, 
+Likewise if numberOf_LongHorMetrics in the hhea table is wrong, this will NOT be trapped,
 which could cause a lookup in the hmtx table to exceed the table length. Of course, TTF tables
 that are completely corrupt will cause unpredictable results. */
 
 /* Note on composite glyphs: Glyphs that have components that are themselves composites
-are not supported. IsDeepComposite can be used to test for this. False is returned from many 
-of the methods in this cases. It is unclear how to build composite glyphs in some cases, 
+are not supported. IsDeepComposite can be used to test for this. False is returned from many
+of the methods in this cases. It is unclear how to build composite glyphs in some cases,
 so this code represents my best guess until test cases can be found. See notes on the high-
 level GlyfPoints method. */
 namespace graphite2
@@ -167,7 +167,7 @@
 ----------------------------------------------------------------------------------------------*/
 bool CheckHeader(const void * pHdr)
 {
-    const Sfnt::OffsetSubTable * pOffsetTable  
+    const Sfnt::OffsetSubTable * pOffsetTable
         = reinterpret_cast<const Sfnt::OffsetSubTable *>(pHdr);
 
     return pHdr && be::swap(pOffsetTable->scaler_type) == Sfnt::OffsetSubTable::TrueTypeWin;
@@ -185,7 +185,7 @@
     lOffset = offsetof(Sfnt::OffsetSubTable, table_directory);
     lSize   = be::swap(pOffsetTable->num_tables)
         * sizeof(Sfnt::OffsetSubTable::Entry);
-    
+
     return true;
 }
 
@@ -197,10 +197,10 @@
 bool GetTableInfo(const Tag TableTag, const void * pHdr, const void * pTableDir,
                            size_t & lOffset, size_t & lSize)
 {
-    const Sfnt::OffsetSubTable * pOffsetTable 
+    const Sfnt::OffsetSubTable * pOffsetTable
         = reinterpret_cast<const Sfnt::OffsetSubTable *>(pHdr);
     const size_t num_tables = be::swap(pOffsetTable->num_tables);
-    const Sfnt::OffsetSubTable::Entry 
+    const Sfnt::OffsetSubTable::Entry
         * entry_itr = reinterpret_cast<const Sfnt::OffsetSubTable::Entry *>(
             pTableDir),
         * const  dir_end = entry_itr + num_tables;
@@ -228,7 +228,7 @@
 bool CheckTable(const Tag TableId, const void * pTable, size_t lTableSize)
 {
     using namespace Sfnt;
-    
+
     if (pTable == 0 || lTableSize < 4) return false;
 
     switch(TableId)
@@ -235,7 +235,7 @@
     {
     case Tag::cmap: // cmap
     {
-        const Sfnt::CharacterCodeMap * const pCmap 
+        const Sfnt::CharacterCodeMap * const pCmap
             = reinterpret_cast<const Sfnt::CharacterCodeMap *>(pTable);
         if (lTableSize < sizeof(Sfnt::CharacterCodeMap))
             return false;
@@ -244,7 +244,7 @@
 
     case Tag::head: // head
     {
-        const Sfnt::FontHeader * const pHead 
+        const Sfnt::FontHeader * const pHead
             = reinterpret_cast<const Sfnt::FontHeader *>(pTable);
         if (lTableSize < sizeof(Sfnt::FontHeader))
             return false;
@@ -251,11 +251,11 @@
         bool r = be::swap(pHead->version) == OneFix
             && be::swap(pHead->magic_number) == FontHeader::MagicNumber
             && be::swap(pHead->glyph_data_format)
-                    == FontHeader::GlypDataFormat 
+                    == FontHeader::GlypDataFormat
             && (be::swap(pHead->index_to_loc_format)
-                    == FontHeader::ShortIndexLocFormat 
+                    == FontHeader::ShortIndexLocFormat
                 || be::swap(pHead->index_to_loc_format)
-                    == FontHeader::LongIndexLocFormat) 
+                    == FontHeader::LongIndexLocFormat)
             && sizeof(FontHeader) <= lTableSize;
         return r;
     }
@@ -262,14 +262,14 @@
 
     case Tag::post: // post
     {
-        const Sfnt::PostScriptGlyphName * const pPost 
+        const Sfnt::PostScriptGlyphName * const pPost
             = reinterpret_cast<const Sfnt::PostScriptGlyphName *>(pTable);
         if (lTableSize < sizeof(Sfnt::PostScriptGlyphName))
             return false;
         const fixed format = be::swap(pPost->format);
-        bool r = format == PostScriptGlyphName::Format1 
-            || format == PostScriptGlyphName::Format2 
-            || format == PostScriptGlyphName::Format3 
+        bool r = format == PostScriptGlyphName::Format1
+            || format == PostScriptGlyphName::Format2
+            || format == PostScriptGlyphName::Format3
             || format == PostScriptGlyphName::Format25;
         return r;
     }
@@ -276,7 +276,7 @@
 
     case Tag::hhea: // hhea
     {
-        const Sfnt::HorizontalHeader * pHhea = 
+        const Sfnt::HorizontalHeader * pHhea =
             reinterpret_cast<const Sfnt::HorizontalHeader *>(pTable);
         if (lTableSize < sizeof(Sfnt::HorizontalHeader))
             return false;
@@ -288,7 +288,7 @@
 
     case Tag::maxp: // maxp
     {
-        const Sfnt::MaximumProfile * pMaxp = 
+        const Sfnt::MaximumProfile * pMaxp =
             reinterpret_cast<const Sfnt::MaximumProfile *>(pTable);
         if (lTableSize < sizeof(Sfnt::MaximumProfile))
             return false;
@@ -299,12 +299,12 @@
 
     case Tag::OS_2: // OS/2
     {
-        const Sfnt::Compatibility * pOs2 
+        const Sfnt::Compatibility * pOs2
             = reinterpret_cast<const Sfnt::Compatibility *>(pTable);
         if (be::swap(pOs2->version) == 0)
         { // OS/2 table version 1 size
-//          if (sizeof(Sfnt::Compatibility) 
-//                  - sizeof(uint32)*2 - sizeof(int16)*2 
+//          if (sizeof(Sfnt::Compatibility)
+//                  - sizeof(uint32)*2 - sizeof(int16)*2
 //                  - sizeof(uint16)*3 <= lTableSize)
             if (sizeof(Sfnt::Compatibility0) <= lTableSize)
                 return true;
@@ -311,8 +311,8 @@
         }
         else if (be::swap(pOs2->version) == 1)
         { // OS/2 table version 2 size
-//          if (sizeof(Sfnt::Compatibility) 
-//                  - sizeof(int16) *2 
+//          if (sizeof(Sfnt::Compatibility)
+//                  - sizeof(int16) *2
 //                  - sizeof(uint16)*3 <= lTableSize)
             if (sizeof(Sfnt::Compatibility1) <= lTableSize)
                 return true;
@@ -334,7 +334,7 @@
 
     case Tag::name:
     {
-        const Sfnt::FontNames * pName 
+        const Sfnt::FontNames * pName
             = reinterpret_cast<const Sfnt::FontNames *>(pTable);
         if (lTableSize < sizeof(Sfnt::FontNames))
             return false;
@@ -360,7 +360,7 @@
 ----------------------------------------------------------------------------------------------*/
 size_t GlyphCount(const void * pMaxp)
 {
-    const Sfnt::MaximumProfile * pTable = 
+    const Sfnt::MaximumProfile * pTable =
             reinterpret_cast<const Sfnt::MaximumProfile *>(pMaxp);
     return be::swap(pTable->num_glyphs);
 }
@@ -373,7 +373,7 @@
 ----------------------------------------------------------------------------------------------*/
 size_t  MaxCompositeComponentCount(const void * pMaxp)
 {
-    const Sfnt::MaximumProfile * pTable = 
+    const Sfnt::MaximumProfile * pTable =
             reinterpret_cast<const Sfnt::MaximumProfile *>(pMaxp);
     return be::swap(pTable->max_component_elements);
 }
@@ -387,7 +387,7 @@
 ----------------------------------------------------------------------------------------------*/
 size_t  MaxCompositeLevelCount(const void * pMaxp)
 {
-    const Sfnt::MaximumProfile * pTable = 
+    const Sfnt::MaximumProfile * pTable =
             reinterpret_cast<const Sfnt::MaximumProfile *>(pMaxp);
     return be::swap(pTable->max_component_depth);
 }
@@ -401,7 +401,7 @@
 size_t LocaGlyphCount(size_t lLocaSize, const void * pHead) //throw(std::domain_error)
 {
 
-    const Sfnt::FontHeader * pTable 
+    const Sfnt::FontHeader * pTable
         = reinterpret_cast<const Sfnt::FontHeader *>(pHead);
 
     if (be::swap(pTable->index_to_loc_format)
@@ -408,7 +408,7 @@
         == Sfnt::FontHeader::ShortIndexLocFormat)
     // loca entries are two bytes and have been divided by two
         return (lLocaSize >> 1) - 1;
-    
+
     if (be::swap(pTable->index_to_loc_format)
         == Sfnt::FontHeader::LongIndexLocFormat)
      // loca entries are four bytes
@@ -424,9 +424,9 @@
 ----------------------------------------------------------------------------------------------*/
 int DesignUnits(const void * pHead)
 {
-    const Sfnt::FontHeader * pTable = 
+    const Sfnt::FontHeader * pTable =
             reinterpret_cast<const Sfnt::FontHeader *>(pHead);
-    
+
     return be::swap(pTable->units_per_em);
 }
 
@@ -436,9 +436,9 @@
 ----------------------------------------------------------------------------------------------*/
 int HeadTableCheckSum(const void * pHead)
 {
-    const Sfnt::FontHeader * pTable = 
+    const Sfnt::FontHeader * pTable =
             reinterpret_cast<const Sfnt::FontHeader *>(pHead);
-    
+
     return be::swap(pTable->check_sum_adjustment);
 }
 
@@ -451,9 +451,9 @@
 void HeadTableCreateTime(const void * pHead,
     unsigned int * pnDateBC, unsigned int * pnDateAD)
 {
-    const Sfnt::FontHeader * pTable = 
+    const Sfnt::FontHeader * pTable =
             reinterpret_cast<const Sfnt::FontHeader *>(pHead);
-    
+
     *pnDateBC = be::swap(pTable->created[0]);
     *pnDateAD = be::swap(pTable->created[1]);
 }
@@ -467,9 +467,9 @@
 void HeadTableModifyTime(const void * pHead,
     unsigned int * pnDateBC, unsigned int *pnDateAD)
 {
-    const Sfnt::FontHeader * pTable = 
+    const Sfnt::FontHeader * pTable =
             reinterpret_cast<const Sfnt::FontHeader *>(pHead);
-   ; 
+   ;
     *pnDateBC = be::swap(pTable->modified[0]);
     *pnDateAD = be::swap(pTable->modified[1]);
 }
@@ -479,7 +479,7 @@
 ----------------------------------------------------------------------------------------------*/
 bool IsItalic(const void * pHead)
 {
-    const Sfnt::FontHeader * pTable = 
+    const Sfnt::FontHeader * pTable =
             reinterpret_cast<const Sfnt::FontHeader *>(pHead);
 
     return ((be::swap(pTable->mac_style) & 0x00000002) != 0);
@@ -518,7 +518,7 @@
 
     fBold = (be::swap(pTable->fs_selection) & Sfnt::Compatibility::Bold) != 0;
     fItalic = (be::swap(pTable->fs_selection) & Sfnt::Compatibility::Italic) != 0;
-    
+
     return true;
 }
 #endif
@@ -615,7 +615,7 @@
 ----------------------------------------------------------------------------------------------*/
 bool Get31EngFamilyInfo(const void * pName, size_t & lOffset, size_t & lSize)
 {
-    return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 1, 1033, 
+    return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 1, 1033,
         Sfnt::NameRecord::Family, lOffset, lSize);
 }
 
@@ -628,7 +628,7 @@
 ----------------------------------------------------------------------------------------------*/
 bool Get31EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize)
 {
-    return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 1, 1033, 
+    return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 1, 1033,
         Sfnt::NameRecord::Fullname, lOffset, lSize);
 }
 
@@ -639,7 +639,7 @@
 ----------------------------------------------------------------------------------------------*/
 bool Get30EngFamilyInfo(const void * pName, size_t & lOffset, size_t & lSize)
 {
-    return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 0, 1033, 
+    return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 0, 1033,
         Sfnt::NameRecord::Family, lOffset, lSize);
 }
 
@@ -652,13 +652,13 @@
 ----------------------------------------------------------------------------------------------*/
 bool Get30EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize)
 {
-    return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 0, 1033, 
+    return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 0, 1033,
         Sfnt::NameRecord::Fullname, lOffset, lSize);
 }
 
 /*----------------------------------------------------------------------------------------------
     Return the Glyph ID for a given Postscript name. This method finds the first glyph which
-    matches the requested Postscript name. Ideally every glyph should have a unique Postscript 
+    matches the requested Postscript name. Ideally every glyph should have a unique Postscript
     name (except for special names such as .notdef), but this is not always true.
     On failure return value less than zero.
        -1 - table search failed
@@ -667,12 +667,12 @@
 
     Note: this method is not currently used by the Graphite engine.
 ----------------------------------------------------------------------------------------------*/
-int PostLookup(const void * pPost, size_t lPostSize, const void * pMaxp, 
+int PostLookup(const void * pPost, size_t lPostSize, const void * pMaxp,
                         const char * pPostName)
 {
     using namespace Sfnt;
-    
-    const Sfnt::PostScriptGlyphName * pTable 
+
+    const Sfnt::PostScriptGlyphName * pTable
         = reinterpret_cast<const Sfnt::PostScriptGlyphName *>(pPost);
     fixed format = be::swap(pTable->format);
 
@@ -696,19 +696,19 @@
     { // format 1 - use standard Postscript names
         return iPostName;
     }
-    
+
     if (format == PostScriptGlyphName::Format25)
-    { 
+    {
         if (iPostName == -1)
             return -1;
-        
-        const PostScriptGlyphName25 * pTable25 
+
+        const PostScriptGlyphName25 * pTable25
             = static_cast<const PostScriptGlyphName25 *>(pTable);
         int cnGlyphs = GlyphCount(pMaxp);
-        for (gid16 nGlyphId = 0; nGlyphId < cnGlyphs && nGlyphId < kcPostNames; 
+        for (gid16 nGlyphId = 0; nGlyphId < cnGlyphs && nGlyphId < kcPostNames;
                 nGlyphId++)
         { // glyph_name_index25 contains bytes so no byte swapping needed
-          // search for first glyph id that uses the standard name 
+          // search for first glyph id that uses the standard name
             if (nGlyphId + pTable25->offset[nGlyphId] == iPostName)
                 return nGlyphId;
         }
@@ -716,9 +716,9 @@
 
     if (format == PostScriptGlyphName::Format2)
     { // format 2
-        const PostScriptGlyphName2 * pTable2 
+        const PostScriptGlyphName2 * pTable2
             = static_cast<const PostScriptGlyphName2 *>(pTable);
-        
+
         int cnGlyphs = be::swap(pTable2->number_of_glyphs);
 
         if (iPostName != -1)
@@ -737,9 +737,9 @@
             const char * pGlyphName = pFirstGlyphName;
             int iInNames = 0; // index in font specific names
             bool fFound = false;
-            const char * const endOfTable 
+            const char * const endOfTable
                 = reinterpret_cast<const char *>(pTable2) + lPostSize;
-            while (pGlyphName < endOfTable && !fFound) 
+            while (pGlyphName < endOfTable && !fFound)
             { // search Pascal strings for first matching name
                 size_t nStringSize = size_t(*pGlyphName);
                 if (nStrSizeGoal != nStringSize ||
@@ -770,12 +770,12 @@
 }
 
 /*----------------------------------------------------------------------------------------------
-    Convert a Unicode character string from big endian (MSB first, Motorola) format to little 
-    endian (LSB first, Intel) format. 
-    nSize is the number of Unicode characters in the string. It should not include any 
-    terminating null. If nSize is 0, it is assumed the string is null terminated. nSize 
+    Convert a Unicode character string from big endian (MSB first, Motorola) format to little
+    endian (LSB first, Intel) format.
+    nSize is the number of Unicode characters in the string. It should not include any
+    terminating null. If nSize is 0, it is assumed the string is null terminated. nSize
     defaults to 0.
-    Return true if successful, false otherwise. 
+    Return true if successful, false otherwise.
 ----------------------------------------------------------------------------------------------*/
 void SwapWString(void * pWStr, size_t nSize /* = 0 */) //throw (std::invalid_argument)
 {
@@ -803,17 +803,17 @@
     Get the left-side bearing and and advance width based on the given tables and Glyph ID
     Return true if successful, false otherwise. On false, one or both value could be INT_MIN
 ----------------------------------------------------------------------------------------------*/
-bool HorMetrics(gid16 nGlyphId, const void * pHmtx, size_t lHmtxSize, const void * pHhea, 
+bool HorMetrics(gid16 nGlyphId, const void * pHmtx, size_t lHmtxSize, const void * pHhea,
                          int & nLsb, unsigned int & nAdvWid)
 {
-    const Sfnt::HorizontalMetric * phmtx = 
+    const Sfnt::HorizontalMetric * phmtx =
         reinterpret_cast<const Sfnt::HorizontalMetric *>(pHmtx);
 
-    const Sfnt::HorizontalHeader * phhea = 
+    const Sfnt::HorizontalHeader * phhea =
         reinterpret_cast<const Sfnt::HorizontalHeader *>(pHhea);
 
     size_t cLongHorMetrics = be::swap(phhea->num_long_hor_metrics);
-    if (nGlyphId < cLongHorMetrics) 
+    if (nGlyphId < cLongHorMetrics)
     {   // glyph id is acceptable
         if ((nGlyphId + 1) * sizeof(Sfnt::HorizontalMetric) > lHmtxSize) return false;
         nAdvWid = be::swap(phmtx[nGlyphId].advance_width);
@@ -899,7 +899,7 @@
     size_t table_len = (const byte *)pCmapEnd - (const byte *)pCmapSubtable4;
     if (!pCmapSubtable4) return false;
     const Sfnt::CmapSubTable * pTable = reinterpret_cast<const Sfnt::CmapSubTable *>(pCmapSubtable4);
-    // Bob H say some freeware TT fonts have version 1 (eg, CALIGULA.TTF) 
+    // Bob H say some freeware TT fonts have version 1 (eg, CALIGULA.TTF)
     // so don't check subtable version. 21 Mar 2002 spec changes version to language.
     if (table_len < sizeof(*pTable) || be::swap(pTable->format) != 4) return false;
     const Sfnt::CmapSubTableFormat4 * pTable4 = reinterpret_cast<const Sfnt::CmapSubTableFormat4 *>(pCmapSubtable4);
@@ -958,7 +958,7 @@
     const Sfnt::CmapSubTableFormat4 * pTable = reinterpret_cast<const Sfnt::CmapSubTableFormat4 *>(pCmapSubtabel4);
 
     uint16 nSeg = be::swap(pTable->seg_count_x2) >> 1;
-  
+
     uint16 n;
     const uint16 * pLeft, * pMid;
     uint16 cMid, chStart, chEnd;
@@ -1211,8 +1211,8 @@
     Technically this method should return an unsigned long but it is unlikely the offset will
         exceed 2^31.
 ----------------------------------------------------------------------------------------------*/
-size_t LocaLookup(gid16 nGlyphId, 
-        const void * pLoca, size_t lLocaSize, 
+size_t LocaLookup(gid16 nGlyphId,
+        const void * pLoca, size_t lLocaSize,
         const void * pHead) // throw (std::out_of_range)
 {
     const Sfnt::FontHeader * pTable = reinterpret_cast<const Sfnt::FontHeader *>(pHead);
@@ -1252,8 +1252,8 @@
 void * GlyfLookup(const void * pGlyf, size_t nGlyfOffset, size_t nTableLen)
 {
     const uint8 * pByte = reinterpret_cast<const uint8 *>(pGlyf);
-        if (nGlyfOffset + pByte < pByte || nGlyfOffset >= nTableLen - sizeof(Sfnt::Glyph))
-            return NULL;
+    if (OVERFLOW_OFFSET_CHECK(pByte, nGlyfOffset) || nGlyfOffset >= nTableLen - sizeof(Sfnt::Glyph))
+        return NULL;
     return const_cast<uint8 *>(pByte + nGlyfOffset);
 }
 
@@ -1261,7 +1261,7 @@
     Get the bounding box coordinates for a simple glyf entry (non-composite).
     Return true if successful, false otherwise.
 ----------------------------------------------------------------------------------------------*/
-bool GlyfBox(const void * pSimpleGlyf, int & xMin, int & yMin, 
+bool GlyfBox(const void * pSimpleGlyf, int & xMin, int & yMin,
                       int & xMax, int & yMax)
 {
     const Sfnt::Glyph * pGlyph = reinterpret_cast<const Sfnt::Glyph *>(pSimpleGlyf);
@@ -1287,7 +1287,7 @@
 
 /*----------------------------------------------------------------------------------------------
     Get the point numbers for the end points of the glyph contours for a simple
-    glyf entry (non-composite). 
+    glyf entry (non-composite).
     cnPointsTotal - count of contours from GlyfContourCount(); (same as number of end points)
     prgnContourEndPoints - should point to a buffer large enough to hold cnPoints integers
     cnPoints - count of points placed in above range
@@ -1294,7 +1294,7 @@
     Return true if successful, false otherwise.
         False could indicate a multi-level composite glyphs.
 ----------------------------------------------------------------------------------------------*/
-bool GlyfContourEndPoints(const void * pSimpleGlyf, int * prgnContourEndPoint, 
+bool GlyfContourEndPoints(const void * pSimpleGlyf, int * prgnContourEndPoint,
                                    int cnPointsTotal, int & cnPoints)
 {
     const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast<const Sfnt::SimpleGlyph *>(pSimpleGlyf);
@@ -1316,19 +1316,19 @@
     Get the points for a simple glyf entry (non-composite)
     cnPointsTotal - count of points from largest end point obtained from GlyfContourEndPoints
     prgnX & prgnY - should point to buffers large enough to hold cnPointsTotal integers
-        The ranges are parallel so that coordinates for point(n) are found at offset n in both 
+        The ranges are parallel so that coordinates for point(n) are found at offset n in both
         ranges. This is raw point data with relative coordinates.
     prgbFlag - should point to a buffer a large enough to hold cnPointsTotal bytes
         This range is parallel to the prgnX & prgnY
     cnPoints - count of points placed in above ranges
-    Return true if successful, false otherwise. 
+    Return true if successful, false otherwise.
         False could indicate a composite glyph
 ----------------------------------------------------------------------------------------------*/
-bool GlyfPoints(const void * pSimpleGlyf, int * prgnX, int * prgnY, 
+bool GlyfPoints(const void * pSimpleGlyf, int * prgnX, int * prgnY,
         char * prgbFlag, int cnPointsTotal, int & cnPoints)
 {
     using namespace Sfnt;
-    
+
     const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast<const Sfnt::SimpleGlyph *>(pSimpleGlyf);
     int cContours = be::swap(pGlyph->number_of_contours);
     // return false for composite glyph
@@ -1341,7 +1341,7 @@
     // skip over bounding box data & point to byte count of instructions (hints)
     const uint8 * pbGlyph = reinterpret_cast<const uint8 *>
         (&pGlyph->end_pts_of_contours[cContours]);
-    
+
     // skip over hints & point to first flag
     int cbHints = be::swap(*(uint16 *)pbGlyph);
     pbGlyph += sizeof(uint16);
@@ -1403,7 +1403,7 @@
         }
         iFlag++;
     }
-        
+
     // load y coordinates
     iFlag = 0;
     while (iFlag < cPts)
@@ -1432,7 +1432,7 @@
         }
         iFlag++;
     }
-        
+
     cnPoints = cPts;
     return true;
 }
@@ -1441,16 +1441,16 @@
     Fill prgnCompId with the component Glyph IDs from pSimpleGlyf.
     Client must allocate space before calling.
     pSimpleGlyf - assumed to point to a composite glyph
-    cCompIdTotal - the number of elements in prgnCompId 
+    cCompIdTotal - the number of elements in prgnCompId
     cCompId  - the total number of Glyph IDs stored in prgnCompId
     Return true if successful, false otherwise
         False could indicate a non-composite glyph or the input array was not big enough
 ----------------------------------------------------------------------------------------------*/
-bool GetComponentGlyphIds(const void * pSimpleGlyf, int * prgnCompId, 
+bool GetComponentGlyphIds(const void * pSimpleGlyf, int * prgnCompId,
         size_t cnCompIdTotal, size_t & cnCompId)
 {
     using namespace Sfnt;
-    
+
     if (GlyfContourCount(pSimpleGlyf) >= 0)
         return false;
 
@@ -1460,13 +1460,13 @@
 
     uint16 GlyphFlags;
     size_t iCurrentComp = 0;
-    do 
+    do
     {
         GlyphFlags = be::swap(*((uint16 *)pbGlyph));
         pbGlyph += sizeof(uint16);
         prgnCompId[iCurrentComp++] = be::swap(*((uint16 *)pbGlyph));
         pbGlyph += sizeof(uint16);
-        if (iCurrentComp >= cnCompIdTotal) 
+        if (iCurrentComp >= cnCompIdTotal)
             return false;
         int nOffset = 0;
         nOffset += GlyphFlags & CompoundGlyph::Arg1Arg2Words ? 4 : 2;
@@ -1495,7 +1495,7 @@
                                     bool fOffset, int & a, int & b)
 {
     using namespace Sfnt;
-    
+
     if (GlyfContourCount(pSimpleGlyf) >= 0)
         return false;
 
@@ -1504,7 +1504,7 @@
     const uint8 * pbGlyph = reinterpret_cast<const uint8 *>(&pGlyph->end_pts_of_contours[0]);
 
     uint16 GlyphFlags;
-    do 
+    do
     {
         GlyphFlags = be::swap(*((uint16 *)pbGlyph));
         pbGlyph += sizeof(uint16);
@@ -1548,7 +1548,7 @@
     pSimpleGlyph - assumed to point to a composite glyph
     nCompId - glyph id for component of interest
     flt11, flt11, flt11, flt11 - a 2x2 matrix giving the transform
-    bTransOffset - whether to transform the offset from above method 
+    bTransOffset - whether to transform the offset from above method
         The spec is unclear about the meaning of this flag
         Currently - initialize to true for MS rasterizer and false for Mac rasterizer, then
             on return it will indicate whether transform should apply to offset (MSDN CD 10/99)
@@ -1555,12 +1555,12 @@
     Return true if successful, false otherwise
         False could indicate a non-composite glyph or that component wasn't found
 ----------------------------------------------------------------------------------------------*/
-bool GetComponentTransform(const void * pSimpleGlyf, int nCompId, 
-                                    float & flt11, float & flt12, float & flt21, float & flt22, 
+bool GetComponentTransform(const void * pSimpleGlyf, int nCompId,
+                                    float & flt11, float & flt12, float & flt21, float & flt22,
                                     bool & fTransOffset)
 {
     using namespace Sfnt;
-    
+
     if (GlyfContourCount(pSimpleGlyf) >= 0)
         return false;
 
@@ -1569,7 +1569,7 @@
     const uint8 * pbGlyph = reinterpret_cast<const uint8 *>(&pGlyph->end_pts_of_contours[0]);
 
     uint16 GlyphFlags;
-    do 
+    do
     {
         GlyphFlags = be::swap(*((uint16 *)pbGlyph));
         pbGlyph += sizeof(uint16);
@@ -1579,7 +1579,7 @@
             pbGlyph += GlyphFlags & CompoundGlyph::Arg1Arg2Words  ? 4 : 2; // skip over placement data
 
             if (fTransOffset) // MS rasterizer
-                fTransOffset = !(GlyphFlags & CompoundGlyph::UnscaledOffset); 
+                fTransOffset = !(GlyphFlags & CompoundGlyph::UnscaledOffset);
             else // Apple rasterizer
                 fTransOffset = (GlyphFlags & CompoundGlyph::ScaledOffset) != 0;
 
@@ -1644,13 +1644,13 @@
     Since this method doesn't check for spaces, it is good to call IsSpace before using it.
     Return NULL on error.
 ----------------------------------------------------------------------------------------------*/
-void * GlyfLookup(gid16 nGlyphId, const void * pGlyf, const void * pLoca, 
+void * GlyfLookup(gid16 nGlyphId, const void * pGlyf, const void * pLoca,
                            size_t lGlyfSize, size_t lLocaSize, const void * pHead)
 {
     // test for valid glyph id
     // CheckTable verifies the index_to_loc_format is valid
-    
-    const Sfnt::FontHeader * pTable 
+
+    const Sfnt::FontHeader * pTable
         = reinterpret_cast<const Sfnt::FontHeader *>(pHead);
 
     if (be::swap(pTable->index_to_loc_format) == Sfnt::FontHeader::ShortIndexLocFormat)
@@ -1670,7 +1670,7 @@
         }
     }
 
-    long lGlyfOffset = LocaLookup(nGlyphId, pLoca, lLocaSize, pHead);
+    size_t lGlyfOffset = LocaLookup(nGlyphId, pLoca, lLocaSize, pHead);
     void * pSimpleGlyf = GlyfLookup(pGlyf, lGlyfOffset, lGlyfSize); // invalid loca offset returns null
     return pSimpleGlyf;
 }
@@ -1683,7 +1683,7 @@
 bool IsSpace(gid16 nGlyphId, const void * pLoca, size_t lLocaSize, const void * pHead)
 {
     size_t lGlyfOffset = LocaLookup(nGlyphId, pLoca, lLocaSize, pHead);
-    
+
     // the +1 should always work because there is a sentinel value at the end of the loca table
     size_t lNextGlyfOffset = LocaLookup(nGlyphId + 1, pLoca, lLocaSize, pHead);
 
@@ -1693,7 +1693,7 @@
 /*----------------------------------------------------------------------------------------------
     Determine if a particular Glyph ID is a multi-level composite.
 ----------------------------------------------------------------------------------------------*/
-bool IsDeepComposite(gid16 nGlyphId, const void * pGlyf, const void * pLoca, 
+bool IsDeepComposite(gid16 nGlyphId, const void * pGlyf, const void * pLoca,
                     size_t lGlyfSize, long lLocaSize, const void * pHead)
 {
     if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) {return false;}
@@ -1714,7 +1714,7 @@
 
     for (size_t i = 0; i < cCompId; i++)
     {
-        pSimpleGlyf = GlyfLookup(static_cast<gid16>(rgnCompId[i]), 
+        pSimpleGlyf = GlyfLookup(static_cast<gid16>(rgnCompId[i]),
                             pGlyf, pLoca, lGlyfSize, lLocaSize, pHead);
         if (pSimpleGlyf == NULL) {return false;}
 
@@ -1731,7 +1731,7 @@
     Return true if successful, false otherwise. On false, all point values will be INT_MIN
         False may indicate a white space glyph
 ----------------------------------------------------------------------------------------------*/
-bool GlyfBox(gid16  nGlyphId, const void * pGlyf, const void * pLoca, 
+bool GlyfBox(gid16  nGlyphId, const void * pGlyf, const void * pLoca,
         size_t lGlyfSize, size_t lLocaSize, const void * pHead, int & xMin, int & yMin, int & xMax, int & yMax)
 {
     xMin = yMin = xMax = yMax = INT_MIN;
@@ -1750,7 +1750,7 @@
     Return true if successful, false otherwise. On false, cnContours will be INT_MIN
         False may indicate a white space glyph or a multi-level composite glyph.
 ----------------------------------------------------------------------------------------------*/
-bool GlyfContourCount(gid16 nGlyphId, const void * pGlyf, const void * pLoca, 
+bool GlyfContourCount(gid16 nGlyphId, const void * pGlyf, const void * pLoca,
     size_t lGlyfSize, size_t lLocaSize, const void * pHead, size_t & cnContours)
 {
     cnContours = static_cast<size_t>(INT_MIN);
@@ -1766,7 +1766,7 @@
         cnContours = size_t(cRtnContours);
         return true;
     }
-        
+
     //handle composite glyphs
 
     int rgnCompId[kMaxGlyphComponents]; // assumes no glyph will be made of more than 8 components
@@ -1781,11 +1781,11 @@
     for (size_t i = 0; i < cCompId; i++)
     {
         if (IsSpace(static_cast<gid16>(rgnCompId[i]), pLoca, lLocaSize, pHead)) {return false;}
-        pSimpleGlyf = GlyfLookup(static_cast<gid16>(rgnCompId[i]), 
+        pSimpleGlyf = GlyfLookup(static_cast<gid16>(rgnCompId[i]),
                                  pGlyf, pLoca, lGlyfSize, lLocaSize, pHead);
         if (pSimpleGlyf == 0) {return false;}
         // return false on multi-level composite
-        if ((cTmp = GlyfContourCount(pSimpleGlyf)) < 0) 
+        if ((cTmp = GlyfContourCount(pSimpleGlyf)) < 0)
             return false;
         cRtnContours += cTmp;
     }
@@ -1795,7 +1795,7 @@
 }
 
 /*----------------------------------------------------------------------------------------------
-    Get the point numbers for the end points of the glyph contours based on the given tables 
+    Get the point numbers for the end points of the glyph contours based on the given tables
     and Glyph ID
     Handles both simple and composite glyphs.
     cnPoints - count of contours from GlyfContourCount (same as number of end points)
@@ -1803,7 +1803,7 @@
     Return true if successful, false otherwise. On false, all end points are INT_MIN
         False may indicate a white space glyph or a multi-level composite glyph.
 ----------------------------------------------------------------------------------------------*/
-bool GlyfContourEndPoints(gid16 nGlyphId, const void * pGlyf, const void * pLoca, 
+bool GlyfContourEndPoints(gid16 nGlyphId, const void * pGlyf, const void * pLoca,
     size_t lGlyfSize, size_t lLocaSize, const void * pHead,
     int * prgnContourEndPoint, size_t cnPoints)
 {
@@ -1819,9 +1819,9 @@
     int cActualPts = 0;
     if (cContours > 0)
         return GlyfContourEndPoints(pSimpleGlyf, prgnContourEndPoint, cnPoints, cActualPts);
-    
+
     // handle composite glyphs
-    
+
     int rgnCompId[kMaxGlyphComponents]; // assumes no glyph will be made of more than 8 components
     size_t cCompIdTotal = kMaxGlyphComponents;
     size_t cCompId = 0;
@@ -1858,21 +1858,21 @@
     Handles both simple and composite glyphs.
     cnPoints - count of points from largest end point obtained from GlyfContourEndPoints
     prgnX & prgnY - should point to buffers large enough to hold cnPoints integers
-        The ranges are parallel so that coordinates for point(n) are found at offset n in 
+        The ranges are parallel so that coordinates for point(n) are found at offset n in
         both ranges. These points are in absolute coordinates.
     prgfOnCurve - should point to a buffer a large enough to hold cnPoints bytes (bool)
         This range is parallel to the prgnX & prgnY
     Return true if successful, false otherwise. On false, all points may be INT_MIN
         False may indicate a white space glyph, a multi-level composite, or a corrupt font
-        It's not clear from the TTF spec when the transforms should be applied. Should the 
-        transform be done before or after attachment point calcs? (current code - before) 
-        Should the transform be applied to other offsets? (currently - no; however commented 
-        out code is in place so that if CompoundGlyph::UnscaledOffset on the MS rasterizer is 
-        clear (typical) then yes, and if CompoundGlyph::ScaledOffset on the Apple rasterizer is 
+        It's not clear from the TTF spec when the transforms should be applied. Should the
+        transform be done before or after attachment point calcs? (current code - before)
+        Should the transform be applied to other offsets? (currently - no; however commented
+        out code is in place so that if CompoundGlyph::UnscaledOffset on the MS rasterizer is
+        clear (typical) then yes, and if CompoundGlyph::ScaledOffset on the Apple rasterizer is
         clear (typical?) then no). See GetComponentTransform.
-        It's also unclear where point numbering with attachment poinst starts 
-        (currently - first point number is relative to whole glyph, second point number is 
-        relative to current glyph). 
+        It's also unclear where point numbering with attachment poinst starts
+        (currently - first point number is relative to whole glyph, second point number is
+        relative to current glyph).
 ----------------------------------------------------------------------------------------------*/
 bool GlyfPoints(gid16 nGlyphId, const void * pGlyf,
         const void * pLoca, size_t lGlyfSize, size_t lLocaSize, const void * pHead,
@@ -1882,7 +1882,7 @@
         memset(prgnX, 0x7F, cnPoints * sizeof(int));
         memset(prgnY, 0x7F, cnPoints * sizeof(int));
 
-    if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) 
+    if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead))
         return false;
 
     void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lGlyfSize, lLocaSize, pHead);
@@ -1900,7 +1900,7 @@
         return true;
     }
 
-    // handle composite glyphs  
+    // handle composite glyphs
     int rgnCompId[kMaxGlyphComponents]; // assumes no glyph will be made of more than 8 components
     size_t cCompIdTotal = kMaxGlyphComponents;
     size_t cCompId = 0;
@@ -1924,12 +1924,12 @@
         void * pCompGlyf = GlyfLookup(static_cast<gid16>(rgnCompId[i]), pGlyf, pLoca, lGlyfSize, lLocaSize, pHead);
         if (pCompGlyf == NULL) {return false;}
         // returns false on multi-level composite
-        if (!GlyfPoints(pCompGlyf, prgnCurrentX, prgnCurrentY, prgbCurrentFlag, 
+        if (!GlyfPoints(pCompGlyf, prgnCurrentX, prgnCurrentY, prgbCurrentFlag,
             cCurrentPoints, cActualPts))
-            return false; 
+            return false;
         if (!GetComponentPlacement(pSimpleGlyf, rgnCompId[i], fOffset, a, b))
             return false;
-        if (!GetComponentTransform(pSimpleGlyf, rgnCompId[i], 
+        if (!GetComponentTransform(pSimpleGlyf, rgnCompId[i],
             flt11, flt12, flt21, flt22, fTransOff))
             return false;
         bool fIdTrans = flt11 == 1.0 && flt12 == 0.0 && flt21 == 0.0 && flt22 == 1.0;
@@ -1948,18 +1948,18 @@
                 prgnCurrentX[j] = (int)(x * flt11 + y * flt12);
                 prgnCurrentY[j] = (int)(x * flt21 + y * flt22);
             }
-            
+
         // apply placement - see main method note above
         int nXOff, nYOff;
         if (fOffset) // explicit x & y offsets
-        { 
+        {
             /* ignore fTransOff for now
-            if (fTransOff && !fIdTrans) 
+            if (fTransOff && !fIdTrans)
             {   // transform x & y offsets
                 nXOff = (int)(a * flt11 + b * flt12);
                 nYOff = (int)(a * flt21 + b * flt22);
             }
-            else */ 
+            else */
             { // don't transform offset
                 nXOff = a;
                 nYOff = b;
@@ -2004,7 +2004,7 @@
 
 /*----------------------------------------------------------------------------------------------
     Convert relative point coordinates to absolute coordinates
-    Points are stored in the font such that they are offsets from one another except for the 
+    Points are stored in the font such that they are offsets from one another except for the
         first point of a glyph.
 ---------------------------------------------------------------------------------------------*/
 bool CalcAbsolutePoints(int * prgnX, int * prgnY, int cnPoints)

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/UtfCodec.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/UtfCodec.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/UtfCodec.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/call_machine.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/call_machine.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/call_machine.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -28,8 +28,8 @@
 // Author: Tim Eves
 
 // Build either this interpreter or the direct_machine implementation.
-// The call threaded interpreter is portable across compilers and 
-// architectures as well as being useful to debug (you can set breakpoints on 
+// The call threaded interpreter is portable across compilers and
+// architectures as well as being useful to debug (you can set breakpoints on
 // opcodes) but is slower that the direct threaded interpreter by a factor of 2
 
 #include <cassert>
@@ -117,7 +117,7 @@
             * const sb = sp;
     regbank         reg = {*map, map, _map, _map.begin()+_map.context(), ip, _map.dir(), 0, _status};
 
-    // Run the program        
+    // Run the program
     while ((reinterpret_cast<ip_t>(*++ip))(dp, sp, sb, reg)) {}
     const stack_t ret = sp == _stack+STACK_GUARD+1 ? *sp-- : 0;
 
@@ -136,5 +136,3 @@
 {
     return opcode_table;
 }
-
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/direct_machine.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/direct_machine.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/direct_machine.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -28,12 +28,12 @@
 // Author: Tim Eves
 
 // Build either this interpreter or the call_machine implementation.
-// The direct threaded interpreter is relies upon a gcc feature called 
-// labels-as-values so is only portable to compilers that support the 
+// The direct threaded interpreter is relies upon a gcc feature called
+// labels-as-values so is only portable to compilers that support the
 // extension (gcc only as far as I know) however it should build on any
-// architecture gcc supports. 
-// This is twice as fast as the call threaded model and is likely faster on 
-// inorder processors with short pipelines and little branch prediction such 
+// architecture gcc supports.
+// This is twice as fast as the call threaded model and is likely faster on
+// inorder processors with short pipelines and little branch prediction such
 // as the ARM and possibly Atom chips.
 
 
@@ -65,7 +65,7 @@
                         Machine::status_t & status,
                         SlotMap           * __smap=0)
 {
-    // We need to define and return to opcode table from within this function 
+    // We need to define and return to opcode table from within this function
     // other inorder to take the addresses of the instruction bodies.
     #include "inc/opcode_table.h"
     if (get_table_mode)
@@ -83,13 +83,13 @@
                   * const mapb = smap.begin()+smap.context();
     uint8                  dir = _dir;
     int8                 flags = 0;
-    
+
     // start the program
     goto **ip;
 
     // Pull in the opcode definitions
     #include "inc/opcodes.h"
-    
+
     end:
     __map  = map;
     *__map = is;
@@ -111,7 +111,7 @@
                                slotref     * & is)
 {
     assert(program != 0);
-    
+
     const stack_t *sp = static_cast<const stack_t *>(
                 direct_run(false, program, data, _stack, is, _map.dir(), _status, &_map));
     const stack_t ret = sp == _stack+STACK_GUARD+1 ? *sp-- : 0;
@@ -118,4 +118,3 @@
     check_final_stack(sp);
     return ret;
 }
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/files.mk
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/files.mk	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/files.mk	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 #
 #    You should also have received a copy of the GNU Lesser General Public
 #    License along with this library in the file named "LICENSE".
-#    If not, write to the Free Software Foundation, 51 Franklin Street, 
-#    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+#    If not, write to the Free Software Foundation, 51 Franklin Street,
+#    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
 #    internet at http://www.fsf.org/licenses/lgpl.html.
 #
 # Alternatively, the contents of this file may be used under the terms of the
@@ -63,9 +63,6 @@
     $($(_NS)_BASE)/src/NameTable.cpp \
     $($(_NS)_BASE)/src/Pass.cpp \
     $($(_NS)_BASE)/src/Position.cpp \
-    $($(_NS)_BASE)/src/SegCache.cpp \
-    $($(_NS)_BASE)/src/SegCacheEntry.cpp \
-    $($(_NS)_BASE)/src/SegCacheStore.cpp \
     $($(_NS)_BASE)/src/Segment.cpp \
     $($(_NS)_BASE)/src/Silf.cpp \
     $($(_NS)_BASE)/src/Slot.cpp \
@@ -104,9 +101,6 @@
     $($(_NS)_BASE)/src/inc/Pass.h \
     $($(_NS)_BASE)/src/inc/Position.h \
     $($(_NS)_BASE)/src/inc/Rule.h \
-    $($(_NS)_BASE)/src/inc/SegCache.h \
-    $($(_NS)_BASE)/src/inc/SegCacheEntry.h \
-    $($(_NS)_BASE)/src/inc/SegCacheStore.h \
     $($(_NS)_BASE)/src/inc/Segment.h \
     $($(_NS)_BASE)/src/inc/Silf.h \
     $($(_NS)_BASE)/src/inc/Slot.h \
@@ -120,4 +114,3 @@
     $($(_NS)_BASE)/include/graphite2/Log.h \
     $($(_NS)_BASE)/include/graphite2/Segment.h \
     $($(_NS)_BASE)/include/graphite2/Types.h
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/gr_char_info.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/gr_char_info.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/gr_char_info.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/gr_face.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/gr_face.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/gr_face.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -28,7 +28,6 @@
 #include "inc/Face.h"
 #include "inc/FileFace.h"
 #include "inc/GlyphCache.h"
-#include "inc/CachedFace.h"
 #include "inc/CmapCache.h"
 #include "inc/Silf.h"
 #include "inc/json.h"
@@ -47,8 +46,7 @@
         telemetry::category _misc_cat(face.tele.misc);
 #endif
         Face::Table silf(face, Tag::Silf, 0x00050000);
-        if (silf)   options &= ~gr_face_dumbRendering;
-        else if (!(options &  gr_face_dumbRendering))
+        if (!silf)
             return false;
 
         if (!face.readGlyphs(options))
@@ -74,14 +72,24 @@
                 return true;
         }
         else
-            return options & gr_face_dumbRendering;
+            return false;
     }
+
+    inline
+    uint32 zeropad(const uint32 x)
+    {
+        if (x == 0x20202020)                    return 0;
+        if ((x & 0x00FFFFFF) == 0x00202020)     return x & 0xFF000000;
+        if ((x & 0x0000FFFF) == 0x00002020)     return x & 0xFFFF0000;
+        if ((x & 0x000000FF) == 0x00000020)     return x & 0xFFFFFF00;
+        return x;
+    }
 }
 
 extern "C" {
 
 gr_face* gr_make_face_with_ops(const void* appFaceHandle/*non-NULL*/, const gr_face_ops *ops, unsigned int faceOptions)
-                  //the appFaceHandle must stay alive all the time when the gr_face is alive. When finished with the gr_face, call destroy_face    
+                  //the appFaceHandle must stay alive all the time when the gr_face is alive. When finished with the gr_face, call destroy_face
 {
     if (ops == 0)   return 0;
 
@@ -99,56 +107,41 @@
     return gr_make_face_with_ops(appFaceHandle, &ops, faceOptions);
 }
 
-#ifndef GRAPHITE2_NSEGCACHE
-gr_face* gr_make_face_with_seg_cache_and_ops(const void* appFaceHandle/*non-NULL*/, const gr_face_ops *ops, unsigned int cacheSize, unsigned int faceOptions)
-                  //the appFaceHandle must stay alive all the time when the GrFace is alive. When finished with the GrFace, call destroy_face
+
+gr_face* gr_make_face_with_seg_cache_and_ops(const void* appFaceHandle/*non-NULL*/, const gr_face_ops *ops, unsigned int , unsigned int faceOptions)
 {
-    if (ops == 0)   return 0;
-
-    CachedFace *res = new CachedFace(appFaceHandle, *ops);
-    if (res && load_face(*res, faceOptions)
-            && res->setupCache(cacheSize))
-        return static_cast<gr_face *>(static_cast<Face *>(res));
-
-    delete res;
-    return 0;
+  return gr_make_face_with_ops(appFaceHandle, ops, faceOptions);
 }
 
-gr_face* gr_make_face_with_seg_cache(const void* appFaceHandle/*non-NULL*/, gr_get_table_fn getTable, unsigned int cacheSize, unsigned int faceOptions)
+gr_face* gr_make_face_with_seg_cache(const void* appFaceHandle/*non-NULL*/, gr_get_table_fn tablefn, unsigned int, unsigned int faceOptions)
 {
-    const gr_face_ops ops = {sizeof(gr_face_ops), getTable, NULL};
-    return gr_make_face_with_seg_cache_and_ops(appFaceHandle, &ops, cacheSize, faceOptions);
+  const gr_face_ops ops = {sizeof(gr_face_ops), tablefn, NULL};
+  return gr_make_face_with_ops(appFaceHandle, &ops, faceOptions);
 }
-#endif
 
 gr_uint32 gr_str_to_tag(const char *str)
 {
     uint32 res = 0;
-    int i = strlen(str);
-    if (i > 4) i = 4;
-    while (--i >= 0)
-        res = (res >> 8) + (str[i] << 24);
+    switch(max(strlen(str),size_t(4)))
+    {
+        case 4: res |= str[3];       GR_FALLTHROUGH;
+        case 3: res |= str[2] << 8;  GR_FALLTHROUGH;
+        case 2: res |= str[1] << 16; GR_FALLTHROUGH;
+        case 1: res |= str[0] << 24; GR_FALLTHROUGH;
+        default:  break;
+    }
     return res;
 }
 
 void gr_tag_to_str(gr_uint32 tag, char *str)
 {
-    int i = 4;
-    while (--i >= 0)
-    {
-        str[i] = tag & 0xFF;
-        tag >>= 8;
-    }
-}
+    if (!str) return;
 
-inline
-uint32 zeropad(const uint32 x)
-{
-    if (x == 0x20202020)                    return 0;
-    if ((x & 0x00FFFFFF) == 0x00202020)     return x & 0xFF000000;
-    if ((x & 0x0000FFFF) == 0x00002020)     return x & 0xFFFF0000;
-    if ((x & 0x000000FF) == 0x00000020)     return x & 0xFFFFFF00;
-    return x;
+    *str++ = char(tag >> 24);
+    *str++ = char(tag >> 16);
+    *str++ = char(tag >> 8);
+    *str++ = char(tag);
+    *str = '\0';
 }
 
 gr_feature_val* gr_face_featureval_for_lang(const gr_face* pFace, gr_uint32 langname/*0 means clone default*/) //clones the features. if none for language, clones the default
@@ -246,7 +239,7 @@
         return pRes;
       }
     }
-    
+
     //error when loading
 
     delete pFileFace;
@@ -253,30 +246,11 @@
     return NULL;
 }
 
-#ifndef GRAPHITE2_NSEGCACHE
-gr_face* gr_make_file_face_with_seg_cache(const char* filename, unsigned int segCacheMaxSize, unsigned int faceOptions)   //returns NULL on failure. //TBD better error handling
+gr_face* gr_make_file_face_with_seg_cache(const char* filename, unsigned int, unsigned int faceOptions)   //returns NULL on failure. //TBD better error handling
                   //when finished with, call destroy_face
 {
-    FileFace* pFileFace = new FileFace(filename);
-    if (*pFileFace)
-    {
-      gr_face * pRes = gr_make_face_with_seg_cache_and_ops(pFileFace, &FileFace::ops, segCacheMaxSize, faceOptions);
-      if (pRes)
-      {
-        pRes->takeFileFace(pFileFace);        //takes ownership
-        return pRes;
-      }
-    }
-
-    //error when loading
-
-    delete pFileFace;
-    return NULL;
+    return gr_make_file_face(filename, faceOptions);
 }
-#endif
 #endif      //!GRAPHITE2_NFILEFACE
 
-
 } // extern "C"
-
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/gr_features.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/gr_features.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/gr_features.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -46,7 +46,7 @@
 int gr_fref_set_feature_value(const gr_feature_ref* pfeatureref, gr_uint16 val, gr_feature_val* pDest)
 {
     if (!pfeatureref || !pDest) return 0;
-    
+
     return pfeatureref->applyValToFeature(val, *pDest);
 }
 
@@ -55,7 +55,7 @@
 {
   if (!pfeatureref)
     return 0;
-  
+
   return pfeatureref->getId();
 }
 
@@ -125,10 +125,10 @@
 }
 
 gr_feature_val* gr_featureval_clone(const gr_feature_val* pfeatures/*may be NULL*/)
-{                      //When finished with the Features, call features_destroy    
+{                      //When finished with the Features, call features_destroy
     return static_cast<gr_feature_val*>(pfeatures ? new Features(*pfeatures) : new Features);
 }
-  
+
 void gr_featureval_destroy(gr_feature_val *p)
 {
     delete static_cast<Features*>(p);

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/gr_font.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/gr_font.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/gr_font.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -46,7 +46,7 @@
 
 
 gr_font* gr_make_font_with_ops(float ppm/*pixels per em*/, const void* appFontHandle/*non-NULL*/, const gr_font_ops * font_ops, const gr_face * face/*needed for scaling*/)
-{                 //the appFontHandle must stay alive all the time when the gr_font is alive. When finished with the gr_font, call destroy_gr_font    
+{                 //the appFontHandle must stay alive all the time when the gr_font is alive. When finished with the gr_font, call destroy_gr_font
     if (face == 0 || ppm <= 0)  return 0;
 
     Font * const res = new Font(ppm, *face, appFontHandle, font_ops);
@@ -72,7 +72,3 @@
 
 
 } // extern "C"
-
-
-
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/gr_logging.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/gr_logging.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/gr_logging.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -225,7 +225,7 @@
     }
     if (cslot)
     {
-		// Note: the reason for using Positions to lump together related attributes is to make the 
+		// Note: the reason for using Positions to lump together related attributes is to make the
 		// JSON output slightly more compact.
         j << "collision" << json::flat << json::object
 //              << "shift" << cslot->shift() -- not used pass level, only within the collision routine itself
@@ -252,7 +252,7 @@
 graphite2::objectid::objectid(const dslot & ds) throw()
 {
     const Slot * const p = ds.second;
-    uint32 s = reinterpret_cast<size_t>(p);
+    uint32 s = uint32(reinterpret_cast<size_t>(p));
     sprintf(name, "%.4x-%.2x-%.4hx", uint16(s >> 16), uint16(p ? p->userAttrs()[ds.first->silf()->numUser()] : 0), uint16(s));
     name[sizeof name-1] = 0;
 }
@@ -259,7 +259,7 @@
 
 graphite2::objectid::objectid(const Segment * const p) throw()
 {
-    uint32 s = reinterpret_cast<size_t>(p);
+    uint32 s = uint32(reinterpret_cast<size_t>(p));
     sprintf(name, "%.4x-%.2x-%.4hx", uint16(s >> 16), 0, uint16(s));
     name[sizeof name-1] = 0;
 }

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/gr_segment.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/gr_segment.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/gr_segment.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -30,7 +30,7 @@
 
 using namespace graphite2;
 
-namespace 
+namespace
 {
 
   gr_segment* makeAndInitialize(const Font *font, const Face *face, uint32 script, const Features* pFeats/*must not be NULL*/, gr_encform enc, const void* pStart, size_t nChars, int dir)
@@ -42,7 +42,7 @@
       // if (!font) return NULL;
       Segment* pRes=new Segment(nChars, face, script, dir);
 
-      
+
       if (!pRes->read_text(face, pFeats, enc, pStart, nChars) || !pRes->runGraphite())
       {
         delete pRes;
@@ -53,34 +53,37 @@
       return static_cast<gr_segment*>(pRes);
   }
 
+  template <typename utf_iter>
+  inline size_t count_unicode_chars(utf_iter first, const utf_iter last, const void **error)
+  {
+      size_t n_chars = 0;
+      uint32 usv = 0;
 
+      if (last)
+      {
+          if (!first.validate(last))
+          {
+              if (error)  *error = last - 1;
+              return 0;
+          }
+          for (;first != last; ++first, ++n_chars)
+              if ((usv = *first) == 0 || first.error()) break;
+      }
+      else
+      {
+          while ((usv = *first) != 0 && !first.error())
+          {
+              ++first;
+              ++n_chars;
+          }
+      }
+
+      if (error)  *error = first.error() ? first : 0;
+      return n_chars;
+  }
 }
 
 
-template <typename utf_iter>
-inline size_t count_unicode_chars(utf_iter first, const utf_iter last, const void **error)
-{
-    size_t n_chars = 0;
-    uint32 usv = 0;
-
-    if (last)
-    {
-        for (;first != last; ++first, ++n_chars)
-            if ((usv = *first) == 0 || first.error()) break;
-    }
-    else
-    {
-        while ((usv = *first) != 0 && !first.error())
-        {
-            ++first;
-            ++n_chars;
-        }
-    }
-
-    if (error)  *error = first.error() ? first : 0;
-    return n_chars;
-}
-
 extern "C" {
 
 size_t gr_count_unicode_characters(gr_encform enc, const void* buffer_begin, const void* buffer_end/*don't go on or past end, If NULL then ignored*/, const void** pError)   //Also stops on nul. Any nul is not in the count
@@ -99,6 +102,8 @@
 
 gr_segment* gr_make_seg(const gr_font *font, const gr_face *face, gr_uint32 script, const gr_feature_val* pFeats, gr_encform enc, const void* pStart, size_t nChars, int dir)
 {
+    if (!face) return nullptr;
+
     const gr_feature_val * tmp_feats = 0;
     if (pFeats == 0)
         pFeats = tmp_feats = static_cast<const gr_feature_val*>(face->theSill().cloneFeatures(0));
@@ -132,7 +137,7 @@
 unsigned int gr_seg_n_cinfo(const gr_segment* pSeg/*not NULL*/)
 {
     assert(pSeg);
-    return pSeg->charInfoCount();
+    return static_cast<unsigned int>(pSeg->charInfoCount());
 }
 
 
@@ -145,7 +150,7 @@
 unsigned int gr_seg_n_slots(const gr_segment* pSeg/*not NULL*/)
 {
     assert(pSeg);
-    return pSeg->slotCount();
+    return static_cast<unsigned int>(pSeg->slotCount());
 }
 
 const gr_slot* gr_seg_first_slot(gr_segment* pSeg/*not NULL*/)

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/gr_slot.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/gr_slot.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/gr_slot.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -58,7 +58,7 @@
     return static_cast<const gr_slot*>(p->firstChild());
 }
 
-    
+
 const gr_slot* gr_slot_next_sibling_attachment(const gr_slot* p/*not NULL*/)        //returns NULL iff no more attachments.
 {        //if slot_next_sibling_attachment(p) is not NULL, then slot_attached_to(slot_next_sibling_attachment(p))==slot_attached_to(p).
     assert(p);
@@ -112,7 +112,7 @@
     else
         return res;
 }
-        
+
 int gr_slot_before(const gr_slot* p/*not NULL*/)
 {
     assert(p);
@@ -170,4 +170,3 @@
 
 
 } // extern "C"
-

Deleted: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/CachedFace.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/CachedFace.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/CachedFace.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -1,56 +0,0 @@
-/*  GRAPHITE2 LICENSING
-
-    Copyright 2010, SIL International
-    All rights reserved.
-
-    This library is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published
-    by the Free Software Foundation; either version 2.1 of License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should also have received a copy of the GNU Lesser General Public
-    License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street,
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
-    internet at http://www.fsf.org/licenses/lgpl.html.
-
-Alternatively, the contents of this file may be used under the terms of the
-Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public
-License, as published by the Free Software Foundation, either version 2
-of the License or (at your option) any later version.
-*/
-#pragma once
-
-#ifndef GRAPHITE2_NSEGCACHE
-
-#include "inc/Face.h"
-
-namespace graphite2 {
-
-class SegCacheStore;
-class SegCache;
-
-class CachedFace : public Face
-{
-    CachedFace(const CachedFace &);
-    CachedFace & operator = (const CachedFace &);
-
-public:
-    CachedFace(const void* appFaceHandle/*non-NULL*/, const gr_face_ops & ops);
-    bool setupCache(unsigned int cacheSize);
-    virtual ~CachedFace();
-    virtual bool runGraphite(Segment *seg, const Silf *silf) const;
-    SegCacheStore * cacheStore() { return m_cacheStore; }
-private:
-    SegCacheStore * m_cacheStore;
-};
-
-} // namespace graphite2
-
-#endif
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/CharInfo.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/CharInfo.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/CharInfo.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -64,4 +64,3 @@
 } // namespace graphite2
 
 struct gr_char_info : public graphite2::CharInfo {};
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Code.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Code.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Code.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -24,7 +24,7 @@
 License, as published by the Free Software Foundation, either version 2
 of the License or (at your option) any later version.
 */
-// This class represents loaded graphite stack machine code.  It performs 
+// This class represents loaded graphite stack machine code.  It performs
 // basic sanity checks, on the incoming code to prevent more obvious problems
 // from crashing graphite.
 // Author: Tim Eves
@@ -54,11 +54,11 @@
 class Machine::Code
 {
 public:
-    enum status_t 
+    enum status_t
     {
         loaded,
-        alloc_failed, 
-        invalid_opcode, 
+        alloc_failed,
+        invalid_opcode,
         unimplemented_opcode_used,
         out_of_range_data,
         jump_past_end,
@@ -94,7 +94,7 @@
          enum passtype pt, byte * * const _out = 0);
     Code(const Machine::Code &) throw();
     ~Code() throw();
-    
+
     Code & operator=(const Code &rhs) throw();
     operator bool () const throw()                  { return _code && status() == loaded; }
     status_t      status() const throw()            { return _status; }
@@ -107,7 +107,7 @@
     void          externalProgramMoved(ptrdiff_t) throw();
 
     int32 run(Machine &m, slotref * & map) const;
-    
+
     CLASS_NEW_DELETE;
 };
 
@@ -128,16 +128,16 @@
 }
 
 inline Machine::Code::Code(const Machine::Code &obj) throw ()
- :  _code(obj._code), 
-    _data(obj._data), 
-    _data_size(obj._data_size), 
+ :  _code(obj._code),
+    _data(obj._data),
+    _data_size(obj._data_size),
     _instr_count(obj._instr_count),
     _max_ref(obj._max_ref),
-    _status(obj._status), 
+    _status(obj._status),
     _constraint(obj._constraint),
     _modify(obj._modify),
     _delete(obj._delete),
-    _own(obj._own) 
+    _own(obj._own)
 {
     obj._own = false;
 }
@@ -145,15 +145,15 @@
 inline Machine::Code & Machine::Code::operator=(const Machine::Code &rhs) throw() {
     if (_instr_count > 0)
         release_buffers();
-    _code        = rhs._code; 
+    _code        = rhs._code;
     _data        = rhs._data;
-    _data_size   = rhs._data_size; 
+    _data_size   = rhs._data_size;
     _instr_count = rhs._instr_count;
-    _status      = rhs._status; 
+    _status      = rhs._status;
     _constraint  = rhs._constraint;
     _modify      = rhs._modify;
     _delete      = rhs._delete;
-    _own         = rhs._own; 
+    _own         = rhs._own;
     rhs._own = false;
     return *this;
 }

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Collider.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Collider.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Collider.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -59,7 +59,7 @@
         ////COLL_JUMPABLE = 128,    // moving glyphs may jump this stationary glyph in any direction - DELETE
         ////COLL_OVERLAP = 256,    // use maxoverlap to restrict - DELETE
     };
-    
+
     // Behavior for the collision.order attribute. To GDL this is an enum, to us it's a bitfield, with only 1 bit set
     // Allows for easier inversion.
     enum {
@@ -70,10 +70,10 @@
         SEQ_ORDER_NOLEFT = 16,
         SEQ_ORDER_NORIGHT = 32
     };
-    
+
     SlotCollision(Segment *seg, Slot *slot);
     void initFromSlot(Segment *seg, Slot *slot);
-    
+
     const Rect &limit() const { return _limit; }
     void setLimit(const Rect &r) { _limit = r; }
     SLOTCOLSETPOSITIONPROP(shift, setShift)
@@ -95,7 +95,7 @@
 
     float getKern(int dir) const;
     bool ignore() const;
-    
+
 private:
     Rect        _limit;
     Position    _shift;     // adjustment within the given pass
@@ -114,7 +114,7 @@
     uint16		_seqBelowWt;
     uint16		_seqValignHt;
     uint16		_seqValignWt;
-	
+
 };  // end of class SlotColllision
 
 struct BBox;
@@ -133,7 +133,7 @@
     bool initSlot(Segment *seg, Slot *aSlot, const Rect &constraint,
                 float margin, float marginMin, const Position &currShift,
                 const Position &currOffset, int dir, GR_MAYBE_UNUSED json * const dbgout);
-    bool mergeSlot(Segment *seg, Slot *slot, const SlotCollision *cinfo, const Position &currShift, bool isAfter, 
+    bool mergeSlot(Segment *seg, Slot *slot, const SlotCollision *cinfo, const Position &currShift, bool isAfter,
                 bool sameCluster, bool &hasCol, bool isExclusion, GR_MAYBE_UNUSED json * const dbgout);
     Position resolve(Segment *seg, bool &isCol, GR_MAYBE_UNUSED json * const dbgout);
     void addBox_slope(bool isx, const Rect &box, const BBox &bb, const SlantBox &sb, const Position &org, float weight, float m, bool minright, int mode);
@@ -164,7 +164,7 @@
     uint16  _seqClass;
 	uint16	_seqProxClass;
     uint16  _seqOrder;
-    
+
 	//bool _scraping[4];
 
 };	// end of class ShiftCollider
@@ -212,7 +212,7 @@
     float _xbound;        // max or min edge
     bool  _hit;
 
-#if !defined GRAPHITE2_NTRACING    
+#if !defined GRAPHITE2_NTRACING
     // Debugging
     Segment * _seg;
     Vector<float> _nearEdges; // closest potential collision in each slice
@@ -243,4 +243,3 @@
 };
 
 };  // end of namespace graphite2
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Compression.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Compression.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Compression.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -53,7 +53,7 @@
                     MINSRCSIZE = 13;
 
 template<int S>
-inline 
+inline
 void unaligned_copy(void * d, void const * s) {
   ::memcpy(d, s, S);
 }
@@ -63,7 +63,7 @@
     return (p + sizeof(unsigned long)-1) & ~(sizeof(unsigned long)-1);
 }
 
-inline 
+inline
 u8 * safe_copy(u8 * d, u8 const * s, size_t n) {
     while (n--) *d++ = *s++;
     return d;
@@ -73,7 +73,7 @@
 u8 * overrun_copy(u8 * d, u8 const * s, size_t n) {
     size_t const WS = sizeof(unsigned long);
     u8 const * e = s + n;
-    do 
+    do
     {
         unaligned_copy<WS>(d, s);
         d += WS;
@@ -81,7 +81,7 @@
     }
     while (s < e);
     d-=(s-e);
-    
+
     return d;
 }
 
@@ -90,7 +90,7 @@
 u8 * fast_copy(u8 * d, u8 const * s, size_t n) {
     size_t const WS = sizeof(unsigned long);
     size_t wn = n/WS;
-    while (wn--) 
+    while (wn--)
     {
         unaligned_copy<WS>(d, s);
         d += WS;
@@ -102,5 +102,3 @@
 
 
 } // end of anonymous namespace
-
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Decompressor.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Decompressor.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Decompressor.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -52,5 +52,3 @@
 int decompress(void const *in, size_t in_size, void *out, size_t out_size);
 
 } // end of namespace shrinker
-
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Endian.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Endian.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Endian.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -57,11 +57,11 @@
 
     template<typename T>
     inline static T read(const unsigned char * &p) {
-        const T r = T(_peek<sizeof(T)>(p)); 
+        const T r = T(_peek<sizeof(T)>(p));
         p += sizeof r;
         return r;
     }
-    
+
     template<typename T>
     inline static T swap(const T x) {
         return T(_peek<sizeof(T)>(reinterpret_cast<const unsigned char *>(&x)));
@@ -77,7 +77,7 @@
 inline unsigned long int be::_peek<1>(const unsigned char * p) { return *p; }
 
 
-class le 
+class le
 {
     template<int S>
     inline static unsigned long int _peek(const unsigned char * p) {
@@ -91,11 +91,11 @@
 
     template<typename T>
     inline static T read(const unsigned char * &p) {
-        const T r = T(_peek<sizeof(T)>(p)); 
+        const T r = T(_peek<sizeof(T)>(p));
         p += sizeof r;
         return r;
     }
-    
+
     template<typename T>
     inline static T swap(const T x) {
         return T(_peek<sizeof(T)>(reinterpret_cast<const unsigned char *>(&x)));
@@ -109,4 +109,3 @@
 
 template<>
 inline unsigned long int le::_peek<1>(const unsigned char * p) { return *p; }
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Error.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Error.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Error.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -132,4 +132,3 @@
 };
 
 }
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Face.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Face.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Face.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -170,23 +170,23 @@
 {
     const Face *            _f;
     mutable const byte *    _p;
-    uint32                  _sz;
+    size_t                  _sz;
     bool                    _compressed;
 
     Error decompress();
 
-    void releaseBuffers();
+    void release();
 
 public:
     Table() throw();
     Table(const Face & face, const Tag n, uint32 version=0xffffffff) throw();
-    Table(const Table & rhs) throw();
     ~Table() throw();
+    Table(const Table && rhs) throw();
 
     operator const byte * () const throw();
 
-    Table & operator = (const Table & rhs) throw();
     size_t  size() const throw();
+    Table & operator = (const Table && rhs) throw();
 };
 
 inline
@@ -196,7 +196,7 @@
 }
 
 inline
-Face::Table::Table(const Table & rhs) throw()
+Face::Table::Table(const Table && rhs) throw()
 : _f(rhs._f), _p(rhs._p), _sz(rhs._sz), _compressed(rhs._compressed)
 {
     rhs._p = 0;
@@ -205,7 +205,7 @@
 inline
 Face::Table::~Table() throw()
 {
-    releaseBuffers();
+    release();
 }
 
 inline

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureMap.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureMap.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureMap.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -41,7 +41,7 @@
     FeatureSetting(int16 theValue, uint16 labelId) : m_label(labelId), m_value(theValue) {};
     uint16 label() const { return m_label; }
     int16 value() const { return m_value; }
-    
+
     CLASS_NEW_DELETE;
 private:
     FeatureSetting(const FeatureSetting & fs) : m_label(fs.m_label), m_value(fs.m_value) {};
@@ -56,6 +56,7 @@
     static const uint8  SIZEOF_CHUNK = sizeof(chunk_t)*8;
 
 public:
+    FeatureRef() throw();
     FeatureRef(const Face & face, unsigned short & bits_offset, uint32 max_val,
                uint32 name, uint16 uiName, uint16 flags,
                FeatureSetting *settings, uint16 num_set) throw();
@@ -64,7 +65,7 @@
     bool applyValToFeature(uint32 val, Features& pDest) const; //defined in GrFaceImp.h
     void maskFeature(Features & pDest) const {
     if (m_index < pDest.size())                 //defensive
-        pDest[m_index] |= m_mask; 
+        pDest[m_index] |= m_mask;
     }
 
     uint32 getFeatureVal(const Features& feats) const; //defined in GrFaceImp.h
@@ -75,7 +76,7 @@
     uint16 getSettingName(uint16 index) const { return m_nameValues[index].label(); }
     int16  getSettingValue(uint16 index) const { return m_nameValues[index].value(); }
     uint32 maxVal() const { return m_max; }
-    const Face & getFace() const { return m_face;}
+    const Face & getFace() const { assert(m_face); return *m_face;}
     const FeatureMap* getFeatureMap() const;// { return m_pFace;}
 
     CLASS_NEW_DELETE;
@@ -82,7 +83,7 @@
 private:
     FeatureRef(const FeatureRef & rhs);
 
-    const Face     & m_face;
+    const Face     * m_face;
     FeatureSetting * m_nameValues; // array of name table ids for feature values
     chunk_t m_mask,             // bit mask to get the value from the vector
             m_max;              // max value the value can take
@@ -97,6 +98,16 @@
     FeatureRef& operator=(const FeatureRef&);
 };
 
+inline
+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_bits(0), m_index(0)
+{
+}
 
 
 class NameAndFeatureRef
@@ -118,7 +129,7 @@
 {
 public:
     FeatureMap() : m_numFeats(0), m_feats(NULL), m_pNamedFeats(NULL) {}
-    ~FeatureMap() { free(m_feats); delete[] m_pNamedFeats; }
+    ~FeatureMap() { delete[] m_feats; delete[] m_pNamedFeats; }
 
     bool readFeats(const Face & face);
     const FeatureRef *findFeatureRef(uint32 name) const;
@@ -135,7 +146,7 @@
     FeatureRef *m_feats;
     NameAndFeatureRef* m_pNamedFeats;   //owned
     FeatureVal m_defaultFeatures;        //owned
-    
+
 private:        //defensive on m_feats, m_pNamedFeats, and m_defaultFeatures
     FeatureMap(const FeatureMap&);
     FeatureMap& operator=(const FeatureMap&);
@@ -153,7 +164,7 @@
     public:
         LangFeaturePair() :  m_lang(0), m_pFeatures(0) {}
         ~LangFeaturePair() { delete m_pFeatures; }
-        
+
         uint32 m_lang;
         Features* m_pFeatures;      //owns
         CLASS_NEW_DELETE

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureVal.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureVal.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/FeatureVal.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -48,9 +48,9 @@
     {
         size_t n = size();
         if (n != b.size())      return false;
-        
+
         for(const_iterator l = begin(), r = b.begin(); n && *l == *r; --n, ++l, ++r);
-        
+
         return n == 0;
     }
 

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/FileFace.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/FileFace.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/FileFace.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Font.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Font.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Font.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/GlyphCache.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/GlyphCache.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/GlyphCache.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -71,7 +71,7 @@
     GlyphBox & operator = (const GlyphBox &);
 
 public:
-    GlyphBox(uint8 numsubs, unsigned short bitmap, Rect *slanted) : _num(numsubs), _bitmap(bitmap), _slant(*slanted) {}; 
+    GlyphBox(uint8 numsubs, unsigned short bitmap, Rect *slanted) : _num(numsubs), _bitmap(bitmap), _slant(*slanted) {};
 
     void addSubBox(int subindex, int boundary, Rect *val) { _subs[subindex * 2 + boundary] = *val; }
     Rect &subVal(int subindex, int boundary) { return _subs[subindex * 2 + boundary]; }
@@ -115,7 +115,7 @@
     bool             hasBoxes() const { return _boxes != 0; }
 
     CLASS_NEW_DELETE;
-    
+
 private:
     const Rect            _empty_slant_box;
     const Loader        * _glyph_loader;

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/GlyphFace.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/GlyphFace.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/GlyphFace.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Intervals.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Intervals.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Intervals.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -216,7 +216,7 @@
         float m, float xi, GR_MAYBE_UNUSED float ai, float c, GR_MAYBE_UNUSED bool nega) {
     return Exclusion(xmin, xmax,
             m + f,
-            m * xi, 
+            m * xi,
             m * xi * xi + f * a0 * a0 + c);
 }
 
@@ -225,9 +225,9 @@
 Zones::Exclusion Zones::Exclusion::weighted<SD>(float xmin, float xmax, float f, float a0,
         float m, float xi, float ai,float c, bool nega) {
     float xia = nega ? xi - ai : xi + ai;
-    return Exclusion(xmin, xmax, 
-            0.25f * (m + 2.f * f), 
-            0.25f * m * xia, 
+    return Exclusion(xmin, xmax,
+            0.25f * (m + 2.f * f),
+            0.25f * m * xia,
             0.25f * (m * xia * xia + 2.f * f * a0 * a0) + c);
 }
 

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/List.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/List.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/List.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -38,12 +38,12 @@
 
 namespace graphite2 {
 
-template <typename T> 
+template <typename T>
 inline
 ptrdiff_t distance(T* first, T* last) { return last-first; }
 
 
-template <typename T> 
+template <typename T>
 class Vector
 {
     T * m_first, *m_last, *m_end;
@@ -56,32 +56,32 @@
     Vector() : m_first(0), m_last(0), m_end(0) {}
     Vector(size_t n, const T& value = T())      : m_first(0), m_last(0), m_end(0) { insert(begin(), n, value); }
     Vector(const Vector<T> &rhs)                : m_first(0), m_last(0), m_end(0) { insert(begin(), rhs.begin(), rhs.end()); }
-    template <typename I> 
+    template <typename I>
     Vector(I first, const I last)               : m_first(0), m_last(0), m_end(0) { insert(begin(), first, last); }
     ~Vector() { clear(); free(m_first); }
-    
+
     iterator            begin()         { return m_first; }
     const_iterator      begin() const   { return m_first; }
 
     iterator            end()           { return m_last; }
     const_iterator      end() const     { return m_last; }
-    
+
     bool                empty() const   { return m_first == m_last; }
     size_t              size() const    { return m_last - m_first; }
     size_t              capacity() const{ return m_end - m_first; }
-    
+
     void                reserve(size_t n);
     void                resize(size_t n, const T & v = T());
-    
+
     reference           front()         { assert(size() > 0); return *begin(); }
     const_reference     front() const   { assert(size() > 0); return *begin(); }
     reference           back()          { assert(size() > 0); return *(end()-1); }
     const_reference     back() const    { assert(size() > 0); return *(end()-1); }
-    
+
     Vector<T>         & operator = (const Vector<T> & rhs) { assign(rhs.begin(), rhs.end()); return *this; }
     reference           operator [] (size_t n)          { assert(size() > n); return m_first[n]; }
     const_reference     operator [] (size_t n) const    { assert(size() > n); return m_first[n]; }
-    
+
     void                assign(size_t n, const T& u)    { clear(); insert(begin(), n, u); }
     void                assign(const_iterator first, const_iterator last)      { clear(); insert(begin(), first, last); }
     iterator            insert(iterator p, const T & x) { p = _insert_default(p, 1); new (p) T(x); return p; }
@@ -97,12 +97,12 @@
 private:
     iterator            _insert_default(iterator p, size_t n);
 };
-    
+
 template <typename T>
-inline 
+inline
 void Vector<T>::reserve(size_t n)
 {
-    if (n > capacity()) 
+    if (n > capacity())
     {
         const ptrdiff_t sz = size();
         size_t requested;
@@ -122,8 +122,8 @@
     else if (d > 0) insert(end(), d, v);
 }
 
-template<typename T> 
-inline 
+template<typename T>
+inline
 typename Vector<T>::iterator Vector<T>::_insert_default(iterator p, size_t n)
 {
     assert(begin() <= p && p <= end());
@@ -136,8 +136,8 @@
     return p;
 }
 
-template<typename T> 
-inline 
+template<typename T>
+inline
 void Vector<T>::insert(iterator p, size_t n, const T & x)
 {
     p = _insert_default(p, n);
@@ -146,7 +146,7 @@
 }
 
 template<typename T>
-inline 
+inline
 void Vector<T>::insert(iterator p, const_iterator first, const_iterator last)
 {
     p = _insert_default(p, distance(first, last));

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Main.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Main.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Main.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -86,7 +86,7 @@
   #define HAVE_BUILTIN_OVERFLOW
 #endif
 #if defined(__has_include)
-  #if __has_include(<intsafe.h>)
+  #if __has_include(<intsafe.h>) && !defined(__CYGWIN__)
     #define HAVE_INTSAFE_H
   #endif
 #elif defined(_WIN32)
@@ -172,9 +172,14 @@
 #define GR_MAYBE_UNUSED
 #endif
 
-#if defined(__clang__) && __cplusplus >= 201103L
-   /* clang's fallthrough annotations are only available starting in C++11. */
-    #define GR_FALLTHROUGH [[fallthrough]]
+#ifndef __has_cpp_attribute
+#  define __has_cpp_attribute(x) 0
+#endif
+
+#if __has_cpp_attribute(clang::fallthrough)
+#  define GR_FALLTHROUGH [[clang::fallthrough]]
+#elif __has_cpp_attribute(gnu::fallthrough)
+#  define GR_FALLTHROUGH [[gnu::fallthrough]]
 #elif defined(_MSC_VER)
    /*
     * MSVC's __fallthrough annotations are checked by /analyze (Code Analysis):

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Pass.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Pass.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Pass.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -46,11 +46,11 @@
 enum passtype;
 
 class Pass
-{   
+{
 public:
     Pass();
     ~Pass();
-    
+
     bool readPass(const byte * pPass, size_t pass_length, size_t subtable_base, Face & face,
         enum passtype pt, uint32 version, Error &e);
     bool runGraphite(vm::Machine & m, FiniteStateMachine & fsm, bool reverse) const;
@@ -66,7 +66,7 @@
     bool    testConstraint(const Rule & r, vm::Machine &) const;
     bool    readRules(const byte * rule_map, const size_t num_entries,
                      const byte *precontext, const uint16 * sort_key,
-                     const uint16 * o_constraint, const byte *constraint_data, 
+                     const uint16 * o_constraint, const byte *constraint_data,
                      const uint16 * o_action, const byte * action_data,
                      Face &, enum passtype pt, Error &e);
     bool    readStates(const byte * starts, const byte * states, const byte * o_rule_map, Face &, Error &e);
@@ -109,7 +109,7 @@
     byte m_colThreshold;
     bool m_isReverseDir;
     vm::Machine::Code m_cPConstraint;
-    
+
 private:        //defensive
     Pass(const Pass&);
     Pass& operator=(const Pass&);

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Position.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Position.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Position.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Rule.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Rule.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Rule.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -33,7 +33,7 @@
 namespace graphite2 {
 
 struct Rule {
-  const vm::Machine::Code * constraint, 
+  const vm::Machine::Code * constraint,
                  * action;
   unsigned short   sort;
   byte             preContext;
@@ -87,7 +87,7 @@
 {
   const RuleEntry     * rules,
                       * rules_end;
-  
+
   bool   empty() const;
 };
 
@@ -102,14 +102,14 @@
 {
 public:
   enum {MAX_SLOTS=64};
-  SlotMap(Segment & seg, uint8 direction, int maxSize);
-  
+  SlotMap(Segment & seg, uint8 direction, size_t maxSize);
+
   Slot       * * begin();
   Slot       * * end();
   size_t         size() const;
   unsigned short context() const;
   void           reset(Slot &, unsigned short);
-  
+
   Slot * const & operator[](int n) const;
   Slot       * & operator [] (int);
   void           pushSlot(Slot * const slot);
@@ -149,11 +149,11 @@
       const RuleEntry * begin() const;
       const RuleEntry * end() const;
       size_t            size() const;
-      
+
       void accumulate_rules(const State &state);
 
   private:
-      RuleEntry * m_begin, 
+      RuleEntry * m_begin,
                 * m_end,
                   m_rules[MAX_RULES*2];
   };
@@ -219,13 +219,13 @@
 {
   // Only bother if there are rules in the State object.
   if (state.empty()) return;
-  
+
   // Merge the new sorted rules list into the current sorted result set.
   const RuleEntry * lre = begin(), * rre = state.rules;
-  RuleEntry * out = m_rules + (m_begin == m_rules)*MAX_RULES;    
+  RuleEntry * out = m_rules + (m_begin == m_rules)*MAX_RULES;
   const RuleEntry * const lrend = out + MAX_RULES,
                   * const rrend = state.rules_end;
-  m_begin = out; 
+  m_begin = out;
   while (lre != end() && out != lrend)
   {
     if (*lre < *rre)      *out++ = *lre++;
@@ -233,7 +233,7 @@
     else                { *out++ = *lre++; ++rre; }
 
     if (rre == rrend)
-    { 
+    {
       while (lre != end() && out != lrend) { *out++ = *lre++; }
       m_end = out;
       return;
@@ -244,9 +244,9 @@
 }
 
 inline
-SlotMap::SlotMap(Segment & seg, uint8 direction, int maxSize)
+SlotMap::SlotMap(Segment & seg, uint8 direction, size_t maxSize)
 : segment(seg), m_size(0), m_precontext(0), m_highwater(0),
-    m_maxSize(maxSize), m_dir(direction), m_highpassed(false)
+    m_maxSize(int(maxSize)), m_dir(direction), m_highpassed(false)
 {
     m_slot_map[0] = 0;
 }

Deleted: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/SegCache.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/SegCache.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/SegCache.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -1,316 +0,0 @@
-/*  GRAPHITE2 LICENSING
-
-    Copyright 2010, SIL International
-    All rights reserved.
-
-    This library is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published
-    by the Free Software Foundation; either version 2.1 of License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should also have received a copy of the GNU Lesser General Public
-    License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street,
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
-    internet at http://www.fsf.org/licenses/lgpl.html.
-
-Alternatively, the contents of this file may be used under the terms of the
-Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public
-License, as published by the Free Software Foundation, either version 2
-of the License or (at your option) any later version.
-*/
-#pragma once
-
-#ifndef GRAPHITE2_NSEGCACHE
-
-#include <graphite2/Segment.h>
-#include "inc/Main.h"
-#include "inc/Slot.h"
-#include "inc/FeatureVal.h"
-#include "inc/SegCacheEntry.h"
-#include "inc/Segment.h"
-
-namespace graphite2 {
-
-class SegCache;
-class SegCacheEntry;
-class SegCacheStore;
-
-/**
- * SegPrefixEntry stores lists of word/syllable segments
- * with one list for each word length. The prefix size should be chosen so that
- * these list sizes stay small since they will be searched iteratively.
- */
-class SegCachePrefixEntry
-{
-    SegCachePrefixEntry(const SegCachePrefixEntry &);
-    SegCachePrefixEntry & operator = (const SegCachePrefixEntry &);
-
-public:
-    SegCachePrefixEntry() : m_lastPurge(0)
-    {
-        memset(m_entryCounts, 0, sizeof m_entryCounts);
-        memset(m_entryBSIndex, 0, sizeof m_entryBSIndex);
-        memset(m_entries, 0, sizeof m_entries);
-    }
-
-    ~SegCachePrefixEntry()
-    {
-        for (size_t j = 0; j < eMaxSpliceSize; j++)
-        {
-            if (m_entryCounts[j])
-            {
-                assert(m_entries[j]);
-                for (size_t k = 0; k < m_entryCounts[j]; k++)
-                    m_entries[j][k].clear();
-
-                free(m_entries[j]);
-            }
-        }
-    }
-    const SegCacheEntry * find(const uint16 * cmapGlyphs, size_t length) const
-    {
-        if (length <= ePrefixLength)
-        {
-            assert(m_entryCounts[length-1] <= 1);
-            if (m_entries[length-1])
-                return m_entries[length-1];
-            return NULL;
-        }
-        SegCacheEntry * entry = NULL;
-        findPosition(cmapGlyphs, length, &entry);
-        return entry;
-    }
-    SegCacheEntry * cache(const uint16* cmapGlyphs, size_t length, Segment * seg, size_t charOffset, unsigned long long totalAccessCount)
-    {
-        size_t listSize = m_entryBSIndex[length-1]? (m_entryBSIndex[length-1] << 1) - 1 : 0;
-        SegCacheEntry * newEntries = NULL;
-        if (m_entryCounts[length-1] + 1u > listSize)
-        {
-            if (m_entryCounts[length-1] == 0)
-                listSize = 1;
-            else
-            {
-                // the problem comes when you get incremental numeric ids in a large doc
-                if (listSize >= eMaxSuffixCount)
-                    return NULL;
-                listSize = (m_entryBSIndex[length-1] << 2) - 1;
-            }
-            newEntries = gralloc<SegCacheEntry>(listSize);
-            if (!newEntries)
-                return NULL;
-        }        
-
-        uint16 insertPos = 0;
-        if (m_entryCounts[length-1] > 0)
-        {
-            insertPos = findPosition(cmapGlyphs, length, NULL);
-            if (!newEntries)
-            {
-                // same buffer, shift entries up
-                memmove(m_entries[length-1] + insertPos + 1, m_entries[length-1] + insertPos,
-                    sizeof(SegCacheEntry) * (m_entryCounts[length-1] - insertPos));
-            }
-            else
-            {
-                memcpy(newEntries, m_entries[length-1], sizeof(SegCacheEntry) * (insertPos));
-                memcpy(newEntries + insertPos + 1, m_entries[length-1] + insertPos,
-                   sizeof(SegCacheEntry) * (m_entryCounts[length-1] - insertPos));
-                
-                free(m_entries[length-1]);
-                m_entries[length-1] = newEntries;
-                assert (m_entryBSIndex[length-1]);
-                m_entryBSIndex[length-1] <<= 1;
-            }
-        } 
-        else
-        {
-            m_entryBSIndex[length-1] = 1;
-            m_entries[length-1] = newEntries;
-        }
-        m_entryCounts[length-1] += 1;
-        new (m_entries[length-1] + insertPos)
-            SegCacheEntry(cmapGlyphs, length, seg, charOffset, totalAccessCount);
-        return m_entries[length-1]  + insertPos;
-    }
-    uint32 purge(unsigned long long minAccessCount, unsigned long long oldAccessTime,
-        unsigned long long currentTime);
-    CLASS_NEW_DELETE
-private:
-    uint16 findPosition(const uint16 * cmapGlyphs, uint16 length, SegCacheEntry ** entry) const
-    {
-        int dir = 0;
-        if (m_entryCounts[length-1] == 0)
-        {
-            if (entry) *entry = NULL;
-            return 0;
-        }
-        else if (m_entryCounts[length-1] == 1)
-        {
-            // optimize single entry case
-            for (int i = ePrefixLength; i < length; i++)
-            {
-                if (cmapGlyphs[i] > m_entries[length-1][0].m_unicode[i])
-                {
-                    return 1;
-                }
-                else if (cmapGlyphs[i] < m_entries[length-1][0].m_unicode[i])
-                {
-                    return 0;
-                }
-            }
-            if (entry)
-                *entry = m_entries[length-1];
-            return 0;
-        }
-        uint16 searchIndex = m_entryBSIndex[length-1] - 1;
-        uint16 stepSize = m_entryBSIndex[length-1] >> 1;
-        size_t prevIndex = searchIndex;
-        do
-        {
-            dir = 0;
-            if (searchIndex >= m_entryCounts[length-1])
-            {
-                dir = -1;
-                searchIndex -= stepSize;
-                stepSize >>= 1;
-            }
-            else
-            {
-                for (int i = ePrefixLength; i < length; i++)
-                {
-                    if (cmapGlyphs[i] > m_entries[length-1][searchIndex].m_unicode[i])
-                    {
-                        dir = 1;
-                        searchIndex += stepSize;
-                        stepSize >>= 1;
-                        break;
-                    }
-                    else if (cmapGlyphs[i] < m_entries[length-1][searchIndex].m_unicode[i])
-                    {
-                        dir = -1;
-                        searchIndex -= stepSize;
-                        stepSize >>= 1;
-                        break;
-                    }
-                }
-            }
-            if (prevIndex == searchIndex)
-                break;
-            prevIndex = searchIndex;
-        } while (dir != 0);
-        if (entry)
-        {
-            if (dir == 0)
-                *entry = m_entries[length-1] + searchIndex;
-            else
-                *entry = NULL;
-        }
-        else
-        {
-            // if entry is null, then this is for inserting a new value, which
-            // shouldn't already be in the cache
-            assert(dir != 0);
-            if (dir > 0)
-                ++searchIndex;
-        }
-        return searchIndex;
-    }
-    /** m_entries is a null terminated list of entries */
-    uint16 m_entryCounts[eMaxSpliceSize];
-    uint16 m_entryBSIndex[eMaxSpliceSize];
-    SegCacheEntry * m_entries[eMaxSpliceSize];
-    unsigned long long m_lastPurge;
-};
-
-
-#define SEG_CACHE_MIN_INDEX (store->maxCmapGid())
-#define SEG_CACHE_MAX_INDEX (store->maxCmapGid()+1u)
-#define SEG_CACHE_UNSET_INDEX (store->maxCmapGid()+2u)
-
-union SegCachePrefixArray
-{
-    void ** raw;
-    SegCachePrefixArray * array;
-    SegCachePrefixEntry ** prefixEntries;
-    uintptr * range;
-};
-
-class SegCache
-{
-public:
-    SegCache(const SegCacheStore * store, const Features& features);
-    ~SegCache();
-
-    const SegCacheEntry * find(const uint16 * cmapGlyphs, size_t length) const;
-    SegCacheEntry * cache(SegCacheStore * store, const uint16 * cmapGlyphs, size_t length, Segment * seg, size_t charOffset);
-    void purge(SegCacheStore * store);
-
-    long long totalAccessCount() const { return m_totalAccessCount; }
-    size_t segmentCount() const { return m_segmentCount; }
-    const Features & features() const { return m_features; }
-    void clear(SegCacheStore * store);
-
-    CLASS_NEW_DELETE
-private:
-    void freeLevel(SegCacheStore * store, SegCachePrefixArray prefixes, size_t level);
-    void purgeLevel(SegCacheStore * store, SegCachePrefixArray prefixes, size_t level,
-                    unsigned long long minAccessCount, unsigned long long oldAccessTime);
-
-    uint16 m_prefixLength;
-//    uint16 m_maxCachedSegLength;
-    size_t m_segmentCount;
-    SegCachePrefixArray m_prefixes;
-    Features m_features;
-    mutable unsigned long long m_totalAccessCount;
-    mutable unsigned long long m_totalMisses;
-    float m_purgeFactor;
-};
-
-inline const SegCacheEntry * SegCache::find(const uint16 * cmapGlyphs, size_t length) const
-{
-    uint16 pos = 0;
-    if (!length || length > eMaxSpliceSize) return NULL;
-    SegCachePrefixArray pEntry = m_prefixes.array[cmapGlyphs[0]];
-    while (++pos < m_prefixLength - 1)
-    {
-        if (!pEntry.raw)
-        {
-            ++m_totalMisses;
-            return NULL;
-        }
-        pEntry = pEntry.array[(pos < length)? cmapGlyphs[pos] : 0];
-    }
-    if (!pEntry.raw)
-    {
-        ++m_totalMisses;
-        return NULL;
-    }
-    SegCachePrefixEntry * prefixEntry = pEntry.prefixEntries[(pos < length)? cmapGlyphs[pos] : 0];
-    if (!prefixEntry)
-    {
-        ++m_totalMisses;
-        return NULL;
-    }
-    const SegCacheEntry * entry = prefixEntry->find(cmapGlyphs, length);
-    if (entry)
-    {
-        ++m_totalAccessCount;
-        entry->accessed(m_totalAccessCount);
-    }
-    else
-    {
-        ++m_totalMisses;
-    }   
-    return entry;
-}
-    
-} // namespace graphite2
-
-#endif
-

Deleted: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/SegCacheEntry.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/SegCacheEntry.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/SegCacheEntry.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -1,121 +0,0 @@
-/*  GRAPHITE2 LICENSING
-
-    Copyright 2010, SIL International
-    All rights reserved.
-
-    This library is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published
-    by the Free Software Foundation; either version 2.1 of License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should also have received a copy of the GNU Lesser General Public
-    License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street,
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
-    internet at http://www.fsf.org/licenses/lgpl.html.
-
-Alternatively, the contents of this file may be used under the terms of the
-Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public
-License, as published by the Free Software Foundation, either version 2
-of the License or (at your option) any later version.
-*/
-#pragma once
-
-#ifndef GRAPHITE2_NSEGCACHE
-
-#include "inc/Main.h"
-#include "inc/Slot.h"
-
-namespace graphite2 {
-
-class Segment;
-class Slot;
-class SegCacheEntry;
-class SegCachePrefixEntry;
-
-enum SegCacheParameters {
-    /** number of characters used in initial prefix tree */
-    ePrefixLength = 2,
-    /** Segments more recent than maxSegmentCount() / eAgeFactor are kept */
-    eAgeFactor = 4,
-    /** Segments are purged according to the formular:
-     * accessCount < (totalAccesses)/(ePurgeFactor * maxSegments) */
-    ePurgeFactor = 5,
-    /** Maximum number of Segments to store which have the same
-     * prefix. Needed to prevent unique identifiers flooding the cache */
-    eMaxSuffixCount = 15
-
-};
-
-class SegCacheCharInfo
-{
-public:
-    uint16 m_unicode;
-    uint16 m_before;
-    uint16 m_after;
-};
-
-/**
- * SegCacheEntry stores the result of running the engine for specific unicode
- * code points in the typical mid-line situation.
- */
-class SegCacheEntry
-{
-    // Prevent any implict copying;
-    SegCacheEntry(const SegCacheEntry &);
-    SegCacheEntry & operator = (const SegCacheEntry &);
-
-    friend class SegCachePrefixEntry;
-public:
-    SegCacheEntry() :
-        m_glyphLength(0), m_unicode(NULL), m_glyph(NULL), m_attr(NULL), m_justs(0),
-        m_accessCount(0), m_lastAccess(0)
-    {}
-    SegCacheEntry(const uint16 * cmapGlyphs, size_t length, Segment * seg, size_t charOffset, long long cacheTime);
-    ~SegCacheEntry() { clear(); };
-    void clear();
-    size_t glyphLength() const { return m_glyphLength; }
-    const Slot * first() const { return m_glyph; }
-    const Slot * last() const { return m_glyph + (m_glyphLength - 1); }
-
-    /** Total number of times this entry has been accessed since creation */
-    unsigned long long accessCount() const { return m_accessCount; }
-    /** "time" of last access where "time" is measured in accesses to the cache owning this entry */
-    void accessed(unsigned long long cacheTime) const
-    {
-        m_lastAccess = cacheTime; ++m_accessCount;
-    };
-
-    int compareRank(const SegCacheEntry & entry) const
-    {
-        if (m_accessCount > entry.m_accessCount) return 1;
-        else if (m_accessCount < entry.m_accessCount) return 1;
-        else if (m_lastAccess > entry.m_lastAccess) return 1;
-        else if (m_lastAccess < entry.m_lastAccess) return -1;
-        return 0;
-    }
-    unsigned long long lastAccess() const { return m_lastAccess; };
-
-    CLASS_NEW_DELETE;
-private:
-
-    size_t   m_glyphLength;
-    /** glyph ids resulting from cmap mapping from unicode to glyph before substitution
-     * the length of this array is determined by the position in the SegCachePrefixEntry */
-    uint16 * m_unicode;
-    /** slots after shapping and positioning */
-    Slot   * m_glyph;
-    int16  * m_attr;
-    byte   * m_justs;
-    mutable unsigned long long m_accessCount;
-    mutable unsigned long long m_lastAccess;
-};
-
-} // namespace graphite2
-
-#endif

Deleted: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/SegCacheStore.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/SegCacheStore.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/SegCacheStore.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -1,127 +0,0 @@
-/*  GRAPHITE2 LICENSING
-
-    Copyright 2010, SIL International
-    All rights reserved.
-
-    This library is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published
-    by the Free Software Foundation; either version 2.1 of License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should also have received a copy of the GNU Lesser General Public
-    License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street,
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
-    internet at http://www.fsf.org/licenses/lgpl.html.
-
-Alternatively, the contents of this file may be used under the terms of the
-Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public
-License, as published by the Free Software Foundation, either version 2
-of the License or (at your option) any later version.
-*/
-#pragma once
-
-#ifndef GRAPHITE2_NSEGCACHE
-
-#include "inc/Main.h"
-#include "inc/CmapCache.h"
-#include "inc/SegCache.h"
-
-namespace graphite2 {
-
-class SegCache;
-class Face;
-
-class SilfSegCache
-{
-    SilfSegCache(const SilfSegCache &);
-    SilfSegCache & operator = (const SilfSegCache &);
-
-public:
-    SilfSegCache() : m_caches(NULL), m_cacheCount(0) {};
-    ~SilfSegCache()
-    {
-        assert(m_caches == NULL);
-    }
-    void clear(SegCacheStore * cacheStore)
-    {
-        for (size_t i = 0; i < m_cacheCount; i++)
-        {
-            m_caches[i]->clear(cacheStore);
-            delete m_caches[i];
-        }
-        free(m_caches);
-        m_caches = NULL;
-        m_cacheCount = 0;
-    }
-    SegCache * getOrCreate(SegCacheStore * cacheStore, const Features & features)
-    {
-        for (size_t i = 0; i < m_cacheCount; i++)
-        {
-            if (m_caches[i]->features() == features)
-                return m_caches[i];
-        }
-        SegCache ** newData = gralloc<SegCache*>(m_cacheCount+1);
-        if (newData)
-        {
-            if (m_cacheCount > 0)
-            {
-                memcpy(newData, m_caches, sizeof(SegCache*) * m_cacheCount);
-                free(m_caches);
-            }
-            m_caches = newData;
-            m_caches[m_cacheCount] = new SegCache(cacheStore, features);
-            m_cacheCount++;
-            return m_caches[m_cacheCount - 1];
-        }
-        return NULL;
-    }
-    CLASS_NEW_DELETE
-private:
-    SegCache ** m_caches;
-    size_t m_cacheCount;
-};
-
-class SegCacheStore
-{
-    SegCacheStore(const SegCacheStore &);
-    SegCacheStore & operator = (const SegCacheStore &);
-
-public:
-    SegCacheStore(const Face & face, unsigned int numSilf, size_t maxSegments);
-    ~SegCacheStore()
-    {
-        for (size_t i = 0; i < m_numSilf; i++)
-        {
-            m_caches[i].clear(this);
-        }
-        delete [] m_caches;
-        m_caches = NULL;
-    }
-    SegCache * getOrCreate(unsigned int i, const Features & features)
-    {
-        return m_caches[i].getOrCreate(this, features);
-    }
-    bool isSpaceGlyph(uint16 gid) const { return (gid == m_spaceGid) || (gid == m_zwspGid); }
-    uint16 maxCmapGid() const { return m_maxCmapGid; }
-    uint32 maxSegmentCount() const { return m_maxSegments; };
-
-    CLASS_NEW_DELETE
-private:
-    SilfSegCache * m_caches;
-    uint8 m_numSilf;
-    uint32 m_maxSegments;
-    uint16 m_maxCmapGid;
-    uint16 m_spaceGid;
-    uint16 m_zwspGid;
-};
-
-} // namespace graphite2
-
-#endif
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Segment.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Segment.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Segment.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -49,9 +49,6 @@
 typedef Vector<int16 *>         AttributeRope;
 typedef Vector<SlotJustify *>   JustifyRope;
 
-#ifndef GRAPHITE2_NSEGCACHE
-class SegmentScopeState;
-#endif
 class Font;
 class Segment;
 class Silf;
@@ -91,26 +88,18 @@
         SEG_HASCOLLISIONS = 2
     };
 
-    unsigned int slotCount() const { return m_numGlyphs; }      //one slot per glyph
-    void extendLength(int num) { m_numGlyphs += num; }
+    size_t slotCount() const { return m_numGlyphs; }      //one slot per glyph
+    void extendLength(ptrdiff_t num) { m_numGlyphs += num; }
     Position advance() const { return m_advance; }
     bool runGraphite() { if (m_silf) return m_face->runGraphite(this, m_silf); else return true;};
     void chooseSilf(uint32 script) { m_silf = m_face->chooseSilf(script); }
     const Silf *silf() const { return m_silf; }
-    unsigned int charInfoCount() const { return m_numCharinfo; }
+    size_t charInfoCount() const { return m_numCharinfo; }
     const CharInfo *charinfo(unsigned int index) const { return index < m_numCharinfo ? m_charinfo + index : NULL; }
     CharInfo *charinfo(unsigned int index) { return index < m_numCharinfo ? m_charinfo + index : NULL; }
 
-    Segment(unsigned int numchars, const Face* face, uint32 script, int dir);
+    Segment(size_t numchars, const Face* face, uint32 script, int dir);
     ~Segment();
-#ifndef GRAPHITE2_NSEGCACHE
-    SegmentScopeState setScope(Slot * firstSlot, Slot * lastSlot, size_t subLength);
-    void removeScope(SegmentScopeState & state);
-    void append(const Segment &other);
-    void splice(size_t offset, size_t length, Slot * const startSlot,
-            Slot * endSlot, const Slot * srcSlot,
-            const size_t numGlyphs);
-#endif
     uint8 flags() const { return m_flags; }
     void flags(uint8 f) { m_flags = f; }
     Slot *first() { return m_first; }
@@ -123,14 +112,14 @@
     SlotJustify *newJustify();
     void freeJustify(SlotJustify *aJustify);
     Position positionSlots(const Font *font=0, Slot *first=0, Slot *last=0, bool isRtl = false, bool isFinal = true);
-    void associateChars(int offset, int num);
+    void associateChars(int offset, size_t num);
     void linkClusters(Slot *first, Slot *last);
     uint16 getClassGlyph(uint16 cid, uint16 offset) const { return m_silf->getClassGlyph(cid, offset); }
     uint16 findClassIndex(uint16 cid, uint16 gid) const { return m_silf->findClassIndex(cid, gid); }
-    int addFeatures(const Features& feats) { m_feats.push_back(feats); return m_feats.size() - 1; }
+    int addFeatures(const Features& feats) { m_feats.push_back(feats); return int(m_feats.size()) - 1; }
     uint32 getFeature(int index, uint8 findex) const { const FeatureRef* pFR=m_face->theSill().theFeatureMap().featureRef(findex); if (!pFR) return 0; else return pFR->getFeatureVal(m_feats[index]); }
     void setFeature(int index, uint8 findex, uint32 val) {
-        const FeatureRef* pFR=m_face->theSill().theFeatureMap().featureRef(findex); 
+        const FeatureRef* pFR=m_face->theSill().theFeatureMap().featureRef(findex);
         if (pFR)
         {
             if (val > pFR->maxVal()) val = pFR->maxVal();
@@ -139,8 +128,8 @@
     int8 dir() const { return m_dir; }
     void dir(int8 val) { m_dir = val; }
     bool currdir() const { return ((m_dir >> 6) ^ m_dir) & 1; }
-    unsigned int passBits() const { return m_passBits; }
-    void mergePassBits(const unsigned int val) { m_passBits &= val; }
+    uint8 passBits() const { return m_passBits; }
+    void mergePassBits(const uint8 val) { m_passBits &= val; }
     int16 glyphAttr(uint16 gid, uint16 gattr) const { const GlyphFace * p = m_face->glyphs().glyphSafe(gid); return p ? p->attrs()[gattr] : 0; }
     int32 getGlyphMetric(Slot *iSlot, uint8 metric, uint8 attrLevel, bool rtl) const;
     float glyphAdvance(uint16 gid) const { return m_face->glyphs().glyph(gid)->theAdvance().x; }
@@ -168,7 +157,7 @@
     void finalise(const Font *font, bool reverse=false);
     float justify(Slot *pSlot, const Font *font, float width, enum justFlags flags, Slot *pFirst, Slot *pLast);
     bool initCollisions();
-  
+
 private:
     Position        m_advance;          // whole segment advance
     SlotRope        m_slots;            // Vector of slot buffers
@@ -183,13 +172,13 @@
     const Silf    * m_silf;
     Slot          * m_first;            // first slot in segment
     Slot          * m_last;             // last slot in segment
-    unsigned int    m_bufSize,          // how big a buffer to create when need more slots
+    size_t          m_bufSize,          // how big a buffer to create when need more slots
                     m_numGlyphs,
-                    m_numCharinfo,      // size of the array and number of input characters
-                    m_passBits;         // if bit set then skip pass
+                    m_numCharinfo;      // size of the array and number of input characters
     int             m_defaultOriginal;  // number of whitespace chars in the string
     int8            m_dir;
-    uint8           m_flags;            // General purpose flags
+    uint8           m_flags,            // General purpose flags
+                    m_passBits;         // if bit set then skip pass
 };
 
 inline
@@ -245,4 +234,3 @@
 } // namespace graphite2
 
 struct gr_segment : public graphite2::Segment {};
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Silf.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Silf.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Silf.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -73,7 +73,7 @@
 public:
     Silf() throw();
     ~Silf() throw();
-    
+
     bool readGraphite(const byte * const pSilf, size_t lSilf, Face &face, uint32 version);
     bool runGraphite(Segment *seg, uint8 firstPass=0, uint8 lastPass=0, int dobidi = 0) const;
     uint16 findClassIndex(uint16 cid, uint16 gid) const;
@@ -121,7 +121,7 @@
     uint16      m_aLig, m_numPseudo, m_nClass, m_nLinear,
                 m_gEndLine;
     gr_faceinfo m_silfinfo;
-    
+
     void releaseBuffers() throw();
 };
 

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Slot.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Slot.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Slot.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -37,7 +37,6 @@
 typedef gr_attrCode attrCode;
 
 class GlyphFace;
-class SegCacheEntry;
 class Segment;
 
 struct SlotJustify
@@ -163,7 +162,6 @@
     int16   *m_userAttr;    // pointer to user attributes
     SlotJustify *m_justs;   // pointer to justification parameters
 
-    friend class SegCacheEntry;
     friend class Segment;
 };
 

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Sparse.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Sparse.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/Sparse.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -138,7 +138,7 @@
         if (ci != ci_)
         {
             ci = ci_;
-            ci->offset = vi - m_array.values;
+            ci->offset = key_type(vi - m_array.values);
         }
 
         ci->mask |= 1UL << (SIZEOF_CHUNK - 1 - (v.first % SIZEOF_CHUNK));

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/TtfTypes.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/TtfTypes.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/TtfTypes.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -77,11 +77,11 @@
 //**********************************************************************************************
 //  Table declarations
 //**********************************************************************************************
-namespace Sfnt 
+namespace Sfnt
 {
-#pragma pack(1) // We need this or the structure members aren't alligned 
+#pragma pack(1) // We need this or the structure members aren't aligned
                         // correctly.  Fortunately this form of pragma is supposed
-                        // to be recongnised by VS C++ too (at least according to 
+                        // to be recognised by VS C++ too (at least according to
                         // MSDN).
 
     struct OffsetSubTable
@@ -99,9 +99,9 @@
                 length;
         } table_directory[1];
 
-        enum ScalerType 
-        { 
-            TrueTypeMac = 0x74727565U, 
+        enum ScalerType
+        {
+            TrueTypeMac = 0x74727565U,
             TrueTypeWin = 0x00010000U,
             Type1   = 0x74797031U
         };
@@ -109,7 +109,7 @@
 
 
 
-    
+
     struct CharacterCodeMap
     {
         uint16  version,
@@ -137,7 +137,7 @@
             range_shift,
             end_code[1];
         // There are arrarys after this which need their
-        // start positions calculated since end_code is 
+        // start positions calculated since end_code is
         // seg_count uint16s long.
     };
 
@@ -147,7 +147,7 @@
         uint32  length,
             language,
             num_groups;
-        struct 
+        struct
         {
             uint32  start_char_code,
                 end_char_code,
@@ -176,9 +176,9 @@
         int16   font_direction_hint,
             index_to_loc_format,
             glyph_data_format;
-        enum 
+        enum
         {
-            MagicNumber = 0x5F0F3CF5, 
+            MagicNumber = 0x5F0F3CF5,
             GlypDataFormat = 0
         };
         enum {ShortIndexLocFormat, LongIndexLocFormat};
@@ -197,10 +197,10 @@
             min_mem_type42,
             max_mem_type42,
             min_mem_type1,
-            max_mem_type1;          
-        enum 
+            max_mem_type1;
+        enum
         {
-            Format1  = 0x10000, 
+            Format1  = 0x10000,
             Format2  = 0x20000,
             Format25 = 0x28000,
             Format3  = 0x30000,
@@ -207,27 +207,27 @@
             Format4  = 0x40000
         };
     };
-    
+
     struct PostScriptGlyphName2 : PostScriptGlyphName
     {
         uint16  number_of_glyphs,
             glyph_name_index[1];
     };
-    
+
     struct PostScriptGlyphName25 : PostScriptGlyphName
     {
         uint16  number_of_glyphs;
         int8    offset[1];
     };
-    
+
     struct PostScriptGlyphName3 : PostScriptGlyphName {};
-    
+
     struct PostScriptGlyphName4 : PostScriptGlyphName
     {
         uint16 glyph_to_char_map[1];
     };
-    
-    
+
+
     struct HorizontalHeader
     {
         fixed   version;
@@ -245,7 +245,7 @@
             metric_data_format;
         uint16  num_long_hor_metrics;
     };
-    
+
     struct MaximumProfile
     {
         fixed   version;
@@ -297,23 +297,23 @@
             type_linegap,
             win_ascent,
             win_descent;
-        
-        enum 
+
+        enum
         {
-            Italic    =0x01, 
-            Underscore=0x02, 
-            Negative  =0x04, 
-            Outlined  =0x08, 
-            StrikeOut =0x10, 
+            Italic    =0x01,
+            Underscore=0x02,
+            Negative  =0x04,
+            Outlined  =0x08,
+            StrikeOut =0x10,
             Bold      =0x20
         };
     };
-    
+
     struct Compatibility1 : Compatibility0
     {
         uint32  codepage_range[2];
     };
-    
+
     struct Compatibility2 : Compatibility1
     {
             int16   x_height,
@@ -322,12 +322,12 @@
                 break_char,
                 max_context;
     };
-    
+
     struct Compatibility3 : Compatibility2 {};
-    
+
     typedef Compatibility3  Compatibility;
-    
-    
+
+
     struct NameRecord
     {
         uint16  platform_id,
@@ -337,9 +337,9 @@
             length,
             offset;
         enum    {Unicode, Mactintosh, Reserved, Microsoft};
-        enum    
+        enum
         {
-            Copyright, Family, Subfamily, UniqueSubfamily, 
+            Copyright, Family, Subfamily, UniqueSubfamily,
             Fullname, Version, PostScript
         };
     };
@@ -357,15 +357,15 @@
             string_offset;
         NameRecord name_record[1];
     };
-    
-    
+
+
     struct HorizontalMetric
     {
         uint16  advance_width;
         int16   left_side_bearing;
     };
-    
-    
+
+
     struct Glyph
     {
         int16   number_of_contours;
@@ -374,11 +374,11 @@
             x_max,
             y_max;
     };
-    
+
     struct SimpleGlyph : Glyph
     {
         uint16  end_pts_of_contours[1];
-        enum 
+        enum
         {
             OnCurve = 0x01,
             XShort  = 0x02,
@@ -390,12 +390,12 @@
             YIsPos  = 0x20
         };
     };
-    
+
     struct CompoundGlyph : Glyph
     {
         uint16  flags,
             glyph_index;
-        enum 
+        enum
         {
             Arg1Arg2Words   = 0x01,
             ArgsAreXYValues = 0x02,

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/TtfUtil.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/TtfUtil.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/TtfUtil.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -43,6 +43,8 @@
 namespace TtfUtil
 {
 
+#define OVERFLOW_OFFSET_CHECK(p, o) (o + reinterpret_cast<size_t>(p) < reinterpret_cast<size_t>(p))
+
 typedef long fontTableId32;
 typedef unsigned short gid16;
 
@@ -51,12 +53,12 @@
 // Enumeration used to specify a table in a TTF file
 class Tag
 {
-    unsigned long _v;
+    unsigned int _v;
 public:
     Tag(const char n[5]) throw()            : _v(TTF_TAG(n[0],n[1],n[2],n[3])) {}
-    Tag(const unsigned long tag) throw()    : _v(tag) {}
+    Tag(const unsigned int tag) throw()    : _v(tag) {}
 
-    operator unsigned long () const throw () { return _v; }
+    operator unsigned int () const throw () { return _v; }
 
     enum
     {
@@ -100,12 +102,12 @@
         size_t & lOffset, size_t & lSize);
     bool CheckTable(const Tag TableId, const void * pTable, size_t lTableSize);
 
-    ////////////////////////////////// simple font wide info 
-    size_t  GlyphCount(const void * pMaxp); 
+    ////////////////////////////////// simple font wide info
+    size_t  GlyphCount(const void * pMaxp);
 #ifdef ALL_TTFUTILS
     size_t  MaxCompositeComponentCount(const void * pMaxp);
     size_t  MaxCompositeLevelCount(const void * pMaxp);
-    size_t  LocaGlyphCount(size_t lLocaSize, const void * pHead); // throw (std::domain_error); 
+    size_t  LocaGlyphCount(size_t lLocaSize, const void * pHead); // throw (std::domain_error);
 #endif
     int DesignUnits(const void * pHead);
 #ifdef ALL_TTFUTILS
@@ -120,7 +122,7 @@
     bool Get31EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize);
     bool Get30EngFamilyInfo(const void * pName, size_t & lOffset, size_t & lSize);
     bool Get30EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize);
-    int PostLookup(const void * pPost, size_t lPostSize, const void * pMaxp, 
+    int PostLookup(const void * pPost, size_t lPostSize, const void * pMaxp,
         const char * pPostName);
 #endif
 
@@ -134,8 +136,8 @@
     void SwapWString(void * pWStr, size_t nSize = 0); // throw (std::invalid_argument);
 #endif
 
-    ////////////////////////////////// cmap lookup tools 
-    const void * FindCmapSubtable(const void * pCmap, int nPlatformId = 3, 
+    ////////////////////////////////// cmap lookup tools
+    const void * FindCmapSubtable(const void * pCmap, int nPlatformId = 3,
         int nEncodingId = 1, size_t length = 0);
     bool CheckCmapSubtable4(const void * pCmap31, const void * pCmapEnd /*, unsigned int maxgid*/);
     gid16 CmapSubtable4Lookup(const void * pCmapSubtabel4, unsigned int nUnicodeId, int rangeKey = 0);
@@ -147,31 +149,31 @@
         int * pRangeKey = 0);
 
     ///////////////////////////////// horizontal metric data for a glyph
-    bool HorMetrics(gid16 nGlyphId, const void * pHmtx, size_t lHmtxSize, 
+    bool HorMetrics(gid16 nGlyphId, const void * pHmtx, size_t lHmtxSize,
         const void * pHhea, int & nLsb, unsigned int & nAdvWid);
 
-    ////////////////////////////////// primitives for loca and glyf lookup 
-    size_t LocaLookup(gid16 nGlyphId, const void * pLoca, size_t lLocaSize, 
-        const void * pHead); // throw (std::out_of_range); 
+    ////////////////////////////////// primitives for loca and glyf lookup
+    size_t LocaLookup(gid16 nGlyphId, const void * pLoca, size_t lLocaSize,
+        const void * pHead); // throw (std::out_of_range);
     void * GlyfLookup(const void * pGlyf, size_t lGlyfOffset, size_t lTableLen);
 
     ////////////////////////////////// primitves for simple glyph data
-    bool GlyfBox(const void * pSimpleGlyf, int & xMin, int & yMin, 
+    bool GlyfBox(const void * pSimpleGlyf, int & xMin, int & yMin,
         int & xMax, int & yMax);
 
 #ifdef ALL_TTFUTILS
-    int GlyfContourCount(const void * pSimpleGlyf); 
-    bool GlyfContourEndPoints(const void * pSimpleGlyf, int * prgnContourEndPoint, 
+    int GlyfContourCount(const void * pSimpleGlyf);
+    bool GlyfContourEndPoints(const void * pSimpleGlyf, int * prgnContourEndPoint,
         int cnPointsTotal, size_t & cnPoints);
-    bool GlyfPoints(const void * pSimpleGlyf, int * prgnX, int * prgnY, 
+    bool GlyfPoints(const void * pSimpleGlyf, int * prgnX, int * prgnY,
         char * prgbFlag, int cnPointsTotal, int & cnPoints);
-    
+
     // primitive to find the glyph ids in a composite glyph
-    bool GetComponentGlyphIds(const void * pSimpleGlyf, int * prgnCompId, 
+    bool GetComponentGlyphIds(const void * pSimpleGlyf, int * prgnCompId,
         size_t cnCompIdTotal, size_t & cnCompId);
     // primitive to find the placement data for a component in a composite glyph
     bool GetComponentPlacement(const void * pSimpleGlyf, int nCompId,
-        bool fOffset, int & a, int & b);                        
+        bool fOffset, int & a, int & b);
     // primitive to find the transform data for a component in a composite glyph
     bool GetComponentTransform(const void * pSimpleGlyf, int nCompId,
         float & flt11, float & flt12, float & flt21, float & flt22, bool & fTransOffset);
@@ -178,26 +180,26 @@
 #endif
 
     ////////////////////////////////// operate on composite or simple glyph (auto glyf lookup)
-    void * GlyfLookup(gid16 nGlyphId, const void * pGlyf, const void * pLoca, 
+    void * GlyfLookup(gid16 nGlyphId, const void * pGlyf, const void * pLoca,
         size_t lGlyfSize, size_t lLocaSize, const void * pHead); // primitive used by below methods
 
 #ifdef ALL_TTFUTILS
     // below are primary user methods for handling glyf data
     bool IsSpace(gid16 nGlyphId, const void * pLoca, size_t lLocaSize, const void * pHead);
-    bool IsDeepComposite(gid16 nGlyphId, const void * pGlyf, const void * pLoca, 
+    bool IsDeepComposite(gid16 nGlyphId, const void * pGlyf, const void * pLoca,
         size_t lGlyfSize, size_t lLocaSize, const void * pHead);
 
-    bool GlyfBox(gid16 nGlyphId, const void * pGlyf, const void * pLoca, size_t lGlyfSize, size_t lLocaSize, 
+    bool GlyfBox(gid16 nGlyphId, const void * pGlyf, const void * pLoca, size_t lGlyfSize, size_t lLocaSize,
         const void * pHead, int & xMin, int & yMin, int & xMax, int & yMax);
-    bool GlyfContourCount(gid16 nGlyphId, const void * pGlyf, const void * pLoca, 
+    bool GlyfContourCount(gid16 nGlyphId, const void * pGlyf, const void * pLoca,
         size_t lGlyfSize, size_t lLocaSize, const void *pHead, size_t & cnContours);
-    bool GlyfContourEndPoints(gid16 nGlyphId, const void * pGlyf, const void * pLoca, 
-        size_t lGlyfSize, size_t lLocaSize, const void * pHead, int * prgnContourEndPoint, size_t cnPoints); 
-    bool GlyfPoints(gid16 nGlyphId, const void * pGlyf, const void * pLoca, 
-        size_t lGlyfSize, size_t lLocaSize, const void * pHead, const int * prgnContourEndPoint, size_t cnEndPoints, 
+    bool GlyfContourEndPoints(gid16 nGlyphId, const void * pGlyf, const void * pLoca,
+        size_t lGlyfSize, size_t lLocaSize, const void * pHead, int * prgnContourEndPoint, size_t cnPoints);
+    bool GlyfPoints(gid16 nGlyphId, const void * pGlyf, const void * pLoca,
+        size_t lGlyfSize, size_t lLocaSize, const void * pHead, const int * prgnContourEndPoint, size_t cnEndPoints,
         int * prgnX, int * prgnY, bool * prgfOnCurve, size_t cnPoints);
 
-    // utitily method used by high-level GlyfPoints 
+    // utitily method used by high-level GlyfPoints
     bool SimplifyFlags(char * prgbFlags, int cnPoints);
     bool CalcAbsolutePoints(int * prgnX, int * prgnY, int cnPoints);
 #endif

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/UtfCodec.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/UtfCodec.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/UtfCodec.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -40,7 +40,7 @@
 
     static void     put(codeunit_t * cp, const uchar_t , int8 & len) throw();
     static uchar_t  get(const codeunit_t * cp, int8 & len) throw();
-    static bool     validate(const codeunit_t * s, const codeunit_t * e) throw();
+    static bool     validate(const codeunit_t * s, const codeunit_t * const e) throw();
 };
 
 
@@ -66,9 +66,9 @@
     }
 
     inline
-    static bool validate(codeunit_t * s, codeunit_t * e) throw()
+    static bool validate(const codeunit_t * s, const codeunit_t * const e) throw()
     {
-        return e > s;
+        return s <= e;
     }
 };
 
@@ -101,18 +101,19 @@
         l = 1;
 
         if (uh < 0xD800|| uh > 0xDFFF) { return uh; }
+        if (uh > 0xDBFF) { l = -1; return 0xFFFD; }
         const uint32 ul = cp[1];
-        if (uh > 0xDBFF || ul < 0xDC00 || ul > 0xDFFF) { l = -1; return 0xFFFD; }
+        if (ul < 0xDC00 || ul > 0xDFFF) { l = -1; return 0xFFFD; }
         ++l;
         return (uh<<10) + ul + surrogate_offset;
     }
 
     inline
-    static bool validate(codeunit_t * s, codeunit_t * e) throw()
+    static bool validate(const codeunit_t * s, const codeunit_t * const e) throw()
     {
         const ptrdiff_t n = e-s;
         if (n <= 0) return n == 0;
-        const uint32 u = *(s+(n-1)); // Get the last codepoint
+        const uint32 u = *(e-1); // Get the last codepoint
         return (u < 0xD800 || u > 0xDBFF);
     }
 };
@@ -166,7 +167,7 @@
     }
 
     inline
-    static bool validate(codeunit_t * s, codeunit_t * e) throw()
+    static bool validate(const codeunit_t * s, const codeunit_t * const e) throw()
     {
         const ptrdiff_t n = e-s;
         if (n <= 0) return n == 0;
@@ -175,7 +176,7 @@
         if (*s >= 0xC0) return false;
         if (n == 1) return true;
         if (*--s < 0x80) return true;
-        if (*s >= 0xe0) return false;
+        if (*s >= 0xE0) return false;
         if (n == 2 || *s >= 0xC0) return true;
         if (*--s < 0x80) return true;
         if (*s >= 0xF0) return false;
@@ -225,6 +226,7 @@
     operator codeunit_type * () const throw() { return cp; }
 
     bool error() const throw()  { return sl < 1; }
+    bool validate(const _utf_iterator & e)  { return codec::validate(cp, e.cp); }
 };
 
 template <typename C>

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/bits.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/bits.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/bits.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -73,22 +73,25 @@
 {
     return __builtin_popcountll(v);
 }
+
 #else
 
 template<typename T>
 inline unsigned int bit_set_count(T v)
 {
-    v = v - ((v >> 1) & T(~(0UL)/3));                           // temp
-    v = (v & T(~(0UL)/15*3)) + ((v >> 2) & T(~(0UL)/15*3));     // temp
-    v = (v + (v >> 4)) & T(~(0UL)/255*15);                      // temp
-    return (T)(v * T(~(0UL)/255)) >> (sizeof(T)-1)*8;           // count
+	static size_t const ONES = ~0;
+
+	v = v - ((v >> 1) & T(ONES/3));                      // temp
+    v = (v & T(ONES/15*3)) + ((v >> 2) & T(ONES/15*3));  // temp
+    v = (v + (v >> 4)) & T(ONES/255*15);                 // temp
+    return (T)(v * T(ONES/255)) >> (sizeof(T)-1)*8;      // count
 }
 
 #endif
 
-
+//TODO: Changed these to uintmax_t when we go to C++11
 template<int S>
-inline unsigned long _mask_over_val(unsigned long v)
+inline size_t _mask_over_val(size_t v)
 {
     v = _mask_over_val<S/2>(v);
     v |= v >> S*4;
@@ -95,8 +98,9 @@
     return v;
 }
 
+//TODO: Changed these to uintmax_t when we go to C++11
 template<>
-inline unsigned long _mask_over_val<1>(unsigned long v)
+inline size_t _mask_over_val<1>(size_t v)
 {
     v |= v >> 1;
     v |= v >> 2;
@@ -107,7 +111,7 @@
 template<typename T>
 inline T mask_over_val(T v)
 {
-    return _mask_over_val<sizeof(T)>(v);
+    return T(_mask_over_val<sizeof(T)>(v));
 }
 
 template<typename T>

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/json.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/json.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/json.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -33,6 +33,7 @@
 #include "inc/Main.h"
 #include <cassert>
 #include <cstdio>
+#include <cstdint>
 #include "inc/List.h"
 
 namespace graphite2 {
@@ -44,7 +45,6 @@
     json & operator = (const json &);
 
     typedef void (*_context_t)(json &);
-    class _null_t {};
 
     FILE * const    _stream;
     char            _contexts[128], // context stack
@@ -61,11 +61,12 @@
 public:
     class closer;
 
-    typedef const char *    string;
-    typedef double          number;
-    typedef long signed int integer;
-    typedef bool            boolean;
-    static const _null_t    null;
+    using string = const char *;
+    using number = double;
+    enum class integer : std::intmax_t {};
+    enum class integer_u : std::uintmax_t {};
+    using boolean = bool;
+    static const std::nullptr_t  null;
 
     void setenv(unsigned int index, void *val) { _env.reserve(index + 1); if (index >= _env.size()) _env.insert(_env.end(), _env.size() - index + 1, 0); _env[index] = val; }
     void *getenv(unsigned int index) const { return _env[index]; }
@@ -85,9 +86,9 @@
     json & operator << (string) throw();
     json & operator << (number) throw();
     json & operator << (integer) throw();
-    json & operator << (long unsigned int d) throw();
+    json & operator << (integer_u) throw();
     json & operator << (boolean) throw();
-    json & operator << (_null_t) throw();
+    json & operator << (std::nullptr_t) throw();
     json & operator << (_context_t) throw();
 
     operator bool() const throw();
@@ -136,31 +137,36 @@
 }
 
 inline
-json & operator << (json & j, signed char d) throw()        { return j << json::integer(d); }
+json & operator << (json & j, signed char d) throw()   { return j << json::integer(d); }
 
 inline
-json & operator << (json & j, short signed int d) throw()   { return j << json::integer(d); }
+json & operator << (json & j, unsigned char d) throw() { return j << json::integer_u(d); }
 
 inline
-json & operator << (json & j, signed int d) throw()         { return j << json::integer(d); }
+json & operator << (json & j, short int d) throw()   { return j << json::integer(d); }
 
 inline
-json & operator << (json & j, unsigned char d) throw()      { return j << json::integer(d); }
+json & operator << (json & j, unsigned short int d) throw() { return j << json::integer_u(d); }
 
 inline
-json & operator << (json & j, short unsigned int d) throw() { return j << json::integer(d); }
+json & operator << (json & j, int d) throw()         { return j << json::integer(d); }
 
 inline
-json & operator << (json & j, unsigned int d) throw()       { return j << json::integer(d); }
+json & operator << (json & j, unsigned int d) throw()       { return j << json::integer_u(d); }
 
 inline
-json & operator << (json & j, char c) throw ()
-{
-    const char str[2] = {c,0};
-    return j << str;
-}
+json & operator << (json & j, long int d) throw()         { return j << json::integer(d); }
 
 inline
+json & operator << (json & j, unsigned long int d) throw()       { return j << json::integer_u(d); }
+
+inline
+json & operator << (json & j, long long int d) throw()         { return j << json::integer(d); }
+
+inline
+json & operator << (json & j, unsigned long long int d) throw()       { return j << json::integer_u(d); }
+
+inline
 json::operator bool() const throw()     { return good(); }
 
 inline

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/opcode_table.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/opcode_table.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/opcode_table.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -41,7 +41,7 @@
 //      gmetric - 0 .. 11 (kgmetDescent)
 //      featidx - 0 .. face.numFeatures()
 //      level - any byte
-static const opcode_t opcode_table[] = 
+static const opcode_t opcode_table[] =
 {
     {{do2(nop)},                                    0, "NOP"},
 
@@ -122,4 +122,3 @@
     // private opcodes for internal use only, comes after all other on disk opcodes.
     {{do_(temp_copy), NILOP},                       0, "TEMP_COPY"}
 };
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/inc/opcodes.h
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/inc/opcodes.h	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/inc/opcodes.h	2018-08-16 00:30:02 UTC (rev 48409)
@@ -15,8 +15,8 @@
 
     You should also have received a copy of the GNU Lesser General Public
     License along with this library in the file named "LICENSE".
-    If not, write to the Free Software Foundation, 51 Franklin Street, 
-    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 
+    If not, write to the Free Software Foundation, 51 Franklin Street,
+    Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
     internet at http://www.fsf.org/licenses/lgpl.html.
 
 Alternatively, the contents of this file may be used under the terms of the
@@ -33,20 +33,20 @@
 // ==================
 // You have access to a few primitives and the full C++ code:
 //    declare_params(n) Tells the interpreter how many bytes of parameter
-//                      space to claim for this instruction uses and 
-//                      initialises the param pointer.  You *must* before the 
+//                      space to claim for this instruction uses and
+//                      initialises the param pointer.  You *must* before the
 //                      first use of param.
-//    use_params(n)     Claim n extra bytes of param space beyond what was 
+//    use_params(n)     Claim n extra bytes of param space beyond what was
 //                      claimed using delcare_param.
 //    param             A const byte pointer for the parameter space claimed by
 //                      this instruction.
-//    binop(op)         Implement a binary operation on the stack using the 
+//    binop(op)         Implement a binary operation on the stack using the
 //                      specified C++ operator.
-//    NOT_IMPLEMENTED   Any instruction body containing this will exit the 
+//    NOT_IMPLEMENTED   Any instruction body containing this will exit the
 //                      program with an assertion error.  Instructions that are
 //                      not implemented should also be marked NILOP in the
 //                      opcodes tables this will cause the code class to spot
-//                      them in a live code stream and throw a runtime_error 
+//                      them in a live code stream and throw a runtime_error
 //                      instead.
 //    push(n)           Push the value n onto the stack.
 //    pop()             Pop the top most value and return it.
@@ -62,8 +62,8 @@
 //        ip        = The current instruction pointer
 //        endPos    = Position of advance of last cluster
 //        dir       = writing system directionality of the font
-     
 
+
 // #define NOT_IMPLEMENTED     assert(false)
 // #define NOT_IMPLEMENTED
 
@@ -96,7 +96,7 @@
 
 STARTOP(push_short)
     declare_params(2);
-    const int16 r   = int16(param[0]) << 8 
+    const int16 r   = int16(param[0]) << 8
                     | uint8(param[1]);
     push(r);
 ENDOP
@@ -322,7 +322,7 @@
         smap.highpassed(false);
     is = newSlot;
     seg.extendLength(1);
-    if (map != &smap[-1]) 
+    if (map != &smap[-1])
         --map;
 ENDOP
 
@@ -333,13 +333,13 @@
         is->prev()->next(is->next());
     else
         seg.first(is->next());
-    
+
     if (is->next())
         is->next()->prev(is->prev());
     else
         seg.last(is->prev());
-    
 
+
     if (is == smap.highwater())
             smap.highwater(is->next());
     if (is->prev())
@@ -371,7 +371,7 @@
 
 STARTOP(cntxt_item)
     // It turns out this is a cunningly disguised condition forward jump.
-    declare_params(3);    
+    declare_params(3);
     const int       is_arg = int8(param[0]);
     const size_t    iskip  = uint8(param[1]),
                     dskip  = uint8(param[2]);
@@ -387,7 +387,7 @@
 STARTOP(attr_set)
     declare_params(1);
     const attrCode      slat = attrCode(uint8(*param));
-    const          int  val  = int(pop());
+    const          int  val  = pop();
     is->setAttr(&seg, slat, 0, val, smap);
 ENDOP
 
@@ -394,42 +394,42 @@
 STARTOP(attr_add)
     declare_params(1);
     const attrCode      slat = attrCode(uint8(*param));
-    const          int  val  = int(pop());
+    const     uint32_t  val  = pop();
     if ((slat == gr_slatPosX || slat == gr_slatPosY) && (flags & POSITIONED) == 0)
     {
         seg.positionSlots(0, *smap.begin(), *(smap.end()-1), seg.currdir());
         flags |= POSITIONED;
     }
-    int res = is->getAttr(&seg, slat, 0);
-    is->setAttr(&seg, slat, 0, val + res, smap);
+    uint32_t res = uint32_t(is->getAttr(&seg, slat, 0));
+    is->setAttr(&seg, slat, 0, int32_t(val + res), smap);
 ENDOP
 
 STARTOP(attr_sub)
     declare_params(1);
     const attrCode      slat = attrCode(uint8(*param));
-    const          int  val  = int(pop());
+    const     uint32_t  val  = pop();
     if ((slat == gr_slatPosX || slat == gr_slatPosY) && (flags & POSITIONED) == 0)
     {
         seg.positionSlots(0, *smap.begin(), *(smap.end()-1), seg.currdir());
         flags |= POSITIONED;
     }
-    int res = is->getAttr(&seg, slat, 0);
-    is->setAttr(&seg, slat, 0, res - val, smap);
+    uint32_t res = uint32_t(is->getAttr(&seg, slat, 0));
+    is->setAttr(&seg, slat, 0, int32_t(res - val), smap);
 ENDOP
 
 STARTOP(attr_set_slot)
     declare_params(1);
-    const attrCode      slat = attrCode(uint8(*param));
-    const int offset = (map - smap.begin())*int(slat == gr_slatAttTo);
-    const          int  val  = int(pop())  + offset;
+    const attrCode  slat   = attrCode(uint8(*param));
+    const int       offset = int(map - smap.begin())*int(slat == gr_slatAttTo);
+    const int       val    = pop()  + offset;
     is->setAttr(&seg, slat, offset, val, smap);
 ENDOP
 
 STARTOP(iattr_set_slot)
     declare_params(2);
-    const attrCode      slat = attrCode(uint8(param[0]));
-    const size_t        idx  = uint8(param[1]);
-    const          int  val  = int(pop())  + (map - smap.begin())*int(slat == gr_slatAttTo);
+    const attrCode  slat = attrCode(uint8(param[0]));
+    const uint8     idx  = uint8(param[1]);
+    const int       val  = int(pop()  + (map - smap.begin())*int(slat == gr_slatAttTo));
     is->setAttr(&seg, slat, idx, val, smap);
 ENDOP
 
@@ -531,7 +531,7 @@
     NOT_IMPLEMENTED;
 ENDOP
 #endif
-      
+
 STARTOP(pop_ret)
     const uint32 ret = pop();
     EXIT(ret);
@@ -548,8 +548,8 @@
 STARTOP(iattr_set)
     declare_params(2);
     const attrCode      slat = attrCode(uint8(param[0]));
-    const size_t        idx  = uint8(param[1]);
-    const          int  val  = int(pop());
+    const uint8         idx  = uint8(param[1]);
+    const          int  val  = pop();
     is->setAttr(&seg, slat, idx, val, smap);
 ENDOP
 
@@ -556,29 +556,29 @@
 STARTOP(iattr_add)
     declare_params(2);
     const attrCode      slat = attrCode(uint8(param[0]));
-    const size_t        idx  = uint8(param[1]);
-    const          int  val  = int(pop());
+    const uint8         idx  = uint8(param[1]);
+    const     uint32_t  val  = pop();
     if ((slat == gr_slatPosX || slat == gr_slatPosY) && (flags & POSITIONED) == 0)
     {
         seg.positionSlots(0, *smap.begin(), *(smap.end()-1), seg.currdir());
         flags |= POSITIONED;
     }
-    int res = is->getAttr(&seg, slat, idx);
-    is->setAttr(&seg, slat, idx, val + res, smap);
+    uint32_t res = uint32_t(is->getAttr(&seg, slat, idx));
+    is->setAttr(&seg, slat, idx, int32_t(val + res), smap);
 ENDOP
 
 STARTOP(iattr_sub)
     declare_params(2);
     const attrCode      slat = attrCode(uint8(param[0]));
-    const size_t        idx  = uint8(param[1]);
-    const          int  val  = int(pop());
+    const uint8         idx  = uint8(param[1]);
+    const     uint32_t  val  = pop();
     if ((slat == gr_slatPosX || slat == gr_slatPosY) && (flags & POSITIONED) == 0)
     {
         seg.positionSlots(0, *smap.begin(), *(smap.end()-1), seg.currdir());
         flags |= POSITIONED;
     }
-    int res = is->getAttr(&seg, slat, idx);
-    is->setAttr(&seg, slat, idx, res - val, smap);
+    uint32_t res = uint32_t(is->getAttr(&seg, slat, idx));
+    is->setAttr(&seg, slat, idx, int32_t(res - val), smap);
 ENDOP
 
 STARTOP(push_proc_state)
@@ -689,4 +689,3 @@
         seg.setFeature(fid, feat, pop());
     }
 ENDOP
-

Modified: trunk/Build/source/libs/graphite2/graphite2-src/src/json.cpp
===================================================================
--- trunk/Build/source/libs/graphite2/graphite2-src/src/json.cpp	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/graphite2-src/src/json.cpp	2018-08-16 00:30:02 UTC (rev 48409)
@@ -33,6 +33,14 @@
 #include <limits>
 #include "inc/json.h"
 
+#if defined(_MSC_VER)
+#define FORMAT_INTMAX "%lli"
+#define FORMAT_UINTMAX "%llu"
+#else
+#define FORMAT_INTMAX "%ji"
+#define FORMAT_UINTMAX "%ju"
+#endif
+
 using namespace graphite2;
 
 namespace
@@ -45,7 +53,7 @@
     };
 }
 
-const json::_null_t json::null = {};
+const std::nullptr_t json::null = nullptr;
 
 inline
 void json::context(const char current) throw()
@@ -118,8 +126,8 @@
 }
 
 json & json::operator << (json::number f) throw()
-{ 
-    context(seq); 
+{
+    context(seq);
     if (std::numeric_limits<json::number>::infinity() == f)
         fputs("Infinity", _stream);
     else if (-std::numeric_limits<json::number>::infinity() == f)
@@ -128,13 +136,12 @@
             std::numeric_limits<json::number>::signaling_NaN() == f)
         fputs("NaN", _stream);
     else
-        fprintf(_stream, "%g", f); 
-    return *this; 
+        fprintf(_stream, "%g", f);
+    return *this;
 }
-json & json::operator << (json::integer d) throw()  { context(seq); fprintf(_stream, "%ld", d); return *this; }
-json & json::operator << (long unsigned d) throw()  { context(seq); fprintf(_stream, "%ld", d); return *this; }
+json & json::operator << (json::integer d) throw()  { context(seq); fprintf(_stream, FORMAT_INTMAX, intmax_t(d)); return *this; }
+json & json::operator << (json::integer_u d) throw()  { context(seq); fprintf(_stream, FORMAT_UINTMAX, uintmax_t(d)); return *this; }
 json & json::operator << (json::boolean b) throw()  { context(seq); fputs(b ? "true" : "false", _stream); return *this; }
-json & json::operator << (json::_null_t) throw()    { context(seq); fputs("null",_stream); return *this; }
+json & json::operator << (std::nullptr_t)  throw()  { context(seq); fputs("null",_stream); return *this; }
 
 #endif
-

Modified: trunk/Build/source/libs/graphite2/version.ac
===================================================================
--- trunk/Build/source/libs/graphite2/version.ac	2018-08-16 00:23:52 UTC (rev 48408)
+++ trunk/Build/source/libs/graphite2/version.ac	2018-08-16 00:30:02 UTC (rev 48409)
@@ -8,4 +8,4 @@
 dnl --------------------------------------------------------
 dnl
 dnl  m4-include this file to define the current graphite2 version
-m4_define([graphite2_version], [1.3.11])
+m4_define([graphite2_version], [1.3.12])



More information about the tex-live-commits mailing list