Add true_type_tag utility function

This commit is contained in:
Brian Anderson 2012-06-28 17:13:23 -07:00
parent 47e5d225c9
commit 973c7076c0
2 changed files with 12 additions and 0 deletions

View file

@ -84,6 +84,7 @@ mod text {
#[cfg(target_os = "linux")]
mod ft_native_font;
}
mod util;
}
mod util {

11
src/servo/text/util.rs Normal file
View file

@ -0,0 +1,11 @@
export true_type_tag;
#[doc = "Generate a 32-bit TrueType tag from its 4 charecters"]
fn true_type_tag(a: char, b: char, c: char, d: char) -> u32 {
(a << 24 | b << 16 | c << 8 | d) as u32
}
#[test]
fn test_true_type_tag() {
assert true_type_tag('c', 'm', 'a', 'p') == 0x_63_6D_61_70_u32;
}