- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would like to use the odd greek letter as a symbol in dialog static text context - e.g. 'theta' to represent an angle. I wonder if anyone knows of a simple way of doing this?
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The attached files when used to build a standard Fortran windows program will display a dialog box with two static text strings that can be changed to display using the 'Symbol' font which changes them to Greek characters.
I first built the 'SHOWFONT' example supplied with the compiler and ran it to enumerate the fonts on the system.
The dialog code I supply uses code scavenged from the SHOWFONT example to establish and store the required data on the list of fonts available, and to find the index of the 'Symbol' font within the list of fonts. It then uses a dialog button to send a WM_SETFONT message to each of the two static text controls in order to change the font to the 'Symbol' font, using the stored font data. The text then displays as Greek characters.
See included screen shots of informative messages and the before and after dialog text.
I first built the 'SHOWFONT' example supplied with the compiler and ran it to enumerate the fonts on the system.
The dialog code I supply uses code scavenged from the SHOWFONT example to establish and store the required data on the list of fonts available, and to find the index of the 'Symbol' font within the list of fonts. It then uses a dialog button to send a WM_SETFONT message to each of the two static text controls in order to change the font to the 'Symbol' font, using the stored font data. The text then displays as Greek characters.
See included screen shots of informative messages and the before and after dialog text.
Link Copied
11 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You'd probably need to know something about the devices you wish to support. When I first did this, it involved swapping print wheels (intervention by you, the operator). If you didn't succeed in simply typing the letter into a constant character string, but still knew the numeric equivalent, you could use CHAR(numericvalue).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Maybe you can use a string something like:
CHARACTER(LEN=40) :: mystring
mystring = 'Magnetic Flux Densityin '//ACHAR(181)//'T'//ACHAR(0)
in case you want to use a greek letter (here ACHAR(181) stands for "mhu")
Robert
CHARACTER(LEN=40) :: mystring
mystring = 'Magnetic Flux Densityin '//ACHAR(181)//'T'//ACHAR(0)
in case you want to use a greek letter (here ACHAR(181) stands for "mhu")
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If it is just static text, open the text box properties in the Resource Editor, open the Windows Character Map tool, select the character(s) you want, copy and paste into the property. Seems to work fine for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve but this does not work for me as although I can copy the symbol into the resource editor and it appears correctly, it does not show correctly when I run my application. For example I want a small theta in the default font used by the dialogs (MS Sans Serif) so in Character Map I selected MS Reference Sans Serif (since MS Sans Serif didn't appear to have greek letters), I copied and pasted the character into the resource editor where it appeared correctly as a theta but in the application it comes out as a question mark ?.
The problem with Robert's suggestion, which does indeed work, is that I can't find all greek letters in the ASCII table. 181 is mu but it is described as the micro sign. There does not appear to be a full set of greek letters.
In Character Map it lists what I assume is the UNICODE for the character, e.g. small theta is U+03B8 but how can I use this in FORTRAN? A search for UNICODE in the Intel Help is typically unhelpful. There is a routine MBConvertUnicodeToMB listed but no idea is given as to the use of this routine and no example code is given. The input to this is integer whereas the unicode number appears to be hexidecimal....
Any further suggestions would be gratefully received. Many thanks, ACAR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
The font used by dialog boxes is provided by Windows and can be set in the configuration panel. The font characteristics (size, charset, face ...) depend on Windows version, language and defined style. For example, on my XP computer, the Tahoma font is used. So, in dialog boxes, you can't assume any property of the actual font.
You can interrogate the actual font characteristics using the GetTextMetrics function on the current device context.
If the charset of the actual font doesn't include the desired character, you must change the font and charset of the control using CreateFont and SetFont.
The font used by dialog boxes is provided by Windows and can be set in the configuration panel. The font characteristics (size, charset, face ...) depend on Windows version, language and defined style. For example, on my XP computer, the Tahoma font is used. So, in dialog boxes, you can't assume any property of the actual font.
You can interrogate the actual font characteristics using the GetTextMetrics function on the current device context.
If the charset of the actual font doesn't include the desired character, you must change the font and charset of the control using CreateFont and SetFont.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The attached files when used to build a standard Fortran windows program will display a dialog box with two static text strings that can be changed to display using the 'Symbol' font which changes them to Greek characters.
I first built the 'SHOWFONT' example supplied with the compiler and ran it to enumerate the fonts on the system.
The dialog code I supply uses code scavenged from the SHOWFONT example to establish and store the required data on the list of fonts available, and to find the index of the 'Symbol' font within the list of fonts. It then uses a dialog button to send a WM_SETFONT message to each of the two static text controls in order to change the font to the 'Symbol' font, using the stored font data. The text then displays as Greek characters.
See included screen shots of informative messages and the before and after dialog text.
I first built the 'SHOWFONT' example supplied with the compiler and ran it to enumerate the fonts on the system.
The dialog code I supply uses code scavenged from the SHOWFONT example to establish and store the required data on the list of fonts available, and to find the index of the 'Symbol' font within the list of fonts. It then uses a dialog button to send a WM_SETFONT message to each of the two static text controls in order to change the font to the 'Symbol' font, using the stored font data. The text then displays as Greek characters.
See included screen shots of informative messages and the before and after dialog text.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many thanks for your input gvautier. It is, as I feared, more complicated than I had imagined.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many thanks for that complete solution Anthony. I shall have a go at implementing this tomorrow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One afterthought: clearly, with this method you cannot mix Greek and Roman within the same text string; if you want to mix Roman and Greek, you will have to use seperate static text controls with a different font for each.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good point - thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
Mixed font in a control can only be managed though "owner drawn" controls using the SS_OWNERDRAW style. In this case you are responsible of drawing the text allowing you to separate the string and to draw each section with the appropriate font.
See :
http://msdn.microsoft.com/en-us/library/bb760767%28v=vs.85%29.aspx#owner_drawn_static_control
Mixed font in a control can only be managed though "owner drawn" controls using the SS_OWNERDRAW style. In this case you are responsible of drawing the text allowing you to separate the string and to draw each section with the appropriate font.
See :
http://msdn.microsoft.com/en-us/library/bb760767%28v=vs.85%29.aspx#owner_drawn_static_control

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page