Skip to main content

OH_Drawing_FontMeasureText

Function OH_Drawing_FontMeasureText 

Source
pub unsafe extern "C" fn OH_Drawing_FontMeasureText(
    font: *const OH_Drawing_Font,
    text: *const c_void,
    byteLength: usize,
    encoding: OH_Drawing_TextEncoding,
    bounds: *mut OH_Drawing_Rect,
    textWidth: *mut f32,
) -> OH_Drawing_ErrorCode
Expand description

@brief Measures the width of text.

@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing @param font Indicates the pointer to an OH_Drawing_Font object. @param text Indicates the character storage encoded with text encoding. @param byteLength Indicates the text length in bytes. @param encoding Indicates the text encoding. @param bounds Gets the bounding box relative to (0, 0) if not nullptr. @param textWidth Indicates the width of text. @return Returns the error code. Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of font, text and textWidth is nullptr or byteLength is 0. @since 12 @version 1.0