Move font API to GpCommon

This commit is contained in:
elasota
2020-09-12 14:01:51 -04:00
parent f07137b52d
commit 987a1dea75
43 changed files with 189 additions and 190 deletions

12
GpCommon/GpFontHandler.h Normal file
View File

@@ -0,0 +1,12 @@
#pragma once
class GpIOStream;
struct IGpFont;
struct IGpFontHandler
{
virtual void Shutdown() = 0;
virtual IGpFont *LoadFont(GpIOStream *stream) = 0;
virtual bool KeepStreamOpen() const = 0;
};

View File

@@ -4,5 +4,5 @@
struct GpFontHandlerProperties
{
EGpFontHandlerType m_type;
EGpFontHandlerType m_type;
};

View File

@@ -0,0 +1,10 @@
#pragma once
#include <stdint.h>
struct GpRenderedFontMetrics
{
int32_t m_ascent;
int32_t m_descent;
int32_t m_linegap;
};

View File

@@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
struct GpRenderedGlyphMetrics
{
size_t m_glyphDataPitch;
uint32_t m_glyphWidth;
uint32_t m_glyphHeight;
int16_t m_bearingX;
int16_t m_bearingY;
int16_t m_advanceX;
};

13
GpCommon/IGpFont.h Normal file
View File

@@ -0,0 +1,13 @@
#pragma once
#include <stdint.h>
struct IGpFontRenderedGlyph;
struct GpRenderedFontMetrics;
struct IGpFont
{
virtual void Destroy() = 0;
virtual IGpFontRenderedGlyph *Render(uint32_t unicodeCodePoint, unsigned int size, bool aa) = 0;
virtual bool GetLineSpacing(unsigned int size, int32_t &outSpacing) = 0;
};

12
GpCommon/IGpFontHandler.h Normal file
View File

@@ -0,0 +1,12 @@
#pragma once
class GpIOStream;
struct IGpFont;
struct IGpFontHandler
{
virtual void Shutdown() = 0;
virtual IGpFont *LoadFont(GpIOStream *stream) = 0;
virtual bool KeepStreamOpen() const = 0;
};

View File

@@ -0,0 +1,10 @@
#pragma once
struct GpRenderedGlyphMetrics;
struct IGpFontRenderedGlyph
{
virtual const GpRenderedGlyphMetrics &GetMetrics() const = 0;
virtual const void *GetData() const = 0;
virtual void Destroy() = 0;
};