View Issue Details

IDProjectCategoryView StatusLast Update
0006234The Dark ModGUIpublic16.01.2023 22:02
ReporterDaft Mugi Assigned Tostgatilov  
PrioritynormalSeveritynormalReproducibilityalways
Status resolvedResolutionfixed 
Product VersionTDM 2.09 
Target VersionTDM 2.11Fixed in VersionTDM 2.11 
Summary0006234: Objectives screen title bottom cut off
DescriptionThe bottom of the objectives screen title can get cut off if the "gui_objectiveTextSize" is less than 0.94.
Steps To ReproduceMethod 1:
1. Click "Start this mission"
2. Look at the objectives screen title.

Method 2:
1. In game, press key to open in-game objectives overlay.
2. Look at the objectives screen title.
Additional InformationAttached screenshot.
TagsNo tags attached.
Attached Files

Activities

Daft Mugi

Daft Mugi

16.01.2023 07:54

developer   ~0015784

I've attached a patch that works for me.
I changed the "textscale" base size from 32 to 28.
r16727-fix-objectives-title.diff (378 bytes)   
diff --git guis/tdm_objectives_core.gui guis/tdm_objectives_core.gui
index a2975cb..5d45e80 100644
--- guis/tdm_objectives_core.gui
+++ guis/tdm_objectives_core.gui
@@ -74,7 +74,7 @@ windowDef ObjectivesTitle
 	visible		1
 	text		"#str_07312" // Objectives
 	font		OBJ_TEXT_FONT
-	textscale	0.32*OBJ_SIZE_MULT
+	textscale	0.28*OBJ_SIZE_MULT
 	forecolor	0,0,0,1
 	textalign	1
 }
stgatilov

stgatilov

16.01.2023 21:21

administrator   ~0015795

Happens in 2.09 too, so this is not some breakage from recent changes in objectives.
stgatilov

stgatilov

16.01.2023 21:23

administrator   ~0015796

I wonder why it even happens.
It seems that the size of the title window is computed with some kind of "if" sequence, and the match for too small scale should be corrected.
stgatilov

stgatilov

16.01.2023 21:40

administrator   ~0015797

Last edited: 16.01.2023 21:41

Font scaling is not a simple smooth thing.
It seems that there are 3 prerendered raster fonts, and the UI engine selects the most fitting one for every particular case.

void idDeviceContext::SetFontByScale(float scale) {
    if (scale <= gui_smallFontLimit.GetFloat()) {
        useFont = &activeFont->fontInfoSmall;
        activeFont->maxHeight = activeFont->maxHeightSmall;
        activeFont->maxWidth = activeFont->maxWidthSmall;
    } else if (scale <= gui_mediumFontLimit.GetFloat()) {
        useFont = &activeFont->fontInfoMedium;
        activeFont->maxHeight = activeFont->maxHeightMedium;
        activeFont->maxWidth = activeFont->maxWidthMedium;
    } else {
        useFont = &activeFont->fontInfoLarge;
        activeFont->maxHeight = activeFont->maxHeightLarge;
        activeFont->maxWidth = activeFont->maxWidthLarge;
    }
}

At the "critical" scale factor, I get scale ~= 0.3 for Objectives text.
That's exactly the value of gui_mediumFontLimit, so at this moment engine switches from large to medium font.

The max sizes vary depending on which version of font is used:
        maxHeightSmall 13
        maxWidthSmall 15
        maxHeightMedium 28
        maxWidthMedium 32
        maxHeightLarge 51
        maxWidthLarge 63
I think the idea is that Large is 2x larger than Medium, and Medium is 2x larger than Small.
But the "max" sizes are different: 51 < 28 * 2.
stgatilov

stgatilov

16.01.2023 21:45

administrator   ~0015798

Here is how the objectives GUI look if I paint every window with its background.
As you see, there is plenty of space between title text and the first objective.
I guess it would be better to use a bit more of that space than to make text smaller?
guisize.jpg (181,362 bytes)   
guisize.jpg (181,362 bytes)   
stgatilov

stgatilov

16.01.2023 21:53

administrator   ~0015799

If I change height of ObjectivesTitle from 20 * OBJ_SIZE_MULT to 30 * OBJ_SIZE_MULT, then I get much better picture.
guisize_30.jpg (180,544 bytes)   
guisize_30.jpg (180,544 bytes)   
stgatilov

stgatilov

16.01.2023 21:59

administrator   ~0015800

Committed the vertical size increase in svn rev 16741.
Daft Mugi

Daft Mugi

16.01.2023 22:02

developer   ~0015801

Looks great!

Issue History

Date Modified Username Field Change
16.01.2023 07:51 Daft Mugi New Issue
16.01.2023 07:51 Daft Mugi File Added: newjob (2023-01-16 01-30-48) (0 0 0) edited.jpg
16.01.2023 07:54 Daft Mugi Note Added: 0015784
16.01.2023 07:54 Daft Mugi File Added: r16727-fix-objectives-title.diff
16.01.2023 21:21 stgatilov Note Added: 0015795
16.01.2023 21:23 stgatilov Note Added: 0015796
16.01.2023 21:40 stgatilov Note Added: 0015797
16.01.2023 21:41 stgatilov Note Edited: 0015797
16.01.2023 21:45 stgatilov Note Added: 0015798
16.01.2023 21:45 stgatilov File Added: guisize.jpg
16.01.2023 21:53 stgatilov Note Added: 0015799
16.01.2023 21:53 stgatilov File Added: guisize_30.jpg
16.01.2023 21:59 stgatilov Note Added: 0015800
16.01.2023 22:00 stgatilov Assigned To => stgatilov
16.01.2023 22:00 stgatilov Status new => assigned
16.01.2023 22:00 stgatilov Product Version SVN => TDM 2.09
16.01.2023 22:00 stgatilov Fixed in Version => TDM 2.11
16.01.2023 22:00 stgatilov Target Version => TDM 2.11
16.01.2023 22:00 stgatilov Status assigned => resolved
16.01.2023 22:00 stgatilov Resolution open => fixed
16.01.2023 22:02 Daft Mugi Note Added: 0015801