more fixes, AtomFont still requires more work

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
monroegm-disable-blank-issue-2
Esteban Papp 5 years ago
parent 9c72510a4f
commit 63d2f34ad6

@ -34,14 +34,14 @@ struct SLocalizedInfoGame
}
const char* szCharacterName;
string sUtf8TranslatedText;
AZStd::string sUtf8TranslatedText;
bool bUseSubtitle;
};
struct SLocalizedAdvancesSoundEntry
{
string sName;
AZStd::string sName;
float fValue;
void GetMemoryUsage(ICrySizer* pSizer) const
{
@ -178,12 +178,12 @@ struct ILocalizationManager
// bEnglish - if true, translates the string into the always present English language.
// Returns:
// true if localization was successful, false otherwise
virtual bool LocalizeString_ch([[maybe_unused]] const char* sString, [[maybe_unused]] string& outLocalizedString, [[maybe_unused]] bool bEnglish = false) override { return false; }
virtual bool LocalizeString_ch([[maybe_unused]] const char* sString, [[maybe_unused]] AZStd::string& outLocalizedString, [[maybe_unused]] bool bEnglish = false) override { return false; }
// Summary:
// Same as LocalizeString( const char* sString, string& outLocalizedString, bool bEnglish=false )
// Same as LocalizeString( const char* sString, AZStd::string& outLocalizedString, bool bEnglish=false )
// but at the moment this is faster.
virtual bool LocalizeString_s([[maybe_unused]] const string& sString, [[maybe_unused]] string& outLocalizedString, [[maybe_unused]] bool bEnglish = false) override { return false; }
virtual bool LocalizeString_s([[maybe_unused]] const AZStd::string& sString, [[maybe_unused]] AZStd::string& outLocalizedString, [[maybe_unused]] bool bEnglish = false) override { return false; }
// Summary:
virtual void LocalizeAndSubstituteInternal([[maybe_unused]] AZStd::string& locString, [[maybe_unused]] const AZStd::vector<AZStd::string>& keys, [[maybe_unused]] const AZStd::vector<AZStd::string>& values) override {}
@ -196,7 +196,7 @@ struct ILocalizationManager
// bEnglish - if true, returns the always present English version of the label.
// Returns:
// True if localization was successful, false otherwise.
virtual bool LocalizeLabel([[maybe_unused]] const char* sLabel, [[maybe_unused]] string& outLocalizedString, [[maybe_unused]] bool bEnglish = false) override { return false; }
virtual bool LocalizeLabel([[maybe_unused]] const char* sLabel, [[maybe_unused]] AZStd::string& outLocalizedString, [[maybe_unused]] bool bEnglish = false) override { return false; }
virtual bool IsLocalizedInfoFound([[maybe_unused]] const char* sKey) { return false; }
// Summary:
@ -251,7 +251,7 @@ struct ILocalizationManager
// sLocalizedString - Corresponding english language string.
// Returns:
// True if successful, false otherwise (key not found).
virtual bool GetEnglishString([[maybe_unused]] const char* sKey, [[maybe_unused]] string& sLocalizedString) override { return false; }
virtual bool GetEnglishString([[maybe_unused]] const char* sKey, [[maybe_unused]] AZStd::string& sLocalizedString) override { return false; }
// Summary:
// Get Subtitle for Key or Label .
@ -261,21 +261,21 @@ struct ILocalizationManager
// bForceSubtitle - If true, get subtitle (sLocalized or sEnglish) even if not specified in Data file.
// Returns:
// True if subtitle found (and outSubtitle filled in), false otherwise.
virtual bool GetSubtitle([[maybe_unused]] const char* sKeyOrLabel, [[maybe_unused]] string& outSubtitle, [[maybe_unused]] bool bForceSubtitle = false) override { return false; }
virtual bool GetSubtitle([[maybe_unused]] const char* sKeyOrLabel, [[maybe_unused]] AZStd::string& outSubtitle, [[maybe_unused]] bool bForceSubtitle = false) override { return false; }
// Description:
// These methods format outString depending on sString with ordered arguments
// FormatStringMessage(outString, "This is %2 and this is %1", "second", "first");
// Arguments:
// outString - This is first and this is second.
virtual void FormatStringMessage_List([[maybe_unused]] string& outString, [[maybe_unused]] const string& sString, [[maybe_unused]] const char** sParams, [[maybe_unused]] int nParams) override {}
virtual void FormatStringMessage([[maybe_unused]] string& outString, [[maybe_unused]] const string& sString, [[maybe_unused]] const char* param1, [[maybe_unused]] const char* param2 = 0, [[maybe_unused]] const char* param3 = 0, [[maybe_unused]] const char* param4 = 0) override {}
virtual void LocalizeTime([[maybe_unused]] time_t t, [[maybe_unused]] bool bMakeLocalTime, [[maybe_unused]] bool bShowSeconds, [[maybe_unused]] string& outTimeString) override {}
virtual void LocalizeDate([[maybe_unused]] time_t t, [[maybe_unused]] bool bMakeLocalTime, [[maybe_unused]] bool bShort, [[maybe_unused]] bool bIncludeWeekday, [[maybe_unused]] string& outDateString) override {}
virtual void LocalizeDuration([[maybe_unused]] int seconds, [[maybe_unused]] string& outDurationString) override {}
virtual void LocalizeNumber([[maybe_unused]] int number, [[maybe_unused]] string& outNumberString) override {}
virtual void LocalizeNumber_Decimal([[maybe_unused]] float number, [[maybe_unused]] int decimals, [[maybe_unused]] string& outNumberString) override {}
virtual void FormatStringMessage_List([[maybe_unused]] AZStd::string& outString, [[maybe_unused]] const AZStd::string& sString, [[maybe_unused]] const char** sParams, [[maybe_unused]] int nParams) override {}
virtual void FormatStringMessage([[maybe_unused]] AZStd::string& outString, [[maybe_unused]] const AZStd::string& sString, [[maybe_unused]] const char* param1, [[maybe_unused]] const char* param2 = 0, [[maybe_unused]] const char* param3 = 0, [[maybe_unused]] const char* param4 = 0) override {}
virtual void LocalizeTime([[maybe_unused]] time_t t, [[maybe_unused]] bool bMakeLocalTime, [[maybe_unused]] bool bShowSeconds, [[maybe_unused]] AZStd::string& outTimeString) override {}
virtual void LocalizeDate([[maybe_unused]] time_t t, [[maybe_unused]] bool bMakeLocalTime, [[maybe_unused]] bool bShort, [[maybe_unused]] bool bIncludeWeekday, [[maybe_unused]] AZStd::string& outDateString) override {}
virtual void LocalizeDuration([[maybe_unused]] int seconds, [[maybe_unused]] AZStd::string& outDurationString) override {}
virtual void LocalizeNumber([[maybe_unused]] int number, [[maybe_unused]] AZStd::string& outNumberString) override {}
virtual void LocalizeNumber_Decimal([[maybe_unused]] float number, [[maybe_unused]] int decimals, [[maybe_unused]] AZStd::string& outNumberString) override {}
// Summary:
// Returns true if the project has localization configured for use, false otherwise.

@ -99,12 +99,12 @@ public:
// bEnglish - if true, translates the string into the always present English language.
// Returns:
// true if localization was successful, false otherwise
virtual bool LocalizeString_ch(const char* sString, string& outLocalizedString, bool bEnglish = false) = 0;
virtual bool LocalizeString_ch(const char* sString, AZStd::string& outLocalizedString, bool bEnglish = false) = 0;
// Summary:
// Same as LocalizeString( const char* sString, string& outLocalizedString, bool bEnglish=false )
// but at the moment this is faster.
virtual bool LocalizeString_s(const string& sString, string& outLocalizedString, bool bEnglish = false) = 0;
virtual bool LocalizeString_s(const AZStd::string& sString, AZStd::string& outLocalizedString, bool bEnglish = false) = 0;
// Set up system for passing in placeholder data for localized strings
// Summary:
@ -138,7 +138,7 @@ public:
// bEnglish - if true, returns the always present English version of the label.
// Returns:
// True if localization was successful, false otherwise.
virtual bool LocalizeLabel(const char* sLabel, string& outLocalizedString, bool bEnglish = false) = 0;
virtual bool LocalizeLabel(const char* sLabel, AZStd::string& outLocalizedString, bool bEnglish = false) = 0;
// Summary:
// Return number of localization entries.
@ -151,7 +151,7 @@ public:
// sLocalizedString - Corresponding english language string.
// Returns:
// True if successful, false otherwise (key not found).
virtual bool GetEnglishString(const char* sKey, string& sLocalizedString) = 0;
virtual bool GetEnglishString(const char* sKey, AZStd::string& sLocalizedString) = 0;
// Summary:
// Get Subtitle for Key or Label .
@ -161,21 +161,21 @@ public:
// bForceSubtitle - If true, get subtitle (sLocalized or sEnglish) even if not specified in Data file.
// Returns:
// True if subtitle found (and outSubtitle filled in), false otherwise.
virtual bool GetSubtitle(const char* sKeyOrLabel, string& outSubtitle, bool bForceSubtitle = false) = 0;
virtual bool GetSubtitle(const char* sKeyOrLabel, AZStd::string& outSubtitle, bool bForceSubtitle = false) = 0;
// Description:
// These methods format outString depending on sString with ordered arguments
// FormatStringMessage(outString, "This is %2 and this is %1", "second", "first");
// Arguments:
// outString - This is first and this is second.
virtual void FormatStringMessage_List(string& outString, const string& sString, const char** sParams, int nParams) = 0;
virtual void FormatStringMessage(string& outString, const string& sString, const char* param1, const char* param2 = 0, const char* param3 = 0, const char* param4 = 0) = 0;
virtual void LocalizeTime(time_t t, bool bMakeLocalTime, bool bShowSeconds, string& outTimeString) = 0;
virtual void LocalizeDate(time_t t, bool bMakeLocalTime, bool bShort, bool bIncludeWeekday, string& outDateString) = 0;
virtual void LocalizeDuration(int seconds, string& outDurationString) = 0;
virtual void LocalizeNumber(int number, string& outNumberString) = 0;
virtual void LocalizeNumber_Decimal(float number, int decimals, string& outNumberString) = 0;
virtual void FormatStringMessage_List(AZStd::string& outString, const AZStd::string& sString, const char** sParams, int nParams) = 0;
virtual void FormatStringMessage(AZStd::string& outString, const AZStd::string& sString, const char* param1, const char* param2 = 0, const char* param3 = 0, const char* param4 = 0) = 0;
virtual void LocalizeTime(time_t t, bool bMakeLocalTime, bool bShowSeconds, AZStd::string& outTimeString) = 0;
virtual void LocalizeDate(time_t t, bool bMakeLocalTime, bool bShort, bool bIncludeWeekday, AZStd::string& outDateString) = 0;
virtual void LocalizeDuration(int seconds, AZStd::string& outDurationString) = 0;
virtual void LocalizeNumber(int number, AZStd::string& outNumberString) = 0;
virtual void LocalizeNumber_Decimal(float number, int decimals, AZStd::string& outNumberString) = 0;
// Summary:
// Returns true if the project has localization configured for use, false otherwise.

@ -82,7 +82,7 @@ namespace AZ
FontFamilyPtr GetFontFamily(const char* fontFamilyName) override;
void AddCharsToFontTextures(FontFamilyPtr fontFamily, const char* chars, int glyphSizeX = ICryFont::defaultGlyphSizeX, int glyphSizeY = ICryFont::defaultGlyphSizeY) override;
void GetMemoryUsage([[maybe_unused]] ICrySizer* sizer) const override {}
string GetLoadedFontNames() const;
AZStd::string GetLoadedFontNames() const;
void OnLanguageChanged() override;
void ReloadAllFonts() override;
//////////////////////////////////////////////////////////////////////////////////
@ -124,7 +124,7 @@ namespace AZ
//! \param fontFamilyName The name of the font family, or path to a font family file.
//! \param outputDirectory Path to loaded font family (no filename), may need resolving with PathUtil::MakeGamePath.
//! \param outputFullPath Full path to loaded font family, may need resolving with PathUtil::MakeGamePath.
XmlNodeRef LoadFontFamilyXml(const char* fontFamilyName, string& outputDirectory, string& outputFullPath);
XmlNodeRef LoadFontFamilyXml(const char* fontFamilyName, AZStd::string& outputDirectory, AZStd::string& outputFullPath);
// Data::AssetBus::Handler overrides...
void OnAssetReady(Data::Asset<Data::AssetData> asset) override;

@ -42,7 +42,7 @@ namespace AZ
size_t GetTextLength([[maybe_unused]] const char* str, [[maybe_unused]] const bool asciiMultiLine) const override { return 0; }
void WrapText(string& result, [[maybe_unused]] float maxWidth, const char* str, [[maybe_unused]] const TextDrawContext& ctx) override { result = str; }
void WrapText(AZStd::string& result, [[maybe_unused]] float maxWidth, const char* str, [[maybe_unused]] const TextDrawContext& ctx) override { result = str; }
void GetMemoryUsage([[maybe_unused]] ICrySizer* sizer) const override {}
@ -76,7 +76,7 @@ namespace AZ
virtual FontFamilyPtr GetFontFamily([[maybe_unused]] const char* fontFamilyName) override { CRY_ASSERT(false); return nullptr; }
virtual void AddCharsToFontTextures([[maybe_unused]] FontFamilyPtr fontFamily, [[maybe_unused]] const char* chars, [[maybe_unused]] int glyphSizeX, [[maybe_unused]] int glyphSizeY) override {};
virtual void GetMemoryUsage([[maybe_unused]] ICrySizer* sizer) const override {}
virtual string GetLoadedFontNames() const override { return ""; }
virtual AZStd::string GetLoadedFontNames() const override { return ""; }
virtual void OnLanguageChanged() override { }
virtual void ReloadAllFonts() override { }

@ -122,7 +122,7 @@ namespace AZ
struct FontEffect
{
string m_name;
AZStd::string m_name;
std::vector<FontRenderingPass> m_passes;
FontEffect(const char* name)
@ -178,7 +178,7 @@ namespace AZ
void DrawString(float x, float y, float z, const char* str, const bool asciiMultiLine, const TextDrawContext& ctx) override;
Vec2 GetTextSize(const char* str, const bool asciiMultiLine, const TextDrawContext& ctx) override;
size_t GetTextLength(const char* str, const bool asciiMultiLine) const override;
void WrapText(string& result, float maxWidth, const char* str, const TextDrawContext& ctx) override;
void WrapText(AZStd::string& result, float maxWidth, const char* str, const TextDrawContext& ctx) override;
void GetMemoryUsage([[maybe_unused]] ICrySizer* sizer) const override {};
void GetGradientTextureCoord(float& minU, float& minV, float& maxU, float& maxV) const override;
unsigned int GetEffectId(const char* effectName) const override;
@ -215,7 +215,7 @@ namespace AZ
FFont(AtomFont* atomFont, const char* fontName);
FontTexture* GetFontTexture() const { return m_fontTexture; }
const string& GetName() const { return m_name; }
const AZStd::string& GetName() const { return m_name; }
FontEffect* AddEffect(const char* effectName);
FontEffect* GetDefaultEffect();
@ -291,8 +291,8 @@ namespace AZ
static constexpr uint32_t NumBuffers = 2;
static constexpr float WindowScaleWidth = 800.0f;
static constexpr float WindowScaleHeight = 600.0f;
string m_name;
string m_curPath;
AZStd::string m_name;
AZStd::string m_curPath;
AZ::Name m_dynamicDrawContextName = AZ::Name(AZ::AtomFontDynamicDrawContextName);
@ -341,7 +341,7 @@ namespace AZ
FFont* font = const_cast<FFont*>(static_cast<const FFont*>(ptr));
if (font && font->m_atomFont)
{
font->m_atomFont->UnregisterFont(font->m_name);
font->m_atomFont->UnregisterFont(font->m_name.c_str());
font->m_atomFont = nullptr;
}

@ -60,7 +60,7 @@ namespace AZ
FontRenderer();
~FontRenderer();
int LoadFromFile(const string& fileName);
int LoadFromFile(const AZStd::string& fileName);
int LoadFromMemory(unsigned char* buffer, int bufferSize);
int Release();

@ -74,7 +74,7 @@ namespace AZ
FontTexture();
~FontTexture();
int CreateFromFile(const string& fileName, int width, int height, AZ::FontSmoothMethod smoothMethod, AZ::FontSmoothAmount smoothAmount, int widthCharCount = 16, int heightCharCount = 16);
int CreateFromFile(const AZStd::string& fileName, int width, int height, AZ::FontSmoothMethod smoothMethod, AZ::FontSmoothAmount smoothAmount, int widthCharCount = 16, int heightCharCount = 16);
//! Default texture slot width/height is 16x8 slots, allowing for 128 glyphs to be stored in the font texture. This was
//! previously 16x16, allowing 256 glyphs to be stored. For reference, there are 95 printable ASCII characters, so by
@ -129,7 +129,7 @@ namespace AZ
// useful for special feature rendering interleaved with fonts (e.g. box behind the text)
void CreateGradientSlot();
int WriteToFile(const string& fileName);
int WriteToFile(const AZStd::string& fileName);
void GetMemoryUsage([[maybe_unused]] ICrySizer* sizer) const {}

@ -79,7 +79,7 @@ namespace AZ
int Create(int iCacheSize, int glyphBitmapWidth, int glyphBitmapHeight, FontSmoothMethod smoothMethod, FontSmoothAmount smoothAmount, float sizeRatio);
int Release();
int LoadFontFromFile(const string& fileName);
int LoadFontFromFile(const AZStd::string& fileName);
int LoadFontFromMemory(unsigned char* fileBuffer, int dataSize);
int ReleaseFont();

@ -36,7 +36,7 @@ namespace AtomFontInternal
ELEMENT_PASS_BLEND = 14
};
inline int GetBlendModeFromString(const string& str, bool dst)
inline int GetBlendModeFromString(const AZStd::string& str, bool dst)
{
int blend = GS_BLSRC_ONE;
@ -100,7 +100,7 @@ namespace AtomFontInternal
);
}
inline AZ::FontSmoothMethod TranslateSmoothMethod(const string& value)
inline AZ::FontSmoothMethod TranslateSmoothMethod(const AZStd::string& value)
{
AZ::FontSmoothMethod smoothMethod = AZ::FontSmoothMethod::None;
if (value == "blur")
@ -179,9 +179,8 @@ namespace AtomFontInternal
void FoundElementImpl();
// notify methods
void FoundElement(const string& name)
void FoundElement(const AZStd::string& name)
{
//MessageBox(NULL, string("[" + name + "]").c_str(), "FoundElement", MB_OK);
// process the previous element
switch (m_nElement)
{
@ -246,9 +245,8 @@ namespace AtomFontInternal
}
}
void FoundAttribute(const string& name, const string& value)
void FoundAttribute(const AZStd::string& name, const AZStd::string& value)
{
//MessageBox(NULL, string(name + "\n" + value).c_str(), "FoundAttribute", MB_OK);
switch (m_nElement)
{
case ELEMENT_FONT:
@ -388,8 +386,8 @@ namespace AtomFontInternal
AZ::FFont::FontEffect* m_effect;
AZ::FFont::FontRenderingPass* m_pass;
string m_strFontPath;
string m_strFontEffectPath;
AZStd::string m_strFontPath;
AZStd::string m_strFontEffectPath;
vector2l m_FontTexSize;
AZ::AtomFont::GlyphSize m_slotSizes;
float m_SizeRatio = IFFontConstants::defaultSizeRatio;

Loading…
Cancel
Save