1 /* 2 * Copyright (c) 2025 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 #include "include/TextGlobalConfig.h" 16 17 namespace skia { 18 namespace textlayout { 19 uint32_t TextGlobalConfig::bundleApiVersion_{0}; 20 std::atomic<bool> TextGlobalConfig::undefinedGlyphDisplayTofu_{false}; 21 22 constexpr uint32_t UNDEFINED_GLYPH_USE_TOFU = 1; 23 IsTargetApiVersion(uint32_t targetVersion)24bool TextGlobalConfig::IsTargetApiVersion(uint32_t targetVersion) 25 { 26 return bundleApiVersion_ >= targetVersion; 27 } 28 SetUndefinedGlyphDisplay(uint32_t undefinedGlyphDisplay)29void TextGlobalConfig::SetUndefinedGlyphDisplay(uint32_t undefinedGlyphDisplay) 30 { 31 undefinedGlyphDisplayTofu_.store(undefinedGlyphDisplay == UNDEFINED_GLYPH_USE_TOFU); 32 }; 33 UndefinedGlyphDisplayUseTofu(const std::string & family)34bool TextGlobalConfig::UndefinedGlyphDisplayUseTofu(const std::string& family) 35 { 36 return undefinedGlyphDisplayTofu_.load() && family == NOTDEF_FAMILY; 37 }; 38 } // namespace textlayout 39 } // namespace skia 40