Page 1 of 1

Problem with justified text

Posted: 22 Jul 2015, 00:17
by marym
I am having problems creating justified text in a DWG file. It only seems to work properly if the Point is 0,0.

For the code snippet below, I try to create justified text. It only works with the 0,0 version. I believe this is because the code sets the "Geometry Position X" variable, but it should be setting the "Text alignment X" variable as shown in AutoCAD. I am attaching a screen shot of the text properties from the code snippet below.

Code: Select all

// VAlign and HAlign constants to justify text - I found these in the help file
const byte VALIGN_BASELINE			= 0;
const byte VALIGN_BOTTOM			= 1;
const byte VALIGN_MIDDLE			= 2;
const byte VALIGN_TOP				= 3;

const byte HALIGN_LEFT				= 0;
const byte HALIGN_CENTER 			= 1;
const byte HALIGN_RIGHT				= 2;
const byte HALIGN_ALIGNED			= 3;	// if vertical alignment = 0
const byte HALIGN_MIDDLE 			= 4;	// if vertical alignment = 0
const byte HALIGN_FIT				= 5;	// if vertical alignment = 0

	byte hal = HALIGN_CENTER;
	byte val = VALIGN_MIDDLE;

	// test 1
	{
	TsgDXFText *vText = new TsgDXFText();
	vText->HAlign = hal;
	vText->VAlign = val;
	vText->Text = "This is a test, horizontal center, vertical middle, 0,0";
	vText->Point = MakeFPoint(0, 0, 0);

	vText->Height = 1.2;
	vText->Layer = pDrawing->Converter->LayerByName("TEXT2-8");
	vText->Color = clRed;
	if(!PlaceEntity(vText))
		delete vText;

	}

	// test 2
	{
	TsgDXFText *vText = new TsgDXFText();
	vText->HAlign = hal;
	vText->VAlign = val;
	vText->Text = "This is a test, horizontal center, vertical middle, 10, 40";
	vText->Point = MakeFPoint(10, 40, 0);

	vText->Height = 1.2;
	vText->Layer = pDrawing->Converter->LayerByName("TEXT2-8");
	vText->Color = clRed;
	if(!PlaceEntity(vText))
		delete vText;

	}

Re: Problem with justified text

Posted: 22 Jul 2015, 00:18
by marym
screen shots are attached

Re: Problem with justified text

Posted: 27 Jul 2015, 20:05
by support
Hello Mary,

We are currently investigating this issue. Unfortunately, the screen shots weren't attached. You can use the Img button to insert an image into a post.


Mikhail