Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
This commit is contained in:
@@ -34,14 +34,14 @@ private:
|
||||
FT_Face face; ///< The font face associated with this font.
|
||||
|
||||
void SetFontSize(FontSize fs, FT_Face face, int pixels);
|
||||
const void *InternalGetFontTable(uint32 tag, size_t &length) override;
|
||||
const void *InternalGetFontTable(uint32_t tag, size_t &length) override;
|
||||
const Sprite *InternalGetGlyph(GlyphID key, bool aa) override;
|
||||
|
||||
public:
|
||||
FreeTypeFontCache(FontSize fs, FT_Face face, int pixels);
|
||||
~FreeTypeFontCache();
|
||||
void ClearFontCache() override;
|
||||
GlyphID MapCharToGlyph(WChar key) override;
|
||||
GlyphID MapCharToGlyph(char32_t key) override;
|
||||
std::string GetFontName() override { return fmt::format("{}, {}", face->family_name, face->style_name); }
|
||||
bool IsBuiltInFont() override { return false; }
|
||||
const void *GetOSHandle() override { return &face; }
|
||||
@@ -275,7 +275,7 @@ const Sprite *FreeTypeFontCache::InternalGetGlyph(GlyphID key, bool aa)
|
||||
}
|
||||
|
||||
|
||||
GlyphID FreeTypeFontCache::MapCharToGlyph(WChar key)
|
||||
GlyphID FreeTypeFontCache::MapCharToGlyph(char32_t key)
|
||||
{
|
||||
assert(IsPrintable(key));
|
||||
|
||||
@@ -286,7 +286,7 @@ GlyphID FreeTypeFontCache::MapCharToGlyph(WChar key)
|
||||
return FT_Get_Char_Index(this->face, key);
|
||||
}
|
||||
|
||||
const void *FreeTypeFontCache::InternalGetFontTable(uint32 tag, size_t &length)
|
||||
const void *FreeTypeFontCache::InternalGetFontTable(uint32_t tag, size_t &length)
|
||||
{
|
||||
FT_ULong len = 0;
|
||||
FT_Byte *result = nullptr;
|
||||
|
@@ -50,13 +50,13 @@ SpriteFontCache::~SpriteFontCache()
|
||||
this->ClearGlyphToSpriteMap();
|
||||
}
|
||||
|
||||
SpriteID SpriteFontCache::GetUnicodeGlyph(WChar key)
|
||||
SpriteID SpriteFontCache::GetUnicodeGlyph(char32_t key)
|
||||
{
|
||||
if (this->glyph_to_spriteid_map[GB(key, 8, 8)] == nullptr) return 0;
|
||||
return this->glyph_to_spriteid_map[GB(key, 8, 8)][GB(key, 0, 8)];
|
||||
}
|
||||
|
||||
void SpriteFontCache::SetUnicodeGlyph(WChar key, SpriteID sprite)
|
||||
void SpriteFontCache::SetUnicodeGlyph(char32_t key, SpriteID sprite)
|
||||
{
|
||||
if (this->glyph_to_spriteid_map == nullptr) this->glyph_to_spriteid_map = CallocT<SpriteID*>(256);
|
||||
if (this->glyph_to_spriteid_map[GB(key, 8, 8)] == nullptr) this->glyph_to_spriteid_map[GB(key, 8, 8)] = CallocT<SpriteID>(256);
|
||||
|
@@ -17,20 +17,20 @@
|
||||
class SpriteFontCache : public FontCache {
|
||||
private:
|
||||
SpriteID **glyph_to_spriteid_map; ///< Mapping of glyphs to sprite IDs.
|
||||
SpriteID GetUnicodeGlyph(WChar key);
|
||||
SpriteID GetUnicodeGlyph(char32_t key);
|
||||
|
||||
void ClearGlyphToSpriteMap();
|
||||
public:
|
||||
SpriteFontCache(FontSize fs);
|
||||
~SpriteFontCache();
|
||||
virtual void SetUnicodeGlyph(WChar key, SpriteID sprite);
|
||||
virtual void SetUnicodeGlyph(char32_t key, SpriteID sprite);
|
||||
virtual void InitializeUnicodeGlyphMap();
|
||||
virtual void ClearFontCache();
|
||||
virtual const Sprite *GetGlyph(GlyphID key);
|
||||
virtual uint GetGlyphWidth(GlyphID key);
|
||||
virtual bool GetDrawGlyphShadow();
|
||||
virtual GlyphID MapCharToGlyph(WChar key) { assert(IsPrintable(key)); return SPRITE_GLYPH | key; }
|
||||
virtual const void *GetFontTable(uint32 tag, size_t &length) { length = 0; return nullptr; }
|
||||
virtual GlyphID MapCharToGlyph(char32_t key) { assert(IsPrintable(key)); return SPRITE_GLYPH | key; }
|
||||
virtual const void *GetFontTable(uint32_t tag, size_t &length) { length = 0; return nullptr; }
|
||||
virtual std::string GetFontName() { return "sprite"; }
|
||||
virtual bool IsBuiltInFont() { return true; }
|
||||
};
|
||||
|
@@ -165,7 +165,7 @@ const Sprite *TrueTypeFontCache::GetGlyph(GlyphID key)
|
||||
return this->InternalGetGlyph(key, GetFontAAState(this->fs));
|
||||
}
|
||||
|
||||
const void *TrueTypeFontCache::GetFontTable(uint32 tag, size_t &length)
|
||||
const void *TrueTypeFontCache::GetFontTable(uint32_t tag, size_t &length)
|
||||
{
|
||||
const auto iter = this->font_tables.find(tag);
|
||||
if (iter != this->font_tables.end()) {
|
||||
|
@@ -55,17 +55,17 @@ protected:
|
||||
GlyphEntry *GetGlyphPtr(GlyphID key);
|
||||
void SetGlyphPtr(GlyphID key, const GlyphEntry *glyph, bool duplicate = false);
|
||||
|
||||
virtual const void *InternalGetFontTable(uint32 tag, size_t &length) = 0;
|
||||
virtual const void *InternalGetFontTable(uint32_t tag, size_t &length) = 0;
|
||||
virtual const Sprite *InternalGetGlyph(GlyphID key, bool aa) = 0;
|
||||
|
||||
public:
|
||||
TrueTypeFontCache(FontSize fs, int pixels);
|
||||
virtual ~TrueTypeFontCache();
|
||||
int GetFontSize() const override { return this->used_size; }
|
||||
void SetUnicodeGlyph(WChar key, SpriteID sprite) override { this->parent->SetUnicodeGlyph(key, sprite); }
|
||||
void SetUnicodeGlyph(char32_t key, SpriteID sprite) override { this->parent->SetUnicodeGlyph(key, sprite); }
|
||||
void InitializeUnicodeGlyphMap() override { this->parent->InitializeUnicodeGlyphMap(); }
|
||||
const Sprite *GetGlyph(GlyphID key) override;
|
||||
const void *GetFontTable(uint32 tag, size_t &length) override;
|
||||
const void *GetFontTable(uint32_t tag, size_t &length) override;
|
||||
void ClearFontCache() override;
|
||||
uint GetGlyphWidth(GlyphID key) override;
|
||||
bool GetDrawGlyphShadow() override;
|
||||
|
Reference in New Issue
Block a user