minor fixes: new font structure in dumpfont.c, commented obsolete functions, ...
authorboehme <boehme>
Mon, 5 Nov 2001 17:01:38 +0000 (17:01 +0000)
committerboehme <boehme>
Mon, 5 Nov 2001 17:01:38 +0000 (17:01 +0000)
lib/example/dumpfont.c
lib/example/text.c
lib/modules/swftext.c
lib/rfxswf.h

index 986f853..c6669bb 100644 (file)
@@ -25,7 +25,7 @@
 #include <unistd.h>
 #include "../rfxswf.h"
 
-#define PRINTABLE(a) ((a>='A')&&(a<='Z'))||((a>='a')&&(a<='z'))||((a>='0')&&(a<='9'))
+#define PRINTABLE(a) (((a>0x20)&&(a<0xff)&&(a!='\\'))?a:0x20)
 
 SWF swf;
 
@@ -74,7 +74,7 @@ void DumpFont(SWFFONT * f,char * name)
     if (f->glyph[i].shape)
     { printf("  addGlyph(f,%3i, 0x%02x,%4i, &Glyphs_%s[0x%04x],%4i); // %c\n",
              i, f->glyph2ascii[i], f->glyph[i].advance, name, gpos[i],
-             f->glyph[i].shape->bitlen,(i!='\\')?i:0x20);
+             f->glyph[i].shape->bitlen,PRINTABLE(f->glyph2ascii[i]));
     }
 
   printf("  return f;\n}\n\n");
index fb19f7e..9762f10 100644 (file)
@@ -128,6 +128,7 @@ int main(int argc, char ** argv)
   close(f);
 
   swf_FreeTags(&swf);
+//  swf_FontFree(font);
 
 #ifdef __NT__
   system("start ..\\text.swf");
index 270447d..fb708fa 100644 (file)
@@ -372,9 +372,9 @@ int swf_FontReduce(SWFFONT * f,FONTUSAGE * use)
       }
       else
       { swf_ShapeFree(f->glyph[i].shape);
-       f->ascii2glyph[f->glyph2ascii[i]] = -1;
+        f->ascii2glyph[f->glyph2ascii[i]] = -1;
        f->glyph2ascii[i] = 0;
-        f->glyph[i].shape   = 0;
+        f->glyph[i].shape   = NULL;
         f->glyph[i].advance = 0;
       }
     } else f->ascii2glyph[f->glyph2ascii[i]] = -1;
@@ -700,10 +700,10 @@ void swf_WriteFont(SWFFONT*font, char* filename, int useDefineFont2)
   {
       t = swf_InsertTag(NULL,ST_SETBACKGROUNDCOLOR);
       swf.firstTag = t;
-           rgb.r = 0xff;
-           rgb.g = 0xff;
-           rgb.b = 0xff;
-           swf_SetRGB(t,&rgb);
+            rgb.r = 0xff;
+            rgb.g = 0xff;
+            rgb.b = 0xff;
+            swf_SetRGB(t,&rgb);
       t = swf_InsertTag(t,ST_DEFINEFONT);
   }
   else
@@ -718,8 +718,7 @@ void swf_WriteFont(SWFFONT*font, char* filename, int useDefineFont2)
         swf_FontSetInfo(t,font);
 
   if(!useDefineFont2)
-  {
-       int textscale = 400;
+  {     int textscale = 400;
        int s;
        int xmax = 0;
        int ymax = textscale * 20;
@@ -791,12 +790,13 @@ void swf_WriteFont(SWFFONT*font, char* filename, int useDefineFont2)
                } 
            }
            swf_SetU8(t,0);
+
         
-       t = swf_InsertTag(t,ST_PLACEOBJECT2);
+        t = swf_InsertTag(t,ST_PLACEOBJECT2);
 
-           swf_ObjectPlace(t,font->id+1,1,NULL,NULL,NULL);
+            swf_ObjectPlace(t,font->id+1,1,NULL,NULL,NULL);
      
-       t = swf_InsertTag(t,ST_SHOWFRAME);
+        t = swf_InsertTag(t,ST_SHOWFRAME);
   }
   
   t = swf_InsertTag(t,ST_END);
index 724134d..b8dedeb 100644 (file)
@@ -358,6 +358,7 @@ int swf_FontUse(FONTUSAGE * use,U8 * s);
 int swf_FontSetDefine(TAG * t,SWFFONT * f);
 int swf_FontSetInfo(TAG * t,SWFFONT * f);
 
+// the following two functions are obsolete and will be removed soon
 int swf_FontExport(int handle,SWFFONT * f);
 int swf_FontImport(int handle,SWFFONT * * f);