1 2 3 4 5<!doctype html> 6<html lang="en" class="no-js"> 7 <head> 8 9 <meta charset="utf-8"> 10 <meta name="viewport" content="width=device-width,initial-scale=1"> 11 <meta http-equiv="x-ua-compatible" content="ie=edge"> 12 13 <meta name="description" content="API Reference Documentation for FreeType-2.10.4"> 14 15 16 17 <meta name="author" content="FreeType Contributors"> 18 19 20 <meta name="lang:clipboard.copy" content="Copy to clipboard"> 21 22 <meta name="lang:clipboard.copied" content="Copied to clipboard"> 23 24 <meta name="lang:search.language" content="en"> 25 26 <meta name="lang:search.pipeline.stopwords" content="True"> 27 28 <meta name="lang:search.pipeline.trimmer" content="True"> 29 30 <meta name="lang:search.result.none" content="No matching documents"> 31 32 <meta name="lang:search.result.one" content="1 matching document"> 33 34 <meta name="lang:search.result.other" content="# matching documents"> 35 36 <meta name="lang:search.tokenizer" content="[\s\-]+"> 37 38 <link rel="shortcut icon" href="images/favico.ico"> 39 <meta name="generator" content="mkdocs-1.1, mkdocs-material-4.6.3"> 40 41 42 43 <title>Glyph Management - FreeType-2.10.4 API Reference</title> 44 45 46 47 <link rel="stylesheet" href="assets/stylesheets/application.adb8469c.css"> 48 49 <link rel="stylesheet" href="assets/stylesheets/application-palette.a8b3c06d.css"> 50 51 52 53 54 <meta name="theme-color" content="#4caf50"> 55 56 57 58 <script src="assets/javascripts/modernizr.86422ebf.js"></script> 59 60 61 62 <link href="https://fonts.gstatic.com" rel="preconnect" crossorigin> 63 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Noto+Serif:300,400,400i,700%7CRoboto+Mono&display=fallback"> 64 <style>body,input{font-family:"Noto Serif","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style> 65 66 67 <link rel="stylesheet" href="assets/fonts/material-icons.css"> 68 69 70 <link rel="stylesheet" href="stylesheets/extra.css"> 71 72 73 74 75 76 </head> 77 78 79 80 <body dir="ltr" data-md-color-primary="green" data-md-color-accent="green"> 81 82 <svg class="md-svg"> 83 <defs> 84 85 86 </defs> 87 </svg> 88 <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off"> 89 <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off"> 90 <label class="md-overlay" data-md-component="overlay" for="__drawer"></label> 91 92 <a href="#glyph-management" tabindex="0" class="md-skip"> 93 Skip to content 94 </a> 95 96 97 <header class="md-header" data-md-component="header"> 98 <nav class="md-header-nav md-grid"> 99 <div class="md-flex"> 100 <div class="md-flex__cell md-flex__cell--shrink"> 101 <a href="." title="FreeType-2.10.4 API Reference" aria-label="FreeType-2.10.4 API Reference" class="md-header-nav__button md-logo"> 102 103 <img alt="logo" src="images/favico.ico" width="24" height="24"> 104 105 </a> 106 </div> 107 <div class="md-flex__cell md-flex__cell--shrink"> 108 <label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label> 109 </div> 110 <div class="md-flex__cell md-flex__cell--stretch"> 111 <div class="md-flex__ellipsis md-header-nav__title" data-md-component="title"> 112 113 <span class="md-header-nav__topic"> 114 FreeType-2.10.4 API Reference 115 </span> 116 <span class="md-header-nav__topic"> 117 118 Glyph Management 119 120 </span> 121 122 </div> 123 </div> 124 <div class="md-flex__cell md-flex__cell--shrink"> 125 126 <label class="md-icon md-icon--search md-header-nav__button" for="__search"></label> 127 128<div class="md-search" data-md-component="search" role="dialog"> 129 <label class="md-search__overlay" for="__search"></label> 130 <div class="md-search__inner" role="search"> 131 <form class="md-search__form" name="search"> 132 <input type="text" class="md-search__input" aria-label="search" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active"> 133 <label class="md-icon md-search__icon" for="__search"></label> 134 <button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1"> 135  136 </button> 137 </form> 138 <div class="md-search__output"> 139 <div class="md-search__scrollwrap" data-md-scrollfix> 140 <div class="md-search-result" data-md-component="result"> 141 <div class="md-search-result__meta"> 142 Type to start searching 143 </div> 144 <ol class="md-search-result__list"></ol> 145 </div> 146 </div> 147 </div> 148 </div> 149</div> 150 151 </div> 152 153 </div> 154 </nav> 155</header> 156 157 <div class="md-container"> 158 159 160 161 162 <main class="md-main" role="main"> 163 <div class="md-main__inner md-grid" data-md-component="container"> 164 165 166 <div class="md-sidebar md-sidebar--primary" data-md-component="navigation"> 167 <div class="md-sidebar__scrollwrap"> 168 <div class="md-sidebar__inner"> 169 <nav class="md-nav md-nav--primary" data-md-level="0"> 170 <label class="md-nav__title md-nav__title--site" for="__drawer"> 171 <a href="." title="FreeType-2.10.4 API Reference" class="md-nav__button md-logo"> 172 173 <img alt="logo" src="images/favico.ico" width="48" height="48"> 174 175 </a> 176 FreeType-2.10.4 API Reference 177 </label> 178 179 <ul class="md-nav__list" data-md-scrollfix> 180 181 182 183 184 185 186 <li class="md-nav__item"> 187 <a href="index.html" title="TOC" class="md-nav__link"> 188 TOC 189 </a> 190 </li> 191 192 193 194 195 196 197 198 <li class="md-nav__item"> 199 <a href="ft2-index.html" title="Index" class="md-nav__link"> 200 Index 201 </a> 202 </li> 203 204 205 206 207 208 209 210 <li class="md-nav__item md-nav__item--nested"> 211 212 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-3" type="checkbox" id="nav-3"> 213 214 <label class="md-nav__link" for="nav-3"> 215 General Remarks 216 </label> 217 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 218 <label class="md-nav__title" for="nav-3"> 219 General Remarks 220 </label> 221 <ul class="md-nav__list" data-md-scrollfix> 222 223 224 225 226 227 228 229 <li class="md-nav__item"> 230 <a href="ft2-header_inclusion.html" title="FreeType's header inclusion scheme" class="md-nav__link"> 231 FreeType's header inclusion scheme 232 </a> 233 </li> 234 235 236 237 238 239 240 241 <li class="md-nav__item"> 242 <a href="ft2-user_allocation.html" title="User allocation" class="md-nav__link"> 243 User allocation 244 </a> 245 </li> 246 247 248 </ul> 249 </nav> 250 </li> 251 252 253 254 255 256 257 258 259 260 <li class="md-nav__item md-nav__item--active md-nav__item--nested"> 261 262 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-4" type="checkbox" id="nav-4" checked> 263 264 <label class="md-nav__link" for="nav-4"> 265 Core API 266 </label> 267 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 268 <label class="md-nav__title" for="nav-4"> 269 Core API 270 </label> 271 <ul class="md-nav__list" data-md-scrollfix> 272 273 274 275 276 277 278 279 <li class="md-nav__item"> 280 <a href="ft2-version.html" title="FreeType Version" class="md-nav__link"> 281 FreeType Version 282 </a> 283 </li> 284 285 286 287 288 289 290 291 <li class="md-nav__item"> 292 <a href="ft2-basic_types.html" title="Basic Data Types" class="md-nav__link"> 293 Basic Data Types 294 </a> 295 </li> 296 297 298 299 300 301 302 303 <li class="md-nav__item"> 304 <a href="ft2-base_interface.html" title="Base Interface" class="md-nav__link"> 305 Base Interface 306 </a> 307 </li> 308 309 310 311 312 313 314 315 <li class="md-nav__item"> 316 <a href="ft2-glyph_variants.html" title="Unicode Variation Sequences" class="md-nav__link"> 317 Unicode Variation Sequences 318 </a> 319 </li> 320 321 322 323 324 325 326 327 <li class="md-nav__item"> 328 <a href="ft2-color_management.html" title="Glyph Color Management" class="md-nav__link"> 329 Glyph Color Management 330 </a> 331 </li> 332 333 334 335 336 337 338 339 <li class="md-nav__item"> 340 <a href="ft2-layer_management.html" title="Glyph Layer Management" class="md-nav__link"> 341 Glyph Layer Management 342 </a> 343 </li> 344 345 346 347 348 349 350 351 352 353 <li class="md-nav__item md-nav__item--active"> 354 355 <input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc"> 356 357 358 359 360 <label class="md-nav__link md-nav__link--active" for="__toc"> 361 Glyph Management 362 </label> 363 364 <a href="ft2-glyph_management.html" title="Glyph Management" class="md-nav__link md-nav__link--active"> 365 Glyph Management 366 </a> 367 368 369<nav class="md-nav md-nav--secondary"> 370 371 372 373 374 375 <label class="md-nav__title" for="__toc">Table of contents</label> 376 <ul class="md-nav__list" data-md-scrollfix> 377 378 <li class="md-nav__item"> 379 <a href="#synopsis" class="md-nav__link"> 380 Synopsis 381 </a> 382 383</li> 384 385 <li class="md-nav__item"> 386 <a href="#ft_glyph" class="md-nav__link"> 387 FT_Glyph 388 </a> 389 390</li> 391 392 <li class="md-nav__item"> 393 <a href="#ft_glyphrec" class="md-nav__link"> 394 FT_GlyphRec 395 </a> 396 397</li> 398 399 <li class="md-nav__item"> 400 <a href="#ft_bitmapglyph" class="md-nav__link"> 401 FT_BitmapGlyph 402 </a> 403 404</li> 405 406 <li class="md-nav__item"> 407 <a href="#ft_bitmapglyphrec" class="md-nav__link"> 408 FT_BitmapGlyphRec 409 </a> 410 411</li> 412 413 <li class="md-nav__item"> 414 <a href="#ft_outlineglyph" class="md-nav__link"> 415 FT_OutlineGlyph 416 </a> 417 418</li> 419 420 <li class="md-nav__item"> 421 <a href="#ft_outlineglyphrec" class="md-nav__link"> 422 FT_OutlineGlyphRec 423 </a> 424 425</li> 426 427 <li class="md-nav__item"> 428 <a href="#ft_new_glyph" class="md-nav__link"> 429 FT_New_Glyph 430 </a> 431 432</li> 433 434 <li class="md-nav__item"> 435 <a href="#ft_get_glyph" class="md-nav__link"> 436 FT_Get_Glyph 437 </a> 438 439</li> 440 441 <li class="md-nav__item"> 442 <a href="#ft_glyph_copy" class="md-nav__link"> 443 FT_Glyph_Copy 444 </a> 445 446</li> 447 448 <li class="md-nav__item"> 449 <a href="#ft_glyph_transform" class="md-nav__link"> 450 FT_Glyph_Transform 451 </a> 452 453</li> 454 455 <li class="md-nav__item"> 456 <a href="#ft_glyph_bbox_mode" class="md-nav__link"> 457 FT_Glyph_BBox_Mode 458 </a> 459 460</li> 461 462 <li class="md-nav__item"> 463 <a href="#ft_glyph_get_cbox" class="md-nav__link"> 464 FT_Glyph_Get_CBox 465 </a> 466 467</li> 468 469 <li class="md-nav__item"> 470 <a href="#ft_glyph_to_bitmap" class="md-nav__link"> 471 FT_Glyph_To_Bitmap 472 </a> 473 474</li> 475 476 <li class="md-nav__item"> 477 <a href="#ft_done_glyph" class="md-nav__link"> 478 FT_Done_Glyph 479 </a> 480 481</li> 482 483 484 485 486 487 </ul> 488 489</nav> 490 491 </li> 492 493 494 495 496 497 498 499 <li class="md-nav__item"> 500 <a href="ft2-mac_specific.html" title="Mac Specific Interface" class="md-nav__link"> 501 Mac Specific Interface 502 </a> 503 </li> 504 505 506 507 508 509 510 511 <li class="md-nav__item"> 512 <a href="ft2-sizes_management.html" title="Size Management" class="md-nav__link"> 513 Size Management 514 </a> 515 </li> 516 517 518 519 520 521 522 523 <li class="md-nav__item"> 524 <a href="ft2-header_file_macros.html" title="Header File Macros" class="md-nav__link"> 525 Header File Macros 526 </a> 527 </li> 528 529 530 </ul> 531 </nav> 532 </li> 533 534 535 536 537 538 539 540 <li class="md-nav__item md-nav__item--nested"> 541 542 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-5" type="checkbox" id="nav-5"> 543 544 <label class="md-nav__link" for="nav-5"> 545 Format-Specific API 546 </label> 547 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 548 <label class="md-nav__title" for="nav-5"> 549 Format-Specific API 550 </label> 551 <ul class="md-nav__list" data-md-scrollfix> 552 553 554 555 556 557 558 559 <li class="md-nav__item"> 560 <a href="ft2-multiple_masters.html" title="Multiple Masters" class="md-nav__link"> 561 Multiple Masters 562 </a> 563 </li> 564 565 566 567 568 569 570 571 <li class="md-nav__item"> 572 <a href="ft2-truetype_tables.html" title="TrueType Tables" class="md-nav__link"> 573 TrueType Tables 574 </a> 575 </li> 576 577 578 579 580 581 582 583 <li class="md-nav__item"> 584 <a href="ft2-type1_tables.html" title="Type 1 Tables" class="md-nav__link"> 585 Type 1 Tables 586 </a> 587 </li> 588 589 590 591 592 593 594 595 <li class="md-nav__item"> 596 <a href="ft2-sfnt_names.html" title="SFNT Names" class="md-nav__link"> 597 SFNT Names 598 </a> 599 </li> 600 601 602 603 604 605 606 607 <li class="md-nav__item"> 608 <a href="ft2-bdf_fonts.html" title="BDF and PCF Files" class="md-nav__link"> 609 BDF and PCF Files 610 </a> 611 </li> 612 613 614 615 616 617 618 619 <li class="md-nav__item"> 620 <a href="ft2-cid_fonts.html" title="CID Fonts" class="md-nav__link"> 621 CID Fonts 622 </a> 623 </li> 624 625 626 627 628 629 630 631 <li class="md-nav__item"> 632 <a href="ft2-pfr_fonts.html" title="PFR Fonts" class="md-nav__link"> 633 PFR Fonts 634 </a> 635 </li> 636 637 638 639 640 641 642 643 <li class="md-nav__item"> 644 <a href="ft2-winfnt_fonts.html" title="Window FNT Files" class="md-nav__link"> 645 Window FNT Files 646 </a> 647 </li> 648 649 650 651 652 653 654 655 <li class="md-nav__item"> 656 <a href="ft2-font_formats.html" title="Font Formats" class="md-nav__link"> 657 Font Formats 658 </a> 659 </li> 660 661 662 663 664 665 666 667 <li class="md-nav__item"> 668 <a href="ft2-gasp_table.html" title="Gasp Table" class="md-nav__link"> 669 Gasp Table 670 </a> 671 </li> 672 673 674 </ul> 675 </nav> 676 </li> 677 678 679 680 681 682 683 684 <li class="md-nav__item md-nav__item--nested"> 685 686 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-6" type="checkbox" id="nav-6"> 687 688 <label class="md-nav__link" for="nav-6"> 689 Controlling FreeType Modules 690 </label> 691 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 692 <label class="md-nav__title" for="nav-6"> 693 Controlling FreeType Modules 694 </label> 695 <ul class="md-nav__list" data-md-scrollfix> 696 697 698 699 700 701 702 703 <li class="md-nav__item"> 704 <a href="ft2-auto_hinter.html" title="The auto-hinter" class="md-nav__link"> 705 The auto-hinter 706 </a> 707 </li> 708 709 710 711 712 713 714 715 <li class="md-nav__item"> 716 <a href="ft2-cff_driver.html" title="The CFF driver" class="md-nav__link"> 717 The CFF driver 718 </a> 719 </li> 720 721 722 723 724 725 726 727 <li class="md-nav__item"> 728 <a href="ft2-t1_cid_driver.html" title="The Type 1 and CID drivers" class="md-nav__link"> 729 The Type 1 and CID drivers 730 </a> 731 </li> 732 733 734 735 736 737 738 739 <li class="md-nav__item"> 740 <a href="ft2-tt_driver.html" title="The TrueType driver" class="md-nav__link"> 741 The TrueType driver 742 </a> 743 </li> 744 745 746 747 748 749 750 751 <li class="md-nav__item"> 752 <a href="ft2-pcf_driver.html" title="The PCF driver" class="md-nav__link"> 753 The PCF driver 754 </a> 755 </li> 756 757 758 759 760 761 762 763 <li class="md-nav__item"> 764 <a href="ft2-properties.html" title="Driver properties" class="md-nav__link"> 765 Driver properties 766 </a> 767 </li> 768 769 770 771 772 773 774 775 <li class="md-nav__item"> 776 <a href="ft2-parameter_tags.html" title="Parameter Tags" class="md-nav__link"> 777 Parameter Tags 778 </a> 779 </li> 780 781 782 783 784 785 786 787 <li class="md-nav__item"> 788 <a href="ft2-lcd_rendering.html" title="Subpixel Rendering" class="md-nav__link"> 789 Subpixel Rendering 790 </a> 791 </li> 792 793 794 </ul> 795 </nav> 796 </li> 797 798 799 800 801 802 803 804 <li class="md-nav__item md-nav__item--nested"> 805 806 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-7" type="checkbox" id="nav-7"> 807 808 <label class="md-nav__link" for="nav-7"> 809 Cache Sub-System 810 </label> 811 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 812 <label class="md-nav__title" for="nav-7"> 813 Cache Sub-System 814 </label> 815 <ul class="md-nav__list" data-md-scrollfix> 816 817 818 819 820 821 822 823 <li class="md-nav__item"> 824 <a href="ft2-cache_subsystem.html" title="Cache Sub-System" class="md-nav__link"> 825 Cache Sub-System 826 </a> 827 </li> 828 829 830 </ul> 831 </nav> 832 </li> 833 834 835 836 837 838 839 840 <li class="md-nav__item md-nav__item--nested"> 841 842 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-8" type="checkbox" id="nav-8"> 843 844 <label class="md-nav__link" for="nav-8"> 845 Support API 846 </label> 847 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 848 <label class="md-nav__title" for="nav-8"> 849 Support API 850 </label> 851 <ul class="md-nav__list" data-md-scrollfix> 852 853 854 855 856 857 858 859 <li class="md-nav__item"> 860 <a href="ft2-computations.html" title="Computations" class="md-nav__link"> 861 Computations 862 </a> 863 </li> 864 865 866 867 868 869 870 871 <li class="md-nav__item"> 872 <a href="ft2-list_processing.html" title="List Processing" class="md-nav__link"> 873 List Processing 874 </a> 875 </li> 876 877 878 879 880 881 882 883 <li class="md-nav__item"> 884 <a href="ft2-outline_processing.html" title="Outline Processing" class="md-nav__link"> 885 Outline Processing 886 </a> 887 </li> 888 889 890 891 892 893 894 895 <li class="md-nav__item"> 896 <a href="ft2-quick_advance.html" title="Quick retrieval of advance values" class="md-nav__link"> 897 Quick retrieval of advance values 898 </a> 899 </li> 900 901 902 903 904 905 906 907 <li class="md-nav__item"> 908 <a href="ft2-bitmap_handling.html" title="Bitmap Handling" class="md-nav__link"> 909 Bitmap Handling 910 </a> 911 </li> 912 913 914 915 916 917 918 919 <li class="md-nav__item"> 920 <a href="ft2-raster.html" title="Scanline Converter" class="md-nav__link"> 921 Scanline Converter 922 </a> 923 </li> 924 925 926 927 928 929 930 931 <li class="md-nav__item"> 932 <a href="ft2-glyph_stroker.html" title="Glyph Stroker" class="md-nav__link"> 933 Glyph Stroker 934 </a> 935 </li> 936 937 938 939 940 941 942 943 <li class="md-nav__item"> 944 <a href="ft2-system_interface.html" title="System Interface" class="md-nav__link"> 945 System Interface 946 </a> 947 </li> 948 949 950 951 952 953 954 955 <li class="md-nav__item"> 956 <a href="ft2-module_management.html" title="Module Management" class="md-nav__link"> 957 Module Management 958 </a> 959 </li> 960 961 962 963 964 965 966 967 <li class="md-nav__item"> 968 <a href="ft2-gzip.html" title="GZIP Streams" class="md-nav__link"> 969 GZIP Streams 970 </a> 971 </li> 972 973 974 975 976 977 978 979 <li class="md-nav__item"> 980 <a href="ft2-lzw.html" title="LZW Streams" class="md-nav__link"> 981 LZW Streams 982 </a> 983 </li> 984 985 986 987 988 989 990 991 <li class="md-nav__item"> 992 <a href="ft2-bzip2.html" title="BZIP2 Streams" class="md-nav__link"> 993 BZIP2 Streams 994 </a> 995 </li> 996 997 998 </ul> 999 </nav> 1000 </li> 1001 1002 1003 1004 1005 1006 1007 1008 <li class="md-nav__item md-nav__item--nested"> 1009 1010 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-9" type="checkbox" id="nav-9"> 1011 1012 <label class="md-nav__link" for="nav-9"> 1013 Error Codes 1014 </label> 1015 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 1016 <label class="md-nav__title" for="nav-9"> 1017 Error Codes 1018 </label> 1019 <ul class="md-nav__list" data-md-scrollfix> 1020 1021 1022 1023 1024 1025 1026 1027 <li class="md-nav__item"> 1028 <a href="ft2-error_enumerations.html" title="Error Enumerations" class="md-nav__link"> 1029 Error Enumerations 1030 </a> 1031 </li> 1032 1033 1034 1035 1036 1037 1038 1039 <li class="md-nav__item"> 1040 <a href="ft2-error_code_values.html" title="Error Code Values" class="md-nav__link"> 1041 Error Code Values 1042 </a> 1043 </li> 1044 1045 1046 </ul> 1047 </nav> 1048 </li> 1049 1050 1051 1052 1053 1054 1055 1056 <li class="md-nav__item md-nav__item--nested"> 1057 1058 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-10" type="checkbox" id="nav-10"> 1059 1060 <label class="md-nav__link" for="nav-10"> 1061 Miscellaneous 1062 </label> 1063 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 1064 <label class="md-nav__title" for="nav-10"> 1065 Miscellaneous 1066 </label> 1067 <ul class="md-nav__list" data-md-scrollfix> 1068 1069 1070 1071 1072 1073 1074 1075 <li class="md-nav__item"> 1076 <a href="ft2-gx_validation.html" title="TrueTypeGX/AAT Validation" class="md-nav__link"> 1077 TrueTypeGX/AAT Validation 1078 </a> 1079 </li> 1080 1081 1082 1083 1084 1085 1086 1087 <li class="md-nav__item"> 1088 <a href="ft2-incremental.html" title="Incremental Loading" class="md-nav__link"> 1089 Incremental Loading 1090 </a> 1091 </li> 1092 1093 1094 1095 1096 1097 1098 1099 <li class="md-nav__item"> 1100 <a href="ft2-truetype_engine.html" title="The TrueType Engine" class="md-nav__link"> 1101 The TrueType Engine 1102 </a> 1103 </li> 1104 1105 1106 1107 1108 1109 1110 1111 <li class="md-nav__item"> 1112 <a href="ft2-ot_validation.html" title="OpenType Validation" class="md-nav__link"> 1113 OpenType Validation 1114 </a> 1115 </li> 1116 1117 1118 </ul> 1119 </nav> 1120 </li> 1121 1122 1123 </ul> 1124</nav> 1125 </div> 1126 </div> 1127 </div> 1128 1129 1130 <div class="md-sidebar md-sidebar--secondary" data-md-component="toc"> 1131 <div class="md-sidebar__scrollwrap"> 1132 <div class="md-sidebar__inner"> 1133 1134<nav class="md-nav md-nav--secondary"> 1135 1136 1137 1138 1139 1140 <label class="md-nav__title" for="__toc">Table of contents</label> 1141 <ul class="md-nav__list" data-md-scrollfix> 1142 1143 <li class="md-nav__item"> 1144 <a href="#synopsis" class="md-nav__link"> 1145 Synopsis 1146 </a> 1147 1148</li> 1149 1150 <li class="md-nav__item"> 1151 <a href="#ft_glyph" class="md-nav__link"> 1152 FT_Glyph 1153 </a> 1154 1155</li> 1156 1157 <li class="md-nav__item"> 1158 <a href="#ft_glyphrec" class="md-nav__link"> 1159 FT_GlyphRec 1160 </a> 1161 1162</li> 1163 1164 <li class="md-nav__item"> 1165 <a href="#ft_bitmapglyph" class="md-nav__link"> 1166 FT_BitmapGlyph 1167 </a> 1168 1169</li> 1170 1171 <li class="md-nav__item"> 1172 <a href="#ft_bitmapglyphrec" class="md-nav__link"> 1173 FT_BitmapGlyphRec 1174 </a> 1175 1176</li> 1177 1178 <li class="md-nav__item"> 1179 <a href="#ft_outlineglyph" class="md-nav__link"> 1180 FT_OutlineGlyph 1181 </a> 1182 1183</li> 1184 1185 <li class="md-nav__item"> 1186 <a href="#ft_outlineglyphrec" class="md-nav__link"> 1187 FT_OutlineGlyphRec 1188 </a> 1189 1190</li> 1191 1192 <li class="md-nav__item"> 1193 <a href="#ft_new_glyph" class="md-nav__link"> 1194 FT_New_Glyph 1195 </a> 1196 1197</li> 1198 1199 <li class="md-nav__item"> 1200 <a href="#ft_get_glyph" class="md-nav__link"> 1201 FT_Get_Glyph 1202 </a> 1203 1204</li> 1205 1206 <li class="md-nav__item"> 1207 <a href="#ft_glyph_copy" class="md-nav__link"> 1208 FT_Glyph_Copy 1209 </a> 1210 1211</li> 1212 1213 <li class="md-nav__item"> 1214 <a href="#ft_glyph_transform" class="md-nav__link"> 1215 FT_Glyph_Transform 1216 </a> 1217 1218</li> 1219 1220 <li class="md-nav__item"> 1221 <a href="#ft_glyph_bbox_mode" class="md-nav__link"> 1222 FT_Glyph_BBox_Mode 1223 </a> 1224 1225</li> 1226 1227 <li class="md-nav__item"> 1228 <a href="#ft_glyph_get_cbox" class="md-nav__link"> 1229 FT_Glyph_Get_CBox 1230 </a> 1231 1232</li> 1233 1234 <li class="md-nav__item"> 1235 <a href="#ft_glyph_to_bitmap" class="md-nav__link"> 1236 FT_Glyph_To_Bitmap 1237 </a> 1238 1239</li> 1240 1241 <li class="md-nav__item"> 1242 <a href="#ft_done_glyph" class="md-nav__link"> 1243 FT_Done_Glyph 1244 </a> 1245 1246</li> 1247 1248 1249 1250 1251 1252 </ul> 1253 1254</nav> 1255 </div> 1256 </div> 1257 </div> 1258 1259 1260 <div class="md-content"> 1261 <article class="md-content__inner md-typeset"> 1262 1263 1264 1265 <p><a href="https://www.freetype.org">FreeType</a> » <a href="../">Docs</a> » <a href="index.html#core-api">Core API</a> » Glyph Management</p> 1266<hr /> 1267<h1 id="glyph-management">Glyph Management<a class="headerlink" href="#glyph-management" title="Permanent link">¶</a></h1> 1268<h2 id="synopsis">Synopsis<a class="headerlink" href="#synopsis" title="Permanent link">¶</a></h2> 1269<p>This section contains definitions used to manage glyph data through generic <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> objects. Each of them can contain a bitmap, a vector outline, or even images in other formats. These objects are detached from <code><a href="ft2-base_interface.html#ft_face">FT_Face</a></code>, contrary to <code><a href="ft2-base_interface.html#ft_glyphslot">FT_GlyphSlot</a></code>.</p> 1270<h2 id="ft_glyph">FT_Glyph<a class="headerlink" href="#ft_glyph" title="Permanent link">¶</a></h2> 1271<p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p> 1272<div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_GlyphRec_* <b>FT_Glyph</b>; 1273</code></pre></div> 1274 1275<p>Handle to an object used to model generic glyph images. It is a pointer to the <code><a href="ft2-glyph_management.html#ft_glyphrec">FT_GlyphRec</a></code> structure and can contain a glyph bitmap or pointer.</p> 1276<h4>note</h4> 1277 1278<p>Glyph objects are not owned by the library. You must thus release them manually (through <code><a href="ft2-glyph_management.html#ft_done_glyph">FT_Done_Glyph</a></code>) <em>before</em> calling <code><a href="ft2-base_interface.html#ft_done_freetype">FT_Done_FreeType</a></code>.</p> 1279<hr> 1280 1281<h2 id="ft_glyphrec">FT_GlyphRec<a class="headerlink" href="#ft_glyphrec" title="Permanent link">¶</a></h2> 1282<p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p> 1283<div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_GlyphRec_ 1284 { 1285 <a href="ft2-base_interface.html#ft_library">FT_Library</a> library; 1286 <span class="keyword">const</span> FT_Glyph_Class* clazz; 1287 <a href="ft2-basic_types.html#ft_glyph_format">FT_Glyph_Format</a> format; 1288 <a href="ft2-basic_types.html#ft_vector">FT_Vector</a> advance; 1289 1290 } <b>FT_GlyphRec</b>; 1291</code></pre></div> 1292 1293<p>The root glyph structure contains a given glyph image plus its advance width in 16.16 fixed-point format.</p> 1294<h4>fields</h4> 1295 1296<table class="fields"> 1297<tr><td class="val" id="library">library</td><td class="desc"> 1298<p>A handle to the FreeType library object.</p> 1299</td></tr> 1300<tr><td class="val" id="clazz">clazz</td><td class="desc"> 1301<p>A pointer to the glyph's class. Private.</p> 1302</td></tr> 1303<tr><td class="val" id="format">format</td><td class="desc"> 1304<p>The format of the glyph's image.</p> 1305</td></tr> 1306<tr><td class="val" id="advance">advance</td><td class="desc"> 1307<p>A 16.16 vector that gives the glyph's advance width.</p> 1308</td></tr> 1309</table> 1310 1311<hr> 1312 1313<h2 id="ft_bitmapglyph">FT_BitmapGlyph<a class="headerlink" href="#ft_bitmapglyph" title="Permanent link">¶</a></h2> 1314<p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p> 1315<div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_BitmapGlyphRec_* <b>FT_BitmapGlyph</b>; 1316</code></pre></div> 1317 1318<p>A handle to an object used to model a bitmap glyph image. This is a sub-class of <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code>, and a pointer to <code><a href="ft2-glyph_management.html#ft_bitmapglyphrec">FT_BitmapGlyphRec</a></code>.</p> 1319<hr> 1320 1321<h2 id="ft_bitmapglyphrec">FT_BitmapGlyphRec<a class="headerlink" href="#ft_bitmapglyphrec" title="Permanent link">¶</a></h2> 1322<p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p> 1323<div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_BitmapGlyphRec_ 1324 { 1325 <a href="ft2-glyph_management.html#ft_glyphrec">FT_GlyphRec</a> root; 1326 <a href="ft2-basic_types.html#ft_int">FT_Int</a> left; 1327 <a href="ft2-basic_types.html#ft_int">FT_Int</a> top; 1328 <a href="ft2-basic_types.html#ft_bitmap">FT_Bitmap</a> bitmap; 1329 1330 } <b>FT_BitmapGlyphRec</b>; 1331</code></pre></div> 1332 1333<p>A structure used for bitmap glyph images. This really is a ‘sub-class’ of <code><a href="ft2-glyph_management.html#ft_glyphrec">FT_GlyphRec</a></code>.</p> 1334<h4>fields</h4> 1335 1336<table class="fields"> 1337<tr><td class="val" id="root">root</td><td class="desc"> 1338<p>The root <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> fields.</p> 1339</td></tr> 1340<tr><td class="val" id="left">left</td><td class="desc"> 1341<p>The left-side bearing, i.e., the horizontal distance from the current pen position to the left border of the glyph bitmap.</p> 1342</td></tr> 1343<tr><td class="val" id="top">top</td><td class="desc"> 1344<p>The top-side bearing, i.e., the vertical distance from the current pen position to the top border of the glyph bitmap. This distance is positive for upwards y!</p> 1345</td></tr> 1346<tr><td class="val" id="bitmap">bitmap</td><td class="desc"> 1347<p>A descriptor for the bitmap.</p> 1348</td></tr> 1349</table> 1350 1351<h4>note</h4> 1352 1353<p>You can typecast an <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> to <code><a href="ft2-glyph_management.html#ft_bitmapglyph">FT_BitmapGlyph</a></code> if you have <code>glyph->format == FT_GLYPH_FORMAT_BITMAP</code>. This lets you access the bitmap's contents easily.</p> 1354<p>The corresponding pixel buffer is always owned by <code><a href="ft2-glyph_management.html#ft_bitmapglyph">FT_BitmapGlyph</a></code> and is thus created and destroyed with it.</p> 1355<hr> 1356 1357<h2 id="ft_outlineglyph">FT_OutlineGlyph<a class="headerlink" href="#ft_outlineglyph" title="Permanent link">¶</a></h2> 1358<p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p> 1359<div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_OutlineGlyphRec_* <b>FT_OutlineGlyph</b>; 1360</code></pre></div> 1361 1362<p>A handle to an object used to model an outline glyph image. This is a sub-class of <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code>, and a pointer to <code><a href="ft2-glyph_management.html#ft_outlineglyphrec">FT_OutlineGlyphRec</a></code>.</p> 1363<hr> 1364 1365<h2 id="ft_outlineglyphrec">FT_OutlineGlyphRec<a class="headerlink" href="#ft_outlineglyphrec" title="Permanent link">¶</a></h2> 1366<p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p> 1367<div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_OutlineGlyphRec_ 1368 { 1369 <a href="ft2-glyph_management.html#ft_glyphrec">FT_GlyphRec</a> root; 1370 <a href="ft2-outline_processing.html#ft_outline">FT_Outline</a> outline; 1371 1372 } <b>FT_OutlineGlyphRec</b>; 1373</code></pre></div> 1374 1375<p>A structure used for outline (vectorial) glyph images. This really is a ‘sub-class’ of <code><a href="ft2-glyph_management.html#ft_glyphrec">FT_GlyphRec</a></code>.</p> 1376<h4>fields</h4> 1377 1378<table class="fields"> 1379<tr><td class="val" id="root">root</td><td class="desc"> 1380<p>The root <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> fields.</p> 1381</td></tr> 1382<tr><td class="val" id="outline">outline</td><td class="desc"> 1383<p>A descriptor for the outline.</p> 1384</td></tr> 1385</table> 1386 1387<h4>note</h4> 1388 1389<p>You can typecast an <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> to <code><a href="ft2-glyph_management.html#ft_outlineglyph">FT_OutlineGlyph</a></code> if you have <code>glyph->format == FT_GLYPH_FORMAT_OUTLINE</code>. This lets you access the outline's content easily.</p> 1390<p>As the outline is extracted from a glyph slot, its coordinates are expressed normally in 26.6 pixels, unless the flag <code><a href="ft2-base_interface.html#ft_load_xxx">FT_LOAD_NO_SCALE</a></code> was used in <code><a href="ft2-base_interface.html#ft_load_glyph">FT_Load_Glyph</a></code> or <code><a href="ft2-base_interface.html#ft_load_char">FT_Load_Char</a></code>.</p> 1391<p>The outline's tables are always owned by the object and are destroyed with it.</p> 1392<hr> 1393 1394<h2 id="ft_new_glyph">FT_New_Glyph<a class="headerlink" href="#ft_new_glyph" title="Permanent link">¶</a></h2> 1395<p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p> 1396<div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> ) 1397 <b>FT_New_Glyph</b>( <a href="ft2-base_interface.html#ft_library">FT_Library</a> library, 1398 <a href="ft2-basic_types.html#ft_glyph_format">FT_Glyph_Format</a> format, 1399 <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> *aglyph ); 1400</code></pre></div> 1401 1402<p>A function used to create a new empty glyph image. Note that the created <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> object must be released with <code><a href="ft2-glyph_management.html#ft_done_glyph">FT_Done_Glyph</a></code>.</p> 1403<h4>input</h4> 1404 1405<table class="fields"> 1406<tr><td class="val" id="library">library</td><td class="desc"> 1407<p>A handle to the FreeType library object.</p> 1408</td></tr> 1409<tr><td class="val" id="format">format</td><td class="desc"> 1410<p>The format of the glyph's image.</p> 1411</td></tr> 1412</table> 1413 1414<h4>output</h4> 1415 1416<table class="fields"> 1417<tr><td class="val" id="aglyph">aglyph</td><td class="desc"> 1418<p>A handle to the glyph object.</p> 1419</td></tr> 1420</table> 1421 1422<h4>return</h4> 1423 1424<p>FreeType error code. 0 means success.</p> 1425<h4>since</h4> 1426 1427<p>2.10</p> 1428<hr> 1429 1430<h2 id="ft_get_glyph">FT_Get_Glyph<a class="headerlink" href="#ft_get_glyph" title="Permanent link">¶</a></h2> 1431<p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p> 1432<div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> ) 1433 <b>FT_Get_Glyph</b>( <a href="ft2-base_interface.html#ft_glyphslot">FT_GlyphSlot</a> slot, 1434 <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> *aglyph ); 1435</code></pre></div> 1436 1437<p>A function used to extract a glyph image from a slot. Note that the created <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> object must be released with <code><a href="ft2-glyph_management.html#ft_done_glyph">FT_Done_Glyph</a></code>.</p> 1438<h4>input</h4> 1439 1440<table class="fields"> 1441<tr><td class="val" id="slot">slot</td><td class="desc"> 1442<p>A handle to the source glyph slot.</p> 1443</td></tr> 1444</table> 1445 1446<h4>output</h4> 1447 1448<table class="fields"> 1449<tr><td class="val" id="aglyph">aglyph</td><td class="desc"> 1450<p>A handle to the glyph object.</p> 1451</td></tr> 1452</table> 1453 1454<h4>return</h4> 1455 1456<p>FreeType error code. 0 means success.</p> 1457<h4>note</h4> 1458 1459<p>Because <code>*aglyph->advance.x</code> and <code>*aglyph->advance.y</code> are 16.16 fixed-point numbers, <code>slot->advance.x</code> and <code>slot->advance.y</code> (which are in 26.6 fixed-point format) must be in the range ]-32768;32768[.</p> 1460<hr> 1461 1462<h2 id="ft_glyph_copy">FT_Glyph_Copy<a class="headerlink" href="#ft_glyph_copy" title="Permanent link">¶</a></h2> 1463<p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p> 1464<div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> ) 1465 <b>FT_Glyph_Copy</b>( <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> source, 1466 <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> *target ); 1467</code></pre></div> 1468 1469<p>A function used to copy a glyph image. Note that the created <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> object must be released with <code><a href="ft2-glyph_management.html#ft_done_glyph">FT_Done_Glyph</a></code>.</p> 1470<h4>input</h4> 1471 1472<table class="fields"> 1473<tr><td class="val" id="source">source</td><td class="desc"> 1474<p>A handle to the source glyph object.</p> 1475</td></tr> 1476</table> 1477 1478<h4>output</h4> 1479 1480<table class="fields"> 1481<tr><td class="val" id="target">target</td><td class="desc"> 1482<p>A handle to the target glyph object. 0 in case of error.</p> 1483</td></tr> 1484</table> 1485 1486<h4>return</h4> 1487 1488<p>FreeType error code. 0 means success.</p> 1489<hr> 1490 1491<h2 id="ft_glyph_transform">FT_Glyph_Transform<a class="headerlink" href="#ft_glyph_transform" title="Permanent link">¶</a></h2> 1492<p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p> 1493<div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> ) 1494 <b>FT_Glyph_Transform</b>( <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> glyph, 1495 <a href="ft2-basic_types.html#ft_matrix">FT_Matrix</a>* matrix, 1496 <a href="ft2-basic_types.html#ft_vector">FT_Vector</a>* delta ); 1497</code></pre></div> 1498 1499<p>Transform a glyph image if its format is scalable.</p> 1500<h4>inout</h4> 1501 1502<table class="fields"> 1503<tr><td class="val" id="glyph">glyph</td><td class="desc"> 1504<p>A handle to the target glyph object.</p> 1505</td></tr> 1506</table> 1507 1508<h4>input</h4> 1509 1510<table class="fields"> 1511<tr><td class="val" id="matrix">matrix</td><td class="desc"> 1512<p>A pointer to a 2x2 matrix to apply.</p> 1513</td></tr> 1514<tr><td class="val" id="delta">delta</td><td class="desc"> 1515<p>A pointer to a 2d vector to apply. Coordinates are expressed in 1/64th of a pixel.</p> 1516</td></tr> 1517</table> 1518 1519<h4>return</h4> 1520 1521<p>FreeType error code (if not 0, the glyph format is not scalable).</p> 1522<h4>note</h4> 1523 1524<p>The 2x2 transformation matrix is also applied to the glyph's advance vector.</p> 1525<hr> 1526 1527<h2 id="ft_glyph_bbox_mode">FT_Glyph_BBox_Mode<a class="headerlink" href="#ft_glyph_bbox_mode" title="Permanent link">¶</a></h2> 1528<p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p> 1529<div class = "codehilite"><pre><code> <span class="keyword">typedef</span> <span class="keyword">enum</span> FT_Glyph_BBox_Mode_ 1530 { 1531 <a href="ft2-glyph_management.html#ft_glyph_bbox_unscaled">FT_GLYPH_BBOX_UNSCALED</a> = 0, 1532 <a href="ft2-glyph_management.html#ft_glyph_bbox_subpixels">FT_GLYPH_BBOX_SUBPIXELS</a> = 0, 1533 <a href="ft2-glyph_management.html#ft_glyph_bbox_gridfit">FT_GLYPH_BBOX_GRIDFIT</a> = 1, 1534 <a href="ft2-glyph_management.html#ft_glyph_bbox_truncate">FT_GLYPH_BBOX_TRUNCATE</a> = 2, 1535 <a href="ft2-glyph_management.html#ft_glyph_bbox_pixels">FT_GLYPH_BBOX_PIXELS</a> = 3 1536 1537 } <b>FT_Glyph_BBox_Mode</b>; 1538 1539 1540 /* these constants are deprecated; use the corresponding */ 1541 /* `<b>FT_Glyph_BBox_Mode</b>` values instead */ 1542#<span class="keyword">define</span> ft_glyph_bbox_unscaled <a href="ft2-glyph_management.html#ft_glyph_bbox_unscaled">FT_GLYPH_BBOX_UNSCALED</a> 1543#<span class="keyword">define</span> ft_glyph_bbox_subpixels <a href="ft2-glyph_management.html#ft_glyph_bbox_subpixels">FT_GLYPH_BBOX_SUBPIXELS</a> 1544#<span class="keyword">define</span> ft_glyph_bbox_gridfit <a href="ft2-glyph_management.html#ft_glyph_bbox_gridfit">FT_GLYPH_BBOX_GRIDFIT</a> 1545#<span class="keyword">define</span> ft_glyph_bbox_truncate <a href="ft2-glyph_management.html#ft_glyph_bbox_truncate">FT_GLYPH_BBOX_TRUNCATE</a> 1546#<span class="keyword">define</span> ft_glyph_bbox_pixels <a href="ft2-glyph_management.html#ft_glyph_bbox_pixels">FT_GLYPH_BBOX_PIXELS</a> 1547</code></pre></div> 1548 1549<p>The mode how the values of <code><a href="ft2-glyph_management.html#ft_glyph_get_cbox">FT_Glyph_Get_CBox</a></code> are returned.</p> 1550<h4>values</h4> 1551 1552<table class="fields"> 1553<tr><td class="val" id="ft_glyph_bbox_unscaled">FT_GLYPH_BBOX_UNSCALED</td><td class="desc"> 1554<p>Return unscaled font units.</p> 1555</td></tr> 1556<tr><td class="val" id="ft_glyph_bbox_subpixels">FT_GLYPH_BBOX_SUBPIXELS</td><td class="desc"> 1557<p>Return unfitted 26.6 coordinates.</p> 1558</td></tr> 1559<tr><td class="val" id="ft_glyph_bbox_gridfit">FT_GLYPH_BBOX_GRIDFIT</td><td class="desc"> 1560<p>Return grid-fitted 26.6 coordinates.</p> 1561</td></tr> 1562<tr><td class="val" id="ft_glyph_bbox_truncate">FT_GLYPH_BBOX_TRUNCATE</td><td class="desc"> 1563<p>Return coordinates in integer pixels.</p> 1564</td></tr> 1565<tr><td class="val" id="ft_glyph_bbox_pixels">FT_GLYPH_BBOX_PIXELS</td><td class="desc"> 1566<p>Return grid-fitted pixel coordinates.</p> 1567</td></tr> 1568</table> 1569 1570<hr> 1571 1572<h2 id="ft_glyph_get_cbox">FT_Glyph_Get_CBox<a class="headerlink" href="#ft_glyph_get_cbox" title="Permanent link">¶</a></h2> 1573<p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p> 1574<div class = "codehilite"><pre><code> FT_EXPORT( <span class="keyword">void</span> ) 1575 <b>FT_Glyph_Get_CBox</b>( <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> glyph, 1576 <a href="ft2-basic_types.html#ft_uint">FT_UInt</a> bbox_mode, 1577 <a href="ft2-basic_types.html#ft_bbox">FT_BBox</a> *acbox ); 1578</code></pre></div> 1579 1580<p>Return a glyph's ‘control box’. The control box encloses all the outline's points, including Bezier control points. Though it coincides with the exact bounding box for most glyphs, it can be slightly larger in some situations (like when rotating an outline that contains Bezier outside arcs).</p> 1581<p>Computing the control box is very fast, while getting the bounding box can take much more time as it needs to walk over all segments and arcs in the outline. To get the latter, you can use the ‘ftbbox’ component, which is dedicated to this single task.</p> 1582<h4>input</h4> 1583 1584<table class="fields"> 1585<tr><td class="val" id="glyph">glyph</td><td class="desc"> 1586<p>A handle to the source glyph object.</p> 1587</td></tr> 1588<tr><td class="val" id="mode">mode</td><td class="desc"> 1589<p>The mode that indicates how to interpret the returned bounding box values.</p> 1590</td></tr> 1591</table> 1592 1593<h4>output</h4> 1594 1595<table class="fields"> 1596<tr><td class="val" id="acbox">acbox</td><td class="desc"> 1597<p>The glyph coordinate bounding box. Coordinates are expressed in 1/64th of pixels if it is grid-fitted.</p> 1598</td></tr> 1599</table> 1600 1601<h4>note</h4> 1602 1603<p>Coordinates are relative to the glyph origin, using the y upwards convention.</p> 1604<p>If the glyph has been loaded with <code><a href="ft2-base_interface.html#ft_load_xxx">FT_LOAD_NO_SCALE</a></code>, <code>bbox_mode</code> must be set to <code><a href="ft2-glyph_management.html#ft_glyph_bbox_mode">FT_GLYPH_BBOX_UNSCALED</a></code> to get unscaled font units in 26.6 pixel format. The value <code><a href="ft2-glyph_management.html#ft_glyph_bbox_mode">FT_GLYPH_BBOX_SUBPIXELS</a></code> is another name for this constant.</p> 1605<p>If the font is tricky and the glyph has been loaded with <code><a href="ft2-base_interface.html#ft_load_xxx">FT_LOAD_NO_SCALE</a></code>, the resulting CBox is meaningless. To get reasonable values for the CBox it is necessary to load the glyph at a large ppem value (so that the hinting instructions can properly shift and scale the subglyphs), then extracting the CBox, which can be eventually converted back to font units.</p> 1606<p>Note that the maximum coordinates are exclusive, which means that one can compute the width and height of the glyph image (be it in integer or 26.6 pixels) as: 1607<div class="highlight"><pre><span></span><code> width = bbox.xMax - bbox.xMin; 1608 height = bbox.yMax - bbox.yMin; 1609</code></pre></div></p> 1610<p>Note also that for 26.6 coordinates, if <code>bbox_mode</code> is set to <code><a href="ft2-glyph_management.html#ft_glyph_bbox_mode">FT_GLYPH_BBOX_GRIDFIT</a></code>, the coordinates will also be grid-fitted, which corresponds to: 1611<div class="highlight"><pre><span></span><code> bbox.xMin = FLOOR(bbox.xMin); 1612 bbox.yMin = FLOOR(bbox.yMin); 1613 bbox.xMax = CEILING(bbox.xMax); 1614 bbox.yMax = CEILING(bbox.yMax); 1615</code></pre></div></p> 1616<p>To get the bbox in pixel coordinates, set <code>bbox_mode</code> to <code><a href="ft2-glyph_management.html#ft_glyph_bbox_mode">FT_GLYPH_BBOX_TRUNCATE</a></code>.</p> 1617<p>To get the bbox in grid-fitted pixel coordinates, set <code>bbox_mode</code> to <code><a href="ft2-glyph_management.html#ft_glyph_bbox_mode">FT_GLYPH_BBOX_PIXELS</a></code>.</p> 1618<hr> 1619 1620<h2 id="ft_glyph_to_bitmap">FT_Glyph_To_Bitmap<a class="headerlink" href="#ft_glyph_to_bitmap" title="Permanent link">¶</a></h2> 1621<p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p> 1622<div class = "codehilite"><pre><code> FT_EXPORT( <a href="ft2-basic_types.html#ft_error">FT_Error</a> ) 1623 <b>FT_Glyph_To_Bitmap</b>( <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a>* the_glyph, 1624 <a href="ft2-base_interface.html#ft_render_mode">FT_Render_Mode</a> render_mode, 1625 <a href="ft2-basic_types.html#ft_vector">FT_Vector</a>* origin, 1626 <a href="ft2-basic_types.html#ft_bool">FT_Bool</a> destroy ); 1627</code></pre></div> 1628 1629<p>Convert a given glyph object to a bitmap glyph object.</p> 1630<h4>inout</h4> 1631 1632<table class="fields"> 1633<tr><td class="val" id="the_glyph">the_glyph</td><td class="desc"> 1634<p>A pointer to a handle to the target glyph.</p> 1635</td></tr> 1636</table> 1637 1638<h4>input</h4> 1639 1640<table class="fields"> 1641<tr><td class="val" id="render_mode">render_mode</td><td class="desc"> 1642<p>An enumeration that describes how the data is rendered.</p> 1643</td></tr> 1644<tr><td class="val" id="origin">origin</td><td class="desc"> 1645<p>A pointer to a vector used to translate the glyph image before rendering. Can be 0 (if no translation). The origin is expressed in 26.6 pixels.</p> 1646</td></tr> 1647<tr><td class="val" id="destroy">destroy</td><td class="desc"> 1648<p>A boolean that indicates that the original glyph image should be destroyed by this function. It is never destroyed in case of error.</p> 1649</td></tr> 1650</table> 1651 1652<h4>return</h4> 1653 1654<p>FreeType error code. 0 means success.</p> 1655<h4>note</h4> 1656 1657<p>This function does nothing if the glyph format isn't scalable.</p> 1658<p>The glyph image is translated with the <code>origin</code> vector before rendering.</p> 1659<p>The first parameter is a pointer to an <code><a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a></code> handle, that will be <em>replaced</em> by this function (with newly allocated data). Typically, you would use (omitting error handling): 1660<div class="highlight"><pre><span></span><code> FT_Glyph glyph; 1661 FT_BitmapGlyph glyph_bitmap; 1662 1663 1664 // load glyph 1665 error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAULT ); 1666 1667 // extract glyph image 1668 error = FT_Get_Glyph( face->glyph, &glyph ); 1669 1670 // convert to a bitmap (default render mode + destroying old) 1671 if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) 1672 { 1673 error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, 1674 0, 1 ); 1675 if ( error ) // `glyph' unchanged 1676 ... 1677 } 1678 1679 // access bitmap content by typecasting 1680 glyph_bitmap = (FT_BitmapGlyph)glyph; 1681 1682 // do funny stuff with it, like blitting/drawing 1683 ... 1684 1685 // discard glyph image (bitmap or not) 1686 FT_Done_Glyph( glyph ); 1687</code></pre></div></p> 1688<p>Here is another example, again without error handling: 1689<div class="highlight"><pre><span></span><code> FT_Glyph glyphs[MAX_GLYPHS] 1690 1691 1692 ... 1693 1694 for ( idx = 0; i < MAX_GLYPHS; i++ ) 1695 error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) || 1696 FT_Get_Glyph ( face->glyph, &glyphs[idx] ); 1697 1698 ... 1699 1700 for ( idx = 0; i < MAX_GLYPHS; i++ ) 1701 { 1702 FT_Glyph bitmap = glyphs[idx]; 1703 1704 1705 ... 1706 1707 // after this call, `bitmap' no longer points into 1708 // the `glyphs' array (and the old value isn't destroyed) 1709 FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 ); 1710 1711 ... 1712 1713 FT_Done_Glyph( bitmap ); 1714 } 1715 1716 ... 1717 1718 for ( idx = 0; i < MAX_GLYPHS; i++ ) 1719 FT_Done_Glyph( glyphs[idx] ); 1720</code></pre></div></p> 1721<hr> 1722 1723<h2 id="ft_done_glyph">FT_Done_Glyph<a class="headerlink" href="#ft_done_glyph" title="Permanent link">¶</a></h2> 1724<p>Defined in FT_GLYPH_H (freetype/ftglyph.h).</p> 1725<div class = "codehilite"><pre><code> FT_EXPORT( <span class="keyword">void</span> ) 1726 <b>FT_Done_Glyph</b>( <a href="ft2-glyph_management.html#ft_glyph">FT_Glyph</a> glyph ); 1727</code></pre></div> 1728 1729<p>Destroy a given glyph.</p> 1730<h4>input</h4> 1731 1732<table class="fields"> 1733<tr><td class="val" id="glyph">glyph</td><td class="desc"> 1734<p>A handle to the target glyph object.</p> 1735</td></tr> 1736</table> 1737 1738<hr> 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 </article> 1750 </div> 1751 </div> 1752 </main> 1753 1754 1755<footer class="md-footer"> 1756 1757 <div class="md-footer-nav"> 1758 <nav class="md-footer-nav__inner md-grid"> 1759 1760 <a href="ft2-layer_management.html" title="Glyph Layer Management" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev"> 1761 <div class="md-flex__cell md-flex__cell--shrink"> 1762 <i class="md-icon md-icon--arrow-back md-footer-nav__button"></i> 1763 </div> 1764 <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"> 1765 <span class="md-flex__ellipsis"> 1766 <span class="md-footer-nav__direction"> 1767 Previous 1768 </span> 1769 Glyph Layer Management 1770 </span> 1771 </div> 1772 </a> 1773 1774 1775 <a href="ft2-mac_specific.html" title="Mac Specific Interface" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next"> 1776 <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"> 1777 <span class="md-flex__ellipsis"> 1778 <span class="md-footer-nav__direction"> 1779 Next 1780 </span> 1781 Mac Specific Interface 1782 </span> 1783 </div> 1784 <div class="md-flex__cell md-flex__cell--shrink"> 1785 <i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i> 1786 </div> 1787 </a> 1788 1789 </nav> 1790 </div> 1791 1792 <div class="md-footer-meta md-typeset"> 1793 <div class="md-footer-meta__inner md-grid"> 1794 <div class="md-footer-copyright"> 1795 1796 <div class="md-footer-copyright__highlight"> 1797 Copyright 2020 <a href = "https://www.freetype.org/license.html">The FreeType Project</a>. 1798 </div> 1799 1800 powered by 1801 <a href="https://www.mkdocs.org" target="_blank" rel="noopener">MkDocs</a> 1802 and 1803 <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener"> 1804 Material for MkDocs</a> 1805 </div> 1806 1807 </div> 1808 </div> 1809</footer> 1810 1811 </div> 1812 1813 <script src="assets/javascripts/application.c33a9706.js"></script> 1814 1815 <script>app.initialize({version:"1.1",url:{base:"."}})</script> 1816 1817 <script src="javascripts/extra.js"></script> 1818 1819 1820 </body> 1821</html>