git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed off by one maxascii bug.
[swftools.git]
/
lib
/
modules
/
swffont.c
diff --git
a/lib/modules/swffont.c
b/lib/modules/swffont.c
index
7b55f34
..
e5ff9ee
100644
(file)
--- a/
lib/modules/swffont.c
+++ b/
lib/modules/swffont.c
@@
-23,11
+23,13
@@
static int loadfont_scale = 64;
static int skip_unused = 1;
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;
skip_unused = _skip_unused;
+ full_unicode = _full_unicode;
}
#ifdef HAVE_FREETYPE
}
#ifdef HAVE_FREETYPE
@@
-106,6
+108,7
@@
SWFFONT* swf_LoadTrueTypeFont(char*filename)
int t;
int*glyph2glyph;
FT_Size size;
int t;
int*glyph2glyph;
FT_Size size;
+ int max_unicode = 0;
if(ftlibrary == 0) {
if(FT_Init_FreeType(&ftlibrary)) {
if(ftlibrary == 0) {
if(FT_Init_FreeType(&ftlibrary)) {
@@
-181,6
+184,9
@@
SWFFONT* swf_LoadTrueTypeFont(char*filename)
}
charcode = FT_Get_Next_Char(face, charcode, &gindex);
}
}
charcode = FT_Get_Next_Char(face, charcode, &gindex);
}
+
+ if(full_unicode)
+ font->maxascii = 65535;
font->ascii2glyph = malloc(font->maxascii*sizeof(int));
font->ascii2glyph = malloc(font->maxascii*sizeof(int));
@@
-190,11
+196,13
@@
SWFFONT* swf_LoadTrueTypeFont(char*filename)
g = -1;
font->ascii2glyph[t] = g;
if(g>=0) {
g = -1;
font->ascii2glyph[t] = g;
if(g>=0) {
+ max_unicode = t+1;
if(!font->glyph2ascii[g]) {
font->glyph2ascii[g] = t;
}
}
}
if(!font->glyph2ascii[g]) {
font->glyph2ascii[g] = t;
}
}
}
+ font->maxascii = max_unicode;
font->numchars = 0;
font->numchars = 0;