зеркало из https://github.com/mozilla/gecko-dev.git
servo: Add true_type_tag utility function
Source-Repo: https://github.com/servo/servo Source-Revision: 973c7076c00379435cab6f78bd01ff6d027d3d81
This commit is contained in:
Родитель
4e3d93a612
Коммит
1c5c808b3d
|
@ -84,6 +84,7 @@ mod text {
|
|||
#[cfg(target_os = "linux")]
|
||||
mod ft_native_font;
|
||||
}
|
||||
mod util;
|
||||
}
|
||||
|
||||
mod util {
|
||||
|
|
|
@ -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;
|
||||
}
|
Загрузка…
Ссылка в новой задаче