- tag = (TagObject*)tag_new();
- tag->font = font;
- tag->tag = swf_InsertTag(0, ST_DEFINEFONT2);
- tag->font->id = 0;
- swf_FontSetDefine2(tag->tag, tag->font);
- mylog("+%08x(%d) DefineFont\n", (int)tag, tag->ob_refcnt);
- return (PyObject*)tag;
-}
-//----------------------------------------------------------------------------
-static PyObject* f_Protect(PyObject* self, PyObject* args, PyObject* kwargs)
-{
- static char *kwlist[] = {"password", NULL};
- char*password = 0;
- TagObject*tag;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|s", kwlist, &password))
- return NULL;
-
- tag = (TagObject*)tag_new();
- tag->tag = swf_InsertTag(0, ST_PROTECT);
- if(password) {
- swf_SetPassword(tag->tag, password);
- }
- mylog("+%08x(%d) f_Protect", (int)tag, tag->ob_refcnt);
- return (PyObject*)tag;
-}
-//----------------------------------------------------------------------------
-static PyObject* f_DefineText(PyObject* self, PyObject* args, PyObject* kwargs)
-{
- static char *kwlist[] = {"font", "text", "size", "color", NULL};
- TagObject*tag = 0;
- char*text = 0;
- int textlen = 0;
- PyObject*unicode16;
- PyObject*unicode8;
- int size = 0;
- RGBA rgba = {255,0,0,0};
- PyObject*color = 0;
- TagObject*font = 0;
- SRECT r;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!u#i|O!", kwlist, &TagClass, &font, &text, &textlen, &size, &ColorClass, &color))
- return NULL;
-
- unicode16 = PyUnicode_DecodeUTF16(text, textlen*2, NULL, NULL);
- unicode8 = PyUnicode_AsUTF8String(unicode16);
- text = PyString_AS_STRING(unicode8);
-
- if(color)
- rgba = color_getRGBA(color);
-
- mylog("DefineText: text = %s", text);
-
- tag = (TagObject*)tag_new();
-
- /* notice: we do modify the (passed) font object here,
- for the swf_SetDefineText call, who will write out the font id. */
- font->font->id = tagmap_add(tag->tagmap,(PyObject*)font); // add dependency on font
-
- tag ->tag= swf_InsertTag(0, ST_DEFINETEXT2);
- swf_SetU16(tag->tag, /*ID*/0);
- r = swf_SetDefineText(tag->tag, font->font, &rgba, text, size);
- mylog("+%08x(%d) DefineText %08x -> %08x\n", (int)tag, tag->ob_refcnt);