Browse Source

added new parameter -rm to allow render-only spacing

Josh Wilson 19 years ago
parent
commit
505280f473
2 changed files with 12 additions and 1 deletions
  1. 11 1
      pandatool/src/egg-mkfont/eggMakeFont.cxx
  2. 1 0
      pandatool/src/egg-mkfont/eggMakeFont.h

+ 11 - 1
pandatool/src/egg-mkfont/eggMakeFont.cxx

@@ -142,6 +142,15 @@ EggMakeFont() : EggWriter(true, false) {
      "both the polygon size and the texture map spacing.",
      "both the polygon size and the texture map spacing.",
      &EggMakeFont::dispatch_int, NULL, &_tex_margin);
      &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
   add_option
     ("sf", "factor", 0,
     ("sf", "factor", 0,
      "The scale factor of the generated image.  This is the factor by which "
      "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;
   _point_size = 10.0;
   _poly_margin = 1.0;
   _poly_margin = 1.0;
   _tex_margin = 2;
   _tex_margin = 2;
+  _render_margin = 0.0;
   _palette_size[0] = _palette_size[1] = 256;
   _palette_size[0] = _palette_size[1] = 256;
   _face_index = 0;
   _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
   // Now create a single point where the origin of the next character
   // will be.
   // 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;
   EggPoint *point = new EggPoint;
   group->add_child(point);
   group->add_child(point);
   point->add_vertex(v0);
   point->add_vertex(v0);

+ 1 - 0
pandatool/src/egg-mkfont/eggMakeFont.h

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