1 /* 2 * Copyright (c) 2024 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 #ifndef OHOS_ACE_FRAMEWORK_CJ_MEASURE_FFI_H 17 #define OHOS_ACE_FRAMEWORK_CJ_MEASURE_FFI_H 18 19 #include <cstdint> 20 21 #include "base/utils/measure_util.h" 22 #include "bridge/cj_frontend/interfaces/cj_ffi/cj_macro.h" 23 #include "bridge/cj_frontend/interfaces/cj_ffi/cj_common_ffi.h" 24 25 26 // using namespace OHOS::Ace; 27 28 extern "C" { 29 typedef struct CJMeasureContextToC { 30 char* textContent; 31 char* fontWeight; 32 char* fontFamily; 33 NativeOptionLength constraintWidth; 34 NativeOptionLength fontSize; 35 NativeOptionLength lineHeight; 36 NativeOptionLength baselineOffset; 37 NativeOptionLength letterSpacing; 38 NativeOptionLength textIndent; 39 uint32_t maxLines; 40 int32_t textAlign; 41 int32_t fontStyle; 42 int32_t overflow; 43 int32_t textCase; 44 int32_t wordBreak; 45 } CJMeasureContextToC; 46 47 typedef struct CJSize { 48 double width; 49 double height; 50 } CJSize; 51 52 CJ_EXPORT double FfiMeasureText(const CJMeasureContextToC cjcontext); 53 CJ_EXPORT CJSize FfiMeasureTextSize(const CJMeasureContextToC cjcontext); 54 } 55 56 #endif // OHOS_ACE_FRAMEWORK_CJ_MEASURE_FFI_H