Shark007 Posted February 2, 2010 Share Posted February 2, 2010 (edited) My GUI is in english. (target OS is Windows 7) In an attempt to correct the issue I am dealing with, I have attempted to set the GUI font manually, GUISetFont(8.5,"","", "Segoe UI","", 5) (also tried using other fonts such as Tahoma) on a chinese system, the font used is still SimSun, the default Chinese font for English text. When SimSun is loaded it doesnt 'fit' the GUI and makes it largely unreadable. Is there a solution? In VS2008 /.NET 3.5, the following does force the correct font and avoids the SimSun text public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); } void InitializeComponent(void) { // // Form1 // Font = (gcnew System::Drawing::Font(L"Segoe UI", 8.5, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0))); Name = L"Form1"; Text = L"Form1"; } } Edited February 2, 2010 by Shark007 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 2, 2010 Moderators Share Posted February 2, 2010 Shark007,The only suggestion I can make is that the "Segoe UI" and "Tahoma" fonts do not exist on the target machine.I have just been playing with GUISetFont and GUICtrlSetFont using PsaltyDS' code here. If I specify a non-existent font for either the GUI or the button, I get "MS Sans Serif" as a default - it must be set in the system somewhere. So I can only imagine that you are also specifying a non-existent font and the system is defaulting to "SimSun". The fact that you describe "SimSun" as "the default Chinese font for English text" makes me think this might well be the case.Sorry I cannot offer anything more concrete, but as long as I have used a valid fontname, I have never had any trouble with either of the *SetFont commands.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 Link to comment Share on other sites More sharing options...
Shark007 Posted February 2, 2010 Author Share Posted February 2, 2010 (edited) Thanks for trying to help M23. I have narrowed my problem down to it being the syntax used for the 'Quality' setting. I am currently trying to use the integer '5' for cleartype but I have also tried using text such as; DEFAULT_QUALITY = 0 DRAFT_QUALITY = 1 PROOF_QUALITY = 2 NONANTIALIASED_QUALITY = 3 ANTIALIASED_QUALITY = 4 CLEARTYPE_QUALITY = 5 CLEARTYPE_NATURAL_QUALITY = 6 but using the text alone (in quotes or without), or with the corresponding = integer attached to the text, does not seem to work either. Does anyone know what the proper syntax is to enter the quality setting when using GuiSetFont? Edited February 2, 2010 by Shark007 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 2, 2010 Moderators Share Posted February 2, 2010 Shark007,I would suggest that you need just the integer value - most of the constants we use in AutoIt are defined in the relevant *Constants.au3 include and begin with a $-sign. As the example in the Help file does not, I would draw the conclusion that there is no such constant value defined.This little snippet will let you see the default GUI font of the machine it is run on:#include <WinAPI.au3> $hLogFont = _WinAPI_GetStockObject($DEFAULT_GUI_FONT) $structLF = DllStructCreate($tagLogFont) $isize = _WinAPI_GetObject($hLogFont, 0, 0) $iWritten = _WinAPI_GetObject($hLogFont, $isize, DllStructGetPtr($structLF)) $output = "Height = " & DllStructGetData($structLF, 1) & @CRLF $output &= "Width = " & DllStructGetData($structLF, 2) & @CRLF $output &= "Escapement = " & DllStructGetData($structLF, 3) & @CRLF $output &= "Orientation = " & DllStructGetData($structLF, 4) & @CRLF $output &= "Weight = " & DllStructGetData($structLF, 5) & @CRLF $output &= "Italic = " & DllStructGetData($structLF, 6) & @CRLF $output &= "Underline = " & DllStructGetData($structLF, 7) & @CRLF $output &= "StrikeOut = " & DllStructGetData($structLF, 8) & @CRLF $output &= "CharSet = " & DllStructGetData($structLF, 9) & @CRLF $output &= "OutPrecision = " & DllStructGetData($structLF, 10) & @CRLF $output &= "ClipPrecision = " & DllStructGetData($structLF, 11) & @CRLF $output &= "Quality = " & DllStructGetData($structLF, 12) & @CRLF ; <<<<<<<<<<<<<<<<<<<<<<<<<<<< I get 0 here and my GUIs are perfectly readable $output &= "PitchAndFamily = " & DllStructGetData($structLF, 13) & @CRLF $output &= "FaceName = " & DllStructGetData($structLF, 14) & @CRLF MsgBox(0, "", $output)I must say that I have never seen the "quality" parameter used in an AutoIt script - do you find it absolutely necessary? What problem are you trying to solve by using it? And if it is this parameter which is causing the problem, and omitting it makes everything run smoothly, is the quality really a significant issue?Your script - your decision, of course! M23 pixelsearch 1 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 Link to comment Share on other sites More sharing options...
Shark007 Posted February 2, 2010 Author Share Posted February 2, 2010 (edited) as M23 suggests, every problem is solvable, as long as you're willing to bend a little. My original issue is that the GUI does not display properly on non English systems. A Chinese user sent me a screenshot of the GUI from his computer, and I had to agree, it was largely unreadable because of the font being used. I think I have solved my issue with this code If Not StringInStr("0409 0809 0c09 1009 1409 1809 1c09 2009 2409 2809 2c09 3009 3409", @OSLang) Then GUISetFont(8.5, "", "", "SimSun Regular") The problem was that the Chinese OS was using SimSun font but it was set to large. I would guess it was using a value of 10, where 8.5 is common in English text. I await for a response from the user if this aditional snippet of code has resolved his readability issue. The quality setting was for eyecandy, I'd still like to use it, but can do without. Edited February 2, 2010 by Shark007 Link to comment Share on other sites More sharing options...
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