kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #11826
Character codes clamping
I was looking through the text drawing routines and I am wondering if
font code clamping works as expected. It seems that for characters with
codes higher than the font description table size it should draw '?'
instead of characters. But in the function
common/drawtxt.cpp:GetHersheyShapeDescription() it first assigns '?'
character and then subtracts 32 resulting in a different character than
the question mark. Please have a look at the attached patch and check if
I got it right.
Maybe it is not a big deal and it will not crash pcbnew, but still it is
better when things work as expected.
Regards,
Orson
=== modified file 'common/drawtxt.cpp'
--- common/drawtxt.cpp 2013-06-29 09:52:22 +0000
+++ common/drawtxt.cpp 2013-12-03 09:35:42 +0000
@@ -150,7 +150,7 @@
int font_length_max = newstroke_font_bufsize;
if( AsciiCode >= (32 + font_length_max) )
- AsciiCode = '?';
+ AsciiCode = 32 + '?';
if( AsciiCode < 32 )
AsciiCode = 32; // Clamp control chars
Follow ups