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

font_options.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_OPTIONS_HEADER
00019 #define FONT_OPTIONS_HEADER
00020 
00021 #include "whiptk/whipcore.h"
00022 #include "whiptk/attribute.h"
00023 #include "whiptk/opcode.h"
00024 
00034 // ====================================================================================
00036 class WHIPTK_API WT_Font_Option_Font_Name : public WT_Option
00037 {
00038 private:
00039     WT_String     m_font_name;
00040 
00041 public:
00042 
00044 
00045     WT_Font_Option_Font_Name()
00046         : m_font_name ("Arial") // Shouldn't use hard coded constants like this.
00047     { }
00048 
00050     WT_Font_Option_Font_Name(WT_String name)
00051         : m_font_name (name)
00052     { }
00054 
00056 
00057     WT_String const &   name() const                                            {   return m_font_name;   }
00059     void                set(WT_String const & name)                             {   m_font_name = name;   }
00061     WT_Boolean          operator==(WT_Font_Option_Font_Name const & nm) const   {   return (m_font_name == nm.m_font_name); }
00063     WT_Boolean          operator!=(WT_Font_Option_Font_Name const & nm) const   {   return (m_font_name != nm.m_font_name); }
00065     operator WT_String const & () const                     {   return m_font_name;     }
00067 
00069     WT_ID            object_id() const;
00070     WT_Result        serialize  (WT_Object const & parent, WT_File & file) const;
00071     WT_Result        materialize(WT_Object       & parent, WT_Optioncode const & optioncode, WT_File & file);
00073 
00074 };
00075 
00076 // ====================================================================================
00078 
00085 class WHIPTK_API WT_Font_Option_Charset : public WT_Option
00086 {
00087 private:
00088     WT_Byte     m_charset;
00089 
00090 public:
00091 
00093     enum Font_Charset_Code
00094     {
00095          CHARSET_ANSI           = 0x00  // 0
00096         ,CHARSET_DEFAULT        = 0x01  // 1
00097         ,CHARSET_SYMBOL         = 0x02  // 2
00098         ,CHARSET_MAC            = 0x4D  // 77
00099         ,CHARSET_UNICODE        = 0x57  // 87
00100         ,CHARSET_SHIFTJIS       = 0X80  // 128
00101         ,CHARSET_HANGEUL        = 0X81  // 129
00102         ,CHARSET_JOHAB          = 0X82  // 130
00103         ,CHARSET_GB2312         = 0X86  // 134
00104         ,CHARSET_CHINESEBIG5    = 0X88  // 136
00105         ,CHARSET_GREEK          = 0XA1  // 161
00106         ,CHARSET_TURKISH        = 0XA2  // 162
00107         ,CHARSET_VIETNAMESE     = 0XA3  // 163
00108         ,CHARSET_HEBREW         = 0XB1  // 177
00109         ,CHARSET_ARABIC         = 0XB2  // 178
00110         ,CHARSET_BALTIC         = 0XBA  // 186
00111         ,CHARSET_RUSSIAN        = 0XCC  // 204
00112         ,CHARSET_THAI           = 0XDE  // 222
00113         ,CHARSET_EASTEUROPE     = 0XEE  // 238
00114         ,CHARSET_OEM            = 0XFF  // 255
00115     };
00116 
00118 
00119     WT_Font_Option_Charset()
00120         : m_charset (CHARSET_ANSI)
00121     { }
00122 
00124     WT_Font_Option_Charset(WT_Byte charset)
00125         : m_charset (charset)
00126     { }
00128 
00130 
00131     WT_Byte     charset() const                                     {   return m_charset;   }
00133     void        set(WT_Byte cs)                                     {   m_charset = cs;     }
00135     WT_Boolean  operator==(WT_Font_Option_Charset const & cs) const {   return (m_charset == cs.m_charset); }
00137     WT_Boolean  operator!=(WT_Font_Option_Charset const & cs) const {   return (m_charset != cs.m_charset); }
00139 
00141     WT_ID            object_id() const;
00142     WT_Result        serialize  (WT_Object const & parent, WT_File & file) const;
00143     WT_Result        materialize(WT_Object       & parent, WT_Optioncode const & optioncode, WT_File & file);
00145 };
00146 
00147 // ====================================================================================
00149 
00153 class WHIPTK_API WT_Font_Option_Pitch : public WT_Option
00154 {
00155 private:
00156     WT_Byte            m_pitch;
00157 
00158 public:
00159 
00161     enum Font_Pitch_Flags
00162     {
00163      PITCH_DEFAULT     = 0x00 
00164     ,PITCH_FIXED       = 0x01 
00165     ,PITCH_VARIABLE    = 0x02 
00166     ,PITCH_BITS        = ( PITCH_DEFAULT | PITCH_FIXED | PITCH_VARIABLE )
00167     };
00168 
00170 
00171     WT_Font_Option_Pitch()
00172         : m_pitch (PITCH_VARIABLE)
00173     { }
00174 
00176     WT_Font_Option_Pitch(
00177         WT_Byte pitch 
00178         )
00179         : m_pitch (pitch)
00180     { }
00182 
00184 
00185     WT_Byte     pitch() const                                       {   return m_pitch;                     }
00187     void        set(WT_Byte pitch)                                  {   m_pitch = pitch;                    }
00189     WT_Boolean  operator==(WT_Font_Option_Pitch const & pt) const   {   return (m_pitch == pt.m_pitch);     }
00191     WT_Boolean  operator!=(WT_Font_Option_Pitch const & pt) const   {   return (m_pitch != pt.m_pitch);     }
00193 
00195     WT_ID            object_id() const;
00196     WT_Result        serialize  (WT_Object const & parent, WT_File & file) const;
00197     WT_Result        materialize(WT_Object       & parent, WT_Optioncode const & optioncode, WT_File & file);
00199 };
00200 
00201 
00202 // ====================================================================================
00204 class WHIPTK_API WT_Font_Option_Family : public WT_Option
00205 {
00206 private:
00207     WT_Byte            m_family;
00208 
00209 public:
00210 
00212     enum Font_Family_Flags
00213     {
00214          FAMILY_UNKNOWN    = 0x00
00215         ,FAMILY_ROMAN      = 0x10
00216         ,FAMILY_SWISS      = 0x20
00217         ,FAMILY_MODERN     = 0x30
00218         ,FAMILY_SCRIPT     = 0x40
00219         ,FAMILY_DECORATIVE = 0x50
00220         ,FAMILY_BITS       = (FAMILY_UNKNOWN | FAMILY_ROMAN | FAMILY_SWISS | FAMILY_MODERN | FAMILY_SCRIPT | FAMILY_DECORATIVE)
00221     };
00222 
00224 
00225     WT_Font_Option_Family()
00226         : m_family (FAMILY_ROMAN)
00227     { }
00228 
00230     WT_Font_Option_Family(
00231         WT_Byte family 
00232         )
00233         : m_family(family)
00234     { }
00236 
00238 
00239     WT_Byte     family() const                                      {   return m_family;                    }
00241     void        set(
00242         WT_Byte family 
00243         )                                 {   m_family = family;                  }
00245     WT_Boolean  operator==(WT_Font_Option_Family const & fm) const  {   return (m_family == fm.m_family);   }
00247     WT_Boolean  operator!=(WT_Font_Option_Family const & fm) const  {   return (m_family != fm.m_family);   }
00249 
00251     WT_ID            object_id() const;
00252     WT_Result        serialize  (WT_Object const & parent, WT_File & file) const;
00253     WT_Result        materialize(WT_Object       & parent, WT_Optioncode const & optioncode, WT_File & file);
00255 };
00256 
00257 
00258 // ====================================================================================
00260 class WHIPTK_API WT_Font_Option_Style : public WT_Option
00261 {
00262 private:
00263     WT_Boolean          m_bold;
00264     WT_Boolean          m_italic;
00265     WT_Boolean          m_underlined;
00266 
00267     enum
00268     {
00269         Starting = 1000,
00270         Getting_Next_Optioncode = 1001,
00271         Skipping_Optioncode = 1002
00272     };
00273 
00274     WT_Opcode       m_optioncode;
00275 
00276 public:
00277 
00279 
00280     WT_Font_Option_Style(
00281         WT_Boolean bold = WD_False,
00282         WT_Boolean italic = WD_False,
00283         WT_Boolean underlined = WD_False
00284         )
00285         : m_bold(bold)
00286         , m_italic(italic)
00287         , m_underlined(underlined)
00288     {
00289         m_stage = Starting;
00290     }
00292 
00294 
00295     WT_Boolean      bold() const                                         {   return m_bold;       }
00297     WT_Boolean      italic() const                                       {   return m_italic;     }
00299     WT_Boolean      underlined() const                                   {   return m_underlined; }
00301     void            set_bold(WT_Boolean bold)                            {   m_bold = bold;       }
00303     void            set_italic(WT_Boolean italic)                        {   m_italic = italic;   }
00305     void            set_underlined(WT_Boolean underlined)                {   m_underlined = underlined;  }
00307     WT_Boolean      operator==(WT_Font_Option_Style  const & in) const
00308     {
00309         return (m_bold       == in.m_bold
00310              && m_italic     == in.m_italic
00311              && m_underlined == in.m_underlined);
00312     }
00314     WT_Boolean      operator!=(WT_Font_Option_Style  const & in) const
00315     {
00316         return (m_bold      != in.m_bold
00317              || m_italic    != in.m_italic
00318              || m_underlined != in.m_underlined);
00319     }
00321 
00323     WT_ID            object_id() const;
00324     WT_Result        serialize  (WT_Object const & parent, WT_File & file) const;
00325     WT_Result        materialize(WT_Object       & parent, WT_Optioncode const & optioncode, WT_File & file);
00327 };
00328 
00329 
00330 // ====================================================================================
00332 class WHIPTK_API WT_Font_Option_Height : public WT_Option
00333 {
00334 private:
00335     WT_Integer32        m_height;
00336 
00337 public:
00339 
00340     WT_Font_Option_Height()
00341         : m_height (1000) // Pull a rabbit out of a hat! Shouldn't hard code data like this.
00342     { }
00344     WT_Font_Option_Height(WT_Integer32 height)
00345         : m_height(height)
00346     { }
00348 
00350 
00351     WT_Integer32    height() const                                      {   return m_height;     }
00353     void            set(WT_Integer32 height)                            {   m_height = height;   }
00355     WT_Boolean      operator==(WT_Font_Option_Height const & in) const  {   return (m_height == in.m_height);   }
00357     WT_Boolean      operator!=(WT_Font_Option_Height const & in) const  {   return (m_height != in.m_height);   }
00359     operator WT_Integer32() const                       {   return m_height;     }
00361 
00363     WT_ID            object_id() const;
00364     WT_Result        serialize  (WT_Object const & parent, WT_File & file) const;
00365     WT_Result        materialize(WT_Object       & parent, WT_Optioncode const & optioncode, WT_File & file);
00367 };
00368 
00369 
00370 // ====================================================================================
00372 class WHIPTK_API WT_Font_Option_Rotation : public WT_Option
00373 {
00374 private:
00375     WT_Unsigned_Integer16        m_rotation;
00376 
00377 public:
00379 
00380     WT_Font_Option_Rotation()
00381         : m_rotation (0)
00382     { }
00384     WT_Font_Option_Rotation(
00385         WT_Unsigned_Integer16 rotation 
00386         )
00387         : m_rotation(rotation)
00388     { }
00390 
00392 
00393     WT_Unsigned_Integer16   rotation() const                                        {   return m_rotation;     }
00395     void                    set(WT_Unsigned_Integer16 rotation)                     {   m_rotation = rotation; }
00397     WT_Boolean              operator==(WT_Font_Option_Rotation const & in) const    {   return (m_rotation == in.m_rotation);   }
00399     WT_Boolean              operator!=(WT_Font_Option_Rotation const & in) const    {   return (m_rotation != in.m_rotation);   }
00401     operator WT_Unsigned_Integer16() const                  {   return m_rotation;     }
00403 
00405     WT_ID            object_id() const;
00406     WT_Result        serialize  (WT_Object const & parent, WT_File & file) const;
00407     WT_Result        materialize(WT_Object       & parent, WT_Optioncode const & optioncode, WT_File & file);
00409 
00410 };
00411 
00412 
00413 // ====================================================================================
00415 
00420 class WHIPTK_API WT_Font_Option_Width_Scale : public WT_Option
00421 {
00422 private:
00423     WT_Unsigned_Integer16        m_width_scale;
00424 
00425 public:
00427 
00428     WT_Font_Option_Width_Scale()
00429         : m_width_scale (1024)
00430     { }
00432     WT_Font_Option_Width_Scale( WT_Unsigned_Integer16 width_scale)
00433         : m_width_scale(width_scale)
00434     { }
00436 
00438 
00439     WT_Unsigned_Integer16   width_scale() const                     {   return m_width_scale;        }
00441     void                    set(WT_Unsigned_Integer16 width_scale)  {   m_width_scale = width_scale; }
00443     WT_Boolean              operator==(WT_Font_Option_Width_Scale const & in) const  {   return (m_width_scale == in.m_width_scale);   }
00445     WT_Boolean              operator!=(WT_Font_Option_Width_Scale const & in) const  {   return (m_width_scale != in.m_width_scale);   }
00447     operator WT_Unsigned_Integer16() const                   {   return m_width_scale;     }
00449 
00451     WT_ID            object_id() const;
00452     WT_Result        serialize  (WT_Object const & parent, WT_File & file) const;
00453     WT_Result        materialize(WT_Object       & parent, WT_Optioncode const & optioncode, WT_File & file);
00455 
00456 };
00457 
00458 
00459 // ====================================================================================
00461 
00467 class WHIPTK_API WT_Font_Option_Spacing : public WT_Option
00468 {
00469 private:
00470     WT_Unsigned_Integer16        m_spacing;
00471 
00472 public:
00474 
00475     WT_Font_Option_Spacing()
00476         : m_spacing (1024) // Pulling a rabit out of our hat!  Shouldn't use hard coded constants.
00477     { }
00479     WT_Font_Option_Spacing(WT_Unsigned_Integer16 spacing)
00480         : m_spacing(spacing)
00481     { }
00483 
00485 
00486     WT_Unsigned_Integer16   spacing() const                                      {   return m_spacing;        }
00488     void                    set(WT_Unsigned_Integer16 spacing)                   {   m_spacing = spacing;     }
00490     WT_Boolean              operator==(WT_Font_Option_Spacing const & in) const  {   return (m_spacing == in.m_spacing);   }
00492     WT_Boolean              operator!=(WT_Font_Option_Spacing const & in) const  {   return (m_spacing != in.m_spacing);   }
00494     operator WT_Unsigned_Integer16() const               {   return m_spacing;     }
00496 
00498     WT_ID            object_id() const;
00499     WT_Result        serialize  (WT_Object const & parent, WT_File & file) const;
00500     WT_Result        materialize(WT_Object       & parent, WT_Optioncode const & optioncode, WT_File & file);
00502 
00503 };
00504 
00505 // ====================================================================================
00507 class WHIPTK_API WT_Font_Option_Oblique : public WT_Option
00508 {
00509 private:
00510     WT_Unsigned_Integer16        m_oblique;
00511 
00512 public:
00514 
00515     WT_Font_Option_Oblique()
00516         : m_oblique (0)
00517     { }
00519     WT_Font_Option_Oblique(
00520         WT_Unsigned_Integer16 oblique 
00521         )
00522         : m_oblique(oblique)
00523     { }
00525 
00527 
00528     WT_Unsigned_Integer16   oblique() const                                      {   return m_oblique;        }
00530     void                    set(WT_Unsigned_Integer16 oblique)                   {   m_oblique = oblique;     }
00532     WT_Boolean              operator==(WT_Font_Option_Oblique const & in) const  {   return (m_oblique == in.m_oblique);   }
00534     WT_Boolean              operator!=(WT_Font_Option_Oblique const & in) const  {   return (m_oblique != in.m_oblique);   }
00536     operator WT_Unsigned_Integer16() const               {   return m_oblique;     }
00537 
00539 
00541     WT_ID            object_id() const;
00542     WT_Result        serialize  (WT_Object const & parent, WT_File & file) const;
00543     WT_Result        materialize(WT_Object       & parent, WT_Optioncode const & optioncode, WT_File & file);
00545 
00546 };
00547 
00548 
00549 // ====================================================================================
00551 class WHIPTK_API WT_Font_Option_Flags : public WT_Option
00552 {
00553 private:
00554     WT_Integer32        m_flags;
00555 
00556 public:
00558 
00559     WT_Font_Option_Flags()
00560         : m_flags (0)
00561     { }
00563     WT_Font_Option_Flags(WT_Integer32 flags)
00564         : m_flags(flags)
00565     { }
00567 
00569 
00570     WT_Integer32    flags() const                                       {   return m_flags;     }
00572     void            set(WT_Integer32 flags)                             {   m_flags = flags;    }
00574     WT_Boolean      operator==(WT_Font_Option_Flags const & in) const   {   return (m_flags == in.m_flags);   }
00576     WT_Boolean      operator!=(WT_Font_Option_Flags const & in) const   {   return (m_flags != in.m_flags);   }
00578     operator WT_Integer32() const                       {   return m_flags;     }
00580 
00582     WT_ID            object_id() const;
00583     WT_Result        serialize  (WT_Object const & parent, WT_File & file) const;
00584     WT_Result        materialize(WT_Object       & parent, WT_Optioncode const & optioncode, WT_File & file);
00586 
00587 };
00588 
00589 
00590 // ====================================================================================
00591 
00593 class WHIPTK_API WT_Font_Optioncode : public WT_Optioncode
00594 {
00595 public:
00596 
00598     enum
00599     {
00600         Unknown_Option  = 0,
00601         Font_Name_Option,
00602         Charset_Option,
00603         Pitch_Option,
00604         Family_Option,
00605         Style_Option,
00606         Height_Option,
00607         Rotation_Option,
00608         Width_Scale_Option,
00609         Spacing_Option,
00610         Oblique_Option,
00611         Flags_Option
00612     };
00613 
00615     virtual int option_id_from_optioncode();
00616 };
00617 
00618 #endif // FONT_OPTIONS_HEADER

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