[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1431
Date       : Tue Jul 11 16:15:01 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/cameleps.cpp
   M /Trunk/XaraLX/Kernel/fontman.cpp
   M /Trunk/XaraLX/Kernel/nodetxts.cpp

Be careful with Unicode and DCs when exporting to EPS


Diff:
Index: Trunk/XaraLX/Kernel/fontman.cpp
===================================================================
--- Trunk/XaraLX/Kernel/fontman.cpp	(revision 1430)
+++ Trunk/XaraLX/Kernel/fontman.cpp	(revision 1431)
@@ -1859,7 +1859,7 @@
 	String_32 Match;
 	
 	// Replace all spaces with a hyphen.
- 	Copy.SwapChar(' ','-');
+ 	Copy.SwapChar(_T(' '),_T('-'));
 
 	INT32 Length = Copy.Length();
 
Index: Trunk/XaraLX/Kernel/nodetxts.cpp
===================================================================
--- Trunk/XaraLX/Kernel/nodetxts.cpp	(revision 1430)
+++ Trunk/XaraLX/Kernel/nodetxts.cpp	(revision 1431)
@@ -2787,7 +2787,7 @@
 		if (pRegion->IsKindOf(CC_RUNTIME_CLASS(EPSRenderRegion)))
 		{
 			// Output "start text object" token
-			EPSExportDC *pDC = (EPSExportDC *) pRegion->GetRenderDC();
+			EPSExportDC *pDC = (EPSExportDC *) CCDC::ConvertFromNativeDC(pRegion->GetRenderDC());
 			EPSRenderRegion* pEPSRegion = (EPSRenderRegion*)pRegion;
 
 			NodePath* pPath = GetTextPath();
Index: Trunk/XaraLX/Kernel/cameleps.cpp
===================================================================
--- Trunk/XaraLX/Kernel/cameleps.cpp	(revision 1430)
+++ Trunk/XaraLX/Kernel/cameleps.cpp	(revision 1431)
@@ -4747,7 +4747,7 @@
 
 	// Graham 5/8/96: Changed this to work with MBCS
 	// Set up a string buffer for the output character
-	TCHAR cBuffer[3];
+	char cBuffer[3];
 
 	//Convert the character over to a MBCS index number
 	UINT32 uiCharNumber = UnicodeManager::UnicodeToMultiByte(ch);
@@ -4770,16 +4770,22 @@
 	//So let's check if we've got a one-byte or a two-byte character. We do this
 	//by saying...is cBuffer[0] zero?
 
-	if (cBuffer[0]==0)
+    // First we copy it byte by byte into a TCHAR buffer
+	TCHAR tcBuffer[3];
+	tcBuffer[0]=cBuffer[0];
+	tcBuffer[1]=cBuffer[1];
+	tcBuffer[2]=cBuffer[2];
+
+	if (tcBuffer[0]==0)
 		//It's a standard ASCII character, one byte long.
 		//So we only want to pass the second byte of cBuffer - cBuffer[1] -
 		//to OutputString
-		pKernelDC->OutputString(&cBuffer[1]);
+		pKernelDC->OutputString(&tcBuffer[1]);
 	else
 		//The character is two bytes long (that is, it's a foreign character).
 		//So we want to pass the whole of cBuffer - starting from cBuffer[0] -
 		//to OutputString
-		pKernelDC->OutputString(&cBuffer[0]);
+		pKernelDC->OutputString(&tcBuffer[0]);
 
 	//And that's the end of Graham's MBCS code. Now back to Tim.
 


Xara