workaround for a minor and strange issue: size of chars '-' and '_' are incorrect in msdf_atlasgen fonte. the size of 'x' char is used instead.
This commit is contained in:
parent
e1fbe1cb3a
commit
d8ade988ce
|
@ -894,7 +894,7 @@ void OPENGL_GAL::BitmapText( const wxString& aText, const VECTOR2D& aPosition,
|
||||||
|
|
||||||
for( unsigned int ii = 0; ii < aText.length(); ++ii )
|
for( unsigned int ii = 0; ii < aText.length(); ++ii )
|
||||||
{
|
{
|
||||||
const unsigned int c = aText[ii];
|
unsigned int c = aText[ii];
|
||||||
|
|
||||||
wxASSERT_MSG( LookupGlyph(c) != nullptr, wxT( "Missing character in bitmap font atlas." ) );
|
wxASSERT_MSG( LookupGlyph(c) != nullptr, wxT( "Missing character in bitmap font atlas." ) );
|
||||||
wxASSERT_MSG( c != '\n' && c != '\r', wxT( "No support for multiline bitmap text yet" ) );
|
wxASSERT_MSG( c != '\n' && c != '\r', wxT( "No support for multiline bitmap text yet" ) );
|
||||||
|
@ -1537,6 +1537,7 @@ int OPENGL_GAL::drawBitmapChar( unsigned long aChar )
|
||||||
const float TEX_Y = font_image.height;
|
const float TEX_Y = font_image.height;
|
||||||
|
|
||||||
const FONT_GLYPH_TYPE* glyph = LookupGlyph(aChar);
|
const FONT_GLYPH_TYPE* glyph = LookupGlyph(aChar);
|
||||||
|
|
||||||
if( !glyph ) return 0;
|
if( !glyph ) return 0;
|
||||||
|
|
||||||
const float X = glyph->atlas_x + font_information.smooth_pixels;
|
const float X = glyph->atlas_x + font_information.smooth_pixels;
|
||||||
|
@ -1638,8 +1639,21 @@ std::pair<VECTOR2D, float> OPENGL_GAL::computeBitmapTextSize( const wxString& aT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const FONT_GLYPH_TYPE* glyph = LookupGlyph(aText[i]);
|
unsigned int c = aText[i];
|
||||||
if( glyph ) {
|
|
||||||
|
const FONT_GLYPH_TYPE* glyph = LookupGlyph( c );
|
||||||
|
|
||||||
|
// a few chars
|
||||||
|
if( !glyph || // Not coded in font
|
||||||
|
c == '-' || c == '_' ) // Strange size of these 2 chars
|
||||||
|
{
|
||||||
|
c = 'x'; // For calculation of the char size, replace by a medium sized char
|
||||||
|
glyph = LookupGlyph( c );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( glyph )
|
||||||
|
{
|
||||||
textSize.x += glyph->advance;
|
textSize.x += glyph->advance;
|
||||||
textSize.y = std::max<float>( textSize.y, font_information.max_y - glyph->miny );
|
textSize.y = std::max<float>( textSize.y, font_information.max_y - glyph->miny );
|
||||||
commonOffset = std::min<float>( font_information.max_y - glyph->maxy, commonOffset );
|
commonOffset = std::min<float>( font_information.max_y - glyph->maxy, commonOffset );
|
||||||
|
|
Loading…
Reference in New Issue