mirror of
https://github.com/elasota/Aerofoil.git
synced 2026-02-04 02:28:50 +00:00
Move font API to GpCommon
This commit is contained in:
@@ -28,7 +28,7 @@ GpWindowsGlobals g_gpWindowsGlobals;
|
||||
extern "C" __declspec(dllimport) IGpAudioDriver *GpDriver_CreateAudioDriver_XAudio2(const GpAudioDriverProperties &properties);
|
||||
extern "C" __declspec(dllimport) IGpDisplayDriver *GpDriver_CreateDisplayDriver_D3D11(const GpDisplayDriverProperties &properties);
|
||||
extern "C" __declspec(dllimport) IGpInputDriver *GpDriver_CreateInputDriver_XInput(const GpInputDriverProperties &properties);
|
||||
extern "C" __declspec(dllimport) PortabilityLayer::HostFontHandler *GpDriver_CreateFontHandler_FreeType2(const GpFontHandlerProperties &properties);
|
||||
extern "C" __declspec(dllimport) IGpFontHandler *GpDriver_CreateFontHandler_FreeType2(const GpFontHandlerProperties &properties);
|
||||
|
||||
static void PostMouseEvent(IGpVOSEventQueue *eventQueue, GpMouseEventType_t eventType, GpMouseButton_t button, int32_t x, int32_t y, float pixelScaleX, float pixelScaleY)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "GpBuildVersion.h"
|
||||
#include "HostSystemServices.h"
|
||||
#include "RenderedFont.h"
|
||||
#include "RenderedFontMetrics.h"
|
||||
#include "GpRenderedFontMetrics.h"
|
||||
#include "ResolveCachingColor.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "ScanlineMask.h"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "MainWindow.h"
|
||||
#include "RectUtils.h"
|
||||
#include "RenderedFont.h"
|
||||
#include "RenderedFontMetrics.h"
|
||||
#include "GpRenderedFontMetrics.h"
|
||||
#include "ResolveCachingColor.h"
|
||||
#include "Room.h"
|
||||
#include "Utilities.h"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "ResourceManager.h"
|
||||
#include "ResolveCachingColor.h"
|
||||
#include "RenderedFont.h"
|
||||
#include "RenderedFontMetrics.h"
|
||||
#include "GpRenderedFontMetrics.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
void PL_HostSystemServices_SetInstance(PortabilityLayer::HostSystemServices *instance) override;
|
||||
void PL_HostAudioDriver_SetInstance(IGpAudioDriver *instance) override;
|
||||
void PL_HostLogDriver_SetInstance(IGpLogDriver *instance) override;
|
||||
void PL_HostFontHandler_SetInstance(PortabilityLayer::HostFontHandler *instance) override;
|
||||
void PL_HostFontHandler_SetInstance(IGpFontHandler *instance) override;
|
||||
void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) override;
|
||||
void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) override;
|
||||
bool PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY) override;
|
||||
@@ -79,7 +79,7 @@ void GpAppInterfaceImpl::PL_HostInputDriver_SetInstances(IGpInputDriver *const*
|
||||
PortabilityLayer::HostInputDriver::SetInstances(instances, numInstances);
|
||||
}
|
||||
|
||||
void GpAppInterfaceImpl::PL_HostFontHandler_SetInstance(PortabilityLayer::HostFontHandler *instance)
|
||||
void GpAppInterfaceImpl::PL_HostFontHandler_SetInstance(IGpFontHandler *instance)
|
||||
{
|
||||
PortabilityLayer::HostFontHandler::SetInstance(instance);
|
||||
}
|
||||
|
||||
12
GpCommon/GpFontHandler.h
Normal file
12
GpCommon/GpFontHandler.h
Normal 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;
|
||||
};
|
||||
10
GpCommon/GpRenderedFontMetrics.h
Normal file
10
GpCommon/GpRenderedFontMetrics.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct GpRenderedFontMetrics
|
||||
{
|
||||
int32_t m_ascent;
|
||||
int32_t m_descent;
|
||||
int32_t m_linegap;
|
||||
};
|
||||
15
GpCommon/GpRenderedGlyphMetrics.h
Normal file
15
GpCommon/GpRenderedGlyphMetrics.h
Normal 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
13
GpCommon/IGpFont.h
Normal 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
12
GpCommon/IGpFontHandler.h
Normal 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;
|
||||
};
|
||||
10
GpCommon/IGpFontRenderedGlyph.h
Normal file
10
GpCommon/IGpFontRenderedGlyph.h
Normal 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;
|
||||
};
|
||||
@@ -3,9 +3,10 @@
|
||||
|
||||
#include "CoreDefs.h"
|
||||
#include "GpIOStream.h"
|
||||
#include "HostFont.h"
|
||||
#include "HostFontRenderedGlyph.h"
|
||||
#include "RenderedGlyphMetrics.h"
|
||||
#include "IGpFont.h"
|
||||
#include "IGpFontRenderedGlyph.h"
|
||||
#include "GpRenderedGlyphMetrics.h"
|
||||
#include "IGpFontHandler.h"
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
@@ -16,30 +17,30 @@
|
||||
#include <new>
|
||||
#include <assert.h>
|
||||
|
||||
class GpFontRenderedGlyph_FreeType2 final : public PortabilityLayer::HostFontRenderedGlyph
|
||||
class GpFontRenderedGlyph_FreeType2 final : public IGpFontRenderedGlyph
|
||||
{
|
||||
public:
|
||||
const PortabilityLayer::RenderedGlyphMetrics &GetMetrics() const override;
|
||||
const GpRenderedGlyphMetrics &GetMetrics() const override;
|
||||
const void *GetData() const override;
|
||||
void Destroy() override;
|
||||
|
||||
static GpFontRenderedGlyph_FreeType2 *Create(size_t dataSize, const PortabilityLayer::RenderedGlyphMetrics &metrics);
|
||||
static GpFontRenderedGlyph_FreeType2 *Create(size_t dataSize, const GpRenderedGlyphMetrics &metrics);
|
||||
|
||||
void *GetMutableData();
|
||||
|
||||
private:
|
||||
GpFontRenderedGlyph_FreeType2(void *data, const PortabilityLayer::RenderedGlyphMetrics &metrics);
|
||||
GpFontRenderedGlyph_FreeType2(void *data, const GpRenderedGlyphMetrics &metrics);
|
||||
~GpFontRenderedGlyph_FreeType2();
|
||||
|
||||
void *m_data;
|
||||
PortabilityLayer::RenderedGlyphMetrics m_metrics;
|
||||
GpRenderedGlyphMetrics m_metrics;
|
||||
};
|
||||
|
||||
class GpFont_FreeType2 final : public PortabilityLayer::HostFont
|
||||
class GpFont_FreeType2 final : public IGpFont
|
||||
{
|
||||
public:
|
||||
void Destroy() override;
|
||||
GpFontRenderedGlyph_FreeType2 *Render(uint32_t unicodeCodePoint, unsigned int size, bool aa) override;
|
||||
IGpFontRenderedGlyph *Render(uint32_t unicodeCodePoint, unsigned int size, bool aa) override;
|
||||
bool GetLineSpacing(unsigned int size, int32_t &outSpacing) override;
|
||||
|
||||
static GpFont_FreeType2 *Create(const FT_StreamRec_ &streamRec, GpIOStream *stream);
|
||||
@@ -56,7 +57,7 @@ private:
|
||||
unsigned int m_currentSize;
|
||||
};
|
||||
|
||||
const PortabilityLayer::RenderedGlyphMetrics &GpFontRenderedGlyph_FreeType2::GetMetrics() const
|
||||
const GpRenderedGlyphMetrics &GpFontRenderedGlyph_FreeType2::GetMetrics() const
|
||||
{
|
||||
return m_metrics;
|
||||
}
|
||||
@@ -72,7 +73,7 @@ void GpFontRenderedGlyph_FreeType2::Destroy()
|
||||
free(this);
|
||||
}
|
||||
|
||||
GpFontRenderedGlyph_FreeType2 *GpFontRenderedGlyph_FreeType2::Create(size_t dataSize, const PortabilityLayer::RenderedGlyphMetrics &metrics)
|
||||
GpFontRenderedGlyph_FreeType2 *GpFontRenderedGlyph_FreeType2::Create(size_t dataSize, const GpRenderedGlyphMetrics &metrics)
|
||||
{
|
||||
size_t alignedPrefixSize = (sizeof(GpFontRenderedGlyph_FreeType2) + GP_SYSTEM_MEMORY_ALIGNMENT - 1);
|
||||
alignedPrefixSize -= alignedPrefixSize % GP_SYSTEM_MEMORY_ALIGNMENT;
|
||||
@@ -90,7 +91,7 @@ void *GpFontRenderedGlyph_FreeType2::GetMutableData()
|
||||
}
|
||||
|
||||
|
||||
GpFontRenderedGlyph_FreeType2::GpFontRenderedGlyph_FreeType2(void *data, const PortabilityLayer::RenderedGlyphMetrics &metrics)
|
||||
GpFontRenderedGlyph_FreeType2::GpFontRenderedGlyph_FreeType2(void *data, const GpRenderedGlyphMetrics &metrics)
|
||||
: m_metrics(metrics)
|
||||
, m_data(data)
|
||||
{
|
||||
@@ -106,7 +107,7 @@ void GpFont_FreeType2::Destroy()
|
||||
free(this);
|
||||
}
|
||||
|
||||
GpFontRenderedGlyph_FreeType2 *GpFont_FreeType2::Render(uint32_t unicodeCodePoint, unsigned int size, bool aa)
|
||||
IGpFontRenderedGlyph *GpFont_FreeType2::Render(uint32_t unicodeCodePoint, unsigned int size, bool aa)
|
||||
{
|
||||
if (m_currentSize != size)
|
||||
{
|
||||
@@ -154,7 +155,7 @@ GpFontRenderedGlyph_FreeType2 *GpFont_FreeType2::Render(uint32_t unicodeCodePoin
|
||||
return nullptr; // This should never happen
|
||||
}
|
||||
|
||||
PortabilityLayer::RenderedGlyphMetrics metrics;
|
||||
GpRenderedGlyphMetrics metrics;
|
||||
memset(&metrics, 0, sizeof(metrics));
|
||||
|
||||
metrics.m_bearingX = glyph->metrics.horiBearingX / 64;
|
||||
@@ -303,7 +304,7 @@ GpFontHandler_FreeType2 *GpFontHandler_FreeType2::Create()
|
||||
return fh;
|
||||
}
|
||||
|
||||
PortabilityLayer::HostFont *GpFontHandler_FreeType2::LoadFont(GpIOStream *stream)
|
||||
IGpFont *GpFontHandler_FreeType2::LoadFont(GpIOStream *stream)
|
||||
{
|
||||
FT_StreamRec_ ftStream;
|
||||
memset(&ftStream, 0, sizeof(ftStream));
|
||||
@@ -424,7 +425,7 @@ bool GpFontHandler_FreeType2::Init()
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) PortabilityLayer::HostFontHandler *GpDriver_CreateFontHandler_FreeType2(const GpFontHandlerProperties &properties)
|
||||
extern "C" __declspec(dllexport) IGpFontHandler *GpDriver_CreateFontHandler_FreeType2(const GpFontHandlerProperties &properties)
|
||||
{
|
||||
return GpFontHandler_FreeType2::Create();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "HostFontHandler.h"
|
||||
#include "IGpFontHandler.h"
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_SYSTEM_H
|
||||
@@ -13,10 +13,10 @@ namespace PortabilityLayer
|
||||
class HostFont;
|
||||
}
|
||||
|
||||
class GpFontHandler_FreeType2 final : public PortabilityLayer::HostFontHandler
|
||||
class GpFontHandler_FreeType2 final : public IGpFontHandler
|
||||
{
|
||||
public:
|
||||
PortabilityLayer::HostFont *LoadFont(GpIOStream *stream) override;
|
||||
IGpFont *LoadFont(GpIOStream *stream) override;
|
||||
void Shutdown() override;
|
||||
|
||||
bool KeepStreamOpen() const override;
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\PortabilityLayer.props" />
|
||||
<Import Project="..\FreeTypePublic.props" />
|
||||
<Import Project="..\FreeTypeImport.props" />
|
||||
<Import Project="..\Common.props" />
|
||||
@@ -66,7 +65,6 @@
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\PortabilityLayer.props" />
|
||||
<Import Project="..\FreeTypePublic.props" />
|
||||
<Import Project="..\FreeTypeImport.props" />
|
||||
<Import Project="..\Common.props" />
|
||||
@@ -74,7 +72,6 @@
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\PortabilityLayer.props" />
|
||||
<Import Project="..\FreeTypePublic.props" />
|
||||
<Import Project="..\FreeTypeImport.props" />
|
||||
<Import Project="..\Common.props" />
|
||||
@@ -82,7 +79,6 @@
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\PortabilityLayer.props" />
|
||||
<Import Project="..\FreeTypePublic.props" />
|
||||
<Import Project="..\FreeTypeImport.props" />
|
||||
<Import Project="..\Common.props" />
|
||||
|
||||
@@ -115,7 +115,7 @@ void GpAppEnvironment::SetInputDrivers(IGpInputDriver *const* inputDrivers, size
|
||||
m_numInputDrivers = numDrivers;
|
||||
}
|
||||
|
||||
void GpAppEnvironment::SetFontHandler(PortabilityLayer::HostFontHandler *fontHandler)
|
||||
void GpAppEnvironment::SetFontHandler(IGpFontHandler *fontHandler)
|
||||
{
|
||||
m_fontHandler = fontHandler;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
union HostSuspendCallArgument;
|
||||
class HostFontHandler;
|
||||
class HostVOSEventQueue;
|
||||
}
|
||||
|
||||
@@ -17,6 +16,7 @@ struct IGpDisplayDriver;
|
||||
struct IGpAudioDriver;
|
||||
struct IGpInputDriver;
|
||||
struct IGpFiber;
|
||||
struct IGpFontHandler;
|
||||
|
||||
class GpAppEnvironment
|
||||
{
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
void SetDisplayDriver(IGpDisplayDriver *displayDriver);
|
||||
void SetAudioDriver(IGpAudioDriver *audioDriver);
|
||||
void SetInputDrivers(IGpInputDriver *const* inputDrivers, size_t numDrivers);
|
||||
void SetFontHandler(PortabilityLayer::HostFontHandler *fontHandler);
|
||||
void SetFontHandler(IGpFontHandler *fontHandler);
|
||||
void SetVOSEventQueue(GpVOSEventQueue *eventQueue);
|
||||
|
||||
private:
|
||||
@@ -59,7 +59,7 @@ private:
|
||||
IGpDisplayDriver *m_displayDriver;
|
||||
IGpAudioDriver *m_audioDriver;
|
||||
IGpInputDriver *const* m_inputDrivers;
|
||||
PortabilityLayer::HostFontHandler *m_fontHandler;
|
||||
IGpFontHandler *m_fontHandler;
|
||||
GpVOSEventQueue *m_vosEventQueue;
|
||||
IGpFiber *m_applicationFiber;
|
||||
IGpFiber *m_vosFiber;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
PortabilityLayer::HostFontHandler *GpFontHandlerFactory::CreateFontHandler(const GpFontHandlerProperties &properties)
|
||||
IGpFontHandler *GpFontHandlerFactory::CreateFontHandler(const GpFontHandlerProperties &properties)
|
||||
{
|
||||
assert(properties.m_type < EGpFontHandlerType_Count);
|
||||
|
||||
|
||||
@@ -2,19 +2,16 @@
|
||||
|
||||
#include "EGpFontHandlerType.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class HostFontHandler;
|
||||
}
|
||||
struct IGpFontHandler;
|
||||
|
||||
struct GpFontHandlerProperties;
|
||||
|
||||
class GpFontHandlerFactory
|
||||
{
|
||||
public:
|
||||
typedef PortabilityLayer::HostFontHandler *(*FactoryFunc_t)(const GpFontHandlerProperties &properties);
|
||||
typedef IGpFontHandler *(*FactoryFunc_t)(const GpFontHandlerProperties &properties);
|
||||
|
||||
static PortabilityLayer::HostFontHandler *CreateFontHandler(const GpFontHandlerProperties &properties);
|
||||
static IGpFontHandler *CreateFontHandler(const GpFontHandlerProperties &properties);
|
||||
static void RegisterFontHandlerFactory(EGpFontHandlerType type, FactoryFunc_t func);
|
||||
|
||||
private:
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "GpAppEnvironment.h"
|
||||
#include "IGpAudioDriver.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "IGpFontHandler.h"
|
||||
#include "IGpInputDriver.h"
|
||||
|
||||
#include <string.h>
|
||||
@@ -105,7 +106,7 @@ int GpMain::Run()
|
||||
|
||||
IGpDisplayDriver *displayDriver = GpDisplayDriverFactory::CreateDisplayDriver(ddProps);
|
||||
IGpAudioDriver *audioDriver = GpAudioDriverFactory::CreateAudioDriver(adProps);
|
||||
PortabilityLayer::HostFontHandler *fontHandler = GpFontHandlerFactory::CreateFontHandler(fontProps);
|
||||
IGpFontHandler *fontHandler = GpFontHandlerFactory::CreateFontHandler(fontProps);
|
||||
|
||||
appEnvironment->Init();
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "FontFamily.h"
|
||||
#include "GpIOStream.h"
|
||||
#include "HostFileSystem.h"
|
||||
#include "IGpFontHandler.h"
|
||||
#include "HostFontHandler.h"
|
||||
#include "HostFont.h"
|
||||
#include "IGpFont.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <new>
|
||||
@@ -15,9 +16,9 @@ namespace PortabilityLayer
|
||||
if (!sysFontStream)
|
||||
return;
|
||||
|
||||
PortabilityLayer::HostFontHandler *fontHandler = PortabilityLayer::HostFontHandler::GetInstance();
|
||||
IGpFontHandler *fontHandler = PortabilityLayer::HostFontHandler::GetInstance();
|
||||
|
||||
PortabilityLayer::HostFont *font = fontHandler->LoadFont(sysFontStream);
|
||||
IGpFont *font = fontHandler->LoadFont(sysFontStream);
|
||||
|
||||
if (!fontHandler->KeepStreamOpen())
|
||||
sysFontStream->Close();
|
||||
@@ -49,7 +50,7 @@ namespace PortabilityLayer
|
||||
return m_defaultVariation;
|
||||
}
|
||||
|
||||
PortabilityLayer::HostFont *FontFamily::GetFontForVariation(int variation) const
|
||||
IGpFont *FontFamily::GetFontForVariation(int variation) const
|
||||
{
|
||||
return m_fonts[variation];
|
||||
}
|
||||
@@ -88,7 +89,7 @@ namespace PortabilityLayer
|
||||
{
|
||||
for (unsigned int i = 0; i < kNumVariations; i++)
|
||||
{
|
||||
if (PortabilityLayer::HostFont *font = m_fonts[i])
|
||||
if (IGpFont *font = m_fonts[i])
|
||||
font->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
#include <stdint.h>
|
||||
|
||||
class PLPasStr;
|
||||
struct IGpFont;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class HostFont;
|
||||
|
||||
enum FontFamilyFlags
|
||||
{
|
||||
FontFamilyFlag_None = 0,
|
||||
@@ -27,15 +26,15 @@ namespace PortabilityLayer
|
||||
void SetDefaultVariation(int defaultVariation);
|
||||
|
||||
int GetVariationForFlags(int variation) const;
|
||||
PortabilityLayer::HostFont *GetFontForVariation(int variation) const;
|
||||
PortabilityLayer::FontHacks GetHacksForVariation(int variation) const;
|
||||
IGpFont *GetFontForVariation(int variation) const;
|
||||
FontHacks GetHacksForVariation(int variation) const;
|
||||
|
||||
static FontFamily *Create();
|
||||
void Destroy();
|
||||
|
||||
private:
|
||||
PortabilityLayer::FontHacks m_hacks[kNumVariations];
|
||||
PortabilityLayer::HostFont *m_fonts[kNumVariations];
|
||||
FontHacks m_hacks[kNumVariations];
|
||||
IGpFont *m_fonts[kNumVariations];
|
||||
uint8_t m_defaultVariation;
|
||||
|
||||
FontFamily();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "FontRenderer.h"
|
||||
|
||||
#include "HostFileSystem.h"
|
||||
#include "HostFont.h"
|
||||
#include "IGpFont.h"
|
||||
#include "HostFontHandler.h"
|
||||
#include "GpIOStream.h"
|
||||
#include "RenderedFont.h"
|
||||
@@ -24,7 +24,7 @@ namespace PortabilityLayer
|
||||
FontFamily *GetSystemFont(int textSize, int variationFlags) const override;
|
||||
FontFamily *GetApplicationFont(int textSize, int variationFlags) const override;
|
||||
|
||||
RenderedFont *GetRenderedFont(HostFont *font, int size, bool aa, FontHacks fontHacks) override;
|
||||
RenderedFont *GetRenderedFont(IGpFont *font, int size, bool aa, FontHacks fontHacks) override;
|
||||
RenderedFont *GetRenderedFontFromFamily(FontFamily *font, int size, bool aa, int flags) override;
|
||||
|
||||
static FontManagerImpl *GetInstance();
|
||||
@@ -35,7 +35,7 @@ namespace PortabilityLayer
|
||||
struct CachedRenderedFont
|
||||
{
|
||||
RenderedFont *m_rfont;
|
||||
const HostFont *m_font;
|
||||
const IGpFont *m_font;
|
||||
int m_size;
|
||||
uint32_t m_lastUsage;
|
||||
bool m_aa;
|
||||
@@ -80,7 +80,7 @@ namespace PortabilityLayer
|
||||
if (m_applicationFont)
|
||||
m_applicationFont->Destroy();
|
||||
|
||||
HostFontHandler *hfh = HostFontHandler::GetInstance();
|
||||
IGpFontHandler *hfh = HostFontHandler::GetInstance();
|
||||
|
||||
if (m_systemFont)
|
||||
{
|
||||
@@ -110,7 +110,7 @@ namespace PortabilityLayer
|
||||
return m_applicationFont;
|
||||
}
|
||||
|
||||
RenderedFont *FontManagerImpl::GetRenderedFont(HostFont *font, int size, bool aa, FontHacks fontHacks)
|
||||
RenderedFont *FontManagerImpl::GetRenderedFont(IGpFont *font, int size, bool aa, FontHacks fontHacks)
|
||||
{
|
||||
CachedRenderedFont *newCacheSlot = &m_cachedRenderedFonts[0];
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace PortabilityLayer
|
||||
{
|
||||
const int variation = fontFamily->GetVariationForFlags(flags);
|
||||
|
||||
PortabilityLayer::HostFont *hostFont = fontFamily->GetFontForVariation(variation);
|
||||
IGpFont *hostFont = fontFamily->GetFontForVariation(variation);
|
||||
if (!hostFont)
|
||||
return nullptr;
|
||||
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
#include "FontHacks.h"
|
||||
|
||||
struct IGpFont;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class FontFamily;
|
||||
class HostFont;
|
||||
class RenderedFont;
|
||||
|
||||
class FontManager
|
||||
@@ -17,7 +18,7 @@ namespace PortabilityLayer
|
||||
virtual FontFamily *GetSystemFont(int fontSize, int variationFlags) const = 0;
|
||||
virtual FontFamily *GetApplicationFont(int fontSize, int variationFlags) const = 0;
|
||||
|
||||
virtual RenderedFont *GetRenderedFont(HostFont *font, int size, bool aa, FontHacks fontHacks) = 0;
|
||||
virtual RenderedFont *GetRenderedFont(IGpFont *font, int size, bool aa, FontHacks fontHacks) = 0;
|
||||
virtual RenderedFont *GetRenderedFontFromFamily(FontFamily *fontFamily, int fontSize, bool aa, int flags) = 0;
|
||||
|
||||
static FontManager *GetInstance();
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#include "FontRenderer.h"
|
||||
|
||||
#include "CoreDefs.h"
|
||||
#include "HostFont.h"
|
||||
#include "IGpFont.h"
|
||||
#include "HostFontHandler.h"
|
||||
#include "HostFontRenderedGlyph.h"
|
||||
#include "IGpFontRenderedGlyph.h"
|
||||
#include "MacRomanConversion.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "RenderedFont.h"
|
||||
#include "RenderedFontMetrics.h"
|
||||
#include "RenderedGlyphMetrics.h"
|
||||
#include "GpRenderedFontMetrics.h"
|
||||
#include "GpRenderedGlyphMetrics.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
@@ -20,15 +20,15 @@ namespace PortabilityLayer
|
||||
class RenderedFontImpl final : public RenderedFont
|
||||
{
|
||||
public:
|
||||
bool GetGlyph(unsigned int character, const RenderedGlyphMetrics *&outMetricsPtr, const void *&outData) const override;
|
||||
const RenderedFontMetrics &GetMetrics() const override;
|
||||
bool GetGlyph(unsigned int character, const GpRenderedGlyphMetrics *&outMetricsPtr, const void *&outData) const override;
|
||||
const GpRenderedFontMetrics &GetMetrics() const override;
|
||||
size_t MeasureString(const uint8_t *chars, size_t len) const override;
|
||||
bool IsAntiAliased() const override;
|
||||
|
||||
void Destroy() override;
|
||||
|
||||
void SetCharData(unsigned int charID, const void *data, size_t dataOffset, const RenderedGlyphMetrics &metrics);
|
||||
void SetFontMetrics(const RenderedFontMetrics &metrics);
|
||||
void SetCharData(unsigned int charID, const void *data, size_t dataOffset, const GpRenderedGlyphMetrics &metrics);
|
||||
void SetFontMetrics(const GpRenderedFontMetrics &metrics);
|
||||
|
||||
static RenderedFontImpl *Create(size_t glyphDataSize, bool aa);
|
||||
|
||||
@@ -37,9 +37,9 @@ namespace PortabilityLayer
|
||||
~RenderedFontImpl();
|
||||
|
||||
size_t m_dataOffsets[256];
|
||||
RenderedGlyphMetrics m_glyphMetrics[256];
|
||||
GpRenderedGlyphMetrics m_glyphMetrics[256];
|
||||
|
||||
RenderedFontMetrics m_fontMetrics;
|
||||
GpRenderedFontMetrics m_fontMetrics;
|
||||
bool m_isAntiAliased;
|
||||
|
||||
void *m_data;
|
||||
@@ -48,7 +48,7 @@ namespace PortabilityLayer
|
||||
class FontRendererImpl final : public FontRenderer
|
||||
{
|
||||
public:
|
||||
RenderedFont *RenderFont(HostFont *font, int size, bool aa, FontHacks fontHacks) override;
|
||||
RenderedFont *RenderFont(IGpFont *font, int size, bool aa, FontHacks fontHacks) override;
|
||||
|
||||
static FontRendererImpl *GetInstance();
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace PortabilityLayer
|
||||
static FontRendererImpl ms_instance;
|
||||
};
|
||||
|
||||
bool RenderedFontImpl::GetGlyph(unsigned int character, const RenderedGlyphMetrics *&outMetricsPtr, const void *&outData) const
|
||||
bool RenderedFontImpl::GetGlyph(unsigned int character, const GpRenderedGlyphMetrics *&outMetricsPtr, const void *&outData) const
|
||||
{
|
||||
const size_t dataOffset = m_dataOffsets[character];
|
||||
if (!dataOffset)
|
||||
@@ -68,7 +68,7 @@ namespace PortabilityLayer
|
||||
return true;
|
||||
}
|
||||
|
||||
const RenderedFontMetrics &RenderedFontImpl::GetMetrics() const
|
||||
const GpRenderedFontMetrics &RenderedFontImpl::GetMetrics() const
|
||||
{
|
||||
return m_fontMetrics;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ namespace PortabilityLayer
|
||||
|
||||
for (size_t i = 0; i < len; i++)
|
||||
{
|
||||
const RenderedGlyphMetrics &metrics = m_glyphMetrics[chars[i]];
|
||||
const GpRenderedGlyphMetrics &metrics = m_glyphMetrics[chars[i]];
|
||||
measure += metrics.m_advanceX;
|
||||
}
|
||||
|
||||
@@ -97,14 +97,14 @@ namespace PortabilityLayer
|
||||
free(this);
|
||||
}
|
||||
|
||||
void RenderedFontImpl::SetCharData(unsigned int charID, const void *data, size_t dataOffset, const RenderedGlyphMetrics &metrics)
|
||||
void RenderedFontImpl::SetCharData(unsigned int charID, const void *data, size_t dataOffset, const GpRenderedGlyphMetrics &metrics)
|
||||
{
|
||||
m_dataOffsets[charID] = dataOffset;
|
||||
m_glyphMetrics[charID] = metrics;
|
||||
memcpy(static_cast<uint8_t*>(m_data) + dataOffset, data, metrics.m_glyphDataPitch * metrics.m_glyphHeight);
|
||||
}
|
||||
|
||||
void RenderedFontImpl::SetFontMetrics(const RenderedFontMetrics &metrics)
|
||||
void RenderedFontImpl::SetFontMetrics(const GpRenderedFontMetrics &metrics)
|
||||
{
|
||||
m_fontMetrics = metrics;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ namespace PortabilityLayer
|
||||
{
|
||||
}
|
||||
|
||||
RenderedFont *FontRendererImpl::RenderFont(HostFont *font, int size, bool aa, FontHacks fontHacks)
|
||||
RenderedFont *FontRendererImpl::RenderFont(IGpFont *font, int size, bool aa, FontHacks fontHacks)
|
||||
{
|
||||
const unsigned int numCharacters = 256;
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace PortabilityLayer
|
||||
if (!font->GetLineSpacing(size, lineSpacing))
|
||||
return nullptr;
|
||||
|
||||
HostFontRenderedGlyph *glyphs[numCharacters];
|
||||
IGpFontRenderedGlyph *glyphs[numCharacters];
|
||||
|
||||
for (unsigned int i = 0; i < numCharacters; i++)
|
||||
glyphs[i] = nullptr;
|
||||
@@ -172,7 +172,7 @@ namespace PortabilityLayer
|
||||
{
|
||||
if (glyphs[i])
|
||||
{
|
||||
const RenderedGlyphMetrics &metrics = glyphs[i]->GetMetrics();
|
||||
const GpRenderedGlyphMetrics &metrics = glyphs[i]->GetMetrics();
|
||||
glyphDataSize += metrics.m_glyphDataPitch * metrics.m_glyphHeight;
|
||||
}
|
||||
}
|
||||
@@ -187,9 +187,9 @@ namespace PortabilityLayer
|
||||
{
|
||||
if (glyphs[i])
|
||||
{
|
||||
HostFontRenderedGlyph *glyph = glyphs[i];
|
||||
IGpFontRenderedGlyph *glyph = glyphs[i];
|
||||
|
||||
RenderedGlyphMetrics metrics = glyph->GetMetrics();
|
||||
GpRenderedGlyphMetrics metrics = glyph->GetMetrics();
|
||||
const void *data = glyph->GetData();
|
||||
|
||||
if (fontHacks == FontHacks_Roboto && !aa)
|
||||
@@ -219,7 +219,7 @@ namespace PortabilityLayer
|
||||
}
|
||||
|
||||
// Compute metrics
|
||||
RenderedFontMetrics fontMetrics;
|
||||
GpRenderedFontMetrics fontMetrics;
|
||||
fontMetrics.m_linegap = lineSpacing;
|
||||
fontMetrics.m_ascent = 0;
|
||||
fontMetrics.m_descent = 0;
|
||||
@@ -227,7 +227,7 @@ namespace PortabilityLayer
|
||||
bool measuredAnyGlyphs = false;
|
||||
for (char capChar = 'A'; capChar <= 'Z'; capChar++)
|
||||
{
|
||||
const RenderedGlyphMetrics *glyphMetrics;
|
||||
const GpRenderedGlyphMetrics *glyphMetrics;
|
||||
const void *glyphData;
|
||||
if (rfont->GetGlyph(static_cast<unsigned int>(capChar), glyphMetrics, glyphData) && glyphMetrics != nullptr)
|
||||
{
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
|
||||
#include "FontHacks.h"
|
||||
|
||||
struct IGpFont;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class RenderedFont;
|
||||
class HostFont;
|
||||
|
||||
class FontRenderer
|
||||
{
|
||||
public:
|
||||
virtual RenderedFont *RenderFont(HostFont *font, int size, bool aa, FontHacks fontHacks) = 0;
|
||||
virtual RenderedFont *RenderFont(IGpFont *font, int size, bool aa, FontHacks fontHacks) = 0;
|
||||
|
||||
static FontRenderer *GetInstance();
|
||||
};
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
struct IGpAudioDriver;
|
||||
struct IGpLogDriver;
|
||||
struct IGpInputDriver;
|
||||
struct IGpFontHandler;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class HostFileSystem;
|
||||
class HostDisplayDriver;
|
||||
class HostSystemServices;
|
||||
class HostFontHandler;
|
||||
class HostVOSEventQueue;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
virtual void PL_HostLogDriver_SetInstance(IGpLogDriver *instance) = 0;
|
||||
virtual void PL_HostInputDriver_SetInstances(IGpInputDriver *const* instances, size_t numInstances) = 0;
|
||||
virtual void PL_HostSystemServices_SetInstance(PortabilityLayer::HostSystemServices *instance) = 0;
|
||||
virtual void PL_HostFontHandler_SetInstance(PortabilityLayer::HostFontHandler *instance) = 0;
|
||||
virtual void PL_HostFontHandler_SetInstance(IGpFontHandler *instance) = 0;
|
||||
virtual void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) = 0;
|
||||
|
||||
virtual void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) = 0;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class HostFontRenderedGlyph;
|
||||
struct RenderedFontMetrics;
|
||||
|
||||
class HostFont
|
||||
{
|
||||
public:
|
||||
virtual void Destroy() = 0;
|
||||
virtual HostFontRenderedGlyph *Render(uint32_t unicodeCodePoint, unsigned int size, bool aa) = 0;
|
||||
virtual bool GetLineSpacing(unsigned int size, int32_t &outSpacing) = 0;
|
||||
};
|
||||
}
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
void HostFontHandler::SetInstance(HostFontHandler *instance)
|
||||
void HostFontHandler::SetInstance(IGpFontHandler *instance)
|
||||
{
|
||||
ms_instance = instance;
|
||||
}
|
||||
|
||||
HostFontHandler *HostFontHandler::GetInstance()
|
||||
IGpFontHandler *HostFontHandler::GetInstance()
|
||||
{
|
||||
return ms_instance;
|
||||
}
|
||||
|
||||
HostFontHandler *HostFontHandler::ms_instance = nullptr;
|
||||
IGpFontHandler *HostFontHandler::ms_instance = nullptr;
|
||||
}
|
||||
|
||||
@@ -1,23 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
class GpIOStream;
|
||||
struct IGpFontHandler;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class HostFont;
|
||||
|
||||
class HostFontHandler
|
||||
{
|
||||
public:
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
virtual HostFont *LoadFont(GpIOStream *stream) = 0;
|
||||
virtual bool KeepStreamOpen() const = 0;
|
||||
|
||||
static void SetInstance(HostFontHandler *instance);
|
||||
static HostFontHandler *GetInstance();
|
||||
static void SetInstance(IGpFontHandler *instance);
|
||||
static IGpFontHandler *GetInstance();
|
||||
|
||||
private:
|
||||
static HostFontHandler *ms_instance;
|
||||
static IGpFontHandler *ms_instance;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
struct RenderedGlyphMetrics;
|
||||
|
||||
class HostFontRenderedGlyph
|
||||
{
|
||||
public:
|
||||
virtual const RenderedGlyphMetrics &GetMetrics() const = 0;
|
||||
virtual const void *GetData() const = 0;
|
||||
virtual void Destroy() = 0;
|
||||
};
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "FontFamily.h"
|
||||
#include "FontManager.h"
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "HostFont.h"
|
||||
#include "IGpFont.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "ResourceManager.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "PLQDraw.h"
|
||||
#include "FontFamily.h"
|
||||
#include "RenderedFont.h"
|
||||
#include "RenderedFontMetrics.h"
|
||||
#include "GpRenderedFontMetrics.h"
|
||||
#include "ResolveCachingColor.h"
|
||||
#include "SimpleGraphic.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "MacRomanConversion.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "RenderedFont.h"
|
||||
#include "RenderedFontMetrics.h"
|
||||
#include "GpRenderedFontMetrics.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLQDraw.h"
|
||||
#include "PLStandardColors.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "FontFamily.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "RenderedFont.h"
|
||||
#include "RenderedFontMetrics.h"
|
||||
#include "GpRenderedFontMetrics.h"
|
||||
#include "ResolveCachingColor.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "PLStandardColors.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "RenderedFont.h"
|
||||
#include "RenderedFontMetrics.h"
|
||||
#include "GpRenderedFontMetrics.h"
|
||||
#include "ResolveCachingColor.h"
|
||||
#include "FontFamily.h"
|
||||
#include "Vec2i.h"
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
#include "PLPasStr.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "RenderedFont.h"
|
||||
#include "RenderedFontMetrics.h"
|
||||
#include "RenderedGlyphMetrics.h"
|
||||
#include "GpRenderedFontMetrics.h"
|
||||
#include "GpRenderedGlyphMetrics.h"
|
||||
#include "Rect2i.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "ResTypeID.h"
|
||||
@@ -240,7 +240,7 @@ static void DrawGlyph(PixMap *pixMap, const Rect &rect, const Point &penPos, con
|
||||
{
|
||||
assert(rect.IsValid());
|
||||
|
||||
const PortabilityLayer::RenderedGlyphMetrics *metrics;
|
||||
const GpRenderedGlyphMetrics *metrics;
|
||||
const void *data;
|
||||
if (!rfont->GetGlyph(character, metrics, data))
|
||||
return;
|
||||
|
||||
@@ -3,18 +3,16 @@
|
||||
#include <stdint.h>
|
||||
|
||||
class PLPasStr;
|
||||
struct GpRenderedFontMetrics;
|
||||
struct GpRenderedGlyphMetrics;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
struct RenderedFontMetrics;
|
||||
|
||||
struct RenderedGlyphMetrics;
|
||||
|
||||
class RenderedFont
|
||||
{
|
||||
public:
|
||||
virtual bool GetGlyph(unsigned int character, const RenderedGlyphMetrics *&outMetricsPtr, const void *&outData) const = 0;
|
||||
virtual const RenderedFontMetrics &GetMetrics() const = 0;
|
||||
virtual bool GetGlyph(unsigned int character, const GpRenderedGlyphMetrics *&outMetricsPtr, const void *&outData) const = 0;
|
||||
virtual const GpRenderedFontMetrics &GetMetrics() const = 0;
|
||||
virtual size_t MeasureString(const uint8_t *chars, size_t len) const = 0;
|
||||
virtual bool IsAntiAliased() const = 0;
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
struct RenderedFontMetrics
|
||||
{
|
||||
int32_t m_ascent;
|
||||
int32_t m_descent;
|
||||
int32_t m_linegap;
|
||||
};
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
struct RenderedGlyphMetrics
|
||||
{
|
||||
size_t m_glyphDataPitch;
|
||||
|
||||
uint32_t m_glyphWidth;
|
||||
uint32_t m_glyphHeight;
|
||||
|
||||
int16_t m_bearingX;
|
||||
int16_t m_bearingY;
|
||||
int16_t m_advanceX;
|
||||
};
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "TextPlacer.h"
|
||||
|
||||
#include "PLPasStr.h"
|
||||
#include "RenderedFontMetrics.h"
|
||||
#include "RenderedGlyphMetrics.h"
|
||||
#include "GpRenderedFontMetrics.h"
|
||||
#include "GpRenderedGlyphMetrics.h"
|
||||
#include "RenderedFont.h"
|
||||
|
||||
#include <assert.h>
|
||||
@@ -63,7 +63,7 @@ namespace PortabilityLayer
|
||||
if (character == '\r')
|
||||
break;
|
||||
|
||||
const PortabilityLayer::RenderedGlyphMetrics *metrics = nullptr;
|
||||
const GpRenderedGlyphMetrics *metrics = nullptr;
|
||||
const void *glyphData = nullptr;
|
||||
if (m_rfont->GetGlyph(m_chars[i], metrics, glyphData))
|
||||
spanWidth += metrics->m_advanceX;
|
||||
@@ -72,7 +72,7 @@ namespace PortabilityLayer
|
||||
}
|
||||
else
|
||||
{
|
||||
const PortabilityLayer::RenderedGlyphMetrics *metrics = nullptr;
|
||||
const GpRenderedGlyphMetrics *metrics = nullptr;
|
||||
const void *glyphData = nullptr;
|
||||
if (!m_rfont->GetGlyph(m_chars[i], metrics, glyphData))
|
||||
{
|
||||
@@ -116,7 +116,7 @@ namespace PortabilityLayer
|
||||
outCharacteristics.m_characterIndex = m_currentStartChar + m_emitOffset;
|
||||
outCharacteristics.m_character = character;
|
||||
|
||||
const PortabilityLayer::RenderedGlyphMetrics *metrics;
|
||||
const GpRenderedGlyphMetrics *metrics;
|
||||
const void *data;
|
||||
if (!m_rfont->GetGlyph(character, metrics, data))
|
||||
{
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
#include "Vec2i.h"
|
||||
|
||||
class PLPasStr;
|
||||
struct GpRenderedGlyphMetrics;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class RenderedFont;
|
||||
struct RenderedGlyphMetrics;
|
||||
|
||||
struct GlyphPlacementCharacteristics
|
||||
{
|
||||
bool m_haveGlyph;
|
||||
bool m_isParaStart; // Character is the first character in the paragraph
|
||||
bool m_isParaEnd; // Character is the last character in the paragraph
|
||||
const RenderedGlyphMetrics *m_glyphMetrics; // Glyph metrics
|
||||
const GpRenderedGlyphMetrics *m_glyphMetrics; // Glyph metrics
|
||||
const void *m_glyphData; // Glyph data
|
||||
Vec2i m_glyphStartPos; // Glyph start position
|
||||
Vec2i m_glyphEndPos; // Glyph end position
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "Rect2i.h"
|
||||
#include "RenderedFont.h"
|
||||
#include "RenderedFontMetrics.h"
|
||||
#include "GpRenderedFontMetrics.h"
|
||||
#include "ResolveCachingColor.h"
|
||||
#include "Vec2i.h"
|
||||
#include "WindowDef.h"
|
||||
|
||||
Reference in New Issue
Block a user