Basic Font integration.

This commit is contained in:
James Grogan 2022-11-15 09:32:28 +00:00
parent ce11c52ae5
commit 72123bc333
36 changed files with 325 additions and 198 deletions

View file

@ -9,10 +9,11 @@
#include "DrawingSurface.h"
#include "Scene.h"
DrawingContext::DrawingContext(DrawingSurface* surface, DrawingMode requestedDrawingMode)
DrawingContext::DrawingContext(DrawingSurface* surface, FontsManager* fontsManager, DrawingMode requestedDrawingMode)
: mSurface(surface),
mDrawingMode(requestedDrawingMode),
mScene(std::make_unique<Scene>())
mScene(std::make_unique<Scene>()),
mFontsManager(fontsManager)
{
if (mDrawingMode == DrawingMode::GRAPH)
{
@ -24,9 +25,9 @@ DrawingContext::DrawingContext(DrawingSurface* surface, DrawingMode requestedDra
}
}
std::unique_ptr<DrawingContext> DrawingContext::Create(DrawingSurface* surface, DrawingMode requestedDrawingMode)
std::unique_ptr<DrawingContext> DrawingContext::Create(DrawingSurface* surface, FontsManager* fontsManager, DrawingMode requestedDrawingMode)
{
return std::make_unique<DrawingContext>(surface, requestedDrawingMode);
return std::make_unique<DrawingContext>(surface, fontsManager, requestedDrawingMode);
}
Scene* DrawingContext::getScene() const
@ -41,6 +42,6 @@ DrawingSurface* DrawingContext::getSurface() const
void DrawingContext::paint()
{
mScene->update(mDrawingMode == DrawingMode::RASTER ? mSurface->getImage() : nullptr);
mScene->update(mFontsManager, mDrawingMode == DrawingMode::RASTER ? mSurface->getImage() : nullptr);
mPainter->paint(this);
}