1 /* 2 * Copyright (c) 2023-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 FONT_MGR_IMPL_H 17 #define FONT_MGR_IMPL_H 18 19 #include "impl_interface/base_impl.h" 20 #include "text/font_style_set.h" 21 #include "text/typeface.h" 22 #include "utils/scalar.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 namespace Drawing { 27 struct FontByteArray; 28 class FontMgrImpl : public BaseImpl { 29 public: 30 ~FontMgrImpl() override = default; 31 32 #ifndef USE_TEXGINE 33 virtual Typeface* LoadDynamicFont(const std::string& familyName, const uint8_t* data, size_t dataLength) = 0; 34 virtual Typeface* LoadThemeFont(const std::string& familyName, const std::string& themeName, 35 const uint8_t* data, size_t dataLength) = 0; 36 virtual void LoadThemeFont(const std::string& themeName, std::shared_ptr<Typeface> typeface) = 0; 37 #endif 38 virtual Typeface* MatchFamilyStyleCharacter(const char familyName[], const FontStyle& fontStyle, 39 const char* bcp47[], int bcp47Count, 40 int32_t character) = 0; 41 virtual FontStyleSet* MatchFamily(const char familyName[]) const = 0; 42 43 virtual Typeface* MatchFamilyStyle(const char familyName[], const FontStyle& fontStyle) const = 0; 44 45 virtual int CountFamilies() const = 0; 46 virtual void GetFamilyName(int index, std::string& str) const = 0; 47 virtual FontStyleSet* CreateStyleSet(int index) const = 0; 48 virtual int GetFontFullName(int fontFd, std::vector<FontByteArray>& fullnameVec) = 0; 49 virtual int ParseInstallFontConfig(const std::string& configPath, std::vector<std::string>& fontPathVec) = 0; 50 protected: 51 FontMgrImpl() noexcept = default; 52 }; 53 } // namespace Drawing 54 } // namespace Rosen 55 } // namespace OHOS 56 #endif