Files
UnrealEngineUWP/Engine/Source/Editor/FontEditor/Private/FontEditorModule.cpp

58 lines
2.0 KiB
C++
Raw Normal View History

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "FontEditorModule.h"
#include "ModuleManager.h"
#include "Factories.h"
#include "SFontEditorViewport.h"
Initial support for composite fonts for Slate, UMG, and Canvas Slate now has the concept of composite fonts and font families (via FCompositeFont and FTypeface). A composite font is a font that contains a default font family, as well as any number of sub-font families which should be used for a given set of character ranges. This change will greatly improve the localization support for fonts. UFont assets can now use two forms of caching "offline" (which is the way they have always worked historically), and "runtime" (which utilizes the Slate font cache to cache glyphs on demand). These runtime cached UFont assets are now the only way to specify which font to use for a UMG widget, and address the previous issues about ensuring that the required font files were staged for your game. The Slate font cache now works on FFontData instances, rather than filenames. This allows the UFont asset to embed a blob of TTF or OTF font data inside it, rather than require the fonts be loaded from files on disk. The Canvas text renderer has been updated to support runtime cached UFont assets. This gives our legacy Canvas based tools the same improved font localization support as the rest of the Slate-based editor UI. UFont asset creation has been changed to use runtime caching by default, and additionally, you can now import a TTF or OTF file via the Content Browser and it will automatically create a UFont asset. If you still want an offline cached UFont asset, you can just change the cache type in the font editor, and the usual font picker dialog will appear and allow you to generate a font texture atlas. [CL 2342203 by Jamie Dale in Main branch]
2014-10-28 09:02:03 -04:00
#include "SCompositeFontEditor.h"
#include "FontEditor.h"
const FName FontEditorAppIdentifier = FName(TEXT("FontEditorApp"));
/*-----------------------------------------------------------------------------
FFontEditorModule
-----------------------------------------------------------------------------*/
class FFontEditorModule : public IFontEditorModule
{
public:
/** Constructor, set up console commands and variables **/
FFontEditorModule()
{
}
/** Called right after the module DLL has been loaded and the module object has been created */
virtual void StartupModule() override
{
MenuExtensibilityManager = MakeShareable(new FExtensibilityManager);
ToolBarExtensibilityManager = MakeShareable(new FExtensibilityManager);
}
/** Called before the module is unloaded, right before the module object is destroyed */
virtual void ShutdownModule() override
{
MenuExtensibilityManager.Reset();
ToolBarExtensibilityManager.Reset();
}
/** Creates a new Font editor */
virtual TSharedRef<IFontEditor> CreateFontEditor( const EToolkitMode::Type Mode, const TSharedPtr< IToolkitHost >& InitToolkitHost, UFont* Font ) override
{
TSharedRef<FFontEditor> NewFontEditor(new FFontEditor());
NewFontEditor->InitFontEditor(Mode, InitToolkitHost, Font);
return NewFontEditor;
}
/** Gets the extensibility managers for outside entities to extend static mesh editor's menus and toolbars */
virtual TSharedPtr<FExtensibilityManager> GetMenuExtensibilityManager() override { return MenuExtensibilityManager; }
virtual TSharedPtr<FExtensibilityManager> GetToolBarExtensibilityManager() override { return ToolBarExtensibilityManager; }
private:
TSharedPtr<FExtensibilityManager> MenuExtensibilityManager;
TSharedPtr<FExtensibilityManager> ToolBarExtensibilityManager;
};
IMPLEMENT_MODULE( FFontEditorModule, FontEditor );