Rework on commit 6a9607bto fix non printable char codes

This commit is contained in:
jean-pierre charras 2022-02-07 12:32:21 +01:00
parent a37a7aa1d5
commit bc710e3d97
1 changed files with 8 additions and 5 deletions

View File

@ -236,19 +236,22 @@ VECTOR2I STROKE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_ptr
for( wxUniChar c : aText )
{
if( c >= (int) m_glyphBoundingBoxes->size() || c < ' ' )
// dd is the index into bounding boxes table
int dd = (signed) c - ' ';
if( dd >= (int) m_glyphBoundingBoxes->size() || dd < 0 )
{
// Filtering non existing glyphes and non printable chars
if( c == '\t' )
c = ' ';
else
c = '?';
// Fix the index:
dd = (signed) c - ' ';
}
// Index into bounding boxes table
int dd = (signed) c - ' ';
if( dd <= 0 )
if( dd <= 0 ) // dd < 0 should not happen
{
// 'space' character - draw nothing, advance cursor position
cursor.x += KiROUND( glyphSize.x * SPACE_WIDTH );