diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /common/vgui_surfacelib/FontAmalgam.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'common/vgui_surfacelib/FontAmalgam.h')
| -rw-r--r-- | common/vgui_surfacelib/FontAmalgam.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/common/vgui_surfacelib/FontAmalgam.h b/common/vgui_surfacelib/FontAmalgam.h new file mode 100644 index 0000000..f7fbbfc --- /dev/null +++ b/common/vgui_surfacelib/FontAmalgam.h @@ -0,0 +1,79 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef FONTAMALGAM_H +#define FONTAMALGAM_H +#ifdef _WIN32 +#pragma once +#endif + +#include "vguifont.h" +#include "BitmapFont.h" +#include "utlvector.h" + +//----------------------------------------------------------------------------- +// Purpose: object that holds a set of fonts in specified ranges +//----------------------------------------------------------------------------- +class CFontAmalgam +{ +public: + CFontAmalgam(); + ~CFontAmalgam(); + + const char *Name(); + void SetName(const char *name); + + // adds a font to the amalgam + void AddFont( font_t *font, int lowRange, int highRange); + + // returns the font for the given character + font_t *GetFontForChar(int ch); + + // returns the max height of the font set + int GetFontHeight(); + + // returns height requested + int GetFontHeightRequested(); + + // returns the maximum width of a character in a font + int GetFontMaxWidth(); + + // returns the flags used to make the first font + int GetFlags(int i); + + // returns the windows name for the font + const char *GetFontName(int i); + const char *GetFontFamilyName(int i); + + // returns the number of fonts in this amalgam + int GetCount(); + + // returns true if this font is underlined + bool GetUnderlined(); + + // sets the scale of a bitmap font + void SetFontScale(float sx, float sy); + + // clears the fonts + void RemoveAll(); + +private: + struct TFontRange + { + int lowRange; + int highRange; + font_t *font; + }; + + CUtlVector<TFontRange> m_Fonts; + char m_szName[32]; + int m_iMaxWidth; + int m_iMaxHeight; +}; + + +#endif // FONTAMALGAM_H |