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