• 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 
16 #ifdef ENABLE_TEXT_ENHANCE
17 #ifndef TEXT_GLOBAL_CONFIG_H
18 #define TEXT_GLOBAL_CONFIG_H
19 
20 #include <atomic>
21 #include <cstddef>
22 #include <cstdint>
23 #include <string>
24 
25 namespace skia {
26 namespace textlayout {
27 constexpr const char* NOTDEF_FAMILY = "notdef";
28 
29 class TextGlobalConfig {
30 public:
31     static bool IsTargetApiVersion(uint32_t targetVersion);
32 
SetTargetVersion(uint32_t targetVersion)33     static void SetTargetVersion(uint32_t targetVersion)
34     {
35         bundleApiVersion_ = targetVersion;
36     }
37 
38     static void SetUndefinedGlyphDisplay(uint32_t undefinedGlyphDisplay);
39 
40     static bool UndefinedGlyphDisplayUseTofu(const std::string& family = NOTDEF_FAMILY);
41 
42 private:
43     static uint32_t bundleApiVersion_;
44     static std::atomic<bool> undefinedGlyphDisplayTofu_;
45 };
46 } // namespace textlayout
47 } // namespace skia
48 
49 #endif // TEXT_GLOBAL_CONFIG_H
50 #endif // ENABLE_TEXT_ENHANCE