Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | initial commit |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
cc61552b2353a591bba407c3fc0ac84e |
User & Date: | lexi 2019-05-20 11:40:30 |
2019-06-08
| ||
19:28 | make conf script more portable check-in: 2bf816277f user: lexi tags: trunk | |
2019-05-20
| ||
11:40 | initial commit check-in: cc61552b23 user: lexi tags: trunk | |
07:39 | initial empty check-in check-in: 95af6ee31c user: lexi tags: trunk | |
Added LICENSE.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 |
this license covers all files in this repository EXCEPT those in the "ext" directory, which contains libraries written by other authors. see the appropriate file for details. GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <https://www.gnu.org/licenses/>. |
Added README.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# visnov `visnov` is a lightweight visual-novel authoring toolchain intended as an (eventual) alternative to the bulky & overcomplicated ren'py. visnov does not involve any scripting languages or DSLs: it's just a binary library with some tooling, and the user can choose to implement her visual novel in whatever language she likes. want to make a line of dialogue conditional on the weather? link in [tenki](https://c.hale.su/lexi/util) and query the Dark Sky API. this repository also includes a low-level binding to ocaml, intended to be used by user-defined functions that operate on native ocaml data structures appropriate to the specific game. those bindings are defined in `visnov.ml` ## build process `visnov` has very few external dependencies. the only thing you should need to worry about is [libglfw3](https://glfw.org), though the `visnov` library itself does not require glfw to build. glfw may be installed through your distribution's package manager or may be compiled from source. the latter is recommended if you wish to create a portable binary (which you probably should when you're ready to release your game.) when you compile your source code and link against glfw, you can do it either by specifying `-lglfw` to dynamically link or by adding `libglfw3.a` to the source list on the command line. (if you using a language other than C, you may need to specify the libraries differently. if your language comes with a default binding see `bind/$lang/build.md`) once you have built the library and compiled your binary against you, you will need to store your assets in the binary. this is currently done with the `build/visnarc` tool. visnarc generates a flat binary archive from a list of files on the command like. if you run, for instance, `visnarc font/reg.ttf font/bold.ttf player.png` it will print to standard output an archive containing those three files, using the entered paths as keys to access the data with. therefore, to archive a whole directory, you currently must `cd` to that directory, and then run `visnarc **` (if your shell, unlike `zsh` or `fish`, does not support recursive glob expansion, you may need to use the `find` command with `xargs` - this is best done from a shell script or makefile). in the future, visnarc should support a `-r` flag to set a directory as the archive root and then recurse into it; this is not currently a priority since it's already minimally functional. the compiled binary will try to resolve files references from a `visnarc` archive appended to the end of the binary. the `>>` redirection operator is sufficient for these purposes; however, if you wish to keep a fileless copy (for instance, if you want to be able to update the assets without generating a new binary) you may instead wish to use a process like cc $files $flags -o novel-empty (cd assets; visnarc ** > ../assets.arc) cat novel-empty assets.arc > novel this will provide greater flexibility, at the cost of disk space and build system complexity. ## license `visnov` is licensed under the AGPL (see LICENSE). the external libraries in ext/ are not my intellectual property and have their own licenses. per the AGPL, `visnov` binaries may be sold for profit, but *only* if the source code (to both the `visnov` engine *and* the game built with it) is made freely available. closed-source development with `visnov` is not permitted, though i might be convinced to grant commercial licenses on a case-by-case basis to low-income folks who genuinely need the money. note that you are bound by the licenses of *ALL* code you compile statically into your binary. |
Added conf.sh.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
#!/usr/bin/bash cc="clang" ocamlc="ocamlopt.opt" cflags="-std=c++14 -Iext/soil/ -Iext/fontstash/ -fno-rtti -fno-exceptions -g" ldflags="-cclib \"-lglfw -lGL\"" prod=$(basename $(pwd)) echo "all: tools link" csrc="" for x in csrc/*.cc; do bx=$(basename $x).o $cc $cflags -MM $x -MT $bx echo " $cc -c $cflags $x -o build/$bx" csrc="$csrc $bx" done echo "link: $csrc soil fontstash" echo " ar -rcs build/libvisnov.a build/*.o" echo " $ocamlc -c build/libvisnov.a mlsrc/*.ml $ldflags" echo " mv mlsrc/*.cmx mlsrc/*.cmi build/" echo " cp mlsrc/*.ml build/" echo "soil:" echo " cd build && clang -c ../ext/soil/*.c" echo "fontstash:" echo " cd build && clang -c ../ext/fontstash/*.c" echo "tools:" echo " cd build && clang -std=c++14 ../tool/visnarc.cc -o visnarc" echo "clean:" echo " rm build/*" |
Added csrc/tbox.cc.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
struct strsplit { size_t elts = 0; char** words; char* mem; char* original; static bool isws(char c) { return (c == ' ') or (c == '\t') or (c == '\n'); } /* TODO: ~unicode~ */ void split(const char* str) { size_t len; /* figure out how much memory we need */ { bool space = true; const char* cur; for (cur = str; *cur!=0; ++cur) if (space and not isws(*cur)) space = false, ++elts; else if (isws(*cur) and not space) space = true; len = cur - str; } /* TODO: stop malloc 2k17 */ mem = new char[len+1]; words = new char*[elts]; original = strdup(str); char** wcur = words; bool newelt = true; for(char* cur = mem;*str!=0;++str, ++cur) { if (newelt and isws(*str)) *cur=0; else if (newelt) { *wcur ++= cur; newelt = false; *cur = *str; } else if (isws(*str)) *cur = 0, newelt = true; else *cur = *str; } mem[len] = 0; elts = wcur - words; } void del() { elts = 0; delete words; delete mem; delete original; } }; const float linespace = 5; float tboxh(sth_stash* ctx, int font, float size, float w, const strsplit& str, float* out_w) { float lw = 0; for (size_t i = 0; i<str.elts; ++i) { float x1, x2, y1, y2; sth_dim_text(ctx, font, size, str.words[i], &x1, &y1, &x2, &y2); lw += (x2-x1) + 7; } if (lw <= w) { *out_w = lw; return size; } *out_w = w; float h = size + linespace; while(lw > w) { h += size + linespace; lw -= w; } return h - linespace; } void tbox(sth_stash* ctx, int font, float size, uint16_t left, uint16_t top, uint16_t w, const strsplit& str) { float ypos = 0; float linew = 0; size_t linestart = 0; float ww[str.elts]; // lick my clit, malloc for (size_t i = 0; i<str.elts; ++i) { float x1, x2, y1, y2; sth_dim_text(ctx, font, size, str.words[i], &x1, &y1, &x2, &y2); ww[i] = x2 - x1; float potential_wspace = (w - (linew+ww[i])) / (i - (linestart)); if ((potential_wspace < 7) or (linew + ww[i] > w)) { /* render this line, start a new one */ float cur = 0; float wspace = (w - linew) / (i - (linestart+1)); for (size_t j = linestart; j<i; ++j) { float _; sth_draw_text(ctx, font, size, left+cur, top-ypos, str.words[j], &_); cur += ww[j] + wspace; } linestart = i; ypos += (y2-y1) + linespace; linew = ww[i]; } else { linew += ww[i]; } } float cur = left; for (size_t j = linestart; j<str.elts; ++j) { float _; sth_draw_text(ctx, font, size, cur, top-ypos, str.words[j], &_); cur += ww[j] + 7; } } |
Added csrc/visnov.cc.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
#include <GLFW/glfw3.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include <stdio.h> #include <SOIL.h> extern "C" { #include <fontstash.h> } void* operator new(size_t sz) { return malloc(sz); } void* operator new[](size_t sz) { return malloc(sz); } void operator delete(void* ptr) noexcept { free(ptr); } void operator delete[](void* ptr) noexcept { free(ptr); } #include "tbox.cc" namespace visnov { constexpr uint8_t max_pos = 8; struct frame { int16_t x, y; uint16_t w, h; }; struct game; struct file { char* name; uint8_t* data; size_t len; enum class kind { none, image, font } filetype = kind::none; union { struct { uint16_t w, h; GLuint id; } img; int font; }; void render(frame f) { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, img.id); glBegin(GL_QUADS); glTexCoord2f(0,1); glVertex2i(f.x,f.y); glTexCoord2f(1,1); glVertex2i(f.x+f.w,f.y); glTexCoord2f(1,0); glVertex2i(f.x+f.w,f.y+f.h); glTexCoord2f(0,0); glVertex2i(f.x,f.y+f.h); glEnd(); glDisable(GL_TEXTURE_2D); } frame getframe (const game* g, uint8_t p); }; struct text { strsplit str; uint32_t fg = 0, bg = 0xffFFff; file* font; }; char* readstr(unsigned char** cur) { uint8_t len = **cur; char* strbuf = new char[len+1]; for (uint8_t i = 0; i<len; ++i) { strbuf[i] = *++* cur; } ++*cur; strbuf[len] = 0; return strbuf; } struct game { GLFWwindow* window; uint16_t width, height, cw, ch; file* bg = nullptr; uint8_t npos = 3; file* chars[max_pos] = {nullptr}; text dlg[max_pos]; sth_stash* fs = 0; bool pause = false; file* files; size_t filec; unsigned char* dat; void genlists() { const uint16_t ct = dat[0] | (dat [1] << 8); files = new file[ct]; filec = ct; unsigned char* cur = dat + 2; for (size_t i = 0; i < ct; ++i) { files[i].name = readstr(&cur); files[i].data = dat + ((cur[0]) | (cur [1] << 8) | (cur[2] << 16) | (cur[3] << 24)); cur+=4; files[i].len = ((cur[0]) | (cur [1] << 8) | (cur[2] << 16) | (cur[3] << 24)); cur+=4; } for (size_t i = 0; i < ct; ++i) { files[i].data += cur-dat; // account for size of the file table } } }; frame file::getframe (const game* g, uint8_t p) { const int16_t maxw = g -> cw / g -> npos, /* TODO padding? */ x = maxw * p, xo = x+(maxw / 2 - img.w / 2); return { xo, 0, img.w, img.h }; /* TODO downscaling */ }; void resize(GLFWwindow* win, int w, int h) { game* g = (game*)glfwGetWindowUserPointer(win); g->cw=w; g->ch=h; glViewport(0,0,w,h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0,w,0,h,0,1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } void render(const game* g) { glClear(GL_COLOR_BUFFER_BIT); glfwMakeContextCurrent(g->window); glEnable(GL_BLEND); sth_begin_draw(g->fs); if (g -> bg) { const float wfac = float(g->cw) / g->width, hfac = float(g->ch) / g-> height, factor = (wfac > hfac) ? wfac : hfac; frame bgf = {0,0, uint16_t(float(g->bg->img.w) * factor), uint16_t(float(g->bg->img.h) * factor)}; g -> bg -> render(bgf); } for (uint8_t i = 0; i < g->npos; ++i) { if (g -> chars[i]) { auto f = g -> chars[i] -> getframe(g, i); g -> chars[i] -> render( g -> chars[i] -> getframe(g, i)); }; const auto& d = g -> dlg[i]; if (d.str.elts != 0) { const uint16_t pad = 15, fontsize = 32; const uint16_t col = g -> cw / g -> npos; float boxw; const uint16_t text_height = tboxh(g->fs, g->dlg[i].font->font, fontsize, col-pad*4, g->dlg[i].str, &boxw); const uint16_t top = text_height + ((g->chars[i] != nullptr) ? (g->chars[i]->img.h) + 20 : pad); const int16_t x1 = col*i + (col/2 - boxw/2), y1 = top - (text_height+pad), x2 = x1 + boxw + pad*2, y2 = top; glColor4ub(d.bg >> 16, (d.bg >> 8) & 0xFF, d.bg & 0xFF,200); glEnable(GL_MULTISAMPLE); glBegin(GL_POLYGON); glVertex2i((x1 + (x2-x1)/2) - 10,y1); glVertex2i((x1 + (x2-x1)/2), y1 - 20); glVertex2i((x1 + (x2-x1)/2) + 10,y1); glVertex2i(x2,y1); glVertex2i(x2,y2); glVertex2i(x1,y2); glVertex2i(x1,y1); glEnd(); glColor3ub(d.fg >> 16, (d.fg >> 8) & 0xFF, d.fg & 0xFF); glBegin(GL_LINE_STRIP); glVertex2i(x1,y1); glVertex2i((x1 + (x2-x1)/2) - 10,y1); glVertex2i((x1 + (x2-x1)/2), y1 - 20); glVertex2i((x1 + (x2-x1)/2) + 10,y1); glVertex2i(x2,y1); glVertex2i(x2,y2); glVertex2i(x1,y2); glVertex2i(x1,y1); glEnd(); glDisable(GL_MULTISAMPLE); float x; glColor3ub(d.fg >> 16, (d.fg >> 8) & 0xFF, d.fg & 0xFF); tbox(g->fs, g->dlg[i].font->font, fontsize, x1+pad, top-fontsize, col-pad*4, g->dlg[i].str); glColor3ub(255,255,255); } } sth_end_draw(g->fs); glDisable(GL_BLEND); glfwSwapBuffers(g->window); } void onclick(GLFWwindow* win, int button, int action, int mods) { if (action == GLFW_RELEASE and button == 0) ((game*)glfwGetWindowUserPointer(win))->pause=false; } extern "C" { game* visnov_init(const char* gname, const char* str, int w, int h) { w>>=1; h>>=1; game* g = new game; g->width=w; g->height=h; FILE* f = fopen(gname, "rb"); fseek(f,0,SEEK_END); long len = ftell(f); fseek(f,len-7,SEEK_SET); unsigned char buf[7]; fread(buf,1,7,f); if (buf[4] == 0x9e and buf[5] == 0xcf and buf[6] == 0x44) { size_t sz = (buf[0]) | (buf [1] << 8) | (buf[2] << 16) | (buf [3] << 24); fseek(f,len-(sz+7),SEEK_SET); long arcsz = len-ftell(f); g -> dat = new unsigned char[arcsz]; fread(g -> dat,arcsz,1,f); fclose(f); g -> genlists(); } else { printf("\x1b[31;1merror:\x1b[0m cannot read resource pack\n"); exit(1); } glfwInit(); glfwWindowHint(GLFW_SAMPLES, 8); g -> window = glfwCreateWindow(w,h,str,nullptr,nullptr); glfwSetMouseButtonCallback(g->window,onclick); glfwMakeContextCurrent(g->window); g -> fs = sth_create(512,512); if (g->fs == 0) { printf("\x1b[31;1merror:\x1b[0m cannot init fontstash\n"); } glfwSetWindowUserPointer(g->window,g); glClearColor(0,0,0,1); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_FUNC_ADD); glfwSetWindowSizeCallback(g->window,resize); resize(g->window,w,h); return g; } void visnov_exit() { glfwTerminate(); } file* visnov_fnt(game* g, const char* name) { for(uint16_t i = 0; i<g->filec; ++i) { if(strcmp(name,g->files[i].name)) continue; if(g->files[i].filetype==file::kind::none) { g->files[i].filetype = file::kind::font; g->files[i].font = sth_add_font_from_memory(g->fs, g->files[i].data); if (g->files[i].font < 0) { printf("\x1b[31;1mruntime error: \x1b[0m file \x1b[1m%s\x1b[0m is not a TTF\n",name); exit(2); } } return g->files + i; } printf("\x1b[31;1mruntime error: \x1b[0m font \x1b[1m%s\x1b[0m does not exist\n",name); exit(2); } file* visnov_img(game* g, const char* name) { for(uint16_t i = 0; i<g->filec; ++i) { if(strcmp(name,g->files[i].name)) continue; if (g->files[i].filetype==file::kind::none) { g->files[i].filetype = file::kind::image; int iw, ih; g->files[i].img.id = SOIL_load_OGL_texture_from_memory( /* address */ g->files[i].data, /* length */ g->files[i].len, /* force channels */ 4, /* reuse id */ 0, /* flags */ SOIL_LOAD_RGBA, /* MODIFICATION */ &iw, &ih ); g->files[i].img.w=iw, g->files[i].img.h = ih; /*printf(" - %s [%zx ~ %zx] (%x)\n", g->files[i].name, g->files[i].data-g->dat, (g->files[i].data-g->dat)+g->files[i].len, g->files[i].id);*/ } return g->files + i; } printf("\x1b[31;1mruntime error: \x1b[0m image \x1b[1m%s\x1b[0m does not exist\n",name); exit(2); } void visnov_chr(game* g, int p, file* i) { g->chars[p>>1] = i; } void visnov_bg(game* g, file* i) { g->bg = i; } void visnov_layout(game* g, int l) { g -> npos = l >> 1; } void visnov_setfont(game* g, int pos, file* font) { g -> dlg[pos>>1].font = font; } void visnov_color(game* g, int pos, int fg, int bg) { g->dlg[pos>>1].fg = fg >> 1; g->dlg[pos>>1].bg = bg >> 1; } void visnov_block(game* g) { g->pause = true; int font = visnov_fnt(g,"font/comic/regular.ttf")->font; while(g->pause) { render(g); glfwPollEvents(); if (glfwWindowShouldClose(g->window)) { /* uuuugh this is so hacky */ glfwTerminate(); exit(0); } } } void visnov_say(game* g, int pos, const char* str) { pos >>= 1; text& tx = g -> dlg[pos]; if (tx.str.elts != 0) tx.str.del(); tx.str.split(str); } } } |
Added ext/fontstash/Makefile.
> > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
PROGRAM = fontstash C_FILES := $(wildcard *.c) CC = gcc CFLAGS = -std=c99 -Wall -pedantic -Wno-unused-but-set-variable CFLAGS += `sdl-config --cflags` `pkg-config --cflags SDL_image` LDFLAGS = `sdl-config --libs` `pkg-config --libs SDL_image` -lGL -lm all: $(CC) -o bin/$(PROGRAM) $(CFLAGS) $(C_FILES) $(LDFLAGS) debug: $(CC) -o bin/$(PROGRAM) -ggdb $(CFLAGS) $(C_FILES) $(LDFLAGS) run: all cd bin && ./$(PROGRAM) |
Added ext/fontstash/README.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# Font Stash: Dynamic font glyph cache for OpenGL Font Stash enables easy string rendering in OpenGL applications. It supports truetype fonts and UTF-8 encoded localized strings. All glyphs are cached in OpenGL texture atlases. Font rasterization is done using Sean Barrett's [stb_truetype.h](http://nothings.org/). Font Stash was originally created and [published](http://digestingduck.blogspot.com/2009/08/font-stash.html) by [Mikko Mononen](http://digestingduck.blogspot.com). ## Major changes to the original version * Bitmap font support * Truetype font loading from memory * Added ability to load an arbitrary number of fonts (not just four) * Use multiple OpenGL textures for glyph caching (not just one) ## Road map * Freetype2 support (for glyph outlines) ## Screenshot  ## Usage ```c #include "fontstash.h" ... /* create a font stash with a maximum texture size of 512 x 512 */ struct sth_stash* stash = sth_create(512, 512); /* load truetype font */ int droid = sth_add_font(stash, "DroidSerif-Regular.ttf"); /* position of the text */ float x = 10, y = 10; ... /* draw text during your OpenGL render loop */ sth_begin_draw(stash); /* position: (x, y); font size: 24 */ sth_draw_text(stash, droid, 24.0f, x, y, "Hello world!", &x); /* now, the float x contains the x position of the next char */ sth_end_draw(stash); ... ``` ## Bitmap fonts Bitmap fonts can be generated using the [AngelCode Bitmap Font Generator](http://www.angelcode.com/products/bmfont/). It's a Windows program that runs under Linux using Wine. This program generates one or more image files and a text file (*.fnt) containing the bounding box coordinates of all individual glyphs. These coordinates are used to reference the glyphs using Font Stash. ## License The files fontstash.c, fontstash.h and main.c are licensed unter the zlib license: Copyright (c) 2011 Andreas Krinke andreas.krinke@gmx.de Copyright (c) 2009 Mikko Mononen memon@inside.org This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. For UTF-8 decoding, Font Stash uses Björn Höhrmann's [Flexible and Economical UTF-8 Decoder](http://bjoern.hoehrmann.de/utf-8/decoder/dfa/) (included in fontstash.c). His code is licensed under the MIT license: Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Finally, Font Stash uses Sean Barrett's public domain truetype font rasterizer [stb_truetype.h](http://nothings.org/). |
Added ext/fontstash/bin/DroidSansJapanese.ttf.
cannot compute difference between binary files
Added ext/fontstash/bin/DroidSerif-Bold.ttf.
cannot compute difference between binary files
Added ext/fontstash/bin/DroidSerif-Italic.ttf.
cannot compute difference between binary files
Added ext/fontstash/bin/DroidSerif-Regular.ttf.
cannot compute difference between binary files
Added ext/fontstash/bin/NOTICE.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
Copyright (c) 2005-2008, The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS |
Added ext/fontstash/bin/README.txt.
> > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
Copyright (C) 2008 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ########## This directory contains the fonts for the platform. They are licensed under the Apache 2 license. |
Added ext/fontstash/bin/dejavu-sans.bmfc.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# AngelCode Bitmap Font Generator configuration file fileVersion=1 # font settings fontName=DejaVu Sans charSet=0 fontSize=18 aa=1 scaleH=100 useSmoothing=1 isBold=1 isItalic=0 useUnicode=1 disableBoxChars=1 outputInvalidCharGlyph=0 # character alignment paddingDown=0 paddingUp=0 paddingRight=0 paddingLeft=0 spacingHoriz=1 spacingVert=1 useFixedHeight=0 # output file outWidth=512 outHeight=512 outBitDepth=8 fontDescFormat=0 fourChnlPacked=0 textureFormat=png textureCompression=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4 invA=0 invR=0 invG=0 invB=0 # outline outlineThickness=0 # selected chars chars=32-126,160-591,880-887,890-894,900-906,908,910-929,931-1309,1312-1317,1542-1543,1545-1546,1548,1557 chars=1563,1567,1569-1594,1600-1621,1623,1626,1632-1648,1652,1657-1727,1734,1740,1742,1749,1776-1785,8192 chars=8193-8292,8298-8305,8308-8334,8336-8340,8352-8373,8376-8377,8592-8703,9632-9884,9888-9912,9920-9923 chars=9985-9988,9990-9993,9996-10023,10025-10059,10061,10063-10066,10070,10072-10078,10081-10132,10136 chars=10137-10159,10161-10174 # imported icon images |
Added ext/fontstash/bin/dejavu-sans.fnt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 |
info face="DejaVu Sans" size=18 bold=1 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 outline=0 common lineHeight=18 base=14 scaleW=512 scaleH=512 pages=1 packed=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4 page id=0 file="dejavu-sans_0.png" chars count=1847 char id=32 x=66 y=185 width=1 height=1 xoffset=0 yoffset=14 xadvance=5 page=0 chnl=15 char id=33 x=508 y=305 width=2 height=11 xoffset=2 yoffset=3 xadvance=7 page=0 chnl=15 char id=34 x=28 y=483 width=5 height=4 xoffset=1 yoffset=3 xadvance=8 page=0 chnl=15 char id=35 x=208 y=310 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=36 x=132 y=113 width=7 height=14 xoffset=2 yoffset=2 xadvance=10 page=0 chnl=15 char id=37 x=206 y=274 width=14 height=11 xoffset=1 yoffset=3 xadvance=15 page=0 chnl=15 char id=38 x=91 y=291 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=39 x=69 y=483 width=2 height=4 xoffset=1 yoffset=3 xadvance=5 page=0 chnl=15 char id=40 x=123 y=184 width=4 height=13 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=41 x=118 y=184 width=4 height=13 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=42 x=260 y=462 width=7 height=7 xoffset=0 yoffset=3 xadvance=8 page=0 chnl=15 char id=43 x=77 y=410 width=10 height=10 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 char id=44 x=459 y=463 width=3 height=5 xoffset=0 yoffset=11 xadvance=6 page=0 chnl=15 char id=45 x=375 y=472 width=5 height=2 xoffset=1 yoffset=8 xadvance=6 page=0 chnl=15 char id=46 x=285 y=476 width=2 height=3 xoffset=1 yoffset=11 xadvance=6 page=0 chnl=15 char id=47 x=88 y=266 width=5 height=12 xoffset=0 yoffset=3 xadvance=5 page=0 chnl=15 char id=48 x=350 y=355 width=9 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=49 x=198 y=371 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=50 x=333 y=367 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=51 x=396 y=366 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=52 x=165 y=335 width=10 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=53 x=0 y=387 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=54 x=380 y=354 width=9 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=55 x=418 y=354 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=56 x=427 y=353 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=57 x=390 y=354 width=9 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=58 x=341 y=450 width=2 height=8 xoffset=1 yoffset=6 xadvance=6 page=0 chnl=15 char id=59 x=409 y=401 width=3 height=10 xoffset=0 yoffset=6 xadvance=6 page=0 chnl=15 char id=60 x=500 y=410 width=9 height=9 xoffset=2 yoffset=5 xadvance=13 page=0 chnl=15 char id=61 x=76 y=476 width=9 height=6 xoffset=2 yoffset=6 xadvance=13 page=0 chnl=15 char id=62 x=20 y=431 width=9 height=9 xoffset=2 yoffset=5 xadvance=13 page=0 chnl=15 char id=63 x=330 y=379 width=7 height=11 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15 char id=64 x=352 y=123 width=13 height=13 xoffset=1 yoffset=3 xadvance=15 page=0 chnl=15 char id=65 x=352 y=307 width=11 height=11 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=66 x=275 y=344 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=67 x=295 y=343 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=68 x=253 y=334 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=69 x=135 y=384 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=70 x=153 y=383 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=71 x=264 y=332 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=72 x=297 y=331 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=73 x=481 y=377 width=2 height=11 xoffset=2 yoffset=3 xadvance=6 page=0 chnl=15 char id=74 x=268 y=110 width=4 height=14 xoffset=0 yoffset=3 xadvance=6 page=0 chnl=15 char id=75 x=319 y=331 width=10 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=76 x=162 y=383 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=77 x=169 y=311 width=12 height=11 xoffset=1 yoffset=3 xadvance=14 page=0 chnl=15 char id=78 x=330 y=331 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=79 x=156 y=323 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=80 x=305 y=343 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=81 x=324 y=151 width=11 height=13 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=82 x=335 y=343 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=83 x=345 y=343 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=84 x=363 y=331 width=10 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=85 x=385 y=330 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=86 x=264 y=320 width=11 height=11 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15 char id=87 x=319 y=259 width=16 height=11 xoffset=1 yoffset=3 xadvance=17 page=0 chnl=15 char id=88 x=288 y=319 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=89 x=429 y=329 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=90 x=242 y=346 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=91 x=506 y=123 width=4 height=13 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=92 x=70 y=266 width=5 height=12 xoffset=0 yoffset=3 xadvance=5 page=0 chnl=15 char id=93 x=506 y=165 width=4 height=13 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=94 x=501 y=462 width=10 height=4 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=95 x=176 y=182 width=8 height=1 xoffset=0 yoffset=17 xadvance=8 page=0 chnl=15 char id=96 x=264 y=476 width=4 height=3 xoffset=1 yoffset=2 xadvance=8 page=0 chnl=15 char id=97 x=18 y=459 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=98 x=198 y=383 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=99 x=167 y=457 width=7 height=8 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=100 x=207 y=382 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=101 x=9 y=459 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=102 x=442 y=377 width=5 height=11 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=103 x=216 y=382 width=8 height=11 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=104 x=225 y=382 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=105 x=478 y=377 width=2 height=11 xoffset=1 yoffset=3 xadvance=4 page=0 chnl=15 char id=106 x=283 y=109 width=4 height=14 xoffset=-1 yoffset=3 xadvance=4 page=0 chnl=15 char id=107 x=355 y=343 width=9 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=108 x=508 y=353 width=2 height=11 xoffset=1 yoffset=3 xadvance=4 page=0 chnl=15 char id=109 x=494 y=429 width=12 height=8 xoffset=2 yoffset=6 xadvance=16 page=0 chnl=15 char id=110 x=0 y=459 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=111 x=483 y=438 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=112 x=436 y=353 width=8 height=11 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=113 x=463 y=353 width=8 height=11 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=114 x=267 y=453 width=6 height=8 xoffset=1 yoffset=6 xadvance=7 page=0 chnl=15 char id=115 x=199 y=455 width=7 height=8 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=116 x=436 y=377 width=5 height=11 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=117 x=465 y=439 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=118 x=293 y=444 width=9 height=8 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=15 char id=119 x=325 y=432 width=12 height=8 xoffset=1 yoffset=6 xadvance=14 page=0 chnl=15 char id=120 x=223 y=445 width=9 height=8 xoffset=1 yoffset=6 xadvance=11 page=0 chnl=15 char id=121 x=365 y=343 width=9 height=11 xoffset=0 yoffset=6 xadvance=10 page=0 chnl=15 char id=122 x=151 y=457 width=7 height=8 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=123 x=164 y=111 width=6 height=14 xoffset=2 yoffset=3 xadvance=11 page=0 chnl=15 char id=124 x=143 y=51 width=2 height=15 xoffset=2 yoffset=3 xadvance=5 page=0 chnl=15 char id=125 x=504 y=64 width=7 height=14 xoffset=2 yoffset=3 xadvance=11 page=0 chnl=15 char id=126 x=331 y=468 width=9 height=5 xoffset=2 yoffset=7 xadvance=13 page=0 chnl=15 char id=160 x=82 y=238 width=1 height=1 xoffset=0 yoffset=14 xadvance=5 page=0 chnl=15 char id=161 x=509 y=218 width=2 height=11 xoffset=2 yoffset=3 xadvance=7 page=0 chnl=15 char id=162 x=504 y=244 width=6 height=12 xoffset=1 yoffset=4 xadvance=10 page=0 chnl=15 char id=163 x=385 y=342 width=9 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=164 x=447 y=439 width=8 height=8 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=15 char id=165 x=420 y=317 width=11 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=166 x=509 y=151 width=2 height=13 xoffset=2 yoffset=4 xadvance=5 page=0 chnl=15 char id=167 x=362 y=244 width=7 height=12 xoffset=1 yoffset=3 xadvance=8 page=0 chnl=15 char id=168 x=393 y=471 width=5 height=2 xoffset=1 yoffset=3 xadvance=8 page=0 chnl=15 char id=169 x=444 y=317 width=11 height=11 xoffset=2 yoffset=3 xadvance=15 page=0 chnl=15 char id=170 x=323 y=451 width=6 height=8 xoffset=1 yoffset=3 xadvance=8 page=0 chnl=15 char id=171 x=233 y=463 width=8 height=7 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=172 x=341 y=467 width=9 height=5 xoffset=2 yoffset=7 xadvance=13 page=0 chnl=15 char id=173 x=399 y=471 width=5 height=2 xoffset=1 yoffset=8 xadvance=6 page=0 chnl=15 char id=174 x=456 y=317 width=11 height=11 xoffset=2 yoffset=3 xadvance=15 page=0 chnl=15 char id=175 x=45 y=129 width=5 height=1 xoffset=1 yoffset=3 xadvance=8 page=0 chnl=15 char id=176 x=411 y=465 width=5 height=5 xoffset=1 yoffset=3 xadvance=8 page=0 chnl=15 char id=177 x=121 y=410 width=10 height=10 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 char id=178 x=195 y=472 width=5 height=6 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=179 x=189 y=473 width=5 height=6 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=180 x=269 y=476 width=4 height=3 xoffset=3 yoffset=2 xadvance=8 page=0 chnl=15 char id=181 x=405 y=342 width=9 height=11 xoffset=1 yoffset=6 xadvance=11 page=0 chnl=15 char id=182 x=14 y=266 width=6 height=12 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=183 x=291 y=476 width=2 height=3 xoffset=1 yoffset=7 xadvance=6 page=0 chnl=15 char id=184 x=278 y=476 width=3 height=3 xoffset=2 yoffset=14 xadvance=8 page=0 chnl=15 char id=185 x=176 y=474 width=6 height=6 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=186 x=159 y=457 width=7 height=8 xoffset=1 yoffset=3 xadvance=8 page=0 chnl=15 char id=187 x=242 y=463 width=8 height=7 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=188 x=351 y=192 width=13 height=12 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=15 char id=189 x=236 y=272 width=14 height=11 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=15 char id=190 x=127 y=198 width=13 height=12 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=15 char id=191 x=504 y=269 width=7 height=11 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15 char id=192 x=432 y=64 width=11 height=14 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15 char id=193 x=444 y=64 width=11 height=14 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15 char id=194 x=456 y=64 width=11 height=14 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15 char id=195 x=96 y=36 width=11 height=15 xoffset=0 yoffset=-1 xadvance=11 page=0 chnl=15 char id=196 x=480 y=64 width=11 height=14 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15 char id=197 x=492 y=64 width=11 height=14 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15 char id=198 x=128 y=275 width=15 height=11 xoffset=0 yoffset=3 xadvance=16 page=0 chnl=15 char id=199 x=161 y=96 width=9 height=14 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=200 x=27 y=116 width=8 height=14 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=15 char id=201 x=426 y=94 width=8 height=14 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=15 char id=202 x=408 y=94 width=8 height=14 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=15 char id=203 x=63 y=114 width=8 height=14 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=15 char id=204 x=288 y=109 width=4 height=14 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 char id=205 x=273 y=109 width=4 height=14 xoffset=1 yoffset=0 xadvance=6 page=0 chnl=15 char id=206 x=192 y=110 width=6 height=14 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 char id=207 x=178 y=111 width=6 height=14 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 char id=208 x=468 y=317 width=11 height=11 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15 char id=209 x=306 y=33 width=10 height=15 xoffset=1 yoffset=-1 xadvance=12 page=0 chnl=15 char id=210 x=96 y=83 width=11 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=211 x=60 y=84 width=11 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=212 x=36 y=84 width=11 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=213 x=0 y=39 width=11 height=15 xoffset=1 yoffset=-1 xadvance=13 page=0 chnl=15 char id=214 x=468 y=64 width=11 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=215 x=490 y=410 width=9 height=9 xoffset=2 yoffset=5 xadvance=13 page=0 chnl=15 char id=216 x=224 y=139 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=217 x=440 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=218 x=451 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=219 x=462 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=220 x=473 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=221 x=484 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=222 x=415 y=342 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=223 x=425 y=341 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=224 x=225 y=247 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=225 x=476 y=231 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=226 x=234 y=246 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=227 x=485 y=231 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=228 x=490 y=353 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=229 x=54 y=187 width=8 height=13 xoffset=1 yoffset=1 xadvance=10 page=0 chnl=15 char id=230 x=273 y=426 width=15 height=8 xoffset=1 yoffset=6 xadvance=17 page=0 chnl=15 char id=231 x=250 y=382 width=7 height=11 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=232 x=314 y=233 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=233 x=323 y=233 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=234 x=63 y=253 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=235 x=18 y=375 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=236 x=507 y=205 width=4 height=12 xoffset=0 yoffset=2 xadvance=4 page=0 chnl=15 char id=237 x=506 y=179 width=5 height=12 xoffset=1 yoffset=2 xadvance=4 page=0 chnl=15 char id=238 x=42 y=266 width=6 height=12 xoffset=-1 yoffset=2 xadvance=4 page=0 chnl=15 char id=239 x=345 y=379 width=6 height=11 xoffset=-1 yoffset=3 xadvance=4 page=0 chnl=15 char id=240 x=413 y=231 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=241 x=270 y=246 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=242 x=261 y=246 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=243 x=243 y=246 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=244 x=198 y=249 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=245 x=171 y=249 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=246 x=153 y=371 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=247 x=171 y=447 width=10 height=8 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=248 x=262 y=405 width=9 height=10 xoffset=0 yoffset=5 xadvance=10 page=0 chnl=15 char id=249 x=162 y=249 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=250 x=144 y=250 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=251 x=108 y=251 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=252 x=162 y=371 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=253 x=348 y=33 width=9 height=15 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=15 char id=254 x=390 y=94 width=8 height=14 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=255 x=181 y=95 width=9 height=14 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=256 x=168 y=154 width=11 height=13 xoffset=0 yoffset=1 xadvance=11 page=0 chnl=15 char id=257 x=45 y=375 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=258 x=48 y=84 width=11 height=14 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15 char id=259 x=360 y=367 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=260 x=120 y=83 width=11 height=14 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=261 x=369 y=367 width=8 height=11 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=262 x=351 y=94 width=9 height=14 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 char id=263 x=99 y=251 width=8 height=12 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=15 char id=264 x=291 y=94 width=9 height=14 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 char id=265 x=90 y=251 width=8 height=12 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=15 char id=266 x=121 y=98 width=9 height=14 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 char id=267 x=338 y=245 width=7 height=12 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=15 char id=268 x=151 y=97 width=9 height=14 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 char id=269 x=36 y=253 width=8 height=12 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=15 char id=270 x=33 y=101 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=271 x=91 y=315 width=12 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=272 x=96 y=339 width=11 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=273 x=445 y=341 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=274 x=488 y=165 width=8 height=13 xoffset=1 yoffset=1 xadvance=10 page=0 chnl=15 char id=275 x=378 y=367 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=276 x=453 y=94 width=8 height=14 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=15 char id=277 x=387 y=366 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=278 x=480 y=94 width=8 height=14 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=15 char id=279 x=458 y=231 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=280 x=141 y=98 width=9 height=14 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=281 x=414 y=366 width=8 height=11 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=282 x=489 y=94 width=8 height=14 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=15 char id=283 x=449 y=231 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=284 x=55 y=99 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=285 x=501 y=33 width=8 height=15 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=286 x=66 y=99 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=287 x=18 y=116 width=8 height=14 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=288 x=187 y=80 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=289 x=0 y=55 width=8 height=15 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=290 x=262 y=33 width=10 height=15 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=291 x=36 y=116 width=8 height=14 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=292 x=77 y=98 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=293 x=88 y=98 width=10 height=14 xoffset=-1 yoffset=0 xadvance=10 page=0 chnl=15 char id=294 x=78 y=315 width=12 height=11 xoffset=1 yoffset=3 xadvance=15 page=0 chnl=15 char id=295 x=455 y=341 width=9 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=296 x=101 y=52 width=6 height=15 xoffset=0 yoffset=-1 xadvance=6 page=0 chnl=15 char id=297 x=28 y=266 width=6 height=12 xoffset=-1 yoffset=2 xadvance=4 page=0 chnl=15 char id=298 x=111 y=184 width=6 height=13 xoffset=0 yoffset=1 xadvance=6 page=0 chnl=15 char id=299 x=380 y=379 width=6 height=11 xoffset=-1 yoffset=3 xadvance=4 page=0 chnl=15 char id=300 x=185 y=110 width=6 height=14 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 char id=301 x=373 y=379 width=6 height=11 xoffset=-1 yoffset=3 xadvance=4 page=0 chnl=15 char id=302 x=507 y=94 width=4 height=14 xoffset=2 yoffset=3 xadvance=6 page=0 chnl=15 char id=303 x=506 y=79 width=5 height=14 xoffset=1 yoffset=3 xadvance=4 page=0 chnl=15 char id=304 x=303 y=109 width=2 height=14 xoffset=2 yoffset=0 xadvance=6 page=0 chnl=15 char id=305 x=344 y=450 width=2 height=8 xoffset=1 yoffset=6 xadvance=4 page=0 chnl=15 char id=306 x=72 y=114 width=8 height=14 xoffset=2 yoffset=3 xadvance=11 page=0 chnl=15 char id=307 x=116 y=113 width=7 height=14 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15 char id=308 x=252 y=0 width=6 height=17 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 char id=309 x=94 y=52 width=6 height=15 xoffset=-1 yoffset=2 xadvance=4 page=0 chnl=15 char id=310 x=119 y=36 width=10 height=15 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=311 x=408 y=33 width=9 height=15 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=312 x=283 y=444 width=9 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=313 x=99 y=113 width=8 height=14 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=15 char id=314 x=238 y=110 width=5 height=14 xoffset=1 yoffset=0 xadvance=4 page=0 chnl=15 char id=315 x=36 y=53 width=8 height=15 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=316 x=508 y=17 width=3 height=15 xoffset=1 yoffset=3 xadvance=4 page=0 chnl=15 char id=317 x=468 y=365 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=318 x=387 y=378 width=6 height=11 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=319 x=486 y=365 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=320 x=412 y=378 width=5 height=11 xoffset=1 yoffset=3 xadvance=8 page=0 chnl=15 char id=321 x=465 y=341 width=9 height=11 xoffset=-1 yoffset=3 xadvance=10 page=0 chnl=15 char id=322 x=338 y=379 width=6 height=11 xoffset=-1 yoffset=3 xadvance=4 page=0 chnl=15 char id=323 x=275 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=324 x=395 y=231 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=325 x=196 y=34 width=10 height=15 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=326 x=386 y=231 width=8 height=12 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=327 x=330 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=328 x=377 y=231 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=329 x=481 y=293 width=12 height=11 xoffset=1 yoffset=3 xadvance=15 page=0 chnl=15 char id=330 x=363 y=79 width=10 height=14 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=331 x=18 y=387 width=8 height=11 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=332 x=420 y=151 width=11 height=13 xoffset=1 yoffset=1 xadvance=13 page=0 chnl=15 char id=333 x=27 y=387 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=334 x=252 y=65 width=11 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=335 x=36 y=387 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=336 x=240 y=65 width=11 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=337 x=359 y=231 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=338 x=387 y=257 width=16 height=11 xoffset=1 yoffset=3 xadvance=18 page=0 chnl=15 char id=339 x=207 y=427 width=16 height=8 xoffset=1 yoffset=6 xadvance=18 page=0 chnl=15 char id=340 x=201 y=95 width=9 height=14 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 char id=341 x=322 y=246 width=7 height=12 xoffset=1 yoffset=2 xadvance=7 page=0 chnl=15 char id=342 x=358 y=33 width=9 height=15 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=343 x=497 y=244 width=6 height=12 xoffset=1 yoffset=6 xadvance=7 page=0 chnl=15 char id=344 x=241 y=95 width=9 height=14 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 char id=345 x=314 y=246 width=7 height=12 xoffset=1 yoffset=2 xadvance=7 page=0 chnl=15 char id=346 x=261 y=95 width=9 height=14 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 char id=347 x=306 y=246 width=7 height=12 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=15 char id=348 x=281 y=94 width=9 height=14 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 char id=349 x=482 y=244 width=7 height=12 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=15 char id=350 x=301 y=94 width=9 height=14 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=351 x=234 y=382 width=7 height=11 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=352 x=321 y=94 width=9 height=14 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 char id=353 x=450 y=244 width=7 height=12 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=15 char id=354 x=11 y=101 width=10 height=14 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=355 x=262 y=110 width=5 height=14 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=356 x=22 y=101 width=10 height=14 xoffset=0 yoffset=0 xadvance=10 page=0 chnl=15 char id=357 x=442 y=244 width=7 height=12 xoffset=1 yoffset=2 xadvance=7 page=0 chnl=15 char id=358 x=110 y=349 width=10 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=359 x=390 y=402 width=6 height=10 xoffset=0 yoffset=4 xadvance=6 page=0 chnl=15 char id=360 x=174 y=34 width=10 height=15 xoffset=1 yoffset=-1 xadvance=12 page=0 chnl=15 char id=361 x=368 y=231 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=362 x=454 y=151 width=10 height=13 xoffset=1 yoffset=1 xadvance=12 page=0 chnl=15 char id=363 x=351 y=367 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=364 x=110 y=98 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=365 x=342 y=367 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=366 x=132 y=83 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=367 x=27 y=187 width=8 height=13 xoffset=1 yoffset=1 xadvance=10 page=0 chnl=15 char id=368 x=154 y=81 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=369 x=297 y=246 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=370 x=176 y=80 width=10 height=14 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=371 x=209 y=346 width=10 height=11 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=372 x=352 y=49 width=16 height=14 xoffset=1 yoffset=0 xadvance=17 page=0 chnl=15 char id=373 x=260 y=207 width=12 height=12 xoffset=1 yoffset=2 xadvance=14 page=0 chnl=15 char id=374 x=220 y=80 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=375 x=388 y=33 width=9 height=15 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=15 char id=376 x=242 y=80 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=377 x=253 y=80 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=378 x=474 y=244 width=7 height=12 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=15 char id=379 x=0 y=101 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=380 x=466 y=244 width=7 height=12 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=15 char id=381 x=286 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=382 x=458 y=244 width=7 height=12 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=15 char id=383 x=418 y=378 width=5 height=11 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=384 x=475 y=341 width=9 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=385 x=65 y=315 width=12 height=11 xoffset=-1 yoffset=3 xadvance=12 page=0 chnl=15 char id=386 x=10 y=363 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=387 x=315 y=367 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=388 x=228 y=322 width=11 height=11 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=389 x=216 y=153 width=11 height=13 xoffset=0 yoffset=2 xadvance=11 page=0 chnl=15 char id=390 x=20 y=363 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=391 x=460 y=17 width=11 height=15 xoffset=1 yoffset=-1 xadvance=11 page=0 chnl=15 char id=392 x=30 y=363 width=9 height=11 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15 char id=393 x=216 y=322 width=11 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=394 x=378 y=269 width=13 height=11 xoffset=-1 yoffset=3 xadvance=13 page=0 chnl=15 char id=395 x=40 y=363 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=396 x=288 y=368 width=8 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=397 x=279 y=246 width=8 height=12 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=398 x=279 y=368 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=399 x=120 y=324 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=400 x=117 y=373 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=401 x=324 y=64 width=11 height=14 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=15 char id=402 x=148 y=113 width=7 height=14 xoffset=-1 yoffset=3 xadvance=7 page=0 chnl=15 char id=403 x=201 y=65 width=12 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=404 x=14 y=71 width=13 height=14 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=405 x=461 y=179 width=14 height=12 xoffset=1 yoffset=2 xadvance=16 page=0 chnl=15 char id=406 x=424 y=378 width=5 height=11 xoffset=2 yoffset=3 xadvance=7 page=0 chnl=15 char id=407 x=463 y=377 width=4 height=11 xoffset=1 yoffset=3 xadvance=6 page=0 chnl=15 char id=408 x=377 y=205 width=12 height=12 xoffset=1 yoffset=2 xadvance=12 page=0 chnl=15 char id=409 x=88 y=238 width=10 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=410 x=468 y=377 width=4 height=11 xoffset=0 yoffset=3 xadvance=4 page=0 chnl=15 char id=411 x=498 y=218 width=10 height=12 xoffset=-1 yoffset=2 xadvance=9 page=0 chnl=15 char id=412 x=431 y=179 width=14 height=12 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=15 char id=413 x=175 y=65 width=12 height=14 xoffset=-1 yoffset=3 xadvance=12 page=0 chnl=15 char id=414 x=0 y=375 width=8 height=11 xoffset=1 yoffset=6 xadvance=11 page=0 chnl=15 char id=415 x=472 y=305 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=416 x=195 y=210 width=12 height=12 xoffset=1 yoffset=2 xadvance=13 page=0 chnl=15 char id=417 x=22 y=410 width=10 height=10 xoffset=1 yoffset=4 xadvance=10 page=0 chnl=15 char id=418 x=221 y=274 width=14 height=11 xoffset=1 yoffset=3 xadvance=17 page=0 chnl=15 char id=419 x=460 y=305 width=11 height=11 xoffset=1 yoffset=6 xadvance=14 page=0 chnl=15 char id=420 x=442 y=293 width=12 height=11 xoffset=-1 yoffset=3 xadvance=12 page=0 chnl=15 char id=421 x=462 y=94 width=8 height=14 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=422 x=500 y=49 width=11 height=14 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=423 x=187 y=168 width=9 height=13 xoffset=0 yoffset=2 xadvance=11 page=0 chnl=15 char id=424 x=321 y=402 width=8 height=10 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=15 char id=425 x=481 y=353 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=426 x=33 y=20 width=10 height=16 xoffset=-1 yoffset=2 xadvance=8 page=0 chnl=15 char id=427 x=79 y=52 width=7 height=15 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=15 char id=428 x=22 y=351 width=10 height=11 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=429 x=506 y=257 width=5 height=11 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=430 x=99 y=98 width=10 height=14 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=431 x=416 y=205 width=12 height=12 xoffset=1 yoffset=2 xadvance=13 page=0 chnl=15 char id=432 x=396 y=390 width=11 height=10 xoffset=1 yoffset=4 xadvance=11 page=0 chnl=15 char id=433 x=328 y=307 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=434 x=316 y=307 width=11 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=435 x=169 y=197 width=13 height=12 xoffset=-1 yoffset=2 xadvance=12 page=0 chnl=15 char id=436 x=278 y=139 width=12 height=13 xoffset=0 yoffset=5 xadvance=12 page=0 chnl=15 char id=437 x=304 y=307 width=11 height=11 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=438 x=118 y=431 width=8 height=9 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=15 char id=439 x=22 y=240 width=10 height=12 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=440 x=260 y=220 width=11 height=12 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15 char id=441 x=197 y=168 width=9 height=13 xoffset=0 yoffset=5 xadvance=10 page=0 chnl=15 char id=442 x=479 y=165 width=8 height=13 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=15 char id=443 x=129 y=237 width=9 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=444 x=272 y=220 width=11 height=12 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15 char id=445 x=237 y=167 width=9 height=13 xoffset=0 yoffset=5 xadvance=10 page=0 chnl=15 char id=446 x=269 y=233 width=8 height=12 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=15 char id=447 x=110 y=170 width=10 height=13 xoffset=1 yoffset=5 xadvance=11 page=0 chnl=15 char id=448 x=128 y=52 width=4 height=15 xoffset=1 yoffset=3 xadvance=6 page=0 chnl=15 char id=449 x=447 y=33 width=8 height=15 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=450 x=483 y=33 width=8 height=15 xoffset=0 yoffset=3 xadvance=8 page=0 chnl=15 char id=451 x=484 y=377 width=2 height=11 xoffset=1 yoffset=3 xadvance=6 page=0 chnl=15 char id=452 x=146 y=51 width=22 height=14 xoffset=1 yoffset=0 xadvance=23 page=0 chnl=15 char id=453 x=150 y=184 width=19 height=12 xoffset=1 yoffset=2 xadvance=21 page=0 chnl=15 char id=454 x=209 y=181 width=18 height=12 xoffset=1 yoffset=2 xadvance=19 page=0 chnl=15 char id=455 x=472 y=49 width=13 height=14 xoffset=1 yoffset=3 xadvance=15 page=0 chnl=15 char id=456 x=214 y=65 width=12 height=14 xoffset=1 yoffset=3 xadvance=15 page=0 chnl=15 char id=457 x=140 y=113 width=7 height=14 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=458 x=318 y=49 width=16 height=14 xoffset=1 yoffset=3 xadvance=18 page=0 chnl=15 char id=459 x=369 y=49 width=15 height=14 xoffset=1 yoffset=3 xadvance=18 page=0 chnl=15 char id=460 x=56 y=69 width=13 height=14 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=15 char id=461 x=108 y=83 width=11 height=14 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15 char id=462 x=278 y=233 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=463 x=171 y=111 width=6 height=14 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 char id=464 x=63 y=266 width=6 height=12 xoffset=-1 yoffset=2 xadvance=4 page=0 chnl=15 char id=465 x=24 y=86 width=11 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=466 x=305 y=233 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=467 x=495 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=468 x=332 y=232 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=469 x=273 y=33 width=10 height=15 xoffset=1 yoffset=-1 xadvance=12 page=0 chnl=15 char id=470 x=461 y=165 width=8 height=13 xoffset=1 yoffset=1 xadvance=10 page=0 chnl=15 char id=471 x=230 y=0 width=10 height=17 xoffset=1 yoffset=-3 xadvance=12 page=0 chnl=15 char id=472 x=498 y=94 width=8 height=14 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 char id=473 x=241 y=0 width=10 height=17 xoffset=1 yoffset=-3 xadvance=12 page=0 chnl=15 char id=474 x=0 y=116 width=8 height=14 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 char id=475 x=219 y=0 width=10 height=17 xoffset=1 yoffset=-3 xadvance=12 page=0 chnl=15 char id=476 x=45 y=114 width=8 height=14 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 char id=477 x=126 y=459 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=478 x=496 y=17 width=11 height=15 xoffset=0 yoffset=-1 xadvance=11 page=0 chnl=15 char id=479 x=425 y=165 width=8 height=13 xoffset=1 yoffset=1 xadvance=10 page=0 chnl=15 char id=480 x=472 y=17 width=11 height=15 xoffset=0 yoffset=-1 xadvance=11 page=0 chnl=15 char id=481 x=434 y=165 width=8 height=13 xoffset=1 yoffset=1 xadvance=10 page=0 chnl=15 char id=482 x=117 y=128 width=15 height=13 xoffset=0 yoffset=1 xadvance=16 page=0 chnl=15 char id=483 x=64 y=279 width=15 height=11 xoffset=1 yoffset=3 xadvance=17 page=0 chnl=15 char id=484 x=91 y=157 width=12 height=13 xoffset=0 yoffset=2 xadvance=12 page=0 chnl=15 char id=485 x=396 y=151 width=11 height=13 xoffset=0 yoffset=5 xadvance=11 page=0 chnl=15 char id=486 x=418 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=487 x=465 y=33 width=8 height=15 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=488 x=407 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 char id=489 x=336 y=64 width=11 height=14 xoffset=-1 yoffset=0 xadvance=10 page=0 chnl=15 char id=490 x=264 y=64 width=11 height=14 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=491 x=472 y=353 width=8 height=11 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=492 x=468 y=0 width=11 height=16 xoffset=1 yoffset=1 xadvance=13 page=0 chnl=15 char id=493 x=444 y=94 width=8 height=14 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=494 x=141 y=35 width=10 height=15 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=495 x=84 y=19 width=9 height=16 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=15 char id=496 x=115 y=52 width=6 height=15 xoffset=-1 yoffset=2 xadvance=5 page=0 chnl=15 char id=497 x=103 y=264 width=22 height=11 xoffset=1 yoffset=3 xadvance=23 page=0 chnl=15 char id=498 x=169 y=262 width=19 height=11 xoffset=1 yoffset=3 xadvance=21 page=0 chnl=15 char id=499 x=209 y=262 width=18 height=11 xoffset=1 yoffset=3 xadvance=19 page=0 chnl=15 char id=500 x=385 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=501 x=474 y=33 width=8 height=15 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=502 x=247 y=181 width=17 height=12 xoffset=1 yoffset=3 xadvance=19 page=0 chnl=15 char id=503 x=456 y=0 width=11 height=16 xoffset=1 yoffset=2 xadvance=12 page=0 chnl=15 char id=504 x=374 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=505 x=189 y=249 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=506 x=149 y=66 width=12 height=14 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=15 char id=507 x=341 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=15 char id=508 x=385 y=49 width=15 height=14 xoffset=0 yoffset=0 xadvance=16 page=0 chnl=15 char id=509 x=352 y=179 width=15 height=12 xoffset=1 yoffset=2 xadvance=17 page=0 chnl=15 char id=510 x=369 y=17 width=13 height=15 xoffset=0 yoffset=0 xadvance=13 page=0 chnl=15 char id=511 x=207 y=167 width=9 height=13 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=15 char id=512 x=72 y=36 width=11 height=15 xoffset=0 yoffset=-1 xadvance=11 page=0 chnl=15 char id=513 x=350 y=231 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=514 x=60 y=36 width=11 height=15 xoffset=0 yoffset=-1 xadvance=11 page=0 chnl=15 char id=515 x=45 y=253 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=516 x=456 y=33 width=8 height=15 xoffset=1 yoffset=-1 xadvance=10 page=0 chnl=15 char id=517 x=216 y=247 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=518 x=438 y=33 width=8 height=15 xoffset=1 yoffset=-1 xadvance=10 page=0 chnl=15 char id=519 x=207 y=249 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=520 x=71 y=52 width=7 height=15 xoffset=-1 yoffset=-1 xadvance=6 page=0 chnl=15 char id=521 x=354 y=244 width=7 height=12 xoffset=-1 yoffset=2 xadvance=4 page=0 chnl=15 char id=522 x=108 y=52 width=6 height=15 xoffset=0 yoffset=-1 xadvance=6 page=0 chnl=15 char id=523 x=490 y=244 width=6 height=12 xoffset=-1 yoffset=2 xadvance=4 page=0 chnl=15 char id=524 x=36 y=37 width=11 height=15 xoffset=1 yoffset=-1 xadvance=13 page=0 chnl=15 char id=525 x=252 y=246 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=526 x=448 y=17 width=11 height=15 xoffset=1 yoffset=-1 xadvance=13 page=0 chnl=15 char id=527 x=81 y=253 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=528 x=338 y=33 width=9 height=15 xoffset=1 yoffset=-1 xadvance=11 page=0 chnl=15 char id=529 x=346 y=245 width=7 height=12 xoffset=0 yoffset=2 xadvance=7 page=0 chnl=15 char id=530 x=328 y=33 width=9 height=15 xoffset=1 yoffset=-1 xadvance=11 page=0 chnl=15 char id=531 x=7 y=266 width=6 height=12 xoffset=1 yoffset=2 xadvance=7 page=0 chnl=15 char id=532 x=251 y=34 width=10 height=15 xoffset=1 yoffset=-1 xadvance=12 page=0 chnl=15 char id=533 x=72 y=253 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=534 x=207 y=34 width=10 height=15 xoffset=1 yoffset=-1 xadvance=12 page=0 chnl=15 char id=535 x=54 y=253 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=536 x=378 y=33 width=9 height=15 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=537 x=386 y=244 width=7 height=12 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=538 x=185 y=34 width=10 height=15 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=539 x=122 y=52 width=5 height=15 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=540 x=74 y=19 width=9 height=16 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=541 x=397 y=165 width=9 height=13 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=15 char id=542 x=308 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=543 x=264 y=79 width=10 height=14 xoffset=-1 yoffset=0 xadvance=10 page=0 chnl=15 char id=544 x=231 y=80 width=10 height=14 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=545 x=458 y=49 width=13 height=14 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=546 x=395 y=137 width=12 height=13 xoffset=0 yoffset=2 xadvance=12 page=0 chnl=15 char id=547 x=418 y=329 width=10 height=11 xoffset=0 yoffset=4 xadvance=10 page=0 chnl=15 char id=548 x=84 y=36 width=11 height=15 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=549 x=9 y=187 width=8 height=13 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=15 char id=550 x=420 y=64 width=11 height=14 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15 char id=551 x=422 y=231 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=552 x=471 y=94 width=8 height=14 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=553 x=445 y=353 width=8 height=11 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=554 x=424 y=17 width=11 height=15 xoffset=1 yoffset=-1 xadvance=13 page=0 chnl=15 char id=555 x=407 y=165 width=8 height=13 xoffset=1 yoffset=1 xadvance=10 page=0 chnl=15 char id=556 x=436 y=17 width=11 height=15 xoffset=1 yoffset=-1 xadvance=13 page=0 chnl=15 char id=557 x=416 y=165 width=8 height=13 xoffset=1 yoffset=1 xadvance=10 page=0 chnl=15 char id=558 x=0 y=86 width=11 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=559 x=404 y=231 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=560 x=12 y=39 width=11 height=15 xoffset=1 yoffset=-1 xadvance=13 page=0 chnl=15 char id=561 x=452 y=165 width=8 height=13 xoffset=1 yoffset=1 xadvance=10 page=0 chnl=15 char id=562 x=44 y=173 width=10 height=13 xoffset=1 yoffset=1 xadvance=12 page=0 chnl=15 char id=563 x=231 y=95 width=9 height=14 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=564 x=206 y=110 width=6 height=14 xoffset=1 yoffset=2 xadvance=7 page=0 chnl=15 char id=565 x=364 y=294 width=12 height=11 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=566 x=63 y=187 width=7 height=13 xoffset=0 yoffset=3 xadvance=8 page=0 chnl=15 char id=567 x=458 y=377 width=4 height=11 xoffset=-1 yoffset=6 xadvance=4 page=0 chnl=15 char id=568 x=448 y=109 width=16 height=13 xoffset=0 yoffset=2 xadvance=16 page=0 chnl=15 char id=569 x=465 y=109 width=16 height=13 xoffset=0 yoffset=5 xadvance=16 page=0 chnl=15 char id=570 x=238 y=139 width=13 height=13 xoffset=-1 yoffset=2 xadvance=12 page=0 chnl=15 char id=571 x=140 y=142 width=13 height=13 xoffset=-1 yoffset=2 xadvance=11 page=0 chnl=15 char id=572 x=88 y=410 width=10 height=10 xoffset=-1 yoffset=5 xadvance=9 page=0 chnl=15 char id=573 x=50 y=363 width=9 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=574 x=126 y=142 width=13 height=13 xoffset=-1 yoffset=2 xadvance=10 page=0 chnl=15 char id=575 x=337 y=165 width=9 height=13 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=15 char id=576 x=347 y=165 width=9 height=13 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=15 char id=577 x=351 y=295 width=12 height=11 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15 char id=578 x=0 y=431 width=9 height=9 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=15 char id=579 x=308 y=331 width=10 height=11 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=580 x=234 y=298 width=12 height=11 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15 char id=581 x=448 y=305 width=11 height=11 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15 char id=582 x=428 y=33 width=9 height=15 xoffset=1 yoffset=1 xadvance=10 page=0 chnl=15 char id=583 x=487 y=218 width=10 height=12 xoffset=0 yoffset=4 xadvance=10 page=0 chnl=15 char id=584 x=220 y=110 width=5 height=14 xoffset=0 yoffset=3 xadvance=6 page=0 chnl=15 char id=585 x=199 y=110 width=6 height=14 xoffset=-1 yoffset=3 xadvance=4 page=0 chnl=15 char id=586 x=311 y=17 width=14 height=15 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=587 x=434 y=137 width=12 height=13 xoffset=0 yoffset=5 xadvance=12 page=0 chnl=15 char id=588 x=242 y=334 width=10 height=11 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=589 x=117 y=459 width=8 height=8 xoffset=-1 yoffset=6 xadvance=7 page=0 chnl=15 char id=590 x=221 y=298 width=12 height=11 xoffset=-1 yoffset=3 xadvance=11 page=0 chnl=15 char id=591 x=192 y=154 width=11 height=13 xoffset=-1 yoffset=5 xadvance=10 page=0 chnl=15 char id=880 x=60 y=363 width=9 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=881 x=172 y=428 width=7 height=9 xoffset=1 yoffset=5 xadvance=8 page=0 chnl=15 char id=882 x=294 y=271 width=13 height=11 xoffset=1 yoffset=3 xadvance=15 page=0 chnl=15 char id=883 x=340 y=307 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=884 x=65 y=483 width=3 height=4 xoffset=1 yoffset=2 xadvance=5 page=0 chnl=15 char id=885 x=463 y=463 width=3 height=5 xoffset=1 yoffset=13 xadvance=5 page=0 chnl=15 char id=886 x=176 y=335 width=10 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=887 x=108 y=459 width=8 height=8 xoffset=1 yoffset=6 xadvance=11 page=0 chnl=15 char id=890 x=72 y=483 width=2 height=4 xoffset=3 yoffset=14 xadvance=8 page=0 chnl=15 char id=891 x=175 y=456 width=7 height=8 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=892 x=135 y=459 width=7 height=8 xoffset=1 yoffset=6 xadvance=8 page=0 chnl=15 char id=893 x=183 y=455 width=7 height=8 xoffset=1 yoffset=6 xadvance=8 page=0 chnl=15 char id=894 x=413 y=401 width=3 height=10 xoffset=0 yoffset=6 xadvance=6 page=0 chnl=15 char id=900 x=259 y=476 width=4 height=3 xoffset=3 yoffset=2 xadvance=7 page=0 chnl=15 char id=901 x=148 y=476 width=6 height=6 xoffset=1 yoffset=-1 xadvance=8 page=0 chnl=15 char id=902 x=284 y=220 width=11 height=12 xoffset=0 yoffset=2 xadvance=12 page=0 chnl=15 char id=903 x=288 y=476 width=2 height=3 xoffset=1 yoffset=7 xadvance=6 page=0 chnl=15 char id=904 x=296 y=220 width=11 height=12 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=905 x=446 y=179 width=14 height=12 xoffset=0 yoffset=2 xadvance=15 page=0 chnl=15 char id=906 x=434 y=244 width=7 height=12 xoffset=0 yoffset=2 xadvance=8 page=0 chnl=15 char id=908 x=211 y=194 width=13 height=12 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=910 x=368 y=179 width=15 height=12 xoffset=0 yoffset=2 xadvance=15 page=0 chnl=15 char id=911 x=99 y=199 width=13 height=12 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=912 x=87 y=52 width=6 height=15 xoffset=0 yoffset=-1 xadvance=5 page=0 chnl=15 char id=913 x=244 y=310 width=11 height=11 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=914 x=70 y=363 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=915 x=234 y=370 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=916 x=312 y=319 width=11 height=11 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=917 x=207 y=370 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=918 x=209 y=334 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=919 x=132 y=335 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=920 x=492 y=317 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=921 x=490 y=377 width=2 height=11 xoffset=2 yoffset=3 xadvance=6 page=0 chnl=15 char id=922 x=231 y=346 width=10 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=923 x=132 y=323 width=11 height=11 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=924 x=130 y=287 width=12 height=11 xoffset=1 yoffset=3 xadvance=14 page=0 chnl=15 char id=925 x=352 y=331 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=926 x=298 y=380 width=7 height=11 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15 char id=927 x=496 y=305 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=928 x=484 y=329 width=10 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=929 x=80 y=363 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=931 x=135 y=372 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=932 x=495 y=329 width=10 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=933 x=176 y=347 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=934 x=429 y=281 width=12 height=11 xoffset=1 yoffset=3 xadvance=14 page=0 chnl=15 char id=935 x=24 y=327 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=936 x=126 y=373 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=937 x=0 y=327 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=938 x=232 y=110 width=5 height=14 xoffset=1 yoffset=0 xadvance=6 page=0 chnl=15 char id=939 x=165 y=81 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=940 x=169 y=236 width=9 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=941 x=426 y=244 width=7 height=12 xoffset=1 yoffset=2 xadvance=8 page=0 chnl=15 char id=942 x=54 y=53 width=8 height=15 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=943 x=82 y=266 width=5 height=12 xoffset=1 yoffset=2 xadvance=5 page=0 chnl=15 char id=944 x=45 y=53 width=8 height=15 xoffset=1 yoffset=-1 xadvance=10 page=0 chnl=15 char id=945 x=233 y=445 width=9 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=946 x=90 y=113 width=8 height=14 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=947 x=90 y=363 width=9 height=11 xoffset=0 yoffset=6 xadvance=10 page=0 chnl=15 char id=948 x=72 y=375 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=949 x=260 y=453 width=6 height=8 xoffset=1 yoffset=6 xadvance=8 page=0 chnl=15 char id=950 x=156 y=112 width=7 height=14 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15 char id=951 x=54 y=375 width=8 height=11 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=952 x=400 y=354 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=953 x=337 y=450 width=3 height=8 xoffset=1 yoffset=6 xadvance=5 page=0 chnl=15 char id=954 x=243 y=444 width=9 height=8 xoffset=1 yoffset=6 xadvance=11 page=0 chnl=15 char id=955 x=100 y=363 width=9 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=956 x=110 y=361 width=9 height=11 xoffset=1 yoffset=6 xadvance=11 page=0 chnl=15 char id=957 x=253 y=444 width=9 height=8 xoffset=0 yoffset=6 xadvance=10 page=0 chnl=15 char id=958 x=108 y=113 width=7 height=14 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15 char id=959 x=99 y=459 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=960 x=502 y=420 width=9 height=8 xoffset=1 yoffset=6 xadvance=12 page=0 chnl=15 char id=961 x=72 y=387 width=8 height=11 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=962 x=282 y=380 width=7 height=11 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=963 x=273 y=444 width=9 height=8 xoffset=1 yoffset=6 xadvance=12 page=0 chnl=15 char id=964 x=420 y=440 width=8 height=8 xoffset=0 yoffset=6 xadvance=8 page=0 chnl=15 char id=965 x=321 y=442 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=966 x=396 y=330 width=10 height=11 xoffset=1 yoffset=6 xadvance=12 page=0 chnl=15 char id=967 x=120 y=361 width=9 height=11 xoffset=0 yoffset=6 xadvance=10 page=0 chnl=15 char id=968 x=81 y=387 width=8 height=11 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=969 x=156 y=439 width=12 height=8 xoffset=1 yoffset=6 xadvance=14 page=0 chnl=15 char id=970 x=400 y=378 width=5 height=11 xoffset=0 yoffset=3 xadvance=5 page=0 chnl=15 char id=971 x=90 y=387 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=972 x=431 y=231 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=973 x=467 y=231 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=974 x=117 y=211 width=12 height=12 xoffset=1 yoffset=2 xadvance=14 page=0 chnl=15 char id=975 x=411 y=17 width=12 height=15 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=976 x=99 y=171 width=10 height=13 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=15 char id=977 x=88 y=171 width=10 height=13 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=15 char id=978 x=312 y=207 width=12 height=12 xoffset=0 yoffset=2 xadvance=11 page=0 chnl=15 char id=979 x=318 y=180 width=16 height=12 xoffset=0 yoffset=2 xadvance=15 page=0 chnl=15 char id=980 x=136 y=67 width=12 height=14 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15 char id=981 x=444 y=0 width=11 height=16 xoffset=0 yoffset=2 xadvance=12 page=0 chnl=15 char id=982 x=265 y=394 width=13 height=10 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=983 x=264 y=153 width=11 height=13 xoffset=0 yoffset=5 xadvance=11 page=0 chnl=15 char id=984 x=405 y=0 width=12 height=16 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=985 x=121 y=170 width=10 height=13 xoffset=0 yoffset=5 xadvance=10 page=0 chnl=15 char id=986 x=24 y=37 width=11 height=15 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=987 x=357 y=165 width=9 height=13 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=15 char id=988 x=9 y=387 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=989 x=503 y=0 width=8 height=16 xoffset=-1 yoffset=2 xadvance=7 page=0 chnl=15 char id=990 x=198 y=346 width=10 height=11 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=991 x=27 y=253 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=992 x=378 y=0 width=13 height=16 xoffset=0 yoffset=2 xadvance=14 page=0 chnl=15 char id=993 x=229 y=233 width=9 height=12 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=15 char id=994 x=194 y=18 width=16 height=15 xoffset=0 yoffset=3 xadvance=16 page=0 chnl=15 char id=995 x=26 y=159 width=12 height=13 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=996 x=431 y=0 width=12 height=16 xoffset=0 yoffset=2 xadvance=12 page=0 chnl=15 char id=997 x=55 y=173 width=10 height=13 xoffset=0 yoffset=5 xadvance=11 page=0 chnl=15 char id=998 x=355 y=17 width=13 height=15 xoffset=1 yoffset=3 xadvance=14 page=0 chnl=15 char id=999 x=432 y=390 width=11 height=10 xoffset=0 yoffset=5 xadvance=11 page=0 chnl=15 char id=1000 x=480 y=0 width=11 height=16 xoffset=0 yoffset=2 xadvance=11 page=0 chnl=15 char id=1001 x=443 y=151 width=10 height=13 xoffset=0 yoffset=5 xadvance=10 page=0 chnl=15 char id=1002 x=320 y=220 width=11 height=12 xoffset=0 yoffset=2 xadvance=12 page=0 chnl=15 char id=1003 x=435 y=411 width=10 height=9 xoffset=0 yoffset=5 xadvance=10 page=0 chnl=15 char id=1004 x=180 y=154 width=11 height=13 xoffset=0 yoffset=2 xadvance=11 page=0 chnl=15 char id=1005 x=22 y=173 width=10 height=13 xoffset=1 yoffset=2 xadvance=11 page=0 chnl=15 char id=1006 x=295 y=33 width=10 height=15 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=1007 x=398 y=33 width=9 height=15 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=15 char id=1008 x=384 y=391 width=11 height=10 xoffset=0 yoffset=5 xadvance=11 page=0 chnl=15 char id=1009 x=176 y=168 width=10 height=13 xoffset=1 yoffset=5 xadvance=11 page=0 chnl=15 char id=1010 x=207 y=455 width=7 height=8 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=1011 x=293 y=109 width=4 height=14 xoffset=-1 yoffset=3 xadvance=4 page=0 chnl=15 char id=1012 x=424 y=305 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=1013 x=366 y=402 width=8 height=10 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=15 char id=1014 x=312 y=402 width=8 height=10 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=15 char id=1015 x=140 y=359 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1016 x=9 y=116 width=8 height=14 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=1017 x=150 y=359 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1018 x=308 y=271 width=13 height=11 xoffset=1 yoffset=3 xadvance=15 page=0 chnl=15 char id=1019 x=317 y=166 width=9 height=13 xoffset=1 yoffset=5 xadvance=11 page=0 chnl=15 char id=1020 x=408 y=151 width=11 height=13 xoffset=0 yoffset=5 xadvance=11 page=0 chnl=15 char id=1021 x=66 y=171 width=10 height=13 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=15 char id=1022 x=160 y=359 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1023 x=77 y=171 width=10 height=13 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=15 char id=1024 x=54 y=114 width=8 height=14 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=15 char id=1025 x=435 y=94 width=8 height=14 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=15 char id=1026 x=162 y=66 width=12 height=14 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=1027 x=399 y=94 width=8 height=14 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=15 char id=1028 x=170 y=359 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1029 x=200 y=358 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1030 x=493 y=377 width=2 height=11 xoffset=2 yoffset=3 xadvance=6 page=0 chnl=15 char id=1031 x=213 y=110 width=6 height=14 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 char id=1032 x=278 y=109 width=4 height=14 xoffset=0 yoffset=3 xadvance=6 page=0 chnl=15 char id=1033 x=247 y=259 width=17 height=11 xoffset=0 yoffset=3 xadvance=17 page=0 chnl=15 char id=1034 x=112 y=276 width=15 height=11 xoffset=1 yoffset=3 xadvance=17 page=0 chnl=15 char id=1035 x=104 y=313 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=1036 x=312 y=64 width=11 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=1037 x=297 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=1038 x=288 y=64 width=11 height=14 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=15 char id=1039 x=276 y=64 width=11 height=14 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=1040 x=432 y=317 width=11 height=11 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=1041 x=210 y=358 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1042 x=220 y=358 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1043 x=99 y=387 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=1044 x=447 y=137 width=12 height=13 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=1045 x=108 y=387 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=1046 x=228 y=260 width=18 height=11 xoffset=0 yoffset=3 xadvance=18 page=0 chnl=15 char id=1047 x=230 y=358 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1048 x=121 y=348 width=10 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=1049 x=44 y=99 width=10 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=1050 x=388 y=306 width=11 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=1051 x=364 y=306 width=11 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=1052 x=468 y=293 width=12 height=11 xoffset=1 yoffset=3 xadvance=14 page=0 chnl=15 char id=1053 x=11 y=351 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=1054 x=232 y=310 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=1055 x=77 y=351 width=10 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=1056 x=280 y=356 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1057 x=240 y=358 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1058 x=55 y=351 width=10 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=1059 x=220 y=310 width=11 height=11 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15 char id=1060 x=176 y=274 width=14 height=11 xoffset=1 yoffset=3 xadvance=15 page=0 chnl=15 char id=1061 x=12 y=339 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=1062 x=304 y=138 width=12 height=13 xoffset=1 yoffset=3 xadvance=14 page=0 chnl=15 char id=1063 x=165 y=347 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=1064 x=438 y=257 width=16 height=11 xoffset=1 yoffset=3 xadvance=19 page=0 chnl=15 char id=1065 x=394 y=109 width=18 height=13 xoffset=1 yoffset=3 xadvance=20 page=0 chnl=15 char id=1066 x=191 y=274 width=14 height=11 xoffset=0 yoffset=3 xadvance=14 page=0 chnl=15 char id=1067 x=350 y=271 width=13 height=11 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=15 char id=1068 x=250 y=358 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1069 x=11 y=173 width=10 height=13 xoffset=1 yoffset=2 xadvance=11 page=0 chnl=15 char id=1070 x=48 y=279 width=15 height=11 xoffset=1 yoffset=3 xadvance=18 page=0 chnl=15 char id=1071 x=143 y=347 width=10 height=11 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15 char id=1072 x=501 y=438 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=1073 x=341 y=232 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=1074 x=492 y=438 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=1075 x=302 y=453 width=6 height=8 xoffset=1 yoffset=6 xadvance=8 page=0 chnl=15 char id=1076 x=55 y=410 width=10 height=10 xoffset=1 yoffset=6 xadvance=12 page=0 chnl=15 char id=1077 x=474 y=438 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=1078 x=224 y=426 width=16 height=8 xoffset=-1 yoffset=6 xadvance=15 page=0 chnl=15 char id=1079 x=231 y=454 width=7 height=8 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=1080 x=456 y=439 width=8 height=8 xoffset=1 yoffset=6 xadvance=11 page=0 chnl=15 char id=1081 x=117 y=385 width=8 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1082 x=213 y=445 width=9 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=1083 x=203 y=446 width=9 height=8 xoffset=1 yoffset=6 xadvance=11 page=0 chnl=15 char id=1084 x=149 y=448 width=10 height=8 xoffset=1 yoffset=6 xadvance=12 page=0 chnl=15 char id=1085 x=402 y=441 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=1086 x=393 y=441 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=1087 x=375 y=441 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=1088 x=126 y=385 width=8 height=11 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=1089 x=191 y=455 width=7 height=8 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=1090 x=348 y=441 width=8 height=8 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=15 char id=1091 x=260 y=358 width=9 height=11 xoffset=0 yoffset=6 xadvance=10 page=0 chnl=15 char id=1092 x=401 y=49 width=14 height=14 xoffset=1 yoffset=3 xadvance=15 page=0 chnl=15 char id=1093 x=263 y=444 width=9 height=8 xoffset=1 yoffset=6 xadvance=11 page=0 chnl=15 char id=1094 x=232 y=405 width=9 height=10 xoffset=1 yoffset=6 xadvance=11 page=0 chnl=15 char id=1095 x=303 y=444 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=1096 x=289 y=426 width=14 height=8 xoffset=1 yoffset=6 xadvance=16 page=0 chnl=15 char id=1097 x=175 y=395 width=15 height=10 xoffset=1 yoffset=6 xadvance=17 page=0 chnl=15 char id=1098 x=344 y=413 width=11 height=9 xoffset=0 yoffset=5 xadvance=11 page=0 chnl=15 char id=1099 x=160 y=448 width=10 height=8 xoffset=1 yoffset=6 xadvance=14 page=0 chnl=15 char id=1100 x=90 y=459 width=8 height=8 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=1101 x=357 y=402 width=8 height=10 xoffset=1 yoffset=5 xadvance=9 page=0 chnl=15 char id=1102 x=102 y=450 width=11 height=8 xoffset=1 yoffset=6 xadvance=15 page=0 chnl=15 char id=1103 x=81 y=459 width=8 height=8 xoffset=0 yoffset=6 xadvance=10 page=0 chnl=15 char id=1104 x=18 y=253 width=8 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=1105 x=297 y=368 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=1106 x=22 y=20 width=10 height=16 xoffset=0 yoffset=2 xadvance=11 page=0 chnl=15 char id=1107 x=330 y=246 width=7 height=12 xoffset=1 yoffset=2 xadvance=8 page=0 chnl=15 char id=1108 x=223 y=454 width=7 height=8 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=1109 x=143 y=459 width=7 height=8 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=1110 x=487 y=377 width=2 height=11 xoffset=1 yoffset=3 xadvance=4 page=0 chnl=15 char id=1111 x=359 y=379 width=6 height=11 xoffset=-1 yoffset=3 xadvance=5 page=0 chnl=15 char id=1112 x=298 y=109 width=4 height=14 xoffset=-1 yoffset=3 xadvance=4 page=0 chnl=15 char id=1113 x=32 y=421 width=15 height=9 xoffset=0 yoffset=5 xadvance=15 page=0 chnl=15 char id=1114 x=105 y=421 width=13 height=9 xoffset=1 yoffset=5 xadvance=14 page=0 chnl=15 char id=1115 x=77 y=240 width=10 height=12 xoffset=0 yoffset=2 xadvance=11 page=0 chnl=15 char id=1116 x=239 y=233 width=9 height=12 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=1117 x=135 y=250 width=8 height=12 xoffset=1 yoffset=2 xadvance=11 page=0 chnl=15 char id=1118 x=361 y=94 width=9 height=14 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=1119 x=249 y=233 width=9 height=12 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=15 char id=1120 x=301 y=181 width=16 height=12 xoffset=0 yoffset=3 xadvance=16 page=0 chnl=15 char id=1121 x=91 y=441 width=12 height=8 xoffset=1 yoffset=6 xadvance=13 page=0 chnl=15 char id=1122 x=117 y=312 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=1123 x=36 y=339 width=11 height=11 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=1124 x=210 y=125 width=14 height=13 xoffset=1 yoffset=2 xadvance=15 page=0 chnl=15 char id=1125 x=420 y=390 width=11 height=10 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=1126 x=80 y=279 width=15 height=11 xoffset=0 yoffset=3 xadvance=15 page=0 chnl=15 char id=1127 x=91 y=421 width=13 height=9 xoffset=0 yoffset=5 xadvance=12 page=0 chnl=15 char id=1128 x=148 y=263 width=20 height=11 xoffset=1 yoffset=3 xadvance=20 page=0 chnl=15 char id=1129 x=451 y=400 width=16 height=9 xoffset=1 yoffset=5 xadvance=17 page=0 chnl=15 char id=1130 x=143 y=311 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=1131 x=391 y=413 width=10 height=9 xoffset=0 yoffset=5 xadvance=10 page=0 chnl=15 char id=1132 x=404 y=257 width=16 height=11 xoffset=1 yoffset=3 xadvance=19 page=0 chnl=15 char id=1133 x=48 y=421 width=14 height=9 xoffset=1 yoffset=5 xadvance=15 page=0 chnl=15 char id=1134 x=38 y=0 width=10 height=19 xoffset=0 yoffset=-1 xadvance=10 page=0 chnl=15 char id=1135 x=492 y=33 width=8 height=15 xoffset=0 yoffset=2 xadvance=8 page=0 chnl=15 char id=1136 x=336 y=259 width=16 height=11 xoffset=0 yoffset=3 xadvance=16 page=0 chnl=15 char id=1137 x=313 y=0 width=16 height=16 xoffset=0 yoffset=2 xadvance=16 page=0 chnl=15 char id=1138 x=24 y=339 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=1139 x=63 y=459 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=1140 x=183 y=197 width=13 height=12 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=1141 x=356 y=413 width=11 height=9 xoffset=0 yoffset=5 xadvance=10 page=0 chnl=15 char id=1142 x=383 y=17 width=13 height=15 xoffset=0 yoffset=-1 xadvance=13 page=0 chnl=15 char id=1143 x=404 y=218 width=11 height=12 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=15 char id=1144 x=278 y=0 width=17 height=16 xoffset=0 yoffset=2 xadvance=17 page=0 chnl=15 char id=1145 x=482 y=109 width=16 height=13 xoffset=0 yoffset=5 xadvance=16 page=0 chnl=15 char id=1146 x=431 y=109 width=16 height=13 xoffset=0 yoffset=2 xadvance=16 page=0 chnl=15 char id=1147 x=237 y=394 width=13 height=10 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=1148 x=155 y=18 width=21 height=15 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 char id=1149 x=264 y=49 width=17 height=14 xoffset=0 yoffset=1 xadvance=18 page=0 chnl=15 char id=1150 x=245 y=18 width=16 height=15 xoffset=0 yoffset=0 xadvance=16 page=0 chnl=15 char id=1151 x=195 y=223 width=12 height=12 xoffset=1 yoffset=2 xadvance=13 page=0 chnl=15 char id=1152 x=11 y=22 width=10 height=16 xoffset=0 yoffset=2 xadvance=11 page=0 chnl=15 char id=1153 x=443 y=165 width=8 height=13 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=15 char id=1154 x=154 y=429 width=8 height=9 xoffset=0 yoffset=6 xadvance=10 page=0 chnl=15 char id=1155 x=0 y=483 width=8 height=4 xoffset=-9 yoffset=1 xadvance=0 page=0 chnl=15 char id=1156 x=200 y=479 width=7 height=3 xoffset=-7 yoffset=2 xadvance=0 page=0 chnl=15 char id=1157 x=61 y=483 width=3 height=4 xoffset=-6 yoffset=2 xadvance=0 page=0 chnl=15 char id=1158 x=49 y=483 width=3 height=4 xoffset=-6 yoffset=2 xadvance=0 page=0 chnl=15 char id=1159 x=487 y=463 width=13 height=4 xoffset=-12 yoffset=2 xadvance=0 page=0 chnl=15 char id=1160 x=127 y=0 width=22 height=17 xoffset=-16 yoffset=0 xadvance=6 page=0 chnl=15 char id=1161 x=0 y=0 width=20 height=21 xoffset=-15 yoffset=-3 xadvance=6 page=0 chnl=15 char id=1162 x=64 y=0 width=13 height=18 xoffset=1 yoffset=0 xadvance=14 page=0 chnl=15 char id=1163 x=48 y=37 width=11 height=15 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=1164 x=408 y=317 width=11 height=11 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15 char id=1165 x=270 y=356 width=9 height=11 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=15 char id=1166 x=473 y=329 width=10 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1167 x=132 y=170 width=10 height=13 xoffset=1 yoffset=5 xadvance=11 page=0 chnl=15 char id=1168 x=18 y=187 width=8 height=13 xoffset=1 yoffset=1 xadvance=10 page=0 chnl=15 char id=1169 x=383 y=402 width=6 height=10 xoffset=1 yoffset=4 xadvance=8 page=0 chnl=15 char id=1170 x=451 y=329 width=10 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=1171 x=136 y=429 width=8 height=9 xoffset=0 yoffset=5 xadvance=8 page=0 chnl=15 char id=1172 x=198 y=80 width=10 height=14 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=1173 x=36 y=187 width=8 height=13 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=15 char id=1174 x=169 y=50 width=19 height=14 xoffset=0 yoffset=3 xadvance=18 page=0 chnl=15 char id=1175 x=384 y=179 width=15 height=12 xoffset=0 yoffset=5 xadvance=15 page=0 chnl=15 char id=1176 x=251 y=95 width=9 height=14 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1177 x=322 y=379 width=7 height=11 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=1178 x=84 y=83 width=11 height=14 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=1179 x=149 y=236 width=9 height=12 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=15 char id=1180 x=240 y=322 width=11 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=1181 x=70 y=431 width=9 height=9 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=15 char id=1182 x=156 y=311 width=12 height=11 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15 char id=1183 x=476 y=218 width=10 height=12 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=15 char id=1184 x=0 y=279 width=15 height=11 xoffset=0 yoffset=3 xadvance=15 page=0 chnl=15 char id=1185 x=133 y=419 width=13 height=9 xoffset=0 yoffset=5 xadvance=12 page=0 chnl=15 char id=1186 x=70 y=68 width=13 height=14 xoffset=1 yoffset=3 xadvance=14 page=0 chnl=15 char id=1187 x=416 y=218 width=11 height=12 xoffset=1 yoffset=5 xadvance=12 page=0 chnl=15 char id=1188 x=421 y=257 width=16 height=11 xoffset=1 yoffset=3 xadvance=17 page=0 chnl=15 char id=1189 x=201 y=417 width=12 height=9 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=1190 x=282 y=49 width=17 height=14 xoffset=1 yoffset=3 xadvance=19 page=0 chnl=15 char id=1191 x=225 y=125 width=14 height=13 xoffset=1 yoffset=5 xadvance=15 page=0 chnl=15 char id=1192 x=195 y=125 width=14 height=13 xoffset=0 yoffset=2 xadvance=14 page=0 chnl=15 char id=1193 x=279 y=392 width=13 height=10 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=1194 x=341 y=94 width=9 height=14 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1195 x=258 y=382 width=7 height=11 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=15 char id=1196 x=396 y=64 width=11 height=14 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=1197 x=209 y=234 width=9 height=12 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=15 char id=1198 x=341 y=331 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=1199 x=0 y=173 width=10 height=13 xoffset=0 yoffset=5 xadvance=10 page=0 chnl=15 char id=1200 x=0 y=291 width=12 height=11 xoffset=-1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1201 x=476 y=151 width=10 height=13 xoffset=0 yoffset=5 xadvance=10 page=0 chnl=15 char id=1202 x=84 y=68 width=12 height=14 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15 char id=1203 x=44 y=240 width=10 height=12 xoffset=0 yoffset=5 xadvance=10 page=0 chnl=15 char id=1204 x=300 y=49 width=17 height=14 xoffset=0 yoffset=3 xadvance=17 page=0 chnl=15 char id=1205 x=400 y=179 width=15 height=12 xoffset=0 yoffset=5 xadvance=15 page=0 chnl=15 char id=1206 x=430 y=49 width=13 height=14 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=1207 x=440 y=218 width=11 height=12 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=15 char id=1208 x=198 y=334 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=1209 x=109 y=431 width=8 height=9 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=15 char id=1210 x=187 y=335 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=1211 x=405 y=366 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=1212 x=133 y=128 width=15 height=13 xoffset=0 yoffset=2 xadvance=15 page=0 chnl=15 char id=1213 x=306 y=391 width=12 height=10 xoffset=0 yoffset=5 xadvance=12 page=0 chnl=15 char id=1214 x=295 y=17 width=15 height=15 xoffset=0 yoffset=2 xadvance=15 page=0 chnl=15 char id=1215 x=65 y=227 width=12 height=12 xoffset=0 yoffset=5 xadvance=12 page=0 chnl=15 char id=1216 x=496 y=377 width=2 height=11 xoffset=2 yoffset=3 xadvance=6 page=0 chnl=15 char id=1217 x=189 y=50 width=18 height=14 xoffset=0 yoffset=0 xadvance=18 page=0 chnl=15 char id=1218 x=472 y=257 width=16 height=11 xoffset=-1 yoffset=3 xadvance=15 page=0 chnl=15 char id=1219 x=360 y=64 width=11 height=14 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=1220 x=257 y=167 width=9 height=13 xoffset=1 yoffset=5 xadvance=9 page=0 chnl=15 char id=1221 x=326 y=17 width=14 height=15 xoffset=0 yoffset=3 xadvance=14 page=0 chnl=15 char id=1222 x=421 y=137 width=12 height=13 xoffset=0 yoffset=5 xadvance=12 page=0 chnl=15 char id=1223 x=300 y=64 width=11 height=14 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=1224 x=367 y=165 width=9 height=13 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=15 char id=1225 x=341 y=17 width=13 height=15 xoffset=1 yoffset=3 xadvance=14 page=0 chnl=15 char id=1226 x=252 y=153 width=11 height=13 xoffset=1 yoffset=5 xadvance=12 page=0 chnl=15 char id=1227 x=143 y=82 width=10 height=14 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=1228 x=440 y=231 width=8 height=12 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=15 char id=1229 x=177 y=18 width=16 height=15 xoffset=1 yoffset=3 xadvance=17 page=0 chnl=15 char id=1230 x=366 y=123 width=13 height=13 xoffset=1 yoffset=5 xadvance=14 page=0 chnl=15 char id=1231 x=499 y=377 width=2 height=11 xoffset=1 yoffset=3 xadvance=4 page=0 chnl=15 char id=1232 x=204 y=153 width=11 height=13 xoffset=0 yoffset=1 xadvance=11 page=0 chnl=15 char id=1233 x=306 y=367 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=1234 x=348 y=64 width=11 height=14 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15 char id=1235 x=261 y=370 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=1236 x=32 y=279 width=15 height=11 xoffset=0 yoffset=3 xadvance=16 page=0 chnl=15 char id=1237 x=241 y=426 width=15 height=8 xoffset=1 yoffset=6 xadvance=17 page=0 chnl=15 char id=1238 x=81 y=113 width=8 height=14 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=15 char id=1239 x=252 y=370 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=1240 x=412 y=305 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=1241 x=45 y=459 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=1242 x=384 y=64 width=11 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=1243 x=216 y=370 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=1244 x=227 y=50 width=18 height=14 xoffset=0 yoffset=0 xadvance=18 page=0 chnl=15 char id=1245 x=455 y=257 width=16 height=11 xoffset=-1 yoffset=3 xadvance=15 page=0 chnl=15 char id=1246 x=171 y=96 width=9 height=14 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 char id=1247 x=274 y=380 width=7 height=11 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15 char id=1248 x=66 y=240 width=10 height=12 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=1249 x=307 y=166 width=9 height=13 xoffset=0 yoffset=5 xadvance=10 page=0 chnl=15 char id=1250 x=432 y=151 width=10 height=13 xoffset=1 yoffset=1 xadvance=13 page=0 chnl=15 char id=1251 x=189 y=371 width=8 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1252 x=319 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=1253 x=180 y=371 width=8 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1254 x=12 y=86 width=11 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=1255 x=171 y=371 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=1256 x=480 y=317 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=1257 x=36 y=459 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=1258 x=72 y=83 width=11 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=1259 x=108 y=375 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=1260 x=317 y=33 width=10 height=15 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 char id=1261 x=288 y=246 width=8 height=12 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15 char id=1262 x=156 y=156 width=11 height=13 xoffset=0 yoffset=1 xadvance=12 page=0 chnl=15 char id=1263 x=331 y=94 width=9 height=14 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=1264 x=372 y=64 width=11 height=14 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=15 char id=1265 x=131 y=98 width=9 height=14 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=1266 x=408 y=64 width=11 height=14 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=15 char id=1267 x=418 y=33 width=9 height=15 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=15 char id=1268 x=429 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=1269 x=499 y=353 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=1270 x=191 y=95 width=9 height=14 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=1271 x=410 y=244 width=7 height=12 xoffset=1 yoffset=5 xadvance=8 page=0 chnl=15 char id=1272 x=444 y=49 width=13 height=14 xoffset=1 yoffset=0 xadvance=16 page=0 chnl=15 char id=1273 x=407 y=330 width=10 height=11 xoffset=1 yoffset=3 xadvance=14 page=0 chnl=15 char id=1274 x=240 y=34 width=10 height=15 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=1275 x=45 y=187 width=8 height=13 xoffset=0 yoffset=5 xadvance=8 page=0 chnl=15 char id=1276 x=188 y=65 width=12 height=14 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15 char id=1277 x=487 y=151 width=10 height=13 xoffset=0 yoffset=5 xadvance=10 page=0 chnl=15 char id=1278 x=52 y=315 width=12 height=11 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15 char id=1279 x=402 y=412 width=10 height=9 xoffset=0 yoffset=5 xadvance=10 page=0 chnl=15 char id=1280 x=220 y=346 width=10 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1281 x=163 y=428 width=8 height=9 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=15 char id=1282 x=335 y=179 width=16 height=12 xoffset=1 yoffset=3 xadvance=17 page=0 chnl=15 char id=1283 x=251 y=394 width=13 height=10 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=1284 x=101 y=128 width=15 height=13 xoffset=1 yoffset=2 xadvance=17 page=0 chnl=15 char id=1285 x=319 y=391 width=12 height=10 xoffset=1 yoffset=5 xadvance=14 page=0 chnl=15 char id=1286 x=392 y=0 width=12 height=16 xoffset=1 yoffset=2 xadvance=12 page=0 chnl=15 char id=1287 x=277 y=167 width=9 height=13 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=15 char id=1288 x=228 y=181 width=18 height=12 xoffset=0 yoffset=3 xadvance=19 page=0 chnl=15 char id=1289 x=222 y=394 width=14 height=10 xoffset=0 yoffset=5 xadvance=15 page=0 chnl=15 char id=1290 x=265 y=181 width=17 height=12 xoffset=1 yoffset=3 xadvance=19 page=0 chnl=15 char id=1291 x=207 y=394 width=14 height=10 xoffset=1 yoffset=5 xadvance=15 page=0 chnl=15 char id=1292 x=343 y=137 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=1293 x=272 y=405 width=9 height=10 xoffset=0 yoffset=5 xadvance=10 page=0 chnl=15 char id=1294 x=43 y=201 width=13 height=12 xoffset=0 yoffset=3 xadvance=14 page=0 chnl=15 char id=1295 x=408 y=390 width=11 height=10 xoffset=0 yoffset=5 xadvance=12 page=0 chnl=15 char id=1296 x=63 y=375 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=1297 x=253 y=453 width=6 height=8 xoffset=1 yoffset=6 xadvance=8 page=0 chnl=15 char id=1298 x=227 y=65 width=12 height=14 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15 char id=1299 x=33 y=173 width=10 height=13 xoffset=0 yoffset=5 xadvance=11 page=0 chnl=15 char id=1300 x=189 y=262 width=19 height=11 xoffset=0 yoffset=3 xadvance=19 page=0 chnl=15 char id=1301 x=434 y=401 width=16 height=9 xoffset=0 yoffset=5 xadvance=16 page=0 chnl=15 char id=1302 x=144 y=275 width=15 height=11 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=15 char id=1303 x=165 y=126 width=14 height=13 xoffset=1 yoffset=5 xadvance=15 page=0 chnl=15 char id=1304 x=160 y=275 width=15 height=11 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=15 char id=1305 x=127 y=397 width=15 height=10 xoffset=0 yoffset=5 xadvance=15 page=0 chnl=15 char id=1306 x=384 y=151 width=11 height=13 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=1307 x=225 y=370 width=8 height=11 xoffset=1 yoffset=6 xadvance=11 page=0 chnl=15 char id=1308 x=370 y=257 width=16 height=11 xoffset=1 yoffset=3 xadvance=17 page=0 chnl=15 char id=1309 x=182 y=437 width=12 height=8 xoffset=1 yoffset=6 xadvance=14 page=0 chnl=15 char id=1312 x=208 y=50 width=18 height=14 xoffset=0 yoffset=3 xadvance=19 page=0 chnl=15 char id=1313 x=85 y=128 width=15 height=13 xoffset=0 yoffset=5 xadvance=16 page=0 chnl=15 char id=1314 x=246 y=50 width=17 height=14 xoffset=1 yoffset=3 xadvance=19 page=0 chnl=15 char id=1315 x=180 y=126 width=14 height=13 xoffset=1 yoffset=5 xadvance=15 page=0 chnl=15 char id=1316 x=416 y=49 width=13 height=14 xoffset=1 yoffset=3 xadvance=14 page=0 chnl=15 char id=1317 x=452 y=218 width=11 height=12 xoffset=1 yoffset=5 xadvance=12 page=0 chnl=15 char id=1542 x=163 y=34 width=10 height=15 xoffset=0 yoffset=0 xadvance=10 page=0 chnl=15 char id=1543 x=218 y=34 width=10 height=15 xoffset=0 yoffset=0 xadvance=10 page=0 chnl=15 char id=1545 x=358 y=391 width=12 height=10 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 char id=1546 x=78 y=399 width=16 height=10 xoffset=1 yoffset=4 xadvance=17 page=0 chnl=15 char id=1548 x=439 y=463 width=4 height=5 xoffset=1 yoffset=9 xadvance=6 page=0 chnl=15 char id=1557 x=22 y=483 width=5 height=4 xoffset=1 yoffset=1 xadvance=0 page=0 chnl=15 char id=1563 x=507 y=281 width=4 height=11 xoffset=1 yoffset=3 xadvance=6 page=0 chnl=15 char id=1567 x=418 y=244 width=7 height=12 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=15 char id=1569 x=215 y=454 width=7 height=8 xoffset=0 yoffset=6 xadvance=8 page=0 chnl=15 char id=1570 x=124 y=113 width=7 height=14 xoffset=-1 yoffset=0 xadvance=5 page=0 chnl=15 char id=1571 x=138 y=51 width=4 height=15 xoffset=1 yoffset=-1 xadvance=5 page=0 chnl=15 char id=1572 x=498 y=151 width=10 height=13 xoffset=-1 yoffset=5 xadvance=9 page=0 chnl=15 char id=1573 x=134 y=18 width=4 height=16 xoffset=1 yoffset=2 xadvance=5 page=0 chnl=15 char id=1574 x=266 y=271 width=13 height=11 xoffset=0 yoffset=5 xadvance=14 page=0 chnl=15 char id=1575 x=99 y=264 width=3 height=12 xoffset=1 yoffset=2 xadvance=5 page=0 chnl=15 char id=1576 x=347 y=450 width=15 height=7 xoffset=0 yoffset=9 xadvance=15 page=0 chnl=15 char id=1577 x=302 y=403 width=9 height=10 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=15 char id=1578 x=257 y=426 width=15 height=8 xoffset=0 yoffset=7 xadvance=15 page=0 chnl=15 char id=1579 x=468 y=400 width=15 height=9 xoffset=0 yoffset=6 xadvance=15 page=0 chnl=15 char id=1580 x=440 y=329 width=10 height=11 xoffset=1 yoffset=7 xadvance=11 page=0 chnl=15 char id=1581 x=462 y=329 width=10 height=11 xoffset=1 yoffset=7 xadvance=11 page=0 chnl=15 char id=1582 x=352 y=79 width=10 height=14 xoffset=1 yoffset=4 xadvance=11 page=0 chnl=15 char id=1583 x=54 y=459 width=8 height=8 xoffset=0 yoffset=7 xadvance=8 page=0 chnl=15 char id=1584 x=171 y=383 width=8 height=11 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=15 char id=1585 x=193 y=446 width=9 height=8 xoffset=-1 yoffset=10 xadvance=9 page=0 chnl=15 char id=1586 x=259 y=233 width=9 height=12 xoffset=-1 yoffset=6 xadvance=9 page=0 chnl=15 char id=1587 x=20 y=399 width=19 height=10 xoffset=1 yoffset=8 xadvance=21 page=0 chnl=15 char id=1588 x=355 y=109 width=19 height=13 xoffset=1 yoffset=5 xadvance=21 page=0 chnl=15 char id=1589 x=40 y=399 width=18 height=10 xoffset=1 yoffset=8 xadvance=20 page=0 chnl=15 char id=1590 x=190 y=182 width=18 height=12 xoffset=1 yoffset=6 xadvance=20 page=0 chnl=15 char id=1591 x=476 y=179 width=14 height=12 xoffset=1 yoffset=2 xadvance=16 page=0 chnl=15 char id=1592 x=416 y=179 width=14 height=12 xoffset=1 yoffset=2 xadvance=16 page=0 chnl=15 char id=1593 x=55 y=240 width=10 height=12 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=1594 x=229 y=34 width=10 height=15 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=1600 x=360 y=472 width=7 height=2 xoffset=-1 yoffset=12 xadvance=5 page=0 chnl=15 char id=1601 x=489 y=257 width=16 height=11 xoffset=1 yoffset=4 xadvance=17 page=0 chnl=15 char id=1602 x=42 y=69 width=13 height=14 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=1603 x=13 y=159 width=12 height=13 xoffset=1 yoffset=2 xadvance=14 page=0 chnl=15 char id=1604 x=484 y=17 width=11 height=15 xoffset=1 yoffset=2 xadvance=13 page=0 chnl=15 char id=1605 x=502 y=377 width=9 height=10 xoffset=1 yoffset=8 xadvance=11 page=0 chnl=15 char id=1606 x=130 y=311 width=12 height=11 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=1607 x=214 y=464 width=9 height=7 xoffset=0 yoffset=8 xadvance=9 page=0 chnl=15 char id=1608 x=446 y=411 width=10 height=9 xoffset=-1 yoffset=9 xadvance=9 page=0 chnl=15 char id=1609 x=161 y=418 width=13 height=9 xoffset=0 yoffset=7 xadvance=14 page=0 chnl=15 char id=1610 x=490 y=269 width=13 height=11 xoffset=0 yoffset=7 xadvance=14 page=0 chnl=15 char id=1611 x=399 y=465 width=5 height=5 xoffset=1 yoffset=1 xadvance=0 page=0 chnl=15 char id=1612 x=207 y=472 width=5 height=6 xoffset=1 yoffset=0 xadvance=0 page=0 chnl=15 char id=1613 x=16 y=483 width=5 height=4 xoffset=1 yoffset=14 xadvance=0 page=0 chnl=15 char id=1614 x=243 y=477 width=5 height=3 xoffset=1 yoffset=3 xadvance=0 page=0 chnl=15 char id=1615 x=213 y=472 width=5 height=6 xoffset=1 yoffset=0 xadvance=0 page=0 chnl=15 char id=1616 x=387 y=472 width=5 height=2 xoffset=1 yoffset=14 xadvance=0 page=0 chnl=15 char id=1617 x=9 y=483 width=6 height=4 xoffset=1 yoffset=1 xadvance=0 page=0 chnl=15 char id=1618 x=405 y=465 width=5 height=5 xoffset=1 yoffset=0 xadvance=0 page=0 chnl=15 char id=1619 x=192 y=480 width=7 height=3 xoffset=0 yoffset=3 xadvance=0 page=0 chnl=15 char id=1620 x=34 y=483 width=4 height=4 xoffset=2 yoffset=2 xadvance=0 page=0 chnl=15 char id=1621 x=39 y=483 width=4 height=4 xoffset=2 yoffset=14 xadvance=0 page=0 chnl=15 char id=1623 x=423 y=465 width=5 height=5 xoffset=1 yoffset=0 xadvance=0 page=0 chnl=15 char id=1626 x=237 y=477 width=5 height=3 xoffset=1 yoffset=2 xadvance=8 page=0 chnl=15 char id=1632 x=57 y=483 width=3 height=4 xoffset=3 yoffset=8 xadvance=9 page=0 chnl=15 char id=1633 x=397 y=401 width=5 height=10 xoffset=2 yoffset=4 xadvance=9 page=0 chnl=15 char id=1634 x=212 y=405 width=9 height=10 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 char id=1635 x=202 y=406 width=9 height=10 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 char id=1636 x=306 y=379 width=7 height=11 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=15 char id=1637 x=495 y=365 width=8 height=11 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=15 char id=1638 x=282 y=403 width=9 height=10 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 char id=1639 x=242 y=405 width=9 height=10 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 char id=1640 x=252 y=405 width=9 height=10 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 char id=1641 x=132 y=408 width=9 height=10 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 char id=1642 x=330 y=402 width=8 height=10 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=15 char id=1643 x=318 y=460 width=6 height=7 xoffset=0 yoffset=9 xadvance=6 page=0 chnl=15 char id=1644 x=444 y=463 width=4 height=5 xoffset=1 yoffset=3 xadvance=6 page=0 chnl=15 char id=1645 x=72 y=459 width=8 height=8 xoffset=0 yoffset=5 xadvance=8 page=0 chnl=15 char id=1646 x=407 y=458 width=15 height=6 xoffset=0 yoffset=9 xadvance=15 page=0 chnl=15 char id=1647 x=113 y=198 width=13 height=12 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=1648 x=509 y=447 width=2 height=5 xoffset=3 yoffset=0 xadvance=0 page=0 chnl=15 char id=1652 x=44 y=483 width=4 height=4 xoffset=0 yoffset=1 xadvance=4 page=0 chnl=15 char id=1657 x=159 y=395 width=15 height=10 xoffset=0 yoffset=5 xadvance=15 page=0 chnl=15 char id=1658 x=143 y=396 width=15 height=10 xoffset=0 yoffset=5 xadvance=15 page=0 chnl=15 char id=1659 x=0 y=421 width=15 height=9 xoffset=0 yoffset=9 xadvance=15 page=0 chnl=15 char id=1660 x=111 y=399 width=15 height=10 xoffset=0 yoffset=7 xadvance=15 page=0 chnl=15 char id=1661 x=95 y=399 width=15 height=10 xoffset=0 yoffset=5 xadvance=15 page=0 chnl=15 char id=1662 x=484 y=400 width=15 height=9 xoffset=0 yoffset=9 xadvance=15 page=0 chnl=15 char id=1663 x=191 y=395 width=15 height=10 xoffset=0 yoffset=5 xadvance=15 page=0 chnl=15 char id=1664 x=16 y=421 width=15 height=9 xoffset=0 yoffset=9 xadvance=15 page=0 chnl=15 char id=1665 x=108 y=36 width=10 height=15 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1666 x=0 y=22 width=10 height=16 xoffset=1 yoffset=2 xadvance=11 page=0 chnl=15 char id=1667 x=88 y=351 width=10 height=11 xoffset=1 yoffset=7 xadvance=11 page=0 chnl=15 char id=1668 x=99 y=351 width=10 height=11 xoffset=1 yoffset=7 xadvance=11 page=0 chnl=15 char id=1669 x=152 y=35 width=10 height=15 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=1670 x=132 y=347 width=10 height=11 xoffset=1 yoffset=7 xadvance=11 page=0 chnl=15 char id=1671 x=44 y=351 width=10 height=11 xoffset=1 yoffset=7 xadvance=11 page=0 chnl=15 char id=1672 x=9 y=253 width=8 height=12 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=15 char id=1673 x=339 y=402 width=8 height=10 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=15 char id=1674 x=348 y=402 width=8 height=10 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=15 char id=1675 x=417 y=94 width=8 height=14 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=15 char id=1676 x=243 y=370 width=8 height=11 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=15 char id=1677 x=127 y=431 width=8 height=9 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=15 char id=1678 x=503 y=231 width=8 height=12 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=15 char id=1679 x=494 y=231 width=8 height=12 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=15 char id=1680 x=497 y=165 width=8 height=13 xoffset=0 yoffset=2 xadvance=7 page=0 chnl=15 char id=1681 x=371 y=94 width=9 height=14 xoffset=-1 yoffset=4 xadvance=9 page=0 chnl=15 char id=1682 x=247 y=167 width=9 height=13 xoffset=-1 yoffset=5 xadvance=9 page=0 chnl=15 char id=1683 x=114 y=450 width=11 height=8 xoffset=-1 yoffset=10 xadvance=9 page=0 chnl=15 char id=1684 x=182 y=446 width=10 height=8 xoffset=-1 yoffset=10 xadvance=9 page=0 chnl=15 char id=1685 x=476 y=420 width=12 height=8 xoffset=-1 yoffset=10 xadvance=10 page=0 chnl=15 char id=1686 x=138 y=450 width=10 height=8 xoffset=-1 yoffset=10 xadvance=9 page=0 chnl=15 char id=1687 x=219 y=234 width=9 height=12 xoffset=-1 yoffset=6 xadvance=9 page=0 chnl=15 char id=1688 x=217 y=167 width=9 height=13 xoffset=-1 yoffset=5 xadvance=9 page=0 chnl=15 char id=1689 x=271 y=94 width=9 height=14 xoffset=-1 yoffset=4 xadvance=9 page=0 chnl=15 char id=1690 x=170 y=184 width=19 height=12 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=15 char id=1691 x=0 y=399 width=19 height=10 xoffset=1 yoffset=8 xadvance=21 page=0 chnl=15 char id=1692 x=335 y=109 width=19 height=13 xoffset=1 yoffset=5 xadvance=21 page=0 chnl=15 char id=1693 x=59 y=399 width=18 height=10 xoffset=1 yoffset=8 xadvance=20 page=0 chnl=15 char id=1694 x=375 y=109 width=18 height=13 xoffset=1 yoffset=5 xadvance=20 page=0 chnl=15 char id=1695 x=491 y=179 width=14 height=12 xoffset=1 yoffset=2 xadvance=16 page=0 chnl=15 char id=1696 x=492 y=0 width=10 height=16 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=1697 x=417 y=401 width=16 height=9 xoffset=1 yoffset=6 xadvance=17 page=0 chnl=15 char id=1698 x=353 y=258 width=16 height=11 xoffset=1 yoffset=6 xadvance=17 page=0 chnl=15 char id=1699 x=0 y=131 width=16 height=13 xoffset=1 yoffset=4 xadvance=17 page=0 chnl=15 char id=1700 x=17 y=131 width=16 height=13 xoffset=1 yoffset=2 xadvance=17 page=0 chnl=15 char id=1701 x=34 y=131 width=16 height=13 xoffset=1 yoffset=5 xadvance=17 page=0 chnl=15 char id=1702 x=335 y=49 width=16 height=14 xoffset=1 yoffset=1 xadvance=17 page=0 chnl=15 char id=1703 x=0 y=71 width=13 height=14 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=1704 x=397 y=17 width=13 height=15 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=1705 x=51 y=129 width=16 height=13 xoffset=0 yoffset=2 xadvance=15 page=0 chnl=15 char id=1706 x=413 y=109 width=17 height=13 xoffset=1 yoffset=2 xadvance=19 page=0 chnl=15 char id=1707 x=68 y=129 width=16 height=13 xoffset=0 yoffset=2 xadvance=15 page=0 chnl=15 char id=1708 x=460 y=137 width=12 height=13 xoffset=1 yoffset=2 xadvance=14 page=0 chnl=15 char id=1709 x=123 y=68 width=12 height=14 xoffset=1 yoffset=1 xadvance=14 page=0 chnl=15 char id=1710 x=181 y=0 width=12 height=17 xoffset=1 yoffset=1 xadvance=14 page=0 chnl=15 char id=1711 x=228 y=18 width=16 height=15 xoffset=0 yoffset=0 xadvance=15 page=0 chnl=15 char id=1712 x=211 y=18 width=16 height=15 xoffset=0 yoffset=0 xadvance=15 page=0 chnl=15 char id=1713 x=262 y=17 width=16 height=15 xoffset=0 yoffset=0 xadvance=15 page=0 chnl=15 char id=1714 x=150 y=0 width=16 height=17 xoffset=0 yoffset=0 xadvance=15 page=0 chnl=15 char id=1715 x=21 y=0 width=16 height=19 xoffset=0 yoffset=-1 xadvance=15 page=0 chnl=15 char id=1716 x=296 y=0 width=16 height=16 xoffset=0 yoffset=-1 xadvance=15 page=0 chnl=15 char id=1717 x=78 y=0 width=12 height=18 xoffset=1 yoffset=-1 xadvance=13 page=0 chnl=15 char id=1718 x=103 y=0 width=11 height=18 xoffset=1 yoffset=-1 xadvance=13 page=0 chnl=15 char id=1719 x=91 y=0 width=11 height=18 xoffset=1 yoffset=-1 xadvance=13 page=0 chnl=15 char id=1720 x=115 y=0 width=11 height=18 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=1721 x=473 y=137 width=12 height=13 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=1722 x=227 y=416 width=12 height=9 xoffset=0 yoffset=8 xadvance=13 page=0 chnl=15 char id=1723 x=382 y=137 width=12 height=13 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=1724 x=408 y=137 width=12 height=13 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=1725 x=91 y=225 width=12 height=12 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=1726 x=119 y=421 width=13 height=9 xoffset=1 yoffset=6 xadvance=14 page=0 chnl=15 char id=1727 x=209 y=80 width=10 height=14 xoffset=1 yoffset=4 xadvance=11 page=0 chnl=15 char id=1734 x=165 y=170 width=10 height=13 xoffset=-1 yoffset=5 xadvance=9 page=0 chnl=15 char id=1740 x=147 y=419 width=13 height=9 xoffset=0 yoffset=7 xadvance=14 page=0 chnl=15 char id=1742 x=406 y=269 width=13 height=11 xoffset=0 yoffset=5 xadvance=14 page=0 chnl=15 char id=1749 x=204 y=464 width=9 height=7 xoffset=0 yoffset=8 xadvance=9 page=0 chnl=15 char id=1776 x=53 y=483 width=3 height=4 xoffset=3 yoffset=8 xadvance=9 page=0 chnl=15 char id=1777 x=403 y=401 width=5 height=10 xoffset=2 yoffset=4 xadvance=9 page=0 chnl=15 char id=1778 x=222 y=405 width=9 height=10 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 char id=1779 x=192 y=406 width=9 height=10 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 char id=1780 x=182 y=406 width=9 height=10 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 char id=1781 x=290 y=356 width=9 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 char id=1782 x=375 y=402 width=7 height=10 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=15 char id=1783 x=172 y=406 width=9 height=10 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 char id=1784 x=162 y=406 width=9 height=10 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 char id=1785 x=142 y=408 width=9 height=10 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 char id=8192 x=165 y=140 width=1 height=1 xoffset=0 yoffset=14 xadvance=8 page=0 chnl=15 char id=8193 x=174 y=168 width=1 height=1 xoffset=0 yoffset=14 xadvance=15 page=0 chnl=15 char id=8194 x=53 y=143 width=1 height=1 xoffset=0 yoffset=14 xadvance=8 page=0 chnl=15 char id=8195 x=510 y=47 width=1 height=1 xoffset=0 yoffset=14 xadvance=15 page=0 chnl=15 char id=8196 x=510 y=43 width=1 height=1 xoffset=0 yoffset=14 xadvance=5 page=0 chnl=15 char id=8197 x=510 y=41 width=1 height=1 xoffset=0 yoffset=14 xadvance=4 page=0 chnl=15 char id=8198 x=88 y=251 width=1 height=1 xoffset=0 yoffset=14 xadvance=3 page=0 chnl=15 char id=8199 x=510 y=37 width=1 height=1 xoffset=0 yoffset=14 xadvance=10 page=0 chnl=15 char id=8200 x=24 y=53 width=1 height=1 xoffset=0 yoffset=14 xadvance=6 page=0 chnl=15 char id=8201 x=22 y=37 width=1 height=1 xoffset=0 yoffset=14 xadvance=3 page=0 chnl=15 char id=8202 x=510 y=33 width=1 height=1 xoffset=0 yoffset=14 xadvance=2 page=0 chnl=15 char id=8203 x=203 y=208 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8204 x=199 y=208 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8205 x=73 y=212 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8206 x=71 y=212 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8207 x=192 y=195 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8208 x=405 y=471 width=5 height=2 xoffset=1 yoffset=8 xadvance=6 page=0 chnl=15 char id=8209 x=381 y=472 width=5 height=2 xoffset=1 yoffset=8 xadvance=6 page=0 chnl=15 char id=8210 x=350 y=473 width=9 height=2 xoffset=1 yoffset=8 xadvance=10 page=0 chnl=15 char id=8211 x=368 y=472 width=6 height=2 xoffset=1 yoffset=8 xadvance=8 page=0 chnl=15 char id=8212 x=310 y=476 width=13 height=2 xoffset=1 yoffset=8 xadvance=15 page=0 chnl=15 char id=8213 x=294 y=476 width=15 height=2 xoffset=0 yoffset=8 xadvance=15 page=0 chnl=15 char id=8214 x=133 y=51 width=4 height=15 xoffset=2 yoffset=3 xadvance=8 page=0 chnl=15 char id=8215 x=166 y=481 width=8 height=3 xoffset=0 yoffset=15 xadvance=8 page=0 chnl=15 char id=8216 x=467 y=463 width=3 height=5 xoffset=2 yoffset=3 xadvance=6 page=0 chnl=15 char id=8217 x=429 y=465 width=4 height=5 xoffset=1 yoffset=3 xadvance=6 page=0 chnl=15 char id=8218 x=434 y=465 width=4 height=5 xoffset=1 yoffset=11 xadvance=6 page=0 chnl=15 char id=8219 x=393 y=465 width=5 height=5 xoffset=0 yoffset=3 xadvance=6 page=0 chnl=15 char id=8220 x=386 y=466 width=6 height=5 xoffset=2 yoffset=3 xadvance=10 page=0 chnl=15 char id=8221 x=378 y=466 width=7 height=5 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=8222 x=360 y=466 width=8 height=5 xoffset=1 yoffset=11 xadvance=10 page=0 chnl=15 char id=8223 x=351 y=467 width=8 height=5 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=8224 x=49 y=266 width=6 height=12 xoffset=1 yoffset=3 xadvance=8 page=0 chnl=15 char id=8225 x=56 y=266 width=6 height=12 xoffset=1 yoffset=3 xadvance=8 page=0 chnl=15 char id=8226 x=417 y=465 width=5 height=5 xoffset=2 yoffset=6 xadvance=10 page=0 chnl=15 char id=8227 x=332 y=459 width=6 height=7 xoffset=2 yoffset=5 xadvance=10 page=0 chnl=15 char id=8228 x=274 y=476 width=3 height=3 xoffset=1 yoffset=11 xadvance=5 page=0 chnl=15 char id=8229 x=175 y=481 width=8 height=3 xoffset=1 yoffset=11 xadvance=10 page=0 chnl=15 char id=8230 x=133 y=483 width=10 height=3 xoffset=1 yoffset=11 xadvance=15 page=0 chnl=15 char id=8231 x=282 y=476 width=2 height=3 xoffset=1 yoffset=7 xadvance=5 page=0 chnl=15 char id=8232 x=75 y=212 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8233 x=197 y=208 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8234 x=201 y=208 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8235 x=205 y=208 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8236 x=78 y=238 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8237 x=80 y=238 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8238 x=84 y=238 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8239 x=86 y=238 width=1 height=1 xoffset=0 yoffset=14 xadvance=3 page=0 chnl=15 char id=8240 x=126 y=263 width=21 height=11 xoffset=1 yoffset=3 xadvance=22 page=0 chnl=15 char id=8241 x=306 y=109 width=28 height=13 xoffset=0 yoffset=2 xadvance=28 page=0 chnl=15 char id=8242 x=249 y=477 width=4 height=3 xoffset=0 yoffset=3 xadvance=4 page=0 chnl=15 char id=8243 x=184 y=480 width=7 height=3 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=15 char id=8244 x=144 y=483 width=10 height=3 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=15 char id=8245 x=254 y=477 width=4 height=3 xoffset=0 yoffset=3 xadvance=4 page=0 chnl=15 char id=8246 x=208 y=479 width=7 height=3 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=15 char id=8247 x=155 y=483 width=10 height=3 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=15 char id=8248 x=321 y=468 width=9 height=5 xoffset=1 yoffset=13 xadvance=11 page=0 chnl=15 char id=8249 x=381 y=458 width=4 height=7 xoffset=1 yoffset=6 xadvance=6 page=0 chnl=15 char id=8250 x=386 y=458 width=4 height=7 xoffset=1 yoffset=6 xadvance=6 page=0 chnl=15 char id=8251 x=288 y=153 width=11 height=13 xoffset=1 yoffset=1 xadvance=15 page=0 chnl=15 char id=8252 x=504 y=365 width=7 height=11 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15 char id=8253 x=402 y=244 width=7 height=12 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=15 char id=8254 x=56 y=157 width=8 height=1 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=15 char id=8255 x=105 y=483 width=14 height=3 xoffset=-1 yoffset=15 xadvance=12 page=0 chnl=15 char id=8256 x=90 y=483 width=14 height=3 xoffset=-1 yoffset=0 xadvance=12 page=0 chnl=15 char id=8257 x=309 y=453 width=6 height=8 xoffset=-1 yoffset=10 xadvance=5 page=0 chnl=15 char id=8258 x=149 y=128 width=15 height=13 xoffset=0 yoffset=2 xadvance=15 page=0 chnl=15 char id=8259 x=223 y=478 width=6 height=3 xoffset=1 yoffset=8 xadvance=8 page=0 chnl=15 char id=8260 x=27 y=375 width=8 height=11 xoffset=-3 yoffset=3 xadvance=3 page=0 chnl=15 char id=8261 x=244 y=110 width=5 height=14 xoffset=1 yoffset=2 xadvance=7 page=0 chnl=15 char id=8262 x=226 y=110 width=5 height=14 xoffset=1 yoffset=2 xadvance=7 page=0 chnl=15 char id=8263 x=16 y=279 width=15 height=11 xoffset=0 yoffset=3 xadvance=15 page=0 chnl=15 char id=8264 x=231 y=334 width=10 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=8265 x=376 y=306 width=11 height=11 xoffset=1 yoffset=3 xadvance=12 page=0 chnl=15 char id=8266 x=266 y=382 width=7 height=11 xoffset=0 yoffset=5 xadvance=8 page=0 chnl=15 char id=8267 x=470 y=165 width=8 height=13 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=8268 x=346 y=459 width=6 height=7 xoffset=1 yoffset=5 xadvance=8 page=0 chnl=15 char id=8269 x=339 y=459 width=6 height=7 xoffset=1 yoffset=5 xadvance=8 page=0 chnl=15 char id=8270 x=268 y=462 width=7 height=7 xoffset=0 yoffset=7 xadvance=8 page=0 chnl=15 char id=8271 x=94 y=264 width=4 height=12 xoffset=1 yoffset=5 xadvance=6 page=0 chnl=15 char id=8272 x=49 y=0 width=14 height=18 xoffset=-1 yoffset=0 xadvance=12 page=0 chnl=15 char id=8273 x=79 y=185 width=7 height=13 xoffset=0 yoffset=2 xadvance=8 page=0 chnl=15 char id=8274 x=394 y=244 width=7 height=12 xoffset=0 yoffset=3 xadvance=8 page=0 chnl=15 char id=8275 x=471 y=463 width=15 height=4 xoffset=0 yoffset=7 xadvance=15 page=0 chnl=15 char id=8276 x=75 y=483 width=14 height=3 xoffset=-1 yoffset=15 xadvance=12 page=0 chnl=15 char id=8277 x=50 y=431 width=9 height=9 xoffset=2 yoffset=4 xadvance=13 page=0 chnl=15 char id=8278 x=145 y=429 width=8 height=9 xoffset=1 yoffset=4 xadvance=10 page=0 chnl=15 char id=8279 x=120 y=483 width=12 height=3 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15 char id=8280 x=168 y=323 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=8281 x=424 y=411 width=10 height=9 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 char id=8282 x=507 y=293 width=4 height=11 xoffset=1 yoffset=3 xadvance=6 page=0 chnl=15 char id=8283 x=167 y=0 width=13 height=17 xoffset=0 yoffset=0 xadvance=13 page=0 chnl=15 char id=8284 x=182 y=286 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=8285 x=453 y=377 width=4 height=11 xoffset=1 yoffset=3 xadvance=6 page=0 chnl=15 char id=8286 x=448 y=377 width=4 height=11 xoffset=1 yoffset=3 xadvance=6 page=0 chnl=15 char id=8287 x=172 y=168 width=1 height=1 xoffset=0 yoffset=14 xadvance=3 page=0 chnl=15 char id=8288 x=170 y=168 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8289 x=168 y=168 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8290 x=51 y=143 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8291 x=510 y=39 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8292 x=510 y=35 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8298 x=190 y=195 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8299 x=187 y=182 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8300 x=185 y=182 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8301 x=68 y=185 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8302 x=194 y=195 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8303 x=510 y=45 width=1 height=1 xoffset=0 yoffset=14 xadvance=0 page=0 chnl=15 char id=8304 x=281 y=453 width=6 height=8 xoffset=0 yoffset=2 xadvance=7 page=0 chnl=15 char id=8305 x=507 y=429 width=3 height=8 xoffset=0 yoffset=2 xadvance=3 page=0 chnl=15 char id=8308 x=304 y=462 width=6 height=7 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=15 char id=8309 x=367 y=458 width=6 height=7 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=15 char id=8310 x=274 y=453 width=6 height=8 xoffset=0 yoffset=2 xadvance=7 page=0 chnl=15 char id=8311 x=325 y=460 width=6 height=7 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=15 char id=8312 x=246 y=453 width=6 height=8 xoffset=0 yoffset=2 xadvance=7 page=0 chnl=15 char id=8313 x=330 y=450 width=6 height=8 xoffset=0 yoffset=2 xadvance=7 page=0 chnl=15 char id=8314 x=297 y=462 width=6 height=7 xoffset=1 yoffset=3 xadvance=8 page=0 chnl=15 char id=8315 x=28 y=84 width=6 height=1 xoffset=1 yoffset=6 xadvance=8 page=0 chnl=15 char id=8316 x=216 y=479 width=6 height=3 xoffset=1 yoffset=5 xadvance=8 page=0 chnl=15 char id=8317 x=187 y=427 width=4 height=9 xoffset=0 yoffset=2 xadvance=4 page=0 chnl=15 char id=8318 x=202 y=427 width=4 height=9 xoffset=0 yoffset=2 xadvance=4 page=0 chnl=15 char id=8319 x=111 y=476 width=7 height=6 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=15 char id=8320 x=295 y=453 width=6 height=8 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=15 char id=8321 x=155 y=476 width=6 height=6 xoffset=1 yoffset=8 xadvance=7 page=0 chnl=15 char id=8322 x=201 y=472 width=5 height=6 xoffset=1 yoffset=8 xadvance=7 page=0 chnl=15 char id=8323 x=183 y=473 width=5 height=6 xoffset=1 yoffset=8 xadvance=7 page=0 chnl=15 char id=8324 x=311 y=462 width=6 height=7 xoffset=0 yoffset=8 xadvance=7 page=0 chnl=15 char id=8325 x=290 y=462 width=6 height=7 xoffset=0 yoffset=8 xadvance=7 page=0 chnl=15 char id=8326 x=239 y=454 width=6 height=8 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=15 char id=8327 x=283 y=462 width=6 height=7 xoffset=0 yoffset=8 xadvance=7 page=0 chnl=15 char id=8328 x=316 y=451 width=6 height=8 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=15 char id=8329 x=288 y=453 width=6 height=8 xoffset=0 yoffset=7 xadvance=7 page=0 chnl=15 char id=8330 x=276 y=462 width=6 height=7 xoffset=1 yoffset=8 xadvance=8 page=0 chnl=15 char id=8331 x=36 y=99 width=6 height=1 xoffset=1 yoffset=11 xadvance=8 page=0 chnl=15 char id=8332 x=230 y=478 width=6 height=3 xoffset=1 yoffset=10 xadvance=8 page=0 chnl=15 char id=8333 x=197 y=427 width=4 height=9 xoffset=0 yoffset=7 xadvance=4 page=0 chnl=15 char id=8334 x=192 y=427 width=4 height=9 xoffset=0 yoffset=7 xadvance=4 page=0 chnl=15 char id=8336 x=169 y=474 width=6 height=6 xoffset=0 yoffset=9 xadvance=7 page=0 chnl=15 char id=8337 x=504 y=455 width=7 height=6 xoffset=0 yoffset=9 xadvance=7 page=0 chnl=15 char id=8338 x=103 y=476 width=7 height=6 xoffset=0 yoffset=9 xadvance=7 page=0 chnl=15 char id=8339 x=162 y=474 width=6 height=6 xoffset=0 yoffset=9 xadvance=6 page=0 chnl=15 char id=8340 x=119 y=476 width=7 height=6 xoffset=0 yoffset=9 xadvance=7 page=0 chnl=15 char id=8352 x=251 y=271 width=14 height=11 xoffset=0 yoffset=3 xadvance=14 page=0 chnl=15 char id=8353 x=143 y=170 width=10 height=13 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=15 char id=8354 x=154 y=170 width=10 height=13 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=15 char id=8355 x=330 y=355 width=9 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=8356 x=0 y=240 width=10 height=12 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=15 char id=8357 x=0 y=201 width=14 height=12 xoffset=1 yoffset=4 xadvance=16 page=0 chnl=15 char id=8358 x=494 y=281 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=8359 x=128 y=184 width=21 height=12 xoffset=1 yoffset=3 xadvance=23 page=0 chnl=15 char id=8360 x=283 y=181 width=17 height=12 xoffset=1 yoffset=3 xadvance=18 page=0 chnl=15 char id=8361 x=301 y=259 width=17 height=11 xoffset=0 yoffset=3 xadvance=17 page=0 chnl=15 char id=8362 x=309 y=194 width=13 height=12 xoffset=0 yoffset=3 xadvance=14 page=0 chnl=15 char id=8363 x=311 y=94 width=9 height=14 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=8364 x=340 y=355 width=9 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=8365 x=400 y=305 width=11 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=8366 x=72 y=327 width=11 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=8367 x=259 y=0 width=18 height=16 xoffset=1 yoffset=2 xadvance=21 page=0 chnl=15 char id=8368 x=465 y=151 width=10 height=13 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=15 char id=8369 x=252 y=322 width=11 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=8370 x=284 y=33 width=10 height=15 xoffset=0 yoffset=1 xadvance=10 page=0 chnl=15 char id=8371 x=84 y=339 width=11 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=8372 x=210 y=139 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=8373 x=368 y=33 width=9 height=15 xoffset=1 yoffset=2 xadvance=10 page=0 chnl=15 char id=8376 x=268 y=307 width=11 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=8377 x=0 y=351 width=10 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=8592 x=78 y=450 width=11 height=8 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=8593 x=90 y=375 width=8 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8594 x=126 y=450 width=11 height=8 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=8595 x=99 y=375 width=8 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8596 x=90 y=450 width=11 height=8 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=8597 x=144 y=371 width=8 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8598 x=40 y=431 width=9 height=9 xoffset=2 yoffset=4 xadvance=13 page=0 chnl=15 char id=8599 x=10 y=431 width=9 height=9 xoffset=2 yoffset=4 xadvance=13 page=0 chnl=15 char id=8600 x=90 y=431 width=9 height=9 xoffset=2 yoffset=4 xadvance=13 page=0 chnl=15 char id=8601 x=80 y=431 width=9 height=9 xoffset=2 yoffset=4 xadvance=13 page=0 chnl=15 char id=8602 x=78 y=441 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8603 x=195 y=437 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8604 x=423 y=458 width=13 height=6 xoffset=0 yoffset=7 xadvance=13 page=0 chnl=15 char id=8605 x=451 y=456 width=13 height=6 xoffset=0 yoffset=7 xadvance=13 page=0 chnl=15 char id=8606 x=247 y=435 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8607 x=270 y=368 width=8 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8608 x=338 y=432 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8609 x=324 y=367 width=8 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8610 x=0 y=450 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8611 x=52 y=450 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8612 x=346 y=423 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8613 x=432 y=365 width=8 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8614 x=359 y=423 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8615 x=459 y=365 width=8 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8616 x=477 y=365 width=8 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8617 x=372 y=423 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8618 x=424 y=421 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8619 x=463 y=420 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8620 x=489 y=420 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8621 x=0 y=441 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8622 x=26 y=441 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8623 x=11 y=240 width=10 height=12 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=8624 x=153 y=249 width=8 height=12 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=8625 x=126 y=250 width=8 height=12 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=8626 x=117 y=251 width=8 height=12 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8627 x=180 y=249 width=8 height=12 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8628 x=152 y=407 width=9 height=10 xoffset=3 yoffset=4 xadvance=13 page=0 chnl=15 char id=8629 x=368 y=413 width=11 height=9 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=8630 x=318 y=423 width=13 height=8 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=8631 x=332 y=423 width=13 height=8 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=8632 x=12 y=327 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=8633 x=369 y=137 width=12 height=13 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=8634 x=60 y=327 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=8635 x=108 y=325 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=8636 x=0 y=476 width=12 height=6 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8637 x=246 y=471 width=12 height=5 xoffset=0 yoffset=8 xadvance=13 page=0 chnl=15 char id=8638 x=394 y=378 width=5 height=11 xoffset=5 yoffset=3 xadvance=13 page=0 chnl=15 char id=8639 x=352 y=379 width=6 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8640 x=491 y=455 width=12 height=6 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8641 x=233 y=471 width=12 height=5 xoffset=0 yoffset=8 xadvance=13 page=0 chnl=15 char id=8642 x=506 y=329 width=5 height=11 xoffset=5 yoffset=3 xadvance=13 page=0 chnl=15 char id=8643 x=366 y=379 width=6 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8644 x=500 y=192 width=11 height=12 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=8645 x=26 y=315 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=8646 x=464 y=218 width=11 height=12 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=8647 x=247 y=207 width=12 height=12 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=8648 x=182 y=310 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=8649 x=221 y=207 width=12 height=12 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=8650 x=455 y=293 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=8651 x=345 y=391 width=12 height=10 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=8652 x=371 y=391 width=12 height=10 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=8653 x=208 y=436 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8654 x=221 y=436 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8655 x=234 y=435 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8656 x=273 y=435 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8657 x=423 y=366 width=8 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8658 x=13 y=450 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8659 x=441 y=365 width=8 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8660 x=26 y=450 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8661 x=296 y=233 width=8 height=12 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8662 x=468 y=389 width=10 height=10 xoffset=2 yoffset=5 xadvance=13 page=0 chnl=15 char id=8663 x=66 y=410 width=10 height=10 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=8664 x=110 y=410 width=10 height=10 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 char id=8665 x=99 y=410 width=10 height=10 xoffset=2 yoffset=4 xadvance=13 page=0 chnl=15 char id=8666 x=169 y=438 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8667 x=143 y=439 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8668 x=130 y=441 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8669 x=411 y=422 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8670 x=45 y=387 width=8 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8671 x=54 y=387 width=8 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8672 x=442 y=430 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8673 x=9 y=375 width=8 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8674 x=39 y=441 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8675 x=63 y=387 width=8 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8676 x=364 y=432 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8677 x=312 y=433 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8678 x=214 y=416 width=12 height=9 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8679 x=159 y=236 width=9 height=12 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=8680 x=292 y=414 width=12 height=9 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8681 x=189 y=236 width=9 height=12 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=8682 x=199 y=236 width=9 height=12 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=8683 x=99 y=238 width=9 height=12 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=8684 x=179 y=236 width=9 height=12 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=8685 x=109 y=238 width=9 height=12 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=8686 x=119 y=237 width=9 height=12 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=8687 x=139 y=237 width=9 height=12 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=8688 x=188 y=417 width=12 height=9 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8689 x=494 y=293 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=8690 x=13 y=315 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=8691 x=327 y=165 width=9 height=13 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=8692 x=39 y=450 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8693 x=39 y=315 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=8694 x=194 y=0 width=12 height=17 xoffset=0 yoffset=1 xadvance=13 page=0 chnl=15 char id=8695 x=403 y=432 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8696 x=398 y=423 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8697 x=299 y=435 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8698 x=286 y=435 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8699 x=104 y=441 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8700 x=260 y=435 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=8701 x=104 y=468 width=12 height=7 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=8702 x=377 y=450 width=13 height=7 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=8703 x=391 y=450 width=13 height=7 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=9632 x=234 y=207 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9633 x=208 y=208 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9634 x=182 y=210 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9635 x=91 y=212 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9636 x=52 y=214 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9637 x=39 y=214 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9638 x=13 y=214 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9639 x=0 y=214 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9640 x=487 y=192 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9641 x=461 y=192 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9642 x=312 y=442 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=9643 x=330 y=441 width=8 height=8 xoffset=1 yoffset=6 xadvance=10 page=0 chnl=15 char id=9644 x=13 y=476 width=12 height=6 xoffset=1 yoffset=7 xadvance=14 page=0 chnl=15 char id=9645 x=39 y=476 width=12 height=6 xoffset=1 yoffset=7 xadvance=14 page=0 chnl=15 char id=9646 x=0 y=266 width=6 height=12 xoffset=1 yoffset=4 xadvance=8 page=0 chnl=15 char id=9647 x=21 y=266 width=6 height=12 xoffset=1 yoffset=4 xadvance=8 page=0 chnl=15 char id=9648 x=465 y=456 width=12 height=6 xoffset=0 yoffset=7 xadvance=12 page=0 chnl=15 char id=9649 x=26 y=476 width=12 height=6 xoffset=0 yoffset=7 xadvance=12 page=0 chnl=15 char id=9650 x=435 y=192 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9651 x=208 y=221 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9652 x=339 y=441 width=8 height=8 xoffset=0 yoffset=6 xadvance=8 page=0 chnl=15 char id=9653 x=357 y=441 width=8 height=8 xoffset=0 yoffset=6 xadvance=8 page=0 chnl=15 char id=9654 x=182 y=223 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9655 x=169 y=223 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9656 x=366 y=441 width=8 height=8 xoffset=0 yoffset=6 xadvance=8 page=0 chnl=15 char id=9657 x=384 y=441 width=8 height=8 xoffset=0 yoffset=6 xadvance=8 page=0 chnl=15 char id=9658 x=450 y=421 width=12 height=8 xoffset=0 yoffset=6 xadvance=12 page=0 chnl=15 char id=9659 x=437 y=421 width=12 height=8 xoffset=0 yoffset=6 xadvance=12 page=0 chnl=15 char id=9660 x=156 y=223 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9661 x=143 y=223 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9662 x=411 y=441 width=8 height=8 xoffset=0 yoffset=6 xadvance=8 page=0 chnl=15 char id=9663 x=27 y=459 width=8 height=8 xoffset=0 yoffset=6 xadvance=8 page=0 chnl=15 char id=9664 x=169 y=210 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9665 x=130 y=224 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9666 x=429 y=439 width=8 height=8 xoffset=0 yoffset=6 xadvance=8 page=0 chnl=15 char id=9667 x=438 y=439 width=8 height=8 xoffset=0 yoffset=6 xadvance=8 page=0 chnl=15 char id=9668 x=481 y=429 width=12 height=8 xoffset=0 yoffset=6 xadvance=12 page=0 chnl=15 char id=9669 x=468 y=429 width=12 height=8 xoffset=0 yoffset=6 xadvance=12 page=0 chnl=15 char id=9670 x=117 y=224 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9671 x=104 y=225 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9672 x=78 y=225 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9673 x=281 y=194 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9674 x=119 y=19 width=7 height=16 xoffset=0 yoffset=2 xadvance=7 page=0 chnl=15 char id=9675 x=239 y=194 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9676 x=225 y=194 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9677 x=197 y=195 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9678 x=155 y=197 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9679 x=141 y=197 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9680 x=253 y=194 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9681 x=29 y=201 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9682 x=15 y=201 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9683 x=407 y=192 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9684 x=393 y=192 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9685 x=379 y=192 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9686 x=370 y=244 width=7 height=12 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=15 char id=9687 x=378 y=244 width=7 height=12 xoffset=1 yoffset=4 xadvance=8 page=0 chnl=15 char id=9688 x=312 y=152 width=11 height=13 xoffset=1 yoffset=2 xadvance=13 page=0 chnl=15 char id=9689 x=364 y=0 width=13 height=16 xoffset=1 yoffset=2 xadvance=15 page=0 chnl=15 char id=9690 x=77 y=421 width=13 height=9 xoffset=1 yoffset=2 xadvance=15 page=0 chnl=15 char id=9691 x=304 y=424 width=13 height=8 xoffset=1 yoffset=10 xadvance=15 page=0 chnl=15 char id=9692 x=360 y=458 width=6 height=7 xoffset=0 yoffset=4 xadvance=6 page=0 chnl=15 char id=9693 x=374 y=458 width=6 height=7 xoffset=0 yoffset=4 xadvance=6 page=0 chnl=15 char id=9694 x=141 y=476 width=6 height=6 xoffset=0 yoffset=10 xadvance=6 page=0 chnl=15 char id=9695 x=134 y=476 width=6 height=6 xoffset=0 yoffset=10 xadvance=6 page=0 chnl=15 char id=9696 x=143 y=468 width=12 height=7 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9697 x=478 y=456 width=12 height=6 xoffset=0 yoffset=10 xadvance=12 page=0 chnl=15 char id=9698 x=403 y=205 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9699 x=390 y=205 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9700 x=448 y=192 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9701 x=325 y=206 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9702 x=353 y=458 width=6 height=7 xoffset=2 yoffset=5 xadvance=10 page=0 chnl=15 char id=9703 x=26 y=227 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9704 x=299 y=207 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9705 x=286 y=207 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9706 x=156 y=210 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9707 x=143 y=210 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9708 x=130 y=211 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9709 x=104 y=212 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9710 x=26 y=214 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9711 x=330 y=0 width=16 height=16 xoffset=0 yoffset=2 xadvance=17 page=0 chnl=15 char id=9712 x=474 y=192 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9713 x=234 y=220 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9714 x=221 y=220 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9715 x=273 y=207 width=12 height=12 xoffset=1 yoffset=4 xadvance=14 page=0 chnl=15 char id=9716 x=421 y=192 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9717 x=337 y=192 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9718 x=323 y=193 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9719 x=295 y=194 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9720 x=247 y=220 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9721 x=52 y=227 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9722 x=338 y=205 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9723 x=456 y=389 width=11 height=10 xoffset=1 yoffset=5 xadvance=12 page=0 chnl=15 char id=9724 x=444 y=389 width=11 height=10 xoffset=1 yoffset=5 xadvance=12 page=0 chnl=15 char id=9725 x=60 y=431 width=9 height=9 xoffset=1 yoffset=6 xadvance=11 page=0 chnl=15 char id=9726 x=30 y=431 width=9 height=9 xoffset=1 yoffset=6 xadvance=11 page=0 chnl=15 char id=9727 x=351 y=205 width=12 height=12 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15 char id=9728 x=195 y=310 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9729 x=391 y=458 width=15 height=6 xoffset=0 yoffset=8 xadvance=15 page=0 chnl=15 char id=9730 x=322 y=271 width=13 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9731 x=97 y=68 width=12 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=9732 x=110 y=68 width=12 height=14 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=9733 x=0 y=227 width=12 height=12 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9734 x=13 y=227 width=12 height=12 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9735 x=504 y=317 width=7 height=11 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15 char id=9736 x=13 y=291 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9737 x=26 y=291 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9738 x=434 y=269 width=13 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9739 x=448 y=269 width=13 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9740 x=143 y=335 width=10 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=9741 x=96 y=277 width=15 height=11 xoffset=0 yoffset=3 xadvance=15 page=0 chnl=15 char id=9742 x=283 y=259 width=17 height=11 xoffset=1 yoffset=3 xadvance=19 page=0 chnl=15 char id=9743 x=265 y=259 width=17 height=11 xoffset=1 yoffset=3 xadvance=19 page=0 chnl=15 char id=9744 x=39 y=291 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9745 x=52 y=291 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9746 x=65 y=291 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9747 x=180 y=427 width=6 height=9 xoffset=1 yoffset=4 xadvance=8 page=0 chnl=15 char id=9748 x=28 y=69 width=13 height=14 xoffset=0 yoffset=0 xadvance=13 page=0 chnl=15 char id=9749 x=78 y=291 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9750 x=104 y=289 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9751 x=117 y=288 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9752 x=143 y=287 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9753 x=0 y=468 width=12 height=7 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=9754 x=377 y=432 width=12 height=8 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=9755 x=13 y=441 width=12 height=8 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=9756 x=455 y=430 width=12 height=8 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=9757 x=454 y=353 width=8 height=11 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15 char id=9758 x=385 y=423 width=12 height=8 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=9759 x=180 y=383 width=8 height=11 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15 char id=9760 x=462 y=269 width=13 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9761 x=156 y=287 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9762 x=169 y=287 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9763 x=336 y=271 width=13 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9764 x=275 y=332 width=10 height=11 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15 char id=9765 x=315 y=343 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=9766 x=81 y=375 width=8 height=11 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=9767 x=396 y=79 width=10 height=14 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 char id=9768 x=505 y=341 width=6 height=11 xoffset=1 yoffset=3 xadvance=8 page=0 chnl=15 char id=9769 x=195 y=286 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9770 x=208 y=286 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9771 x=221 y=286 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9772 x=375 y=342 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=9773 x=234 y=286 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9774 x=247 y=284 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9775 x=260 y=283 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9776 x=273 y=283 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9777 x=286 y=283 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9778 x=299 y=283 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9779 x=312 y=283 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9780 x=325 y=283 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9781 x=338 y=283 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9782 x=351 y=283 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9783 x=364 y=282 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9784 x=464 y=123 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=9785 x=377 y=282 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9786 x=390 y=281 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9787 x=403 y=281 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9788 x=416 y=281 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9789 x=450 y=365 width=8 height=11 xoffset=5 yoffset=3 xadvance=13 page=0 chnl=15 char id=9790 x=409 y=354 width=8 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9791 x=87 y=185 width=7 height=13 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15 char id=9792 x=267 y=167 width=9 height=13 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=9793 x=221 y=95 width=9 height=14 xoffset=1 yoffset=1 xadvance=11 page=0 chnl=15 char id=9794 x=364 y=205 width=12 height=12 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9795 x=130 y=360 width=9 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9796 x=36 y=375 width=8 height=11 xoffset=3 yoffset=3 xadvance=13 page=0 chnl=15 char id=9797 x=144 y=323 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9798 x=348 y=319 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9799 x=314 y=379 width=7 height=11 xoffset=3 yoffset=3 xadvance=13 page=0 chnl=15 char id=9800 x=280 y=271 width=13 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9801 x=442 y=281 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9802 x=0 y=339 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9803 x=120 y=336 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9804 x=264 y=344 width=10 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9805 x=486 y=49 width=13 height=14 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9806 x=332 y=391 width=12 height=10 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 char id=9807 x=84 y=143 width=13 height=13 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9808 x=455 y=281 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9809 x=36 y=327 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9810 x=13 y=468 width=12 height=7 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=9811 x=33 y=351 width=10 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9812 x=180 y=323 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9813 x=192 y=322 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9814 x=300 y=355 width=9 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9815 x=189 y=383 width=8 height=11 xoffset=3 yoffset=3 xadvance=13 page=0 chnl=15 char id=9816 x=310 y=355 width=9 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9817 x=154 y=347 width=10 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9818 x=384 y=318 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9819 x=396 y=318 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9820 x=360 y=355 width=9 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9821 x=144 y=383 width=8 height=11 xoffset=3 yoffset=3 xadvance=13 page=0 chnl=15 char id=9822 x=370 y=355 width=9 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9823 x=187 y=347 width=10 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9824 x=220 y=334 width=10 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9825 x=468 y=281 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9826 x=285 y=344 width=9 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9827 x=484 y=305 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9828 x=286 y=331 width=10 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9829 x=481 y=281 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9830 x=325 y=343 width=9 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9831 x=84 y=327 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9832 x=96 y=327 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9833 x=76 y=266 width=5 height=12 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=9834 x=287 y=233 width=8 height=12 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=15 char id=9835 x=387 y=165 width=9 height=13 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9836 x=429 y=205 width=12 height=12 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9837 x=406 y=378 width=5 height=11 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=9838 x=473 y=377 width=4 height=11 xoffset=1 yoffset=3 xadvance=5 page=0 chnl=15 char id=9839 x=430 y=378 width=5 height=11 xoffset=1 yoffset=3 xadvance=7 page=0 chnl=15 char id=9840 x=395 y=342 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=9841 x=374 y=330 width=10 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=9842 x=0 y=303 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9843 x=13 y=303 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9844 x=26 y=303 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9845 x=39 y=303 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9846 x=52 y=303 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9847 x=65 y=303 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9848 x=78 y=303 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9849 x=91 y=303 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9850 x=104 y=301 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9851 x=117 y=300 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9852 x=130 y=299 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9853 x=143 y=299 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9854 x=156 y=299 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9855 x=66 y=351 width=10 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9856 x=436 y=305 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9857 x=108 y=337 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9858 x=276 y=319 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9859 x=300 y=319 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9860 x=360 y=319 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9861 x=372 y=318 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9862 x=169 y=299 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9863 x=182 y=298 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9864 x=195 y=298 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9865 x=208 y=298 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9866 x=324 y=474 width=12 height=2 xoffset=1 yoffset=12 xadvance=13 page=0 chnl=15 char id=9867 x=337 y=474 width=12 height=2 xoffset=1 yoffset=12 xadvance=13 page=0 chnl=15 char id=9868 x=444 y=448 width=12 height=7 xoffset=1 yoffset=7 xadvance=13 page=0 chnl=15 char id=9869 x=457 y=448 width=12 height=7 xoffset=1 yoffset=7 xadvance=13 page=0 chnl=15 char id=9870 x=470 y=448 width=12 height=7 xoffset=1 yoffset=7 xadvance=13 page=0 chnl=15 char id=9871 x=483 y=447 width=12 height=7 xoffset=1 yoffset=7 xadvance=13 page=0 chnl=15 char id=9872 x=180 y=359 width=9 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9873 x=190 y=359 width=9 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9874 x=364 y=270 width=13 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9875 x=308 y=220 width=11 height=12 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9876 x=253 y=346 width=10 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9877 x=0 y=253 width=8 height=12 xoffset=0 yoffset=3 xadvance=8 page=0 chnl=15 char id=9878 x=365 y=192 width=13 height=12 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9879 x=476 y=269 width=13 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9880 x=154 y=335 width=10 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=9881 x=332 y=219 width=11 height=12 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9882 x=344 y=218 width=11 height=12 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9883 x=280 y=307 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9884 x=292 y=307 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9888 x=420 y=269 width=13 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9889 x=320 y=355 width=9 height=11 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=9890 x=56 y=143 width=13 height=13 xoffset=1 yoffset=3 xadvance=15 page=0 chnl=15 char id=9891 x=279 y=17 width=15 height=15 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=15 char id=9892 x=347 y=0 width=16 height=16 xoffset=1 yoffset=1 xadvance=18 page=0 chnl=15 char id=9893 x=418 y=0 width=12 height=16 xoffset=1 yoffset=0 xadvance=14 page=0 chnl=15 char id=9894 x=211 y=95 width=9 height=14 xoffset=2 yoffset=1 xadvance=13 page=0 chnl=15 char id=9895 x=207 y=0 width=11 height=17 xoffset=1 yoffset=0 xadvance=13 page=0 chnl=15 char id=9896 x=381 y=94 width=8 height=14 xoffset=2 yoffset=1 xadvance=13 page=0 chnl=15 char id=9897 x=363 y=450 width=13 height=7 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=9898 x=251 y=462 width=8 height=7 xoffset=2 yoffset=5 xadvance=13 page=0 chnl=15 char id=9899 x=224 y=463 width=8 height=7 xoffset=2 yoffset=5 xadvance=13 page=0 chnl=15 char id=9900 x=127 y=476 width=6 height=6 xoffset=3 yoffset=6 xadvance=13 page=0 chnl=15 char id=9901 x=86 y=476 width=8 height=6 xoffset=2 yoffset=6 xadvance=13 page=0 chnl=15 char id=9902 x=65 y=468 width=12 height=7 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=9903 x=437 y=456 width=13 height=6 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=9904 x=64 y=476 width=11 height=6 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=9905 x=242 y=382 width=7 height=11 xoffset=3 yoffset=3 xadvance=13 page=0 chnl=15 char id=9906 x=377 y=165 width=9 height=13 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=9907 x=0 y=187 width=8 height=13 xoffset=2 yoffset=3 xadvance=11 page=0 chnl=15 char id=9908 x=287 y=167 width=9 height=13 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=9909 x=297 y=167 width=9 height=13 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=15 char id=9910 x=39 y=227 width=12 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9911 x=95 y=185 width=7 height=13 xoffset=2 yoffset=3 xadvance=11 page=0 chnl=15 char id=9912 x=71 y=185 width=7 height=13 xoffset=2 yoffset=3 xadvance=11 page=0 chnl=15 char id=9920 x=266 y=416 width=12 height=9 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=9921 x=247 y=296 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9922 x=318 y=413 width=12 height=9 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=9923 x=260 y=295 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9985 x=65 y=441 width=12 height=8 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9986 x=117 y=468 width=12 height=7 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=9987 x=52 y=441 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=9988 x=63 y=421 width=13 height=9 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=9990 x=330 y=137 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=9991 x=317 y=137 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=9992 x=273 y=295 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9993 x=500 y=400 width=11 height=9 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 char id=9996 x=35 y=266 width=6 height=12 xoffset=3 yoffset=2 xadvance=13 page=0 chnl=15 char id=9997 x=293 y=392 width=12 height=10 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=9998 x=0 y=410 width=10 height=10 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=9999 x=219 y=472 width=13 height=5 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=10000 x=490 y=389 width=10 height=10 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=10001 x=130 y=468 width=12 height=7 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=10002 x=297 y=470 width=11 height=5 xoffset=1 yoffset=6 xadvance=13 page=0 chnl=15 char id=10003 x=100 y=431 width=8 height=9 xoffset=2 yoffset=4 xadvance=13 page=0 chnl=15 char id=10004 x=380 y=413 width=10 height=9 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 char id=10005 x=413 y=412 width=10 height=9 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 char id=10006 x=48 y=327 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=10007 x=33 y=240 width=10 height=12 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=10008 x=428 y=218 width=11 height=12 xoffset=1 yoffset=2 xadvance=13 page=0 chnl=15 char id=10009 x=286 y=295 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10010 x=299 y=295 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10011 x=312 y=295 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10012 x=325 y=295 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10013 x=485 y=341 width=9 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=10014 x=495 y=341 width=9 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=10015 x=0 y=363 width=9 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=10016 x=338 y=295 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10017 x=228 y=153 width=11 height=13 xoffset=1 yoffset=2 xadvance=13 page=0 chnl=15 char id=10018 x=291 y=138 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10019 x=265 y=139 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10020 x=252 y=139 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10021 x=143 y=156 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10022 x=130 y=156 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10023 x=117 y=156 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10025 x=338 y=123 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10026 x=104 y=156 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10027 x=310 y=123 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10028 x=296 y=124 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10029 x=282 y=124 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10030 x=268 y=125 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10031 x=254 y=125 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10032 x=392 y=269 width=13 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10033 x=324 y=319 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=10034 x=336 y=319 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=10035 x=377 y=294 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10036 x=78 y=157 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10037 x=356 y=137 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10038 x=372 y=151 width=11 height=13 xoffset=1 yoffset=2 xadvance=13 page=0 chnl=15 char id=10039 x=65 y=157 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10040 x=52 y=159 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10041 x=39 y=159 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10042 x=390 y=293 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10043 x=360 y=151 width=11 height=13 xoffset=1 yoffset=2 xadvance=13 page=0 chnl=15 char id=10044 x=348 y=151 width=11 height=13 xoffset=1 yoffset=2 xadvance=13 page=0 chnl=15 char id=10045 x=300 y=152 width=11 height=13 xoffset=1 yoffset=2 xadvance=13 page=0 chnl=15 char id=10046 x=276 y=153 width=11 height=13 xoffset=1 yoffset=2 xadvance=13 page=0 chnl=15 char id=10047 x=403 y=293 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10048 x=416 y=293 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10049 x=0 y=159 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10050 x=499 y=137 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10051 x=240 y=153 width=11 height=13 xoffset=1 yoffset=2 xadvance=13 page=0 chnl=15 char id=10052 x=48 y=339 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=10053 x=60 y=339 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=10054 x=72 y=339 width=11 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=10055 x=336 y=151 width=11 height=13 xoffset=1 yoffset=2 xadvance=13 page=0 chnl=15 char id=10056 x=65 y=214 width=12 height=12 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10057 x=78 y=212 width=12 height=12 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10058 x=486 y=137 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10059 x=499 y=109 width=12 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10061 x=394 y=123 width=13 height=13 xoffset=0 yoffset=2 xadvance=14 page=0 chnl=15 char id=10063 x=57 y=201 width=13 height=12 xoffset=0 yoffset=3 xadvance=14 page=0 chnl=15 char id=10064 x=71 y=199 width=13 height=12 xoffset=0 yoffset=2 xadvance=14 page=0 chnl=15 char id=10065 x=85 y=199 width=13 height=12 xoffset=0 yoffset=3 xadvance=14 page=0 chnl=15 char id=10066 x=267 y=194 width=13 height=12 xoffset=0 yoffset=2 xadvance=14 page=0 chnl=15 char id=10070 x=429 y=293 width=12 height=11 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=10072 x=152 y=18 width=2 height=16 xoffset=5 yoffset=2 xadvance=13 page=0 chnl=15 char id=10073 x=148 y=18 width=3 height=16 xoffset=5 yoffset=2 xadvance=13 page=0 chnl=15 char id=10074 x=127 y=18 width=6 height=16 xoffset=3 yoffset=2 xadvance=13 page=0 chnl=15 char id=10075 x=454 y=463 width=4 height=5 xoffset=1 yoffset=3 xadvance=5 page=0 chnl=15 char id=10076 x=449 y=463 width=4 height=5 xoffset=0 yoffset=3 xadvance=5 page=0 chnl=15 char id=10077 x=95 y=476 width=7 height=6 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15 char id=10078 x=369 y=466 width=8 height=5 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=15 char id=10081 x=130 y=35 width=10 height=15 xoffset=2 yoffset=1 xadvance=13 page=0 chnl=15 char id=10082 x=103 y=185 width=7 height=13 xoffset=3 yoffset=2 xadvance=13 page=0 chnl=15 char id=10083 x=227 y=167 width=9 height=13 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=10084 x=240 y=416 width=12 height=9 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 char id=10085 x=435 y=341 width=9 height=11 xoffset=2 yoffset=3 xadvance=13 page=0 chnl=15 char id=10086 x=256 y=308 width=11 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10087 x=156 y=466 width=11 height=7 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=10088 x=18 y=55 width=8 height=15 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=10089 x=27 y=53 width=8 height=15 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=10090 x=250 y=110 width=5 height=14 xoffset=4 yoffset=2 xadvance=13 page=0 chnl=15 char id=10091 x=256 y=110 width=5 height=14 xoffset=4 yoffset=2 xadvance=13 page=0 chnl=15 char id=10092 x=103 y=19 width=7 height=16 xoffset=3 yoffset=2 xadvance=13 page=0 chnl=15 char id=10093 x=111 y=19 width=7 height=16 xoffset=3 yoffset=2 xadvance=13 page=0 chnl=15 char id=10094 x=64 y=19 width=9 height=16 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=10095 x=54 y=19 width=9 height=16 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=10096 x=94 y=19 width=8 height=16 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=10097 x=44 y=20 width=9 height=16 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=10098 x=144 y=18 width=3 height=16 xoffset=5 yoffset=2 xadvance=13 page=0 chnl=15 char id=10099 x=139 y=18 width=4 height=16 xoffset=4 yoffset=2 xadvance=13 page=0 chnl=15 char id=10100 x=9 y=55 width=8 height=15 xoffset=2 yoffset=2 xadvance=13 page=0 chnl=15 char id=10101 x=63 y=52 width=7 height=15 xoffset=3 yoffset=2 xadvance=13 page=0 chnl=15 char id=10102 x=356 y=218 width=11 height=12 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=10103 x=368 y=218 width=11 height=12 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=10104 x=380 y=218 width=11 height=12 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=10105 x=392 y=218 width=11 height=12 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=15 char id=10106 x=442 y=205 width=12 height=12 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10107 x=455 y=205 width=12 height=12 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10108 x=468 y=205 width=12 height=12 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10109 x=481 y=205 width=12 height=12 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10110 x=494 y=205 width=12 height=12 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10111 x=0 y=315 width=12 height=11 xoffset=0 yoffset=3 xadvance=13 page=0 chnl=15 char id=10112 x=240 y=125 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10113 x=98 y=142 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10114 x=42 y=145 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10115 x=478 y=123 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10116 x=196 y=139 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10117 x=182 y=140 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10118 x=168 y=140 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10119 x=154 y=142 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10120 x=112 y=142 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10121 x=70 y=143 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10122 x=28 y=145 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10123 x=14 y=145 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10124 x=0 y=145 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10125 x=492 y=123 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10126 x=450 y=123 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10127 x=436 y=123 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10128 x=422 y=123 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10129 x=380 y=123 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10130 x=408 y=123 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10131 x=324 y=123 width=13 height=13 xoffset=0 yoffset=2 xadvance=13 page=0 chnl=15 char id=10132 x=351 y=432 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=10136 x=44 y=410 width=10 height=10 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 char id=10137 x=496 y=447 width=12 height=7 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=10138 x=457 y=410 width=10 height=9 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=10139 x=431 y=448 width=12 height=7 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=10140 x=253 y=416 width=12 height=9 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=10141 x=78 y=468 width=12 height=7 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=10142 x=26 y=468 width=12 height=7 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=10143 x=418 y=450 width=12 height=7 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=10144 x=405 y=450 width=12 height=7 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=10145 x=91 y=468 width=12 height=7 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=10146 x=180 y=465 width=11 height=7 xoffset=1 yoffset=6 xadvance=13 page=0 chnl=15 char id=10147 x=168 y=466 width=11 height=7 xoffset=1 yoffset=6 xadvance=13 page=0 chnl=15 char id=10148 x=204 y=322 width=11 height=11 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 char id=10149 x=390 y=432 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=10150 x=52 y=468 width=12 height=7 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=10151 x=290 y=380 width=7 height=11 xoffset=3 yoffset=4 xadvance=13 page=0 chnl=15 char id=10152 x=39 y=468 width=12 height=7 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 char id=10153 x=416 y=431 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=10154 x=429 y=430 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=10155 x=279 y=416 width=12 height=9 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=10156 x=305 y=414 width=12 height=9 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=10157 x=468 y=410 width=10 height=9 xoffset=2 yoffset=5 xadvance=13 page=0 chnl=15 char id=10158 x=479 y=410 width=10 height=9 xoffset=2 yoffset=5 xadvance=13 page=0 chnl=15 char id=10159 x=331 y=413 width=12 height=9 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=10161 x=175 y=417 width=12 height=9 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=10162 x=292 y=403 width=9 height=10 xoffset=2 yoffset=5 xadvance=13 page=0 chnl=15 char id=10163 x=285 y=470 width=11 height=5 xoffset=1 yoffset=7 xadvance=13 page=0 chnl=15 char id=10164 x=33 y=410 width=10 height=10 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 char id=10165 x=259 y=470 width=12 height=5 xoffset=0 yoffset=7 xadvance=13 page=0 chnl=15 char id=10166 x=11 y=410 width=10 height=10 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=10167 x=501 y=389 width=10 height=10 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 char id=10168 x=272 y=470 width=12 height=5 xoffset=0 yoffset=7 xadvance=13 page=0 chnl=15 char id=10169 x=479 y=389 width=10 height=10 xoffset=1 yoffset=5 xadvance=13 page=0 chnl=15 char id=10170 x=65 y=450 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 char id=10171 x=52 y=476 width=11 height=6 xoffset=1 yoffset=6 xadvance=13 page=0 chnl=15 char id=10172 x=309 y=470 width=11 height=5 xoffset=1 yoffset=7 xadvance=13 page=0 chnl=15 char id=10173 x=192 y=464 width=11 height=7 xoffset=1 yoffset=6 xadvance=13 page=0 chnl=15 char id=10174 x=117 y=441 width=12 height=8 xoffset=0 yoffset=5 xadvance=13 page=0 chnl=15 kernings count=920 kerning first=45 second=84 amount=-2 kerning first=45 second=86 amount=-1 kerning first=45 second=87 amount=-1 kerning first=45 second=88 amount=-1 kerning first=45 second=89 amount=-2 kerning first=45 second=221 amount=-2 kerning first=45 second=356 amount=-2 kerning first=45 second=376 amount=-2 kerning first=8222 second=376 amount=-3 kerning first=8222 second=356 amount=-3 kerning first=8222 second=221 amount=-3 kerning first=8222 second=89 amount=-3 kerning first=65 second=84 amount=-1 kerning first=8222 second=87 amount=-2 kerning first=65 second=86 amount=-1 kerning first=65 second=87 amount=-1 kerning first=65 second=89 amount=-1 kerning first=65 second=118 amount=-1 kerning first=65 second=121 amount=-1 kerning first=8222 second=86 amount=-2 kerning first=8222 second=84 amount=-3 kerning first=8220 second=198 amount=-2 kerning first=8220 second=196 amount=-2 kerning first=65 second=221 amount=-1 kerning first=65 second=253 amount=-1 kerning first=65 second=255 amount=-1 kerning first=65 second=354 amount=-1 kerning first=65 second=356 amount=-1 kerning first=8220 second=195 amount=-2 kerning first=8220 second=194 amount=-2 kerning first=8220 second=193 amount=-2 kerning first=8220 second=192 amount=-2 kerning first=8220 second=74 amount=-1 kerning first=65 second=372 amount=-1 kerning first=65 second=374 amount=-1 kerning first=65 second=375 amount=-1 kerning first=65 second=376 amount=-1 kerning first=65 second=538 amount=-1 kerning first=65 second=562 amount=-1 kerning first=65 second=563 amount=-1 kerning first=8220 second=65 amount=-2 kerning first=8218 second=376 amount=-3 kerning first=8218 second=356 amount=-3 kerning first=8218 second=221 amount=-3 kerning first=65 second=8217 amount=-1 kerning first=65 second=8218 amount=1 kerning first=65 second=8221 amount=-1 kerning first=65 second=8222 amount=1 kerning first=66 second=86 amount=-1 kerning first=66 second=87 amount=-1 kerning first=66 second=89 amount=-1 kerning first=66 second=221 amount=-1 kerning first=66 second=372 amount=-1 kerning first=66 second=374 amount=-1 kerning first=66 second=376 amount=-1 kerning first=66 second=562 amount=-1 kerning first=8218 second=89 amount=-3 kerning first=8218 second=87 amount=-2 kerning first=8218 second=86 amount=-2 kerning first=8218 second=84 amount=-3 kerning first=8216 second=376 amount=1 kerning first=8216 second=221 amount=1 kerning first=8216 second=198 amount=-2 kerning first=8216 second=196 amount=-2 kerning first=8216 second=195 amount=-2 kerning first=8216 second=194 amount=-2 kerning first=8216 second=193 amount=-2 kerning first=67 second=8217 amount=1 kerning first=67 second=8221 amount=1 kerning first=8216 second=192 amount=-2 kerning first=68 second=89 amount=-1 kerning first=68 second=221 amount=-1 kerning first=68 second=374 amount=-1 kerning first=68 second=376 amount=-1 kerning first=68 second=562 amount=-1 kerning first=8216 second=89 amount=1 kerning first=8216 second=74 amount=-1 kerning first=8216 second=65 amount=-2 kerning first=70 second=44 amount=-2 kerning first=8208 second=376 amount=-2 kerning first=70 second=46 amount=-2 kerning first=70 second=58 amount=-1 kerning first=70 second=59 amount=-1 kerning first=70 second=65 amount=-2 kerning first=70 second=97 amount=-1 kerning first=70 second=101 amount=-1 kerning first=70 second=111 amount=-1 kerning first=70 second=114 amount=-1 kerning first=70 second=117 amount=-1 kerning first=70 second=121 amount=-1 kerning first=70 second=192 amount=-2 kerning first=70 second=193 amount=-2 kerning first=70 second=194 amount=-2 kerning first=70 second=195 amount=-2 kerning first=70 second=196 amount=-2 kerning first=70 second=224 amount=-1 kerning first=70 second=225 amount=-1 kerning first=70 second=226 amount=-1 kerning first=70 second=227 amount=-1 kerning first=70 second=228 amount=-1 kerning first=70 second=229 amount=-1 kerning first=70 second=230 amount=-1 kerning first=70 second=232 amount=-1 kerning first=70 second=233 amount=-1 kerning first=70 second=234 amount=-1 kerning first=70 second=235 amount=-1 kerning first=70 second=242 amount=-1 kerning first=70 second=243 amount=-1 kerning first=70 second=244 amount=-1 kerning first=70 second=245 amount=-1 kerning first=70 second=246 amount=-1 kerning first=70 second=248 amount=-1 kerning first=70 second=249 amount=-1 kerning first=70 second=250 amount=-1 kerning first=70 second=251 amount=-1 kerning first=70 second=252 amount=-1 kerning first=70 second=253 amount=-1 kerning first=70 second=255 amount=-1 kerning first=70 second=256 amount=-2 kerning first=70 second=257 amount=-1 kerning first=70 second=258 amount=-2 kerning first=70 second=259 amount=-1 kerning first=70 second=260 amount=-2 kerning first=70 second=261 amount=-1 kerning first=70 second=275 amount=-1 kerning first=70 second=277 amount=-1 kerning first=70 second=279 amount=-1 kerning first=70 second=281 amount=-1 kerning first=70 second=283 amount=-1 kerning first=70 second=333 amount=-1 kerning first=70 second=335 amount=-1 kerning first=70 second=337 amount=-1 kerning first=70 second=339 amount=-1 kerning first=70 second=341 amount=-1 kerning first=70 second=343 amount=-1 kerning first=70 second=345 amount=-1 kerning first=70 second=361 amount=-1 kerning first=70 second=363 amount=-1 kerning first=70 second=365 amount=-1 kerning first=70 second=367 amount=-1 kerning first=70 second=369 amount=-1 kerning first=70 second=371 amount=-1 kerning first=70 second=375 amount=-1 kerning first=70 second=483 amount=-1 kerning first=70 second=491 amount=-1 kerning first=70 second=493 amount=-1 kerning first=70 second=559 amount=-1 kerning first=70 second=563 amount=-1 kerning first=8208 second=356 amount=-2 kerning first=8208 second=221 amount=-2 kerning first=70 second=8218 amount=-3 kerning first=70 second=8222 amount=-3 kerning first=8208 second=89 amount=-2 kerning first=8208 second=88 amount=-1 kerning first=8208 second=87 amount=-1 kerning first=8208 second=86 amount=-1 kerning first=8208 second=84 amount=-2 kerning first=75 second=45 amount=-1 kerning first=75 second=67 amount=-1 kerning first=75 second=79 amount=-1 kerning first=376 second=8222 amount=-2 kerning first=376 second=8218 amount=-3 kerning first=376 second=367 amount=-1 kerning first=376 second=339 amount=-1 kerning first=75 second=121 amount=-1 kerning first=75 second=199 amount=-1 kerning first=75 second=210 amount=-1 kerning first=75 second=211 amount=-1 kerning first=75 second=212 amount=-1 kerning first=75 second=213 amount=-1 kerning first=75 second=214 amount=-1 kerning first=376 second=338 amount=-1 kerning first=376 second=283 amount=-1 kerning first=376 second=268 amount=-1 kerning first=376 second=262 amount=-1 kerning first=376 second=252 amount=-1 kerning first=376 second=251 amount=-1 kerning first=376 second=250 amount=-1 kerning first=376 second=249 amount=-1 kerning first=376 second=248 amount=-1 kerning first=376 second=246 amount=-1 kerning first=376 second=245 amount=-1 kerning first=376 second=244 amount=-1 kerning first=376 second=243 amount=-1 kerning first=376 second=242 amount=-1 kerning first=376 second=235 amount=-1 kerning first=376 second=234 amount=-1 kerning first=376 second=233 amount=-1 kerning first=376 second=232 amount=-1 kerning first=376 second=230 amount=-1 kerning first=75 second=253 amount=-1 kerning first=75 second=255 amount=-1 kerning first=75 second=262 amount=-1 kerning first=75 second=268 amount=-1 kerning first=376 second=229 amount=-1 kerning first=75 second=338 amount=-1 kerning first=376 second=228 amount=-1 kerning first=376 second=227 amount=-1 kerning first=376 second=226 amount=-1 kerning first=376 second=225 amount=-1 kerning first=376 second=224 amount=-1 kerning first=76 second=79 amount=-1 kerning first=76 second=84 amount=-3 kerning first=76 second=85 amount=-1 kerning first=76 second=86 amount=-2 kerning first=76 second=87 amount=-1 kerning first=76 second=89 amount=-2 kerning first=76 second=121 amount=-1 kerning first=76 second=210 amount=-1 kerning first=76 second=211 amount=-1 kerning first=76 second=212 amount=-1 kerning first=76 second=213 amount=-1 kerning first=76 second=214 amount=-1 kerning first=76 second=216 amount=-1 kerning first=76 second=217 amount=-1 kerning first=76 second=218 amount=-1 kerning first=76 second=219 amount=-1 kerning first=76 second=220 amount=-1 kerning first=76 second=221 amount=-2 kerning first=76 second=253 amount=-1 kerning first=76 second=255 amount=-1 kerning first=76 second=338 amount=-1 kerning first=76 second=356 amount=-3 kerning first=76 second=366 amount=-1 kerning first=76 second=376 amount=-2 kerning first=76 second=8217 amount=-4 kerning first=76 second=8221 amount=-4 kerning first=376 second=214 amount=-1 kerning first=376 second=213 amount=-1 kerning first=376 second=212 amount=-1 kerning first=376 second=211 amount=-1 kerning first=376 second=210 amount=-1 kerning first=79 second=88 amount=-1 kerning first=79 second=89 amount=-1 kerning first=376 second=199 amount=-1 kerning first=376 second=196 amount=-1 kerning first=376 second=195 amount=-1 kerning first=376 second=194 amount=-1 kerning first=376 second=193 amount=-1 kerning first=79 second=221 amount=-1 kerning first=79 second=376 amount=-1 kerning first=80 second=44 amount=-3 kerning first=376 second=192 amount=-1 kerning first=80 second=46 amount=-3 kerning first=80 second=65 amount=-1 kerning first=376 second=117 amount=-1 kerning first=376 second=111 amount=-1 kerning first=376 second=101 amount=-1 kerning first=80 second=192 amount=-1 kerning first=80 second=193 amount=-1 kerning first=80 second=194 amount=-1 kerning first=80 second=195 amount=-1 kerning first=80 second=196 amount=-1 kerning first=376 second=97 amount=-1 kerning first=376 second=79 amount=-1 kerning first=376 second=67 amount=-1 kerning first=376 second=65 amount=-1 kerning first=376 second=59 amount=-1 kerning first=376 second=58 amount=-1 kerning first=376 second=46 amount=-3 kerning first=376 second=45 amount=-2 kerning first=376 second=44 amount=-3 kerning first=356 second=8222 amount=-2 kerning first=356 second=8218 amount=-2 kerning first=356 second=367 amount=-2 kerning first=80 second=8218 amount=-3 kerning first=356 second=353 amount=-2 kerning first=80 second=8222 amount=-3 kerning first=356 second=351 amount=-2 kerning first=356 second=345 amount=-2 kerning first=356 second=341 amount=-2 kerning first=82 second=84 amount=-1 kerning first=82 second=89 amount=-1 kerning first=82 second=121 amount=-1 kerning first=82 second=221 amount=-1 kerning first=82 second=253 amount=-1 kerning first=82 second=255 amount=-1 kerning first=82 second=356 amount=-1 kerning first=82 second=376 amount=-1 kerning first=83 second=83 amount=-1 kerning first=83 second=350 amount=-1 kerning first=83 second=352 amount=-1 kerning first=84 second=44 amount=-2 kerning first=84 second=45 amount=-2 kerning first=84 second=46 amount=-2 kerning first=84 second=58 amount=-1 kerning first=84 second=59 amount=-1 kerning first=84 second=65 amount=-1 kerning first=356 second=339 amount=-1 kerning first=84 second=97 amount=-2 kerning first=84 second=99 amount=-2 kerning first=84 second=101 amount=-2 kerning first=84 second=111 amount=-2 kerning first=84 second=114 amount=-2 kerning first=84 second=115 amount=-2 kerning first=84 second=117 amount=-2 kerning first=84 second=119 amount=-2 kerning first=84 second=121 amount=-2 kerning first=84 second=192 amount=-1 kerning first=84 second=193 amount=-1 kerning first=84 second=194 amount=-1 kerning first=84 second=195 amount=-1 kerning first=84 second=196 amount=-1 kerning first=84 second=224 amount=-1 kerning first=84 second=225 amount=-2 kerning first=84 second=226 amount=-1 kerning first=84 second=227 amount=-1 kerning first=84 second=228 amount=-1 kerning first=84 second=229 amount=-1 kerning first=84 second=230 amount=-1 kerning first=84 second=231 amount=-2 kerning first=84 second=232 amount=-2 kerning first=84 second=233 amount=-2 kerning first=84 second=234 amount=-2 kerning first=84 second=235 amount=-2 kerning first=84 second=242 amount=-1 kerning first=84 second=243 amount=-2 kerning first=84 second=244 amount=-1 kerning first=84 second=245 amount=-1 kerning first=84 second=246 amount=-1 kerning first=84 second=248 amount=-1 kerning first=84 second=249 amount=-1 kerning first=84 second=250 amount=-2 kerning first=84 second=251 amount=-1 kerning first=84 second=252 amount=-1 kerning first=84 second=253 amount=-2 kerning first=84 second=255 amount=-2 kerning first=84 second=263 amount=-2 kerning first=84 second=269 amount=-2 kerning first=84 second=283 amount=-2 kerning first=84 second=339 amount=-1 kerning first=84 second=341 amount=-2 kerning first=84 second=345 amount=-2 kerning first=84 second=351 amount=-2 kerning first=84 second=353 amount=-2 kerning first=84 second=367 amount=-2 kerning first=84 second=8218 amount=-2 kerning first=84 second=8222 amount=-2 kerning first=356 second=283 amount=-2 kerning first=356 second=269 amount=-2 kerning first=356 second=263 amount=-2 kerning first=356 second=255 amount=-2 kerning first=356 second=253 amount=-2 kerning first=356 second=252 amount=-2 kerning first=86 second=44 amount=-2 kerning first=86 second=45 amount=-1 kerning first=86 second=46 amount=-2 kerning first=86 second=58 amount=-1 kerning first=86 second=59 amount=-1 kerning first=86 second=65 amount=-1 kerning first=356 second=251 amount=-2 kerning first=86 second=97 amount=-1 kerning first=86 second=101 amount=-1 kerning first=356 second=250 amount=-2 kerning first=86 second=111 amount=-1 kerning first=86 second=117 amount=-1 kerning first=86 second=192 amount=-1 kerning first=86 second=193 amount=-1 kerning first=86 second=194 amount=-1 kerning first=86 second=195 amount=-1 kerning first=86 second=196 amount=-1 kerning first=356 second=249 amount=-2 kerning first=356 second=248 amount=-1 kerning first=356 second=246 amount=-2 kerning first=356 second=245 amount=-2 kerning first=356 second=244 amount=-2 kerning first=356 second=243 amount=-2 kerning first=86 second=224 amount=-1 kerning first=86 second=225 amount=-1 kerning first=86 second=226 amount=-1 kerning first=86 second=227 amount=-1 kerning first=86 second=228 amount=-1 kerning first=86 second=229 amount=-1 kerning first=86 second=230 amount=-1 kerning first=86 second=232 amount=-1 kerning first=86 second=233 amount=-1 kerning first=86 second=234 amount=-1 kerning first=86 second=235 amount=-1 kerning first=86 second=242 amount=-1 kerning first=86 second=243 amount=-1 kerning first=86 second=244 amount=-1 kerning first=86 second=245 amount=-1 kerning first=86 second=246 amount=-1 kerning first=86 second=248 amount=-1 kerning first=86 second=249 amount=-1 kerning first=86 second=250 amount=-1 kerning first=86 second=251 amount=-1 kerning first=86 second=252 amount=-1 kerning first=86 second=283 amount=-1 kerning first=356 second=242 amount=-2 kerning first=86 second=339 amount=-1 kerning first=86 second=367 amount=-1 kerning first=86 second=8218 amount=-2 kerning first=86 second=8222 amount=-1 kerning first=87 second=44 amount=-1 kerning first=87 second=45 amount=-1 kerning first=87 second=46 amount=-1 kerning first=356 second=235 amount=-2 kerning first=356 second=234 amount=-2 kerning first=87 second=65 amount=-1 kerning first=87 second=97 amount=-1 kerning first=87 second=101 amount=-1 kerning first=87 second=111 amount=-1 kerning first=356 second=233 amount=-2 kerning first=87 second=192 amount=-1 kerning first=87 second=193 amount=-1 kerning first=87 second=194 amount=-1 kerning first=87 second=195 amount=-1 kerning first=87 second=196 amount=-1 kerning first=87 second=224 amount=-1 kerning first=87 second=225 amount=-1 kerning first=87 second=226 amount=-1 kerning first=87 second=227 amount=-1 kerning first=87 second=228 amount=-1 kerning first=87 second=229 amount=-1 kerning first=87 second=230 amount=-1 kerning first=87 second=232 amount=-1 kerning first=87 second=233 amount=-1 kerning first=87 second=234 amount=-1 kerning first=87 second=235 amount=-1 kerning first=87 second=242 amount=-1 kerning first=87 second=243 amount=-1 kerning first=87 second=244 amount=-1 kerning first=87 second=245 amount=-1 kerning first=87 second=246 amount=-1 kerning first=87 second=248 amount=-1 kerning first=87 second=283 amount=-1 kerning first=87 second=339 amount=-1 kerning first=356 second=232 amount=-2 kerning first=356 second=231 amount=-2 kerning first=88 second=45 amount=-1 kerning first=88 second=67 amount=-1 kerning first=88 second=79 amount=-1 kerning first=356 second=230 amount=-1 kerning first=88 second=199 amount=-1 kerning first=88 second=210 amount=-1 kerning first=88 second=211 amount=-1 kerning first=88 second=212 amount=-1 kerning first=88 second=213 amount=-1 kerning first=88 second=214 amount=-1 kerning first=88 second=216 amount=-1 kerning first=356 second=229 amount=-2 kerning first=356 second=228 amount=-2 kerning first=356 second=227 amount=-2 kerning first=356 second=226 amount=-2 kerning first=88 second=262 amount=-1 kerning first=88 second=268 amount=-1 kerning first=356 second=225 amount=-2 kerning first=88 second=338 amount=-1 kerning first=356 second=224 amount=-2 kerning first=356 second=196 amount=-1 kerning first=89 second=44 amount=-3 kerning first=89 second=45 amount=-2 kerning first=89 second=46 amount=-3 kerning first=89 second=58 amount=-1 kerning first=89 second=59 amount=-1 kerning first=89 second=65 amount=-1 kerning first=89 second=67 amount=-1 kerning first=89 second=79 amount=-1 kerning first=89 second=97 amount=-1 kerning first=89 second=101 amount=-1 kerning first=89 second=111 amount=-1 kerning first=89 second=117 amount=-1 kerning first=89 second=192 amount=-1 kerning first=89 second=193 amount=-1 kerning first=89 second=194 amount=-1 kerning first=89 second=195 amount=-1 kerning first=89 second=196 amount=-1 kerning first=89 second=199 amount=-1 kerning first=89 second=210 amount=-1 kerning first=89 second=211 amount=-1 kerning first=89 second=212 amount=-1 kerning first=89 second=213 amount=-1 kerning first=89 second=214 amount=-1 kerning first=356 second=195 amount=-1 kerning first=89 second=224 amount=-1 kerning first=89 second=225 amount=-1 kerning first=89 second=226 amount=-1 kerning first=89 second=227 amount=-1 kerning first=89 second=228 amount=-1 kerning first=89 second=229 amount=-1 kerning first=89 second=230 amount=-1 kerning first=89 second=232 amount=-1 kerning first=89 second=233 amount=-1 kerning first=89 second=234 amount=-1 kerning first=89 second=235 amount=-1 kerning first=89 second=242 amount=-1 kerning first=89 second=243 amount=-1 kerning first=89 second=244 amount=-1 kerning first=89 second=245 amount=-1 kerning first=89 second=246 amount=-1 kerning first=89 second=248 amount=-1 kerning first=89 second=249 amount=-1 kerning first=89 second=250 amount=-1 kerning first=89 second=251 amount=-1 kerning first=89 second=252 amount=-1 kerning first=89 second=262 amount=-1 kerning first=89 second=268 amount=-1 kerning first=89 second=283 amount=-1 kerning first=89 second=338 amount=-1 kerning first=89 second=339 amount=-1 kerning first=89 second=367 amount=-1 kerning first=89 second=8218 amount=-3 kerning first=89 second=8222 amount=-2 kerning first=356 second=194 amount=-1 kerning first=356 second=193 amount=-1 kerning first=356 second=192 amount=-1 kerning first=356 second=121 amount=-2 kerning first=102 second=44 amount=-1 kerning first=356 second=119 amount=-2 kerning first=102 second=46 amount=-1 kerning first=102 second=8217 amount=1 kerning first=102 second=8221 amount=1 kerning first=356 second=117 amount=-2 kerning first=356 second=115 amount=-2 kerning first=356 second=114 amount=-2 kerning first=356 second=111 amount=-2 kerning first=356 second=101 amount=-2 kerning first=356 second=99 amount=-2 kerning first=356 second=97 amount=-2 kerning first=356 second=65 amount=-1 kerning first=356 second=59 amount=-1 kerning first=356 second=58 amount=-1 kerning first=356 second=46 amount=-2 kerning first=356 second=45 amount=-2 kerning first=356 second=44 amount=-2 kerning first=352 second=352 amount=-1 kerning first=114 second=44 amount=-2 kerning first=114 second=46 amount=-2 kerning first=114 second=8217 amount=1 kerning first=352 second=350 amount=-1 kerning first=118 second=44 amount=-1 kerning first=118 second=46 amount=-1 kerning first=119 second=44 amount=-1 kerning first=119 second=46 amount=-1 kerning first=121 second=44 amount=-1 kerning first=121 second=46 amount=-1 kerning first=352 second=83 amount=-1 kerning first=350 second=352 amount=-1 kerning first=350 second=350 amount=-1 kerning first=350 second=83 amount=-1 kerning first=192 second=84 amount=-1 kerning first=345 second=8217 amount=1 kerning first=192 second=86 amount=-1 kerning first=192 second=87 amount=-1 kerning first=192 second=89 amount=-1 kerning first=192 second=118 amount=-1 kerning first=192 second=121 amount=-1 kerning first=345 second=46 amount=-2 kerning first=345 second=44 amount=-2 kerning first=344 second=376 amount=-1 kerning first=344 second=356 amount=-1 kerning first=192 second=221 amount=-1 kerning first=192 second=253 amount=-1 kerning first=192 second=255 amount=-1 kerning first=192 second=354 amount=-1 kerning first=192 second=356 amount=-1 kerning first=344 second=255 amount=-1 kerning first=344 second=253 amount=-1 kerning first=344 second=221 amount=-1 kerning first=344 second=121 amount=-1 kerning first=344 second=89 amount=-1 kerning first=192 second=372 amount=-1 kerning first=192 second=374 amount=-1 kerning first=192 second=375 amount=-1 kerning first=192 second=376 amount=-1 kerning first=192 second=538 amount=-1 kerning first=192 second=562 amount=-1 kerning first=192 second=563 amount=-1 kerning first=344 second=84 amount=-1 kerning first=341 second=8217 amount=1 kerning first=341 second=46 amount=-2 kerning first=341 second=44 amount=-2 kerning first=192 second=8217 amount=-1 kerning first=192 second=8218 amount=1 kerning first=192 second=8221 amount=-1 kerning first=192 second=8222 amount=1 kerning first=340 second=376 amount=-1 kerning first=340 second=356 amount=-1 kerning first=340 second=255 amount=-1 kerning first=340 second=253 amount=-1 kerning first=193 second=84 amount=-1 kerning first=340 second=221 amount=-1 kerning first=193 second=86 amount=-1 kerning first=193 second=87 amount=-1 kerning first=193 second=89 amount=-1 kerning first=193 second=118 amount=-1 kerning first=193 second=121 amount=-1 kerning first=340 second=121 amount=-1 kerning first=340 second=89 amount=-1 kerning first=340 second=84 amount=-1 kerning first=321 second=8221 amount=-3 kerning first=193 second=221 amount=-1 kerning first=193 second=253 amount=-1 kerning first=193 second=255 amount=-1 kerning first=193 second=354 amount=-1 kerning first=193 second=356 amount=-1 kerning first=321 second=8217 amount=-3 kerning first=321 second=376 amount=-2 kerning first=321 second=366 amount=-1 kerning first=321 second=356 amount=-3 kerning first=321 second=338 amount=-1 kerning first=193 second=372 amount=-1 kerning first=193 second=374 amount=-1 kerning first=193 second=375 amount=-1 kerning first=193 second=376 amount=-1 kerning first=193 second=538 amount=-1 kerning first=193 second=562 amount=-1 kerning first=193 second=563 amount=-1 kerning first=321 second=255 amount=-1 kerning first=321 second=253 amount=-1 kerning first=321 second=221 amount=-2 kerning first=321 second=220 amount=-1 kerning first=193 second=8217 amount=-1 kerning first=193 second=8218 amount=1 kerning first=193 second=8221 amount=-1 kerning first=193 second=8222 amount=1 kerning first=321 second=219 amount=-1 kerning first=321 second=218 amount=-1 kerning first=321 second=217 amount=-1 kerning first=321 second=216 amount=-1 kerning first=194 second=84 amount=-1 kerning first=321 second=214 amount=-1 kerning first=194 second=86 amount=-1 kerning first=194 second=87 amount=-1 kerning first=194 second=89 amount=-1 kerning first=194 second=118 amount=-1 kerning first=194 second=121 amount=-1 kerning first=321 second=213 amount=-1 kerning first=321 second=212 amount=-1 kerning first=321 second=211 amount=-1 kerning first=321 second=210 amount=-1 kerning first=194 second=221 amount=-1 kerning first=194 second=253 amount=-1 kerning first=194 second=255 amount=-1 kerning first=194 second=354 amount=-1 kerning first=194 second=356 amount=-1 kerning first=321 second=121 amount=-1 kerning first=321 second=89 amount=-2 kerning first=321 second=87 amount=-1 kerning first=321 second=86 amount=-2 kerning first=321 second=85 amount=-1 kerning first=194 second=372 amount=-1 kerning first=194 second=374 amount=-1 kerning first=194 second=375 amount=-1 kerning first=194 second=376 amount=-1 kerning first=194 second=538 amount=-1 kerning first=194 second=562 amount=-1 kerning first=194 second=563 amount=-1 kerning first=321 second=84 amount=-3 kerning first=321 second=79 amount=-1 kerning first=320 second=108 amount=-2 kerning first=317 second=8221 amount=-4 kerning first=194 second=8217 amount=-1 kerning first=194 second=8218 amount=1 kerning first=194 second=8221 amount=-1 kerning first=194 second=8222 amount=1 kerning first=317 second=8217 amount=-4 kerning first=317 second=376 amount=-2 kerning first=317 second=366 amount=-1 kerning first=317 second=356 amount=-3 kerning first=195 second=84 amount=-1 kerning first=317 second=338 amount=-1 kerning first=195 second=86 amount=-1 kerning first=195 second=87 amount=-1 kerning first=195 second=89 amount=-1 kerning first=195 second=118 amount=-1 kerning first=195 second=121 amount=-1 kerning first=317 second=255 amount=-1 kerning first=317 second=253 amount=-1 kerning first=317 second=221 amount=-2 kerning first=317 second=220 amount=-1 kerning first=195 second=221 amount=-1 kerning first=195 second=253 amount=-1 kerning first=195 second=255 amount=-1 kerning first=195 second=354 amount=-1 kerning first=195 second=356 amount=-1 kerning first=317 second=219 amount=-1 kerning first=317 second=218 amount=-1 kerning first=317 second=217 amount=-1 kerning first=317 second=216 amount=-1 kerning first=317 second=214 amount=-1 kerning first=195 second=372 amount=-1 kerning first=195 second=374 amount=-1 kerning first=195 second=375 amount=-1 kerning first=195 second=376 amount=-1 kerning first=195 second=538 amount=-1 kerning first=195 second=562 amount=-1 kerning first=195 second=563 amount=-1 kerning first=317 second=213 amount=-1 kerning first=317 second=212 amount=-1 kerning first=317 second=211 amount=-1 kerning first=317 second=210 amount=-1 kerning first=195 second=8217 amount=-1 kerning first=195 second=8218 amount=1 kerning first=195 second=8221 amount=-1 kerning first=195 second=8222 amount=1 kerning first=317 second=121 amount=-1 kerning first=317 second=89 amount=-2 kerning first=317 second=87 amount=-1 kerning first=317 second=86 amount=-2 kerning first=196 second=84 amount=-1 kerning first=317 second=85 amount=-1 kerning first=196 second=86 amount=-1 kerning first=196 second=87 amount=-1 kerning first=196 second=89 amount=-1 kerning first=196 second=118 amount=-1 kerning first=196 second=121 amount=-1 kerning first=317 second=84 amount=-3 kerning first=317 second=79 amount=-1 kerning first=313 second=8221 amount=-4 kerning first=313 second=8217 amount=-4 kerning first=196 second=221 amount=-1 kerning first=196 second=253 amount=-1 kerning first=196 second=255 amount=-1 kerning first=196 second=354 amount=-1 kerning first=196 second=356 amount=-1 kerning first=313 second=376 amount=-2 kerning first=313 second=366 amount=-1 kerning first=313 second=356 amount=-3 kerning first=313 second=338 amount=-1 kerning first=313 second=255 amount=-1 kerning first=196 second=372 amount=-1 kerning first=196 second=374 amount=-1 kerning first=196 second=375 amount=-1 kerning first=196 second=376 amount=-1 kerning first=196 second=538 amount=-1 kerning first=196 second=562 amount=-1 kerning first=196 second=563 amount=-1 kerning first=313 second=253 amount=-1 kerning first=313 second=221 amount=-2 kerning first=313 second=220 amount=-1 kerning first=313 second=219 amount=-1 kerning first=196 second=8217 amount=-1 kerning first=196 second=8218 amount=1 kerning first=196 second=8221 amount=-1 kerning first=196 second=8222 amount=1 kerning first=313 second=218 amount=-1 kerning first=313 second=217 amount=-1 kerning first=313 second=216 amount=-1 kerning first=313 second=214 amount=-1 kerning first=313 second=213 amount=-1 kerning first=313 second=212 amount=-1 kerning first=313 second=211 amount=-1 kerning first=313 second=210 amount=-1 kerning first=199 second=8217 amount=1 kerning first=199 second=8221 amount=1 kerning first=313 second=121 amount=-1 kerning first=208 second=89 amount=-1 kerning first=208 second=221 amount=-1 kerning first=208 second=374 amount=-1 kerning first=208 second=376 amount=-1 kerning first=208 second=562 amount=-1 kerning first=313 second=89 amount=-2 kerning first=313 second=87 amount=-1 kerning first=313 second=86 amount=-2 kerning first=313 second=85 amount=-1 kerning first=313 second=84 amount=-3 kerning first=313 second=79 amount=-1 kerning first=272 second=562 amount=-1 kerning first=272 second=376 amount=-1 kerning first=210 second=88 amount=-1 kerning first=210 second=89 amount=-1 kerning first=272 second=374 amount=-1 kerning first=272 second=221 amount=-1 kerning first=272 second=89 amount=-1 kerning first=270 second=562 amount=-1 kerning first=270 second=376 amount=-1 kerning first=210 second=221 amount=-1 kerning first=210 second=376 amount=-1 kerning first=270 second=374 amount=-1 kerning first=270 second=221 amount=-1 kerning first=270 second=89 amount=-1 kerning first=268 second=8221 amount=1 kerning first=268 second=8217 amount=1 kerning first=211 second=88 amount=-1 kerning first=211 second=89 amount=-1 kerning first=266 second=8221 amount=1 kerning first=266 second=8217 amount=1 kerning first=264 second=8221 amount=1 kerning first=264 second=8217 amount=1 kerning first=262 second=8221 amount=1 kerning first=211 second=221 amount=-1 kerning first=211 second=376 amount=-1 kerning first=262 second=8217 amount=1 kerning first=260 second=8222 amount=1 kerning first=260 second=8221 amount=-1 kerning first=260 second=8218 amount=1 kerning first=260 second=8217 amount=-1 kerning first=212 second=88 amount=-1 kerning first=212 second=89 amount=-1 kerning first=260 second=563 amount=-1 kerning first=260 second=562 amount=-1 kerning first=260 second=538 amount=-1 kerning first=260 second=376 amount=-1 kerning first=260 second=375 amount=-1 kerning first=212 second=221 amount=-1 kerning first=212 second=376 amount=-1 kerning first=260 second=374 amount=-1 kerning first=260 second=372 amount=-1 kerning first=260 second=356 amount=-1 kerning first=260 second=354 amount=-1 kerning first=260 second=255 amount=-1 kerning first=213 second=88 amount=-1 kerning first=213 second=89 amount=-1 kerning first=260 second=253 amount=-1 kerning first=260 second=221 amount=-1 kerning first=260 second=121 amount=-1 kerning first=260 second=118 amount=-1 kerning first=260 second=89 amount=-1 kerning first=213 second=221 amount=-1 kerning first=213 second=376 amount=-1 kerning first=260 second=87 amount=-1 kerning first=260 second=86 amount=-1 kerning first=260 second=84 amount=-1 kerning first=258 second=8222 amount=1 kerning first=258 second=8221 amount=-1 kerning first=214 second=88 amount=-1 kerning first=214 second=89 amount=-1 kerning first=258 second=8218 amount=1 kerning first=258 second=8217 amount=-1 kerning first=258 second=563 amount=-1 kerning first=258 second=562 amount=-1 kerning first=258 second=538 amount=-1 kerning first=214 second=221 amount=-1 kerning first=214 second=376 amount=-1 kerning first=258 second=376 amount=-1 kerning first=258 second=375 amount=-1 kerning first=258 second=374 amount=-1 kerning first=258 second=372 amount=-1 kerning first=258 second=356 amount=-1 kerning first=216 second=88 amount=-1 kerning first=258 second=354 amount=-1 kerning first=258 second=255 amount=-1 kerning first=258 second=253 amount=-1 kerning first=258 second=221 amount=-1 kerning first=258 second=121 amount=-1 kerning first=258 second=118 amount=-1 kerning first=258 second=89 amount=-1 kerning first=258 second=87 amount=-1 kerning first=258 second=86 amount=-1 kerning first=258 second=84 amount=-1 kerning first=256 second=8222 amount=1 kerning first=256 second=8221 amount=-1 kerning first=256 second=8218 amount=1 kerning first=256 second=8217 amount=-1 kerning first=256 second=563 amount=-1 kerning first=256 second=562 amount=-1 kerning first=256 second=538 amount=-1 kerning first=256 second=376 amount=-1 kerning first=256 second=375 amount=-1 kerning first=256 second=374 amount=-1 kerning first=256 second=372 amount=-1 kerning first=256 second=356 amount=-1 kerning first=256 second=354 amount=-1 kerning first=256 second=255 amount=-1 kerning first=256 second=253 amount=-1 kerning first=256 second=221 amount=-1 kerning first=256 second=121 amount=-1 kerning first=256 second=118 amount=-1 kerning first=256 second=89 amount=-1 kerning first=256 second=87 amount=-1 kerning first=256 second=86 amount=-1 kerning first=256 second=84 amount=-1 kerning first=221 second=44 amount=-3 kerning first=221 second=45 amount=-2 kerning first=221 second=46 amount=-3 kerning first=221 second=58 amount=-1 kerning first=221 second=59 amount=-1 kerning first=221 second=65 amount=-1 kerning first=221 second=67 amount=-1 kerning first=221 second=79 amount=-1 kerning first=221 second=97 amount=-1 kerning first=221 second=101 amount=-1 kerning first=221 second=111 amount=-1 kerning first=221 second=117 amount=-1 kerning first=221 second=192 amount=-1 kerning first=221 second=193 amount=-1 kerning first=221 second=194 amount=-1 kerning first=221 second=195 amount=-1 kerning first=221 second=196 amount=-1 kerning first=221 second=199 amount=-1 kerning first=221 second=210 amount=-1 kerning first=221 second=211 amount=-1 kerning first=221 second=212 amount=-1 kerning first=221 second=213 amount=-1 kerning first=221 second=214 amount=-1 kerning first=255 second=46 amount=-1 kerning first=221 second=224 amount=-1 kerning first=221 second=225 amount=-1 kerning first=221 second=226 amount=-1 kerning first=221 second=227 amount=-1 kerning first=221 second=228 amount=-1 kerning first=221 second=229 amount=-1 kerning first=221 second=230 amount=-1 kerning first=221 second=232 amount=-1 kerning first=221 second=233 amount=-1 kerning first=221 second=234 amount=-1 kerning first=221 second=235 amount=-1 kerning first=221 second=242 amount=-1 kerning first=221 second=243 amount=-1 kerning first=221 second=244 amount=-1 kerning first=221 second=245 amount=-1 kerning first=221 second=246 amount=-1 kerning first=221 second=248 amount=-1 kerning first=221 second=249 amount=-1 kerning first=221 second=250 amount=-1 kerning first=221 second=251 amount=-1 kerning first=221 second=252 amount=-1 kerning first=221 second=262 amount=-1 kerning first=221 second=268 amount=-1 kerning first=221 second=283 amount=-1 kerning first=221 second=338 amount=-1 kerning first=221 second=339 amount=-1 kerning first=221 second=367 amount=-1 kerning first=221 second=8218 amount=-3 kerning first=221 second=8222 amount=-2 kerning first=255 second=44 amount=-1 kerning first=253 second=46 amount=-1 kerning first=253 second=44 amount=-1 |
Added ext/fontstash/bin/dejavu-sans_0.png.
cannot compute difference between binary files
Added ext/fontstash/bin/fontstash.
cannot compute difference between binary files
Added ext/fontstash/example.ex.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
// // Copyright (c) 2011 Andreas Krinke andreas.krinke@gmx.de // Copyright (c) 2009 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. // #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include "SDL.h" #include "SDL_image.h" #ifdef __MACOSX__ #include "SDL_Opengl.h" #else #include "SDL_opengl.h" #endif #include "fontstash.h" int main(int argc, char *argv[]) { int done; SDL_Event event; SDL_Surface* screen; int width, height; struct sth_stash* stash = 0; FILE* fp = 0; int datasize; unsigned char* data; float sx,sy,dx,dy,lh; int droidRegular, droidItalic, droidBold, droidJapanese, dejavu; SDL_Surface* surface; GLuint texture; if (SDL_Init(SDL_INIT_EVERYTHING) < 0) { fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); return -1; } // Init OpenGL SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); width = 800; height = 600; screen = SDL_SetVideoMode(width, height, 0, SDL_OPENGL); if (!screen) { fprintf(stderr, "Could not initialise SDL opengl\n"); return -1; } SDL_WM_SetCaption("FontStash Demo", 0); stash = sth_create(512,512); if (!stash) { fprintf(stderr, "Could not create stash.\n"); return -1; } // Load the first truetype font from memory (just because we can). fp = fopen("DroidSerif-Regular.ttf", "rb"); if (!fp) goto error_add_font; fseek(fp, 0, SEEK_END); datasize = (int)ftell(fp); fseek(fp, 0, SEEK_SET); data = (unsigned char*)malloc(datasize); if (data == NULL) goto error_add_font; fread(data, 1, datasize, fp); fclose(fp); fp = 0; if (!(droidRegular = sth_add_font_from_memory(stash, data))) goto error_add_font; // Load the remaining truetype fonts directly. if (!(droidItalic = sth_add_font(stash,"DroidSerif-Italic.ttf"))) goto error_add_font; if (!(droidBold = sth_add_font(stash,"DroidSerif-Bold.ttf"))) goto error_add_font; if (!(droidJapanese = sth_add_font(stash,"DroidSansJapanese.ttf"))) goto error_add_font; // Load a bitmap font surface = IMG_Load("dejavu-sans_0.png"); if (surface == NULL) { fprintf(stderr, "%s.\n", IMG_GetError()); return -1; } glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); if (SDL_MUSTLOCK(surface)) SDL_LockSurface(surface); glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA8, surface->w, surface->h, 0, GL_ALPHA, GL_UNSIGNED_BYTE, surface->pixels); if (SDL_MUSTLOCK(surface)) SDL_UnlockSurface(surface); SDL_FreeSurface(surface); dejavu = sth_add_bitmap_font(stash, 17, -4, 2); sth_add_glyph_for_char(stash, dejavu, texture, "T", 18, 14, 363, 331, 10, 11, 0, 3, 10); sth_add_glyph_for_char(stash, dejavu, texture, "h", 18, 14, 225, 382, 8, 11, 1, 3, 10); sth_add_glyph_for_char(stash, dejavu, texture, "i", 18, 14, 478, 377, 2, 11, 1, 3, 4); sth_add_glyph_for_char(stash, dejavu, texture, "s", 18, 14, 199, 455, 7, 8, 1, 6, 9); sth_add_glyph_for_char(stash, dejavu, texture, " ", 18, 14, 66, 185, 1, 1, 0, 14, 5); sth_add_glyph_for_char(stash, dejavu, texture, "a", 18, 14, 18, 459, 8, 8, 1, 6, 10); sth_add_glyph_for_char(stash, dejavu, texture, "b", 18, 14, 198, 383, 8, 11, 1, 3, 10); sth_add_glyph_for_char(stash, dejavu, texture, "t", 18, 14, 436, 377, 5, 11, 1, 3, 6); sth_add_glyph_for_char(stash, dejavu, texture, "m", 18, 14, 494, 429, 12, 8, 2, 6, 16); sth_add_glyph_for_char(stash, dejavu, texture, "p", 18, 14, 436, 353, 8, 11, 1, 6, 10); sth_add_glyph_for_char(stash, dejavu, texture, "f", 18, 14, 442, 377, 5, 11, 1, 3, 7); sth_add_glyph_for_char(stash, dejavu, texture, "o", 18, 14, 483, 438, 8, 8, 1, 6, 10); sth_add_glyph_for_char(stash, dejavu, texture, "n", 18, 14, 0, 459, 8, 8, 1, 6, 10); sth_add_glyph_for_char(stash, dejavu, texture, ".", 18, 14, 285, 476, 2, 3, 1, 11, 6); done = 0; while (!done) { while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_MOUSEMOTION: break; case SDL_MOUSEBUTTONDOWN: break; case SDL_KEYDOWN: if (event.key.keysym.sym == SDLK_ESCAPE) done = 1; break; case SDL_QUIT: done = 1; break; default: break; } } // Update and render glViewport(0, 0, width, height); glClearColor(0.3f, 0.3f, 0.32f, 1.0f); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable(GL_TEXTURE_2D); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0,width,0,height,-1,1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glDisable(GL_DEPTH_TEST); glColor4ub(255,255,255,255); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); sx = 100; sy = 250; sth_begin_draw(stash); dx = sx; dy = sy; sth_draw_text(stash, droidRegular, 24.0f, dx, dy, "The quick ", &dx); sth_draw_text(stash, droidItalic, 48.0f, dx, dy, "brown ", &dx); sth_draw_text(stash, droidRegular, 24.0f, dx, dy, "fox ", &dx); sth_vmetrics(stash, droidItalic, 24, NULL, NULL, &lh); dx = sx; dy -= lh*1.2f; sth_draw_text(stash, droidItalic, 24.0f, dx, dy, "jumps over ", &dx); sth_draw_text(stash, droidBold, 24.0f, dx, dy, "the lazy ", &dx); sth_draw_text(stash, droidRegular, 24.0f, dx, dy, "dog.", &dx); dx = sx; dy -= lh*1.2f; sth_draw_text(stash, droidRegular, 12.0f, dx, dy, "Now is the time for all good men to come to the aid of the party.", &dx); sth_vmetrics(stash, droidItalic, 12, NULL, NULL, &lh); dx = sx; dy -= lh*1.2f*2; sth_draw_text(stash, droidItalic, 18.0f, dx, dy, "Ég get etið gler án þess að meiða mig.", &dx); sth_vmetrics(stash, droidItalic, 18, NULL, NULL, &lh); dx = sx; dy -= lh*1.2f; sth_draw_text(stash, droidJapanese, 18.0f, dx, dy, "私はガラスを食べられます。それは私を傷つけません。", &dx); dx = sx; dy -= lh*1.2f*2; sth_draw_text(stash, dejavu, 18.0f, dx, dy, "This is a bitmap font.", &dx); sth_end_draw(stash); glEnable(GL_DEPTH_TEST); SDL_GL_SwapBuffers(); } sth_delete(stash); free(data); SDL_Quit(); return 0; error_add_font: fprintf(stderr, "Could not add font.\n"); return -1; } |
Added ext/fontstash/fontstash.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 |
// // Copyright (c) 2011-2013 Andreas Krinke andreas.krinke@gmx.de // Copyright (c) 2009 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. // #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> /* @rlyeh: floorf() */ #include <GL/glew.h> /* @rlyeh: before including GL. doesnt hurt and makes life better */ #ifdef __MACOSX__ #include <OpenGL/gl.h> #else #include <GL/gl.h> #endif /* @rlyeh: removed STB_TRUETYPE_IMPLENTATION. We link it externally */ #include "stb_truetype.h" #include "fontstash.h" #define HASH_LUT_SIZE 256 #define MAX_ROWS 128 #define VERT_COUNT (6*128) #define VERT_STRIDE (sizeof(float)*4) #define TTFONT_FILE 1 #define TTFONT_MEM 2 #define BMFONT 3 static int idx = 1; static unsigned int hashint(unsigned int a) { a += ~(a<<15); a ^= (a>>10); a += (a<<3); a ^= (a>>6); a += ~(a<<11); a ^= (a>>16); return a; } struct sth_quad { float x0,y0,s0,t0; float x1,y1,s1,t1; }; struct sth_row { short x,y,h; }; struct sth_glyph { unsigned int codepoint; short size; struct sth_texture* texture; int x0,y0,x1,y1; float xadv,xoff,yoff; int next; }; struct sth_font { int idx; int type; stbtt_fontinfo font; unsigned char* data; struct sth_glyph* glyphs; int lut[HASH_LUT_SIZE]; int nglyphs; float ascender; float descender; float lineh; struct sth_font* next; }; struct sth_texture { GLuint id; // TODO: replace rows with pointer struct sth_row rows[MAX_ROWS]; int nrows; float verts[4*VERT_COUNT]; int nverts; struct sth_texture* next; }; struct sth_stash { int tw,th; float itw,ith; GLubyte *empty_data; struct sth_texture* tt_textures; struct sth_texture* bm_textures; struct sth_font* fonts; int drawing; }; // Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de> // See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. #define UTF8_ACCEPT 0 #define UTF8_REJECT 1 static const unsigned char utf8d[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 00..1f 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 20..3f 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 40..5f 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 60..7f 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, // 80..9f 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, // a0..bf 8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // c0..df 0xa,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x4,0x3,0x3, // e0..ef 0xb,0x6,0x6,0x6,0x5,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, // f0..ff 0x0,0x1,0x2,0x3,0x5,0x8,0x7,0x1,0x1,0x1,0x4,0x6,0x1,0x1,0x1,0x1, // s0..s0 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1, // s1..s2 1,2,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1, // s3..s4 1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,3,1,1,1,1,1,1, // s5..s6 1,3,1,1,1,1,1,3,1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // s7..s8 }; static unsigned int decutf8(unsigned int* state, unsigned int* codep, unsigned int byte) { unsigned int type = utf8d[byte]; *codep = (*state != UTF8_ACCEPT) ? (byte & 0x3fu) | (*codep << 6) : (0xff >> type) & (byte); *state = utf8d[256 + *state*16 + type]; return *state; } struct sth_stash* sth_create(int cachew, int cacheh) { struct sth_stash* stash = NULL; GLubyte* empty_data = NULL; struct sth_texture* texture = NULL; // Allocate memory for the font stash. stash = (struct sth_stash*)malloc(sizeof(struct sth_stash)); if (stash == NULL) goto error; memset(stash,0,sizeof(struct sth_stash)); // Create data for clearing the textures empty_data = malloc(cachew * cacheh); if (empty_data == NULL) goto error; memset(empty_data, 0, cachew * cacheh); // Allocate memory for the first texture texture = (struct sth_texture*)malloc(sizeof(struct sth_texture)); if (texture == NULL) goto error; memset(texture,0,sizeof(struct sth_texture)); // Create first texture for the cache. stash->tw = cachew; stash->th = cacheh; stash->itw = 1.0f/cachew; stash->ith = 1.0f/cacheh; stash->empty_data = empty_data; stash->tt_textures = texture; glGenTextures(1, &texture->id); if (!texture->id) goto error; glBindTexture(GL_TEXTURE_2D, texture->id); glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, cachew, cacheh, 0, GL_ALPHA, GL_UNSIGNED_BYTE, empty_data); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); return stash; error: if (stash != NULL) free(stash); if (empty_data != NULL) free(empty_data); if (texture != NULL) free(texture); return NULL; } int sth_add_font_from_memory(struct sth_stash* stash, unsigned char* buffer) { int ret, i, ascent, descent, fh, lineGap; struct sth_font* fnt = NULL; fnt = (struct sth_font*)malloc(sizeof(struct sth_font)); if (fnt == NULL) { ret = STH_ENOMEM; goto error; } memset(fnt,0,sizeof(struct sth_font)); // Init hash lookup. for (i = 0; i < HASH_LUT_SIZE; ++i) fnt->lut[i] = -1; fnt->data = buffer; // Init stb_truetype if (!stbtt_InitFont(&fnt->font, fnt->data, 0)) { ret = STH_ETTFINIT; goto error; } // Store normalized line height. The real line height is got // by multiplying the lineh by font size. stbtt_GetFontVMetrics(&fnt->font, &ascent, &descent, &lineGap); fh = ascent - descent; fnt->ascender = (float)ascent / (float)fh; fnt->descender = (float)descent / (float)fh; fnt->lineh = (float)(fh + lineGap) / (float)fh; fnt->idx = idx; fnt->type = TTFONT_MEM; fnt->next = stash->fonts; stash->fonts = fnt; return idx++; error: if (fnt) { if (fnt->glyphs) free(fnt->glyphs); free(fnt); } return ret; } int sth_add_font(struct sth_stash* stash, const char* path) { FILE* fp = 0; int ret, datasize; unsigned char* data = NULL; int idx; // Read in the font data. fp = fopen(path, "rb"); if (!fp) { ret = STH_EFILEIO; goto error; } fseek(fp,0,SEEK_END); datasize = (int)ftell(fp); fseek(fp,0,SEEK_SET); data = (unsigned char*)malloc(datasize); if (data == NULL) { ret = STH_ENOMEM; goto error; } fread(data, 1, datasize, fp); fclose(fp); fp = 0; idx = sth_add_font_from_memory(stash, data); // Modify type of the loaded font. if (idx) stash->fonts->type = TTFONT_FILE; else free(data); return idx; error: if (data) free(data); if (fp) fclose(fp); return ret; } int sth_add_bitmap_font(struct sth_stash* stash, int ascent, int descent, int line_gap) { int ret, i, fh; struct sth_font* fnt = NULL; fnt = (struct sth_font*)malloc(sizeof(struct sth_font)); if (fnt == NULL) { ret = STH_ENOMEM; goto error; } memset(fnt,0,sizeof(struct sth_font)); // Init hash lookup. for (i = 0; i < HASH_LUT_SIZE; ++i) fnt->lut[i] = -1; // Store normalized line height. The real line height is got // by multiplying the lineh by font size. fh = ascent - descent; fnt->ascender = (float)ascent / (float)fh; fnt->descender = (float)descent / (float)fh; fnt->lineh = (float)(fh + line_gap) / (float)fh; fnt->idx = idx; fnt->type = BMFONT; fnt->next = stash->fonts; stash->fonts = fnt; return idx++; error: if (fnt) free(fnt); return ret; } int sth_add_glyph_for_codepoint(struct sth_stash* stash, int idx, GLuint id, unsigned int codepoint, short size, short base, int x, int y, int w, int h, float xoffset, float yoffset, float xadvance) { struct sth_texture* texture = NULL; struct sth_font* fnt = NULL; struct sth_glyph* glyph = NULL; if (stash == NULL) return STH_EINVAL; texture = stash->bm_textures; while (texture != NULL && texture->id != id) texture = texture->next; if (texture == NULL) { // Create new texture texture = (struct sth_texture*)malloc(sizeof(struct sth_texture)); if (texture == NULL) return STH_ENOMEM; memset(texture, 0, sizeof(struct sth_texture)); texture->id = id; texture->next = stash->bm_textures; stash->bm_textures = texture; } fnt = stash->fonts; while (fnt != NULL && fnt->idx != idx) fnt = fnt->next; if (fnt == NULL) return STH_EINVAL; if (fnt->type != BMFONT) return STH_EINVAL; // Alloc space for new glyph. fnt->nglyphs++; fnt->glyphs = (struct sth_glyph *)realloc(fnt->glyphs, fnt->nglyphs*sizeof(struct sth_glyph)); /* @rlyeh: explicit cast needed in C++ */ if (!fnt->glyphs) return STH_ENOMEM; // Init glyph. glyph = &fnt->glyphs[fnt->nglyphs-1]; memset(glyph, 0, sizeof(struct sth_glyph)); glyph->codepoint = codepoint; glyph->size = size; glyph->texture = texture; glyph->x0 = x; glyph->y0 = y; glyph->x1 = glyph->x0+w; glyph->y1 = glyph->y0+h; glyph->xoff = xoffset; glyph->yoff = yoffset - base; glyph->xadv = xadvance; // Find code point and size. h = hashint(codepoint) & (HASH_LUT_SIZE-1); // Insert char to hash lookup. glyph->next = fnt->lut[h]; fnt->lut[h] = fnt->nglyphs-1; return STH_ESUCCESS; } inline int sth_add_glyph_for_char(struct sth_stash* stash, int idx, GLuint id, const char* s, short size, short base, int x, int y, int w, int h, float xoffset, float yoffset, float xadvance) { unsigned int codepoint; unsigned int state = 0; for (; *s; ++s) { if (!decutf8(&state, &codepoint, *(unsigned char*)s)) break; } if (state != UTF8_ACCEPT) return STH_EINVAL; return sth_add_glyph_for_codepoint(stash, idx, id, codepoint, size, base, x, y, w, h, xoffset, yoffset, xadvance); } static struct sth_glyph* get_glyph(struct sth_stash* stash, struct sth_font* fnt, unsigned int codepoint, short isize) { int i,g,advance,lsb,x0,y0,x1,y1,gw,gh; float scale; struct sth_texture* texture = NULL; struct sth_glyph* glyph = NULL; unsigned char* bmp = NULL; unsigned int h; float size = isize/10.0f; int rh; struct sth_row* br = NULL; // Find code point and size. h = hashint(codepoint) & (HASH_LUT_SIZE-1); i = fnt->lut[h]; while (i != -1) { if (fnt->glyphs[i].codepoint == codepoint && (fnt->type == BMFONT || fnt->glyphs[i].size == isize)) return &fnt->glyphs[i]; i = fnt->glyphs[i].next; } // Could not find glyph. // For bitmap fonts: ignore this glyph. if (fnt->type == BMFONT) return 0; // For truetype fonts: create this glyph. scale = stbtt_ScaleForPixelHeight(&fnt->font, size); g = stbtt_FindGlyphIndex(&fnt->font, codepoint); if(!g) return 0; /* @rlyeh: glyph not found, ie, arab chars */ stbtt_GetGlyphHMetrics(&fnt->font, g, &advance, &lsb); stbtt_GetGlyphBitmapBox(&fnt->font, g, scale,scale, &x0,&y0,&x1,&y1); gw = x1-x0; gh = y1-y0; // Check if glyph is larger than maximum texture size if (gw >= stash->tw || gh >= stash->th) return 0; // Find texture and row where the glyph can be fit. br = NULL; rh = (gh+7) & ~7; texture = stash->tt_textures; while(br == NULL) { for (i = 0; i < texture->nrows; ++i) { if (texture->rows[i].h == rh && texture->rows[i].x+gw+1 <= stash->tw) br = &texture->rows[i]; } // If no row is found, there are 3 possibilities: // - add new row // - try next texture // - create new texture if (br == NULL) { short py = 0; // Check that there is enough space. if (texture->nrows) { py = texture->rows[texture->nrows-1].y + texture->rows[texture->nrows-1].h+1; if (py+rh > stash->th) { if (texture->next != NULL) { texture = texture->next; } else { // Create new texture texture->next = (struct sth_texture*)malloc(sizeof(struct sth_texture)); texture = texture->next; if (texture == NULL) goto error; memset(texture,0,sizeof(struct sth_texture)); glGenTextures(1, &texture->id); if (!texture->id) goto error; glBindTexture(GL_TEXTURE_2D, texture->id); glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, stash->tw,stash->th, 0, GL_ALPHA, GL_UNSIGNED_BYTE, stash->empty_data); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } continue; } } // Init and add row br = &texture->rows[texture->nrows]; br->x = 0; br->y = py; br->h = rh; texture->nrows++; } } // Alloc space for new glyph. fnt->nglyphs++; fnt->glyphs = (struct sth_glyph *)realloc(fnt->glyphs, fnt->nglyphs*sizeof(struct sth_glyph)); /* @rlyeh: explicit cast needed in C++ */ if (!fnt->glyphs) return 0; // Init glyph. glyph = &fnt->glyphs[fnt->nglyphs-1]; memset(glyph, 0, sizeof(struct sth_glyph)); glyph->codepoint = codepoint; glyph->size = isize; glyph->texture = texture; glyph->x0 = br->x; glyph->y0 = br->y; glyph->x1 = glyph->x0+gw; glyph->y1 = glyph->y0+gh; glyph->xadv = scale * advance; glyph->xoff = (float)x0; glyph->yoff = (float)y0; glyph->next = 0; // Advance row location. br->x += gw+1; // Insert char to hash lookup. glyph->next = fnt->lut[h]; fnt->lut[h] = fnt->nglyphs-1; // Rasterize bmp = (unsigned char*)malloc(gw*gh); if (bmp) { stbtt_MakeGlyphBitmap(&fnt->font, bmp, gw,gh,gw, scale,scale, g); // Update texture glBindTexture(GL_TEXTURE_2D, texture->id); glPixelStorei(GL_UNPACK_ALIGNMENT,1); glTexSubImage2D(GL_TEXTURE_2D, 0, glyph->x0,glyph->y0, gw,gh, GL_ALPHA,GL_UNSIGNED_BYTE,bmp); free(bmp); } return glyph; error: if (texture) free(texture); return 0; } static int get_quad(struct sth_stash* stash, struct sth_font* fnt, struct sth_glyph* glyph, short isize, float* x, float* y, struct sth_quad* q) { int rx,ry; float scale = 1.0f; if (fnt->type == BMFONT) scale = isize/(glyph->size*10.0f); rx = floorf(*x + scale * glyph->xoff); ry = floorf(*y - scale * glyph->yoff); q->x0 = rx; q->y0 = ry; q->x1 = rx + scale * (glyph->x1 - glyph->x0); q->y1 = ry - scale * (glyph->y1 - glyph->y0); q->s0 = (glyph->x0) * stash->itw; q->t0 = (glyph->y0) * stash->ith; q->s1 = (glyph->x1) * stash->itw; q->t1 = (glyph->y1) * stash->ith; *x += scale * glyph->xadv; return 1; } static float* setv(float* v, float x, float y, float s, float t) { v[0] = x; v[1] = y; v[2] = s; v[3] = t; return v+4; } static void flush_draw(struct sth_stash* stash) { struct sth_texture* texture = stash->tt_textures; short tt = 1; while (texture) { if (texture->nverts > 0) { glBindTexture(GL_TEXTURE_2D, texture->id); glEnable(GL_TEXTURE_2D); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2, GL_FLOAT, VERT_STRIDE, texture->verts); glTexCoordPointer(2, GL_FLOAT, VERT_STRIDE, texture->verts+2); glDrawArrays(GL_QUADS, 0, texture->nverts); glDisable(GL_TEXTURE_2D); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); texture->nverts = 0; } texture = texture->next; if (!texture && tt) { texture = stash->bm_textures; tt = 0; } } } void sth_begin_draw(struct sth_stash* stash) { if (stash == NULL) return; if (stash->drawing) flush_draw(stash); stash->drawing = 1; } void sth_end_draw(struct sth_stash* stash) { if (stash == NULL) return; if (!stash->drawing) return; /* // Debug dump. if (stash->nverts+6 < VERT_COUNT) { float x = 500, y = 100; float* v = &stash->verts[stash->nverts*4]; v = setv(v, x, y, 0, 0); v = setv(v, x+stash->tw, y, 1, 0); v = setv(v, x+stash->tw, y+stash->th, 1, 1); v = setv(v, x, y, 0, 0); v = setv(v, x+stash->tw, y+stash->th, 1, 1); v = setv(v, x, y+stash->th, 0, 1); stash->nverts += 6; } */ flush_draw(stash); stash->drawing = 0; } void sth_draw_text(struct sth_stash* stash, int idx, float size, float x, float y, const char* s, float* dx) { unsigned int codepoint; struct sth_glyph* glyph = NULL; struct sth_texture* texture = NULL; unsigned int state = 0; struct sth_quad q; short isize = (short)(size*10.0f); float* v; struct sth_font* fnt = NULL; if (stash == NULL) return; fnt = stash->fonts; while(fnt != NULL && fnt->idx != idx) fnt = fnt->next; if (fnt == NULL) return; if (fnt->type != BMFONT && !fnt->data) return; for (; *s; ++s) { if (decutf8(&state, &codepoint, *(unsigned char*)s)) continue; glyph = get_glyph(stash, fnt, codepoint, isize); if (!glyph) continue; texture = glyph->texture; if (texture->nverts+4 >= VERT_COUNT) flush_draw(stash); if (!get_quad(stash, fnt, glyph, isize, &x, &y, &q)) continue; v = &texture->verts[texture->nverts*4]; v = setv(v, q.x0, q.y0, q.s0, q.t0); v = setv(v, q.x1, q.y0, q.s1, q.t0); v = setv(v, q.x1, q.y1, q.s1, q.t1); v = setv(v, q.x0, q.y1, q.s0, q.t1); texture->nverts += 4; } if (dx) *dx = x; } void sth_dim_text(struct sth_stash* stash, int idx, float size, const char* s, float* minx, float* miny, float* maxx, float* maxy) { unsigned int codepoint; struct sth_glyph* glyph = NULL; unsigned int state = 0; struct sth_quad q; short isize = (short)(size*10.0f); struct sth_font* fnt = NULL; float x = 0, y = 0; *minx = *maxx = *miny = *maxy = 0; /* @rlyeh: reset vars before failing */ if (stash == NULL) return; fnt = stash->fonts; while(fnt != NULL && fnt->idx != idx) fnt = fnt->next; if (fnt == NULL) return; if (fnt->type != BMFONT && !fnt->data) return; for (; *s; ++s) { if (decutf8(&state, &codepoint, *(unsigned char*)s)) continue; glyph = get_glyph(stash, fnt, codepoint, isize); if (!glyph) continue; if (!get_quad(stash, fnt, glyph, isize, &x, &y, &q)) continue; if (q.x0 < *minx) *minx = q.x0; if (q.x1 > *maxx) *maxx = q.x1; if (q.y1 < *miny) *miny = q.y1; if (q.y0 > *maxy) *maxy = q.y0; } if (floorf(x) > *maxx) *maxx = floorf(x); } void sth_vmetrics(struct sth_stash* stash, int idx, float size, float* ascender, float* descender, float* lineh) { struct sth_font* fnt = NULL; if (stash == NULL) return; fnt = stash->fonts; while(fnt != NULL && fnt->idx != idx) fnt = fnt->next; if (fnt == NULL) return; if (fnt->type != BMFONT && !fnt->data) return; if (ascender) *ascender = fnt->ascender*size; if (descender) *descender = fnt->descender*size; if (lineh) *lineh = fnt->lineh*size; } void sth_delete(struct sth_stash* stash) { struct sth_texture* tex = NULL; struct sth_texture* curtex = NULL; struct sth_font* fnt = NULL; struct sth_font* curfnt = NULL; if (!stash) return; tex = stash->tt_textures; while(tex != NULL) { curtex = tex; tex = tex->next; if (curtex->id) glDeleteTextures(1, &curtex->id); free(curtex); } tex = stash->bm_textures; while(tex != NULL) { curtex = tex; tex = tex->next; if (curtex->id) glDeleteTextures(1, &curtex->id); free(curtex); } fnt = stash->fonts; while(fnt != NULL) { curfnt = fnt; fnt = fnt->next; if (curfnt->glyphs) free(curfnt->glyphs); if (curfnt->type == TTFONT_FILE && curfnt->data) free(curfnt->data); free(curfnt); } free(stash->empty_data); free(stash); } |
Added ext/fontstash/fontstash.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
// // Copyright (c) 2011 Andreas Krinke andreas.krinke@gmx.de // Copyright (c) 2009 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. // #ifndef FONTSTASH_H #define FONTSTASH_H #define STH_ESUCCESS 0 // error opening file #define STH_EFILEIO -1 // error initializing truetype font #define STH_ETTFINIT -2 // invalid argument #define STH_EINVAL -3 // not enough memory #define STH_ENOMEM -4 struct sth_stash* sth_create(int cachew, int cacheh); int sth_add_font(struct sth_stash* stash, const char* path); int sth_add_font_from_memory(struct sth_stash* stash, unsigned char* buffer); int sth_add_bitmap_font(struct sth_stash* stash, int ascent, int descent, int line_gap); int sth_add_glyph_for_codepoint(struct sth_stash* stash, int idx, GLuint id, unsigned int codepoint, short size, short base, int x, int y, int w, int h, float xoffset, float yoffset, float xadvance); int sth_add_glyph_for_char(struct sth_stash* stash, int idx, GLuint id, const char* s, short size, short base, int x, int y, int w, int h, float xoffset, float yoffset, float xadvance); void sth_begin_draw(struct sth_stash* stash); void sth_end_draw(struct sth_stash* stash); void sth_draw_text(struct sth_stash* stash, int idx, float size, float x, float y, const char* string, float* dx); void sth_dim_text(struct sth_stash* stash, int idx, float size, const char* string, float* minx, float* miny, float* maxx, float* maxy); void sth_vmetrics(struct sth_stash* stash, int idx, float size, float* ascender, float* descender, float * lineh); void sth_delete(struct sth_stash* stash); #endif // FONTSTASH_H |
Added ext/fontstash/stb_truetype.c.
> > > > > > > |
1 2 3 4 5 6 7 |
#define STB_TRUETYPE_IMPLEMENTATION #define STBTT_malloc(x,u) malloc(x) #define STBTT_free(x,u) free(x) #define STBTT_assert(...) do {} while(0) #include "stb_truetype.h" |
Added ext/fontstash/stb_truetype.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 |
// stb_truetype.h - v0.6c - public domain // authored from 2009-2012 by Sean Barrett / RAD Game Tools // // This library processes TrueType files: // parse files // extract glyph metrics // extract glyph shapes // render glyphs to one-channel bitmaps with antialiasing (box filter) // // Todo: // non-MS cmaps // crashproof on bad data // hinting? (no longer patented) // cleartype-style AA? // optimize: use simple memory allocator for intermediates // optimize: build edge-list directly from curves // optimize: rasterize directly from curves? // // ADDITIONAL CONTRIBUTORS // // Mikko Mononen: compound shape support, more cmap formats // Tor Andersson: kerning, subpixel rendering // // Bug/warning reports: // "Zer" on mollyrocket (with fix) // Cass Everitt // stoiko (Haemimont Games) // Brian Hook // Walter van Niftrik // // VERSION HISTORY // // 0.6c (2012-07-24) improve documentation // 0.6b (2012-07-20) fix a few more warnings // 0.6 (2012-07-17) fix warnings; added stbtt_ScaleForMappingEmToPixels, // stbtt_GetFontBoundingBox, stbtt_IsGlyphEmpty // 0.5 (2011-12-09) bugfixes: // subpixel glyph renderer computed wrong bounding box // first vertex of shape can be off-curve (FreeSans) // 0.4b (2011-12-03) fixed an error in the font baking example // 0.4 (2011-12-01) kerning, subpixel rendering (tor) // bugfixes for: // codepoint-to-glyph conversion using table fmt=12 // codepoint-to-glyph conversion using table fmt=4 // stbtt_GetBakedQuad with non-square texture (Zer) // updated Hello World! sample to use kerning and subpixel // fixed some warnings // 0.3 (2009-06-24) cmap fmt=12, compound shapes (MM) // userdata, malloc-from-userdata, non-zero fill (STB) // 0.2 (2009-03-11) Fix unsigned/signed char warnings // 0.1 (2009-03-09) First public release // // LICENSE // // This software is in the public domain. Where that dedication is not // recognized, you are granted a perpetual, irrevokable license to copy // and modify this file as you see fit. // // USAGE // // Include this file in whatever places neeed to refer to it. In ONE C/C++ // file, write: // #define STB_TRUETYPE_IMPLEMENTATION // before the #include of this file. This expands out the actual // implementation into that C/C++ file. // // Simple 3D API (don't ship this, but it's fine for tools and quick start, // and you can cut and paste from it to move to more advanced) // stbtt_BakeFontBitmap() -- bake a font to a bitmap for use as texture // stbtt_GetBakedQuad() -- compute quad to draw for a given char // // "Load" a font file from a memory buffer (you have to keep the buffer loaded) // stbtt_InitFont() // stbtt_GetFontOffsetForIndex() -- use for TTC font collections // // Render a unicode codepoint to a bitmap // stbtt_GetCodepointBitmap() -- allocates and returns a bitmap // stbtt_MakeCodepointBitmap() -- renders into bitmap you provide // stbtt_GetCodepointBitmapBox() -- how big the bitmap must be // // Character advance/positioning // stbtt_GetCodepointHMetrics() // stbtt_GetFontVMetrics() // stbtt_GetCodepointKernAdvance() // // ADDITIONAL DOCUMENTATION // // Immediately after this block comment are a series of sample programs. // // After the sample programs is the "header file" section. This section // includes documentation for each API function. // // Some important concepts to understand to use this library: // // Codepoint // Characters are defined by unicode codepoints, e.g. 65 is // uppercase A, 231 is lowercase c with a cedilla, 0x7e30 is // the hiragana for "ma". // // Glyph // A visual character shape (every codepoint is rendered as // some glyph) // // Glyph index // A font-specific integer ID representing a glyph // // Baseline // Glyph shapes are defined relative to a baseline, which is the // bottom of uppercase characters. Characters extend both above // and below the baseline. // // Current Point // As you draw text to the screen, you keep track of a "current point" // which is the origin of each character. The current point's vertical // position is the baseline. Even "baked fonts" use this model. // // Vertical Font Metrics // The vertical qualities of the font, used to vertically position // and space the characters. See docs for stbtt_GetFontVMetrics. // // Font Size in Pixels or Points // The preferred interface for specifying font sizes in stb_truetype // is to specify how tall the font's vertical extent should be in pixels. // If that sounds good enough, skip the next paragraph. // // Most font APIs instead use "points", which are a common typographic // measurement for describing font size, defined as 72 points per inch. // stb_truetype provides a point API for compatibility. However, true // "per inch" conventions don't make much sense on computer displays // since they different monitors have different number of pixels per // inch. For example, Windows traditionally uses a convention that // there are 96 pixels per inch, thus making 'inch' measurements have // nothing to do with inches, and thus effectively defining a point to // be 1.333 pixels. Additionally, the TrueType font data provides // an explicit scale factor to scale a given font's glyphs to points, // but the author has observed that this scale factor is often wrong // for non-commercial fonts, thus making fonts scaled in points // according to the TrueType spec incoherently sized in practice. // // ADVANCED USAGE // // Quality: // // - Use the functions with Subpixel at the end to allow your characters // to have subpixel positioning. Since the font is anti-aliased, not // hinted, this is very import for quality. (This is not possible with // baked fonts.) // // - Kerning is now supported, and if you're supporting subpixel rendering // then kerning is worth using to give your text a polished look. // // Performance: // // - Convert Unicode codepoints to glyph indexes and operate on the glyphs; // if you don't do this, stb_truetype is forced to do the conversion on // every call. // // - There are a lot of memory allocations. We should modify it to take // a temp buffer and allocate from the temp buffer (without freeing), // should help performance a lot. // // NOTES // // The system uses the raw data found in the .ttf file without changing it // and without building auxiliary data structures. This is a bit inefficient // on little-endian systems (the data is big-endian), but assuming you're // caching the bitmaps or glyph shapes this shouldn't be a big deal. // // It appears to be very hard to programmatically determine what font a // given file is in a general way. I provide an API for this, but I don't // recommend it. // // // SOURCE STATISTICS (based on v0.6c, 2050 LOC) // // Documentation & header file 520 LOC \___ 660 LOC documentation // Sample code 140 LOC / // Truetype parsing 620 LOC ---- 620 LOC TrueType // Software rasterization 240 LOC \ . // Curve tesselation 120 LOC \__ 550 LOC Bitmap creation // Bitmap management 100 LOC / // Baked bitmap interface 70 LOC / // Font name matching & access 150 LOC ---- 150 // C runtime library abstraction 60 LOC ---- 60 ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// //// //// SAMPLE PROGRAMS //// // // Incomplete text-in-3d-api example, which draws quads properly aligned to be lossless // #if 0 #define STB_TRUETYPE_IMPLEMENTATION // force following include to generate implementation #include "stb_truetype.h" char ttf_buffer[1<<20]; unsigned char temp_bitmap[512*512]; stbtt_bakedchar cdata[96]; // ASCII 32..126 is 95 glyphs GLstbtt_uint ftex; void my_stbtt_initfont(void) { fread(ttf_buffer, 1, 1<<20, fopen("c:/windows/fonts/times.ttf", "rb")); stbtt_BakeFontBitmap(data,0, 32.0, temp_bitmap,512,512, 32,96, cdata); // no guarantee this fits! // can free ttf_buffer at this point glGenTextures(1, &ftex); glBindTexture(GL_TEXTURE_2D, ftex); glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 512,512, 0, GL_ALPHA, GL_UNSIGNED_BYTE, temp_bitmap); // can free temp_bitmap at this point glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } void my_stbtt_print(float x, float y, char *text) { // assume orthographic projection with units = screen pixels, origin at top left glBindTexture(GL_TEXTURE_2D, ftex); glBegin(GL_QUADS); while (*text) { if (*text >= 32 && *text < 128) { stbtt_aligned_quad q; stbtt_GetBakedQuad(cdata, 512,512, *text-32, &x,&y,&q,1);//1=opengl,0=old d3d glTexCoord2f(q.s0,q.t1); glVertex2f(q.x0,q.y0); glTexCoord2f(q.s1,q.t1); glVertex2f(q.x1,q.y0); glTexCoord2f(q.s1,q.t0); glVertex2f(q.x1,q.y1); glTexCoord2f(q.s0,q.t0); glVertex2f(q.x0,q.y1); } ++text; } glEnd(); } #endif // // ////////////////////////////////////////////////////////////////////////////// // // Complete program (this compiles): get a single bitmap, print as ASCII art // #if 0 #include <stdio.h> #define STB_TRUETYPE_IMPLEMENTATION // force following include to generate implementation #include "stb_truetype.h" char ttf_buffer[1<<25]; int main(int argc, char **argv) { stbtt_fontinfo font; unsigned char *bitmap; int w,h,i,j,c = (argc > 1 ? atoi(argv[1]) : 'a'), s = (argc > 2 ? atoi(argv[2]) : 20); fread(ttf_buffer, 1, 1<<25, fopen(argc > 3 ? argv[3] : "c:/windows/fonts/arialbd.ttf", "rb")); stbtt_InitFont(&font, ttf_buffer, stbtt_GetFontOffsetForIndex(ttf_buffer,0)); bitmap = stbtt_GetCodepointBitmap(&font, 0,stbtt_ScaleForPixelHeight(&font, s), c, &w, &h, 0,0); for (j=0; j < h; ++j) { for (i=0; i < w; ++i) putchar(" .:ioVM@"[bitmap[j*w+i]>>5]); putchar('\n'); } return 0; } #endif // // Output: // // .ii. // @@@@@@. // V@Mio@@o // :i. V@V // :oM@@M // :@@@MM@M // @@o o@M // :@@. M@M // @@@o@@@@ // :M@@V:@@. // ////////////////////////////////////////////////////////////////////////////// // // Complete program: print "Hello World!" banner, with bugs // #if 0 char buffer[24<<20]; unsigned char screen[20][79]; int main(int arg, char **argv) { stbtt_fontinfo font; int i,j,ascent,baseline,ch=0; float scale, xpos=0; char *text = "Heljo World!"; fread(buffer, 1, 1000000, fopen("c:/windows/fonts/arialbd.ttf", "rb")); stbtt_InitFont(&font, buffer, 0); scale = stbtt_ScaleForPixelHeight(&font, 15); stbtt_GetFontVMetrics(&font, &ascent,0,0); baseline = (int) (ascent*scale); while (text[ch]) { int advance,lsb,x0,y0,x1,y1; float x_shift = xpos - (float) floor(xpos); stbtt_GetCodepointHMetrics(&font, text[ch], &advance, &lsb); stbtt_GetCodepointBitmapBoxSubpixel(&font, text[ch], scale,scale,x_shift,0, &x0,&y0,&x1,&y1); stbtt_MakeCodepointBitmapSubpixel(&font, &screen[baseline + y0][(int) xpos + x0], x1-x0,y1-y0, 79, scale,scale,x_shift,0, text[ch]); // note that this stomps the old data, so where character boxes overlap (e.g. 'lj') it's wrong // because this API is really for baking character bitmaps into textures. if you want to render // a sequence of characters, you really need to render each bitmap to a temp buffer, then // "alpha blend" that into the working buffer xpos += (advance * scale); if (text[ch+1]) xpos += scale*stbtt_GetCodepointKernAdvance(&font, text[ch],text[ch+1]); ++ch; } for (j=0; j < 20; ++j) { for (i=0; i < 78; ++i) putchar(" .:ioVM@"[screen[j][i]>>5]); putchar('\n'); } return 0; } #endif ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// //// //// INTEGRATION WITH YOUR CODEBASE //// //// The following sections allow you to supply alternate definitions //// of C library functions used by stb_truetype. #ifdef STB_TRUETYPE_IMPLEMENTATION // #define your own (u)stbtt_int8/16/32 before including to override this #ifndef stbtt_uint8 typedef unsigned char stbtt_uint8; typedef signed char stbtt_int8; typedef unsigned short stbtt_uint16; typedef signed short stbtt_int16; typedef unsigned int stbtt_uint32; typedef signed int stbtt_int32; #endif typedef char stbtt__check_size32[sizeof(stbtt_int32)==4 ? 1 : -1]; typedef char stbtt__check_size16[sizeof(stbtt_int16)==2 ? 1 : -1]; // #define your own STBTT_sort() to override this to avoid qsort #ifndef STBTT_sort #include <stdlib.h> #define STBTT_sort(data,num_items,item_size,compare_func) qsort(data,num_items,item_size,compare_func) #endif // #define your own STBTT_ifloor/STBTT_iceil() to avoid math.h #ifndef STBTT_ifloor #include <math.h> #define STBTT_ifloor(x) ((int) floor(x)) #define STBTT_iceil(x) ((int) ceil(x)) #endif // #define your own functions "STBTT_malloc" / "STBTT_free" to avoid malloc.h #ifndef STBTT_malloc #include <malloc.h> #define STBTT_malloc(x,u) malloc(x) #define STBTT_free(x,u) free(x) #endif #ifndef STBTT_assert #include <assert.h> #define STBTT_assert(x) assert(x) #endif #ifndef STBTT_strlen #include <string.h> #define STBTT_strlen(x) strlen(x) #endif #ifndef STBTT_memcpy #include <memory.h> #define STBTT_memcpy memcpy #define STBTT_memset memset #endif #endif /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //// //// INTERFACE //// //// #ifndef __STB_INCLUDE_STB_TRUETYPE_H__ #define __STB_INCLUDE_STB_TRUETYPE_H__ #ifdef __cplusplus extern "C" { #endif ////////////////////////////////////////////////////////////////////////////// // // TEXTURE BAKING API // // If you use this API, you only have to call two functions ever. // typedef struct { unsigned short x0,y0,x1,y1; // coordinates of bbox in bitmap float xoff,yoff,xadvance; } stbtt_bakedchar; extern int stbtt_BakeFontBitmap(const unsigned char *data, int offset, // font location (use offset=0 for plain .ttf) float pixel_height, // height of font in pixels unsigned char *pixels, int pw, int ph, // bitmap to be filled in int first_char, int num_chars, // characters to bake stbtt_bakedchar *chardata); // you allocate this, it's num_chars long // if return is positive, the first unused row of the bitmap // if return is negative, returns the negative of the number of characters that fit // if return is 0, no characters fit and no rows were used // This uses a very crappy packing. typedef struct { float x0,y0,s0,t0; // top-left float x1,y1,s1,t1; // bottom-right } stbtt_aligned_quad; extern void stbtt_GetBakedQuad(stbtt_bakedchar *chardata, int pw, int ph, // same data as above int char_index, // character to display float *xpos, float *ypos, // pointers to current position in screen pixel space stbtt_aligned_quad *q, // output: quad to draw int opengl_fillrule); // true if opengl fill rule; false if DX9 or earlier // Call GetBakedQuad with char_index = 'character - first_char', and it // creates the quad you need to draw and advances the current position. // // The coordinate system used assumes y increases downwards. // // Characters will extend both above and below the current position; // see discussion of "BASELINE" above. // // It's inefficient; you might want to c&p it and optimize it. ////////////////////////////////////////////////////////////////////////////// // // FONT LOADING // // extern int stbtt_GetFontOffsetForIndex(const unsigned char *data, int index); // Each .ttf/.ttc file may have more than one font. Each font has a sequential // index number starting from 0. Call this function to get the font offset for // a given index; it returns -1 if the index is out of range. A regular .ttf // file will only define one font and it always be at offset 0, so it will // return '0' for index 0, and -1 for all other indices. You can just skip // this step if you know it's that kind of font. // The following structure is defined publically so you can declare one on // the stack or as a global or etc, but you should treat it as opaque. typedef struct stbtt_fontinfo { void * userdata; unsigned char * data; // pointer to .ttf file int fontstart; // offset of start of font int numGlyphs; // number of glyphs, needed for range checking int loca,head,glyf,hhea,hmtx,kern; // table locations as offset from start of .ttf int index_map; // a cmap mapping for our chosen character encoding int indexToLocFormat; // format needed to map from glyph index to glyph } stbtt_fontinfo; extern int stbtt_InitFont(stbtt_fontinfo *info, const unsigned char *data, int offset); // Given an offset into the file that defines a font, this function builds // the necessary cached info for the rest of the system. You must allocate // the stbtt_fontinfo yourself, and stbtt_InitFont will fill it out. You don't // need to do anything special to free it, because the contents are pure // value data with no additional data structures. Returns 0 on failure. ////////////////////////////////////////////////////////////////////////////// // // CHARACTER TO GLYPH-INDEX CONVERSIOn int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codepoint); // If you're going to perform multiple operations on the same character // and you want a speed-up, call this function with the character you're // going to process, then use glyph-based functions instead of the // codepoint-based functions. ////////////////////////////////////////////////////////////////////////////// // // CHARACTER PROPERTIES // extern float stbtt_ScaleForPixelHeight(const stbtt_fontinfo *info, float pixels); // computes a scale factor to produce a font whose "height" is 'pixels' tall. // Height is measured as the distance from the highest ascender to the lowest // descender; in other words, it's equivalent to calling stbtt_GetFontVMetrics // and computing: // scale = pixels / (ascent - descent) // so if you prefer to measure height by the ascent only, use a similar calculation. extern float stbtt_ScaleForMappingEmToPixels(const stbtt_fontinfo *info, float pixels); // computes a scale factor to produce a font whose EM size is mapped to // 'pixels' tall. This is probably what traditional APIs compute, but // I'm not positive. extern void stbtt_GetFontVMetrics(const stbtt_fontinfo *info, int *ascent, int *descent, int *lineGap); // ascent is the coordinate above the baseline the font extends; descent // is the coordinate below the baseline the font extends (i.e. it is typically negative) // lineGap is the spacing between one row's descent and the next row's ascent... // so you should advance the vertical position by "*ascent - *descent + *lineGap" // these are expressed in unscaled coordinates, so you must multiply by // the scale factor for a given size extern void stbtt_GetFontBoundingBox(const stbtt_fontinfo *info, int *x0, int *y0, int *x1, int *y1); // the bounding box around all possible characters extern void stbtt_GetCodepointHMetrics(const stbtt_fontinfo *info, int codepoint, int *advanceWidth, int *leftSideBearing); // leftSideBearing is the offset from the current horizontal position to the left edge of the character // advanceWidth is the offset from the current horizontal position to the next horizontal position // these are expressed in unscaled coordinates extern int stbtt_GetCodepointKernAdvance(const stbtt_fontinfo *info, int ch1, int ch2); // an additional amount to add to the 'advance' value between ch1 and ch2 // @TODO; for now always returns 0! extern int stbtt_GetCodepointBox(const stbtt_fontinfo *info, int codepoint, int *x0, int *y0, int *x1, int *y1); // Gets the bounding box of the visible part of the glyph, in unscaled coordinates extern void stbtt_GetGlyphHMetrics(const stbtt_fontinfo *info, int glyph_index, int *advanceWidth, int *leftSideBearing); extern int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2); extern int stbtt_GetGlyphBox(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1); // as above, but takes one or more glyph indices for greater efficiency ////////////////////////////////////////////////////////////////////////////// // // GLYPH SHAPES (you probably don't need these, but they have to go before // the bitmaps for C declaration-order reasons) // #ifndef STBTT_vmove // you can predefine these to use different values (but why?) enum { STBTT_vmove=1, STBTT_vline, STBTT_vcurve }; #endif #ifndef stbtt_vertex // you can predefine this to use different values // (we share this with other code at RAD) #define stbtt_vertex_type short // can't use stbtt_int16 because that's not visible in the header file typedef struct { stbtt_vertex_type x,y,cx,cy; unsigned char type,padding; } stbtt_vertex; #endif extern int stbtt_IsGlyphEmpty(const stbtt_fontinfo *info, int glyph_index); // returns non-zero if nothing is drawn for this glyph extern int stbtt_GetCodepointShape(const stbtt_fontinfo *info, int unicode_codepoint, stbtt_vertex **vertices); extern int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **vertices); // returns # of vertices and fills *vertices with the pointer to them // these are expressed in "unscaled" coordinates extern void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *vertices); // frees the data allocated above ////////////////////////////////////////////////////////////////////////////// // // BITMAP RENDERING // extern void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata); // frees the bitmap allocated below extern unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff); // allocates a large-enough single-channel 8bpp bitmap and renders the // specified character/glyph at the specified scale into it, with // antialiasing. 0 is no coverage (transparent), 255 is fully covered (opaque). // *width & *height are filled out with the width & height of the bitmap, // which is stored left-to-right, top-to-bottom. // // xoff/yoff are the offset it pixel space from the glyph origin to the top-left of the bitmap extern unsigned char *stbtt_GetCodepointBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, int *width, int *height, int *xoff, int *yoff); // the same as stbtt_GetCodepoitnBitmap, but you can specify a subpixel // shift for the character extern void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint); // the same as stbtt_GetCodepointBitmap, but you pass in storage for the bitmap // in the form of 'output', with row spacing of 'out_stride' bytes. the bitmap // is clipped to out_w/out_h bytes. Call stbtt_GetCodepointBitmapBox to get the // width and height and positioning info for it first. extern void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint); // same as stbtt_MakeCodepointBitmap, but you can specify a subpixel // shift for the character extern void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1); // get the bbox of the bitmap centered around the glyph origin; so the // bitmap width is ix1-ix0, height is iy1-iy0, and location to place // the bitmap top left is (leftSideBearing*scale,iy0). // (Note that the bitmap uses y-increases-down, but the shape uses // y-increases-up, so CodepointBitmapBox and CodepointBox are inverted.) extern void stbtt_GetCodepointBitmapBoxSubpixel(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1); // same as stbtt_GetCodepointBitmapBox, but you can specify a subpixel // shift for the character // the following functions are equivalent to the above functions, but operate // on glyph indices instead of Unicode codepoints (for efficiency) extern unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff); extern unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int glyph, int *width, int *height, int *xoff, int *yoff); extern void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph); extern void stbtt_MakeGlyphBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int glyph); extern void stbtt_GetGlyphBitmapBox(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1); extern void stbtt_GetGlyphBitmapBoxSubpixel(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y,float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1); // @TODO: don't expose this structure typedef struct { int w,h,stride; unsigned char *pixels; } stbtt__bitmap; extern void stbtt_Rasterize(stbtt__bitmap *result, float flatness_in_pixels, stbtt_vertex *vertices, int num_verts, float scale_x, float scale_y, float shift_x, float shift_y, int x_off, int y_off, int invert, void *userdata); ////////////////////////////////////////////////////////////////////////////// // // Finding the right font... // // You should really just solve this offline, keep your own tables // of what font is what, and don't try to get it out of the .ttf file. // That's because getting it out of the .ttf file is really hard, because // the names in the file can appear in many possible encodings, in many // possible languages, and e.g. if you need a case-insensitive comparison, // the details of that depend on the encoding & language in a complex way // (actually underspecified in truetype, but also gigantic). // // But you can use the provided functions in two possible ways: // stbtt_FindMatchingFont() will use *case-sensitive* comparisons on // unicode-encoded names to try to find the font you want; // you can run this before calling stbtt_InitFont() // // stbtt_GetFontNameString() lets you get any of the various strings // from the file yourself and do your own comparisons on them. // You have to have called stbtt_InitFont() first. extern int stbtt_FindMatchingFont(const unsigned char *fontdata, const char *name, int flags); // returns the offset (not index) of the font that matches, or -1 if none // if you use STBTT_MACSTYLE_DONTCARE, use a font name like "Arial Bold". // if you use any other flag, use a font name like "Arial"; this checks // the 'macStyle' header field; i don't know if fonts set this consistently #define STBTT_MACSTYLE_DONTCARE 0 #define STBTT_MACSTYLE_BOLD 1 #define STBTT_MACSTYLE_ITALIC 2 #define STBTT_MACSTYLE_UNDERSCORE 4 #define STBTT_MACSTYLE_NONE 8 // <= not same as 0, this makes us check the bitfield is 0 extern int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2); // returns 1/0 whether the first string interpreted as utf8 is identical to // the second string interpreted as big-endian utf16... useful for strings from next func extern const char *stbtt_GetFontNameString(const stbtt_fontinfo *font, int *length, int platformID, int encodingID, int languageID, int nameID); // returns the string (which may be big-endian double byte, e.g. for unicode) // and puts the length in bytes in *length. // // some of the values for the IDs are below; for more see the truetype spec: // http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6name.html // http://www.microsoft.com/typography/otspec/name.htm enum { // platformID STBTT_PLATFORM_ID_UNICODE =0, STBTT_PLATFORM_ID_MAC =1, STBTT_PLATFORM_ID_ISO =2, STBTT_PLATFORM_ID_MICROSOFT =3 }; enum { // encodingID for STBTT_PLATFORM_ID_UNICODE STBTT_UNICODE_EID_UNICODE_1_0 =0, STBTT_UNICODE_EID_UNICODE_1_1 =1, STBTT_UNICODE_EID_ISO_10646 =2, STBTT_UNICODE_EID_UNICODE_2_0_BMP=3, STBTT_UNICODE_EID_UNICODE_2_0_FULL=4 }; enum { // encodingID for STBTT_PLATFORM_ID_MICROSOFT STBTT_MS_EID_SYMBOL =0, STBTT_MS_EID_UNICODE_BMP =1, STBTT_MS_EID_SHIFTJIS =2, STBTT_MS_EID_UNICODE_FULL =10 }; enum { // encodingID for STBTT_PLATFORM_ID_MAC; same as Script Manager codes STBTT_MAC_EID_ROMAN =0, STBTT_MAC_EID_ARABIC =4, STBTT_MAC_EID_JAPANESE =1, STBTT_MAC_EID_HEBREW =5, STBTT_MAC_EID_CHINESE_TRAD =2, STBTT_MAC_EID_GREEK =6, STBTT_MAC_EID_KOREAN =3, STBTT_MAC_EID_RUSSIAN =7 }; enum { // languageID for STBTT_PLATFORM_ID_MICROSOFT; same as LCID... // problematic because there are e.g. 16 english LCIDs and 16 arabic LCIDs STBTT_MS_LANG_ENGLISH =0x0409, STBTT_MS_LANG_ITALIAN =0x0410, STBTT_MS_LANG_CHINESE =0x0804, STBTT_MS_LANG_JAPANESE =0x0411, STBTT_MS_LANG_DUTCH =0x0413, STBTT_MS_LANG_KOREAN =0x0412, STBTT_MS_LANG_FRENCH =0x040c, STBTT_MS_LANG_RUSSIAN =0x0419, STBTT_MS_LANG_GERMAN =0x0407, STBTT_MS_LANG_SPANISH =0x0409, STBTT_MS_LANG_HEBREW =0x040d, STBTT_MS_LANG_SWEDISH =0x041D }; enum { // languageID for STBTT_PLATFORM_ID_MAC STBTT_MAC_LANG_ENGLISH =0 , STBTT_MAC_LANG_JAPANESE =11, STBTT_MAC_LANG_ARABIC =12, STBTT_MAC_LANG_KOREAN =23, STBTT_MAC_LANG_DUTCH =4 , STBTT_MAC_LANG_RUSSIAN =32, STBTT_MAC_LANG_FRENCH =1 , STBTT_MAC_LANG_SPANISH =6 , STBTT_MAC_LANG_GERMAN =2 , STBTT_MAC_LANG_SWEDISH =5 , STBTT_MAC_LANG_HEBREW =10, STBTT_MAC_LANG_CHINESE_SIMPLIFIED =33, STBTT_MAC_LANG_ITALIAN =3 , STBTT_MAC_LANG_CHINESE_TRAD =19 }; #ifdef __cplusplus } #endif #endif // __STB_INCLUDE_STB_TRUETYPE_H__ /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //// //// IMPLEMENTATION //// //// #ifdef STB_TRUETYPE_IMPLEMENTATION ////////////////////////////////////////////////////////////////////////// // // accessors to parse data from file // // on platforms that don't allow misaligned reads, if we want to allow // truetype fonts that aren't padded to alignment, define ALLOW_UNALIGNED_TRUETYPE #define ttBYTE(p) (* (stbtt_uint8 *) (p)) #define ttCHAR(p) (* (stbtt_int8 *) (p)) #define ttFixed(p) ttLONG(p) #if defined(STB_TRUETYPE_BIGENDIAN) && !defined(ALLOW_UNALIGNED_TRUETYPE) #define ttUSHORT(p) (* (stbtt_uint16 *) (p)) #define ttSHORT(p) (* (stbtt_int16 *) (p)) #define ttULONG(p) (* (stbtt_uint32 *) (p)) #define ttLONG(p) (* (stbtt_int32 *) (p)) #else stbtt_uint16 ttUSHORT(const stbtt_uint8 *p) { return p[0]*256 + p[1]; } stbtt_int16 ttSHORT(const stbtt_uint8 *p) { return p[0]*256 + p[1]; } stbtt_uint32 ttULONG(const stbtt_uint8 *p) { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; } stbtt_int32 ttLONG(const stbtt_uint8 *p) { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; } #endif #define stbtt_tag4(p,c0,c1,c2,c3) ((p)[0] == (c0) && (p)[1] == (c1) && (p)[2] == (c2) && (p)[3] == (c3)) #define stbtt_tag(p,str) stbtt_tag4(p,str[0],str[1],str[2],str[3]) static int stbtt__isfont(const stbtt_uint8 *font) { // check the version number if (stbtt_tag4(font, '1',0,0,0)) return 1; // TrueType 1 if (stbtt_tag(font, "typ1")) return 1; // TrueType with type 1 font -- we don't support this! if (stbtt_tag(font, "OTTO")) return 1; // OpenType with CFF if (stbtt_tag4(font, 0,1,0,0)) return 1; // OpenType 1.0 return 0; } // @OPTIMIZE: binary search static stbtt_uint32 stbtt__find_table(stbtt_uint8 *data, stbtt_uint32 fontstart, const char *tag) { stbtt_int32 num_tables = ttUSHORT(data+fontstart+4); stbtt_uint32 tabledir = fontstart + 12; stbtt_int32 i; for (i=0; i < num_tables; ++i) { stbtt_uint32 loc = tabledir + 16*i; if (stbtt_tag(data+loc+0, tag)) return ttULONG(data+loc+8); } return 0; } int stbtt_GetFontOffsetForIndex(const unsigned char *font_collection, int index) { // if it's just a font, there's only one valid index if (stbtt__isfont(font_collection)) return index == 0 ? 0 : -1; // check if it's a TTC if (stbtt_tag(font_collection, "ttcf")) { // version 1? if (ttULONG(font_collection+4) == 0x00010000 || ttULONG(font_collection+4) == 0x00020000) { stbtt_int32 n = ttLONG(font_collection+8); if (index >= n) return -1; return ttULONG(font_collection+12+index*14); } } return -1; } int stbtt_InitFont(stbtt_fontinfo *info, const unsigned char *data2, int fontstart) { stbtt_uint8 *data = (stbtt_uint8 *) data2; stbtt_uint32 cmap, t; stbtt_int32 i,numTables; info->data = data; info->fontstart = fontstart; cmap = stbtt__find_table(data, fontstart, "cmap"); // required info->loca = stbtt__find_table(data, fontstart, "loca"); // required info->head = stbtt__find_table(data, fontstart, "head"); // required info->glyf = stbtt__find_table(data, fontstart, "glyf"); // required info->hhea = stbtt__find_table(data, fontstart, "hhea"); // required info->hmtx = stbtt__find_table(data, fontstart, "hmtx"); // required info->kern = stbtt__find_table(data, fontstart, "kern"); // not required if (!cmap || !info->loca || !info->head || !info->glyf || !info->hhea || !info->hmtx) return 0; t = stbtt__find_table(data, fontstart, "maxp"); if (t) info->numGlyphs = ttUSHORT(data+t+4); else info->numGlyphs = 0xffff; // find a cmap encoding table we understand *now* to avoid searching // later. (todo: could make this installable) // the same regardless of glyph. numTables = ttUSHORT(data + cmap + 2); info->index_map = 0; for (i=0; i < numTables; ++i) { stbtt_uint32 encoding_record = cmap + 4 + 8 * i; // find an encoding we understand: switch(ttUSHORT(data+encoding_record)) { case STBTT_PLATFORM_ID_MICROSOFT: switch (ttUSHORT(data+encoding_record+2)) { case STBTT_MS_EID_UNICODE_BMP: case STBTT_MS_EID_UNICODE_FULL: // MS/Unicode info->index_map = cmap + ttULONG(data+encoding_record+4); break; } break; } } if (info->index_map == 0) return 0; info->indexToLocFormat = ttUSHORT(data+info->head + 50); return 1; } int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codepoint) { stbtt_uint8 *data = info->data; stbtt_uint32 index_map = info->index_map; stbtt_uint16 format = ttUSHORT(data + index_map + 0); if (format == 0) { // apple byte encoding stbtt_int32 bytes = ttUSHORT(data + index_map + 2); if (unicode_codepoint < bytes-6) return ttBYTE(data + index_map + 6 + unicode_codepoint); return 0; } else if (format == 6) { stbtt_uint32 first = ttUSHORT(data + index_map + 6); stbtt_uint32 count = ttUSHORT(data + index_map + 8); if ((stbtt_uint32) unicode_codepoint >= first && (stbtt_uint32) unicode_codepoint < first+count) return ttUSHORT(data + index_map + 10 + (unicode_codepoint - first)*2); return 0; } else if (format == 2) { STBTT_assert(0); // @TODO: high-byte mapping for japanese/chinese/korean return 0; } else if (format == 4) { // standard mapping for windows fonts: binary search collection of ranges stbtt_uint16 segcount = ttUSHORT(data+index_map+6) >> 1; stbtt_uint16 searchRange = ttUSHORT(data+index_map+8) >> 1; stbtt_uint16 entrySelector = ttUSHORT(data+index_map+10); stbtt_uint16 rangeShift = ttUSHORT(data+index_map+12) >> 1; stbtt_uint16 item, offset, start, end; // do a binary search of the segments stbtt_uint32 endCount = index_map + 14; stbtt_uint32 search = endCount; if (unicode_codepoint > 0xffff) return 0; // they lie from endCount .. endCount + segCount // but searchRange is the nearest power of two, so... if (unicode_codepoint >= ttUSHORT(data + search + rangeShift*2)) search += rangeShift*2; // now decrement to bias correctly to find smallest search -= 2; while (entrySelector) { stbtt_uint16 start, end; searchRange >>= 1; start = ttUSHORT(data + search + 2 + segcount*2 + 2); end = ttUSHORT(data + search + 2); start = ttUSHORT(data + search + searchRange*2 + segcount*2 + 2); end = ttUSHORT(data + search + searchRange*2); if (unicode_codepoint > end) search += searchRange*2; --entrySelector; } search += 2; item = (stbtt_uint16) ((search - endCount) >> 1); STBTT_assert(unicode_codepoint <= ttUSHORT(data + endCount + 2*item)); start = ttUSHORT(data + index_map + 14 + segcount*2 + 2 + 2*item); end = ttUSHORT(data + index_map + 14 + 2 + 2*item); if (unicode_codepoint < start) return 0; offset = ttUSHORT(data + index_map + 14 + segcount*6 + 2 + 2*item); if (offset == 0) return (stbtt_uint16) (unicode_codepoint + ttSHORT(data + index_map + 14 + segcount*4 + 2 + 2*item)); return ttUSHORT(data + offset + (unicode_codepoint-start)*2 + index_map + 14 + segcount*6 + 2 + 2*item); } else if (format == 12 || format == 13) { stbtt_uint32 ngroups = ttULONG(data+index_map+12); stbtt_int32 low,high; low = 0; high = (stbtt_int32)ngroups; // Binary search the right group. while (low < high) { stbtt_int32 mid = low + ((high-low) >> 1); // rounds down, so low <= mid < high stbtt_uint32 start_char = ttULONG(data+index_map+16+mid*12); stbtt_uint32 end_char = ttULONG(data+index_map+16+mid*12+4); if ((stbtt_uint32) unicode_codepoint < start_char) high = mid; else if ((stbtt_uint32) unicode_codepoint > end_char) low = mid+1; else { stbtt_uint32 start_glyph = ttULONG(data+index_map+16+mid*12+8); if (format == 12) return start_glyph + unicode_codepoint-start_char; else // format == 13 return start_glyph; } } return 0; // not found } // @TODO STBTT_assert(0); return 0; } int stbtt_GetCodepointShape(const stbtt_fontinfo *info, int unicode_codepoint, stbtt_vertex **vertices) { return stbtt_GetGlyphShape(info, stbtt_FindGlyphIndex(info, unicode_codepoint), vertices); } static void stbtt_setvertex(stbtt_vertex *v, stbtt_uint8 type, stbtt_int32 x, stbtt_int32 y, stbtt_int32 cx, stbtt_int32 cy) { v->type = type; v->x = (stbtt_int16) x; v->y = (stbtt_int16) y; v->cx = (stbtt_int16) cx; v->cy = (stbtt_int16) cy; } static int stbtt__GetGlyfOffset(const stbtt_fontinfo *info, int glyph_index) { int g1,g2; if (glyph_index >= info->numGlyphs) return -1; // glyph index out of range if (info->indexToLocFormat >= 2) return -1; // unknown index->glyph map format if (info->indexToLocFormat == 0) { g1 = info->glyf + ttUSHORT(info->data + info->loca + glyph_index * 2) * 2; g2 = info->glyf + ttUSHORT(info->data + info->loca + glyph_index * 2 + 2) * 2; } else { g1 = info->glyf + ttULONG (info->data + info->loca + glyph_index * 4); g2 = info->glyf + ttULONG (info->data + info->loca + glyph_index * 4 + 4); } return g1==g2 ? -1 : g1; // if length is 0, return -1 } int stbtt_GetGlyphBox(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1) { int g = stbtt__GetGlyfOffset(info, glyph_index); if (g < 0) return 0; if (x0) *x0 = ttSHORT(info->data + g + 2); if (y0) *y0 = ttSHORT(info->data + g + 4); if (x1) *x1 = ttSHORT(info->data + g + 6); if (y1) *y1 = ttSHORT(info->data + g + 8); return 1; } int stbtt_GetCodepointBox(const stbtt_fontinfo *info, int codepoint, int *x0, int *y0, int *x1, int *y1) { return stbtt_GetGlyphBox(info, stbtt_FindGlyphIndex(info,codepoint), x0,y0,x1,y1); } int stbtt_IsGlyphEmpty(const stbtt_fontinfo *info, int glyph_index) { stbtt_int16 numberOfContours; int g = stbtt__GetGlyfOffset(info, glyph_index); if (g < 0) return 1; numberOfContours = ttSHORT(info->data + g); return numberOfContours == 0; } static int stbtt__close_shape(stbtt_vertex *vertices, int num_vertices, int was_off, int start_off, stbtt_int32 sx, stbtt_int32 sy, stbtt_int32 scx, stbtt_int32 scy, stbtt_int32 cx, stbtt_int32 cy) { if (start_off) { if (was_off) stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, (cx+scx)>>1, (cy+scy)>>1, cx,cy); stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, sx,sy,scx,scy); } else { if (was_off) stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve,sx,sy,cx,cy); else stbtt_setvertex(&vertices[num_vertices++], STBTT_vline,sx,sy,0,0); } return num_vertices; } int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **pvertices) { stbtt_int16 numberOfContours; stbtt_uint8 *endPtsOfContours; stbtt_uint8 *data = info->data; stbtt_vertex *vertices=0; int num_vertices=0; int g = stbtt__GetGlyfOffset(info, glyph_index); *pvertices = NULL; if (g < 0) return 0; numberOfContours = ttSHORT(data + g); if (numberOfContours > 0) { stbtt_uint8 flags=0,flagcount; stbtt_int32 ins, i,j=0,m,n, next_move, was_off=0, off, start_off=0; stbtt_int32 x,y,cx,cy,sx,sy, scx,scy; stbtt_uint8 *points; endPtsOfContours = (data + g + 10); ins = ttUSHORT(data + g + 10 + numberOfContours * 2); points = data + g + 10 + numberOfContours * 2 + 2 + ins; n = 1+ttUSHORT(endPtsOfContours + numberOfContours*2-2); m = n + 2*numberOfContours; // a loose bound on how many vertices we might need vertices = (stbtt_vertex *) STBTT_malloc(m * sizeof(vertices[0]), info->userdata); if (vertices == 0) return 0; next_move = 0; flagcount=0; // in first pass, we load uninterpreted data into the allocated array // above, shifted to the end of the array so we won't overwrite it when // we create our final data starting from the front off = m - n; // starting offset for uninterpreted data, regardless of how m ends up being calculated // first load flags for (i=0; i < n; ++i) { if (flagcount == 0) { flags = *points++; if (flags & 8) flagcount = *points++; } else --flagcount; vertices[off+i].type = flags; } // now load x coordinates x=0; for (i=0; i < n; ++i) { flags = vertices[off+i].type; if (flags & 2) { stbtt_int16 dx = *points++; x += (flags & 16) ? dx : -dx; // ??? } else { if (!(flags & 16)) { x = x + (stbtt_int16) (points[0]*256 + points[1]); points += 2; } } vertices[off+i].x = (stbtt_int16) x; } // now load y coordinates y=0; for (i=0; i < n; ++i) { flags = vertices[off+i].type; if (flags & 4) { stbtt_int16 dy = *points++; y += (flags & 32) ? dy : -dy; // ??? } else { if (!(flags & 32)) { y = y + (stbtt_int16) (points[0]*256 + points[1]); points += 2; } } vertices[off+i].y = (stbtt_int16) y; } // now convert them to our format num_vertices=0; sx = sy = cx = cy = scx = scy = 0; for (i=0; i < n; ++i) { flags = vertices[off+i].type; x = (stbtt_int16) vertices[off+i].x; y = (stbtt_int16) vertices[off+i].y; if (next_move == i) { if (i != 0) num_vertices = stbtt__close_shape(vertices, num_vertices, was_off, start_off, sx,sy,scx,scy,cx,cy); // now start the new one start_off = !(flags & 1); if (start_off) { // if we start off with an off-curve point, then when we need to find a point on the curve // where we can start, and we need to save some state for when we wraparound. scx = x; scy = y; if (!(vertices[off+i+1].type & 1)) { // next point is also a curve point, so interpolate an on-point curve sx = (x + (stbtt_int32) vertices[off+i+1].x) >> 1; sy = (y + (stbtt_int32) vertices[off+i+1].y) >> 1; } else { // otherwise just use the next point as our start point sx = (stbtt_int32) vertices[off+i+1].x; sy = (stbtt_int32) vertices[off+i+1].y; ++i; // we're using point i+1 as the starting point, so skip it } } else { sx = x; sy = y; } stbtt_setvertex(&vertices[num_vertices++], STBTT_vmove,sx,sy,0,0); was_off = 0; next_move = 1 + ttUSHORT(endPtsOfContours+j*2); ++j; } else { if (!(flags & 1)) { // if it's a curve if (was_off) // two off-curve control points in a row means interpolate an on-curve midpoint stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, (cx+x)>>1, (cy+y)>>1, cx, cy); cx = x; cy = y; was_off = 1; } else { if (was_off) stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, x,y, cx, cy); else stbtt_setvertex(&vertices[num_vertices++], STBTT_vline, x,y,0,0); was_off = 0; } } } num_vertices = stbtt__close_shape(vertices, num_vertices, was_off, start_off, sx,sy,scx,scy,cx,cy); } else if (numberOfContours == -1) { // Compound shapes. int more = 1; stbtt_uint8 *comp = data + g + 10; num_vertices = 0; vertices = 0; while (more) { stbtt_uint16 flags, gidx; int comp_num_verts = 0, i; stbtt_vertex *comp_verts = 0, *tmp = 0; float mtx[6] = {1,0,0,1,0,0}, m, n; flags = ttSHORT(comp); comp+=2; gidx = ttSHORT(comp); comp+=2; if (flags & 2) { // XY values if (flags & 1) { // shorts mtx[4] = ttSHORT(comp); comp+=2; mtx[5] = ttSHORT(comp); comp+=2; } else { mtx[4] = ttCHAR(comp); comp+=1; mtx[5] = ttCHAR(comp); comp+=1; } } else { // @TODO handle matching point STBTT_assert(0); } if (flags & (1<<3)) { // WE_HAVE_A_SCALE mtx[0] = mtx[3] = ttSHORT(comp)/16384.0f; comp+=2; mtx[1] = mtx[2] = 0; } else if (flags & (1<<6)) { // WE_HAVE_AN_X_AND_YSCALE mtx[0] = ttSHORT(comp)/16384.0f; comp+=2; mtx[1] = mtx[2] = 0; mtx[3] = ttSHORT(comp)/16384.0f; comp+=2; } else if (flags & (1<<7)) { // WE_HAVE_A_TWO_BY_TWO mtx[0] = ttSHORT(comp)/16384.0f; comp+=2; mtx[1] = ttSHORT(comp)/16384.0f; comp+=2; mtx[2] = ttSHORT(comp)/16384.0f; comp+=2; mtx[3] = ttSHORT(comp)/16384.0f; comp+=2; } // Find transformation scales. m = (float) sqrt(mtx[0]*mtx[0] + mtx[1]*mtx[1]); n = (float) sqrt(mtx[2]*mtx[2] + mtx[3]*mtx[3]); // Get indexed glyph. comp_num_verts = stbtt_GetGlyphShape(info, gidx, &comp_verts); if (comp_num_verts > 0) { // Transform vertices. for (i = 0; i < comp_num_verts; ++i) { stbtt_vertex* v = &comp_verts[i]; stbtt_vertex_type x,y; x=v->x; y=v->y; v->x = (stbtt_vertex_type)(m * (mtx[0]*x + mtx[2]*y + mtx[4])); v->y = (stbtt_vertex_type)(n * (mtx[1]*x + mtx[3]*y + mtx[5])); x=v->cx; y=v->cy; v->cx = (stbtt_vertex_type)(m * (mtx[0]*x + mtx[2]*y + mtx[4])); v->cy = (stbtt_vertex_type)(n * (mtx[1]*x + mtx[3]*y + mtx[5])); } // Append vertices. tmp = (stbtt_vertex*)STBTT_malloc((num_vertices+comp_num_verts)*sizeof(stbtt_vertex), info->userdata); if (!tmp) { if (vertices) STBTT_free(vertices, info->userdata); if (comp_verts) STBTT_free(comp_verts, info->userdata); return 0; } if (num_vertices > 0) memcpy(tmp, vertices, num_vertices*sizeof(stbtt_vertex)); memcpy(tmp+num_vertices, comp_verts, comp_num_verts*sizeof(stbtt_vertex)); if (vertices) STBTT_free(vertices, info->userdata); vertices = tmp; STBTT_free(comp_verts, info->userdata); num_vertices += comp_num_verts; } // More components ? more = flags & (1<<5); } } else if (numberOfContours < 0) { // @TODO other compound variations? STBTT_assert(0); } else { // numberOfCounters == 0, do nothing } *pvertices = vertices; return num_vertices; } void stbtt_GetGlyphHMetrics(const stbtt_fontinfo *info, int glyph_index, int *advanceWidth, int *leftSideBearing) { stbtt_uint16 numOfLongHorMetrics = ttUSHORT(info->data+info->hhea + 34); if (glyph_index < numOfLongHorMetrics) { if (advanceWidth) *advanceWidth = ttSHORT(info->data + info->hmtx + 4*glyph_index); if (leftSideBearing) *leftSideBearing = ttSHORT(info->data + info->hmtx + 4*glyph_index + 2); } else { if (advanceWidth) *advanceWidth = ttSHORT(info->data + info->hmtx + 4*(numOfLongHorMetrics-1)); if (leftSideBearing) *leftSideBearing = ttSHORT(info->data + info->hmtx + 4*numOfLongHorMetrics + 2*(glyph_index - numOfLongHorMetrics)); } } int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2) { stbtt_uint8 *data = info->data + info->kern; stbtt_uint32 needle, straw; int l, r, m; // we only look at the first table. it must be 'horizontal' and format 0. if (!info->kern) return 0; if (ttUSHORT(data+2) < 1) // number of tables, need at least 1 return 0; if (ttUSHORT(data+8) != 1) // horizontal flag must be set in format return 0; l = 0; r = ttUSHORT(data+10) - 1; needle = glyph1 << 16 | glyph2; while (l <= r) { m = (l + r) >> 1; straw = ttULONG(data+18+(m*6)); // note: unaligned read if (needle < straw) r = m - 1; else if (needle > straw) l = m + 1; else return ttSHORT(data+22+(m*6)); } return 0; } int stbtt_GetCodepointKernAdvance(const stbtt_fontinfo *info, int ch1, int ch2) { if (!info->kern) // if no kerning table, don't waste time looking up both codepoint->glyphs return 0; return stbtt_GetGlyphKernAdvance(info, stbtt_FindGlyphIndex(info,ch1), stbtt_FindGlyphIndex(info,ch2)); } void stbtt_GetCodepointHMetrics(const stbtt_fontinfo *info, int codepoint, int *advanceWidth, int *leftSideBearing) { stbtt_GetGlyphHMetrics(info, stbtt_FindGlyphIndex(info,codepoint), advanceWidth, leftSideBearing); } void stbtt_GetFontVMetrics(const stbtt_fontinfo *info, int *ascent, int *descent, int *lineGap) { if (ascent ) *ascent = ttSHORT(info->data+info->hhea + 4); if (descent) *descent = ttSHORT(info->data+info->hhea + 6); if (lineGap) *lineGap = ttSHORT(info->data+info->hhea + 8); } void stbtt_GetFontBoundingBox(const stbtt_fontinfo *info, int *x0, int *y0, int *x1, int *y1) { *x0 = ttSHORT(info->data + info->head + 36); *y0 = ttSHORT(info->data + info->head + 38); *x1 = ttSHORT(info->data + info->head + 40); *y1 = ttSHORT(info->data + info->head + 42); } float stbtt_ScaleForPixelHeight(const stbtt_fontinfo *info, float height) { int fheight = ttSHORT(info->data + info->hhea + 4) - ttSHORT(info->data + info->hhea + 6); return (float) height / fheight; } float stbtt_ScaleForMappingEmToPixels(const stbtt_fontinfo *info, float pixels) { int unitsPerEm = ttUSHORT(info->data + info->head + 18); return pixels / unitsPerEm; } void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *v) { STBTT_free(v, info->userdata); } ////////////////////////////////////////////////////////////////////////////// // // antialiasing software rasterizer // void stbtt_GetGlyphBitmapBoxSubpixel(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y,float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1) { int x0,y0,x1,y1; if (!stbtt_GetGlyphBox(font, glyph, &x0,&y0,&x1,&y1)) x0=y0=x1=y1=0; // e.g. space character // now move to integral bboxes (treating pixels as little squares, what pixels get touched)? if (ix0) *ix0 = STBTT_ifloor(x0 * scale_x + shift_x); if (iy0) *iy0 = -STBTT_iceil (y1 * scale_y + shift_y); if (ix1) *ix1 = STBTT_iceil (x1 * scale_x + shift_x); if (iy1) *iy1 = -STBTT_ifloor(y0 * scale_y + shift_y); } void stbtt_GetGlyphBitmapBox(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1) { stbtt_GetGlyphBitmapBoxSubpixel(font, glyph, scale_x, scale_y,0.0f,0.0f, ix0, iy0, ix1, iy1); } void stbtt_GetCodepointBitmapBoxSubpixel(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1) { stbtt_GetGlyphBitmapBoxSubpixel(font, stbtt_FindGlyphIndex(font,codepoint), scale_x, scale_y,shift_x,shift_y, ix0,iy0,ix1,iy1); } void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1) { stbtt_GetCodepointBitmapBoxSubpixel(font, codepoint, scale_x, scale_y,0.0f,0.0f, ix0,iy0,ix1,iy1); } typedef struct stbtt__edge { float x0,y0, x1,y1; int invert; } stbtt__edge; typedef struct stbtt__active_edge { int x,dx; float ey; struct stbtt__active_edge *next; int valid; } stbtt__active_edge; #define FIXSHIFT 10 #define FIX (1 << FIXSHIFT) #define FIXMASK (FIX-1) static stbtt__active_edge *new_active(stbtt__edge *e, int off_x, float start_point, void *userdata) { stbtt__active_edge *z = (stbtt__active_edge *) STBTT_malloc(sizeof(*z), userdata); // @TODO: make a pool of these!!! float dxdy = (e->x1 - e->x0) / (e->y1 - e->y0); STBTT_assert(e->y0 <= start_point); if (!z) return z; // round dx down to avoid going too far if (dxdy < 0) z->dx = -STBTT_ifloor(FIX * -dxdy); else z->dx = STBTT_ifloor(FIX * dxdy); z->x = STBTT_ifloor(FIX * (e->x0 + dxdy * (start_point - e->y0))); z->x -= off_x * FIX; z->ey = e->y1; z->next = 0; z->valid = e->invert ? 1 : -1; return z; } // note: this routine clips fills that extend off the edges... ideally this // wouldn't happen, but it could happen if the truetype glyph bounding boxes // are wrong, or if the user supplies a too-small bitmap static void stbtt__fill_active_edges(unsigned char *scanline, int len, stbtt__active_edge *e, int max_weight) { // non-zero winding fill int x0=0, w=0; while (e) { if (w == 0) { // if we're currently at zero, we need to record the edge start point x0 = e->x; w += e->valid; } else { int x1 = e->x; w += e->valid; // if we went to zero, we need to draw if (w == 0) { int i = x0 >> FIXSHIFT; int j = x1 >> FIXSHIFT; if (i < len && j >= 0) { if (i == j) { // x0,x1 are the same pixel, so compute combined coverage scanline[i] = scanline[i] + (stbtt_uint8) ((x1 - x0) * max_weight >> FIXSHIFT); } else { if (i >= 0) // add antialiasing for x0 scanline[i] = scanline[i] + (stbtt_uint8) (((FIX - (x0 & FIXMASK)) * max_weight) >> FIXSHIFT); else i = -1; // clip if (j < len) // add antialiasing for x1 scanline[j] = scanline[j] + (stbtt_uint8) (((x1 & FIXMASK) * max_weight) >> FIXSHIFT); else j = len; // clip for (++i; i < j; ++i) // fill pixels between x0 and x1 scanline[i] = scanline[i] + (stbtt_uint8) max_weight; } } } } e = e->next; } } static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, int n, int vsubsample, int off_x, int off_y, void *userdata) { stbtt__active_edge *active = NULL; int y,j=0; int max_weight = (255 / vsubsample); // weight per vertical scanline int s; // vertical subsample index unsigned char scanline_data[512], *scanline; if (result->w > 512) scanline = (unsigned char *) STBTT_malloc(result->w, userdata); else scanline = scanline_data; y = off_y * vsubsample; e[n].y0 = (off_y + result->h) * (float) vsubsample + 1; while (j < result->h) { STBTT_memset(scanline, 0, result->w); for (s=0; s < vsubsample; ++s) { // find center of pixel for this scanline float scan_y = y + 0.5f; stbtt__active_edge **step = &active; // update all active edges; // remove all active edges that terminate before the center of this scanline while (*step) { stbtt__active_edge * z = *step; if (z->ey <= scan_y) { *step = z->next; // delete from list STBTT_assert(z->valid); z->valid = 0; STBTT_free(z, userdata); } else { z->x += z->dx; // advance to position for current scanline step = &((*step)->next); // advance through list } } // resort the list if needed for(;;) { int changed=0; step = &active; while (*step && (*step)->next) { if ((*step)->x > (*step)->next->x) { stbtt__active_edge *t = *step; stbtt__active_edge *q = t->next; t->next = q->next; q->next = t; *step = q; changed = 1; } step = &(*step)->next; } if (!changed) break; } // insert all edges that start before the center of this scanline -- omit ones that also end on this scanline while (e->y0 <= scan_y) { if (e->y1 > scan_y) { stbtt__active_edge *z = new_active(e, off_x, scan_y, userdata); // find insertion point if (active == NULL) active = z; else if (z->x < active->x) { // insert at front z->next = active; active = z; } else { // find thing to insert AFTER stbtt__active_edge *p = active; while (p->next && p->next->x < z->x) p = p->next; // at this point, p->next->x is NOT < z->x z->next = p->next; p->next = z; } } ++e; } // now process all active edges in XOR fashion if (active) stbtt__fill_active_edges(scanline, result->w, active, max_weight); ++y; } STBTT_memcpy(result->pixels + j * result->stride, scanline, result->w); ++j; } while (active) { stbtt__active_edge *z = active; active = active->next; STBTT_free(z, userdata); } if (scanline != scanline_data) STBTT_free(scanline, userdata); } static int stbtt__edge_compare(const void *p, const void *q) { stbtt__edge *a = (stbtt__edge *) p; stbtt__edge *b = (stbtt__edge *) q; if (a->y0 < b->y0) return -1; if (a->y0 > b->y0) return 1; return 0; } typedef struct { float x,y; } stbtt__point; static void stbtt__rasterize(stbtt__bitmap *result, stbtt__point *pts, int *wcount, int windings, float scale_x, float scale_y, float shift_x, float shift_y, int off_x, int off_y, int invert, void *userdata) { float y_scale_inv = invert ? -scale_y : scale_y; stbtt__edge *e; int n,i,j,k,m; int vsubsample = result->h < 8 ? 15 : 5; // vsubsample should divide 255 evenly; otherwise we won't reach full opacity // now we have to blow out the windings into explicit edge lists n = 0; for (i=0; i < windings; ++i) n += wcount[i]; e = (stbtt__edge *) STBTT_malloc(sizeof(*e) * (n+1), userdata); // add an extra one as a sentinel if (e == 0) return; n = 0; m=0; for (i=0; i < windings; ++i) { stbtt__point *p = pts + m; m += wcount[i]; j = wcount[i]-1; for (k=0; k < wcount[i]; j=k++) { int a=k,b=j; // skip the edge if horizontal if (p[j].y == p[k].y) continue; // add edge from j to k to the list e[n].invert = 0; if (invert ? p[j].y > p[k].y : p[j].y < p[k].y) { e[n].invert = 1; a=j,b=k; } e[n].x0 = p[a].x * scale_x + shift_x; e[n].y0 = p[a].y * y_scale_inv * vsubsample + shift_y; e[n].x1 = p[b].x * scale_x + shift_x; e[n].y1 = p[b].y * y_scale_inv * vsubsample + shift_y; ++n; } } // now sort the edges by their highest point (should snap to integer, and then by x) STBTT_sort(e, n, sizeof(e[0]), stbtt__edge_compare); // now, traverse the scanlines and find the intersections on each scanline, use xor winding rule stbtt__rasterize_sorted_edges(result, e, n, vsubsample, off_x, off_y, userdata); STBTT_free(e, userdata); } static void stbtt__add_point(stbtt__point *points, int n, float x, float y) { if (!points) return; // during first pass, it's unallocated points[n].x = x; points[n].y = y; } // tesselate until threshhold p is happy... @TODO warped to compensate for non-linear stretching static int stbtt__tesselate_curve(stbtt__point *points, int *num_points, float x0, float y0, float x1, float y1, float x2, float y2, float objspace_flatness_squared, int n) { // midpoint float mx = (x0 + 2*x1 + x2)/4; float my = (y0 + 2*y1 + y2)/4; // versus directly drawn line float dx = (x0+x2)/2 - mx; float dy = (y0+y2)/2 - my; if (n > 16) // 65536 segments on one curve better be enough! return 1; if (dx*dx+dy*dy > objspace_flatness_squared) { // half-pixel error allowed... need to be smaller if AA stbtt__tesselate_curve(points, num_points, x0,y0, (x0+x1)/2.0f,(y0+y1)/2.0f, mx,my, objspace_flatness_squared,n+1); stbtt__tesselate_curve(points, num_points, mx,my, (x1+x2)/2.0f,(y1+y2)/2.0f, x2,y2, objspace_flatness_squared,n+1); } else { stbtt__add_point(points, *num_points,x2,y2); *num_points = *num_points+1; } return 1; } // returns number of contours stbtt__point *stbtt_FlattenCurves(stbtt_vertex *vertices, int num_verts, float objspace_flatness, int **contour_lengths, int *num_contours, void *userdata) { stbtt__point *points=0; int num_points=0; float objspace_flatness_squared = objspace_flatness * objspace_flatness; int i,n=0,start=0, pass; // count how many "moves" there are to get the contour count for (i=0; i < num_verts; ++i) if (vertices[i].type == STBTT_vmove) ++n; *num_contours = n; if (n == 0) return 0; *contour_lengths = (int *) STBTT_malloc(sizeof(**contour_lengths) * n, userdata); if (*contour_lengths == 0) { *num_contours = 0; return 0; } // make two passes through the points so we don't need to realloc for (pass=0; pass < 2; ++pass) { float x=0,y=0; if (pass == 1) { points = (stbtt__point *) STBTT_malloc(num_points * sizeof(points[0]), userdata); if (points == NULL) goto error; } num_points = 0; n= -1; for (i=0; i < num_verts; ++i) { switch (vertices[i].type) { case STBTT_vmove: // start the next contour if (n >= 0) (*contour_lengths)[n] = num_points - start; ++n; start = num_points; x = vertices[i].x, y = vertices[i].y; stbtt__add_point(points, num_points++, x,y); break; case STBTT_vline: x = vertices[i].x, y = vertices[i].y; stbtt__add_point(points, num_points++, x, y); break; case STBTT_vcurve: stbtt__tesselate_curve(points, &num_points, x,y, vertices[i].cx, vertices[i].cy, vertices[i].x, vertices[i].y, objspace_flatness_squared, 0); x = vertices[i].x, y = vertices[i].y; break; } } (*contour_lengths)[n] = num_points - start; } return points; error: STBTT_free(points, userdata); STBTT_free(*contour_lengths, userdata); *contour_lengths = 0; *num_contours = 0; return NULL; } void stbtt_Rasterize(stbtt__bitmap *result, float flatness_in_pixels, stbtt_vertex *vertices, int num_verts, float scale_x, float scale_y, float shift_x, float shift_y, int x_off, int y_off, int invert, void *userdata) { float scale = scale_x > scale_y ? scale_y : scale_x; int winding_count, *winding_lengths; stbtt__point *windings = stbtt_FlattenCurves(vertices, num_verts, flatness_in_pixels / scale, &winding_lengths, &winding_count, userdata); if (windings) { stbtt__rasterize(result, windings, winding_lengths, winding_count, scale_x, scale_y, shift_x, shift_y, x_off, y_off, invert, userdata); STBTT_free(winding_lengths, userdata); STBTT_free(windings, userdata); } } void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata) { STBTT_free(bitmap, userdata); } unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int glyph, int *width, int *height, int *xoff, int *yoff) { int ix0,iy0,ix1,iy1; stbtt__bitmap gbm; stbtt_vertex *vertices; int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices); if (scale_x == 0) scale_x = scale_y; if (scale_y == 0) { if (scale_x == 0) return NULL; scale_y = scale_x; } stbtt_GetGlyphBitmapBox(info, glyph, scale_x, scale_y, &ix0,&iy0,&ix1,&iy1); // now we get the size gbm.w = (ix1 - ix0); gbm.h = (iy1 - iy0); gbm.pixels = NULL; // in case we error if (width ) *width = gbm.w; if (height) *height = gbm.h; if (xoff ) *xoff = ix0; if (yoff ) *yoff = iy0; if (gbm.w && gbm.h) { gbm.pixels = (unsigned char *) STBTT_malloc(gbm.w * gbm.h, info->userdata); if (gbm.pixels) { gbm.stride = gbm.w; stbtt_Rasterize(&gbm, 0.35f, vertices, num_verts, scale_x, scale_y, shift_x, shift_y, ix0, iy0, 1, info->userdata); } } STBTT_free(vertices, info->userdata); return gbm.pixels; } unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff) { return stbtt_GetGlyphBitmapSubpixel(info, scale_x, scale_y, 0.0f, 0.0f, glyph, width, height, xoff, yoff); } void stbtt_MakeGlyphBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int glyph) { int ix0,iy0; stbtt_vertex *vertices; int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices); stbtt__bitmap gbm; stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale_x, scale_y, shift_x, shift_y, &ix0,&iy0,0,0); gbm.pixels = output; gbm.w = out_w; gbm.h = out_h; gbm.stride = out_stride; if (gbm.w && gbm.h) stbtt_Rasterize(&gbm, 0.35f, vertices, num_verts, scale_x, scale_y, shift_x, shift_y, ix0,iy0, 1, info->userdata); STBTT_free(vertices, info->userdata); } void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph) { stbtt_MakeGlyphBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, 0.0f,0.0f, glyph); } unsigned char *stbtt_GetCodepointBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, int *width, int *height, int *xoff, int *yoff) { return stbtt_GetGlyphBitmapSubpixel(info, scale_x, scale_y,shift_x,shift_y, stbtt_FindGlyphIndex(info,codepoint), width,height,xoff,yoff); } void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint) { stbtt_MakeGlyphBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, shift_x, shift_y, stbtt_FindGlyphIndex(info,codepoint)); } unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff) { return stbtt_GetCodepointBitmapSubpixel(info, scale_x, scale_y, 0.0f,0.0f, codepoint, width,height,xoff,yoff); } void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint) { stbtt_MakeCodepointBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, 0.0f,0.0f, codepoint); } ////////////////////////////////////////////////////////////////////////////// // // bitmap baking // // This is SUPER-CRAPPY packing to keep source code small extern int stbtt_BakeFontBitmap(const unsigned char *data, int offset, // font location (use offset=0 for plain .ttf) float pixel_height, // height of font in pixels unsigned char *pixels, int pw, int ph, // bitmap to be filled in int first_char, int num_chars, // characters to bake stbtt_bakedchar *chardata) { float scale; int x,y,bottom_y, i; stbtt_fontinfo f; stbtt_InitFont(&f, data, offset); STBTT_memset(pixels, 0, pw*ph); // background of 0 around pixels x=y=1; bottom_y = 1; scale = stbtt_ScaleForPixelHeight(&f, pixel_height); for (i=0; i < num_chars; ++i) { int advance, lsb, x0,y0,x1,y1,gw,gh; int g = stbtt_FindGlyphIndex(&f, first_char + i); stbtt_GetGlyphHMetrics(&f, g, &advance, &lsb); stbtt_GetGlyphBitmapBox(&f, g, scale,scale, &x0,&y0,&x1,&y1); gw = x1-x0; gh = y1-y0; if (x + gw + 1 >= pw) y = bottom_y, x = 1; // advance to next row if (y + gh + 1 >= ph) // check if it fits vertically AFTER potentially moving to next row return -i; STBTT_assert(x+gw < pw); STBTT_assert(y+gh < ph); stbtt_MakeGlyphBitmap(&f, pixels+x+y*pw, gw,gh,pw, scale,scale, g); chardata[i].x0 = (stbtt_int16) x; chardata[i].y0 = (stbtt_int16) y; chardata[i].x1 = (stbtt_int16) (x + gw); chardata[i].y1 = (stbtt_int16) (y + gh); chardata[i].xadvance = scale * advance; chardata[i].xoff = (float) x0; chardata[i].yoff = (float) y0; x = x + gw + 2; if (y+gh+2 > bottom_y) bottom_y = y+gh+2; } return bottom_y; } void stbtt_GetBakedQuad(stbtt_bakedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int opengl_fillrule) { float d3d_bias = opengl_fillrule ? 0 : -0.5f; float ipw = 1.0f / pw, iph = 1.0f / ph; stbtt_bakedchar *b = chardata + char_index; int round_x = STBTT_ifloor((*xpos + b->xoff) + 0.5); int round_y = STBTT_ifloor((*ypos + b->yoff) + 0.5); q->x0 = round_x + d3d_bias; q->y0 = round_y + d3d_bias; q->x1 = round_x + b->x1 - b->x0 + d3d_bias; q->y1 = round_y + b->y1 - b->y0 + d3d_bias; q->s0 = b->x0 * ipw; q->t0 = b->y0 * iph; q->s1 = b->x1 * ipw; q->t1 = b->y1 * iph; *xpos += b->xadvance; } ////////////////////////////////////////////////////////////////////////////// // // font name matching -- recommended not to use this // // check if a utf8 string contains a prefix which is the utf16 string; if so return length of matching utf8 string static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2) { stbtt_int32 i=0; // convert utf16 to utf8 and compare the results while converting while (len2) { stbtt_uint16 ch = s2[0]*256 + s2[1]; if (ch < 0x80) { if (i >= len1) return -1; if (s1[i++] != ch) return -1; } else if (ch < 0x800) { if (i+1 >= len1) return -1; if (s1[i++] != 0xc0 + (ch >> 6)) return -1; if (s1[i++] != 0x80 + (ch & 0x3f)) return -1; } else if (ch >= 0xd800 && ch < 0xdc00) { stbtt_uint32 c; stbtt_uint16 ch2 = s2[2]*256 + s2[3]; if (i+3 >= len1) return -1; c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000; if (s1[i++] != 0xf0 + (c >> 18)) return -1; if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1; if (s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1; if (s1[i++] != 0x80 + ((c ) & 0x3f)) return -1; s2 += 2; // plus another 2 below len2 -= 2; } else if (ch >= 0xdc00 && ch < 0xe000) { return -1; } else { if (i+2 >= len1) return -1; if (s1[i++] != 0xe0 + (ch >> 12)) return -1; if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1; if (s1[i++] != 0x80 + ((ch ) & 0x3f)) return -1; } s2 += 2; len2 -= 2; } return i; } int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2) { return len1 == stbtt__CompareUTF8toUTF16_bigendian_prefix((const stbtt_uint8*) s1, len1, (const stbtt_uint8*) s2, len2); } // returns results in whatever encoding you request... but note that 2-byte encodings // will be BIG-ENDIAN... use stbtt_CompareUTF8toUTF16_bigendian() to compare const char *stbtt_GetFontNameString(const stbtt_fontinfo *font, int *length, int platformID, int encodingID, int languageID, int nameID) { stbtt_int32 i,count,stringOffset; stbtt_uint8 *fc = font->data; stbtt_uint32 offset = font->fontstart; stbtt_uint32 nm = stbtt__find_table(fc, offset, "name"); if (!nm) return NULL; count = ttUSHORT(fc+nm+2); stringOffset = nm + ttUSHORT(fc+nm+4); for (i=0; i < count; ++i) { stbtt_uint32 loc = nm + 6 + 12 * i; if (platformID == ttUSHORT(fc+loc+0) && encodingID == ttUSHORT(fc+loc+2) && languageID == ttUSHORT(fc+loc+4) && nameID == ttUSHORT(fc+loc+6)) { *length = ttUSHORT(fc+loc+8); return (const char *) (fc+stringOffset+ttUSHORT(fc+loc+10)); } } return NULL; } static int stbtt__matchpair(stbtt_uint8 *fc, stbtt_uint32 nm, stbtt_uint8 *name, stbtt_int32 nlen, stbtt_int32 target_id, stbtt_int32 next_id) { stbtt_int32 i; stbtt_int32 count = ttUSHORT(fc+nm+2); stbtt_int32 stringOffset = nm + ttUSHORT(fc+nm+4); for (i=0; i < count; ++i) { stbtt_uint32 loc = nm + 6 + 12 * i; stbtt_int32 id = ttUSHORT(fc+loc+6); if (id == target_id) { // find the encoding stbtt_int32 platform = ttUSHORT(fc+loc+0), encoding = ttUSHORT(fc+loc+2), language = ttUSHORT(fc+loc+4); // is this a Unicode encoding? if (platform == 0 || (platform == 3 && encoding == 1) || (platform == 3 && encoding == 10)) { stbtt_int32 slen = ttUSHORT(fc+loc+8), off = ttUSHORT(fc+loc+10); // check if there's a prefix match stbtt_int32 matchlen = stbtt__CompareUTF8toUTF16_bigendian_prefix(name, nlen, fc+stringOffset+off,slen); if (matchlen >= 0) { // check for target_id+1 immediately following, with same encoding & language if (i+1 < count && ttUSHORT(fc+loc+12+6) == next_id && ttUSHORT(fc+loc+12) == platform && ttUSHORT(fc+loc+12+2) == encoding && ttUSHORT(fc+loc+12+4) == language) { stbtt_int32 slen = ttUSHORT(fc+loc+12+8), off = ttUSHORT(fc+loc+12+10); if (slen == 0) { if (matchlen == nlen) return 1; } else if (matchlen < nlen && name[matchlen] == ' ') { ++matchlen; if (stbtt_CompareUTF8toUTF16_bigendian((char*) (name+matchlen), nlen-matchlen, (char*)(fc+stringOffset+off),slen)) return 1; } } else { // if nothing immediately following if (matchlen == nlen) return 1; } } } // @TODO handle other encodings } } return 0; } static int stbtt__matches(stbtt_uint8 *fc, stbtt_uint32 offset, stbtt_uint8 *name, stbtt_int32 flags) { stbtt_int32 nlen = (stbtt_int32) STBTT_strlen((char *) name); stbtt_uint32 nm,hd; if (!stbtt__isfont(fc+offset)) return 0; // check italics/bold/underline flags in macStyle... if (flags) { hd = stbtt__find_table(fc, offset, "head"); if ((ttUSHORT(fc+hd+44) & 7) != (flags & 7)) return 0; } nm = stbtt__find_table(fc, offset, "name"); if (!nm) return 0; if (flags) { // if we checked the macStyle flags, then just check the family and ignore the subfamily if (stbtt__matchpair(fc, nm, name, nlen, 16, -1)) return 1; if (stbtt__matchpair(fc, nm, name, nlen, 1, -1)) return 1; if (stbtt__matchpair(fc, nm, name, nlen, 3, -1)) return 1; } else { if (stbtt__matchpair(fc, nm, name, nlen, 16, 17)) return 1; if (stbtt__matchpair(fc, nm, name, nlen, 1, 2)) return 1; if (stbtt__matchpair(fc, nm, name, nlen, 3, -1)) return 1; } return 0; } int stbtt_FindMatchingFont(const unsigned char *font_collection, const char *name_utf8, stbtt_int32 flags) { stbtt_int32 i; for (i=0;;++i) { stbtt_int32 off = stbtt_GetFontOffsetForIndex(font_collection, i); if (off < 0) return off; if (stbtt__matches((stbtt_uint8 *) font_collection, off, (stbtt_uint8*) name_utf8, flags)) return off; } } #endif // STB_TRUETYPE_IMPLEMENTATION |
Added ext/soil/SOIL.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 |
/* Jonathan Dummer 2007-07-26-10.36 Simple OpenGL Image Library Public Domain using Sean Barret's stb_image as a base Thanks to: * Sean Barret - for the awesome stb_image * Dan Venkitachalam - for finding some non-compliant DDS files, and patching some explicit casts * everybody at gamedev.net */ #define SOIL_CHECK_FOR_GL_ERRORS 0 #ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <wingdi.h> #include <GL/gl.h> #elif defined(__APPLE__) || defined(__APPLE_CC__) /* I can't test this Apple stuff! */ #include <OpenGL/gl.h> #include <Carbon/Carbon.h> #define APIENTRY #else #include <GL/gl.h> #include <GL/glx.h> #endif #include "SOIL.h" #include "stb_image_aug.h" #include "image_helper.h" #include "image_DXT.h" #include <stdlib.h> #include <string.h> /* error reporting */ char *result_string_pointer = "SOIL initialized"; /* for loading cube maps */ enum{ SOIL_CAPABILITY_UNKNOWN = -1, SOIL_CAPABILITY_NONE = 0, SOIL_CAPABILITY_PRESENT = 1 }; static int has_cubemap_capability = SOIL_CAPABILITY_UNKNOWN; int query_cubemap_capability( void ); #define SOIL_TEXTURE_WRAP_R 0x8072 #define SOIL_CLAMP_TO_EDGE 0x812F #define SOIL_NORMAL_MAP 0x8511 #define SOIL_REFLECTION_MAP 0x8512 #define SOIL_TEXTURE_CUBE_MAP 0x8513 #define SOIL_TEXTURE_BINDING_CUBE_MAP 0x8514 #define SOIL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 #define SOIL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 #define SOIL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 #define SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 #define SOIL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 #define SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A #define SOIL_PROXY_TEXTURE_CUBE_MAP 0x851B #define SOIL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C /* for non-power-of-two texture */ static int has_NPOT_capability = SOIL_CAPABILITY_UNKNOWN; int query_NPOT_capability( void ); /* for texture rectangles */ static int has_tex_rectangle_capability = SOIL_CAPABILITY_UNKNOWN; int query_tex_rectangle_capability( void ); #define SOIL_TEXTURE_RECTANGLE_ARB 0x84F5 #define SOIL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 /* for using DXT compression */ static int has_DXT_capability = SOIL_CAPABILITY_UNKNOWN; int query_DXT_capability( void ); #define SOIL_RGB_S3TC_DXT1 0x83F0 #define SOIL_RGBA_S3TC_DXT1 0x83F1 #define SOIL_RGBA_S3TC_DXT3 0x83F2 #define SOIL_RGBA_S3TC_DXT5 0x83F3 typedef void (APIENTRY * P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data); P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC soilGlCompressedTexImage2D = NULL; unsigned int SOIL_direct_load_DDS( const char *filename, unsigned int reuse_texture_ID, int flags, int loading_as_cubemap ); unsigned int SOIL_direct_load_DDS_from_memory( const unsigned char *const buffer, int buffer_length, unsigned int reuse_texture_ID, int flags, int loading_as_cubemap ); /* other functions */ unsigned int SOIL_internal_create_OGL_texture ( const unsigned char *const data, int width, int height, int channels, unsigned int reuse_texture_ID, unsigned int flags, unsigned int opengl_texture_type, unsigned int opengl_texture_target, unsigned int texture_check_size_enum ); /* and the code magic begins here [8^) */ unsigned int SOIL_load_OGL_texture ( const char *filename, int force_channels, unsigned int reuse_texture_ID, unsigned int flags ) { /* variables */ unsigned char* img; int width, height, channels; unsigned int tex_id; /* does the user want direct uploading of the image as a DDS file? */ if( flags & SOIL_FLAG_DDS_LOAD_DIRECT ) { /* 1st try direct loading of the image as a DDS file note: direct uploading will only load what is in the DDS file, no MIPmaps will be generated, the image will not be flipped, etc. */ tex_id = SOIL_direct_load_DDS( filename, reuse_texture_ID, flags, 0 ); if( tex_id ) { /* hey, it worked!! */ return tex_id; } } /* try to load the image */ img = SOIL_load_image( filename, &width, &height, &channels, force_channels ); /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* OK, make it a texture! */ tex_id = SOIL_internal_create_OGL_texture( img, width, height, channels, reuse_texture_ID, flags, GL_TEXTURE_2D, GL_TEXTURE_2D, GL_MAX_TEXTURE_SIZE ); /* and nuke the image data */ SOIL_free_image_data( img ); /* and return the handle, such as it is */ return tex_id; } unsigned int SOIL_load_OGL_HDR_texture ( const char *filename, int fake_HDR_format, int rescale_to_max, unsigned int reuse_texture_ID, unsigned int flags ) { /* variables */ unsigned char* img; int width, height, channels; unsigned int tex_id; /* no direct uploading of the image as a DDS file */ /* error check */ if( (fake_HDR_format != SOIL_HDR_RGBE) && (fake_HDR_format != SOIL_HDR_RGBdivA) && (fake_HDR_format != SOIL_HDR_RGBdivA2) ) { result_string_pointer = "Invalid fake HDR format specified"; return 0; } /* try to load the image (only the HDR type) */ img = stbi_hdr_load_rgbe( filename, &width, &height, &channels, 4 ); /* channels holds the original number of channels, which may have been forced */ if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* the load worked, do I need to convert it? */ if( fake_HDR_format == SOIL_HDR_RGBdivA ) { RGBE_to_RGBdivA( img, width, height, rescale_to_max ); } else if( fake_HDR_format == SOIL_HDR_RGBdivA2 ) { RGBE_to_RGBdivA2( img, width, height, rescale_to_max ); } /* OK, make it a texture! */ tex_id = SOIL_internal_create_OGL_texture( img, width, height, channels, reuse_texture_ID, flags, GL_TEXTURE_2D, GL_TEXTURE_2D, GL_MAX_TEXTURE_SIZE ); /* and nuke the image data */ SOIL_free_image_data( img ); /* and return the handle, such as it is */ return tex_id; } unsigned int SOIL_load_OGL_texture_from_memory ( const unsigned char *const buffer, int buffer_length, int force_channels, unsigned int reuse_texture_ID, unsigned int flags, int* rw, int* rh ) { /* variables */ unsigned char* img; int width, height, channels; unsigned int tex_id; /* does the user want direct uploading of the image as a DDS file? */ if( flags & SOIL_FLAG_DDS_LOAD_DIRECT ) { /* 1st try direct loading of the image as a DDS file note: direct uploading will only load what is in the DDS file, no MIPmaps will be generated, the image will not be flipped, etc. */ tex_id = SOIL_direct_load_DDS_from_memory( buffer, buffer_length, reuse_texture_ID, flags, 0 ); if( tex_id ) { /* hey, it worked!! */ return tex_id; } } /* try to load the image */ img = SOIL_load_image_from_memory( buffer, buffer_length, &width, &height, &channels, force_channels ); *rw = width; *rh = height; /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* OK, make it a texture! */ tex_id = SOIL_internal_create_OGL_texture( img, width, height, channels, reuse_texture_ID, flags, GL_TEXTURE_2D, GL_TEXTURE_2D, GL_MAX_TEXTURE_SIZE ); /* and nuke the image data */ SOIL_free_image_data( img ); /* and return the handle, such as it is */ return tex_id; } unsigned int SOIL_load_OGL_cubemap ( const char *x_pos_file, const char *x_neg_file, const char *y_pos_file, const char *y_neg_file, const char *z_pos_file, const char *z_neg_file, int force_channels, unsigned int reuse_texture_ID, unsigned int flags ) { /* variables */ unsigned char* img; int width, height, channels; unsigned int tex_id; /* error checking */ if( (x_pos_file == NULL) || (x_neg_file == NULL) || (y_pos_file == NULL) || (y_neg_file == NULL) || (z_pos_file == NULL) || (z_neg_file == NULL) ) { result_string_pointer = "Invalid cube map files list"; return 0; } /* capability checking */ if( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT ) { result_string_pointer = "No cube map capability present"; return 0; } /* 1st face: try to load the image */ img = SOIL_load_image( x_pos_file, &width, &height, &channels, force_channels ); /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* upload the texture, and create a texture ID if necessary */ tex_id = SOIL_internal_create_OGL_texture( img, width, height, channels, reuse_texture_ID, flags, SOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_X, SOIL_MAX_CUBE_MAP_TEXTURE_SIZE ); /* and nuke the image data */ SOIL_free_image_data( img ); /* continue? */ if( tex_id != 0 ) { /* 1st face: try to load the image */ img = SOIL_load_image( x_neg_file, &width, &height, &channels, force_channels ); /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* upload the texture, but reuse the assigned texture ID */ tex_id = SOIL_internal_create_OGL_texture( img, width, height, channels, tex_id, flags, SOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_X, SOIL_MAX_CUBE_MAP_TEXTURE_SIZE ); /* and nuke the image data */ SOIL_free_image_data( img ); } /* continue? */ if( tex_id != 0 ) { /* 1st face: try to load the image */ img = SOIL_load_image( y_pos_file, &width, &height, &channels, force_channels ); /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* upload the texture, but reuse the assigned texture ID */ tex_id = SOIL_internal_create_OGL_texture( img, width, height, channels, tex_id, flags, SOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_Y, SOIL_MAX_CUBE_MAP_TEXTURE_SIZE ); /* and nuke the image data */ SOIL_free_image_data( img ); } /* continue? */ if( tex_id != 0 ) { /* 1st face: try to load the image */ img = SOIL_load_image( y_neg_file, &width, &height, &channels, force_channels ); /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* upload the texture, but reuse the assigned texture ID */ tex_id = SOIL_internal_create_OGL_texture( img, width, height, channels, tex_id, flags, SOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Y, SOIL_MAX_CUBE_MAP_TEXTURE_SIZE ); /* and nuke the image data */ SOIL_free_image_data( img ); } /* continue? */ if( tex_id != 0 ) { /* 1st face: try to load the image */ img = SOIL_load_image( z_pos_file, &width, &height, &channels, force_channels ); /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* upload the texture, but reuse the assigned texture ID */ tex_id = SOIL_internal_create_OGL_texture( img, width, height, channels, tex_id, flags, SOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_Z, SOIL_MAX_CUBE_MAP_TEXTURE_SIZE ); /* and nuke the image data */ SOIL_free_image_data( img ); } /* continue? */ if( tex_id != 0 ) { /* 1st face: try to load the image */ img = SOIL_load_image( z_neg_file, &width, &height, &channels, force_channels ); /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* upload the texture, but reuse the assigned texture ID */ tex_id = SOIL_internal_create_OGL_texture( img, width, height, channels, tex_id, flags, SOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z, SOIL_MAX_CUBE_MAP_TEXTURE_SIZE ); /* and nuke the image data */ SOIL_free_image_data( img ); } /* and return the handle, such as it is */ return tex_id; } unsigned int SOIL_load_OGL_cubemap_from_memory ( const unsigned char *const x_pos_buffer, int x_pos_buffer_length, const unsigned char *const x_neg_buffer, int x_neg_buffer_length, const unsigned char *const y_pos_buffer, int y_pos_buffer_length, const unsigned char *const y_neg_buffer, int y_neg_buffer_length, const unsigned char *const z_pos_buffer, int z_pos_buffer_length, const unsigned char *const z_neg_buffer, int z_neg_buffer_length, int force_channels, unsigned int reuse_texture_ID, unsigned int flags ) { /* variables */ unsigned char* img; int width, height, channels; unsigned int tex_id; /* error checking */ if( (x_pos_buffer == NULL) || (x_neg_buffer == NULL) || (y_pos_buffer == NULL) || (y_neg_buffer == NULL) || (z_pos_buffer == NULL) || (z_neg_buffer == NULL) ) { result_string_pointer = "Invalid cube map buffers list"; return 0; } /* capability checking */ if( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT ) { result_string_pointer = "No cube map capability present"; return 0; } /* 1st face: try to load the image */ img = SOIL_load_image_from_memory( x_pos_buffer, x_pos_buffer_length, &width, &height, &channels, force_channels ); /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* upload the texture, and create a texture ID if necessary */ tex_id = SOIL_internal_create_OGL_texture( img, width, height, channels, reuse_texture_ID, flags, SOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_X, SOIL_MAX_CUBE_MAP_TEXTURE_SIZE ); /* and nuke the image data */ SOIL_free_image_data( img ); /* continue? */ if( tex_id != 0 ) { /* 1st face: try to load the image */ img = SOIL_load_image_from_memory( x_neg_buffer, x_neg_buffer_length, &width, &height, &channels, force_channels ); /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* upload the texture, but reuse the assigned texture ID */ tex_id = SOIL_internal_create_OGL_texture( img, width, height, channels, tex_id, flags, SOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_X, SOIL_MAX_CUBE_MAP_TEXTURE_SIZE ); /* and nuke the image data */ SOIL_free_image_data( img ); } /* continue? */ if( tex_id != 0 ) { /* 1st face: try to load the image */ img = SOIL_load_image_from_memory( y_pos_buffer, y_pos_buffer_length, &width, &height, &channels, force_channels ); /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* upload the texture, but reuse the assigned texture ID */ tex_id = SOIL_internal_create_OGL_texture( img, width, height, channels, tex_id, flags, SOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_Y, SOIL_MAX_CUBE_MAP_TEXTURE_SIZE ); /* and nuke the image data */ SOIL_free_image_data( img ); } /* continue? */ if( tex_id != 0 ) { /* 1st face: try to load the image */ img = SOIL_load_image_from_memory( y_neg_buffer, y_neg_buffer_length, &width, &height, &channels, force_channels ); /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* upload the texture, but reuse the assigned texture ID */ tex_id = SOIL_internal_create_OGL_texture( img, width, height, channels, tex_id, flags, SOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Y, SOIL_MAX_CUBE_MAP_TEXTURE_SIZE ); /* and nuke the image data */ SOIL_free_image_data( img ); } /* continue? */ if( tex_id != 0 ) { /* 1st face: try to load the image */ img = SOIL_load_image_from_memory( z_pos_buffer, z_pos_buffer_length, &width, &height, &channels, force_channels ); /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* upload the texture, but reuse the assigned texture ID */ tex_id = SOIL_internal_create_OGL_texture( img, width, height, channels, tex_id, flags, SOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_Z, SOIL_MAX_CUBE_MAP_TEXTURE_SIZE ); /* and nuke the image data */ SOIL_free_image_data( img ); } /* continue? */ if( tex_id != 0 ) { /* 1st face: try to load the image */ img = SOIL_load_image_from_memory( z_neg_buffer, z_neg_buffer_length, &width, &height, &channels, force_channels ); /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* upload the texture, but reuse the assigned texture ID */ tex_id = SOIL_internal_create_OGL_texture( img, width, height, channels, tex_id, flags, SOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z, SOIL_MAX_CUBE_MAP_TEXTURE_SIZE ); /* and nuke the image data */ SOIL_free_image_data( img ); } /* and return the handle, such as it is */ return tex_id; } unsigned int SOIL_load_OGL_single_cubemap ( const char *filename, const char face_order[6], int force_channels, unsigned int reuse_texture_ID, unsigned int flags ) { /* variables */ unsigned char* img; int width, height, channels, i; unsigned int tex_id = 0; /* error checking */ if( filename == NULL ) { result_string_pointer = "Invalid single cube map file name"; return 0; } /* does the user want direct uploading of the image as a DDS file? */ if( flags & SOIL_FLAG_DDS_LOAD_DIRECT ) { /* 1st try direct loading of the image as a DDS file note: direct uploading will only load what is in the DDS file, no MIPmaps will be generated, the image will not be flipped, etc. */ tex_id = SOIL_direct_load_DDS( filename, reuse_texture_ID, flags, 1 ); if( tex_id ) { /* hey, it worked!! */ return tex_id; } } /* face order checking */ for( i = 0; i < 6; ++i ) { if( (face_order[i] != 'N') && (face_order[i] != 'S') && (face_order[i] != 'W') && (face_order[i] != 'E') && (face_order[i] != 'U') && (face_order[i] != 'D') ) { result_string_pointer = "Invalid single cube map face order"; return 0; }; } /* capability checking */ if( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT ) { result_string_pointer = "No cube map capability present"; return 0; } /* 1st off, try to load the full image */ img = SOIL_load_image( filename, &width, &height, &channels, force_channels ); /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* now, does this image have the right dimensions? */ if( (width != 6*height) && (6*width != height) ) { SOIL_free_image_data( img ); result_string_pointer = "Single cubemap image must have a 6:1 ratio"; return 0; } /* try the image split and create */ tex_id = SOIL_create_OGL_single_cubemap( img, width, height, channels, face_order, reuse_texture_ID, flags ); /* nuke the temporary image data and return the texture handle */ SOIL_free_image_data( img ); return tex_id; } unsigned int SOIL_load_OGL_single_cubemap_from_memory ( const unsigned char *const buffer, int buffer_length, const char face_order[6], int force_channels, unsigned int reuse_texture_ID, unsigned int flags ) { /* variables */ unsigned char* img; int width, height, channels, i; unsigned int tex_id = 0; /* error checking */ if( buffer == NULL ) { result_string_pointer = "Invalid single cube map buffer"; return 0; } /* does the user want direct uploading of the image as a DDS file? */ if( flags & SOIL_FLAG_DDS_LOAD_DIRECT ) { /* 1st try direct loading of the image as a DDS file note: direct uploading will only load what is in the DDS file, no MIPmaps will be generated, the image will not be flipped, etc. */ tex_id = SOIL_direct_load_DDS_from_memory( buffer, buffer_length, reuse_texture_ID, flags, 1 ); if( tex_id ) { /* hey, it worked!! */ return tex_id; } } /* face order checking */ for( i = 0; i < 6; ++i ) { if( (face_order[i] != 'N') && (face_order[i] != 'S') && (face_order[i] != 'W') && (face_order[i] != 'E') && (face_order[i] != 'U') && (face_order[i] != 'D') ) { result_string_pointer = "Invalid single cube map face order"; return 0; }; } /* capability checking */ if( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT ) { result_string_pointer = "No cube map capability present"; return 0; } /* 1st off, try to load the full image */ img = SOIL_load_image_from_memory( buffer, buffer_length, &width, &height, &channels, force_channels ); /* channels holds the original number of channels, which may have been forced */ if( (force_channels >= 1) && (force_channels <= 4) ) { channels = force_channels; } if( NULL == img ) { /* image loading failed */ result_string_pointer = stbi_failure_reason(); return 0; } /* now, does this image have the right dimensions? */ if( (width != 6*height) && (6*width != height) ) { SOIL_free_image_data( img ); result_string_pointer = "Single cubemap image must have a 6:1 ratio"; return 0; } /* try the image split and create */ tex_id = SOIL_create_OGL_single_cubemap( img, width, height, channels, face_order, reuse_texture_ID, flags ); /* nuke the temporary image data and return the texture handle */ SOIL_free_image_data( img ); return tex_id; } unsigned int SOIL_create_OGL_single_cubemap ( const unsigned char *const data, int width, int height, int channels, const char face_order[6], unsigned int reuse_texture_ID, unsigned int flags ) { /* variables */ unsigned char* sub_img; int dw, dh, sz, i; unsigned int tex_id; /* error checking */ if( data == NULL ) { result_string_pointer = "Invalid single cube map image data"; return 0; } /* face order checking */ for( i = 0; i < 6; ++i ) { if( (face_order[i] != 'N') && (face_order[i] != 'S') && (face_order[i] != 'W') && (face_order[i] != 'E') && (face_order[i] != 'U') && (face_order[i] != 'D') ) { result_string_pointer = "Invalid single cube map face order"; return 0; }; } /* capability checking */ if( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT ) { result_string_pointer = "No cube map capability present"; return 0; } /* now, does this image have the right dimensions? */ if( (width != 6*height) && (6*width != height) ) { result_string_pointer = "Single cubemap image must have a 6:1 ratio"; return 0; } /* which way am I stepping? */ if( width > height ) { dw = height; dh = 0; } else { dw = 0; dh = width; } sz = dw+dh; sub_img = (unsigned char *)malloc( sz*sz*channels ); /* do the splitting and uploading */ tex_id = reuse_texture_ID; for( i = 0; i < 6; ++i ) { int x, y, idx = 0; unsigned int cubemap_target = 0; /* copy in the sub-image */ for( y = i*dh; y < i*dh+sz; ++y ) { for( x = i*dw*channels; x < (i*dw+sz)*channels; ++x ) { sub_img[idx++] = data[y*width*channels+x]; } } /* what is my texture target? remember, this coordinate system is LHS if viewed from inside the cube! */ switch( face_order[i] ) { case 'N': cubemap_target = SOIL_TEXTURE_CUBE_MAP_POSITIVE_Z; break; case 'S': cubemap_target = SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z; break; case 'W': cubemap_target = SOIL_TEXTURE_CUBE_MAP_NEGATIVE_X; break; case 'E': cubemap_target = SOIL_TEXTURE_CUBE_MAP_POSITIVE_X; break; case 'U': cubemap_target = SOIL_TEXTURE_CUBE_MAP_POSITIVE_Y; break; case 'D': cubemap_target = SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Y; break; } /* upload it as a texture */ tex_id = SOIL_internal_create_OGL_texture( sub_img, sz, sz, channels, tex_id, flags, SOIL_TEXTURE_CUBE_MAP, cubemap_target, SOIL_MAX_CUBE_MAP_TEXTURE_SIZE ); } /* and nuke the image and sub-image data */ SOIL_free_image_data( sub_img ); /* and return the handle, such as it is */ return tex_id; } unsigned int SOIL_create_OGL_texture ( const unsigned char *const data, int width, int height, int channels, unsigned int reuse_texture_ID, unsigned int flags ) { /* wrapper function for 2D textures */ return SOIL_internal_create_OGL_texture( data, width, height, channels, reuse_texture_ID, flags, GL_TEXTURE_2D, GL_TEXTURE_2D, GL_MAX_TEXTURE_SIZE ); } #if SOIL_CHECK_FOR_GL_ERRORS void check_for_GL_errors( const char *calling_location ) { /* check for errors */ GLenum err_code = glGetError(); while( GL_NO_ERROR != err_code ) { printf( "OpenGL Error @ %s: %i", calling_location, err_code ); err_code = glGetError(); } } #else void check_for_GL_errors( const char *calling_location ) { /* no check for errors */ } #endif unsigned int SOIL_internal_create_OGL_texture ( const unsigned char *const data, int width, int height, int channels, unsigned int reuse_texture_ID, unsigned int flags, unsigned int opengl_texture_type, unsigned int opengl_texture_target, unsigned int texture_check_size_enum ) { /* variables */ unsigned char* img; unsigned int tex_id; unsigned int internal_texture_format = 0, original_texture_format = 0; int DXT_mode = SOIL_CAPABILITY_UNKNOWN; int max_supported_size; /* If the user wants to use the texture rectangle I kill a few flags */ if( flags & SOIL_FLAG_TEXTURE_RECTANGLE ) { /* well, the user asked for it, can we do that? */ if( query_tex_rectangle_capability() == SOIL_CAPABILITY_PRESENT ) { /* only allow this if the user in _NOT_ trying to do a cubemap! */ if( opengl_texture_type == GL_TEXTURE_2D ) { /* clean out the flags that cannot be used with texture rectangles */ flags &= ~( SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS ); /* and change my target */ opengl_texture_target = SOIL_TEXTURE_RECTANGLE_ARB; opengl_texture_type = SOIL_TEXTURE_RECTANGLE_ARB; } else { /* not allowed for any other uses (yes, I'm looking at you, cubemaps!) */ flags &= ~SOIL_FLAG_TEXTURE_RECTANGLE; } } else { /* can't do it, and that is a breakable offense (uv coords use pixels instead of [0,1]!) */ result_string_pointer = "Texture Rectangle extension unsupported"; return 0; } } /* create a copy the image data */ img = (unsigned char*)malloc( width*height*channels ); memcpy( img, data, width*height*channels ); /* does the user want me to invert the image? */ if( flags & SOIL_FLAG_INVERT_Y ) { int i, j; for( j = 0; j*2 < height; ++j ) { int index1 = j * width * channels; int index2 = (height - 1 - j) * width * channels; for( i = width * channels; i > 0; --i ) { unsigned char temp = img[index1]; img[index1] = img[index2]; img[index2] = temp; ++index1; ++index2; } } } /* does the user want me to scale the colors into the NTSC safe RGB range? */ if( flags & SOIL_FLAG_NTSC_SAFE_RGB ) { scale_image_RGB_to_NTSC_safe( img, width, height, channels ); } /* does the user want me to convert from straight to pre-multiplied alpha? (and do we even _have_ alpha?) */ if( flags & SOIL_FLAG_MULTIPLY_ALPHA ) { int i; switch( channels ) { case 2: for( i = 0; i < 2*width*height; i += 2 ) { img[i] = (img[i] * img[i+1] + 128) >> 8; } break; case 4: for( i = 0; i < 4*width*height; i += 4 ) { img[i+0] = (img[i+0] * img[i+3] + 128) >> 8; img[i+1] = (img[i+1] * img[i+3] + 128) >> 8; img[i+2] = (img[i+2] * img[i+3] + 128) >> 8; } break; default: /* no other number of channels contains alpha data */ break; } } /* if the user can't support NPOT textures, make sure we force the POT option */ if( (query_NPOT_capability() == SOIL_CAPABILITY_NONE) && !(flags & SOIL_FLAG_TEXTURE_RECTANGLE) ) { /* add in the POT flag */ flags |= SOIL_FLAG_POWER_OF_TWO; } /* how large of a texture can this OpenGL implementation handle? */ /* texture_check_size_enum will be GL_MAX_TEXTURE_SIZE or SOIL_MAX_CUBE_MAP_TEXTURE_SIZE */ glGetIntegerv( texture_check_size_enum, &max_supported_size ); /* do I need to make it a power of 2? */ if( (flags & SOIL_FLAG_POWER_OF_TWO) || /* user asked for it */ (flags & SOIL_FLAG_MIPMAPS) || /* need it for the MIP-maps */ (width > max_supported_size) || /* it's too big, (make sure it's */ (height > max_supported_size) ) /* 2^n for later down-sampling) */ { int new_width = 1; int new_height = 1; while( new_width < width ) { new_width *= 2; } while( new_height < height ) { new_height *= 2; } /* still? */ if( (new_width != width) || (new_height != height) ) { /* yep, resize */ unsigned char *resampled = (unsigned char*)malloc( channels*new_width*new_height ); up_scale_image( img, width, height, channels, resampled, new_width, new_height ); /* OJO this is for debug only! */ /* SOIL_save_image( "\\showme.bmp", SOIL_SAVE_TYPE_BMP, new_width, new_height, channels, resampled ); */ /* nuke the old guy, then point it at the new guy */ SOIL_free_image_data( img ); img = resampled; width = new_width; height = new_height; } } /* now, if it is too large... */ if( (width > max_supported_size) || (height > max_supported_size) ) { /* I've already made it a power of two, so simply use the MIPmapping code to reduce its size to the allowable maximum. */ unsigned char *resampled; int reduce_block_x = 1, reduce_block_y = 1; int new_width, new_height; if( width > max_supported_size ) { reduce_block_x = width / max_supported_size; } if( height > max_supported_size ) { reduce_block_y = height / max_supported_size; } new_width = width / reduce_block_x; new_height = height / reduce_block_y; resampled = (unsigned char*)malloc( channels*new_width*new_height ); /* perform the actual reduction */ mipmap_image( img, width, height, channels, resampled, reduce_block_x, reduce_block_y ); /* nuke the old guy, then point it at the new guy */ SOIL_free_image_data( img ); img = resampled; width = new_width; height = new_height; } /* does the user want us to use YCoCg color space? */ if( flags & SOIL_FLAG_CoCg_Y ) { /* this will only work with RGB and RGBA images */ convert_RGB_to_YCoCg( img, width, height, channels ); /* save_image_as_DDS( "CoCg_Y.dds", width, height, channels, img ); */ } /* create the OpenGL texture ID handle (note: allowing a forced texture ID lets me reload a texture) */ tex_id = reuse_texture_ID; if( tex_id == 0 ) { glGenTextures( 1, &tex_id ); } check_for_GL_errors( "glGenTextures" ); /* Note: sometimes glGenTextures fails (usually no OpenGL context) */ if( tex_id ) { /* and what type am I using as the internal texture format? */ switch( channels ) { case 1: original_texture_format = GL_LUMINANCE; break; case 2: original_texture_format = GL_LUMINANCE_ALPHA; break; case 3: original_texture_format = GL_RGB; break; case 4: original_texture_format = GL_RGBA; break; } internal_texture_format = original_texture_format; /* does the user want me to, and can I, save as DXT? */ if( flags & SOIL_FLAG_COMPRESS_TO_DXT ) { DXT_mode = query_DXT_capability(); if( DXT_mode == SOIL_CAPABILITY_PRESENT ) { /* I can use DXT, whether I compress it or OpenGL does */ if( (channels & 1) == 1 ) { /* 1 or 3 channels = DXT1 */ internal_texture_format = SOIL_RGB_S3TC_DXT1; } else { /* 2 or 4 channels = DXT5 */ internal_texture_format = SOIL_RGBA_S3TC_DXT5; } } } /* bind an OpenGL texture ID */ glBindTexture( opengl_texture_type, tex_id ); check_for_GL_errors( "glBindTexture" ); /* upload the main image */ if( DXT_mode == SOIL_CAPABILITY_PRESENT ) { /* user wants me to do the DXT conversion! */ int DDS_size; unsigned char *DDS_data = NULL; if( (channels & 1) == 1 ) { /* RGB, use DXT1 */ DDS_data = convert_image_to_DXT1( img, width, height, channels, &DDS_size ); } else { /* RGBA, use DXT5 */ DDS_data = convert_image_to_DXT5( img, width, height, channels, &DDS_size ); } if( DDS_data ) { soilGlCompressedTexImage2D( opengl_texture_target, 0, internal_texture_format, width, height, 0, DDS_size, DDS_data ); check_for_GL_errors( "glCompressedTexImage2D" ); SOIL_free_image_data( DDS_data ); /* printf( "Internal DXT compressor\n" ); */ } else { /* my compression failed, try the OpenGL driver's version */ glTexImage2D( opengl_texture_target, 0, internal_texture_format, width, height, 0, original_texture_format, GL_UNSIGNED_BYTE, img ); check_for_GL_errors( "glTexImage2D" ); /* printf( "OpenGL DXT compressor\n" ); */ } } else { /* user want OpenGL to do all the work! */ glTexImage2D( opengl_texture_target, 0, internal_texture_format, width, height, 0, original_texture_format, GL_UNSIGNED_BYTE, img ); check_for_GL_errors( "glTexImage2D" ); /*printf( "OpenGL DXT compressor\n" ); */ } /* are any MIPmaps desired? */ if( flags & SOIL_FLAG_MIPMAPS ) { int MIPlevel = 1; int MIPwidth = (width+1) / 2; int MIPheight = (height+1) / 2; unsigned char *resampled = (unsigned char*)malloc( channels*MIPwidth*MIPheight ); while( ((1<<MIPlevel) <= width) || ((1<<MIPlevel) <= height) ) { /* do this MIPmap level */ mipmap_image( img, width, height, channels, resampled, (1 << MIPlevel), (1 << MIPlevel) ); /* upload the MIPmaps */ if( DXT_mode == SOIL_CAPABILITY_PRESENT ) { /* user wants me to do the DXT conversion! */ int DDS_size; unsigned char *DDS_data = NULL; if( (channels & 1) == 1 ) { /* RGB, use DXT1 */ DDS_data = convert_image_to_DXT1( resampled, MIPwidth, MIPheight, channels, &DDS_size ); } else { /* RGBA, use DXT5 */ DDS_data = convert_image_to_DXT5( resampled, MIPwidth, MIPheight, channels, &DDS_size ); } if( DDS_data ) { soilGlCompressedTexImage2D( opengl_texture_target, MIPlevel, internal_texture_format, MIPwidth, MIPheight, 0, DDS_size, DDS_data ); check_for_GL_errors( "glCompressedTexImage2D" ); SOIL_free_image_data( DDS_data ); } else { /* my compression failed, try the OpenGL driver's version */ glTexImage2D( opengl_texture_target, MIPlevel, internal_texture_format, MIPwidth, MIPheight, 0, original_texture_format, GL_UNSIGNED_BYTE, resampled ); check_for_GL_errors( "glTexImage2D" ); } } else { /* user want OpenGL to do all the work! */ glTexImage2D( opengl_texture_target, MIPlevel, internal_texture_format, MIPwidth, MIPheight, 0, original_texture_format, GL_UNSIGNED_BYTE, resampled ); check_for_GL_errors( "glTexImage2D" ); } /* prep for the next level */ ++MIPlevel; MIPwidth = (MIPwidth + 1) / 2; MIPheight = (MIPheight + 1) / 2; } SOIL_free_image_data( resampled ); /* instruct OpenGL to use the MIPmaps */ glTexParameteri( opengl_texture_type, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( opengl_texture_type, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR ); check_for_GL_errors( "GL_TEXTURE_MIN/MAG_FILTER" ); } else { /* instruct OpenGL _NOT_ to use the MIPmaps */ glTexParameteri( opengl_texture_type, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( opengl_texture_type, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); check_for_GL_errors( "GL_TEXTURE_MIN/MAG_FILTER" ); } /* does the user want clamping, or wrapping? */ if( flags & SOIL_FLAG_TEXTURE_REPEATS ) { glTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_S, GL_REPEAT ); glTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_T, GL_REPEAT ); if( opengl_texture_type == SOIL_TEXTURE_CUBE_MAP ) { /* SOIL_TEXTURE_WRAP_R is invalid if cubemaps aren't supported */ glTexParameteri( opengl_texture_type, SOIL_TEXTURE_WRAP_R, GL_REPEAT ); } check_for_GL_errors( "GL_TEXTURE_WRAP_*" ); } else { /* unsigned int clamp_mode = SOIL_CLAMP_TO_EDGE; */ unsigned int clamp_mode = GL_CLAMP; glTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_S, clamp_mode ); glTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_T, clamp_mode ); if( opengl_texture_type == SOIL_TEXTURE_CUBE_MAP ) { /* SOIL_TEXTURE_WRAP_R is invalid if cubemaps aren't supported */ glTexParameteri( opengl_texture_type, SOIL_TEXTURE_WRAP_R, clamp_mode ); } check_for_GL_errors( "GL_TEXTURE_WRAP_*" ); } /* done */ result_string_pointer = "Image loaded as an OpenGL texture"; } else { /* failed */ result_string_pointer = "Failed to generate an OpenGL texture name; missing OpenGL context?"; } SOIL_free_image_data( img ); return tex_id; } int SOIL_save_screenshot ( const char *filename, int image_type, int x, int y, int width, int height ) { unsigned char *pixel_data; int i, j; int save_result; /* error checks */ if( (width < 1) || (height < 1) ) { result_string_pointer = "Invalid screenshot dimensions"; return 0; } if( (x < 0) || (y < 0) ) { result_string_pointer = "Invalid screenshot location"; return 0; } if( filename == NULL ) { result_string_pointer = "Invalid screenshot filename"; return 0; } /* Get the data from OpenGL */ pixel_data = (unsigned char*)malloc( 3*width*height ); glReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixel_data); /* invert the image */ for( j = 0; j*2 < height; ++j ) { int index1 = j * width * 3; int index2 = (height - 1 - j) * width * 3; for( i = width * 3; i > 0; --i ) { unsigned char temp = pixel_data[index1]; pixel_data[index1] = pixel_data[index2]; pixel_data[index2] = temp; ++index1; ++index2; } } /* save the image */ save_result = SOIL_save_image( filename, image_type, width, height, 3, pixel_data); /* And free the memory */ SOIL_free_image_data( pixel_data ); return save_result; } unsigned char* SOIL_load_image ( const char *filename, int *width, int *height, int *channels, int force_channels ) { unsigned char *result = stbi_load( filename, width, height, channels, force_channels ); if( result == NULL ) { result_string_pointer = stbi_failure_reason(); } else { result_string_pointer = "Image loaded"; } return result; } unsigned char* SOIL_load_image_from_memory ( const unsigned char *const buffer, int buffer_length, int *width, int *height, int *channels, int force_channels ) { unsigned char *result = stbi_load_from_memory( buffer, buffer_length, width, height, channels, force_channels ); if( result == NULL ) { result_string_pointer = stbi_failure_reason(); } else { result_string_pointer = "Image loaded from memory"; } return result; } int SOIL_save_image ( const char *filename, int image_type, int width, int height, int channels, const unsigned char *const data ) { int save_result; /* error check */ if( (width < 1) || (height < 1) || (channels < 1) || (channels > 4) || (data == NULL) || (filename == NULL) ) { return 0; } if( image_type == SOIL_SAVE_TYPE_BMP ) { save_result = stbi_write_bmp( filename, width, height, channels, (void*)data ); } else if( image_type == SOIL_SAVE_TYPE_TGA ) { save_result = stbi_write_tga( filename, width, height, channels, (void*)data ); } else if( image_type == SOIL_SAVE_TYPE_DDS ) { save_result = save_image_as_DDS( filename, width, height, channels, (const unsigned char *const)data ); } else { save_result = 0; } if( save_result == 0 ) { result_string_pointer = "Saving the image failed"; } else { result_string_pointer = "Image saved"; } return save_result; } void SOIL_free_image_data ( unsigned char *img_data ) { free( (void*)img_data ); } const char* SOIL_last_result ( void ) { return result_string_pointer; } unsigned int SOIL_direct_load_DDS_from_memory( const unsigned char *const buffer, int buffer_length, unsigned int reuse_texture_ID, int flags, int loading_as_cubemap ) { /* variables */ DDS_header header; unsigned int buffer_index = 0; unsigned int tex_ID = 0; /* file reading variables */ unsigned int S3TC_type = 0; unsigned char *DDS_data; unsigned int DDS_main_size; unsigned int DDS_full_size; unsigned int width, height; int mipmaps, cubemap, uncompressed, block_size = 16; unsigned int flag; unsigned int cf_target, ogl_target_start, ogl_target_end; unsigned int opengl_texture_type; int i; /* 1st off, does the filename even exist? */ if( NULL == buffer ) { /* we can't do it! */ result_string_pointer = "NULL buffer"; return 0; } if( buffer_length < sizeof( DDS_header ) ) { /* we can't do it! */ result_string_pointer = "DDS file was too small to contain the DDS header"; return 0; } /* try reading in the header */ memcpy ( (void*)(&header), (const void *)buffer, sizeof( DDS_header ) ); buffer_index = sizeof( DDS_header ); /* guilty until proven innocent */ result_string_pointer = "Failed to read a known DDS header"; /* validate the header (warning, "goto"'s ahead, shield your eyes!!) */ flag = ('D'<<0)|('D'<<8)|('S'<<16)|(' '<<24); if( header.dwMagic != flag ) {goto quick_exit;} if( header.dwSize != 124 ) {goto quick_exit;} /* I need all of these */ flag = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT; if( (header.dwFlags & flag) != flag ) {goto quick_exit;} /* According to the MSDN spec, the dwFlags should contain DDSD_LINEARSIZE if it's compressed, or DDSD_PITCH if uncompressed. Some DDS writers do not conform to the spec, so I need to make my reader more tolerant */ /* I need one of these */ flag = DDPF_FOURCC | DDPF_RGB; if( (header.sPixelFormat.dwFlags & flag) == 0 ) {goto quick_exit;} if( header.sPixelFormat.dwSize != 32 ) {goto quick_exit;} if( (header.sCaps.dwCaps1 & DDSCAPS_TEXTURE) == 0 ) {goto quick_exit;} /* make sure it is a type we can upload */ if( (header.sPixelFormat.dwFlags & DDPF_FOURCC) && !( (header.sPixelFormat.dwFourCC == (('D'<<0)|('X'<<8)|('T'<<16)|('1'<<24))) || (header.sPixelFormat.dwFourCC == (('D'<<0)|('X'<<8)|('T'<<16)|('3'<<24))) || (header.sPixelFormat.dwFourCC == (('D'<<0)|('X'<<8)|('T'<<16)|('5'<<24))) ) ) { goto quick_exit; } /* OK, validated the header, let's load the image data */ result_string_pointer = "DDS header loaded and validated"; width = header.dwWidth; height = header.dwHeight; uncompressed = 1 - (header.sPixelFormat.dwFlags & DDPF_FOURCC) / DDPF_FOURCC; cubemap = (header.sCaps.dwCaps2 & DDSCAPS2_CUBEMAP) / DDSCAPS2_CUBEMAP; if( uncompressed ) { S3TC_type = GL_RGB; block_size = 3; if( header.sPixelFormat.dwFlags & DDPF_ALPHAPIXELS ) { S3TC_type = GL_RGBA; block_size = 4; } DDS_main_size = width * height * block_size; } else { /* can we even handle direct uploading to OpenGL DXT compressed images? */ if( query_DXT_capability() != SOIL_CAPABILITY_PRESENT ) { /* we can't do it! */ result_string_pointer = "Direct upload of S3TC images not supported by the OpenGL driver"; return 0; } /* well, we know it is DXT1/3/5, because we checked above */ switch( (header.sPixelFormat.dwFourCC >> 24) - '0' ) { case 1: S3TC_type = SOIL_RGBA_S3TC_DXT1; block_size = 8; break; case 3: S3TC_type = SOIL_RGBA_S3TC_DXT3; block_size = 16; break; case 5: S3TC_type = SOIL_RGBA_S3TC_DXT5; block_size = 16; break; } DDS_main_size = ((width+3)>>2)*((height+3)>>2)*block_size; } if( cubemap ) { /* does the user want a cubemap? */ if( !loading_as_cubemap ) { /* we can't do it! */ result_string_pointer = "DDS image was a cubemap"; return 0; } /* can we even handle cubemaps with the OpenGL driver? */ if( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT ) { /* we can't do it! */ result_string_pointer = "Direct upload of cubemap images not supported by the OpenGL driver"; return 0; } ogl_target_start = SOIL_TEXTURE_CUBE_MAP_POSITIVE_X; ogl_target_end = SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z; opengl_texture_type = SOIL_TEXTURE_CUBE_MAP; } else { /* does the user want a non-cubemap? */ if( loading_as_cubemap ) { /* we can't do it! */ result_string_pointer = "DDS image was not a cubemap"; return 0; } ogl_target_start = GL_TEXTURE_2D; ogl_target_end = GL_TEXTURE_2D; opengl_texture_type = GL_TEXTURE_2D; } if( (header.sCaps.dwCaps1 & DDSCAPS_MIPMAP) && (header.dwMipMapCount > 1) ) { int shift_offset; mipmaps = header.dwMipMapCount - 1; DDS_full_size = DDS_main_size; if( uncompressed ) { /* uncompressed DDS, simple MIPmap size calculation */ shift_offset = 0; } else { /* compressed DDS, MIPmap size calculation is block based */ shift_offset = 2; } for( i = 1; i <= mipmaps; ++ i ) { int w, h; w = width >> (shift_offset + i); h = height >> (shift_offset + i); if( w < 1 ) { w = 1; } if( h < 1 ) { h = 1; } DDS_full_size += w*h*block_size; } } else { mipmaps = 0; DDS_full_size = DDS_main_size; } DDS_data = (unsigned char*)malloc( DDS_full_size ); /* got the image data RAM, create or use an existing OpenGL texture handle */ tex_ID = reuse_texture_ID; if( tex_ID == 0 ) { glGenTextures( 1, &tex_ID ); } /* bind an OpenGL texture ID */ glBindTexture( opengl_texture_type, tex_ID ); /* do this for each face of the cubemap! */ for( cf_target = ogl_target_start; cf_target <= ogl_target_end; ++cf_target ) { if( buffer_index + DDS_full_size <= buffer_length ) { unsigned int byte_offset = DDS_main_size; memcpy( (void*)DDS_data, (const void*)(&buffer[buffer_index]), DDS_full_size ); buffer_index += DDS_full_size; /* upload the main chunk */ if( uncompressed ) { /* and remember, DXT uncompressed uses BGR(A), so swap to RGB(A) for ALL MIPmap levels */ for( i = 0; i < DDS_full_size; i += block_size ) { unsigned char temp = DDS_data[i]; DDS_data[i] = DDS_data[i+2]; DDS_data[i+2] = temp; } glTexImage2D( cf_target, 0, S3TC_type, width, height, 0, S3TC_type, GL_UNSIGNED_BYTE, DDS_data ); } else { soilGlCompressedTexImage2D( cf_target, 0, S3TC_type, width, height, 0, DDS_main_size, DDS_data ); } /* upload the mipmaps, if we have them */ for( i = 1; i <= mipmaps; ++i ) { int w, h, mip_size; w = width >> i; h = height >> i; if( w < 1 ) { w = 1; } if( h < 1 ) { h = 1; } /* upload this mipmap */ if( uncompressed ) { mip_size = w*h*block_size; glTexImage2D( cf_target, i, S3TC_type, w, h, 0, S3TC_type, GL_UNSIGNED_BYTE, &DDS_data[byte_offset] ); } else { mip_size = ((w+3)/4)*((h+3)/4)*block_size; soilGlCompressedTexImage2D( cf_target, i, S3TC_type, w, h, 0, mip_size, &DDS_data[byte_offset] ); } /* and move to the next mipmap */ byte_offset += mip_size; } /* it worked! */ result_string_pointer = "DDS file loaded"; } else { glDeleteTextures( 1, & tex_ID ); tex_ID = 0; cf_target = ogl_target_end + 1; result_string_pointer = "DDS file was too small for expected image data"; } }/* end reading each face */ SOIL_free_image_data( DDS_data ); if( tex_ID ) { /* did I have MIPmaps? */ if( mipmaps > 0 ) { /* instruct OpenGL to use the MIPmaps */ glTexParameteri( opengl_texture_type, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( opengl_texture_type, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR ); } else { /* instruct OpenGL _NOT_ to use the MIPmaps */ glTexParameteri( opengl_texture_type, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( opengl_texture_type, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); } /* does the user want clamping, or wrapping? */ if( flags & SOIL_FLAG_TEXTURE_REPEATS ) { glTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_S, GL_REPEAT ); glTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_T, GL_REPEAT ); glTexParameteri( opengl_texture_type, SOIL_TEXTURE_WRAP_R, GL_REPEAT ); } else { /* unsigned int clamp_mode = SOIL_CLAMP_TO_EDGE; */ unsigned int clamp_mode = GL_CLAMP; glTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_S, clamp_mode ); glTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_T, clamp_mode ); glTexParameteri( opengl_texture_type, SOIL_TEXTURE_WRAP_R, clamp_mode ); } } quick_exit: /* report success or failure */ return tex_ID; } unsigned int SOIL_direct_load_DDS( const char *filename, unsigned int reuse_texture_ID, int flags, int loading_as_cubemap ) { FILE *f; unsigned char *buffer; size_t buffer_length, bytes_read; unsigned int tex_ID = 0; /* error checks */ if( NULL == filename ) { result_string_pointer = "NULL filename"; return 0; } f = fopen( filename, "rb" ); if( NULL == f ) { /* the file doesn't seem to exist (or be open-able) */ result_string_pointer = "Can not find DDS file"; return 0; } fseek( f, 0, SEEK_END ); buffer_length = ftell( f ); fseek( f, 0, SEEK_SET ); buffer = (unsigned char *) malloc( buffer_length ); if( NULL == buffer ) { result_string_pointer = "malloc failed"; fclose( f ); return 0; } bytes_read = fread( (void*)buffer, 1, buffer_length, f ); fclose( f ); if( bytes_read < buffer_length ) { /* huh? */ buffer_length = bytes_read; } /* now try to do the loading */ tex_ID = SOIL_direct_load_DDS_from_memory( (const unsigned char *const)buffer, buffer_length, reuse_texture_ID, flags, loading_as_cubemap ); SOIL_free_image_data( buffer ); return tex_ID; } int query_NPOT_capability( void ) { /* check for the capability */ if( has_NPOT_capability == SOIL_CAPABILITY_UNKNOWN ) { /* we haven't yet checked for the capability, do so */ if( (NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ), "GL_ARB_texture_non_power_of_two" ) ) ) { /* not there, flag the failure */ has_NPOT_capability = SOIL_CAPABILITY_NONE; } else { /* it's there! */ has_NPOT_capability = SOIL_CAPABILITY_PRESENT; } } /* let the user know if we can do non-power-of-two textures or not */ return has_NPOT_capability; } int query_tex_rectangle_capability( void ) { /* check for the capability */ if( has_tex_rectangle_capability == SOIL_CAPABILITY_UNKNOWN ) { /* we haven't yet checked for the capability, do so */ if( (NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ), "GL_ARB_texture_rectangle" ) ) && (NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ), "GL_EXT_texture_rectangle" ) ) && (NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ), "GL_NV_texture_rectangle" ) ) ) { /* not there, flag the failure */ has_tex_rectangle_capability = SOIL_CAPABILITY_NONE; } else { /* it's there! */ has_tex_rectangle_capability = SOIL_CAPABILITY_PRESENT; } } /* let the user know if we can do texture rectangles or not */ return has_tex_rectangle_capability; } int query_cubemap_capability( void ) { /* check for the capability */ if( has_cubemap_capability == SOIL_CAPABILITY_UNKNOWN ) { /* we haven't yet checked for the capability, do so */ if( (NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ), "GL_ARB_texture_cube_map" ) ) && (NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ), "GL_EXT_texture_cube_map" ) ) ) { /* not there, flag the failure */ has_cubemap_capability = SOIL_CAPABILITY_NONE; } else { /* it's there! */ has_cubemap_capability = SOIL_CAPABILITY_PRESENT; } } /* let the user know if we can do cubemaps or not */ return has_cubemap_capability; } int query_DXT_capability( void ) { /* check for the capability */ if( has_DXT_capability == SOIL_CAPABILITY_UNKNOWN ) { /* we haven't yet checked for the capability, do so */ if( NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ), "GL_EXT_texture_compression_s3tc" ) ) { /* not there, flag the failure */ has_DXT_capability = SOIL_CAPABILITY_NONE; } else { /* and find the address of the extension function */ P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC ext_addr = NULL; #ifdef WIN32 ext_addr = (P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC) wglGetProcAddress ( "glCompressedTexImage2DARB" ); #elif defined(__APPLE__) || defined(__APPLE_CC__) /* I can't test this Apple stuff! */ CFBundleRef bundle; CFURLRef bundleURL = CFURLCreateWithFileSystemPath( kCFAllocatorDefault, CFSTR("/System/Library/Frameworks/OpenGL.framework"), kCFURLPOSIXPathStyle, true ); CFStringRef extensionName = CFStringCreateWithCString( kCFAllocatorDefault, "glCompressedTexImage2DARB", kCFStringEncodingASCII ); bundle = CFBundleCreate( kCFAllocatorDefault, bundleURL ); assert( bundle != NULL ); ext_addr = (P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC) CFBundleGetFunctionPointerForName ( bundle, extensionName ); CFRelease( bundleURL ); CFRelease( extensionName ); CFRelease( bundle ); #else ext_addr = (P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC) glXGetProcAddressARB ( (const GLubyte *)"glCompressedTexImage2DARB" ); #endif /* Flag it so no checks needed later */ if( NULL == ext_addr ) { /* hmm, not good!! This should not happen, but does on my laptop's VIA chipset. The GL_EXT_texture_compression_s3tc spec requires that ARB_texture_compression be present too. this means I can upload and have the OpenGL drive do the conversion, but I can't use my own routines or load DDS files from disk and upload them directly [8^( */ has_DXT_capability = SOIL_CAPABILITY_NONE; } else { /* all's well! */ soilGlCompressedTexImage2D = ext_addr; has_DXT_capability = SOIL_CAPABILITY_PRESENT; } } } /* let the user know if we can do DXT or not */ return has_DXT_capability; } |
Added ext/soil/SOIL.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
/** @mainpage SOIL Jonathan Dummer 2007-07-26-10.36 Simple OpenGL Image Library A tiny c library for uploading images as textures into OpenGL. Also saving and loading of images is supported. I'm using Sean's Tool Box image loader as a base: http://www.nothings.org/ I'm upgrading it to load TGA and DDS files, and a direct path for loading DDS files straight into OpenGL textures, when applicable. Image Formats: - BMP load & save - TGA load & save - DDS load & save - PNG load - JPG load OpenGL Texture Features: - resample to power-of-two sizes - MIPmap generation - compressed texture S3TC formats (if supported) - can pre-multiply alpha for you, for better compositing - can flip image about the y-axis (except pre-compressed DDS files) Thanks to: * Sean Barret - for the awesome stb_image * Dan Venkitachalam - for finding some non-compliant DDS files, and patching some explicit casts * everybody at gamedev.net **/ #ifndef HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY #define HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY #ifdef __cplusplus extern "C" { #endif /** The format of images that may be loaded (force_channels). SOIL_LOAD_AUTO leaves the image in whatever format it was found. SOIL_LOAD_L forces the image to load as Luminous (greyscale) SOIL_LOAD_LA forces the image to load as Luminous with Alpha SOIL_LOAD_RGB forces the image to load as Red Green Blue SOIL_LOAD_RGBA forces the image to load as Red Green Blue Alpha **/ enum { SOIL_LOAD_AUTO = 0, SOIL_LOAD_L = 1, SOIL_LOAD_LA = 2, SOIL_LOAD_RGB = 3, SOIL_LOAD_RGBA = 4 }; /** Passed in as reuse_texture_ID, will cause SOIL to register a new texture ID using glGenTextures(). If the value passed into reuse_texture_ID > 0 then SOIL will just re-use that texture ID (great for reloading image assets in-game!) **/ enum { SOIL_CREATE_NEW_ID = 0 }; /** flags you can pass into SOIL_load_OGL_texture() and SOIL_create_OGL_texture(). (note that if SOIL_FLAG_DDS_LOAD_DIRECT is used the rest of the flags with the exception of SOIL_FLAG_TEXTURE_REPEATS will be ignored while loading already-compressed DDS files.) SOIL_FLAG_POWER_OF_TWO: force the image to be POT SOIL_FLAG_MIPMAPS: generate mipmaps for the texture SOIL_FLAG_TEXTURE_REPEATS: otherwise will clamp SOIL_FLAG_MULTIPLY_ALPHA: for using (GL_ONE,GL_ONE_MINUS_SRC_ALPHA) blending SOIL_FLAG_INVERT_Y: flip the image vertically SOIL_FLAG_COMPRESS_TO_DXT: if the card can display them, will convert RGB to DXT1, RGBA to DXT5 SOIL_FLAG_DDS_LOAD_DIRECT: will load DDS files directly without _ANY_ additional processing SOIL_FLAG_NTSC_SAFE_RGB: clamps RGB components to the range [16,235] SOIL_FLAG_CoCg_Y: Google YCoCg; RGB=>CoYCg, RGBA=>CoCgAY SOIL_FLAG_TEXTURE_RECTANGE: uses ARB_texture_rectangle ; pixel indexed & no repeat or MIPmaps or cubemaps **/ enum { SOIL_FLAG_POWER_OF_TWO = 1, SOIL_FLAG_MIPMAPS = 2, SOIL_FLAG_TEXTURE_REPEATS = 4, SOIL_FLAG_MULTIPLY_ALPHA = 8, SOIL_FLAG_INVERT_Y = 16, SOIL_FLAG_COMPRESS_TO_DXT = 32, SOIL_FLAG_DDS_LOAD_DIRECT = 64, SOIL_FLAG_NTSC_SAFE_RGB = 128, SOIL_FLAG_CoCg_Y = 256, SOIL_FLAG_TEXTURE_RECTANGLE = 512 }; /** The types of images that may be saved. (TGA supports uncompressed RGB / RGBA) (BMP supports uncompressed RGB) (DDS supports DXT1 and DXT5) **/ enum { SOIL_SAVE_TYPE_TGA = 0, SOIL_SAVE_TYPE_BMP = 1, SOIL_SAVE_TYPE_DDS = 2 }; /** Defines the order of faces in a DDS cubemap. I recommend that you use the same order in single image cubemap files, so they will be interchangeable with DDS cubemaps when using SOIL. **/ #define SOIL_DDS_CUBEMAP_FACE_ORDER "EWUDNS" /** The types of internal fake HDR representations SOIL_HDR_RGBE: RGB * pow( 2.0, A - 128.0 ) SOIL_HDR_RGBdivA: RGB / A SOIL_HDR_RGBdivA2: RGB / (A*A) **/ enum { SOIL_HDR_RGBE = 0, SOIL_HDR_RGBdivA = 1, SOIL_HDR_RGBdivA2 = 2 }; /** Loads an image from disk into an OpenGL texture. \param filename the name of the file to upload as a texture \param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA \param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture) \param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT \return 0-failed, otherwise returns the OpenGL texture handle **/ unsigned int SOIL_load_OGL_texture ( const char *filename, int force_channels, unsigned int reuse_texture_ID, unsigned int flags ); /** Loads 6 images from disk into an OpenGL cubemap texture. \param x_pos_file the name of the file to upload as the +x cube face \param x_neg_file the name of the file to upload as the -x cube face \param y_pos_file the name of the file to upload as the +y cube face \param y_neg_file the name of the file to upload as the -y cube face \param z_pos_file the name of the file to upload as the +z cube face \param z_neg_file the name of the file to upload as the -z cube face \param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA \param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture) \param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT \return 0-failed, otherwise returns the OpenGL texture handle **/ unsigned int SOIL_load_OGL_cubemap ( const char *x_pos_file, const char *x_neg_file, const char *y_pos_file, const char *y_neg_file, const char *z_pos_file, const char *z_neg_file, int force_channels, unsigned int reuse_texture_ID, unsigned int flags ); /** Loads 1 image from disk and splits it into an OpenGL cubemap texture. \param filename the name of the file to upload as a texture \param face_order the order of the faces in the file, any combination of NSWEUD, for North, South, Up, etc. \param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA \param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture) \param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT \return 0-failed, otherwise returns the OpenGL texture handle **/ unsigned int SOIL_load_OGL_single_cubemap ( const char *filename, const char face_order[6], int force_channels, unsigned int reuse_texture_ID, unsigned int flags ); /** Loads an HDR image from disk into an OpenGL texture. \param filename the name of the file to upload as a texture \param fake_HDR_format SOIL_HDR_RGBE, SOIL_HDR_RGBdivA, SOIL_HDR_RGBdivA2 \param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture) \param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT \return 0-failed, otherwise returns the OpenGL texture handle **/ unsigned int SOIL_load_OGL_HDR_texture ( const char *filename, int fake_HDR_format, int rescale_to_max, unsigned int reuse_texture_ID, unsigned int flags ); /** Loads an image from RAM into an OpenGL texture. \param buffer the image data in RAM just as if it were still in a file \param buffer_length the size of the buffer in bytes \param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA \param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture) \param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT \return 0-failed, otherwise returns the OpenGL texture handle **/ unsigned int SOIL_load_OGL_texture_from_memory ( const unsigned char *const buffer, int buffer_length, int force_channels, unsigned int reuse_texture_ID, unsigned int flags, /* ADDED */ int* rw, int* rh ); /** Loads 6 images from memory into an OpenGL cubemap texture. \param x_pos_buffer the image data in RAM to upload as the +x cube face \param x_pos_buffer_length the size of the above buffer \param x_neg_buffer the image data in RAM to upload as the +x cube face \param x_neg_buffer_length the size of the above buffer \param y_pos_buffer the image data in RAM to upload as the +x cube face \param y_pos_buffer_length the size of the above buffer \param y_neg_buffer the image data in RAM to upload as the +x cube face \param y_neg_buffer_length the size of the above buffer \param z_pos_buffer the image data in RAM to upload as the +x cube face \param z_pos_buffer_length the size of the above buffer \param z_neg_buffer the image data in RAM to upload as the +x cube face \param z_neg_buffer_length the size of the above buffer \param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA \param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture) \param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT \return 0-failed, otherwise returns the OpenGL texture handle **/ unsigned int SOIL_load_OGL_cubemap_from_memory ( const unsigned char *const x_pos_buffer, int x_pos_buffer_length, const unsigned char *const x_neg_buffer, int x_neg_buffer_length, const unsigned char *const y_pos_buffer, int y_pos_buffer_length, const unsigned char *const y_neg_buffer, int y_neg_buffer_length, const unsigned char *const z_pos_buffer, int z_pos_buffer_length, const unsigned char *const z_neg_buffer, int z_neg_buffer_length, int force_channels, unsigned int reuse_texture_ID, unsigned int flags ); /** Loads 1 image from RAM and splits it into an OpenGL cubemap texture. \param buffer the image data in RAM just as if it were still in a file \param buffer_length the size of the buffer in bytes \param face_order the order of the faces in the file, any combination of NSWEUD, for North, South, Up, etc. \param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA \param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture) \param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT \return 0-failed, otherwise returns the OpenGL texture handle **/ unsigned int SOIL_load_OGL_single_cubemap_from_memory ( const unsigned char *const buffer, int buffer_length, const char face_order[6], int force_channels, unsigned int reuse_texture_ID, unsigned int flags ); /** Creates a 2D OpenGL texture from raw image data. Note that the raw data is _NOT_ freed after the upload (so the user can load various versions). \param data the raw data to be uploaded as an OpenGL texture \param width the width of the image in pixels \param height the height of the image in pixels \param channels the number of channels: 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA \param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture) \param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT \return 0-failed, otherwise returns the OpenGL texture handle **/ unsigned int SOIL_create_OGL_texture ( const unsigned char *const data, int width, int height, int channels, unsigned int reuse_texture_ID, unsigned int flags ); /** Creates an OpenGL cubemap texture by splitting up 1 image into 6 parts. \param data the raw data to be uploaded as an OpenGL texture \param width the width of the image in pixels \param height the height of the image in pixels \param channels the number of channels: 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA \param face_order the order of the faces in the file, and combination of NSWEUD, for North, South, Up, etc. \param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture) \param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT \return 0-failed, otherwise returns the OpenGL texture handle **/ unsigned int SOIL_create_OGL_single_cubemap ( const unsigned char *const data, int width, int height, int channels, const char face_order[6], unsigned int reuse_texture_ID, unsigned int flags ); /** Captures the OpenGL window (RGB) and saves it to disk \return 0 if it failed, otherwise returns 1 **/ int SOIL_save_screenshot ( const char *filename, int image_type, int x, int y, int width, int height ); /** Loads an image from disk into an array of unsigned chars. Note that *channels return the original channel count of the image. If force_channels was other than SOIL_LOAD_AUTO, the resulting image has force_channels, but *channels may be different (if the original image had a different channel count). \return 0 if failed, otherwise returns 1 **/ unsigned char* SOIL_load_image ( const char *filename, int *width, int *height, int *channels, int force_channels ); /** Loads an image from memory into an array of unsigned chars. Note that *channels return the original channel count of the image. If force_channels was other than SOIL_LOAD_AUTO, the resulting image has force_channels, but *channels may be different (if the original image had a different channel count). \return 0 if failed, otherwise returns 1 **/ unsigned char* SOIL_load_image_from_memory ( const unsigned char *const buffer, int buffer_length, int *width, int *height, int *channels, int force_channels ); /** Saves an image from an array of unsigned chars (RGBA) to disk \return 0 if failed, otherwise returns 1 **/ int SOIL_save_image ( const char *filename, int image_type, int width, int height, int channels, const unsigned char *const data ); /** Frees the image data (note, this is just C's "free()"...this function is present mostly so C++ programmers don't forget to use "free()" and call "delete []" instead [8^) **/ void SOIL_free_image_data ( unsigned char *img_data ); /** This function resturn a pointer to a string describing the last thing that happened inside SOIL. It can be used to determine why an image failed to load. **/ const char* SOIL_last_result ( void ); #ifdef __cplusplus } #endif #endif /* HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY */ |
Added ext/soil/image_DXT.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 |
/* Jonathan Dummer 2007-07-31-10.32 simple DXT compression / decompression code public domain */ #include "image_DXT.h" #include <math.h> #include <stdlib.h> #include <string.h> #include <stdio.h> /* set this =1 if you want to use the covarince matrix method... which is better than my method of using standard deviations overall, except on the infintesimal chance that the power method fails for finding the largest eigenvector */ #define USE_COV_MAT 1 /********* Function Prototypes *********/ /* Takes a 4x4 block of pixels and compresses it into 8 bytes in DXT1 format (color only, no alpha). Speed is valued over prettyness, at least for now. */ void compress_DDS_color_block( int channels, const unsigned char *const uncompressed, unsigned char compressed[8] ); /* Takes a 4x4 block of pixels and compresses the alpha component it into 8 bytes for use in DXT5 DDS files. Speed is valued over prettyness, at least for now. */ void compress_DDS_alpha_block( const unsigned char *const uncompressed, unsigned char compressed[8] ); /********* Actual Exposed Functions *********/ int save_image_as_DDS ( const char *filename, int width, int height, int channels, const unsigned char *const data ) { /* variables */ FILE *fout; unsigned char *DDS_data; DDS_header header; int DDS_size; /* error check */ if( (NULL == filename) || (width < 1) || (height < 1) || (channels < 1) || (channels > 4) || (data == NULL ) ) { return 0; } /* Convert the image */ if( (channels & 1) == 1 ) { /* no alpha, just use DXT1 */ DDS_data = convert_image_to_DXT1( data, width, height, channels, &DDS_size ); } else { /* has alpha, so use DXT5 */ DDS_data = convert_image_to_DXT5( data, width, height, channels, &DDS_size ); } /* save it */ memset( &header, 0, sizeof( DDS_header ) ); header.dwMagic = ('D' << 0) | ('D' << 8) | ('S' << 16) | (' ' << 24); header.dwSize = 124; header.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT | DDSD_LINEARSIZE; header.dwWidth = width; header.dwHeight = height; header.dwPitchOrLinearSize = DDS_size; header.sPixelFormat.dwSize = 32; header.sPixelFormat.dwFlags = DDPF_FOURCC; if( (channels & 1) == 1 ) { header.sPixelFormat.dwFourCC = ('D' << 0) | ('X' << 8) | ('T' << 16) | ('1' << 24); } else { header.sPixelFormat.dwFourCC = ('D' << 0) | ('X' << 8) | ('T' << 16) | ('5' << 24); } header.sCaps.dwCaps1 = DDSCAPS_TEXTURE; /* write it out */ fout = fopen( filename, "wb"); fwrite( &header, sizeof( DDS_header ), 1, fout ); fwrite( DDS_data, 1, DDS_size, fout ); fclose( fout ); /* done */ free( DDS_data ); return 1; } unsigned char* convert_image_to_DXT1( const unsigned char *const uncompressed, int width, int height, int channels, int *out_size ) { unsigned char *compressed; int i, j, x, y; unsigned char ublock[16*3]; unsigned char cblock[8]; int index = 0, chan_step = 1; int block_count = 0; /* error check */ *out_size = 0; if( (width < 1) || (height < 1) || (NULL == uncompressed) || (channels < 1) || (channels > 4) ) { return NULL; } /* for channels == 1 or 2, I do not step forward for R,G,B values */ if( channels < 3 ) { chan_step = 0; } /* get the RAM for the compressed image (8 bytes per 4x4 pixel block) */ *out_size = ((width+3) >> 2) * ((height+3) >> 2) * 8; compressed = (unsigned char*)malloc( *out_size ); /* go through each block */ for( j = 0; j < height; j += 4 ) { for( i = 0; i < width; i += 4 ) { /* copy this block into a new one */ int idx = 0; int mx = 4, my = 4; if( j+4 >= height ) { my = height - j; } if( i+4 >= width ) { mx = width - i; } for( y = 0; y < my; ++y ) { for( x = 0; x < mx; ++x ) { ublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels]; ublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step]; ublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step+chan_step]; } for( x = mx; x < 4; ++x ) { ublock[idx++] = ublock[0]; ublock[idx++] = ublock[1]; ublock[idx++] = ublock[2]; } } for( y = my; y < 4; ++y ) { for( x = 0; x < 4; ++x ) { ublock[idx++] = ublock[0]; ublock[idx++] = ublock[1]; ublock[idx++] = ublock[2]; } } /* compress the block */ ++block_count; compress_DDS_color_block( 3, ublock, cblock ); /* copy the data from the block into the main block */ for( x = 0; x < 8; ++x ) { compressed[index++] = cblock[x]; } } } return compressed; } unsigned char* convert_image_to_DXT5( const unsigned char *const uncompressed, int width, int height, int channels, int *out_size ) { unsigned char *compressed; int i, j, x, y; unsigned char ublock[16*4]; unsigned char cblock[8]; int index = 0, chan_step = 1; int block_count = 0, has_alpha; /* error check */ *out_size = 0; if( (width < 1) || (height < 1) || (NULL == uncompressed) || (channels < 1) || ( channels > 4) ) { return NULL; } /* for channels == 1 or 2, I do not step forward for R,G,B vales */ if( channels < 3 ) { chan_step = 0; } /* # channels = 1 or 3 have no alpha, 2 & 4 do have alpha */ has_alpha = 1 - (channels & 1); /* get the RAM for the compressed image (16 bytes per 4x4 pixel block) */ *out_size = ((width+3) >> 2) * ((height+3) >> 2) * 16; compressed = (unsigned char*)malloc( *out_size ); /* go through each block */ for( j = 0; j < height; j += 4 ) { for( i = 0; i < width; i += 4 ) { /* local variables, and my block counter */ int idx = 0; int mx = 4, my = 4; if( j+4 >= height ) { my = height - j; } if( i+4 >= width ) { mx = width - i; } for( y = 0; y < my; ++y ) { for( x = 0; x < mx; ++x ) { ublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels]; ublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step]; ublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step+chan_step]; ublock[idx++] = has_alpha * uncompressed[(j+y)*width*channels+(i+x)*channels+channels-1] + (1-has_alpha)*255; } for( x = mx; x < 4; ++x ) { ublock[idx++] = ublock[0]; ublock[idx++] = ublock[1]; ublock[idx++] = ublock[2]; ublock[idx++] = ublock[3]; } } for( y = my; y < 4; ++y ) { for( x = 0; x < 4; ++x ) { ublock[idx++] = ublock[0]; ublock[idx++] = ublock[1]; ublock[idx++] = ublock[2]; ublock[idx++] = ublock[3]; } } /* now compress the alpha block */ compress_DDS_alpha_block( ublock, cblock ); /* copy the data from the compressed alpha block into the main buffer */ for( x = 0; x < 8; ++x ) { compressed[index++] = cblock[x]; } /* then compress the color block */ ++block_count; compress_DDS_color_block( 4, ublock, cblock ); /* copy the data from the compressed color block into the main buffer */ for( x = 0; x < 8; ++x ) { compressed[index++] = cblock[x]; } } } return compressed; } /********* Helper Functions *********/ int convert_bit_range( int c, int from_bits, int to_bits ) { int b = (1 << (from_bits - 1)) + c * ((1 << to_bits) - 1); return (b + (b >> from_bits)) >> from_bits; } int rgb_to_565( int r, int g, int b ) { return (convert_bit_range( r, 8, 5 ) << 11) | (convert_bit_range( g, 8, 6 ) << 05) | (convert_bit_range( b, 8, 5 ) << 00); } void rgb_888_from_565( unsigned int c, int *r, int *g, int *b ) { *r = convert_bit_range( (c >> 11) & 31, 5, 8 ); *g = convert_bit_range( (c >> 05) & 63, 6, 8 ); *b = convert_bit_range( (c >> 00) & 31, 5, 8 ); } void compute_color_line_STDEV( const unsigned char *const uncompressed, int channels, float point[3], float direction[3] ) { const float inv_16 = 1.0f / 16.0f; int i; float sum_r = 0.0f, sum_g = 0.0f, sum_b = 0.0f; float sum_rr = 0.0f, sum_gg = 0.0f, sum_bb = 0.0f; float sum_rg = 0.0f, sum_rb = 0.0f, sum_gb = 0.0f; /* calculate all data needed for the covariance matrix ( to compare with _rygdxt code) */ for( i = 0; i < 16*channels; i += channels ) { sum_r += uncompressed[i+0]; sum_rr += uncompressed[i+0] * uncompressed[i+0]; sum_g += uncompressed[i+1]; sum_gg += uncompressed[i+1] * uncompressed[i+1]; sum_b += uncompressed[i+2]; sum_bb += uncompressed[i+2] * uncompressed[i+2]; sum_rg += uncompressed[i+0] * uncompressed[i+1]; sum_rb += uncompressed[i+0] * uncompressed[i+2]; sum_gb += uncompressed[i+1] * uncompressed[i+2]; } /* convert the sums to averages */ sum_r *= inv_16; sum_g *= inv_16; sum_b *= inv_16; /* and convert the squares to the squares of the value - avg_value */ sum_rr -= 16.0f * sum_r * sum_r; sum_gg -= 16.0f * sum_g * sum_g; sum_bb -= 16.0f * sum_b * sum_b; sum_rg -= 16.0f * sum_r * sum_g; sum_rb -= 16.0f * sum_r * sum_b; sum_gb -= 16.0f * sum_g * sum_b; /* the point on the color line is the average */ point[0] = sum_r; point[1] = sum_g; point[2] = sum_b; #if USE_COV_MAT /* The following idea was from ryg. (https://mollyrocket.com/forums/viewtopic.php?t=392) The method worked great (less RMSE than mine) most of the time, but had some issues handling some simple boundary cases, like full green next to full red, which would generate a covariance matrix like this: | 1 -1 0 | | -1 1 0 | | 0 0 0 | For a given starting vector, the power method can generate all zeros! So no starting with {1,1,1} as I was doing! This kind of error is still a slight posibillity, but will be very rare. */ /* use the covariance matrix directly (1st iteration, don't use all 1.0 values!) */ sum_r = 1.0f; sum_g = 2.718281828f; sum_b = 3.141592654f; direction[0] = sum_r*sum_rr + sum_g*sum_rg + sum_b*sum_rb; direction[1] = sum_r*sum_rg + sum_g*sum_gg + sum_b*sum_gb; direction[2] = sum_r*sum_rb + sum_g*sum_gb + sum_b*sum_bb; /* 2nd iteration, use results from the 1st guy */ sum_r = direction[0]; sum_g = direction[1]; sum_b = direction[2]; direction[0] = sum_r*sum_rr + sum_g*sum_rg + sum_b*sum_rb; direction[1] = sum_r*sum_rg + sum_g*sum_gg + sum_b*sum_gb; direction[2] = sum_r*sum_rb + sum_g*sum_gb + sum_b*sum_bb; /* 3rd iteration, use results from the 2nd guy */ sum_r = direction[0]; sum_g = direction[1]; sum_b = direction[2]; direction[0] = sum_r*sum_rr + sum_g*sum_rg + sum_b*sum_rb; direction[1] = sum_r*sum_rg + sum_g*sum_gg + sum_b*sum_gb; direction[2] = sum_r*sum_rb + sum_g*sum_gb + sum_b*sum_bb; #else /* use my standard deviation method (very robust, a tiny bit slower and less accurate) */ direction[0] = sqrt( sum_rr ); direction[1] = sqrt( sum_gg ); direction[2] = sqrt( sum_bb ); /* which has a greater component */ if( sum_gg > sum_rr ) { /* green has greater component, so base the other signs off of green */ if( sum_rg < 0.0f ) { direction[0] = -direction[0]; } if( sum_gb < 0.0f ) { direction[2] = -direction[2]; } } else { /* red has a greater component */ if( sum_rg < 0.0f ) { direction[1] = -direction[1]; } if( sum_rb < 0.0f ) { direction[2] = -direction[2]; } } #endif } void LSE_master_colors_max_min( int *cmax, int *cmin, int channels, const unsigned char *const uncompressed ) { int i, j; /* the master colors */ int c0[3], c1[3]; /* used for fitting the line */ float sum_x[] = { 0.0f, 0.0f, 0.0f }; float sum_x2[] = { 0.0f, 0.0f, 0.0f }; float dot_max = 1.0f, dot_min = -1.0f; float vec_len2 = 0.0f; float dot; /* error check */ if( (channels < 3) || (channels > 4) ) { return; } compute_color_line_STDEV( uncompressed, channels, sum_x, sum_x2 ); vec_len2 = 1.0f / ( 0.00001f + sum_x2[0]*sum_x2[0] + sum_x2[1]*sum_x2[1] + sum_x2[2]*sum_x2[2] ); /* finding the max and min vector values */ dot_max = ( sum_x2[0] * uncompressed[0] + sum_x2[1] * uncompressed[1] + sum_x2[2] * uncompressed[2] ); dot_min = dot_max; for( i = 1; i < 16; ++i ) { dot = ( sum_x2[0] * uncompressed[i*channels+0] + sum_x2[1] * uncompressed[i*channels+1] + sum_x2[2] * uncompressed[i*channels+2] ); if( dot < dot_min ) { dot_min = dot; } else if( dot > dot_max ) { dot_max = dot; } } /* and the offset (from the average location) */ dot = sum_x2[0]*sum_x[0] + sum_x2[1]*sum_x[1] + sum_x2[2]*sum_x[2]; dot_min -= dot; dot_max -= dot; /* post multiply by the scaling factor */ dot_min *= vec_len2; dot_max *= vec_len2; /* OK, build the master colors */ for( i = 0; i < 3; ++i ) { /* color 0 */ c0[i] = (int)(0.5f + sum_x[i] + dot_max * sum_x2[i]); if( c0[i] < 0 ) { c0[i] = 0; } else if( c0[i] > 255 ) { c0[i] = 255; } /* color 1 */ c1[i] = (int)(0.5f + sum_x[i] + dot_min * sum_x2[i]); if( c1[i] < 0 ) { c1[i] = 0; } else if( c1[i] > 255 ) { c1[i] = 255; } } /* down_sample (with rounding?) */ i = rgb_to_565( c0[0], c0[1], c0[2] ); j = rgb_to_565( c1[0], c1[1], c1[2] ); if( i > j ) { *cmax = i; *cmin = j; } else { *cmax = j; *cmin = i; } } void compress_DDS_color_block ( int channels, const unsigned char *const uncompressed, unsigned char compressed[8] ) { /* variables */ int i; int next_bit; int enc_c0, enc_c1; int c0[4], c1[4]; float color_line[] = { 0.0f, 0.0f, 0.0f, 0.0f }; float vec_len2 = 0.0f, dot_offset = 0.0f; /* stupid order */ int swizzle4[] = { 0, 2, 3, 1 }; /* get the master colors */ LSE_master_colors_max_min( &enc_c0, &enc_c1, channels, uncompressed ); /* store the 565 color 0 and color 1 */ compressed[0] = (enc_c0 >> 0) & 255; compressed[1] = (enc_c0 >> 8) & 255; compressed[2] = (enc_c1 >> 0) & 255; compressed[3] = (enc_c1 >> 8) & 255; /* zero out the compressed data */ compressed[4] = 0; compressed[5] = 0; compressed[6] = 0; compressed[7] = 0; /* reconstitute the master color vectors */ rgb_888_from_565( enc_c0, &c0[0], &c0[1], &c0[2] ); rgb_888_from_565( enc_c1, &c1[0], &c1[1], &c1[2] ); /* the new vector */ vec_len2 = 0.0f; for( i = 0; i < 3; ++i ) { color_line[i] = (float)(c1[i] - c0[i]); vec_len2 += color_line[i] * color_line[i]; } if( vec_len2 > 0.0f ) { vec_len2 = 1.0f / vec_len2; } /* pre-proform the scaling */ color_line[0] *= vec_len2; color_line[1] *= vec_len2; color_line[2] *= vec_len2; /* compute the offset (constant) portion of the dot product */ dot_offset = color_line[0]*c0[0] + color_line[1]*c0[1] + color_line[2]*c0[2]; /* store the rest of the bits */ next_bit = 8*4; for( i = 0; i < 16; ++i ) { /* find the dot product of this color, to place it on the line (should be [-1,1]) */ int next_value = 0; float dot_product = color_line[0] * uncompressed[i*channels+0] + color_line[1] * uncompressed[i*channels+1] + color_line[2] * uncompressed[i*channels+2] - dot_offset; /* map to [0,3] */ next_value = (int)( dot_product * 3.0f + 0.5f ); if( next_value > 3 ) { next_value = 3; } else if( next_value < 0 ) { next_value = 0; } /* OK, store this value */ compressed[next_bit >> 3] |= swizzle4[ next_value ] << (next_bit & 7); next_bit += 2; } /* done compressing to DXT1 */ } void compress_DDS_alpha_block ( const unsigned char *const uncompressed, unsigned char compressed[8] ) { /* variables */ int i; int next_bit; int a0, a1; float scale_me; /* stupid order */ int swizzle8[] = { 1, 7, 6, 5, 4, 3, 2, 0 }; /* get the alpha limits (a0 > a1) */ a0 = a1 = uncompressed[3]; for( i = 4+3; i < 16*4; i += 4 ) { if( uncompressed[i] > a0 ) { a0 = uncompressed[i]; } else if( uncompressed[i] < a1 ) { a1 = uncompressed[i]; } } /* store those limits, and zero the rest of the compressed dataset */ compressed[0] = a0; compressed[1] = a1; /* zero out the compressed data */ compressed[2] = 0; compressed[3] = 0; compressed[4] = 0; compressed[5] = 0; compressed[6] = 0; compressed[7] = 0; /* store the all of the alpha values */ next_bit = 8*2; scale_me = 7.9999f / (a0 - a1); for( i = 3; i < 16*4; i += 4 ) { /* convert this alpha value to a 3 bit number */ int svalue; int value = (int)((uncompressed[i] - a1) * scale_me); svalue = swizzle8[ value&7 ]; /* OK, store this value, start with the 1st byte */ compressed[next_bit >> 3] |= svalue << (next_bit & 7); if( (next_bit & 7) > 5 ) { /* spans 2 bytes, fill in the start of the 2nd byte */ compressed[1 + (next_bit >> 3)] |= svalue >> (8 - (next_bit & 7) ); } next_bit += 3; } /* done compressing to DXT1 */ } |
Added ext/soil/image_DXT.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
/* Jonathan Dummer 2007-07-31-10.32 simple DXT compression / decompression code public domain */ #ifndef HEADER_IMAGE_DXT #define HEADER_IMAGE_DXT /** Converts an image from an array of unsigned chars (RGB or RGBA) to DXT1 or DXT5, then saves the converted image to disk. \return 0 if failed, otherwise returns 1 **/ int save_image_as_DDS ( const char *filename, int width, int height, int channels, const unsigned char *const data ); /** take an image and convert it to DXT1 (no alpha) **/ unsigned char* convert_image_to_DXT1 ( const unsigned char *const uncompressed, int width, int height, int channels, int *out_size ); /** take an image and convert it to DXT5 (with alpha) **/ unsigned char* convert_image_to_DXT5 ( const unsigned char *const uncompressed, int width, int height, int channels, int *out_size ); /** A bunch of DirectDraw Surface structures and flags **/ typedef struct { unsigned int dwMagic; unsigned int dwSize; unsigned int dwFlags; unsigned int dwHeight; unsigned int dwWidth; unsigned int dwPitchOrLinearSize; unsigned int dwDepth; unsigned int dwMipMapCount; unsigned int dwReserved1[ 11 ]; /* DDPIXELFORMAT */ struct { unsigned int dwSize; unsigned int dwFlags; unsigned int dwFourCC; unsigned int dwRGBBitCount; unsigned int dwRBitMask; unsigned int dwGBitMask; unsigned int dwBBitMask; unsigned int dwAlphaBitMask; } sPixelFormat; /* DDCAPS2 */ struct { unsigned int dwCaps1; unsigned int dwCaps2; unsigned int dwDDSX; unsigned int dwReserved; } sCaps; unsigned int dwReserved2; } DDS_header ; /* the following constants were copied directly off the MSDN website */ /* The dwFlags member of the original DDSURFACEDESC2 structure can be set to one or more of the following values. */ #define DDSD_CAPS 0x00000001 #define DDSD_HEIGHT 0x00000002 #define DDSD_WIDTH 0x00000004 #define DDSD_PITCH 0x00000008 #define DDSD_PIXELFORMAT 0x00001000 #define DDSD_MIPMAPCOUNT 0x00020000 #define DDSD_LINEARSIZE 0x00080000 #define DDSD_DEPTH 0x00800000 /* DirectDraw Pixel Format */ #define DDPF_ALPHAPIXELS 0x00000001 #define DDPF_FOURCC 0x00000004 #define DDPF_RGB 0x00000040 /* The dwCaps1 member of the DDSCAPS2 structure can be set to one or more of the following values. */ #define DDSCAPS_COMPLEX 0x00000008 #define DDSCAPS_TEXTURE 0x00001000 #define DDSCAPS_MIPMAP 0x00400000 /* The dwCaps2 member of the DDSCAPS2 structure can be set to one or more of the following values. */ #define DDSCAPS2_CUBEMAP 0x00000200 #define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400 #define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800 #define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000 #define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000 #define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000 #define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000 #define DDSCAPS2_VOLUME 0x00200000 #endif /* HEADER_IMAGE_DXT */ |
Added ext/soil/image_helper.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
/* Jonathan Dummer image helper functions MIT license */ #include "image_helper.h" #include <stdlib.h> #include <math.h> /* Upscaling the image uses simple bilinear interpolation */ int up_scale_image ( const unsigned char* const orig, int width, int height, int channels, unsigned char* resampled, int resampled_width, int resampled_height ) { float dx, dy; int x, y, c; /* error(s) check */ if ( (width < 1) || (height < 1) || (resampled_width < 2) || (resampled_height < 2) || (channels < 1) || (NULL == orig) || (NULL == resampled) ) { /* signify badness */ return 0; } /* for each given pixel in the new map, find the exact location from the original map which would contribute to this guy */ dx = (width - 1.0f) / (resampled_width - 1.0f); dy = (height - 1.0f) / (resampled_height - 1.0f); for ( y = 0; y < resampled_height; ++y ) { /* find the base y index and fractional offset from that */ float sampley = y * dy; int inty = (int)sampley; /* if( inty < 0 ) { inty = 0; } else */ if( inty > height - 2 ) { inty = height - 2; } sampley -= inty; for ( x = 0; x < resampled_width; ++x ) { float samplex = x * dx; int intx = (int)samplex; int base_index; /* find the base x index and fractional offset from that */ /* if( intx < 0 ) { intx = 0; } else */ if( intx > width - 2 ) { intx = width - 2; } samplex -= intx; /* base index into the original image */ base_index = (inty * width + intx) * channels; for ( c = 0; c < channels; ++c ) { /* do the sampling */ float value = 0.5f; value += orig[base_index] *(1.0f-samplex)*(1.0f-sampley); value += orig[base_index+channels] *(samplex)*(1.0f-sampley); value += orig[base_index+width*channels] *(1.0f-samplex)*(sampley); value += orig[base_index+width*channels+channels] *(samplex)*(sampley); /* move to the next channel */ ++base_index; /* save the new value */ resampled[y*resampled_width*channels+x*channels+c] = (unsigned char)(value); } } } /* done */ return 1; } int mipmap_image ( const unsigned char* const orig, int width, int height, int channels, unsigned char* resampled, int block_size_x, int block_size_y ) { int mip_width, mip_height; int i, j, c; /* error check */ if( (width < 1) || (height < 1) || (channels < 1) || (orig == NULL) || (resampled == NULL) || (block_size_x < 1) || (block_size_y < 1) ) { /* nothing to do */ return 0; } mip_width = width / block_size_x; mip_height = height / block_size_y; if( mip_width < 1 ) { mip_width = 1; } if( mip_height < 1 ) { mip_height = 1; } for( j = 0; j < mip_height; ++j ) { for( i = 0; i < mip_width; ++i ) { for( c = 0; c < channels; ++c ) { const int index = (j*block_size_y)*width*channels + (i*block_size_x)*channels + c; int sum_value; int u,v; int u_block = block_size_x; int v_block = block_size_y; int block_area; /* do a bit of checking so we don't over-run the boundaries (necessary for non-square textures!) */ if( block_size_x * (i+1) > width ) { u_block = width - i*block_size_y; } if( block_size_y * (j+1) > height ) { v_block = height - j*block_size_y; } block_area = u_block*v_block; /* for this pixel, see what the average of all the values in the block are. note: start the sum at the rounding value, not at 0 */ sum_value = block_area >> 1; for( v = 0; v < v_block; ++v ) for( u = 0; u < u_block; ++u ) { sum_value += orig[index + v*width*channels + u*channels]; } resampled[j*mip_width*channels + i*channels + c] = sum_value / block_area; } } } return 1; } int scale_image_RGB_to_NTSC_safe ( unsigned char* orig, int width, int height, int channels ) { const float scale_lo = 16.0f - 0.499f; const float scale_hi = 235.0f + 0.499f; int i, j; int nc = channels; unsigned char scale_LUT[256]; /* error check */ if( (width < 1) || (height < 1) || (channels < 1) || (orig == NULL) ) { /* nothing to do */ return 0; } /* set up the scaling Look Up Table */ for( i = 0; i < 256; ++i ) { scale_LUT[i] = (unsigned char)((scale_hi - scale_lo) * i / 255.0f + scale_lo); } /* for channels = 2 or 4, ignore the alpha component */ nc -= 1 - (channels & 1); /* OK, go through the image and scale any non-alpha components */ for( i = 0; i < width*height*channels; i += channels ) { for( j = 0; j < nc; ++j ) { orig[i+j] = scale_LUT[orig[i+j]]; } } return 1; } unsigned char clamp_byte( int x ) { return ( (x) < 0 ? (0) : ( (x) > 255 ? 255 : (x) ) ); } /* This function takes the RGB components of the image and converts them into YCoCg. 3 components will be re-ordered to CoYCg (for optimum DXT1 compression), while 4 components will be ordered CoCgAY (for DXT5 compression). */ int convert_RGB_to_YCoCg ( unsigned char* orig, int width, int height, int channels ) { int i; /* error check */ if( (width < 1) || (height < 1) || (channels < 3) || (channels > 4) || (orig == NULL) ) { /* nothing to do */ return -1; } /* do the conversion */ if( channels == 3 ) { for( i = 0; i < width*height*3; i += 3 ) { int r = orig[i+0]; int g = (orig[i+1] + 1) >> 1; int b = orig[i+2]; int tmp = (2 + r + b) >> 2; /* Co */ orig[i+0] = clamp_byte( 128 + ((r - b + 1) >> 1) ); /* Y */ orig[i+1] = clamp_byte( g + tmp ); /* Cg */ orig[i+2] = clamp_byte( 128 + g - tmp ); } } else { for( i = 0; i < width*height*4; i += 4 ) { int r = orig[i+0]; int g = (orig[i+1] + 1) >> 1; int b = orig[i+2]; unsigned char a = orig[i+3]; int tmp = (2 + r + b) >> 2; /* Co */ orig[i+0] = clamp_byte( 128 + ((r - b + 1) >> 1) ); /* Cg */ orig[i+1] = clamp_byte( 128 + g - tmp ); /* Alpha */ orig[i+2] = a; /* Y */ orig[i+3] = clamp_byte( g + tmp ); } } /* done */ return 0; } /* This function takes the YCoCg components of the image and converts them into RGB. See above. */ int convert_YCoCg_to_RGB ( unsigned char* orig, int width, int height, int channels ) { int i; /* error check */ if( (width < 1) || (height < 1) || (channels < 3) || (channels > 4) || (orig == NULL) ) { /* nothing to do */ return -1; } /* do the conversion */ if( channels == 3 ) { for( i = 0; i < width*height*3; i += 3 ) { int co = orig[i+0] - 128; int y = orig[i+1]; int cg = orig[i+2] - 128; /* R */ orig[i+0] = clamp_byte( y + co - cg ); /* G */ orig[i+1] = clamp_byte( y + cg ); /* B */ orig[i+2] = clamp_byte( y - co - cg ); } } else { for( i = 0; i < width*height*4; i += 4 ) { int co = orig[i+0] - 128; int cg = orig[i+1] - 128; unsigned char a = orig[i+2]; int y = orig[i+3]; /* R */ orig[i+0] = clamp_byte( y + co - cg ); /* G */ orig[i+1] = clamp_byte( y + cg ); /* B */ orig[i+2] = clamp_byte( y - co - cg ); /* A */ orig[i+3] = a; } } /* done */ return 0; } float find_max_RGBE ( unsigned char *image, int width, int height ) { float max_val = 0.0f; unsigned char *img = image; int i, j; for( i = width * height; i > 0; --i ) { /* float scale = powf( 2.0f, img[3] - 128.0f ) / 255.0f; */ float scale = ldexp( 1.0f / 255.0f, (int)(img[3]) - 128 ); for( j = 0; j < 3; ++j ) { if( img[j] * scale > max_val ) { max_val = img[j] * scale; } } /* next pixel */ img += 4; } return max_val; } int RGBE_to_RGBdivA ( unsigned char *image, int width, int height, int rescale_to_max ) { /* local variables */ int i, iv; unsigned char *img = image; float scale = 1.0f; /* error check */ if( (!image) || (width < 1) || (height < 1) ) { return 0; } /* convert (note: no negative numbers, but 0.0 is possible) */ if( rescale_to_max ) { scale = 255.0f / find_max_RGBE( image, width, height ); } for( i = width * height; i > 0; --i ) { /* decode this pixel, and find the max */ float r,g,b,e, m; /* e = scale * powf( 2.0f, img[3] - 128.0f ) / 255.0f; */ e = scale * ldexp( 1.0f / 255.0f, (int)(img[3]) - 128 ); r = e * img[0]; g = e * img[1]; b = e * img[2]; m = (r > g) ? r : g; m = (b > m) ? b : m; /* and encode it into RGBdivA */ iv = (m != 0.0f) ? (int)(255.0f / m) : 1.0f; iv = (iv < 1) ? 1 : iv; img[3] = (iv > 255) ? 255 : iv; iv = (int)(img[3] * r + 0.5f); img[0] = (iv > 255) ? 255 : iv; iv = (int)(img[3] * g + 0.5f); img[1] = (iv > 255) ? 255 : iv; iv = (int)(img[3] * b + 0.5f); img[2] = (iv > 255) ? 255 : iv; /* and on to the next pixel */ img += 4; } return 1; } int RGBE_to_RGBdivA2 ( unsigned char *image, int width, int height, int rescale_to_max ) { /* local variables */ int i, iv; unsigned char *img = image; float scale = 1.0f; /* error check */ if( (!image) || (width < 1) || (height < 1) ) { return 0; } /* convert (note: no negative numbers, but 0.0 is possible) */ if( rescale_to_max ) { scale = 255.0f * 255.0f / find_max_RGBE( image, width, height ); } for( i = width * height; i > 0; --i ) { /* decode this pixel, and find the max */ float r,g,b,e, m; /* e = scale * powf( 2.0f, img[3] - 128.0f ) / 255.0f; */ e = scale * ldexp( 1.0f / 255.0f, (int)(img[3]) - 128 ); r = e * img[0]; g = e * img[1]; b = e * img[2]; m = (r > g) ? r : g; m = (b > m) ? b : m; /* and encode it into RGBdivA */ iv = (m != 0.0f) ? (int)sqrtf( 255.0f * 255.0f / m ) : 1.0f; iv = (iv < 1) ? 1 : iv; img[3] = (iv > 255) ? 255 : iv; iv = (int)(img[3] * img[3] * r / 255.0f + 0.5f); img[0] = (iv > 255) ? 255 : iv; iv = (int)(img[3] * img[3] * g / 255.0f + 0.5f); img[1] = (iv > 255) ? 255 : iv; iv = (int)(img[3] * img[3] * b / 255.0f + 0.5f); img[2] = (iv > 255) ? 255 : iv; /* and on to the next pixel */ img += 4; } return 1; } |
Added ext/soil/image_helper.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
/* Jonathan Dummer Image helper functions MIT license */ #ifndef HEADER_IMAGE_HELPER #define HEADER_IMAGE_HELPER #ifdef __cplusplus extern "C" { #endif /** This function upscales an image. Not to be used to create MIPmaps, but to make it square, or to make it a power-of-two sized. **/ int up_scale_image ( const unsigned char* const orig, int width, int height, int channels, unsigned char* resampled, int resampled_width, int resampled_height ); /** This function downscales an image. Used for creating MIPmaps, the incoming image should be a power-of-two sized. **/ int mipmap_image ( const unsigned char* const orig, int width, int height, int channels, unsigned char* resampled, int block_size_x, int block_size_y ); /** This function takes the RGB components of the image and scales each channel from [0,255] to [16,235]. This makes the colors "Safe" for display on NTSC displays. Note that this is _NOT_ a good idea for loading images like normal- or height-maps! **/ int scale_image_RGB_to_NTSC_safe ( unsigned char* orig, int width, int height, int channels ); /** This function takes the RGB components of the image and converts them into YCoCg. 3 components will be re-ordered to CoYCg (for optimum DXT1 compression), while 4 components will be ordered CoCgAY (for DXT5 compression). **/ int convert_RGB_to_YCoCg ( unsigned char* orig, int width, int height, int channels ); /** This function takes the YCoCg components of the image and converts them into RGB. See above. **/ int convert_YCoCg_to_RGB ( unsigned char* orig, int width, int height, int channels ); /** Converts an HDR image from an array of unsigned chars (RGBE) to RGBdivA \return 0 if failed, otherwise returns 1 **/ int RGBE_to_RGBdivA ( unsigned char *image, int width, int height, int rescale_to_max ); /** Converts an HDR image from an array of unsigned chars (RGBE) to RGBdivA2 \return 0 if failed, otherwise returns 1 **/ int RGBE_to_RGBdivA2 ( unsigned char *image, int width, int height, int rescale_to_max ); #ifdef __cplusplus } #endif #endif /* HEADER_IMAGE_HELPER */ |
Added ext/soil/stb_image_aug.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 |
/* stbi-1.16 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c when you control the images you're loading QUICK NOTES: Primarily of interest to game developers and other people who can avoid problematic images and only need the trivial interface JPEG baseline (no JPEG progressive, no oddball channel decimations) PNG non-interlaced BMP non-1bpp, non-RLE TGA (not sure what subset, if a subset) PSD (composited view only, no extra channels) HDR (radiance rgbE format) writes BMP,TGA (define STBI_NO_WRITE to remove code) decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code) supports installable dequantizing-IDCT, YCbCr-to-RGB conversion (define STBI_SIMD) TODO: stbi_info_* history: 1.16 major bugfix - convert_format converted one too many pixels 1.15 initialize some fields for thread safety 1.14 fix threadsafe conversion bug; header-file-only version (#define STBI_HEADER_FILE_ONLY before including) 1.13 threadsafe 1.12 const qualifiers in the API 1.11 Support installable IDCT, colorspace conversion routines 1.10 Fixes for 64-bit (don't use "unsigned long") optimized upsampling by Fabian "ryg" Giesen 1.09 Fix format-conversion for PSD code (bad global variables!) 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz 1.07 attempt to fix C++ warning/errors again 1.06 attempt to fix C++ warning/errors again 1.05 fix TGA loading to return correct *comp and use good luminance calc 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR 1.02 support for (subset of) HDR files, float interface for preferred access to them 1.01 fix bug: possible bug in handling right-side up bmps... not sure fix bug: the stbi_bmp_load() and stbi_tga_load() functions didn't work at all 1.00 interface to zlib that skips zlib header 0.99 correct handling of alpha in palette 0.98 TGA loader by lonesock; dynamically add loaders (untested) 0.97 jpeg errors on too large a file; also catch another malloc failure 0.96 fix detection of invalid v value - particleman@mollyrocket forum 0.95 during header scan, seek to markers in case of padding 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same 0.93 handle jpegtran output; verbose errors 0.92 read 4,8,16,24,32-bit BMP files of several formats 0.91 output 24-bit Windows 3.0 BMP files 0.90 fix a few more warnings; bump version number to approach 1.0 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd 0.60 fix compiling as c++ 0.59 fix warnings: merge Dave Moore's -Wall fixes 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less than 16 available 0.56 fix bug: zlib uncompressed mode len vs. nlen 0.55 fix bug: restart_interval not initialized to 0 0.54 allow NULL for 'int *comp' 0.53 fix bug in png 3->4; speedup png decoding 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments 0.51 obey req_comp requests, 1-component jpegs return as 1-component, on 'test' only check type, not whether we support this variant */ #include "stb_image_aug.h" #ifndef STBI_NO_HDR #include <math.h> // ldexp #include <string.h> // strcmp #endif #ifndef STBI_NO_STDIO #include <stdio.h> #endif #include <stdlib.h> #include <memory.h> #include <assert.h> #include <stdarg.h> #ifndef _MSC_VER #ifdef __cplusplus #define __forceinline inline #else #define __forceinline #endif #endif // implementation: typedef unsigned char uint8; typedef unsigned short uint16; typedef signed short int16; typedef unsigned int uint32; typedef signed int int32; typedef unsigned int uint; // should produce compiler error if size is wrong typedef unsigned char validate_uint32[sizeof(uint32)==4]; #if defined(STBI_NO_STDIO) && !defined(STBI_NO_WRITE) #define STBI_NO_WRITE #endif #ifndef STBI_NO_DDS #include "stbi_DDS_aug.h" #endif // I (JLD) want full messages for SOIL #define STBI_FAILURE_USERMSG 1 ////////////////////////////////////////////////////////////////////////////// // // Generic API that works on all image types // // this is not threadsafe static char *failure_reason; char *stbi_failure_reason(void) { return failure_reason; } static int e(char *str) { failure_reason = str; return 0; } #ifdef STBI_NO_FAILURE_STRINGS #define e(x,y) 0 #elif defined(STBI_FAILURE_USERMSG) #define e(x,y) e(y) #else #define e(x,y) e(x) #endif #define epf(x,y) ((float *) (e(x,y)?NULL:NULL)) #define epuc(x,y) ((unsigned char *) (e(x,y)?NULL:NULL)) void stbi_image_free(void *retval_from_stbi_load) { free(retval_from_stbi_load); } #define MAX_LOADERS 32 stbi_loader *loaders[MAX_LOADERS]; static int max_loaders = 0; int stbi_register_loader(stbi_loader *loader) { int i; for (i=0; i < MAX_LOADERS; ++i) { // already present? if (loaders[i] == loader) return 1; // end of the list? if (loaders[i] == NULL) { loaders[i] = loader; max_loaders = i+1; return 1; } } // no room for it return 0; } #ifndef STBI_NO_HDR static float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp); static stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp); #endif #ifndef STBI_NO_STDIO unsigned char *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp) { FILE *f = fopen(filename, "rb"); unsigned char *result; if (!f) return epuc("can't fopen", "Unable to open file"); result = stbi_load_from_file(f,x,y,comp,req_comp); fclose(f); return result; } unsigned char *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) { int i; if (stbi_jpeg_test_file(f)) return stbi_jpeg_load_from_file(f,x,y,comp,req_comp); if (stbi_png_test_file(f)) return stbi_png_load_from_file(f,x,y,comp,req_comp); if (stbi_bmp_test_file(f)) return stbi_bmp_load_from_file(f,x,y,comp,req_comp); if (stbi_psd_test_file(f)) return stbi_psd_load_from_file(f,x,y,comp,req_comp); #ifndef STBI_NO_DDS if (stbi_dds_test_file(f)) return stbi_dds_load_from_file(f,x,y,comp,req_comp); #endif #ifndef STBI_NO_HDR if (stbi_hdr_test_file(f)) { float *hdr = stbi_hdr_load_from_file(f, x,y,comp,req_comp); return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp); } #endif for (i=0; i < max_loaders; ++i) if (loaders[i]->test_file(f)) return loaders[i]->load_from_file(f,x,y,comp,req_comp); // test tga last because it's a crappy test! if (stbi_tga_test_file(f)) return stbi_tga_load_from_file(f,x,y,comp,req_comp); return epuc("unknown image type", "Image not of any known type, or corrupt"); } #endif unsigned char *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) { int i; if (stbi_jpeg_test_memory(buffer,len)) return stbi_jpeg_load_from_memory(buffer,len,x,y,comp,req_comp); if (stbi_png_test_memory(buffer,len)) return stbi_png_load_from_memory(buffer,len,x,y,comp,req_comp); if (stbi_bmp_test_memory(buffer,len)) return stbi_bmp_load_from_memory(buffer,len,x,y,comp,req_comp); if (stbi_psd_test_memory(buffer,len)) return stbi_psd_load_from_memory(buffer,len,x,y,comp,req_comp); #ifndef STBI_NO_DDS if (stbi_dds_test_memory(buffer,len)) return stbi_dds_load_from_memory(buffer,len,x,y,comp,req_comp); #endif #ifndef STBI_NO_HDR if (stbi_hdr_test_memory(buffer, len)) { float *hdr = stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp); return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp); } #endif for (i=0; i < max_loaders; ++i) if (loaders[i]->test_memory(buffer,len)) return loaders[i]->load_from_memory(buffer,len,x,y,comp,req_comp); // test tga last because it's a crappy test! if (stbi_tga_test_memory(buffer,len)) return stbi_tga_load_from_memory(buffer,len,x,y,comp,req_comp); return epuc("unknown image type", "Image not of any known type, or corrupt"); } #ifndef STBI_NO_HDR #ifndef STBI_NO_STDIO float *stbi_loadf(char const *filename, int *x, int *y, int *comp, int req_comp) { FILE *f = fopen(filename, "rb"); float *result; if (!f) return epf("can't fopen", "Unable to open file"); result = stbi_loadf_from_file(f,x,y,comp,req_comp); fclose(f); return result; } float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) { unsigned char *data; #ifndef STBI_NO_HDR if (stbi_hdr_test_file(f)) return stbi_hdr_load_from_file(f,x,y,comp,req_comp); #endif data = stbi_load_from_file(f, x, y, comp, req_comp); if (data) return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp); return epf("unknown image type", "Image not of any known type, or corrupt"); } #endif float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) { stbi_uc *data; #ifndef STBI_NO_HDR if (stbi_hdr_test_memory(buffer, len)) return stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp); #endif data = stbi_load_from_memory(buffer, len, x, y, comp, req_comp); if (data) return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp); return epf("unknown image type", "Image not of any known type, or corrupt"); } #endif // these is-hdr-or-not is defined independent of whether STBI_NO_HDR is // defined, for API simplicity; if STBI_NO_HDR is defined, it always // reports false! int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len) { #ifndef STBI_NO_HDR return stbi_hdr_test_memory(buffer, len); #else return 0; #endif } #ifndef STBI_NO_STDIO extern int stbi_is_hdr (char const *filename) { FILE *f = fopen(filename, "rb"); int result=0; if (f) { result = stbi_is_hdr_from_file(f); fclose(f); } return result; } extern int stbi_is_hdr_from_file(FILE *f) { #ifndef STBI_NO_HDR return stbi_hdr_test_file(f); #else return 0; #endif } #endif // @TODO: get image dimensions & components without fully decoding #ifndef STBI_NO_STDIO extern int stbi_info (char const *filename, int *x, int *y, int *comp); extern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp); #endif extern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp); #ifndef STBI_NO_HDR static float h2l_gamma_i=1.0f/2.2f, h2l_scale_i=1.0f; static float l2h_gamma=2.2f, l2h_scale=1.0f; void stbi_hdr_to_ldr_gamma(float gamma) { h2l_gamma_i = 1/gamma; } void stbi_hdr_to_ldr_scale(float scale) { h2l_scale_i = 1/scale; } void stbi_ldr_to_hdr_gamma(float gamma) { l2h_gamma = gamma; } void stbi_ldr_to_hdr_scale(float scale) { l2h_scale = scale; } #endif ////////////////////////////////////////////////////////////////////////////// // // Common code used by all image loaders // enum { SCAN_load=0, SCAN_type, SCAN_header, }; typedef struct { uint32 img_x, img_y; int img_n, img_out_n; #ifndef STBI_NO_STDIO FILE *img_file; #endif uint8 *img_buffer, *img_buffer_end; } stbi; #ifndef STBI_NO_STDIO static void start_file(stbi *s, FILE *f) { s->img_file = f; } #endif static void start_mem(stbi *s, uint8 const *buffer, int len) { #ifndef STBI_NO_STDIO s->img_file = NULL; #endif s->img_buffer = (uint8 *) buffer; s->img_buffer_end = (uint8 *) buffer+len; } __forceinline static int get8(stbi *s) { #ifndef STBI_NO_STDIO if (s->img_file) { int c = fgetc(s->img_file); return c == EOF ? 0 : c; } #endif if (s->img_buffer < s->img_buffer_end) return *s->img_buffer++; return 0; } __forceinline static int at_eof(stbi *s) { #ifndef STBI_NO_STDIO if (s->img_file) return feof(s->img_file); #endif return s->img_buffer >= s->img_buffer_end; } __forceinline static uint8 get8u(stbi *s) { return (uint8) get8(s); } static void skip(stbi *s, int n) { #ifndef STBI_NO_STDIO if (s->img_file) fseek(s->img_file, n, SEEK_CUR); else #endif s->img_buffer += n; } static int get16(stbi *s) { int z = get8(s); return (z << 8) + get8(s); } static uint32 get32(stbi *s) { uint32 z = get16(s); return (z << 16) + get16(s); } static int get16le(stbi *s) { int z = get8(s); return z + (get8(s) << 8); } static uint32 get32le(stbi *s) { uint32 z = get16le(s); return z + (get16le(s) << 16); } static void getn(stbi *s, stbi_uc *buffer, int n) { #ifndef STBI_NO_STDIO if (s->img_file) { fread(buffer, 1, n, s->img_file); return; } #endif memcpy(buffer, s->img_buffer, n); s->img_buffer += n; } ////////////////////////////////////////////////////////////////////////////// // // generic converter from built-in img_n to req_comp // individual types do this automatically as much as possible (e.g. jpeg // does all cases internally since it needs to colorspace convert anyway, // and it never has alpha, so very few cases ). png can automatically // interleave an alpha=255 channel, but falls back to this for other cases // // assume data buffer is malloced, so malloc a new one and free that one // only failure mode is malloc failing static uint8 compute_y(int r, int g, int b) { return (uint8) (((r*77) + (g*150) + (29*b)) >> 8); } static unsigned char *convert_format(unsigned char *data, int img_n, int req_comp, uint x, uint y) { int i,j; unsigned char *good; if (req_comp == img_n) return data; assert(req_comp >= 1 && req_comp <= 4); good = (unsigned char *) malloc(req_comp * x * y); if (good == NULL) { free(data); return epuc("outofmem", "Out of memory"); } for (j=0; j < (int) y; ++j) { unsigned char *src = data + j * x * img_n ; unsigned char *dest = good + j * x * req_comp; #define COMBO(a,b) ((a)*8+(b)) #define CASE(a,b) case COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b) // convert source image with img_n components to one with req_comp components; // avoid switch per pixel, so use switch per scanline and massive macros switch(COMBO(img_n, req_comp)) { CASE(1,2) dest[0]=src[0], dest[1]=255; break; CASE(1,3) dest[0]=dest[1]=dest[2]=src[0]; break; CASE(1,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=255; break; CASE(2,1) dest[0]=src[0]; break; CASE(2,3) dest[0]=dest[1]=dest[2]=src[0]; break; CASE(2,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; break; CASE(3,4) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255; break; CASE(3,1) dest[0]=compute_y(src[0],src[1],src[2]); break; CASE(3,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = 255; break; CASE(4,1) dest[0]=compute_y(src[0],src[1],src[2]); break; CASE(4,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = src[3]; break; CASE(4,3) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; break; default: assert(0); } #undef CASE } free(data); return good; } #ifndef STBI_NO_HDR static float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp) { int i,k,n; float *output = (float *) malloc(x * y * comp * sizeof(float)); if (output == NULL) { free(data); return epf("outofmem", "Out of memory"); } // compute number of non-alpha components if (comp & 1) n = comp; else n = comp-1; for (i=0; i < x*y; ++i) { for (k=0; k < n; ++k) { output[i*comp + k] = (float) pow(data[i*comp+k]/255.0f, l2h_gamma) * l2h_scale; } if (k < comp) output[i*comp + k] = data[i*comp+k]/255.0f; } free(data); return output; } #define float2int(x) ((int) (x)) static stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp) { int i,k,n; stbi_uc *output = (stbi_uc *) malloc(x * y * comp); if (output == NULL) { free(data); return epuc("outofmem", "Out of memory"); } // compute number of non-alpha components if (comp & 1) n = comp; else n = comp-1; for (i=0; i < x*y; ++i) { for (k=0; k < n; ++k) { float z = (float) pow(data[i*comp+k]*h2l_scale_i, h2l_gamma_i) * 255 + 0.5f; if (z < 0) z = 0; if (z > 255) z = 255; output[i*comp + k] = float2int(z); } if (k < comp) { float z = data[i*comp+k] * 255 + 0.5f; if (z < 0) z = 0; if (z > 255) z = 255; output[i*comp + k] = float2int(z); } } free(data); return output; } #endif ////////////////////////////////////////////////////////////////////////////// // // "baseline" JPEG/JFIF decoder (not actually fully baseline implementation) // // simple implementation // - channel subsampling of at most 2 in each dimension // - doesn't support delayed output of y-dimension // - simple interface (only one output format: 8-bit interleaved RGB) // - doesn't try to recover corrupt jpegs // - doesn't allow partial loading, loading multiple at once // - still fast on x86 (copying globals into locals doesn't help x86) // - allocates lots of intermediate memory (full size of all components) // - non-interleaved case requires this anyway // - allows good upsampling (see next) // high-quality // - upsampled channels are bilinearly interpolated, even across blocks // - quality integer IDCT derived from IJG's 'slow' // performance // - fast huffman; reasonable integer IDCT // - uses a lot of intermediate memory, could cache poorly // - load http://nothings.org/remote/anemones.jpg 3 times on 2.8Ghz P4 // stb_jpeg: 1.34 seconds (MSVC6, default release build) // stb_jpeg: 1.06 seconds (MSVC6, processor = Pentium Pro) // IJL11.dll: 1.08 seconds (compiled by intel) // IJG 1998: 0.98 seconds (MSVC6, makefile provided by IJG) // IJG 1998: 0.95 seconds (MSVC6, makefile + proc=PPro) // huffman decoding acceleration #define FAST_BITS 9 // larger handles more cases; smaller stomps less cache typedef struct { uint8 fast[1 << FAST_BITS]; // weirdly, repacking this into AoS is a 10% speed loss, instead of a win uint16 code[256]; uint8 values[256]; uint8 size[257]; unsigned int maxcode[18]; int delta[17]; // old 'firstsymbol' - old 'firstcode' } huffman; typedef struct { #if STBI_SIMD unsigned short dequant2[4][64]; #endif stbi s; huffman huff_dc[4]; huffman huff_ac[4]; uint8 dequant[4][64]; // sizes for components, interleaved MCUs int img_h_max, img_v_max; int img_mcu_x, img_mcu_y; int img_mcu_w, img_mcu_h; // definition of jpeg image component struct { int id; int h,v; int tq; int hd,ha; int dc_pred; int x,y,w2,h2; uint8 *data; void *raw_data; uint8 *linebuf; } img_comp[4]; uint32 code_buffer; // jpeg entropy-coded buffer int code_bits; // number of valid bits unsigned char marker; // marker seen while filling entropy buffer int nomore; // flag if we saw a marker so must stop int scan_n, order[4]; int restart_interval, todo; } jpeg; static int build_huffman(huffman *h, int *count) { int i,j,k=0,code; // build size list for each symbol (from JPEG spec) for (i=0; i < 16; ++i) for (j=0; j < count[i]; ++j) h->size[k++] = (uint8) (i+1); h->size[k] = 0; // compute actual symbols (from jpeg spec) code = 0; k = 0; for(j=1; j <= 16; ++j) { // compute delta to add to code to compute symbol id h->delta[j] = k - code; if (h->size[k] == j) { while (h->size[k] == j) h->code[k++] = (uint16) (code++); if (code-1 >= (1 << j)) return e("bad code lengths","Corrupt JPEG"); } // compute largest code + 1 for this size, preshifted as needed later h->maxcode[j] = code << (16-j); code <<= 1; } h->maxcode[j] = 0xffffffff; // build non-spec acceleration table; 255 is flag for not-accelerated memset(h->fast, 255, 1 << FAST_BITS); for (i=0; i < k; ++i) { int s = h->size[i]; if (s <= FAST_BITS) { int c = h->code[i] << (FAST_BITS-s); int m = 1 << (FAST_BITS-s); for (j=0; j < m; ++j) { h->fast[c+j] = (uint8) i; } } } return 1; } static void grow_buffer_unsafe(jpeg *j) { do { int b = j->nomore ? 0 : get8(&j->s); if (b == 0xff) { int c = get8(&j->s); if (c != 0) { j->marker = (unsigned char) c; j->nomore = 1; return; } } j->code_buffer = (j->code_buffer << 8) | b; j->code_bits += 8; } while (j->code_bits <= 24); } // (1 << n) - 1 static uint32 bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535}; // decode a jpeg huffman value from the bitstream __forceinline static int decode(jpeg *j, huffman *h) { unsigned int temp; int c,k; if (j->code_bits < 16) grow_buffer_unsafe(j); // look at the top FAST_BITS and determine what symbol ID it is, // if the code is <= FAST_BITS c = (j->code_buffer >> (j->code_bits - FAST_BITS)) & ((1 << FAST_BITS)-1); k = h->fast[c]; if (k < 255) { if (h->size[k] > j->code_bits) return -1; j->code_bits -= h->size[k]; return h->values[k]; } // naive test is to shift the code_buffer down so k bits are // valid, then test against maxcode. To speed this up, we've // preshifted maxcode left so that it has (16-k) 0s at the // end; in other words, regardless of the number of bits, it // wants to be compared against something shifted to have 16; // that way we don't need to shift inside the loop. if (j->code_bits < 16) temp = (j->code_buffer << (16 - j->code_bits)) & 0xffff; else temp = (j->code_buffer >> (j->code_bits - 16)) & 0xffff; for (k=FAST_BITS+1 ; ; ++k) if (temp < h->maxcode[k]) break; if (k == 17) { // error! code not found j->code_bits -= 16; return -1; } if (k > j->code_bits) return -1; // convert the huffman code to the symbol id c = ((j->code_buffer >> (j->code_bits - k)) & bmask[k]) + h->delta[k]; assert((((j->code_buffer) >> (j->code_bits - h->size[c])) & bmask[h->size[c]]) == h->code[c]); // convert the id to a symbol j->code_bits -= k; return h->values[c]; } // combined JPEG 'receive' and JPEG 'extend', since baseline // always extends everything it receives. __forceinline static int extend_receive(jpeg *j, int n) { unsigned int m = 1 << (n-1); unsigned int k; if (j->code_bits < n) grow_buffer_unsafe(j); k = (j->code_buffer >> (j->code_bits - n)) & bmask[n]; j->code_bits -= n; // the following test is probably a random branch that won't // predict well. I tried to table accelerate it but failed. // maybe it's compiling as a conditional move? if (k < m) return (-1 << n) + k + 1; else return k; } // given a value that's at position X in the zigzag stream, // where does it appear in the 8x8 matrix coded as row-major? static uint8 dezigzag[64+15] = { 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63, // let corrupt input sample past end 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63 }; // decode one 64-entry block-- static int decode_block(jpeg *j, short data[64], huffman *hdc, huffman *hac, int b) { int diff,dc,k; int t = decode(j, hdc); if (t < 0) return e("bad huffman code","Corrupt JPEG"); // 0 all the ac values now so we can do it 32-bits at a time memset(data,0,64*sizeof(data[0])); diff = t ? extend_receive(j, t) : 0; dc = j->img_comp[b].dc_pred + diff; j->img_comp[b].dc_pred = dc; data[0] = (short) dc; // decode AC components, see JPEG spec k = 1; do { int r,s; int rs = decode(j, hac); if (rs < 0) return e("bad huffman code","Corrupt JPEG"); s = rs & 15; r = rs >> 4; if (s == 0) { if (rs != 0xf0) break; // end block k += 16; } else { k += r; // decode into unzigzag'd location data[dezigzag[k++]] = (short) extend_receive(j,s); } } while (k < 64); return 1; } // take a -128..127 value and clamp it and convert to 0..255 __forceinline static uint8 clamp(int x) { x += 128; // trick to use a single test to catch both cases if ((unsigned int) x > 255) { if (x < 0) return 0; if (x > 255) return 255; } return (uint8) x; } #define f2f(x) (int) (((x) * 4096 + 0.5)) #define fsh(x) ((x) << 12) // derived from jidctint -- DCT_ISLOW #define IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \ int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \ p2 = s2; \ p3 = s6; \ p1 = (p2+p3) * f2f(0.5411961f); \ t2 = p1 + p3*f2f(-1.847759065f); \ t3 = p1 + p2*f2f( 0.765366865f); \ p2 = s0; \ p3 = s4; \ t0 = fsh(p2+p3); \ t1 = fsh(p2-p3); \ x0 = t0+t3; \ x3 = t0-t3; \ x1 = t1+t2; \ x2 = t1-t2; \ t0 = s7; \ t1 = s5; \ t2 = s3; \ t3 = s1; \ p3 = t0+t2; \ p4 = t1+t3; \ p1 = t0+t3; \ p2 = t1+t2; \ p5 = (p3+p4)*f2f( 1.175875602f); \ t0 = t0*f2f( 0.298631336f); \ t1 = t1*f2f( 2.053119869f); \ t2 = t2*f2f( 3.072711026f); \ t3 = t3*f2f( 1.501321110f); \ p1 = p5 + p1*f2f(-0.899976223f); \ p2 = p5 + p2*f2f(-2.562915447f); \ p3 = p3*f2f(-1.961570560f); \ p4 = p4*f2f(-0.390180644f); \ t3 += p1+p4; \ t2 += p2+p3; \ t1 += p2+p4; \ t0 += p1+p3; #if !STBI_SIMD // .344 seconds on 3*anemones.jpg static void idct_block(uint8 *out, int out_stride, short data[64], uint8 *dequantize) { int i,val[64],*v=val; uint8 *o,*dq = dequantize; short *d = data; // columns for (i=0; i < 8; ++i,++d,++dq, ++v) { // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0 && d[40]==0 && d[48]==0 && d[56]==0) { // no shortcut 0 seconds // (1|2|3|4|5|6|7)==0 0 seconds // all separate -0.047 seconds // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds int dcterm = d[0] * dq[0] << 2; v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm; } else { IDCT_1D(d[ 0]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24], d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[56]) // constants scaled things up by 1<<12; let's bring them back // down, but keep 2 extra bits of precision x0 += 512; x1 += 512; x2 += 512; x3 += 512; v[ 0] = (x0+t3) >> 10; v[56] = (x0-t3) >> 10; v[ 8] = (x1+t2) >> 10; v[48] = (x1-t2) >> 10; v[16] = (x2+t1) >> 10; v[40] = (x2-t1) >> 10; v[24] = (x3+t0) >> 10; v[32] = (x3-t0) >> 10; } } for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) { // no fast case since the first 1D IDCT spread components out IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7]) // constants scaled things up by 1<<12, plus we had 1<<2 from first // loop, plus horizontal and vertical each scale by sqrt(8) so together // we've got an extra 1<<3, so 1<<17 total we need to remove. x0 += 65536; x1 += 65536; x2 += 65536; x3 += 65536; o[0] = clamp((x0+t3) >> 17); o[7] = clamp((x0-t3) >> 17); o[1] = clamp((x1+t2) >> 17); o[6] = clamp((x1-t2) >> 17); o[2] = clamp((x2+t1) >> 17); o[5] = clamp((x2-t1) >> 17); o[3] = clamp((x3+t0) >> 17); o[4] = clamp((x3-t0) >> 17); } } #else static void idct_block(uint8 *out, int out_stride, short data[64], unsigned short *dequantize) { int i,val[64],*v=val; uint8 *o; unsigned short *dq = dequantize; short *d = data; // columns for (i=0; i < 8; ++i,++d,++dq, ++v) { // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0 && d[40]==0 && d[48]==0 && d[56]==0) { // no shortcut 0 seconds // (1|2|3|4|5|6|7)==0 0 seconds // all separate -0.047 seconds // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds int dcterm = d[0] * dq[0] << 2; v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm; } else { IDCT_1D(d[ 0]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24], d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[56]) // constants scaled things up by 1<<12; let's bring them back // down, but keep 2 extra bits of precision x0 += 512; x1 += 512; x2 += 512; x3 += 512; v[ 0] = (x0+t3) >> 10; v[56] = (x0-t3) >> 10; v[ 8] = (x1+t2) >> 10; v[48] = (x1-t2) >> 10; v[16] = (x2+t1) >> 10; v[40] = (x2-t1) >> 10; v[24] = (x3+t0) >> 10; v[32] = (x3-t0) >> 10; } } for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) { // no fast case since the first 1D IDCT spread components out IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7]) // constants scaled things up by 1<<12, plus we had 1<<2 from first // loop, plus horizontal and vertical each scale by sqrt(8) so together // we've got an extra 1<<3, so 1<<17 total we need to remove. x0 += 65536; x1 += 65536; x2 += 65536; x3 += 65536; o[0] = clamp((x0+t3) >> 17); o[7] = clamp((x0-t3) >> 17); o[1] = clamp((x1+t2) >> 17); o[6] = clamp((x1-t2) >> 17); o[2] = clamp((x2+t1) >> 17); o[5] = clamp((x2-t1) >> 17); o[3] = clamp((x3+t0) >> 17); o[4] = clamp((x3-t0) >> 17); } } static stbi_idct_8x8 stbi_idct_installed = idct_block; extern void stbi_install_idct(stbi_idct_8x8 func) { stbi_idct_installed = func; } #endif #define MARKER_none 0xff // if there's a pending marker from the entropy stream, return that // otherwise, fetch from the stream and get a marker. if there's no // marker, return 0xff, which is never a valid marker value static uint8 get_marker(jpeg *j) { uint8 x; if (j->marker != MARKER_none) { x = j->marker; j->marker = MARKER_none; return x; } x = get8u(&j->s); if (x != 0xff) return MARKER_none; while (x == 0xff) x = get8u(&j->s); return x; } // in each scan, we'll have scan_n components, and the order // of the components is specified by order[] #define RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7) // after a restart interval, reset the entropy decoder and // the dc prediction static void reset(jpeg *j) { j->code_bits = 0; j->code_buffer = 0; j->nomore = 0; j->img_comp[0].dc_pred = j->img_comp[1].dc_pred = j->img_comp[2].dc_pred = 0; j->marker = MARKER_none; j->todo = j->restart_interval ? j->restart_interval : 0x7fffffff; // no more than 1<<31 MCUs if no restart_interal? that's plenty safe, // since we don't even allow 1<<30 pixels } static int parse_entropy_coded_data(jpeg *z) { reset(z); if (z->scan_n == 1) { int i,j; #if STBI_SIMD __declspec(align(16)) #endif short data[64]; int n = z->order[0]; // non-interleaved data, we just need to process one block at a time, // in trivial scanline order // number of blocks to do just depends on how many actual "pixels" this // component has, independent of interleaved MCU blocking and such int w = (z->img_comp[n].x+7) >> 3; int h = (z->img_comp[n].y+7) >> 3; for (j=0; j < h; ++j) { for (i=0; i < w; ++i) { if (!decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+z->img_comp[n].ha, n)) return 0; #if STBI_SIMD stbi_idct_installed(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data, z->dequant2[z->img_comp[n].tq]); #else idct_block(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data, z->dequant[z->img_comp[n].tq]); #endif // every data block is an MCU, so countdown the restart interval if (--z->todo <= 0) { if (z->code_bits < 24) grow_buffer_unsafe(z); // if it's NOT a restart, then just bail, so we get corrupt data // rather than no data if (!RESTART(z->marker)) return 1; reset(z); } } } } else { // interleaved! int i,j,k,x,y; short data[64]; for (j=0; j < z->img_mcu_y; ++j) { for (i=0; i < z->img_mcu_x; ++i) { // scan an interleaved mcu... process scan_n components in order for (k=0; k < z->scan_n; ++k) { int n = z->order[k]; // scan out an mcu's worth of this component; that's just determined // by the basic H and V specified for the component for (y=0; y < z->img_comp[n].v; ++y) { for (x=0; x < z->img_comp[n].h; ++x) { int x2 = (i*z->img_comp[n].h + x)*8; int y2 = (j*z->img_comp[n].v + y)*8; if (!decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+z->img_comp[n].ha, n)) return 0; #if STBI_SIMD stbi_idct_installed(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data, z->dequant2[z->img_comp[n].tq]); #else idct_block(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data, z->dequant[z->img_comp[n].tq]); #endif } } } // after all interleaved components, that's an interleaved MCU, // so now count down the restart interval if (--z->todo <= 0) { if (z->code_bits < 24) grow_buffer_unsafe(z); // if it's NOT a restart, then just bail, so we get corrupt data // rather than no data if (!RESTART(z->marker)) return 1; reset(z); } } } } return 1; } static int process_marker(jpeg *z, int m) { int L; switch (m) { case MARKER_none: // no marker found return e("expected marker","Corrupt JPEG"); case 0xC2: // SOF - progressive return e("progressive jpeg","JPEG format not supported (progressive)"); case 0xDD: // DRI - specify restart interval if (get16(&z->s) != 4) return e("bad DRI len","Corrupt JPEG"); z->restart_interval = get16(&z->s); return 1; case 0xDB: // DQT - define quantization table L = get16(&z->s)-2; while (L > 0) { int q = get8(&z->s); int p = q >> 4; int t = q & 15,i; if (p != 0) return e("bad DQT type","Corrupt JPEG"); if (t > 3) return e("bad DQT table","Corrupt JPEG"); for (i=0; i < 64; ++i) z->dequant[t][dezigzag[i]] = get8u(&z->s); #if STBI_SIMD for (i=0; i < 64; ++i) z->dequant2[t][i] = dequant[t][i]; #endif L -= 65; } return L==0; case 0xC4: // DHT - define huffman table L = get16(&z->s)-2; while (L > 0) { uint8 *v; int sizes[16],i,m=0; int q = get8(&z->s); int tc = q >> 4; int th = q & 15; if (tc > 1 || th > 3) return e("bad DHT header","Corrupt JPEG"); for (i=0; i < 16; ++i) { sizes[i] = get8(&z->s); m += sizes[i]; } L -= 17; if (tc == 0) { if (!build_huffman(z->huff_dc+th, sizes)) return 0; v = z->huff_dc[th].values; } else { if (!build_huffman(z->huff_ac+th, sizes)) return 0; v = z->huff_ac[th].values; } for (i=0; i < m; ++i) v[i] = get8u(&z->s); L -= m; } return L==0; } // check for comment block or APP blocks if ((m >= 0xE0 && m <= 0xEF) || m == 0xFE) { skip(&z->s, get16(&z->s)-2); return 1; } return 0; } // after we see SOS static int process_scan_header(jpeg *z) { int i; int Ls = get16(&z->s); z->scan_n = get8(&z->s); if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s.img_n) return e("bad SOS component count","Corrupt JPEG"); if (Ls != 6+2*z->scan_n) return e("bad SOS len","Corrupt JPEG"); for (i=0; i < z->scan_n; ++i) { int id = get8(&z->s), which; int q = get8(&z->s); for (which = 0; which < z->s.img_n; ++which) if (z->img_comp[which].id == id) break; if (which == z->s.img_n) return 0; z->img_comp[which].hd = q >> 4; if (z->img_comp[which].hd > 3) return e("bad DC huff","Corrupt JPEG"); z->img_comp[which].ha = q & 15; if (z->img_comp[which].ha > 3) return e("bad AC huff","Corrupt JPEG"); z->order[i] = which; } if (get8(&z->s) != 0) return e("bad SOS","Corrupt JPEG"); get8(&z->s); // should be 63, but might be 0 if (get8(&z->s) != 0) return e("bad SOS","Corrupt JPEG"); return 1; } static int process_frame_header(jpeg *z, int scan) { stbi *s = &z->s; int Lf,p,i,q, h_max=1,v_max=1,c; Lf = get16(s); if (Lf < 11) return e("bad SOF len","Corrupt JPEG"); // JPEG p = get8(s); if (p != 8) return e("only 8-bit","JPEG format not supported: 8-bit only"); // JPEG baseline s->img_y = get16(s); if (s->img_y == 0) return e("no header height", "JPEG format not supported: delayed height"); // Legal, but we don't handle it--but neither does IJG s->img_x = get16(s); if (s->img_x == 0) return e("0 width","Corrupt JPEG"); // JPEG requires c = get8(s); if (c != 3 && c != 1) return e("bad component count","Corrupt JPEG"); // JFIF requires s->img_n = c; for (i=0; i < c; ++i) { z->img_comp[i].data = NULL; z->img_comp[i].linebuf = NULL; } if (Lf != 8+3*s->img_n) return e("bad SOF len","Corrupt JPEG"); for (i=0; i < s->img_n; ++i) { z->img_comp[i].id = get8(s); if (z->img_comp[i].id != i+1) // JFIF requires if (z->img_comp[i].id != i) // some version of jpegtran outputs non-JFIF-compliant files! return e("bad component ID","Corrupt JPEG"); q = get8(s); z->img_comp[i].h = (q >> 4); if (!z->img_comp[i].h || z->img_comp[i].h > 4) return e("bad H","Corrupt JPEG"); z->img_comp[i].v = q & 15; if (!z->img_comp[i].v || z->img_comp[i].v > 4) return e("bad V","Corrupt JPEG"); z->img_comp[i].tq = get8(s); if (z->img_comp[i].tq > 3) return e("bad TQ","Corrupt JPEG"); } if (scan != SCAN_load) return 1; if ((1 << 30) / s->img_x / s->img_n < s->img_y) return e("too large", "Image too large to decode"); for (i=0; i < s->img_n; ++i) { if (z->img_comp[i].h > h_max) h_max = z->img_comp[i].h; if (z->img_comp[i].v > v_max) v_max = z->img_comp[i].v; } // compute interleaved mcu info z->img_h_max = h_max; z->img_v_max = v_max; z->img_mcu_w = h_max * 8; z->img_mcu_h = v_max * 8; z->img_mcu_x = (s->img_x + z->img_mcu_w-1) / z->img_mcu_w; z->img_mcu_y = (s->img_y + z->img_mcu_h-1) / z->img_mcu_h; for (i=0; i < s->img_n; ++i) { // number of effective pixels (e.g. for non-interleaved MCU) z->img_comp[i].x = (s->img_x * z->img_comp[i].h + h_max-1) / h_max; z->img_comp[i].y = (s->img_y * z->img_comp[i].v + v_max-1) / v_max; // to simplify generation, we'll allocate enough memory to decode // the bogus oversized data from using interleaved MCUs and their // big blocks (e.g. a 16x16 iMCU on an image of width 33); we won't // discard the extra data until colorspace conversion z->img_comp[i].w2 = z->img_mcu_x * z->img_comp[i].h * 8; z->img_comp[i].h2 = z->img_mcu_y * z->img_comp[i].v * 8; z->img_comp[i].raw_data = malloc(z->img_comp[i].w2 * z->img_comp[i].h2+15); if (z->img_comp[i].raw_data == NULL) { for(--i; i >= 0; --i) { free(z->img_comp[i].raw_data); z->img_comp[i].data = NULL; } return e("outofmem", "Out of memory"); } // align blocks for installable-idct using mmx/sse z->img_comp[i].data = (uint8*) (((size_t) z->img_comp[i].raw_data + 15) & ~15); z->img_comp[i].linebuf = NULL; } return 1; } // use comparisons since in some cases we handle more than one case (e.g. SOF) #define DNL(x) ((x) == 0xdc) #define SOI(x) ((x) == 0xd8) #define EOI(x) ((x) == 0xd9) #define SOF(x) ((x) == 0xc0 || (x) == 0xc1) #define SOS(x) ((x) == 0xda) static int decode_jpeg_header(jpeg *z, int scan) { int m; z->marker = MARKER_none; // initialize cached marker to empty m = get_marker(z); if (!SOI(m)) return e("no SOI","Corrupt JPEG"); if (scan == SCAN_type) return 1; m = get_marker(z); while (!SOF(m)) { if (!process_marker(z,m)) return 0; m = get_marker(z); while (m == MARKER_none) { // some files have extra padding after their blocks, so ok, we'll scan if (at_eof(&z->s)) return e("no SOF", "Corrupt JPEG"); m = get_marker(z); } } if (!process_frame_header(z, scan)) return 0; return 1; } static int decode_jpeg_image(jpeg *j) { int m; j->restart_interval = 0; if (!decode_jpeg_header(j, SCAN_load)) return 0; m = get_marker(j); while (!EOI(m)) { if (SOS(m)) { if (!process_scan_header(j)) return 0; if (!parse_entropy_coded_data(j)) return 0; } else { if (!process_marker(j, m)) return 0; } m = get_marker(j); } return 1; } // static jfif-centered resampling (across block boundaries) typedef uint8 *(*resample_row_func)(uint8 *out, uint8 *in0, uint8 *in1, int w, int hs); #define div4(x) ((uint8) ((x) >> 2)) static uint8 *resample_row_1(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs) { return in_near; } static uint8* resample_row_v_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs) { // need to generate two samples vertically for every one in input int i; for (i=0; i < w; ++i) out[i] = div4(3*in_near[i] + in_far[i] + 2); return out; } static uint8* resample_row_h_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs) { // need to generate two samples horizontally for every one in input int i; uint8 *input = in_near; if (w == 1) { // if only one sample, can't do any interpolation out[0] = out[1] = input[0]; return out; } out[0] = input[0]; out[1] = div4(input[0]*3 + input[1] + 2); for (i=1; i < w-1; ++i) { int n = 3*input[i]+2; out[i*2+0] = div4(n+input[i-1]); out[i*2+1] = div4(n+input[i+1]); } out[i*2+0] = div4(input[w-2]*3 + input[w-1] + 2); out[i*2+1] = input[w-1]; return out; } #define div16(x) ((uint8) ((x) >> 4)) static uint8 *resample_row_hv_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs) { // need to generate 2x2 samples for every one in input int i,t0,t1; if (w == 1) { out[0] = out[1] = div4(3*in_near[0] + in_far[0] + 2); return out; } t1 = 3*in_near[0] + in_far[0]; out[0] = div4(t1+2); for (i=1; i < w; ++i) { t0 = t1; t1 = 3*in_near[i]+in_far[i]; out[i*2-1] = div16(3*t0 + t1 + 8); out[i*2 ] = div16(3*t1 + t0 + 8); } out[w*2-1] = div4(t1+2); return out; } static uint8 *resample_row_generic(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs) { // resample with nearest-neighbor int i,j; for (i=0; i < w; ++i) for (j=0; j < hs; ++j) out[i*hs+j] = in_near[i]; return out; } #define float2fixed(x) ((int) ((x) * 65536 + 0.5)) // 0.38 seconds on 3*anemones.jpg (0.25 with processor = Pro) // VC6 without processor=Pro is generating multiple LEAs per multiply! static void YCbCr_to_RGB_row(uint8 *out, uint8 *y, uint8 *pcb, uint8 *pcr, int count, int step) { int i; for (i=0; i < count; ++i) { int y_fixed = (y[i] << 16) + 32768; // rounding int r,g,b; int cr = pcr[i] - 128; int cb = pcb[i] - 128; r = y_fixed + cr*float2fixed(1.40200f); g = y_fixed - cr*float2fixed(0.71414f) - cb*float2fixed(0.34414f); b = y_fixed + cb*float2fixed(1.77200f); r >>= 16; g >>= 16; b >>= 16; if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; } if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; } if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; } out[0] = (uint8)r; out[1] = (uint8)g; out[2] = (uint8)b; out[3] = 255; out += step; } } #if STBI_SIMD static stbi_YCbCr_to_RGB_run stbi_YCbCr_installed = YCbCr_to_RGB_row; void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func) { stbi_YCbCr_installed = func; } #endif // clean up the temporary component buffers static void cleanup_jpeg(jpeg *j) { int i; for (i=0; i < j->s.img_n; ++i) { if (j->img_comp[i].data) { free(j->img_comp[i].raw_data); j->img_comp[i].data = NULL; } if (j->img_comp[i].linebuf) { free(j->img_comp[i].linebuf); j->img_comp[i].linebuf = NULL; } } } typedef struct { resample_row_func resample; uint8 *line0,*line1; int hs,vs; // expansion factor in each axis int w_lores; // horizontal pixels pre-expansion int ystep; // how far through vertical expansion we are int ypos; // which pre-expansion row we're on } stbi_resample; static uint8 *load_jpeg_image(jpeg *z, int *out_x, int *out_y, int *comp, int req_comp) { int n, decode_n; // validate req_comp if (req_comp < 0 || req_comp > 4) return epuc("bad req_comp", "Internal error"); z->s.img_n = 0; // load a jpeg image from whichever source if (!decode_jpeg_image(z)) { cleanup_jpeg(z); return NULL; } // determine actual number of components to generate n = req_comp ? req_comp : z->s.img_n; if (z->s.img_n == 3 && n < 3) decode_n = 1; else decode_n = z->s.img_n; // resample and color-convert { int k; uint i,j; uint8 *output; uint8 *coutput[4]; stbi_resample res_comp[4]; for (k=0; k < decode_n; ++k) { stbi_resample *r = &res_comp[k]; // allocate line buffer big enough for upsampling off the edges // with upsample factor of 4 z->img_comp[k].linebuf = (uint8 *) malloc(z->s.img_x + 3); if (!z->img_comp[k].linebuf) { cleanup_jpeg(z); return epuc("outofmem", "Out of memory"); } r->hs = z->img_h_max / z->img_comp[k].h; r->vs = z->img_v_max / z->img_comp[k].v; r->ystep = r->vs >> 1; r->w_lores = (z->s.img_x + r->hs-1) / r->hs; r->ypos = 0; r->line0 = r->line1 = z->img_comp[k].data; if (r->hs == 1 && r->vs == 1) r->resample = resample_row_1; else if (r->hs == 1 && r->vs == 2) r->resample = resample_row_v_2; else if (r->hs == 2 && r->vs == 1) r->resample = resample_row_h_2; else if (r->hs == 2 && r->vs == 2) r->resample = resample_row_hv_2; else r->resample = resample_row_generic; } // can't error after this so, this is safe output = (uint8 *) malloc(n * z->s.img_x * z->s.img_y + 1); if (!output) { cleanup_jpeg(z); return epuc("outofmem", "Out of memory"); } // now go ahead and resample for (j=0; j < z->s.img_y; ++j) { uint8 *out = output + n * z->s.img_x * j; for (k=0; k < decode_n; ++k) { stbi_resample *r = &res_comp[k]; int y_bot = r->ystep >= (r->vs >> 1); coutput[k] = r->resample(z->img_comp[k].linebuf, y_bot ? r->line1 : r->line0, y_bot ? r->line0 : r->line1, r->w_lores, r->hs); if (++r->ystep >= r->vs) { r->ystep = 0; r->line0 = r->line1; if (++r->ypos < z->img_comp[k].y) r->line1 += z->img_comp[k].w2; } } if (n >= 3) { uint8 *y = coutput[0]; if (z->s.img_n == 3) { #if STBI_SIMD stbi_YCbCr_installed(out, y, coutput[1], coutput[2], z->s.img_x, n); #else YCbCr_to_RGB_row(out, y, coutput[1], coutput[2], z->s.img_x, n); #endif } else for (i=0; i < z->s.img_x; ++i) { out[0] = out[1] = out[2] = y[i]; out[3] = 255; // not used if n==3 out += n; } } else { uint8 *y = coutput[0]; if (n == 1) for (i=0; i < z->s.img_x; ++i) out[i] = y[i]; else for (i=0; i < z->s.img_x; ++i) *out++ = y[i], *out++ = 255; } } cleanup_jpeg(z); *out_x = z->s.img_x; *out_y = z->s.img_y; if (comp) *comp = z->s.img_n; // report original components, not output return output; } } #ifndef STBI_NO_STDIO unsigned char *stbi_jpeg_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) { jpeg j; start_file(&j.s, f); return load_jpeg_image(&j, x,y,comp,req_comp); } unsigned char *stbi_jpeg_load(char const *filename, int *x, int *y, int *comp, int req_comp) { unsigned char *data; FILE *f = fopen(filename, "rb"); if (!f) return NULL; data = stbi_jpeg_load_from_file(f,x,y,comp,req_comp); fclose(f); return data; } #endif unsigned char *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) { jpeg j; start_mem(&j.s, buffer,len); return load_jpeg_image(&j, x,y,comp,req_comp); } #ifndef STBI_NO_STDIO int stbi_jpeg_test_file(FILE *f) { int n,r; jpeg j; n = ftell(f); start_file(&j.s, f); r = decode_jpeg_header(&j, SCAN_type); fseek(f,n,SEEK_SET); return r; } #endif int stbi_jpeg_test_memory(stbi_uc const *buffer, int len) { jpeg j; start_mem(&j.s, buffer,len); return decode_jpeg_header(&j, SCAN_type); } // @TODO: #ifndef STBI_NO_STDIO extern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp); extern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp); #endif extern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp); // public domain zlib decode v0.2 Sean Barrett 2006-11-18 // simple implementation // - all input must be provided in an upfront buffer // - all output is written to a single output buffer (can malloc/realloc) // performance // - fast huffman // fast-way is faster to check than jpeg huffman, but slow way is slower #define ZFAST_BITS 9 // accelerate all cases in default tables #define ZFAST_MASK ((1 << ZFAST_BITS) - 1) // zlib-style huffman encoding // (jpegs packs from left, zlib from right, so can't share code) typedef struct { uint16 fast[1 << ZFAST_BITS]; uint16 firstcode[16]; int maxcode[17]; uint16 firstsymbol[16]; uint8 size[288]; uint16 value[288]; } zhuffman; __forceinline static int bitreverse16(int n) { n = ((n & 0xAAAA) >> 1) | ((n & 0x5555) << 1); n = ((n & 0xCCCC) >> 2) | ((n & 0x3333) << 2); n = ((n & 0xF0F0) >> 4) | ((n & 0x0F0F) << 4); n = ((n & 0xFF00) >> 8) | ((n & 0x00FF) << 8); return n; } __forceinline static int bit_reverse(int v, int bits) { assert(bits <= 16); // to bit reverse n bits, reverse 16 and shift // e.g. 11 bits, bit reverse and shift away 5 return bitreverse16(v) >> (16-bits); } static int zbuild_huffman(zhuffman *z, uint8 *sizelist, int num) { int i,k=0; int code, next_code[16], sizes[17]; // DEFLATE spec for generating codes memset(sizes, 0, sizeof(sizes)); memset(z->fast, 255, sizeof(z->fast)); for (i=0; i < num; ++i) ++sizes[sizelist[i]]; sizes[0] = 0; for (i=1; i < 16; ++i) assert(sizes[i] <= (1 << i)); code = 0; for (i=1; i < 16; ++i) { next_code[i] = code; z->firstcode[i] = (uint16) code; z->firstsymbol[i] = (uint16) k; code = (code + sizes[i]); if (sizes[i]) if (code-1 >= (1 << i)) return e("bad codelengths","Corrupt JPEG"); z->maxcode[i] = code << (16-i); // preshift for inner loop code <<= 1; k += sizes[i]; } z->maxcode[16] = 0x10000; // sentinel for (i=0; i < num; ++i) { int s = sizelist[i]; if (s) { int c = next_code[s] - z->firstcode[s] + z->firstsymbol[s]; z->size[c] = (uint8)s; z->value[c] = (uint16)i; if (s <= ZFAST_BITS) { int k = bit_reverse(next_code[s],s); while (k < (1 << ZFAST_BITS)) { z->fast[k] = (uint16) c; k += (1 << s); } } ++next_code[s]; } } return 1; } // zlib-from-memory implementation for PNG reading // because PNG allows splitting the zlib stream arbitrarily, // and it's annoying structurally to have PNG call ZLIB call PNG, // we require PNG read all the IDATs and combine them into a single // memory buffer typedef struct { uint8 *zbuffer, *zbuffer_end; int num_bits; uint32 code_buffer; char *zout; char *zout_start; char *zout_end; int z_expandable; zhuffman z_length, z_distance; } zbuf; __forceinline static int zget8(zbuf *z) { if (z->zbuffer >= z->zbuffer_end) return 0; return *z->zbuffer++; } static void fill_bits(zbuf *z) { do { assert(z->code_buffer < (1U << z->num_bits)); z->code_buffer |= zget8(z) << z->num_bits; z->num_bits += 8; } while (z->num_bits <= 24); } __forceinline static unsigned int zreceive(zbuf *z, int n) { unsigned int k; if (z->num_bits < n) fill_bits(z); k = z->code_buffer & ((1 << n) - 1); z->code_buffer >>= n; z->num_bits -= n; return k; } __forceinline static int zhuffman_decode(zbuf *a, zhuffman *z) { int b,s,k; if (a->num_bits < 16) fill_bits(a); b = z->fast[a->code_buffer & ZFAST_MASK]; if (b < 0xffff) { s = z->size[b]; a->code_buffer >>= s; a->num_bits -= s; return z->value[b]; } // not resolved by fast table, so compute it the slow way // use jpeg approach, which requires MSbits at top k = bit_reverse(a->code_buffer, 16); for (s=ZFAST_BITS+1; ; ++s) if (k < z->maxcode[s]) break; if (s == 16) return -1; // invalid code! // code size is s, so: b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s]; assert(z->size[b] == s); a->code_buffer >>= s; a->num_bits -= s; return z->value[b]; } static int expand(zbuf *z, int n) // need to make room for n bytes { char *q; int cur, limit; if (!z->z_expandable) return e("output buffer limit","Corrupt PNG"); cur = (int) (z->zout - z->zout_start); limit = (int) (z->zout_end - z->zout_start); while (cur + n > limit) limit *= 2; q = (char *) realloc(z->zout_start, limit); if (q == NULL) return e("outofmem", "Out of memory"); z->zout_start = q; z->zout = q + cur; z->zout_end = q + limit; return 1; } static int length_base[31] = { 3,4,5,6,7,8,9,10,11,13, 15,17,19,23,27,31,35,43,51,59, 67,83,99,115,131,163,195,227,258,0,0 }; static int length_extra[31]= { 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 }; static int dist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193, 257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0}; static int dist_extra[32] = { 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; static int parse_huffman_block(zbuf *a) { for(;;) { int z = zhuffman_decode(a, &a->z_length); if (z < 256) { if (z < 0) return e("bad huffman code","Corrupt PNG"); // error in huffman codes if (a->zout >= a->zout_end) if (!expand(a, 1)) return 0; *a->zout++ = (char) z; } else { uint8 *p; int len,dist; if (z == 256) return 1; z -= 257; len = length_base[z]; if (length_extra[z]) len += zreceive(a, length_extra[z]); z = zhuffman_decode(a, &a->z_distance); if (z < 0) return e("bad huffman code","Corrupt PNG"); dist = dist_base[z]; if (dist_extra[z]) dist += zreceive(a, dist_extra[z]); if (a->zout - a->zout_start < dist) return e("bad dist","Corrupt PNG"); if (a->zout + len > a->zout_end) if (!expand(a, len)) return 0; p = (uint8 *) (a->zout - dist); while (len--) *a->zout++ = *p++; } } } static int compute_huffman_codes(zbuf *a) { static uint8 length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; static zhuffman z_codelength; // static just to save stack space uint8 lencodes[286+32+137];//padding for maximum single op uint8 codelength_sizes[19]; int i,n; int hlit = zreceive(a,5) + 257; int hdist = zreceive(a,5) + 1; int hclen = zreceive(a,4) + 4; memset(codelength_sizes, 0, sizeof(codelength_sizes)); for (i=0; i < hclen; ++i) { int s = zreceive(a,3); codelength_sizes[length_dezigzag[i]] = (uint8) s; } if (!zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0; n = 0; while (n < hlit + hdist) { int c = zhuffman_decode(a, &z_codelength); assert(c >= 0 && c < 19); if (c < 16) lencodes[n++] = (uint8) c; else if (c == 16) { c = zreceive(a,2)+3; memset(lencodes+n, lencodes[n-1], c); n += c; } else if (c == 17) { c = zreceive(a,3)+3; memset(lencodes+n, 0, c); n += c; } else { assert(c == 18); c = zreceive(a,7)+11; memset(lencodes+n, 0, c); n += c; } } if (n != hlit+hdist) return e("bad codelengths","Corrupt PNG"); if (!zbuild_huffman(&a->z_length, lencodes, hlit)) return 0; if (!zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0; return 1; } static int parse_uncompressed_block(zbuf *a) { uint8 header[4]; int len,nlen,k; if (a->num_bits & 7) zreceive(a, a->num_bits & 7); // discard // drain the bit-packed data into header k = 0; while (a->num_bits > 0) { header[k++] = (uint8) (a->code_buffer & 255); // wtf this warns? a->code_buffer >>= 8; a->num_bits -= 8; } assert(a->num_bits == 0); // now fill header the normal way while (k < 4) header[k++] = (uint8) zget8(a); len = header[1] * 256 + header[0]; nlen = header[3] * 256 + header[2]; if (nlen != (len ^ 0xffff)) return e("zlib corrupt","Corrupt PNG"); if (a->zbuffer + len > a->zbuffer_end) return e("read past buffer","Corrupt PNG"); if (a->zout + len > a->zout_end) if (!expand(a, len)) return 0; memcpy(a->zout, a->zbuffer, len); a->zbuffer += len; a->zout += len; return 1; } static int parse_zlib_header(zbuf *a) { int cmf = zget8(a); int cm = cmf & 15; /* int cinfo = cmf >> 4; */ int flg = zget8(a); if ((cmf*256+flg) % 31 != 0) return e("bad zlib header","Corrupt PNG"); // zlib spec if (flg & 32) return e("no preset dict","Corrupt PNG"); // preset dictionary not allowed in png if (cm != 8) return e("bad compression","Corrupt PNG"); // DEFLATE required for png // window = 1 << (8 + cinfo)... but who cares, we fully buffer output return 1; } // @TODO: should statically initialize these for optimal thread safety static uint8 default_length[288], default_distance[32]; static void init_defaults(void) { int i; // use <= to match clearly with spec for (i=0; i <= 143; ++i) default_length[i] = 8; for ( ; i <= 255; ++i) default_length[i] = 9; for ( ; i <= 279; ++i) default_length[i] = 7; for ( ; i <= 287; ++i) default_length[i] = 8; for (i=0; i <= 31; ++i) default_distance[i] = 5; } static int parse_zlib(zbuf *a, int parse_header) { int final, type; if (parse_header) if (!parse_zlib_header(a)) return 0; a->num_bits = 0; a->code_buffer = 0; do { final = zreceive(a,1); type = zreceive(a,2); if (type == 0) { if (!parse_uncompressed_block(a)) return 0; } else if (type == 3) { return 0; } else { if (type == 1) { // use fixed code lengths if (!default_distance[31]) init_defaults(); if (!zbuild_huffman(&a->z_length , default_length , 288)) return 0; if (!zbuild_huffman(&a->z_distance, default_distance, 32)) return 0; } else { if (!compute_huffman_codes(a)) return 0; } if (!parse_huffman_block(a)) return 0; } } while (!final); return 1; } static int do_zlib(zbuf *a, char *obuf, int olen, int exp, int parse_header) { a->zout_start = obuf; a->zout = obuf; a->zout_end = obuf + olen; a->z_expandable = exp; return parse_zlib(a, parse_header); } char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen) { zbuf a; char *p = (char *) malloc(initial_size); if (p == NULL) return NULL; a.zbuffer = (uint8 *) buffer; a.zbuffer_end = (uint8 *) buffer + len; if (do_zlib(&a, p, initial_size, 1, 1)) { if (outlen) *outlen = (int) (a.zout - a.zout_start); return a.zout_start; } else { free(a.zout_start); return NULL; } } char *stbi_zlib_decode_malloc(char const *buffer, int len, int *outlen) { return stbi_zlib_decode_malloc_guesssize(buffer, len, 16384, outlen); } int stbi_zlib_decode_buffer(char *obuffer, int olen, char const *ibuffer, int ilen) { zbuf a; a.zbuffer = (uint8 *) ibuffer; a.zbuffer_end = (uint8 *) ibuffer + ilen; if (do_zlib(&a, obuffer, olen, 0, 1)) return (int) (a.zout - a.zout_start); else return -1; } char *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen) { zbuf a; char *p = (char *) malloc(16384); if (p == NULL) return NULL; a.zbuffer = (uint8 *) buffer; a.zbuffer_end = (uint8 *) buffer+len; if (do_zlib(&a, p, 16384, 1, 0)) { if (outlen) *outlen = (int) (a.zout - a.zout_start); return a.zout_start; } else { free(a.zout_start); return NULL; } } int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen) { zbuf a; a.zbuffer = (uint8 *) ibuffer; a.zbuffer_end = (uint8 *) ibuffer + ilen; if (do_zlib(&a, obuffer, olen, 0, 0)) return (int) (a.zout - a.zout_start); else return -1; } // public domain "baseline" PNG decoder v0.10 Sean Barrett 2006-11-18 // simple implementation // - only 8-bit samples // - no CRC checking // - allocates lots of intermediate memory // - avoids problem of streaming data between subsystems // - avoids explicit window management // performance // - uses stb_zlib, a PD zlib implementation with fast huffman decoding typedef struct { uint32 length; uint32 type; } chunk; #define PNG_TYPE(a,b,c,d) (((a) << 24) + ((b) << 16) + ((c) << 8) + (d)) static chunk get_chunk_header(stbi *s) { chunk c; c.length = get32(s); c.type = get32(s); return c; } static int check_png_header(stbi *s) { static uint8 png_sig[8] = { 137,80,78,71,13,10,26,10 }; int i; for (i=0; i < 8; ++i) if (get8(s) != png_sig[i]) return e("bad png sig","Not a PNG"); return 1; } typedef struct { stbi s; uint8 *idata, *expanded, *out; } png; enum { F_none=0, F_sub=1, F_up=2, F_avg=3, F_paeth=4, F_avg_first, F_paeth_first, }; static uint8 first_row_filter[5] = { F_none, F_sub, F_none, F_avg_first, F_paeth_first }; static int paeth(int a, int b, int c) { int p = a + b - c; int pa = abs(p-a); int pb = abs(p-b); int pc = abs(p-c); if (pa <= pb && pa <= pc) return a; if (pb <= pc) return b; return c; } // create the png data from post-deflated data static int create_png_image(png *a, uint8 *raw, uint32 raw_len, int out_n) { stbi *s = &a->s; uint32 i,j,stride = s->img_x*out_n; int k; int img_n = s->img_n; // copy it into a local for later assert(out_n == s->img_n || out_n == s->img_n+1); a->out = (uint8 *) malloc(s->img_x * s->img_y * out_n); if (!a->out) return e("outofmem", "Out of memory"); if (raw_len != (img_n * s->img_x + 1) * s->img_y) return e("not enough pixels","Corrupt PNG"); for (j=0; j < s->img_y; ++j) { uint8 *cur = a->out + stride*j; uint8 *prior = cur - stride; int filter = *raw++; if (filter > 4) return e("invalid filter","Corrupt PNG"); // if first row, use special filter that doesn't sample previous row if (j == 0) filter = first_row_filter[filter]; // handle first pixel explicitly for (k=0; k < img_n; ++k) { switch(filter) { case F_none : cur[k] = raw[k]; break; case F_sub : cur[k] = raw[k]; break; case F_up : cur[k] = raw[k] + prior[k]; break; case F_avg : cur[k] = raw[k] + (prior[k]>>1); break; case F_paeth : cur[k] = (uint8) (raw[k] + paeth(0,prior[k],0)); break; case F_avg_first : cur[k] = raw[k]; break; case F_paeth_first: cur[k] = raw[k]; break; } } if (img_n != out_n) cur[img_n] = 255; raw += img_n; cur += out_n; prior += out_n; // this is a little gross, so that we don't switch per-pixel or per-component if (img_n == out_n) { #define CASE(f) \ case f: \ for (i=s->img_x-1; i >= 1; --i, raw+=img_n,cur+=img_n,prior+=img_n) \ for (k=0; k < img_n; ++k) switch(filter) { CASE(F_none) cur[k] = raw[k]; break; CASE(F_sub) cur[k] = raw[k] + cur[k-img_n]; break; CASE(F_up) cur[k] = raw[k] + prior[k]; break; CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-img_n])>>1); break; CASE(F_paeth) cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],prior[k],prior[k-img_n])); break; CASE(F_avg_first) cur[k] = raw[k] + (cur[k-img_n] >> 1); break; CASE(F_paeth_first) cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],0,0)); break; } #undef CASE } else { assert(img_n+1 == out_n); #define CASE(f) \ case f: \ for (i=s->img_x-1; i >= 1; --i, cur[img_n]=255,raw+=img_n,cur+=out_n,prior+=out_n) \ for (k=0; k < img_n; ++k) switch(filter) { CASE(F_none) cur[k] = raw[k]; break; CASE(F_sub) cur[k] = raw[k] + cur[k-out_n]; break; CASE(F_up) cur[k] = raw[k] + prior[k]; break; CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-out_n])>>1); break; CASE(F_paeth) cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],prior[k],prior[k-out_n])); break; CASE(F_avg_first) cur[k] = raw[k] + (cur[k-out_n] >> 1); break; CASE(F_paeth_first) cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],0,0)); break; } #undef CASE } } return 1; } static int compute_transparency(png *z, uint8 tc[3], int out_n) { stbi *s = &z->s; uint32 i, pixel_count = s->img_x * s->img_y; uint8 *p = z->out; // compute color-based transparency, assuming we've // already got 255 as the alpha value in the output assert(out_n == 2 || out_n == 4); if (out_n == 2) { for (i=0; i < pixel_count; ++i) { p[1] = (p[0] == tc[0] ? 0 : 255); p += 2; } } else { for (i=0; i < pixel_count; ++i) { if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2]) p[3] = 0; p += 4; } } return 1; } static int expand_palette(png *a, uint8 *palette, int len, int pal_img_n) { uint32 i, pixel_count = a->s.img_x * a->s.img_y; uint8 *p, *temp_out, *orig = a->out; p = (uint8 *) malloc(pixel_count * pal_img_n); if (p == NULL) return e("outofmem", "Out of memory"); // between here and free(out) below, exitting would leak temp_out = p; if (pal_img_n == 3) { for (i=0; i < pixel_count; ++i) { int n = orig[i]*4; p[0] = palette[n ]; p[1] = palette[n+1]; p[2] = palette[n+2]; p += 3; } } else { for (i=0; i < pixel_count; ++i) { int n = orig[i]*4; p[0] = palette[n ]; p[1] = palette[n+1]; p[2] = palette[n+2]; p[3] = palette[n+3]; p += 4; } } free(a->out); a->out = temp_out; return 1; } static int parse_png_file(png *z, int scan, int req_comp) { uint8 palette[1024], pal_img_n=0; uint8 has_trans=0, tc[3]; uint32 ioff=0, idata_limit=0, i, pal_len=0; int first=1,k; stbi *s = &z->s; if (!check_png_header(s)) return 0; if (scan == SCAN_type) return 1; for(;;first=0) { chunk c = get_chunk_header(s); if (first && c.type != PNG_TYPE('I','H','D','R')) return e("first not IHDR","Corrupt PNG"); switch (c.type) { case PNG_TYPE('I','H','D','R'): { int depth,color,interlace,comp,filter; if (!first) return e("multiple IHDR","Corrupt PNG"); if (c.length != 13) return e("bad IHDR len","Corrupt PNG"); s->img_x = get32(s); if (s->img_x > (1 << 24)) return e("too large","Very large image (corrupt?)"); s->img_y = get32(s); if (s->img_y > (1 << 24)) return e("too large","Very large image (corrupt?)"); depth = get8(s); if (depth != 8) return e("8bit only","PNG not supported: 8-bit only"); color = get8(s); if (color > 6) return e("bad ctype","Corrupt PNG"); if (color == 3) pal_img_n = 3; else if (color & 1) return e("bad ctype","Corrupt PNG"); comp = get8(s); if (comp) return e("bad comp method","Corrupt PNG"); filter= get8(s); if (filter) return e("bad filter method","Corrupt PNG"); interlace = get8(s); if (interlace) return e("interlaced","PNG not supported: interlaced mode"); if (!s->img_x || !s->img_y) return e("0-pixel image","Corrupt PNG"); if (!pal_img_n) { s->img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0); if ((1 << 30) / s->img_x / s->img_n < s->img_y) return e("too large", "Image too large to decode"); if (scan == SCAN_header) return 1; } else { // if paletted, then pal_n is our final components, and // img_n is # components to decompress/filter. s->img_n = 1; if ((1 << 30) / s->img_x / 4 < s->img_y) return e("too large","Corrupt PNG"); // if SCAN_header, have to scan to see if we have a tRNS } break; } case PNG_TYPE('P','L','T','E'): { if (c.length > 256*3) return e("invalid PLTE","Corrupt PNG"); pal_len = c.length / 3; if (pal_len * 3 != c.length) return e("invalid PLTE","Corrupt PNG"); for (i=0; i < pal_len; ++i) { palette[i*4+0] = get8u(s); palette[i*4+1] = get8u(s); palette[i*4+2] = get8u(s); palette[i*4+3] = 255; } break; } case PNG_TYPE('t','R','N','S'): { if (z->idata) return e("tRNS after IDAT","Corrupt PNG"); if (pal_img_n) { if (scan == SCAN_header) { s->img_n = 4; return 1; } if (pal_len == 0) return e("tRNS before PLTE","Corrupt PNG"); if (c.length > pal_len) return e("bad tRNS len","Corrupt PNG"); pal_img_n = 4; for (i=0; i < c.length; ++i) palette[i*4+3] = get8u(s); } else { if (!(s->img_n & 1)) return e("tRNS with alpha","Corrupt PNG"); if (c.length != (uint32) s->img_n*2) return e("bad tRNS len","Corrupt PNG"); has_trans = 1; for (k=0; k < s->img_n; ++k) tc[k] = (uint8) get16(s); // non 8-bit images will be larger } break; } case PNG_TYPE('I','D','A','T'): { if (pal_img_n && !pal_len) return e("no PLTE","Corrupt PNG"); if (scan == SCAN_header) { s->img_n = pal_img_n; return 1; } if (ioff + c.length > idata_limit) { uint8 *p; if (idata_limit == 0) idata_limit = c.length > 4096 ? c.length : 4096; while (ioff + c.length > idata_limit) idata_limit *= 2; p = (uint8 *) realloc(z->idata, idata_limit); if (p == NULL) return e("outofmem", "Out of memory"); z->idata = p; } #ifndef STBI_NO_STDIO if (s->img_file) { if (fread(z->idata+ioff,1,c.length,s->img_file) != c.length) return e("outofdata","Corrupt PNG"); } else #endif { memcpy(z->idata+ioff, s->img_buffer, c.length); s->img_buffer += c.length; } ioff += c.length; break; } case PNG_TYPE('I','E','N','D'): { uint32 raw_len; if (scan != SCAN_load) return 1; if (z->idata == NULL) return e("no IDAT","Corrupt PNG"); z->expanded = (uint8 *) stbi_zlib_decode_malloc((char *) z->idata, ioff, (int *) &raw_len); if (z->expanded == NULL) return 0; // zlib should set error free(z->idata); z->idata = NULL; if ((req_comp == s->img_n+1 && req_comp != 3 && !pal_img_n) || has_trans) s->img_out_n = s->img_n+1; else s->img_out_n = s->img_n; if (!create_png_image(z, z->expanded, raw_len, s->img_out_n)) return 0; if (has_trans) if (!compute_transparency(z, tc, s->img_out_n)) return 0; if (pal_img_n) { // pal_img_n == 3 or 4 s->img_n = pal_img_n; // record the actual colors we had s->img_out_n = pal_img_n; if (req_comp >= 3) s->img_out_n = req_comp; if (!expand_palette(z, palette, pal_len, s->img_out_n)) return 0; } free(z->expanded); z->expanded = NULL; return 1; } default: // if critical, fail if ((c.type & (1 << 29)) == 0) { #ifndef STBI_NO_FAILURE_STRINGS // not threadsafe static char invalid_chunk[] = "XXXX chunk not known"; invalid_chunk[0] = (uint8) (c.type >> 24); invalid_chunk[1] = (uint8) (c.type >> 16); invalid_chunk[2] = (uint8) (c.type >> 8); invalid_chunk[3] = (uint8) (c.type >> 0); #endif return e(invalid_chunk, "PNG not supported: unknown chunk type"); } skip(s, c.length); break; } // end of chunk, read and skip CRC get32(s); } } static unsigned char *do_png(png *p, int *x, int *y, int *n, int req_comp) { unsigned char *result=NULL; p->expanded = NULL; p->idata = NULL; p->out = NULL; if (req_comp < 0 || req_comp > 4) return epuc("bad req_comp", "Internal error"); if (parse_png_file(p, SCAN_load, req_comp)) { result = p->out; p->out = NULL; if (req_comp && req_comp != p->s.img_out_n) { result = convert_format(result, p->s.img_out_n, req_comp, p->s.img_x, p->s.img_y); p->s.img_out_n = req_comp; if (result == NULL) return result; } *x = p->s.img_x; *y = p->s.img_y; if (n) *n = p->s.img_n; } free(p->out); p->out = NULL; free(p->expanded); p->expanded = NULL; free(p->idata); p->idata = NULL; return result; } #ifndef STBI_NO_STDIO unsigned char *stbi_png_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) { png p; start_file(&p.s, f); return do_png(&p, x,y,comp,req_comp); } unsigned char *stbi_png_load(char const *filename, int *x, int *y, int *comp, int req_comp) { unsigned char *data; FILE *f = fopen(filename, "rb"); if (!f) return NULL; data = stbi_png_load_from_file(f,x,y,comp,req_comp); fclose(f); return data; } #endif unsigned char *stbi_png_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) { png p; start_mem(&p.s, buffer,len); return do_png(&p, x,y,comp,req_comp); } #ifndef STBI_NO_STDIO int stbi_png_test_file(FILE *f) { png p; int n,r; n = ftell(f); start_file(&p.s, f); r = parse_png_file(&p, SCAN_type,STBI_default); fseek(f,n,SEEK_SET); return r; } #endif int stbi_png_test_memory(stbi_uc const *buffer, int len) { png p; start_mem(&p.s, buffer, len); return parse_png_file(&p, SCAN_type,STBI_default); } // TODO: load header from png #ifndef STBI_NO_STDIO extern int stbi_png_info (char const *filename, int *x, int *y, int *comp); extern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp); #endif extern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp); // Microsoft/Windows BMP image static int bmp_test(stbi *s) { int sz; if (get8(s) != 'B') return 0; if (get8(s) != 'M') return 0; get32le(s); // discard filesize get16le(s); // discard reserved get16le(s); // discard reserved get32le(s); // discard data offset sz = get32le(s); if (sz == 12 || sz == 40 || sz == 56 || sz == 108) return 1; return 0; } #ifndef STBI_NO_STDIO int stbi_bmp_test_file (FILE *f) { stbi s; int r,n = ftell(f); start_file(&s,f); r = bmp_test(&s); fseek(f,n,SEEK_SET); return r; } #endif int stbi_bmp_test_memory (stbi_uc const *buffer, int len) { stbi s; start_mem(&s, buffer, len); return bmp_test(&s); } // returns 0..31 for the highest set bit static int high_bit(unsigned int z) { int n=0; if (z == 0) return -1; if (z >= 0x10000) n += 16, z >>= 16; if (z >= 0x00100) n += 8, z >>= 8; if (z >= 0x00010) n += 4, z >>= 4; if (z >= 0x00004) n += 2, z >>= 2; if (z >= 0x00002) n += 1, z >>= 1; return n; } static int bitcount(unsigned int a) { a = (a & 0x55555555) + ((a >> 1) & 0x55555555); // max 2 a = (a & 0x33333333) + ((a >> 2) & 0x33333333); // max 4 a = (a + (a >> 4)) & 0x0f0f0f0f; // max 8 per 4, now 8 bits a = (a + (a >> 8)); // max 16 per 8 bits a = (a + (a >> 16)); // max 32 per 8 bits return a & 0xff; } static int shiftsigned(int v, int shift, int bits) { int result; int z=0; if (shift < 0) v <<= -shift; else v >>= shift; result = v; z = bits; while (z < 8) { result += v >> z; z += bits; } return result; } static stbi_uc *bmp_load(stbi *s, int *x, int *y, int *comp, int req_comp) { uint8 *out; unsigned int mr=0,mg=0,mb=0,ma=0; stbi_uc pal[256][4]; int psize=0,i,j,compress=0,width; int bpp, flip_vertically, pad, target, offset, hsz; if (get8(s) != 'B' || get8(s) != 'M') return epuc("not BMP", "Corrupt BMP"); get32le(s); // discard filesize get16le(s); // discard reserved get16le(s); // discard reserved offset = get32le(s); hsz = get32le(s); if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108) return epuc("unknown BMP", "BMP type not supported: unknown"); failure_reason = "bad BMP"; if (hsz == 12) { s->img_x = get16le(s); s->img_y = get16le(s); } else { s->img_x = get32le(s); s->img_y = get32le(s); } if (get16le(s) != 1) return 0; bpp = get16le(s); if (bpp == 1) return epuc("monochrome", "BMP type not supported: 1-bit"); flip_vertically = ((int) s->img_y) > 0; s->img_y = abs((int) s->img_y); if (hsz == 12) { if (bpp < 24) psize = (offset - 14 - 24) / 3; } else { compress = get32le(s); if (compress == 1 || compress == 2) return epuc("BMP RLE", "BMP type not supported: RLE"); get32le(s); // discard sizeof get32le(s); // discard hres get32le(s); // discard vres get32le(s); // discard colorsused get32le(s); // discard max important if (hsz == 40 || hsz == 56) { if (hsz == 56) { get32le(s); get32le(s); get32le(s); get32le(s); } if (bpp == 16 || bpp == 32) { mr = mg = mb = 0; if (compress == 0) { if (bpp == 32) { mr = 0xff << 16; mg = 0xff << 8; mb = 0xff << 0; } else { mr = 31 << 10; mg = 31 << 5; mb = 31 << 0; } } else if (compress == 3) { mr = get32le(s); mg = get32le(s); mb = get32le(s); // not documented, but generated by photoshop and handled by mspaint if (mr == mg && mg == mb) { // ?!?!? return NULL; } } else return NULL; } } else { assert(hsz == 108); mr = get32le(s); mg = get32le(s); mb = get32le(s); ma = get32le(s); get32le(s); // discard color space for (i=0; i < 12; ++i) get32le(s); // discard color space parameters } if (bpp < 16) psize = (offset - 14 - hsz) >> 2; } s->img_n = ma ? 4 : 3; if (req_comp && req_comp >= 3) // we can directly decode 3 or 4 target = req_comp; else target = s->img_n; // if they want monochrome, we'll post-convert out = (stbi_uc *) malloc(target * s->img_x * s->img_y); if (!out) return epuc("outofmem", "Out of memory"); if (bpp < 16) { int z=0; if (psize == 0 || psize > 256) { free(out); return epuc("invalid", "Corrupt BMP"); } for (i=0; i < psize; ++i) { pal[i][2] = get8(s); pal[i][1] = get8(s); pal[i][0] = get8(s); if (hsz != 12) get8(s); pal[i][3] = 255; } skip(s, offset - 14 - hsz - psize * (hsz == 12 ? 3 : 4)); if (bpp == 4) width = (s->img_x + 1) >> 1; else if (bpp == 8) width = s->img_x; else { free(out); return epuc("bad bpp", "Corrupt BMP"); } pad = (-width)&3; for (j=0; j < (int) s->img_y; ++j) { for (i=0; i < (int) s->img_x; i += 2) { int v=get8(s),v2=0; if (bpp == 4) { v2 = v & 15; v >>= 4; } out[z++] = pal[v][0]; out[z++] = pal[v][1]; out[z++] = pal[v][2]; if (target == 4) out[z++] = 255; if (i+1 == (int) s->img_x) break; v = (bpp == 8) ? get8(s) : v2; out[z++] = pal[v][0]; out[z++] = pal[v][1]; out[z++] = pal[v][2]; if (target == 4) out[z++] = 255; } skip(s, pad); } } else { int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0; int z = 0; int easy=0; skip(s, offset - 14 - hsz); if (bpp == 24) width = 3 * s->img_x; else if (bpp == 16) width = 2*s->img_x; else /* bpp = 32 and pad = 0 */ width=0; pad = (-width) & 3; if (bpp == 24) { easy = 1; } else if (bpp == 32) { if (mb == 0xff && mg == 0xff00 && mr == 0xff000000 && ma == 0xff000000) easy = 2; } if (!easy) { if (!mr || !mg || !mb) return epuc("bad masks", "Corrupt BMP"); // right shift amt to put high bit in position #7 rshift = high_bit(mr)-7; rcount = bitcount(mr); gshift = high_bit(mg)-7; gcount = bitcount(mr); bshift = high_bit(mb)-7; bcount = bitcount(mr); ashift = high_bit(ma)-7; acount = bitcount(mr); } for (j=0; j < (int) s->img_y; ++j) { if (easy) { for (i=0; i < (int) s->img_x; ++i) { int a; out[z+2] = get8(s); out[z+1] = get8(s); out[z+0] = get8(s); z += 3; a = (easy == 2 ? get8(s) : 255); if (target == 4) out[z++] = a; } } else { for (i=0; i < (int) s->img_x; ++i) { uint32 v = (bpp == 16 ? get16le(s) : get32le(s)); int a; out[z++] = shiftsigned(v & mr, rshift, rcount); out[z++] = shiftsigned(v & mg, gshift, gcount); out[z++] = shiftsigned(v & mb, bshift, bcount); a = (ma ? shiftsigned(v & ma, ashift, acount) : 255); if (target == 4) out[z++] = a; } } skip(s, pad); } } if (flip_vertically) { stbi_uc t; for (j=0; j < (int) s->img_y>>1; ++j) { stbi_uc *p1 = out + j *s->img_x*target; stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target; for (i=0; i < (int) s->img_x*target; ++i) { t = p1[i], p1[i] = p2[i], p2[i] = t; } } } if (req_comp && req_comp != target) { out = convert_format(out, target, req_comp, s->img_x, s->img_y); if (out == NULL) return out; // convert_format frees input on failure } *x = s->img_x; *y = s->img_y; if (comp) *comp = target; return out; } #ifndef STBI_NO_STDIO stbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp) { stbi_uc *data; FILE *f = fopen(filename, "rb"); if (!f) return NULL; data = stbi_bmp_load_from_file(f, x,y,comp,req_comp); fclose(f); return data; } stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp) { stbi s; start_file(&s, f); return bmp_load(&s, x,y,comp,req_comp); } #endif stbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) { stbi s; start_mem(&s, buffer, len); return bmp_load(&s, x,y,comp,req_comp); } // Targa Truevision - TGA // by Jonathan Dummer static int tga_test(stbi *s) { int sz; get8u(s); // discard Offset sz = get8u(s); // color type if( sz > 1 ) return 0; // only RGB or indexed allowed sz = get8u(s); // image type if( (sz != 1) && (sz != 2) && (sz != 3) && (sz != 9) && (sz != 10) && (sz != 11) ) return 0; // only RGB or grey allowed, +/- RLE get16(s); // discard palette start get16(s); // discard palette length get8(s); // discard bits per palette color entry get16(s); // discard x origin get16(s); // discard y origin if( get16(s) < 1 ) return 0; // test width if( get16(s) < 1 ) return 0; // test height sz = get8(s); // bits per pixel if( (sz != 8) && (sz != 16) && (sz != 24) && (sz != 32) ) return 0; // only RGB or RGBA or grey allowed return 1; // seems to have passed everything } #ifndef STBI_NO_STDIO int stbi_tga_test_file (FILE *f) { stbi s; int r,n = ftell(f); start_file(&s, f); r = tga_test(&s); fseek(f,n,SEEK_SET); return r; } #endif int stbi_tga_test_memory (stbi_uc const *buffer, int len) { stbi s; start_mem(&s, buffer, len); return tga_test(&s); } static stbi_uc *tga_load(stbi *s, int *x, int *y, int *comp, int req_comp) { // read in the TGA header stuff int tga_offset = get8u(s); int tga_indexed = get8u(s); int tga_image_type = get8u(s); int tga_is_RLE = 0; int tga_palette_start = get16le(s); int tga_palette_len = get16le(s); int tga_palette_bits = get8u(s); int tga_x_origin = get16le(s); int tga_y_origin = get16le(s); int tga_width = get16le(s); int tga_height = get16le(s); int tga_bits_per_pixel = get8u(s); int tga_inverted = get8u(s); // image data unsigned char *tga_data; unsigned char *tga_palette = NULL; int i, j; unsigned char raw_data[4]; unsigned char trans_data[] = { 0,0,0,0 }; int RLE_count = 0; int RLE_repeating = 0; int read_next_pixel = 1; // do a tiny bit of precessing if( tga_image_type >= 8 ) { tga_image_type -= 8; tga_is_RLE = 1; } /* int tga_alpha_bits = tga_inverted & 15; */ tga_inverted = 1 - ((tga_inverted >> 5) & 1); // error check if( //(tga_indexed) || (tga_width < 1) || (tga_height < 1) || (tga_image_type < 1) || (tga_image_type > 3) || ((tga_bits_per_pixel != 8) && (tga_bits_per_pixel != 16) && (tga_bits_per_pixel != 24) && (tga_bits_per_pixel != 32)) ) { return NULL; } // If I'm paletted, then I'll use the number of bits from the palette if( tga_indexed ) { tga_bits_per_pixel = tga_palette_bits; } // tga info *x = tga_width; *y = tga_height; if( (req_comp < 1) || (req_comp > 4) ) { // just use whatever the file was req_comp = tga_bits_per_pixel / 8; *comp = req_comp; } else { // force a new number of components *comp = tga_bits_per_pixel/8; } tga_data = (unsigned char*)malloc( tga_width * tga_height * req_comp ); // skip to the data's starting position (offset usually = 0) skip(s, tga_offset ); // do I need to load a palette? if( tga_indexed ) { // any data to skip? (offset usually = 0) skip(s, tga_palette_start ); // load the palette tga_palette = (unsigned char*)malloc( tga_palette_len * tga_palette_bits / 8 ); getn(s, tga_palette, tga_palette_len * tga_palette_bits / 8 ); } // load the data for( i = 0; i < tga_width * tga_height; ++i ) { // if I'm in RLE mode, do I need to get a RLE chunk? if( tga_is_RLE ) { if( RLE_count == 0 ) { // yep, get the next byte as a RLE command int RLE_cmd = get8u(s); RLE_count = 1 + (RLE_cmd & 127); RLE_repeating = RLE_cmd >> 7; read_next_pixel = 1; } else if( !RLE_repeating ) { read_next_pixel = 1; } } else { read_next_pixel = 1; } // OK, if I need to read a pixel, do it now if( read_next_pixel ) { // load however much data we did have if( tga_indexed ) { // read in 1 byte, then perform the lookup int pal_idx = get8u(s); if( pal_idx >= tga_palette_len ) { // invalid index pal_idx = 0; } pal_idx *= tga_bits_per_pixel / 8; for( j = 0; j*8 < tga_bits_per_pixel; ++j ) { raw_data[j] = tga_palette[pal_idx+j]; } } else { // read in the data raw for( j = 0; j*8 < tga_bits_per_pixel; ++j ) { raw_data[j] = get8u(s); } } // convert raw to the intermediate format switch( tga_bits_per_pixel ) { case 8: // Luminous => RGBA trans_data[0] = raw_data[0]; trans_data[1] = raw_data[0]; trans_data[2] = raw_data[0]; trans_data[3] = 255; break; case 16: // Luminous,Alpha => RGBA trans_data[0] = raw_data[0]; trans_data[1] = raw_data[0]; trans_data[2] = raw_data[0]; trans_data[3] = raw_data[1]; break; case 24: // BGR => RGBA trans_data[0] = raw_data[2]; trans_data[1] = raw_data[1]; trans_data[2] = raw_data[0]; trans_data[3] = 255; break; case 32: // BGRA => RGBA trans_data[0] = raw_data[2]; trans_data[1] = raw_data[1]; trans_data[2] = raw_data[0]; trans_data[3] = raw_data[3]; break; } // clear the reading flag for the next pixel read_next_pixel = 0; } // end of reading a pixel // convert to final format switch( req_comp ) { case 1: // RGBA => Luminance tga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]); break; case 2: // RGBA => Luminance,Alpha tga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]); tga_data[i*req_comp+1] = trans_data[3]; break; case 3: // RGBA => RGB tga_data[i*req_comp+0] = trans_data[0]; tga_data[i*req_comp+1] = trans_data[1]; tga_data[i*req_comp+2] = trans_data[2]; break; case 4: // RGBA => RGBA tga_data[i*req_comp+0] = trans_data[0]; tga_data[i*req_comp+1] = trans_data[1]; tga_data[i*req_comp+2] = trans_data[2]; tga_data[i*req_comp+3] = trans_data[3]; break; } // in case we're in RLE mode, keep counting down --RLE_count; } // do I need to invert the image? if( tga_inverted ) { for( j = 0; j*2 < tga_height; ++j ) { int index1 = j * tga_width * req_comp; int index2 = (tga_height - 1 - j) * tga_width * req_comp; for( i = tga_width * req_comp; i > 0; --i ) { unsigned char temp = tga_data[index1]; tga_data[index1] = tga_data[index2]; tga_data[index2] = temp; ++index1; ++index2; } } } // clear my palette, if I had one if( tga_palette != NULL ) { free( tga_palette ); } // the things I do to get rid of an error message, and yet keep // Microsoft's C compilers happy... [8^( tga_palette_start = tga_palette_len = tga_palette_bits = tga_x_origin = tga_y_origin = 0; // OK, done return tga_data; } #ifndef STBI_NO_STDIO stbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp) { stbi_uc *data; FILE *f = fopen(filename, "rb"); if (!f) return NULL; data = stbi_tga_load_from_file(f, x,y,comp,req_comp); fclose(f); return data; } stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp) { stbi s; start_file(&s, f); return tga_load(&s, x,y,comp,req_comp); } #endif stbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) { stbi s; start_mem(&s, buffer, len); return tga_load(&s, x,y,comp,req_comp); } // ************************************************************************************************* // Photoshop PSD loader -- PD by Thatcher Ulrich, integration by Nicholas Schulz, tweaked by STB static int psd_test(stbi *s) { if (get32(s) != 0x38425053) return 0; // "8BPS" else return 1; } #ifndef STBI_NO_STDIO int stbi_psd_test_file(FILE *f) { stbi s; int r,n = ftell(f); start_file(&s, f); r = psd_test(&s); fseek(f,n,SEEK_SET); return r; } #endif int stbi_psd_test_memory(stbi_uc const *buffer, int len) { stbi s; start_mem(&s, buffer, len); return psd_test(&s); } static stbi_uc *psd_load(stbi *s, int *x, int *y, int *comp, int req_comp) { int pixelCount; int channelCount, compression; int channel, i, count, len; int w,h; uint8 *out; // Check identifier if (get32(s) != 0x38425053) // "8BPS" return epuc("not PSD", "Corrupt PSD image"); // Check file type version. if (get16(s) != 1) return epuc("wrong version", "Unsupported version of PSD image"); // Skip 6 reserved bytes. skip(s, 6 ); // Read the number of channels (R, G, B, A, etc). channelCount = get16(s); if (channelCount < 0 || channelCount > 16) return epuc("wrong channel count", "Unsupported number of channels in PSD image"); // Read the rows and columns of the image. h = get32(s); w = get32(s); // Make sure the depth is 8 bits. if (get16(s) != 8) return epuc("unsupported bit depth", "PSD bit depth is not 8 bit"); // Make sure the color mode is RGB. // Valid options are: // 0: Bitmap // 1: Grayscale // 2: Indexed color // 3: RGB color // 4: CMYK color // 7: Multichannel // 8: Duotone // 9: Lab color if (get16(s) != 3) return epuc("wrong color format", "PSD is not in RGB color format"); // Skip the Mode Data. (It's the palette for indexed color; other info for other modes.) skip(s,get32(s) ); // Skip the image resources. (resolution, pen tool paths, etc) skip(s, get32(s) ); // Skip the reserved data. skip(s, get32(s) ); // Find out if the data is compressed. // Known values: // 0: no compression // 1: RLE compressed compression = get16(s); if (compression > 1) return epuc("bad compression", "PSD has an unknown compression format"); // Create the destination image. out = (stbi_uc *) malloc(4 * w*h); if (!out) return epuc("outofmem", "Out of memory"); pixelCount = w*h; // Initialize the data to zero. //memset( out, 0, pixelCount * 4 ); // Finally, the image data. if (compression) { // RLE as used by .PSD and .TIFF // Loop until you get the number of unpacked bytes you are expecting: // Read the next source byte into n. // If n is between 0 and 127 inclusive, copy the next n+1 bytes literally. // Else if n is between -127 and -1 inclusive, copy the next byte -n+1 times. // Else if n is 128, noop. // Endloop // The RLE-compressed data is preceeded by a 2-byte data count for each row in the data, // which we're going to just skip. skip(s, h * channelCount * 2 ); // Read the RLE data by channel. for (channel = 0; channel < 4; channel++) { uint8 *p; p = out+channel; if (channel >= channelCount) { // Fill this channel with default data. for (i = 0; i < pixelCount; i++) *p = (channel == 3 ? 255 : 0), p += 4; } else { // Read the RLE data. count = 0; while (count < pixelCount) { len = get8(s); if (len == 128) { // No-op. } else if (len < 128) { // Copy next len+1 bytes literally. len++; count += len; while (len) { *p = get8(s); p += 4; len--; } } else if (len > 128) { uint32 val; // Next -len+1 bytes in the dest are replicated from next source byte. // (Interpret len as a negative 8-bit int.) len ^= 0x0FF; len += 2; val = get8(s); count += len; while (len) { *p = val; p += 4; len--; } } } } } } else { // We're at the raw image data. It's each channel in order (Red, Green, Blue, Alpha, ...) // where each channel consists of an 8-bit value for each pixel in the image. // Read the data by channel. for (channel = 0; channel < 4; channel++) { uint8 *p; p = out + channel; if (channel > channelCount) { // Fill this channel with default data. for (i = 0; i < pixelCount; i++) *p = channel == 3 ? 255 : 0, p += 4; } else { // Read the data. count = 0; for (i = 0; i < pixelCount; i++) *p = get8(s), p += 4; } } } if (req_comp && req_comp != 4) { out = convert_format(out, 4, req_comp, w, h); if (out == NULL) return out; // convert_format frees input on failure } if (comp) *comp = channelCount; *y = h; *x = w; return out; } #ifndef STBI_NO_STDIO stbi_uc *stbi_psd_load(char const *filename, int *x, int *y, int *comp, int req_comp) { stbi_uc *data; FILE *f = fopen(filename, "rb"); if (!f) return NULL; data = stbi_psd_load_from_file(f, x,y,comp,req_comp); fclose(f); return data; } stbi_uc *stbi_psd_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) { stbi s; start_file(&s, f); return psd_load(&s, x,y,comp,req_comp); } #endif stbi_uc *stbi_psd_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) { stbi s; start_mem(&s, buffer, len); return psd_load(&s, x,y,comp,req_comp); } // ************************************************************************************************* // Radiance RGBE HDR loader // originally by Nicolas Schulz #ifndef STBI_NO_HDR static int hdr_test(stbi *s) { char *signature = "#?RADIANCE\n"; int i; for (i=0; signature[i]; ++i) if (get8(s) != signature[i]) return 0; return 1; } int stbi_hdr_test_memory(stbi_uc const *buffer, int len) { stbi s; start_mem(&s, buffer, len); return hdr_test(&s); } #ifndef STBI_NO_STDIO int stbi_hdr_test_file(FILE *f) { stbi s; int r,n = ftell(f); start_file(&s, f); r = hdr_test(&s); fseek(f,n,SEEK_SET); return r; } #endif #define HDR_BUFLEN 1024 static char *hdr_gettoken(stbi *z, char *buffer) { int len=0; //char *s = buffer, char c = '\0'; c = get8(z); while (!at_eof(z) && c != '\n') { buffer[len++] = c; if (len == HDR_BUFLEN-1) { // flush to end of line while (!at_eof(z) && get8(z) != '\n') ; break; } c = get8(z); } buffer[len] = 0; return buffer; } static void hdr_convert(float *output, stbi_uc *input, int req_comp) { if( input[3] != 0 ) { float f1; // Exponent f1 = (float) ldexp(1.0f, input[3] - (int)(128 + 8)); if (req_comp <= 2) output[0] = (input[0] + input[1] + input[2]) * f1 / 3; else { output[0] = input[0] * f1; output[1] = input[1] * f1; output[2] = input[2] * f1; } if (req_comp == 2) output[1] = 1; if (req_comp == 4) output[3] = 1; } else { switch (req_comp) { case 4: output[3] = 1; /* fallthrough */ case 3: output[0] = output[1] = output[2] = 0; break; case 2: output[1] = 1; /* fallthrough */ case 1: output[0] = 0; break; } } } static float *hdr_load(stbi *s, int *x, int *y, int *comp, int req_comp) { char buffer[HDR_BUFLEN]; char *token; int valid = 0; int width, height; stbi_uc *scanline; float *hdr_data; int len; unsigned char count, value; int i, j, k, c1,c2, z; // Check identifier if (strcmp(hdr_gettoken(s,buffer), "#?RADIANCE") != 0) return epf("not HDR", "Corrupt HDR image"); // Parse header while(1) { token = hdr_gettoken(s,buffer); if (token[0] == 0) break; if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1; } if (!valid) return epf("unsupported format", "Unsupported HDR format"); // Parse width and height // can't use sscanf() if we're not using stdio! token = hdr_gettoken(s,buffer); if (strncmp(token, "-Y ", 3)) return epf("unsupported data layout", "Unsupported HDR format"); token += 3; height = strtol(token, &token, 10); while (*token == ' ') ++token; if (strncmp(token, "+X ", 3)) return epf("unsupported data layout", "Unsupported HDR format"); token += 3; width = strtol(token, NULL, 10); *x = width; *y = height; *comp = 3; if (req_comp == 0) req_comp = 3; // Read data hdr_data = (float *) malloc(height * width * req_comp * sizeof(float)); // Load image data // image data is stored as some number of sca if( width < 8 || width >= 32768) { // Read flat data for (j=0; j < height; ++j) { for (i=0; i < width; ++i) { stbi_uc rgbe[4]; main_decode_loop: getn(s, rgbe, 4); hdr_convert(hdr_data + j * width * req_comp + i * req_comp, rgbe, req_comp); } } } else { // Read RLE-encoded data scanline = NULL; for (j = 0; j < height; ++j) { c1 = get8(s); c2 = get8(s); len = get8(s); if (c1 != 2 || c2 != 2 || (len & 0x80)) { // not run-length encoded, so we have to actually use THIS data as a decoded // pixel (note this can't be a valid pixel--one of RGB must be >= 128) stbi_uc rgbe[4] = { c1,c2,len, get8(s) }; hdr_convert(hdr_data, rgbe, req_comp); i = 1; j = 0; free(scanline); goto main_decode_loop; // yes, this is fucking insane; blame the fucking insane format } len <<= 8; len |= get8(s); if (len != width) { free(hdr_data); free(scanline); return epf("invalid decoded scanline length", "corrupt HDR"); } if (scanline == NULL) scanline = (stbi_uc *) malloc(width * 4); for (k = 0; k < 4; ++k) { i = 0; while (i < width) { count = get8(s); if (count > 128) { // Run value = get8(s); count -= 128; for (z = 0; z < count; ++z) scanline[i++ * 4 + k] = value; } else { // Dump for (z = 0; z < count; ++z) scanline[i++ * 4 + k] = get8(s); } } } for (i=0; i < width; ++i) hdr_convert(hdr_data+(j*width + i)*req_comp, scanline + i*4, req_comp); } free(scanline); } return hdr_data; } static stbi_uc *hdr_load_rgbe(stbi *s, int *x, int *y, int *comp, int req_comp) { char buffer[HDR_BUFLEN]; char *token; int valid = 0; int width, height; stbi_uc *scanline; stbi_uc *rgbe_data; int len; unsigned char count, value; int i, j, k, c1,c2, z; // Check identifier if (strcmp(hdr_gettoken(s,buffer), "#?RADIANCE") != 0) return epuc("not HDR", "Corrupt HDR image"); // Parse header while(1) { token = hdr_gettoken(s,buffer); if (token[0] == 0) break; if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1; } if (!valid) return epuc("unsupported format", "Unsupported HDR format"); // Parse width and height // can't use sscanf() if we're not using stdio! token = hdr_gettoken(s,buffer); if (strncmp(token, "-Y ", 3)) return epuc("unsupported data layout", "Unsupported HDR format"); token += 3; height = strtol(token, &token, 10); while (*token == ' ') ++token; if (strncmp(token, "+X ", 3)) return epuc("unsupported data layout", "Unsupported HDR format"); token += 3; width = strtol(token, NULL, 10); *x = width; *y = height; // RGBE _MUST_ come out as 4 components *comp = 4; req_comp = 4; // Read data rgbe_data = (stbi_uc *) malloc(height * width * req_comp * sizeof(stbi_uc)); // point to the beginning scanline = rgbe_data; // Load image data // image data is stored as some number of scan lines if( width < 8 || width >= 32768) { // Read flat data for (j=0; j < height; ++j) { for (i=0; i < width; ++i) { main_decode_loop: //getn(rgbe, 4); getn(s,scanline, 4); scanline += 4; } } } else { // Read RLE-encoded data for (j = 0; j < height; ++j) { c1 = get8(s); c2 = get8(s); len = get8(s); if (c1 != 2 || c2 != 2 || (len & 0x80)) { // not run-length encoded, so we have to actually use THIS data as a decoded // pixel (note this can't be a valid pixel--one of RGB must be >= 128) scanline[0] = c1; scanline[1] = c2; scanline[2] = len; scanline[3] = get8(s); scanline += 4; i = 1; j = 0; goto main_decode_loop; // yes, this is insane; blame the insane format } len <<= 8; len |= get8(s); if (len != width) { free(rgbe_data); return epuc("invalid decoded scanline length", "corrupt HDR"); } for (k = 0; k < 4; ++k) { i = 0; while (i < width) { count = get8(s); if (count > 128) { // Run value = get8(s); count -= 128; for (z = 0; z < count; ++z) scanline[i++ * 4 + k] = value; } else { // Dump for (z = 0; z < count; ++z) scanline[i++ * 4 + k] = get8(s); } } } // move the scanline on scanline += 4 * width; } } return rgbe_data; } #ifndef STBI_NO_STDIO float *stbi_hdr_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) { stbi s; start_file(&s,f); return hdr_load(&s,x,y,comp,req_comp); } stbi_uc *stbi_hdr_load_rgbe_file(FILE *f, int *x, int *y, int *comp, int req_comp) { stbi s; start_file(&s,f); return hdr_load_rgbe(&s,x,y,comp,req_comp); } stbi_uc *stbi_hdr_load_rgbe (char const *filename, int *x, int *y, int *comp, int req_comp) { FILE *f = fopen(filename, "rb"); unsigned char *result; if (!f) return epuc("can't fopen", "Unable to open file"); result = stbi_hdr_load_rgbe_file(f,x,y,comp,req_comp); fclose(f); return result; } #endif float *stbi_hdr_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) { stbi s; start_mem(&s,buffer, len); return hdr_load(&s,x,y,comp,req_comp); } stbi_uc *stbi_hdr_load_rgbe_memory(stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp) { stbi s; start_mem(&s,buffer, len); return hdr_load_rgbe(&s,x,y,comp,req_comp); } #endif // STBI_NO_HDR /////////////////////// write image /////////////////////// #ifndef STBI_NO_WRITE static void write8(FILE *f, int x) { uint8 z = (uint8) x; fwrite(&z,1,1,f); } static void writefv(FILE *f, char *fmt, va_list v) { while (*fmt) { switch (*fmt++) { case ' ': break; case '1': { uint8 x = va_arg(v, int); write8(f,x); break; } case '2': { int16 x = va_arg(v, int); write8(f,x); write8(f,x>>8); break; } case '4': { int32 x = va_arg(v, int); write8(f,x); write8(f,x>>8); write8(f,x>>16); write8(f,x>>24); break; } default: assert(0); va_end(v); return; } } } static void writef(FILE *f, char *fmt, ...) { va_list v; va_start(v, fmt); writefv(f,fmt,v); va_end(v); } static void write_pixels(FILE *f, int rgb_dir, int vdir, int x, int y, int comp, void *data, int write_alpha, int scanline_pad) { uint8 bg[3] = { 255, 0, 255}, px[3]; uint32 zero = 0; int i,j,k, j_end; if (vdir < 0) j_end = -1, j = y-1; else j_end = y, j = 0; for (; j != j_end; j += vdir) { for (i=0; i < x; ++i) { uint8 *d = (uint8 *) data + (j*x+i)*comp; if (write_alpha < 0) fwrite(&d[comp-1], 1, 1, f); switch (comp) { case 1: case 2: writef(f, "111", d[0],d[0],d[0]); break; case 4: if (!write_alpha) { for (k=0; k < 3; ++k) px[k] = bg[k] + ((d[k] - bg[k]) * d[3])/255; writef(f, "111", px[1-rgb_dir],px[1],px[1+rgb_dir]); break; } /* FALLTHROUGH */ case 3: writef(f, "111", d[1-rgb_dir],d[1],d[1+rgb_dir]); break; } if (write_alpha > 0) fwrite(&d[comp-1], 1, 1, f); } fwrite(&zero,scanline_pad,1,f); } } static int outfile(char const *filename, int rgb_dir, int vdir, int x, int y, int comp, void *data, int alpha, int pad, char *fmt, ...) { FILE *f = fopen(filename, "wb"); if (f) { va_list v; va_start(v, fmt); writefv(f, fmt, v); va_end(v); write_pixels(f,rgb_dir,vdir,x,y,comp,data,alpha,pad); fclose(f); } return f != NULL; } int stbi_write_bmp(char const *filename, int x, int y, int comp, void *data) { int pad = (-x*3) & 3; return outfile(filename,-1,-1,x,y,comp,data,0,pad, "11 4 22 4" "4 44 22 444444", 'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header 40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header } int stbi_write_tga(char const *filename, int x, int y, int comp, void *data) { int has_alpha = !(comp & 1); return outfile(filename, -1,-1, x, y, comp, data, has_alpha, 0, "111 221 2222 11", 0,0,2, 0,0,0, 0,0,x,y, 24+8*has_alpha, 8*has_alpha); } // any other image formats that do interleaved rgb data? // PNG: requires adler32,crc32 -- significant amount of code // PSD: no, channels output separately // TIFF: no, stripwise-interleaved... i think #endif // STBI_NO_WRITE // add in my DDS loading support #ifndef STBI_NO_DDS #include "stbi_DDS_aug_c.h" #endif |
Added ext/soil/stb_image_aug.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
/* stbi-1.16 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c when you control the images you're loading QUICK NOTES: Primarily of interest to game developers and other people who can avoid problematic images and only need the trivial interface JPEG baseline (no JPEG progressive, no oddball channel decimations) PNG non-interlaced BMP non-1bpp, non-RLE TGA (not sure what subset, if a subset) PSD (composited view only, no extra channels) HDR (radiance rgbE format) writes BMP,TGA (define STBI_NO_WRITE to remove code) decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code) supports installable dequantizing-IDCT, YCbCr-to-RGB conversion (define STBI_SIMD) TODO: stbi_info_* history: 1.16 major bugfix - convert_format converted one too many pixels 1.15 initialize some fields for thread safety 1.14 fix threadsafe conversion bug; header-file-only version (#define STBI_HEADER_FILE_ONLY before including) 1.13 threadsafe 1.12 const qualifiers in the API 1.11 Support installable IDCT, colorspace conversion routines 1.10 Fixes for 64-bit (don't use "unsigned long") optimized upsampling by Fabian "ryg" Giesen 1.09 Fix format-conversion for PSD code (bad global variables!) 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz 1.07 attempt to fix C++ warning/errors again 1.06 attempt to fix C++ warning/errors again 1.05 fix TGA loading to return correct *comp and use good luminance calc 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR 1.02 support for (subset of) HDR files, float interface for preferred access to them 1.01 fix bug: possible bug in handling right-side up bmps... not sure fix bug: the stbi_bmp_load() and stbi_tga_load() functions didn't work at all 1.00 interface to zlib that skips zlib header 0.99 correct handling of alpha in palette 0.98 TGA loader by lonesock; dynamically add loaders (untested) 0.97 jpeg errors on too large a file; also catch another malloc failure 0.96 fix detection of invalid v value - particleman@mollyrocket forum 0.95 during header scan, seek to markers in case of padding 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same 0.93 handle jpegtran output; verbose errors 0.92 read 4,8,16,24,32-bit BMP files of several formats 0.91 output 24-bit Windows 3.0 BMP files 0.90 fix a few more warnings; bump version number to approach 1.0 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd 0.60 fix compiling as c++ 0.59 fix warnings: merge Dave Moore's -Wall fixes 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less than 16 available 0.56 fix bug: zlib uncompressed mode len vs. nlen 0.55 fix bug: restart_interval not initialized to 0 0.54 allow NULL for 'int *comp' 0.53 fix bug in png 3->4; speedup png decoding 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments 0.51 obey req_comp requests, 1-component jpegs return as 1-component, on 'test' only check type, not whether we support this variant */ #ifndef HEADER_STB_IMAGE_AUGMENTED #define HEADER_STB_IMAGE_AUGMENTED //// begin header file //////////////////////////////////////////////////// // // Limitations: // - no progressive/interlaced support (jpeg, png) // - 8-bit samples only (jpeg, png) // - not threadsafe // - channel subsampling of at most 2 in each dimension (jpeg) // - no delayed line count (jpeg) -- IJG doesn't support either // // Basic usage (see HDR discussion below): // int x,y,n; // unsigned char *data = stbi_load(filename, &x, &y, &n, 0); // // ... process data if not NULL ... // // ... x = width, y = height, n = # 8-bit components per pixel ... // // ... replace '0' with '1'..'4' to force that many components per pixel // stbi_image_free(data) // // Standard parameters: // int *x -- outputs image width in pixels // int *y -- outputs image height in pixels // int *comp -- outputs # of image components in image file // int req_comp -- if non-zero, # of image components requested in result // // The return value from an image loader is an 'unsigned char *' which points // to the pixel data. The pixel data consists of *y scanlines of *x pixels, // with each pixel consisting of N interleaved 8-bit components; the first // pixel pointed to is top-left-most in the image. There is no padding between // image scanlines or between pixels, regardless of format. The number of // components N is 'req_comp' if req_comp is non-zero, or *comp otherwise. // If req_comp is non-zero, *comp has the number of components that _would_ // have been output otherwise. E.g. if you set req_comp to 4, you will always // get RGBA output, but you can check *comp to easily see if it's opaque. // // An output image with N components has the following components interleaved // in this order in each pixel: // // N=#comp components // 1 grey // 2 grey, alpha // 3 red, green, blue // 4 red, green, blue, alpha // // If image loading fails for any reason, the return value will be NULL, // and *x, *y, *comp will be unchanged. The function stbi_failure_reason() // can be queried for an extremely brief, end-user unfriendly explanation // of why the load failed. Define STBI_NO_FAILURE_STRINGS to avoid // compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly // more user-friendly ones. // // Paletted PNG and BMP images are automatically depalettized. // // // =========================================================================== // // HDR image support (disable by defining STBI_NO_HDR) // // stb_image now supports loading HDR images in general, and currently // the Radiance .HDR file format, although the support is provided // generically. You can still load any file through the existing interface; // if you attempt to load an HDR file, it will be automatically remapped to // LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1; // both of these constants can be reconfigured through this interface: // // stbi_hdr_to_ldr_gamma(2.2f); // stbi_hdr_to_ldr_scale(1.0f); // // (note, do not use _inverse_ constants; stbi_image will invert them // appropriately). // // Additionally, there is a new, parallel interface for loading files as // (linear) floats to preserve the full dynamic range: // // float *data = stbi_loadf(filename, &x, &y, &n, 0); // // If you load LDR images through this interface, those images will // be promoted to floating point values, run through the inverse of // constants corresponding to the above: // // stbi_ldr_to_hdr_scale(1.0f); // stbi_ldr_to_hdr_gamma(2.2f); // // Finally, given a filename (or an open file or memory block--see header // file for details) containing image data, you can query for the "most // appropriate" interface to use (that is, whether the image is HDR or // not), using: // // stbi_is_hdr(char *filename); #ifndef STBI_NO_STDIO #include <stdio.h> #endif #define STBI_VERSION 1 enum { STBI_default = 0, // only used for req_comp STBI_grey = 1, STBI_grey_alpha = 2, STBI_rgb = 3, STBI_rgb_alpha = 4, }; typedef unsigned char stbi_uc; #ifdef __cplusplus extern "C" { #endif // WRITING API #if !defined(STBI_NO_WRITE) && !defined(STBI_NO_STDIO) // write a BMP/TGA file given tightly packed 'comp' channels (no padding, nor bmp-stride-padding) // (you must include the appropriate extension in the filename). // returns TRUE on success, FALSE if couldn't open file, error writing file extern int stbi_write_bmp (char const *filename, int x, int y, int comp, void *data); extern int stbi_write_tga (char const *filename, int x, int y, int comp, void *data); #endif // PRIMARY API - works on images of any type // load image by filename, open file, or memory buffer #ifndef STBI_NO_STDIO extern stbi_uc *stbi_load (char const *filename, int *x, int *y, int *comp, int req_comp); extern stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); extern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp); #endif extern stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); // for stbi_load_from_file, file pointer is left pointing immediately after image #ifndef STBI_NO_HDR #ifndef STBI_NO_STDIO extern float *stbi_loadf (char const *filename, int *x, int *y, int *comp, int req_comp); extern float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); #endif extern float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); extern void stbi_hdr_to_ldr_gamma(float gamma); extern void stbi_hdr_to_ldr_scale(float scale); extern void stbi_ldr_to_hdr_gamma(float gamma); extern void stbi_ldr_to_hdr_scale(float scale); #endif // STBI_NO_HDR // get a VERY brief reason for failure // NOT THREADSAFE extern char *stbi_failure_reason (void); // free the loaded image -- this is just free() extern void stbi_image_free (void *retval_from_stbi_load); // get image dimensions & components without fully decoding extern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp); extern int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len); #ifndef STBI_NO_STDIO extern int stbi_info (char const *filename, int *x, int *y, int *comp); extern int stbi_is_hdr (char const *filename); extern int stbi_is_hdr_from_file(FILE *f); #endif // ZLIB client - used by PNG, available for other purposes extern char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen); extern char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen); extern int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen); extern char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen); extern int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen); // TYPE-SPECIFIC ACCESS // is it a jpeg? extern int stbi_jpeg_test_memory (stbi_uc const *buffer, int len); extern stbi_uc *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); extern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp); #ifndef STBI_NO_STDIO extern stbi_uc *stbi_jpeg_load (char const *filename, int *x, int *y, int *comp, int req_comp); extern int stbi_jpeg_test_file (FILE *f); extern stbi_uc *stbi_jpeg_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); extern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp); extern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp); #endif // is it a png? extern int stbi_png_test_memory (stbi_uc const *buffer, int len); extern stbi_uc *stbi_png_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); extern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp); #ifndef STBI_NO_STDIO extern stbi_uc *stbi_png_load (char const *filename, int *x, int *y, int *comp, int req_comp); extern int stbi_png_info (char const *filename, int *x, int *y, int *comp); extern int stbi_png_test_file (FILE *f); extern stbi_uc *stbi_png_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); extern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp); #endif // is it a bmp? extern int stbi_bmp_test_memory (stbi_uc const *buffer, int len); extern stbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp); extern stbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); #ifndef STBI_NO_STDIO extern int stbi_bmp_test_file (FILE *f); extern stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); #endif // is it a tga? extern int stbi_tga_test_memory (stbi_uc const *buffer, int len); extern stbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp); extern stbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); #ifndef STBI_NO_STDIO extern int stbi_tga_test_file (FILE *f); extern stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); #endif // is it a psd? extern int stbi_psd_test_memory (stbi_uc const *buffer, int len); extern stbi_uc *stbi_psd_load (char const *filename, int *x, int *y, int *comp, int req_comp); extern stbi_uc *stbi_psd_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); #ifndef STBI_NO_STDIO extern int stbi_psd_test_file (FILE *f); extern stbi_uc *stbi_psd_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); #endif // is it an hdr? extern int stbi_hdr_test_memory (stbi_uc const *buffer, int len); extern float * stbi_hdr_load (char const *filename, int *x, int *y, int *comp, int req_comp); extern float * stbi_hdr_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); extern stbi_uc *stbi_hdr_load_rgbe (char const *filename, int *x, int *y, int *comp, int req_comp); extern float * stbi_hdr_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); #ifndef STBI_NO_STDIO extern int stbi_hdr_test_file (FILE *f); extern float * stbi_hdr_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); extern stbi_uc *stbi_hdr_load_rgbe_file (FILE *f, int *x, int *y, int *comp, int req_comp); #endif // define new loaders typedef struct { int (*test_memory)(stbi_uc const *buffer, int len); stbi_uc * (*load_from_memory)(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); #ifndef STBI_NO_STDIO int (*test_file)(FILE *f); stbi_uc * (*load_from_file)(FILE *f, int *x, int *y, int *comp, int req_comp); #endif } stbi_loader; // register a loader by filling out the above structure (you must defined ALL functions) // returns 1 if added or already added, 0 if not added (too many loaders) // NOT THREADSAFE extern int stbi_register_loader(stbi_loader *loader); // define faster low-level operations (typically SIMD support) #if STBI_SIMD typedef void (*stbi_idct_8x8)(uint8 *out, int out_stride, short data[64], unsigned short *dequantize); // compute an integer IDCT on "input" // input[x] = data[x] * dequantize[x] // write results to 'out': 64 samples, each run of 8 spaced by 'out_stride' // CLAMP results to 0..255 typedef void (*stbi_YCbCr_to_RGB_run)(uint8 *output, uint8 const *y, uint8 const *cb, uint8 const *cr, int count, int step); // compute a conversion from YCbCr to RGB // 'count' pixels // write pixels to 'output'; each pixel is 'step' bytes (either 3 or 4; if 4, write '255' as 4th), order R,G,B // y: Y input channel // cb: Cb input channel; scale/biased to be 0..255 // cr: Cr input channel; scale/biased to be 0..255 extern void stbi_install_idct(stbi_idct_8x8 func); extern void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func); #endif // STBI_SIMD #ifdef __cplusplus } #endif // // //// end header file ///////////////////////////////////////////////////// #endif // STBI_INCLUDE_STB_IMAGE_H |
Added ext/soil/stbi_DDS_aug.h.
> > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
/* adding DDS loading support to stbi */ #ifndef HEADER_STB_IMAGE_DDS_AUGMENTATION #define HEADER_STB_IMAGE_DDS_AUGMENTATION // is it a DDS file? extern int stbi_dds_test_memory (stbi_uc const *buffer, int len); extern stbi_uc *stbi_dds_load (char *filename, int *x, int *y, int *comp, int req_comp); extern stbi_uc *stbi_dds_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); #ifndef STBI_NO_STDIO extern int stbi_dds_test_file (FILE *f); extern stbi_uc *stbi_dds_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); #endif // // //// end header file ///////////////////////////////////////////////////// #endif // HEADER_STB_IMAGE_DDS_AUGMENTATION |
Added ext/soil/stbi_DDS_aug_c.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 |
/// DDS file support, does decoding, _not_ direct uploading /// (use SOIL for that ;-) /// A bunch of DirectDraw Surface structures and flags typedef struct { unsigned int dwMagic; unsigned int dwSize; unsigned int dwFlags; unsigned int dwHeight; unsigned int dwWidth; unsigned int dwPitchOrLinearSize; unsigned int dwDepth; unsigned int dwMipMapCount; unsigned int dwReserved1[ 11 ]; // DDPIXELFORMAT struct { unsigned int dwSize; unsigned int dwFlags; unsigned int dwFourCC; unsigned int dwRGBBitCount; unsigned int dwRBitMask; unsigned int dwGBitMask; unsigned int dwBBitMask; unsigned int dwAlphaBitMask; } sPixelFormat; // DDCAPS2 struct { unsigned int dwCaps1; unsigned int dwCaps2; unsigned int dwDDSX; unsigned int dwReserved; } sCaps; unsigned int dwReserved2; } DDS_header ; // the following constants were copied directly off the MSDN website // The dwFlags member of the original DDSURFACEDESC2 structure // can be set to one or more of the following values. #define DDSD_CAPS 0x00000001 #define DDSD_HEIGHT 0x00000002 #define DDSD_WIDTH 0x00000004 #define DDSD_PITCH 0x00000008 #define DDSD_PIXELFORMAT 0x00001000 #define DDSD_MIPMAPCOUNT 0x00020000 #define DDSD_LINEARSIZE 0x00080000 #define DDSD_DEPTH 0x00800000 // DirectDraw Pixel Format #define DDPF_ALPHAPIXELS 0x00000001 #define DDPF_FOURCC 0x00000004 #define DDPF_RGB 0x00000040 // The dwCaps1 member of the DDSCAPS2 structure can be // set to one or more of the following values. #define DDSCAPS_COMPLEX 0x00000008 #define DDSCAPS_TEXTURE 0x00001000 #define DDSCAPS_MIPMAP 0x00400000 // The dwCaps2 member of the DDSCAPS2 structure can be // set to one or more of the following values. #define DDSCAPS2_CUBEMAP 0x00000200 #define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400 #define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800 #define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000 #define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000 #define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000 #define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000 #define DDSCAPS2_VOLUME 0x00200000 static int dds_test(stbi *s) { // check the magic number if (get8(s) != 'D') return 0; if (get8(s) != 'D') return 0; if (get8(s) != 'S') return 0; if (get8(s) != ' ') return 0; // check header size if (get32le(s) != 124) return 0; return 1; } #ifndef STBI_NO_STDIO int stbi_dds_test_file (FILE *f) { stbi s; int r,n = ftell(f); start_file(&s,f); r = dds_test(&s); fseek(f,n,SEEK_SET); return r; } #endif int stbi_dds_test_memory (stbi_uc const *buffer, int len) { stbi s; start_mem(&s,buffer, len); return dds_test(&s); } // helper functions int stbi_convert_bit_range( int c, int from_bits, int to_bits ) { int b = (1 << (from_bits - 1)) + c * ((1 << to_bits) - 1); return (b + (b >> from_bits)) >> from_bits; } void stbi_rgb_888_from_565( unsigned int c, int *r, int *g, int *b ) { *r = stbi_convert_bit_range( (c >> 11) & 31, 5, 8 ); *g = stbi_convert_bit_range( (c >> 05) & 63, 6, 8 ); *b = stbi_convert_bit_range( (c >> 00) & 31, 5, 8 ); } void stbi_decode_DXT1_block( unsigned char uncompressed[16*4], unsigned char compressed[8] ) { int next_bit = 4*8; int i, r, g, b; int c0, c1; unsigned char decode_colors[4*4]; // find the 2 primary colors c0 = compressed[0] + (compressed[1] << 8); c1 = compressed[2] + (compressed[3] << 8); stbi_rgb_888_from_565( c0, &r, &g, &b ); decode_colors[0] = r; decode_colors[1] = g; decode_colors[2] = b; decode_colors[3] = 255; stbi_rgb_888_from_565( c1, &r, &g, &b ); decode_colors[4] = r; decode_colors[5] = g; decode_colors[6] = b; decode_colors[7] = 255; if( c0 > c1 ) { // no alpha, 2 interpolated colors decode_colors[8] = (2*decode_colors[0] + decode_colors[4]) / 3; decode_colors[9] = (2*decode_colors[1] + decode_colors[5]) / 3; decode_colors[10] = (2*decode_colors[2] + decode_colors[6]) / 3; decode_colors[11] = 255; decode_colors[12] = (decode_colors[0] + 2*decode_colors[4]) / 3; decode_colors[13] = (decode_colors[1] + 2*decode_colors[5]) / 3; decode_colors[14] = (decode_colors[2] + 2*decode_colors[6]) / 3; decode_colors[15] = 255; } else { // 1 interpolated color, alpha decode_colors[8] = (decode_colors[0] + decode_colors[4]) / 2; decode_colors[9] = (decode_colors[1] + decode_colors[5]) / 2; decode_colors[10] = (decode_colors[2] + decode_colors[6]) / 2; decode_colors[11] = 255; decode_colors[12] = 0; decode_colors[13] = 0; decode_colors[14] = 0; decode_colors[15] = 0; } // decode the block for( i = 0; i < 16*4; i += 4 ) { int idx = ((compressed[next_bit>>3] >> (next_bit & 7)) & 3) * 4; next_bit += 2; uncompressed[i+0] = decode_colors[idx+0]; uncompressed[i+1] = decode_colors[idx+1]; uncompressed[i+2] = decode_colors[idx+2]; uncompressed[i+3] = decode_colors[idx+3]; } // done } void stbi_decode_DXT23_alpha_block( unsigned char uncompressed[16*4], unsigned char compressed[8] ) { int i, next_bit = 0; // each alpha value gets 4 bits for( i = 3; i < 16*4; i += 4 ) { uncompressed[i] = stbi_convert_bit_range( (compressed[next_bit>>3] >> (next_bit&7)) & 15, 4, 8 ); next_bit += 4; } } void stbi_decode_DXT45_alpha_block( unsigned char uncompressed[16*4], unsigned char compressed[8] ) { int i, next_bit = 8*2; unsigned char decode_alpha[8]; // each alpha value gets 3 bits, and the 1st 2 bytes are the range decode_alpha[0] = compressed[0]; decode_alpha[1] = compressed[1]; if( decode_alpha[0] > decode_alpha[1] ) { // 6 step intermediate decode_alpha[2] = (6*decode_alpha[0] + 1*decode_alpha[1]) / 7; decode_alpha[3] = (5*decode_alpha[0] + 2*decode_alpha[1]) / 7; decode_alpha[4] = (4*decode_alpha[0] + 3*decode_alpha[1]) / 7; decode_alpha[5] = (3*decode_alpha[0] + 4*decode_alpha[1]) / 7; decode_alpha[6] = (2*decode_alpha[0] + 5*decode_alpha[1]) / 7; decode_alpha[7] = (1*decode_alpha[0] + 6*decode_alpha[1]) / 7; } else { // 4 step intermediate, pluss full and none decode_alpha[2] = (4*decode_alpha[0] + 1*decode_alpha[1]) / 5; decode_alpha[3] = (3*decode_alpha[0] + 2*decode_alpha[1]) / 5; decode_alpha[4] = (2*decode_alpha[0] + 3*decode_alpha[1]) / 5; decode_alpha[5] = (1*decode_alpha[0] + 4*decode_alpha[1]) / 5; decode_alpha[6] = 0; decode_alpha[7] = 255; } for( i = 3; i < 16*4; i += 4 ) { int idx = 0, bit; bit = (compressed[next_bit>>3] >> (next_bit&7)) & 1; idx += bit << 0; ++next_bit; bit = (compressed[next_bit>>3] >> (next_bit&7)) & 1; idx += bit << 1; ++next_bit; bit = (compressed[next_bit>>3] >> (next_bit&7)) & 1; idx += bit << 2; ++next_bit; uncompressed[i] = decode_alpha[idx & 7]; } // done } void stbi_decode_DXT_color_block( unsigned char uncompressed[16*4], unsigned char compressed[8] ) { int next_bit = 4*8; int i, r, g, b; int c0, c1; unsigned char decode_colors[4*3]; // find the 2 primary colors c0 = compressed[0] + (compressed[1] << 8); c1 = compressed[2] + (compressed[3] << 8); stbi_rgb_888_from_565( c0, &r, &g, &b ); decode_colors[0] = r; decode_colors[1] = g; decode_colors[2] = b; stbi_rgb_888_from_565( c1, &r, &g, &b ); decode_colors[3] = r; decode_colors[4] = g; decode_colors[5] = b; // Like DXT1, but no choicees: // no alpha, 2 interpolated colors decode_colors[6] = (2*decode_colors[0] + decode_colors[3]) / 3; decode_colors[7] = (2*decode_colors[1] + decode_colors[4]) / 3; decode_colors[8] = (2*decode_colors[2] + decode_colors[5]) / 3; decode_colors[9] = (decode_colors[0] + 2*decode_colors[3]) / 3; decode_colors[10] = (decode_colors[1] + 2*decode_colors[4]) / 3; decode_colors[11] = (decode_colors[2] + 2*decode_colors[5]) / 3; // decode the block for( i = 0; i < 16*4; i += 4 ) { int idx = ((compressed[next_bit>>3] >> (next_bit & 7)) & 3) * 3; next_bit += 2; uncompressed[i+0] = decode_colors[idx+0]; uncompressed[i+1] = decode_colors[idx+1]; uncompressed[i+2] = decode_colors[idx+2]; } // done } static stbi_uc *dds_load(stbi *s, int *x, int *y, int *comp, int req_comp) { // all variables go up front stbi_uc *dds_data = NULL; stbi_uc block[16*4]; stbi_uc compressed[8]; int flags, DXT_family; int has_alpha, has_mipmap; int is_compressed, cubemap_faces; int block_pitch, num_blocks; DDS_header header; int i, sz, cf; // load the header if( sizeof( DDS_header ) != 128 ) { return NULL; } getn( s, (stbi_uc*)(&header), 128 ); // and do some checking if( header.dwMagic != (('D' << 0) | ('D' << 8) | ('S' << 16) | (' ' << 24)) ) return NULL; if( header.dwSize != 124 ) return NULL; flags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT; if( (header.dwFlags & flags) != flags ) return NULL; /* According to the MSDN spec, the dwFlags should contain DDSD_LINEARSIZE if it's compressed, or DDSD_PITCH if uncompressed. Some DDS writers do not conform to the spec, so I need to make my reader more tolerant */ if( header.sPixelFormat.dwSize != 32 ) return NULL; flags = DDPF_FOURCC | DDPF_RGB; if( (header.sPixelFormat.dwFlags & flags) == 0 ) return NULL; if( (header.sCaps.dwCaps1 & DDSCAPS_TEXTURE) == 0 ) return NULL; // get the image data s->img_x = header.dwWidth; s->img_y = header.dwHeight; s->img_n = 4; is_compressed = (header.sPixelFormat.dwFlags & DDPF_FOURCC) / DDPF_FOURCC; has_alpha = (header.sPixelFormat.dwFlags & DDPF_ALPHAPIXELS) / DDPF_ALPHAPIXELS; has_mipmap = (header.sCaps.dwCaps1 & DDSCAPS_MIPMAP) && (header.dwMipMapCount > 1); cubemap_faces = (header.sCaps.dwCaps2 & DDSCAPS2_CUBEMAP) / DDSCAPS2_CUBEMAP; /* I need cubemaps to have square faces */ cubemap_faces &= (s->img_x == s->img_y); cubemap_faces *= 5; cubemap_faces += 1; block_pitch = (s->img_x+3) >> 2; num_blocks = block_pitch * ((s->img_y+3) >> 2); /* let the user know what's going on */ *x = s->img_x; *y = s->img_y; *comp = s->img_n; /* is this uncompressed? */ if( is_compressed ) { /* compressed */ // note: header.sPixelFormat.dwFourCC is something like (('D'<<0)|('X'<<8)|('T'<<16)|('1'<<24)) DXT_family = 1 + (header.sPixelFormat.dwFourCC >> 24) - '1'; if( (DXT_family < 1) || (DXT_family > 5) ) return NULL; /* check the expected size...oops, nevermind... those non-compliant writers leave dwPitchOrLinearSize == 0 */ // passed all the tests, get the RAM for decoding sz = (s->img_x)*(s->img_y)*4*cubemap_faces; dds_data = (unsigned char*)malloc( sz ); /* do this once for each face */ for( cf = 0; cf < cubemap_faces; ++ cf ) { // now read and decode all the blocks for( i = 0; i < num_blocks; ++i ) { // where are we? int bx, by, bw=4, bh=4; int ref_x = 4 * (i % block_pitch); int ref_y = 4 * (i / block_pitch); // get the next block's worth of compressed data, and decompress it if( DXT_family == 1 ) { // DXT1 getn( s, compressed, 8 ); stbi_decode_DXT1_block( block, compressed ); } else if( DXT_family < 4 ) { // DXT2/3 getn( s, compressed, 8 ); stbi_decode_DXT23_alpha_block ( block, compressed ); getn( s, compressed, 8 ); stbi_decode_DXT_color_block ( block, compressed ); } else { // DXT4/5 getn( s, compressed, 8 ); stbi_decode_DXT45_alpha_block ( block, compressed ); getn( s, compressed, 8 ); stbi_decode_DXT_color_block ( block, compressed ); } // is this a partial block? if( ref_x + 4 > s->img_x ) { bw = s->img_x - ref_x; } if( ref_y + 4 > s->img_y ) { bh = s->img_y - ref_y; } // now drop our decompressed data into the buffer for( by = 0; by < bh; ++by ) { int idx = 4*((ref_y+by+cf*s->img_x)*s->img_x + ref_x); for( bx = 0; bx < bw*4; ++bx ) { dds_data[idx+bx] = block[by*16+bx]; } } } /* done reading and decoding the main image... skip MIPmaps if present */ if( has_mipmap ) { int block_size = 16; if( DXT_family == 1 ) { block_size = 8; } for( i = 1; i < header.dwMipMapCount; ++i ) { int mx = s->img_x >> (i + 2); int my = s->img_y >> (i + 2); if( mx < 1 ) { mx = 1; } if( my < 1 ) { my = 1; } skip( s, mx*my*block_size ); } } }/* per cubemap face */ } else { /* uncompressed */ DXT_family = 0; s->img_n = 3; if( has_alpha ) { s->img_n = 4; } *comp = s->img_n; sz = s->img_x*s->img_y*s->img_n*cubemap_faces; dds_data = (unsigned char*)malloc( sz ); /* do this once for each face */ for( cf = 0; cf < cubemap_faces; ++ cf ) { /* read the main image for this face */ getn( s, &dds_data[cf*s->img_x*s->img_y*s->img_n], s->img_x*s->img_y*s->img_n ); /* done reading and decoding the main image... skip MIPmaps if present */ if( has_mipmap ) { for( i = 1; i < header.dwMipMapCount; ++i ) { int mx = s->img_x >> i; int my = s->img_y >> i; if( mx < 1 ) { mx = 1; } if( my < 1 ) { my = 1; } skip( s, mx*my*s->img_n ); } } } /* data was BGR, I need it RGB */ for( i = 0; i < sz; i += s->img_n ) { unsigned char temp = dds_data[i]; dds_data[i] = dds_data[i+2]; dds_data[i+2] = temp; } } /* finished decompressing into RGBA, adjust the y size if we have a cubemap note: sz is already up to date */ s->img_y *= cubemap_faces; *y = s->img_y; // did the user want something else, or // see if all the alpha values are 255 (i.e. no transparency) has_alpha = 0; if( s->img_n == 4) { for( i = 3; (i < sz) && (has_alpha == 0); i += 4 ) { has_alpha |= (dds_data[i] < 255); } } if( (req_comp <= 4) && (req_comp >= 1) ) { // user has some requirements, meet them if( req_comp != s->img_n ) { dds_data = convert_format( dds_data, s->img_n, req_comp, s->img_x, s->img_y ); *comp = s->img_n; } } else { // user had no requirements, only drop to RGB is no alpha if( (has_alpha == 0) && (s->img_n == 4) ) { dds_data = convert_format( dds_data, 4, 3, s->img_x, s->img_y ); *comp = 3; } } // OK, done return dds_data; } #ifndef STBI_NO_STDIO stbi_uc *stbi_dds_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp) { stbi s; start_file(&s,f); return dds_load(&s,x,y,comp,req_comp); } stbi_uc *stbi_dds_load (char *filename, int *x, int *y, int *comp, int req_comp) { stbi_uc *data; FILE *f = fopen(filename, "rb"); if (!f) return NULL; data = stbi_dds_load_from_file(f,x,y,comp,req_comp); fclose(f); return data; } #endif stbi_uc *stbi_dds_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) { stbi s; start_mem(&s,buffer, len); return dds_load(&s,x,y,comp,req_comp); } |
Added makefile.
> > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
all: tools link build: mkdir -p build visnov.cc.o: csrc/visnov.cc ext/soil/SOIL.h ext/fontstash/fontstash.h build cc -c -std=c++14 -Iext/soil/ -Iext/fontstash/ -fno-rtti -fno-exceptions -g csrc/visnov.cc -o build/visnov.cc.o link: visnov.cc.o soil fontstash build ar -rcs build/libvisnov.a build/*.o ocamlopt.opt -c build/libvisnov.a mlsrc/*.ml -cclib "-lglfw -lGL" mv mlsrc/*.cmx mlsrc/*.cmi build/ cp mlsrc/*.ml build/ soil: build cd build && cc -c ../ext/soil/*.c fontstash: build cd build && cc -c ../ext/fontstash/*.c tools: build cc -std=c++14 tool/visnarc.cc -o build/visnarc clean: build rm -r build |
Added mlsrc/visnov.ml.
> > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
type handle type image type font external init : string -> string -> int -> int -> handle = "visnov_init" [@@noalloc] external exit : unit -> unit = "visnov_exit" [@@noalloc] external block : handle -> unit = "visnov_block" [@@noalloc] external say : handle -> int -> string -> unit = "visnov_say" [@@noalloc] external img : handle -> string -> image = "visnov_img" [@@noalloc] external fnt : handle -> string -> font = "visnov_fnt" [@@noalloc] external setfont : handle -> int -> font -> unit = "visnov_setfont" [@@noalloc] external chr : handle -> int -> image -> unit = "visnov_chr" [@@noalloc] external bg : handle -> image -> unit = "visnov_bg" [@@noalloc] external layout : handle -> int -> unit = "visnov_layout" [@@noalloc] external color : handle -> int -> int -> int -> unit = "visnov_color" [@@noalloc] |
Added tool/visnarc.cc.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
#include <stdio.h> #include <stdint.h> #include <string.h> struct ent { size_t start; size_t len; FILE* fs; }; void plend(uint32_t v) { putchar(v & 0xff); putchar((v >> 8) & 0xff); putchar((v >> 16) & 0xff); putchar((v >> 24) & 0xff); } void pstr(uint8_t len, const char* s) { putchar(len); for (size_t i = 0; i<len; ++i) { putchar(s[i]); } } int main(int argc, char** argv) { if (argc == 1) { printf ("\x1b[1musage:\x1b[0m %s files... >> visnov", argv[0]); } else { ent ftbl[argc-1]; size_t cursize = 0; size_t biggest = 0; for (uint16_t i = 0; i<argc-1; ++i) { ftbl[i].fs=fopen(argv[1+i], "rb"); fseek(ftbl[i].fs, 0, SEEK_END); ftbl[i].start=cursize; ftbl[i].len=ftell(ftbl[i].fs); if (ftbl[i].len>biggest) biggest=ftbl[i].len; cursize+=ftbl[i].len; fseek(ftbl[i].fs, 0, SEEK_SET); } size_t sz = 2; putchar((argc-1) & 0xff); putchar(((argc-1)>>8) & 0xff); for (uint16_t i = 0; i<argc-1; ++i) { uint8_t sl = strlen(argv[i+1]); pstr(sl,argv[1+i]); sz+=sl+1; plend(ftbl[i].start); sz+=4; plend(ftbl[i].len); sz+=4; } for (uint16_t i = 0; i<argc-1; ++i) { char buf[biggest]; fread(buf,ftbl[i].len,1,ftbl[i].fs); for (size_t j = 0; j<ftbl[i].len; ++j) { putchar(buf[j]); // printf is not binary-safe } sz += ftbl[i].len; } plend(sz); putchar(0x9e); putchar(0xcf); putchar(0x44); fprintf(stderr,"\x1b[32;1mdone:\x1b[0m attached %d files, total size ",argc-1); if (sz < 1024) { fprintf(stderr, "%lu\n", sz); } else if (sz < 1024*1024) { fprintf(stderr, "%lu.%luK\n",sz / 1024, (sz % 1024) / 10000); } else { fprintf(stderr, "%lu.%luM\n",sz / (1024*1024), (sz % (1024*1024) / 10000)); } } } |