Beispiel #1
0
void
SWFText_addWideString(SWFText text, const unsigned short* widestring,
											int len, int* advance)
{
	SWFTextRecord textRecord = text->currentRecord;

	/* marginally sloppy to tack on a new record,
		 but I don't want to deal with concats */

	if ( textRecord == NULL || textRecord->string != NULL )
		textRecord = SWFText_addTextRecord(text);

	/* If SWFText_addTextRecord() failed, return early */
	if (NULL == textRecord)
		return;

	if ( textRecord->font.font == NULL )
		SWF_error("font must be set before calling addString");

	textRecord->advance = advance;
	textRecord->strlen = len;
	textRecord->string = (unsigned short*)malloc(sizeof(unsigned short) * len);

	/* If malloc failed, return early */
	if (NULL == textRecord->string)
	{
		destroySWFTextRecord(textRecord);
		return;
	}

	memcpy(textRecord->string, widestring, sizeof(unsigned short) * len);
}
Beispiel #2
0
void
SWFText_addUTF8String(SWFText text, const char* string, int* advance)
{
	unsigned short* widestring;
	int len = UTF8ExpandString(string, &widestring);

	SWFTextRecord textRecord = text->currentRecord;

	/* marginally sloppy to tack on a new record,
		 but I don't want to deal with concats */

	if ( textRecord == NULL || textRecord->string != NULL )
		textRecord = SWFText_addTextRecord(text);

	/* If SWFText_addTextRecord() failed, return early */
	if (NULL == textRecord)
		return;

	if ( textRecord->font.font == NULL )
		SWF_error("font must be set before calling addString");

	textRecord->advance = advance;
	textRecord->strlen = len;
	textRecord->string = widestring;
}
Beispiel #3
0
void
SWFText_setScaledSpacing(SWFText text, int spacing)
{
	SWFTextRecord textRecord = text->currentRecord;

	if ( textRecord == NULL || textRecord->string != NULL )
		textRecord = SWFText_addTextRecord(text);

	textRecord->spacing = spacing;
}
Beispiel #4
0
void
SWFText_setScaledSpacing(SWFText text, int spacing)
{
	SWFTextRecord textRecord = text->currentRecord;

	if ( textRecord == NULL || textRecord->string != NULL )
		textRecord = SWFText_addTextRecord(text);

	/* If SWFText_addTextRecord() failed, return early */
	if (NULL == textRecord)
		return;

	textRecord->spacing = spacing;
}
Beispiel #5
0
void
SWFText_setScaledHeight(SWFText text, int height)
{
	SWFTextRecord textRecord = text->currentRecord;

	if ( textRecord == NULL ||
			 (textRecord->string != NULL && height != textRecord->height) )
	{
		textRecord = SWFText_addTextRecord(text);
	}

	textRecord->flags |= SWF_TEXT_HAS_FONT;
	textRecord->height = height;
}
Beispiel #6
0
void 
SWFText_setFont(SWFText text, SWFFont font)
{
	SWFTextRecord textRecord = text->currentRecord;
	if ( textRecord == NULL || textRecord->string != NULL )
		textRecord = SWFText_addTextRecord(text);

	/* If SWFText_addTextRecord() failed, return early */
	if (NULL == textRecord)
		return;

	textRecord->flags |= SWF_TEXT_HAS_FONT;
	textRecord->font.font = font;
}
Beispiel #7
0
void
SWFText_setColor(SWFText text, byte r, byte g, byte b, byte a)
{
	SWFTextRecord textRecord = text->currentRecord;

	if ( textRecord == NULL || textRecord->string != NULL )
		textRecord = SWFText_addTextRecord(text);

	textRecord->flags |= SWF_TEXT_HAS_COLOR;
	textRecord->r = r;
	textRecord->g = g;
	textRecord->b = b;
	textRecord->a = a;
}
Beispiel #8
0
void
SWFText_setColor(SWFText text, byte r, byte g, byte b, byte a)
{
	SWFTextRecord textRecord = text->currentRecord;

	if ( textRecord == NULL || textRecord->string != NULL )
		textRecord = SWFText_addTextRecord(text);

	/* If SWFText_addTextRecord() failed, return early */
	if (NULL == textRecord)
		return;

	textRecord->flags |= SWF_TEXT_HAS_COLOR;
	textRecord->r = r;
	textRecord->g = g;
	textRecord->b = b;
	textRecord->a = a;
}
Beispiel #9
0
void 
SWFText_setFont(SWFText text, void* font)
{
	SWFTextRecord textRecord = text->currentRecord;

	if ( textRecord == NULL || textRecord->string != NULL )
		textRecord = SWFText_addTextRecord(text);

	textRecord->flags |= SWF_TEXT_HAS_FONT;

	/* XXX */
	textRecord->isBrowserFont = (BLOCK(font)->type == SWF_DEFINEEDITTEXT);

	if ( textRecord->isBrowserFont )
		SWF_error("cannot use browser font for SWFText");
//		textRecord->font.browserFont = (SWFBrowserFont)font;
	else
		textRecord->font.font = (SWFFont)font;
}
Beispiel #10
0
void
SWFText_scaledMoveTo(SWFText text, int x, int y)
{
	SWFTextRecord textRecord = text->currentRecord;

	if ( textRecord == NULL || textRecord->string != NULL )
		textRecord = SWFText_addTextRecord(text);

	if ( x != 0 )
	{
		textRecord->flags |= SWF_TEXT_HAS_X;
		textRecord->x = x;
	}

	if ( y != 0 )
	{
		textRecord->flags |= SWF_TEXT_HAS_Y;
		textRecord->y = y;
	}
}
Beispiel #11
0
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 || (text->initialRecord && text->initialRecord->string))
	{
		textRecord->flags |= SWF_TEXT_HAS_X;
		textRecord->x = x;
	}

	if ( y != 0 || (text->initialRecord && text->initialRecord->string))
	{
		textRecord->flags |= SWF_TEXT_HAS_Y;
		textRecord->y = y;
	}
}