/** * @file XTPFontManager.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPFONTMANAGER_H__) # define __XTPFONTMANAGER_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * Singleton class to manage fonts used by library windows and * controls. You can access members of this class by using the * function XTPFontManager(). */ class _XTP_EXT_CLASS CXTPFontManager { /** * @brief * Private singleton constructor. */ CXTPFontManager(); /** @cond */ friend _XTP_EXT_CLASS CXTPFontManager* AFX_CDECL XTPFontManager(); friend class CXTPSingleton; /** @endcond */ public: /** * @brief * Call this member function to determine if the specified * font exists. * @param lpszFaceName A NULL-terminated string that represents the * font face name. * @return * TRUE if the font was found, otherwise FALSE. */ BOOL FontExists(LPCTSTR lpszFaceName); /** * @brief * Call this member to create system fonts using the specified * LOGFONT structure. * @param lf Font structure used to initialize all system fonts. */ void CreateFonts(LOGFONT lf); /** * @brief * Retrieves a reference to the standard library font managed * by CXTPFontManager. * @return * A reference to a CFont object representing the library * standard font. */ CFont& GetFont(); /** * @brief * Retrieves a reference to the bold library font managed * by CXTPFontManager. * @return * A reference to a CFont object representing the library * bold font. */ CFont& GetFontBold(); /** * @brief * Retrieves a reference to the italic library font managed * by CXTPFontManager. * @return * A reference to a CFont object representing the library * italic font. */ CFont& GetFontItalic(); /** * @brief * Retrieves a reference to the italic standard library font * managed by CXTPFontManager. * @return * A reference to a CFont object representing the library * italic standard font. */ CFont& GetFontItalicBold(); /** * @brief * Retrieves a reference to the vertical library font managed * by CXTPFontManager. * @return * A reference to a CFont object representing the library * vertical font. */ CFont& GetFontVertical(); /** * @brief * Retrieves a reference to the vertical bold library font * managed by CXTPFontManager. * @return * A reference to a CFont object representing the library * vertical bold font. */ CFont& GetFontVerticalBold(); protected: CXTPFont m_xtpFont; /**< Default font. */ CXTPFont m_xtpFontBold; /**< Default bold font. */ CXTPFont m_xtpFontItalic; /**< Default italic font. */ CXTPFont m_xtpFontItalicBold; /**< Default italic bold font. */ CXTPFont m_xtpFontVertical; /**< Default vertical font. */ CXTPFont m_xtpFontVerticalBold; /**< Default vertical bold font. */ XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_font, m_xtpFont, GetFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fontBold, m_xtpFontBold, GetBoldFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fontItalic, m_xtpFontItalic, GetItalicFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fontItalicBold, m_xtpFontItalicBold, GetItalicBoldFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fontVertical, m_xtpFontVertical, GetVerticalFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fontVerticalBold, m_xtpFontVerticalBold, GetVerticalBoldFontHandle); }; AFX_INLINE CFont& CXTPFontManager::GetFont() { return m_xtpFont; } AFX_INLINE CFont& CXTPFontManager::GetFontBold() { return m_xtpFontBold; } AFX_INLINE CFont& CXTPFontManager::GetFontItalic() { return m_xtpFontItalic; } AFX_INLINE CFont& CXTPFontManager::GetFontItalicBold() { return m_xtpFontItalicBold; } AFX_INLINE CFont& CXTPFontManager::GetFontVertical() { return m_xtpFontVertical; } AFX_INLINE CFont& CXTPFontManager::GetFontVerticalBold() { return m_xtpFontVerticalBold; } /** * @brief * Call this function to access CXTPFontManager members. Since this * class is designed as a single instance object you can only access * its members through this method. You cannot directly * instantiate an object of type CXTPFontManager. * * Example: *
SetFont(&CXTPFontManager()->GetNormalFont());
* @return A global font manager object pointer. */ _XTP_EXT_CLASS CXTPFontManager* AFX_CDECL XTPFontManager(); # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPFONTMANAGER_H__) /** @endcond */