visnov  Check-in [cc61552b23]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:initial commit
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cc61552b2353a591bba407c3fc0ac84ee893afb4fa17e694db219594370589c2
User & Date: lexi 2019-05-20 11:40:30
Context
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
Changes

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

![Screenshot](https://github.com/akrinke/Font-Stash/wiki/screenshot.png)

## 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