-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
504 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
mod support; | ||
|
||
use std::io::Result; | ||
use std::path::{Path, PathBuf}; | ||
|
||
use colored::Colorize; | ||
use font::opentype::truetype::Tag; | ||
|
||
fn main() { | ||
let arguments = arguments::parse(std::env::args()).unwrap(); | ||
let path: PathBuf = arguments | ||
.get::<String>("path") | ||
.unwrap_or_else(|| ".".to_string()) | ||
.into(); | ||
let excludes = arguments.get_all::<String>("exclude").unwrap_or_default(); | ||
let excludes = excludes.iter().map(String::as_str).collect::<Vec<_>>(); | ||
support::summarize( | ||
&folder::scan( | ||
&path, | ||
|path| support::filter(path, &[".otf", ".ttf"], &excludes), | ||
process, | ||
(), | ||
arguments.get::<usize>("workers"), | ||
) | ||
.collect::<Vec<_>>(), | ||
); | ||
} | ||
|
||
fn process(path: &Path, _: ()) -> Result<Option<()>> { | ||
use std::io::Write; | ||
|
||
match subprocess(path) { | ||
Ok(result) => { | ||
{ | ||
let path = path | ||
.parent() | ||
.unwrap() | ||
.join(path.file_stem().unwrap()) | ||
.with_extension("txt"); | ||
let mut file = std::fs::File::create(path)?; | ||
write!(file, "{result}")?; | ||
} | ||
eprintln!("{} {path:?}", "[success]".green()); | ||
Ok(Some(())) | ||
} | ||
Err(error) => { | ||
eprintln!("{} {path:?} ({error:?})", "[failure]".red()); | ||
Err(error) | ||
} | ||
} | ||
} | ||
|
||
fn subprocess(path: &Path) -> Result<String> { | ||
use std::fmt::Write; | ||
|
||
let font::File { mut fonts } = font::File::open(path)?; | ||
let mut string = String::new(); | ||
for (feature, value) in fonts[0].features()? { | ||
let feature = Tag::from(feature); | ||
let feature = feature.as_str().unwrap_or("<none>"); | ||
for (script, value) in value.scripts { | ||
let script = Tag::from(script); | ||
let script = script.as_str().unwrap_or("<none>"); | ||
for language in value { | ||
let language = language.map(Tag::from); | ||
let language = language.as_ref().and_then(Tag::as_str).unwrap_or("<none>"); | ||
writeln!(string, "{feature: <10} {script: <10} {language}").unwrap(); | ||
} | ||
} | ||
} | ||
Ok(string) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
124 changes: 124 additions & 0 deletions
124
tests/fixtures/internal/feature/CrimsonText-Regular.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
case DFLT <none> | ||
case latn <none> | ||
case latn AZE | ||
case latn CAT | ||
case latn CRT | ||
case latn KAZ | ||
case latn MOL | ||
case latn ROM | ||
case latn TAT | ||
case latn TRK | ||
ccmp DFLT <none> | ||
ccmp latn <none> | ||
ccmp latn AZE | ||
ccmp latn CAT | ||
ccmp latn CRT | ||
ccmp latn KAZ | ||
ccmp latn MOL | ||
ccmp latn ROM | ||
ccmp latn TAT | ||
ccmp latn TRK | ||
dlig DFLT <none> | ||
dlig latn <none> | ||
dlig latn AZE | ||
dlig latn CAT | ||
dlig latn CRT | ||
dlig latn KAZ | ||
dlig latn MOL | ||
dlig latn ROM | ||
dlig latn TAT | ||
dlig latn TRK | ||
dnom DFLT <none> | ||
dnom latn <none> | ||
dnom latn AZE | ||
dnom latn CAT | ||
dnom latn CRT | ||
dnom latn KAZ | ||
dnom latn MOL | ||
dnom latn ROM | ||
dnom latn TAT | ||
dnom latn TRK | ||
frac DFLT <none> | ||
frac latn <none> | ||
frac latn AZE | ||
frac latn CAT | ||
frac latn CRT | ||
frac latn KAZ | ||
frac latn MOL | ||
frac latn ROM | ||
frac latn TAT | ||
frac latn TRK | ||
kern DFLT <none> | ||
kern latn <none> | ||
liga DFLT <none> | ||
liga latn <none> | ||
liga latn AZE | ||
liga latn CAT | ||
liga latn CRT | ||
liga latn KAZ | ||
liga latn MOL | ||
liga latn ROM | ||
liga latn TAT | ||
liga latn TRK | ||
locl latn AZE | ||
locl latn CAT | ||
locl latn CRT | ||
locl latn KAZ | ||
locl latn MOL | ||
locl latn ROM | ||
locl latn TAT | ||
locl latn TRK | ||
mark DFLT <none> | ||
mark latn <none> | ||
mkmk DFLT <none> | ||
mkmk latn <none> | ||
numr DFLT <none> | ||
numr latn <none> | ||
numr latn AZE | ||
numr latn CAT | ||
numr latn CRT | ||
numr latn KAZ | ||
numr latn MOL | ||
numr latn ROM | ||
numr latn TAT | ||
numr latn TRK | ||
sinf DFLT <none> | ||
sinf latn <none> | ||
sinf latn AZE | ||
sinf latn CAT | ||
sinf latn CRT | ||
sinf latn KAZ | ||
sinf latn MOL | ||
sinf latn ROM | ||
sinf latn TAT | ||
sinf latn TRK | ||
subs DFLT <none> | ||
subs latn <none> | ||
subs latn AZE | ||
subs latn CAT | ||
subs latn CRT | ||
subs latn KAZ | ||
subs latn MOL | ||
subs latn ROM | ||
subs latn TAT | ||
subs latn TRK | ||
sups DFLT <none> | ||
sups latn <none> | ||
sups latn AZE | ||
sups latn CAT | ||
sups latn CRT | ||
sups latn KAZ | ||
sups latn MOL | ||
sups latn ROM | ||
sups latn TAT | ||
sups latn TRK | ||
zero DFLT <none> | ||
zero latn <none> | ||
zero latn AZE | ||
zero latn CAT | ||
zero latn CRT | ||
zero latn KAZ | ||
zero latn MOL | ||
zero latn ROM | ||
zero latn TAT | ||
zero latn TRK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
kern DFLT <none> | ||
kern latn <none> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
liga latn <none> | ||
liga latn MOL | ||
liga latn ROM | ||
lnum latn <none> | ||
lnum latn MOL | ||
lnum latn ROM | ||
locl latn MOL | ||
locl latn ROM | ||
onum latn <none> | ||
onum latn MOL | ||
onum latn ROM | ||
pnum latn <none> | ||
pnum latn MOL | ||
pnum latn ROM | ||
salt latn <none> | ||
salt latn MOL | ||
salt latn ROM | ||
ss01 latn <none> | ||
ss01 latn MOL | ||
ss01 latn ROM | ||
ss02 latn <none> | ||
ss02 latn MOL | ||
ss02 latn ROM | ||
ss03 latn <none> | ||
ss03 latn MOL | ||
ss03 latn ROM | ||
tnum latn <none> | ||
tnum latn MOL | ||
tnum latn ROM |
Empty file.
Oops, something went wrong.