ccpanose.h

Go to the documentation of this file.
00001 // $Id: ccpanose.h 751 2006-03-31 15:43:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 /********************************************************************************************
00099 
00100 >   CCPanose.h
00101 
00102     Author:     Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
00103     Created:    24/05/96
00104     Purpose:    Kernel Panose related class and functions
00105 
00106 ********************************************************************************************/
00107 
00108 #ifndef INC_CCPANOSE
00109 #define INC_CCPANOSE
00110 
00111 #if !defined(__WXMSW__)
00112 struct PANOSE
00113 {
00114     BYTE                bFamilyType;
00115     BYTE                bSerifStyle;
00116     BYTE                bWeight;
00117     BYTE                bProportion;
00118     BYTE                bContrast;
00119     BYTE                bStrokeVariation;
00120     BYTE                bArmStyle;
00121     BYTE                bLetterform;
00122     BYTE                bMidline;
00123     BYTE                bXHeight;
00124 };
00125 typedef PANOSE         *LPPANOSE;
00126 
00127 #define PAN_ANY                         0 /* Any                            */
00128 #define PAN_NO_FIT                      1 /* No Fit                         */
00129 
00130 #define PAN_FAMILY_TEXT_DISPLAY         2 /* Text and Display               */
00131 #define PAN_FAMILY_SCRIPT               3 /* Script                         */
00132 #define PAN_FAMILY_DECORATIVE           4 /* Decorative                     */
00133 #define PAN_FAMILY_PICTORIAL            5 /* Pictorial                      */
00134 
00135 #define PAN_SERIF_COVE                  2 /* Cove                           */
00136 #define PAN_SERIF_OBTUSE_COVE           3 /* Obtuse Cove                    */
00137 #define PAN_SERIF_SQUARE_COVE           4 /* Square Cove                    */
00138 #define PAN_SERIF_OBTUSE_SQUARE_COVE    5 /* Obtuse Square Cove             */
00139 #define PAN_SERIF_SQUARE                6 /* Square                         */
00140 #define PAN_SERIF_THIN                  7 /* Thin                           */
00141 #define PAN_SERIF_BONE                  8 /* Bone                           */
00142 #define PAN_SERIF_EXAGGERATED           9 /* Exaggerated                    */
00143 #define PAN_SERIF_TRIANGLE             10 /* Triangle                       */
00144 #define PAN_SERIF_NORMAL_SANS          11 /* Normal Sans                    */
00145 #define PAN_SERIF_OBTUSE_SANS          12 /* Obtuse Sans                    */
00146 #define PAN_SERIF_PERP_SANS            13 /* Prep Sans                      */
00147 #define PAN_SERIF_FLARED               14 /* Flared                         */
00148 #define PAN_SERIF_ROUNDED              15 /* Rounded                        */
00149 
00150 #define PAN_WEIGHT_VERY_LIGHT           2 /* Very Light                     */
00151 #define PAN_WEIGHT_LIGHT                3 /* Light                          */
00152 #define PAN_WEIGHT_THIN                 4 /* Thin                           */
00153 #define PAN_WEIGHT_BOOK                 5 /* Book                           */
00154 #define PAN_WEIGHT_MEDIUM               6 /* Medium                         */
00155 #define PAN_WEIGHT_DEMI                 7 /* Demi                           */
00156 #define PAN_WEIGHT_BOLD                 8 /* Bold                           */
00157 #define PAN_WEIGHT_HEAVY                9 /* Heavy                          */
00158 #define PAN_WEIGHT_BLACK               10 /* Black                          */
00159 #define PAN_WEIGHT_NORD                11 /* Nord                           */
00160 
00161 #define PAN_PROP_OLD_STYLE              2 /* Old Style                      */
00162 #define PAN_PROP_MODERN                 3 /* Modern                         */
00163 #define PAN_PROP_EVEN_WIDTH             4 /* Even Width                     */
00164 #define PAN_PROP_EXPANDED               5 /* Expanded                       */
00165 #define PAN_PROP_CONDENSED              6 /* Condensed                      */
00166 #define PAN_PROP_VERY_EXPANDED          7 /* Very Expanded                  */
00167 #define PAN_PROP_VERY_CONDENSED         8 /* Very Condensed                 */
00168 #define PAN_PROP_MONOSPACED             9 /* Monospaced                     */
00169 
00170 #define PAN_CONTRAST_NONE               2 /* None                           */
00171 #define PAN_CONTRAST_VERY_LOW           3 /* Very Low                       */
00172 #define PAN_CONTRAST_LOW                4 /* Low                            */
00173 #define PAN_CONTRAST_MEDIUM_LOW         5 /* Medium Low                     */
00174 #define PAN_CONTRAST_MEDIUM             6 /* Medium                         */
00175 #define PAN_CONTRAST_MEDIUM_HIGH        7 /* Mediim High                    */
00176 #define PAN_CONTRAST_HIGH               8 /* High                           */
00177 #define PAN_CONTRAST_VERY_HIGH          9 /* Very High                      */
00178 
00179 #define PAN_STROKE_GRADUAL_DIAG         2 /* Gradual/Diagonal               */
00180 #define PAN_STROKE_GRADUAL_TRAN         3 /* Gradual/Transitional           */
00181 #define PAN_STROKE_GRADUAL_VERT         4 /* Gradual/Vertical               */
00182 #define PAN_STROKE_GRADUAL_HORZ         5 /* Gradual/Horizontal             */
00183 #define PAN_STROKE_RAPID_VERT           6 /* Rapid/Vertical                 */
00184 #define PAN_STROKE_RAPID_HORZ           7 /* Rapid/Horizontal               */
00185 #define PAN_STROKE_INSTANT_VERT         8 /* Instant/Vertical               */
00186 
00187 #define PAN_STRAIGHT_ARMS_HORZ          2 /* Straight Arms/Horizontal       */
00188 #define PAN_STRAIGHT_ARMS_WEDGE         3 /* Straight Arms/Wedge            */
00189 #define PAN_STRAIGHT_ARMS_VERT          4 /* Straight Arms/Vertical         */
00190 #define PAN_STRAIGHT_ARMS_SINGLE_SERIF  5 /* Straight Arms/Single-Serif     */
00191 #define PAN_STRAIGHT_ARMS_DOUBLE_SERIF  6 /* Straight Arms/Double-Serif     */
00192 #define PAN_BENT_ARMS_HORZ              7 /* Non-Straight Arms/Horizontal   */
00193 #define PAN_BENT_ARMS_WEDGE             8 /* Non-Straight Arms/Wedge        */
00194 #define PAN_BENT_ARMS_VERT              9 /* Non-Straight Arms/Vertical     */
00195 #define PAN_BENT_ARMS_SINGLE_SERIF     10 /* Non-Straight Arms/Single-Serif */
00196 #define PAN_BENT_ARMS_DOUBLE_SERIF     11 /* Non-Straight Arms/Double-Serif */
00197 
00198 #define PAN_LETT_NORMAL_CONTACT         2 /* Normal/Contact                 */
00199 #define PAN_LETT_NORMAL_WEIGHTED        3 /* Normal/Weighted                */
00200 #define PAN_LETT_NORMAL_BOXED           4 /* Normal/Boxed                   */
00201 #define PAN_LETT_NORMAL_FLATTENED       5 /* Normal/Flattened               */
00202 #define PAN_LETT_NORMAL_ROUNDED         6 /* Normal/Rounded                 */
00203 #define PAN_LETT_NORMAL_OFF_CENTER      7 /* Normal/Off Center              */
00204 #define PAN_LETT_NORMAL_SQUARE          8 /* Normal/Square                  */
00205 #define PAN_LETT_OBLIQUE_CONTACT        9 /* Oblique/Contact                */
00206 #define PAN_LETT_OBLIQUE_WEIGHTED      10 /* Oblique/Weighted               */
00207 #define PAN_LETT_OBLIQUE_BOXED         11 /* Oblique/Boxed                  */
00208 #define PAN_LETT_OBLIQUE_FLATTENED     12 /* Oblique/Flattened              */
00209 #define PAN_LETT_OBLIQUE_ROUNDED       13 /* Oblique/Rounded                */
00210 #define PAN_LETT_OBLIQUE_OFF_CENTER    14 /* Oblique/Off Center             */
00211 #define PAN_LETT_OBLIQUE_SQUARE        15 /* Oblique/Square                 */
00212 
00213 #define PAN_MIDLINE_STANDARD_TRIMMED    2 /* Standard/Trimmed               */
00214 #define PAN_MIDLINE_STANDARD_POINTED    3 /* Standard/Pointed               */
00215 #define PAN_MIDLINE_STANDARD_SERIFED    4 /* Standard/Serifed               */
00216 #define PAN_MIDLINE_HIGH_TRIMMED        5 /* High/Trimmed                   */
00217 #define PAN_MIDLINE_HIGH_POINTED        6 /* High/Pointed                   */
00218 #define PAN_MIDLINE_HIGH_SERIFED        7 /* High/Serifed                   */
00219 #define PAN_MIDLINE_CONSTANT_TRIMMED    8 /* Constant/Trimmed               */
00220 #define PAN_MIDLINE_CONSTANT_POINTED    9 /* Constant/Pointed               */
00221 #define PAN_MIDLINE_CONSTANT_SERIFED   10 /* Constant/Serifed               */
00222 #define PAN_MIDLINE_LOW_TRIMMED        11 /* Low/Trimmed                    */
00223 #define PAN_MIDLINE_LOW_POINTED        12 /* Low/Pointed                    */
00224 #define PAN_MIDLINE_LOW_SERIFED        13 /* Low/Serifed                    */
00225 
00226 #define PAN_XHEIGHT_CONSTANT_SMALL      2 /* Constant/Small                 */
00227 #define PAN_XHEIGHT_CONSTANT_STD        3 /* Constant/Standard              */
00228 #define PAN_XHEIGHT_CONSTANT_LARGE      4 /* Constant/Large                 */
00229 #define PAN_XHEIGHT_DUCKING_SMALL       5 /* Ducking/Small                  */
00230 #define PAN_XHEIGHT_DUCKING_STD         6 /* Ducking/Standard               */
00231 #define PAN_XHEIGHT_DUCKING_LARGE       7 /* Ducking/Large                  */
00232 
00233 struct OUTLINETEXTMETRIC
00234 {
00235     PANOSE              otmPanoseNumber;
00236 };
00237 #endif
00238 
00239 /********************************************************************************************
00240 
00241 >   class CCPanose
00242 
00243     Author:     Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
00244     Created:    24/05/96
00245     Base Class: CCObject
00246     Purpose:    Class to hold and manipulate Panose numbers
00247     See also:   class FontMan, class ATMFontMan, class TTFontMan
00248 
00249 ********************************************************************************************/
00250 
00251 class CCPanose : public CCObject
00252 {
00253     CC_DECLARE_DYNCREATE(CCPanose)
00254 
00255 // private member variables
00256 private:
00257     // identical to the member variables of the Win32 PANOSE structure. We duplicate them here
00258     // since this is kernel code - platform independent (alledgedly!)
00259     BYTE mFamilyType;
00260     BYTE mSerifStyle;
00261     BYTE mWeight;
00262     BYTE mProportion;
00263     BYTE mContrast;
00264     BYTE mStrokeVariation;
00265     BYTE mArmStyle;
00266     BYTE mLetterform;
00267     BYTE mMidline;
00268     BYTE mXHeight;
00269 
00270 // constructor, copy constructor, destructor, assignment
00271 public:
00272     CCPanose();
00273     CCPanose(const PANOSE &PanoseNumber);
00274 
00275 // public member functions
00276 public:
00277     void SetAllToAny();         // Sets all components of the panose number to PAN_ANY
00278     void SetAll(BYTE, BYTE, BYTE, BYTE, BYTE, BYTE, BYTE, BYTE, BYTE, BYTE);
00279     void operator=(const CCPanose & x);
00280 
00281     BOOL BodgePanoseNumber(BOOL Bold, BOOL Italic);
00282     BOOL BodgeToNormal();
00283 
00284 // static member functions
00285 public:
00286     static UINT32 Distance(const CCPanose &x, const CCPanose &y);
00287 private:
00288     static UINT32 DistanceFamilyType(BYTE x, BYTE y);
00289     static UINT32 DistanceSerifStyle(BYTE x, BYTE y);
00290     static UINT32 DistanceWeight(BYTE x, BYTE y);
00291     static UINT32 DistanceProportion(BYTE x, BYTE y);
00292     static UINT32 DistanceContrast(BYTE x, BYTE y);
00293     static UINT32 DistanceStrokeVariation(BYTE x, BYTE y);
00294     static UINT32 DistanceArmStyle(BYTE x, BYTE y);
00295     static UINT32 DistanceLetterform(BYTE x, BYTE y);
00296     static UINT32 DistanceMidline(BYTE x, BYTE y);
00297     static UINT32 DistanceXHeight(BYTE x, BYTE y);
00298     
00299 // separate set and get functions, to hide the internals of this class. the internals
00300 // may change - we could have a member structure of the OS's panose class.
00301 public:
00302     void SetFamilyType(BYTE value) {mFamilyType = value;};
00303     void SetSerifStyle(BYTE value) {mSerifStyle = value;};
00304     void SetWeight(BYTE value) {mWeight = value;};
00305     void SetProportion(BYTE value) {mProportion = value;};
00306     void SetContrast(BYTE value) {mContrast = value;};
00307     void SetStrokeVariation(BYTE value) {mStrokeVariation = value;};
00308     void SetArmStyle(BYTE value) {mArmStyle = value;};
00309     void SetLetterform(BYTE value) {mLetterform = value;};
00310     void SetMidline(BYTE value) {mMidline = value;};
00311     void SetXHeight(BYTE value) {mXHeight = value;};
00312 
00313     BYTE GetFamilyType() const {return mFamilyType;};
00314     BYTE GetSerifStyle() const {return mSerifStyle;};
00315     BYTE GetWeight() const {return mWeight;};
00316     BYTE GetProportion() const {return mProportion;};
00317     BYTE GetContrast() const {return mContrast;};
00318     BYTE GetStrokeVariation() const {return mStrokeVariation;};
00319     BYTE GetArmStyle() const {return mArmStyle;};
00320     BYTE GetLetterform() const {return mLetterform;};
00321     BYTE GetMidline() const {return mMidline;};
00322     BYTE GetXHeight() const {return mXHeight;};
00323 
00324 public:
00325     // debug details, used in various places, such as the camelot debug tree, new file format tree display..
00326     void GetDebugDetails(StringBase * Str);
00327 };
00328 
00329 #endif

Generated on Sat Nov 10 03:44:39 2007 for Camelot by  doxygen 1.4.4