├── LICENSE.md
├── README.md
├── bin
├── _bz2.pyd
├── _ctypes.pyd
├── _decimal.pyd
├── _elementtree.pyd
├── _hashlib.pyd
├── _lzma.pyd
├── _socket.pyd
├── _ssl.pyd
├── fonttools_LICENSE.txt
├── freetype6.dll
├── getKerningPairsFromOTF.exe
├── getKerningPairsFromOTF.py
├── msdfgen.exe
├── msdfgen_LICENSE.txt
├── pyexpat.pyd
├── python34.dll
├── select.pyd
├── unicodedata.pyd
├── wiggle.exe
└── zlib1.dll
├── demo
├── game.c
├── main.c
├── make.bat
├── render.c
├── shaders.h
└── textSample.h
├── example_files
├── SourceSerifPro-Bold.otf
├── SourceSerifPro-Light.otf
├── SourceSerifPro-Regular.otf
├── SourceSerif_LICENSE.txt
├── background.png
└── sprites.png
├── example_usage.bat
├── make.bat
├── src
├── freetype27.lib
├── include
│ ├── FTL.txt
│ ├── freetype
│ │ ├── config
│ │ │ ├── ftconfig.h
│ │ │ ├── ftheader.h
│ │ │ ├── ftmodule.h
│ │ │ ├── ftoption.h
│ │ │ └── ftstdlib.h
│ │ ├── freetype.h
│ │ ├── ftadvanc.h
│ │ ├── ftautoh.h
│ │ ├── ftbbox.h
│ │ ├── ftbdf.h
│ │ ├── ftbitmap.h
│ │ ├── ftbzip2.h
│ │ ├── ftcache.h
│ │ ├── ftcffdrv.h
│ │ ├── ftchapters.h
│ │ ├── ftcid.h
│ │ ├── fterrdef.h
│ │ ├── fterrors.h
│ │ ├── ftfntfmt.h
│ │ ├── ftgasp.h
│ │ ├── ftglyph.h
│ │ ├── ftgxval.h
│ │ ├── ftgzip.h
│ │ ├── ftimage.h
│ │ ├── ftincrem.h
│ │ ├── ftlcdfil.h
│ │ ├── ftlist.h
│ │ ├── ftlzw.h
│ │ ├── ftmac.h
│ │ ├── ftmm.h
│ │ ├── ftmodapi.h
│ │ ├── ftmoderr.h
│ │ ├── ftotval.h
│ │ ├── ftoutln.h
│ │ ├── ftpfr.h
│ │ ├── ftrender.h
│ │ ├── ftsizes.h
│ │ ├── ftsnames.h
│ │ ├── ftstroke.h
│ │ ├── ftsynth.h
│ │ ├── ftsystem.h
│ │ ├── fttrigon.h
│ │ ├── ftttdrv.h
│ │ ├── fttypes.h
│ │ ├── ftwinfnt.h
│ │ ├── internal
│ │ │ ├── autohint.h
│ │ │ ├── ftcalc.h
│ │ │ ├── ftdebug.h
│ │ │ ├── ftdriver.h
│ │ │ ├── ftgloadr.h
│ │ │ ├── fthash.h
│ │ │ ├── ftmemory.h
│ │ │ ├── ftobjs.h
│ │ │ ├── ftpic.h
│ │ │ ├── ftrfork.h
│ │ │ ├── ftserv.h
│ │ │ ├── ftstream.h
│ │ │ ├── fttrace.h
│ │ │ ├── ftvalid.h
│ │ │ ├── internal.h
│ │ │ ├── psaux.h
│ │ │ ├── pshints.h
│ │ │ ├── services
│ │ │ │ ├── svbdf.h
│ │ │ │ ├── svcid.h
│ │ │ │ ├── svfntfmt.h
│ │ │ │ ├── svgldict.h
│ │ │ │ ├── svgxval.h
│ │ │ │ ├── svkern.h
│ │ │ │ ├── svmm.h
│ │ │ │ ├── svotval.h
│ │ │ │ ├── svpfr.h
│ │ │ │ ├── svpostnm.h
│ │ │ │ ├── svprop.h
│ │ │ │ ├── svpscmap.h
│ │ │ │ ├── svpsinfo.h
│ │ │ │ ├── svsfnt.h
│ │ │ │ ├── svttcmap.h
│ │ │ │ ├── svtteng.h
│ │ │ │ ├── svttglyf.h
│ │ │ │ └── svwinfnt.h
│ │ │ ├── sfnt.h
│ │ │ ├── t1types.h
│ │ │ └── tttypes.h
│ │ ├── t1tables.h
│ │ ├── ttnameid.h
│ │ ├── tttables.h
│ │ ├── tttags.h
│ │ └── ttunpat.h
│ └── ft2build.h
├── main.cc
├── stb_image.h
├── stb_image_write.h
├── stb_rect_pack.h
├── stuff.cc
├── whereami.c
├── whereami.h
├── wiggle_atlas.cc
└── wiggle_fontgen.cc
└── wiggle_types.h
/LICENSE.md:
--------------------------------------------------------------------------------
1 | This is free and unencumbered software released into the public domain.
2 |
3 | Anyone is free to copy, modify, publish, use, compile, sell, or
4 | distribute this software, either in source code form or as a compiled
5 | binary, for any purpose, commercial or non-commercial, and by any
6 | means.
7 |
8 | In jurisdictions that recognize copyright laws, the author or authors
9 | of this software dedicate any and all copyright interest in the
10 | software to the public domain. We make this dedication for the benefit
11 | of the public at large and to the detriment of our heirs and
12 | successors. We intend this dedication to be an overt act of
13 | relinquishment in perpetuity of all present and future rights to this
14 | software under copyright law.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 | OTHER DEALINGS IN THE SOFTWARE.
23 |
24 | For more information, please refer to
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Wiggle
2 | ### A one-stop solution for SDF font atlas generation
3 | #### (it's a bit of a mess, but it works!)
4 |
5 | ## Build instructions
6 |
7 | Wiggle comes with all its dependencies. Wiggle is currently 64-bit Windows only.
8 |
9 | 1. Have Visual Studio installed
10 | 2. Run make.bat in a developer prompt
11 | 3. Wiggle.exe should work if it's in bin/
12 | 4. Run `example_usage.bat`
13 | 5. Run the make.bat in the demo folder to build the demo.
14 |
15 | ## Description
16 |
17 | Wiggle is the result of a week of quick-and-dirty coding in an attempt to build some tooling to aid with making nicer looking text in small games. If you think that is a heavily qualified sentence, you're correct. This utility is largely cobbled together from parts, behaves more like a function than a program, and probably crashes if you feed it invalid input. However, it does work; it wraps msdfgen, freetype, and Adobe's kerndump script to generate image atlases of fonts using stb_image with a only a few invocations.
18 |
19 | eg:
20 | ```bat
21 | set wiggle=bin\wiggle
22 | %wiggle% fontgen font1.otf font1.wfi font1.png 128 96 4 8 4 8 1
23 | %wiggle% fontgen font2.otf font2.wfi font2.png 128 96 4 8 4 8 1
24 | %wiggle% atlas fonts.png 1024 font1.png font1.wfi font2.png font2.wfi
25 | %wiggle% rgba fonts.png fonts.rgba
26 | ```
27 |
28 | In detail, the `fontgen` command is the star of the show: it calls out to the other programs to render glyphs, generate metrics, and gather kerning, then it atlases the results and writes it out.
29 |
30 | Once each font has been rendered to its own atlas, `atlas` gathers all the existing font atlases and writes them to a bigger atlas, along with any other images you add. This makes it easier to ship a project using only a single texture.
31 |
32 | Finally, the `rgba` command converts an encoded image (anything supported by stb_image should work) to raw 32-bit rgba data, for ease of loading in minimal applications.
33 |
34 | ## Demo
35 |
36 | Text Invaders--the name's influence should be clear--shows off the quality of the rendered text in a little game, built with no external libraries. It uses the results from `example_usage.bat`, so run that first.
37 |
38 | ## License
39 |
40 | All my code and graphics are "unlicensed" into the public domain, to be used how you see fit. msdfgen, fonttools, and kerndump are all under the MIT license, and FreeType is under the FreeType licence, which can be found in src/include/FTL.txt. Internally, I use stb_image, stb_image_write, stb_rect_pack, and whereami, which are all in the public domain. The Source Serif fonts supplied are under the Open Font License.
41 |
42 | ## Notes
43 |
44 | This thing is a mess; it uses a lot of other programs through `system(...)` calls, and won't work if it's separated from them. It'll overwrite the file `kerning.txt` and things in the folder `wiggleTemp/`.
--------------------------------------------------------------------------------
/bin/_bz2.pyd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/_bz2.pyd
--------------------------------------------------------------------------------
/bin/_ctypes.pyd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/_ctypes.pyd
--------------------------------------------------------------------------------
/bin/_decimal.pyd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/_decimal.pyd
--------------------------------------------------------------------------------
/bin/_elementtree.pyd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/_elementtree.pyd
--------------------------------------------------------------------------------
/bin/_hashlib.pyd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/_hashlib.pyd
--------------------------------------------------------------------------------
/bin/_lzma.pyd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/_lzma.pyd
--------------------------------------------------------------------------------
/bin/_socket.pyd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/_socket.pyd
--------------------------------------------------------------------------------
/bin/_ssl.pyd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/_ssl.pyd
--------------------------------------------------------------------------------
/bin/fonttools_LICENSE.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Just van Rossum
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/bin/freetype6.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/freetype6.dll
--------------------------------------------------------------------------------
/bin/getKerningPairsFromOTF.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/getKerningPairsFromOTF.exe
--------------------------------------------------------------------------------
/bin/msdfgen.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/msdfgen.exe
--------------------------------------------------------------------------------
/bin/msdfgen_LICENSE.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 Viktor Chlumsky
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/bin/pyexpat.pyd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/pyexpat.pyd
--------------------------------------------------------------------------------
/bin/python34.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/python34.dll
--------------------------------------------------------------------------------
/bin/select.pyd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/select.pyd
--------------------------------------------------------------------------------
/bin/unicodedata.pyd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/unicodedata.pyd
--------------------------------------------------------------------------------
/bin/wiggle.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/wiggle.exe
--------------------------------------------------------------------------------
/bin/zlib1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/bin/zlib1.dll
--------------------------------------------------------------------------------
/demo/make.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | set msvcdir="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\"
4 | if not defined DevEnvDir call %msvcdir%vcvars64.bat >nul
5 |
6 | cl /nologo ^
7 | /TC ^
8 | /EHsc ^
9 | /Zi ^
10 | /W3 ^
11 | /Gs16777216 ^
12 | /GS- ^
13 | /Gm- ^
14 | /fp:fast ^
15 | /wd4477 ^
16 | /wd4244 ^
17 | /wd4267 ^
18 | /wd4334 ^
19 | /wd4305 ^
20 | /wd4101 ^
21 | main.c ^
22 | /Fe"TextInvaders.exe" ^
23 | /Fd"TextInvaders.pdb" ^
24 | /link ^
25 | /nologo ^
26 | /STACK:16777216,16777216 ^
27 | /entry:TextInvadersMain ^
28 | /NODEFAULTLIB ^
29 | kernel32.lib gdi32.lib user32.lib opengl32.lib ^
30 | /SUBSYSTEM:WINDOWS ^
31 | /INCREMENTAL:NO
32 |
33 | del *.obj 2>&1 >nul
34 |
35 |
--------------------------------------------------------------------------------
/demo/shaders.h:
--------------------------------------------------------------------------------
1 | // The shader is based on the one from
2 | // https://github.com/libgdx/libgdx/wiki/Distance-field-fonts
3 | // and
4 | // https://github.com/Chlumsky/msdfgen
5 |
6 | const char* GLES2_frag = "" "#version 100\n"
7 | "precision mediump float;\n"
8 | "varying float fKind;\n"
9 | "varying vec2 fScale;\n"
10 | "varying vec2 fUV;\n"
11 | "varying vec4 fColor;\n"
12 | "uniform float uPxRange;\n"
13 | "uniform vec2 uInvTextureSize;\n"
14 | "uniform vec4 uTint;\n"
15 | "uniform sampler2D uTexture;\n"
16 | "float median(float a, float b, float c)\n"
17 | "{\n"
18 | " return max(min(a, b), min(max(a, b), c));\n"
19 | "}\n"
20 | "vec2 subpixelAA(vec2 pixel, float zoom)\n"
21 | "{\n"
22 | " vec2 uv = floor(pixel) + 0.5;\n"
23 | " return uv + 1.0 - clamp((1.0 - fract(pixel)) * zoom, 0.0, 1.0);\n"
24 | "}\n"
25 | "void main()\n"
26 | "{\n"
27 | " if(fKind < 10.0) {\n"
28 | " //vec4 dist = texture2D(uTexture, fUV * uInvTextureSize);\n"
29 | " //float m = median(dist.x, dist.y, dist.z);\n"
30 | " //float smoothing = 0.25 / (uPxRange * fScale.x);\n"
31 | " //float alpha = smoothstep(0.5 - smoothing, 0.5 + smoothing, m);\n"
32 | " //gl_FragColor = vec4(1, 1, 1, alpha) * uTint * fColor;\n"
33 | " vec2 msdfUnit = uPxRange * uInvTextureSize;\n"
34 | " vec4 sdfVal = texture2D(uTexture, fUV * uInvTextureSize);\n"
35 | " float sigDist = median(sdfVal.r, sdfVal.g, sdfVal.b) - 0.5;\n"
36 | " sigDist *= dot(msdfUnit, 0.5/vec2(fKind / 1000.0));\n"
37 | " float opacity = clamp(sigDist + 0.5, 0.0, 1.0);\n"
38 | " gl_FragColor = vec4(1, 1, 1, opacity) * uTint * fColor;\n"
39 | " } else {\n"
40 | " vec4 lcolor = fColor;\n"
41 | " if(fKind < 20.0) {\n"
42 | " vec2 uv;\n"
43 | " if(fKind > 15.0) {\n"
44 | " uv = subpixelAA(fUV, fScale.x);\n"
45 | " } else {\n"
46 | " uv = floor(fUV) + 0.5;\n"
47 | " }\n"
48 | " lcolor *= texture2D(uTexture, uv * uInvTextureSize);\n"
49 | " }\n"
50 | " gl_FragColor = lcolor * uTint;\n"
51 | " }\n"
52 | "}\n"
53 | ;
54 | const char* GLES2_vert = "" "#version 100\n"
55 | "attribute float vKind;\n"
56 | "attribute vec2 vPos;\n"
57 | "attribute vec2 vUV;\n"
58 | "attribute vec2 vScale;\n"
59 | "attribute vec4 vColor;\n"
60 | "varying float fKind;\n"
61 | "varying vec2 fScale;\n"
62 | "varying vec2 fUV;\n"
63 | "varying vec4 fColor;\n"
64 | "void main()\n"
65 | "{\n"
66 | " gl_Position = vec4(vPos, 0, 1);\n"
67 | " fUV = vUV;\n"
68 | " fScale = vScale;\n"
69 | " fKind = vKind;\n"
70 | " fColor = vColor.wzyx;\n"
71 | "}\n"
72 | ;
73 |
74 |
--------------------------------------------------------------------------------
/demo/textSample.h:
--------------------------------------------------------------------------------
1 |
2 | /* The first paragraph of "The War of the Worlds", by HG Wells
3 | * What could be more fitting for a Space Invaders clone?
4 | */
5 | const char* textSample = "No one would have believed in the last years of the nineteenth century\n"
6 | "that this world was being watched keenly and closely by intelligences\n"
7 | "greater than man's and yet as mortal as his own; that as men busied\n"
8 | "themselves about their various concerns they were scrutinised and studied,\n"
9 | "perhaps almost as narrowly as a man with a microscope might scrutinize the\n"
10 | "transient creatures that swarm and multiply in a drop of water. With\n"
11 | "infinite complacency men went to and fro over this globe about their\n"
12 | "little affairs, serene in their assurance of their empire over matter. It\n"
13 | "is possible that the infusoria under the microscope do the same. No one\n"
14 | "gave a thought to the older worlds of space as sources of human danger, or\n"
15 | "thought of them only to dismiss the idea of life upon them as impossible\n"
16 | "or improbable. It is curious to recall some of the mental habits of those\n"
17 | "departed days. At most terrestrial men fancied there might be other men\n"
18 | "upon Mars, perhaps inferior to themselves and ready to welcome\n"
19 | "a missionary enterprise. Yet across the gulf of space, minds that are to\n"
20 | "our minds as ours are to those of the beasts that perish, intellects vast\n"
21 | "and cool and unsympathetic, regarded this earth with envious eyes, and\n"
22 | "slowly and surely drew their plans against us. And early in the twentieth\n"
23 | "century came the great disillusionment.\n"
24 | ;
25 |
26 |
27 | /*
28 | The Project Gutenberg EBook of The War of the Worlds, by H. G. Wells
29 |
30 | This eBook is for the use of anyone anywhere at no cost and with
31 | almost no restrictions whatsoever. You may copy it, give it away or
32 | re-use it under the terms of the Project Gutenberg License included
33 | with this eBook or online at www.gutenberg.net
34 | */
35 |
--------------------------------------------------------------------------------
/example_files/SourceSerifPro-Bold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/example_files/SourceSerifPro-Bold.otf
--------------------------------------------------------------------------------
/example_files/SourceSerifPro-Light.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/example_files/SourceSerifPro-Light.otf
--------------------------------------------------------------------------------
/example_files/SourceSerifPro-Regular.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/example_files/SourceSerifPro-Regular.otf
--------------------------------------------------------------------------------
/example_files/SourceSerif_LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright 2014 - 2017 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
2 |
3 | This Font Software is licensed under the SIL Open Font License, Version 1.1.
4 |
5 | This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
6 |
7 |
8 | -----------------------------------------------------------
9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10 | -----------------------------------------------------------
11 |
12 | PREAMBLE
13 | The goals of the Open Font License (OFL) are to stimulate worldwide
14 | development of collaborative font projects, to support the font creation
15 | efforts of academic and linguistic communities, and to provide a free and
16 | open framework in which fonts may be shared and improved in partnership
17 | with others.
18 |
19 | The OFL allows the licensed fonts to be used, studied, modified and
20 | redistributed freely as long as they are not sold by themselves. The
21 | fonts, including any derivative works, can be bundled, embedded,
22 | redistributed and/or sold with any software provided that any reserved
23 | names are not used by derivative works. The fonts and derivatives,
24 | however, cannot be released under any other type of license. The
25 | requirement for fonts to remain under this license does not apply
26 | to any document created using the fonts or their derivatives.
27 |
28 | DEFINITIONS
29 | "Font Software" refers to the set of files released by the Copyright
30 | Holder(s) under this license and clearly marked as such. This may
31 | include source files, build scripts and documentation.
32 |
33 | "Reserved Font Name" refers to any names specified as such after the
34 | copyright statement(s).
35 |
36 | "Original Version" refers to the collection of Font Software components as
37 | distributed by the Copyright Holder(s).
38 |
39 | "Modified Version" refers to any derivative made by adding to, deleting,
40 | or substituting -- in part or in whole -- any of the components of the
41 | Original Version, by changing formats or by porting the Font Software to a
42 | new environment.
43 |
44 | "Author" refers to any designer, engineer, programmer, technical
45 | writer or other person who contributed to the Font Software.
46 |
47 | PERMISSION & CONDITIONS
48 | Permission is hereby granted, free of charge, to any person obtaining
49 | a copy of the Font Software, to use, study, copy, merge, embed, modify,
50 | redistribute, and sell modified and unmodified copies of the Font
51 | Software, subject to the following conditions:
52 |
53 | 1) Neither the Font Software nor any of its individual components,
54 | in Original or Modified Versions, may be sold by itself.
55 |
56 | 2) Original or Modified Versions of the Font Software may be bundled,
57 | redistributed and/or sold with any software, provided that each copy
58 | contains the above copyright notice and this license. These can be
59 | included either as stand-alone text files, human-readable headers or
60 | in the appropriate machine-readable metadata fields within text or
61 | binary files as long as those fields can be easily viewed by the user.
62 |
63 | 3) No Modified Version of the Font Software may use the Reserved Font
64 | Name(s) unless explicit written permission is granted by the corresponding
65 | Copyright Holder. This restriction only applies to the primary font name as
66 | presented to the users.
67 |
68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69 | Software shall not be used to promote, endorse or advertise any
70 | Modified Version, except to acknowledge the contribution(s) of the
71 | Copyright Holder(s) and the Author(s) or with their explicit written
72 | permission.
73 |
74 | 5) The Font Software, modified or unmodified, in part or in whole,
75 | must be distributed entirely under this license, and must not be
76 | distributed under any other license. The requirement for fonts to
77 | remain under this license does not apply to any document created
78 | using the Font Software.
79 |
80 | TERMINATION
81 | This license becomes null and void if any of the above conditions are
82 | not met.
83 |
84 | DISCLAIMER
85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93 | OTHER DEALINGS IN THE FONT SOFTWARE.
94 |
--------------------------------------------------------------------------------
/example_files/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/example_files/background.png
--------------------------------------------------------------------------------
/example_files/sprites.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/example_files/sprites.png
--------------------------------------------------------------------------------
/example_usage.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | set wiggle=bin\wiggle.exe
3 |
4 | set sspr=example_files\SourceSerifPro-Regular.otf
5 | set sspl=example_files\SourceSerifPro-Light.otf
6 | set sspb=example_files\SourceSerifPro-Bold.otf
7 |
8 | rem width height scale x y pxrange render
9 | %wiggle% fontgen %sspr% sspr.wfi sspr.png 128 96 4 8 4 8 1
10 | %wiggle% fontgen %sspl% sspl.wfi sspl.png 128 96 4 8 4 8 1
11 | %wiggle% fontgen %sspb% sspb.wfi sspb.png 128 96 4 8 4 8 1
12 |
13 | %wiggle% atlas game_atlas.png 2048 ^
14 | example_files\sprites.png 0 ^
15 | example_files\background.png 0 ^
16 | sspr.png sspr.wfi ^
17 | sspl.png sspl.wfi ^
18 | sspb.png sspb.wfi ^
19 | > atlas.txt
20 |
21 | %wiggle% rgba game_atlas.png game_atlas.rgba
22 |
23 | copy game_atlas.rgba demo\
24 | copy sspr.wfi demo\
25 |
--------------------------------------------------------------------------------
/make.bat:
--------------------------------------------------------------------------------
1 |
2 | @echo off
3 | set msvcdir="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\"
4 | if not defined DevEnvDir call %msvcdir%vcvars64.bat >nul
5 | cl /nologo /TP /W3 /wd4244 /EHsc /I"src/include" /MD /O2 src\main.cc /Fe"bin/wiggle.exe" /link /nologo src\freetype27.lib shlwapi.lib /INCREMENTAL:NO /SUBSYSTEM:CONSOLE
6 |
7 | del *.obj 2>&1 >nul
8 |
9 | rem start wiggle DejaVuSansCondensed.ttf dvsc.wgd
10 |
--------------------------------------------------------------------------------
/src/freetype27.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WilliamBundy/wiggle/420890efe221875e98cf6772248d88f76d1f9e06/src/freetype27.lib
--------------------------------------------------------------------------------
/src/include/FTL.txt:
--------------------------------------------------------------------------------
1 | The FreeType Project LICENSE
2 | ----------------------------
3 |
4 | 2006-Jan-27
5 |
6 | Copyright 1996-2002, 2006 by
7 | David Turner, Robert Wilhelm, and Werner Lemberg
8 |
9 |
10 |
11 | Introduction
12 | ============
13 |
14 | The FreeType Project is distributed in several archive packages;
15 | some of them may contain, in addition to the FreeType font engine,
16 | various tools and contributions which rely on, or relate to, the
17 | FreeType Project.
18 |
19 | This license applies to all files found in such packages, and
20 | which do not fall under their own explicit license. The license
21 | affects thus the FreeType font engine, the test programs,
22 | documentation and makefiles, at the very least.
23 |
24 | This license was inspired by the BSD, Artistic, and IJG
25 | (Independent JPEG Group) licenses, which all encourage inclusion
26 | and use of free software in commercial and freeware products
27 | alike. As a consequence, its main points are that:
28 |
29 | o We don't promise that this software works. However, we will be
30 | interested in any kind of bug reports. (`as is' distribution)
31 |
32 | o You can use this software for whatever you want, in parts or
33 | full form, without having to pay us. (`royalty-free' usage)
34 |
35 | o You may not pretend that you wrote this software. If you use
36 | it, or only parts of it, in a program, you must acknowledge
37 | somewhere in your documentation that you have used the
38 | FreeType code. (`credits')
39 |
40 | We specifically permit and encourage the inclusion of this
41 | software, with or without modifications, in commercial products.
42 | We disclaim all warranties covering The FreeType Project and
43 | assume no liability related to The FreeType Project.
44 |
45 |
46 | Finally, many people asked us for a preferred form for a
47 | credit/disclaimer to use in compliance with this license. We thus
48 | encourage you to use the following text:
49 |
50 | """
51 | Portions of this software are copyright © The FreeType
52 | Project (www.freetype.org). All rights reserved.
53 | """
54 |
55 | Please replace with the value from the FreeType version you
56 | actually use.
57 |
58 |
59 | Legal Terms
60 | ===========
61 |
62 | 0. Definitions
63 | --------------
64 |
65 | Throughout this license, the terms `package', `FreeType Project',
66 | and `FreeType archive' refer to the set of files originally
67 | distributed by the authors (David Turner, Robert Wilhelm, and
68 | Werner Lemberg) as the `FreeType Project', be they named as alpha,
69 | beta or final release.
70 |
71 | `You' refers to the licensee, or person using the project, where
72 | `using' is a generic term including compiling the project's source
73 | code as well as linking it to form a `program' or `executable'.
74 | This program is referred to as `a program using the FreeType
75 | engine'.
76 |
77 | This license applies to all files distributed in the original
78 | FreeType Project, including all source code, binaries and
79 | documentation, unless otherwise stated in the file in its
80 | original, unmodified form as distributed in the original archive.
81 | If you are unsure whether or not a particular file is covered by
82 | this license, you must contact us to verify this.
83 |
84 | The FreeType Project is copyright (C) 1996-2000 by David Turner,
85 | Robert Wilhelm, and Werner Lemberg. All rights reserved except as
86 | specified below.
87 |
88 | 1. No Warranty
89 | --------------
90 |
91 | THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY
92 | KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
93 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
94 | PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
95 | BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO
96 | USE, OF THE FREETYPE PROJECT.
97 |
98 | 2. Redistribution
99 | -----------------
100 |
101 | This license grants a worldwide, royalty-free, perpetual and
102 | irrevocable right and license to use, execute, perform, compile,
103 | display, copy, create derivative works of, distribute and
104 | sublicense the FreeType Project (in both source and object code
105 | forms) and derivative works thereof for any purpose; and to
106 | authorize others to exercise some or all of the rights granted
107 | herein, subject to the following conditions:
108 |
109 | o Redistribution of source code must retain this license file
110 | (`FTL.TXT') unaltered; any additions, deletions or changes to
111 | the original files must be clearly indicated in accompanying
112 | documentation. The copyright notices of the unaltered,
113 | original files must be preserved in all copies of source
114 | files.
115 |
116 | o Redistribution in binary form must provide a disclaimer that
117 | states that the software is based in part of the work of the
118 | FreeType Team, in the distribution documentation. We also
119 | encourage you to put an URL to the FreeType web page in your
120 | documentation, though this isn't mandatory.
121 |
122 | These conditions apply to any software derived from or based on
123 | the FreeType Project, not just the unmodified files. If you use
124 | our work, you must acknowledge us. However, no fee need be paid
125 | to us.
126 |
127 | 3. Advertising
128 | --------------
129 |
130 | Neither the FreeType authors and contributors nor you shall use
131 | the name of the other for commercial, advertising, or promotional
132 | purposes without specific prior written permission.
133 |
134 | We suggest, but do not require, that you use one or more of the
135 | following phrases to refer to this software in your documentation
136 | or advertising materials: `FreeType Project', `FreeType Engine',
137 | `FreeType library', or `FreeType Distribution'.
138 |
139 | As you have not signed this license, you are not required to
140 | accept it. However, as the FreeType Project is copyrighted
141 | material, only this license, or another one contracted with the
142 | authors, grants you the right to use, distribute, and modify it.
143 | Therefore, by using, distributing, or modifying the FreeType
144 | Project, you indicate that you understand and accept all the terms
145 | of this license.
146 |
147 | 4. Contacts
148 | -----------
149 |
150 | There are two mailing lists related to FreeType:
151 |
152 | o freetype@nongnu.org
153 |
154 | Discusses general use and applications of FreeType, as well as
155 | future and wanted additions to the library and distribution.
156 | If you are looking for support, start in this list if you
157 | haven't found anything to help you in the documentation.
158 |
159 | o freetype-devel@nongnu.org
160 |
161 | Discusses bugs, as well as engine internals, design issues,
162 | specific licenses, porting, etc.
163 |
164 | Our home page can be found at
165 |
166 | https://www.freetype.org
167 |
168 |
169 | --- end of FTL.TXT ---
170 |
--------------------------------------------------------------------------------
/src/include/freetype/config/ftmodule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file registers the FreeType modules compiled into the library.
3 | *
4 | * If you use GNU make, this file IS NOT USED! Instead, it is created in
5 | * the objects directory (normally `/objs/') based on information
6 | * from `/modules.cfg'.
7 | *
8 | * Please read `docs/INSTALL.ANY' and `docs/CUSTOMIZE' how to compile
9 | * FreeType without GNU make.
10 | *
11 | */
12 |
13 | FT_USE_MODULE( FT_Module_Class, autofit_module_class )
14 | FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )
15 | FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )
16 | FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )
17 | FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )
18 | FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )
19 | FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )
20 | FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )
21 | FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
22 | FT_USE_MODULE( FT_Module_Class, psaux_module_class )
23 | FT_USE_MODULE( FT_Module_Class, psnames_module_class )
24 | FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
25 | FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
26 | FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
27 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
28 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
29 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
30 | FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
31 |
32 | /* EOF */
33 |
--------------------------------------------------------------------------------
/src/include/freetype/config/ftstdlib.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************/
2 | /* */
3 | /* ftstdlib.h */
4 | /* */
5 | /* ANSI-specific library and header configuration file (specification */
6 | /* only). */
7 | /* */
8 | /* Copyright 2002-2016 by */
9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */
10 | /* */
11 | /* This file is part of the FreeType project, and may only be used, */
12 | /* modified, and distributed under the terms of the FreeType project */
13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
14 | /* this file you indicate that you have read the license and */
15 | /* understand and accept it fully. */
16 | /* */
17 | /***************************************************************************/
18 |
19 |
20 | /*************************************************************************/
21 | /* */
22 | /* This file is used to group all #includes to the ANSI C library that */
23 | /* FreeType normally requires. It also defines macros to rename the */
24 | /* standard functions within the FreeType source code. */
25 | /* */
26 | /* Load a file which defines FTSTDLIB_H_ before this one to override it. */
27 | /* */
28 | /*************************************************************************/
29 |
30 |
31 | #ifndef FTSTDLIB_H_
32 | #define FTSTDLIB_H_
33 |
34 |
35 | #include
36 |
37 | #define ft_ptrdiff_t ptrdiff_t
38 |
39 |
40 | /**********************************************************************/
41 | /* */
42 | /* integer limits */
43 | /* */
44 | /* UINT_MAX and ULONG_MAX are used to automatically compute the size */
45 | /* of `int' and `long' in bytes at compile-time. So far, this works */
46 | /* for all platforms the library has been tested on. */
47 | /* */
48 | /* Note that on the extremely rare platforms that do not provide */
49 | /* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */
50 | /* old Crays where `int' is 36 bits), we do not make any guarantee */
51 | /* about the correct behaviour of FT2 with all fonts. */
52 | /* */
53 | /* In these case, `ftconfig.h' will refuse to compile anyway with a */
54 | /* message like `couldn't find 32-bit type' or something similar. */
55 | /* */
56 | /**********************************************************************/
57 |
58 |
59 | #include
60 |
61 | #define FT_CHAR_BIT CHAR_BIT
62 | #define FT_USHORT_MAX USHRT_MAX
63 | #define FT_INT_MAX INT_MAX
64 | #define FT_INT_MIN INT_MIN
65 | #define FT_UINT_MAX UINT_MAX
66 | #define FT_LONG_MIN LONG_MIN
67 | #define FT_LONG_MAX LONG_MAX
68 | #define FT_ULONG_MAX ULONG_MAX
69 |
70 |
71 | /**********************************************************************/
72 | /* */
73 | /* character and string processing */
74 | /* */
75 | /**********************************************************************/
76 |
77 |
78 | #include
79 |
80 | #define ft_memchr memchr
81 | #define ft_memcmp memcmp
82 | #define ft_memcpy memcpy
83 | #define ft_memmove memmove
84 | #define ft_memset memset
85 | #define ft_strcat strcat
86 | #define ft_strcmp strcmp
87 | #define ft_strcpy strcpy
88 | #define ft_strlen strlen
89 | #define ft_strncmp strncmp
90 | #define ft_strncpy strncpy
91 | #define ft_strrchr strrchr
92 | #define ft_strstr strstr
93 |
94 |
95 | /**********************************************************************/
96 | /* */
97 | /* file handling */
98 | /* */
99 | /**********************************************************************/
100 |
101 |
102 | #include
103 |
104 | #define FT_FILE FILE
105 | #define ft_fclose fclose
106 | #define ft_fopen fopen
107 | #define ft_fread fread
108 | #define ft_fseek fseek
109 | #define ft_ftell ftell
110 | #define ft_sprintf sprintf
111 |
112 |
113 | /**********************************************************************/
114 | /* */
115 | /* sorting */
116 | /* */
117 | /**********************************************************************/
118 |
119 |
120 | #include
121 |
122 | #define ft_qsort qsort
123 |
124 |
125 | /**********************************************************************/
126 | /* */
127 | /* memory allocation */
128 | /* */
129 | /**********************************************************************/
130 |
131 |
132 | #define ft_scalloc calloc
133 | #define ft_sfree free
134 | #define ft_smalloc malloc
135 | #define ft_srealloc realloc
136 |
137 |
138 | /**********************************************************************/
139 | /* */
140 | /* miscellaneous */
141 | /* */
142 | /**********************************************************************/
143 |
144 |
145 | #define ft_strtol strtol
146 | #define ft_getenv getenv
147 |
148 |
149 | /**********************************************************************/
150 | /* */
151 | /* execution control */
152 | /* */
153 | /**********************************************************************/
154 |
155 |
156 | #include
157 |
158 | #define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */
159 | /* jmp_buf is defined as a macro */
160 | /* on certain platforms */
161 |
162 | #define ft_longjmp longjmp
163 | #define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */
164 |
165 |
166 | /* the following is only used for debugging purposes, i.e., if */
167 | /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */
168 |
169 | #include
170 |
171 |
172 | #endif /* FTSTDLIB_H_ */
173 |
174 |
175 | /* END */
176 |
--------------------------------------------------------------------------------
/src/include/freetype/ftbbox.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************/
2 | /* */
3 | /* ftbbox.h */
4 | /* */
5 | /* FreeType exact bbox computation (specification). */
6 | /* */
7 | /* Copyright 1996-2016 by */
8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */
9 | /* */
10 | /* This file is part of the FreeType project, and may only be used, */
11 | /* modified, and distributed under the terms of the FreeType project */
12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 | /* this file you indicate that you have read the license and */
14 | /* understand and accept it fully. */
15 | /* */
16 | /***************************************************************************/
17 |
18 |
19 | /*************************************************************************/
20 | /* */
21 | /* This component has a _single_ role: to compute exact outline bounding */
22 | /* boxes. */
23 | /* */
24 | /* It is separated from the rest of the engine for various technical */
25 | /* reasons. It may well be integrated in `ftoutln' later. */
26 | /* */
27 | /*************************************************************************/
28 |
29 |
30 | #ifndef FTBBOX_H_
31 | #define FTBBOX_H_
32 |
33 |
34 | #include
35 | #include FT_FREETYPE_H
36 |
37 | #ifdef FREETYPE_H
38 | #error "freetype.h of FreeType 1 has been loaded!"
39 | #error "Please fix the directory search order for header files"
40 | #error "so that freetype.h of FreeType 2 is found first."
41 | #endif
42 |
43 |
44 | FT_BEGIN_HEADER
45 |
46 |
47 | /*************************************************************************/
48 | /* */
49 | /* */
50 | /* outline_processing */
51 | /* */
52 | /*************************************************************************/
53 |
54 |
55 | /*************************************************************************/
56 | /* */
57 | /* */
58 | /* FT_Outline_Get_BBox */
59 | /* */
60 | /* */
61 | /* Compute the exact bounding box of an outline. This is slower */
62 | /* than computing the control box. However, it uses an advanced */
63 | /* algorithm that returns _very_ quickly when the two boxes */
64 | /* coincide. Otherwise, the outline Bézier arcs are traversed to */
65 | /* extract their extrema. */
66 | /* */
67 | /* */
68 | /* outline :: A pointer to the source outline. */
69 | /* */
70 | /*