Skip to content

Commit 5e25952

Browse files
committed
new check: 'opentype/dsig'
"The font should not need a DSIG table anymore." Added to the OpenType profile. ported from https://github.com/fonttools/fontbakery/blob/33632eba19c5b8a9f75f4ce268db7dd7f987e44c/Lib/fontbakery/checks/opentype/dsig.py#L6-L39 (original proposal: fonttools/fontbakery#3398)
1 parent 99231d0 commit 5e25952

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

profile-universal/src/checks/dsig.rs

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
}

profile-universal/src/checks/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pub mod arabic_spacing_symbols;
22
pub mod bold_italic_unique;
33
pub mod code_pages;
4+
pub mod dsig;
45
pub mod fvar;
56
pub mod glyphnames;
67
pub mod hhea;

profile-universal/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ impl fontspector_checkapi::Plugin for Universal {
88
fn register(&self, cr: &mut Registry) -> Result<(), String> {
99
cr.register_check(checks::arabic_spacing_symbols::arabic_spacing_symbols);
1010
cr.register_check(checks::code_pages::code_pages);
11+
cr.register_check(checks::dsig::dsig);
1112
cr.register_check(checks::fvar::axis_ranges_correct);
1213
cr.register_check(checks::fvar::regular_coords_correct);
1314
cr.register_check(checks::glyphnames::valid_glyphnames);

0 commit comments

Comments
 (0)