mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-24 15:16:38 +00:00
Re-enable runtime font rendering if a font handler is assigned, clean up some font handler things.
This commit is contained in:
@@ -137,6 +137,7 @@ GpFileSystem_Win32::GpFileSystem_Win32()
|
|||||||
m_userSavesDir.append(L"\\");
|
m_userSavesDir.append(L"\\");
|
||||||
m_logsDir.append(L"\\");
|
m_logsDir.append(L"\\");
|
||||||
m_fontCacheDir.append(L"\\");
|
m_fontCacheDir.append(L"\\");
|
||||||
|
m_resourcesDir.append(L"\\");
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD modulePathSize = GetModuleFileNameW(nullptr, m_executablePath, MAX_PATH);
|
DWORD modulePathSize = GetModuleFileNameW(nullptr, m_executablePath, MAX_PATH);
|
||||||
@@ -177,6 +178,7 @@ GpFileSystem_Win32::GpFileSystem_Win32()
|
|||||||
{
|
{
|
||||||
m_packagedDir = std::wstring(m_executablePath) + L"Packaged\\";
|
m_packagedDir = std::wstring(m_executablePath) + L"Packaged\\";
|
||||||
m_housesDir = std::wstring(m_executablePath) + L"Packaged\\Houses\\";
|
m_housesDir = std::wstring(m_executablePath) + L"Packaged\\Houses\\";
|
||||||
|
m_resourcesDir = std::wstring(m_executablePath) + L"Resources\\";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,9 +455,6 @@ bool GpFileSystem_Win32::ResolvePath(PortabilityLayer::VirtualDirectory_t virtua
|
|||||||
case PortabilityLayer::VirtualDirectories::kLogs:
|
case PortabilityLayer::VirtualDirectories::kLogs:
|
||||||
baseDir = m_logsDir.c_str();
|
baseDir = m_logsDir.c_str();
|
||||||
break;
|
break;
|
||||||
case PortabilityLayer::VirtualDirectories::kFontCache:
|
|
||||||
baseDir = m_fontCacheDir.c_str();
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -35,40 +35,6 @@ namespace PortabilityLayer
|
|||||||
return minIndexInclusive;
|
return minIndexInclusive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool AntiAliasTable::LoadFromCache(const char *cacheFileName)
|
|
||||||
{
|
|
||||||
GpIOStream *stream = PLDrivers::GetFileSystem()->OpenFile(PortabilityLayer::VirtualDirectories::kFontCache, cacheFileName, false, GpFileCreationDispositions::kOpenExisting);
|
|
||||||
if (!stream)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
BEUInt32_t cacheVersion;
|
|
||||||
if (stream->Read(&cacheVersion, sizeof(cacheVersion)) != sizeof(cacheVersion) || cacheVersion != kCacheVersion)
|
|
||||||
{
|
|
||||||
stream->Close();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const size_t readSize = sizeof(m_aaTranslate);
|
|
||||||
const bool readOK = (stream->Read(m_aaTranslate, readSize) == readSize);
|
|
||||||
stream->Close();
|
|
||||||
|
|
||||||
return readOK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AntiAliasTable::SaveToCache(const char *cacheFileName)
|
|
||||||
{
|
|
||||||
GpIOStream *stream = PLDrivers::GetFileSystem()->OpenFile(PortabilityLayer::VirtualDirectories::kFontCache, cacheFileName, true, GpFileCreationDispositions::kCreateOrOverwrite);
|
|
||||||
if (!stream)
|
|
||||||
return;
|
|
||||||
|
|
||||||
BEUInt32_t cacheVersion(static_cast<uint32_t>(kCacheVersion));
|
|
||||||
stream->Write(&cacheVersion, sizeof(cacheVersion));
|
|
||||||
|
|
||||||
stream->Write(m_aaTranslate, sizeof(m_aaTranslate));
|
|
||||||
stream->Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AntiAliasTable::GenerateForPaletteFast(const RGBAColor &baseColorRef)
|
void AntiAliasTable::GenerateForPaletteFast(const RGBAColor &baseColorRef)
|
||||||
{
|
{
|
||||||
const RGBAColor baseColor = baseColorRef;
|
const RGBAColor baseColor = baseColorRef;
|
||||||
@@ -191,16 +157,8 @@ namespace PortabilityLayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AntiAliasTable::GenerateForPalette(const RGBAColor &baseColorRef, const RGBAColor *colors, size_t numColors, bool cacheable)
|
void AntiAliasTable::GenerateForPalette(const RGBAColor &baseColorRef, const RGBAColor *colors, size_t numColors)
|
||||||
{
|
{
|
||||||
char cacheFileName[256];
|
|
||||||
if (cacheable)
|
|
||||||
{
|
|
||||||
sprintf(cacheFileName, "aa_p_%02x%02x%02x%02x.cache", static_cast<int>(baseColorRef.r), static_cast<int>(baseColorRef.g), static_cast<int>(baseColorRef.b), static_cast<int>(baseColorRef.a));
|
|
||||||
if (LoadFromCache(cacheFileName))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const RGBAColor baseColor = baseColorRef;
|
const RGBAColor baseColor = baseColorRef;
|
||||||
|
|
||||||
if (numColors > 256)
|
if (numColors > 256)
|
||||||
@@ -259,21 +217,10 @@ namespace PortabilityLayer
|
|||||||
m_aaTranslate[i][b] = static_cast<uint8_t>(bestColor);
|
m_aaTranslate[i][b] = static_cast<uint8_t>(bestColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cacheable)
|
|
||||||
SaveToCache(cacheFileName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AntiAliasTable::GenerateForSimpleScale(uint8_t colorChannel, bool cacheable)
|
void AntiAliasTable::GenerateForSimpleScale(uint8_t colorChannel)
|
||||||
{
|
{
|
||||||
char cacheFileName[256];
|
|
||||||
if (cacheable)
|
|
||||||
{
|
|
||||||
sprintf(cacheFileName, "aa_t_%02x.cache", static_cast<int>(colorChannel));
|
|
||||||
if (LoadFromCache(cacheFileName))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const double gamma = 1.8;
|
const double gamma = 1.8;
|
||||||
const double rcpGamma = 1.0 / gamma;
|
const double rcpGamma = 1.0 / gamma;
|
||||||
const double rcp255 = 1.0 / 255.0;
|
const double rcp255 = 1.0 / 255.0;
|
||||||
@@ -294,8 +241,5 @@ namespace PortabilityLayer
|
|||||||
m_aaTranslate[baseColor][opacity] = static_cast<uint8_t>(floor(blendedColorGammaSpace * 255.0 + 0.5));
|
m_aaTranslate[baseColor][opacity] = static_cast<uint8_t>(floor(blendedColorGammaSpace * 255.0 + 0.5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cacheable)
|
|
||||||
SaveToCache(cacheFileName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,14 +12,8 @@ namespace PortabilityLayer
|
|||||||
// Striped 256x16 because constant background color is more likely than constant sample
|
// Striped 256x16 because constant background color is more likely than constant sample
|
||||||
uint8_t m_aaTranslate[256][16];
|
uint8_t m_aaTranslate[256][16];
|
||||||
|
|
||||||
void GenerateForPalette(const RGBAColor &baseColor, const RGBAColor *colors, size_t numColors, bool cacheable);
|
void GenerateForPalette(const RGBAColor &baseColor, const RGBAColor *colors, size_t numColors);
|
||||||
void GenerateForPaletteFast(const RGBAColor &baseColor);
|
void GenerateForPaletteFast(const RGBAColor &baseColor);
|
||||||
void GenerateForSimpleScale(uint8_t colorChannel, bool cacheable);
|
void GenerateForSimpleScale(uint8_t colorChannel);
|
||||||
|
|
||||||
private:
|
|
||||||
bool LoadFromCache(const char *path);
|
|
||||||
void SaveToCache(const char *path);
|
|
||||||
|
|
||||||
static const unsigned int kCacheVersion = 1;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -106,6 +106,16 @@ namespace PortabilityLayer
|
|||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FontFamily::UnloadVariation(int variation)
|
||||||
|
{
|
||||||
|
FontSpec &spec = m_fontSpecs[variation];
|
||||||
|
if (spec.m_font)
|
||||||
|
{
|
||||||
|
spec.m_font->Destroy();
|
||||||
|
spec.m_font = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PortabilityLayer::FontHacks FontFamily::GetHacksForVariation(int variation) const
|
PortabilityLayer::FontHacks FontFamily::GetHacksForVariation(int variation) const
|
||||||
{
|
{
|
||||||
return m_fontSpecs[variation].m_hacks;
|
return m_fontSpecs[variation].m_hacks;
|
||||||
|
@@ -30,6 +30,7 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
int GetVariationForFlags(int flags) const;
|
int GetVariationForFlags(int flags) const;
|
||||||
IGpFont *GetFontForVariation(int variation);
|
IGpFont *GetFontForVariation(int variation);
|
||||||
|
void UnloadVariation(int variation);
|
||||||
FontHacks GetHacksForVariation(int variation) const;
|
FontHacks GetHacksForVariation(int variation) const;
|
||||||
|
|
||||||
FontFamilyID_t GetFamilyID() const;
|
FontFamilyID_t GetFamilyID() const;
|
||||||
|
@@ -32,8 +32,6 @@ namespace PortabilityLayer
|
|||||||
FontFamily *GetFont(FontFamilyID_t fontFamilyID) const override;
|
FontFamily *GetFont(FontFamilyID_t fontFamilyID) const override;
|
||||||
void GetFontPreset(FontPreset_t fontPreset, FontFamilyID_t *outFamilyID, int *outSize, int *outVariationFlags, bool *outAA) const override;
|
void GetFontPreset(FontPreset_t fontPreset, FontFamilyID_t *outFamilyID, int *outSize, int *outVariationFlags, bool *outAA) const override;
|
||||||
|
|
||||||
RenderedFont *GetRenderedFontFromFamily(FontFamily *font, int size, bool aa, int flags) override;
|
|
||||||
|
|
||||||
RenderedFont *LoadCachedRenderedFont(FontFamilyID_t familyID, int size, bool aa, int flags) override;
|
RenderedFont *LoadCachedRenderedFont(FontFamilyID_t familyID, int size, bool aa, int flags) override;
|
||||||
|
|
||||||
void PurgeCache() override;
|
void PurgeCache() override;
|
||||||
@@ -41,6 +39,9 @@ namespace PortabilityLayer
|
|||||||
static FontManagerImpl *GetInstance();
|
static FontManagerImpl *GetInstance();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
RenderedFont *LoadAndRenderFontUsingFontHandler(FontFamily *font, int size, bool aa, int flags);
|
||||||
|
RenderedFont *LoadAndRenderFont(FontFamilyID_t familyID, int size, bool aa, int flags);
|
||||||
|
|
||||||
static const unsigned int kNumCachedRenderedFonts = 32;
|
static const unsigned int kNumCachedRenderedFonts = 32;
|
||||||
|
|
||||||
struct CachedRenderedFont
|
struct CachedRenderedFont
|
||||||
@@ -206,44 +207,49 @@ namespace PortabilityLayer
|
|||||||
m_usageCounter++;
|
m_usageCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderedFont *FontManagerImpl::GetRenderedFontFromFamily(FontFamily *fontFamily, int size, bool aa, int flags)
|
RenderedFont *FontManagerImpl::LoadAndRenderFontUsingFontHandler(FontFamily *fontFamily, int size, bool aa, int flags)
|
||||||
{
|
{
|
||||||
PortabilityLayer::FontManager *fm = PortabilityLayer::FontManager::GetInstance();
|
PortabilityLayer::FontManager *fm = PortabilityLayer::FontManager::GetInstance();
|
||||||
|
|
||||||
RenderedFont *rfont = nullptr;
|
|
||||||
CachedRenderedFont *cacheSlot = nullptr;
|
|
||||||
FontFamilyID_t familyID = fontFamily->GetFamilyID();
|
|
||||||
|
|
||||||
if (this->FindOrReserveCacheSlot(familyID, size, aa, cacheSlot, rfont))
|
|
||||||
return rfont;
|
|
||||||
|
|
||||||
rfont = fm->LoadCachedRenderedFont(familyID, size, aa, flags);
|
|
||||||
if (rfont)
|
|
||||||
{
|
|
||||||
ReplaceCachedRenderedFont(*cacheSlot, rfont, familyID, size, aa, flags);
|
|
||||||
return rfont;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int variation = fontFamily->GetVariationForFlags(flags);
|
const int variation = fontFamily->GetVariationForFlags(flags);
|
||||||
|
|
||||||
IGpFont *hostFont = fontFamily->GetFontForVariation(variation);
|
IGpFont *hostFont = fontFamily->GetFontForVariation(variation);
|
||||||
if (!hostFont)
|
if (!hostFont)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
RenderedFont *rfont = FontRenderer::GetInstance()->RenderFont(hostFont, size, aa, fontFamily->GetHacksForVariation(variation));
|
||||||
rfont = FontRenderer::GetInstance()->RenderFont(hostFont, size, aa, fontFamily->GetHacksForVariation(variation));
|
fontFamily->UnloadVariation(variation);
|
||||||
if (rfont)
|
|
||||||
{
|
|
||||||
ReplaceCachedRenderedFont(*cacheSlot, rfont, familyID, size, aa, flags);
|
|
||||||
|
|
||||||
return rfont;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rfont;
|
return rfont;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderedFont *FontManagerImpl::LoadCachedRenderedFont(FontFamilyID_t familyID, int size, bool aa, int flags)
|
RenderedFont *FontManagerImpl::LoadCachedRenderedFont(FontFamilyID_t familyID, int size, bool aa, int flags)
|
||||||
{
|
{
|
||||||
|
CachedRenderedFont *cacheSlot = nullptr;
|
||||||
|
RenderedFont *rfont = nullptr;
|
||||||
|
|
||||||
|
if (this->FindOrReserveCacheSlot(familyID, size, aa, cacheSlot, rfont))
|
||||||
|
return rfont;
|
||||||
|
|
||||||
|
rfont = LoadAndRenderFont(familyID, size, aa, flags);
|
||||||
|
if (rfont)
|
||||||
|
ReplaceCachedRenderedFont(*cacheSlot, rfont, familyID, size, aa, flags);
|
||||||
|
|
||||||
|
return rfont;
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderedFont *FontManagerImpl::LoadAndRenderFont(FontFamilyID_t familyID, int size, bool aa, int flags)
|
||||||
|
{
|
||||||
|
FontFamily *fontFamily = this->GetFont(familyID);
|
||||||
|
|
||||||
|
RenderedFont *rfont = nullptr;
|
||||||
|
if (PLDrivers::GetFontHandler() != nullptr)
|
||||||
|
{
|
||||||
|
rfont = LoadAndRenderFontUsingFontHandler(fontFamily, size, aa, flags);
|
||||||
|
if (rfont != nullptr)
|
||||||
|
return rfont;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_fontArchive)
|
if (!m_fontArchive)
|
||||||
{
|
{
|
||||||
m_fontArchiveFile = PortabilityLayer::FileManager::GetInstance()->OpenCompositeFile(VirtualDirectories::kApplicationData, PSTR("Fonts"));
|
m_fontArchiveFile = PortabilityLayer::FileManager::GetInstance()->OpenCompositeFile(VirtualDirectories::kApplicationData, PSTR("Fonts"));
|
||||||
@@ -266,7 +272,6 @@ namespace PortabilityLayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FontFamily *fontFamily = this->GetFont(familyID);
|
|
||||||
int variation = fontFamily->GetVariationForFlags(flags);
|
int variation = fontFamily->GetVariationForFlags(flags);
|
||||||
|
|
||||||
FontHacks hacks = FontHacks_None;
|
FontHacks hacks = FontHacks_None;
|
||||||
@@ -328,13 +333,13 @@ namespace PortabilityLayer
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
THandle<void> res = m_fontArchive->LoadResource('RFNT', 1000 + static_cast<int>(fontIndex));
|
THandle<void> res = m_fontArchive->LoadResource('RFNT', 1000 + static_cast<int>(fontIndex));
|
||||||
if (!res)
|
if (res)
|
||||||
return nullptr;
|
{
|
||||||
|
|
||||||
PortabilityLayer::MemReaderStream stream(*res, res.MMBlock()->m_size);
|
PortabilityLayer::MemReaderStream stream(*res, res.MMBlock()->m_size);
|
||||||
|
|
||||||
RenderedFont *rfont = PortabilityLayer::FontRenderer::GetInstance()->LoadCache(&stream);
|
rfont = PortabilityLayer::FontRenderer::GetInstance()->LoadCache(&stream);
|
||||||
res.Dispose();
|
res.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
return rfont;
|
return rfont;
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "FontHacks.h"
|
#include "FontHacks.h"
|
||||||
#include "FontFamilyID.h"
|
#include "FontFamilyID.h"
|
||||||
|
#include "FontPresets.h"
|
||||||
|
|
||||||
struct IGpFont;
|
struct IGpFont;
|
||||||
|
|
||||||
@@ -10,34 +11,6 @@ namespace PortabilityLayer
|
|||||||
class FontFamily;
|
class FontFamily;
|
||||||
class RenderedFont;
|
class RenderedFont;
|
||||||
|
|
||||||
namespace FontPresets
|
|
||||||
{
|
|
||||||
enum FontPreset
|
|
||||||
{
|
|
||||||
kSystem12,
|
|
||||||
kSystem12Bold,
|
|
||||||
|
|
||||||
kApplication8,
|
|
||||||
kApplication9,
|
|
||||||
kApplication9Bold,
|
|
||||||
kApplication10Bold,
|
|
||||||
kApplication12Bold,
|
|
||||||
kApplication14,
|
|
||||||
kApplication14Bold,
|
|
||||||
kApplication18,
|
|
||||||
kApplication40,
|
|
||||||
|
|
||||||
kMono10,
|
|
||||||
|
|
||||||
kHandwriting24,
|
|
||||||
kHandwriting48,
|
|
||||||
|
|
||||||
kCount,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef FontPresets::FontPreset FontPreset_t;
|
|
||||||
|
|
||||||
class FontManager
|
class FontManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -47,8 +20,6 @@ namespace PortabilityLayer
|
|||||||
virtual FontFamily *GetFont(FontFamilyID_t fontFamilyID) const = 0;
|
virtual FontFamily *GetFont(FontFamilyID_t fontFamilyID) const = 0;
|
||||||
virtual void GetFontPreset(FontPreset_t fontPreset, FontFamilyID_t *outFamilyID, int *outSize, int *outVariationFlags, bool *outAA) const = 0;
|
virtual void GetFontPreset(FontPreset_t fontPreset, FontFamilyID_t *outFamilyID, int *outSize, int *outVariationFlags, bool *outAA) const = 0;
|
||||||
|
|
||||||
virtual RenderedFont *GetRenderedFontFromFamily(FontFamily *fontFamily, int fontSize, bool aa, int flags) = 0;
|
|
||||||
|
|
||||||
virtual RenderedFont *LoadCachedRenderedFont(FontFamilyID_t familyID, int size, bool aa, int flags) = 0;
|
virtual RenderedFont *LoadCachedRenderedFont(FontFamilyID_t familyID, int size, bool aa, int flags) = 0;
|
||||||
|
|
||||||
virtual void PurgeCache() = 0;
|
virtual void PurgeCache() = 0;
|
||||||
|
32
PortabilityLayer/FontPresets.h
Normal file
32
PortabilityLayer/FontPresets.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace PortabilityLayer
|
||||||
|
{
|
||||||
|
namespace FontPresets
|
||||||
|
{
|
||||||
|
enum FontPreset
|
||||||
|
{
|
||||||
|
kSystem12,
|
||||||
|
kSystem12Bold,
|
||||||
|
|
||||||
|
kApplication8,
|
||||||
|
kApplication9,
|
||||||
|
kApplication9Bold,
|
||||||
|
kApplication10Bold,
|
||||||
|
kApplication12Bold,
|
||||||
|
kApplication14,
|
||||||
|
kApplication14Bold,
|
||||||
|
kApplication18,
|
||||||
|
kApplication40,
|
||||||
|
|
||||||
|
kMono10,
|
||||||
|
|
||||||
|
kHandwriting24,
|
||||||
|
kHandwriting48,
|
||||||
|
|
||||||
|
kCount,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef FontPresets::FontPreset FontPreset_t;
|
||||||
|
}
|
@@ -1330,16 +1330,19 @@ namespace PortabilityLayer
|
|||||||
return ccs->m_category;
|
return ccs->m_category;
|
||||||
}
|
}
|
||||||
|
|
||||||
FontFamily *EditboxWidget::GetFontFamily() const
|
FontPreset_t EditboxWidget::GetFontPreset() const
|
||||||
{
|
{
|
||||||
FontFamilyID_t preset = FontFamilyIDs::kCount;
|
return FontPresets::kSystem12;
|
||||||
PortabilityLayer::FontManager::GetInstance()->GetFontPreset(FontPresets::kSystem12, &preset, nullptr, nullptr, nullptr);
|
|
||||||
return PortabilityLayer::FontManager::GetInstance()->GetFont(preset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderedFont *EditboxWidget::GetRenderedFont() const
|
RenderedFont *EditboxWidget::GetRenderedFont() const
|
||||||
{
|
{
|
||||||
return PortabilityLayer::FontManager::GetInstance()->GetRenderedFontFromFamily(GetFontFamily(), 12, true, FontFamilyFlag_None);
|
PortabilityLayer::FontFamilyID_t fontFamilyID = FontFamilyIDs::kCount;
|
||||||
|
int size = 0;
|
||||||
|
int varFlags = 0;
|
||||||
|
bool aa = false;
|
||||||
|
PortabilityLayer::FontManager::GetInstance()->GetFontPreset(GetFontPreset(), &fontFamilyID, &size, &varFlags, &aa);
|
||||||
|
return PortabilityLayer::FontManager::GetInstance()->LoadCachedRenderedFont(fontFamilyID, size, aa, varFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditboxWidget::SetMultiLine(bool isMultiLine)
|
void EditboxWidget::SetMultiLine(bool isMultiLine)
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "FontPresets.h"
|
||||||
#include "PascalStr.h"
|
#include "PascalStr.h"
|
||||||
#include "PLWidgets.h"
|
#include "PLWidgets.h"
|
||||||
#include "Vec2i.h"
|
#include "Vec2i.h"
|
||||||
@@ -111,7 +112,7 @@ namespace PortabilityLayer
|
|||||||
size_t IdentifySpanLength(size_t startChar, SpanScanDirection scanDirection) const;
|
size_t IdentifySpanLength(size_t startChar, SpanScanDirection scanDirection) const;
|
||||||
static CharacterCategory CategorizeCharacter(uint8_t character);
|
static CharacterCategory CategorizeCharacter(uint8_t character);
|
||||||
|
|
||||||
PortabilityLayer::FontFamily *GetFontFamily() const;
|
PortabilityLayer::FontPreset_t GetFontPreset() const;
|
||||||
PortabilityLayer::RenderedFont *GetRenderedFont() const;
|
PortabilityLayer::RenderedFont *GetRenderedFont() const;
|
||||||
|
|
||||||
uint8_t *m_chars;
|
uint8_t *m_chars;
|
||||||
|
@@ -2016,7 +2016,7 @@ PortabilityLayer::RenderedFont *GetFont(PortabilityLayer::FontPreset_t fontPrese
|
|||||||
if (familyID == PortabilityLayer::FontFamilyIDs::kCount)
|
if (familyID == PortabilityLayer::FontFamilyIDs::kCount)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return fontManager->GetRenderedFontFromFamily(fontManager->GetFont(familyID), size, aa, variationFlags);
|
return fontManager->LoadCachedRenderedFont(familyID, size, aa, variationFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "stb_image_write.h"
|
#include "stb_image_write.h"
|
||||||
|
@@ -105,6 +105,7 @@
|
|||||||
<ClInclude Include="FontFamily.h" />
|
<ClInclude Include="FontFamily.h" />
|
||||||
<ClInclude Include="FontFamilyID.h" />
|
<ClInclude Include="FontFamilyID.h" />
|
||||||
<ClInclude Include="FontManager.h" />
|
<ClInclude Include="FontManager.h" />
|
||||||
|
<ClInclude Include="FontPresets.h" />
|
||||||
<ClInclude Include="FontRenderer.h" />
|
<ClInclude Include="FontRenderer.h" />
|
||||||
<ClInclude Include="GpAppInterface.h" />
|
<ClInclude Include="GpAppInterface.h" />
|
||||||
<ClInclude Include="GPArchive.h" />
|
<ClInclude Include="GPArchive.h" />
|
||||||
|
@@ -432,6 +432,9 @@
|
|||||||
<ClInclude Include="FontFamilyID.h">
|
<ClInclude Include="FontFamilyID.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="FontPresets.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="CFileStream.cpp">
|
<ClCompile Include="CFileStream.cpp">
|
||||||
|
@@ -293,7 +293,7 @@ namespace PortabilityLayer
|
|||||||
if (mutex)
|
if (mutex)
|
||||||
mutex->Unlock();
|
mutex->Unlock();
|
||||||
|
|
||||||
entry.m_aaTable.GenerateForSimpleScale(tone, false);
|
entry.m_aaTable.GenerateForSimpleScale(tone);
|
||||||
|
|
||||||
return entry.m_aaTable;
|
return entry.m_aaTable;
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,6 @@ namespace PortabilityLayer
|
|||||||
kCursors,
|
kCursors,
|
||||||
kHighScores,
|
kHighScores,
|
||||||
kLogs,
|
kLogs,
|
||||||
kFontCache,
|
|
||||||
|
|
||||||
kSourceExport,
|
kSourceExport,
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user