[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Swftools-common] swfstrings and japanese text
From: |
Con Kolivas |
Subject: |
Re: [Swftools-common] swfstrings and japanese text |
Date: |
Thu, 29 Jun 2006 23:46:08 +1000 |
User-agent: |
KMail/1.9.3 |
On Thursday 29 June 2006 22:37, Con Kolivas wrote:
> On Tuesday 27 June 2006 23:17, Matthias Kramm wrote:
> > On Tue, Jun 27, 2006 at 07:11:36PM +1000, Con Kolivas wrote:
> > > One query; I can't seem to extract japanese text (kanji) with
> > > swfstrings apart from the font name which is correctly displayed in
> > > kanji. Most of the static text is ignored and nothing follows.
> >
> > That's an interesting feature request :)
> > Well, so far swfstrings only extracts text in the standard codepage
> > (iso8859-1). There's no UTF-8 output yet.
> >
> > I guess I'll add it to the TODO list.
> >
> > Do you happen to have any simple Kanji encoded sample-SWFs?
>
> (sample sent offlist)..
>
> I've been looking at your code myself to see if I could help and tracked
> down your output line (in v0.7.0) to
>
> swfextc.c:466
> printf("%c", code);
>
> which is obviously only going to work for ascii codes up to 127 since UTF8
> is variable length and probably needs a %lc passed a wchar_t. All of this
> is new to me so I'm not sure if it's obvious to others or not who might
> also find it interesting. I've never really hacked on this sort of code
> before.
Ok I've gone one better and got it working. Obviously the code style and way
you choose to implement this is entirely up to you but this patch produces
the output I desire.
Thanks for your tools again.
---
lib/modules/swftext.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
Index: swftools-0.7.0/lib/modules/swftext.c
===================================================================
--- swftools-0.7.0.orig/lib/modules/swftext.c 2005-06-03 03:17:17.000000000
+1000
+++ swftools-0.7.0/lib/modules/swftext.c 2006-06-29 23:43:30.000000000
+1000
@@ -22,6 +22,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <locale.h>
+
static U32 readUTF8char(U8 ** text)
{
U32 c = 0;
@@ -404,6 +406,7 @@ swf_FontExtract_DefineTextCallback(int i
RGBA color;
int x = 0, y = 0;
int fontsize = 0;
+ (void)setlocale(LC_ALL,"");
memset(&color, 0, sizeof(color));
@@ -462,8 +465,8 @@ swf_FontExtract_DefineTextCallback(int i
// <deprecated>
if (id == fid) {
if (jobs & FEDTJ_PRINT) {
- int code = f->glyph2ascii[glyph];
- printf("%c", code);
+ wchar_t code = f->glyph2ascii[glyph];
+ printf("%lc", code);
}
if (jobs & FEDTJ_MODIFY)
f->glyph[glyph].advance = adv * 20; //?
--
-ck