aboutsummaryrefslogtreecommitdiff
path: root/src/osx/graphics
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-10-04 21:13:30 +0800
committercrupest <crupest@outlook.com>2021-10-04 21:13:30 +0800
commit4fc39124bc876a9c78a04cb86397a4f0f08878e9 (patch)
tree27b9919b8c17710aed3031b6f1e64055dab0683f /src/osx/graphics
parent8b5df96202b8eb663a9a747c1c9d249f64a933e8 (diff)
downloadcru-4fc39124bc876a9c78a04cb86397a4f0f08878e9.tar.gz
cru-4fc39124bc876a9c78a04cb86397a4f0f08878e9.tar.bz2
cru-4fc39124bc876a9c78a04cb86397a4f0f08878e9.zip
...
Diffstat (limited to 'src/osx/graphics')
-rw-r--r--src/osx/graphics/quartz/Factory.cpp21
-rw-r--r--src/osx/graphics/quartz/Font.cpp2
-rw-r--r--src/osx/graphics/quartz/TextLayout.cpp2
3 files changed, 25 insertions, 0 deletions
diff --git a/src/osx/graphics/quartz/Factory.cpp b/src/osx/graphics/quartz/Factory.cpp
index 72dd96c7..7aef9d7e 100644
--- a/src/osx/graphics/quartz/Factory.cpp
+++ b/src/osx/graphics/quartz/Factory.cpp
@@ -1,6 +1,10 @@
#include "cru/osx/graphics/quartz/Factory.hpp"
#include "cru/osx/graphics/quartz/Brush.hpp"
+#include "cru/osx/graphics/quartz/Font.hpp"
+#include "cru/osx/graphics/quartz/Geometry.hpp"
+#include "cru/osx/graphics/quartz/TextLayout.hpp"
+#include "cru/platform/Check.hpp"
#include <memory>
@@ -9,4 +13,21 @@ std::unique_ptr<ISolidColorBrush>
QuartzGraphicsFactory::CreateSolidColorBrush() {
return std::make_unique<QuartzSolidColorBrush>(this, colors::black);
}
+
+std::unique_ptr<IGeometryBuilder>
+QuartzGraphicsFactory::CreateGeometryBuilder() {
+ return std::make_unique<QuartzGeometryBuilder>(this);
+}
+
+std::unique_ptr<IFont> QuartzGraphicsFactory::CreateFont(String font_family,
+ float font_size) {
+ return std::make_unique<OsxCTFont>(this, font_family, font_size);
+}
+
+std::unique_ptr<ITextLayout> QuartzGraphicsFactory::CreateTextLayout(
+ std::shared_ptr<IFont> font, String text) {
+ auto f = CheckPlatform<OsxCTFont>(font, GetPlatformId());
+ return std::make_unique<OsxCTTextLayout>(this, f, text);
+}
+
} // namespace cru::platform::graphics::osx::quartz
diff --git a/src/osx/graphics/quartz/Font.cpp b/src/osx/graphics/quartz/Font.cpp
index c35f53fa..600f8309 100644
--- a/src/osx/graphics/quartz/Font.cpp
+++ b/src/osx/graphics/quartz/Font.cpp
@@ -15,4 +15,6 @@ OsxCTFont::OsxCTFont(IGraphicsFactory* graphics_factory, const String& name,
}
OsxCTFont::~OsxCTFont() { CFRelease(ct_font_); }
+
+float OsxCTFont::GetFontSize() { return CTFontGetSize(ct_font_); }
} // namespace cru::platform::graphics::osx::quartz
diff --git a/src/osx/graphics/quartz/TextLayout.cpp b/src/osx/graphics/quartz/TextLayout.cpp
index d6a19264..577eba58 100644
--- a/src/osx/graphics/quartz/TextLayout.cpp
+++ b/src/osx/graphics/quartz/TextLayout.cpp
@@ -20,6 +20,8 @@ OsxCTTextLayout::OsxCTTextLayout(IGraphicsFactory* graphics_factory,
RecreateFrame();
}
+OsxCTTextLayout::~OsxCTTextLayout() {}
+
void OsxCTTextLayout::SetFont(std::shared_ptr<IFont> font) {
font_ = CheckPlatform<OsxCTFont>(font, GetPlatformId());
CFRelease(ct_framesetter_);