This repository has been archived on 2023-10-28. You can view files and clone it, but cannot push or open issues or pull requests.
frostbite/snowlib/FntDecoder.h
2020-02-06 00:23:46 +00:00

36 lines
793 B
C++

#pragma once
#include "stdint.h"
class Texture;
struct GlyphInfo
{
uint16_t charId;
uint16_t x0;
uint16_t x1;
uint16_t y0;
uint16_t y1;
uint16_t yOffset;
uint16_t width;
uint16_t kernId;
};
struct GlyphKernPair
{
uint16_t glyph1;
uint16_t glyph2;
int16_t kern;
};
class FntDecoder
{
public:
void charsToGlyphsInplace(const unsigned char* font, unsigned short* charsOrGlyphs, int len, int ps2FontAddress);
int charCodeToGlyphId(const unsigned char* font, int charCode, int ps2FontAddress);
GlyphInfo& lookupGlyph(const unsigned char* font, int glyphNum, int ps2FontAddress);
int getCharAdvance(const unsigned char* font, uint16_t glyph, int ps2FontAddress);
int getKernPairAdjust(const unsigned char* font, uint16_t previousGlyph, uint16_t glyph, int ps2FontAddress);
};