font_metrics.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 **    Magnus Norddahl
00027 **    Harry Storbacka
00028 **    Mark Page
00029 */
00030 
00033 
00034 #pragma once
00035 
00036 #include "../api_display.h"
00037 #include "../../Core/System/sharedptr.h"
00038 
00039 class CL_FontMetrics_Impl;
00040 
00044 class CL_API_DISPLAY CL_FontMetrics
00045 {
00048 
00049 public:
00051         CL_FontMetrics();
00052 
00053         CL_FontMetrics(
00054                 float height,
00055                 float ascent=0.0f,
00056                 float descent=0.0f,
00057                 float internal_leading=0.0f,
00058                 float external_leading=0.0f,
00059                 float average_character_width=0.0f,
00060                 float max_character_width=0.0f,
00061                 float weight=0.0f,
00062                 float overhang=0.0f,
00063                 float digitized_aspect_x=0.0f,
00064                 float digitized_aspect_y=0.0f,
00065                 bool italic=false,
00066                 bool underlined=false,
00067                 bool struck_out=false,
00068                 bool fixed_pitch=false
00069         );
00070 
00071         ~CL_FontMetrics();
00072 
00076 
00077 public:
00079         bool is_null() const { return !impl; }
00080 
00082         void throw_if_null() const;
00083 
00085         float get_height() const;
00086 
00088         float get_ascent() const;
00089 
00091         float get_descent() const;
00092 
00094         float get_internal_leading() const;
00095 
00097         float get_external_leading() const;
00098 
00100 
00102         float get_average_character_width() const;
00103 
00105         float get_max_character_width() const;
00106 
00108         float get_weight() const;
00109 
00111         float get_overhang() const;
00112 
00114         float get_digitized_aspect_x() const;
00115 
00117         float get_digitized_aspect_y() const;
00118 
00120         CL_String::char_type get_first_char() const;
00121 
00123         CL_String::char_type get_last_char() const;
00124 
00126         CL_String::char_type get_default_char() const;
00127 
00129         CL_String::char_type get_word_break_char() const;
00130 
00132         bool is_italic() const;
00133 
00135         bool is_underlined() const;
00136 
00138         bool is_struck_out() const;
00139 
00141         bool is_fixed_pitch() const;
00142 
00146 
00147 public:
00148 
00152         void set_height(float value);
00153 
00157         void set_ascent(float value);
00158 
00162         void set_descent(float value);
00163 
00167         void set_internal_leading(float value);
00168 
00172         void set_external_leading(float value);
00173 
00177         void set_average_character_width(float value);
00178 
00182         void set_max_character_width(float value);
00183 
00187         void set_weight(float value);
00188 
00192         void set_overhang(float value);
00193 
00197         void set_digitized_aspect_x(float value);
00198 
00202         void set_digitized_aspect_y(float value);
00203 
00207         void set_italic(bool value);
00208 
00212         void set_underlined(bool value);
00213 
00217         void set_struck_out(bool value);
00218 
00222         void set_fixed_pitch(bool value);
00223 
00224 
00228 
00229 private:
00230         CL_SharedPtr<CL_FontMetrics_Impl> impl;
00232 };
00233 
00235