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(...)`.
This commit is contained in:
Peter Nelson
2023-11-21 19:04:24 +00:00
committed by GitHub
parent 96ec9c1b47
commit c18a1494b7
57 changed files with 369 additions and 381 deletions

View File

@@ -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) {