From 976e367e5299f608ed4f634ca8bfca78fdac880b Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 14 May 2008 00:30:36 +0000 Subject: [PATCH] hard-set text quality for now --- panda/src/text/config_text.cxx | 3 +++ panda/src/text/dynamicTextPage.cxx | 2 +- panda/src/text/staticTextFont.cxx | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/panda/src/text/config_text.cxx b/panda/src/text/config_text.cxx index ae30dc4248..9fed6ded7f 100644 --- a/panda/src/text/config_text.cxx +++ b/panda/src/text/config_text.cxx @@ -181,6 +181,9 @@ ConfigVariableEnum text_magfilter ConfigVariableEnum text_wrap_mode ("text-wrap-mode", Texture::WM_border_color, PRC_DESC("The default wrap mode for dynamic text fonts")); +ConfigVariableEnum 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 text_render_mode ("text-render-mode", TextFont::RM_texture, diff --git a/panda/src/text/dynamicTextPage.cxx b/panda/src/text/dynamicTextPage.cxx index 6c4f0a27d4..ec44b00180 100644 --- a/panda/src/text/dynamicTextPage.cxx +++ b/panda/src/text/dynamicTextPage.cxx @@ -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(); diff --git a/panda/src/text/staticTextFont.cxx b/panda/src/text/staticTextFont.cxx index 0179899d8d..9647e4769f 100644 --- a/panda/src/text/staticTextFont.cxx +++ b/panda/src/text/staticTextFont.cxx @@ -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();