2019-12-24 02:35:24 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
2020-01-01 20:24:46 -05:00
|
|
|
#include <stdint.h>
|
2021-08-08 12:27:10 +10:00
|
|
|
#include <stddef.h>
|
2019-12-23 17:43:10 -05:00
|
|
|
|
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
|
|
|
|
2019-12-23 17:43:10 -05:00
|
|
|
namespace PortabilityLayer
|
|
|
|
|
{
|
|
|
|
|
class RenderedFont
|
2020-01-01 20:24:46 -05:00
|
|
|
{
|
2019-12-23 17:43:10 -05:00
|
|
|
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;
|
2020-01-18 18:20:16 -05:00
|
|
|
virtual bool IsAntiAliased() const = 0;
|
2019-12-23 17:43:10 -05:00
|
|
|
|
2020-01-01 20:24:46 -05:00
|
|
|
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;
|
2019-12-23 17:43:10 -05:00
|
|
|
};
|
|
|
|
|
}
|
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);
|
|
|
|
|
}
|