Adjustable Character Size in Resizeable Graphics Windows
QUESTION: Is there a way I can allow my plot title strings and other characters to change size according to the size of the window in the resizeable graphics window cgWindow? I'd prefer to use small characters when the window is small and large characters when the window is large.
ANSWER: Yes, this is possible in cgWindow by setting the property with the AdjustSize keyword. The property can be set for all windows by using the cgWindow_SetDefs command with the keyword. Setting the value to 1 turns the adjustable character size property on for all future windows. Setting the value to 0 turns the property off.
IDL> cgWindow_SetDefs, ADJUSTSIZE=1
The property can also be turned on or off for an individual window that is already on the display by using the cgControl command with the keyword. In other words, to turn the property on for the current cgWindow you would type this.
IDL> cgControl, ADJUSTSIZE=1
Here, for example, is what a graphics window looks like when the window is resized when the adjustable character size property is turned on for the window. The commands used in this example are these.
IDL> cgWindow_SetDefs, ADJUSTSIZE=1 IDL> cgPlot, cgDemoData(1), XTITLE='Signal', YTITLE='Strength', /WINDOW
|In small windows, a small character size is used.|
|In large windows, a larger character size is used.|
Please note that for adjustable character size to be used you must not set a character size, either by using a character size keyword or by setting !P.Charsize. Adjustable character size is only available if you use the default character size specified by the cgDefCharsize command in the commands that are loaded into cgWindow. Also note that adjustable character size only applies to the display figure. It does not apply, for example, to the PostScript output that is automatically generated from the resizeable cgWindow program.
Adjustable character size is implemented by setting the AdjustSize keyword in the cgDefCharsize program. If this keyword is set, the Coyote Library program Str_Size is used to adjust the character size.
If the adjustable text size property is turned on in a particular cgWindow, you can turn it off with cgControl. The graphics display will immediately reflect the default character size for the window, provided the commands you have loaded into cgWindow are not in any way setting their own character size.
IDL> cgControl, ADJUSTSIZE=0
|Characters appear in normal size when the adjustable size property is turned off.|
Version of IDL used to prepare this article: IDL 7.0.1.