1 /* 2 * Copyright (c) 2021 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 #include "core/common/font_manager.h" 17 18 #ifndef NG_BUILD 19 #ifndef NEW_SKIA 20 #include "core/components/font/flutter_font_manager.h" 21 #endif 22 #endif 23 #ifdef ENABLE_ROSEN_BACKEND 24 #include "core/components/font/rosen_font_manager.h" 25 #endif 26 27 namespace OHOS::Ace { 28 Create()29RefPtr<FontManager> FontManager::Create() 30 { 31 if (SystemProperties::GetRosenBackendEnabled()) { 32 #ifdef ENABLE_ROSEN_BACKEND 33 return AceType::MakeRefPtr<RosenFontManager>(); 34 #else 35 return nullptr; 36 #endif 37 } else { 38 #ifdef NG_BUILD 39 // TODO: adapt to flutter fontmanager for ng 40 return nullptr; 41 #else 42 #ifndef NEW_SKIA 43 return AceType::MakeRefPtr<FlutterFontManager>(); 44 #else 45 return nullptr; 46 #endif 47 #endif 48 } 49 } 50 51 } // namespace OHOS::Ace 52