xref: /aoo42x/main/graphite/graphite-2.3.1.patch (revision f1d7d1c0)
1--- misc/silgraphite-2.3.1/engine/include/graphite/GrCommon.h	Thu Jan 22 00:36:40 2009
2+++ misc/build/silgraphite-2.3.1/engine/include/graphite/GrCommon.h	Sat Aug 22 19:36:32 2009
3@@ -18,6 +18,8 @@
4 #ifndef GRCOMMON_INCLUDED
5 #define GRCOMMON_INCLUDED
6
7+#define _SECURE_SCL 0	// to allow GlyphSetIterator to work, which points off the end of a vector
8+#define _HAS_ITERATOR_DEBUGGING 0
9
10 // Standard Headers.
11
12@@ -33,6 +35,7 @@
13 #include <vector>
14 #include <algorithm>
15 #include <string>
16+///#include <stdexcept> -- possibly needed for std::string Xran and Xlen functions??
17
18 // Uncomment this to allow multiple versions of gr to coexist
19 // in the same program e.g. pangographite with gtk uses namespace gr
20@@ -41,7 +44,7 @@
21 // Provided the client includes GrClient.h first this #define is
22 // picked up by all files.
23
24-//#define gr gr2
25+#define gr gr3ooo
26
27 // Project headers
28 #include "GrPlatform.h"
29--- misc/silgraphite-2.3.1/engine/include/graphite/GrMstypes.h	Thu Jan 22 00:36:40 2009
30+++ misc/build/silgraphite-2.3.1/engine/include/graphite/GrMstypes.h	Sat Aug 22 19:36:32 2009
31@@ -24,11 +24,11 @@
32
33 typedef signed long	    HRESULT;
34
35-inline const long InterlockedIncrement(long *const intr_lck) {
36+inline long InterlockedIncrement(long *const intr_lck) {
37 	return ++*intr_lck;
38 }
39
40-inline const long InterlockedDecrement(long *const intr_lck) {
41+inline long InterlockedDecrement(long *const intr_lck) {
42 	return --*intr_lck;
43 }
44
45--- misc/silgraphite-2.3.1/engine/makefile.vc7	Thu Aug 21 16:24:32 2008
46+++ misc/build/silgraphite-2.3.1/engine/makefile.vc7	Sat Aug 22 19:36:32 2009
47@@ -48,11 +48,7 @@
48 CPP_DEBUG=/D "TRACING" $(CPP_DEBUG)
49 !ENDIF
50
51-!IF "$(OS)" == "Windows_NT"
52 NULL=
53-!ELSE
54-NULL=nul
55-!ENDIF
56
57 clean :
58     @- rd /s/q .\release_temp
59--- misc/silgraphite-2.3.1/engine/makefile.vc8	Sat Aug 22 21:58:25 2009
60+++ misc/build/silgraphite-2.3.1/engine/makefile.vc8	Sat Aug 22 21:57:42 2009
61@@ -2,11 +2,16 @@
62 TARGET=graphite
63
64 CPP=cl.exe
65-CPPFLAGS=/Zc:wchar_t- /nologo /W4 /GR /EHsc /I "./src/font" /I "./src/painter" /I "./src/segment" /I "./src/textsource" /I "./src/generic" /I "./include/graphite" /I "../wrappers/win32" /D "GR_NAMESPACE" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "TRACING"  /Fp"$(INTDIR)\graphite.pch" /Fd"$(INTDIR)\\" /FD /c
66+### HDU: disabled building with the normal compile flags
67+###CPPFLAGS= /Zc:wchar_t- /nologo /W4 /GR /EHsc /I "./src/font" /I "./src/painter" /I "./src/segment" /I "./src/textsource" /I "./src/generic" /I "./include/graphite" /I "../wrappers/win32" /D "GR_NAMESPACE" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "TRACING"  /Fp"$(INTDIR)\graphite.pch" /Fd"$(INTDIR)\\" /FD /c
68+### HDU: because for full binary compatibility with the rest of OOo all compile flags must match exactly
69+###       which is especially true for template-heavy C++ code with non-default config (e.g. _STLP_DEBUG enabled)
70+CPPFLAGS= $(CFLAGS4MSC) /nologo /W4 /I "./src/font" /I "./src/painter" /I "./src/segment" /I "./src/textsource" /I "./src/generic" /I "./include/graphite" /I "../wrappers/win32" /D "GR_NAMESPACE" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "TRACING"  /Fp"$(INTDIR)\graphite.pch" /FD /c
71+
72 # /Wp62
73
74 LINK=link.exe
75-LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /pdb:"$(OUTDIR)\\graphite.pdb" /machine:I386 /out:"$(OUTDIR)\\$(TARGET).dll" /implib:"$(OUTDIR)\\$(TARGET).lib"
76+LINK_FLAGS=$(ADDLIBS) kernel32.lib user32.lib gdi32.lib winspool.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /pdb:"$(OUTDIR)\\graphite.pdb" /machine:I386 /out:"$(OUTDIR)\\$(TARGET).dll" /implib:"$(OUTDIR)\\$(TARGET).lib"
77
78 BSC32=bscmake.exe
79 BSC32_FLAGS=/nologo /o"$(OUTDIR)\\$(TARGET).bsc"
80@@ -24,21 +29,21 @@
81 SBREXT = .sbr
82
83 !IF "$(CFG)" == "DEBUG"
84-CPP_DEBUG=/D "DEBUG" /Gm /GR /ZI /Od /RTC1 /FR"$(INTDIR)\\" /$(MLIB)d
85+CPP_DEBUG=/D "DEBUG" /Gm /GR /Od /RTC1 /FR"$(INTDIR)\\"
86 # CPP_DEBUG=/D "DEBUG" /Gm /GR /ZI /Od /RTC1 /FR"$(INTDIR)\\" /MDd
87
88 OUTDIR=.\debug
89 INTDIR=.\debug_temp
90-LINK_DEBUG= MSVCRTD.lib /debug /incremental:yes #/pdbtype:sept
91+LINK_DEBUG= /debug
92
93 all : lib lib_dll bsc
94
95 !ELSE
96-CPP_DEBUG=/D "NDEBUG" /O2 /$(MLIB)
97+CPP_DEBUG=/D "NDEBUG" /O2
98 # CPP_DEBUG=/D "NDEBUG" /O2 /MD
99 OUTDIR=.\release
100 INTDIR=.\release_temp
101-LINK_DEBUG= MSVCRT.lib /incremental:no /NODEFAULTLIB:libc
102+LINK_DEBUG= /incremental:no /NODEFAULTLIB:libc
103
104 all : lib lib_dll
105
106@@ -48,11 +53,7 @@
107 CPP_DEBUG=/D "TRACING" $(CPP_DEBUG)
108 !ENDIF
109
110-!IF "$(OS)" == "Windows_NT"
111 NULL=
112-!ELSE
113-NULL=nul
114-!ENDIF
115
116 clean :
117     @- rd /s/q .\release_temp
118@@ -779,7 +780,7 @@
119 	@- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont$(OBJEXT)" $?
120
121 "$(INTDIR)\FileFont_dll$(OBJEXT)" : "src/font/FileFont.cpp"
122-	@- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FileFont_dll$(OBJEXT)" $?
123+	$(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FileFont_dll$(OBJEXT)" $?
124
125 !ENDIF
126
127--- misc/silgraphite-2.3.1/engine/src/font/FileFont.cpp	Thu Jan 22 00:36:42 2009
128+++ misc/build/silgraphite-2.3.1/engine/src/font/FileFont.cpp	Sat Aug 22 19:36:32 2009
129@@ -207,11 +207,11 @@
130 				cch16 += cch16Used;
131 			}
132 //		}
133-#else
134+#elif 1
135 		m_stuFaceName.assign(rgchwFace);
136-		// VS 2005 needs this:
137-		//for (int cch16 = 0; cch16 < cchw; cch16++)
138-		//	m_stuFaceName.push_back(rgchwFace[cch16]);
139+#else	// VS 2005 needs this:
140+		for (int cch16 = 0; cch16 < cchw; cch16++)
141+			m_stuFaceName.push_back(rgchwFace[cch16]);
142 #endif
143 		pTable = readTable(ktiHead, lSize);
144 		if (!m_fIsValid || !pTable)
145@@ -233,7 +233,7 @@
146 FileFont::readTable(int /*TableId*/ tid, size_t & size)
147 {
148 	const TableId tableId = TableId(tid);
149-	bool isValid = true;
150+	bool isTableValid = true;
151 	size_t lOffset = 0, lSize = 0;
152 	if (!m_pTableCache)
153 	{
154@@ -245,9 +245,9 @@
155 	size = m_pTableCache->getTableSize(tableId);
156 	// check whether it is already in the cache
157 	if (pTable) return pTable;
158-	isValid &= TtfUtil::GetTableInfo(tableId, m_pHeader, m_pTableDir,
159+	isTableValid &= TtfUtil::GetTableInfo(tableId, m_pHeader, m_pTableDir,
160 			lOffset, lSize);
161-	if (!isValid)
162+	if (!isTableValid)
163 		return NULL;
164 	fseek(m_pfile, lOffset, SEEK_SET);
165 	// only allocate if needed
166@@ -255,16 +255,16 @@
167
168 	if (!pTable)
169 	{
170-		isValid = false;
171+		isTableValid = false;
172 		return NULL;
173 	}
174 	size_t bytesRead = fread(pTable, 1, lSize, m_pfile);
175-	isValid = bytesRead == lSize;
176-	if (isValid)
177+	isTableValid = bytesRead == lSize;
178+	if (isTableValid)
179 	{
180-		isValid &= TtfUtil::CheckTable(tableId, pTable, lSize);
181+		isTableValid &= TtfUtil::CheckTable(tableId, pTable, lSize);
182 	}
183-	if (!isValid)
184+	if (!isTableValid)
185 	{
186 		return 0;
187 	}
188--- misc/silgraphite-2.3.1/engine/src/font/Font.cpp	Tue May 20 08:04:16 2008
189+++ misc/build/silgraphite-2.3.1/engine/src/font/Font.cpp	Sat Aug 22 19:36:33 2009
190@@ -626,7 +626,7 @@
191 		Assert(false);
192 		m_ifeat = m_cfeat;
193 	}
194-	else if (m_ifeat + n < 0)
195+	else if (static_cast<int>(m_ifeat) + n < 0)
196 	{
197 		// Can't decrement.
198 		Assert(false);
199@@ -727,7 +727,7 @@
200 		Assert(false);
201 		m_ifset = m_cfset;
202 	}
203-	if (m_ifset + n < 0)
204+	if (static_cast<int>(m_ifset) + n < 0)
205 	{
206 		// Can't decrement.
207 		Assert(false);
208@@ -820,7 +820,7 @@
209 		Assert(false);
210 		m_ilang = m_clang;
211 	}
212-	else if (m_ilang + n < 0)
213+	else if (static_cast<int>(m_ilang) + n < 0)
214 	{
215 		// Can't decrement.
216 		Assert(false);
217@@ -906,7 +906,7 @@
218 		Assert(false);
219 		m_ilang = m_clang;
220 	}
221-	else if (m_ilang + n < 0)
222+	else if (static_cast<int>(m_ilang) + n < 0)
223 	{
224 		// Can't decrement.
225 		Assert(false);
226--- misc/silgraphite-2.3.1/engine/src/font/TtfUtil.cpp	Thu Jan 29 10:33:19 2009
227+++ misc/build/silgraphite-2.3.1/engine/src/font/TtfUtil.cpp	Sat Aug 22 19:36:33 2009
228@@ -492,7 +492,7 @@
229 	const Sfnt::FontHeader * pTable =
230 			reinterpret_cast<const Sfnt::FontHeader *>(pHead);
231
232-	return read(((pTable->mac_style) & 0x00000002) != 0);
233+	return ((read(pTable->mac_style) & 0x00000002) != 0);
234 }
235
236 /*----------------------------------------------------------------------------------------------
237@@ -1108,8 +1108,8 @@
238 	{ // loca entries are two bytes and have been divided by two
239 		if (nGlyphId <= (lLocaSize >> 1) - 1) // allow sentinel value to be accessed
240 		{
241-			const uint16 * pTable = reinterpret_cast<const uint16 *>(pLoca);
242-			return (read(pTable[nGlyphId]) << 1);
243+			const uint16 * pTableLoca = reinterpret_cast<const uint16 *>(pLoca);
244+			return (read(pTableLoca[nGlyphId]) << 1);
245 		}
246 	}
247
248@@ -1117,8 +1117,8 @@
249 	{ // loca entries are four bytes
250 		if (nGlyphId <= (lLocaSize >> 2) - 1)
251 		{
252-			const uint32 * pTable = reinterpret_cast<const uint32 *>(pLoca);
253-			return read(pTable[nGlyphId]);
254+			const uint32 * pTableLoca = reinterpret_cast<const uint32 *>(pLoca);
255+			return read(pTableLoca[nGlyphId]);
256 		}
257 	}
258
259@@ -1586,7 +1586,7 @@
260
261 	for (size_t i = 0; i < cCompId; i++)
262 	{
263-		void * pSimpleGlyf = GlyfLookup(static_cast<gr::gid16>(rgnCompId[i]),
264+		pSimpleGlyf = GlyfLookup(static_cast<gr::gid16>(rgnCompId[i]),
265 										pGlyf, pLoca, lLocaSize, pHead);
266 		if (pSimpleGlyf == NULL) {return false;}
267
268@@ -1748,7 +1748,7 @@
269 ----------------------------------------------------------------------------------------------*/
270 bool GlyfPoints(gr::gid16 nGlyphId, const void * pGlyf,
271 		const void * pLoca, size_t lLocaSize, const void * pHead,
272-		const int * prgnContourEndPoint, size_t cnEndPoints,
273+		const int * /*prgnContourEndPoint*/, size_t /*cnEndPoints*/,
274 		int * prgnX, int * prgnY, bool * prgfOnCurve, size_t cnPoints)
275 {
276 	std::fill_n(prgnX, cnPoints, INT_MAX);
277--- misc/silgraphite-2.3.1/engine/src/painter/SegmentPainter.cpp	Wed Jan 28 04:01:29 2009
278+++ misc/build/silgraphite-2.3.1/engine/src/painter/SegmentPainter.cpp	Sat Aug 22 19:36:33 2009
279@@ -353,7 +353,7 @@
280 	@param bOn				- true if we are turning on (ignored in this implementation)
281 ----------------------------------------------------------------------------------------------*/
282 bool SegmentPainter::drawSelectionRange(int ichwAnchor, int ichwEnd,
283-	float ydLineTop, float ydLineBottom, bool bOn)
284+	float ydLineTop, float ydLineBottom, bool /*bOn*/)
285 {
286 	if (g_fDrawing)
287 		return true;
288@@ -993,7 +993,7 @@
289 								an I-beam (std selection)
290 ----------------------------------------------------------------------------------------------*/
291 void SegmentPainter::CalcOrDrawInsertionPoint(
292-	int ichwIP, bool fAssocPrev, bool bOn, bool fForceSplit,
293+	int ichwIP, bool fAssocPrev, bool /*bOn*/, bool fForceSplit,
294 	Rect * prdPrimary, Rect * prdSecondary)
295 {
296 	GrResult res = kresOk;
297@@ -1277,7 +1277,7 @@
298 							if NULL, do the drawing
299 ----------------------------------------------------------------------------------------------*/
300 void SegmentPainter::InvertIBeam(float xs, float ysTop, float ysBottom,
301-	bool fAssocPrev, Rect * prdRet)
302+	bool /*fAssocPrev*/, Rect * prdRet)
303 {
304 	float xd = ScaleXToDest(xs);
305 	float ydTop = ScaleYToDest(ysTop);
306@@ -1675,7 +1675,7 @@
307 }
308
309 bool SegmentPainter::AtEdgeOfCluster(GrSlotOutput * psloutBase, int isloutBase,
310-	GrSlotOutput * pslout, int islout, bool fBefore)
311+	GrSlotOutput * /*pslout*/, int islout, bool fBefore)
312 {
313 	//	Compare pslout to all the members of the cluster. If it is the minimum or maximum, it
314 	//	is at an edge.
315@@ -1778,12 +1778,12 @@
316 			}
317 			for (icomp = 0; icomp < pslout->NumberOfComponents(); icomp++)
318 			{
319-				for (int ichw = pslout->FirstUnderlyingComponent(icomp) ;
320-					ichw <= pslout->LastUnderlyingComponent(icomp) ;
321-					ichw++)
322+				for (int ichwTemp = pslout->FirstUnderlyingComponent(icomp) ;
323+					ichwTemp <= pslout->LastUnderlyingComponent(icomp) ;
324+					ichwTemp++)
325 				{
326-					if (m_pseg->m_prgiComponent[ichw - m_pseg->m_ichwAssocsMin] == icomp)
327-						prgfAllSelected[ichw] = fAll;
328+					if (m_pseg->m_prgiComponent[ichwTemp - m_pseg->m_ichwAssocsMin] == icomp)
329+						prgfAllSelected[ichwTemp] = fAll;
330 				}
331 			}
332 		}
333@@ -2304,7 +2304,11 @@
334 	Assert that there are no overlaps among all the rectangles in the array, which should
335 	be the case if AdjustRectsToNotOverlap is working properly.
336 ----------------------------------------------------------------------------------------------*/
337+#ifdef _DEBUG
338 void SegmentPainter::AssertNoOverlaps(std::vector<Rect> & vrect)
339+#else
340+void SegmentPainter::AssertNoOverlaps(std::vector<Rect> & /*vrect*/)
341+#endif
342 {
343 #ifdef _DEBUG
344 	for (int irect1 = 0; irect1 < signed(vrect.size() - 1); irect1++)
345@@ -2452,7 +2456,11 @@
346 	Assert that there are no overlaps among all the rectangles in the array, which should
347 	be the case if AdjustRectsToNotOverlap is working properly.
348 ----------------------------------------------------------------------------------------------*/
349+#ifdef _DEBUG
350 void SegmentPainter::AssertNoOverlaps(std::vector<LineSeg> & vls)
351+#else
352+void SegmentPainter::AssertNoOverlaps(std::vector<LineSeg> & /*vls*/)
353+#endif
354 {
355 #ifdef _DEBUG
356 	for (int ils1 = 0; ils1 < (int)vls.size() - 1; ils1++)
357@@ -2884,7 +2892,7 @@
358 	{
359 		if (icompNext != icompCurr)
360 		{
361-			float xsHorizNext = (fIPOnRight) ? vxsRights[icompNext] : vxsLefts[icompNext];
362+			xsHorizNext = (fIPOnRight) ? vxsRights[icompNext] : vxsLefts[icompNext];
363 			if (fMovingRight && xsHorizNext > xsHorizCurr)
364 				break;
365 			else if (!fMovingRight && xsHorizNext < xsHorizCurr)
366@@ -2996,7 +3004,7 @@
367 /*----------------------------------------------------------------------------------------------
368 	Make sure the font is set to use the character properties required by this segment.
369 ----------------------------------------------------------------------------------------------*/
370-void SegmentPainter::SetFontProps(unsigned long clrFore, unsigned long clrBack)
371+void SegmentPainter::SetFontProps(unsigned long /*clrFore*/, unsigned long /*clrBack*/)
372 {
373 	return;
374 }
375--- misc/silgraphite-2.3.1/engine/src/segment/FileInput.cpp	Thu Jan 22 00:36:42 2009
376+++ misc/build/silgraphite-2.3.1/engine/src/segment/FileInput.cpp	Sat Aug 22 19:36:33 2009
377@@ -80,7 +80,7 @@
378 #ifdef GR_FW
379 bool GrBufferIStream::Open(std::wstring stuFileName, int kMode)
380 #else
381-bool GrBufferIStream::Open(const char * pcFileName, std::ios::openmode kMode)
382+bool GrBufferIStream::Open(const char * /*pcFileName*/, std::ios::openmode /*kMode*/)
383 #endif
384 {
385 	Assert(false); // use OpenBuffer
386--- misc/silgraphite-2.3.1/engine/src/segment/GrCharStream.cpp	Thu Jan 22 00:36:42 2009
387+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrCharStream.cpp	Sat Aug 22 19:36:33 2009
388@@ -417,8 +417,11 @@
389 	return true;
390 */
391 }
392-
393+#ifdef NDEBUG
394+bool GrCharStream::AtUnicodeCharBoundary(utf8 * prgchs, int cchs, int ichs, UtfType /*utf*/)
395+#else
396 bool GrCharStream::AtUnicodeCharBoundary(utf8 * prgchs, int cchs, int ichs, UtfType utf)
397+#endif
398 {
399 	Assert(ichs >= 0);
400 	Assert(ichs <= cchs);
401--- misc/silgraphite-2.3.1/engine/src/segment/GrClassTable.h	Thu Jan 22 00:36:42 2009
402+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrClassTable.h	Sat Aug 22 19:36:33 2009
403@@ -54,7 +54,11 @@
404 	/*------------------------------------------------------------------------------------------
405 		Copy the raw memory into the instance.
406 	------------------------------------------------------------------------------------------*/
407+#ifdef NDEBUG
408+	void CopyFrom(data16 * pchwStart, int /*cchw*/)
409+#else
410 	void CopyFrom(data16 * pchwStart, int cchw)
411+#endif
412 	{
413 		m_cgixBIG = pchwStart[0];
414 		m_digixBIGInit = pchwStart[1];
415--- misc/silgraphite-2.3.1/engine/src/segment/GrEngine.cpp	Wed Jan 28 04:01:29 2009
416+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrEngine.cpp	Sat Aug 22 19:36:33 2009
417@@ -159,12 +159,12 @@
418 GrEngine::~GrEngine()
419 {
420 	DestroyEverything();
421-	#ifdef _MSC_VER
422-	if (!_CrtCheckMemory())
423-	{
424-		OutputDebugString(L"bad memory");
425-	}
426-	#endif
427+//	#ifdef _MSC_VER
428+//	if (!_CrtCheckMemory())
429+//	{
430+//		OutputDebugString(L"bad memory");
431+//	}
432+//	#endif
433 }
434
435 /*----------------------------------------------------------------------------------------------
436@@ -173,12 +173,12 @@
437 void GrEngine::DestroyEverything()
438 {
439 	DestroyContents();
440-	#ifdef _MSC_VER
441-	if (!_CrtCheckMemory())
442-	{
443-		OutputDebugString(L"bad memory");
444-	}
445-	#endif
446+//	#ifdef _MSC_VER
447+//	if (!_CrtCheckMemory())
448+//	{
449+//		OutputDebugString(L"bad memory");
450+//	}
451+//	#endif
452
453 	m_strCtrlFileReg.erase();
454 	m_strCtrlFileBold.erase();
455@@ -417,7 +417,11 @@
456 	@return The supported script direction(s). If more than one, the application is
457 	responsible for choosing the most appropriate.
458 ----------------------------------------------------------------------------------------------*/
459+#ifdef NDEBUG
460+GrResult GrEngine::get_ScriptDirection(unsigned int * pgrfsdc, OLECHAR * /*prgchwErrMsg*/, int /*cchMaxErrMsg*/)
461+#else
462 GrResult GrEngine::get_ScriptDirection(unsigned int * pgrfsdc, OLECHAR * prgchwErrMsg, int cchMaxErrMsg)
463+#endif
464 {
465 	ChkGrOutPtr(pgrfsdc);
466 	ChkGrArrayArg(prgchwErrMsg, cchMaxErrMsg);
467@@ -789,7 +793,7 @@
468 	Record a system error indicating a bad error in rendering using a supposedly valid font.
469 	OBSOLETE
470 ----------------------------------------------------------------------------------------------*/
471-void GrEngine::RecordFontRunError(OLECHAR * prgchwErrMsg, int cchMax, GrResult res)
472+void GrEngine::RecordFontRunError(OLECHAR * prgchwErrMsg, int cchMax, GrResult /*res*/)
473 {
474 	if (prgchwErrMsg == NULL || cchMax == 0)
475 		return;
476@@ -970,7 +974,7 @@
477 /*----------------------------------------------------------------------------------------------
478 	Return whether the text is asking for bold and/or italic text.
479 ----------------------------------------------------------------------------------------------*/
480-void GrEngine::GetStyles(Font * pfont, int ichwMin, bool * pfBold, bool * pfItalic)
481+void GrEngine::GetStyles(Font * pfont, int /*ichwMin*/, bool * pfBold, bool * pfItalic)
482 {
483 	*pfBold = pfont->bold();
484 	*pfItalic = pfont->italic();
485@@ -981,7 +985,11 @@
486 	Should only be called when we know we are using a base font, or when we are reading
487 	the base font to see if it is valid.
488 ----------------------------------------------------------------------------------------------*/
489+#ifdef NDEBUG
490+void GrEngine::SwitchGraphicsFont(bool /*fBase*/)
491+#else
492 void GrEngine::SwitchGraphicsFont(bool fBase)
493+#endif
494 {
495 	Assert(!fBase || m_stuBaseFaceName.size() > 0);
496
497@@ -1135,7 +1143,7 @@
498 		m_chwJShrink0 = 0xffff;
499 		m_chwJStep0 = 0xffff;
500 		m_chwJWeight0 = 0xffff;
501-		for (int i = 0; i < m_cJLevels; i++)
502+		for (i = 0; i < m_cJLevels; i++)
503 		{
504 			//	justification glyph attribute IDs
505 			bTmp = grstrm.ReadByteFromFont();
506@@ -1210,10 +1218,12 @@
507
508 	//	rendering behaviors--ignore for now
509 	byte cBehaviors = grstrm.ReadByteFromFont();
510-	unsigned int nBehaviors[kMaxRenderingBehavior];
511+	int nTmp;
512+	//unsigned int nBehaviors[kMaxRenderingBehavior]; -- this big buffer causes a stack overflow in Multiscribe; rework eventually
513 	for (i = 0; i < cBehaviors; i++)
514 	{
515-		nBehaviors[i] = unsigned(grstrm.ReadIntFromFont());
516+		//nBehaviors[i] = unsigned(grstrm.ReadIntFromFont());
517+		nTmp = unsigned(grstrm.ReadIntFromFont());
518 	}
519
520 	//	linebreak glyph ID
521--- misc/silgraphite-2.3.1/engine/src/segment/GrFSM.cpp	Thu Jan 22 00:36:42 2009
522+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrFSM.cpp	Sat Aug 22 19:36:33 2009
523@@ -46,7 +46,7 @@
524 	Fill in the FSM by reading from the font stream.
525 	Assumes the stream is in the correct position.
526 ----------------------------------------------------------------------------------------------*/
527-bool GrFSM::ReadFromFont(GrIStream & grstrm, int fxdVersion)
528+bool GrFSM::ReadFromFont(GrIStream & grstrm, int /*fxdVersion*/)
529 {
530 	short snTmp;
531
532@@ -138,7 +138,7 @@
533 	Fill in the FSM's state table by reading from the font stream.
534 	Assumes the stream is in the correct position.
535 ----------------------------------------------------------------------------------------------*/
536-bool GrFSM::ReadStateTableFromFont(GrIStream & grstrm, int fxdVersion)
537+bool GrFSM::ReadStateTableFromFont(GrIStream & grstrm, int /*fxdVersion*/)
538 {
539 	int cCells = ((m_crow - m_crowFinal) * m_ccol);
540 	m_prgrowTransitions = new short[cCells];
541--- misc/silgraphite-2.3.1/engine/src/segment/GrFeature.cpp	Thu Jan 22 00:36:42 2009
542+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrFeature.cpp	Sat Aug 22 19:36:33 2009
543@@ -186,7 +186,7 @@
544 /*----------------------------------------------------------------------------------------------
545 	Read the languages from the font.
546 ----------------------------------------------------------------------------------------------*/
547-bool GrLangTable::ReadFromFont(GrIStream * pgrstrm, int fxdVersion)
548+bool GrLangTable::ReadFromFont(GrIStream * pgrstrm, int /*fxdVersion*/)
549 {
550 	GrIStream & grstrm = *pgrstrm;
551
552@@ -206,13 +206,22 @@
553
554 	m_cbOffset0 = (lsbf)(m_prglang[0].cbOffsetBIG);
555
556-	Assert((lsbf)(m_prglang[m_clang].cFeaturesBIG) == 0); // bogus entry has no settings
557+	if ((lsbf)(m_prglang[m_clang].cFeaturesBIG) == 0) // bogus entry has no settings
558+	{
559 	cb = (lsbf)(m_prglang[m_clang].cbOffsetBIG) - m_cbOffset0;
560-	Assert(cb % sizeof(FeatSet) == 0); // # of bytes fits nicely into FeatSet class
561+		if (cb % sizeof(FeatSet) == 0) // # of bytes fits nicely into FeatSet class
562+		{
563 	int cfset = cb / sizeof(FeatSet);
564 	m_prgfset = new FeatSet[cfset];
565 	m_cfset = cfset;
566 	grstrm.ReadBlockFromFont(m_prgfset, cb);
567+		}
568+		else return false;
569+	}
570+	else
571+	{
572+		return false;
573+	}
574
575 	return true;
576 }
577--- misc/silgraphite-2.3.1/engine/src/segment/GrPass.cpp	Wed Jan 28 04:01:29 2009
578+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrPass.cpp	Sat Aug 22 19:36:34 2009
579@@ -279,9 +279,10 @@
580 	@param twsh					- how we are handling trailing white-space
581 	@param pnRet				- return value
582 	@param pcslotGot			- return the number of slots gotten
583-	@param pislotFinalBreak		- return the index of the final slot, when we are removing
584-									the trailing white-space and so the end of the segment
585-									will be before the any actual line-break slot
586+	@param pislotFinalBreak		- index of the final slot (LB or actual glyph), or -1;
587+									adjusted when we are removing the trailing white-space and
588+									so the end of the segment will be before the any actual
589+									line-break slot
590
591 	@return kNextPass if we were able to generated the number requested, or processing is
592 		complete; otherwise return the number of slots needed from the previous pass.
593@@ -465,7 +466,7 @@
594 void GrBidiPass::ExtendOutput(GrTableManager * ptman,
595 	GrSlotStream* psstrmIn, GrSlotStream* psstrmOut,
596 	int cslotNeededByNext, TrWsHandling twsh,
597-	int * pnRet, int * pcslotGot, int * pislotFinalBreak)
598+	int * pnRet, int * pcslotGot, int * /*pislotFinalBreak*/)
599 {
600 	Assert(psstrmIn->SlotsToReprocess() == 0);
601
602@@ -776,7 +777,7 @@
603 int GrPass::ExtendFinalOutput(GrTableManager * ptman,
604 	GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput,
605 	float xsSpaceAllotted, bool fWidthIsCharCount, bool fInfiniteWidth,
606-	bool fHaveLineBreak, bool fMustBacktrack, LineBrk lbMax, TrWsHandling twsh,
607+	bool fHaveLineBreak, bool fMustBacktrack, LineBrk /*lbMax*/, TrWsHandling twsh,
608 	int * pislotLB, float * pxsWidth)
609 {
610 	EngineState * pengst = ptman->State();
611@@ -897,7 +898,11 @@
612 	Remove undesirable trailing white-space.
613 ----------------------------------------------------------------------------------------------*/
614 int GrPass::RemoveTrailingWhiteSpace(GrTableManager * ptman, GrSlotStream * psstrmOut,
615+#ifdef NDEBUG
616+	TrWsHandling /*twsh*/, int * pislotFinalBreak)
617+#else
618 	TrWsHandling twsh, int * pislotFinalBreak)
619+#endif
620 {
621 	EngineState * pengst = ptman->State();
622
623@@ -944,7 +949,7 @@
624 	should never be necessary if they've set up their tables right.
625 ----------------------------------------------------------------------------------------------*/
626 void GrPass::CheckInputProgress(GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput,
627-	int islotOrigInput)
628+	int /*islotOrigInput*/)
629 {
630 	int islotInput = psstrmInput->ReadPosForNextGet();
631 //	Assert(islotInput >= islotOrigInput); -- no longer true now that we can back up
632@@ -1752,7 +1757,7 @@
633 ----------------------------------------------------------------------------------------------*/
634 int GrPass::Unwind(GrTableManager * ptman,
635 	int islotChanged, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
636-	bool fFirst)
637+	bool /*fFirst*/)
638 {
639 	//	Back up the number of slots required for the longest rule context,
640 	//	but if we land in the middle of a chunk, go forward to its boundary.
641@@ -1824,7 +1829,7 @@
642 ----------------------------------------------------------------------------------------------*/
643 int GrBidiPass::Unwind(GrTableManager * ptman,
644 	int islotChanged, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
645-	bool fFirst)
646+	bool /*fFirst*/)
647 {
648 	int islotIn;
649 	int islotOut;
650@@ -1901,8 +1906,8 @@
651 	OBSOLETE
652 ----------------------------------------------------------------------------------------------*/
653 //:Ignore
654-void GrPosPass::Unattach(GrSlotStream * psstrmIn, int islotIn,
655-	GrSlotStream * psstrmOut, int islotOut, int islotLB)
656+void GrPosPass::Unattach(GrSlotStream * /*psstrmIn*/, int /*islotIn*/,
657+	GrSlotStream * /*psstrmOut*/, int /*islotOut*/, int /*islotLB*/)
658 {
659 	//	Because this is a positioning pass, there is a one-to-one correspondence between
660 	//	the slots in the input and the slots in the output. Thus we can make simplifying
661--- misc/silgraphite-2.3.1/engine/src/segment/GrPass.h	Thu Aug 21 16:24:32 2008
662+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrPass.h	Sat Aug 22 19:36:34 2009
663@@ -197,7 +197,7 @@
664 	bool ReadFromFont(GrIStream & grstrm, int fxdSilfVersion, int fxdRuleVersion, int nOffset);
665 	void InitializeWithNoRules();
666
667-	virtual void SetTopDirLevel(int n)
668+	virtual void SetTopDirLevel(int /*n*/)
669 	{	// only GrBidiPass does anything interesting
670 	}
671
672@@ -253,13 +253,13 @@
673 		m_pzpst->SetResyncSkip(n);
674 	}
675
676-	virtual void DoCleanUpSegMin(GrTableManager * ptman,
677-		GrSlotStream * psstrmIn, int islotInitReadPos, GrSlotStream * psstrmOut)
678+	virtual void DoCleanUpSegMin(GrTableManager * /*ptman*/,
679+		GrSlotStream * /*psstrmIn*/, int /*islotInitReadPos*/, GrSlotStream * /*psstrmOut*/)
680 	{
681 	}
682
683-	virtual void DoCleanUpSegLim(GrTableManager * ptman, GrSlotStream * psstrmOut,
684-		TrWsHandling twsh)
685+	virtual void DoCleanUpSegLim(GrTableManager * /*ptman*/, GrSlotStream * /*psstrmOut*/,
686+		TrWsHandling /*twsh*/)
687 	{
688 	}
689
690@@ -383,8 +383,8 @@
691 	void MapChunks(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
692 		int islotChunkI, int islotChunkO, int cslotReprocessed);
693
694-	virtual void Unattach(GrSlotStream * psstrmIn, int islotIn,	// GrPosPass overrides
695-		GrSlotStream * psstrmOut, int islotOut, int islotLB)
696+	virtual void Unattach(GrSlotStream * /*psstrmIn*/, int /*islotIn*/,	// GrPosPass overrides
697+		GrSlotStream * /*psstrmOut*/, int /*islotOut*/, int /*islotLB*/)
698 	{
699 	}
700
701@@ -500,8 +500,8 @@
702
703 protected:
704 	//	Irrelevant when generating glyphs.
705-	virtual void RunRule(GrTableManager *, int ruln,
706-		GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
707+	virtual void RunRule(GrTableManager *, int /*ruln*/,
708+		GrSlotStream * /*psstrmInput*/, GrSlotStream * /*psstrmOutput*/)
709 	{
710 		Assert(false);
711 	}
712--- misc/silgraphite-2.3.1/engine/src/segment/GrPassActionCode.cpp	Wed Jan 28 04:01:29 2009
713+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrPassActionCode.cpp	Sat Aug 22 19:36:34 2009
714@@ -632,8 +632,13 @@
715 /*----------------------------------------------------------------------------------------------
716 	We are finished processing a slot; go on to the next slot, or possibly go backwards.
717 ----------------------------------------------------------------------------------------------*/
718-void GrPass::DoNext(GrTableManager * ptman,
719-	int cslot, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
720+#ifdef NDEBUG
721+void GrPass::DoNext(GrTableManager * /*ptman*/,
722+	int /*cslot*/, GrSlotStream * /*psstrmIn*/, GrSlotStream * /*psstrmOut*/)
723+#else
724+void GrPass::DoNext(GrTableManager * /*ptman*/,
725+	int cslot, GrSlotStream * /*psstrmIn*/, GrSlotStream * /*psstrmOut*/)
726+#endif
727 {
728 	gAssert(cslot == 1);	// for now anyway
729 }
730@@ -690,6 +695,7 @@
731 		psstrmOut->SetSegMinToWritePos(false);
732 	if (fSetSegLim)
733 		psstrmOut->SetSegLimToWritePos(false);
734+	//gid16 chw; chw = pslotNew->GlyphID();
735 	psstrmOut->NextPut(pslotNew);
736 }
737
738@@ -729,6 +735,7 @@
739 		psstrmOut->SetSegMinToWritePos(false);
740 	if (fSetSegLim)
741 		psstrmOut->SetSegLimToWritePos(false);
742+	//gid16 chw; chw = pslotNew->GlyphID();
743 	psstrmOut->NextPut(pslotNew);
744 }
745
746@@ -825,7 +832,7 @@
747 	@param psstrmIn / Out		- input/output streams
748 ----------------------------------------------------------------------------------------------*/
749 void GrPass::DoPutSubs3(GrTableManager * ptman, bool fInserting,
750-	int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int cslotSel3, int nSelClass3,
751+	int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int /*cslotSel3*/, int nSelClass3,
752 	int nReplacementClass,
753 	GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
754 {
755@@ -888,7 +895,7 @@
756 	Common part of all the DoPutSubs... methods.
757 ----------------------------------------------------------------------------------------------*/
758 void GrPass::DoPutSubsAux(GrTableManager * ptman, bool fInserting, gid16 nGlyphReplacement,
759-	GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, GrSlotState * pslotNextInput,
760+	GrSlotStream * /*psstrmIn*/, GrSlotStream * psstrmOut, GrSlotState * pslotNextInput,
761 	bool fAtSegMin, bool fAtSegLim)
762 {
763 	EngineState * pengst = ptman->State();
764@@ -915,6 +922,7 @@
765 		psstrmOut->SetSegMinToWritePos(false);
766 	if (fSetSegLim)
767 		psstrmOut->SetSegLimToWritePos(false);
768+	//gid16 chw; chw = pslotNew->GlyphID();
769 	psstrmOut->NextPut(pslotNew);
770 }
771
772@@ -924,7 +932,7 @@
773 	and its after-assoc to the slot before it. This makes it basically unselectable.
774 	OBSOLETE - handled by slot initialization code
775 ----------------------------------------------------------------------------------------------*/
776-void GrPass::SetNeutralAssocs(GrSlotState * pslotNew, GrSlotStream * psstrmIn)
777+void GrPass::SetNeutralAssocs(GrSlotState * pslotNew, GrSlotStream * /*psstrmIn*/)
778 {
779 	pslotNew->ClearAssocs();
780 }
781@@ -943,6 +951,7 @@
782 		psstrmOut->SetSegLimToWritePos();
783
784 	GrSlotState * pslot = psstrmIn->NextGet();
785+	//gid16 chw; chw = pslotNew->GlyphID();
786 	pslot->MarkDeleted();
787
788 	if (ptman->LoggingTransduction())
789@@ -957,7 +966,7 @@
790 	@param fInserting			- whether current slot was inserted
791 	@param psstrmIn / Out		- input/output streams
792 ----------------------------------------------------------------------------------------------*/
793-void GrPass::DoAssoc(int cnAssocs, std::vector<int> & vnAssocs, bool fInserting,
794+void GrPass::DoAssoc(int cnAssocs, std::vector<int> & vnAssocs, bool /*fInserting*/,
795 	GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
796 {
797 	gAssert((unsigned)cnAssocs == vnAssocs.size());
798@@ -997,7 +1006,11 @@
799 	@param vnStack				- stack to read value from
800 	@param psstrmIn / Out		- input/output streams
801 ----------------------------------------------------------------------------------------------*/
802+#ifdef NDEBUG
803+void GrPass::DoSetAttr(GrTableManager * ptman, ActionCommand op, bool /*fInserting*/,
804+#else
805 void GrPass::DoSetAttr(GrTableManager * ptman, ActionCommand op, bool fInserting,
806+#endif
807 	SlotAttrName slat, int slati, std::vector<int> & vnStack,
808 	GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
809 {
810@@ -1192,7 +1205,7 @@
811 	@param psstrmIn				- input stream
812 ----------------------------------------------------------------------------------------------*/
813 void GrPass::DoPushSlotAttr(GrTableManager * ptman,
814-	int nSlotRef, bool fInserting,
815+	int nSlotRef, bool /*fInserting*/,
816 	SlotAttrName slat, int slati, std::vector<int> & vnStack,
817 	GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
818 {
819@@ -1236,16 +1249,16 @@
820
821 	case kslatAttTo:		nVal = pslot->AttachTo();			break;
822 	case kslatAttLevel:		nVal = pslot->AttachLevel();		break;
823-	case kslatAttAtX:		nVal = pslot->AttachAtX(ptman, psstrmIn); break;
824 	case kslatAttAtY:		nVal = pslot->AttachAtY();			break;
825 	case kslatAttAtGpt:		nVal = pslot->AttachAtGpoint();		break;
826 	case kslatAttAtXoff:	nVal = pslot->AttachAtXOffset();	break;
827 	case kslatAttAtYoff:	nVal = pslot->AttachAtYOffset();	break;
828-	case kslatAttWithX:		nVal = pslot->AttachWithX(ptman, psstrmIn); break;
829 	case kslatAttWithY:		nVal = pslot->AttachWithY();		break;
830 	case kslatAttWithGpt:	nVal = pslot->AttachWithGpoint();	break;
831 	case kslatAttWithXoff:	nVal = pslot->AttachWithXOffset();	break;
832 	case kslatAttWithYoff:	nVal = pslot->AttachWithYOffset();	break;
833+	case kslatAttAtX:		nVal = pslot->AttachAtX(ptman, psstrmIn);	break;
834+	case kslatAttWithX:		nVal = pslot->AttachWithX(ptman, psstrmIn);	break;
835
836 	case kslatMeasureSol:	nVal = pslot->MeasureSol();			break;
837 	case kslatMeasureEol:	nVal = pslot->MeasureEol();			break;
838@@ -1282,7 +1295,7 @@
839 	@param vnStack				- stack to push onto
840 	@param psstrmIn				- input stream
841 ----------------------------------------------------------------------------------------------*/
842-void GrPass::DoPushGlyphAttr(GrTableManager * ptman, int nSlotRef, bool fInserting,
843+void GrPass::DoPushGlyphAttr(GrTableManager * ptman, int nSlotRef, bool /*fInserting*/,
844 	int nGlyphAttr,
845 	std::vector<int> & vnStack, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
846 {
847@@ -1307,7 +1320,7 @@
848 	@param vnStack				- stack to push onto
849 	@param psstrmIn				- input stream
850 ----------------------------------------------------------------------------------------------*/
851-void GrPass::DoPushAttToGlyphAttr(GrTableManager * ptman, int nSlotRef, bool fInserting,
852+void GrPass::DoPushAttToGlyphAttr(GrTableManager * ptman, int nSlotRef, bool /*fInserting*/,
853 	int nGlyphAttr, std::vector<int> & vnStack,
854 	GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
855 {
856@@ -1337,7 +1350,7 @@
857 	@param vnStack				- stack to push onto
858 	@param psstrmIn				- input stream
859 ----------------------------------------------------------------------------------------------*/
860-void GrPass::DoPushGlyphMetric(GrTableManager * ptman, int nSlotRef, bool fInserting,
861+void GrPass::DoPushGlyphMetric(GrTableManager * ptman, int nSlotRef, bool /*fInserting*/,
862 	int nGlyphAttr, int nAttLevel,
863 	std::vector<int> & vnStack, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
864 {
865@@ -1364,7 +1377,7 @@
866 	@param psstrmIn				- input stream
867 	@param psstrmOut			- output stream
868 ----------------------------------------------------------------------------------------------*/
869-void GrPass::DoPushAttToGlyphMetric(GrTableManager * ptman, int nSlotRef, bool fInserting,
870+void GrPass::DoPushAttToGlyphMetric(GrTableManager * ptman, int nSlotRef, bool /*fInserting*/,
871 	int nGlyphAttr, int nAttLevel,
872 	std::vector<int> & vnStack,
873 	GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
874@@ -1399,7 +1412,7 @@
875 	}
876 	else
877 	{
878-		pslot->CalcCompositeMetrics(ptman, psstrmIn, nAttLevel, true);
879+		pslot->CalcCompositeMetrics(ptman, psstrmIn, NULL, nAttLevel, true);
880
881 		float xy;
882 		switch (gmet)
883@@ -1435,7 +1448,11 @@
884 	@param psstrmIn				- input stream
885 	@param psstrmOut			- output stream
886 ----------------------------------------------------------------------------------------------*/
887-void GrPass::DoPushFeatValue(GrTableManager * ptman, int nSlotRef, bool fInserting,
888+#ifdef NDEBUG
889+void GrPass::DoPushFeatValue(GrTableManager * /*ptman*/, int nSlotRef, bool /*fInserting*/,
890+#else
891+void GrPass::DoPushFeatValue(GrTableManager * /*ptman*/, int nSlotRef, bool fInserting,
892+#endif
893 	int nFeat, std::vector<int> & vnStack, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
894 {
895 	gAssert(!fInserting);
896--- misc/silgraphite-2.3.1/engine/src/segment/GrSlotState.cpp	Wed Jan 28 04:01:29 2009
897+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrSlotState.cpp	Sat Aug 22 19:36:34 2009
898@@ -261,7 +261,7 @@
899 	root or attached leaf slots.
900 	OBSOLETE
901 ----------------------------------------------------------------------------------------------*/
902-void GrSlotState::FixAttachmentTree(GrSlotState * pslotOld)
903+void GrSlotState::FixAttachmentTree(GrSlotState * /*pslotOld*/)
904 {
905 #if 0
906 	pslotOld->m_vpslotAttLeaves.CopyTo(m_vpslotAttLeaves);
907@@ -524,13 +524,13 @@
908 		GrSlotState * pslot;
909 		if (HasComponents())
910 		{
911-			for (int iComponent = 0; iComponent < m_cnCompPerLig; iComponent++)
912+			for (int iLigComponent = 0; iLigComponent < m_cnCompPerLig; iLigComponent++)
913 			{
914-				pslot = CompRefSlot(iComponent);
915+				pslot = CompRefSlot(iLigComponent);
916 				if (pslot)
917 				{
918 					Assert(PassModified() >= pslot->PassModified());
919-					pslot->AllComponentRefs(vichw, vicomp, iComponent);
920+					pslot->AllComponentRefs(vichw, vicomp, iLigComponent);
921 				}
922 			}
923 		}
924@@ -1024,7 +1024,7 @@
925 	NOTE: the caller is responsible to zap the cached positions of following glyphs
926 	in the stream.
927 ----------------------------------------------------------------------------------------------*/
928-void GrSlotState::AttachToRoot(GrTableManager * ptman, GrSlotStream * psstrm,
929+void GrSlotState::AttachToRoot(GrTableManager * /*ptman*/, GrSlotStream * psstrm,
930 	GrSlotState * pslotNewRoot)
931 {
932 	GrSlotState * pslotOldRoot = (m_dislotRootFixed == 0) ?
933@@ -1063,7 +1063,7 @@
934
935 	float xsWidth, xsVisWidth;
936 	if (m_xsPositionX == kNegInfFloat || m_ysPositionY == kNegInfFloat)
937-		ptman->CalcPositionsUpTo(psstrmOut->m_ipass, this, &xsWidth, &xsVisWidth);
938+		ptman->CalcPositionsUpTo(psstrmOut->m_ipass, this, true, &xsWidth, &xsVisWidth);
939
940 	*pmXPos = ptman->LogToEmUnits(m_xsPositionX);
941 	*pmYPos = ptman->LogToEmUnits(m_ysPositionY);
942@@ -1077,7 +1077,7 @@
943 {
944 	Assert(m_dislotRootFixed == m_srAttachTo);
945 	GrSlotState * pslotRoot = AttachRoot(psstrm);
946-	CalcRootMetrics(ptman, psstrm, kPosInfinity);
947+	CalcRootMetrics(ptman, psstrm, NULL, kPosInfinity);
948 	if (pslotRoot)
949 		pslotRoot->AdjustRootMetrics(ptman, psstrm);
950 }
951@@ -1086,13 +1086,15 @@
952 	Calculate the composite metrics for this slot.
953
954 	@param psstrm			- stream for which we are calculating it
955+	@param psstrmNext		- because when processing in the middle of a pass, we may need to
956+								get the slot from the following (output) stream
957 	@param nLevel			- attachment level we are asking for; kPosInifinity means all levels
958 	@param fThorough		- true: do a thorough recalculation; false: don't recalculate
959 								metrics for leaves (are they assumed to be accurate???)
960 								--currently not used
961 ----------------------------------------------------------------------------------------------*/
962 void GrSlotState::CalcCompositeMetrics(GrTableManager * ptman, GrSlotStream * psstrm,
963-	int nLevel, bool fThorough)
964+	GrSlotStream * psstrmNext, int nLevel, bool fThorough)
965 {
966 	if (m_nCompositeLevel == nLevel)
967 		return;
968@@ -1101,19 +1103,38 @@
969 	{
970 		Assert(m_dislotRootFixed == m_srAttachTo);
971 		GrSlotState * pslotRoot = AttachRoot(psstrm);
972+		// Kludge to handle the fact that we might have gotten the root from the wrong stream.
973+		// Calling MidPassSlotAt finds the right one.
974+		if (psstrmNext && pslotRoot)
975+		{
976+			int islotRoot = pslotRoot->PosPassIndex();
977+			pslotRoot = psstrm->MidPassSlotAt(islotRoot, psstrmNext);
978+		}
979
980 		InitMetrics(ptman, pslotRoot);
981
982 		for (size_t islot = 0; islot < m_vdislotAttLeaves.size(); islot++)
983 		{
984-			GrSlotState * pslotLeaf = SlotAtOffset(psstrm, m_vdislotAttLeaves[islot]);
985+			GrSlotState * pslotLeaf;
986+			if (psstrmNext)
987+			{
988+				// Calculating a position in the middle of processing a pass.
989+				pslotLeaf = psstrm->MidPassSlotAt(PosPassIndex() + m_vdislotAttLeaves[islot],
990+					psstrmNext);
991+			}
992+			else
993+			{
994+				// Calculating the final position.
995+				pslotLeaf = SlotAtOffset(psstrm, m_vdislotAttLeaves[islot]);
996+			}
997+
998 			if (pslotLeaf->AttachLevel() <= nLevel)
999-				pslotLeaf->CalcCompositeMetrics(ptman, psstrm, nLevel, fThorough);
1000+				pslotLeaf->CalcCompositeMetrics(ptman, psstrm, psstrmNext, nLevel, fThorough);
1001 			else
1002 				//	this slot will be ignored in the composite metrics
1003 				pslotLeaf->ZapRootMetrics();
1004 		}
1005-		CalcRootMetrics(ptman, psstrm, nLevel);
1006+		CalcRootMetrics(ptman, psstrm, psstrmNext, nLevel);
1007
1008 		m_nCompositeLevel = nLevel;
1009 	}
1010@@ -1129,25 +1150,33 @@
1011 /*----------------------------------------------------------------------------------------------
1012 	Calculate the metrics for this node and all its leaf nodes.
1013 ----------------------------------------------------------------------------------------------*/
1014-void GrSlotState::CalcRootMetrics(GrTableManager * ptman, GrSlotStream * psstrm, int nLevel)
1015+void GrSlotState::CalcRootMetrics(GrTableManager * /*ptman*/, GrSlotStream * psstrm,
1016+	GrSlotStream * psstrmNext, int nLevel)
1017 {
1018 	for (size_t idislot = 0; idislot < m_vdislotAttLeaves.size(); idislot++)
1019 	{
1020-		GrSlotState * pslot = SlotAtOffset(psstrm, m_vdislotAttLeaves[idislot]);
1021-		if (pslot->AttachLevel() > nLevel)
1022+		GrSlotState * pslotLeaf = SlotAtOffset(psstrm, m_vdislotAttLeaves[idislot]);
1023+		// Kludge to handle the fact that we might have gotten the leaf from the wrong stream.
1024+		// Calling MidPassSlotAt finds the right one.
1025+		if (psstrmNext)
1026+		{
1027+			int islot = pslotLeaf->PosPassIndex();
1028+			pslotLeaf = psstrm->MidPassSlotAt(islot, psstrmNext);
1029+		}
1030+		if (pslotLeaf->AttachLevel() > nLevel)
1031 			continue;
1032
1033-		m_xsClusterXOffset = min(m_xsClusterXOffset, pslot->m_xsClusterXOffset);
1034-		if (!pslot->m_fIgnoreAdvance)
1035+		m_xsClusterXOffset = min(m_xsClusterXOffset, pslotLeaf->m_xsClusterXOffset);
1036+		if (!pslotLeaf->m_fIgnoreAdvance)
1037 		{
1038 			m_xsClusterAdv = max(
1039 				m_xsClusterAdv,
1040-				pslot->m_xsClusterAdv + m_xsRootShiftX);
1041+				pslotLeaf->m_xsClusterAdv + m_xsRootShiftX);
1042 		}
1043-		m_xsClusterBbLeft = min(m_xsClusterBbLeft, pslot->m_xsClusterBbLeft);
1044-		m_xsClusterBbRight = max(m_xsClusterBbRight, pslot->m_xsClusterBbRight);
1045-		m_ysClusterBbTop = max(m_ysClusterBbTop, pslot->m_ysClusterBbTop);
1046-		m_ysClusterBbBottom = min(m_ysClusterBbBottom, pslot->m_ysClusterBbBottom);
1047+		m_xsClusterBbLeft = min(m_xsClusterBbLeft, pslotLeaf->m_xsClusterBbLeft);
1048+		m_xsClusterBbRight = max(m_xsClusterBbRight, pslotLeaf->m_xsClusterBbRight);
1049+		m_ysClusterBbTop = max(m_ysClusterBbTop, pslotLeaf->m_ysClusterBbTop);
1050+		m_ysClusterBbBottom = min(m_ysClusterBbBottom, pslotLeaf->m_ysClusterBbBottom);
1051 	}
1052 }
1053
1054@@ -1263,7 +1292,7 @@
1055 /*----------------------------------------------------------------------------------------------
1056 	Y-offsets of a single glyph relative to the previous advance position.
1057 ----------------------------------------------------------------------------------------------*/
1058-float GrSlotState::GlyphYOffset(GrSlotStream * psstrm)
1059+float GrSlotState::GlyphYOffset(GrSlotStream * /*psstrm*/)
1060 {
1061 	return m_ysOffsetY;
1062 }
1063--- misc/silgraphite-2.3.1/engine/src/segment/GrSlotState.h	Wed Jan 28 04:01:29 2009
1064+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrSlotState.h	Sat Aug 22 19:36:34 2009
1065@@ -308,7 +308,11 @@
1066 	{
1067 		return m_islotPosPass;
1068 	}
1069+#ifdef NDEBUG
1070+	void SetPosPassIndex(int islot, bool /*fInputToPosPass1*/)
1071+#else
1072 	void SetPosPassIndex(int islot, bool fInputToPosPass1)
1073+#endif
1074 	{
1075 		// If we're resetting it, it should be to the same value as before:
1076 		Assert(fInputToPosPass1 || m_islotPosPass == kNotYetSet || m_islotPosPass == islot);
1077@@ -386,12 +390,12 @@
1078 		return (IsInitialLineBreak(chwLB) || IsFinalLineBreak(chwLB));
1079 		//return (m_chwGlyphID == chwLB); // TODO: remove
1080 	}
1081-	bool IsInitialLineBreak(gid16 chwLB)
1082+	bool IsInitialLineBreak(gid16 /*chwLB*/)
1083 	{
1084 		return (m_spsl == kspslLbInitial);
1085 		//return (IsLineBreak(chwLB) && m_fInitialLB == true); // TODO: remove
1086 	}
1087-	bool IsFinalLineBreak(gid16 chwLB)
1088+	bool IsFinalLineBreak(gid16 /*chwLB*/)
1089 	{
1090 		return (m_spsl == kspslLbFinal);
1091 		//return (IsLineBreak(chwLB) && m_fInitialLB == false); // TODO: remove
1092@@ -475,7 +479,7 @@
1093 		return m_mAttachAtX;
1094 	}
1095
1096-	int AttachWithX(GrTableManager * ptman, GrSlotStream * psstrm)
1097+	int AttachWithX(GrTableManager * /*ptman*/, GrSlotStream * /*psstrm*/)
1098 	{
1099 		if (m_mAttachAtX == kNotYetSet)
1100 		{
1101@@ -615,7 +619,7 @@
1102 		GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis);
1103
1104 	void CalcCompositeMetrics(GrTableManager * ptman, GrSlotStream * psstrm,
1105-		int nLevel, bool fThorough = false);
1106+		GrSlotStream * psstrmNext, int nLevel, bool fThorough = false);
1107
1108 	void Position(GrTableManager * ptman,
1109 		GrSlotStream * psstrmOut, int * pmXPos, int * pmYPos);
1110@@ -646,7 +650,7 @@
1111 	{
1112 		return ClusterBbLeft(psstrm) + xs;
1113 	}
1114-	float ClusterRsb(GrSlotStream * psstrm, float xs)
1115+	float ClusterRsb(GrSlotStream * /*psstrm*/, float xs)
1116 	{
1117 		return ClusterAdvWidthFrom(xs) - ClusterBbRightFrom(xs);
1118 	}
1119@@ -668,19 +672,19 @@
1120 	{
1121 		return ClusterBbRightFrom(Base(psstrm)->ClusterRootOffset());
1122 	}
1123-	float ClusterBbTop(GrSlotStream * psstrm)
1124+	float ClusterBbTop(GrSlotStream * /*psstrm*/)
1125 	{
1126 		return m_ysClusterBbTop;
1127 	}
1128-	float ClusterBbBottom(GrSlotStream * psstrm)
1129+	float ClusterBbBottom(GrSlotStream * /*psstrm*/)
1130 	{
1131 		return m_ysClusterBbBottom;
1132 	}
1133-	float ClusterBbWidth(GrSlotStream * psstrm)
1134+	float ClusterBbWidth(GrSlotStream * /*psstrm*/)
1135 	{
1136 		return m_xsClusterBbRight - m_xsClusterBbLeft + 1;
1137 	}
1138-	float ClusterBbHeight(GrSlotStream * psstrm)
1139+	float ClusterBbHeight(GrSlotStream * /*psstrm*/)
1140 	{
1141 		return m_ysClusterBbTop - m_ysClusterBbBottom + 1;
1142 	}
1143@@ -990,7 +994,8 @@
1144 	void InitMetrics(GrTableManager * ptman, GrSlotState * pslotRoot);
1145 	void InitLeafMetrics(GrTableManager * ptman, GrSlotState * pslotRoot);
1146 	void InitRootMetrics(GrTableManager * ptman);
1147-	void CalcRootMetrics(GrTableManager * ptman, GrSlotStream *, int nLevel);
1148+	void CalcRootMetrics(GrTableManager * ptman, GrSlotStream * psstrm,
1149+		GrSlotStream * psstrmNext, int nLevel);
1150 	void AttachToRoot(GrTableManager * ptman, GrSlotStream *, GrSlotState * pslotNewRoot);
1151 	void AttachLogUnits(GrTableManager * ptman,
1152 		GrSlotState * pslotRoot,
1153--- misc/silgraphite-2.3.1/engine/src/segment/GrSlotStream.cpp	Wed Feb 04 07:53:26 2009
1154+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrSlotStream.cpp	Sat Aug 22 19:36:34 2009
1155@@ -189,12 +189,16 @@
1156 	stream position when the rule is being run.
1157
1158 	@param dislot		- how far back to peek before the write position
1159-							when the rule started; a negative number
1160+							WHEN THE RULE STARTED; a negative number
1161 							(NOTE: the current write position is irrelevant)
1162 	@param fNullOkay	- true if it's okay to return NULL in the situation where we're asking
1163 							for something before the beginning of the stream
1164 ----------------------------------------------------------------------------------------------*/
1165+#ifdef NDEBUG
1166+GrSlotState * GrSlotStream::PeekBack(int dislot, bool /*fNullOkay*/)
1167+#else
1168 GrSlotState * GrSlotStream::PeekBack(int dislot, bool fNullOkay)
1169+#endif
1170 {
1171 	Assert(dislot < 0);
1172 	if (dislot < m_islotRuleStartWrite * -1)
1173@@ -1104,6 +1108,7 @@
1174 	case kdircRLO:
1175 	case kdircRLE:
1176 	case kdircPdfR:
1177+	case kdircRlb:
1178 		return true;
1179
1180 	case kdircNeutral:
1181@@ -1212,7 +1217,7 @@
1182 			return true;
1183
1184 		float xsWidth, xsVisWidth;
1185-		ptman->CalcPositionsUpTo(m_ipass, NULL, &xsWidth, &xsVisWidth);
1186+		ptman->CalcPositionsUpTo(m_ipass, NULL, false, &xsWidth, &xsVisWidth);
1187
1188 		*pxsWidth = (fIgnoreTrailingWS || twsh == ktwshOnlyWs) ? xsVisWidth : xsWidth;
1189         return (*pxsWidth < xsSpaceAllotted);
1190@@ -1322,7 +1327,7 @@
1191 	@param islotMin			- first slot that is officially part of the segment (after initial LB)
1192 ----------------------------------------------------------------------------------------------*/
1193 int GrSlotStream::MakeSegmentBreak(GrTableManager * ptman,
1194-	int islotPrevBreak, bool fInsertedLB, int islotStartTry,
1195+	int /*islotPrevBreak*/, bool /*fInsertedLB*/, int islotStartTry,
1196 	LineBrk lb, TrWsHandling twsh, int islotMin,
1197 	LineBrk * plbNextToTry)
1198 {
1199@@ -1576,7 +1581,11 @@
1200 	Return the break weight of the given slot, which should be a line-break.
1201 	OBSOLETE??
1202 ----------------------------------------------------------------------------------------------*/
1203+#ifdef NDEBUG
1204+LineBrk GrSlotStream::BreakWeightAt(gid16 /*chwLB*/, int islot)
1205+#else
1206 LineBrk GrSlotStream::BreakWeightAt(gid16 chwLB, int islot)
1207+#endif
1208 {
1209 	GrSlotState * pslot = GetSlotAt(islot);
1210 	Assert(pslot->IsLineBreak(chwLB));
1211@@ -1769,7 +1778,7 @@
1212 	@param fBackingUp		- this chunk results in the stream position moving backwards,
1213 								so clear anything we're backing over
1214 ----------------------------------------------------------------------------------------------*/
1215-void GrSlotStream::MapInputChunk(int islotInputMin, int islotOutputMin, int islotInputLim,
1216+void GrSlotStream::MapInputChunk(int islotInputMin, int islotOutputMin, int /*islotInputLim*/,
1217 	bool fSkipChunkStart, bool fBackingUp)
1218 {
1219 	Assert(AssertValid());
1220@@ -1828,7 +1837,7 @@
1221 	@param fBackingUp		- this chunk results in the stream position moving backwards,
1222 								so clear anything we're backing over
1223 ----------------------------------------------------------------------------------------------*/
1224-void GrSlotStream::MapOutputChunk(int islotOutputMin, int islotInputMin, int islotOutputLim,
1225+void GrSlotStream::MapOutputChunk(int islotOutputMin, int islotInputMin, int /*islotOutputLim*/,
1226 	bool fSkipChunkStart, int cslotReprocess, bool fBackingUp)
1227 {
1228 	Assert(AssertValid());
1229@@ -1863,7 +1872,11 @@
1230 	Ensure that the chunk maps for a pair of streams match properly. The recipient is
1231 	the input stream.
1232 ----------------------------------------------------------------------------------------------*/
1233+#ifdef _DEBUG
1234 void GrSlotStream::AssertChunkMapsValid(GrSlotStream * psstrmOut)
1235+#else
1236+void GrSlotStream::AssertChunkMapsValid(GrSlotStream * )
1237+#endif
1238 {
1239 #ifdef _DEBUG
1240 	GrSlotStream * psstrmIn = this;
1241@@ -1915,7 +1924,11 @@
1242 	Ensure that corresponding items in the streams of a positioning pass have matching
1243 	stream indices. The recipient is the output stream.
1244 ----------------------------------------------------------------------------------------------*/
1245+#ifdef _DEBUG
1246 void GrSlotStream::AssertStreamIndicesValid(GrSlotStream * psstrmIn)
1247+#else
1248+void GrSlotStream::AssertStreamIndicesValid(GrSlotStream * )
1249+#endif
1250 {
1251 #ifdef _DEBUG
1252 	if (!GotIndexOffset())
1253@@ -1939,7 +1948,11 @@
1254 	in the output stream. (Currently the compiler ensures this by making it an error
1255 	to write rules that don't do this.)
1256 ----------------------------------------------------------------------------------------------*/
1257+#ifdef _DEBUG
1258 void GrSlotStream::AssertAttachmentsInOutput(int islotMin, int islotLim)
1259+#else
1260+void GrSlotStream::AssertAttachmentsInOutput(int , int )
1261+#endif
1262 {
1263 #ifdef _DEBUG
1264 	for (int islot = islotMin; islot < islotLim; islot++)
1265@@ -2007,7 +2016,11 @@
1266 	Record the number of slots in the stream that are previous to the official start of the
1267 	segment.
1268 ----------------------------------------------------------------------------------------------*/
1269+#ifdef _DEBUG
1270 void GrSlotStream::CalcIndexOffset(GrTableManager * ptman)
1271+#else
1272+void GrSlotStream::CalcIndexOffset(GrTableManager * )
1273+#endif
1274 {
1275 	if (GotIndexOffset())
1276 		return; // already figured it
1277@@ -2203,6 +2212,21 @@
1278 }
1279
1280 /*----------------------------------------------------------------------------------------------
1281+	In the middle of running a pass, return the given slot to use in processing.
1282+	Read it from the reprocess buffer if appropriate, or for slots previous to the current
1283+	position, read from the output stream (psstrmNext).
1284+
1285+	psstrmNext may be NULL when processing is complete, therefore we only have one stream to
1286+	deal with.
1287+----------------------------------------------------------------------------------------------*/
1288+GrSlotState * GrSlotStream::MidPassSlotAt(int islot, GrSlotStream * psstrmNext)
1289+{
1290+	int islotInput = islot - ReadPosForNextGet() + 1; // +1 because RuleInputSlot takes 0 to mean the previously read slot
1291+	GrSlotState * pslot = RuleInputSlot(islotInput, psstrmNext);
1292+	return pslot;
1293+}
1294+
1295+/*----------------------------------------------------------------------------------------------
1296 	Return the "current" input item from the rule's perspective, ie, the last slot read.
1297 	So dislotOffset = 0 means not the slot at the read position but one slot earlier.
1298
1299@@ -2214,7 +2238,6 @@
1300 	@param fNullOkay	- true if it's okay to return NULL in the situation where we're asking
1301 							for something before the beginning of the stream
1302 ----------------------------------------------------------------------------------------------*/
1303-
1304 GrSlotState * GrSlotStream::RuleInputSlot(int dislotOffset, GrSlotStream * psstrmOutput,
1305 	bool fNullOkay)
1306 {
1307@@ -2244,8 +2267,10 @@
1308
1309 			if (cslotOffsetBack >= cslotPostReproc + cslotValidReproc)
1310 			{
1311-				// Read from the output stream.
1312-				int dislotTmp = dislotOffset - 1 + cslotPostReproc + cslotValidReproc;
1313+				// Read from the output stream. (Remember that PeekBack works relative to
1314+				// the rule-start write position, not the current write position.)
1315+				int dislotTmp = dislotOffset - 1 + cslotPostReproc
1316+					+ cslotValidReproc - SlotsToReprocess();
1317 				Assert(dislotTmp < 0);
1318 				return psstrmOutput->PeekBack(dislotTmp);
1319 			}
1320@@ -2253,7 +2278,7 @@
1321 			{
1322 				if (m_islotReprocPos > -1)
1323 				{
1324-					//	Current read pos is inside reprocess buffer.
1325+					//	Current read pos could be inside reprocess buffer.
1326 					Assert(cslotPostReproc == 0);
1327 					int islotStartReadReprocBuf = m_vpslotReproc.size() - cslotValidReproc;
1328 					Assert(islotStartReadReprocBuf >= 0);
1329@@ -2342,9 +2367,10 @@
1330 			else if (pslotAfter)
1331 				pslot->Associate(pslotAfter);
1332 			else
1333+			{
1334 				// Weird, but can happen with an empty segment.
1335 				Warn("No assocations");
1336-
1337+			}
1338 //			Assert(pslot->m_vpslotAssoc.Size() > 0);
1339 			pslot->m_fNeutralAssocs = true;
1340 		}
1341--- misc/silgraphite-2.3.1/engine/src/segment/GrSlotStream.h	Thu Jan 22 00:36:42 2009
1342+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrSlotStream.h	Sat Aug 22 19:36:34 2009
1343@@ -107,7 +107,7 @@
1344 		ReleaseSlots(0, m_vpslot.size());
1345 	}
1346
1347-	void ReleaseSlots(int islotMin, int islotLim)
1348+	void ReleaseSlots(int /*islotMin*/, int /*islotLim*/)
1349 	{
1350 		//	A slot stream is responsible for deleting the slot states that it created,
1351 		//	that is, the ones whose modified tag equals this stream's pass index.
1352@@ -182,6 +182,7 @@
1353 		return Peek(islot - ReadPosForNextGet());
1354 	}
1355
1356+	//	Return the functional read position, taking into account the reprocess buffer.
1357 	int ReadPosForNextGet()
1358 	{
1359 		return ReadPos() - SlotsToReprocess();
1360@@ -260,12 +261,16 @@
1361
1362 	void MarkFullyWritten();
1363
1364+#ifdef NDEBUG
1365+	void SetSegMin(int islot, bool /*fAdjusting*/ = false)
1366+#else
1367 	void SetSegMin(int islot, bool fAdjusting = false)
1368+#endif
1369 	{
1370 		Assert(fAdjusting || m_islotSegMin == -1 || m_islotSegMin == islot);
1371 		m_islotSegMin = islot;
1372 	}
1373-	void SetSegMinToWritePos(bool fMod = true)
1374+	void SetSegMinToWritePos(bool /*fMod*/ = true)
1375 	{
1376 		if (m_islotSegMin == -1)
1377 			m_islotSegMin = m_islotWritePos;
1378@@ -456,6 +461,7 @@
1379 		}
1380 	}
1381
1382+	GrSlotState * MidPassSlotAt(int islot, GrSlotStream * psstrmNext = NULL);
1383 	GrSlotState * RuleInputSlot(int dislot = 0, GrSlotStream * psstrmOut = NULL,
1384 		bool fNullOkay = false);
1385 	GrSlotState * RuleOutputSlot(int dislot = 0);
1386--- misc/silgraphite-2.3.1/engine/src/segment/GrTableManager.cpp	Wed Jan 28 04:01:29 2009
1387+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrTableManager.cpp	Sat Aug 22 19:36:34 2009
1388@@ -25,8 +25,8 @@
1389 DEFINE_THIS_FILE
1390 #ifndef _WIN32
1391 #include <stdlib.h>
1392-#include <math.h>
1393 #endif
1394+#include <math.h>
1395
1396 //:>********************************************************************************************
1397 //:>	Forward declarations
1398@@ -572,7 +572,7 @@
1399 		else
1400 		{
1401 			Assert(!m_engst.m_fInsertedLB);
1402-			Assert(islotUnderBreak == -1 || m_engst.m_fFinalLB);
1403+			//Assert(islotUnderBreak == -1 || m_engst.m_fFinalLB); -- no, ExtendGlyphIDOutput clearly sets islotUnderBreak regardless
1404 		}
1405 		int islotTmp = OutputStream(m_cpass - 1)->WritePos();
1406 		GrSlotState * pslotTmp;
1407@@ -931,7 +931,7 @@
1408 	@param plbFound			- kind of line-break created
1409 ----------------------------------------------------------------------------------------------*/
1410 bool GrTableManager::Backtrack(int * pislotPrevBreak,
1411-	LineBrk * plbMin, LineBrk lbMax, TrWsHandling twsh, bool fMoreText,
1412+	LineBrk * plbMin, LineBrk lbMax, TrWsHandling twsh, bool /*fMoreText*/,
1413 	int ichwCallerBtLim, bool fEndLine,
1414 	LineBrk * plbFound)
1415 {
1416@@ -1343,7 +1343,7 @@
1417 	Calculate the associations, and record the output slots in the segment.
1418 ----------------------------------------------------------------------------------------------*/
1419 void GrTableManager::RecordAssocsAndOutput(Font * pfont,
1420-	Segment * pseg, bool fWidthIsCharCount,
1421+	Segment * pseg, bool /*fWidthIsCharCount*/,
1422 	TrWsHandling twsh, bool fParaRtl, int nDirDepth)
1423 {
1424 	int cchwUnderlying = pseg->stopCharacter() - pseg->startCharacter();
1425@@ -1362,7 +1362,7 @@
1426 #endif // OLD_TEST_STUFF
1427
1428 	//	Make sure the final positions are set for every glyph.
1429-	CalcPositionsUpTo(m_cpass-1, reinterpret_cast<GrSlotState *>(NULL),
1430+	CalcPositionsUpTo(m_cpass-1, reinterpret_cast<GrSlotState *>(NULL), false,
1431 		&xsTotalWidth, &xsVisWidth);
1432 	pseg->SetWidths(xsVisWidth, xsTotalWidth);
1433
1434@@ -1377,7 +1377,7 @@
1435 	Calculate the underlying-to-surface associations and ligature mappings.
1436 	Assumes the arrays have been properly initialized.
1437 ----------------------------------------------------------------------------------------------*/
1438-void GrTableManager::CalculateAssociations(Segment * pseg, int csloutSurface)
1439+void GrTableManager::CalculateAssociations(Segment * pseg, int /*csloutSurface*/)
1440 {
1441 	GrSlotStream * psstrmFinal = OutputStream(m_cpass-1);
1442
1443@@ -2350,18 +2350,20 @@
1444 								final pass, but it could be another if positions are
1445 								requested by the rules themselves
1446 	@param pslotLast		- last slot that needs to be positioned, or NULL
1447+	@param fMidPass			- calculating the position of some slot in the middle of the pass
1448 	@param pxsWidth			- return the total width used so far
1449 	@param psxVisibleWidth	- return the visible width so far
1450
1451 	MOVE to EngineState
1452 ----------------------------------------------------------------------------------------------*/
1453-void GrTableManager::CalcPositionsUpTo(int ipass, GrSlotState * pslotLast,
1454+void GrTableManager::CalcPositionsUpTo(int ipass, GrSlotState * pslotLast, bool fMidPass,
1455 	float * pxsWidth, float * pxsVisibleWidth)
1456 {
1457 	Assert(ipass >= m_ipassPos1 - 1);
1458
1459 	int isstrm = ipass;
1460 	GrSlotStream * psstrm = OutputStream(isstrm);
1461+	GrSlotStream * psstrmNext = (isstrm >= m_cpass - 1) ? NULL : OutputStream(isstrm + 1);
1462 	Assert(psstrm->GotIndexOffset());
1463 	if (psstrm->WritePos() <= psstrm->IndexOffset())
1464 	{
1465@@ -2399,7 +2401,9 @@
1466 	//	to be later in the stream than the last actual slot passed in.
1467 	if (!psstrm->HasSlotAtPosPassIndex(pslotLast->AttachRootPosPassIndex()))
1468 		return;
1469-	GrSlotState * pslotLastBase = pslotLast->Base(psstrm);
1470+	GrSlotState * pslotLastBase = (fMidPass && pslotLast->PosPassIndex() < psstrm->WritePos())
1471+		? pslotLast->Base(psstrmNext)
1472+		: pslotLast->Base(psstrm);
1473
1474 	if (ipass == m_cpass - 1 && m_engst.m_islotPosNext > -1)
1475 	{
1476@@ -2428,6 +2432,7 @@
1477 	}
1478
1479 	std::vector<GrSlotState *> vpslotAttached;
1480+	std::vector<GrSlotStream *> vpsstrmAttached;
1481
1482 	bool fRtl = RightToLeft();
1483
1484@@ -2435,13 +2440,24 @@
1485 	{
1486 		Assert(islot < psstrm->SlotsPresent());
1487
1488-		pslot = (isstrm == ipass) ?	psstrm->SlotAt(islot) :	psstrm->OutputSlotAt(islot);
1489+		GrSlotStream * psstrmThis = psstrm;
1490+		if (fMidPass && islot < psstrm->WritePos())
1491+		{
1492+			pslot = psstrm->MidPassSlotAt(islot, psstrmNext);
1493+			psstrmThis = psstrmNext;
1494+		}
1495+		else
1496+		{
1497+			//pslot = (isstrm == ipass) ?	psstrm->SlotAt(islot) :	psstrm->OutputSlotAt(islot);
1498+			pslot = psstrm->SlotAt(islot);
1499+		}
1500
1501 		if (!pslot->IsBase())
1502 		{
1503 			//	This slot is attached to another; it will be positioned strictly
1504 			//	relative to that one. This happens in the loop below.
1505 			vpslotAttached.push_back(pslot);
1506+			vpsstrmAttached.push_back(psstrmThis);
1507 		}
1508 		else
1509 		{
1510@@ -2455,7 +2471,7 @@
1511 			}
1512
1513 			//	Make sure the metrics are the complete ones.
1514-			pslot->CalcCompositeMetrics(this, psstrm, kPosInfinity, true);
1515+			pslot->CalcCompositeMetrics(this, psstrm, psstrmNext, kPosInfinity, true);
1516
1517 			float xsInc = pslot->GlyphXOffset(psstrm, fakeItalicRatio);
1518 			float ysInc = pslot->GlyphYOffset(psstrm);
1519@@ -2514,8 +2530,9 @@
1520
1521 	for (size_t ipslot = 0; ipslot < vpslotAttached.size(); ipslot++)
1522 	{
1523-		GrSlotState * pslot = vpslotAttached[ipslot];
1524-		GrSlotState * pslotBase = pslot->Base(psstrm);
1525+		GrSlotState * pslotAtt = vpslotAttached[ipslot];
1526+		GrSlotStream * psstrmAtt = vpsstrmAttached[ipslot];
1527+		GrSlotState * pslotBase = pslotAtt->Base(psstrmAtt);
1528 		if (pslotBase->XPosition() == kNegInfinity || pslotBase->YPosition() == kNegInfinity)
1529 		{
1530 			Assert(false);
1531@@ -2523,10 +2540,10 @@
1532 		}
1533 		float xsCluster = pslotBase->XPosition() - pslotBase->GlyphXOffset(psstrm, fakeItalicRatio);
1534 		float ysCluster = pslotBase->YPosition() - pslotBase->GlyphYOffset(psstrm);
1535-		float xsInc = pslot->GlyphXOffset(psstrm, fakeItalicRatio);
1536-		float ysInc = pslot->GlyphYOffset(psstrm);
1537-		pslot->SetXPos(xsCluster + xsInc);
1538-		pslot->SetYPos(ysCluster + ysInc);
1539+		float xsInc = pslotAtt->GlyphXOffset(psstrm, fakeItalicRatio);
1540+		float ysInc = pslotAtt->GlyphYOffset(psstrm);
1541+		pslotAtt->SetXPos(xsCluster + xsInc);
1542+		pslotAtt->SetYPos(ysCluster + ysInc);
1543
1544 		//	My theory is that we don't need to adjust *pxsWidth here, because the width of
1545 		//	any non-base slots should be factored into the advance width of their cluster
1546--- misc/silgraphite-2.3.1/engine/src/segment/GrTableManager.h	Wed Jan 28 04:01:29 2009
1547+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrTableManager.h	Sat Aug 22 19:36:35 2009
1548@@ -442,7 +442,7 @@
1549 	int LogToEmUnits(float xys);
1550 	bool GPointToXY(gid16 chwGlyphID, int nGPoint, float * xs, float * ys);
1551
1552-	void CalcPositionsUpTo(int ipass, GrSlotState * pslotLast,
1553+	void CalcPositionsUpTo(int ipass, GrSlotState * pslotLast, bool fMidPass,
1554 		float * pxsWidth, float * pxsVisibleWidth);
1555
1556 	void InitPosCache()
1557--- misc/silgraphite-2.3.1/engine/src/segment/Platform.cpp	Thu Jan 22 00:36:42 2009
1558+++ misc/build/silgraphite-2.3.1/engine/src/segment/Platform.cpp	Sat Aug 22 19:36:35 2009
1559@@ -103,7 +103,7 @@
1560 {
1561 	// assumes NULL terminated strings
1562 	const utf16 *start = s;
1563-	for (; *s; ++s);
1564+	for (; *s; ++s) {};
1565
1566 	return s - start;
1567 }
1568--- misc/silgraphite-2.3.1/engine/src/segment/Segment.cpp	Thu Aug 21 16:24:32 2008
1569+++ misc/build/silgraphite-2.3.1/engine/src/segment/Segment.cpp	Sat Aug 22 19:36:35 2009
1570@@ -1178,7 +1178,7 @@
1571 	part of the segment.
1572 ----------------------------------------------------------------------------------------------*/
1573 float Segment::getRangeWidth(int ichMin, int ichLim,
1574-	bool fStartLine, bool fEndLine, bool fSkipSpace)
1575+	bool /*fStartLine*/, bool /*fEndLine*/, bool fSkipSpace)
1576 {
1577 	if (m_dxsWidth < 0)
1578 	{
1579@@ -1549,7 +1549,11 @@
1580 void Segment::SetUpOutputArrays(Font * pfont, GrTableManager * ptman,
1581 	GrSlotStream * psstrmFinal,
1582 	int cchwInThisSeg, int csloutSurface, gid16 chwLB,
1583+#ifdef NDEBUG
1584+	TrWsHandling twsh, bool fParaRtl, int nDirDepth, bool /*fEmpty*/)
1585+#else
1586 	TrWsHandling twsh, bool fParaRtl, int nDirDepth, bool fEmpty)
1587+#endif
1588 {
1589 	m_mFontEmUnits = EngineImpl()->GetFontEmUnits();
1590
1591@@ -1725,7 +1729,7 @@
1592 	Set up the data structures that represent the actual rendered glyphs for the new segment.
1593 ----------------------------------------------------------------------------------------------*/
1594 void Segment::SetUpGlyphInfo(GrTableManager * ptman, GrSlotStream * psstrmFinal,
1595-	gid16 chwLB, int nDirDepth, int islotMin, int cslot)
1596+	gid16 chwLB, int /*nDirDepth*/, int islotMin, int cslot)
1597 {
1598 	//int paraDirLevel = (ptman->State()->ParaRightToLeft()) ? 1 : 0;
1599
1600@@ -1751,7 +1755,7 @@
1601
1602 	m_isloutGinf0 = -1;
1603 	int iginf = 0;
1604-	for (int islot = islotMin; islot < cslot; islot++)
1605+	for (islot = islotMin; islot < cslot; islot++)
1606 	{
1607 		GrSlotState * pslot = psstrmFinal->SlotAt(islot);
1608
1609@@ -2160,7 +2164,7 @@
1610 	@param ichwUnder		- character index relative to the official beginning of the segment
1611 	@param islot			- processed glyph it maps to
1612 ----------------------------------------------------------------------------------------------*/
1613-void Segment::MarkSlotInPrevSeg(int ichwUnder, int islot)
1614+void Segment::MarkSlotInPrevSeg(int ichwUnder, int /*islot*/)
1615 {
1616 	if (ichwUnder >= m_ichwAssocsMin)
1617 		m_prgisloutBefore[ichwUnder - m_ichwAssocsMin] = kNegInfinity;
1618@@ -2174,7 +2178,7 @@
1619 	@param ichwUnder		- character index relative to the official beginning of the segment
1620 	@param islot			- processed glyph it maps to
1621 ----------------------------------------------------------------------------------------------*/
1622-void Segment::MarkSlotInNextSeg(int ichwUnder, int islot)
1623+void Segment::MarkSlotInNextSeg(int ichwUnder, int /*islot*/)
1624 {
1625 	if (ichwUnder < m_ichwAssocsLim)
1626 		m_prgisloutAfter[ichwUnder - m_ichwAssocsMin] = kPosInfinity;
1627@@ -2351,7 +2355,7 @@
1628 	@param pfAfter			- return true if they clicked on trailing side; possibly NULL
1629 ----------------------------------------------------------------------------------------------*/
1630 int Segment::LogicalSurfaceToUnderlying(int islout, float xsOffset, float ysClick,
1631-	float dxsGlyphWidth, float dysGlyphHeight, bool * pfAfter)
1632+	float dxsGlyphWidth, float /*dysGlyphHeight*/, bool * pfAfter)
1633 {
1634 	Assert(islout >= 0);
1635 	Assert(islout < m_cslout);
1636@@ -2529,31 +2533,31 @@
1637 	else if (fBefore)
1638 	{
1639 		int isloutRet;
1640-		int ichw = ichwSegOffset;
1641+		int ichwTemp = ichwSegOffset;
1642 		//	If no association has been made, loop forward to the next slot
1643 		//	we are before. As a last resort, answer kPosInfinity, meaning we
1644 		//	aren't before anything.
1645 		do
1646 		{
1647-			isloutRet = m_prgisloutBefore[ichw - m_ichwAssocsMin];
1648-			do { ++ichw; }
1649-			while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichw));
1650-		} while (isloutRet == kPosInfinity && ichw < m_ichwAssocsLim);
1651+			isloutRet = m_prgisloutBefore[ichwTemp - m_ichwAssocsMin];
1652+			do { ++ichwTemp; }
1653+			while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichwTemp));
1654+		} while (isloutRet == kPosInfinity && ichwTemp < m_ichwAssocsLim);
1655 		return isloutRet;
1656 	}
1657 	else
1658 	{
1659 		int isloutRet;
1660-		int ichw = ichwSegOffset;
1661+		int ichwTemp = ichwSegOffset;
1662 		//	If no association has been made, loop backward to the previous slot
1663 		//	we are after. As a last resort, answer kNegInfinity, meaning we
1664 		//	aren't after anything.
1665 		do
1666 		{
1667-			isloutRet = m_prgisloutAfter[ichw - m_ichwAssocsMin];
1668-			do { --ichw; }
1669-			while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichw));
1670-		} while (isloutRet == kNegInfinity && ichw >= 0);
1671+			isloutRet = m_prgisloutAfter[ichwTemp - m_ichwAssocsMin];
1672+			do { --ichwTemp; }
1673+			while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichwTemp));
1674+		} while (isloutRet == kNegInfinity && ichwTemp >= 0);
1675 		return isloutRet;
1676 	}
1677 	Assert(false); // should never reach here
1678@@ -2748,7 +2752,11 @@
1679 	that root glyph as one of its roots.
1680 	OBSOLETE
1681 ----------------------------------------------------------------------------------------------*/
1682+#ifdef _DEBUG
1683 void Segment::AssertValidClusters(GrSlotStream * psstrm)
1684+#else
1685+void Segment::AssertValidClusters(GrSlotStream * /*psstrm*/)
1686+#endif
1687 {
1688 #ifdef _DEBUG
1689 	for (int islot = 0; islot < psstrm->WritePos(); islot++)
1690--- misc/silgraphite-2.3.1/engine/src/segment/TransductionLog.cpp	Wed Jan 28 04:01:29 2009
1691+++ misc/build/silgraphite-2.3.1/engine/src/segment/TransductionLog.cpp	Sat Aug 22 19:36:35 2009
1692@@ -175,7 +175,7 @@
1693 	Output a file showing a log of the transduction process and the resulting segment.
1694 ----------------------------------------------------------------------------------------------*/
1695 void GrTableManager::WriteXductnLog(std::ostream & strmOut,
1696-	GrCharStream * pchstrm, Segment * psegRet,
1697+	GrCharStream * pchstrm, Segment * /*psegRet*/,
1698 	int cbPrevSegDat, byte * pbPrevSegDat)
1699 {
1700 	if (cbPrevSegDat == 0)
1701@@ -416,8 +416,8 @@
1702 	the raw (UTF-16 or UTF-8) chars for display. To do this we get the raw characters
1703 	directly from the text source.
1704 ----------------------------------------------------------------------------------------------*/
1705-void GrCharStream::GetLogDataRaw(GrTableManager * ptman, int cchl, int cchrBackup,
1706-	int cchrMaxRaw, int * prgchl,
1707+void GrCharStream::GetLogDataRaw(GrTableManager * /*ptman*/, int cchl, int cchrBackup,
1708+	int /*cchrMaxRaw*/, int * prgchl,
1709 	utf16 * prgchw2, utf16 * prgchw3, utf16 * prgchw4, utf16 * prgchw5, utf16 * prgchw6,
1710 	int * prgcchr)
1711 {
1712@@ -441,7 +441,7 @@
1713 	case kutf8:
1714 		prgchsRunText8 = new utf8[cchrRange];
1715 		m_pgts->fetch(ichrMin, cchrRange, prgchsRunText8);
1716-		for (int ichr = 0; ichr < cchrRange; ichr++)
1717+		for (ichr = 0; ichr < cchrRange; ichr++)
1718 			prgchwRunText[ichr] = (utf16)prgchsRunText8[ichr];	// zero-extend into UTF-16 buffer
1719 		break;
1720 	case kutf16:
1721@@ -634,7 +634,7 @@
1722 	m_pzpst->LogRulesFiredAndFailed(strmOut, psstrmIn);
1723 }
1724
1725-void PassState::LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * psstrmIn)
1726+void PassState::LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * /*psstrmIn*/)
1727 {
1728
1729 	strmOut << "PASS " << m_ipass << "\n\n" << "Rules matched: ";
1730@@ -1193,7 +1193,7 @@
1731 	if (fAnyPseudos)
1732 	{
1733 		strmOut << "Actual glyphs: ";
1734-		for (int islout = 0; islout < m_cslout; islout++)
1735+		for (islout = 0; islout < m_cslout; islout++)
1736 		{
1737 			GrSlotOutput * psloutTmp = m_prgslout + islout;
1738 			if (psloutTmp->GlyphID() != psloutTmp->ActualGlyphForOutput(ptman))
1739@@ -1319,7 +1319,7 @@
1740 	Write out the header lines for the slot contents.
1741 ----------------------------------------------------------------------------------------------*/
1742 void GrTableManager::LogSlotHeader(std::ostream & strmOut, int islotLim,
1743-	int cspPerSlot, int cspLeading, int islotMin)
1744+	int /*cspPerSlot*/, int cspLeading, int islotMin)
1745 {
1746 	islotLim = min(islotLim, MAX_SLOTS);
1747
1748@@ -1721,7 +1721,7 @@
1749
1750 	case kslatAttAtX:	// always do these in pairs
1751 	case kslatAttAtY:
1752-		if (m_mAttachAtX != (pslotPrev ? pslotPrev->m_mAttachAtX : kNotYetSet) ||
1753+		if (m_mAttachAtX != (pslotPrev ? pslotPrev->m_mAttachAtX : static_cast<short>(kNotYetSet)) ||
1754 			m_mAttachAtY != (pslotPrev ? pslotPrev->m_mAttachAtY : 0))
1755 		{
1756 			ptman->LogInTable(strmOut,
1757@@ -1730,7 +1730,7 @@
1758 		}
1759 		break;
1760 	case kslatAttAtGpt:
1761-		if (m_nAttachAtGpoint != (pslotPrev ? pslotPrev->m_nAttachAtGpoint : kNotYetSet))
1762+		if (m_nAttachAtGpoint != (pslotPrev ? pslotPrev->m_nAttachAtGpoint : static_cast<short>(kNotYetSet)))
1763 		{
1764 			ptman->LogInTable(strmOut,
1765 				((m_nAttachAtGpoint == kGpointZero) ? 0 : m_nAttachAtGpoint));
1766@@ -1750,7 +1750,7 @@
1767
1768 	case kslatAttWithX:	// always do these in pairs
1769 	case kslatAttWithY:
1770-		if (m_mAttachWithX != (pslotPrev ? pslotPrev->m_mAttachWithX : kNotYetSet) ||
1771+		if (m_mAttachWithX != (pslotPrev ? pslotPrev->m_mAttachWithX : static_cast<short>(kNotYetSet)) ||
1772 			m_mAttachWithY != (pslotPrev ? pslotPrev->m_mAttachWithY : 0))
1773 		{
1774 			ptman->LogInTable(strmOut,
1775@@ -1759,7 +1759,7 @@
1776 		}
1777 		break;
1778 	case kslatAttWithGpt:
1779-		if (m_nAttachWithGpoint != (pslotPrev ? pslotPrev->m_nAttachWithGpoint : kNotYetSet))
1780+		if (m_nAttachWithGpoint != (pslotPrev ? pslotPrev->m_nAttachWithGpoint : static_cast<short>(kNotYetSet)))
1781 		{
1782 			ptman->LogInTable(strmOut,
1783 				((m_nAttachWithGpoint == kGpointZero) ? 0 : m_nAttachWithGpoint));
1784@@ -1786,14 +1786,14 @@
1785 		break;
1786
1787 	case kslatBreak:
1788-		if (m_lb != (pslotPrev ? pslotPrev->m_lb : kNotYetSet8))
1789+		if (m_lb != (pslotPrev ? pslotPrev->m_lb : static_cast<sdata8>(kNotYetSet8)))
1790 		{
1791 			ptman->LogBreakWeightInTable(strmOut, m_lb);
1792 			return;
1793 		}
1794 		break;
1795 	case kslatDir:
1796-		if (m_dirc != (pslotPrev ? pslotPrev->m_dirc : kNotYetSet8))
1797+		if (m_dirc != (pslotPrev ? pslotPrev->m_dirc : static_cast<sdata8>(kNotYetSet8)))
1798 		{
1799 			ptman->LogDirCodeInTable(strmOut, m_dirc);
1800 			return;
1801--- misc/silgraphite-2.3.1/engine/test/ProfileHarness/GrUtfTextSrc.cpp	Thu Jan 22 00:36:42 2009
1802+++ misc/build/silgraphite-2.3.1/engine/test/ProfileHarness/GrUtfTextSrc.cpp	Sat Aug 22 19:36:35 2009
1803@@ -210,12 +210,12 @@
1804 }
1805
1806
1807-bool GrUtfTextSrc::getRightToLeft(gr::toffset ich)
1808+bool GrUtfTextSrc::getRightToLeft(gr::toffset /*ich*/)
1809 {
1810 	return mRtl; // assumes src only contains one direction
1811 }
1812
1813-unsigned int GrUtfTextSrc::getDirectionDepth(gr::toffset ich)
1814+unsigned int GrUtfTextSrc::getDirectionDepth(gr::toffset /*ich*/)
1815 {
1816 	return (mRtl) ? 1 : 0; // TBD
1817 }
1818@@ -254,7 +254,7 @@
1819 	return range;
1820 }
1821
1822-size_t GrUtfTextSrc::getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset)
1823+size_t GrUtfTextSrc::getFontFeatures(gr::toffset /*ich*/, gr::FeatureSetting * /*prgfset*/)
1824 {
1825 	return 0;
1826 }
1827@@ -277,14 +277,14 @@
1828
1829 // these should be called I hope
1830 float
1831-GrUtfTextSrc::getFontSize(gr::toffset ich)
1832+GrUtfTextSrc::getFontSize(gr::toffset /*ich*/)
1833 {
1834 	assert(mFont);
1835 	return mPointSize;
1836 }
1837
1838 bool
1839-GrUtfTextSrc::getBold(gr::toffset ich)
1840+GrUtfTextSrc::getBold(gr::toffset /*ich*/)
1841 {
1842 	assert(mFont);
1843 //	NS_ASSERTION(false, "unexpected call to getBold");
1844@@ -293,7 +293,7 @@
1845 }
1846
1847 bool
1848-GrUtfTextSrc::getItalic(gr::toffset ich)
1849+GrUtfTextSrc::getItalic(gr::toffset /*ich*/)
1850 {
1851 	assert(mFont);
1852 	//NS_ASSERTION(false, "unexpected call to getItalic");
1853@@ -301,7 +301,7 @@
1854 	return mFont->italic();
1855 }
1856
1857-gr::isocode GrUtfTextSrc::getLanguage(gr::toffset ich)
1858+gr::isocode GrUtfTextSrc::getLanguage(gr::toffset /*ich*/)
1859 {
1860   gr::isocode unknown;
1861   std::fill_n(unknown.rgch, 4, '\0');
1862--- misc/silgraphite-2.3.1/engine/test/ProfileHarness/GrUtfTextSrc.h	Thu Jan 22 00:36:42 2009
1863+++ misc/build/silgraphite-2.3.1/engine/test/ProfileHarness/GrUtfTextSrc.h	Sat Aug 22 19:36:35 2009
1864@@ -79,7 +79,7 @@
1865   virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf32 * prgchBuffer);
1866   virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer);
1867   virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf8  * prgchsBuffer);
1868-  virtual gr::GrResult getFaceName(int ich, unsigned int cchMax,
1869+  virtual gr::GrResult getFaceName(int /*ich*/, unsigned int /*cchMax*/,
1870     gr::utf16 * prgchFaceName, unsigned int * pcchLen)
1871   {
1872     prgchFaceName[0] = 0;
1873@@ -92,12 +92,12 @@
1874   virtual bool getItalic(gr::toffset ich);
1875   virtual bool getRightToLeft(gr::toffset ich);
1876   virtual unsigned int getDirectionDepth(gr::toffset ich);
1877-  virtual float getVerticalOffset(gr::toffset ich) { return 0;};
1878+  virtual float getVerticalOffset(gr::toffset /*ich*/) { return 0;};
1879   virtual gr::isocode getLanguage(gr::toffset ich);
1880
1881   virtual std::pair<gr::toffset, gr::toffset> propertyRange(gr::toffset ich);
1882   virtual size_t getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset);
1883-  virtual bool sameSegment(gr::toffset ich1, gr::toffset ich2) { return true; };
1884+  virtual bool sameSegment(gr::toffset /*ich1*/, gr::toffset /*ich2*/) { return true; };
1885
1886 protected:
1887   bool checkBuffer8();
1888@@ -129,11 +129,11 @@
1889   virtual void getColors(gr::toffset ich, int * pclrFore, int * pclrBack);
1890
1891   // Shouldn't be here!
1892-  virtual gr::GrResult Fetch(int ichMin, int ichLim, gr::utf16 * prgchBuf) { return gr::kresNotImpl; };
1893-  virtual gr::GrResult get_Length(int * pcch) { return gr::kresNotImpl; };
1894-  virtual gr::GrResult GetFontVariations(int ich,
1895-    wchar_t * prgchFontVar, int ichMax, int * pich,
1896-    int * pichMin, int * pichLim) { return gr::kresNotImpl; };
1897+  virtual gr::GrResult Fetch(int /*ichMin*/, int /*ichLim*/, gr::utf16 * /*prgchBuf*/) { return gr::kresNotImpl; };
1898+  virtual gr::GrResult get_Length(int * /*pcch*/) { return gr::kresNotImpl; };
1899+  virtual gr::GrResult GetFontVariations(int /*ich*/,
1900+    wchar_t * /*prgchFontVar*/, int /*ichMax*/, int * /*pich*/,
1901+    int * /*pichMin*/, int * /*pichLim*/) { return gr::kresNotImpl; };
1902
1903 };
1904
1905--- misc/silgraphite-2.3.1/engine/test/ProfileHarness/ProfileHarness.cpp	Thu Jan 22 00:36:42 2009
1906+++ misc/build/silgraphite-2.3.1/engine/test/ProfileHarness/ProfileHarness.cpp	Sat Aug 22 19:36:35 2009
1907@@ -39,14 +39,14 @@
1908 typedef std::pair< gr::GlyphIterator, gr::GlyphIterator > GlyphRange;
1909
1910 #ifndef HAVE_STRTOF
1911-float strtof(char * text, char ** ignore)
1912+float strtof(char * text, char ** /*ignore*/)
1913 {
1914   return static_cast<float>(atof(text));
1915 }
1916 #endif
1917
1918 #ifndef HAVE_STRTOL
1919-long strtol(char * text, char ** ignore)
1920+long strtol(char * text, char ** /*ignore*/)
1921 {
1922   return atol(text);
1923 }
1924--- misc/silgraphite-2.3.1/engine/test/RegressionTest/GrJustifier.cpp	Thu Jan 22 00:36:42 2009
1925+++ misc/build/silgraphite-2.3.1/engine/test/RegressionTest/GrJustifier.cpp	Sat Aug 22 19:36:35 2009
1926@@ -327,7 +327,7 @@
1927 					&dxStretchAchieved);
1928 				for (int iiiGlyph = 0; iiiGlyph < cStretchable; iiiGlyph++)
1929 				{
1930-					int iiGlyph = viiGlyphsRem[iiiGlyph];
1931+					iiGlyph = viiGlyphsRem[iiiGlyph];
1932 					vdxStretchLeft[iiGlyph] = vdxStretchRem[iiiGlyph];
1933 					vdxWidth[iiGlyph] = vdxWidthRem[iiiGlyph];
1934 				}
1935--- misc/silgraphite-2.3.1/engine/test/RegressionTest/RegressionTest.cpp	Thu Jan 22 00:36:42 2009
1936+++ misc/build/silgraphite-2.3.1/engine/test/RegressionTest/RegressionTest.cpp	Sat Aug 22 19:36:35 2009
1937@@ -675,7 +675,7 @@
1938 	OutputErrorAux(ptcase, strErr, i, true, valueFound, valueExpected);
1939 }
1940
1941-void OutputErrorAux(TestCase * ptcase, std::string strErr, int i,
1942+void OutputErrorAux(TestCase * /*ptcase*/, std::string strErr, int i,
1943 	bool showValues, int valueFound, int valueExpected)
1944 {
1945 //	if (g_debugMode)
1946--- misc/silgraphite-2.3.1/engine/test/RegressionTest/SimpleTextSrc.cpp	Thu Jan 22 00:36:42 2009
1947+++ misc/build/silgraphite-2.3.1/engine/test/RegressionTest/SimpleTextSrc.cpp	Sat Aug 22 19:36:36 2009
1948@@ -70,7 +70,7 @@
1949 /*----------------------------------------------------------------------------------------------
1950 	Return true if the text uses a right-to-left writing system.
1951 ----------------------------------------------------------------------------------------------*/
1952-bool SimpleTextSrc::getRightToLeft(toffset ich)
1953+bool SimpleTextSrc::getRightToLeft(toffset /*ich*/)
1954 {
1955 	return false;
1956 }
1957@@ -78,7 +78,7 @@
1958 /*----------------------------------------------------------------------------------------------
1959 	Return the depth of embedding of the writing system.
1960 ----------------------------------------------------------------------------------------------*/
1961-unsigned int SimpleTextSrc::getDirectionDepth(toffset ich)
1962+unsigned int SimpleTextSrc::getDirectionDepth(toffset /*ich*/)
1963 {
1964 	return 0;
1965 }
1966@@ -87,7 +87,7 @@
1967 	Return the vertical offset of the text. This simple implementation provides no
1968 	vertical offset.
1969 ----------------------------------------------------------------------------------------------*/
1970-float SimpleTextSrc::getVerticalOffset(toffset ich)
1971+float SimpleTextSrc::getVerticalOffset(toffset /*ich*/)
1972 {
1973 	return 0;
1974 }
1975--- misc/silgraphite-2.3.1/engine/test/RegressionTest/SimpleTextSrc.h	Thu Jan 22 00:36:42 2009
1976+++ misc/build/silgraphite-2.3.1/engine/test/RegressionTest/SimpleTextSrc.h	Sat Aug 22 19:36:36 2009
1977@@ -59,12 +59,12 @@
1978 	{
1979 		return m_cchLength;
1980 	}
1981-	virtual size_t fetch(toffset ichMin, size_t cch, utf32 * prgchBuffer)
1982+	virtual size_t fetch(toffset /*ichMin*/, size_t /*cch*/, utf32 * /*prgchBuffer*/)
1983 	{
1984 		throw;
1985 	}
1986 	virtual size_t fetch(toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer);
1987-	virtual size_t fetch(toffset ichMin, size_t cch, utf8  * prgchsBuffer)
1988+	virtual size_t fetch(toffset /*ichMin*/, size_t /*cch*/, utf8  * /*prgchsBuffer*/)
1989 	{
1990 		throw;
1991 	};
1992@@ -73,14 +73,14 @@
1993 	virtual unsigned int getDirectionDepth(toffset ich);
1994 	virtual float getVerticalOffset(toffset ich);
1995
1996-	virtual isocode getLanguage(toffset ich)
1997+	virtual isocode getLanguage(toffset /*ich*/)
1998 	{
1999 		isocode ret;
2000 		ret.rgch[0] = 'e'; ret.rgch[1] = 'n'; ret.rgch[2] = 0; ret.rgch[3] = 0;
2001 		return ret;
2002 	}
2003
2004-	virtual std::pair<toffset, toffset> propertyRange(toffset ich)
2005+	virtual std::pair<toffset, toffset> propertyRange(toffset /*ich*/)
2006 	{
2007 		std::pair<toffset, toffset> pairRet;
2008 		pairRet.first = 0;
2009@@ -88,16 +88,16 @@
2010 		return pairRet;
2011 	}
2012
2013-	virtual size_t getFontFeatures(toffset ich, FeatureSetting * prgfset)
2014+	virtual size_t getFontFeatures(toffset /*ich*/, FeatureSetting * /*prgfset*/)
2015 	{
2016 		return 0; // no features in this simple implementation
2017 	}
2018-	virtual bool sameSegment(toffset ich1, toffset ich2)
2019+	virtual bool sameSegment(toffset /*ich1*/, toffset /*ich2*/)
2020 	{
2021 		return true;
2022 	}
2023
2024-	virtual void getColors(toffset ich, int * pclrFore, int * pclrBack)
2025+	virtual void getColors(toffset /*ich*/, int * pclrFore, int * pclrBack)
2026 	{
2027 		*pclrFore = kclrBlack;
2028 		*pclrBack = kclrTransparent;
2029--- misc/silgraphite-2.3.1/wrappers/win32/WinFont.cpp	Thu Jan 29 10:33:19 2009
2030+++ misc/build/silgraphite-2.3.1/wrappers/win32/WinFont.cpp	Sat Aug 22 19:36:36 2009
2031@@ -70,6 +72,7 @@
2032 	// But don't store m_hfont, because we don't really "own" it; the client is
2033 	// responsible for releasing it.
2034 	m_hfont = 0;
2035+    m_pGlyphMetricMap = NULL;
2036 	memset(&m_fpropSet, 0, sizeof(m_fpropSet));
2037
2038 	m_pbCmapTbl = NULL;
2039@@ -196,6 +198,7 @@
2040 	m_hdc = 0;
2041 	m_hfont = 0;
2042 	m_hfontClient = 0;
2043+    m_pGlyphMetricMap = NULL;
2044 	memset(&m_fpropSet, 0, sizeof(FontProps));
2045
2046 	m_pbCmapTbl = NULL;
2047@@ -408,7 +410,7 @@
2048 					if (pPolyCurve->wType == TT_PRIM_QSPLINE &&
2049 						// test if this is the last curve
2050 						pPolyHdr->cb - (int)((byte *)(&pPolyCurve->apfx[j]) - (byte *)(pPolyHdr))
2051-							== sizeof POINTFX &&
2052+							== sizeof (POINTFX) &&
2053 						// and the two points are identical
2054 						CompareFixed(pPolyCurve->apfx[j].x, pPolyHdr->pfxStart.x) &&
2055 						CompareFixed(pPolyCurve->apfx[j].y, pPolyHdr->pfxStart.y))
2056@@ -457,6 +459,16 @@
2057 ----------------------------------------------------------------------------------------------*/
2058 void WinFont::getGlyphMetrics(gid16 chw, gr::Rect & boundingBox, gr::Point & advances)
2059 {
2060+    if (m_pGlyphMetricMap)
2061+    {
2062+        GlyphMetricMap::iterator i = m_pGlyphMetricMap->find(chw);
2063+        if (i != m_pGlyphMetricMap->end())
2064+        {
2065+            boundingBox = i->second.first;
2066+            advances = i->second.second;
2067+            return;
2068+        }
2069+    }
2070 	GLYPHMETRICS gm;
2071 	const MAT2 mat2 = {{0,1}, {0,0}, {0,0}, {0,1}};
2072 	if (GDI_ERROR == ::GetGlyphOutline(m_hdc, chw, GGO_GLYPH_INDEX | GGO_METRICS,
2073@@ -474,6 +476,10 @@
2074 	boundingBox.bottom = (float)gm.gmptGlyphOrigin.y - gm.gmBlackBoxY;
2075 	advances.x = gm.gmCellIncX;
2076 	advances.y = gm.gmCellIncY;
2077+    if (m_pGlyphMetricMap)
2078+    {
2079+        (*m_pGlyphMetricMap)[chw] = std::pair<gr::Rect,gr::Point>(boundingBox, advances);
2080+    }
2081 }
2082
2083 /*----------------------------------------------------------------------------------------------
2084@@ -618,7 +620,10 @@
2085
2086 		static int cCreateFontCalls = 0;
2087 		static int cCreateFontZero = 0;
2088-		HFONT hfont = g_fhc.GetFont(lf);
2089+        FontHandleCache::FontCacheValue cache = g_fhc.GetCache(lf);
2090+        HFONT hfont = cache.hfont;
2091+        m_pGlyphMetricMap = cache.pGlyphMetricMap;
2092+		//HFONT hfont = g_fhc.GetFont(lf);
2093 		//char ch1[200];
2094 		//if (hfont == 0)
2095 		//{
2096@@ -731,7 +733,7 @@
2097 	@param lf LOGFONT value that describes the desired font
2098 	@return Font handle
2099 ----------------------------------------------------------------------------------------------*/
2100-HFONT WinFont::FontHandleCache::GetFont(LOGFONT & lf)
2101+WinFont::FontHandleCache::FontCacheValue WinFont::FontHandleCache::GetCache(LOGFONT & lf)
2102 {
2103 	FontCacheValue fcv;
2104 	FontHandleHashMap::iterator itFound = m_hmlffcv.find(lf);
2105@@ -752,11 +754,12 @@
2106 			THROW(kresFail);
2107
2108 		fcv.nRefs = 1;
2109+        fcv.pGlyphMetricMap = new GlyphMetricMap();
2110
2111 		m_hmlffcv.insert(std::pair<LOGFONT, FontCacheValue>(lf, fcv));
2112 	}
2113
2114-	return fcv.hfont;
2115+	return fcv;
2116 }
2117
2118 /*----------------------------------------------------------------------------------------------
2119@@ -767,7 +767,7 @@
2120 ----------------------------------------------------------------------------------------------*/
2121 void WinFont::FontHandleCache::DeleteFont(HFONT hfont)
2122 {
2123-	if (!hfont || !m_bValid)
2124+	if (!hfont || !m_bValid || m_hmlffcv.size() == 0)
2125 		return;
2126
2127 	// find the font in the hash map
2128@@ -782,6 +784,8 @@
2129 			{
2130 				// delete font
2131 				::DeleteObject(hfont);
2132+                if (fcv.pGlyphMetricMap)
2133+                    delete fcv.pGlyphMetricMap;
2134 				m_hmlffcv.erase(it);
2135 			}
2136 			else
2137@@ -832,7 +832,8 @@
2138 bool WinFont::LogFontHashFuncs::operator() (const WinFont::LogFontWrapper & key1,
2139 	const WinFont::LogFontWrapper & key2) const
2140 {
2141-	return (key1 == key2);
2142+    // return true if key1 should be ordered before key2
2143+    return (operator()(key1) < operator()(key2));
2144 }
2145
2146 /*--------------------------------------------------------------------------------------
2147--- misc/silgraphite-2.3.1/wrappers/win32/WinFont.h	Thu Jan 29 10:33:19 2009
2148+++ misc/build/silgraphite-2.3.1/wrappers/win32/WinFont.h	Sat Aug 22 19:36:36 2009
2149@@ -27,7 +27,13 @@
2150 #include "GrClient.h"
2151 #include "Font.h"
2152+#include <map>
2153
2154+#ifdef _STLPORT_VERSION
2155+namespace stdext = _STLP_STD;
2156+#endif
2157+
2158 namespace gr
2159 {
2160+typedef std::map<gid16, std::pair<gr::Rect, gr::Point> > GlyphMetricMap;
2161
2162 class FontFace;
2163@@ -100,6 +110,7 @@
2164 	HFONT m_hfontClient;	// need to replace this HFONT into the DC when we are finished
2165 							// with it
2166
2167+    GlyphMetricMap * m_pGlyphMetricMap;
2168 	// Debugging:
2169 	//OLECHAR m_rgchTemp[32];
2170
2171@@ -185,11 +196,13 @@
2172 	class FontHandleCache // hungarian: fhc
2173 	{
2174 	public:
2175-		struct FontCacheValue
2176+        struct FontCacheValue
2177 		{
2178 			int nRefs;   // reference count
2179 			HFONT hfont; // font handle
2180
2181+            GlyphMetricMap * pGlyphMetricMap; // glyph metrics
2182+
2183 			bool operator==(const FontCacheValue & val) const
2184 			{
2185 				return (hfont == val.hfont);
2186@@ -199,7 +212,8 @@
2187         FontHandleCache() : m_bValid(true) {};
2188 		~FontHandleCache();
2189
2190-		HFONT GetFont(LOGFONT & lf);
2191+		//HFONT GetFont(LOGFONT & lf);
2192+        FontCacheValue GetCache(LOGFONT & lf);
2193 		void DeleteFont(HFONT hfont);
2194
2195 		typedef stdext::hash_map<LogFontWrapper, FontCacheValue, LogFontHashFuncs> FontHandleHashMap;
2196--- misc/build/silgraphite-2.3.1/engine/test/RegressionTest/RtTextSrc.h~	2009-01-22 05:06:42.000000000 +0630
2197+++ misc/build/silgraphite-2.3.1/engine/test/RegressionTest/RtTextSrc.h	2010-04-30 23:14:49.000000000 +0630
2198@@ -44,18 +44,18 @@
2199 		}
2200 	}
2201
2202-	virtual size_t getFontFeatures(toffset ich, FeatureSetting * prgfset)
2203+	virtual size_t getFontFeatures(toffset /*ich*/, FeatureSetting * prgfset)
2204 	{
2205 		// Note: size of prgfset buffer = gr::kMaxFeatures = 64
2206 		std::copy(m_fset, m_fset + MAXFEAT, prgfset);
2207 		return m_cFeats;
2208 	}
2209
2210-	virtual bool getRightToLeft(toffset ich)
2211+	virtual bool getRightToLeft(toffset /*ich*/)
2212 	{
2213 		return m_fRtl;
2214 	}
2215-	virtual unsigned int getDirectionDepth(toffset ich)
2216+	virtual unsigned int getDirectionDepth(toffset /*ich*/)
2217 	{
2218 		return ((m_fRtl == 1) ? 1 : 0);
2219 	}
2220
2221--- misc/build/silgraphite-2.3.1/engine/test/RegressionTest/GrJustifier.cpp	2010-06-21 12:55:34.000000000 +0630
2222+++ misc/build/silgraphite-2.3.1/engine/test/RegressionTest/GrJustifier.cpp	2010-06-21 13:16:59.000000000 +0630
2223@@ -16,8 +16,9 @@
2224 //:>	Include files
2225 //:>********************************************************************************************
2226 //#include "main.h" // This is used by clients, so main.h is not available
2227-
2228+#ifdef _MSC_VER
2229 #pragma hdrstop
2230+#endif
2231 // any other headers (not precompiled)
2232 #include "GrClient.h"
2233 #include "ITextSource.h"
2234@@ -31,9 +32,6 @@
2235 #include <string>
2236 #endif
2237
2238-#undef THIS_FILE
2239-DEFINE_THIS_FILE
2240-
2241 //:>********************************************************************************************
2242 //:>	Global constants
2243 //:>********************************************************************************************
2244@@ -327,9 +325,9 @@
2245 					&dxStretchAchieved);
2246 				for (int iiiGlyph = 0; iiiGlyph < cStretchable; iiiGlyph++)
2247 				{
2248-					iiGlyph = viiGlyphsRem[iiiGlyph];
2249-					vdxStretchLeft[iiGlyph] = vdxStretchRem[iiiGlyph];
2250-					vdxWidth[iiGlyph] = vdxWidthRem[iiiGlyph];
2251+					int ivGlyph = viiGlyphsRem[iiiGlyph];
2252+					vdxStretchLeft[ivGlyph] = vdxStretchRem[iiiGlyph];
2253+					vdxWidth[ivGlyph] = vdxWidthRem[iiiGlyph];
2254 				}
2255 			}
2256 			else
2257@@ -366,12 +364,12 @@
2258 	{
2259 #ifdef WIN32
2260 		wchar_t rgchw[20];
2261-		std::fill_n(rgchw, 20, 0);
2262+		std::fill_n(rgchw, 20, L'\0');
2263 		_itow(dxStretchNeeded - dxStretchAchieved, rgchw, 10);
2264 		std::wstring strTmp(L"justification failed by ");
2265 		strTmp += rgchw;
2266 		strTmp += L" units (width needed = ";
2267-		std::fill_n(rgchw, 10, 0);
2268+		std::fill_n(rgchw, 10, L'\0');
2269 		_itow(dxDesiredWidth, rgchw, 10);
2270 		strTmp += rgchw;
2271 		strTmp += L")\n";
2272--- misc/build/silgraphite-2.3.1/engine/test/RegressionTest/GrJustifier.h	2009-01-22 05:06:42.000000000 +0630
2273+++ misc/build/silgraphite-2.3.1/engine/test/RegressionTest/GrJustifier.h	2010-06-21 13:16:49.000000000 +0630
2274@@ -11,7 +11,9 @@
2275 Description:
2276 	A default justification agent for Graphite.
2277 -------------------------------------------------------------------------------*//*:End Ignore*/
2278+#ifdef _MSC_VER
2279 #pragma once
2280+#endif
2281 #ifndef GRJUSTIFIER_INCLUDED
2282 #define GRJUSTIFIER_INCLUDED
2283
2284--- misc/build/silgraphite-2.3.1/engine/test/RegressionTest/SimpleTextSrc.h	2010-06-21 12:55:34.000000000 +0630
2285+++ misc/build/silgraphite-2.3.1/engine/test/RegressionTest/SimpleTextSrc.h	2010-06-21 13:18:12.000000000 +0630
2286@@ -11,7 +11,9 @@
2287 Description:
2288 	A simple text source that shows how to use this interface within Graphite.
2289 -------------------------------------------------------------------------------*//*:End Ignore*/
2290+#ifdef _MSC_VER
2291 #pragma once
2292+#endif
2293 #ifndef GRTXTSRC_INCLUDED
2294 #define GRTXTSRC_INCLUDED
2295
2296
2297--- misc/build/silgraphite-2.3.1/engine/test/RegressionTest/SimpleTextSrc.cpp	2010-06-21 12:55:34.000000000 +0630
2298+++ misc/build/silgraphite-2.3.1/engine/test/RegressionTest/SimpleTextSrc.cpp	2010-06-21 13:18:24.000000000 +0630
2299@@ -15,7 +15,9 @@
2300 //:>********************************************************************************************
2301 //:>	Include files
2302 //:>********************************************************************************************
2303+#ifdef _MSC_VER
2304 #pragma hdrstop
2305+#endif
2306 // any other headers (not precompiled)
2307
2308 #include "GrClient.h"
2309@@ -23,9 +25,6 @@
2310 #include "ITextSource.h"
2311 #include "SimpleTextSrc.h"
2312
2313-#undef THIS_FILE
2314-DEFINE_THIS_FILE
2315-
2316 //:>********************************************************************************************
2317 //:>	Initialization and destruction
2318 //:>********************************************************************************************
2319--- misc/build/silgraphite-2.3.1/engine/src/segment/MemoryUsage.cpp	2009-01-22 05:06:42.000000000 +0630
2320+++ misc/build/silgraphite-2.3.1/engine/src/segment/MemoryUsage.cpp	2010-06-21 13:36:36.000000000 +0630
2321@@ -11,10 +11,10 @@
2322 Description:
2323     Calculates memory usage for the engine and segments.
2324 ----------------------------------------------------------------------------------------------*/
2325-
2326+#ifdef _MSC_VER
2327 #pragma warning(disable: 4244)	// conversion from wchar_t to char
2328 #pragma warning(disable: 4702)	// unreachable code
2329-
2330+#endif
2331 //:>********************************************************************************************
2332 //:>	Include files
2333 //:>********************************************************************************************
2334@@ -54,8 +54,6 @@
2335 #ifdef _MSC_VER
2336 #pragma hdrstop
2337 #endif
2338-#undef THIS_FILE
2339-DEFINE_THIS_FILE
2340
2341 //:End Ignore
2342
2343--- misc/build/silgraphite-2.3.1/engine/src/segment/GrSlotState.h	2010-06-23 19:52:56.429060400 +0700
2344+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrSlotState.h	2010-05-25 11:51:15.195066300 +0700
2345@@ -48,7 +48,7 @@
2346 	{
2347 	}
2348
2349-	~GrSlotAbstract()
2350+	virtual ~GrSlotAbstract()
2351 	{
2352 		// the table manager is responsible for destroying the contents of m_prgnVarLenBuf
2353 	}
2354@@ -231,7 +231,7 @@
2355 		ZapCompositeMetrics();
2356 	}
2357
2358-	~GrSlotState()
2359+	virtual ~GrSlotState()
2360 	{
2361 	}
2362
2363--- misc/silgraphite-2.3.1/engine/include/graphite/Segment.h	2009-01-29 09:33:19.000000000 +0100
2364+++ misc/build/silgraphite-2.3.1/engine/include/graphite/Segment.h	2013-08-14 15:10:53.363864046 +0200
2365@@ -64,7 +64,7 @@
2366 	virtual ~Segment();
2367
2368 	// Basic copy constructor:
2369-	Segment(Segment & seg);
2370+	Segment( const Segment&);
2371
2372 	// For making modified copies of segments:
2373 	static Segment * LineContextSegment(Segment & seg, bool fStartLine, bool fEndLine);
2374--- misc/build/silgraphite-2.3.1/engine/src/segment/Segment.cpp.bak	2010-06-23 19:59:54.611660400 +0700
2375+++ misc/build/silgraphite-2.3.1/engine/src/segment/Segment.cpp	2010-06-23 21:30:16.335460400 +0700
2376@@ -246,6 +246,8 @@
2377
2378 	m_dxsVisibleWidth = -1;
2379 	m_dxsTotalWidth = -1;
2380+	m_ichwAssocsMin = 0;
2381+	m_ichwAssocsLim = 0;
2382
2383 //	m_psstrm = NULL;
2384 	m_prgslout = NULL;
2385@@ -435,7 +435,7 @@
2386 /*----------------------------------------------------------------------------------------------
2387 	Basic copy method.
2388 ----------------------------------------------------------------------------------------------*/
2389-Segment::Segment(Segment & seg)
2390+Segment::Segment( const Segment& seg)
2391 {
2392 	int islout;
2393
2394@@ -2988,9 +2988,10 @@
2395 	return kresOk;
2396 }
2397
2398-
2399+#ifdef __GNUC__
2400 // suppress GCC 4.3 warning for optimized min()/max() when called with (ich, ich+1) or similar
2401 #pragma GCC diagnostic ignored "-Wstrict-overflow"
2402+#endif
2403
2404 /*----------------------------------------------------------------------------------------------
2405 	Merge the given characters into the same Uniscribe cluster. This means merging any
2406--- misc/build/silgraphite-2.3.1/wrappers/win32/win32_dll.cpp.bak	2008-05-09 18:10:30.000000000 +0700
2407+++ misc/build/silgraphite-2.3.1/wrappers/win32/win32_dll.cpp	2010-05-10 15:46:54.291818000 +0700
2408@@ -14,7 +14,7 @@
2409 	DllMain. This is the main DLL entry point for a non-MFC DLL. For an MFC DLL, DllMain is
2410 		in DllModul.cpp. Both DllMains call ModuleEntry::DllMain.
2411 ----------------------------------------------------------------------------------------------*/
2412-extern "C" BOOL WINAPI DllMain(HMODULE hmod, DWORD dwReason, PVOID pvReserved)
2413+extern "C" BOOL WINAPI DllMain(HMODULE hmod, DWORD dwReason, PVOID /*pvReserved*/)
2414 {
2415 	bool fRet = true;
2416
2417--- misc/silgraphite-2.3.1/engine/include/graphite/GrFeature.h		2009-01-21 17:36:40.000000000 -0500
2418+++ misc/build/silgraphite-2.3.1/engine/include/graphite/GrFeature.h	2013-01-15 15:38:54.000000000 -0500
2419@@ -21,6 +21,10 @@
2420
2421 //:End Ignore
2422
2423+#ifdef __FreeBSD__
2424+#define wstring basic_string<wchar_t> //quick dirty hack for not finding _STL::wstring
2425+#endif
2426+
2427 #include "GrAppData.h"
2428
2429 namespace gr
2430--- misc/silgraphite-2.3.1/engine/include/graphite/SegmentAux.h	Thu Jan 22 00:36:40 2009
2431+++ misc/build/silgraphite-2.3.1/engine/include/graphite/SegmentAux.h	Sat Aug 22 19:36:32 2009
2432@@ -232,8 +232,12 @@
2433 protected:
2434 	// Constructor that includes output-slot mapping list, used for non-contiguous lists:
2435 	GlyphSetIterator(Segment & seg, size_t islout, RcVector * qvislout)
2436-		: m_pseg(&seg), m_vit(qvislout->Vector().begin() + islout)
2437+		: m_pseg(&seg), m_vit(qvislout->Vector().begin())
2438 	{
2439+		if( islout < qvislout->Vector().size())
2440+			m_vit += islout;
2441+		else
2442+			m_vit = qvislout->Vector().end();
2443 		m_qvislout = qvislout;
2444 		m_qvislout->IncRefCount();
2445 	}
2446@@ -289,7 +293,7 @@
2447
2448 	// Relational operators.
2449   	// Forward iterator requirements
2450-	bool operator==(const GlyphSetIterator & rhs) const throw()	{ return m_vit == rhs.m_vit; }
2451+	bool operator==(const GlyphSetIterator & rhs) const throw()	{ return (m_qvislout == NULL) || (m_vit == rhs.m_vit); }
2452 	bool operator!=(const GlyphSetIterator & rhs) const throw()	{ return !(*this == rhs); }
2453
2454 	// Random access iterator requirements
2455diff -ur misc/silgraphite-2.3.1/engine/src/segment/GrSlotState.h misc/build/silgraphite-2.3.1/engine/src/segment/GrSlotState.h
2456--- misc/silgraphite-2.3.1/engine/src/segment/GrSlotState.h	2009-01-27 18:01:29.000000000 -0800
2457+++ misc/build/silgraphite-2.3.1/engine/src/segment/GrSlotState.h	2016-08-02 17:22:26.300396000 -0700
2458@@ -481,7 +481,7 @@
2459 		{
2460 			Assert(false);	// Should have already been set in HandleModifiedPosition,
2461 							// but just in case.
2462-			if (!m_srAttachTo == 0)
2463+			if (m_srAttachTo != 0)
2464 				return 0;
2465 			else
2466 				m_mAttachAtX = 0; // attach on the right
2467