View | Details | Raw Unified | Return to bug 165519
Collapse All | Expand All

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

Return to bug 165519