Changeset - r28167:b14ea36d49e5
[Not reviewed]
master
0 57 0
Peter Nelson - 13 months ago 2023-11-21 19:04:24
peter1138@openttd.org
Codechange: Remove FONT_HEIGHT_... macros. (#11481)

These make it look like we're dealing with a constant, but actually each is a call to `GetCharacterHeight(...)`.
57 files changed with 370 insertions and 382 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_gui.cpp
Show inline comments
 
@@ -135,7 +135,7 @@ struct AIConfigWindow : public Window {
 
				break;
 

	
 
			case WID_AIC_LIST:
 
				this->line_height = FONT_HEIGHT_NORMAL + padding.height;
 
				this->line_height = GetCharacterHeight(FS_NORMAL) + padding.height;
 
				resize->height = this->line_height;
 
				size->height = 8 * this->line_height;
 
				break;
src/aircraft_gui.cpp
Show inline comments
 
@@ -38,7 +38,7 @@ void DrawAircraftDetails(const Aircraft 
 
			SetDParam(1, u->build_year);
 
			SetDParam(2, u->value);
 
			DrawString(r.left, r.right, y, STR_VEHICLE_INFO_BUILT_VALUE);
 
			y += FONT_HEIGHT_NORMAL;
 
			y += GetCharacterHeight(FS_NORMAL);
 

	
 
			SetDParam(0, u->cargo_type);
 
			SetDParam(1, u->cargo_cap);
 
@@ -46,7 +46,7 @@ void DrawAircraftDetails(const Aircraft 
 
			SetDParam(3, u->Next()->cargo_cap);
 
			SetDParam(4, GetCargoSubtypeText(u));
 
			DrawString(r.left, r.right, y, (u->Next()->cargo_cap != 0) ? STR_VEHICLE_INFO_CAPACITY_CAPACITY : STR_VEHICLE_INFO_CAPACITY);
 
			y += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
			y += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 
		}
 

	
 
		if (u->cargo_cap != 0) {
 
@@ -58,7 +58,7 @@ void DrawAircraftDetails(const Aircraft 
 
				SetDParam(1, cargo_count);
 
				SetDParam(2, u->cargo.GetFirstStation());
 
				DrawString(r.left, r.right, y, STR_VEHICLE_DETAILS_CARGO_FROM);
 
				y += FONT_HEIGHT_NORMAL;
 
				y += GetCharacterHeight(FS_NORMAL);
 
				feeder_share += u->cargo.GetFeederShare();
 
			}
 
		}
src/airport_gui.cpp
Show inline comments
 
@@ -338,7 +338,7 @@ public:
 
					size->width = std::max(size->width, GetStringBoundingBox(as->name).width + padding.width);
 
				}
 

	
 
				this->line_height = FONT_HEIGHT_NORMAL + padding.height;
 
				this->line_height = GetCharacterHeight(FS_NORMAL) + padding.height;
 
				size->height = 5 * this->line_height;
 
				break;
 
			}
 
@@ -431,14 +431,14 @@ public:
 
				/* show the noise of the selected airport */
 
				SetDParam(0, as->noise_level);
 
				DrawString(r.left, r.right, top, STR_STATION_BUILD_NOISE);
 
				top += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
				top += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 
			}
 

	
 
			if (_settings_game.economy.infrastructure_maintenance) {
 
				Money monthly = _price[PR_INFRASTRUCTURE_AIRPORT] * as->maintenance_cost >> 3;
 
				SetDParam(0, monthly * 12);
 
				DrawString(r.left, r.right, top, STR_STATION_BUILD_INFRASTRUCTURE_COST);
 
				top += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
				top += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 
			}
 

	
 
			/* strings such as 'Size' and 'Coverage Area' */
src/autoreplace_gui.cpp
Show inline comments
 
@@ -334,7 +334,7 @@ public:
 

	
 
			case WID_RV_LEFT_DETAILS:
 
			case WID_RV_RIGHT_DETAILS:
 
				size->height = FONT_HEIGHT_NORMAL * this->details_height + padding.height;
 
				size->height = GetCharacterHeight(FS_NORMAL) * this->details_height + padding.height;
 
				break;
 

	
 
			case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: {
 
@@ -530,7 +530,7 @@ public:
 
					const Rect r = this->GetWidget<NWidgetBase>(side == 0 ? WID_RV_LEFT_DETAILS : WID_RV_RIGHT_DETAILS)->GetCurrentRect()
 
							.Shrink(WidgetDimensions::scaled.frametext, WidgetDimensions::scaled.framerect);
 
					int text_end = DrawVehiclePurchaseInfo(r.left, r.right, r.top, this->sel_engine[side], ted);
 
					needed_height = std::max(needed_height, (text_end - r.top) / FONT_HEIGHT_NORMAL);
 
					needed_height = std::max(needed_height, (text_end - r.top) / GetCharacterHeight(FS_NORMAL));
 
				}
 
			}
 
			if (needed_height != this->details_height) { // Details window are not high enough, enlarge them.
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -51,7 +51,7 @@
 
 */
 
uint GetEngineListHeight(VehicleType type)
 
{
 
	return std::max<uint>(FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.matrix.Vertical(), GetVehicleImageCellSize(type, EIT_PURCHASE).height);
 
	return std::max<uint>(GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.matrix.Vertical(), GetVehicleImageCellSize(type, EIT_PURCHASE).height);
 
}
 

	
 
static const NWidgetPart _nested_build_vehicle_widgets[] = {
 
@@ -582,7 +582,7 @@ static int DrawCargoCapacityInfo(int lef
 
		SetDParam(1, te.all_capacities[cid]);
 
		SetDParam(2, refittable ? STR_PURCHASE_INFO_REFITTABLE : STR_EMPTY);
 
		DrawString(left, right, y, STR_PURCHASE_INFO_CAPACITY);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 
	}
 

	
 
	return y;
 
@@ -602,14 +602,14 @@ static int DrawRailWagonPurchaseInfo(int
 
		SetDParam(0, e->GetCost());
 
		DrawString(left, right, y, STR_PURCHASE_INFO_COST);
 
	}
 
	y += FONT_HEIGHT_NORMAL;
 
	y += GetCharacterHeight(FS_NORMAL);
 

	
 
	/* Wagon weight - (including cargo) */
 
	uint weight = e->GetDisplayWeight();
 
	SetDParam(0, weight);
 
	SetDParam(1, GetCargoWeight(te.all_capacities, VEH_TRAIN) + weight);
 
	DrawString(left, right, y, STR_PURCHASE_INFO_WEIGHT_CWEIGHT);
 
	y += FONT_HEIGHT_NORMAL;
 
	y += GetCharacterHeight(FS_NORMAL);
 

	
 
	/* Wagon speed limit, displayed if above zero */
 
	if (_settings_game.vehicle.wagon_speed_limits) {
 
@@ -617,7 +617,7 @@ static int DrawRailWagonPurchaseInfo(int
 
		if (max_speed > 0) {
 
			SetDParam(0, PackVelocity(max_speed, e->type));
 
			DrawString(left, right, y, STR_PURCHASE_INFO_SPEED);
 
			y += FONT_HEIGHT_NORMAL;
 
			y += GetCharacterHeight(FS_NORMAL);
 
		}
 
	}
 

	
 
@@ -625,7 +625,7 @@ static int DrawRailWagonPurchaseInfo(int
 
	if (rvi->running_cost_class != INVALID_PRICE) {
 
		SetDParam(0, e->GetRunningCost());
 
		DrawString(left, right, y, STR_PURCHASE_INFO_RUNNINGCOST);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 
	}
 

	
 
	return y;
 
@@ -647,26 +647,26 @@ static int DrawRailEnginePurchaseInfo(in
 
		SetDParam(1, e->GetDisplayWeight());
 
		DrawString(left, right, y, STR_PURCHASE_INFO_COST_WEIGHT);
 
	}
 
	y += FONT_HEIGHT_NORMAL;
 
	y += GetCharacterHeight(FS_NORMAL);
 

	
 
	/* Max speed - Engine power */
 
	SetDParam(0, PackVelocity(e->GetDisplayMaxSpeed(), e->type));
 
	SetDParam(1, e->GetPower());
 
	DrawString(left, right, y, STR_PURCHASE_INFO_SPEED_POWER);
 
	y += FONT_HEIGHT_NORMAL;
 
	y += GetCharacterHeight(FS_NORMAL);
 

	
 
	/* Max tractive effort - not applicable if old acceleration or maglev */
 
	if (_settings_game.vehicle.train_acceleration_model != AM_ORIGINAL && GetRailTypeInfo(rvi->railtype)->acceleration_type != 2) {
 
		SetDParam(0, e->GetDisplayMaxTractiveEffort());
 
		DrawString(left, right, y, STR_PURCHASE_INFO_MAX_TE);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 
	}
 

	
 
	/* Running cost */
 
	if (rvi->running_cost_class != INVALID_PRICE) {
 
		SetDParam(0, e->GetRunningCost());
 
		DrawString(left, right, y, STR_PURCHASE_INFO_RUNNINGCOST);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 
	}
 

	
 
	/* Powered wagons power - Powered wagons extra weight */
 
@@ -674,7 +674,7 @@ static int DrawRailEnginePurchaseInfo(in
 
		SetDParam(0, rvi->pow_wag_power);
 
		SetDParam(1, rvi->pow_wag_weight);
 
		DrawString(left, right, y, STR_PURCHASE_INFO_PWAGPOWER_PWAGWEIGHT);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 
	}
 

	
 
	return y;
 
@@ -695,25 +695,25 @@ static int DrawRoadVehPurchaseInfo(int l
 
			SetDParam(0, e->GetCost());
 
			DrawString(left, right, y, STR_PURCHASE_INFO_COST);
 
		}
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 

	
 
		/* Road vehicle weight - (including cargo) */
 
		int16_t weight = e->GetDisplayWeight();
 
		SetDParam(0, weight);
 
		SetDParam(1, GetCargoWeight(te.all_capacities, VEH_ROAD) + weight);
 
		DrawString(left, right, y, STR_PURCHASE_INFO_WEIGHT_CWEIGHT);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 

	
 
		/* Max speed - Engine power */
 
		SetDParam(0, PackVelocity(e->GetDisplayMaxSpeed(), e->type));
 
		SetDParam(1, e->GetPower());
 
		DrawString(left, right, y, STR_PURCHASE_INFO_SPEED_POWER);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 

	
 
		/* Max tractive effort */
 
		SetDParam(0, e->GetDisplayMaxTractiveEffort());
 
		DrawString(left, right, y, STR_PURCHASE_INFO_MAX_TE);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 
	} else {
 
		/* Purchase cost - Max speed */
 
		if (te.cost != 0) {
 
@@ -726,13 +726,13 @@ static int DrawRoadVehPurchaseInfo(int l
 
			SetDParam(1, PackVelocity(e->GetDisplayMaxSpeed(), e->type));
 
			DrawString(left, right, y, STR_PURCHASE_INFO_COST_SPEED);
 
		}
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 
	}
 

	
 
	/* Running cost */
 
	SetDParam(0, e->GetRunningCost());
 
	DrawString(left, right, y, STR_PURCHASE_INFO_RUNNINGCOST);
 
	y += FONT_HEIGHT_NORMAL;
 
	y += GetCharacterHeight(FS_NORMAL);
 

	
 
	return y;
 
}
 
@@ -758,7 +758,7 @@ static int DrawShipPurchaseInfo(int left
 
			SetDParam(1, PackVelocity(ocean_speed, e->type));
 
			DrawString(left, right, y, STR_PURCHASE_INFO_COST_SPEED);
 
		}
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 
	} else {
 
		if (te.cost != 0) {
 
			SetDParam(0, e->GetCost() + te.cost);
 
@@ -768,15 +768,15 @@ static int DrawShipPurchaseInfo(int left
 
			SetDParam(0, e->GetCost());
 
			DrawString(left, right, y, STR_PURCHASE_INFO_COST);
 
		}
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 

	
 
		SetDParam(0, PackVelocity(ocean_speed, e->type));
 
		DrawString(left, right, y, STR_PURCHASE_INFO_SPEED_OCEAN);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 

	
 
		SetDParam(0, PackVelocity(canal_speed, e->type));
 
		DrawString(left, right, y, STR_PURCHASE_INFO_SPEED_CANAL);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 
	}
 

	
 
	/* Cargo type + capacity */
 
@@ -784,12 +784,12 @@ static int DrawShipPurchaseInfo(int left
 
	SetDParam(1, te.capacity);
 
	SetDParam(2, refittable ? STR_PURCHASE_INFO_REFITTABLE : STR_EMPTY);
 
	DrawString(left, right, y, STR_PURCHASE_INFO_CAPACITY);
 
	y += FONT_HEIGHT_NORMAL;
 
	y += GetCharacterHeight(FS_NORMAL);
 

	
 
	/* Running cost */
 
	SetDParam(0, e->GetRunningCost());
 
	DrawString(left, right, y, STR_PURCHASE_INFO_RUNNINGCOST);
 
	y += FONT_HEIGHT_NORMAL;
 
	y += GetCharacterHeight(FS_NORMAL);
 

	
 
	return y;
 
}
 
@@ -818,7 +818,7 @@ static int DrawAircraftPurchaseInfo(int 
 
		SetDParam(1, PackVelocity(e->GetDisplayMaxSpeed(), e->type));
 
		DrawString(left, right, y, STR_PURCHASE_INFO_COST_SPEED);
 
	}
 
	y += FONT_HEIGHT_NORMAL;
 
	y += GetCharacterHeight(FS_NORMAL);
 

	
 
	/* Cargo capacity */
 
	if (te.mail_capacity > 0) {
 
@@ -835,24 +835,24 @@ static int DrawAircraftPurchaseInfo(int 
 
		SetDParam(2, refittable ? STR_PURCHASE_INFO_REFITTABLE : STR_EMPTY);
 
		DrawString(left, right, y, STR_PURCHASE_INFO_CAPACITY);
 
	}
 
	y += FONT_HEIGHT_NORMAL;
 
	y += GetCharacterHeight(FS_NORMAL);
 

	
 
	/* Running cost */
 
	SetDParam(0, e->GetRunningCost());
 
	DrawString(left, right, y, STR_PURCHASE_INFO_RUNNINGCOST);
 
	y += FONT_HEIGHT_NORMAL;
 
	y += GetCharacterHeight(FS_NORMAL);
 

	
 
	/* Aircraft type */
 
	SetDParam(0, e->GetAircraftTypeText());
 
	DrawString(left, right, y, STR_PURCHASE_INFO_AIRCRAFT_TYPE);
 
	y += FONT_HEIGHT_NORMAL;
 
	y += GetCharacterHeight(FS_NORMAL);
 

	
 
	/* Aircraft range, if available. */
 
	uint16_t range = e->GetRange();
 
	if (range != 0) {
 
		SetDParam(0, range);
 
		DrawString(left, right, y, STR_PURCHASE_INFO_AIRCRAFT_RANGE);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 
	}
 

	
 
	return y;
 
@@ -958,7 +958,7 @@ int DrawVehiclePurchaseInfo(int left, in
 
			SetDParam(0, CT_INVALID);
 
			SetDParam(2, STR_EMPTY);
 
			DrawString(left, right, y, STR_PURCHASE_INFO_CAPACITY);
 
			y += FONT_HEIGHT_NORMAL;
 
			y += GetCharacterHeight(FS_NORMAL);
 
		} else {
 
			y = new_y;
 
		}
 
@@ -970,12 +970,12 @@ int DrawVehiclePurchaseInfo(int left, in
 
		SetDParam(0, ymd.year);
 
		SetDParam(1, TimerGameCalendar::DateToYear(e->GetLifeLengthInDays()));
 
		DrawString(left, right, y, STR_PURCHASE_INFO_DESIGNED_LIFE);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 

	
 
		/* Reliability */
 
		SetDParam(0, ToPercent16(e->reliability));
 
		DrawString(left, right, y, STR_PURCHASE_INFO_RELIABILITY);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 
	}
 

	
 
	if (refittable) y = ShowRefitOptionsList(left, right, y, engine_number);
 
@@ -988,7 +988,7 @@ int DrawVehiclePurchaseInfo(int left, in
 
	if (_settings_client.gui.show_newgrf_name && config != nullptr)
 
	{
 
		DrawString(left, right, y, config->GetName(), TC_BLACK);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 
	}
 

	
 
	return y;
 
@@ -1044,8 +1044,8 @@ void DrawEngineList(VehicleType type, co
 
	Rect rr = tr.WithWidth(replace_icon.width, !rtl);                                                                 // Replace icon position
 
	if (show_count) tr = tr.Indent(count_width + WidgetDimensions::scaled.hsep_normal + replace_icon.width + WidgetDimensions::scaled.hsep_wide, !rtl);
 

	
 
	int normal_text_y_offset = (ir.Height() - FONT_HEIGHT_NORMAL) / 2;
 
	int small_text_y_offset  = ir.Height() - FONT_HEIGHT_SMALL;
 
	int normal_text_y_offset = (ir.Height() - GetCharacterHeight(FS_NORMAL)) / 2;
 
	int small_text_y_offset  = ir.Height() - GetCharacterHeight(FS_SMALL);
 
	int replace_icon_y_offset = (ir.Height() - replace_icon.height) / 2;
 

	
 
	int y = ir.top;
 
@@ -1085,7 +1085,7 @@ void DrawEngineList(VehicleType type, co
 
		if (indent > 0) {
 
			/* Draw tree lines */
 
			Rect fr = ir.Indent(indent - WidgetDimensions::scaled.hsep_indent, rtl).WithWidth(circle_width, rtl);
 
			int ycenter = y + normal_text_y_offset + FONT_HEIGHT_NORMAL / 2;
 
			int ycenter = y + normal_text_y_offset + GetCharacterHeight(FS_NORMAL) / 2;
 
			bool continues = (min + 1U) < eng_list.size() && eng_list[min + 1].indent == item.indent;
 
			GfxDrawLine(fr.left + circle_width / 2, y - WidgetDimensions::scaled.matrix.top, fr.left + circle_width / 2, continues ? y - WidgetDimensions::scaled.matrix.top + step_size - 1 : ycenter, linecolour, WidgetDimensions::scaled.fullbevel.top);
 
			GfxDrawLine(fr.left + circle_width / 2, ycenter, fr.right, ycenter, linecolour, WidgetDimensions::scaled.fullbevel.top);
 
@@ -1751,7 +1751,7 @@ struct BuildVehicleWindow : Window {
 
				break;
 

	
 
			case WID_BV_PANEL:
 
				size->height = FONT_HEIGHT_NORMAL * this->details_height + padding.height;
 
				size->height = GetCharacterHeight(FS_NORMAL) * this->details_height + padding.height;
 
				break;
 

	
 
			case WID_BV_SORT_ASCENDING_DESCENDING: {
 
@@ -1822,12 +1822,12 @@ struct BuildVehicleWindow : Window {
 
			if (this->sel_engine != INVALID_ENGINE) {
 
				const Rect r = this->GetWidget<NWidgetBase>(WID_BV_PANEL)->GetCurrentRect().Shrink(WidgetDimensions::scaled.frametext, WidgetDimensions::scaled.framerect);
 
				int text_end = DrawVehiclePurchaseInfo(r.left, r.right, r.top, this->sel_engine, this->te);
 
				needed_height = std::max(needed_height, (text_end - r.top) / FONT_HEIGHT_NORMAL);
 
				needed_height = std::max(needed_height, (text_end - r.top) / GetCharacterHeight(FS_NORMAL));
 
			}
 
			if (needed_height != this->details_height) { // Details window are not high enough, enlarge them.
 
				int resize = needed_height - this->details_height;
 
				this->details_height = needed_height;
 
				this->ReInit(0, resize * FONT_HEIGHT_NORMAL);
 
				this->ReInit(0, resize * GetCharacterHeight(FS_NORMAL));
 
				return;
 
			}
 
		}
src/cheat_gui.cpp
Show inline comments
 
@@ -250,7 +250,7 @@ struct CheatWindow : Window {
 
		uint text_left   = ir.left + (rtl ? 0 : WidgetDimensions::scaled.hsep_wide * 4 + this->box.width + SETTING_BUTTON_WIDTH);
 
		uint text_right  = ir.right - (rtl ? WidgetDimensions::scaled.hsep_wide * 4 + this->box.width + SETTING_BUTTON_WIDTH : 0);
 

	
 
		int text_y_offset = (this->line_height - FONT_HEIGHT_NORMAL) / 2;
 
		int text_y_offset = (this->line_height - GetCharacterHeight(FS_NORMAL)) / 2;
 
		int box_y_offset = (this->line_height - this->box.height) / 2;
 
		int button_y_offset = (this->line_height - SETTING_BUTTON_HEIGHT) / 2;
 
		int icon_y_offset = (this->line_height - this->icon.height) / 2;
 
@@ -339,7 +339,7 @@ struct CheatWindow : Window {
 

	
 
		this->line_height = std::max(this->box.height, this->icon.height);
 
		this->line_height = std::max<uint>(this->line_height, SETTING_BUTTON_HEIGHT);
 
		this->line_height = std::max<uint>(this->line_height, FONT_HEIGHT_NORMAL) + WidgetDimensions::scaled.framerect.Vertical();
 
		this->line_height = std::max<uint>(this->line_height, GetCharacterHeight(FS_NORMAL)) + WidgetDimensions::scaled.framerect.Vertical();
 

	
 
		size->width = width + WidgetDimensions::scaled.hsep_wide * 4 + this->box.width + SETTING_BUTTON_WIDTH /* stuff on the left */ + WidgetDimensions::scaled.hsep_wide * 2 /* extra spacing on right */;
 
		size->height = WidgetDimensions::scaled.framerect.Vertical() + this->line_height * lengthof(_cheats_ui);
src/company_gui.cpp
Show inline comments
 
@@ -91,7 +91,7 @@ struct ExpensesList {
 
	uint GetHeight() const
 
	{
 
		/* Add up the height of all the lines.  */
 
		return static_cast<uint>(this->items.size()) * FONT_HEIGHT_NORMAL;
 
		return static_cast<uint>(this->items.size()) * GetCharacterHeight(FS_NORMAL);
 
	}
 

	
 
	/** Compute width of the expenses categories in pixels. */
 
@@ -119,15 +119,15 @@ static const std::initializer_list<Expen
 
static uint GetTotalCategoriesHeight()
 
{
 
	/* There's an empty line and blockspace on the year row */
 
	uint total_height = FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_wide;
 
	uint total_height = GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_wide;
 

	
 
	for (const ExpensesList &list : _expenses_list_types) {
 
		/* Title + expense list + total line + total + blockspace after category */
 
		total_height += FONT_HEIGHT_NORMAL + list.GetHeight() + WidgetDimensions::scaled.vsep_normal + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_wide;
 
		total_height += GetCharacterHeight(FS_NORMAL) + list.GetHeight() + WidgetDimensions::scaled.vsep_normal + GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_wide;
 
	}
 

	
 
	/* Total income */
 
	total_height += WidgetDimensions::scaled.vsep_normal + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_wide;
 
	total_height += WidgetDimensions::scaled.vsep_normal + GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_wide;
 

	
 
	return total_height;
 
}
 
@@ -162,7 +162,7 @@ static void DrawCategory(const Rect &r, 
 

	
 
	for (const ExpensesType &et : list.items) {
 
		DrawString(tr, STR_FINANCES_SECTION_CONSTRUCTION + et);
 
		tr.top += FONT_HEIGHT_NORMAL;
 
		tr.top += GetCharacterHeight(FS_NORMAL);
 
	}
 
}
 

	
 
@@ -174,12 +174,12 @@ static void DrawCategory(const Rect &r, 
 
static void DrawCategories(const Rect &r)
 
{
 
	/* Start with an empty space in the year row, plus the blockspace under the year. */
 
	int y = r.top + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_wide;
 
	int y = r.top + GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_wide;
 

	
 
	for (const ExpensesList &list : _expenses_list_types) {
 
		/* Draw category title and advance y */
 
		DrawString(r.left, r.right, y, list.title, TC_FROMSTRING, SA_LEFT);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 

	
 
		/* Draw category items and advance y */
 
		DrawCategory(r, y, list);
 
@@ -190,7 +190,7 @@ static void DrawCategories(const Rect &r
 

	
 
		/* Draw category total and advance y */
 
		DrawString(r.left, r.right, y, STR_FINANCES_TOTAL_CAPTION, TC_FROMSTRING, SA_RIGHT);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 

	
 
		/* Advance y by a blockspace after this category block */
 
		y += WidgetDimensions::scaled.vsep_wide;
 
@@ -235,7 +235,7 @@ static Money DrawYearCategory(const Rect
 
		Money cost = tbl[et];
 
		sum += cost;
 
		if (cost != 0) DrawPrice(cost, r.left, r.right, y, TC_BLACK);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 
	}
 

	
 
	/* Draw the total at the bottom of the category. */
 
@@ -263,14 +263,14 @@ static void DrawYearColumn(const Rect &r
 
	/* Year header */
 
	SetDParam(0, year);
 
	DrawString(r.left, r.right, y, STR_FINANCES_YEAR, TC_FROMSTRING, SA_RIGHT, true);
 
	y += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_wide;
 
	y += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_wide;
 

	
 
	/* Categories */
 
	for (const ExpensesList &list : _expenses_list_types) {
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 
		sum += DrawYearCategory(r, y, list, tbl);
 
		/* Expense list + expense category title + expense category total + blockspace after category */
 
		y += list.GetHeight() + WidgetDimensions::scaled.vsep_normal + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_wide;
 
		y += list.GetHeight() + WidgetDimensions::scaled.vsep_normal + GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_wide;
 
	}
 

	
 
	/* Total income. */
 
@@ -405,7 +405,7 @@ struct CompanyFinancesWindow : Window {
 
				break;
 

	
 
			case WID_CF_INTEREST_RATE:
 
				size->height = FONT_HEIGHT_NORMAL;
 
				size->height = GetCharacterHeight(FS_NORMAL);
 
				break;
 
		}
 
	}
 
@@ -586,7 +586,7 @@ public:
 

	
 
	uint Height() const override
 
	{
 
		return std::max(FONT_HEIGHT_NORMAL, ScaleGUITrad(12) + WidgetDimensions::scaled.vsep_normal);
 
		return std::max(GetCharacterHeight(FS_NORMAL), ScaleGUITrad(12) + WidgetDimensions::scaled.vsep_normal);
 
	}
 

	
 
	bool Selectable() const override
 
@@ -598,7 +598,7 @@ public:
 
	{
 
		bool rtl = _current_text_dir == TD_RTL;
 
		int icon_y = CenterBounds(r.top, r.bottom, 0);
 
		int text_y = CenterBounds(r.top, r.bottom, FONT_HEIGHT_NORMAL);
 
		int text_y = CenterBounds(r.top, r.bottom, GetCharacterHeight(FS_NORMAL));
 
		Rect tr = r.Shrink(WidgetDimensions::scaled.dropdowntext);
 
		DrawSprite(SPR_VEH_BUS_SIDE_VIEW, PALETTE_RECOLOUR_START + (this->result % COLOUR_END),
 
				   rtl ? tr.right - ScaleGUITrad(14) : tr.left + ScaleGUITrad(14),
 
@@ -818,7 +818,7 @@ public:
 
			case WID_SCL_MATRIX: {
 
				/* 11 items in the default rail class */
 
				this->square = GetSpriteSize(SPR_SQUARE);
 
				this->line_height = std::max(this->square.height, (uint)FONT_HEIGHT_NORMAL) + padding.height;
 
				this->line_height = std::max(this->square.height, (uint)GetCharacterHeight(FS_NORMAL)) + padding.height;
 

	
 
				size->height = 11 * this->line_height;
 
				resize->width = 1;
 
@@ -923,7 +923,7 @@ public:
 

	
 
		Rect ir = r.WithHeight(this->resize.step_height).Shrink(WidgetDimensions::scaled.matrix);
 
		int square_offs = (ir.Height() - this->square.height) / 2;
 
		int text_offs   = (ir.Height() - FONT_HEIGHT_NORMAL) / 2;
 
		int text_offs   = (ir.Height() - GetCharacterHeight(FS_NORMAL)) / 2;
 

	
 
		int y = ir.top;
 

	
 
@@ -1928,7 +1928,7 @@ struct CompanyInfrastructureWindow : Win
 
					size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_SIGNALS).width + padding.width + WidgetDimensions::scaled.hsep_indent);
 
				}
 

	
 
				size->height = std::max(size->height, lines * FONT_HEIGHT_NORMAL);
 
				size->height = std::max(size->height, lines * GetCharacterHeight(FS_NORMAL));
 
				break;
 
			}
 

	
 
@@ -1945,7 +1945,7 @@ struct CompanyInfrastructureWindow : Win
 
					}
 
				}
 

	
 
				size->height = std::max(size->height, lines * FONT_HEIGHT_NORMAL);
 
				size->height = std::max(size->height, lines * GetCharacterHeight(FS_NORMAL));
 
				break;
 
			}
 

	
 
@@ -2006,7 +2006,7 @@ struct CompanyInfrastructureWindow : Win
 

	
 
				/* Set height of the total line. */
 
				if (widget == WID_CI_TOTAL) {
 
					size->height = _settings_game.economy.infrastructure_maintenance ? std::max<uint>(size->height, WidgetDimensions::scaled.vsep_normal + FONT_HEIGHT_NORMAL) : 0;
 
					size->height = _settings_game.economy.infrastructure_maintenance ? std::max<uint>(size->height, WidgetDimensions::scaled.vsep_normal + GetCharacterHeight(FS_NORMAL)) : 0;
 
				}
 
				break;
 
			}
 
@@ -2023,7 +2023,7 @@ struct CompanyInfrastructureWindow : Win
 
	void DrawCountLine(const Rect &r, int &y, int count, Money monthly_cost) const
 
	{
 
		SetDParam(0, count);
 
		DrawString(r.left, r.right, y += FONT_HEIGHT_NORMAL, STR_JUST_COMMA, TC_WHITE, SA_RIGHT);
 
		DrawString(r.left, r.right, y += GetCharacterHeight(FS_NORMAL), STR_JUST_COMMA, TC_WHITE, SA_RIGHT);
 

	
 
		if (_settings_game.economy.infrastructure_maintenance) {
 
			SetDParam(0, monthly_cost * 12); // Convert to per year
 
@@ -2047,13 +2047,13 @@ struct CompanyInfrastructureWindow : Win
 
					/* Draw name of each valid railtype. */
 
					for (const auto &rt : _sorted_railtypes) {
 
						if (HasBit(this->railtypes, rt)) {
 
							DrawString(ir.left, ir.right, y += FONT_HEIGHT_NORMAL, GetRailTypeInfo(rt)->strings.name, TC_WHITE);
 
							DrawString(ir.left, ir.right, y += GetCharacterHeight(FS_NORMAL), GetRailTypeInfo(rt)->strings.name, TC_WHITE);
 
						}
 
					}
 
					DrawString(ir.left, ir.right, y += FONT_HEIGHT_NORMAL, STR_COMPANY_INFRASTRUCTURE_VIEW_SIGNALS);
 
					DrawString(ir.left, ir.right, y += GetCharacterHeight(FS_NORMAL), STR_COMPANY_INFRASTRUCTURE_VIEW_SIGNALS);
 
				} else {
 
					/* No valid railtype. */
 
					DrawString(ir.left, ir.right, y += FONT_HEIGHT_NORMAL, STR_COMPANY_VIEW_INFRASTRUCTURE_NONE);
 
					DrawString(ir.left, ir.right, y += GetCharacterHeight(FS_NORMAL), STR_COMPANY_VIEW_INFRASTRUCTURE_NONE);
 
				}
 

	
 
				break;
 
@@ -2079,7 +2079,7 @@ struct CompanyInfrastructureWindow : Win
 
				/* Draw name of each valid roadtype. */
 
				for (const auto &rt : _sorted_roadtypes) {
 
					if (HasBit(this->roadtypes, rt) && RoadTypeIsRoad(rt) == (widget == WID_CI_ROAD_DESC)) {
 
						DrawString(ir.left, ir.right, y += FONT_HEIGHT_NORMAL, GetRoadTypeInfo(rt)->strings.name, TC_WHITE);
 
						DrawString(ir.left, ir.right, y += GetCharacterHeight(FS_NORMAL), GetRoadTypeInfo(rt)->strings.name, TC_WHITE);
 
					}
 
				}
 

	
 
@@ -2099,7 +2099,7 @@ struct CompanyInfrastructureWindow : Win
 

	
 
			case WID_CI_WATER_DESC:
 
				DrawString(r.left, r.right, y, STR_COMPANY_INFRASTRUCTURE_VIEW_WATER_SECT);
 
				DrawString(ir.left, ir.right, y += FONT_HEIGHT_NORMAL, STR_COMPANY_INFRASTRUCTURE_VIEW_CANALS);
 
				DrawString(ir.left, ir.right, y += GetCharacterHeight(FS_NORMAL), STR_COMPANY_INFRASTRUCTURE_VIEW_CANALS);
 
				break;
 

	
 
			case WID_CI_WATER_COUNT:
 
@@ -2118,8 +2118,8 @@ struct CompanyInfrastructureWindow : Win
 

	
 
			case WID_CI_STATION_DESC:
 
				DrawString(r.left, r.right, y, STR_COMPANY_INFRASTRUCTURE_VIEW_STATION_SECT);
 
				DrawString(ir.left, ir.right, y += FONT_HEIGHT_NORMAL, STR_COMPANY_INFRASTRUCTURE_VIEW_STATIONS);
 
				DrawString(ir.left, ir.right, y += FONT_HEIGHT_NORMAL, STR_COMPANY_INFRASTRUCTURE_VIEW_AIRPORTS);
 
				DrawString(ir.left, ir.right, y += GetCharacterHeight(FS_NORMAL), STR_COMPANY_INFRASTRUCTURE_VIEW_STATIONS);
 
				DrawString(ir.left, ir.right, y += GetCharacterHeight(FS_NORMAL), STR_COMPANY_INFRASTRUCTURE_VIEW_AIRPORTS);
 
				break;
 

	
 
			case WID_CI_STATION_COUNT:
 
@@ -2418,7 +2418,7 @@ struct CompanyWindow : Window
 
			if (amount != 0) {
 
				SetDParam(0, amount);
 
				DrawString(r.left, r.right, y, _company_view_vehicle_count_strings[type]);
 
				y += FONT_HEIGHT_NORMAL;
 
				y += GetCharacterHeight(FS_NORMAL);
 
			}
 
		}
 

	
 
@@ -2437,7 +2437,7 @@ struct CompanyWindow : Window
 
		if (rail_pieces != 0) {
 
			SetDParam(0, rail_pieces);
 
			DrawString(r.left, r.right, y, STR_COMPANY_VIEW_INFRASTRUCTURE_RAIL);
 
			y += FONT_HEIGHT_NORMAL;
 
			y += GetCharacterHeight(FS_NORMAL);
 
		}
 

	
 
		uint road_pieces = 0;
 
@@ -2445,25 +2445,25 @@ struct CompanyWindow : Window
 
		if (road_pieces != 0) {
 
			SetDParam(0, road_pieces);
 
			DrawString(r.left, r.right, y, STR_COMPANY_VIEW_INFRASTRUCTURE_ROAD);
 
			y += FONT_HEIGHT_NORMAL;
 
			y += GetCharacterHeight(FS_NORMAL);
 
		}
 

	
 
		if (c->infrastructure.water != 0) {
 
			SetDParam(0, c->infrastructure.water);
 
			DrawString(r.left, r.right, y, STR_COMPANY_VIEW_INFRASTRUCTURE_WATER);
 
			y += FONT_HEIGHT_NORMAL;
 
			y += GetCharacterHeight(FS_NORMAL);
 
		}
 

	
 
		if (c->infrastructure.station != 0) {
 
			SetDParam(0, c->infrastructure.station);
 
			DrawString(r.left, r.right, y, STR_COMPANY_VIEW_INFRASTRUCTURE_STATION);
 
			y += FONT_HEIGHT_NORMAL;
 
			y += GetCharacterHeight(FS_NORMAL);
 
		}
 

	
 
		if (c->infrastructure.airport != 0) {
 
			SetDParam(0, c->infrastructure.airport);
 
			DrawString(r.left, r.right, y, STR_COMPANY_VIEW_INFRASTRUCTURE_AIRPORT);
 
			y += FONT_HEIGHT_NORMAL;
 
			y += GetCharacterHeight(FS_NORMAL);
 
		}
 

	
 
		if (y == r.top) {
src/console_gui.cpp
Show inline comments
 
@@ -125,7 +125,7 @@ struct IConsoleWindow : Window
 

	
 
	void OnInit() override
 
	{
 
		this->line_height = FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.hsep_normal;
 
		this->line_height = GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.hsep_normal;
 
		this->line_offset = GetStringBoundingBox("] ").width + WidgetDimensions::scaled.frametext.left;
 
	}
 

	
src/depot_gui.cpp
Show inline comments
 
@@ -330,7 +330,7 @@ struct DepotWindow : Window {
 
				SetDParam(0, CeilDiv(u->gcache.cached_total_length * 10, TILE_SIZE));
 
				SetDParam(1, 1);
 
				Rect count = text.WithWidth(this->count_width - WidgetDimensions::scaled.hsep_normal, !rtl);
 
				DrawString(count.left, count.right, count.bottom - FONT_HEIGHT_SMALL + 1, STR_JUST_DECIMAL, TC_BLACK, SA_RIGHT, false, FS_SMALL); // Draw the counter
 
				DrawString(count.left, count.right, count.bottom - GetCharacterHeight(FS_SMALL) + 1, STR_JUST_DECIMAL, TC_BLACK, SA_RIGHT, false, FS_SMALL); // Draw the counter
 
				break;
 
			}
 

	
 
@@ -348,10 +348,10 @@ struct DepotWindow : Window {
 
		} else {
 
			/* Arrange unitnumber and flag vertically */
 
			diff_x = 0;
 
			diff_y = WidgetDimensions::scaled.matrix.top + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
			diff_y = WidgetDimensions::scaled.matrix.top + GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 
		}
 

	
 
		text = text.WithWidth(this->header_width - WidgetDimensions::scaled.hsep_normal, rtl).WithHeight(FONT_HEIGHT_NORMAL).Indent(diff_x, rtl);
 
		text = text.WithWidth(this->header_width - WidgetDimensions::scaled.hsep_normal, rtl).WithHeight(GetCharacterHeight(FS_NORMAL)).Indent(diff_x, rtl);
 
		if (free_wagon) {
 
			DrawString(text, STR_DEPOT_NO_ENGINE);
 
		} else {
 
@@ -507,7 +507,7 @@ struct DepotWindow : Window {
 

	
 
				case VEH_SHIP:
 
				case VEH_AIRCRAFT:
 
					if (xm <= this->flag_size.width && ym >= (uint)(FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal)) return MODE_START_STOP;
 
					if (xm <= this->flag_size.width && ym >= (uint)(GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal)) return MODE_START_STOP;
 
					break;
 

	
 
				default: NOT_REACHED();
src/engine_gui.cpp
Show inline comments
 
@@ -100,7 +100,7 @@ struct EnginePreviewWindow : Window {
 

	
 
		size->width = std::max(size->width, x - x_offs);
 
		SetDParam(0, GetEngineCategoryName(engine));
 
		size->height = GetStringHeight(STR_ENGINE_PREVIEW_MESSAGE, size->width) + WidgetDimensions::scaled.vsep_wide + FONT_HEIGHT_NORMAL + this->vehicle_space;
 
		size->height = GetStringHeight(STR_ENGINE_PREVIEW_MESSAGE, size->width) + WidgetDimensions::scaled.vsep_wide + GetCharacterHeight(FS_NORMAL) + this->vehicle_space;
 
		SetDParam(0, engine);
 
		size->height += GetStringHeight(GetEngineInfoString(engine), size->width);
 
	}
 
@@ -115,7 +115,7 @@ struct EnginePreviewWindow : Window {
 

	
 
		SetDParam(0, PackEngineNameDParam(engine, EngineNameContext::PreviewNews));
 
		DrawString(r.left, r.right, y, STR_ENGINE_NAME, TC_BLACK, SA_HOR_CENTER);
 
		y += FONT_HEIGHT_NORMAL;
 
		y += GetCharacterHeight(FS_NORMAL);
 

	
 
		DrawVehicleEngine(r.left, r.right, this->width >> 1, y + this->vehicle_space / 2, engine, GetEnginePalette(engine, _local_company), EIT_PREVIEW);
 

	
src/fios_gui.cpp
Show inline comments
 
@@ -431,7 +431,7 @@ public:
 
				Rect ir = r.Shrink(WidgetDimensions::scaled.framerect);
 

	
 
				if (free_space.has_value()) SetDParam(0, free_space.value());
 
				DrawString(ir.left, ir.right, ir.top + FONT_HEIGHT_NORMAL, free_space.has_value() ? STR_SAVELOAD_BYTES_FREE : STR_ERROR_UNABLE_TO_READ_DRIVE);
 
				DrawString(ir.left, ir.right, ir.top + GetCharacterHeight(FS_NORMAL), free_space.has_value() ? STR_SAVELOAD_BYTES_FREE : STR_ERROR_UNABLE_TO_READ_DRIVE);
 
				DrawString(ir.left, ir.right, ir.top, path, TC_BLACK);
 
				break;
 
			}
 
@@ -465,7 +465,7 @@ public:
 
	void DrawDetails(const Rect &r) const
 
	{
 
		/* Header panel */
 
		int HEADER_HEIGHT = FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.frametext.Vertical();
 
		int HEADER_HEIGHT = GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.frametext.Vertical();
 

	
 
		Rect hr = r.WithHeight(HEADER_HEIGHT).Shrink(WidgetDimensions::scaled.frametext);
 
		Rect tr = r.Shrink(WidgetDimensions::scaled.frametext);
 
@@ -478,13 +478,13 @@ public:
 
		if (this->selected == nullptr) return;
 

	
 
		/* Details panel */
 
		tr.bottom -= FONT_HEIGHT_NORMAL - 1;
 
		tr.bottom -= GetCharacterHeight(FS_NORMAL) - 1;
 
		if (tr.top > tr.bottom) return;
 

	
 
		if (!_load_check_data.checkable) {
 
			/* Old savegame, no information available */
 
			DrawString(tr, STR_SAVELOAD_DETAIL_NOT_AVAILABLE);
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 
		} else if (_load_check_data.error != INVALID_STRING_ID) {
 
			/* Incompatible / broken savegame */
 
			SetDParamStr(0, _load_check_data.error_msg);
 
@@ -494,7 +494,7 @@ public:
 
			SetDParam(0, _load_check_data.map_size_x);
 
			SetDParam(1, _load_check_data.map_size_y);
 
			DrawString(tr, STR_NETWORK_SERVER_LIST_MAP_SIZE);
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 
			if (tr.top > tr.bottom) return;
 

	
 
			/* Climate */
 
@@ -502,7 +502,7 @@ public:
 
			if (landscape < NUM_LANDSCAPE) {
 
				SetDParam(0, STR_CLIMATE_TEMPERATE_LANDSCAPE + landscape);
 
				DrawString(tr, STR_NETWORK_SERVER_LIST_LANDSCAPE);
 
				tr.top += FONT_HEIGHT_NORMAL;
 
				tr.top += GetCharacterHeight(FS_NORMAL);
 
			}
 

	
 
			tr.top += WidgetDimensions::scaled.vsep_normal;
 
@@ -512,7 +512,7 @@ public:
 
			if (_load_check_data.settings.game_creation.starting_year != 0) {
 
				SetDParam(0, TimerGameCalendar::ConvertYMDToDate(_load_check_data.settings.game_creation.starting_year, 0, 1));
 
				DrawString(tr, STR_NETWORK_SERVER_LIST_START_DATE);
 
				tr.top += FONT_HEIGHT_NORMAL;
 
				tr.top += GetCharacterHeight(FS_NORMAL);
 
			}
 
			if (tr.top > tr.bottom) return;
 

	
 
@@ -521,7 +521,7 @@ public:
 
				/* Current date */
 
				SetDParam(0, _load_check_data.current_date);
 
				DrawString(tr, STR_NETWORK_SERVER_LIST_CURRENT_DATE);
 
				tr.top += FONT_HEIGHT_NORMAL;
 
				tr.top += GetCharacterHeight(FS_NORMAL);
 
			}
 

	
 
			/* Hide the NewGRF stuff when saving. We also hide the button. */
 
@@ -533,7 +533,7 @@ public:
 
				SetDParam(0, _load_check_data.grfconfig == nullptr ? STR_NEWGRF_LIST_NONE :
 
						STR_NEWGRF_LIST_ALL_FOUND + _load_check_data.grf_compatibility);
 
				DrawString(tr, STR_SAVELOAD_DETAIL_GRFSTATUS);
 
				tr.top += FONT_HEIGHT_NORMAL;
 
				tr.top += GetCharacterHeight(FS_NORMAL);
 
			}
 
			if (tr.top > tr.bottom) return;
 

	
 
@@ -554,7 +554,7 @@ public:
 
						SetDParam(2, c.name_2);
 
					}
 
					DrawString(tr, STR_SAVELOAD_DETAIL_COMPANY_INDEX);
 
					tr.top += FONT_HEIGHT_NORMAL;
 
					tr.top += GetCharacterHeight(FS_NORMAL);
 
					if (tr.top > tr.bottom) break;
 
				}
 
			}
 
@@ -565,11 +565,11 @@ public:
 
	{
 
		switch (widget) {
 
			case WID_SL_BACKGROUND:
 
				size->height = 2 * FONT_HEIGHT_NORMAL + padding.height;
 
				size->height = 2 * GetCharacterHeight(FS_NORMAL) + padding.height;
 
				break;
 

	
 
			case WID_SL_DRIVES_DIRECTORIES_LIST:
 
				resize->height = FONT_HEIGHT_NORMAL;
 
				resize->height = GetCharacterHeight(FS_NORMAL);
 
				size->height = resize->height * 10 + padding.height;
 
				break;
 
			case WID_SL_SORT_BYNAME:
src/framerate_gui.cpp
Show inline comments
 
@@ -457,7 +457,7 @@ struct FramerateWindow : Window {
 
		this->num_displayed = this->num_active;
 

	
 
		/* Window is always initialised to MIN_ELEMENTS height, resize to contain num_displayed */
 
		ResizeWindow(this, 0, (std::max(MIN_ELEMENTS, this->num_displayed) - MIN_ELEMENTS) * FONT_HEIGHT_NORMAL);
 
		ResizeWindow(this, 0, (std::max(MIN_ELEMENTS, this->num_displayed) - MIN_ELEMENTS) * GetCharacterHeight(FS_NORMAL));
 
	}
 

	
 
	void OnRealtimeTick([[maybe_unused]] uint delta_ms) override
 
@@ -563,9 +563,9 @@ struct FramerateWindow : Window {
 

	
 
			case WID_FRW_TIMES_NAMES: {
 
				size->width = 0;
 
				size->height = FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal + MIN_ELEMENTS * FONT_HEIGHT_NORMAL;
 
				size->height = GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal + MIN_ELEMENTS * GetCharacterHeight(FS_NORMAL);
 
				resize->width = 0;
 
				resize->height = FONT_HEIGHT_NORMAL;
 
				resize->height = GetCharacterHeight(FS_NORMAL);
 
				for (PerformanceElement e : DISPLAY_ORDER_PFE) {
 
					if (_pf_data[e].num_valid == 0) continue;
 
					Dimension line_size;
 
@@ -589,9 +589,9 @@ struct FramerateWindow : Window {
 
				SetDParam(1, 2);
 
				Dimension item_size = GetStringBoundingBox(STR_FRAMERATE_MS_GOOD);
 
				size->width = std::max(size->width, item_size.width);
 
				size->height += FONT_HEIGHT_NORMAL * MIN_ELEMENTS + WidgetDimensions::scaled.vsep_normal;
 
				size->height += GetCharacterHeight(FS_NORMAL) * MIN_ELEMENTS + WidgetDimensions::scaled.vsep_normal;
 
				resize->width = 0;
 
				resize->height = FONT_HEIGHT_NORMAL;
 
				resize->height = GetCharacterHeight(FS_NORMAL);
 
				break;
 
			}
 
		}
 
@@ -605,7 +605,7 @@ struct FramerateWindow : Window {
 
		int drawable = this->num_displayed;
 
		int y = r.top;
 
		DrawString(r.left, r.right, y, heading_str, TC_FROMSTRING, SA_CENTER, true);
 
		y += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
		y += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 
		for (PerformanceElement e : DISPLAY_ORDER_PFE) {
 
			if (_pf_data[e].num_valid == 0) continue;
 
			if (skip > 0) {
 
@@ -613,7 +613,7 @@ struct FramerateWindow : Window {
 
			} else {
 
				values[e].InsertDParams(0);
 
				DrawString(r.left, r.right, y, values[e].strid, TC_FROMSTRING, SA_RIGHT);
 
				y += FONT_HEIGHT_NORMAL;
 
				y += GetCharacterHeight(FS_NORMAL);
 
				drawable--;
 
				if (drawable == 0) break;
 
			}
 
@@ -627,7 +627,7 @@ struct FramerateWindow : Window {
 
		int drawable = this->num_displayed;
 
		int y = r.top;
 
		DrawString(r.left, r.right, y, STR_FRAMERATE_MEMORYUSE, TC_FROMSTRING, SA_CENTER, true);
 
		y += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
		y += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 
		for (PerformanceElement e : DISPLAY_ORDER_PFE) {
 
			if (_pf_data[e].num_valid == 0) continue;
 
			if (skip > 0) {
 
@@ -639,12 +639,12 @@ struct FramerateWindow : Window {
 
					SetDParam(0, Company::Get(e - PFE_AI0)->ai_instance->GetAllocatedMemory());
 
				}
 
				DrawString(r.left, r.right, y, STR_FRAMERATE_BYTES_GOOD, TC_FROMSTRING, SA_RIGHT);
 
				y += FONT_HEIGHT_NORMAL;
 
				y += GetCharacterHeight(FS_NORMAL);
 
				drawable--;
 
				if (drawable == 0) break;
 
			} else {
 
				/* skip non-script */
 
				y += FONT_HEIGHT_NORMAL;
 
				y += GetCharacterHeight(FS_NORMAL);
 
				drawable--;
 
				if (drawable == 0) break;
 
			}
 
@@ -659,7 +659,7 @@ struct FramerateWindow : Window {
 
				const Scrollbar *sb = this->GetScrollbar(WID_FRW_SCROLLBAR);
 
				uint16_t skip = sb->GetPosition();
 
				int drawable = this->num_displayed;
 
				int y = r.top + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal; // first line contains headings in the value columns
 
				int y = r.top + GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal; // first line contains headings in the value columns
 
				for (PerformanceElement e : DISPLAY_ORDER_PFE) {
 
					if (_pf_data[e].num_valid == 0) continue;
 
					if (skip > 0) {
 
@@ -672,7 +672,7 @@ struct FramerateWindow : Window {
 
							SetDParamStr(1, GetAIName(e - PFE_AI0));
 
							DrawString(r.left, r.right, y, STR_FRAMERATE_AI, TC_FROMSTRING, SA_LEFT);
 
						}
 
						y += FONT_HEIGHT_NORMAL;
 
						y += GetCharacterHeight(FS_NORMAL);
 
						drawable--;
 
						if (drawable == 0) break;
 
					}
 
@@ -701,7 +701,7 @@ struct FramerateWindow : Window {
 
			case WID_FRW_TIMES_AVERAGE: {
 
				/* Open time graph windows when clicking detail measurement lines */
 
				const Scrollbar *sb = this->GetScrollbar(WID_FRW_SCROLLBAR);
 
				int line = sb->GetScrolledRowFromWidget(pt.y, this, widget, WidgetDimensions::scaled.vsep_normal + FONT_HEIGHT_NORMAL);
 
				int line = sb->GetScrolledRowFromWidget(pt.y, this, widget, WidgetDimensions::scaled.vsep_normal + GetCharacterHeight(FS_NORMAL));
 
				if (line != INT_MAX) {
 
					line++;
 
					/* Find the visible line that was clicked */
 
@@ -721,7 +721,7 @@ struct FramerateWindow : Window {
 
	void OnResize() override
 
	{
 
		auto *wid = this->GetWidget<NWidgetResizeBase>(WID_FRW_TIMES_NAMES);
 
		this->num_displayed = (wid->current_y - wid->min_y - WidgetDimensions::scaled.vsep_normal) / FONT_HEIGHT_NORMAL - 1; // subtract 1 for headings
 
		this->num_displayed = (wid->current_y - wid->min_y - WidgetDimensions::scaled.vsep_normal) / GetCharacterHeight(FS_NORMAL) - 1; // subtract 1 for headings
 
		this->GetScrollbar(WID_FRW_SCROLLBAR)->SetCapacity(this->num_displayed);
 
	}
 
};
 
@@ -929,10 +929,10 @@ struct FrametimeGraphWindow : Window {
 
				if (division % 2 == 0) {
 
					if ((TimingMeasurement)this->vertical_scale > TIMESTAMP_PRECISION) {
 
						SetDParam(0, this->vertical_scale * division / 10 / TIMESTAMP_PRECISION);
 
						DrawString(r.left, x_zero - 2, y - FONT_HEIGHT_SMALL, STR_FRAMERATE_GRAPH_SECONDS, TC_GREY, SA_RIGHT | SA_FORCE, false, FS_SMALL);
 
						DrawString(r.left, x_zero - 2, y - GetCharacterHeight(FS_SMALL), STR_FRAMERATE_GRAPH_SECONDS, TC_GREY, SA_RIGHT | SA_FORCE, false, FS_SMALL);
 
					} else {
 
						SetDParam(0, this->vertical_scale * division / 10 * 1000 / TIMESTAMP_PRECISION);
 
						DrawString(r.left, x_zero - 2, y - FONT_HEIGHT_SMALL, STR_FRAMERATE_GRAPH_MILLISECONDS, TC_GREY, SA_RIGHT | SA_FORCE, false, FS_SMALL);
 
						DrawString(r.left, x_zero - 2, y - GetCharacterHeight(FS_SMALL), STR_FRAMERATE_GRAPH_MILLISECONDS, TC_GREY, SA_RIGHT | SA_FORCE, false, FS_SMALL);
 
					}
 
				}
 
			}
 
@@ -1000,7 +1000,7 @@ struct FrametimeGraphWindow : Window {
 
				TextColour tc_peak = (TextColour)(TC_IS_PALETTE_COLOUR | c_peak);
 
				GfxFillRect(peak_point.x - 1, peak_point.y - 1, peak_point.x + 1, peak_point.y + 1, c_peak);
 
				SetDParam(0, peak_value * 1000 / TIMESTAMP_PRECISION);
 
				int label_y = std::max(y_max, peak_point.y - FONT_HEIGHT_SMALL);
 
				int label_y = std::max(y_max, peak_point.y - GetCharacterHeight(FS_SMALL));
 
				if (peak_point.x - x_zero > (int)this->graph_size.width / 2) {
 
					DrawString(x_zero, peak_point.x - 2, label_y, STR_FRAMERATE_GRAPH_MILLISECONDS, tc_peak, SA_RIGHT | SA_FORCE, false, FS_SMALL);
 
				} else {
src/game/game_gui.cpp
Show inline comments
 
@@ -136,14 +136,14 @@ struct GSConfigWindow : public Window {
 
	{
 
		switch (widget) {
 
			case WID_GSC_SETTINGS:
 
				this->line_height = std::max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL) + padding.height;
 
				this->line_height = std::max(SETTING_BUTTON_HEIGHT, GetCharacterHeight(FS_NORMAL)) + padding.height;
 
				resize->width = 1;
 
				resize->height = this->line_height;
 
				size->height = 5 * this->line_height;
 
				break;
 

	
 
			case WID_GSC_GSLIST:
 
				this->line_height = FONT_HEIGHT_NORMAL + padding.height;
 
				this->line_height = GetCharacterHeight(FS_NORMAL) + padding.height;
 
				size->height = 1 * this->line_height;
 
				break;
 
		}
 
@@ -186,7 +186,7 @@ struct GSConfigWindow : public Window {
 

	
 
				int y = r.top;
 
				int button_y_offset = (this->line_height - SETTING_BUTTON_HEIGHT) / 2;
 
				int text_y_offset = (this->line_height - FONT_HEIGHT_NORMAL) / 2;
 
				int text_y_offset = (this->line_height - GetCharacterHeight(FS_NORMAL)) / 2;
 
				for (; this->vscroll->IsVisible(i) && it != visible_settings.end(); i++, it++) {
 
					const ScriptConfigItem &config_item = **it;
 
					int current_value = config->GetSetting((config_item).name);
src/genworld_gui.cpp
Show inline comments
 
@@ -572,7 +572,7 @@ struct GenerateLandscapeWindow : public 
 

	
 
	void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
 
	{
 
		Dimension d{0, (uint)FONT_HEIGHT_NORMAL};
 
		Dimension d{0, (uint)GetCharacterHeight(FS_NORMAL)};
 
		const StringID *strs = nullptr;
 
		switch (widget) {
 
			case WID_GL_HEIGHTMAP_HEIGHT_TEXT:
 
@@ -1408,7 +1408,7 @@ struct GenerateProgressWindow : public W
 
				for (uint i = 0; i < GWP_CLASS_COUNT; i++) {
 
					size->width = std::max(size->width, GetStringBoundingBox(_generation_class_table[i]).width + padding.width);
 
				}
 
				size->height = FONT_HEIGHT_NORMAL * 2 + WidgetDimensions::scaled.vsep_normal;
 
				size->height = GetCharacterHeight(FS_NORMAL) * 2 + WidgetDimensions::scaled.vsep_normal;
 
				break;
 
		}
 
	}
 
@@ -1422,7 +1422,7 @@ struct GenerateProgressWindow : public W
 
				Rect br = r.Shrink(WidgetDimensions::scaled.bevel);
 
				DrawFrameRect(br.WithWidth(br.Width() * _gws.percent / 100, false), COLOUR_MAUVE, FR_NONE);
 
				SetDParam(0, _gws.percent);
 
				DrawString(br.left, br.right, CenterBounds(br.top, br.bottom, FONT_HEIGHT_NORMAL), STR_GENERATION_PROGRESS, TC_FROMSTRING, SA_HOR_CENTER);
 
				DrawString(br.left, br.right, CenterBounds(br.top, br.bottom, GetCharacterHeight(FS_NORMAL)), STR_GENERATION_PROGRESS, TC_FROMSTRING, SA_HOR_CENTER);
 
				break;
 
			}
 

	
 
@@ -1433,7 +1433,7 @@ struct GenerateProgressWindow : public W
 
				/* And say where we are in that class */
 
				SetDParam(0, _gws.current);
 
				SetDParam(1, _gws.total);
 
				DrawString(r.left, r.right, r.top + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal, STR_GENERATION_PROGRESS_NUM, TC_FROMSTRING, SA_HOR_CENTER);
 
				DrawString(r.left, r.right, r.top + GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal, STR_GENERATION_PROGRESS_NUM, TC_FROMSTRING, SA_HOR_CENTER);
 
		}
 
	}
 
};
src/gfx.cpp
Show inline comments
 
@@ -647,7 +647,7 @@ static int DrawLayoutLine(const Paragrap
 
int DrawString(int left, int right, int top, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
 
{
 
	/* The string may contain control chars to change the font, just use the biggest font for clipping. */
 
	int max_height = std::max({FONT_HEIGHT_SMALL, FONT_HEIGHT_NORMAL, FONT_HEIGHT_LARGE, FONT_HEIGHT_MONO});
 
	int max_height = std::max({GetCharacterHeight(FS_SMALL), GetCharacterHeight(FS_NORMAL), GetCharacterHeight(FS_LARGE), GetCharacterHeight(FS_MONO)});
 

	
 
	/* Funny glyphs may extent outside the usual bounds, so relax the clipping somewhat. */
 
	int extra = max_height / 2;
 
@@ -915,7 +915,7 @@ void DrawCharCentered(char32_t c, const 
 
	SetColourRemap(colour);
 
	GfxMainBlitter(GetGlyph(FS_NORMAL, c),
 
		CenterBounds(r.left, r.right, GetCharacterWidth(FS_NORMAL, c)),
 
		CenterBounds(r.top, r.bottom, FONT_HEIGHT_NORMAL),
 
		CenterBounds(r.top, r.bottom, GetCharacterHeight(FS_NORMAL)),
 
		BM_COLOUR_REMAP);
 
}
 

	
src/gfx_func.h
Show inline comments
 
@@ -183,18 +183,6 @@ void GetBroadestDigit(uint *front, uint 
 

	
 
int GetCharacterHeight(FontSize size);
 

	
 
/** Height of characters in the small (#FS_SMALL) font. @note Some characters may be oversized. */
 
#define FONT_HEIGHT_SMALL  (GetCharacterHeight(FS_SMALL))
 

	
 
/** Height of characters in the normal (#FS_NORMAL) font. @note Some characters may be oversized. */
 
#define FONT_HEIGHT_NORMAL (GetCharacterHeight(FS_NORMAL))
 

	
 
/** Height of characters in the large (#FS_LARGE) font. @note Some characters may be oversized. */
 
#define FONT_HEIGHT_LARGE  (GetCharacterHeight(FS_LARGE))
 

	
 
/** Height of characters in the large (#FS_MONO) font. @note Some characters may be oversized. */
 
#define FONT_HEIGHT_MONO  (GetCharacterHeight(FS_MONO))
 

	
 
extern DrawPixelInfo *_cur_dpi;
 

	
 
/**
src/goal_gui.cpp
Show inline comments
 
@@ -219,7 +219,7 @@ struct GoalListWindow : public Window {
 
							}
 
							break;
 
					}
 
					r.top += FONT_HEIGHT_NORMAL;
 
					r.top += GetCharacterHeight(FS_NORMAL);
 
				}
 
				pos++;
 
				num++;
src/graph_gui.cpp
Show inline comments
 
@@ -73,7 +73,7 @@ struct GraphLegendWindow : Window {
 
		const Rect tr = ir.Indent(d.width + WidgetDimensions::scaled.hsep_normal, rtl);
 
		SetDParam(0, cid);
 
		SetDParam(1, cid);
 
		DrawString(tr.left, tr.right, CenterBounds(tr.top, tr.bottom, FONT_HEIGHT_NORMAL), STR_COMPANY_NAME_COMPANY_NUM, HasBit(_legend_excluded_companies, cid) ? TC_BLACK : TC_WHITE);
 
		DrawString(tr.left, tr.right, CenterBounds(tr.top, tr.bottom, GetCharacterHeight(FS_NORMAL)), STR_COMPANY_NAME_COMPANY_NUM, HasBit(_legend_excluded_companies, cid) ? TC_BLACK : TC_WHITE);
 
	}
 

	
 
	void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
 
@@ -524,7 +524,7 @@ public:
 
		uint y_label_width = GetStringBoundingBox(STR_GRAPH_Y_LABEL).width;
 

	
 
		size->width  = std::max<uint>(size->width,  ScaleGUITrad(5) + y_label_width + this->num_on_x_axis * (x_label_width + ScaleGUITrad(5)) + ScaleGUITrad(9));
 
		size->height = std::max<uint>(size->height, ScaleGUITrad(5) + (1 + MIN_GRAPH_NUM_LINES_Y * 2 + (this->draw_dates ? 3 : 1)) * FONT_HEIGHT_SMALL + ScaleGUITrad(4));
 
		size->height = std::max<uint>(size->height, ScaleGUITrad(5) + (1 + MIN_GRAPH_NUM_LINES_Y * 2 + (this->draw_dates ? 3 : 1)) * GetCharacterHeight(FS_SMALL) + ScaleGUITrad(4));
 
		size->height = std::max<uint>(size->height, size->width / 3);
 
	}
 

	
 
@@ -901,7 +901,7 @@ struct PaymentRatesGraphWindow : BaseGra
 
	void OnInit() override
 
	{
 
		/* Width of the legend blob. */
 
		this->legend_width = (FONT_HEIGHT_SMALL - ScaleGUITrad(1)) * 8 / 5;
 
		this->legend_width = (GetCharacterHeight(FS_SMALL) - ScaleGUITrad(1)) * 8 / 5;
 
	}
 

	
 
	void UpdateExcludedData()
 
@@ -922,7 +922,7 @@ struct PaymentRatesGraphWindow : BaseGra
 
			return;
 
		}
 

	
 
		size->height = FONT_HEIGHT_SMALL + WidgetDimensions::scaled.framerect.Vertical();
 
		size->height = GetCharacterHeight(FS_SMALL) + WidgetDimensions::scaled.framerect.Vertical();
 

	
 
		for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
 
			SetDParam(0, cs->name);
 
@@ -1147,7 +1147,7 @@ struct PerformanceRatingDetailWindow : W
 
	{
 
		switch (widget) {
 
			case WID_PRD_SCORE_FIRST:
 
				this->bar_height = FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.fullbevel.Vertical();
 
				this->bar_height = GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.fullbevel.Vertical();
 
				size->height = this->bar_height + WidgetDimensions::scaled.matrix.Vertical();
 

	
 
				uint score_info_width = 0;
 
@@ -1235,7 +1235,7 @@ struct PerformanceRatingDetailWindow : W
 
		}
 

	
 
		uint bar_top  = CenterBounds(r.top, r.bottom, this->bar_height);
 
		uint text_top = CenterBounds(r.top, r.bottom, FONT_HEIGHT_NORMAL);
 
		uint text_top = CenterBounds(r.top, r.bottom, GetCharacterHeight(FS_NORMAL));
 

	
 
		DrawString(this->score_info_left, this->score_info_right, text_top, STR_PERFORMANCE_DETAIL_VEHICLES + score_type);
 

	
src/group_gui.cpp
Show inline comments
 
@@ -582,12 +582,12 @@ public:
 
				SetDParam(0, this_year);
 
				DrawString(tr, STR_JUST_CURRENCY_LONG, TC_BLACK, SA_RIGHT);
 

	
 
				tr.top += FONT_HEIGHT_NORMAL;
 
				tr.top += GetCharacterHeight(FS_NORMAL);
 
				DrawString(tr, STR_GROUP_PROFIT_LAST_YEAR, TC_BLACK);
 
				SetDParam(0, last_year);
 
				DrawString(tr, STR_JUST_CURRENCY_LONG, TC_BLACK, SA_RIGHT);
 

	
 
				tr.top += FONT_HEIGHT_NORMAL;
 
				tr.top += GetCharacterHeight(FS_NORMAL);
 
				DrawString(tr, STR_GROUP_OCCUPANCY, TC_BLACK);
 
				const size_t vehicle_count = this->vehicles.size();
 
				if (vehicle_count > 0) {
src/highscore_gui.cpp
Show inline comments
 
@@ -204,7 +204,7 @@ struct HighScoreWindow : EndGameHighScor
 
				DrawString(pt.x + ScaleSpriteTrad(71), pt.x + ScaleSpriteTrad(569), pt.y + ScaleSpriteTrad(140 + i * 55), STR_JUST_BIG_RAW_STRING, colour);
 
				SetDParam(0, hs[i].title);
 
				SetDParam(1, hs[i].score);
 
				DrawString(pt.x + ScaleSpriteTrad(71), pt.x + ScaleSpriteTrad(569), pt.y + ScaleSpriteTrad(140) + FONT_HEIGHT_LARGE + ScaleSpriteTrad(i * 55), STR_HIGHSCORE_STATS, colour);
 
				DrawString(pt.x + ScaleSpriteTrad(71), pt.x + ScaleSpriteTrad(569), pt.y + ScaleSpriteTrad(140) + GetCharacterHeight(FS_LARGE) + ScaleSpriteTrad(i * 55), STR_HIGHSCORE_STATS, colour);
 
			}
 
		}
 
	}
src/industry_gui.cpp
Show inline comments
 
@@ -418,7 +418,7 @@ public:
 
	void OnInit() override
 
	{
 
		/* Width of the legend blob -- slightly larger than the smallmap legend blob. */
 
		this->legend.height = FONT_HEIGHT_SMALL;
 
		this->legend.height = GetCharacterHeight(FS_SMALL);
 
		this->legend.width = this->legend.height * 8 / 5;
 

	
 
		this->SetupArrays();
 
@@ -432,7 +432,7 @@ public:
 
				for (const auto &indtype : this->list) {
 
					d = maxdim(d, GetStringBoundingBox(GetIndustrySpec(indtype)->name));
 
				}
 
				resize->height = std::max<uint>(this->legend.height, FONT_HEIGHT_NORMAL) + padding.height;
 
				resize->height = std::max<uint>(this->legend.height, GetCharacterHeight(FS_NORMAL)) + padding.height;
 
				d.width += this->legend.width + WidgetDimensions::scaled.hsep_wide + padding.width;
 
				d.height = 5 * resize->height;
 
				*size = maxdim(*size, d);
 
@@ -445,7 +445,7 @@ public:
 
				uint extra_lines_req = 0;
 
				uint extra_lines_prd = 0;
 
				uint extra_lines_newgrf = 0;
 
				uint max_minwidth = FONT_HEIGHT_NORMAL * MAX_MINWIDTH_LINEHEIGHTS;
 
				uint max_minwidth = GetCharacterHeight(FS_NORMAL) * MAX_MINWIDTH_LINEHEIGHTS;
 
				Dimension d = {0, 0};
 
				for (const auto &indtype : this->list) {
 
					const IndustrySpec *indsp = GetIndustrySpec(indtype);
 
@@ -479,7 +479,7 @@ public:
 

	
 
				/* Set it to something more sane :) */
 
				height += extra_lines_prd + extra_lines_req + extra_lines_newgrf;
 
				size->height = height * FONT_HEIGHT_NORMAL + padding.height;
 
				size->height = height * GetCharacterHeight(FS_NORMAL) + padding.height;
 
				size->width = d.width + padding.width;
 
				break;
 
			}
 
@@ -561,7 +561,7 @@ public:
 
				if (_game_mode != GM_EDITOR) {
 
					SetDParam(0, indsp->GetConstructionCost());
 
					DrawString(ir, STR_FUND_INDUSTRY_INDUSTRY_BUILD_COST);
 
					ir.top += FONT_HEIGHT_NORMAL;
 
					ir.top += GetCharacterHeight(FS_NORMAL);
 
				}
 

	
 
				CargoSuffix cargo_suffix[lengthof(indsp->accepts_cargo)];
 
@@ -817,7 +817,7 @@ public:
 
		this->editbox_line = IL_NONE;
 
		this->clicked_line = IL_NONE;
 
		this->clicked_button = 0;
 
		this->info_height = WidgetDimensions::scaled.framerect.Vertical() + 2 * FONT_HEIGHT_NORMAL; // Info panel has at least two lines text.
 
		this->info_height = WidgetDimensions::scaled.framerect.Vertical() + 2 * GetCharacterHeight(FS_NORMAL); // Info panel has at least two lines text.
 

	
 
		this->InitNested(window_number);
 
		NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_IV_VIEWPORT);
 
@@ -829,7 +829,7 @@ public:
 
	void OnInit() override
 
	{
 
		/* This only used when the cheat to alter industry production is enabled */
 
		this->cheat_line_height = std::max(SETTING_BUTTON_HEIGHT + WidgetDimensions::scaled.vsep_normal, FONT_HEIGHT_NORMAL);
 
		this->cheat_line_height = std::max(SETTING_BUTTON_HEIGHT + WidgetDimensions::scaled.vsep_normal, GetCharacterHeight(FS_NORMAL));
 
	}
 

	
 
	void OnPaint() override
 
@@ -863,7 +863,7 @@ public:
 

	
 
		if (i->prod_level == PRODLEVEL_CLOSURE) {
 
			DrawString(ir, STR_INDUSTRY_VIEW_INDUSTRY_ANNOUNCED_CLOSURE);
 
			ir.top += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_wide;
 
			ir.top += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_wide;
 
		}
 

	
 
		bool stockpiling = HasBit(ind->callback_mask, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(ind->callback_mask, CBM_IND_PRODUCTION_256_TICKS);
 
@@ -873,7 +873,7 @@ public:
 
			has_accept = true;
 
			if (first) {
 
				DrawString(ir, STR_INDUSTRY_VIEW_REQUIRES);
 
				ir.top += FONT_HEIGHT_NORMAL;
 
				ir.top += GetCharacterHeight(FS_NORMAL);
 
				first = false;
 
			}
 

	
 
@@ -904,11 +904,11 @@ public:
 
					NOT_REACHED();
 
			}
 
			DrawString(ir.Indent(WidgetDimensions::scaled.hsep_indent, rtl), str);
 
			ir.top += FONT_HEIGHT_NORMAL;
 
			ir.top += GetCharacterHeight(FS_NORMAL);
 
		}
 

	
 
		int line_height = this->editable == EA_RATE ? this->cheat_line_height : FONT_HEIGHT_NORMAL;
 
		int text_y_offset = (line_height - FONT_HEIGHT_NORMAL) / 2;
 
		int line_height = this->editable == EA_RATE ? this->cheat_line_height : GetCharacterHeight(FS_NORMAL);
 
		int text_y_offset = (line_height - GetCharacterHeight(FS_NORMAL)) / 2;
 
		int button_y_offset = (line_height - SETTING_BUTTON_HEIGHT) / 2;
 
		first = true;
 
		for (const auto &p : i->produced) {
 
@@ -916,7 +916,7 @@ public:
 
			if (first) {
 
				if (has_accept) ir.top += WidgetDimensions::scaled.vsep_wide;
 
				DrawString(ir, STR_INDUSTRY_VIEW_PRODUCTION_LAST_MONTH_TITLE);
 
				ir.top += FONT_HEIGHT_NORMAL;
 
				ir.top += GetCharacterHeight(FS_NORMAL);
 
				if (this->editable == EA_RATE) this->production_offset_y = ir.top;
 
				first = false;
 
			}
 
@@ -940,7 +940,7 @@ public:
 
		/* Display production multiplier if editable */
 
		if (this->editable == EA_MULTIPLIER) {
 
			line_height = this->cheat_line_height;
 
			text_y_offset = (line_height - FONT_HEIGHT_NORMAL) / 2;
 
			text_y_offset = (line_height - GetCharacterHeight(FS_NORMAL)) / 2;
 
			button_y_offset = (line_height - SETTING_BUTTON_HEIGHT) / 2;
 
			ir.top += WidgetDimensions::scaled.vsep_wide;
 
			this->production_offset_y = ir.top;
 
@@ -2138,7 +2138,7 @@ struct CargoesField {
 
				break;
 

	
 
			case CFT_HEADER:
 
				ypos += (small_height - FONT_HEIGHT_NORMAL) / 2;
 
				ypos += (small_height - GetCharacterHeight(FS_NORMAL)) / 2;
 
				DrawString(xpos, xpos + industry_width, ypos, this->u.header, TC_WHITE, SA_HOR_CENTER);
 
				break;
 

	
 
@@ -2150,7 +2150,7 @@ struct CargoesField {
 
				GfxDrawLine(xpos,  ypos1, xpos,  ypos2, INDUSTRY_LINE_COLOUR);
 
				GfxDrawLine(xpos,  ypos2, xpos2, ypos2, INDUSTRY_LINE_COLOUR);
 
				GfxDrawLine(xpos2, ypos1, xpos2, ypos2, INDUSTRY_LINE_COLOUR);
 
				ypos += (normal_height - FONT_HEIGHT_NORMAL) / 2;
 
				ypos += (normal_height - GetCharacterHeight(FS_NORMAL)) / 2;
 
				if (this->u.industry.ind_type < NUM_INDUSTRYTYPES) {
 
					const IndustrySpec *indsp = GetIndustrySpec(this->u.industry.ind_type);
 
					DrawString(xpos, xpos2, ypos, indsp->name, TC_WHITE, SA_HOR_CENTER);
 
@@ -2179,7 +2179,7 @@ struct CargoesField {
 
					other_right = this->u.industry.other_produced;
 
					other_left  = this->u.industry.other_accepted;
 
				}
 
				ypos1 += CargoesField::cargo_border.height + (FONT_HEIGHT_NORMAL - CargoesField::cargo_line.height) / 2;
 
				ypos1 += CargoesField::cargo_border.height + (GetCharacterHeight(FS_NORMAL) - CargoesField::cargo_line.height) / 2;
 
				for (uint i = 0; i < CargoesField::max_cargoes; i++) {
 
					if (IsValidCargoID(other_right[i])) {
 
						const CargoSpec *csp = CargoSpec::Get(other_right[i]);
 
@@ -2193,7 +2193,7 @@ struct CargoesField {
 
						DrawHorConnection(xp + 1, xpos - 1, ypos1, csp);
 
						GfxDrawLine(xp, ypos1, xp, ypos1 + CargoesField::cargo_line.height - 1, CARGO_LINE_COLOUR);
 
					}
 
					ypos1 += FONT_HEIGHT_NORMAL + CargoesField::cargo_space.height;
 
					ypos1 += GetCharacterHeight(FS_NORMAL) + CargoesField::cargo_space.height;
 
				}
 
				break;
 
			}
 
@@ -2223,7 +2223,7 @@ struct CargoesField {
 
					hor_left  = this->u.cargo.supp_cargoes;
 
					hor_right = this->u.cargo.cust_cargoes;
 
				}
 
				ypos += CargoesField::cargo_border.height + vert_inter_industry_space / 2 + (FONT_HEIGHT_NORMAL - CargoesField::cargo_line.height) / 2;
 
				ypos += CargoesField::cargo_border.height + vert_inter_industry_space / 2 + (GetCharacterHeight(FS_NORMAL) - CargoesField::cargo_line.height) / 2;
 
				for (uint i = 0; i < MAX_CARGOES; i++) {
 
					if (IsValidCargoID(hor_left[i])) {
 
						int col = hor_left[i];
 
@@ -2247,7 +2247,7 @@ struct CargoesField {
 
						}
 
						DrawHorConnection(cargo_base + col * CargoesField::cargo_space.width + (col + 1) * CargoesField::cargo_line.width - 1 + dx, xpos + CargoesField::cargo_field_width - 1, ypos, csp);
 
					}
 
					ypos += FONT_HEIGHT_NORMAL + CargoesField::cargo_space.height;
 
					ypos += GetCharacterHeight(FS_NORMAL) + CargoesField::cargo_space.height;
 
				}
 
				break;
 
			}
 
@@ -2260,7 +2260,7 @@ struct CargoesField {
 
						DrawString(xpos + WidgetDimensions::scaled.framerect.left, xpos + industry_width - 1 - WidgetDimensions::scaled.framerect.right, ypos, csp->name, TC_WHITE,
 
								(this->u.cargo_label.left_align) ? SA_LEFT : SA_RIGHT);
 
					}
 
					ypos += FONT_HEIGHT_NORMAL + CargoesField::cargo_space.height;
 
					ypos += GetCharacterHeight(FS_NORMAL) + CargoesField::cargo_space.height;
 
				}
 
				break;
 

	
 
@@ -2294,8 +2294,8 @@ struct CargoesField {
 
		uint row;
 
		for (row = 0; row < MAX_CARGOES; row++) {
 
			if (pt.y < vpos) return CT_INVALID;
 
			if (pt.y < vpos + FONT_HEIGHT_NORMAL) break;
 
			vpos += FONT_HEIGHT_NORMAL + CargoesField::cargo_space.width;
 
			if (pt.y < vpos + GetCharacterHeight(FS_NORMAL)) break;
 
			vpos += GetCharacterHeight(FS_NORMAL) + CargoesField::cargo_space.width;
 
		}
 
		if (row == MAX_CARGOES) return CT_INVALID;
 

	
 
@@ -2342,8 +2342,8 @@ struct CargoesField {
 
		uint row;
 
		for (row = 0; row < MAX_CARGOES; row++) {
 
			if (pt.y < vpos) return CT_INVALID;
 
			if (pt.y < vpos + FONT_HEIGHT_NORMAL) break;
 
			vpos += FONT_HEIGHT_NORMAL + CargoesField::cargo_space.height;
 
			if (pt.y < vpos + GetCharacterHeight(FS_NORMAL)) break;
 
			vpos += GetCharacterHeight(FS_NORMAL) + CargoesField::cargo_space.height;
 
		}
 
		if (row == MAX_CARGOES) return CT_INVALID;
 
		return this->u.cargo_label.cargoes[row];
 
@@ -2551,7 +2551,7 @@ struct IndustryCargoesWindow : public Wi
 
		CargoesField::small_height = d.height;
 

	
 
		/* Size of the legend blob -- slightly larger than the smallmap legend blob. */
 
		CargoesField::legend.height = FONT_HEIGHT_SMALL;
 
		CargoesField::legend.height = GetCharacterHeight(FS_SMALL);
 
		CargoesField::legend.width = CargoesField::legend.height * 8 / 5;
 

	
 
		/* Size of cargo lines. */
 
@@ -2600,7 +2600,7 @@ struct IndustryCargoesWindow : public Wi
 

	
 
		d.width += WidgetDimensions::scaled.frametext.Horizontal();
 
		/* Ensure the height is enough for the industry type text, for the horizontal connections, and for the cargo labels. */
 
		uint min_ind_height = CargoesField::cargo_border.height * 2 + CargoesField::max_cargoes * FONT_HEIGHT_NORMAL + (CargoesField::max_cargoes - 1) * CargoesField::cargo_space.height;
 
		uint min_ind_height = CargoesField::cargo_border.height * 2 + CargoesField::max_cargoes * GetCharacterHeight(FS_NORMAL) + (CargoesField::max_cargoes - 1) * CargoesField::cargo_space.height;
 
		d.height = std::max(d.height + WidgetDimensions::scaled.frametext.Vertical(), min_ind_height);
 

	
 
		CargoesField::industry_width = d.width;
src/league_gui.cpp
Show inline comments
 
@@ -106,7 +106,7 @@ public:
 

	
 
		Rect ir = r.Shrink(WidgetDimensions::scaled.framerect);
 
		int icon_y_offset = (this->line_height - this->icon.height) / 2;
 
		int text_y_offset = (this->line_height - FONT_HEIGHT_NORMAL) / 2;
 
		int text_y_offset = (this->line_height - GetCharacterHeight(FS_NORMAL)) / 2;
 

	
 
		bool rtl = _current_text_dir == TD_RTL;
 
		Rect ordinal = ir.WithWidth(this->ordinal_width, rtl);
 
@@ -148,7 +148,7 @@ public:
 
		}
 

	
 
		this->icon = GetSpriteSize(SPR_COMPANY_ICON);
 
		this->line_height = std::max<int>(this->icon.height + WidgetDimensions::scaled.vsep_normal, FONT_HEIGHT_NORMAL);
 
		this->line_height = std::max<int>(this->icon.height + WidgetDimensions::scaled.vsep_normal, GetCharacterHeight(FS_NORMAL));
 

	
 
		for (const Company *c : Company::Iterate()) {
 
			SetDParam(0, c->index);
 
@@ -328,7 +328,7 @@ public:
 
		}
 

	
 
		int icon_y_offset = (this->line_height - this->icon_size.height) / 2;
 
		int text_y_offset = (this->line_height - FONT_HEIGHT_NORMAL) / 2;
 
		int text_y_offset = (this->line_height - GetCharacterHeight(FS_NORMAL)) / 2;
 

	
 
		/* Calculate positions.of the columns */
 
		bool rtl = _current_text_dir == TD_RTL;
 
@@ -363,7 +363,7 @@ public:
 
		if (lt == nullptr) return;
 

	
 
		this->icon_size = GetSpriteSize(SPR_COMPANY_ICON);
 
		this->line_height = std::max<int>(this->icon_size.height + WidgetDimensions::scaled.fullbevel.Vertical(), FONT_HEIGHT_NORMAL);
 
		this->line_height = std::max<int>(this->icon_size.height + WidgetDimensions::scaled.fullbevel.Vertical(), GetCharacterHeight(FS_NORMAL));
 

	
 
		/* Calculate maximum width of every column */
 
		this->rank_width = this->text_width = this->score_width = 0;
src/linkgraph/linkgraph_gui.cpp
Show inline comments
 
@@ -633,13 +633,13 @@ void LinkGraphLegendWindow::DrawWidget(c
 
			str = STR_LINKGRAPH_LEGEND_SATURATED;
 
		}
 
		if (str != STR_NULL) {
 
			DrawString(br.left, br.right, CenterBounds(br.top, br.bottom, FONT_HEIGHT_SMALL), str, GetContrastColour(colour) | TC_FORCED, SA_HOR_CENTER, false, FS_SMALL);
 
			DrawString(br.left, br.right, CenterBounds(br.top, br.bottom, GetCharacterHeight(FS_SMALL)), str, GetContrastColour(colour) | TC_FORCED, SA_HOR_CENTER, false, FS_SMALL);
 
		}
 
	}
 
	if (IsInsideMM(widget, WID_LGL_CARGO_FIRST, WID_LGL_CARGO_LAST + 1)) {
 
		const CargoSpec *cargo = _sorted_cargo_specs[widget - WID_LGL_CARGO_FIRST];
 
		GfxFillRect(br, cargo->legend_colour);
 
		DrawString(br.left, br.right, CenterBounds(br.top, br.bottom, FONT_HEIGHT_SMALL), cargo->abbrev, GetContrastColour(cargo->legend_colour, 73), SA_HOR_CENTER, false, FS_SMALL);
 
		DrawString(br.left, br.right, CenterBounds(br.top, br.bottom, GetCharacterHeight(FS_SMALL)), cargo->abbrev, GetContrastColour(cargo->legend_colour, 73), SA_HOR_CENTER, false, FS_SMALL);
 
	}
 
}
 

	
src/misc_gui.cpp
Show inline comments
 
@@ -79,7 +79,7 @@ public:
 
		Rect ir = r.Shrink(WidgetDimensions::scaled.frametext);
 
		for (size_t i = 0; i < this->landinfo_data.size(); i++) {
 
			DrawString(ir, this->landinfo_data[i], i == 0 ? TC_LIGHT_BLUE : TC_FROMSTRING, SA_HOR_CENTER);
 
			ir.top += FONT_HEIGHT_NORMAL + (i == 0 ? WidgetDimensions::scaled.vsep_wide : WidgetDimensions::scaled.vsep_normal);
 
			ir.top += GetCharacterHeight(FS_NORMAL) + (i == 0 ? WidgetDimensions::scaled.vsep_wide : WidgetDimensions::scaled.vsep_normal);
 
		}
 

	
 
		if (!this->cargo_acceptance.empty()) {
 
@@ -97,7 +97,7 @@ public:
 
			uint width = GetStringBoundingBox(this->landinfo_data[i]).width + WidgetDimensions::scaled.frametext.Horizontal();
 
			size->width = std::max(size->width, width);
 

	
 
			size->height += FONT_HEIGHT_NORMAL + (i == 0 ? WidgetDimensions::scaled.vsep_wide : WidgetDimensions::scaled.vsep_normal);
 
			size->height += GetCharacterHeight(FS_NORMAL) + (i == 0 ? WidgetDimensions::scaled.vsep_wide : WidgetDimensions::scaled.vsep_normal);
 
		}
 

	
 
		if (!this->cargo_acceptance.empty()) {
 
@@ -488,7 +488,7 @@ struct AboutWindow : public Window {
 
	{
 
		if (widget != WID_A_SCROLLING_TEXT) return;
 

	
 
		this->line_height = FONT_HEIGHT_NORMAL;
 
		this->line_height = GetCharacterHeight(FS_NORMAL);
 

	
 
		Dimension d;
 
		d.height = this->line_height * num_visible_lines;
 
@@ -518,9 +518,9 @@ struct AboutWindow : public Window {
 
	/**
 
	 * Scroll the text in the about window slow.
 
	 *
 
	 * The interval of 2100ms is chosen to maintain parity: 2100 / FONT_HEIGHT_NORMAL = 150ms.
 
	 * The interval of 2100ms is chosen to maintain parity: 2100 / GetCharacterHeight(FS_NORMAL) = 150ms.
 
	 */
 
	IntervalTimer<TimerWindow> scroll_interval = {std::chrono::milliseconds(2100) / FONT_HEIGHT_NORMAL, [this](uint count) {
 
	IntervalTimer<TimerWindow> scroll_interval = {std::chrono::milliseconds(2100) / GetCharacterHeight(FS_NORMAL), [this](uint count) {
 
		this->text_position -= count;
 
		/* If the last text has scrolled start a new from the start */
 
		if (this->text_position < (int)(this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y - lengthof(_credits) * this->line_height)) {
src/music_gui.cpp
Show inline comments
 
@@ -539,7 +539,7 @@ struct MusicTrackSelectionWindow : publi
 
					SetDParam(1, 2);
 
					SetDParamStr(2, song.songname);
 
					DrawString(tr, STR_PLAYLIST_TRACK_NAME);
 
					tr.top += FONT_HEIGHT_SMALL;
 
					tr.top += GetCharacterHeight(FS_SMALL);
 
				}
 
				break;
 
			}
 
@@ -553,7 +553,7 @@ struct MusicTrackSelectionWindow : publi
 
					SetDParam(1, 2);
 
					SetDParamStr(2, song.songname);
 
					DrawString(tr, STR_PLAYLIST_TRACK_NAME);
 
					tr.top += FONT_HEIGHT_SMALL;
 
					tr.top += GetCharacterHeight(FS_SMALL);
 
				}
 
				break;
 
			}
 
@@ -564,13 +564,13 @@ struct MusicTrackSelectionWindow : publi
 
	{
 
		switch (widget) {
 
			case WID_MTS_LIST_LEFT: { // add to playlist
 
				int y = this->GetRowFromWidget(pt.y, widget, 0, FONT_HEIGHT_SMALL);
 
				int y = this->GetRowFromWidget(pt.y, widget, 0, GetCharacterHeight(FS_SMALL));
 
				_music.PlaylistAdd(y);
 
				break;
 
			}
 

	
 
			case WID_MTS_LIST_RIGHT: { // remove from playlist
 
				int y = this->GetRowFromWidget(pt.y, widget, 0, FONT_HEIGHT_SMALL);
 
				int y = this->GetRowFromWidget(pt.y, widget, 0, GetCharacterHeight(FS_SMALL));
 
				_music.PlaylistRemove(y);
 
				break;
 
			}
src/network/network_chat_gui.cpp
Show inline comments
 
@@ -101,8 +101,8 @@ void CDECL NetworkAddChatMessage(TextCol
 
/** Initialize all font-dependent chat box sizes. */
 
void NetworkReInitChatBoxSize()
 
{
 
	_chatmsg_box.y       = 3 * FONT_HEIGHT_NORMAL;
 
	_chatmsg_box.height  = MAX_CHAT_MESSAGES * (FONT_HEIGHT_NORMAL + ScaleGUITrad(NETWORK_CHAT_LINE_SPACING)) + ScaleGUITrad(4);
 
	_chatmsg_box.y       = 3 * GetCharacterHeight(FS_NORMAL);
 
	_chatmsg_box.height  = MAX_CHAT_MESSAGES * (GetCharacterHeight(FS_NORMAL) + ScaleGUITrad(NETWORK_CHAT_LINE_SPACING)) + ScaleGUITrad(4);
 
}
 

	
 
/** Initialize all buffers of the chat visualisation. */
 
@@ -218,10 +218,10 @@ void NetworkDrawChatMessage()
 
	for (auto &cmsg : _chatmsg_list) {
 
		if (!show_all && cmsg.remove_time < now) continue;
 
		SetDParamStr(0, cmsg.message);
 
		string_height += GetStringLineCount(STR_JUST_RAW_STRING, width - 1) * FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING;
 
		string_height += GetStringLineCount(STR_JUST_RAW_STRING, width - 1) * GetCharacterHeight(FS_NORMAL) + NETWORK_CHAT_LINE_SPACING;
 
	}
 

	
 
	string_height = std::min<uint>(string_height, MAX_CHAT_MESSAGES * (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING));
 
	string_height = std::min<uint>(string_height, MAX_CHAT_MESSAGES * (GetCharacterHeight(FS_NORMAL) + NETWORK_CHAT_LINE_SPACING));
 

	
 
	int top = _screen.height - _chatmsg_box.y - string_height - 2;
 
	int bottom = _screen.height - _chatmsg_box.y - 2;
src/network/network_content_gui.cpp
Show inline comments
 
@@ -128,7 +128,7 @@ void BaseNetworkContentDownloadStatusWin
 
			break;
 

	
 
		case WID_NCDS_PROGRESS_TEXT:
 
			size->height = FONT_HEIGHT_NORMAL * 2 + WidgetDimensions::scaled.vsep_normal;
 
			size->height = GetCharacterHeight(FS_NORMAL) * 2 + WidgetDimensions::scaled.vsep_normal;
 
			break;
 
	}
 
}
 
@@ -144,7 +144,7 @@ void BaseNetworkContentDownloadStatusWin
 
			SetDParam(0, this->downloaded_bytes);
 
			SetDParam(1, this->total_bytes);
 
			SetDParam(2, this->downloaded_bytes * 100LL / this->total_bytes);
 
			DrawString(ir.left, ir.right, CenterBounds(ir.top, ir.bottom, FONT_HEIGHT_NORMAL), STR_CONTENT_DOWNLOAD_PROGRESS_SIZE, TC_FROMSTRING, SA_HOR_CENTER);
 
			DrawString(ir.left, ir.right, CenterBounds(ir.top, ir.bottom, GetCharacterHeight(FS_NORMAL)), STR_CONTENT_DOWNLOAD_PROGRESS_SIZE, TC_FROMSTRING, SA_HOR_CENTER);
 
			break;
 
		}
 

	
 
@@ -598,7 +598,7 @@ public:
 
			}
 

	
 
			case WID_NCL_MATRIX:
 
				resize->height = std::max(this->checkbox_size.height, (uint)FONT_HEIGHT_NORMAL) + padding.height;
 
				resize->height = std::max(this->checkbox_size.height, (uint)GetCharacterHeight(FS_NORMAL)) + padding.height;
 
				size->height = 10 * resize->height;
 
				break;
 
		}
 
@@ -647,7 +647,7 @@ public:
 

	
 
		/* Fill the matrix with the information */
 
		int sprite_y_offset = (this->resize.step_height - this->checkbox_size.height) / 2;
 
		int text_y_offset   = (this->resize.step_height - FONT_HEIGHT_NORMAL) / 2;
 
		int text_y_offset   = (this->resize.step_height - GetCharacterHeight(FS_NORMAL)) / 2;
 

	
 
		Rect mr = r.WithHeight(this->resize.step_height);
 
		auto iter = this->content.begin() + this->vscroll->GetPosition();
 
@@ -686,7 +686,7 @@ public:
 
	void DrawDetails(const Rect &r) const
 
	{
 
		/* Height for the title banner */
 
		int HEADER_HEIGHT = 3 * FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.frametext.Vertical();
 
		int HEADER_HEIGHT = 3 * GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.frametext.Vertical();
 

	
 
		Rect hr = r.WithHeight(HEADER_HEIGHT).Shrink(WidgetDimensions::scaled.frametext);
 
		Rect tr = r.Shrink(WidgetDimensions::scaled.frametext);
 
@@ -698,15 +698,15 @@ public:
 

	
 
		/* Draw the total download size */
 
		SetDParam(0, this->filesize_sum);
 
		DrawString(tr.left, tr.right, tr.bottom - FONT_HEIGHT_NORMAL + 1, STR_CONTENT_TOTAL_DOWNLOAD_SIZE);
 
		DrawString(tr.left, tr.right, tr.bottom - GetCharacterHeight(FS_NORMAL) + 1, STR_CONTENT_TOTAL_DOWNLOAD_SIZE);
 

	
 
		if (this->selected == nullptr) return;
 

	
 
		/* And fill the rest of the details when there's information to place there */
 
		DrawStringMultiLine(hr.left, hr.right, hr.top + FONT_HEIGHT_NORMAL, hr.bottom, STR_CONTENT_DETAIL_SUBTITLE_UNSELECTED + this->selected->state, TC_FROMSTRING, SA_CENTER);
 
		DrawStringMultiLine(hr.left, hr.right, hr.top + GetCharacterHeight(FS_NORMAL), hr.bottom, STR_CONTENT_DETAIL_SUBTITLE_UNSELECTED + this->selected->state, TC_FROMSTRING, SA_CENTER);
 

	
 
		/* Also show the total download size, so keep some space from the bottom */
 
		tr.bottom -= FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_wide;
 
		tr.bottom -= GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_wide;
 

	
 
		if (this->selected->upgrade) {
 
			SetDParam(0, STR_CONTENT_TYPE_BASE_GRAPHICS + this->selected->type - CONTENT_TYPE_BASE_GRAPHICS);
src/network/network_gui.cpp
Show inline comments
 
@@ -352,7 +352,7 @@ protected:
 
		}
 

	
 
		/* offsets to vertically centre text and icons */
 
		int text_y_offset = (this->resize.step_height - FONT_HEIGHT_NORMAL) / 2 + 1;
 
		int text_y_offset = (this->resize.step_height - GetCharacterHeight(FS_NORMAL)) / 2 + 1;
 
		int icon_y_offset = (this->resize.step_height - GetSpriteSize(SPR_BLOT).height) / 2;
 
		int lock_y_offset = (this->resize.step_height - GetSpriteSize(SPR_LOCK).height) / 2;
 

	
 
@@ -468,13 +468,13 @@ public:
 
	{
 
		switch (widget) {
 
			case WID_NG_MATRIX:
 
				resize->height = std::max(GetSpriteSize(SPR_BLOT).height, (uint)FONT_HEIGHT_NORMAL) + padding.height;
 
				resize->height = std::max(GetSpriteSize(SPR_BLOT).height, (uint)GetCharacterHeight(FS_NORMAL)) + padding.height;
 
				fill->height = resize->height;
 
				size->height = 12 * resize->height;
 
				break;
 

	
 
			case WID_NG_LASTJOINED:
 
				size->height = std::max(GetSpriteSize(SPR_BLOT).height, (uint)FONT_HEIGHT_NORMAL) + WidgetDimensions::scaled.matrix.Vertical();
 
				size->height = std::max(GetSpriteSize(SPR_BLOT).height, (uint)GetCharacterHeight(FS_NORMAL)) + WidgetDimensions::scaled.matrix.Vertical();
 
				break;
 

	
 
			case WID_NG_LASTJOINED_SPACER:
 
@@ -586,7 +586,7 @@ public:
 
		NetworkGameList *sel = this->server;
 

	
 
		/* Height for the title banner */
 
		int HEADER_HEIGHT = 3 * FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.frametext.Vertical();
 
		int HEADER_HEIGHT = 3 * GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.frametext.Vertical();
 

	
 
		Rect hr = r.WithHeight(HEADER_HEIGHT).Shrink(WidgetDimensions::scaled.frametext);
 
		Rect tr = r.Shrink(WidgetDimensions::scaled.frametext);
 
@@ -610,45 +610,45 @@ public:
 
			}
 

	
 
			DrawString(hr.left, hr.right, hr.top, message, TC_FROMSTRING, SA_HOR_CENTER); // server offline
 
			DrawStringMultiLine(hr.left, hr.right, hr.top + FONT_HEIGHT_NORMAL, hr.bottom, sel->info.server_name, TC_ORANGE, SA_HOR_CENTER); // game name
 
			DrawStringMultiLine(hr.left, hr.right, hr.top + GetCharacterHeight(FS_NORMAL), hr.bottom, sel->info.server_name, TC_ORANGE, SA_HOR_CENTER); // game name
 
			DrawString(tr.left, tr.right, tr.top, message, TC_FROMSTRING, SA_HOR_CENTER); // server offline
 
		} else { // show game info
 

	
 
			DrawString(hr.left, hr.right, hr.top, STR_NETWORK_SERVER_LIST_GAME_INFO, TC_FROMSTRING, SA_HOR_CENTER);
 
			DrawStringMultiLine(hr.left, hr.right, hr.top + FONT_HEIGHT_NORMAL, hr.bottom, sel->info.server_name, TC_ORANGE, SA_HOR_CENTER); // game name
 
			DrawStringMultiLine(hr.left, hr.right, hr.top + GetCharacterHeight(FS_NORMAL), hr.bottom, sel->info.server_name, TC_ORANGE, SA_HOR_CENTER); // game name
 

	
 
			SetDParam(0, sel->info.clients_on);
 
			SetDParam(1, sel->info.clients_max);
 
			SetDParam(2, sel->info.companies_on);
 
			SetDParam(3, sel->info.companies_max);
 
			DrawString(tr, STR_NETWORK_SERVER_LIST_CLIENTS);
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
			SetDParam(0, STR_CLIMATE_TEMPERATE_LANDSCAPE + sel->info.landscape);
 
			DrawString(tr, STR_NETWORK_SERVER_LIST_LANDSCAPE); // landscape
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
			SetDParam(0, sel->info.map_width);
 
			SetDParam(1, sel->info.map_height);
 
			DrawString(tr, STR_NETWORK_SERVER_LIST_MAP_SIZE); // map size
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
			SetDParamStr(0, sel->info.server_revision);
 
			DrawString(tr, STR_NETWORK_SERVER_LIST_SERVER_VERSION); // server version
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
			SetDParamStr(0, sel->connection_string);
 
			StringID invite_or_address = StrStartsWith(sel->connection_string, "+") ? STR_NETWORK_SERVER_LIST_INVITE_CODE : STR_NETWORK_SERVER_LIST_SERVER_ADDRESS;
 
			DrawString(tr, invite_or_address); // server address / invite code
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
			SetDParam(0, sel->info.start_date);
 
			DrawString(tr, STR_NETWORK_SERVER_LIST_START_DATE); // start date
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
			SetDParam(0, sel->info.game_date);
 
			DrawString(tr, STR_NETWORK_SERVER_LIST_CURRENT_DATE); // current date
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
			if (sel->info.gamescript_version != -1) {
 
				SetDParamStr(0, sel->info.gamescript_name);
 
@@ -1682,7 +1682,7 @@ public:
 
			case WID_CL_MATRIX: {
 
				uint height = std::max({GetSpriteSize(SPR_COMPANY_ICON).height, GetSpriteSize(SPR_JOIN).height, GetSpriteSize(SPR_ADMIN).height, GetSpriteSize(SPR_CHAT).height});
 
				height += WidgetDimensions::scaled.framerect.Vertical();
 
				this->line_height = std::max(height, (uint)FONT_HEIGHT_NORMAL) + padding.height;
 
				this->line_height = std::max(height, (uint)GetCharacterHeight(FS_NORMAL)) + padding.height;
 

	
 
				resize->width = 1;
 
				resize->height = this->line_height;
 
@@ -1947,7 +1947,7 @@ public:
 
	void DrawCompany(CompanyID company_id, const Rect &r, uint &line) const
 
	{
 
		bool rtl = _current_text_dir == TD_RTL;
 
		int text_y_offset = CenterBounds(0, this->line_height, FONT_HEIGHT_NORMAL);
 
		int text_y_offset = CenterBounds(0, this->line_height, GetCharacterHeight(FS_NORMAL));
 

	
 
		Dimension d = GetSpriteSize(SPR_COMPANY_ICON);
 
		int offset = CenterBounds(0, this->line_height, d.height);
 
@@ -2125,7 +2125,7 @@ struct NetworkJoinStatusWindow : Window 
 
						break;
 
				}
 
				DrawFrameRect(ir.WithWidth(ir.Width() * progress / 100, false), COLOUR_MAUVE, FR_NONE);
 
				DrawString(ir.left, ir.right, CenterBounds(ir.top, ir.bottom, FONT_HEIGHT_NORMAL), STR_NETWORK_CONNECTING_1 + _network_join_status, TC_FROMSTRING, SA_HOR_CENTER);
 
				DrawString(ir.left, ir.right, CenterBounds(ir.top, ir.bottom, GetCharacterHeight(FS_NORMAL)), STR_NETWORK_CONNECTING_1 + _network_join_status, TC_FROMSTRING, SA_HOR_CENTER);
 
				break;
 
			}
 

	
src/newgrf_debug_gui.cpp
Show inline comments
 
@@ -377,7 +377,7 @@ struct NewGRFInspectWindow : Window {
 
			}
 

	
 
			case WID_NGRFI_MAINPANEL:
 
				resize->height = std::max(11, FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal);
 
				resize->height = std::max(11, GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal);
 
				resize->width  = 1;
 

	
 
				size->height = 5 * resize->height + WidgetDimensions::scaled.frametext.Vertical();
 
@@ -879,7 +879,7 @@ struct SpriteAlignerWindow : Window {
 
			case WID_SA_LIST:
 
				SetDParamMaxDigits(0, 6);
 
				size->width = GetStringBoundingBox(STR_JUST_COMMA).width + padding.width;
 
				resize->height = FONT_HEIGHT_NORMAL + padding.height;
 
				resize->height = GetCharacterHeight(FS_NORMAL) + padding.height;
 
				resize->width  = 1;
 
				fill->height = resize->height;
 
				break;
src/newgrf_gui.cpp
Show inline comments
 
@@ -215,8 +215,8 @@ struct NewGRFParametersWindow : public W
 
		switch (widget) {
 
			case WID_NP_NUMPAR_DEC:
 
			case WID_NP_NUMPAR_INC: {
 
				size->width  = std::max(SETTING_BUTTON_WIDTH / 2, FONT_HEIGHT_NORMAL);
 
				size->height = std::max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL);
 
				size->width  = std::max(SETTING_BUTTON_WIDTH / 2, GetCharacterHeight(FS_NORMAL));
 
				size->height = std::max(SETTING_BUTTON_HEIGHT, GetCharacterHeight(FS_NORMAL));
 
				break;
 
			}
 

	
 
@@ -230,7 +230,7 @@ struct NewGRFParametersWindow : public W
 
			}
 

	
 
			case WID_NP_BACKGROUND:
 
				this->line_height = std::max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL) + padding.height;
 
				this->line_height = std::max(SETTING_BUTTON_HEIGHT, GetCharacterHeight(FS_NORMAL)) + padding.height;
 

	
 
				resize->width = 1;
 
				resize->height = this->line_height;
 
@@ -239,7 +239,7 @@ struct NewGRFParametersWindow : public W
 

	
 
			case WID_NP_DESCRIPTION:
 
				/* Minimum size of 4 lines. The 500 is the default size of the window. */
 
				Dimension suggestion = {500U - WidgetDimensions::scaled.frametext.Horizontal(), (uint)FONT_HEIGHT_NORMAL * 4 + WidgetDimensions::scaled.frametext.Vertical()};
 
				Dimension suggestion = {500U - WidgetDimensions::scaled.frametext.Horizontal(), (uint)GetCharacterHeight(FS_NORMAL) * 4 + WidgetDimensions::scaled.frametext.Vertical()};
 
				for (const auto &par_info : this->grf_config->param_info) {
 
					if (!par_info.has_value()) continue;
 
					const char *desc = GetGRFStringFromGRFText(par_info->desc);
 
@@ -281,7 +281,7 @@ struct NewGRFParametersWindow : public W
 
		Rect tr = ir.Indent(SETTING_BUTTON_WIDTH + WidgetDimensions::scaled.hsep_wide, rtl);
 

	
 
		int button_y_offset = (this->line_height - SETTING_BUTTON_HEIGHT) / 2;
 
		int text_y_offset = (this->line_height - FONT_HEIGHT_NORMAL) / 2;
 
		int text_y_offset = (this->line_height - GetCharacterHeight(FS_NORMAL)) / 2;
 
		for (uint i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < this->vscroll->GetCount(); i++) {
 
			GRFParameterInfo &par_info = this->GetParameterInfo(i);
 
			uint32_t current_value = par_info.GetValue(this->grf_config);
 
@@ -747,7 +747,7 @@ struct NewGRFWindow : public Window, New
 
			case WID_NS_FILE_LIST:
 
			{
 
				Dimension d = maxdim(GetScaledSpriteSize(SPR_SQUARE), GetScaledSpriteSize(SPR_WARNING_SIGN));
 
				resize->height = std::max<uint>(d.height + 2U, FONT_HEIGHT_NORMAL);
 
				resize->height = std::max<uint>(d.height + 2U, GetCharacterHeight(FS_NORMAL));
 
				size->height = std::max(size->height, padding.height + 6 * resize->height);
 
				break;
 
			}
 
@@ -755,7 +755,7 @@ struct NewGRFWindow : public Window, New
 
			case WID_NS_AVAIL_LIST:
 
			{
 
				Dimension d = maxdim(GetScaledSpriteSize(SPR_SQUARE), GetScaledSpriteSize(SPR_WARNING_SIGN));
 
				resize->height = std::max<uint>(d.height + 2U, FONT_HEIGHT_NORMAL);
 
				resize->height = std::max<uint>(d.height + 2U, GetCharacterHeight(FS_NORMAL));
 
				size->height = std::max(size->height, padding.height + 8 * resize->height);
 
				break;
 
			}
 
@@ -768,7 +768,7 @@ struct NewGRFWindow : public Window, New
 
			}
 

	
 
			case WID_NS_NEWGRF_INFO:
 
				size->height = std::max<uint>(size->height, WidgetDimensions::scaled.framerect.Vertical() + 10 * FONT_HEIGHT_NORMAL);
 
				size->height = std::max<uint>(size->height, WidgetDimensions::scaled.framerect.Vertical() + 10 * GetCharacterHeight(FS_NORMAL));
 
				break;
 

	
 
			case WID_NS_PRESET_LIST: {
 
@@ -861,7 +861,7 @@ struct NewGRFWindow : public Window, New
 
				Dimension warning = GetSpriteSize(SPR_WARNING_SIGN);
 
				int square_offset_y = (step_height - square.height) / 2;
 
				int warning_offset_y = (step_height - warning.height) / 2;
 
				int offset_y = (step_height - FONT_HEIGHT_NORMAL) / 2;
 
				int offset_y = (step_height - GetCharacterHeight(FS_NORMAL)) / 2;
 

	
 
				bool rtl = _current_text_dir == TD_RTL;
 
				uint text_left    = rtl ? tr.left : tr.left + square.width + 13;
 
@@ -906,7 +906,7 @@ struct NewGRFWindow : public Window, New
 

	
 
				Rect tr = r.Shrink(WidgetDimensions::scaled.framerect);
 
				uint step_height = this->GetWidget<NWidgetBase>(WID_NS_AVAIL_LIST)->resize_y;
 
				int offset_y = (step_height - FONT_HEIGHT_NORMAL) / 2;
 
				int offset_y = (step_height - GetCharacterHeight(FS_NORMAL)) / 2;
 
				uint min_index = this->vscroll2->GetPosition();
 
				uint max_index = std::min(min_index + this->vscroll2->GetCapacity(), (uint)this->avails.size());
 

	
 
@@ -925,7 +925,7 @@ struct NewGRFWindow : public Window, New
 
			case WID_NS_NEWGRF_INFO_TITLE: {
 
				/* Create the nice grayish rectangle at the details top. */
 
				GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), PC_DARK_BLUE);
 
				DrawString(r.left, r.right, CenterBounds(r.top, r.bottom, FONT_HEIGHT_NORMAL), STR_NEWGRF_SETTINGS_INFO_TITLE, TC_FROMSTRING, SA_HOR_CENTER);
 
				DrawString(r.left, r.right, CenterBounds(r.top, r.bottom, GetCharacterHeight(FS_NORMAL)), STR_NEWGRF_SETTINGS_INFO_TITLE, TC_FROMSTRING, SA_HOR_CENTER);
 
				break;
 
			}
 

	
 
@@ -2103,7 +2103,7 @@ struct SavePresetWindow : public Window 
 
	{
 
		switch (widget) {
 
			case WID_SVP_PRESET_LIST: {
 
				resize->height = FONT_HEIGHT_NORMAL;
 
				resize->height = GetCharacterHeight(FS_NORMAL);
 
				size->height = 0;
 
				for (uint i = 0; i < this->presets.size(); i++) {
 
					Dimension d = GetStringBoundingBox(this->presets[i]);
 
@@ -2124,7 +2124,7 @@ struct SavePresetWindow : public Window 
 
				GfxFillRect(br, PC_BLACK);
 

	
 
				uint step_height = this->GetWidget<NWidgetBase>(WID_SVP_PRESET_LIST)->resize_y;
 
				int offset_y = (step_height - FONT_HEIGHT_NORMAL) / 2;
 
				int offset_y = (step_height - GetCharacterHeight(FS_NORMAL)) / 2;
 
				Rect tr = r.Shrink(WidgetDimensions::scaled.framerect);
 
				uint min_index = this->vscroll->GetPosition();
 
				uint max_index = std::min(min_index + this->vscroll->GetCapacity(), (uint)this->presets.size());
 
@@ -2232,7 +2232,7 @@ struct ScanProgressWindow : public Windo
 
				/* We really don't know the width. We could determine it by scanning the NewGRFs,
 
				 * but this is the status window for scanning them... */
 
				size->width = std::max<uint>(size->width, GetStringBoundingBox(STR_NEWGRF_SCAN_STATUS).width + padding.width);
 
				size->height = FONT_HEIGHT_NORMAL * 2 + WidgetDimensions::scaled.vsep_normal;
 
				size->height = GetCharacterHeight(FS_NORMAL) * 2 + WidgetDimensions::scaled.vsep_normal;
 
				break;
 
		}
 
	}
 
@@ -2247,7 +2247,7 @@ struct ScanProgressWindow : public Windo
 
				uint percent = scanned * 100 / std::max(1U, _settings_client.gui.last_newgrf_count);
 
				DrawFrameRect(ir.WithWidth(ir.Width() * percent / 100, false), COLOUR_MAUVE, FR_NONE);
 
				SetDParam(0, percent);
 
				DrawString(ir.left, ir.right, CenterBounds(ir.top, ir.bottom, FONT_HEIGHT_NORMAL), STR_GENERATION_PROGRESS, TC_FROMSTRING, SA_HOR_CENTER);
 
				DrawString(ir.left, ir.right, CenterBounds(ir.top, ir.bottom, GetCharacterHeight(FS_NORMAL)), STR_GENERATION_PROGRESS, TC_FROMSTRING, SA_HOR_CENTER);
 
				break;
 
			}
 

	
 
@@ -2256,7 +2256,7 @@ struct ScanProgressWindow : public Windo
 
				SetDParam(1, _settings_client.gui.last_newgrf_count);
 
				DrawString(r.left, r.right, r.top, STR_NEWGRF_SCAN_STATUS, TC_FROMSTRING, SA_HOR_CENTER);
 

	
 
				DrawString(r.left, r.right, r.top + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal, this->last_name, TC_BLACK, SA_HOR_CENTER);
 
				DrawString(r.left, r.right, r.top + GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal, this->last_name, TC_BLACK, SA_HOR_CENTER);
 
				break;
 
		}
 
	}
src/news_gui.cpp
Show inline comments
 
@@ -559,9 +559,9 @@ struct NewsWindow : Window {
 
	/**
 
	 * Scroll the news message slowly up from the bottom.
 
	 *
 
	 * The interval of 210ms is chosen to maintain 15ms at normal zoom: 210 / FONT_HEIGHT_NORMAL = 15ms.
 
	 * The interval of 210ms is chosen to maintain 15ms at normal zoom: 210 / GetCharacterHeight(FS_NORMAL) = 15ms.
 
	 */
 
	IntervalTimer<TimerWindow> scroll_interval = {std::chrono::milliseconds(210) / FONT_HEIGHT_NORMAL, [this](uint count) {
 
	IntervalTimer<TimerWindow> scroll_interval = {std::chrono::milliseconds(210) / GetCharacterHeight(FS_NORMAL), [this](uint count) {
 
		int newtop = std::max(this->top - 2 * static_cast<int>(count), _screen.height - this->height - this->status_height - this->chat_height);
 
		this->SetWindowTop(newtop);
 
	}};
 
@@ -1130,7 +1130,7 @@ struct MessageHistoryWindow : Window {
 
	void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
 
	{
 
		if (widget == WID_MH_BACKGROUND) {
 
			this->line_height = FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
			this->line_height = GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 
			resize->height = this->line_height;
 

	
 
			/* Months are off-by-one, so it's actually 8. Not using
src/object_gui.cpp
Show inline comments
 
@@ -221,7 +221,7 @@ public:
 
					if (objclass->GetUISpecCount() == 0) continue;
 
					size->width = std::max(size->width, GetStringBoundingBox(objclass->name).width + padding.width);
 
				}
 
				this->line_height = FONT_HEIGHT_NORMAL + padding.height;
 
				this->line_height = GetCharacterHeight(FS_NORMAL) + padding.height;
 
				resize->height = this->line_height;
 
				size->height = 5 * this->line_height;
 
				break;
src/order_gui.cpp
Show inline comments
 
@@ -224,11 +224,11 @@ void DrawOrderString(const Vehicle *v, c
 
	Dimension sprite_size = GetSpriteSize(sprite);
 
	if (v->cur_real_order_index == order_index) {
 
		/* Draw two arrows before the next real order. */
 
		DrawSprite(sprite, PAL_NONE, rtl ? right -     sprite_size.width : left,                     y + ((int)FONT_HEIGHT_NORMAL - (int)sprite_size.height) / 2);
 
		DrawSprite(sprite, PAL_NONE, rtl ? right - 2 * sprite_size.width : left + sprite_size.width, y + ((int)FONT_HEIGHT_NORMAL - (int)sprite_size.height) / 2);
 
		DrawSprite(sprite, PAL_NONE, rtl ? right -     sprite_size.width : left,                     y + ((int)GetCharacterHeight(FS_NORMAL) - (int)sprite_size.height) / 2);
 
		DrawSprite(sprite, PAL_NONE, rtl ? right - 2 * sprite_size.width : left + sprite_size.width, y + ((int)GetCharacterHeight(FS_NORMAL) - (int)sprite_size.height) / 2);
 
	} else if (v->cur_implicit_order_index == order_index) {
 
		/* Draw one arrow before the next implicit order; the next real order will still get two arrows. */
 
		DrawSprite(sprite, PAL_NONE, rtl ? right -     sprite_size.width : left,                     y + ((int)FONT_HEIGHT_NORMAL - (int)sprite_size.height) / 2);
 
		DrawSprite(sprite, PAL_NONE, rtl ? right -     sprite_size.width : left,                     y + ((int)GetCharacterHeight(FS_NORMAL) - (int)sprite_size.height) / 2);
 
	}
 

	
 
	TextColour colour = TC_BLACK;
 
@@ -805,7 +805,7 @@ public:
 
	{
 
		switch (widget) {
 
			case WID_O_ORDER_LIST:
 
				resize->height = FONT_HEIGHT_NORMAL;
 
				resize->height = GetCharacterHeight(FS_NORMAL);
 
				size->height = 6 * resize->height + padding.height;
 
				break;
 

	
src/rail_gui.cpp
Show inline comments
 
@@ -969,7 +969,7 @@ private:
 
public:
 
	BuildRailStationWindow(WindowDesc *desc, Window *parent, bool newstation) : PickerWindowBase(desc, parent), filter_editbox(EDITBOX_MAX_SIZE * MAX_CHAR_LENGTH, EDITBOX_MAX_SIZE)
 
	{
 
		this->coverage_height = 2 * FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
		this->coverage_height = 2 * GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 
		this->vscroll = nullptr;
 
		_railstation.newstations = newstation;
 

	
 
@@ -1194,7 +1194,7 @@ public:
 
					d = maxdim(d, GetStringBoundingBox(StationClass::Get(station_class)->name));
 
				}
 
				size->width = std::max(size->width, d.width + padding.width);
 
				this->line_height = FONT_HEIGHT_NORMAL + padding.height;
 
				this->line_height = GetCharacterHeight(FS_NORMAL) + padding.height;
 
				size->height = 5 * this->line_height;
 
				resize->height = this->line_height;
 
				break;
src/road_gui.cpp
Show inline comments
 
@@ -1140,7 +1140,7 @@ private:
 
public:
 
	BuildRoadStationWindow(WindowDesc *desc, Window *parent, RoadStopType rs) : PickerWindowBase(desc, parent), filter_editbox(EDITBOX_MAX_SIZE * MAX_CHAR_LENGTH, EDITBOX_MAX_SIZE)
 
	{
 
		this->coverage_height = 2 * FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
		this->coverage_height = 2 * GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 
		this->vscrollList = nullptr;
 
		this->vscrollMatrix = nullptr;
 
		this->roadStopType = rs;
 
@@ -1349,7 +1349,7 @@ public:
 
					d = maxdim(d, GetStringBoundingBox(RoadStopClass::Get(rs_class)->name));
 
				}
 
				size->width = std::max(size->width, d.width + padding.width);
 
				this->line_height = FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.matrix.Vertical();
 
				this->line_height = GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.matrix.Vertical();
 
				size->height = 5 * this->line_height;
 
				resize->height = this->line_height;
 
				break;
src/roadveh_gui.cpp
Show inline comments
 
@@ -36,7 +36,7 @@ void DrawRoadVehDetails(const Vehicle *v
 
	SetDParam(1, v->build_year);
 
	SetDParam(2, v->value);
 
	DrawString(r.left, r.right, y, STR_VEHICLE_INFO_BUILT_VALUE);
 
	y += FONT_HEIGHT_NORMAL;
 
	y += GetCharacterHeight(FS_NORMAL);
 

	
 
	if (v->HasArticulatedPart()) {
 
		CargoArray max_cargo{};
 
@@ -71,7 +71,7 @@ void DrawRoadVehDetails(const Vehicle *v
 
		}
 

	
 
		DrawString(r.left, r.right, y, capacity, TC_BLUE);
 
		y += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
		y += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 

	
 
		for (const Vehicle *u = v; u != nullptr; u = u->Next()) {
 
			if (u->cargo_cap == 0) continue;
 
@@ -85,7 +85,7 @@ void DrawRoadVehDetails(const Vehicle *v
 
				feeder_share += u->cargo.GetFeederShare();
 
			}
 
			DrawString(r.left, r.right, y, str);
 
			y += FONT_HEIGHT_NORMAL;
 
			y += GetCharacterHeight(FS_NORMAL);
 
		}
 
		y += WidgetDimensions::scaled.vsep_normal;
 
	} else {
 
@@ -93,7 +93,7 @@ void DrawRoadVehDetails(const Vehicle *v
 
		SetDParam(1, v->cargo_cap);
 
		SetDParam(4, GetCargoSubtypeText(v));
 
		DrawString(r.left, r.right, y, STR_VEHICLE_INFO_CAPACITY);
 
		y += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
		y += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 

	
 
		str = STR_VEHICLE_DETAILS_CARGO_EMPTY;
 
		if (v->cargo.StoredCount() > 0) {
 
@@ -104,7 +104,7 @@ void DrawRoadVehDetails(const Vehicle *v
 
			feeder_share += v->cargo.GetFeederShare();
 
		}
 
		DrawString(r.left, r.right, y, str);
 
		y += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
		y += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 
	}
 

	
 
	/* Draw Transfer credits text */
src/script/script_gui.cpp
Show inline comments
 
@@ -106,7 +106,7 @@ struct ScriptListWindow : public Window 
 
	{
 
		if (widget != WID_SCRL_LIST) return;
 

	
 
		this->line_height = FONT_HEIGHT_NORMAL + padding.height;
 
		this->line_height = GetCharacterHeight(FS_NORMAL) + padding.height;
 

	
 
		resize->width = 1;
 
		resize->height = this->line_height;
 
@@ -149,14 +149,14 @@ struct ScriptListWindow : public Window 
 
					Rect tr = r.Shrink(WidgetDimensions::scaled.frametext, WidgetDimensions::scaled.framerect);
 
					SetDParamStr(0, selected_info->GetAuthor());
 
					DrawString(tr, STR_AI_LIST_AUTHOR);
 
					tr.top += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
					tr.top += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 
					SetDParam(0, selected_info->GetVersion());
 
					DrawString(tr, STR_AI_LIST_VERSION);
 
					tr.top += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
					tr.top += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 
					if (!selected_info->GetURL().empty()) {
 
						SetDParamStr(0, selected_info->GetURL());
 
						DrawString(tr, STR_AI_LIST_URL);
 
						tr.top += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
						tr.top += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 
					}
 
					SetDParamStr(0, selected_info->GetDescription());
 
					DrawStringMultiLine(tr, STR_JUST_RAW_STRING, TC_WHITE);
 
@@ -346,7 +346,7 @@ struct ScriptSettingsWindow : public Win
 
	{
 
		if (widget != WID_SCRS_BACKGROUND) return;
 

	
 
		this->line_height = std::max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL) + padding.height;
 
		this->line_height = std::max(SETTING_BUTTON_HEIGHT, GetCharacterHeight(FS_NORMAL)) + padding.height;
 

	
 
		resize->width = 1;
 
		resize->height = this->line_height;
 
@@ -369,7 +369,7 @@ struct ScriptSettingsWindow : public Win
 

	
 
		int y = r.top;
 
		int button_y_offset = (this->line_height - SETTING_BUTTON_HEIGHT) / 2;
 
		int text_y_offset = (this->line_height - FONT_HEIGHT_NORMAL) / 2;
 
		int text_y_offset = (this->line_height - GetCharacterHeight(FS_NORMAL)) / 2;
 
		for (; this->vscroll->IsVisible(i) && it != visible_settings.end(); i++, it++) {
 
			const ScriptConfigItem &config_item = **it;
 
			int current_value = config->GetSetting((config_item).name);
 
@@ -793,7 +793,7 @@ struct ScriptDebugWindow : public Window
 
	void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
 
	{
 
		if (widget == WID_SCRD_LOG_PANEL) {
 
			resize->height = FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
			resize->height = GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 
			size->height = 14 * resize->height + WidgetDimensions::scaled.framerect.Vertical();
 
		}
 
	}
src/settings_gui.cpp
Show inline comments
 
@@ -1350,7 +1350,7 @@ void SettingEntry::DrawSetting(GameSetti
 
				editable && value != (sd->flags & SF_GUI_0_IS_SPECIAL ? 0 : sd->min), editable && (uint32_t)value != sd->max);
 
	}
 
	this->SetValueDParams(1, value);
 
	DrawString(text_left, text_right, y + (SETTING_HEIGHT - FONT_HEIGHT_NORMAL) / 2, sd->str, highlight ? TC_WHITE : TC_LIGHT_BLUE);
 
	DrawString(text_left, text_right, y + (SETTING_HEIGHT - GetCharacterHeight(FS_NORMAL)) / 2, sd->str, highlight ? TC_WHITE : TC_LIGHT_BLUE);
 
}
 

	
 
/* == SettingsContainer methods == */
 
@@ -1673,7 +1673,7 @@ void SettingsPage::DrawSetting(GameSetti
 
{
 
	bool rtl = _current_text_dir == TD_RTL;
 
	DrawSprite((this->folded ? SPR_CIRCLE_FOLDED : SPR_CIRCLE_UNFOLDED), PAL_NONE, rtl ? right - _circle_size.width : left, y + (SETTING_HEIGHT - _circle_size.height) / 2);
 
	DrawString(rtl ? left : left + _circle_size.width + WidgetDimensions::scaled.hsep_normal, rtl ? right - _circle_size.width - WidgetDimensions::scaled.hsep_normal : right, y + (SETTING_HEIGHT - FONT_HEIGHT_NORMAL) / 2, this->title, TC_ORANGE);
 
	DrawString(rtl ? left : left + _circle_size.width + WidgetDimensions::scaled.hsep_normal, rtl ? right - _circle_size.width - WidgetDimensions::scaled.hsep_normal : right, y + (SETTING_HEIGHT - GetCharacterHeight(FS_NORMAL)) / 2, this->title, TC_ORANGE);
 
}
 

	
 
/** Construct settings tree */
 
@@ -2078,7 +2078,7 @@ struct GameSettingsWindow : Window {
 
	{
 
		switch (widget) {
 
			case WID_GS_OPTIONSPANEL:
 
				resize->height = SETTING_HEIGHT = std::max({(int)_circle_size.height, SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL}) + WidgetDimensions::scaled.vsep_normal;
 
				resize->height = SETTING_HEIGHT = std::max({(int)_circle_size.height, SETTING_BUTTON_HEIGHT, GetCharacterHeight(FS_NORMAL)}) + WidgetDimensions::scaled.vsep_normal;
 
				resize->width = 1;
 

	
 
				size->height = 5 * resize->height + WidgetDimensions::scaled.framerect.Vertical();
 
@@ -2094,7 +2094,7 @@ struct GameSettingsWindow : Window {
 
					SetDParam(0, setting_types[i]);
 
					size->width = std::max(size->width, GetStringBoundingBox(STR_CONFIG_SETTING_TYPE).width + padding.width);
 
				}
 
				size->height = 2 * FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal +
 
				size->height = 2 * GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal +
 
						std::max(size->height, GetSettingsTree().GetMaxHelpHeight(size->width));
 
				break;
 
			}
 
@@ -2138,7 +2138,7 @@ struct GameSettingsWindow : Window {
 
		/* Draw the 'some search results are hidden' notice. */
 
		if (this->warn_missing != WHR_NONE) {
 
			SetDParam(0, _game_settings_restrict_dropdown[this->filter.min_cat]);
 
			DrawStringMultiLine(panel.WithHeight(this->warn_lines * FONT_HEIGHT_NORMAL), warn_str, TC_FROMSTRING, SA_CENTER);
 
			DrawStringMultiLine(panel.WithHeight(this->warn_lines * GetCharacterHeight(FS_NORMAL)), warn_str, TC_FROMSTRING, SA_CENTER);
 
		}
 
	}
 

	
 
@@ -2209,11 +2209,11 @@ struct GameSettingsWindow : Window {
 
						default: NOT_REACHED();
 
					}
 
					DrawString(tr, STR_CONFIG_SETTING_TYPE);
 
					tr.top += FONT_HEIGHT_NORMAL;
 
					tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
					this->last_clicked->SetValueDParams(0, sd->def);
 
					DrawString(tr, STR_CONFIG_SETTING_DEFAULT_VALUE);
 
					tr.top += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
					tr.top += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 

	
 
					DrawStringMultiLine(tr, this->last_clicked->GetHelpText(), TC_WHITE);
 
				}
src/ship_gui.cpp
Show inline comments
 
@@ -67,13 +67,13 @@ void DrawShipDetails(const Vehicle *v, c
 
	SetDParam(1, v->build_year);
 
	SetDParam(2, v->value);
 
	DrawString(r.left, r.right, y, STR_VEHICLE_INFO_BUILT_VALUE);
 
	y += FONT_HEIGHT_NORMAL;
 
	y += GetCharacterHeight(FS_NORMAL);
 

	
 
	SetDParam(0, v->cargo_type);
 
	SetDParam(1, v->cargo_cap);
 
	SetDParam(4, GetCargoSubtypeText(v));
 
	DrawString(r.left, r.right, y, STR_VEHICLE_INFO_CAPACITY);
 
	y += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
	y += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 

	
 
	StringID str = STR_VEHICLE_DETAILS_CARGO_EMPTY;
 
	if (v->cargo.StoredCount() > 0) {
 
@@ -83,7 +83,7 @@ void DrawShipDetails(const Vehicle *v, c
 
		str = STR_VEHICLE_DETAILS_CARGO_FROM;
 
	}
 
	DrawString(r.left, r.right, y, str);
 
	y += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
 
	y += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
 

	
 
	/* Draw Transfer credits text */
 
	SetDParam(0, v->cargo.GetFeederShare());
src/signs_gui.cpp
Show inline comments
 
@@ -197,7 +197,7 @@ struct SignListWindow : Window, SignList
 
		switch (widget) {
 
			case WID_SIL_LIST: {
 
				Rect tr = r.Shrink(WidgetDimensions::scaled.framerect);
 
				uint text_offset_y = (this->resize.step_height - FONT_HEIGHT_NORMAL + 1) / 2;
 
				uint text_offset_y = (this->resize.step_height - GetCharacterHeight(FS_NORMAL) + 1) / 2;
 
				/* No signs? */
 
				if (this->vscroll->GetCount() == 0) {
 
					DrawString(tr.left, tr.right, tr.top + text_offset_y, STR_STATION_LIST_NONE);
 
@@ -269,7 +269,7 @@ struct SignListWindow : Window, SignList
 
			case WID_SIL_LIST: {
 
				Dimension spr_dim = GetSpriteSize(SPR_COMPANY_ICON);
 
				this->text_offset = WidgetDimensions::scaled.frametext.left + spr_dim.width + 2; // 2 pixels space between icon and the sign text.
 
				resize->height = std::max<uint>(FONT_HEIGHT_NORMAL, spr_dim.height + 2);
 
				resize->height = std::max<uint>(GetCharacterHeight(FS_NORMAL), spr_dim.height + 2);
 
				Dimension d = {(uint)(this->text_offset + WidgetDimensions::scaled.frametext.right), padding.height + 5 * resize->height};
 
				*size = maxdim(*size, d);
 
				break;
src/smallmap_gui.cpp
Show inline comments
 
@@ -714,7 +714,7 @@ protected:
 
	inline uint GetLegendHeight(uint num_columns) const
 
	{
 
		return WidgetDimensions::scaled.framerect.Vertical() +
 
				this->GetNumberRowsLegend(num_columns) * FONT_HEIGHT_SMALL;
 
				this->GetNumberRowsLegend(num_columns) * GetCharacterHeight(FS_SMALL);
 
	}
 

	
 
	/**
 
@@ -994,7 +994,7 @@ protected:
 
			/* Check if the town sign is within bounds */
 
			if (x + t->cache.sign.width_small > dpi->left &&
 
					x < dpi->left + dpi->width &&
 
					y + FONT_HEIGHT_SMALL > dpi->top &&
 
					y + GetCharacterHeight(FS_SMALL) > dpi->top &&
 
					y < dpi->top + dpi->height) {
 
				/* And draw it. */
 
				SetDParam(0, t->index);
 
@@ -1350,7 +1350,7 @@ protected:
 
	int GetPositionOnLegend(Point pt)
 
	{
 
		const NWidgetBase *wi = this->GetWidget<NWidgetBase>(WID_SM_LEGEND);
 
		uint line = (pt.y - wi->pos_y - WidgetDimensions::scaled.framerect.top) / FONT_HEIGHT_SMALL;
 
		uint line = (pt.y - wi->pos_y - WidgetDimensions::scaled.framerect.top) / GetCharacterHeight(FS_SMALL);
 
		uint columns = this->GetNumberColumnsLegend(wi->current_x);
 
		uint number_of_rows = this->GetNumberRowsLegend(columns);
 
		if (line >= number_of_rows) return -1;
 
@@ -1515,7 +1515,7 @@ public:
 
		}
 

	
 
		/* Width of the legend blob. */
 
		this->legend_width = (FONT_HEIGHT_SMALL - ScaleGUITrad(1)) * 8 / 5;
 
		this->legend_width = (GetCharacterHeight(FS_SMALL) - ScaleGUITrad(1)) * 8 / 5;
 

	
 
		/* The width of a column is the minimum width of all texts + the size of the blob + some spacing */
 
		this->column_width = min_width + WidgetDimensions::scaled.hsep_normal + this->legend_width + WidgetDimensions::scaled.framerect.Horizontal();
 
@@ -1553,7 +1553,7 @@ public:
 
				uint number_of_rows = this->GetNumberRowsLegend(columns);
 
				bool rtl = _current_text_dir == TD_RTL;
 
				uint i = 0; // Row counter for industry legend.
 
				uint row_height = FONT_HEIGHT_SMALL;
 
				uint row_height = GetCharacterHeight(FS_SMALL);
 
				int padding = ScaleGUITrad(1);
 

	
 
				Rect origin = r.WithWidth(this->column_width, rtl).Shrink(WidgetDimensions::scaled.framerect).WithHeight(row_height);
src/station_gui.cpp
Show inline comments
 
@@ -407,7 +407,7 @@ public:
 
			}
 

	
 
			case WID_STL_LIST:
 
				resize->height = std::max(FONT_HEIGHT_NORMAL, FONT_HEIGHT_SMALL + ScaleGUITrad(3));
 
				resize->height = std::max(GetCharacterHeight(FS_NORMAL), GetCharacterHeight(FS_SMALL) + ScaleGUITrad(3));
 
				size->height = padding.height + 5 * resize->height;
 

	
 
				/* Determine appropriate width for mini station rating graph */
 
@@ -466,7 +466,7 @@ public:
 

	
 
					SetDParam(0, st->index);
 
					SetDParam(1, st->facilities);
 
					int x = DrawString(tr.left, tr.right, tr.top + (line_height - FONT_HEIGHT_NORMAL) / 2, STR_STATION_LIST_STATION);
 
					int x = DrawString(tr.left, tr.right, tr.top + (line_height - GetCharacterHeight(FS_NORMAL)) / 2, STR_STATION_LIST_STATION);
 
					x += rtl ? -text_spacing : text_spacing;
 

	
 
					/* show cargo waiting and station ratings */
 
@@ -492,7 +492,7 @@ public:
 
				}
 

	
 
				if (this->vscroll->GetCount() == 0) { // company has no stations
 
					DrawString(tr.left, tr.right, tr.top + (line_height - FONT_HEIGHT_NORMAL) / 2, STR_STATION_LIST_NONE);
 
					DrawString(tr.left, tr.right, tr.top + (line_height - GetCharacterHeight(FS_NORMAL)) / 2, STR_STATION_LIST_NONE);
 
					return;
 
				}
 
				break;
 
@@ -506,7 +506,7 @@ public:
 
					br = br.Translate(cg_ofst, cg_ofst);
 
					GfxFillRect(br, cs->rating_colour);
 
					TextColour tc = GetContrastColour(cs->rating_colour);
 
					DrawString(br.left, br.right, CenterBounds(br.top, br.bottom, FONT_HEIGHT_SMALL), cs->abbrev, tc, SA_HOR_CENTER, false, FS_SMALL);
 
					DrawString(br.left, br.right, CenterBounds(br.top, br.bottom, GetCharacterHeight(FS_SMALL)), cs->abbrev, tc, SA_HOR_CENTER, false, FS_SMALL);
 
				}
 
				break;
 
		}
 
@@ -1385,13 +1385,13 @@ struct StationViewWindow : public Window
 
	{
 
		switch (widget) {
 
			case WID_SV_WAITING:
 
				resize->height = FONT_HEIGHT_NORMAL;
 
				resize->height = GetCharacterHeight(FS_NORMAL);
 
				size->height = 4 * resize->height + padding.height;
 
				this->expand_shrink_width = std::max(GetStringBoundingBox("-").width, GetStringBoundingBox("+").width);
 
				break;
 

	
 
			case WID_SV_ACCEPT_RATING_LIST:
 
				size->height = ((this->GetWidget<NWidgetCore>(WID_SV_ACCEPTS_RATINGS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON) ? this->accepts_lines : this->rating_lines) * FONT_HEIGHT_NORMAL + padding.height;
 
				size->height = ((this->GetWidget<NWidgetCore>(WID_SV_ACCEPTS_RATINGS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON) ? this->accepts_lines : this->rating_lines) * GetCharacterHeight(FS_NORMAL) + padding.height;
 
				break;
 

	
 
			case WID_SV_CLOSE_AIRPORT:
 
@@ -1763,7 +1763,7 @@ struct StationViewWindow : public Window
 

	
 
			if (pos > -maxrows && pos <= 0) {
 
				StringID str = STR_EMPTY;
 
				int y = r.top - pos * FONT_HEIGHT_NORMAL;
 
				int y = r.top - pos * GetCharacterHeight(FS_NORMAL);
 
				SetDParam(0, cargo);
 
				SetDParam(1, cd->GetCount());
 

	
 
@@ -1836,7 +1836,7 @@ struct StationViewWindow : public Window
 

	
 
		SetDParam(0, GetAcceptanceMask(st));
 
		int bottom = DrawStringMultiLine(tr.left, tr.right, tr.top, INT32_MAX, STR_STATION_VIEW_ACCEPTS_CARGO);
 
		return CeilDiv(bottom - r.top - WidgetDimensions::scaled.framerect.top, FONT_HEIGHT_NORMAL);
 
		return CeilDiv(bottom - r.top - WidgetDimensions::scaled.framerect.top, GetCharacterHeight(FS_NORMAL));
 
	}
 

	
 
	/**
 
@@ -1857,7 +1857,7 @@ struct StationViewWindow : public Window
 
		}
 

	
 
		DrawString(tr, STR_STATION_VIEW_SUPPLY_RATINGS_TITLE);
 
		tr.top += FONT_HEIGHT_NORMAL;
 
		tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
		for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
 
			const GoodsEntry *ge = &st->goods[cs->Index()];
 
@@ -1869,9 +1869,9 @@ struct StationViewWindow : public Window
 
			SetDParam(2, STR_CARGO_RATING_APPALLING + (ge->rating >> 5));
 
			SetDParam(3, ToPercent8(ge->rating));
 
			DrawString(tr.Indent(WidgetDimensions::scaled.hsep_indent, rtl), STR_STATION_VIEW_CARGO_SUPPLY_RATING);
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 
		}
 
		return CeilDiv(tr.top - r.top - WidgetDimensions::scaled.framerect.top, FONT_HEIGHT_NORMAL);
 
		return CeilDiv(tr.top - r.top - WidgetDimensions::scaled.framerect.top, GetCharacterHeight(FS_NORMAL));
 
	}
 

	
 
	/**
 
@@ -1939,7 +1939,7 @@ struct StationViewWindow : public Window
 
					nwi->SetDataTip(STR_STATION_VIEW_RATINGS_BUTTON, STR_STATION_VIEW_RATINGS_TOOLTIP); // Switch to ratings view.
 
					height_change = this->accepts_lines - this->rating_lines;
 
				}
 
				this->ReInit(0, height_change * FONT_HEIGHT_NORMAL);
 
				this->ReInit(0, height_change * GetCharacterHeight(FS_NORMAL));
 
				break;
 
			}
 

	
src/statusbar_gui.cpp
Show inline comments
 
@@ -112,7 +112,7 @@ struct StatusBarWindow : Window {
 
	void DrawWidget(const Rect &r, int widget) const override
 
	{
 
		Rect tr = r.Shrink(WidgetDimensions::scaled.framerect, RectPadding::zero);
 
		tr.top = CenterBounds(r.top, r.bottom, FONT_HEIGHT_NORMAL);
 
		tr.top = CenterBounds(r.top, r.bottom, GetCharacterHeight(FS_NORMAL));
 
		switch (widget) {
 
			case WID_S_LEFT:
 
				/* Draw the date */
src/story_gui.cpp
Show inline comments
 
@@ -287,7 +287,7 @@ protected:
 
		int height = 0;
 

	
 
		/* Title lines */
 
		height += FONT_HEIGHT_NORMAL; // Date always use exactly one line.
 
		height += GetCharacterHeight(FS_NORMAL); // Date always use exactly one line.
 
		SetDParamStr(0, !page->title.empty() ? page->title : this->selected_generic_title);
 
		height += GetStringHeight(STR_STORY_BOOK_TITLE, max_width);
 

	
 
@@ -404,7 +404,7 @@ protected:
 
		StoryPage *page = this->GetSelPage();
 
		if (page == nullptr) return;
 
		int max_width = GetAvailablePageContentWidth();
 
		int element_dist = FONT_HEIGHT_NORMAL;
 
		int element_dist = GetCharacterHeight(FS_NORMAL);
 

	
 
		/* Make space for the header */
 
		int main_y = GetHeadHeight(max_width) + element_dist;
 
@@ -425,7 +425,7 @@ protected:
 

	
 
			if (fl == ElementFloat::None) {
 
				/* Verify available width */
 
				const int min_required_width = 10 * FONT_HEIGHT_NORMAL;
 
				const int min_required_width = 10 * GetCharacterHeight(FS_NORMAL);
 
				int left_offset = (left_width == 0) ? 0 : (left_width + element_dist);
 
				int right_offset = (right_width == 0) ? 0 : (right_width + element_dist);
 
				if (left_offset + right_offset + min_required_width >= max_width) {
 
@@ -596,7 +596,7 @@ public:
 
	{
 
		this->CreateNestedTree();
 
		this->vscroll = this->GetScrollbar(WID_SB_SCROLLBAR);
 
		this->vscroll->SetStepSize(FONT_HEIGHT_NORMAL);
 
		this->vscroll->SetStepSize(GetCharacterHeight(FS_NORMAL));
 

	
 
		/* Initialize page sort. */
 
		this->story_pages.SetSortFuncs(StoryBookWindow::page_sorter_funcs);
 
@@ -694,7 +694,7 @@ public:
 

	
 
		/* Draw content (now coordinates given to Draw** are local to the new clipping region). */
 
		fr = fr.Translate(-fr.left, -fr.top);
 
		int line_height = FONT_HEIGHT_NORMAL;
 
		int line_height = GetCharacterHeight(FS_NORMAL);
 
		const int scrollpos = this->vscroll->GetPosition();
 
		int y_offset = -scrollpos;
 

	
 
@@ -756,7 +756,7 @@ public:
 
		if (widget != WID_SB_SEL_PAGE && widget != WID_SB_PAGE_PANEL) return;
 

	
 
		Dimension d;
 
		d.height = FONT_HEIGHT_NORMAL;
 
		d.height = GetCharacterHeight(FS_NORMAL);
 
		d.width = 0;
 

	
 
		switch (widget) {
src/subsidy_gui.cpp
Show inline comments
 
@@ -130,7 +130,7 @@ struct SubsidyListWindow : Window {
 
		if (widget != WID_SUL_PANEL) return;
 
		Dimension d = maxdim(GetStringBoundingBox(STR_SUBSIDIES_OFFERED_TITLE), GetStringBoundingBox(STR_SUBSIDIES_SUBSIDISED_TITLE));
 

	
 
		resize->height = FONT_HEIGHT_NORMAL;
 
		resize->height = GetCharacterHeight(FS_NORMAL);
 

	
 
		d.height *= 5;
 
		d.width += WidgetDimensions::scaled.framerect.Horizontal();
 
@@ -151,7 +151,7 @@ struct SubsidyListWindow : Window {
 
		const int cap = this->vscroll->GetCapacity();
 

	
 
		/* Section for drawing the offered subsidies */
 
		if (IsInsideMM(pos, 0, cap)) DrawString(tr.left, tr.right, tr.top + pos * FONT_HEIGHT_NORMAL, STR_SUBSIDIES_OFFERED_TITLE);
 
		if (IsInsideMM(pos, 0, cap)) DrawString(tr.left, tr.right, tr.top + pos * GetCharacterHeight(FS_NORMAL), STR_SUBSIDIES_OFFERED_TITLE);
 
		pos++;
 

	
 
		uint num = 0;
 
@@ -161,7 +161,7 @@ struct SubsidyListWindow : Window {
 
					/* Displays the two offered towns */
 
					SetupSubsidyDecodeParam(s, SubsidyDecodeParamType::Gui);
 
					SetDParam(7, TimerGameCalendar::date - ymd.day + s->remaining * 32);
 
					DrawString(tr.left, tr.right, tr.top + pos * FONT_HEIGHT_NORMAL, STR_SUBSIDIES_OFFERED_FROM_TO);
 
					DrawString(tr.left, tr.right, tr.top + pos * GetCharacterHeight(FS_NORMAL), STR_SUBSIDIES_OFFERED_FROM_TO);
 
				}
 
				pos++;
 
				num++;
 
@@ -169,13 +169,13 @@ struct SubsidyListWindow : Window {
 
		}
 

	
 
		if (num == 0) {
 
			if (IsInsideMM(pos, 0, cap)) DrawString(tr.left, tr.right, tr.top + pos * FONT_HEIGHT_NORMAL, STR_SUBSIDIES_NONE);
 
			if (IsInsideMM(pos, 0, cap)) DrawString(tr.left, tr.right, tr.top + pos * GetCharacterHeight(FS_NORMAL), STR_SUBSIDIES_NONE);
 
			pos++;
 
		}
 

	
 
		/* Section for drawing the already granted subsidies */
 
		pos++;
 
		if (IsInsideMM(pos, 0, cap)) DrawString(tr.left, tr.right, tr.top + pos * FONT_HEIGHT_NORMAL, STR_SUBSIDIES_SUBSIDISED_TITLE);
 
		if (IsInsideMM(pos, 0, cap)) DrawString(tr.left, tr.right, tr.top + pos * GetCharacterHeight(FS_NORMAL), STR_SUBSIDIES_SUBSIDISED_TITLE);
 
		pos++;
 
		num = 0;
 

	
 
@@ -187,7 +187,7 @@ struct SubsidyListWindow : Window {
 
					SetDParam(8, TimerGameCalendar::date - ymd.day + s->remaining * 32);
 

	
 
					/* Displays the two connected stations */
 
					DrawString(tr.left, tr.right, tr.top + pos * FONT_HEIGHT_NORMAL, STR_SUBSIDIES_SUBSIDISED_FROM_TO);
 
					DrawString(tr.left, tr.right, tr.top + pos * GetCharacterHeight(FS_NORMAL), STR_SUBSIDIES_SUBSIDISED_FROM_TO);
 
				}
 
				pos++;
 
				num++;
 
@@ -195,7 +195,7 @@ struct SubsidyListWindow : Window {
 
		}
 

	
 
		if (num == 0) {
 
			if (IsInsideMM(pos, 0, cap)) DrawString(tr.left, tr.right, tr.top + pos * FONT_HEIGHT_NORMAL, STR_SUBSIDIES_NONE);
 
			if (IsInsideMM(pos, 0, cap)) DrawString(tr.left, tr.right, tr.top + pos * GetCharacterHeight(FS_NORMAL), STR_SUBSIDIES_NONE);
 
			pos++;
 
		}
 
	}
src/textfile_gui.cpp
Show inline comments
 
@@ -112,7 +112,7 @@ uint TextfileWindow::ReflowContent()
 
		int max_width = this->GetWidget<NWidgetCore>(WID_TF_BACKGROUND)->current_x - WidgetDimensions::scaled.frametext.Horizontal();
 
		for (auto &line : this->lines) {
 
			line.top = height;
 
			height += GetStringHeight(line.text, max_width, FS_MONO) / FONT_HEIGHT_MONO;
 
			height += GetStringHeight(line.text, max_width, FS_MONO) / GetCharacterHeight(FS_MONO);
 
			line.bottom = height;
 
		}
 
	}
 
@@ -130,7 +130,7 @@ uint TextfileWindow::GetContentHeight()
 
{
 
	switch (widget) {
 
		case WID_TF_BACKGROUND:
 
			resize->height = FONT_HEIGHT_MONO;
 
			resize->height = GetCharacterHeight(FS_MONO);
 

	
 
			size->height = 4 * resize->height + WidgetDimensions::scaled.frametext.Vertical(); // At least 4 lines are visible.
 
			size->width = std::max(200u, size->width); // At least 200 pixels wide.
 
@@ -301,7 +301,7 @@ void TextfileWindow::CheckHyperlinkClick
 
	if (this->links.empty()) return;
 

	
 
	/* Which line was clicked. */
 
	const int clicked_row = this->GetRowFromWidget(pt.y, WID_TF_BACKGROUND, WidgetDimensions::scaled.frametext.top, FONT_HEIGHT_MONO) + this->GetScrollbar(WID_TF_VSCROLLBAR)->GetPosition();
 
	const int clicked_row = this->GetRowFromWidget(pt.y, WID_TF_BACKGROUND, WidgetDimensions::scaled.frametext.top, GetCharacterHeight(FS_MONO)) + this->GetScrollbar(WID_TF_VSCROLLBAR)->GetPosition();
 
	size_t line_index;
 
	size_t subline;
 
	if (IsWidgetLowered(WID_TF_WRAPTEXT)) {
 
@@ -311,7 +311,7 @@ void TextfileWindow::CheckHyperlinkClick
 
		subline = clicked_row - it->top;
 
		Debug(misc, 4, "TextfileWindow check hyperlink: clicked_row={}, line_index={}, line.top={}, subline={}", clicked_row, line_index, it->top, subline);
 
	} else {
 
		line_index = clicked_row / FONT_HEIGHT_MONO;
 
		line_index = clicked_row / GetCharacterHeight(FS_MONO);
 
		subline = 0;
 
	}
 

	
 
@@ -560,7 +560,7 @@ void TextfileWindow::AfterLoadMarkdown()
 

	
 
	/* Draw content (now coordinates given to DrawString* are local to the new clipping region). */
 
	fr = fr.Translate(-fr.left, -fr.top);
 
	int line_height = FONT_HEIGHT_MONO;
 
	int line_height = GetCharacterHeight(FS_MONO);
 
	int pos = this->vscroll->GetPosition();
 
	int cap = this->vscroll->GetCapacity();
 

	
src/timetable_gui.cpp
Show inline comments
 
@@ -200,12 +200,12 @@ struct TimetableWindow : Window {
 

	
 
			case WID_VT_ARRIVAL_DEPARTURE_SELECTION:
 
			case WID_VT_TIMETABLE_PANEL:
 
				resize->height = FONT_HEIGHT_NORMAL;
 
				resize->height = GetCharacterHeight(FS_NORMAL);
 
				size->height = 8 * resize->height + padding.height;
 
				break;
 

	
 
			case WID_VT_SUMMARY_PANEL:
 
				size->height = 2 * FONT_HEIGHT_NORMAL + padding.height;
 
				size->height = 2 * GetCharacterHeight(FS_NORMAL) + padding.height;
 
				break;
 
		}
 
	}
 
@@ -411,7 +411,7 @@ struct TimetableWindow : Window {
 
			}
 

	
 
			i++;
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 
		}
 
	}
 

	
 
@@ -470,7 +470,7 @@ struct TimetableWindow : Window {
 
					DrawString(tr.left, tr.right, tr.top, STR_TIMETABLE_DEPARTURE, i == selected ? TC_WHITE : TC_BLACK);
 
				}
 
			}
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 
		}
 
	}
 

	
 
@@ -488,7 +488,7 @@ struct TimetableWindow : Window {
 
			SetTimetableParams(0, 1, total_time);
 
			DrawString(tr, v->orders->IsCompleteTimetable() ? STR_TIMETABLE_TOTAL_TIME : STR_TIMETABLE_TOTAL_TIME_INCOMPLETE);
 
		}
 
		tr.top += FONT_HEIGHT_NORMAL;
 
		tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
		if (v->timetable_start != 0) {
 
			/* We are running towards the first station so we can start the
src/toolbar_gui.cpp
Show inline comments
 
@@ -149,7 +149,7 @@ public:
 

	
 
	uint Height() const override
 
	{
 
		return std::max(std::max(this->icon_size.height, this->lock_size.height) + WidgetDimensions::scaled.imgbtn.Vertical(), (uint)FONT_HEIGHT_NORMAL);
 
		return std::max(std::max(this->icon_size.height, this->lock_size.height) + WidgetDimensions::scaled.imgbtn.Vertical(), (uint)GetCharacterHeight(FS_NORMAL));
 
	}
 

	
 
	void Draw(const Rect &r, bool sel, Colours) const override
 
@@ -162,7 +162,7 @@ public:
 

	
 
		Rect tr = r.Shrink(WidgetDimensions::scaled.dropdowntext, RectPadding::zero);
 
		int icon_y = CenterBounds(r.top, r.bottom, icon_size.height);
 
		int text_y = CenterBounds(r.top, r.bottom, FONT_HEIGHT_NORMAL);
 
		int text_y = CenterBounds(r.top, r.bottom, GetCharacterHeight(FS_NORMAL));
 
		int lock_y = CenterBounds(r.top, r.bottom, lock_size.height);
 

	
 
		DrawCompanyIcon(company, tr.WithWidth(this->icon_size.width, rtl).left, icon_y);
 
@@ -2368,11 +2368,11 @@ struct ScenarioEditorToolbarWindow : Win
 
		switch (widget) {
 
			case WID_TE_SPACER: {
 
				int height = r.Height();
 
				if (height > 2 * FONT_HEIGHT_NORMAL) {
 
					DrawString(r.left, r.right, height / 2 - FONT_HEIGHT_NORMAL, STR_SCENEDIT_TOOLBAR_OPENTTD, TC_FROMSTRING, SA_HOR_CENTER);
 
				if (height > 2 * GetCharacterHeight(FS_NORMAL)) {
 
					DrawString(r.left, r.right, height / 2 - GetCharacterHeight(FS_NORMAL), STR_SCENEDIT_TOOLBAR_OPENTTD, TC_FROMSTRING, SA_HOR_CENTER);
 
					DrawString(r.left, r.right, height / 2, STR_SCENEDIT_TOOLBAR_SCENARIO_EDITOR, TC_FROMSTRING, SA_HOR_CENTER);
 
				} else {
 
					DrawString(r.left, r.right, (height - FONT_HEIGHT_NORMAL) / 2, STR_SCENEDIT_TOOLBAR_SCENARIO_EDITOR, TC_FROMSTRING, SA_HOR_CENTER);
 
					DrawString(r.left, r.right, (height - GetCharacterHeight(FS_NORMAL)) / 2, STR_SCENEDIT_TOOLBAR_SCENARIO_EDITOR, TC_FROMSTRING, SA_HOR_CENTER);
 
				}
 
				break;
 
			}
src/town_gui.cpp
Show inline comments
 
@@ -151,7 +151,7 @@ public:
 
	{
 
		Rect r = this->GetWidget<NWidgetBase>(WID_TA_RATING_INFO)->GetCurrentRect().Shrink(WidgetDimensions::scaled.framerect);
 

	
 
		int text_y_offset      = (this->resize.step_height - FONT_HEIGHT_NORMAL) / 2;
 
		int text_y_offset      = (this->resize.step_height - GetCharacterHeight(FS_NORMAL)) / 2;
 
		int icon_y_offset      = (this->resize.step_height - this->icon_size.height) / 2;
 
		int exclusive_y_offset = (this->resize.step_height - this->exclusive_size.height) / 2;
 

	
 
@@ -204,7 +204,7 @@ public:
 
		Rect r = this->GetWidget<NWidgetBase>(WID_TA_COMMAND_LIST)->GetCurrentRect().Shrink(WidgetDimensions::scaled.framerect);
 

	
 
		DrawString(r, STR_LOCAL_AUTHORITY_ACTIONS_TITLE);
 
		r.top += FONT_HEIGHT_NORMAL;
 
		r.top += GetCharacterHeight(FS_NORMAL);
 

	
 
		/* Draw list of actions */
 
		for (int i = 0; i < TACT_COUNT; i++) {
 
@@ -217,7 +217,7 @@ public:
 
			if (this->sel_index == i) action_colour = TC_WHITE;
 

	
 
			DrawString(r, STR_LOCAL_AUTHORITY_ACTION_SMALL_ADVERTISING_CAMPAIGN + i, action_colour);
 
			r.top += FONT_HEIGHT_NORMAL;
 
			r.top += GetCharacterHeight(FS_NORMAL);
 
		}
 
	}
 

	
 
@@ -260,7 +260,7 @@ public:
 
			}
 

	
 
			case WID_TA_COMMAND_LIST:
 
				size->height = (TACT_COUNT + 1) * FONT_HEIGHT_NORMAL + padding.height;
 
				size->height = (TACT_COUNT + 1) * GetCharacterHeight(FS_NORMAL) + padding.height;
 
				size->width = GetStringBoundingBox(STR_LOCAL_AUTHORITY_ACTIONS_TITLE).width;
 
				for (uint i = 0; i < TACT_COUNT; i++ ) {
 
					size->width = std::max(size->width, GetStringBoundingBox(STR_LOCAL_AUTHORITY_ACTION_SMALL_ADVERTISING_CAMPAIGN + i).width + padding.width);
 
@@ -269,7 +269,7 @@ public:
 
				break;
 

	
 
			case WID_TA_RATING_INFO:
 
				resize->height = std::max({this->icon_size.height + WidgetDimensions::scaled.vsep_normal, this->exclusive_size.height + WidgetDimensions::scaled.vsep_normal, (uint)FONT_HEIGHT_NORMAL});
 
				resize->height = std::max({this->icon_size.height + WidgetDimensions::scaled.vsep_normal, this->exclusive_size.height + WidgetDimensions::scaled.vsep_normal, (uint)GetCharacterHeight(FS_NORMAL)});
 
				size->height = 9 * resize->height + padding.height;
 
				break;
 
		}
 
@@ -291,7 +291,7 @@ public:
 
			}
 

	
 
			case WID_TA_COMMAND_LIST: {
 
				int y = this->GetRowFromWidget(pt.y, WID_TA_COMMAND_LIST, 1, FONT_HEIGHT_NORMAL) - 1;
 
				int y = this->GetRowFromWidget(pt.y, WID_TA_COMMAND_LIST, 1, GetCharacterHeight(FS_NORMAL)) - 1;
 

	
 
				y = GetNthSetBit(y);
 
				if (y >= 0) {
 
@@ -392,19 +392,19 @@ public:
 
		SetDParam(0, this->town->cache.population);
 
		SetDParam(1, this->town->cache.num_houses);
 
		DrawString(tr, STR_TOWN_VIEW_POPULATION_HOUSES);
 
		tr.top += FONT_HEIGHT_NORMAL;
 
		tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
		SetDParam(0, 1 << CT_PASSENGERS);
 
		SetDParam(1, this->town->supplied[CT_PASSENGERS].old_act);
 
		SetDParam(2, this->town->supplied[CT_PASSENGERS].old_max);
 
		DrawString(tr, STR_TOWN_VIEW_CARGO_LAST_MONTH_MAX);
 
		tr.top += FONT_HEIGHT_NORMAL;
 
		tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
		SetDParam(0, 1 << CT_MAIL);
 
		SetDParam(1, this->town->supplied[CT_MAIL].old_act);
 
		SetDParam(2, this->town->supplied[CT_MAIL].old_max);
 
		DrawString(tr, STR_TOWN_VIEW_CARGO_LAST_MONTH_MAX);
 
		tr.top += FONT_HEIGHT_NORMAL;
 
		tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
		bool first = true;
 
		for (int i = TE_BEGIN; i < TE_END; i++) {
 
@@ -414,7 +414,7 @@ public:
 

	
 
			if (first) {
 
				DrawString(tr, STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH);
 
				tr.top += FONT_HEIGHT_NORMAL;
 
				tr.top += GetCharacterHeight(FS_NORMAL);
 
				first = false;
 
			}
 

	
 
@@ -449,16 +449,16 @@ public:
 
				SetDParam(3, this->town->goal[i]);
 
			}
 
			DrawString(tr.Indent(20, rtl), string);
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 
		}
 

	
 
		if (HasBit(this->town->flags, TOWN_IS_GROWING)) {
 
			SetDParam(0, RoundDivSU(this->town->growth_rate + 1, Ticks::DAY_TICKS));
 
			DrawString(tr, this->town->fund_buildings_months == 0 ? STR_TOWN_VIEW_TOWN_GROWS_EVERY : STR_TOWN_VIEW_TOWN_GROWS_EVERY_FUNDED);
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 
		} else {
 
			DrawString(tr, STR_TOWN_VIEW_TOWN_GROW_STOPPED);
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 
		}
 

	
 
		/* only show the town noise, if the noise option is activated. */
 
@@ -466,7 +466,7 @@ public:
 
			SetDParam(0, this->town->noise_reached);
 
			SetDParam(1, this->town->MaxTownNoise());
 
			DrawString(tr, STR_TOWN_VIEW_NOISE_IN_TOWN);
 
			tr.top += FONT_HEIGHT_NORMAL;
 
			tr.top += GetCharacterHeight(FS_NORMAL);
 
		}
 

	
 
		if (!this->town->text.empty()) {
 
@@ -525,7 +525,7 @@ public:
 
	 */
 
	uint GetDesiredInfoHeight(int width) const
 
	{
 
		uint aimed_height = 3 * FONT_HEIGHT_NORMAL;
 
		uint aimed_height = 3 * GetCharacterHeight(FS_NORMAL);
 

	
 
		bool first = true;
 
		for (int i = TE_BEGIN; i < TE_END; i++) {
 
@@ -534,14 +534,14 @@ public:
 
			if (this->town->goal[i] == TOWN_GROWTH_DESERT && (GetTropicZone(this->town->xy) != TROPICZONE_DESERT || this->town->cache.population <= 60)) continue;
 

	
 
			if (first) {
 
				aimed_height += FONT_HEIGHT_NORMAL;
 
				aimed_height += GetCharacterHeight(FS_NORMAL);
 
				first = false;
 
			}
 
			aimed_height += FONT_HEIGHT_NORMAL;
 
			aimed_height += GetCharacterHeight(FS_NORMAL);
 
		}
 
		aimed_height += FONT_HEIGHT_NORMAL;
 
		aimed_height += GetCharacterHeight(FS_NORMAL);
 

	
 
		if (_settings_game.economy.station_noise_level) aimed_height += FONT_HEIGHT_NORMAL;
 
		if (_settings_game.economy.station_noise_level) aimed_height += GetCharacterHeight(FS_NORMAL);
 

	
 
		if (!this->town->text.empty()) {
 
			SetDParamStr(0, this->town->text);
 
@@ -850,7 +850,7 @@ public:
 

	
 
					SetDParam(0, t->index);
 
					SetDParam(1, t->cache.population);
 
					DrawString(tr.left, tr.right, tr.top + (this->resize.step_height - FONT_HEIGHT_NORMAL) / 2, GetTownString(t));
 
					DrawString(tr.left, tr.right, tr.top + (this->resize.step_height - GetCharacterHeight(FS_NORMAL)) / 2, GetTownString(t));
 

	
 
					tr.top += this->resize.step_height;
 
					if (++n == this->vscroll->GetCapacity()) break; // max number of towns in 1 window
src/train_gui.cpp
Show inline comments
 
@@ -354,7 +354,7 @@ void DrawTrainDetails(const Train *v, co
 
	bool rtl = _current_text_dir == TD_RTL;
 
	int line_height = r.Height();
 
	int sprite_y_offset = line_height / 2;
 
	int text_y_offset = (line_height - FONT_HEIGHT_NORMAL) / 2;
 
	int text_y_offset = (line_height - GetCharacterHeight(FS_NORMAL)) / 2;
 

	
 
	/* draw the first 3 details tabs */
 
	if (det_tab != TDW_TAB_TOTALS) {
src/vehicle_gui.cpp
Show inline comments
 
@@ -597,12 +597,12 @@ static void DrawVehicleRefitWindow(const
 
			if (has_subtypes) {
 
				if (refit.subtype != UINT8_MAX) {
 
					/* Draw tree lines */
 
					int ycenter = tr.top + FONT_HEIGHT_NORMAL / 2;
 
					int ycenter = tr.top + GetCharacterHeight(FS_NORMAL) / 2;
 
					GfxDrawLine(iconcenter, tr.top - WidgetDimensions::scaled.matrix.top, iconcenter, (&refit == &pair.second.back()) ? ycenter : tr.top - WidgetDimensions::scaled.matrix.top + delta - 1, linecolour);
 
					GfxDrawLine(iconcenter, ycenter, iconinner, ycenter, linecolour);
 
				} else {
 
					/* Draw expand/collapse icon */
 
					DrawSprite((sel != nullptr && sel->cargo == refit.cargo) ? SPR_CIRCLE_UNFOLDED : SPR_CIRCLE_FOLDED, PAL_NONE, iconleft, tr.top + (FONT_HEIGHT_NORMAL - iconheight) / 2);
 
					DrawSprite((sel != nullptr && sel->cargo == refit.cargo) ? SPR_CIRCLE_UNFOLDED : SPR_CIRCLE_FOLDED, PAL_NONE, iconleft, tr.top + (GetCharacterHeight(FS_NORMAL) - iconheight) / 2);
 
				}
 
			}
 

	
 
@@ -857,7 +857,7 @@ struct RefitWindow : public Window {
 
	{
 
		switch (widget) {
 
			case WID_VR_MATRIX:
 
				resize->height = FONT_HEIGHT_NORMAL + padding.height;
 
				resize->height = GetCharacterHeight(FS_NORMAL) + padding.height;
 
				size->height = resize->height * 8;
 
				break;
 

	
 
@@ -1558,7 +1558,7 @@ static void DrawSmallOrderList(const Veh
 
			SetDParam(0, order->GetDestination());
 
			DrawString(left + l_offset, right - r_offset, y, STR_STATION_NAME, TC_BLACK, SA_LEFT, false, FS_SMALL);
 

	
 
			y += FONT_HEIGHT_SMALL;
 
			y += GetCharacterHeight(FS_SMALL);
 
			if (++i == 4) break;
 
		}
 

	
 
@@ -1583,7 +1583,7 @@ static void DrawSmallOrderList(const Ord
 
			SetDParam(0, order->GetDestination());
 
			DrawString(left + l_offset, right - r_offset, y, STR_STATION_NAME, TC_BLACK, SA_LEFT, false, FS_SMALL);
 

	
 
			y += FONT_HEIGHT_SMALL;
 
			y += GetCharacterHeight(FS_SMALL);
 
			if (++i == 4) break;
 
		}
 
		order = order->next;
 
@@ -1617,9 +1617,9 @@ void DrawVehicleImage(const Vehicle *v, 
 
uint GetVehicleListHeight(VehicleType type, uint divisor)
 
{
 
	/* Name + vehicle + profit */
 
	uint base = ScaleGUITrad(GetVehicleHeight(type)) + 2 * FONT_HEIGHT_SMALL + WidgetDimensions::scaled.matrix.Vertical();
 
	uint base = ScaleGUITrad(GetVehicleHeight(type)) + 2 * GetCharacterHeight(FS_SMALL) + WidgetDimensions::scaled.matrix.Vertical();
 
	/* Drawing of the 4 small orders + profit*/
 
	if (type >= VEH_SHIP) base = std::max(base, 5U * FONT_HEIGHT_SMALL + WidgetDimensions::scaled.matrix.Vertical());
 
	if (type >= VEH_SHIP) base = std::max(base, 5U * GetCharacterHeight(FS_SMALL) + WidgetDimensions::scaled.matrix.Vertical());
 

	
 
	if (divisor == 1) return base;
 

	
 
@@ -1658,16 +1658,16 @@ void BaseVehicleListWindow::DrawVehicleL
 

	
 
		SetDParam(0, vehgroup.GetDisplayProfitThisYear());
 
		SetDParam(1, vehgroup.GetDisplayProfitLastYear());
 
		DrawString(tr.left, tr.right, ir.bottom - FONT_HEIGHT_SMALL - WidgetDimensions::scaled.framerect.bottom, STR_VEHICLE_LIST_PROFIT_THIS_YEAR_LAST_YEAR);
 

	
 
		DrawVehicleProfitButton(vehgroup.GetOldestVehicleAge(), vehgroup.GetDisplayProfitLastYear(), vehgroup.NumVehicles(), vehicle_button_x, ir.top + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal);
 
		DrawString(tr.left, tr.right, ir.bottom - GetCharacterHeight(FS_SMALL) - WidgetDimensions::scaled.framerect.bottom, STR_VEHICLE_LIST_PROFIT_THIS_YEAR_LAST_YEAR);
 

	
 
		DrawVehicleProfitButton(vehgroup.GetOldestVehicleAge(), vehgroup.GetDisplayProfitLastYear(), vehgroup.NumVehicles(), vehicle_button_x, ir.top + GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal);
 

	
 
		switch (this->grouping) {
 
			case GB_NONE: {
 
				const Vehicle *v = vehgroup.GetSingleVehicle();
 

	
 
				if (HasBit(v->vehicle_flags, VF_PATHFINDER_LOST)) {
 
					DrawSprite(SPR_WARNING_SIGN, PAL_NONE, vehicle_button_x, ir.top + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal + profit.height);
 
					DrawSprite(SPR_WARNING_SIGN, PAL_NONE, vehicle_button_x, ir.top + GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal + profit.height);
 
				}
 

	
 
				DrawVehicleImage(v, {image_left, ir.top, image_right, ir.bottom}, selected_vehicle, EIT_IN_LIST, 0);
 
@@ -2341,13 +2341,13 @@ struct VehicleDetailsWindow : Window {
 
		uint desired_height;
 
		if (v->HasArticulatedPart()) {
 
			/* An articulated RV has its text drawn under the sprite instead of after it, hence 15 pixels extra. */
 
			desired_height = ScaleGUITrad(15) + 3 * FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal * 2;
 
			desired_height = ScaleGUITrad(15) + 3 * GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal * 2;
 
			/* Add space for the cargo amount for each part. */
 
			for (const Vehicle *u = v; u != nullptr; u = u->Next()) {
 
				if (u->cargo_cap != 0) desired_height += FONT_HEIGHT_NORMAL;
 
				if (u->cargo_cap != 0) desired_height += GetCharacterHeight(FS_NORMAL);
 
			}
 
		} else {
 
			desired_height = 4 * FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal * 2;
 
			desired_height = 4 * GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal * 2;
 
		}
 
		return desired_height;
 
	}
 
@@ -2357,7 +2357,7 @@ struct VehicleDetailsWindow : Window {
 
		switch (widget) {
 
			case WID_VD_TOP_DETAILS: {
 
				Dimension dim = { 0, 0 };
 
				size->height = 4 * FONT_HEIGHT_NORMAL + padding.height;
 
				size->height = 4 * GetCharacterHeight(FS_NORMAL) + padding.height;
 

	
 
				for (uint i = 0; i < 4; i++) SetDParamMaxValue(i, INT16_MAX);
 
				static const StringID info_strings[] = {
 
@@ -2384,11 +2384,11 @@ struct VehicleDetailsWindow : Window {
 
						break;
 

	
 
					case VEH_SHIP:
 
						size->height = 4 * FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal * 2 + padding.height;
 
						size->height = 4 * GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal * 2 + padding.height;
 
						break;
 

	
 
					case VEH_AIRCRAFT:
 
						size->height = 5 * FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal * 2 + padding.height;
 
						size->height = 5 * GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal * 2 + padding.height;
 
						break;
 

	
 
					default:
 
@@ -2398,7 +2398,7 @@ struct VehicleDetailsWindow : Window {
 
			}
 

	
 
			case WID_VD_MATRIX:
 
				resize->height = std::max<uint>(ScaleGUITrad(14), FONT_HEIGHT_NORMAL + padding.height);
 
				resize->height = std::max<uint>(ScaleGUITrad(14), GetCharacterHeight(FS_NORMAL) + padding.height);
 
				size->height = 4 * resize->height;
 
				break;
 

	
 
@@ -2421,7 +2421,7 @@ struct VehicleDetailsWindow : Window {
 
					GetStringBoundingBox(STR_VEHICLE_DETAILS_SERVICING_INTERVAL_PERCENT).width,
 
					GetStringBoundingBox(STR_VEHICLE_DETAILS_SERVICING_INTERVAL_DAYS).width
 
				) + padding.width;
 
				size->height = FONT_HEIGHT_NORMAL + padding.height;
 
				size->height = GetCharacterHeight(FS_NORMAL) + padding.height;
 
				break;
 
		}
 
	}
 
@@ -2478,7 +2478,7 @@ struct VehicleDetailsWindow : Window {
 
				SetDParam(2, TimerGameCalendar::DateToYear(v->max_age));
 
				SetDParam(3, v->GetDisplayRunningCost());
 
				DrawString(tr, STR_VEHICLE_INFO_AGE_RUNNING_COST_YR);
 
				tr.top += FONT_HEIGHT_NORMAL;
 
				tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
				/* Draw max speed */
 
				StringID string;
 
@@ -2510,7 +2510,7 @@ struct VehicleDetailsWindow : Window {
 
					}
 
				}
 
				DrawString(tr, string);
 
				tr.top += FONT_HEIGHT_NORMAL;
 
				tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
				/* Draw profit */
 
				SetDParam(0, v->GetDisplayProfitThisYear());
 
@@ -2521,7 +2521,7 @@ struct VehicleDetailsWindow : Window {
 
				} else {
 
					DrawString(tr, STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR);
 
				}
 
				tr.top += FONT_HEIGHT_NORMAL;
 
				tr.top += GetCharacterHeight(FS_NORMAL);
 

	
 
				/* Draw breakdown & reliability */
 
				SetDParam(0, ToPercent16(v->reliability));
 
@@ -2559,7 +2559,7 @@ struct VehicleDetailsWindow : Window {
 
				Rect tr = r.Shrink(WidgetDimensions::scaled.framerect);
 
				SetDParam(0, v->GetServiceInterval());
 
				SetDParam(1, v->date_of_last_service);
 
				DrawString(tr.left, tr.right, CenterBounds(r.top, r.bottom, FONT_HEIGHT_NORMAL),
 
				DrawString(tr.left, tr.right, CenterBounds(r.top, r.bottom, GetCharacterHeight(FS_NORMAL)),
 
						v->ServiceIntervalIsPercent() ? STR_VEHICLE_DETAILS_SERVICING_INTERVAL_PERCENT : STR_VEHICLE_DETAILS_SERVICING_INTERVAL_DAYS);
 
				break;
 
			}
 
@@ -2917,7 +2917,7 @@ public:
 
		const Vehicle *v = Vehicle::Get(this->window_number);
 
		switch (widget) {
 
			case WID_VV_START_STOP:
 
				size->height = std::max<uint>({size->height, (uint)FONT_HEIGHT_NORMAL, GetScaledSpriteSize(SPR_WARNING_SIGN).height, GetScaledSpriteSize(SPR_FLAG_VEH_STOPPED).height, GetScaledSpriteSize(SPR_FLAG_VEH_RUNNING).height}) + padding.height;
 
				size->height = std::max<uint>({size->height, (uint)GetCharacterHeight(FS_NORMAL), GetScaledSpriteSize(SPR_WARNING_SIGN).height, GetScaledSpriteSize(SPR_FLAG_VEH_STOPPED).height, GetScaledSpriteSize(SPR_FLAG_VEH_RUNNING).height}) + padding.height;
 
				break;
 

	
 
			case WID_VV_FORCE_PROCEED:
 
@@ -3070,7 +3070,7 @@ public:
 
		SpriteID image = ((v->vehstatus & VS_STOPPED) != 0) ? SPR_FLAG_VEH_STOPPED : (HasBit(v->vehicle_flags, VF_PATHFINDER_LOST)) ? SPR_WARNING_SIGN : SPR_FLAG_VEH_RUNNING;
 
		DrawSpriteIgnorePadding(image, PAL_NONE, tr.WithWidth(icon_width, rtl), false, SA_CENTER);
 
		tr = tr.Indent(icon_width + WidgetDimensions::scaled.imgbtn.Horizontal(), rtl);
 
		DrawString(tr.left, tr.right, CenterBounds(tr.top, tr.bottom, FONT_HEIGHT_NORMAL), str, text_colour, SA_HOR_CENTER);
 
		DrawString(tr.left, tr.right, CenterBounds(tr.top, tr.bottom, GetCharacterHeight(FS_NORMAL)), str, text_colour, SA_HOR_CENTER);
 
	}
 

	
 
	void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
src/viewport.cpp
Show inline comments
 
@@ -1303,7 +1303,7 @@ void ViewportAddString(const DrawPixelIn
 
	int right  = left + dpi->width;
 
	int bottom = top + dpi->height;
 

	
 
	int sign_height     = ScaleByZoom(WidgetDimensions::scaled.fullbevel.top + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.fullbevel.bottom, dpi->zoom);
 
	int sign_height     = ScaleByZoom(WidgetDimensions::scaled.fullbevel.top + GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.fullbevel.bottom, dpi->zoom);
 
	int sign_half_width = ScaleByZoom((small ? sign->width_small : sign->width_normal) / 2, dpi->zoom);
 

	
 
	if (bottom < sign->top ||
 
@@ -1328,7 +1328,7 @@ void ViewportAddString(const DrawPixelIn
 
static Rect ExpandRectWithViewportSignMargins(Rect r, ZoomLevel zoom)
 
{
 
	/* Pessimistically always use normal font, but also assume small font is never larger in either dimension */
 
	const int fh = FONT_HEIGHT_NORMAL;
 
	const int fh = GetCharacterHeight(FS_NORMAL);
 
	const int max_tw = _viewport_sign_maxwidth / 2 + 1;
 
	const int expand_y = ScaleByZoom(WidgetDimensions::scaled.fullbevel.top + fh + WidgetDimensions::scaled.fullbevel.bottom, zoom);
 
	const int expand_x = ScaleByZoom(WidgetDimensions::scaled.fullbevel.left + max_tw + WidgetDimensions::scaled.fullbevel.right, zoom);
 
@@ -1484,7 +1484,7 @@ void ViewportSign::MarkDirty(ZoomLevel m
 
		zoomlevels[zoom].left   = this->center - ScaleByZoom(this->width_normal / 2 + 1, zoom);
 
		zoomlevels[zoom].top    = this->top    - ScaleByZoom(1, zoom);
 
		zoomlevels[zoom].right  = this->center + ScaleByZoom(this->width_normal / 2 + 1, zoom);
 
		zoomlevels[zoom].bottom = this->top    + ScaleByZoom(WidgetDimensions::scaled.fullbevel.top + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.fullbevel.bottom + 1, zoom);
 
		zoomlevels[zoom].bottom = this->top    + ScaleByZoom(WidgetDimensions::scaled.fullbevel.top + GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.fullbevel.bottom + 1, zoom);
 
	}
 

	
 
	for (const Window *w : Window::Iterate()) {
 
@@ -1698,7 +1698,7 @@ static void ViewportDrawStrings(ZoomLeve
 
		int w = GB(ss.width, 0, 15);
 
		int x = UnScaleByZoom(ss.x, zoom);
 
		int y = UnScaleByZoom(ss.y, zoom);
 
		int h = WidgetDimensions::scaled.fullbevel.top + (small ? FONT_HEIGHT_SMALL : FONT_HEIGHT_NORMAL) + WidgetDimensions::scaled.fullbevel.bottom;
 
		int h = WidgetDimensions::scaled.fullbevel.top + (small ? GetCharacterHeight(FS_SMALL) : GetCharacterHeight(FS_NORMAL)) + WidgetDimensions::scaled.fullbevel.bottom;
 

	
 
		if (ss.colour != INVALID_COLOUR) {
 
			if (IsTransparencySet(TO_SIGNS) && ss.string_id != STR_WHITE_SIGN) {
 
@@ -2131,7 +2131,7 @@ static bool CheckClickOnViewportSign(con
 
{
 
	bool small = (vp->zoom >= ZOOM_LVL_OUT_16X);
 
	int sign_half_width = ScaleByZoom((small ? sign->width_small : sign->width_normal) / 2, vp->zoom);
 
	int sign_height = ScaleByZoom(WidgetDimensions::scaled.fullbevel.top + (small ? FONT_HEIGHT_SMALL : FONT_HEIGHT_NORMAL) + WidgetDimensions::scaled.fullbevel.bottom, vp->zoom);
 
	int sign_height = ScaleByZoom(WidgetDimensions::scaled.fullbevel.top + (small ? GetCharacterHeight(FS_SMALL) : GetCharacterHeight(FS_NORMAL)) + WidgetDimensions::scaled.fullbevel.bottom, vp->zoom);
 

	
 
	return y >= sign->top && y < sign->top + sign_height &&
 
			x >= sign->center - sign_half_width && x < sign->center + sign_half_width;
src/widget.cpp
Show inline comments
 
@@ -693,7 +693,7 @@ static inline void DrawFrame(const Rect 
 

	
 
	/* If the frame has text, adjust the top bar to fit half-way through */
 
	Rect inner = r.Shrink(ScaleGUITrad(1));
 
	if (str != STR_NULL) inner.top = r.top + FONT_HEIGHT_NORMAL / 2;
 
	if (str != STR_NULL) inner.top = r.top + GetCharacterHeight(FS_NORMAL) / 2;
 

	
 
	Rect outer  = inner.Expand(WidgetDimensions::scaled.bevel);
 
	Rect inside = inner.Shrink(WidgetDimensions::scaled.bevel);
 
@@ -851,14 +851,14 @@ static inline void DrawButtonDropdown(co
 
		DrawImageButtons(r.WithWidth(dd_width, true), WWT_DROPDOWN, colour, clicked_dropdown, SPR_ARROW_DOWN, SA_CENTER);
 
		if (str != STR_NULL) {
 
			int o = clicked_button ? WidgetDimensions::scaled.pressed : 0;
 
			DrawString(r.left + WidgetDimensions::scaled.dropdowntext.left + o, r.right - dd_width - WidgetDimensions::scaled.dropdowntext.right + o, CenterBounds(r.top, r.bottom, FONT_HEIGHT_NORMAL) + o, str, TC_BLACK, align);
 
			DrawString(r.left + WidgetDimensions::scaled.dropdowntext.left + o, r.right - dd_width - WidgetDimensions::scaled.dropdowntext.right + o, CenterBounds(r.top, r.bottom, GetCharacterHeight(FS_NORMAL)) + o, str, TC_BLACK, align);
 
		}
 
	} else {
 
		DrawFrameRect(r.left + dd_width, r.top, r.right, r.bottom, colour, clicked_button ? FR_LOWERED : FR_NONE);
 
		DrawImageButtons(r.WithWidth(dd_width, false), WWT_DROPDOWN, colour, clicked_dropdown, SPR_ARROW_DOWN, SA_CENTER);
 
		if (str != STR_NULL) {
 
			int o = clicked_button ? WidgetDimensions::scaled.pressed : 0;
 
			DrawString(r.left + dd_width + WidgetDimensions::scaled.dropdowntext.left + o, r.right - WidgetDimensions::scaled.dropdowntext.right + o, CenterBounds(r.top, r.bottom, FONT_HEIGHT_NORMAL) + o, str, TC_BLACK, align);
 
			DrawString(r.left + dd_width + WidgetDimensions::scaled.dropdowntext.left + o, r.right - WidgetDimensions::scaled.dropdowntext.right + o, CenterBounds(r.top, r.bottom, GetCharacterHeight(FS_NORMAL)) + o, str, TC_BLACK, align);
 
		}
 
	}
 
}
 
@@ -1166,7 +1166,7 @@ void NWidgetResizeBase::SetResize(uint r
 
bool NWidgetResizeBase::UpdateMultilineWidgetSize(const std::string &str, int max_lines)
 
{
 
	int y = GetStringHeight(str, this->current_x);
 
	if (y > max_lines * FONT_HEIGHT_NORMAL) {
 
	if (y > max_lines * GetCharacterHeight(FS_NORMAL)) {
 
		/* Text at the current width is too tall, so try to guess a better width. */
 
		Dimension d = GetStringBoundingBox(str);
 
		d.height *= max_lines;
 
@@ -2293,7 +2293,7 @@ void NWidgetBackground::SetupSmallestSiz
 
		if (this->type == WWT_FRAME) {
 
			/* Account for the size of the frame's text if that exists */
 
			this->child->padding     = WidgetDimensions::scaled.frametext;
 
			this->child->padding.top = std::max<uint8_t>(WidgetDimensions::scaled.frametext.top, this->widget_data != STR_NULL ? FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.frametext.top / 2 : 0);
 
			this->child->padding.top = std::max<uint8_t>(WidgetDimensions::scaled.frametext.top, this->widget_data != STR_NULL ? GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.frametext.top / 2 : 0);
 

	
 
			this->smallest_x += this->child->padding.Horizontal();
 
			this->smallest_y += this->child->padding.Vertical();
src/widgets/dropdown.cpp
Show inline comments
 
@@ -80,7 +80,7 @@ DropDownListIconItem::DropDownListIconIt
 

	
 
uint DropDownListIconItem::Height() const
 
{
 
	return std::max(this->dim.height, (uint)FONT_HEIGHT_NORMAL);
 
	return std::max(this->dim.height, (uint)GetCharacterHeight(FS_NORMAL));
 
}
 

	
 
uint DropDownListIconItem::Width() const
 
@@ -94,7 +94,7 @@ void DropDownListIconItem::Draw(const Re
 
	Rect ir = r.Shrink(WidgetDimensions::scaled.dropdowntext);
 
	Rect tr = ir.Indent(this->dim.width + WidgetDimensions::scaled.hsep_normal, rtl);
 
	DrawSprite(this->sprite, this->pal, ir.WithWidth(this->dim.width, rtl).left, CenterBounds(r.top, r.bottom, this->sprite_y));
 
	DrawString(tr.left, tr.right, CenterBounds(r.top, r.bottom, FONT_HEIGHT_NORMAL), this->String(), sel ? TC_WHITE : TC_BLACK);
 
	DrawString(tr.left, tr.right, CenterBounds(r.top, r.bottom, GetCharacterHeight(FS_NORMAL)), this->String(), sel ? TC_WHITE : TC_BLACK);
 
}
 

	
 
void DropDownListIconItem::SetDimension(Dimension d)
src/widgets/dropdown_type.h
Show inline comments
 
@@ -27,7 +27,7 @@ public:
 
	virtual ~DropDownListItem() = default;
 

	
 
	virtual bool Selectable() const { return false; }
 
	virtual uint Height() const { return FONT_HEIGHT_NORMAL; }
 
	virtual uint Height() const { return GetCharacterHeight(FS_NORMAL); }
 
	virtual uint Width() const { return 0; }
 
	virtual void Draw(const Rect &r, bool sel, Colours bg_colour) const;
 
};
src/widgets/slider.cpp
Show inline comments
 
@@ -29,7 +29,7 @@ static const int SLIDER_WIDTH = 3;
 
void DrawSliderWidget(Rect r, int min_value, int max_value, int value, const std::map<int, StringID> &labels)
 
{
 
	/* Allow space for labels. We assume they are in the small font. */
 
	if (!labels.empty()) r.bottom -= FONT_HEIGHT_SMALL + WidgetDimensions::scaled.hsep_normal;
 
	if (!labels.empty()) r.bottom -= GetCharacterHeight(FS_SMALL) + WidgetDimensions::scaled.hsep_normal;
 

	
 
	max_value -= min_value;
 

	
src/window.cpp
Show inline comments
 
@@ -1612,7 +1612,7 @@ static Point GetAutoPlacePosition(int wi
 
	 */
 
	int left = rtl ? _screen.width - width : 0, top = toolbar_y;
 
	int offset_x = rtl ? -(int)NWidgetLeaf::closebox_dimension.width : (int)NWidgetLeaf::closebox_dimension.width;
 
	int offset_y = std::max<int>(NWidgetLeaf::closebox_dimension.height, FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.captiontext.Vertical());
 
	int offset_y = std::max<int>(NWidgetLeaf::closebox_dimension.height, GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.captiontext.Vertical());
 

	
 
restart:
 
	for (const Window *w : Window::Iterate()) {
 
@@ -1678,7 +1678,7 @@ static Point LocalGetWindowPlacement(con
 
			 *  - Y position: closebox of parent + closebox of child + statusbar
 
			 *  - X position: closebox on left/right, resizebox on right/left (depending on ltr/rtl)
 
			 */
 
			int indent_y = std::max<int>(NWidgetLeaf::closebox_dimension.height, FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.captiontext.Vertical());
 
			int indent_y = std::max<int>(NWidgetLeaf::closebox_dimension.height, GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.captiontext.Vertical());
 
			if (w->top + 3 * indent_y < _screen.height) {
 
				pt.y = w->top + indent_y;
 
				int indent_close = NWidgetLeaf::closebox_dimension.width;
0 comments (0 inline, 0 general)