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
00029
00032
00033 #pragma once
00034
00035 #include "../api_display.h"
00036 #include "font.h"
00037
00038 class CL_Font_Vector_Impl;
00039 class CL_FontMetrics;
00040 class CL_VirtualDirectory;
00041 class CL_GlyphPrimitivesArrayOutline;
00042 class CL_GlyphPrimitivesArray;
00043 class CL_FontProvider_Vector;
00044
00048 class CL_GlyphPrimitivesArray
00049 {
00051 public:
00052
00056 CL_GlyphPrimitivesArray(int num_triangles)
00057 {
00058 int size = num_triangles*3;
00059 vertex.resize(size);
00060 }
00061
00062 ~CL_GlyphPrimitivesArray()
00063 {
00064 }
00065
00066 std::vector<CL_Vec2f> vertex;
00067 };
00068
00072 class CL_GlyphPrimitivesArrayOutline
00073 {
00075 public:
00076
00080 CL_GlyphPrimitivesArrayOutline(int num_lines)
00081 {
00082 vertex.resize(1);
00083 vertex[0].resize(num_lines+1);
00084 }
00085
00087 public:
00088
00092 void new_subarray(int num_lines)
00093 {
00094 std::vector<std::vector<CL_Vec2f> >::size_type size = vertex.size();
00095 vertex.resize(size+1);
00096
00097 vertex[size].resize(num_lines+1);
00098 }
00099
00100 std::vector< std::vector<CL_Vec2f> > vertex;
00101 };
00102
00106 class CL_API_DISPLAY CL_Font_Vector : public CL_Font
00107 {
00110
00111 public:
00113 CL_Font_Vector();
00114
00119 CL_Font_Vector( const CL_StringRef &typeface_name, int height);
00120
00126 CL_Font_Vector( const CL_StringRef &typeface_name, int height, CL_IODevice &file);
00127
00133 CL_Font_Vector( const CL_StringRef &typeface_name, int height, const CL_VirtualDirectory &directory);
00134
00138 CL_Font_Vector( const CL_FontDescription &desc);
00139
00144 CL_Font_Vector( const CL_FontDescription &desc, CL_IODevice &file);
00145
00150 CL_Font_Vector( const CL_FontDescription &desc, const CL_VirtualDirectory &directory);
00151
00152 ~CL_Font_Vector();
00153
00157
00158 public:
00159
00161 CL_FontProvider_Vector *get_provider() const;
00162
00166
00167 public:
00169 int get_glyph_count(const CL_StringRef &text);
00170
00172 CL_GlyphPrimitivesArrayOutline get_glyph_outline(int glyph);
00173
00175 CL_GlyphPrimitivesArray get_glyph_triangles(int glyph);
00176
00178 void get_glyphs(
00179 const CL_StringRef &text,
00180 int *out_glyphs,
00181 float *out_interspacing_x,
00182 float *out_interspacing_y);
00183
00185 void draw_glyphs(
00186 CL_GraphicContext &gc,
00187 float x,
00188 float y,
00189 int *glyphs,
00190 int length,
00191 bool filled = true,
00192 float *interspacing_x = 0,
00193 float *interspacing_y = 0,
00194 const CL_Colorf &color = CL_Colorf::white);
00195
00202 CL_Sizef get_glyphs_size(int *glyphs, int length);
00203
00207
00209 };
00210