Go to the documentation of this file.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() const;
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
00135 void draw_text_ellipsis(CL_GraphicContext &gc, int x, int y, CL_Rect content_box, const CL_StringRef &text, const CL_Colorf &color = CL_Colorf::white);
00136
00147 void draw_text_ellipsis(CL_GraphicContext &gc, float x, float y, CL_Rectf content_box, const CL_StringRef &text, const CL_Colorf &color = CL_Colorf::white);
00148
00158 void draw_text_ellipsis(CL_GraphicContext &gc, const CL_Pointf &position, CL_Rectf content_box, const CL_StringRef &text, const CL_Colorf &color = CL_Colorf::white);
00159
00168 CL_Size get_text_size(CL_GraphicContext &gc, const CL_StringRef &text);
00169
00176 CL_Size get_glyph_size(CL_GraphicContext &gc, unsigned int glyph);
00177
00179 CL_FontMetrics get_font_metrics();
00180
00189 int get_character_index(CL_GraphicContext &gc, const CL_String &text, const CL_Point &point);
00190
00194
00195 private:
00196 CL_SharedPtr<CL_Font_Impl> impl;
00198 };
00199
00203 class CL_API_DISPLAY CL_FontPixelBuffer
00204 {
00205 public:
00206 CL_FontPixelBuffer() : glyph(0), empty_buffer(true), offset(0,0), increment(0,0) { };
00207
00209 unsigned int glyph;
00210
00212 bool empty_buffer;
00213
00215 CL_PixelBuffer buffer;
00216
00218 CL_Rect buffer_rect;
00219
00221
00224 CL_Point offset;
00225
00227
00230 CL_Point increment;
00231 };
00232
00234