|
| 1 | +use fontspector_checkapi::{prelude::*, testfont, FileTypeConvert}; |
| 2 | +use read_fonts::TableProvider; |
| 3 | +use skrifa::Tag; |
| 4 | + |
| 5 | +#[check( |
| 6 | + id = "opentype/dsig", |
| 7 | + title = "The font should not need a DSIG table anymore.", |
| 8 | + rationale = " |
| 9 | + Microsoft Office 2013 and below products expect fonts to have a digital |
| 10 | + signature declared in a DSIG table in order to implement OpenType features. |
| 11 | + The EOL date for Microsoft Office 2013 products was 4/11/2023. |
| 12 | +
|
| 13 | + This issue does not impact Microsoft Office 2016 and above products. It is now considered better to completely remove the table. |
| 14 | +
|
| 15 | + But if you still want your font to support OpenType features on Office 2013, |
| 16 | + then you may find it handy to add a fake signature on a placeholder DSIG table |
| 17 | + by running one of the helper scripts provided at |
| 18 | + https://github.com/googlefonts/gftools |
| 19 | +
|
| 20 | + Reference: https://github.com/fonttools/fontbakery/issues/1845 |
| 21 | + ", |
| 22 | + proposal = "https://github.com/fonttools/fontbakery/issues/3398" |
| 23 | +)] |
| 24 | +fn dsig(t: &Testable, _context: &Context) -> CheckFnResult { |
| 25 | + let f = testfont!(t); |
| 26 | + let dsig_data = f.font().expect_data_for_tag(Tag::new(b"DSIG")); |
| 27 | + if dsig_data.is_ok() { |
| 28 | + Ok(Status::just_one_warn( |
| 29 | + "found-DSIG", |
| 30 | + "This font has a digital signature (DSIG table) which \ |
| 31 | + is only required - even if only a placeholder \ |
| 32 | + - on old programs like MS Office 2013 in order to \ |
| 33 | + work properly.\n\ |
| 34 | + The current recommendation is to completely \ |
| 35 | + remove the DSIG table." |
| 36 | + )) |
| 37 | + } else { |
| 38 | + Ok(Status::just_one_pass()) |
| 39 | + } |
| 40 | +} |
0 commit comments