Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

FFont.h

Go to the documentation of this file.
00001 #ifndef FFONT_H_FILE
00002 #define FFONT_H_FILE
00003 
00004 #include "FBase.h"
00005 #include "FShape.h"
00006 
00007 #include <vector>
00008 
00009 typedef FlashIDFactory FlashFontIDFactory;
00010 typedef FlashIDEnabled FlashFontIDEnabled;
00011 
00012 #define FTDFI_UNICODE           (1 << 5)
00013 #define FTDFI_SHIFTJIS          (1 << 4)
00014 #define FTDFI_ANSI                      (1 << 3)
00015 #define FTDFI_ITALIC            (1 << 2)
00016 #define FTDFI_BOLD                      (1 << 1)
00017 #define FTDFI_WIDECODES         (1)
00018 
00019 class FlashTagDefineFontInfo : public FlashTag, public FlashFontIDEnabled
00020 {
00021 DEFINE_RW_INTERFACE
00022 public:
00023         FlashTagDefineFontInfo(char *_str, unsigned char _flags) : str(_str), flags(_flags) {}
00024 
00025         void AddCode(UWORD code) { codes.push_back(code); }
00026 
00027         friend std::istream &operator >> (std::istream &in,  FlashTagDefineFontInfo &data);
00028         friend std::ostream &operator << (std::ostream &out, FlashTagDefineFontInfo &data);
00029 
00030 private:
00031         std::vector<UWORD> codes;
00032         gc_vector<char *> strings;
00033         char *str;
00034         unsigned char flags;
00035 };
00036 
00037 
00038 class FlashTagDefineFont : public FlashTag, public FlashFontIDEnabled
00039 {
00040 DEFINE_RW_INTERFACE
00041 public:
00042         FlashTagDefineFont() {}
00043         
00044         void AddShape(FlashShape& shape);
00045         friend std::istream &operator >> (std::istream &in,  FlashTagDefineFont &data);
00046         friend std::ostream &operator << (std::ostream &out, FlashTagDefineFont &data);
00047 private:
00048         std::vector<FlashShape> shapes;
00049 };
00050 
00051 class FlashTextRecord : public FlashVersionEnabled
00052 {
00053 public: 
00054         FlashTextRecord() {};
00055         virtual void Write(std::ostream &out, unsigned char bitsGlyph=0, unsigned char bitsAdvance=0) = 0;
00056         virtual bool isGlyph(void) = 0;
00057         virtual int returnGlyphBits(void) { return -1; }
00058         virtual int returnAdvBits(void) { return -1; }
00059 };
00060 
00061 class FlashTextRecordStyle : public FlashTextRecord
00062 {
00063 public:
00064         FlashTextRecordStyle(bool hasFont, bool hasFlashRGB, bool hasOffsetx, bool hasOffsety, 
00065                 UWORD FontID, UWORD FontHeight, FlashRGB color, SWORD offsetx, SWORD offsety) :         
00066                         mhasFont(hasFont), mhasFlashRGB(hasFlashRGB), mhasOffsetx(hasOffsetx), mhasOffsety(hasOffsety), 
00067                         mFontID(FontID), mFontHeight(FontHeight), mcolor(color), moffsetx(offsetx), moffsety(offsety) {}
00068         
00069         virtual void Write(std::ostream &out, unsigned char bitsGlyph=0, unsigned char bitsAdvance=0);
00070         virtual bool isGlyph(void);
00071         
00072 
00073 private:
00074         bool mhasFont;
00075         bool mhasFlashRGB;
00076         bool mhasOffsetx;
00077         bool mhasOffsety;
00078         UWORD mFontID;
00079         UWORD mFontHeight;
00080         FlashRGB mcolor;
00081         SWORD moffsetx;
00082         SWORD moffsety;
00083 };
00084 typedef flash_pair<UWORD, SWORD> FlashGlyphEntry;
00085 
00086 class FlashTextRecordGlyph : public FlashTextRecord
00087 {
00088         
00089 public:
00090         FlashTextRecordGlyph() {}
00091         virtual void Write(std::ostream &out, unsigned char bitsGlyph=0, unsigned char bitsAdvance=0);
00092         virtual bool isGlyph(void) { return true; }
00093         virtual int returnGlyphBits(void);
00094         virtual int returnAdvBits(void);
00095 
00096         void AddGlyph(FlashGlyphEntry &e) { v.push_back(e); }
00097 private:
00098         std::vector<FlashGlyphEntry> v;
00099 };
00100 
00101 class FlashTagDefineText : public FlashTag, public FlashIDEnabled
00102 {
00103 DEFINE_RW_INTERFACE
00104 public:
00105         FlashTagDefineText(FlashRect &r, FlashMatrix &m) : rect(r), matrix(m) {}
00106 
00107         void AddTextRecord(FlashTextRecord *r);
00108 
00109         friend std::istream &operator >> (std::istream &in,  FlashTagDefineText &data);
00110         friend std::ostream &operator << (std::ostream &out, FlashTagDefineText &data);
00111 
00112 private:
00113         FlashRect rect;
00114         FlashMatrix matrix;
00115         std::vector<FlashTextRecord *> records;
00116 
00117 };
00118 
00119 class FlashTagDefineText2 : public FlashTag, public FlashIDEnabled
00120 {
00121 DEFINE_RW_INTERFACE
00122 public:
00123         FlashTagDefineText2(FlashRect &r, FlashMatrix &m) : rect(r), matrix(m) {}
00124 
00125         void AddTextRecord(FlashTextRecord *r);
00126 
00127         friend std::istream &operator >> (std::istream &in,  FlashTagDefineText2 &data);
00128         friend std::ostream &operator << (std::ostream &out, FlashTagDefineText2 &data);
00129 
00130 private:
00131         FlashRect rect;
00132         FlashMatrix matrix;
00133         std::vector<FlashTextRecord *> records;
00134 
00135 };
00136 
00137 
00138 class FlashKerningRecord : public FlashVersionEnabled
00139 {
00140 public:
00141         FlashKerningRecord(UWORD _code1, UWORD _code2, SWORD _adjustment) : code1(_code1), code2(_code2), adjustment(_adjustment) {}
00142 private:
00143         friend std::istream &operator >> (std::istream &in,  FlashKerningRecord &data);
00144         friend std::ostream &operator << (std::ostream &out, FlashKerningRecord &data);
00145 
00146         UWORD code1;
00147         UWORD code2;
00148         SWORD adjustment;
00149 
00150 };
00151 
00152 #define FTDF2_HASLAYOUT                 (1 << 7)
00153 #define FTDF2_SHIFTJIS                  (1 << 6)
00154 #define FTDF2_UNICODE                   (1 << 5)
00155 #define FTDF2_ANSI                              (1 << 4)
00156 #define FTDF2_WIDEOFFSETS               (1 << 3)
00157 #define FTDF2_WIDECODES                 (1 << 2)
00158 #define FTDF2_ITALIC                    (1 << 1)
00159 #define FTDF2_BOLD                              (1)
00160 
00161 class FlashTagDefineFont2 : public FlashTag, public FlashFontIDEnabled
00162 {
00163         DEFINE_RW_INTERFACE
00164 public:
00165         FlashTagDefineFont2(char fontflags,     const char *_fontname) : flags(fontflags), fontname(_fontname) {}
00166         
00167         class FlashFontLayout
00168         {               
00169         public:
00170                 FlashFontLayout() {}
00171                 FlashFontLayout(SWORD ascent, SWORD descent, SWORD leading,
00172                         std::vector<SWORD> &advance) : fontAscent(ascent), fontDescent(descent),
00173                         fontLeading(leading), fontAdvanceTable(advance) {}
00174                 FlashFontLayout(SWORD ascent, SWORD descent, SWORD leading,
00175                         std::vector<SWORD> &advance, std::vector<FlashRect> &bounds,
00176                         std::vector<FlashKerningRecord> &kerning) 
00177                         : fontAscent(ascent), fontDescent(descent),
00178                         fontLeading(leading), fontAdvanceTable(advance),
00179                         fontBoundsTable(bounds), fontKerningTable(kerning){}
00180                 
00181                 void Write(std::ostream &out);
00182         private:
00183                 SWORD fontAscent;
00184                 SWORD fontDescent;
00185                 SWORD fontLeading;
00186 
00187                 std::vector<SWORD>fontAdvanceTable;
00188                 
00189                 std::vector<FlashRect> fontBoundsTable;
00190                 std::vector<FlashKerningRecord> fontKerningTable;
00191         };
00192 
00193         void SetLayout(FlashFontLayout &l) {layout = true; layout_data = l; }
00194         void AddShape(FlashShape &shape) { shapes.push_back(shape); }
00195         void AddCode(UWORD code) { codes.push_back(code); }
00196 
00197 private:
00198 
00199         std::vector<UWORD> codes;
00200         std::vector<FlashShape> shapes;
00201         bool layout;
00202         const char *fontname;
00203         char flags;
00204         FlashFontLayout layout_data;
00205 
00206         
00207         friend std::ostream &operator << (std::ostream &out, FlashTagDefineFont2 &data);
00208         friend std::istream &operator >> (std::istream &in,  FlashTagDefineFont2 &data);
00209 
00210 };
00211 
00212 #define FTDEB_HASTEXT                   (1 << 15)
00213 #define FTDEB_WORDWRAP                  (1 << 14)
00214 #define FTDEB_MULTILINE                 (1 << 13)
00215 #define FTDEB_PASSWORD                  (1 << 12)
00216 #define FTDEB_READONLY                  (1 << 11)
00217 #define FTDEB_HASTEXTCOLOR              (1 << 10)
00218 #define FTDEB_HASMAXLENGTH              (1 << 9)
00219 #define FTDEB_HASFONT                   (1 << 8)
00220 //reserved 2 bits
00221 #define FTDEB_HASLAYOUT                 (1 << 5)
00222 #define FTDEB_NOSELECT                  (1 << 4)
00223 #define FTDEB_BORDER                    (1 << 3)
00224 //reserved 1 bit
00225 #define FTDEB_HTML                      (1 << 1)
00226 #define FTDEB_USEOUTLINES               (1)
00227 
00228 class FlashTagDefineEditBox : public FlashTag, public FlashIDEnabled
00229 {
00230 DEFINE_RW_INTERFACE
00231 public: 
00232         FlashTagDefineEditBox(FlashRect &r, UWORD flags, UWORD fontID, UWORD fontHeight, 
00233                                                   FlashRGB color /*WITH ALPHA*/, UWORD maxLength, unsigned char align, 
00234                                                   UWORD leftmargin, UWORD rightmargin, UWORD indent, UWORD leading, 
00235                                                   char *variable, char *initialtext) :
00236                                                 mr(r), mflags(flags), mfontID(fontID),mfontHeight(fontHeight),mcolor(color),
00237                                                 mmaxLength(maxLength), malign(align), mleftmargin(leftmargin), mrightmargin(rightmargin),
00238                                                 mindent(indent), mleading(leading), mvariable(variable), 
00239                                                 minitialtext(initialtext) {}
00240 private:
00241 
00242         friend std::ostream &operator << (std::ostream &out, FlashTagDefineEditBox &data);
00243         friend std::istream &operator >> (std::istream &in,  FlashTagDefineEditBox &data);
00244 
00245         gc_vector<char *> gc;
00246         FlashRect &mr;
00247         UWORD mflags; 
00248         UWORD mfontID; 
00249         UWORD mfontHeight;
00250         FlashRGB mcolor /*WITH ALPHA*/; 
00251         UWORD mmaxLength; 
00252         unsigned char malign;
00253         UWORD mleftmargin; 
00254         UWORD mrightmargin; 
00255         UWORD mindent; 
00256         UWORD mleading;
00257         char *mvariable; 
00258         char *minitialtext;
00259 };
00260 #endif

Generated at Wed Aug 1 13:33:51 2001 for SWFSource by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001