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