28 releases (18 breaking)

Uses old Rust 2015

0.25.1 Nov 6, 2016
0.24.0 Oct 7, 2016
0.21.0 Jul 15, 2016
0.16.1 Mar 21, 2016
0.0.3 Nov 26, 2014

#656 in Graphics APIs

Download history 146/week @ 2023-08-05 152/week @ 2023-08-12 139/week @ 2023-08-19 103/week @ 2023-08-26 110/week @ 2023-09-02 160/week @ 2023-09-09 153/week @ 2023-09-16 23/week @ 2023-09-23 86/week @ 2023-09-30 112/week @ 2023-10-07 143/week @ 2023-10-14 164/week @ 2023-10-21 209/week @ 2023-10-28 156/week @ 2023-11-04 117/week @ 2023-11-11 158/week @ 2023-11-18

665 downloads per month
Used in 2 crates

MIT license

31KB
666 lines

Rust-SDL2_ttf

Build Status crates.io

Rust bindings for SDL2_ttf.

Overview

Rust-SDL2_ttf is a library for talking to the new SDL2_ttf library from Rust.

Rust-SDL2_ttf uses the MIT licence.

Documentation

Requirements

  • Rust-SDL2
  • SDL2_ttf development libraries
  • Rust master or nightly

Installation

Place the following into your project's Cargo.toml file:

[dependencies]
sdl2_ttf = "0.25"

sdl2_ttf is directly compatible with the corresponding version of sdl2. Hence sdl2_ttf v0.15 is compatible with sdl2 0.15, and so forth. Backwards compatibility is not guaranteed by rust-sdl2, so take that into account when creating new projects !

If you want the newest rust-sdl2_ttf, reference the repository:

[dependencies.sdl2_ttf]
git = "https://github.com/andelf/rust-sdl2_ttf"

You can also just clone and build the library yourself:

git clone https://github.com/andelf/rust-sdl2_ttf
cd rust-sdl2_ttf
cargo build
# TODO: OR if you are using the mac framework version
rustc -L. --cfg mac_framework src/sdl2_ttf/lib.rs

If you're not using Cargo, you can compile the library manually:

git clone https://github.com/andelf/rust-sdl2_ttf
cd rust-sdl2_ttf
rustc src/sdl2_ttf/lib.rs

Demo

A simple demo that prints out a string given a font is included:

cargo run --example demo /path/to/font.(ttf|ttc|fon)

Dependencies

~17MB
~362K SLoC