00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "config_text.h"
00020 #include "staticTextFont.h"
00021 #include "textFont.h"
00022 #include "textNode.h"
00023 #include "dynamicTextFont.h"
00024 #include "dynamicTextPage.h"
00025 #include "geomTextGlyph.h"
00026 #include "unicodeLatinMap.h"
00027
00028 #include "dconfig.h"
00029
00030 Configure(config_text);
00031 NotifyCategoryDef(text, "");
00032
00033 ConfigureFn(config_text) {
00034 init_libtext();
00035 }
00036
00037 const bool text_flatten = config_text.GetBool("text-flatten", true);
00038 const bool text_update_cleared_glyphs = config_text.GetBool("text-update-cleared-glyphs", false);
00039 const int text_anisotropic_degree = config_text.GetInt("text-anisotropic-degree", 1);
00040 const int text_texture_margin = config_text.GetInt("text-texture-margin", 2);
00041 const float text_poly_margin = config_text.GetFloat("text-poly-margin", 0.0f);
00042 const int text_page_x_size = config_text.GetInt("text-page-x-size", 256);
00043 const int text_page_y_size = config_text.GetInt("text-page-y-size", 256);
00044 const float text_point_size = config_text.GetFloat("text-point-size", 10.0f);
00045 const float text_pixels_per_unit = config_text.GetFloat("text-pixels-per-unit", 30.0f);
00046 const float text_scale_factor = config_text.GetFloat("text-scale-factor", 2.0f);
00047 const bool text_small_caps = config_text.GetBool("text-small-caps", false);
00048 const float text_small_caps_scale = config_text.GetFloat("text-small-caps-scale", 0.8f);
00049 const string text_default_font = config_text.GetString("text-default-font", "");
00050
00051 Texture::FilterType text_minfilter = Texture::FT_invalid;
00052 Texture::FilterType text_magfilter = Texture::FT_invalid;
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 void
00064 init_libtext() {
00065 static bool initialized = false;
00066 if (initialized) {
00067 return;
00068 }
00069 initialized = true;
00070
00071 StaticTextFont::init_type();
00072 TextFont::init_type();
00073 TextNode::init_type();
00074
00075 #ifdef HAVE_FREETYPE
00076 DynamicTextFont::init_type();
00077 DynamicTextPage::init_type();
00078 GeomTextGlyph::init_type();
00079 GeomTextGlyph::register_with_read_factory();
00080 #endif
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090 string text_minfilter_str = config_text.GetString("text-minfilter", "linear_mipmap_linear");
00091 string text_magfilter_str = config_text.GetString("text-magfilter", "linear");
00092
00093 text_minfilter = Texture::string_filter_type(text_minfilter_str);
00094 if (text_minfilter == Texture::FT_invalid) {
00095 text_cat.error()
00096 << "Invalid text-minfilter: " << text_minfilter_str << "\n";
00097 text_minfilter = Texture::FT_linear;
00098 }
00099
00100 text_magfilter = Texture::string_filter_type(text_magfilter_str);
00101 if (text_magfilter == Texture::FT_invalid) {
00102 text_cat.error()
00103 << "Invalid text-magfilter: " << text_magfilter_str << "\n";
00104 text_magfilter = Texture::FT_linear;
00105 }
00106
00107 }