|
From: Justin C. <ju...@po...> - 2008-01-20 05:44:26
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
Have just discovered that with SWFText_moveTo() (which maps to
SWFText_scaledMoveTo()), trying to set either x or y to 0 leads to that
value being skipped.
Guessing it was originally intended to allow just one of the
co-ordinates to be effective, but it seems more like a bug.
It's stopping text pen position from actually being set to zero (on
purpose) in either dimension, which I need.
*****************
void
SWFText_scaledMoveTo(SWFText text, int x, int y)
{
SWFTextRecord textRecord = text->currentRecord;
if ( textRecord == NULL || textRecord->string != NULL )
textRecord = SWFText_addTextRecord(text);
/* If SWFText_addTextRecord() failed, return early */
if (NULL == textRecord)
return;
if ( x != 0 )
{
textRecord->flags |= SWF_TEXT_HAS_X;
textRecord->x = x;
}
if ( y != 0 )
{
textRecord->flags |= SWF_TEXT_HAS_Y;
textRecord->y = y;
}
}
*****************
My thinking is we should update the function to honour the 0 value,
document the change, and create two functions allowing people to set
just one of the X or Y values.
Something like (mostly a cut-n-paste of above):
*****************
int
SWFText_scaledMoveXTo(SWFText text, int x)
{
SWFTextRecord textRecord = text->currentRecord;
if ( textRecord == NULL || textRecord->string != NULL )
textRecord = SWFText_addTextRecord(text);
// If SWFText_addTextRecord() failed, return -1 to indicate this
if (NULL == textRecord)
return -1;
textRecord->flags |= SWF_TEXT_HAS_X;
textRecord->x = x;
}
int
SWFText_scaledMoveYTo(SWFText text, int y)
{
SWFTextRecord textRecord = text->currentRecord;
if ( textRecord == NULL || textRecord->string != NULL )
textRecord = SWFText_addTextRecord(text);
// If SWFText_addTextRecord() failed, return -1 to indicate this
if (NULL == textRecord)
return -1;
textRecord->flags |= SWF_TEXT_HAS_Y;
textRecord->y = y;
}
*****************
Good idea, bad idea, general thoughts?
Regards and best wishes,
Justin Clift
- --
The Flame Project - Open Source GUI for animated SVG & Flash
http://www.flameproject.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHkt+wFAuZn5lS2IMRAnOxAKCJ/xvBSDkQWCx6kN0P9mwyWTbA9ACgqw1i
FG5UfleetbX6S5I2/u7UI4k=
=j3XX
-----END PGP SIGNATURE-----
|