Mungo Posted June 28, 2014 Posted June 28, 2014 (edited) I have encountered that the font weight does not seem to scale the way I would have expected. The degree of "bold" does not always increase with the weight value but even reverses e.g. 700 being less bold than 600 ? Does anyone have an idea? Code and screenshot below. Cheers expandcollapse popup#include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $f_size = 9 Local $h_win = GUICreate ( "TEST GUI ... FONT weight", 400, 350) GUISetBkColor(0xffffff, $h_win) GUISetFont(10, 400, 0, "Arial", $h_win, 2) GUICtrlCreateLabel("Test FONT weight ...", 10, 10) GUICtrlCreateLabel("The quick brown fox jumps over ... (weight = 200)", 10, 60, 380, 20) GUICtrlSetFont(-1, $f_size, 200) GUICtrlSetColor(-1, 0x000099) GUICtrlCreateLabel("The quick brown fox jumps over ... (weight = 400)", 10, 90, 380, 20) GUICtrlSetFont(-1, $f_size, 400) GUICtrlSetColor(-1, 0x000099) GUICtrlCreateLabel("The quick brown fox jumps over ... (weight = 500)", 10, 120, 380, 20) GUICtrlSetFont(-1, $f_size, 500) GUICtrlSetColor(-1, 0x000099) GUICtrlCreateLabel("The quick brown fox jumps over ... (weight = 600)", 10, 150, 380, 20) GUICtrlSetFont(-1, $f_size, 600) GUICtrlSetColor(-1, 0x000099) GUICtrlCreateLabel("The quick brown fox jumps over ... (weight = 700)", 10, 180, 380, 20) GUICtrlSetFont(-1, $f_size, 700) GUICtrlSetColor(-1, 0x000099) GUICtrlCreateLabel("The quick brown fox jumps over ... (weight = 800)", 10, 210, 380, 20) GUICtrlSetFont(-1, $f_size, 800) GUICtrlSetColor(-1, 0x000099) GUICtrlCreateLabel("The quick brown fox jumps over ... (weight = 900)", 10, 240, 380, 20) GUICtrlSetFont(-1, $f_size, 900) GUICtrlSetColor(-1, 0x000099) Local $button = GUICtrlCreateButton("Close", 160, 310, 80, 20) GUISetState(@SW_SHOW) While 1 Local $msg_pop = GUIGetMsg() Select Case $msg_pop = $GUI_EVENT_CLOSE ExitLoop Case $msg_pop = $button ExitLoop EndSelect WEnd GUIDelete() EndFunc Edited June 28, 2014 by Mungo
Moderators Melba23 Posted June 28, 2014 Moderators Posted June 28, 2014 Mungo,The Help file explains that Windows will accept anything from 1 to 10 "hundreds" as a "weight" value, but as I understand it what is actually displayed depends on the number of "weight"s a particular font contains for a given size. Different fonts have different numbers of internal "weight"s for each font size, although it seems 400 (normal) and 700 (bold) are supported in the majority of fonts at most sizes. So you cannot predict exactly what you will get at other values, as if a given "weight" is not supported in a font at the required size Windows will choose what it considers as "most suitable" - which, as you have just shown, might not be what you expect. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Mungo Posted June 29, 2014 Author Posted June 29, 2014 (edited) Thanks Melba23, Yes, the help is actually very detailed and good. However, what confused me was the (for me) unexpected kinks when increasing the "weight" factor. I tried various "weight" settings in a 100 increment from 0 to 1000 also with different fonts and sizes. Different fonts behave slightly differently especially in relation to the increase / decrease of boldness when weight factor is increased. E. g. Arial, Segoe UI, Tahoma and Times New Roman actually show two kinks (steps) first increasing the "boldness" drastically (with 600) but then decreasing again to a lesser extent (>=700). The results are that boldness from 0 to 500 is "normal", 600 is "very bold" and 700 to 1000 is "bold" lower again (Example left). It actually looks like a MS bug to me ... Other fonts such as MS Sans Serif and MS Serif only show one kink when increasing the boldness factor (Example righ) I wonder whether these results could also be related to the font version or OS used ? I use Win 7. Any other experiences with XP and Win 8 and 8.1 ? Cheers Mungo Edited June 29, 2014 by Mungo
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now