- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Trial Intel XE 2019 compiler on VS2017 pro. Windows7 z97-p cpu. Debug x86
I am using SETWINDOWCONFIG(WCONFIG) to set text space with appropriate rows and column values.
1/ I set the character shape to 16x8 and all is well. However, any other width value than 8 is corrected(?) by the function to a value 1 pixel less. i.e set 10 is changed to 9 at least up to 16. If -1 is set for columns and rows the x columns is calculated correctly for the lower number otherwise it is changed.
2/ The program name is shown in the instructions as a 'c' string. I a 'c' string is used the function changes it to a 32 character Fortran string. Using a Fortran string is accepted with the same result.
Are these events known of so I have to work around the character width change?
C Define a child-window font size 9x16
WCONFIG.numxpixels = 820
WCONFIG.numypixels = 624
WCONFIG.numtextcols = -1 !COLS2
WCONFIG.numtextrows = -1 !ROWS2
WCONFIG.numcolors = INT2(NPC)!This has to be 256, used 16
WCONFIG.fontsize = #00090010
WCONFIG.title = "This is a test"C !TRIM(PRGNAM)
WCONFIG.bitsperpixel= INT2(8)
C Configure the child-window
LOG4=SETWINDOWCONFIG(WCONFIG)
IF(.NOT.LOG4)THEN
IER=3
RETURN
ENDIF
LOG4=GETWINDOWCONFIG(WCONFIG)
Result.........
.WCONFIG.fontsize = #00090010
WCONFIG.numtextcols = 91
WCONFIG.numtextrows = 39
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
SETWINDOWCONFIG is a QuickWin routine, and it wants regular Fortran strings, not NUL-terminated C strings.
The documentation says that if it can't set what you asked for, the function returns .false. and sets the values in the configuration structure to be the closest it can manage - you are to call SETWINDOWCONFIG again to set those values.
I suggest you read the documentation of SETWINDOWCONFIG carefully and study the example it provides.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your comment Steve.
1/ Note that in my code I USE IFQWIN. There is a line in the code of my first post
IF(.NOT.LOG4)THEN
is there to trap any .FALSE. return from SETWINDOWCONFIG. Whatever value I give to the x pixels in the font #00090010 16x9 or #000A0010 16x10 for example. WCONFIG.fontsize returns #00080010 16x9 or #00090010 16x10 and so on, I have checked up to #001F0010 16x31 which returns #0001D0010 16x29!! In each case SETWINDOWCONFIG returns .TRUE.
Incidentally the 820x640 window requested divides in x by 8,10,16,20,32 so according to your direction any others in between should error and return the next one down. e.g. put in 19 and 16 with error should be returned?
2/ Here is an extract from Intel® Fortran Compiler 19.0 Developer Guide and Reference
Example
USE IFQWIN
TYPE (windowconfig) wc
LOGICAL status /.FALSE./ ! Set the x & y pixels to 800X600 and font size to 8x12
wc%numxpixels = 800
wc%numypixels = 600
wc%numtextcols = -1
wc%numtextrows = -1
wc%numcolors = -1
wc%title= "This is a test"C
Is that a 'c string' I see.
I have no wish to contradict your reply, I am reporting what I see in the debugger on code which does not error. That's not to say the code is right. However, I have long ago learnt to take manuals with a pinch of salt; they tend to say what the writer wants the code to do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are correct regarding the title needing to be a C string. How are you determining that the string becomes a 32-character string? The debugger will show the WINDOWCONFIG%title component as CHARACTER(80), but will show the NUL as a block outline.
I can reproduce that an attempt to set the font size to 9x16 results in 8x16. QuickWin is VERY old (predates even Digital Visual Fortran) and while it has had some enhancements over the years, the basic functionality has not changed much. I note from Using Intel® Visual Fortran to Create and Build Windows*-Based Applications that some fonts are bitmapped (and have fixed sizes) and some are TrueType and can be scaled. You might have better luck using SETFONT to specify the font and size you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve
1/ The 32 number requires more explanation, I picked up the font name buffer length; sorry.
However 32 plays a part in the window title is outlined below:-
The title string consisting of, an 83 character ‘C string’ is truncated (including NULL terminator) and shown in the debugger as a Fortran string of 80 characters , This is accepted by the routine and displayed in the window header complete with the NULL reinstated as terminator; which makes 81; no error from SETWINDOWCONFIG!
Using a 79 character ‘C string’ with NULL terminator is displayed as 78 characters without the NULL terminator; this is the intended operation.
Giving SETWINDOWCONFIG an 83 character Fortran string, it is truncated to 80 and displayed as 80 characters with the NULL terminator inserted; no error. A Fortran string less than 80 characters is displayed as is plus the NULL terminator is displayed at a variable distance behind the end of the string still no error.
String 80 chars NULL at position 81
String 54 chars NULL at position 63
String 44 chars NULL at position 58
String 15 chars NULL at position 42
String 10 chars NULL at position 38
String 0 chars NULL at position 33
2/>You might have better luck using SETFONT to specify the font and size you want<
SETFONT is for graphical text restricted to outputting strings with OUTGTEXT. It does not use WRITE, PRINT and OUTTEXT which can make some things laborious. I have my own graphics library which, since CVF, has used 8x8 console text and a built-in vector graphic font for graphics.
Anyway enough; it looks like a work around then CHX+1 to get CHX at least up to #001F0010 which gives #001D0010!
Thanks for your input.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
SETWINDOWCONFIG just takes whatever is in the 80-character structure component. It relies on Windows to look for a NUL to terminate the title.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
I think we have squeezed all the juice from SETWINDOWCONFIG. I have produced a screen with X,Y pixels requested. The desired width+1 set for the character width. Text and graphics on this surface seems to work as expected , including the extended font facility. There is a slight funny I don't yet understand
Outputting text works as long as some rules are followed. Outputting text with OUTTEXT(TXT(:COLS)) is no problem of course. Using WRITE(*,'(A,$)')TXT(:COLS) is the only way that WRITE will perform without artefact. WRITE(*,'(A)')TXT(:COLS) writes to column 1 but puts out a cr lf which overwrites next column character-position 1. WRITE(*,*)TXT(:COLS) does not use column 1 but starts at character position 2. It does not disturb the next line. This is generally in line with the manual to use formatted writes.
Graphics output uses OUTGTEXT(TXT(:COLS)) which is fine once more of course.
TXT is a string of 120 characters. COLS is the number of character columns returned from SETWINDOWCONFIG correct for the character width returned (not the +1 set)
The only funny I have found is that VIEWPORT(0,0,X-1,Y-1) which should be the rectangle available from WCONFIG.numxpixels=X WCONFIG.numypixels=Y does not allow of drawing along the bottom line of pixels from (X-1,Y-1) to (0,Y-1). I think I have exhausted the testing of this; but we shall see.
Postscript
SETWINDOWCONFIG sets a font width 1-less than WCONFIG.fontsize up to a width of 18; then 2-less for 19, and who knows upwards from there. This can be avoided as follows.
Use the extended font facility of SETWINDOWCONFIG. For example:-
WCONFIG.numxpixels = CXMAX
WCONFIG.numypixels = CYMAX
WCONFIG.numtextcols = -1
WCONFIG.numtextrows = -1
WCONFIG.numcolors = 256
WCONFIG.fontsize = QWIN$EXTENDFONT
WCONFIG.title = 'TEST 1'C
WCONFIG.bitsperpixel= INT2(8)
WCONFIG.extendfontname= 'Consolas'C !Font name
WCONFIG.extendfontsize= #00090010 !Fontsize 9X16
WCONFIG.extendfontattributes=QWIN$EXTENDFONT_ITALIC
Checking WCONFIG with GETWINDOWCONFIG shows that the WCONFIG.extendfontsize is correct at 9x16. Peculiarly enough though, WCONFIG.fontsize which is set as QWIN$EXTENDFONT (this has the value -2, #FFFFFFFE) in SETWINDOWCONFIG now returns the extendfontsize-1 in GETWINDOWCONFIG!! The extended font actually set is correct at 9x16.
ABOVE ALL REMEMBER if not using the extended font facility The font set will be width-1. The columns value must be calculated outside SETWINDOWCONFIG by
COLS=WCONFIG.numxpixels/width set (not the width returned; that is for the smaller font).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As I said in the post above
"The only funny I have found is that VIEWPORT(0,0,X-1,Y-1) which should be the rectangle available from WCONFIG.numxpixels=X WCONFIG.numypixels=Y does not allow of drawing along the bottom line of pixels from (X-1,Y-1) to (0,Y-1). I think I have exhausted the testing of this; but we shall see"
I can now say that it is nothing to do with the viewport, it is the WCONFIG.numypixels value set in SETWINDOWCONFIG which causes the problem. If we ask for a graph area 800 pixels in X and 600 pixels in Y I would expect to be able to access pixels 0 to 799 in X and 0 to 599 in Y. It appears that the only way to do this is to set
WCONFIG.numxpixels = 800
WCONFIG.numypixels = 600+1 !in other words 601........... 0 to 599 in Y (that is. 600 pixels) are then available in Y.
so that
LC2=SETCOLOR(0)
CALL MOVETO(INT2(0),INT2(0),XYS)
LC2=SETCOLOR(14)
LC2=LINETO(INT2(799),INT2(0))
LC2=LINETO(INT2(799),INT2(599))
LC2=LINETO(INT2(0),INT2(599))
LC2=LINETO(INT2(0),INT2(0))
will plot a square using the edges of the graphic area. If WCONFIG.numypixels = 600 is set the bottom row of pixels is not accessible. Calling SETVIEWPORT(0,0,699,599) does not alter this.

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