KmotionCNC DRO font alignment issue after font change

Moderators: TomKerekes, dynomotion

Post Reply
Tim G
Posts: 5
Joined: Wed Jan 13, 2021 9:51 pm

KmotionCNC DRO font alignment issue after font change

Post by Tim G » Wed Jan 13, 2021 10:15 pm

Sorry, this probably seems a bit type A and unimportant to worry about, but I've been making a custom UI for KmotionCNC with the Screen Editor and ran into an issue after changing the font on the axis DRO section. After the font change, the font wants to center a bit when the numbers are changing rather than staying fixed like before. For example, the "X" in the X axis DRO indents a tad and the coordinate number indents a tad from the right as well, centering itself in the box. I'd really prefer the X never move and that the decimals stay aligned like before the font change. I'm a bit committed to the font now because I've invested a ton of time creating custom button bitmaps using that font, so I'm hoping I can tweak this. Any ideas?

User avatar
TomKerekes
Posts: 1535
Joined: Mon Dec 04, 2017 1:49 am

Re: KmotionCNC DRO font alignment issue after font change

Post by TomKerekes » Thu Jan 14, 2021 3:41 pm

Hi Tim,

I think the issue is that the DRO expects a fixed width font (such as Courier New). If in the font a digit and a space have different width then the size of the text will change depending on the number of digits vs spaces. The Control centers the text in the Control. I can't think of a simple solution other than changing the KMotionCNC source code to separate the Label "X:" from the digits, and changing to right alignment. Can't you find a similar fixed width font?
Regards,

Tom Kerekes
Dynomotion, Inc.

Tim G
Posts: 5
Joined: Wed Jan 13, 2021 9:51 pm

Re: KmotionCNC DRO font alignment issue after font change

Post by Tim G » Thu Jan 14, 2021 6:26 pm

Thanks Tom, that was a big help! I wasn't aware of fixed vs. non-fixed font types. Seems like "mono" is a designation for those types of fonts. I was able to search online for a similar font style in monospaced form and that did the trick. The type A side of me can rest a little easier;).

Carl Bruce speaks very highly of you, by the way. I've had a lot of fun learning the Screen Editor and trying out some basic C programs for custom features/buttons for my new CNC router. C is a whole new world to me, but I really appreciate the flexibility it offers, and this forum has been a huge help there.

User avatar
TomKerekes
Posts: 1535
Joined: Mon Dec 04, 2017 1:49 am

Re: KmotionCNC DRO font alignment issue after font change

Post by TomKerekes » Thu Jan 14, 2021 7:54 pm

Hi Tim,

Thanks for posting back and say hi to Carl.

Maybe post your screen set.
Regards,

Tom Kerekes
Dynomotion, Inc.

Tim G
Posts: 5
Joined: Wed Jan 13, 2021 9:51 pm

Re: KmotionCNC DRO font alignment issue after font change

Post by Tim G » Thu Jan 14, 2021 8:14 pm

Will do, and here's the screen set after the font change. It was fun to get things dialed and styled to match my router setup.
Attachments
Tim's Kmotion UI.PNG

Post Reply