diff options
author | crupest <crupest@outlook.com> | 2021-09-06 11:52:21 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-09-06 11:52:21 +0800 |
commit | 16007714fc0ad365c6da52dc58201ba4bc6aa964 (patch) | |
tree | 7ce745b2ab79f6ae057d03c18b875a3661eeca1f /src/osx/graphics/quartz | |
parent | c504aef3835f71ea22c9e938066f01e69e1c2db3 (diff) | |
download | cru-16007714fc0ad365c6da52dc58201ba4bc6aa964.tar.gz cru-16007714fc0ad365c6da52dc58201ba4bc6aa964.tar.bz2 cru-16007714fc0ad365c6da52dc58201ba4bc6aa964.zip |
...
Diffstat (limited to 'src/osx/graphics/quartz')
-rw-r--r-- | src/osx/graphics/quartz/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/osx/graphics/quartz/Font.cpp | 15 | ||||
-rw-r--r-- | src/osx/graphics/quartz/TextLayout.cpp | 5 |
3 files changed, 21 insertions, 1 deletions
diff --git a/src/osx/graphics/quartz/CMakeLists.txt b/src/osx/graphics/quartz/CMakeLists.txt index d58b7ecc..c6bb29cb 100644 --- a/src/osx/graphics/quartz/CMakeLists.txt +++ b/src/osx/graphics/quartz/CMakeLists.txt @@ -8,6 +8,7 @@ add_library(cru_osx_graphics_quartz SHARED Geometry.cpp Painter.cpp Resource.cpp + TextLayout.cpp ) target_sources(cru_osx_graphics_quartz PUBLIC ${CRU_OSX_GRAPHICS_NATIVE_INCLUDE_DIR}/Brush.hpp @@ -17,6 +18,7 @@ target_sources(cru_osx_graphics_quartz PUBLIC ${CRU_OSX_GRAPHICS_NATIVE_INCLUDE_DIR}/Geometry.hpp ${CRU_OSX_GRAPHICS_NATIVE_INCLUDE_DIR}/Painter.hpp ${CRU_OSX_GRAPHICS_NATIVE_INCLUDE_DIR}/Resource.hpp + ${CRU_OSX_GRAPHICS_NATIVE_INCLUDE_DIR}/TextLayout.hpp ) target_link_libraries(cru_osx_graphics_quartz PUBLIC cocoa) target_link_libraries(cru_osx_graphics_quartz PUBLIC cru_osx_base cru_platform_graphics) diff --git a/src/osx/graphics/quartz/Font.cpp b/src/osx/graphics/quartz/Font.cpp index 15ef9b21..e6c1dc91 100644 --- a/src/osx/graphics/quartz/Font.cpp +++ b/src/osx/graphics/quartz/Font.cpp @@ -1,5 +1,18 @@ #include "cru/osx/graphics/quartz/Font.hpp" +#include "cru/osx/graphics/quartz/Convert.hpp" +#include "cru/osx/graphics/quartz/Resource.hpp" + namespace cru::platform::graphics::osx::quartz { - +OsxCTFont::OsxCTFont(IGraphFactory* graphics_factory, const String& name, + float size) + : OsxQuartzResource(graphics_factory) { + CFStringRef n = Convert(name); + + ct_font_ = CTFontCreateWithName(n, size, nullptr); + + CFRelease(n); } + +OsxCTFont::~OsxCTFont() { CFRelease(ct_font_); } +} // namespace cru::platform::graphics::osx::quartz diff --git a/src/osx/graphics/quartz/TextLayout.cpp b/src/osx/graphics/quartz/TextLayout.cpp new file mode 100644 index 00000000..bd0562cb --- /dev/null +++ b/src/osx/graphics/quartz/TextLayout.cpp @@ -0,0 +1,5 @@ +#include "cru/osx/graphics/quartz/TextLayout.hpp" + +namespace cru::platform::graphics::osx::quartz { + +} |