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