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 "font.h"
00036
00037 #include "../2D/subtexture.h"
00038 #include "../Render/texture.h"
00039
00040 class CL_FontProvider;
00041 class CL_Font_System_Impl;
00042 class CL_TextureGroup;
00043
00044 class CL_FontProvider_System;
00045
00049 typedef struct _CL_Font_System_Position
00050 {
00052 unsigned int glyph;
00053
00055 int x_pos;
00056
00058 int y_pos;
00059
00061 int width;
00062
00064 int height;
00065
00067 int x_offset;
00068
00070 int y_offset;
00071
00073 int x_increment;
00074
00076 int y_increment;
00077 } CL_Font_System_Position;
00078
00082 class CL_Font_TextureGlyph
00083 {
00084 public:
00085 CL_Font_TextureGlyph() : glyph(0), empty_buffer(true), offset(0,0), increment(0,0) { };
00086
00088 unsigned int glyph;
00089
00091 bool empty_buffer;
00092
00094 CL_Subtexture subtexture;
00095
00097 CL_Rect geometry;
00098
00100
00103 CL_Point offset;
00104
00106
00109 CL_Point increment;
00110 };
00111
00112
00114
00118 class CL_API_DISPLAY CL_Font_System : public CL_Font
00119 {
00122
00123 public:
00125 CL_Font_System();
00126
00132 CL_Font_System( CL_GraphicContext &context, const CL_StringRef &typeface_name, int height);
00133
00138 CL_Font_System( CL_GraphicContext &context, const CL_FontDescription &desc);
00139
00140 ~CL_Font_System();
00141
00145
00146 public:
00147
00149 CL_FontProvider_System *get_provider() const;
00150
00152 CL_Font_TextureGlyph *get_glyph(CL_GraphicContext &gc, int glyph);
00153
00157
00158 public:
00159
00161 void set_texture_group(CL_TextureGroup &new_texture_group);
00162
00164 void load_font( CL_GraphicContext &context, const CL_FontDescription &desc);
00165
00167 void free_font();
00168
00170
00173 void insert_glyph(CL_GraphicContext &gc, CL_Font_System_Position &position, CL_PixelBuffer &pixel_buffer);
00174
00176
00178 void insert_glyph(CL_GraphicContext &gc, const CL_StringRef &text);
00179
00181 void set_font_metrics(const CL_FontMetrics &metrics);
00182
00184 static void register_font(const CL_StringRef &font_filename, const CL_StringRef &font_typeface);
00185
00189
00190 private:
00192 };
00193