diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/Common/UI/UIBitmapFont.h | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.Client/Common/UI/UIBitmapFont.h')
| -rw-r--r-- | Minecraft.Client/Common/UI/UIBitmapFont.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/Minecraft.Client/Common/UI/UIBitmapFont.h b/Minecraft.Client/Common/UI/UIBitmapFont.h new file mode 100644 index 00000000..62b708fb --- /dev/null +++ b/Minecraft.Client/Common/UI/UIBitmapFont.h @@ -0,0 +1,75 @@ +#pragma once + +struct SFontData; +class CFontData; + +#define VERBOSE_FONT_OUTPUT 0 + +// const int BITMAP_FONT_LANGUAGES = XC_LANGUAGE_ENGLISH +// | XC_LANGUAGE_GERMAN +// | XC_LANGUAGE_FRENCH +// | XC_LANGUAGE_SPANISH +// | XC_LANGUAGE_ITALIAN +// | XC_LANGUAGE_PORTUGUESE +// | XC_LANGUAGE_BRAZILIAN; + +using namespace std; + +class UIAbstractBitmapFont +{ +protected: + string m_fontname; + + IggyBitmapFontProvider *m_bitmapFontProvider; + + bool m_registered; + + unsigned int m_numGlyphs; + +public: + UIAbstractBitmapFont(const string &fontname); + ~UIAbstractBitmapFont(); + + void registerFont(); + + // Virtual Functions. + virtual IggyFontMetrics *GetFontMetrics(IggyFontMetrics *metrics) = 0; + virtual S32 GetCodepointGlyph(U32 codepoint) = 0; + virtual IggyGlyphMetrics *GetGlyphMetrics(S32 glyph, IggyGlyphMetrics *metrics) = 0; + virtual rrbool IsGlyphEmpty(S32 glyph) = 0; + virtual F32 GetKerningForGlyphPair(S32 first_glyph, S32 second_glyph) = 0; + virtual rrbool CanProvideBitmap(S32 glyph, F32 pixel_scale) = 0; + virtual rrbool GetGlyphBitmap(S32 glyph, F32 pixel_scale, IggyBitmapCharacter *bitmap) = 0; + virtual void FreeGlyphBitmap(S32 glyph, F32 pixel_scale, IggyBitmapCharacter *bitmap) = 0; + + // Static Callbacks + // Just wrappers for the virtual functions. + static IggyFontMetrics * RADLINK GetFontMetrics_Callback(void *user_context, IggyFontMetrics *metrics); + static S32 RADLINK GetCodepointGlyph_Callback(void *user_context, U32 codepoint); + static IggyGlyphMetrics * RADLINK GetGlyphMetrics_Callback(void *user_context, S32 glyph, IggyGlyphMetrics *metrics); + static rrbool RADLINK IsGlyphEmpty_Callback(void *user_context, S32 glyph); + static F32 RADLINK GetKerningForGlyphPair_Callback(void *user_context, S32 first_glyph, S32 second_glyph); + static rrbool RADLINK CanProvideBitmap_Callback(void *user_context, S32 glyph, F32 pixel_scale); + static rrbool RADLINK GetGlyphBitmap_Callback(void *user_context, S32 glyph, F32 pixel_scale, IggyBitmapCharacter *bitmap); + static void RADLINK FreeGlyphBitmap_Callback(void *user_context, S32 glyph, F32 pixel_scale, IggyBitmapCharacter *bitmap); +}; + +class UIBitmapFont : public UIAbstractBitmapFont +{ +protected: + CFontData *m_cFontData; + +public: + UIBitmapFont(SFontData &sfontdata); + + ~UIBitmapFont(); + + virtual IggyFontMetrics * GetFontMetrics(IggyFontMetrics *metrics); + virtual S32 GetCodepointGlyph(U32 codepoint); + virtual IggyGlyphMetrics * GetGlyphMetrics(S32 glyph, IggyGlyphMetrics *metrics); + virtual rrbool IsGlyphEmpty(S32 glyph); + virtual F32 GetKerningForGlyphPair(S32 first_glyph, S32 second_glyph); + virtual rrbool CanProvideBitmap(S32 glyph, F32 pixel_scale); + virtual rrbool GetGlyphBitmap(S32 glyph, F32 pixel_scale, IggyBitmapCharacter *bitmap); + virtual void FreeGlyphBitmap(S32 glyph, F32 pixel_scale, IggyBitmapCharacter *bitmap); +};
\ No newline at end of file |
