James Ross, on 19 April 2014 - 01:22 PM, said:
That's what the custom option would do; either by specifying that "you can trust the height of this control to set the font size" or by actually specifying a font size (relative to the MSTS default font)....
Alas, the height information in there is too unreliable to be useful but we might be able to add a custom option.
Some thoughts on this (sorry if it is long-winded) ---
The code in ORTS that produces the digital lettering is fine- it does a great job of looking after the color, decimal point display, etc. The font size problem arises from the use of a single font size for all cabviews. This choice may have resulted (see James quote above) from the wide variation in the parameters of digital display boxes in the cabview (.cvf) files, in particular the values used in the .cvf file to define the size of the digital box.
In MSTS, as was observed earlier, the values of "Width" and "Height" in the .cvf file are ignored by MSTS. (That may explain the wide range of values found.) Instead, the font size of digital displays is modified by changing an entry in the "gui_fnts.dat" file; unfortunately this changes the digital fonts in all locomotive cabview digital displays, regardless of their cab layout details.
In ORTS, the method "CabViewDigitalRenderer(...)" in MSTSLocomotiveViewer.cs uses the values of the width and height of the box in the .cvf file to set up the DrawPosition parameters to draw the digital digits, using normalizing values ( apparently of a 640x480 display). But it choses the font size based on a constant "FontScale" which is, I assume, a best-guess to cover the wide range of values found in the .cvf files.
However, this produces some sub-optimum fits for some locomotive displays, as reported above.
I suggest that ORTS should use the "Height" of each digital box to set the font size for that box, and that the values in the .cvf file be adjusted to make the display acceptable. This has the following advantages:
1. The adjustments for a particular cab require only text editing of the .cvf file, with the result immediately visible by restarting ORTS; (The MSTS Cab Editor is NOT required, except optionally to see what the boxes look like). I would be happy to write some notes on editing the files.
2. These changes in the .cvf file do not have any effect on the MSTS display;
3. The resulting font size is appropriate for the particular cab;
4. It produces an appropriate font size for varying sizes of digital boxes in a single cabview (I notice that the clock and speedometer displays are typically significantly different from the displays of brake line pressures, for instance.)
5. IMHO, it works quite well and looks good.
The disadvantage ?
1. Some .cvf files would have to be modified to get an acceptable display.
2. Some users are not comfortable editing simulator support files.
If this is seen as a serious problem, an additional option (!!!) to retain the current calculation of font size could be added for those who prefer not to modify any files; i.e "Calculate Cab View Digital Font Sizes YES/NO".
My suggested changes to the code to calculate the font size:
"FontScale" would no longer be a const in the CabViewDigitalRenderer class, but would be replaced by a float value within the method CabViewDigitalRenderer(...) so that it is calculated for each digital box. The value would be simply based on the value of 'Control.Height', with a minimum value to guarantee visibility, e.g.
float fScale = Math.Max(8f, (float)Control.Height;
The line:
DrawFont = Viewer.WindowManager.TextManager.Get("Courier New", Viewer.CabHeightPixels * FontScale, System.Drawing.FontStyle.Regular);
would then become:
DrawFont = Viewer.WindowManager.TextManager.Get("Courier New", fScale, System.Drawing.FontStyle.Regular);
(Note that this gets rid of a multiplication by 'Viewer.CabHeightPixels'.)
Edit: I used the raw value of Control.Height because that worked for the first couple of .cvf that I tried.
Cheers,
Sid.