Rework on commit 6a9607bto fix non printable char codes
This commit is contained in:
parent
a37a7aa1d5
commit
bc710e3d97
|
@ -236,19 +236,22 @@ VECTOR2I STROKE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_ptr
|
||||||
|
|
||||||
for( wxUniChar c : aText )
|
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
|
// Filtering non existing glyphes and non printable chars
|
||||||
if( c == '\t' )
|
if( c == '\t' )
|
||||||
c = ' ';
|
c = ' ';
|
||||||
else
|
else
|
||||||
c = '?';
|
c = '?';
|
||||||
|
|
||||||
|
// Fix the index:
|
||||||
|
dd = (signed) c - ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Index into bounding boxes table
|
if( dd <= 0 ) // dd < 0 should not happen
|
||||||
int dd = (signed) c - ' ';
|
|
||||||
|
|
||||||
if( dd <= 0 )
|
|
||||||
{
|
{
|
||||||
// 'space' character - draw nothing, advance cursor position
|
// 'space' character - draw nothing, advance cursor position
|
||||||
cursor.x += KiROUND( glyphSize.x * SPACE_WIDTH );
|
cursor.x += KiROUND( glyphSize.x * SPACE_WIDTH );
|
||||||
|
|
Loading…
Reference in New Issue