1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd.. All rights reserved. 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 ROSEN_MODULES_SPTEXT_PLATFORM_H 17 #define ROSEN_MODULES_SPTEXT_PLATFORM_H 18 19 #include <shared_mutex> 20 #include <string> 21 #include <vector> 22 23 #include "utils.h" 24 25 #include "text/font_mgr.h" 26 27 namespace OHOS { 28 namespace Rosen { 29 namespace SPText { 30 constexpr const char* OHOS_THEME_FONT = "OhosThemeFont"; 31 class DefaultFamilyNameMgr { 32 public: 33 static DefaultFamilyNameMgr& GetInstance(); 34 std::vector<std::string> GetDefaultFontFamilies() const; 35 std::vector<std::string> GetThemeFontFamilies() const; 36 void ModifyThemeFontFamilies(size_t index); 37 static std::string GenerateThemeFamilyName(size_t index); 38 39 private: 40 DefaultFamilyNameMgr(); 41 DefaultFamilyNameMgr(const DefaultFamilyNameMgr&) = delete; 42 const DefaultFamilyNameMgr& operator=(const DefaultFamilyNameMgr&) = delete; 43 std::vector<std::string> themeFamilies_; 44 std::vector<std::string> defaultFamilies_; 45 mutable std::shared_mutex lock_; 46 }; 47 48 std::shared_ptr<Drawing::FontMgr> GetDefaultFontManager(); 49 } // namespace SPText 50 } // namespace Rosen 51 } // namespace OHOS 52 53 #endif // ROSEN_MODULES_SPTEXT_PLATFORM_H 54