Modify GUI2 config files to scale font size with screen pixel pitch
These changes to the data/gui subdirectories make it so that above a certain screen pixel dimensions (currently 1200x900), text font sizes will be scaled with the pixel pitch of the SDL video device. In addition, several dialogues (such as the unit recall window, for example) are allowed to take on larger pixel dimensions to accommodate the larger (in pixel size) fonts.
This commit is contained in:
parent
49d8779ff1
commit
f3a472ab96
7 changed files with 46 additions and 5 deletions
|
@ -248,6 +248,16 @@
|
|||
y = "(floor((screen_height - window_height) / 2))"
|
||||
#enddef
|
||||
|
||||
#define GUI_WINDOW_PERC_FIXED_SIZE_CENTERED PERC_W PERC_H WIDTH HEIGHT
|
||||
automatic_placement = false
|
||||
|
||||
width = "(max(screen_width * {PERC_W} / 100, min(screen_width, {WIDTH})))"
|
||||
height = "(max(screen_height * {PERC_H} / 100, min(screen_height, {HEIGHT})))"
|
||||
|
||||
x = "(floor((screen_width - window_width) / 2))"
|
||||
y = "(floor((screen_height - window_height) / 2))"
|
||||
#enddef
|
||||
|
||||
#define GUI_CENTERED_IMAGE
|
||||
x = "(max(pos, 0) where pos = floor((width - image_width) / 2))"
|
||||
y = "(max(pos, 0) where pos = floor((height - image_height) / 2))"
|
||||
|
|
|
@ -80,6 +80,26 @@
|
|||
[/resolution]
|
||||
#enddef
|
||||
|
||||
# The following is a more-or-less arbitrary resolution, larger than 1024x768
|
||||
# in both dimensions, at which to switch over from the traditional
|
||||
# everything-is-fixed-size layout to one that scales proportionally to
|
||||
# the screen_pitch_microns.
|
||||
|
||||
#define _GUI_BIG_RES
|
||||
window_width = 1200
|
||||
window_height = 900
|
||||
#enddef
|
||||
|
||||
# The magic number 265 in the below formula is the pixel pitch in microns
|
||||
# corresponding to 96 dpi, which the old layout seems to have been based on.
|
||||
# The extra factor of 2/3 in the formula is a fudge factor based on the guess
|
||||
# that the old fonts took up approximately 1.5 pixels per point size at 96
|
||||
# dpi. It came out looking pretty decent on my 90-micron monitor.
|
||||
|
||||
#define _GUI_SCALE_RES SIZE
|
||||
"(floor({SIZE} * 265 * 2 / (3 * screen_pitch_microns)))"
|
||||
#enddef
|
||||
|
||||
#define _GUI_DEFINITION ID DESCRIPTION FONT_FAMILY FONT_SIZE FONT_STYLE FONT_COLOR
|
||||
[label_definition]
|
||||
id = {ID}
|
||||
|
@ -94,6 +114,15 @@
|
|||
({GUI__FONT_COLOR_DISABLED__{FONT_COLOR} ALPHA=""})
|
||||
}
|
||||
|
||||
{_GUI_RESOLUTION
|
||||
({_GUI_BIG_RES})
|
||||
({FONT_FAMILY})
|
||||
({_GUI_SCALE_RES {GUI_FONT_SIZE_{FONT_SIZE}}})
|
||||
({FONT_STYLE})
|
||||
({GUI__FONT_COLOR_ENABLED__{FONT_COLOR} ALPHA=""})
|
||||
({GUI__FONT_COLOR_DISABLED__{FONT_COLOR} ALPHA=""})
|
||||
}
|
||||
|
||||
[/label_definition]
|
||||
#enddef
|
||||
|
||||
|
@ -108,5 +137,7 @@
|
|||
|
||||
{_GUI_DEFINITION "monospace" "fixed width scroll label" monospace DEFAULT () DEFAULT }
|
||||
|
||||
#undef _GUI_SCALE_RES SIZE
|
||||
#undef _GUI_BIG_RES
|
||||
#undef _GUI_DEFINITION
|
||||
#undef _GUI_RESOLUTION
|
||||
|
|
|
@ -243,7 +243,7 @@
|
|||
[resolution]
|
||||
definition = "default"
|
||||
|
||||
{GUI_WINDOW_FIXED_SIZE_CENTERED 850 800}
|
||||
{GUI_WINDOW_PERC_FIXED_SIZE_CENTERED 80 95 850 800}
|
||||
|
||||
[linked_group]
|
||||
id = "filename"
|
||||
|
|
|
@ -594,7 +594,7 @@ Village"
|
|||
vertical_placement = "center"
|
||||
horizontal_placement = "center"
|
||||
|
||||
maximum_height = 750
|
||||
maximum_height = (max(750, screen_height*4/5))
|
||||
|
||||
[linked_group]
|
||||
id = "header"
|
||||
|
|
|
@ -303,7 +303,7 @@
|
|||
vertical_placement = "center"
|
||||
horizontal_placement = "center"
|
||||
|
||||
maximum_height = 700
|
||||
maximum_height = (max(700, screen_height * 2 / 3))
|
||||
|
||||
[linked_group]
|
||||
id = "type"
|
||||
|
|
|
@ -234,7 +234,7 @@
|
|||
vertical_placement = "center"
|
||||
horizontal_placement = "center"
|
||||
|
||||
maximum_height = 750
|
||||
maximum_height = (max(750, screen_height * 3 / 5))
|
||||
|
||||
[linked_group]
|
||||
id = "image"
|
||||
|
|
|
@ -226,7 +226,7 @@
|
|||
{DEFAULT_KEY "text_extra_height" unsigned 0}
|
||||
{DEFAULT_KEY "text_extra_width" unsigned 0}
|
||||
{DEFAULT_KEY "text_font_family" font_family "sans"}
|
||||
{DEFAULT_KEY "text_font_size" unsigned 0}
|
||||
{DEFAULT_KEY "text_font_size" f_unsigned 0}
|
||||
{DEFAULT_KEY "text_font_style" font_style ""}
|
||||
{DEFAULT_KEY "window_height" unsigned 0}
|
||||
{DEFAULT_KEY "window_width" unsigned 0}
|
||||
|
|
Loading…
Add table
Reference in a new issue