Files
Aerofoil/PortabilityLayer/RenderedFont.h

38 lines
997 B
C
Raw Normal View History

2019-12-24 02:35:24 -05:00
#pragma once
#include <stdint.h>
2021-08-08 12:27:10 +10:00
#include <stddef.h>
2020-05-21 05:01:16 -04:00
class PLPasStr;
2020-09-12 14:01:51 -04:00
struct GpRenderedFontMetrics;
struct GpRenderedGlyphMetrics;
2020-05-21 05:01:16 -04:00
namespace PortabilityLayer
{
class RenderedFont
{
public:
2020-09-12 14:01:51 -04:00
virtual bool GetGlyph(unsigned int character, const GpRenderedGlyphMetrics *&outMetricsPtr, const void *&outData) const = 0;
virtual const GpRenderedFontMetrics &GetMetrics() const = 0;
2019-12-24 02:35:24 -05:00
virtual size_t MeasureString(const uint8_t *chars, size_t len) const = 0;
virtual bool IsAntiAliased() const = 0;
virtual void Destroy() = 0;
2020-05-21 05:01:16 -04:00
size_t MeasureCharStr(const char *str, size_t len) const;
size_t MeasurePStr(const PLPasStr &pstr) const;
};
}
2020-05-21 05:01:16 -04:00
#include "PLPasStr.h"
inline size_t PortabilityLayer::RenderedFont::MeasurePStr(const PLPasStr &pstr) const
2020-09-12 14:01:51 -04:00
{
2020-05-21 05:01:16 -04:00
return this->MeasureString(pstr.UChars(), pstr.Length());
}
inline size_t PortabilityLayer::RenderedFont::MeasureCharStr(const char *str, size_t len) const
2020-09-12 14:01:51 -04:00
{
2020-05-21 05:01:16 -04:00
return this->MeasureString(reinterpret_cast<const uint8_t*>(str), len);
}