1 /* 2 * Copyright (c) 2025 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 "text_global_config.h" 17 18 #include "modules/skparagraph/include/TextGlobalConfig.h" 19 20 #include "text/text_blob.h" 21 #include "utils/text_log.h" 22 23 namespace OHOS::Rosen::SrvText { 24 25 using namespace OHOS::Rosen::Drawing; SetTextHighContrast(uint32_t textHighContrast)26uint32_t TextGlobalConfig::SetTextHighContrast(uint32_t textHighContrast) 27 { 28 if (textHighContrast >= TEXT_HIGH_CONTRAST_BUTT) { 29 return TEXT_ERR_PARA_INVALID; 30 } 31 auto& instance = ProcessTextConstrast::Instance(); 32 instance.SetTextContrast(static_cast<TextContrast>(textHighContrast)); 33 TEXT_LOGI("Succeed in setting text contrast %{public}u", textHighContrast); 34 return TEXT_SUCCESS; 35 } 36 SetTextUndefinedGlyphDisplay(uint32_t textUndefinedGlyphDisplay)37uint32_t TextGlobalConfig::SetTextUndefinedGlyphDisplay(uint32_t textUndefinedGlyphDisplay) 38 { 39 if (textUndefinedGlyphDisplay >= UNDEFINED_GLYPH_BUTT) { 40 return TEXT_ERR_PARA_INVALID; 41 } 42 skia::textlayout::TextGlobalConfig::SetUndefinedGlyphDisplay(textUndefinedGlyphDisplay); 43 return TEXT_SUCCESS; 44 } 45 } // namespace OHOS::Rosen::SrvText