Commit 069cec55 authored by Alex Butler's avatar Alex Butler

Rename "simple" example "ascii"

* Rename "rusttype-dev" private crate "dev"
parent a73a9bf0
......@@ -43,7 +43,7 @@ test:stable:gpu_cache:
script:
- cargo +stable test --features 'gpu_cache'
# Heavier testing using rusttype-dev
# Heavier testing using "dev"
test:dev:
stage: test
variables:
......
......@@ -30,11 +30,11 @@ Heavier examples, tests & benchmarks are in the `./dev` directory. This avoids d
Run all tests with `cargo test --all --all-features`.
Run examples with `cargo run --example <NAME> -p rusttype-dev`
Run examples with `cargo run --example <NAME> -p dev`
## Getting Started
To hit the ground running with RustType, look at `dev/examples/simple.rs`
To hit the ground running with RustType, look at `dev/examples/ascii.rs`
supplied with the crate. It demonstrates loading a font file, rasterising an
arbitrary string, and displaying the result as ASCII art. If you prefer to just
look at the documentation, the entry point for loading fonts is `Font`,
......
[package]
name = "rusttype-dev"
name = "dev"
version = "0.1.0"
description = "Tests, examples & benchmarks avoiding dependency feature bleed"
edition = "2018"
......
//! Render example where each glyph pixel is output as an ascii character.
use rusttype::{point, Font, Scale};
use std::io::Write;
......@@ -12,17 +13,11 @@ fn main() {
));
})
} else {
panic!("No font specified")
eprintln!("No font specified ... using WenQuanYiMicroHei.ttf");
let font_data = include_bytes!("../fonts/wqy-microhei/WenQuanYiMicroHei.ttf");
Font::try_from_bytes(font_data as &[u8]).expect("error constructing a Font from bytes")
};
//
// let font_data =
// include_bytes!("../fonts/wqy-microhei/WenQuanYiMicroHei.ttf");
// Font::try_from_bytes(font_data as &[u8]).unwrap_or_else(|_| {
// panic!("error constructing a Font from bytes");
// })
// };
// Desired font pixel height
let height: f32 = 12.4; // to get 80 chars across (fits most terminals); adjust as desired
let pixel_height = height.ceil() as usize;
......
......@@ -27,7 +27,7 @@
//!
//! # Getting Started
//!
//! To hit the ground running with RustType, look at the `simple.rs` example
//! To hit the ground running with RustType, look at the `ascii.rs` example
//! supplied with the crate. It demonstrates loading a font file, rasterising an
//! arbitrary string, and displaying the result as ASCII art. If you prefer to
//! just look at the documentation, the entry point for loading fonts is
......
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