Cumulia Illustrator Rendering Engine v1.1.0
A Rendering engine for industrial CAD/CAE model and optimized for greatest performance
 
Loading...
Searching...
No Matches
fontengine.h
1//##################################################################################################
2//
3// Copyright (c) 2024 Beijing Qiongqi Tech Co.,Ltd. All rights reserved.
4
5// This source code is confidential and proprietary to Beijing Qiongqi Tech Co.,Ltd(The Holder).
6// Any unauthorized use, copying, modification, or distribution of the code is strictly prohibited.
7// Any user shall obtain authorizaition from the Holder before modifying the source code. And the user shall not
8// sublicense, sell, distribute, or transfer the source code, whether in original or modified form, to any third party
9// without the prior written consent of the Holder.
10
11// This copyright notice and permission grant shall be included in all copies or substantial portions of the source code.
12
13// Author Cumulia Illustrator
14// Date 2024-10-31
15// Version V1.1.0
16//##################################################################################################
17
18#pragma once
19
20#include <cilcore.h>
21
22#include <memory>
23#include <vector>
24#include <string>
25#include <map>
26
27namespace cil
28{
29 class Glyph;
30 class Font;
31
33 {
34 public:
35 static void addFamily(const std::string& fontFamily, const std::string& filename);
36 static void removeFamily(const std::string& fontFamily);
37 static std::vector<std::string> families();
38 static std::string defaultFamily();
39 static void setDefaultFamily(const std::string& fontFamily);
40
41 private:
42 static FontEngine* s_instance;
43 std::map<std::string, std::string> m_familyMap;
44 std::string m_defaultFamily;
45 std::vector<std::shared_ptr<Font>> m_fonts;
46 std::shared_ptr<Font> m_current;
47
48 public:
50 void setFont(const int size, const std::string& family);
51 std::shared_ptr<Glyph> getGlyph(wchar_t character);
53 std::shared_ptr<Vector2i> textExtent(const std::wstring& text);
54
55 private:
56 FontEngine();
58
59 std::shared_ptr<Font> getFont(const int size, const std::string& family);
60 };
61}
Definition fontengine.h:33
static FontEngine * getInstance()
std::shared_ptr< Vector2i > textExtent(const std::wstring &text)
static void addFamily(const std::string &fontFamily, const std::string &filename)
static std::string defaultFamily()
static void setDefaultFamily(const std::string &fontFamily)
std::shared_ptr< Glyph > getGlyph(wchar_t character)
static std::vector< std::string > families()
static void removeFamily(const std::string &fontFamily)
void setFont(const int size, const std::string &family)
Definition decal.h:23