Use a better example font which isn't monospace

This commit is contained in:
Gwilym Kuiper 2022-04-05 23:35:18 +01:00
parent 5c24e4089a
commit 45e18d5cc7
5 changed files with 21 additions and 4 deletions

View file

@ -48,7 +48,7 @@ pub fn load_font(font_data: &[u8], pixels_per_em: f32) -> TokenStream {
let width = letter_data.width as u8; let width = letter_data.width as u8;
let xmin = letter_data.xmin as i8; let xmin = letter_data.xmin as i8;
let ymin = letter_data.ymin as i8; let ymin = letter_data.ymin as i8;
let advance_width = letter_data.advance_width as u8; let advance_width = letter_data.advance_width.ceil() as u8;
quote!( quote!(
agb::display::FontLetter::new( agb::display::FontLetter::new(

View file

@ -0,0 +1,17 @@
Thanks for downloading one of codeman38's retro video game fonts, as seen on Memepool, BoingBoing, and all around the blogosphere.
So, you're wondering what the license is for these fonts? Pretty simple; it's based upon that used for Bitstream's Vera font set <http://www.gnome.org/fonts/>.
Basically, here are the key points summarized, in as little legalese as possible; I hate reading license agreements as much as you probably do:
With one specific exception, you have full permission to bundle these fonts in your own free or commercial projects-- and by projects, I'm referring to not just software but also electronic documents and print publications.
So what's the exception? Simple: you can't re-sell these fonts in a commercial font collection. I've seen too many font CDs for sale in stores that are just a repackaging of thousands of freeware fonts found on the internet, and in my mind, that's quite a bit like highway robbery. Note that this *only* applies to products that are font collections in and of themselves; you may freely bundle these fonts with an operating system, application program, or the like.
Feel free to modify these fonts and even to release the modified versions, as long as you change the original font names (to ensure consistency among people with the font installed) and as long as you give credit somewhere in the font file to codeman38 or zone38.net. I may even incorporate these changes into a later version of my fonts if you wish to send me the modifed fonts via e-mail.
Also, feel free to mirror these fonts on your own site, as long as you make it reasonably clear that these fonts are not your own work. I'm not asking for much; linking to zone38.net or even just mentioning the nickname codeman38 should be enough.
Well, that pretty much sums it up... so without further ado, install and enjoy these fonts from the golden age of video games.
[ codeman38 | cody@zone38.net | http://www.zone38.net/ ]

Binary file not shown.

View file

@ -6,7 +6,7 @@ use agb::{
include_font, include_font,
}; };
const FONT: Font = include_font!("examples/unscii-8.ttf", 8); const FONT: Font = include_font!("examples/font/yoster.ttf", 12);
#[agb::entry] #[agb::entry]
fn main(mut gba: agb::Gba) -> ! { fn main(mut gba: agb::Gba) -> ! {

View file

@ -93,12 +93,12 @@ impl Font {
let letter = self.letter(c); let letter = self.letter(c);
let xmin = (current_x_pos + letter.xmin as i32).max(0); let x_start = (current_x_pos + letter.xmin as i32).max(0);
let y_start = current_y_pos + self.ascent - letter.height as i32 - letter.ymin as i32; let y_start = current_y_pos + self.ascent - letter.height as i32 - letter.ymin as i32;
for letter_y in 0..(letter.height as i32) { for letter_y in 0..(letter.height as i32) {
for letter_x in 0..(letter.width as i32) { for letter_x in 0..(letter.width as i32) {
let x = letter_x + xmin; let x = x_start + letter_x;
let y = y_start + letter_y; let y = y_start + letter_y;
let px = letter.data[(letter_x + letter_y * letter.width as i32) as usize]; let px = letter.data[(letter_x + letter_y * letter.width as i32) as usize];