Skip to content

Commit

Permalink
Warning gardening
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Nov 25, 2024
1 parent 39804bc commit b016691
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 22 deletions.
2 changes: 1 addition & 1 deletion shaperglot-cli/src/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn check_command(args: &CheckArgs, language_database: shaperglot::Languages)
let mut fixes_required = HashMap::new();
for language in args.languages.iter() {
if let Some(language) = language_database.get_language(language) {
let results = checker.check(language, false);
let results = checker.check(language);
if args.json {
println!("{}", serde_json::to_string(&results).unwrap());
continue;
Expand Down
10 changes: 3 additions & 7 deletions shaperglot-cli/src/report.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
use clap::Args;
use itertools::Itertools;
use shaperglot::{Checker, Reporter};
use std::{
collections::{HashMap, HashSet},
path::PathBuf,
};
use shaperglot::Checker;
use std::path::PathBuf;

#[derive(Args)]
pub struct ReportArgs {
Expand Down Expand Up @@ -39,7 +35,7 @@ pub fn report_command(args: &ReportArgs, language_database: shaperglot::Language
continue;
}
}
let results = checker.check(language, false);
let results = checker.check(language);
if results.is_unknown() {
continue;
}
Expand Down
19 changes: 10 additions & 9 deletions shaperglot-lib/src/checker.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{
collections::BTreeMap,
sync::{Arc, Mutex},
// sync::{Arc, Mutex},
};

use crate::{font::glyph_names, language::Language, reporter::Reporter};
Expand All @@ -13,7 +13,7 @@ pub struct Checker<'a> {
pub glyph_names: Vec<String>,
pub cmap: BTreeMap<u32, GlyphId>,
reversed_cmap: BTreeMap<GlyphId, u32>,
full_reversed_cmap: Arc<Mutex<Option<BTreeMap<GlyphId, u32>>>>,
// full_reversed_cmap: Arc<Mutex<Option<BTreeMap<GlyphId, u32>>>>,
}

impl<'a> Checker<'a> {
Expand All @@ -29,19 +29,20 @@ impl<'a> Checker<'a> {
cmap,
face,
reversed_cmap,
full_reversed_cmap: Arc::new(Mutex::new(None)),
// full_reversed_cmap: Arc::new(Mutex::new(None)),
})
}

pub fn codepoint_for(&self, gid: GlyphId) -> Option<u32> {
self.reversed_cmap.get(&gid).copied().or_else(||
// if !self.full_reversed_cmap.is_some() {
// self.full_reversed_cmap = Some(self.font.charmap().mappings().collect());
// }
None)
// self.reversed_cmap.get(&gid).copied().or_else(||
// if !self.full_reversed_cmap.is_some() {
// self.full_reversed_cmap = Some(self.font.charmap().mappings().collect());
// }
// None)
self.reversed_cmap.get(&gid).copied()
}

pub fn check(&self, language: &Language, fail_fast: bool) -> Reporter {
pub fn check(&self, language: &Language) -> Reporter {
let mut results = Reporter::default();
for check_object in language.checks.iter() {
// let toml = toml::to_string(&check_object).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion shaperglot-lib/src/providers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use itertools::Itertools;
use unicode_properties::{GeneralCategoryGroup, UnicodeGeneralCategory};

mod african_latin;
mod african_latin_constants;
// mod african_latin_constants;

pub trait Provider {
fn checks_for(&self, language: &Language) -> Vec<Check>;
Expand Down
5 changes: 1 addition & 4 deletions shaperglot-web/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use std::collections::HashMap;

use indexmap::IndexMap;
use serde_json::{json, Value};
use skrifa::{setting::VariationSetting, FontRef, GlyphId};
use wasm_bindgen::prelude::*;
extern crate console_error_panic_hook;
use google_fonts_languages::{RegionProto, ScriptProto, REGIONS, SCRIPTS};
Expand Down Expand Up @@ -44,7 +41,7 @@ pub fn check_font(font_data: &[u8]) -> Result<String, JsValue> {
let languages = Languages::new();
let mut results = vec![];
for language in languages.iter() {
let result = checker.check(language, false);
let result = checker.check(language);
if result.is_unknown() {
continue;
}
Expand Down

0 comments on commit b016691

Please sign in to comment.