1 /* 2 * Copyright (c) 2021-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 /** 17 * @addtogroup Drawing 18 * @{ 19 * 20 * @brief Provides the 2D drawing capability. 21 * 22 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 23 * 24 * @since 8 25 * @version 1.0 26 */ 27 28 /** 29 * @file drawing_text_typography.h 30 * 31 * @brief Declares functions related to <b>typography</b> in the drawing module. 32 * 33 * @kit ArkGraphics2D 34 * @library libnative_drawing.so 35 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 36 * @since 8 37 * @version 1.0 38 */ 39 40 #ifndef C_INCLUDE_DRAWING_TEXT_TYPOGRAPHY_H 41 #define C_INCLUDE_DRAWING_TEXT_TYPOGRAPHY_H 42 43 #ifdef __cplusplus 44 #include <cstdint> 45 #include <cstddef> 46 #else 47 #include <stdint.h> 48 #include <stddef.h> 49 #endif 50 #include "drawing_canvas.h" 51 #include "drawing_color.h" 52 #include "drawing_font.h" 53 #include "drawing_text_declaration.h" 54 #include "drawing_types.h" 55 56 57 #ifdef __cplusplus 58 extern "C" { 59 #endif 60 61 /** 62 * @brief Enumerates text directions. 63 * 64 * @since 8 65 * @version 1.0 66 */ 67 enum OH_Drawing_TextDirection { 68 /** Right to left (RTL) */ 69 TEXT_DIRECTION_RTL, 70 /** Left to right (LTR) */ 71 TEXT_DIRECTION_LTR, 72 }; 73 74 /** 75 * @brief Enumerates text alignment modes. 76 * 77 * @since 8 78 * @version 1.0 79 */ 80 enum OH_Drawing_TextAlign { 81 /** Left-aligned */ 82 TEXT_ALIGN_LEFT, 83 /** Right-aligned */ 84 TEXT_ALIGN_RIGHT, 85 /** Center-aligned */ 86 TEXT_ALIGN_CENTER, 87 /** 88 * Justified, which means that each line (except the last line) is stretched so that every line has equal width, 89 * and the left and right margins are straight. 90 */ 91 TEXT_ALIGN_JUSTIFY, 92 /** 93 * <b>TEXT_ALIGN_START</b> achieves the same effect as <b>TEXT_ALIGN_LEFT</b> 94 * when <b>OH_Drawing_TextDirection</b> is <b>TEXT_DIRECTION_LTR</b>; 95 * it achieves the same effect as <b>TEXT_ALIGN_RIGHT</b> 96 * when <b>OH_Drawing_TextDirection</b> is <b>TEXT_DIRECTION_RTL</b>. 97 */ 98 TEXT_ALIGN_START, 99 /** 100 * <b>TEXT_ALIGN_END</b> achieves the same effect as <b>TEXT_ALIGN_RIGHT</b> 101 * when <b>OH_Drawing_TextDirection</b> is <b>TEXT_DIRECTION_LTR</b>; 102 * it achieves the same effect as <b>TEXT_ALIGN_LEFT</b> 103 * when <b>OH_Drawing_TextDirection</b> is <b>TEXT_DIRECTION_RTL</b>. 104 */ 105 TEXT_ALIGN_END, 106 }; 107 108 /** 109 * @brief Enumerates font weights. 110 * 111 * @since 8 112 * @version 1.0 113 */ 114 enum OH_Drawing_FontWeight { 115 /** Thin */ 116 FONT_WEIGHT_100, 117 /** Extra-light */ 118 FONT_WEIGHT_200, 119 /** Light */ 120 FONT_WEIGHT_300, 121 /** Normal/Regular */ 122 FONT_WEIGHT_400, 123 /** Medium*/ 124 FONT_WEIGHT_500, 125 /** Semi-bold */ 126 FONT_WEIGHT_600, 127 /** Bold */ 128 FONT_WEIGHT_700, 129 /** Extra-bold */ 130 FONT_WEIGHT_800, 131 /** Black */ 132 FONT_WEIGHT_900, 133 }; 134 135 /** 136 * @brief Enumerates text baselines. 137 * 138 * @since 8 139 * @version 1.0 140 */ 141 enum OH_Drawing_TextBaseline { 142 /** Alphabetic, where the letters in alphabets like English sit on. */ 143 TEXT_BASELINE_ALPHABETIC, 144 /** Ideographic. The baseline is at the bottom of the text area. */ 145 TEXT_BASELINE_IDEOGRAPHIC, 146 }; 147 148 /** 149 * @brief Enumerates text decorations. 150 * 151 * @since 8 152 * @version 1.0 153 */ 154 enum OH_Drawing_TextDecoration { 155 /** No decoration. */ 156 TEXT_DECORATION_NONE = 0x0, 157 /** A underline is used for decoration. */ 158 TEXT_DECORATION_UNDERLINE = 0x1, 159 /** An overline is used for decoration. */ 160 TEXT_DECORATION_OVERLINE = 0x2, 161 /** A strikethrough is used for decoration. */ 162 TEXT_DECORATION_LINE_THROUGH = 0x4, 163 }; 164 165 /** 166 * @brief Enumerates font styles. 167 * 168 * @since 8 169 * @version 1.0 170 */ 171 enum OH_Drawing_FontStyle { 172 /** Normal style */ 173 FONT_STYLE_NORMAL, 174 /** Italic style */ 175 FONT_STYLE_ITALIC, 176 /** Oblique style */ 177 FONT_STYLE_OBLIQUE, 178 }; 179 180 /** 181 * @brief Enumerates placeholder vertical alignment. 182 * 183 * @since 11 184 * @version 1.0 185 */ 186 typedef enum { 187 /** Offset At Baseline */ 188 ALIGNMENT_OFFSET_AT_BASELINE, 189 /** Above Baseline */ 190 ALIGNMENT_ABOVE_BASELINE, 191 /** Below Baseline */ 192 ALIGNMENT_BELOW_BASELINE, 193 /** Top of Row Box */ 194 ALIGNMENT_TOP_OF_ROW_BOX, 195 /** Bottom of Row Box */ 196 ALIGNMENT_BOTTOM_OF_ROW_BOX, 197 /** Center of Row Box */ 198 ALIGNMENT_CENTER_OF_ROW_BOX, 199 } OH_Drawing_PlaceholderVerticalAlignment; 200 201 /** 202 * @brief Defines the placeholder span. 203 * 204 * @since 11 205 * @version 1.0 206 */ 207 typedef struct { 208 /** width of placeholder */ 209 double width; 210 /** height of placeholder */ 211 double height; 212 /** alignment of placeholder */ 213 OH_Drawing_PlaceholderVerticalAlignment alignment; 214 /** baseline of placeholder */ 215 OH_Drawing_TextBaseline baseline; 216 /** baselineoffset of placeholder */ 217 double baselineOffset; 218 } OH_Drawing_PlaceholderSpan; 219 220 /** 221 * @brief Enumerates text decoration style. 222 * 223 * @since 11 224 * @version 1.0 225 */ 226 typedef enum { 227 /** Solid style */ 228 TEXT_DECORATION_STYLE_SOLID, 229 /** Double style */ 230 TEXT_DECORATION_STYLE_DOUBLE, 231 /** Dotted style */ 232 TEXT_DECORATION_STYLE_DOTTED, 233 /** Dashed style */ 234 TEXT_DECORATION_STYLE_DASHED, 235 /** Wavy style */ 236 TEXT_DECORATION_STYLE_WAVY, 237 } OH_Drawing_TextDecorationStyle; 238 239 /** 240 * @brief Enumerates ellipsis modal. 241 * 242 * @since 11 243 * @version 1.0 244 */ 245 typedef enum { 246 /** Head modal */ 247 ELLIPSIS_MODAL_HEAD = 0, 248 /** Middle modal */ 249 ELLIPSIS_MODAL_MIDDLE = 1, 250 /** Tail modal */ 251 ELLIPSIS_MODAL_TAIL = 2, 252 } OH_Drawing_EllipsisModal; 253 254 /** 255 * @brief Enumerates break strategy. 256 * 257 * @since 11 258 * @version 1.0 259 */ 260 typedef enum { 261 /** Greedy strategy */ 262 BREAK_STRATEGY_GREEDY = 0, 263 /** Quality strategy */ 264 BREAK_STRATEGY_HIGH_QUALITY = 1, 265 /** Balanced strategy */ 266 BREAK_STRATEGY_BALANCED = 2, 267 } OH_Drawing_BreakStrategy; 268 269 /** 270 * @brief Enumerates word break type. 271 * 272 * @since 11 273 * @version 1.0 274 */ 275 typedef enum { 276 /** Normal type */ 277 WORD_BREAK_TYPE_NORMAL = 0, 278 /** Break All type */ 279 WORD_BREAK_TYPE_BREAK_ALL = 1, 280 /** Break Word type */ 281 WORD_BREAK_TYPE_BREAK_WORD = 2, 282 /** 283 * Break word with hyphens 284 * @since 18 285 */ 286 WORD_BREAK_TYPE_BREAK_HYPHEN = 3, 287 } OH_Drawing_WordBreakType; 288 289 /** 290 * @brief Enumerates rect height style. 291 * 292 * @since 11 293 * @version 1.0 294 */ 295 typedef enum { 296 /** Tight style */ 297 RECT_HEIGHT_STYLE_TIGHT, 298 /** Max style */ 299 RECT_HEIGHT_STYLE_MAX, 300 /** Includelinespacemiddle style */ 301 RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE, 302 /** Includelinespacetop style */ 303 RECT_HEIGHT_STYLE_INCLUDELINESPACETOP, 304 /** Includelinespacebottom style */ 305 RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM, 306 /** Struct style */ 307 RECT_HEIGHT_STYLE_STRUCT, 308 } OH_Drawing_RectHeightStyle; 309 310 /** 311 * @brief Enumerates rect Width style. 312 * 313 * @since 11 314 * @version 1.0 315 */ 316 typedef enum { 317 /** Tight style */ 318 RECT_WIDTH_STYLE_TIGHT, 319 /** Max style */ 320 RECT_WIDTH_STYLE_MAX, 321 } OH_Drawing_RectWidthStyle; 322 323 /** 324 * @brief Gets system font configuration information list result enum. 325 * 326 * @since 12 327 * @version 1.0 328 */ 329 enum OH_Drawing_FontConfigInfoErrorCode { 330 /** The list of system font configuration information was successfully obtained */ 331 SUCCESS_FONT_CONFIG_INFO = 0, 332 /** Unknown error */ 333 ERROR_FONT_CONFIG_INFO_UNKNOWN = 1, 334 /** Parse system config file error */ 335 ERROR_FONT_CONFIG_INFO_PARSE_FILE = 2, 336 /** Alloc memory error */ 337 ERROR_FONT_CONFIG_INFO_ALLOC_MEMORY = 3, 338 /** Copy string data error */ 339 ERROR_FONT_CONFIG_INFO_COPY_STRING_DATA = 4, 340 }; 341 342 /** 343 * @brief Fallback font information. 344 * 345 * @since 12 346 * @version 1.0 347 */ 348 typedef struct OH_Drawing_FontFallbackInfo { 349 /** The type of language supported by the font set. The language format is bcp47 */ 350 char* language; 351 /** Font family name */ 352 char* familyName; 353 } OH_Drawing_FontFallbackInfo; 354 355 /** 356 * @brief Fallback font group. 357 * 358 * @since 12 359 * @version 1.0 360 */ 361 typedef struct OH_Drawing_FontFallbackGroup { 362 /** 363 * The name of the font set corresponding to the fallback font set. If the value is null, 364 * all fonts can be set using the fallback font set list. 365 */ 366 char* groupName; 367 /** Fallback font Info Size */ 368 size_t fallbackInfoSize; 369 /** A list of font sets for fallback fonts */ 370 OH_Drawing_FontFallbackInfo* fallbackInfoSet; 371 } OH_Drawing_FontFallbackGroup; 372 373 /** 374 * @brief Font weight mapping information. 375 * 376 * @since 12 377 * @version 1.0 378 */ 379 typedef struct OH_Drawing_FontAdjustInfo { 380 /** The font's original weight value */ 381 int weight; 382 /** The font weight displayed in the application */ 383 int to; 384 } OH_Drawing_FontAdjustInfo; 385 386 /** 387 * @brief Alias font information. 388 * 389 * @since 12 390 * @version 1.0 391 */ 392 typedef struct OH_Drawing_FontAliasInfo { 393 /** Font family name */ 394 char* familyName; 395 /** 396 * Font weight value. When the weight value is greater than 0, 397 * the font set contains only fonts with the specified weight. 398 * When the weight value is equal to 0, the font set contains all fonts. 399 */ 400 int weight; 401 } OH_Drawing_FontAliasInfo; 402 403 /** 404 * @brief General font set information supported by the system. 405 * 406 * @since 12 407 * @version 1.0 408 */ 409 typedef struct OH_Drawing_FontGenericInfo { 410 /** Font family name */ 411 char* familyName; 412 /** The size of alias font lists */ 413 size_t aliasInfoSize; 414 /** The size of font weight mapping information lists */ 415 size_t adjustInfoSize; 416 /** List of alias fonts */ 417 OH_Drawing_FontAliasInfo* aliasInfoSet; 418 /** Font weight mapping information lists */ 419 OH_Drawing_FontAdjustInfo* adjustInfoSet; 420 } OH_Drawing_FontGenericInfo; 421 422 /** 423 * @brief System font configuration information. 424 * 425 * @since 12 426 * @version 1.0 427 */ 428 typedef struct OH_Drawing_FontConfigInfo { 429 /** Count of system font file paths */ 430 size_t fontDirSize; 431 /** List size of generic font sets */ 432 size_t fontGenericInfoSize; 433 /** Count of fallback font set lists */ 434 size_t fallbackGroupSize; 435 /** List of system font file paths */ 436 char** fontDirSet; 437 /** List of generic font sets */ 438 OH_Drawing_FontGenericInfo* fontGenericInfoSet; 439 /** List of fallback font sets */ 440 OH_Drawing_FontFallbackGroup* fallbackGroupSet; 441 } OH_Drawing_FontConfigInfo; 442 443 /** 444 * @brief Describes the font information. 445 * 446 * @since 12 447 * @version 1.0 448 */ 449 typedef struct OH_Drawing_FontDescriptor { 450 /** The file path of System font */ 451 char* path; 452 /** A name that uniquely identifies the font */ 453 char* postScriptName; 454 /** The name of System font */ 455 char* fullName; 456 /** The family of System font */ 457 char* fontFamily; 458 /** The subfont family of the system font */ 459 char* fontSubfamily; 460 /** The weight of System font */ 461 int weight; 462 /** The width of System font */ 463 int width; 464 /** Whether the system font is tilted */ 465 int italic; 466 /** Whether the system font is compact */ 467 bool monoSpace; 468 /** whether symbolic fonts are supported */ 469 bool symbolic; 470 } OH_Drawing_FontDescriptor; 471 472 /** 473 * @brief The metrics of line. 474 * 475 * @since 12 476 * @version 1.0 477 */ 478 typedef struct OH_Drawing_LineMetrics { 479 /** Text ascender height */ 480 double ascender; 481 /** Tex descender height */ 482 double descender; 483 /** The height of a capital letter */ 484 double capHeight; 485 /** The height of a lowercase letter */ 486 double xHeight; 487 /** Text width */ 488 double width; 489 /** Line height */ 490 double height; 491 /** 492 * The distance from the left end of the text to the left end of the container, 493 * aligned to 0, is the width of the container minus the width of the line of text 494 */ 495 double x; 496 /** 497 * The height from the top of the text to the top of the container, the first line is 0, 498 * and the second line is the height of the first line 499 */ 500 double y; 501 /** Start Index */ 502 size_t startIndex; 503 /** End Index */ 504 size_t endIndex; 505 /** The metrics information of the first character */ 506 OH_Drawing_Font_Metrics firstCharMetrics; 507 } OH_Drawing_LineMetrics; 508 509 /** 510 * @brief Enumerates of heightmode of text. 511 * 512 * @since 12 513 * @version 1.0 514 */ 515 enum OH_Drawing_TextHeightBehavior { 516 /** both ascend of first row and last row style */ 517 TEXT_HEIGHT_ALL = 0x0, 518 /** forbidding ascend of first row style*/ 519 TEXT_HEIGHT_DISABLE_FIRST_ASCENT = 0x1, 520 /** forbidding ascend of last row style */ 521 TEXT_HEIGHT_DISABLE_LAST_ASCENT = 0x2, 522 /** neither ascend of first row nor last row style */ 523 TEXT_HEIGHT_DISABLE_ALL = 0x1 | 0x2, 524 }; 525 526 /** 527 * @brief Enumerates text style type. 528 * 529 * @since 12 530 * @version 1.0 531 */ 532 enum OH_Drawing_TextStyleType { 533 /** None style */ 534 TEXT_STYLE_NONE, 535 /** All attributes style */ 536 TEXT_STYLE_ALL_ATTRIBUTES, 537 /** Font style */ 538 TEXT_STYLE_FONT, 539 /** Foreground style */ 540 TEXT_STYLE_FOREGROUND, 541 /** Background style */ 542 TEXT_STYLE_BACKGROUND, 543 /** Shadow style */ 544 TEXT_STYLE_SHADOW, 545 /** Decorations style */ 546 TEXT_STYLE_DECORATIONS, 547 /** Letter spacing style */ 548 TEXT_STYLE_LETTER_SPACING, 549 /** Word spacing style */ 550 TEXT_STYLE_WORD_SPACING 551 }; 552 553 /** 554 * @brief Enumerates font width. 555 * 556 * @since 12 557 * @version 1.0 558 */ 559 enum OH_Drawing_FontWidth { 560 /* Ultra condensed font width */ 561 FONT_WIDTH_ULTRA_CONDENSED = 1, 562 /* Extra condensed font width */ 563 FONT_WIDTH_EXTRA_CONDENSED = 2, 564 /* condensed font width */ 565 FONT_WIDTH_CONDENSED = 3, 566 /* Semi condensed font width */ 567 FONT_WIDTH_SEMI_CONDENSED = 4, 568 /* Normal font width */ 569 FONT_WIDTH_NORMAL = 5, 570 /* Semi expanded font width */ 571 FONT_WIDTH_SEMI_EXPANDED = 6, 572 /* Expanded font width */ 573 FONT_WIDTH_EXPANDED = 7, 574 /* Extra expanded font width */ 575 FONT_WIDTH_EXTRA_EXPANDED = 8, 576 /* Ultra expanded font width */ 577 FONT_WIDTH_ULTRA_EXPANDED = 9, 578 }; 579 580 /** 581 * @brief Defines the font style struct. 582 * 583 * @since 12 584 * @version 1.0 585 */ 586 typedef struct OH_Drawing_FontStyleStruct { 587 /** Font weight */ 588 OH_Drawing_FontWeight weight; 589 /** Font width */ 590 OH_Drawing_FontWidth width; 591 /** Font slant */ 592 OH_Drawing_FontStyle slant; 593 } OH_Drawing_FontStyleStruct; 594 595 /** 596 * @brief Defines the fontfeature. 597 * 598 * @since 12 599 * @version 1.0 600 */ 601 typedef struct { 602 /** key of fontfeature */ 603 char* tag; 604 /** value of fontfeature */ 605 int value; 606 } OH_Drawing_FontFeature; 607 608 /** 609 * @brief Defines StrutStyle info struct. 610 * 611 * @since 12 612 * @version 1.0 613 */ 614 typedef struct { 615 /** The font weight to use when calculating the strut */ 616 OH_Drawing_FontWeight weight; 617 /** The font style to use when calculating the strut */ 618 OH_Drawing_FontStyle style; 619 /** The size of the ascent plus descent in logical pixels */ 620 double size; 621 /** The minimum height of the strut, as a multiple of fontSize */ 622 double heightScale; 623 /** Whether the height is override */ 624 bool heightOverride; 625 /** Whether the halfleading is enable */ 626 bool halfLeading; 627 /** The additional leading to apply to the strut as a multiple of Size */ 628 double leading; 629 /** Whether the strut height should be forced */ 630 bool forceStrutHeight; 631 /** The size of font families */ 632 size_t familiesSize; 633 /** The families of the font to use when calculating the strut */ 634 char** families; 635 } OH_Drawing_StrutStyle; 636 637 /** 638 * @brief Creates an <b>OH_Drawing_TypographyStyle</b> object. 639 * 640 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 641 * @return Returns the pointer to the <b>OH_Drawing_TypographyStyle</b> object created. 642 * @since 8 643 * @version 1.0 644 */ 645 OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle(void); 646 647 /** 648 * @brief Releases the memory occupied by an <b>OH_Drawing_TypographyStyle</b> object. 649 * 650 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 651 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 652 * @since 8 653 * @version 1.0 654 */ 655 void OH_Drawing_DestroyTypographyStyle(OH_Drawing_TypographyStyle* style); 656 657 /** 658 * @brief Sets the text direction. 659 * 660 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 661 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 662 * @param direction Indicates the text direction to set. For details, see the enum <b>OH_Drawing_TextDirection</b>. 663 * @since 8 664 * @version 1.0 665 */ 666 void OH_Drawing_SetTypographyTextDirection(OH_Drawing_TypographyStyle* style, int direction); 667 668 /** 669 * @brief Sets the text alignment mode. 670 * 671 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 672 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 673 * @param align Indicates the text alignment mode to set. For details, see the enum <b>OH_Drawing_TextAlign</b>. 674 * @since 8 675 * @version 1.0 676 */ 677 void OH_Drawing_SetTypographyTextAlign(OH_Drawing_TypographyStyle* style, int align); 678 679 /** 680 * @brief Sets the maximum number of lines in a text file. 681 * 682 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 683 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 684 * @param lineNumber Indicates the maximum number of lines to set. 685 * @since 8 686 * @version 1.0 687 */ 688 void OH_Drawing_SetTypographyTextMaxLines(OH_Drawing_TypographyStyle* style, int lineNumber); 689 690 /** 691 * @brief Creates an <b>OH_Drawing_TextStyle</b> object. 692 * 693 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 694 * @return Returns the pointer to the <b>OH_Drawing_TextStyle</b> object created. 695 * @since 8 696 * @version 1.0 697 */ 698 OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle(void); 699 700 /** 701 * @brief Releases the memory occupied by an <b>OH_Drawing_TextStyle</b> object. 702 * 703 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 704 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 705 * @since 8 706 * @version 1.0 707 */ 708 void OH_Drawing_DestroyTextStyle(OH_Drawing_TextStyle* style); 709 710 /** 711 * @brief Sets the text color. 712 * 713 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 714 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 715 * @param color Indicates the color to set. 716 * @since 8 717 * @version 1.0 718 */ 719 void OH_Drawing_SetTextStyleColor(OH_Drawing_TextStyle* style, uint32_t color); 720 721 /** 722 * @brief Sets the font size. 723 * 724 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 725 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 726 * @param fontSize Indicates the font size to set. 727 * @since 8 728 * @version 1.0 729 */ 730 void OH_Drawing_SetTextStyleFontSize(OH_Drawing_TextStyle* style, double fontSize); 731 732 /** 733 * @brief Sets the font weight. 734 * 735 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 736 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 737 * @param fontWeight Indicates the font weight to set. For details, see the enum <b>OH_Drawing_FontWeight</b>. 738 * @since 8 739 * @version 1.0 740 */ 741 void OH_Drawing_SetTextStyleFontWeight(OH_Drawing_TextStyle* style, int fontWeight); 742 743 /** 744 * @brief Sets the text baseline. 745 * 746 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 747 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 748 * @param baseline Indicates the text baseline to set. For details, see the enum <b>OH_Drawing_TextBaseline</b>. 749 * @since 8 750 * @version 1.0 751 */ 752 void OH_Drawing_SetTextStyleBaseLine(OH_Drawing_TextStyle* style, int baseline); 753 754 /** 755 * @brief Sets the text decoration. 756 * 757 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 758 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 759 * @param decoration Indicates the text decoration to set. For details, see the enum <b>OH_Drawing_TextDecoration</b>. 760 * @since 8 761 * @version 1.0 762 */ 763 void OH_Drawing_SetTextStyleDecoration(OH_Drawing_TextStyle* style, int decoration); 764 765 /** 766 * @brief Add the text decoration. 767 * 768 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 769 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 770 * @param decoration Indicates the text decoration to add. For details, see the enum <b>OH_Drawing_TextDecoration</b>. 771 * @since 18 772 * @version 1.0 773 */ 774 void OH_Drawing_AddTextStyleDecoration(OH_Drawing_TextStyle* style, int decoration); 775 776 /** 777 * @brief Remove the text decoration. 778 * 779 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 780 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 781 * @param decoration Indicates the text decoration to remove, shoud be match existing text decorations. 782 * For details, see the enum <b>OH_Drawing_TextDecoration</b>. 783 * @since 18 784 * @version 1.0 785 */ 786 void OH_Drawing_RemoveTextStyleDecoration(OH_Drawing_TextStyle* style, int decoration); 787 788 /** 789 * @brief Sets the color for the text decoration. 790 * 791 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 792 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 793 * @param color Indicates the color to set. 794 * @since 8 795 * @version 1.0 796 */ 797 void OH_Drawing_SetTextStyleDecorationColor(OH_Drawing_TextStyle* style, uint32_t color); 798 799 /** 800 * @brief Sets the font height. 801 * 802 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 803 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 804 * @param fontHeight Indicates the font height to set. 805 * @since 8 806 * @version 1.0 807 */ 808 void OH_Drawing_SetTextStyleFontHeight(OH_Drawing_TextStyle* style, double fontHeight); 809 810 /** 811 * @brief Sets the font families. 812 * 813 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 814 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 815 * @param fontFamiliesNumber Indicates the number of font families to set. 816 * @param fontFamilies Indicates the pointer to the font families to set. 817 * @since 8 818 * @version 1.0 819 */ 820 void OH_Drawing_SetTextStyleFontFamilies(OH_Drawing_TextStyle* style, 821 int fontFamiliesNumber, const char* fontFamilies[]); 822 823 /** 824 * @brief Sets the font style. 825 * 826 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 827 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 828 * @param fontStyle Indicates the font style to set. For details, see the enum <b>OH_Drawing_FontStyle</b>. 829 * @since 8 830 * @version 1.0 831 */ 832 void OH_Drawing_SetTextStyleFontStyle(OH_Drawing_TextStyle* style, int fontStyle); 833 834 /** 835 * @brief Sets the locale. 836 * 837 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 838 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 839 * @param locale Indicates the pointer to the locale to set. 840 * @since 8 841 * @version 1.0 842 */ 843 void OH_Drawing_SetTextStyleLocale(OH_Drawing_TextStyle* style, const char* locale); 844 845 /** 846 * @brief Sets the foreground brush style. 847 * 848 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 849 * @param style Indicates the pointer to a text style object <b>OH_Drawing_TextStyle</b>. 850 * @param foregroundBrush Indicates the pointer to a brush object <b>OH_Drawing_Brush</b>. 851 * @since 12 852 * @version 1.0 853 */ 854 void OH_Drawing_SetTextStyleForegroundBrush(OH_Drawing_TextStyle* style, OH_Drawing_Brush* foregroundBrush); 855 856 /** 857 * @brief Gets the foreground brush style. 858 * 859 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 860 * @param style Indicates the pointer to a text style object <b>OH_Drawing_TextStyle</b>. 861 * @param foregroundBrush Indicates the pointer to a brush object <b>OH_Drawing_Brush</b>. 862 * @since 12 863 * @version 1.0 864 */ 865 void OH_Drawing_TextStyleGetForegroundBrush(OH_Drawing_TextStyle* style, OH_Drawing_Brush* foregroundBrush); 866 867 /** 868 * @brief Sets the foreground pen style. 869 * 870 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 871 * @param style Indicates the pointer to a text style object <b>OH_Drawing_TextStyle</b>. 872 * @param foregroundPen Indicates the pointer to a pen object <b>OH_Drawing_Pen</b>. 873 * @since 12 874 * @version 1.0 875 */ 876 void OH_Drawing_SetTextStyleForegroundPen(OH_Drawing_TextStyle* style, OH_Drawing_Pen* foregroundPen); 877 878 /** 879 * @brief Gets the foreground pen style. 880 * 881 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 882 * @param style Indicates the pointer to a text style object <b>OH_Drawing_TextStyle</b>. 883 * @param foregroundPen Indicates the pointer to a pen object <b>OH_Drawing_Pen</b>. 884 * @since 12 885 * @version 1.0 886 */ 887 void OH_Drawing_TextStyleGetForegroundPen(OH_Drawing_TextStyle* style, OH_Drawing_Pen* foregroundPen); 888 889 /** 890 * @brief Sets the background brush style. 891 * 892 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 893 * @param style Indicates the pointer to a text style object <b>OH_Drawing_TextStyle</b>. 894 * @param foregroundPen Indicates the pointer to a brush object <b>OH_Drawing_Brush</b>. 895 * @since 12 896 * @version 1.0 897 */ 898 void OH_Drawing_SetTextStyleBackgroundBrush(OH_Drawing_TextStyle* style, OH_Drawing_Brush* foregroundPen); 899 900 /** 901 * @brief Gets the background brush style. 902 * 903 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 904 * @param style Indicates the pointer to a text style object <b>OH_Drawing_TextStyle</b>. 905 * @param backgroundBrush Indicates the pointer to a brush object <b>OH_Drawing_Brush</b>. 906 * @since 12 907 * @version 1.0 908 */ 909 void OH_Drawing_TextStyleGetBackgroundBrush(OH_Drawing_TextStyle* style, OH_Drawing_Brush* backgroundBrush); 910 911 /** 912 * @brief Sets the background pen style. 913 * 914 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 915 * @param style Indicates the pointer to a text style object <b>OH_Drawing_TextStyle</b>. 916 * @param backgroundPen Indicates the pointer to a pen object <b>OH_Drawing_Pen</b>. 917 * @since 12 918 * @version 1.0 919 */ 920 void OH_Drawing_SetTextStyleBackgroundPen(OH_Drawing_TextStyle* style, OH_Drawing_Pen* backgroundPen); 921 922 /** 923 * @brief Gets the background pen style. 924 * 925 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 926 * @param style Indicates the pointer to a text style object <b>OH_Drawing_TextStyle</b>. 927 * @param backgroundPen Indicates the pointer to a pen object <b>OH_Drawing_Pen</b>. 928 * @since 12 929 * @version 1.0 930 */ 931 void OH_Drawing_TextStyleGetBackgroundPen(OH_Drawing_TextStyle* style, OH_Drawing_Pen* backgroundPen); 932 933 /** 934 * @brief Creates a pointer to an <b>OH_Drawing_TypographyCreate</b> object. 935 * 936 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 937 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 938 * @param fontCollection Indicates the pointer to an <b>OH_Drawing_FontCollection</b> object. 939 * @return Returns the pointer to the <b>OH_Drawing_TypographyCreate</b> object created. 940 * @since 8 941 * @version 1.0 942 */ 943 OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler(OH_Drawing_TypographyStyle* style, 944 OH_Drawing_FontCollection* fontCollection); 945 946 /** 947 * @brief Releases the memory occupied by an <b>OH_Drawing_TypographyCreate</b> object. 948 * 949 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 950 * @param handler Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object. 951 * @since 8 952 * @version 1.0 953 */ 954 void OH_Drawing_DestroyTypographyHandler(OH_Drawing_TypographyCreate* handler); 955 956 /** 957 * @brief Sets the text style. 958 * 959 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 960 * @param handler Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object. 961 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 962 * @since 8 963 * @version 1.0 964 */ 965 void OH_Drawing_TypographyHandlerPushTextStyle(OH_Drawing_TypographyCreate* handler, OH_Drawing_TextStyle* style); 966 967 /** 968 * @brief Sets the text content. 969 * 970 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 971 * @param handler Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object. 972 * @param text Indicates the pointer to the text content to set. 973 * @since 8 974 * @version 1.0 975 */ 976 void OH_Drawing_TypographyHandlerAddText(OH_Drawing_TypographyCreate* handler, const char* text); 977 978 /** 979 * @brief Removes the topmost style in the stack, leaving the remaining styles in effect. 980 * 981 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 982 * @param handler Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object. 983 * @since 8 984 * @version 1.0 985 */ 986 void OH_Drawing_TypographyHandlerPopTextStyle(OH_Drawing_TypographyCreate* handler); 987 988 /** 989 * @brief Creates an <b>OH_Drawing_Typography</b> object. 990 * 991 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 992 * @param handler Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object. 993 * @return Returns the pointer to the <b>OH_Drawing_Typography</b> object created. 994 * @since 8 995 * @version 1.0 996 */ 997 OH_Drawing_Typography* OH_Drawing_CreateTypography(OH_Drawing_TypographyCreate* handler); 998 999 /** 1000 * @brief Releases the memory occupied by an <b>OH_Drawing_Typography</b> object. 1001 * 1002 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1003 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1004 * @since 8 1005 * @version 1.0 1006 */ 1007 void OH_Drawing_DestroyTypography(OH_Drawing_Typography* typography); 1008 1009 /** 1010 * @brief Lays out the typography. 1011 * 1012 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1013 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1014 * @param maxWidth Indicates the maximum text width to set. 1015 * @since 8 1016 * @version 1.0 1017 */ 1018 void OH_Drawing_TypographyLayout(OH_Drawing_Typography* typography, double maxWidth); 1019 1020 /** 1021 * @brief Paints text on the canvas. 1022 * 1023 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1024 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1025 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 1026 * @param potisionX Indicates the x coordinate. 1027 * @param potisionY Indicates the y coordinate. 1028 * @since 8 1029 * @version 1.0 1030 */ 1031 void OH_Drawing_TypographyPaint(OH_Drawing_Typography* typography, OH_Drawing_Canvas* canvas, 1032 double potisionX, double potisionY); 1033 1034 /** 1035 * @brief Paints path text on the canvas. 1036 * 1037 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1038 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1039 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 1040 * @param path Indicates path information. 1041 * @param hOffset Indicates the distance along the path to add to the text's starting position. 1042 * @param vOffset Indicates the distance above(-) or below(+) the path to position the text. 1043 * @since 12 1044 * @version 1.0 1045 */ 1046 void OH_Drawing_TypographyPaintOnPath(OH_Drawing_Typography* typography, OH_Drawing_Canvas* canvas, 1047 OH_Drawing_Path* path, double hOffset, double vOffset); 1048 1049 /** 1050 * @brief Gets the max width. 1051 * 1052 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1053 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1054 * @return Returns the max width. 1055 * @since 9 1056 * @version 1.1 1057 */ 1058 double OH_Drawing_TypographyGetMaxWidth(OH_Drawing_Typography* typography); 1059 1060 /** 1061 * @brief Gets the height. 1062 * 1063 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1064 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1065 * @return Returns the height. 1066 * @since 9 1067 * @version 1.1 1068 */ 1069 double OH_Drawing_TypographyGetHeight(OH_Drawing_Typography* typography); 1070 1071 /** 1072 * @brief Obtains the width of the longest line. You are advised to round up the return value in actual use. 1073 * When the text content is empty, the minimum float value, 1074 * that is, -340282346638528859811704183484516925440.000000, is returned. 1075 * 1076 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1077 * @param typography Pointer to an <b>OH_Drawing_Typography</b> object, which is obtained by 1078 * {@link OH_Drawing_CreateTypography}. 1079 * @return Returns the width of the longest line. 1080 * @since 9 1081 * @version 1.1 1082 */ 1083 double OH_Drawing_TypographyGetLongestLine(OH_Drawing_Typography* typography); 1084 1085 /** 1086 * @brief Obtains the width of the longest line with indent. You are advised to 1087 * round up the return value in actual use. When the text content is empty, the 1088 * minimum float value, that is, 0.0, is returned. 1089 * 1090 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1091 * @param typography Pointer to an <b>OH_Drawing_Typography</b> object, which is obtained by 1092 * {@link OH_Drawing_CreateTypography}. 1093 * @return Returns the width of the longest line with indent. 1094 * @since 13 1095 * @version 1.1 1096 */ 1097 double OH_Drawing_TypographyGetLongestLineWithIndent(OH_Drawing_Typography* typography); 1098 1099 /** 1100 * @brief Gets the min intrinsic width. 1101 * 1102 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1103 * @param typography the pointer to an <b>OH_Drawing_Typography</b> object. 1104 * @return Returns the min intrinsic width. 1105 * @since 9 1106 * @version 1.1 1107 */ 1108 double OH_Drawing_TypographyGetMinIntrinsicWidth(OH_Drawing_Typography* typography); 1109 1110 /** 1111 * @brief Gets the max intrinsic width. 1112 * 1113 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1114 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1115 * @return Returns the max intrinsic width. 1116 * @since 9 1117 * @version 1.1 1118 */ 1119 double OH_Drawing_TypographyGetMaxIntrinsicWidth(OH_Drawing_Typography* typography); 1120 1121 /** 1122 * @brief Gets the alphabetic baseline. 1123 * 1124 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1125 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1126 * @return Returns the alphabetic baseline. 1127 * @since 9 1128 * @version 1.1 1129 */ 1130 double OH_Drawing_TypographyGetAlphabeticBaseline(OH_Drawing_Typography* typography); 1131 1132 /** 1133 * @brief Gets the ideographic baseline. 1134 * 1135 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1136 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1137 * @return Returns the ideographic baseline. 1138 * @since 9 1139 * @version 1.1 1140 */ 1141 double OH_Drawing_TypographyGetIdeographicBaseline(OH_Drawing_Typography* typography); 1142 1143 /** 1144 * @brief Sets the placeholder. 1145 * 1146 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1147 * @param handler Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object. 1148 * @param span Indicates the pointer to an <b>OH_Drawing_PlaceholderSpan</b> object. 1149 * @since 11 1150 * @version 1.0 1151 */ 1152 void OH_Drawing_TypographyHandlerAddPlaceholder(OH_Drawing_TypographyCreate* handler, OH_Drawing_PlaceholderSpan* span); 1153 1154 /** 1155 * @brief Gets the exceed maxLines. 1156 * 1157 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1158 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1159 * @return Returns the exceed maxLines. 1160 * @since 11 1161 * @version 1.0 1162 */ 1163 bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography* typography); 1164 1165 /** 1166 * @brief Gets the rects for range. 1167 * 1168 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1169 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1170 * @param start Indicates the start of range to set. 1171 * @param end Indicates the end of range to set. 1172 * @param heightStyle Indicates the height style to set. 1173 * For details, see the enum <b>OH_Drawing_RectHeightStyle</b>. 1174 * @param widthStyle Indicates the width style to set. 1175 * For details, see the enum <b>OH_Drawing_RectWidthStyle</b>. 1176 * @return Returns the rects for range. 1177 * @since 11 1178 * @version 1.0 1179 */ 1180 OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography* typography, 1181 size_t start, size_t end, OH_Drawing_RectHeightStyle heightStyle, OH_Drawing_RectWidthStyle widthStyle); 1182 1183 /** 1184 * @brief Gets the rects for placeholders. 1185 * 1186 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1187 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1188 * @return Returns the rects for placeholders. 1189 * @since 11 1190 * @version 1.0 1191 */ 1192 OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders(OH_Drawing_Typography* typography); 1193 1194 /** 1195 * @brief Gets left from textbox. 1196 * 1197 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1198 * @param textbox Indicates the pointer to an <b>OH_Drawing_TextBox</b> object. 1199 * @param index Indicates the index of textbox. 1200 * @return Returns left from textbox. 1201 * @since 11 1202 * @version 1.0 1203 */ 1204 float OH_Drawing_GetLeftFromTextBox(OH_Drawing_TextBox* textbox, int index); 1205 1206 /** 1207 * @brief Gets right from textbox. 1208 * 1209 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1210 * @param textbox Indicates the pointer to an <b>OH_Drawing_TextBox</b> object. 1211 * @param index Indicates the index of textbox. 1212 * @return Returns right from textbox. 1213 * @since 11 1214 * @version 1.0 1215 */ 1216 float OH_Drawing_GetRightFromTextBox(OH_Drawing_TextBox* textbox, int index); 1217 1218 /** 1219 * @brief Gets top from textbox. 1220 * 1221 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1222 * @param textbox Indicates the pointer to an <b>OH_Drawing_TextBox</b> object. 1223 * @param index Indicates the index of textbox. 1224 * @return Returns top from textbox. 1225 * @since 11 1226 * @version 1.0 1227 */ 1228 float OH_Drawing_GetTopFromTextBox(OH_Drawing_TextBox* textbox, int index); 1229 1230 /** 1231 * @brief Gets bottom from textbox. 1232 * 1233 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1234 * @param textbox Indicates the pointer to an <b>OH_Drawing_TextBox</b> object. 1235 * @param index Indicates the index of textbox. 1236 * @return Returns bottom from textbox. 1237 * @since 11 1238 * @version 1.0 1239 */ 1240 float OH_Drawing_GetBottomFromTextBox(OH_Drawing_TextBox* textbox, int index); 1241 1242 /** 1243 * @brief Gets direction from textbox. 1244 * 1245 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1246 * @param textbox Indicates the pointer to an <b>OH_Drawing_TextBox</b> object. 1247 * @param index Indicates the index of textbox. 1248 * @return Returns direction from textbox. 1249 * @since 11 1250 * @version 1.0 1251 */ 1252 int OH_Drawing_GetTextDirectionFromTextBox(OH_Drawing_TextBox* textbox, int index); 1253 1254 /** 1255 * @brief Gets size of textBox. 1256 * 1257 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1258 * @param textBox Indicates the pointer to an <b>OH_Drawing_TextBox</b> object. 1259 * @return Returns size of textBox. 1260 * @since 11 1261 * @version 1.0 1262 */ 1263 size_t OH_Drawing_GetSizeOfTextBox(OH_Drawing_TextBox* textBox); 1264 1265 /** 1266 * @brief Gets the glyphposition at coordinate. 1267 * 1268 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1269 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1270 * @param dx Indicates the positionX of typography to set. 1271 * @param dy Indicates the positionY of typography to set. 1272 * @return Returns the glyphposition at coordinate. 1273 * @since 11 1274 * @version 1.0 1275 * @deprecated since 18 1276 * @useinstead OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster 1277 */ 1278 OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate(OH_Drawing_Typography* typography, 1279 double dx, double dy); 1280 1281 /** 1282 * @brief Gets the glyphposition at coordinate with cluster. 1283 * 1284 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1285 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1286 * @param dx Indicates the positionX of typography to set. 1287 * @param dy Indicates the positionY of typography to set. 1288 * @return Returns the glyphposition at coordinate with cluster. 1289 * @since 11 1290 * @version 1.0 1291 */ 1292 OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster( 1293 OH_Drawing_Typography* typography, double dx, double dy); 1294 1295 /** 1296 * @brief Gets position from position and affinity. 1297 * 1298 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1299 * @param positionAndAffinity Indicates the pointer to an <b>OH_Drawing_PositionAndAffinity</b> object. 1300 * @return Returns position from position and affinity. 1301 * @since 11 1302 * @version 1.0 1303 */ 1304 size_t OH_Drawing_GetPositionFromPositionAndAffinity(OH_Drawing_PositionAndAffinity* positionAndAffinity); 1305 1306 /** 1307 * @brief Gets affinity from position and affinity. 1308 * 1309 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1310 * @param positionandaffinity Indicates the pointer to an <b>OH_Drawing_PositionAndAffinity</b> object. 1311 * @return Returns affinity from position and affinity. 1312 * @since 11 1313 * @version 1.0 1314 */ 1315 int OH_Drawing_GetAffinityFromPositionAndAffinity(OH_Drawing_PositionAndAffinity* positionandaffinity); 1316 1317 /** 1318 * @brief Gets the word boundary. 1319 * 1320 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1321 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1322 * @param offset Indicates the size of text to set. 1323 * @return Returns the word boundary. 1324 * @since 11 1325 * @version 1.0 1326 */ 1327 OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary(OH_Drawing_Typography* typography, size_t offset); 1328 1329 /** 1330 * @brief Gets start from range. 1331 * 1332 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1333 * @param range Indicates the pointer to an <b>OH_Drawing_Range</b> object. 1334 * @return Returns start from range. 1335 * @since 11 1336 * @version 1.0 1337 */ 1338 size_t OH_Drawing_GetStartFromRange(OH_Drawing_Range* range); 1339 1340 /** 1341 * @brief Gets end from range. 1342 * 1343 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1344 * @param range Indicates the pointer to an <b>OH_Drawing_Range</b> object. 1345 * @return Returns end from range. 1346 * @since 11 1347 * @version 1.0 1348 */ 1349 size_t OH_Drawing_GetEndFromRange(OH_Drawing_Range* range); 1350 1351 /** 1352 * @brief Gets the line count. 1353 * 1354 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1355 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1356 * @return Returns the line count. 1357 * @since 11 1358 * @version 1.0 1359 */ 1360 size_t OH_Drawing_TypographyGetLineCount(OH_Drawing_Typography* typography); 1361 1362 /** 1363 * @brief Sets the decoration style. 1364 * 1365 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1366 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 1367 * @param decorationStyle Indicates the text decoration style to set. 1368 * For details, see the enum <b>OH_Drawing_TextDecorationStyle</b>. 1369 * @since 11 1370 * @version 1.0 1371 */ 1372 void OH_Drawing_SetTextStyleDecorationStyle(OH_Drawing_TextStyle* style, int decorationStyle); 1373 1374 /** 1375 * @brief Sets the decoration thickness scale. 1376 * 1377 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1378 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 1379 * @param decorationThicknessScale Indicates the thickness scale of text decoration to set. 1380 * @since 11 1381 * @version 1.0 1382 */ 1383 void OH_Drawing_SetTextStyleDecorationThicknessScale(OH_Drawing_TextStyle* style, double decorationThicknessScale); 1384 1385 /** 1386 * @brief Sets the letter spacing. 1387 * 1388 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1389 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 1390 * @param letterSpacing Indicates the letter space to set. 1391 * @since 11 1392 * @version 1.0 1393 */ 1394 void OH_Drawing_SetTextStyleLetterSpacing(OH_Drawing_TextStyle* style, double letterSpacing); 1395 1396 /** 1397 * @brief Sets the word spacing. 1398 * 1399 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1400 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 1401 * @param wordSpacing Indicates the word space to set. 1402 * @since 11 1403 * @version 1.0 1404 */ 1405 void OH_Drawing_SetTextStyleWordSpacing(OH_Drawing_TextStyle* style, double wordSpacing); 1406 1407 /** 1408 * @brief Sets the half leading. 1409 * 1410 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1411 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 1412 * @param halfLeading Indicates the half leading to set. 1413 * @since 11 1414 * @version 1.0 1415 */ 1416 void OH_Drawing_SetTextStyleHalfLeading(OH_Drawing_TextStyle* style, bool halfLeading); 1417 1418 /** 1419 * @brief Sets the ellipsis. 1420 * 1421 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1422 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 1423 * @param ellipsis Indicates the pointer to ellipsis style. 1424 * @since 11 1425 * @version 1.0 1426 * @deprecated since 18 1427 * @useinstead OH_Drawing_SetTypographyTextEllipsis 1428 */ 1429 void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle* style, const char* ellipsis); 1430 1431 /** 1432 * @brief Sets the ellipsis modal. 1433 * 1434 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1435 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 1436 * @param ellipsisModal Indicates the ellipsis model to set. For details, see the enum <b>OH_Drawing_EllipsisModal</b>. 1437 * @since 11 1438 * @version 1.0 1439 * @deprecated since 18 1440 * @useinstead OH_Drawing_SetTypographyTextEllipsisModal 1441 */ 1442 void OH_Drawing_SetTextStyleEllipsisModal(OH_Drawing_TextStyle* style, int ellipsisModal); 1443 1444 /** 1445 * @brief Sets the break strategy. 1446 * 1447 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1448 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 1449 * @param breakStrategy Indicates the break strategy to set. For details, see the enum <b>OH_Drawing_BreakStrategy</b>. 1450 * @since 11 1451 * @version 1.0 1452 */ 1453 void OH_Drawing_SetTypographyTextBreakStrategy(OH_Drawing_TypographyStyle* style, int breakStrategy); 1454 1455 /** 1456 * @brief Sets the word break type. 1457 * 1458 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1459 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 1460 * @param wordBreakType Indicates the word break type to set. For details, see the enum <b>OH_Drawing_WordBreakType</b>. 1461 * @since 11 1462 * @version 1.0 1463 */ 1464 void OH_Drawing_SetTypographyTextWordBreakType(OH_Drawing_TypographyStyle* style, int wordBreakType); 1465 1466 /** 1467 * @brief Sets the ellipsis modal. 1468 * 1469 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1470 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 1471 * @param ellipsisModal Indicates the ellipsis modal to set. For details, see the enum <b>OH_Drawing_EllipsisModal</b>. 1472 * @since 11 1473 * @version 1.0 1474 */ 1475 void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle* style, int ellipsisModal); 1476 1477 /** 1478 * @brief get line height. 1479 * 1480 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1481 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1482 * @param lineNumber Indicates the line number. 1483 * @return Returns line height. 1484 * @since 11 1485 * @version 1.0 1486 */ 1487 double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography* typography, int lineNumber); 1488 1489 /** 1490 * @brief get line width. 1491 * 1492 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1493 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1494 * @param lineNumber Indicates the line number. 1495 * @return Returns line width. 1496 * @since 11 1497 * @version 1.0 1498 */ 1499 double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography* typography, int lineNumber); 1500 1501 /** 1502 * @brief get line text range. 1503 * 1504 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1505 * @param typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object. 1506 * @param lineNumber Indicates the line number. 1507 * @param includeSpaces Indicates whether spaces are contained. 1508 * @return Returns line text range. 1509 * @since 12 1510 * @version 1.0 1511 */ 1512 OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange(OH_Drawing_Typography* typography, 1513 int lineNumber, bool includeSpaces); 1514 1515 /** 1516 * @brief Creates an <b>OH_Drawing_FontDescriptor</b> object. 1517 * 1518 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1519 * @return Returns the pointer to the font descriptor object <b>OH_Drawing_FontDescriptor</b> created. 1520 * @since 12 1521 * @version 1.0 1522 */ 1523 OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor(void); 1524 1525 /** 1526 * @brief Releases the memory occupied by an <b>OH_Drawing_FontDescriptor</b> object. 1527 * 1528 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1529 * @param descriptor the pointer to the font descriptor object <b>OH_Drawing_FontDescriptor</b>. 1530 * @since 12 1531 * @version 1.0 1532 */ 1533 void OH_Drawing_DestroyFontDescriptor(OH_Drawing_FontDescriptor* descriptor); 1534 1535 /** 1536 * @brief Creates an <b>OH_Drawing_FontParser</b> object. 1537 * 1538 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1539 * @return Returns the pointer to the font parser object <b>OH_Drawing_FontParser</b>. 1540 * @since 12 1541 * @version 1.0 1542 */ 1543 OH_Drawing_FontParser* OH_Drawing_CreateFontParser(void); 1544 1545 /** 1546 * @brief Releases the memory occupied by an <b>OH_Drawing_FontParser</b> object. 1547 * 1548 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1549 * @param parser Indicates the pointer to the font parser object <b>OH_Drawing_FontParser</b>. 1550 * @since 12 1551 * @version 1.0 1552 */ 1553 void OH_Drawing_DestroyFontParser(OH_Drawing_FontParser* parser); 1554 1555 /** 1556 * @brief Gets a list of system font names. 1557 * 1558 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1559 * @param fontParser Indicates the pointer to the font parser object <b>OH_Drawing_FontParser</b>. 1560 * @param num Returns the number of obtained system font names. 1561 * @return Returns a list of obtained system fonts. 1562 * @since 12 1563 * @version 1.0 1564 */ 1565 char** OH_Drawing_FontParserGetSystemFontList(OH_Drawing_FontParser* fontParser, size_t* num); 1566 1567 /** 1568 * @brief Releases the memory occupied by a list of system font names. 1569 * 1570 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1571 * @param fontList Indicates the pointer to a list of system font names. 1572 * @param num The number of obtained system font names. 1573 * @since 12 1574 * @version 1.0 1575 */ 1576 void OH_Drawing_DestroySystemFontList(char** fontList, size_t num); 1577 1578 /** 1579 * @brief Gets information about the system font by font name. 1580 * 1581 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1582 * @param fontParser Indicates the pointer to the font parser object <b>OH_Drawing_FontParser</b>. 1583 * @param name font name. 1584 * @return Returns system fonts information. 1585 * @since 12 1586 * @version 1.0 1587 */ 1588 OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName(OH_Drawing_FontParser* fontParser, const char* name); 1589 1590 /** 1591 * @brief Get line metrics information. 1592 * 1593 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1594 * @param typography Indicates the pointer to a typography object <b>OH_Drawing_Typography</b>. 1595 * @return Indicates the pointer to a line metrics object <b>OH_Drawing_LineMetrics</b>. 1596 * @since 12 1597 * @version 1.0 1598 */ 1599 OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics(OH_Drawing_Typography* typography); 1600 1601 /** 1602 * @brief Get the number of lines. 1603 * 1604 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1605 * @param lineMetrics Indicates the pointer to a line metrics object <b>OH_Drawing_LineMetrics</b>. 1606 * @return Returns the number of lines. 1607 * @since 12 1608 * @version 1.0 1609 */ 1610 size_t OH_Drawing_LineMetricsGetSize(OH_Drawing_LineMetrics* lineMetrics); 1611 1612 /** 1613 * @brief Releases the memory occupied by line metrics. 1614 * 1615 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1616 * @param lineMetrics Indicates the pointer to a line metrics object <b>OH_Drawing_LineMetrics</b>. 1617 * @since 12 1618 * @version 1.0 1619 */ 1620 void OH_Drawing_DestroyLineMetrics(OH_Drawing_LineMetrics* lineMetrics); 1621 1622 /** 1623 * @brief Gets the specified line by line number. 1624 * 1625 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1626 * @param typography Indicates the pointer to a typography object <b>OH_Drawing_Typography</b>. 1627 * @param lineNumber Line number. 1628 * @param lineMetric Indicates the pointer to a line metrics object <b>OH_Drawing_LineMetrics</b>. 1629 * @return Whether the line metrics was obtained. 1630 * @since 12 1631 * @version 1.0 1632 */ 1633 bool OH_Drawing_TypographyGetLineMetricsAt(OH_Drawing_Typography* typography, 1634 int lineNumber, OH_Drawing_LineMetrics* lineMetric); 1635 1636 /** 1637 * @brief Sets the ellipsis of lines in a text file. 1638 * 1639 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1640 * @param style Indicates the pointer to a typography object <b>OH_Drawing_Typography</b>. 1641 * @param ellipsis Indicates the line textellipsis. 1642 * @since 12 1643 * @version 1.0 1644 */ 1645 void OH_Drawing_SetTypographyTextEllipsis(OH_Drawing_TypographyStyle* style, const char* ellipsis); 1646 1647 /** 1648 * @brief Sets the locale of lines in a text file. 1649 * 1650 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1651 * @param style Indicates the pointer to a typography style object 1652 * <b>OH_Drawing_TypographyStyle</b>. 1653 * @param locale Indicates the pointer to the locale to set. 1654 * @since 12 1655 * @version 1.0 1656 */ 1657 void OH_Drawing_SetTypographyTextLocale(OH_Drawing_TypographyStyle* style, const char* locale); 1658 1659 /** 1660 * @brief Sets the textSplitRatio of lines in a text file. 1661 * 1662 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1663 * @param style Indicates the pointer to a typography style object 1664 * <b>OH_Drawing_TypographyStyle</b>. 1665 * @param textSplitRatio Indicates the textSplitRatio of lines to set. 1666 * @since 12 1667 * @version 1.0 1668 */ 1669 void OH_Drawing_SetTypographyTextSplitRatio(OH_Drawing_TypographyStyle* style, float textSplitRatio); 1670 1671 /** 1672 * @brief Gets the TextStyle of lines in a text file. 1673 * 1674 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1675 * @param style Indicates the pointer to a typography style object 1676 * <b>OH_Drawing_TypographyStyle</b>. 1677 * @return Returns line text textstyle. 1678 * @since 12 1679 * @version 1.0 1680 */ 1681 OH_Drawing_TextStyle* OH_Drawing_TypographyGetTextStyle(OH_Drawing_TypographyStyle* style); 1682 1683 /** 1684 * @brief Gets the EffectiveAlign of lines in a text file. 1685 * 1686 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1687 * @param style Indicates the pointer to a typography style object 1688 * <b>OH_Drawing_TypographyStyle</b>. 1689 * @return Returns line text align. 1690 * @since 12 1691 * @version 1.0 1692 * @deprecated since 18 1693 * @useinstead OH_Drawing_TypographyStyleGetEffectiveAlignment 1694 */ 1695 int OH_Drawing_TypographyGetEffectiveAlignment(OH_Drawing_TypographyStyle* style); 1696 1697 /** 1698 * @brief Gets the UnlimitedLines of lines in a text file. 1699 * 1700 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1701 * @param style Indicates the pointer to a typography style object 1702 * <b>OH_Drawing_TypographyStyle</b>. 1703 * @return Returns whether the text has a maximum line limit, 1704 * with true indicating a maximum line limit and false indicating no maximum line limit. 1705 * @since 12 1706 * @version 1.0 1707 */ 1708 bool OH_Drawing_TypographyIsLineUnlimited(OH_Drawing_TypographyStyle* style); 1709 1710 /** 1711 * @brief Gets the IsEllipsized of lines in a text file. 1712 * 1713 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1714 * @param style Indicates the pointer to a typography style object 1715 * <b>OH_Drawing_TypographyStyle</b>. 1716 * @return Returns whether the text has ellipsis, 1717 * true meaning there is an ellipsis and false meaning there is no ellipsis. 1718 * @since 12 1719 * @version 1.0 1720 */ 1721 bool OH_Drawing_TypographyIsEllipsized(OH_Drawing_TypographyStyle* style); 1722 1723 /** 1724 * @brief set line textstyle. 1725 * 1726 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1727 * @param handler Indicates the pointer to a typography style object 1728 * <b>OH_Drawing_TypographyStyle</b>. 1729 * @param style Indicates the pointer to a text style object <b>OH_Drawing_TextStyle</b>. 1730 * @since 12 1731 * @version 1.0 1732 */ 1733 void OH_Drawing_SetTypographyTextStyle(OH_Drawing_TypographyStyle* handler, OH_Drawing_TextStyle* style); 1734 1735 /** 1736 * @brief get line fontmetrics. 1737 * 1738 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1739 * @param typography Indicates the pointer to a typography object <b>OH_Drawing_Typography</b>. 1740 * @param style Indicates the pointer to a text style object <b>OH_Drawing_TextStyle</b>. 1741 * @param fontmetrics Indicates the pointer to a font metrics object <b>OH_Drawing_Font_Metrics</b>. 1742 * @return Whether the font metrics was obtained. 1743 * @since 12 1744 * @version 1.0 1745 */ 1746 bool OH_Drawing_TextStyleGetFontMetrics(OH_Drawing_Typography* typography, 1747 OH_Drawing_TextStyle* style, OH_Drawing_Font_Metrics* fontmetrics); 1748 1749 /** 1750 * @brief Gets the position of the specified line or the first text of the specified line. 1751 * 1752 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1753 * @param typography Indicates the pointer to a typography object <b>OH_Drawing_Typography</b>. 1754 * @param lineNumber Line number. 1755 * @param oneLine True is the information for the whole line, and false is the information to get the first character 1756 * @param includeWhitespace Whether the text width contains whitespace. 1757 * @param drawingLineMetrics Indicates the pointer to a line metrics object <b>OH_Drawing_LineMetrics</b>. 1758 * @return return whether the information was successfully fetched. 1759 * @since 12 1760 * @version 1.0 1761 */ 1762 bool OH_Drawing_TypographyGetLineInfo(OH_Drawing_Typography* typography, int lineNumber, bool oneLine, 1763 bool includeWhitespace, OH_Drawing_LineMetrics* drawingLineMetrics); 1764 1765 /** 1766 * @brief Sets the font weight of text typography. 1767 * 1768 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1769 * @param style Indicates the pointer to a typography style object 1770 * <b>OH_Drawing_TypographyStyle</b>. 1771 * @param weight Indicates the font weight of text typography to set. For details, 1772 * see the enum <b>OH_Drawing_FontWeight</b>. 1773 * @since 12 1774 * @version 1.0 1775 */ 1776 void OH_Drawing_SetTypographyTextFontWeight(OH_Drawing_TypographyStyle* style, int weight); 1777 1778 /** 1779 * @brief Sets the font style of text typography. 1780 * 1781 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1782 * @param style Indicates the pointer to a typography style object 1783 * <b>OH_Drawing_TypographyStyle</b>. 1784 * @param fontStyle Indicates the font style of text typography to set. For details, 1785 * see the enum <b>OH_Drawing_FontStyle</b>. 1786 * @since 12 1787 * @version 1.0 1788 */ 1789 void OH_Drawing_SetTypographyTextFontStyle(OH_Drawing_TypographyStyle* style, int fontStyle); 1790 1791 /** 1792 * @brief Sets the font family of text typography. 1793 * 1794 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1795 * @param style Indicates the pointer to a typography style object 1796 * <b>OH_Drawing_TypographyStyle</b>. 1797 * @param fontFamily Indicates the pointer to the font family of text typography to set. 1798 * @since 12 1799 * @version 1.0 1800 */ 1801 void OH_Drawing_SetTypographyTextFontFamily(OH_Drawing_TypographyStyle* style, const char* fontFamily); 1802 1803 /** 1804 * @brief Sets the font size of text typography. 1805 * 1806 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1807 * @param style Indicates the pointer to a typography style object 1808 * <b>OH_Drawing_TypographyStyle</b>. 1809 * @param fontSize Indicates the font size of text typography to set. 1810 * @since 12 1811 * @version 1.0 1812 */ 1813 void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle* style, double fontSize); 1814 1815 /** 1816 * @brief Sets the font height of text typography. 1817 * 1818 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1819 * @param style Indicates the pointer to a typography style object 1820 * <b>OH_Drawing_TypographyStyle</b>. 1821 * @param fontHeight Indicates the font height of text typography to set. 1822 * @since 12 1823 * @version 1.0 1824 */ 1825 void OH_Drawing_SetTypographyTextFontHeight(OH_Drawing_TypographyStyle* style, double fontHeight); 1826 1827 /** 1828 * @brief Sets the half leading of text typography. 1829 * 1830 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1831 * @param style Indicates the pointer to a typography style object 1832 * <b>OH_Drawing_TypographyStyle</b>. 1833 * @param halfLeading Indicates the half leading of text typography to set. 1834 * @since 12 1835 * @version 1.0 1836 */ 1837 void OH_Drawing_SetTypographyTextHalfLeading(OH_Drawing_TypographyStyle* style, bool halfLeading); 1838 1839 /** 1840 * @brief Sets whether to enable line style for text typography. 1841 * 1842 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1843 * @param style Indicates the pointer to a typography style object 1844 * <b>OH_Drawing_TypographyStyle</b>. 1845 * @param useLineStyle Indicates whether the line style for text typography is used. 1846 * @since 12 1847 * @version 1.0 1848 */ 1849 void OH_Drawing_SetTypographyTextUseLineStyle(OH_Drawing_TypographyStyle* style, bool useLineStyle); 1850 1851 /** 1852 * @brief Sets the font weight of line style for text typography. 1853 * 1854 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1855 * @param style Indicates the pointer to a typography style object 1856 * <b>OH_Drawing_TypographyStyle</b>. 1857 * @param weight Indicates the font weight of line style for text typography to set. 1858 * For details, see the enum <b>OH_Drawing_FontWeight</b>. 1859 * @since 12 1860 * @version 1.0 1861 */ 1862 void OH_Drawing_SetTypographyTextLineStyleFontWeight(OH_Drawing_TypographyStyle* style, int weight); 1863 1864 /** 1865 * @brief Sets the font style of line style for text typography. 1866 * 1867 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1868 * @param style Indicates the pointer to a typography style object 1869 * <b>OH_Drawing_TypographyStyle</b>. 1870 * @param fontStyle Indicates the font style of line style for text typography to set. For details, 1871 * see the enum <b>OH_Drawing_FontStyle</b>. 1872 * @since 12 1873 * @version 1.0 1874 */ 1875 void OH_Drawing_SetTypographyTextLineStyleFontStyle(OH_Drawing_TypographyStyle* style, int fontStyle); 1876 1877 /** 1878 * @brief Sets the font families of line style for text typography. 1879 * 1880 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1881 * @param style Indicates the pointer to a typography style object 1882 * <b>OH_Drawing_TypographyStyle</b>. 1883 * @param fontFamiliesNumber Indicates the number of font families to set. 1884 * @param fontFamilies Indicates the pointer to the font families of line style for text typography to set. 1885 * @since 12 1886 * @version 1.0 1887 */ 1888 void OH_Drawing_SetTypographyTextLineStyleFontFamilies(OH_Drawing_TypographyStyle* style, 1889 int fontFamiliesNumber, const char* fontFamilies[]); 1890 1891 /** 1892 * @brief Sets the font size of line style for text typography. 1893 * 1894 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1895 * @param style Indicates the pointer to a typography style object 1896 * <b>OH_Drawing_TypographyStyle</b>. 1897 * @param lineStyleFontSize Indicates the font size of line style for text typography to set. 1898 * @since 12 1899 * @version 1.0 1900 */ 1901 void OH_Drawing_SetTypographyTextLineStyleFontSize(OH_Drawing_TypographyStyle* style, double lineStyleFontSize); 1902 1903 /** 1904 * @brief Sets the font height of line style for text typography. 1905 * 1906 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1907 * @param style Indicates the pointer to a typography style object 1908 * <b>OH_Drawing_TypographyStyle</b>. 1909 * @param lineStyleFontHeight Indicates the font height of line style for text typography to set. 1910 * @since 12 1911 * @version 1.0 1912 */ 1913 void OH_Drawing_SetTypographyTextLineStyleFontHeight(OH_Drawing_TypographyStyle* style, double lineStyleFontHeight); 1914 1915 /** 1916 * @brief Sets the half leading of line style for text typography. 1917 * 1918 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1919 * @param style Indicates the pointer to a typography style object 1920 * <b>OH_Drawing_TypographyStyle</b>. 1921 * @param lineStyleHalfLeading Indicates the half leading of line for text typography to set. 1922 * @since 12 1923 * @version 1.0 1924 */ 1925 void OH_Drawing_SetTypographyTextLineStyleHalfLeading(OH_Drawing_TypographyStyle* style, bool lineStyleHalfLeading); 1926 1927 /** 1928 * @brief Sets the spacing scale of line style for text typography. 1929 * 1930 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1931 * @param style Indicates the pointer to a typography style object 1932 * <b>OH_Drawing_TypographyStyle</b>. 1933 * @param spacingScale Indicates the space scale of line for text typography to set. 1934 * @since 12 1935 * @version 1.0 1936 */ 1937 void OH_Drawing_SetTypographyTextLineStyleSpacingScale(OH_Drawing_TypographyStyle* style, double spacingScale); 1938 1939 /** 1940 * @brief Sets whether only line style is enabled for text typography. 1941 * 1942 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1943 * @param style Indicates the pointer to a typography style object 1944 * <b>OH_Drawing_TypographyStyle</b>. 1945 * @param lineStyleOnly Indicates the line style for text typography to set only. 1946 * @since 12 1947 * @version 1.0 1948 */ 1949 void OH_Drawing_SetTypographyTextLineStyleOnly(OH_Drawing_TypographyStyle* style, bool lineStyleOnly); 1950 1951 /** 1952 * @brief Creates an <b>OH_Drawing_TextShadow</b> object. 1953 * 1954 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1955 * @return Returns the pointer to the text shadow object created <b>OH_Drawing_TextShadow</b>. 1956 * @since 12 1957 * @version 1.0 1958 */ 1959 OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow(void); 1960 1961 /** 1962 * @brief Releases the memory occupied by the text shadow object <b>OH_Drawing_TextShadow</b>. 1963 * 1964 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1965 * @param shadow Indicates the pointer to the text shadow object <b>OH_Drawing_TextShadow</b>. 1966 * @since 12 1967 * @version 1.0 1968 */ 1969 void OH_Drawing_DestroyTextShadow(OH_Drawing_TextShadow* shadow); 1970 1971 /** 1972 * @brief Gets the vector of TextShadow in TextStyle. 1973 * 1974 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1975 * @param style Indicates the pointer to a text style object <b>OH_Drawing_TextStyle</b>. 1976 * @param int Indicates the number in vector to set. 1977 * @param style Indicates the pointer to the text shadow object <b>OH_Drawing_TextShadow</b>. 1978 * @return Returns the vector of TextShadow. 1979 * @since 12 1980 * @version 1.0 1981 */ 1982 OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows(OH_Drawing_TextStyle* style); 1983 1984 /** 1985 * @brief Gets the size of vector of TextShadow in TextStyle. 1986 * 1987 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1988 * @param style Indicates the pointer to a text style object <b>OH_Drawing_TextStyle</b>. 1989 * @return Returns the size of vector. 1990 * @since 12 1991 * @version 1.0 1992 */ 1993 int OH_Drawing_TextStyleGetShadowCount(OH_Drawing_TextStyle* style); 1994 1995 /** 1996 * @brief Adds element in vector of TextShadow in TextStyle. 1997 * 1998 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 1999 * @param style Indicates the pointer to a text style object <b>OH_Drawing_TextStyle</b>. 2000 * @param shadow Indicates the pointer to the text shadow object <b>OH_Drawing_TextShadow</b>. 2001 * @since 12 2002 * @version 1.0 2003 */ 2004 void OH_Drawing_TextStyleAddShadow(OH_Drawing_TextStyle* style, const OH_Drawing_TextShadow* shadow); 2005 2006 /** 2007 * @brief clear elements in vector of TextShadow in TextStyle. 2008 * 2009 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2010 * @param style Indicates the pointer to a text style object <b>OH_Drawing_TextStyle</b>. 2011 * @since 12 2012 * @version 1.0 2013 */ 2014 void OH_Drawing_TextStyleClearShadows(OH_Drawing_TextStyle* style); 2015 2016 /** 2017 * @brief Gets element in vector of TextShadow with index. 2018 * 2019 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2020 * @param style Indicates the pointer to a text style object <b>OH_Drawing_TextStyle</b>. 2021 * @param index Indicates the index to set. 2022 * @return Returns the pointer to element with the index in vector of the text style object 2023 * <b>OH_Drawing_TextStyle</b>. 2024 * @since 12 2025 * @version 1.0 2026 */ 2027 OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex(OH_Drawing_TextStyle* style, int index); 2028 2029 /** 2030 * @brief Set indents of the typography. 2031 * 2032 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2033 * @param typography Indicates the pointer to a typography object <b>OH_Drawing_Typography</b>. 2034 * @param indentsNumber Indicates the pointer to the indents to set. 2035 * @param indents Indicates the pointer to the indents to set. 2036 * @since 12 2037 * @version 1.0 2038 */ 2039 void OH_Drawing_TypographySetIndents(OH_Drawing_Typography* typography, int indentsNumber, const float indents[]); 2040 2041 /** 2042 * @brief Gets element with index in vector of Indents. 2043 * 2044 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2045 * @param typography Indicates the pointer to a typography object <b>OH_Drawing_Typography</b>. 2046 * @param index Indicates the index to set. 2047 * @return float Indicates the element with the index in vector of Indents. 2048 * @since 12 2049 * @version 1.0 2050 */ 2051 float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography* typography, int index); 2052 2053 /** 2054 * @brief Releases the memory occupied by vector with the text shadow object <b>OH_Drawing_TextShadow</b>. 2055 * 2056 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2057 * @param shadow the pointer to the text shadow object <b>OH_Drawing_TextShadow</b>. 2058 * @since 12 2059 * @version 1.0 2060 */ 2061 void OH_Drawing_DestroyTextShadows(OH_Drawing_TextShadow* shadow); 2062 2063 /** 2064 * @brief Set mode of applying the leading over and under text. 2065 * 2066 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2067 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 2068 * @param heightMode Indicates the mode to set. 2069 * @since 12 2070 * @version 1.0 2071 */ 2072 void OH_Drawing_TypographyTextSetHeightBehavior(OH_Drawing_TypographyStyle* style, 2073 OH_Drawing_TextHeightBehavior heightMode); 2074 2075 /** 2076 * @brief Get mode of applying the leading over and under text. 2077 * 2078 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2079 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 2080 * @return Returns the mode. 2081 * @since 12 2082 * @version 1.0 2083 */ 2084 OH_Drawing_TextHeightBehavior OH_Drawing_TypographyTextGetHeightBehavior(OH_Drawing_TypographyStyle* style); 2085 2086 /** 2087 * @brief Set struct of background rect and styleId of text. 2088 * 2089 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2090 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2091 * @param rectStyleInfo Indicates the pointer to an <b>OH_Drawing_RectStyle_Info</b> object. 2092 * @param styleId Indicates the styleId of text to set. 2093 * @since 12 2094 * @version 1.0 2095 */ 2096 void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle* style, 2097 const OH_Drawing_RectStyle_Info* rectStyleInfo, int styleId); 2098 2099 /** 2100 * @brief Add symbols in creating typography. 2101 * 2102 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2103 * @param handler Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object. 2104 * @param symbol Indicates the symbol to set. 2105 * @since 12 2106 * @version 1.0 2107 */ 2108 void OH_Drawing_TypographyHandlerAddSymbol(OH_Drawing_TypographyCreate* handler, uint32_t symbol); 2109 2110 /** 2111 * @brief Add font feature. 2112 * 2113 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2114 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2115 * @param tag Indicates the pointer to the tag to set. 2116 * @param value Indicates the value to set. 2117 * @since 12 2118 * @version 1.0 2119 */ 2120 void OH_Drawing_TextStyleAddFontFeature(OH_Drawing_TextStyle* style, const char* tag, int value); 2121 2122 /** 2123 * @brief Add font variation. 2124 * 2125 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2126 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2127 * @param axis Indicates the pointer to font variation axis. 2128 * @param value Indicates the font variation value to set. 2129 * @since 12 2130 * @version 1.0 2131 */ 2132 void OH_Drawing_TextStyleAddFontVariation(OH_Drawing_TextStyle* style, const char* axis, const float value); 2133 2134 /** 2135 * @brief Get all font features. 2136 * 2137 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2138 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2139 * @return OH_Drawing_FontFeature Indicates the pointer to an array of structures of OH_Drawing_FontFeature. 2140 * Get size of font feature by OH_Drawing_TextStyleGetFontFeatureSize. 2141 * @since 12 2142 * @version 1.0 2143 */ 2144 OH_Drawing_FontFeature* OH_Drawing_TextStyleGetFontFeatures(OH_Drawing_TextStyle* style); 2145 2146 /** 2147 * @brief Release the memory occupied by array of structures of font features. 2148 * 2149 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2150 * @param fontFeature Indicates the pointer to an array of structures of OH_Drawing_FontFeature. 2151 * @param fontFeatureSize Indicates the size of array of structures of OH_Drawing_FontFeature. 2152 * @since 12 2153 * @version 1.0 2154 */ 2155 void OH_Drawing_TextStyleDestroyFontFeatures(OH_Drawing_FontFeature* fontFeature, size_t fontFeatureSize); 2156 2157 /** 2158 * @brief Get size of font features. 2159 * 2160 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2161 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2162 * @return Returns the size of fontfeatures map. 2163 * @since 12 2164 * @version 1.0 2165 */ 2166 size_t OH_Drawing_TextStyleGetFontFeatureSize(OH_Drawing_TextStyle* style); 2167 2168 /** 2169 * @brief Clear font features. 2170 * 2171 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2172 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2173 * @since 12 2174 * @version 1.0 2175 */ 2176 void OH_Drawing_TextStyleClearFontFeature(OH_Drawing_TextStyle* style); 2177 2178 /** 2179 * @brief Set baseline shift of text. 2180 * 2181 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2182 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2183 * @param lineShift Indicates the baseline shift to set. 2184 * @since 12 2185 * @version 1.0 2186 */ 2187 void OH_Drawing_TextStyleSetBaselineShift(OH_Drawing_TextStyle* style, double lineShift); 2188 2189 /** 2190 * @brief Get baseline shift of text. 2191 * 2192 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2193 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2194 * @return Returns the baseline shift. 2195 * @since 12 2196 * @version 1.0 2197 */ 2198 double OH_Drawing_TextStyleGetBaselineShift(OH_Drawing_TextStyle* style); 2199 2200 /** 2201 * @brief Gets the text color. 2202 * 2203 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2204 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2205 * @return Returns the text color. 2206 * @since 12 2207 * @version 1.0 2208 */ 2209 uint32_t OH_Drawing_TextStyleGetColor(OH_Drawing_TextStyle* style); 2210 2211 /** 2212 * @brief Gets text decoration style. 2213 * 2214 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2215 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2216 * @return Returns text decoration style. 2217 * @since 12 2218 * @version 1.0 2219 */ 2220 OH_Drawing_TextDecorationStyle OH_Drawing_TextStyleGetDecorationStyle(OH_Drawing_TextStyle* style); 2221 2222 /** 2223 * @brief Gets font weight. 2224 * 2225 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2226 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2227 * @return Returns font Weight. 2228 * @since 12 2229 * @version 1.0 2230 */ 2231 OH_Drawing_FontWeight OH_Drawing_TextStyleGetFontWeight(OH_Drawing_TextStyle* style); 2232 2233 /** 2234 * @brief Gets font style. 2235 * 2236 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2237 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2238 * @return Returns font style. 2239 * @since 12 2240 * @version 1.0 2241 */ 2242 OH_Drawing_FontStyle OH_Drawing_TextStyleGetFontStyle(OH_Drawing_TextStyle* style); 2243 2244 /** 2245 * @brief Gets the font baseline. 2246 * 2247 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2248 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2249 * @return Returns the font baseline. 2250 * @since 12 2251 * @version 1.0 2252 */ 2253 OH_Drawing_TextBaseline OH_Drawing_TextStyleGetBaseline(OH_Drawing_TextStyle* style); 2254 2255 /** 2256 * @brief Gets a list of font families. 2257 * 2258 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2259 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2260 * @param num Indicates count of font families result. 2261 * @return Returns a list of font families. 2262 * @since 12 2263 * @version 1.0 2264 */ 2265 char** OH_Drawing_TextStyleGetFontFamilies(OH_Drawing_TextStyle* style, size_t* num); 2266 2267 /** 2268 * @brief Releases the memory occupied by a list of font families. 2269 * 2270 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2271 * @param fontFamilies Indicates the pointer to a list of font families. 2272 * @param num Indicates the count of obtained font families. 2273 * @since 12 2274 * @version 1.0 2275 */ 2276 void OH_Drawing_TextStyleDestroyFontFamilies(char** fontFamilies, size_t num); 2277 2278 /** 2279 * @brief Gets font size. 2280 * 2281 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2282 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2283 * @return Returns font size. 2284 * @since 12 2285 * @version 1.0 2286 */ 2287 double OH_Drawing_TextStyleGetFontSize(OH_Drawing_TextStyle* style); 2288 2289 /** 2290 * @brief Gets the letter spacing of the text. 2291 * 2292 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2293 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2294 * @return Returns the size of the letter spacing. 2295 * @since 12 2296 * @version 1.0 2297 */ 2298 double OH_Drawing_TextStyleGetLetterSpacing(OH_Drawing_TextStyle* style); 2299 2300 /** 2301 * @brief Gets the word spacing of the text. 2302 * 2303 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2304 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2305 * @return Returns word spacing size. 2306 * @since 12 2307 * @version 1.0 2308 */ 2309 double OH_Drawing_TextStyleGetWordSpacing(OH_Drawing_TextStyle* style); 2310 2311 /** 2312 * @brief Gets font height. 2313 * 2314 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2315 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2316 * @return Returns font height. 2317 * @since 12 2318 * @version 1.0 2319 */ 2320 double OH_Drawing_TextStyleGetFontHeight(OH_Drawing_TextStyle* style); 2321 2322 /** 2323 * @brief Gets whether to set the text to half line spacing. 2324 * 2325 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2326 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2327 * @return Returns true indicates that the spacing takes effect, 2328 * false indicates that the spacing does not take effect. 2329 * @since 12 2330 * @version 1.0 2331 */ 2332 bool OH_Drawing_TextStyleGetHalfLeading(OH_Drawing_TextStyle* style); 2333 2334 /** 2335 * @brief Gets the locale. 2336 * 2337 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2338 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2339 * @return Returns a locale of data type as a pointer to a char. As with the TextStyle lifecycle. 2340 * No release is required and the return value is invalidated after the set method is called. 2341 * @since 12 2342 * @version 1.0 2343 */ 2344 const char* OH_Drawing_TextStyleGetLocale(OH_Drawing_TextStyle* style); 2345 2346 /** 2347 * @brief Sets the text style, including font weight, font width and font slant. 2348 * 2349 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2350 * @param drawingTextStyle Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2351 * @param fontStyle Indicates an <b>OH_Drawing_FontStyleStruct</b> object. 2352 * @since 12 2353 * @version 1.0 2354 */ 2355 void OH_Drawing_SetTextStyleFontStyleStruct(OH_Drawing_TextStyle* drawingTextStyle, 2356 OH_Drawing_FontStyleStruct fontStyle); 2357 2358 /** 2359 * @brief Gets the text style, including font weight, font width and font slant. 2360 * 2361 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2362 * @param drawingTextStyle Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2363 * @return Returns the <b>OH_Drawing_FontStyleStruct</b> object getted. 2364 * @since 12 2365 * @version 1.0 2366 */ 2367 OH_Drawing_FontStyleStruct OH_Drawing_TextStyleGetFontStyleStruct(OH_Drawing_TextStyle* drawingTextStyle); 2368 2369 /** 2370 * @brief Sets the typography style, including font weight, font width and font slant. 2371 * 2372 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2373 * @param drawingStyle Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 2374 * @param fontStyle Indicates an <b>OH_Drawing_FontStyleStruct</b> object. 2375 * @since 12 2376 * @version 1.0 2377 */ 2378 void OH_Drawing_SetTypographyStyleFontStyleStruct(OH_Drawing_TypographyStyle* drawingStyle, 2379 OH_Drawing_FontStyleStruct fontStyle); 2380 2381 /** 2382 * @brief Gets the typography style, including font weight, font width and font slant. 2383 * 2384 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2385 * @param drawingStyle Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 2386 * @return Returns the <b>OH_Drawing_FontStyleStruct</b> object getted. 2387 * @since 12 2388 * @version 1.0 2389 */ 2390 OH_Drawing_FontStyleStruct OH_Drawing_TypographyStyleGetFontStyleStruct(OH_Drawing_TypographyStyle* drawingStyle); 2391 2392 /** 2393 * @brief Gets whether the two TextStyle objects are equal. 2394 * 2395 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2396 * @param style Indicates source of comparison <b>OH_Drawing_TextStyle</b> object. 2397 * @param comparedStyle Indicates comparison <b>OH_Drawing_TextStyle</b> object. 2398 * @return Compare result. 2399 * @since 12 2400 * @version 1.0 2401 */ 2402 bool OH_Drawing_TextStyleIsEqual(const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle); 2403 2404 /** 2405 * @brief Gets whether the font properties of two TextStyle objects are equal. 2406 * 2407 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2408 * @param style Indicates source of <b>comparison OH_Drawing_TextStyle</b> object. 2409 * @param comparedStyle Indicates comparison <b>OH_Drawing_TextStyle</b> object. 2410 * @return Compare result. 2411 * @since 12 2412 * @version 1.0 2413 */ 2414 bool OH_Drawing_TextStyleIsEqualByFont(const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle); 2415 2416 /** 2417 * @brief Gets whether two TextStyle objects match attributes 2418 * 2419 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2420 * @param style Indicates enumerates of text style type. 2421 * @param comparedStyle Indicates source of comparison <b>OH_Drawing_TextStyle</b> object. 2422 * @param textStyleType Indicates comparison <b>OH_Drawing_TextStyle</b> object. 2423 * @return Match attributes result. 2424 * @since 12 2425 * @version 1.0 2426 */ 2427 bool OH_Drawing_TextStyleIsAttributeMatched(const OH_Drawing_TextStyle* style, 2428 const OH_Drawing_TextStyle* comparedStyle, OH_Drawing_TextStyleType textStyleType); 2429 2430 /** 2431 * @brief Set placeholder of TextStyle. 2432 * 2433 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2434 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2435 * @since 12 2436 * @version 1.0 2437 */ 2438 void OH_Drawing_TextStyleSetPlaceholder(OH_Drawing_TextStyle* style); 2439 2440 /** 2441 * @brief Gets whether placeholder is enable. 2442 * 2443 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2444 * @param style Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object. 2445 * @return Whether placeholder is enable. 2446 * @since 12 2447 * @version 1.0 2448 */ 2449 bool OH_Drawing_TextStyleIsPlaceholder(OH_Drawing_TextStyle* style); 2450 2451 /** 2452 * @brief Gets text alignment mode. 2453 * 2454 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2455 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 2456 * @return Returns text alignment mode. 2457 * @since 12 2458 * @version 1.0 2459 */ 2460 OH_Drawing_TextAlign OH_Drawing_TypographyStyleGetEffectiveAlignment(OH_Drawing_TypographyStyle* style); 2461 2462 /** 2463 * @brief Gets whether the hinting is enabled. 2464 * 2465 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2466 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 2467 * @return True, if the hinting takes effect; False, if the hinting does not take effect. 2468 * @since 12 2469 * @version 1.0 2470 */ 2471 bool OH_Drawing_TypographyStyleIsHintEnabled(OH_Drawing_TypographyStyle* style); 2472 2473 /** 2474 * @brief Gets system font configuration information. 2475 * 2476 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2477 * @param errorCode Indicates error code returned, based on the error code to 2478 * release the memory of system font configuration information. 2479 * For details, see the enum <b>OH_Drawing_FontConfigInfoErrorCode</b>. 2480 * @return Returns a pointer to system font configuration information. 2481 * Indicates the pointer to an <b>OH_Drawing_FontConfigInfo</b> object. 2482 * @since 12 2483 * @version 1.0 2484 */ 2485 OH_Drawing_FontConfigInfo* OH_Drawing_GetSystemFontConfigInfo(OH_Drawing_FontConfigInfoErrorCode* errorCode); 2486 2487 /** 2488 * @brief Releases the memory occupied by system font configuration information. 2489 * 2490 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2491 * @param drawFontCfgInfo Indicates the pointer to an <b>OH_Drawing_FontConfigInfo</b> object. 2492 * @since 12 2493 * @version 1.0 2494 */ 2495 void OH_Drawing_DestroySystemFontConfigInfo(OH_Drawing_FontConfigInfo* drawFontCfgInfo); 2496 2497 /** 2498 * @brief Sets the strut style for text typography. 2499 * 2500 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2501 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 2502 * @param strutstyle Indicates the pointer of <b>OH_Drawing_StrutStyle</b> object. 2503 * @since 12 2504 * @version 1.0 2505 */ 2506 void OH_Drawing_SetTypographyStyleTextStrutStyle(OH_Drawing_TypographyStyle* style, OH_Drawing_StrutStyle* strutstyle); 2507 2508 /** 2509 * @brief Releases the memory occupied by an <b>OH_Drawing_StrutStyle</b> object. 2510 * 2511 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2512 * @param strutstyle Indicates the pointer of <b>OH_Drawing_StrutStyle</b> object. 2513 * @since 12 2514 * @version 1.0 2515 */ 2516 void OH_Drawing_TypographyStyleDestroyStrutStyle(OH_Drawing_StrutStyle* strutstyle); 2517 2518 /** 2519 * @brief Gets the strut style for text typography. 2520 * 2521 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2522 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 2523 * @return Returns the pointer of <b>OH_Drawing_StrutStyle</b> object. 2524 * @since 12 2525 * @version 1.0 2526 */ 2527 OH_Drawing_StrutStyle* OH_Drawing_TypographyStyleGetStrutStyle(OH_Drawing_TypographyStyle* style); 2528 2529 /** 2530 * @brief Overriding the struct StrutStyle equals operator. 2531 * 2532 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2533 * @param from Indicates source of comparison object. 2534 * @param to Indicates comparison object. 2535 * @since 12 2536 * @version 1.0 2537 */ 2538 bool OH_Drawing_TypographyStyleStrutStyleEquals(OH_Drawing_StrutStyle* from, OH_Drawing_StrutStyle* to); 2539 2540 /** 2541 * @brief Sets the hinting of text typography. 2542 * 2543 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2544 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 2545 * @param hintsEnabled Indicates the hinting of text typography.. 2546 * @since 12 2547 * @version 1.0 2548 */ 2549 void OH_Drawing_TypographyStyleSetHintsEnabled(OH_Drawing_TypographyStyle* style, bool hintsEnabled); 2550 2551 /** 2552 * @brief Getting all font metrics from target row. 2553 * 2554 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2555 * @param typography Indicates a pointer to a typesetting object. 2556 * @param lineNumber Indicates specifies the number of rows. 2557 * @param fontMetricsSize Indicates the return size of font metrics struct from current line. 2558 * @return Returns all character measures for the current row. 2559 * @since 12 2560 * @version 1.0 2561 */ 2562 OH_Drawing_Font_Metrics* OH_Drawing_TypographyGetLineFontMetrics(OH_Drawing_Typography* typography, 2563 size_t lineNumber, size_t* fontMetricsSize); 2564 2565 /** 2566 * @brief Free up all the space taken up by the lineFontMetric. 2567 * 2568 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2569 * @param lineFontMetric Indicates the first address of the lineFontMetric gather to be destroyed. 2570 * @since 12 2571 * @version 1.0 2572 */ 2573 void OH_Drawing_TypographyDestroyLineFontMetrics(OH_Drawing_Font_Metrics* lineFontMetric); 2574 2575 /** 2576 * @brief Mark the Typography as dirty, and initially state the Typography. 2577 * 2578 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2579 * @param typography Indicates the pointer to the text <b>OH_Drawing_Typography</b> object. 2580 * @since 12 2581 * @version 1.0 2582 */ 2583 void OH_Drawing_TypographyMarkDirty(OH_Drawing_Typography* typography); 2584 2585 /** 2586 * @brief Get the unresolved Glyphs count of lines in a text. 2587 * 2588 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2589 * @param typography Indicates the pointer to the text <b>OH_Drawing_Typography</b> object. 2590 * @return Returns unresolved Glyphs count. 2591 * @since 12 2592 * @version 1.0 2593 */ 2594 int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount(OH_Drawing_Typography* typography); 2595 2596 /** 2597 * @brief Update the font size of lines in a text. 2598 * 2599 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2600 * @param typography Indicates the pointer to the text <b>OH_Drawing_Typography</b> object. 2601 * @param from Indicates the source of the original font size. 2602 * @param to Indicates the destination of the updated font size. 2603 * @param fontSize Indicates the size of the font. 2604 * @since 12 2605 * @version 1.0 2606 */ 2607 void OH_Drawing_TypographyUpdateFontSize(OH_Drawing_Typography* typography, size_t from, size_t to, float fontSize); 2608 2609 /** 2610 * @brief Get whether the text layout enables line styles. 2611 * 2612 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2613 * @param style Indicates the pointer to the text <b>OH_Drawing_TypographyStyle</b> object. 2614 * @return Whether or not to enable line styles in text layout only, true means enable, false means disable. 2615 * @since 12 2616 * @version 1.0 2617 */ 2618 bool OH_Drawing_TypographyTextGetLineStyle(OH_Drawing_TypographyStyle* style); 2619 2620 /** 2621 * @brief Get the font weight of line style for text typography. 2622 * 2623 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2624 * @param style Indicates the pointer to a typography style object 2625 * <b>OH_Drawing_TypographyStyle</b>. 2626 * @return Return the font weight of line style for text typography. 2627 * For details, see the enum <b>OH_Drawing_FontWeight</b>. 2628 * @since 12 2629 * @version 1.0 2630 */ 2631 OH_Drawing_FontWeight OH_Drawing_TypographyTextlineStyleGetFontWeight(OH_Drawing_TypographyStyle* style); 2632 2633 /** 2634 * @brief Get the font style of line style for text typography. 2635 * 2636 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2637 * @param style Indicates the pointer to a typography style object 2638 * <b>OH_Drawing_TypographyStyle</b>. 2639 * @return Return the font style of line style for text typography. 2640 * For details, see the enum <b>OH_Drawing_FontStyle</b>. 2641 * @since 12 2642 * @version 1.0 2643 */ 2644 OH_Drawing_FontStyle OH_Drawing_TypographyTextlineStyleGetFontStyle(OH_Drawing_TypographyStyle* style); 2645 2646 /** 2647 * @brief Get the font families of line style for text typography. 2648 * 2649 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2650 * @param style Indicates the pointer to a typography style object 2651 * <b>OH_Drawing_TypographyStyle</b>. 2652 * @param num The number of obtained font names. 2653 * @return Return the font families of line style for text typography. 2654 * @since 12 2655 * @version 1.0 2656 */ 2657 char** OH_Drawing_TypographyTextlineStyleGetFontFamilies(OH_Drawing_TypographyStyle* style, size_t* num); 2658 2659 /** 2660 * @brief Releases the memory occupied by a list of font families names. 2661 * 2662 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2663 * @param fontFamilies Indicates the pointer to a list of font families names. 2664 * @param fontFamiliesNum Indicates the number of obtained font names. 2665 * @since 12 2666 * @version 1.0 2667 */ 2668 void OH_Drawing_TypographyTextlineStyleDestroyFontFamilies(char** fontFamilies, size_t fontFamiliesNum); 2669 2670 /** 2671 * @brief Get the font size of font size for text typography. 2672 * 2673 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2674 * @param style Indicates the pointer to a typography style object 2675 * <b>OH_Drawing_TypographyStyle</b>. 2676 * @return Return the font size of font size for text typography. 2677 * @since 12 2678 * @version 1.0 2679 */ 2680 double OH_Drawing_TypographyTextlineStyleGetFontSize(OH_Drawing_TypographyStyle* style); 2681 2682 /** 2683 * @brief Get the font height scale in text layout. 2684 * 2685 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2686 * @param style Indicates the pointer to a typography style object 2687 * <b>OH_Drawing_TypographyStyle</b>. 2688 * @return Retrun the font height scale in text layout. 2689 * @since 12 2690 * @version 1.0 2691 */ 2692 double OH_Drawing_TypographyTextlineStyleGetHeightScale(OH_Drawing_TypographyStyle* style); 2693 2694 /** 2695 * @brief Get whether to enable font height for line styles in text layout only. 2696 * 2697 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2698 * @param style Indicates the pointer to a typography style object 2699 * <b>OH_Drawing_TypographyStyle</b>. 2700 * @return Whether or not to enable the font height for line styles in text layout only, 2701 * true means enable, false means disable. 2702 * @since 12 2703 * @version 1.0 2704 */ 2705 bool OH_Drawing_TypographyTextlineStyleGetHeightOnly(OH_Drawing_TypographyStyle* style); 2706 2707 /** 2708 * @brief Get the half leading of line style for text typography. 2709 * 2710 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2711 * @param style Indicates the pointer to a typography style object 2712 * <b>OH_Drawing_TypographyStyle</b>. 2713 * @return Whether to enable the text line half leading style, true means enable, false means disable. 2714 * @since 12 2715 * @version 1.0 2716 */ 2717 bool OH_Drawing_TypographyTextlineStyleGetHalfLeading(OH_Drawing_TypographyStyle* style); 2718 2719 /** 2720 * @brief Get the spacing scale of line style for text typography. 2721 * 2722 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2723 * @param style Indicates the pointer to a typography style object 2724 * <b>OH_Drawing_TypographyStyle</b>. 2725 * @return Return the spacing scale of line style for text typography. 2726 * @since 12 2727 * @version 1.0 2728 */ 2729 double OH_Drawing_TypographyTextlineStyleGetSpacingScale(OH_Drawing_TypographyStyle* style); 2730 2731 /** 2732 * @brief Get whether only line style is enabled for text typography. 2733 * 2734 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2735 * @param style Indicates the pointer to a typography style object 2736 * <b>OH_Drawing_TypographyStyle</b>. 2737 * @return Returns whether only line style is enabled for text layout, true means it is enabled, 2738 * false means it is not. 2739 * @since 12 2740 * @version 1.0 2741 */ 2742 bool OH_Drawing_TypographyTextlineGetStyleOnly(OH_Drawing_TypographyStyle* style); 2743 2744 /** 2745 * @brief Get the text alignment mode. 2746 * 2747 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2748 * @param style Indicates the pointer to a typography style object 2749 * <b>OH_Drawing_TypographyStyle</b>. 2750 * @return Return the text alignment mode. For details, see the enum <b>OH_Drawing_TextAlign</b>. 2751 * @since 12 2752 * @version 1.0 2753 */ 2754 OH_Drawing_TextAlign OH_Drawing_TypographyGetTextAlign(OH_Drawing_TypographyStyle* style); 2755 2756 /** 2757 * @brief Get the text direction. 2758 * 2759 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2760 * @param style Indicates the pointer to a typography style object 2761 * <b>OH_Drawing_TypographyStyle</b>. 2762 * @return Return the text direction. For details, see the enum <b>OH_Drawing_TextDirection</b>. 2763 * @since 12 2764 * @version 1.0 2765 */ 2766 OH_Drawing_TextDirection OH_Drawing_TypographyGetTextDirection(OH_Drawing_TypographyStyle* style); 2767 2768 /** 2769 * @brief Sets the maximum number of lines in a text. 2770 * 2771 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2772 * @param style Indicates the pointer to a typography style object 2773 * <b>OH_Drawing_TypographyStyle</b>. 2774 * @return Return the maximum number of lines in a text. 2775 * @since 12 2776 * @version 1.0 2777 */ 2778 size_t OH_Drawing_TypographyGetTextMaxLines(OH_Drawing_TypographyStyle* style); 2779 2780 /** 2781 * @brief Get the ellipsis of lines in a text. 2782 * 2783 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2784 * @param style Indicates the pointer to a typography style object 2785 * <b>OH_Drawing_TypographyStyle</b>. 2786 * @return Return the ellipsis of lines in a text. 2787 * @since 12 2788 * @version 1.0 2789 */ 2790 char* OH_Drawing_TypographyGetTextEllipsis(OH_Drawing_TypographyStyle* style); 2791 2792 /** 2793 * @brief Releases the memory occupied by a list of Ellipsis names. 2794 * 2795 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2796 * @param ellipsis Indicates the pointer to a list of Ellipsis names. 2797 * @since 12 2798 * @version 1.0 2799 */ 2800 void OH_Drawing_TypographyDestroyEllipsis(char* ellipsis); 2801 2802 /** 2803 * @brief Overriding the class ParagraphStyle equals operator. 2804 * 2805 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2806 * @param from Indicates source of comparison object. 2807 * @param to Indicates comparison object. 2808 * @return Compare result. 2809 * @since 12 2810 * @version 1.0 2811 */ 2812 bool OH_Drawing_TypographyStyleEquals(OH_Drawing_TypographyStyle* from, OH_Drawing_TypographyStyle* to); 2813 2814 /** 2815 * @brief Releases the memory occupied by text box. 2816 * 2817 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2818 * @param textBox Indicates the pointer to a text box object <b>OH_Drawing_TextBox</b>. 2819 * @since 12 2820 * @version 1.0 2821 */ 2822 void OH_Drawing_TypographyDestroyTextBox(OH_Drawing_TextBox* textBox); 2823 2824 /** 2825 * @brief Sets the parameter of text-shadow. 2826 * 2827 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2828 * @param shadow Indicates the pointer to an <b>OH_Drawing_TextShadow</b> object. 2829 * @param color Indicates the color setting of text-shadow. 2830 * @param offset Indicates the pointer to an <b>OH_Drawing_Point</b> object. 2831 * @param blurRadius Indicates the radius of blur for text-shadow. 2832 * @since 12 2833 * @version 1.0 2834 */ 2835 void OH_Drawing_SetTextShadow(OH_Drawing_TextShadow* shadow, uint32_t color, OH_Drawing_Point* offset, 2836 double blurRadius); 2837 2838 /** 2839 * @brief Creates an <b>OH_Drawing_TextTab</b> object. 2840 * 2841 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2842 * @param alignment Indicates enumerates text tab alignment modes. TAB alignment, Support left alignment 2843 * right alignment center alignment, other enumeration values are left alignment effect. 2844 * @param location Indicates location of text tab. 2845 * @return Returns the pointer to the <b>OH_Drawing_TextTab</b> object created. If the object returns NULL, 2846 * the creation failed. The possible cause of the failure is that the application address space is used up. 2847 * As a result, space cannot be allocated. 2848 * @since 18 2849 * @version 1.0 2850 */ 2851 OH_Drawing_TextTab* OH_Drawing_CreateTextTab(OH_Drawing_TextAlign alignment, float location); 2852 2853 /** 2854 * @brief Releases the memory occupied by an <b>OH_Drawing_TextTab</b> object. 2855 * 2856 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2857 * @param tab Indicates the pointer to an <b>OH_Drawing_TextTab</b> object. 2858 * @since 18 2859 * @version 1.0 2860 */ 2861 void OH_Drawing_DestroyTextTab(OH_Drawing_TextTab* tab); 2862 2863 /** 2864 * @brief Get alignment of an <b>OH_Drawing_TextTab</b> object. 2865 * 2866 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2867 * @param tab Indicates the pointer to an <b>OH_Drawing_TextTab</b> object. 2868 * @return Returns align of an <b>OH_Drawing_TextTab</b> object. 2869 * @since 18 2870 * @version 1.0 2871 */ 2872 OH_Drawing_TextAlign OH_Drawing_GetTextTabAlignment(OH_Drawing_TextTab* tab); 2873 2874 /** 2875 * @brief Get location of an <b>OH_Drawing_TextTab</b> object. 2876 * 2877 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2878 * @param tab Indicates the pointer to an <b>OH_Drawing_TextTab</b> object. 2879 * @return Returns location of an <b>OH_Drawing_TextTab</b> object. 2880 * @since 18 2881 * @version 1.0 2882 */ 2883 float OH_Drawing_GetTextTabLocation(OH_Drawing_TextTab* tab); 2884 2885 /** 2886 * @brief Sets the text tab of <b>OH_Drawing_TypographyStyle</b> object. 2887 * Tab alignment does not take effect when text alignment is also set, Or when the ellipsis style is configured. 2888 * When the tab is not set or the tab's location property is less than or equal to 0, it is the default space effect. 2889 * And all tabs in the paragraph after the setting are aligned according to this tab effect. 2890 * 2891 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2892 * @param style Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object. 2893 * @param tab Indicates the pointer to an <b>OH_Drawing_TextTab</b> object. 2894 * @since 18 2895 * @version 1.0 2896 */ 2897 void OH_Drawing_SetTypographyTextTab(OH_Drawing_TypographyStyle* style, OH_Drawing_TextTab* tab); 2898 2899 /** 2900 * @brief Get DrawingArray size. 2901 * 2902 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 2903 * @param drawingArray Indicates the pointer to the array object <b>OH_Drawing_Array</b>. 2904 * @return Size of array. 2905 * @since 14 2906 * @version 1.0 2907 */ 2908 size_t OH_Drawing_GetDrawingArraySize(OH_Drawing_Array* drawingArray); 2909 2910 #ifdef __cplusplus 2911 } 2912 #endif 2913 /** @} */ 2914 #endif