| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- #pragma once
- #include "BsCorePrerequisites.h"
- #include "BsImportOptions.h"
- #include "BsFont.h"
- namespace BansheeEngine
- {
- /**
- * @brief Determines how is a font rendered into the bitmap texture.
- */
- enum class FontRenderMode
- {
- Smooth, /*< Render antialiased fonts without hinting (slightly more blurry). */
- Raster, /*< Render non-antialiased fonts without hinting (slightly more blurry). */
- HintedSmooth, /*< Render antialiased fonts with hinting. */
- HintedRaster /*< Render non-antialiased fonts with hinting. */
- };
- /**
- * @brief Import options that allow you to control how is a font
- * imported.
- */
- class BS_CORE_EXPORT FontImportOptions : public ImportOptions
- {
- public:
- FontImportOptions();
- /**
- * @brief Sets font sizes that are to be imported. Sizes are in points.
- */
- void setFontSizes(const Vector<UINT32>& fontSizes) { mFontSizes = fontSizes; }
- /**
- * @brief Adds an index range of characters to import.
- */
- void addCharIndexRange(UINT32 from, UINT32 to);
- /**
- * @brief Clears all character indexes, so no character are imported.
- */
- void clearCharIndexRanges();
- /**
- * @brief Sets dots per inch resolution to use when rendering the characters into the texture.
- */
- void setDPI(UINT32 dpi) { mDPI = dpi; }
- /**
- * @brief Set the render mode used for rendering the characters into a bitmap.
- */
- void setRenderMode(FontRenderMode renderMode) { mRenderMode = renderMode; }
- /**
- * @brief Sets whether the bold font style should be used when rendering.
- */
- void setBold(bool bold) { mBold = bold; }
- /**
- * @brief Sets whether the italic font style should be used when rendering.
- */
- void setItalic(bool italic) { mItalic = italic; }
- /**
- * @brief Gets the sizes that are to be imported. Ranges are defined as unicode numbers.
- */
- Vector<UINT32> getFontSizes() const { return mFontSizes; }
- /**
- * @brief Gets character index ranges to import. Ranges are defined as unicode numbers.
- */
- Vector<std::pair<UINT32, UINT32>> getCharIndexRanges() const { return mCharIndexRanges; }
- /**
- * @brief Returns dots per inch scale that will be used when rendering the characters.
- */
- UINT32 getDPI() const { return mDPI; }
- /**
- * @brief Get the render mode used for rendering the characters into a bitmap.
- */
- FontRenderMode getRenderMode() const { return mRenderMode; }
- /**
- * @brief Sets whether the bold font style should be used when rendering.
- */
- bool getBold() const { return mBold; }
- /**
- * @brief Sets whether the italic font style should be used when rendering.
- */
- bool getItalic() const { return mItalic; }
- /************************************************************************/
- /* SERIALIZATION */
- /************************************************************************/
- public:
- friend class FontImportOptionsRTTI;
- static RTTITypeBase* getRTTIStatic();
- virtual RTTITypeBase* getRTTI() const override;
- private:
- Vector<UINT32> mFontSizes;
- Vector<std::pair<UINT32, UINT32>> mCharIndexRanges;
- UINT32 mDPI;
- FontRenderMode mRenderMode;
- bool mBold;
- bool mItalic;
- };
- }
|