Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/FontMetrics.cpp
/* Copyright (C) 2013 Wildfire Games. | /* Copyright (C) 2022 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
Show All 11 Lines | |||||
#include "graphics/Font.h" | #include "graphics/Font.h" | ||||
#include "graphics/FontManager.h" | #include "graphics/FontManager.h" | ||||
#include "ps/Filesystem.h" | #include "ps/Filesystem.h" | ||||
#include "ps/CLogger.h" | #include "ps/CLogger.h" | ||||
#include "renderer/Renderer.h" | #include "renderer/Renderer.h" | ||||
CFontMetrics::CFontMetrics(CStrIntern font) | CFontMetrics::CFontMetrics(CStrIntern font) | ||||
{ | { | ||||
if (CRenderer::IsInitialised()) | |||||
m_Font = g_Renderer.GetFontManager().LoadFont(font); | m_Font = g_Renderer.GetFontManager().LoadFont(font); | ||||
} | } | ||||
int CFontMetrics::GetLineSpacing() const | int CFontMetrics::GetLineSpacing() const | ||||
{ | { | ||||
// Return some arbitrary default if the font failed to load, so that the | // Return some arbitrary default if the font failed to load, so that the | ||||
// user of CFontMetrics doesn't have to care about failures | // user of CFontMetrics doesn't have to care about failures | ||||
if (!m_Font) | if (!m_Font) | ||||
return 12; | return 12; | ||||
Show All 24 Lines |
Wildfire Games · Phabricator