Page 1 of 1

EditorFontSize as a Float

Posted: Wed Jun 24, 2015 12:37 pm
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 ! :)

Re: EditorFontSize as a Float

Posted: Thu Jun 25, 2015 1:39 am
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)

Re: EditorFontSize as a Float

Posted: Thu Jun 25, 2015 7:25 am
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.

Re: EditorFontSize as a Float

Posted: Thu Jun 25, 2015 11:09 am
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.

Re: EditorFontSize as a Float

Posted: Thu Jun 25, 2015 11:18 am
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 !

Re: EditorFontSize as a Float

Posted: Thu Jun 25, 2015 11:28 am
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.

Re: EditorFontSize as a Float

Posted: Thu Jun 25, 2015 1:41 pm
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.

Re: EditorFontSize as a Float

Posted: Thu Jun 25, 2015 2:12 pm
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.

Re: EditorFontSize as a Float

Posted: Thu Jun 25, 2015 2:46 pm
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

Re: EditorFontSize as a Float

Posted: Fri Jun 26, 2015 12:24 pm
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. ;)

Re: EditorFontSize as a Float

Posted: Fri Jun 26, 2015 3:29 pm
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.