• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef GLOBAL_FONT_MANAGER_FONT_MANAGER_H
17 #define GLOBAL_FONT_MANAGER_FONT_MANAGER_H
18 
19 #include "singleton.h"
20 
21 namespace OHOS {
22 namespace Global {
23 namespace FontManager {
24 class FontManager : public DelayedSingleton<FontManager> {
25     DECLARE_DELAYED_SINGLETON(FontManager);
26 public:
27     int32_t InstallFont(const int32_t &fd);
28     int32_t UninstallFont(const std::string &fontFullName);
29 
30 private:
31     bool CheckInstallPath();
32     bool CheckFontConfigPath();
33     std::string Utf16BEToUtf8(const uint8_t* data, size_t byteLen);
34     std::vector<std::string> GetFontFullName(const int32_t &fd);
35     std::string GetFormatFullName(const std::vector<std::string> &fullNameVector);
36     std::string CopyFile(const std::string &fontPath, const int32_t &fd);
37 };
38 } // namespace FontManager
39 } // namespace Global
40 } // namespace OHOS
41 #endif // GLOBAL_FONT_MANAGER_FONT_MANAGER_H
42