From: kramm Date: Mon, 16 Aug 2004 08:36:05 +0000 (+0000) Subject: added full_unicode to swf_SetLoadFontParameters(). X-Git-Tag: xpdf-1-01-latest~23 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=7169758cfe50bc9fa3bbbf75a1859d9a6fb58776 added full_unicode to swf_SetLoadFontParameters(). --- diff --git a/lib/modules/swffont.c b/lib/modules/swffont.c index 7b55f34..8016df4 100644 --- a/lib/modules/swffont.c +++ b/lib/modules/swffont.c @@ -23,10 +23,11 @@ static int loadfont_scale = 64; static int skip_unused = 1; +static int full_unicode = 0; -void swf_SetLoadFontParameters(int _scale, int _skip_unused) +void swf_SetLoadFontParameters(int _scale, int _skip_unused, int _full_unicode) { - loadfont_scale = _scale; + if(_scale) loadfont_scale = _scale; skip_unused = _skip_unused; } @@ -106,6 +107,7 @@ SWFFONT* swf_LoadTrueTypeFont(char*filename) int t; int*glyph2glyph; FT_Size size; + int max_unicode = 0; if(ftlibrary == 0) { if(FT_Init_FreeType(&ftlibrary)) { @@ -181,6 +183,9 @@ SWFFONT* swf_LoadTrueTypeFont(char*filename) } charcode = FT_Get_Next_Char(face, charcode, &gindex); } + + if(full_unicode) + font->maxascii = 65535; font->ascii2glyph = malloc(font->maxascii*sizeof(int)); @@ -190,11 +195,13 @@ SWFFONT* swf_LoadTrueTypeFont(char*filename) g = -1; font->ascii2glyph[t] = g; if(g>=0) { + max_unicode = t; if(!font->glyph2ascii[g]) { font->glyph2ascii[g] = t; } } } + font->maxascii = max_unicode; font->numchars = 0; diff --git a/lib/rfxswf.h b/lib/rfxswf.h index d9a5848..e37fda0 100644 --- a/lib/rfxswf.h +++ b/lib/rfxswf.h @@ -491,11 +491,6 @@ typedef struct SHAPE * shape; } SWFGLYPH; -typedef struct _FONTUSAGE -{ int* chars; - char is_reduced; -} FONTUSAGE, * LPFONTUSAGE; - #define FONT_STYLE_BOLD 1 #define FONT_STYLE_ITALIC 2 #define FONT_ENCODING_UNICODE 1 @@ -518,11 +513,12 @@ typedef struct _SWFFONT SWFGLYPH * glyph; U8 language; char ** glyphnames; - - FONTUSAGE * use; - } SWFFONT, * LPSWFFONT; +// does not support wide characters ! +typedef struct _FONTUSAGE +{ U8* code; +} FONTUSAGE, * LPFONTUSAGE; #define ET_HASTEXT 32768 #define ET_WORDWRAP 16384 @@ -561,11 +557,10 @@ int swf_FontIsItalic(SWFFONT * f); int swf_FontIsBold(SWFFONT * f); int swf_FontSetID(SWFFONT * f,U16 id); -int swf_FontReduce(SWFFONT * f); +int swf_FontReduce(SWFFONT * f,FONTUSAGE * use); -int swf_FontInitUsage(SWFFONT * f); -int swf_FontUseGlyph(SWFFONT * f, int glyph); -int swf_FontUse(SWFFONT* f,U8 * s); +int swf_FontInitUsage(SWFFONT * f,FONTUSAGE * use); +int swf_FontUse(SWFFONT* f,FONTUSAGE * use,U8 * s); int swf_FontSetDefine(TAG * t,SWFFONT * f); int swf_FontSetDefine2(TAG * t,SWFFONT * f);