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

@ -18,12 +18,13 @@
#include "XcbEventInterface.h"
#include "XcbGlInterface.h"
#include "FileLogger.h"
#include "FontsManager.h"
#include <iostream>
XcbInterface::XcbInterface(DesktopManager* desktopManager, bool useHardware)
: AbstractUIInterface(desktopManager, useHardware),
XcbInterface::XcbInterface(DesktopManager* desktopManager, std::unique_ptr<FontsManager> fontsManager, bool useHardware)
: AbstractUIInterface(desktopManager, std::move(fontsManager), useHardware),
mEventInterface(XcbEventInterface::Create())
{
@ -151,7 +152,7 @@ uint32_t XcbInterface::getEventMask()
void XcbInterface::addWindow(mt::Window* window)
{
auto screen = mDesktopManager->getDefaultScreen();
XcbWindow::add(window, mConnection, screen, getEventMask(), mGlInterface.get());
XcbWindow::add(window, mConnection, screen, getEventMask(), mFontsManager.get(), mGlInterface.get());
}
void XcbInterface::onPaint()

View file

@ -25,7 +25,7 @@ namespace mt
class XcbInterface : public AbstractUIInterface
{
public:
XcbInterface(DesktopManager* desktopManager, bool useHardware = true);
XcbInterface(DesktopManager* desktopManager, std::unique_ptr<FontsManager> fontsManager, bool useHardware = true);
~XcbInterface();

View file

@ -7,7 +7,9 @@
#include "Screen.h"
#include "ImagePrimitives.h"
#include "XcbGlWindowInterface.h"
#include "DrawingContext.h"
#include "FontsManager.h"
#include <xcb/xcb.h>
@ -27,7 +29,7 @@ XcbWindow::~XcbWindow()
xcb_destroy_window(mConnection, mHandle);
}
void XcbWindow::add(mt::Window* window, xcb_connection_t* connection, mt::Screen* screen, uint32_t eventMask, XcbGlInterface* xcbGlInterface)
void XcbWindow::add(mt::Window* window, xcb_connection_t* connection, mt::Screen* screen, uint32_t eventMask, FontsManager* fontsManager, XcbGlInterface* xcbGlInterface)
{
if (!screen)
{
@ -52,7 +54,7 @@ void XcbWindow::add(mt::Window* window, xcb_connection_t* connection, mt::Screen
auto xcb_window = std::make_unique<XcbWindow>(window, hwnd, connection, xcbGlInterface);
const auto drawing_mode = xcbGlInterface ? DrawingMode::GRAPH : DrawingMode::RASTER;
window->setPlatformWindow(std::move(xcb_window), drawing_mode);
window->setPlatformWindow(std::move(xcb_window), fontsManager, drawing_mode);
}
int XcbWindow::getHandle() const

View file

@ -6,6 +6,9 @@ class XcbImage;
class XcbScreen;
class XcbGlWindowInterface;
class XcbGlInterface;
class FontsManager;
struct xcb_connection_t;
namespace mt
@ -19,7 +22,7 @@ public:
XcbWindow(mt::Window* window, int hwnd, xcb_connection_t* connection, XcbGlInterface* xcbGlInterface);
virtual ~XcbWindow();
static void add(mt::Window* window, xcb_connection_t* connection, mt::Screen* screen, uint32_t eventMask, XcbGlInterface* xcbGlInterface);
static void add(mt::Window* window, xcb_connection_t* connection, mt::Screen* screen, uint32_t eventMask, FontsManager* fontsManager, XcbGlInterface* xcbGlInterface);
int getHandle() const;
unsigned getGraphicsContext() const;