hard-set text quality for now

This commit is contained in:
David Rose 2008-05-14 00:30:36 +00:00
parent d7cffaa4f5
commit 976e367e52
3 changed files with 21 additions and 1 deletions

View File

@ -181,6 +181,9 @@ ConfigVariableEnum<Texture::FilterType> text_magfilter
ConfigVariableEnum<Texture::WrapMode> text_wrap_mode
("text-wrap-mode", Texture::WM_border_color,
PRC_DESC("The default wrap mode for dynamic text fonts"));
ConfigVariableEnum<Texture::QualityLevel> text_quality_level
("text-quality-level", Texture::QL_best,
PRC_DESC("The default quality level for dynamic text fonts; see Texture::set_quality_level()."));
ConfigVariableEnum<TextFont::RenderMode> text_render_mode
("text-render-mode", TextFont::RM_texture,

View File

@ -39,7 +39,7 @@ DynamicTextPage(DynamicTextFont *font, int page_number) :
// It's usually pretty important for text to look its best, and it
// doesn't usually have a high fill factor.
set_quality_level(Texture::QL_best);
set_quality_level(text_quality_level);
_x_size = _font->get_page_x_size();
_y_size = _font->get_page_y_size();

View File

@ -26,6 +26,10 @@
#include "renderState.h"
#include "dcast.h"
// Temporary
#include "textureCollection.h"
#include "nodePath.h"
TypeHandle StaticTextFont::_type_handle;
////////////////////////////////////////////////////////////////////
@ -41,6 +45,19 @@ StaticTextFont(PandaNode *font_def) {
_font = font_def;
_glyphs.clear();
// This bit is a temporary hack. We find all of the textures
// referenced by the font, and hard-set them to the specified
// quality level for text. This should not remain more than a
// couple of weeks; after that time, we'll remove this and require
// users to set their desired quality level in static fonts
// explicitly.
NodePath np(font_def);
TextureCollection tc = np.find_all_textures();
int num_textures = tc.get_num_textures();
for (int i = 0; i < num_textures; ++i) {
tc.get_texture(i)->set_quality_level(text_quality_level);
}
find_characters(font_def, RenderState::make_empty());
_is_valid = !_glyphs.empty();