Commit 191b3ef4 authored by Alex Butler's avatar Alex Butler

Merge branch 'edition-2018' into 'master'

Edition 2018

See merge request redox-os/stb_truetype-rs!27
parents f8574bd4 cc585d6b
Pipeline #2200 passed with stages
in 4 minutes and 37 seconds
......@@ -2,6 +2,7 @@
name = "stb_truetype"
version = "0.2.4"
authors = ["Dylan Ede <dylanede@googlemail.com>", "Alex Butler <alexheretic@gmail.com>"]
edition = "2018"
description = "A straight translation of the font loading code in stb_truetype.h from C to Rust."
documentation = "https://docs.rs/stb_truetype-rs"
repository = "https://gitlab.redox-os.org/redox-os/stb_truetype-rs"
......
#![feature(test)]
extern crate stb_truetype;
extern crate test;
#[macro_use]
extern crate approx;
use approx::*;
use stb_truetype::*;
/// index map format 12
......
#![allow(unknown_lints)]
extern crate stb_truetype;
use stb_truetype::FontInfo;
use std::borrow::Cow;
......
extern crate stb_truetype;
use stb_truetype::FontInfo;
use std::borrow::Cow;
fn main() {
let file = include_bytes!("../fonts/Gudea-Regular.ttf") as &[u8];
let font = FontInfo::new(Cow::Borrowed(file), 0).unwrap();
......
......@@ -6,8 +6,6 @@
clippy::many_single_char_names
)]
extern crate byteorder;
use byteorder::{BigEndian as BE, ByteOrder};
use std::ops::Deref;
......@@ -1195,7 +1193,7 @@ impl<Data: Deref<Target = [u8]>> FontInfo<Data> {
self.get_codepoint_bitmap_box_subpixel(codepoint, scale_x, scale_y, 0.0, 0.0)
}
pub fn get_font_name_strings(&self) -> FontNameIter<Data> {
pub fn get_font_name_strings(&self) -> FontNameIter<'_, Data> {
let nm = self.name as usize;
if nm == 0 {
return FontNameIter {
......@@ -1218,7 +1216,7 @@ impl<Data: Deref<Target = [u8]>> FontInfo<Data> {
}
#[derive(Clone, Copy)]
pub struct FontNameIter<'a, Data: 'a + Deref<Target = [u8]>> {
pub struct FontNameIter<'a, Data: Deref<Target = [u8]>> {
/// Font info.
font_info: &'a FontInfo<Data>,
string_offset: usize,
......
extern crate stb_truetype;
mod tests {
use stb_truetype;
#[test]
fn is_font() {
assert!(stb_truetype::is_font(b"OTTO"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment