Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef FONTAMALGAM_H
  8. #define FONTAMALGAM_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "vguifont.h"
  13. #include "BitmapFont.h"
  14. #include "utlvector.h"
  15. //-----------------------------------------------------------------------------
  16. // Purpose: object that holds a set of fonts in specified ranges
  17. //-----------------------------------------------------------------------------
  18. class CFontAmalgam
  19. {
  20. public:
  21. CFontAmalgam();
  22. ~CFontAmalgam();
  23. const char *Name();
  24. void SetName(const char *name);
  25. // adds a font to the amalgam
  26. void AddFont( font_t *font, int lowRange, int highRange);
  27. // returns the font for the given character
  28. font_t *GetFontForChar(int ch);
  29. // returns the max height of the font set
  30. int GetFontHeight();
  31. // returns height requested
  32. int GetFontHeightRequested();
  33. // returns the maximum width of a character in a font
  34. int GetFontMaxWidth();
  35. // returns the flags used to make the first font
  36. int GetFlags(int i);
  37. // returns the windows name for the font
  38. const char *GetFontName(int i);
  39. const char *GetFontFamilyName(int i);
  40. // returns the number of fonts in this amalgam
  41. int GetCount();
  42. // returns true if this font is underlined
  43. bool GetUnderlined();
  44. // sets the scale of a bitmap font
  45. void SetFontScale(float sx, float sy);
  46. // clears the fonts
  47. void RemoveAll();
  48. private:
  49. struct TFontRange
  50. {
  51. int lowRange;
  52. int highRange;
  53. font_t *font;
  54. };
  55. CUtlVector<TFontRange> m_Fonts;
  56. char m_szName[32];
  57. int m_iMaxWidth;
  58. int m_iMaxHeight;
  59. };
  60. #endif // FONTAMALGAM_H