Vendor things
This commit is contained in:
parent
5deceec006
commit
977e3c17e5
19434 changed files with 10682014 additions and 0 deletions
19
third-party/vendor/owned_ttf_parser/tests/face_mut.rs
vendored
Normal file
19
third-party/vendor/owned_ttf_parser/tests/face_mut.rs
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
//! Tests for the FaceMut trait.
|
||||
use owned_ttf_parser::{AsFaceRef, FaceMut, OwnedFace};
|
||||
|
||||
const VFONT: &[u8] = include_bytes!("../fonts/Cantarell-VF.otf");
|
||||
|
||||
#[test]
|
||||
fn set_variation() {
|
||||
let mut face = OwnedFace::from_vec(VFONT.to_vec(), 0).unwrap();
|
||||
let axis = face.as_face_ref().variation_axes().get(0).unwrap();
|
||||
let def_coord = face.as_face_ref().variation_coordinates()[0];
|
||||
|
||||
// after setting variation on the owned face it should change
|
||||
let new_value = axis.def_value + 100.0;
|
||||
face.set_variation(axis.tag, new_value)
|
||||
.expect("Should be some");
|
||||
|
||||
let coord = face.as_face_ref().variation_coordinates()[0];
|
||||
assert!(coord.get() > def_coord.get());
|
||||
}
|
||||
16
third-party/vendor/owned_ttf_parser/tests/owned_ttf.rs
vendored
Normal file
16
third-party/vendor/owned_ttf_parser/tests/owned_ttf.rs
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
use owned_ttf_parser::{AsFaceRef, OwnedFace};
|
||||
|
||||
const FONT: &[u8] = include_bytes!("../fonts/font.ttf");
|
||||
|
||||
#[test]
|
||||
fn move_and_use() {
|
||||
let owned_data = FONT.to_vec();
|
||||
let pin_face = OwnedFace::from_vec(owned_data, 0).unwrap();
|
||||
|
||||
let ascent = pin_face.as_face_ref().ascender();
|
||||
|
||||
// force a move
|
||||
let moved = Box::new(pin_face);
|
||||
|
||||
assert_eq!(moved.as_face_ref().ascender(), ascent);
|
||||
}
|
||||
56
third-party/vendor/owned_ttf_parser/tests/preparse.rs
vendored
Normal file
56
third-party/vendor/owned_ttf_parser/tests/preparse.rs
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
use owned_ttf_parser::{AsFaceRef, GlyphId, PreParsedSubtables};
|
||||
|
||||
const FONT: &[u8] = include_bytes!("../fonts/font.ttf");
|
||||
const EMOJI_FONT: &[u8] = include_bytes!("../fonts/NotoColorEmoji-Partial.ttf");
|
||||
|
||||
#[test]
|
||||
fn preparse_glyph_index() {
|
||||
let face = owned_ttf_parser::Face::parse(FONT, 0).unwrap();
|
||||
|
||||
let pre_parse = PreParsedSubtables::from(face.clone());
|
||||
|
||||
assert_eq!(pre_parse.glyph_index('x'), face.glyph_index('x'));
|
||||
|
||||
assert_eq!(
|
||||
pre_parse.as_face_ref().glyph_index('x'),
|
||||
face.glyph_index('x')
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn preparse_glyph_variation_index() {
|
||||
let face = owned_ttf_parser::Face::parse(EMOJI_FONT, 0).unwrap();
|
||||
|
||||
let pre_parse = PreParsedSubtables::from(face.clone());
|
||||
|
||||
assert_eq!(
|
||||
pre_parse.glyph_variation_index('#', '\u{FE0F}'),
|
||||
face.glyph_variation_index('#', '\u{FE0F}')
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
pre_parse
|
||||
.as_face_ref()
|
||||
.glyph_variation_index('#', '\u{FE0F}'),
|
||||
face.glyph_variation_index('#', '\u{FE0F}')
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn preparse_glyphs_kerning() {
|
||||
let face = owned_ttf_parser::Face::parse(FONT, 0).unwrap();
|
||||
|
||||
let pre_parse = PreParsedSubtables::from(face.clone());
|
||||
|
||||
let (a, b) = (GlyphId(92), GlyphId(93));
|
||||
|
||||
assert_eq!(
|
||||
pre_parse.glyphs_hor_kerning(a, b),
|
||||
face.tables()
|
||||
.kern
|
||||
.iter()
|
||||
.flat_map(|c| c.subtables)
|
||||
.filter(|st| st.horizontal && !st.variable)
|
||||
.find_map(|st| st.glyphs_kerning(a, b))
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue