00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00031
00032 #pragma once
00033
00034 #include "../api_display.h"
00035 #include "../../Core/System/sharedptr.h"
00036 #include "../Render/graphic_context.h"
00037 #include "../Image/pixel_buffer.h"
00038 #include "font_description.h"
00039
00040 class CL_FontProvider;
00041 class CL_Font_Impl;
00042
00046 class CL_API_DISPLAY CL_Font
00047 {
00050
00051 public:
00053 CL_Font();
00054
00055
00056 CL_Font( CL_GraphicContext &context, const CL_StringRef &typeface_name, int height);
00057
00058
00059 CL_Font( CL_GraphicContext &context, const CL_FontDescription &desc);
00060
00064 CL_Font(CL_FontProvider *provider);
00065
00069 CL_Font(const CL_Font ©);
00070
00071 virtual ~CL_Font();
00072
00076
00077 public:
00078
00082 bool is_null();
00083
00085 CL_FontProvider *get_provider() const;
00086
00090
00091 public:
00092
00102 void draw_text(CL_GraphicContext &gc, int x, int y, const CL_StringRef &text, const CL_Colorf &color = CL_Colorf::white);
00103
00113 void draw_text(CL_GraphicContext &gc, float x, float y, const CL_StringRef &text, const CL_Colorf &color = CL_Colorf::white);
00114
00123 void draw_text(CL_GraphicContext &gc, const CL_Pointf &position, const CL_StringRef &text, const CL_Colorf &color = CL_Colorf::white);
00124
00131 CL_Size get_text_size(CL_GraphicContext &gc, const CL_StringRef &text);
00132
00134 CL_FontMetrics get_font_metrics(CL_GraphicContext &gc);
00135
00144 int get_character_index(CL_GraphicContext &gc, const CL_String &text, const CL_Point &point);
00145
00149
00150 private:
00151 CL_SharedPtr<CL_Font_Impl> impl;
00153 };
00154
00158 class CL_API_DISPLAY CL_FontPixelBuffer
00159 {
00160 public:
00161 CL_FontPixelBuffer() : glyph(0), empty_buffer(true), offset(0,0), increment(0,0) { };
00162
00164 unsigned int glyph;
00165
00167 bool empty_buffer;
00168
00170 CL_PixelBuffer buffer;
00171
00173
00176 CL_Point offset;
00177
00179
00182 CL_Point increment;
00183 };
00184
00186