Skip to content

Scaling Font with Resolution #875

Open
@Mauller

Description

@Mauller

Font's do not scale beyond 2x their default sizes relative to a horizontal resolution of 800 pixels.

The issue is twofold;

  1. They hard coded a maximum font size
  2. The original code would not properly scale with aspect ratios other than 4:3

The following code is a proposed fix for this within GlobalLanguage.cpp. It corrects the hard upper limit and sets the adjustment factor based on the smallest axes of the resolution being used. This is to help keep the font in proportion.

Int GlobalLanguage::adjustFontSize(Int theFontSize) 
{
	// TheSupperHackers @bugfix Mauller 17/05/2025 Scale the font in relation to the resolution taking the smallest axis into account.
	Real adjustFactor = min(TheGlobalData->m_xResolution/800.0f, TheGlobalData->m_yResolution/600.0f);
	adjustFactor = 1.0f + ((adjustFactor - 1.0f) * m_resolutionFontSizeAdjustment);
	if (adjustFactor<1.0f) adjustFactor = 1.0f;
	//if (adjustFactor>2.0f) adjustFactor = 2.0f;
	Int pointSize = REAL_TO_INT_FLOOR(theFontSize*adjustFactor);
	return pointSize;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementIs new feature or requestFixIs fixing somethingGUIFor graphical user interface

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions