EditorFontSize as a Float

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Joubarbe
Enthusiast
Enthusiast
Posts: 703
Joined: Wed Sep 18, 2013 11:54 am
Location: France

EditorFontSize as a Float

Post by Joubarbe »

Hello,

Could it be possible to put a decimal number into the editor font size configuration menu ? 10.5 is usually a great size for many fonts, but PB only accepts 10 or 11.

Yep, a small detail, but details count ! :)
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: EditorFontSize as a Float

Post by IdeasVacuum »

I think you mean the drop-down list in the Form Designer? PB accepts any size font.

Code: Select all

LoadFont(#MyFont,"Microsoft Sans Serif", 10.5, #PB_Font_HighQuality + 2)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Joubarbe
Enthusiast
Enthusiast
Posts: 703
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: EditorFontSize as a Float

Post by Joubarbe »

Sorry, I guess it wasn't clear.

When you go to File -> Preferences -> Editor/Editing, and when you click "Select Font", you cannot choose a decimal value as the font size.

EDIT : "EditorFontSize" being the variable used in the .prefs file of PureBasic (in AppData\Roaming...) for this option.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: EditorFontSize as a Float

Post by IdeasVacuum »

Ah, I see, you mean the PB IDE. :D
You can in fact edit the .prefs file (e.g. in Notepad) and change the font size to 10.5. Certainly looks neat in PB using the Source Code Pro font, but too small for my old eyes.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Joubarbe
Enthusiast
Enthusiast
Posts: 703
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: EditorFontSize as a Float

Post by Joubarbe »

Do you see any changes when you enter 10.5 ? I tried that with Consolas and saw no difference. Maybe my eyes are older than yours !
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: EditorFontSize as a Float

Post by IdeasVacuum »

It could be that the Consolas font doesn't scale to 10.5? Make sure PB isn't up, edit .prefs, run PB, you should immediately notice the difference.......

Edit: What is dissapointing though is that when you close-down PB it re-writes .prefs, imposing an integer for the font size again.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Joubarbe
Enthusiast
Enthusiast
Posts: 703
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: EditorFontSize as a Float

Post by Joubarbe »

I confirm that 10.5 doesn't work. It rounds down to 10 (and Consolas accepts 10.5 in other programs). And even if that was working, having the value reset every time you close PB would be a pain.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: EditorFontSize as a Float

Post by Dude »

It probably doesn't accept floats because the floating-point symbol differs according to region. It can be a dot, or comma, or whatever. The IDE would have to take the specified value and parse for the symbol to account for all regions.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: EditorFontSize as a Float

Post by IdeasVacuum »

I disagree Dude - it is a file intended only for internal use by PB, therefore any delimiter can be imposed by Fred, the system locale doesn't get a vote! :D
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: EditorFontSize as a Float

Post by Dude »

I mean in the editor settings. If a user in one country types in "10.5", and another user in another country types in "10,5" then what font size will it be? The editor needs to know the locale to decide. Or, you can just force a whole number and not worry about it... which is what I think the team has done. ;)
Julian
Enthusiast
Enthusiast
Posts: 276
Joined: Tue May 24, 2011 1:36 pm

Re: EditorFontSize as a Float

Post by Julian »

I believe this would only be an issue if the string was read through a locale aware function?

If it was a problem, the simplest way around this would be to have FontSize and FontSizeD where is the decimal portion expressed as an int.

ie:

FontSize 12
FontSizeD 5

Actual fontsize = 12.5

I'd like this as I've wanted to set a decimal font sizing using the editor before now.
Post Reply