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

[XaraXtreme-dev] Text fixes



Find attached below a patch to fix incorrect tab formatting in 
conjunction with margins.

It also adds another buffer length check in a FTFontMan routine that 
is not yet used and removes a few unnecessary text header includes in 
the Kernel.

Martin
Index: wxOil/ftfonts.cpp
===================================================================
--- wxOil/ftfonts.cpp	(Revision 1478)
+++ wxOil/ftfonts.cpp	(Arbeitskopie)
@@ -466,6 +466,8 @@
 	// we need to pass a ENUMLOGFONT structure to the kernel
 	// we can pass pointers to transient structures - the kernel copies the data if it is the
 	// best match so far
+	// We can only handle names that have less than 64 characters - see MyFontEnumerator::OnFacename
+	if (font.length() > 63) return TRUE;
 	String_64 OurFontName = font;
 	ENUMLOGFONT OurEnumLogFont;
 	OurEnumLogFont.elfLogFont.FaceName = font;
Index: Kernel/bmplist.cpp
===================================================================
--- Kernel/bmplist.cpp	(Revision 1478)
+++ Kernel/bmplist.cpp	(Arbeitskopie)
@@ -126,8 +126,6 @@
 
 //#include "will2.h"
 
-#include "nodetxtl.h"
-
 #include "bmpcomp.h"
 
 //#include "nodecach.h"		// for CacheCompound specific tests in cleaning up GlobalList
Index: Kernel/bmpcomp.cpp
===================================================================
--- Kernel/bmpcomp.cpp	(Revision 1478)
+++ Kernel/bmpcomp.cpp	(Arbeitskopie)
@@ -128,8 +128,6 @@
 #include "sgliboil.h"
 //#include "will2.h"
 
-#include "nodetxtl.h"
-
 #include "expbmp.h"		// ExportedBitmaps handling class
 #include "impbmp.h"		// ImportedBitmaps handling class
 //#include "camfiltr.h"	// BaseCamelotFilter - version 2 native filter - in camtypes.h [AUTOMATICALLY REMOVED]
Index: Kernel/ngitem.cpp
===================================================================
--- Kernel/ngitem.cpp	(Revision 1478)
+++ Kernel/ngitem.cpp	(Arbeitskopie)
@@ -128,8 +128,6 @@
 
 #include "fontman.h"			// fonts
 //#include "txtattr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
-#include "nodetxts.h"
-#include "nodetxtl.h"
 #include "nodetext.h"
 
 //#include "doccolor.h"			// colours - in camtypes.h [AUTOMATICALLY REMOVED]
Index: Kernel/nodetxtl.h
===================================================================
--- Kernel/nodetxtl.h	(Revision 1478)
+++ Kernel/nodetxtl.h	(Arbeitskopie)
@@ -324,9 +324,9 @@
 								MILLIPOINT LastDescentLine, BOOL FirstLine);
 	BOOL SetCharMatrices(MILLIPOINT LinePos);
 	BOOL FitTextToPath(TextStoryInfo* pPathInfo, MILLIPOINT LinePos);
-	BOOL Wrap(UndoableOperation* pUndoOp, MILLIPOINT WrapWidth);
+	BOOL Wrap(UndoableOperation* pUndoOp, MILLIPOINT WrapWidth, MILLIPOINT Indent);
 	VisibleTextNode* FindBreakChar(MILLIPOINT FitWidth, BOOL SetCharPositions,
-								   MILLIPOINT Indent = 0, MILLIPOINT CharPosOffset = 0,
+								   MILLIPOINT Indent, MILLIPOINT CharPosOffset = 0,
 								   MILLIPOINT ExtraOnChars = 0, MILLIPOINT ExtraOnSpaces = 0);
 
 	TextLine* FindFirstLineOfParagraph();
Index: Kernel/nodetxtl.cpp
===================================================================
--- Kernel/nodetxtl.cpp	(Revision 1478)
+++ Kernel/nodetxtl.cpp	(Arbeitskopie)
@@ -775,15 +775,15 @@
 	MILLIPOINT PhysicalRightMargin  = pStoryInfo->StoryWidth - pStoryInfo->RightPathIndent;
 	BOOL       WordWrapping = pStoryInfo->WordWrapping;
 	MILLIPOINT RightMargin = PhysicalRightMargin - mRightMargin;
-	MILLIPOINT LeftMargin = PhysicalLeftMargin + GetEffectiveLeftMargin();
+	MILLIPOINT LeftIndent = GetEffectiveLeftMargin();
 
 	// if word wrapping, and not text at a point, and undoably 'do'ing op, word wrap the line
 	MILLIPOINT WrapWidth = 0;
 	if (WordWrapping)
-		WrapWidth = RightMargin - LeftMargin;	// will be 0 if text at a point
+		WrapWidth = RightMargin - PhysicalLeftMargin;	// will be 0 if text at a point
 	if (WrapWidth!=0 && pStoryInfo->WordWrap)
 	{
-		if (!this->Wrap(pStoryInfo->pUndoOp, WrapWidth))
+		if (!this->Wrap(pStoryInfo->pUndoOp, WrapWidth, LeftIndent))
 			return FALSE;
 	}
 	else if (WrapWidth != 0)
@@ -791,7 +791,7 @@
 		// when called during undo (i.e., WordWrap = FALSE) and the story is word wrapping,
 		// we do not want to wrap, but we still need to make sure that each tab gets its width
 		// set correctly, otherwise PositionCharsInLine will not do the right thing
-		FindBreakChar(WrapWidth, FALSE);
+		FindBreakChar(WrapWidth, FALSE, LeftIndent);
 	}
 
 	// if line affected in any way, reposition chars in line
@@ -1160,7 +1160,9 @@
 }
 
 /********************************************************************************************
->	VisibleTextNode* TextLine::FindBreakChar(MILLIPOINT FitWidth)
+>	VisibleTextNode* TextLine::FindBreakChar(MILLIPOINT FitWidth, BOOL SetCharPositions,
+										 MILLIPOINT Indent, MILLIPOINT CharPosOffset,
+										 MILLIPOINT ExtraOnChars, MILLIPOINT ExtraOnSpaces)
 
 	Author:		Martin Wuerthner <xara@xxxxxxxxxxxxxxx>
 				(based on routine by Ed_Cornes <camelotdev@xxxxxxxx> created 15/7/96)
@@ -1307,9 +1309,9 @@
 	Purpose:	Word wrap the line
 ********************************************************************************************/
 
-BOOL TextLine::Wrap(UndoableOperation* pUndoOp, MILLIPOINT WrapWidth)
+BOOL TextLine::Wrap(UndoableOperation* pUndoOp, MILLIPOINT WrapWidth, MILLIPOINT Indent)
 {
-	VisibleTextNode* pBreakChar = this->FindBreakChar(WrapWidth, FALSE);
+	VisibleTextNode* pBreakChar = this->FindBreakChar(WrapWidth, FALSE, Indent);
 	if (pBreakChar==NULL)
 		return FALSE;