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