summaryrefslogtreecommitdiffstats
path: root/font
diff options
context:
space:
mode:
authorNathan Lilienthal <nathan@nixpulvis.com>2019-01-06 19:06:57 -0500
committerChristian Duerr <chrisduerr@users.noreply.github.com>2019-01-07 00:06:57 +0000
commit04707cbba630e3e4ad6b4200bef8ae7888c49e3b (patch)
treebd04f4964d4c4ad67cd565b38172b488172acfcc /font
parentdfc30eeef5eb6df9f658e62875e5cde93173e37b (diff)
Normalize Log Message Strings
The general style for errors, warnings and info messages is to start with a capitalized letter and end without a period. The main exception is when dealing with nouns that are clearer with special case handling, e.g. "macOS failed to work" or "ioctl is borked".
Diffstat (limited to 'font')
-rw-r--r--font/src/darwin/mod.rs11
-rw-r--r--font/src/ft/fc/font_set.rs4
-rw-r--r--font/src/ft/mod.rs14
-rw-r--r--font/src/lib.rs2
-rw-r--r--font/src/rusttype/mod.rs8
5 files changed, 19 insertions, 20 deletions
diff --git a/font/src/darwin/mod.rs b/font/src/darwin/mod.rs
index 0e694f16..60b1a3e7 100644
--- a/font/src/darwin/mod.rs
+++ b/font/src/darwin/mod.rs
@@ -101,9 +101,9 @@ pub enum Error {
impl ::std::error::Error for Error {
fn description(&self) -> &str {
match *self {
- Error::MissingGlyph(ref _c) => "couldn't find the requested glyph",
- Error::MissingFont(ref _desc) => "couldn't find the requested font",
- Error::FontNotLoaded => "tried to operate on font that hasn't been loaded",
+ Error::MissingGlyph(ref _c) => "Couldn't find the requested glyph",
+ Error::MissingFont(ref _desc) => "Couldn't find the requested font",
+ Error::FontNotLoaded => "Tried to operate on font that hasn't been loaded",
}
}
}
@@ -129,7 +129,6 @@ impl ::Rasterize for Rasterizer {
type Err = Error;
fn new(device_pixel_ratio: f32, use_thin_strokes: bool) -> Result<Rasterizer, Error> {
- info!("device_pixel_ratio: {}", device_pixel_ratio);
Ok(Rasterizer {
fonts: HashMap::new(),
keys: HashMap::new(),
@@ -332,7 +331,7 @@ fn cascade_list_for_languages(
pub fn descriptors_for_family(family: &str) -> Vec<Descriptor> {
let mut out = Vec::new();
- info!("family: {}", family);
+ trace!("Family: {}", family);
let ct_collection = match create_for_family(family) {
Some(c) => c,
None => return out,
@@ -627,7 +626,7 @@ mod tests {
fn get_descriptors_and_build_font() {
let list = super::descriptors_for_family("Menlo");
assert!(!list.is_empty());
- info!("{:?}", list);
+ println!("{:?}", list);
// Check to_font
let fonts = list.iter()
diff --git a/font/src/ft/fc/font_set.rs b/font/src/ft/fc/font_set.rs
index 6b63f439..4eccd487 100644
--- a/font/src/ft/fc/font_set.rs
+++ b/font/src/ft/fc/font_set.rs
@@ -63,7 +63,7 @@ impl<'a> IntoIterator for &'a FontSet {
(*self.as_ptr()).nfont as isize
};
- info!("num fonts = {}", num_fonts);
+ trace!("Number of fonts is {}", num_fonts);
Iter {
font_set: self.deref(),
@@ -81,7 +81,7 @@ impl<'a> IntoIterator for &'a FontSetRef {
(*self.as_ptr()).nfont as isize
};
- info!("num fonts = {}", num_fonts);
+ trace!("Number of fonts is {}", num_fonts);
Iter {
font_set: self,
diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs
index 1d375295..6bcda2a1 100644
--- a/font/src/ft/mod.rs
+++ b/font/src/ft/mod.rs
@@ -117,7 +117,7 @@ impl ::Rasterize for FreeTypeRasterizer {
},
_ => {
// Fallback if font doesn't provide info about strikeout
- trace!("No strikeout data available for font, using fallback.");
+ trace!("Using fallback strikeout metrics");
let strikeout_position = height as f32 / 2. + descent;
(strikeout_position, underline_thickness)
},
@@ -267,7 +267,7 @@ impl FreeTypeRasterizer {
return Ok(Some(*key));
}
- trace!("got font path={:?}", path);
+ trace!("Got font path={:?}", path);
let ft_face = self.library.new_face(&path, index)?;
// Get available pixel sizes if font isn't scalable.
@@ -550,12 +550,12 @@ impl FreeTypeRasterizer {
// We've previously loaded this font, so don't
// load it again.
Some(&key) => {
- debug!("Hit for font {:?}; no need to load.", path);
+ debug!("Hit for font {:?}; no need to load", path);
Ok(key)
},
None => {
- debug!("Miss for font {:?}; loading now.", path);
+ debug!("Miss for font {:?}; loading now", path);
// Safe to unwrap the option since we've already checked for the path
// and index above.
let key = self.face_from_pattern(&pattern)?.unwrap();
@@ -604,9 +604,9 @@ impl ::std::error::Error for Error {
fn description(&self) -> &str {
match *self {
Error::FreeType(ref err) => err.description(),
- Error::MissingFont(ref _desc) => "couldn't find the requested font",
- Error::FontNotLoaded => "tried to operate on font that hasn't been loaded",
- Error::MissingSizeMetrics => "tried to get size metrics from a face without a size",
+ Error::MissingFont(ref _desc) => "Couldn't find the requested font",
+ Error::FontNotLoaded => "Tried to operate on font that hasn't been loaded",
+ Error::MissingSizeMetrics => "Tried to get size metrics from a face without a size",
}
}
}
diff --git a/font/src/lib.rs b/font/src/lib.rs
index fdba4b87..6fc418dd 100644
--- a/font/src/lib.rs
+++ b/font/src/lib.rs
@@ -132,7 +132,7 @@ impl FontDesc {
impl fmt::Display for FontDesc {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "name '{}' and style '{}'", self.name, self.style)
+ write!(f, "name {} and style {}", self.name, self.style)
}
}
diff --git a/font/src/rusttype/mod.rs b/font/src/rusttype/mod.rs
index bd4b8df1..add23605 100644
--- a/font/src/rusttype/mod.rs
+++ b/font/src/rusttype/mod.rs
@@ -166,10 +166,10 @@ pub enum Error {
impl ::std::error::Error for Error {
fn description(&self) -> &str {
match *self {
- Error::MissingFont(ref _desc) => "couldn't find the requested font",
- Error::UnsupportedFont => "only TrueType fonts are supported",
- Error::UnsupportedStyle => "the selected style is not supported by rusttype",
- Error::MissingGlyph => "the selected font did not have the requested glyph",
+ Error::MissingFont(ref _desc) => "Couldn't find the requested font",
+ Error::UnsupportedFont => "Only TrueType fonts are supported",
+ Error::UnsupportedStyle => "The selected style is not supported by rusttype",
+ Error::MissingGlyph => "The selected font does not have the requested glyph",
}
}
}