added new parameter -rm to allow render-only spacing

This commit is contained in:
Josh Wilson 2006-12-16 00:19:39 +00:00
parent 17b8737ae2
commit 505280f473
2 changed files with 12 additions and 1 deletions

View File

@ -142,6 +142,15 @@ EggMakeFont() : EggWriter(true, false) {
"both the polygon size and the texture map spacing.",
&EggMakeFont::dispatch_int, NULL, &_tex_margin);
add_option
("rm", "n", 0,
"The amount of padding in screen units to place around the glyph when "
"rendered. This differs from -pm in that it has no effect on the "
"generated texture map, only on the generated egg. Use this in order to "
"space the characters out in case they appear to be too close together "
"when rendered. The default is 0.",
&EggMakeFont::dispatch_double, NULL, &_render_margin);
add_option
("sf", "factor", 0,
"The scale factor of the generated image. This is the factor by which "
@ -213,6 +222,7 @@ EggMakeFont() : EggWriter(true, false) {
_point_size = 10.0;
_poly_margin = 1.0;
_tex_margin = 2;
_render_margin = 0.0;
_palette_size[0] = _palette_size[1] = 256;
_face_index = 0;
@ -562,7 +572,7 @@ make_geom(PNMTextGlyph *glyph, int character) {
// Now create a single point where the origin of the next character
// will be.
EggVertex *v0 = make_vertex(LPoint2d(glyph->get_advance() / _pixels_per_unit, 0.0));
EggVertex *v0 = make_vertex(LPoint2d(glyph->get_advance() / _pixels_per_unit + _render_margin, 0.0));
EggPoint *point = new EggPoint;
group->add_child(point);
point->add_vertex(v0);

View File

@ -75,6 +75,7 @@ private:
double _point_size;
double _poly_margin;
int _tex_margin;
double _render_margin;
bool _got_scale_factor;
double _scale_factor;
bool _no_reduce;