mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Write a macro or syntax extension to generate OpenType tags
Fixes #4556
This commit is contained in:
parent
31627bdc9d
commit
9fe39951b0
2 changed files with 8 additions and 18 deletions
|
@ -128,20 +128,6 @@ pub fn fixed_to_rounded_int(before: int, f: i32) -> int {
|
|||
}
|
||||
}
|
||||
|
||||
/* Generate a 32-bit TrueType tag from its 4 characters */
|
||||
pub fn true_type_tag(a: char, b: char, c: char, d: char) -> u32 {
|
||||
let a = a as u32;
|
||||
let b = b as u32;
|
||||
let c = c as u32;
|
||||
let d = d as u32;
|
||||
(a << 24 | b << 16 | c << 8 | d) as u32
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_true_type_tag() {
|
||||
assert_eq!(true_type_tag('c', 'm', 'a', 'p'), 0x_63_6D_61_70_u32);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_transform_compress_none() {
|
||||
let test_strs = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue