Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages | Examples

font.h

00001 //  Copyright (c) 1996-2001 by Autodesk, Inc.
00002 //
00003 //  By using this code, you are agreeing to the terms and conditions of
00004 //  the License Agreement included in the documentation for this code.
00005 //
00006 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00007 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00008 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00009 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00010 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00011 //
00012 //  Use, duplication, or disclosure by the U.S. Government is subject to
00013 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00014 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00015 //  Data and Computer Software), as applicable.
00016 //
00017 
00018 #if !defined FONT_HEADER
00019 #define FONT_HEADER
00020 
00021 #include "whiptk/font_options.h"
00022 
00023 #define WD_FONT_STYLE_BOLD        0x01
00024 #define WD_FONT_STYLE_ITALIC      0x02
00025 #define WD_FONT_STYLE_UNDERLINED  0x04
00026 
00027 
00028 class WT_File;
00029 
00030 
00035 
00036 
00043 class WHIPTK_API WT_Font : public WT_Attribute
00044 {
00045 
00046 private:
00047     WT_Font_Option_Font_Name    m_option_font_name;
00048     WT_Font_Option_Charset      m_option_charset;
00049     WT_Font_Option_Pitch        m_option_pitch;
00050     WT_Font_Option_Family       m_option_family;
00051     WT_Font_Option_Style        m_option_style;
00052     WT_Font_Option_Height       m_option_height;
00053     WT_Font_Option_Rotation     m_option_rotation;
00054     WT_Font_Option_Width_Scale  m_option_width_scale;
00055     WT_Font_Option_Spacing      m_option_spacing;
00056     WT_Font_Option_Oblique      m_option_oblique;
00057     WT_Font_Option_Flags        m_option_flags;
00058 
00059     WT_Integer32            m_name_length;  // Obsolete, but needed to read older files
00060     WT_Boolean              m_rotation_checked; // A hack to get landscape_to_portrait() working.
00061 
00062     enum
00063     {
00064         Getting_Name_Length,
00065         Getting_Fields,
00066         Getting_Name,
00067         Getting_Charset,
00068         Getting_Pitch,
00069         Getting_Family,
00070         Getting_Style,
00071         Getting_Height,
00072         Getting_Rotation,
00073         Getting_Width_Scale,
00074         Getting_Spacing,
00075         Getting_Oblique,
00076         Getting_Flags,
00077         Getting_Next_Optioncode,
00078         Materializing_Option,
00079         Getting_Bold_Italic,
00080         Getting_Pitch_and_Family,
00081         Skipping_Last_Paren,
00082         Completed
00083     }               m_stage;
00084 
00085     WT_Font_Optioncode      m_optioncode;
00086 
00087     WT_Unsigned_Integer16   m_fields_defined;
00088 
00089 public:
00090 
00092     enum Font_Options
00093     {
00094         FONT_NAME_BIT           = 0x0001,
00095         FONT_CHARSET_BIT        = 0x0002,
00096         FONT_PITCH_BIT          = 0x0004,
00097         FONT_FAMILY_BIT         = 0x0008,
00098         FONT_STYLE_BIT          = 0x0010,
00099         FONT_HEIGHT_BIT         = 0x0020,
00100         FONT_ROTATION_BIT       = 0x0040,
00101         FONT_WIDTH_SCALE_BIT    = 0x0080,
00102         FONT_SPACING_BIT        = 0x0100,
00103         FONT_OBLIQUE_BIT        = 0x0200,
00104         FONT_FLAGS_BIT          = 0x0400,
00105         FONT_ALL_FIELDS         = 0xFFFF
00106     };
00107 
00109 
00110     WT_Font()
00111         : m_name_length (0) // Obsolete, but needed to read older files
00112         , m_rotation_checked(WD_False)
00113         , m_stage (Getting_Name_Length)
00114         , m_fields_defined(FONT_ALL_FIELDS)
00115     { }
00116 
00118     WT_Font (
00119         WT_String             name, 
00120         WT_Boolean            bold, 
00121         WT_Boolean            italic, 
00122         WT_Boolean            underline, 
00123         WT_Byte               charset, 
00124         WT_Byte               pitch, 
00125         WT_Byte               family, 
00126         WT_Integer32          height, 
00127         WT_Unsigned_Integer16 rotation, 
00131         WT_Unsigned_Integer16 width_scale,
00136         WT_Unsigned_Integer16 spacing,
00140         WT_Unsigned_Integer16 oblique,
00141         WT_Integer32          flags = 0 
00142         );
00144 
00149     WT_Font_Option_Charset const & charset() const         { return m_option_charset; }
00150     WT_Font_Option_Family const & family() const           { return m_option_family; }
00151     WT_Font_Option_Flags const & flags() const             { return m_option_flags; }
00152     WT_Font_Option_Font_Name const & font_name() const     { return m_option_font_name; }
00153     WT_Font_Option_Height const & height() const           { return m_option_height; }
00154     WT_Font_Option_Oblique const & oblique() const         { return m_option_oblique; }
00155     WT_Font_Option_Pitch const & pitch() const             { return m_option_pitch; }
00156     WT_Font_Option_Rotation const & rotation() const       { return m_option_rotation; }
00157     WT_Font_Option_Spacing const & spacing() const         { return m_option_spacing; }
00158     WT_Font_Option_Style const & style() const             { return m_option_style; }
00159     WT_Font_Option_Width_Scale const & width_scale() const { return m_option_width_scale;}
00161 
00166     WT_Font_Option_Charset & charset()         { return m_option_charset; }
00167     WT_Font_Option_Family & family()           { return m_option_family; }
00168     WT_Font_Option_Flags & flags()             { return m_option_flags; }
00169     WT_Font_Option_Font_Name & font_name()     { return m_option_font_name; }
00170     WT_Font_Option_Height & height()           { return m_option_height; }
00171     WT_Font_Option_Oblique & oblique()         { return m_option_oblique; }
00172     WT_Font_Option_Pitch & pitch()             { return m_option_pitch; }
00173     WT_Font_Option_Rotation & rotation()       { return m_option_rotation; }
00174     WT_Font_Option_Spacing & spacing()         { return m_option_spacing; }
00175     WT_Font_Option_Style & style()             { return m_option_style; }
00176     WT_Font_Option_Width_Scale & width_scale() { return m_option_width_scale;}
00178 
00180 
00181     WT_Unsigned_Integer16              fields_defined() const                           {   return m_fields_defined;    }
00183     void                               set_fields_defined(WT_Unsigned_Integer16 fields) {   m_fields_defined = fields;  }
00185     WT_Font const & operator=  (WT_Font const & font);
00187 
00189     WT_ID            object_id() const;
00190     WT_Result        materialize(WT_Opcode const & opcode, WT_File & file);
00191     WT_Result        process(WT_File & file);
00192     WT_Result        skip_operand(WT_Opcode const & opcode, WT_File & file);
00193     WT_Result        serialize (WT_File & file) const;
00194     WT_Result        sync (WT_File & file) const;
00195     WT_Boolean       operator== (WT_Attribute const & attrib) const;
00197 
00199 
00201     static WT_Result default_process(
00202         WT_Font & item, 
00203         WT_File & file 
00204         );
00205 };
00206 
00208 
00209 #endif // FONT_HEADER

Generated on Tue May 17 12:07:44 2005 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.1