示例#1
0
文件: text.c 项目: akleine/libming
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);
}
示例#2
0
文件: text.c 项目: akleine/libming
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;
}
示例#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;
}
示例#4
0
文件: text.c 项目: akleine/libming
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;
}
示例#5
0
文件: text.c 项目: akleine/libming
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;
}
示例#6
0
文件: text.c 项目: akleine/libming
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;
}
示例#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;
}
示例#8
0
文件: text.c 项目: akleine/libming
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;
}
示例#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;
}
示例#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;
	}
}
示例#11
0
文件: text.c 项目: akleine/libming
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;
	}
}