#include <Message.hxx>
#include <Message_Messenger.hxx>
-#include "Font_DejavuSans_Latin_woff.pxx"
-
#include <algorithm>
#include <ft2build.h>
aParams.ToSynthesizeItalic = true;
break;
}
- Handle(NCollection_Buffer) aBuffer = new NCollection_Buffer (Handle(NCollection_BaseAllocator)(),
- Font_DejavuSans_Latin_woff_size,
- const_cast<Standard_Byte*>(Font_DejavuSans_Latin_woff));
Handle(Font_FTFont) aFont = new Font_FTFont();
- if (aFont->Init (aBuffer, "Embed Fallback Font", aParams, 0))
+ if (aFont->Init (Font_FontMgr::EmbedFallbackFont(), "Embed Fallback Font", aParams, 0))
{
aFont->myFontAspect = aFontAspect;
return aFont;
{
aParams.ToSynthesizeItalic = true;
}
- Handle(NCollection_Buffer) aBuffer = new NCollection_Buffer (Handle(NCollection_BaseAllocator)(),
- Font_DejavuSans_Latin_woff_size,
- const_cast<Standard_Byte*>(Font_DejavuSans_Latin_woff));
- return Init (aBuffer, "Embed Fallback Font", aParams, 0);
+ return Init (Font_FontMgr::EmbedFallbackFont(), "Embed Fallback Font", aParams, 0);
}
Release();
return false;
#include <Font_SystemFont.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
+#include <NCollection_Buffer.hxx>
#include <NCollection_List.hxx>
#include <NCollection_Map.hxx>
#include <OSD_Environment.hxx>
#include <Standard_Type.hxx>
#include <TCollection_HAsciiString.hxx>
+#include "Font_DejavuSans_Latin_woff.pxx"
+
#include <ft2build.h>
#include FT_FREETYPE_H
IMPLEMENT_STANDARD_RTTIEXT(Font_FontMgr,Standard_Transient)
}
return Handle(Font_SystemFont)();
}
+
+// =======================================================================
+// function : EmbedFallbackFont
+// purpose :
+// =======================================================================
+Handle(NCollection_Buffer) Font_FontMgr::EmbedFallbackFont()
+{
+ return new NCollection_Buffer (Handle(NCollection_BaseAllocator)(),
+ Font_DejavuSans_Latin_woff_size,
+ const_cast<Standard_Byte*>(Font_DejavuSans_Latin_woff));
+}
class Font_SystemFont;
class TCollection_HAsciiString;
+class NCollection_Buffer;
DEFINE_STANDARD_HANDLE(Font_FontMgr, Standard_Transient)
//! Clear registry. Can be used for testing purposes.
Standard_EXPORT void ClearFontDataBase();
+ //! Return DejaVu font as embed a single fallback font.
+ //! It can be used in cases when there is no own font file.
+ //! Note: result buffer is readonly and should not be changed,
+ //! any data modification can lead to unpredictable consequences.
+ Standard_EXPORT static Handle(NCollection_Buffer) EmbedFallbackFont();
+
private:
//! Creates empty font manager object