font_description.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2011 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Mark Page
00027 **    Harry Storbacka
00028 */
00029 
00032 
00033 #pragma once
00034 
00035 #include "../api_display.h"
00036 #include "../../Core/Text/string_types.h"
00037 #include "../../Core/System/sharedptr.h"
00038 
00039 class CL_DisplayWindow;
00040 class CL_FontDescription_Impl;
00041 
00046 class CL_API_DISPLAY CL_FontDescription
00047 {
00050 
00051 public:
00053         CL_FontDescription();
00054 
00055         virtual ~CL_FontDescription();
00056 
00060         static CL_FontDescription create_null_object();
00061 
00065 
00066 public:
00067 
00068         enum Charset
00069         {
00070                 charset_default,
00071                 charset_ansi,
00072                 charset_baltic,
00073                 charset_chinesebig5,
00074                 charset_easteurope,
00075                 charset_gb2312,
00076                 charset_greek,
00077                 charset_hangul,
00078                 charset_mac,
00079                 charset_oem,
00080                 charset_russian,
00081                 charset_shiftjis,
00082                 charset_symbol,
00083                 charset_turkish,
00084                 charset_vietnamese,
00085                 charset_johab,
00086                 charset_arabic,
00087                 charset_hebrew,
00088                 charset_thai
00089         };
00090 
00092         bool is_null() const { return !impl; }
00093 
00095         void throw_if_null() const;
00096 
00098         const CL_String &get_typeface_name() const;
00099 
00101         int get_height() const;
00102 
00104         int get_average_width() const;
00105 
00107         float get_escapement() const;
00108 
00110         float get_orientation() const;
00111 
00113         int get_weight() const;
00114 
00116         bool get_italic() const;
00117 
00119         bool get_underline() const;
00120 
00122         bool get_strikeout() const;
00123 
00125         bool get_fixed_pitch() const;
00126 
00128         bool get_anti_alias() const;
00129 
00131         bool get_subpixel() const;
00132 
00134         Charset get_charset() const;
00135 
00137         bool operator==(const CL_FontDescription &other) const;
00138 
00142 
00143 public:
00145         CL_FontDescription &operator =(const CL_FontDescription &copy);
00146 
00147         // \brief Copy the entire font description (not just the implementation)
00148         void clone(const CL_FontDescription &copy);
00149 
00151         void set_typeface_name(const CL_String &name);
00152 
00154         void set_height(int value);
00155 
00157         void set_average_width(int value);
00158 
00160         void set_escapement(float value);
00161 
00163         void set_orientation(float value);
00164 
00166         void set_weight(int value);
00167 
00169         void set_italic(bool setting = true);
00170 
00172         void set_underline(bool setting = true);
00173 
00175         void set_strikeout(bool setting = true);
00176 
00178         void set_fixed_pitch(bool setting = true);
00179 
00181         void set_anti_alias(bool setting = true);
00182 
00184         void set_subpixel(bool setting = true);
00185 
00189         void set_charset(Charset new_charset);
00190 
00194 
00195 private:
00196         CL_SharedPtr<CL_FontDescription_Impl> impl;
00198 };
00199 
00201