1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 21:32:13 +03:00

fonts: remove some unused code and fixup some warnings

This commit is contained in:
Wez Furlong 2019-12-14 12:29:38 -08:00
parent f204ad9a82
commit 51c2646eee
3 changed files with 10 additions and 40 deletions

View File

@ -18,8 +18,15 @@ pub mod font_loader;
/// collection if the data represents a collection of
/// fonts.
pub enum FontDataHandle {
OnDisk { path: PathBuf, index: u32 },
Memory { data: Vec<u8>, index: u32 },
OnDisk {
path: PathBuf,
index: u32,
},
#[allow(dead_code)]
Memory {
data: Vec<u8>,
index: u32,
},
}
impl std::fmt::Debug for FontDataHandle {

View File

@ -1,38 +1,3 @@
use euclid::{Length, Scale};
pub type PixelUnit = window::PixelUnit;
pub struct FontUnit;
pub struct PointUnit;
pub struct EMUnit;
/// The length of a side of the imaginary EM square
/// which sets the resolution of a glyph.
/// eg: an EMSize of 2048 means that there are 2048
/// FontUnit's per em square.
/// 1em corresponds to the selected point size of a font.
pub type EMSize = Length<usize, EMUnit>;
/// A dimension expressed in font coordinates.
/// For example, if the EMSize is 2000 and we have a FontLength
/// of 500, it represents 500/2000 or 1/4 of the nominal size
/// of a glyph.
pub type FontLength = Length<isize, FontUnit>;
/// Describes a distance measured in points.
pub type PointLength = Length<f64, PointUnit>;
/// Returns the scaling factor required to convert from
/// points to pixels at a given dpi; multiply a `PointLength` by
/// this to produce a `PixelLength`
pub fn pixels_per_point(dpi: u32) -> Scale<f64, PointUnit, PixelUnit> {
Scale::new(dpi as f64 / 72.)
}
/// Returns the scaling factor required to convert from
/// font units in a particular font to points.
pub fn units_per_em(units_per_em: EMSize) -> Scale<f64, FontUnit, PointUnit> {
Scale::new(1.0 / units_per_em.get() as f64)
}
pub type PixelLength = euclid::Length<f64, PixelUnit>;
pub type IntPixelLength = isize; // euclid::Length<isize, PixelUnit>;
pub type IntPixelLength = isize;

View File

@ -66,8 +66,6 @@ where
// We pad each sprite reservation with blank space to avoid
// surprising and unexpected artifacts when the texture is
// interpolated on to the render surface.
// In addition, we need to ensure that the bottom left pixel
// is blank as we use that for whitespace glyphs.
let reserve_width = width + 2;
let reserve_height = height + 2;