mirror of https://github.com/OpenRCT2/OpenRCT2.git
Refactor font.c to C++
This commit is contained in:
parent
c2fe90c573
commit
559ec8a404
|
@ -20,7 +20,7 @@
|
|||
#include <openrct2-ui/windows/Window.h>
|
||||
|
||||
#include <openrct2/audio/audio.h>
|
||||
#include <openrct2/drawing/font.h>
|
||||
#include <openrct2/drawing/Font.h>
|
||||
#include <openrct2/interface/widget.h>
|
||||
#include <openrct2/localisation/localisation.h>
|
||||
|
||||
|
|
|
@ -15,16 +15,20 @@
|
|||
#pragma endregion
|
||||
|
||||
#include "../core/Guard.hpp"
|
||||
#include "../core/Util.hpp"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../sprites.h"
|
||||
#include "drawing.h"
|
||||
#include "font.h"
|
||||
#include "Font.h"
|
||||
#include "ttf.h"
|
||||
|
||||
static const sint32 SpriteFontLineHeight[] = { 6, 10, 10, 18 };
|
||||
|
||||
static uint8 _spriteFontCharacterWidths[896];
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
#ifndef NO_TTF
|
||||
TTFFontSetDescriptor *gCurrentTTFFontSet;
|
||||
#endif // NO_TTF
|
||||
|
@ -125,7 +129,7 @@ sint32 font_sprite_get_codepoint_width(uint16 fontSpriteBase, sint32 codepoint)
|
|||
}
|
||||
|
||||
sint32 spriteFontIdx = fontSpriteBase + font_sprite_get_codepoint_offset(codepoint);
|
||||
if (spriteFontIdx < 0 || spriteFontIdx >= countof(_spriteFontCharacterWidths))
|
||||
if (spriteFontIdx < 0 || spriteFontIdx >= (sint32)Util::CountOf(_spriteFontCharacterWidths))
|
||||
{
|
||||
log_warning("Invalid font index %u", spriteFontIdx);
|
||||
spriteFontIdx = 0;
|
||||
|
@ -270,3 +274,5 @@ bool font_supports_string(const utf8 *text, sint32 fontSize)
|
|||
return font_supports_string_sprite(text);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "../common.h"
|
||||
#include "../interface/colour.h"
|
||||
#include "font.h"
|
||||
#include "Font.h"
|
||||
|
||||
typedef struct rct_g1_element {
|
||||
uint8* offset; // 0x00
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "font.h"
|
||||
#include "Font.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#ifndef OPENRCT2_FONTS_H
|
||||
#define OPENRCT2_FONTS_H
|
||||
|
||||
#include "../drawing/font.h"
|
||||
#include "../drawing/Font.h"
|
||||
|
||||
#ifndef NO_TTF
|
||||
extern TTFFontSetDescriptor TTFFontMSGothic;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#endif
|
||||
|
||||
#include "../common.h"
|
||||
#include "../drawing/font.h"
|
||||
#include "../drawing/Font.h"
|
||||
|
||||
enum {
|
||||
LANGUAGE_UNDEFINED,
|
||||
|
|
Loading…
Reference in New Issue