Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stetre/moonfreetype
Lua bindings for FreeType
https://github.com/stetre/moonfreetype
Last synced: about 2 months ago
JSON representation
Lua bindings for FreeType
- Host: GitHub
- URL: https://github.com/stetre/moonfreetype
- Owner: stetre
- License: other
- Created: 2017-01-08T11:38:28.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-08T18:34:41.000Z (over 1 year ago)
- Last Synced: 2024-08-02T15:37:52.574Z (5 months ago)
- Language: C
- Size: 146 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## MoonFreeType: Lua bindings for FreeType
MoonFreeType is a Lua binding library for the
[FreeType library](https://www.freetype.org/).It runs on GNU/Linux and on Windows (MSYS2/MinGW) and requires
[Lua](http://www.lua.org/) (>=5.3) and
[FreeType](https://www.freetype.org/download.html) (>=2.6.1)._Authored by:_ _[Stefano Trettel](https://www.linkedin.com/in/stetre)_
[![Lua logo](./doc/powered-by-lua.gif)](http://www.lua.org/)
#### License
MIT/X11 license (same as Lua). See [LICENSE](./LICENSE).
#### Documentation
See the [Reference Manual](https://stetre.github.io/moonfreetype/doc/index.html).
#### Getting and installing
Setup the build environment as described [here](https://github.com/stetre/moonlibs), then:
```sh
$ git clone https://github.com/stetre/moonfreetype
$ cd moonfreetype
moonfreetype$ make
moonfreetype$ make install # or 'sudo make install' (Ubuntu)
```#### Example
The script below loads a font face from a file and lists the contained glyphs:
```lua
-- MoonFreeType example: listglyphs.luaft = require("moonfreetype")
fontfile = arg[1]
if not fontfile then print("Usage: " .. arg[0] .. " ") return end-- Create a library:
lib = ft.init_freetype()-- Create a face, loading from fontfile:
face = ft.new_face(lib, fontfile)-- List all the glyphs (character code - glyph index - glyph name):
charcode, index = face:get_first_char()
while index do
print(charcode, index, face:get_glyph_name(index))
charcode, index = face:get_next_char(charcode)
endlib:done()
```
The script can be executed at the shell prompt with the standard Lua interpreter,
passing it a font file name, e.g.:```shell
$ lua listglyphs.lua myfavouritefont.ttf
```Other examples can be found in the **examples/** directory.
#### See also
* [MoonLibs - Graphics and Audio Lua Libraries](https://github.com/stetre/moonlibs).