diff --git a/models/cmtt12.egg b/models/cmtt12.egg index 0fd74d515f..fb6fea56d3 100644 --- a/models/cmtt12.egg +++ b/models/cmtt12.egg @@ -1818,6 +1818,11 @@ 0 1 0 } } + 32 { + { + { 160 { vpool } } + } + } 33 { { { chars } diff --git a/panda/src/text/staticTextFont.cxx b/panda/src/text/staticTextFont.cxx index f0a266c645..9431ffd4f7 100644 --- a/panda/src/text/staticTextFont.cxx +++ b/panda/src/text/staticTextFont.cxx @@ -70,6 +70,14 @@ StaticTextFont(PandaNode *font_def) { find_characters(font_def, RenderState::make_empty()); _is_valid = !_glyphs.empty(); + + // Check for an explicit space width. + int character = 32; + Glyphs::iterator gi = _glyphs.find(character); + if (gi != _glyphs.end()) { + TextGlyph *glyph = (*gi).second; + _space_advance = glyph->get_advance(); + } set_name(font_def->get_name()); } @@ -287,15 +295,16 @@ find_characters(PandaNode *root, const RenderState *net_state) { CPT(Geom) dot; const RenderState *state = NULL; find_character_gsets(root, ch, dot, state, next_net_state); - if (ch != (Geom *)NULL && dot != (Geom *)NULL) { + PN_stdfloat width = 0.0; + if (dot != (Geom *)NULL) { // Get the first vertex from the "dot" geoset. This will be the // origin of the next character. GeomVertexReader reader(dot->get_vertex_data(), InternalName::get_vertex()); - PN_stdfloat width = reader.get_data1f(); - - _glyphs[character] = new TextGlyph(character, ch, state, width); + width = reader.get_data1f(); } + _glyphs[character] = new TextGlyph(character, ch, state, width); + } else if (name == "ds") { // The group "ds" is a special node that indicates the font's // design size, or line height. diff --git a/pandatool/src/egg-mkfont/Sources.pp b/pandatool/src/egg-mkfont/Sources.pp index dc042a38e4..4e2baf0e2f 100644 --- a/pandatool/src/egg-mkfont/Sources.pp +++ b/pandatool/src/egg-mkfont/Sources.pp @@ -8,7 +8,7 @@ #define OTHER_LIBS \ egg:c pandaegg:m \ pipeline:c event:c pstatclient:c panda:m \ - pandabase:c pnmimage:c pnmtext:c \ + pandabase:c pnmimage:c pnmimagetypes:c pnmtext:c \ mathutil:c linmath:c putil:c express:c \ pandaexpress:m \ interrogatedb:c prc:c dconfig:c dtoolconfig:m \