mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
fix egg-mkfont
This commit is contained in:
parent
c96de589dc
commit
0768cdd95c
@ -115,26 +115,28 @@ EggMakeFont() : EggWriter(true, false) {
|
|||||||
"Specify the pixels per unit. This is the number of pixels in the "
|
"Specify the pixels per unit. This is the number of pixels in the "
|
||||||
"generated texture map that are used for each onscreen unit (or each "
|
"generated texture map that are used for each onscreen unit (or each "
|
||||||
"10 points of font; see -ps). Setting this number larger results in "
|
"10 points of font; see -ps). Setting this number larger results in "
|
||||||
"an easier-to-read font, but at the cost of more texture memory.",
|
"an easier-to-read font, but at the cost of more texture memory. "
|
||||||
|
"The default is 30.",
|
||||||
&EggMakeFont::dispatch_double, NULL, &_pixels_per_unit);
|
&EggMakeFont::dispatch_double, NULL, &_pixels_per_unit);
|
||||||
|
|
||||||
add_option
|
add_option
|
||||||
("ps", "size", 0,
|
("ps", "size", 0,
|
||||||
"Specify the point size of the resulting font. This controls the "
|
"Specify the point size of the resulting font. This controls the "
|
||||||
"apparent size of the font when it is rendered onscreen. By convention, "
|
"apparent size of the font when it is rendered onscreen. By convention, "
|
||||||
"a 10 point font is 1 screen unit high.",
|
"a 10 point font is 1 screen unit high, so the default is 10.",
|
||||||
&EggMakeFont::dispatch_double, NULL, &_point_size);
|
&EggMakeFont::dispatch_double, NULL, &_point_size);
|
||||||
|
|
||||||
add_option
|
add_option
|
||||||
("pm", "n", 0,
|
("pm", "n", 0,
|
||||||
"The number of extra pixels around a single character in the "
|
"The number of extra pixels around a single character in the "
|
||||||
"generated polygon. This may be a floating-point number.",
|
"generated polygon. This may be a floating-point number. The "
|
||||||
|
"default is 1.",
|
||||||
&EggMakeFont::dispatch_double, NULL, &_poly_margin);
|
&EggMakeFont::dispatch_double, NULL, &_poly_margin);
|
||||||
|
|
||||||
add_option
|
add_option
|
||||||
("tm", "n", 0,
|
("tm", "n", 0,
|
||||||
"The number of extra pixels around each character in the texture map. "
|
"The number of extra pixels around each character in the texture map. "
|
||||||
"This may only be an integer.",
|
"This may only be an integer. The default is 2.",
|
||||||
&EggMakeFont::dispatch_int, NULL, &_tex_margin);
|
&EggMakeFont::dispatch_int, NULL, &_tex_margin);
|
||||||
|
|
||||||
add_option
|
add_option
|
||||||
@ -144,7 +146,7 @@ EggMakeFont() : EggWriter(true, false) {
|
|||||||
"to improve antialiasing. If the specified font contains one "
|
"to improve antialiasing. If the specified font contains one "
|
||||||
"or more fixed-size fonts instead of a scalable font, the scale factor "
|
"or more fixed-size fonts instead of a scalable font, the scale factor "
|
||||||
"may be automatically adjusted as necessary to scale the closest-"
|
"may be automatically adjusted as necessary to scale the closest-"
|
||||||
"matching font to the desired pixel size.",
|
"matching font to the desired pixel size. The default is 2.",
|
||||||
&EggMakeFont::dispatch_double, &_got_scale_factor, &_scale_factor);
|
&EggMakeFont::dispatch_double, &_got_scale_factor, &_scale_factor);
|
||||||
|
|
||||||
add_option
|
add_option
|
||||||
@ -325,7 +327,7 @@ run() {
|
|||||||
}
|
}
|
||||||
if (_output_palette_pattern.empty()) {
|
if (_output_palette_pattern.empty()) {
|
||||||
// Create a default texture filename pattern.
|
// Create a default texture filename pattern.
|
||||||
_output_palette_pattern = get_output_filename().get_fullpath_wo_extension() + "_%i.rgb";
|
_output_palette_pattern = get_output_filename().get_fullpath_wo_extension() + "_%i";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Figure out how many channels we need based on the foreground and
|
// Figure out how many channels we need based on the foreground and
|
||||||
@ -385,9 +387,12 @@ run() {
|
|||||||
|
|
||||||
pal->all_params_set();
|
pal->all_params_set();
|
||||||
|
|
||||||
// Now create all the egg structures.
|
// Now create all the egg structures. We can't use _data, since we
|
||||||
|
// want to pass this object to the palettizer, which will try to up
|
||||||
|
// its reference count.
|
||||||
|
PT(EggData) egg_data = new EggData;
|
||||||
_group = new EggGroup();
|
_group = new EggGroup();
|
||||||
_data.add_child(_group);
|
egg_data->add_child(_group);
|
||||||
|
|
||||||
_vpool = new EggVertexPool("vpool");
|
_vpool = new EggVertexPool("vpool");
|
||||||
_group->add_child(_vpool);
|
_group->add_child(_vpool);
|
||||||
@ -435,7 +440,7 @@ run() {
|
|||||||
// writing it to disk first.
|
// writing it to disk first.
|
||||||
string name = get_output_filename().get_basename();
|
string name = get_output_filename().get_basename();
|
||||||
EggFile *egg_file = pal->get_egg_file(name);
|
EggFile *egg_file = pal->get_egg_file(name);
|
||||||
egg_file->from_command_line(&_data, "", get_output_filename(),
|
egg_file->from_command_line(egg_data, "", get_output_filename(),
|
||||||
get_exec_command());
|
get_exec_command());
|
||||||
|
|
||||||
pal->add_command_line_egg(egg_file);
|
pal->add_command_line_egg(egg_file);
|
||||||
|
@ -45,6 +45,7 @@ TextureImage::
|
|||||||
TextureImage() {
|
TextureImage() {
|
||||||
_preferred_source = (SourceTextureImage *)NULL;
|
_preferred_source = (SourceTextureImage *)NULL;
|
||||||
_read_source_image = false;
|
_read_source_image = false;
|
||||||
|
_allow_release_source_image = true;
|
||||||
_is_surprise = true;
|
_is_surprise = true;
|
||||||
_ever_read_image = false;
|
_ever_read_image = false;
|
||||||
_forced_grayscale = false;
|
_forced_grayscale = false;
|
||||||
@ -746,6 +747,7 @@ read_source_image() {
|
|||||||
source->read(_source_image);
|
source->read(_source_image);
|
||||||
}
|
}
|
||||||
_read_source_image = true;
|
_read_source_image = true;
|
||||||
|
_allow_release_source_image = true;
|
||||||
_ever_read_image = true;
|
_ever_read_image = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -762,7 +764,7 @@ read_source_image() {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void TextureImage::
|
void TextureImage::
|
||||||
release_source_image() {
|
release_source_image() {
|
||||||
if (_read_source_image) {
|
if (_read_source_image && _allow_release_source_image) {
|
||||||
_source_image.clear();
|
_source_image.clear();
|
||||||
_read_source_image = false;
|
_read_source_image = false;
|
||||||
}
|
}
|
||||||
@ -779,6 +781,7 @@ release_source_image() {
|
|||||||
void TextureImage::
|
void TextureImage::
|
||||||
set_source_image(const PNMImage &image) {
|
set_source_image(const PNMImage &image) {
|
||||||
_source_image = image;
|
_source_image = image;
|
||||||
|
_allow_release_source_image = false;
|
||||||
_read_source_image = true;
|
_read_source_image = true;
|
||||||
_ever_read_image = true;
|
_ever_read_image = true;
|
||||||
}
|
}
|
||||||
|
@ -150,6 +150,7 @@ private:
|
|||||||
Dests _dests;
|
Dests _dests;
|
||||||
|
|
||||||
bool _read_source_image;
|
bool _read_source_image;
|
||||||
|
bool _allow_release_source_image;
|
||||||
PNMImage _source_image;
|
PNMImage _source_image;
|
||||||
bool _texture_named;
|
bool _texture_named;
|
||||||
bool _got_txa_file;
|
bool _got_txa_file;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user