00001 00002 // Flash Plugin and Player 00003 // Copyright (C) 1998 Olivier Debon 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 // 00020 // Author : Olivier Debon <odebon@club-internet.fr> 00021 // 00022 00023 #include "swf.h" 00024 00025 #ifdef RCSID 00026 static char *rcsid = "$Id: font.cc,v 1.1.1.1 2002/01/25 22:14:58 kergoth Exp $"; 00027 #endif 00028 00029 SwfFont::SwfFont(long id) : Character(FontType, id) 00030 { 00031 glyphs = 0; 00032 nbGlyphs = 0; 00033 name = NULL; 00034 setFontName("Unknown"); 00035 flags = (FontFlags)0; 00036 lookUpTable = 0; 00037 } 00038 00039 SwfFont::~SwfFont() 00040 { 00041 if (lookUpTable) { 00042 delete lookUpTable; 00043 } 00044 delete name; 00045 delete [] glyphs; 00046 } 00047 00048 void 00049 SwfFont::setFontFlags(FontFlags f) 00050 { 00051 flags = f; 00052 } 00053 00054 char * 00055 SwfFont::getName() 00056 { 00057 return name; 00058 } 00059 00060 FontFlags 00061 SwfFont::getFlags() 00062 { 00063 return flags; 00064 } 00065 00066 long 00067 SwfFont::getNbGlyphs() 00068 { 00069 return nbGlyphs; 00070 } 00071 00072 Shape * 00073 SwfFont::getGlyph(long index) 00074 { 00075 if (index >= nbGlyphs) return 0; 00076 return &glyphs[index]; 00077 } 00078 00079 long 00080 SwfFont::getGlyphCode(long index) 00081 { 00082 if (lookUpTable == 0 || index >= nbGlyphs) return 0; 00083 return lookUpTable[index]; 00084 } 00085 00086 void 00087 SwfFont::setFontName(char *str) 00088 { 00089 delete name; 00090 name = new char[strlen(str)+1]; 00091 strcpy(name,str); 00092 } 00093 00094 void 00095 SwfFont::setFontLookUpTable(long *lut) 00096 { 00097 lookUpTable = lut; 00098 } 00099 00100 void 00101 SwfFont::setFontShapeTable(Shape *shapes, long n) 00102 { 00103 glyphs = shapes; 00104 nbGlyphs = n; 00105 }
1.4.2