mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
static fonts should support explicit space advance specified from font file
This commit is contained in:
parent
ffa6d1bf16
commit
75ac6c1bae
@ -1818,6 +1818,11 @@
|
|||||||
0 1 0
|
0 1 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
<Group> 32 {
|
||||||
|
<PointLight> {
|
||||||
|
<VertexRef> { 160 <Ref> { vpool } }
|
||||||
|
}
|
||||||
|
}
|
||||||
<Group> 33 {
|
<Group> 33 {
|
||||||
<Polygon> {
|
<Polygon> {
|
||||||
<TRef> { chars }
|
<TRef> { chars }
|
||||||
|
@ -70,6 +70,14 @@ StaticTextFont(PandaNode *font_def) {
|
|||||||
|
|
||||||
find_characters(font_def, RenderState::make_empty());
|
find_characters(font_def, RenderState::make_empty());
|
||||||
_is_valid = !_glyphs.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());
|
set_name(font_def->get_name());
|
||||||
}
|
}
|
||||||
@ -287,15 +295,16 @@ find_characters(PandaNode *root, const RenderState *net_state) {
|
|||||||
CPT(Geom) dot;
|
CPT(Geom) dot;
|
||||||
const RenderState *state = NULL;
|
const RenderState *state = NULL;
|
||||||
find_character_gsets(root, ch, dot, state, next_net_state);
|
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
|
// Get the first vertex from the "dot" geoset. This will be the
|
||||||
// origin of the next character.
|
// origin of the next character.
|
||||||
GeomVertexReader reader(dot->get_vertex_data(), InternalName::get_vertex());
|
GeomVertexReader reader(dot->get_vertex_data(), InternalName::get_vertex());
|
||||||
PN_stdfloat width = reader.get_data1f();
|
width = reader.get_data1f();
|
||||||
|
|
||||||
_glyphs[character] = new TextGlyph(character, ch, state, width);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_glyphs[character] = new TextGlyph(character, ch, state, width);
|
||||||
|
|
||||||
} else if (name == "ds") {
|
} else if (name == "ds") {
|
||||||
// The group "ds" is a special node that indicates the font's
|
// The group "ds" is a special node that indicates the font's
|
||||||
// design size, or line height.
|
// design size, or line height.
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#define OTHER_LIBS \
|
#define OTHER_LIBS \
|
||||||
egg:c pandaegg:m \
|
egg:c pandaegg:m \
|
||||||
pipeline:c event:c pstatclient:c panda: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 \
|
mathutil:c linmath:c putil:c express:c \
|
||||||
pandaexpress:m \
|
pandaexpress:m \
|
||||||
interrogatedb:c prc:c dconfig:c dtoolconfig:m \
|
interrogatedb:c prc:c dconfig:c dtoolconfig:m \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user