Skip to content

Commit

Permalink
Merge pull request #26 from ii887522/develop
Browse files Browse the repository at this point in the history
Release 1.3.1
  • Loading branch information
ii887522 authored Aug 20, 2022
2 parents cdeedfb + 1f5cb7d commit f9fa70d
Show file tree
Hide file tree
Showing 6 changed files with 1,728 additions and 577 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "font-packer"
version = "1.3.0"
version = "1.3.1"
edition = "2021"
description = "A CLI tool used to generate glyph atlases for graphics applications such as GUI, video games and so on to improve performance of these applications."
repository = "https://github.com/ii887522/font-packer"
Expand Down
9 changes: 7 additions & 2 deletions src/opengl/gl_basic_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ impl GLBasicStage {
});
tex.init();
let glyph = Glyph {
ch,
font_name: font.file_name[..font.file_name.find('.').unwrap()].to_owned(),
font_size: font.size,
name: ch.to_string(),
atlas_id: tex.get_id(),
atlas_size: tex.get_size(),
line_spacing: ttf_font.recommended_line_spacing(),
Expand All @@ -122,7 +124,10 @@ impl GLBasicStage {
};
(
if font.generate_blur.is_some() && font.generate_blur.unwrap() {
Some(glyph.clone())
Some(Glyph {
name: ch.to_string() + "_blur",
..glyph.clone()
})
} else {
None
},
Expand Down
8 changes: 6 additions & 2 deletions src/structs/atlas_region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ use serde::Serialize;

#[derive(Clone, Debug, Serialize)]
pub(crate) struct AtlasRegion {
pub ch: char,
pub font_name: String,
pub font_size: u16,
pub name: String,
pub atlas_width: u32,
pub atlas_height: u32,
pub line_spacing: i32,
Expand All @@ -18,7 +20,9 @@ pub(crate) struct AtlasRegion {
impl From<Glyph> for AtlasRegion {
fn from(glyph: Glyph) -> Self {
Self {
ch: glyph.ch,
font_name: glyph.font_name,
font_size: glyph.font_size,
name: glyph.name,
atlas_width: glyph.atlas_size.get_x(),
atlas_height: glyph.atlas_size.get_y(),
line_spacing: glyph.line_spacing,
Expand Down
4 changes: 3 additions & 1 deletion src/structs/glyph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ use std::cell::RefCell;

#[derive(Clone, Debug)]
pub(crate) struct Glyph {
pub ch: char,
pub font_name: String,
pub font_size: u16,
pub name: String,
pub atlas_id: GLenum,
pub atlas_size: UVec2,
pub line_spacing: i32,
Expand Down
Loading

0 comments on commit f9fa70d

Please sign in to comment.