Slightly shorten the loadedName
-ids used with font-substitutions
Generally we try to keep the ids that we create short, hence we can slightly shorten the "static" part of them.
This commit is contained in:
parent
3be66f59d6
commit
04de155aaa
@ -400,8 +400,6 @@ function getFontSubstitution(
|
||||
baseFontName,
|
||||
standardFontName
|
||||
) {
|
||||
let mustAddBaseFont = false;
|
||||
|
||||
// It's possible to have a font name with spaces, commas or dashes, hence we
|
||||
// just replace them by a dash.
|
||||
baseFontName = normalizeFontName(baseFontName);
|
||||
@ -426,13 +424,14 @@ function getFontSubstitution(
|
||||
}
|
||||
}
|
||||
|
||||
let mustAddBaseFont = false;
|
||||
if (!substitution) {
|
||||
// If not, check if we've a substitution for the standard font.
|
||||
substitution = substitutionMap.get(standardFontName);
|
||||
mustAddBaseFont = true;
|
||||
}
|
||||
|
||||
const loadedName = `${idFactory.getDocId()}_sf_${idFactory.createFontId()}`;
|
||||
const loadedName = `${idFactory.getDocId()}_s${idFactory.createFontId()}`;
|
||||
if (!substitution) {
|
||||
if (!validateFontName(baseFontName)) {
|
||||
systemFontCache.set(key, null);
|
||||
|
@ -40,7 +40,7 @@ describe("getFontSubstitution", function () {
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf_f(\d+)$/);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf(\d+)$/);
|
||||
});
|
||||
|
||||
it("should substitute an unknown bold font", () => {
|
||||
@ -63,7 +63,7 @@ describe("getFontSubstitution", function () {
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf_f(\d+)$/);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf(\d+)$/);
|
||||
});
|
||||
|
||||
it("should substitute an unknown italic font", () => {
|
||||
@ -86,7 +86,7 @@ describe("getFontSubstitution", function () {
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf_f(\d+)$/);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf(\d+)$/);
|
||||
});
|
||||
|
||||
it("should substitute an unknown bold italic font", () => {
|
||||
@ -109,7 +109,7 @@ describe("getFontSubstitution", function () {
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf_f(\d+)$/);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf(\d+)$/);
|
||||
});
|
||||
|
||||
it("should substitute an unknown font but with a standard font", () => {
|
||||
@ -140,7 +140,7 @@ describe("getFontSubstitution", function () {
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf_f(\d+),sans-serif$/);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf(\d+),sans-serif$/);
|
||||
});
|
||||
|
||||
it("should substitute an unknown font but with a standard italic font", () => {
|
||||
@ -173,7 +173,7 @@ describe("getFontSubstitution", function () {
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf_f(\d+),sans-serif$/);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf(\d+),sans-serif$/);
|
||||
});
|
||||
|
||||
it("should substitute an unknown font but with a standard bold font", () => {
|
||||
@ -205,7 +205,7 @@ describe("getFontSubstitution", function () {
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf_f(\d+),sans-serif$/);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf(\d+),sans-serif$/);
|
||||
});
|
||||
|
||||
it("should substitute an unknown font but with a standard bold italic font", () => {
|
||||
@ -240,7 +240,7 @@ describe("getFontSubstitution", function () {
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf_f(\d+),sans-serif$/);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf(\d+),sans-serif$/);
|
||||
});
|
||||
|
||||
it("should substitute Calibri", () => {
|
||||
@ -271,7 +271,7 @@ describe("getFontSubstitution", function () {
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf_f(\d+),sans-serif$/);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf(\d+),sans-serif$/);
|
||||
});
|
||||
|
||||
it("should substitute Calibri-Bold", () => {
|
||||
@ -304,7 +304,7 @@ describe("getFontSubstitution", function () {
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf_f(\d+),sans-serif$/);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf(\d+),sans-serif$/);
|
||||
});
|
||||
|
||||
it("should substitute Arial Black", () => {
|
||||
@ -337,7 +337,7 @@ describe("getFontSubstitution", function () {
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf_f(\d+),sans-serif$/);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf(\d+),sans-serif$/);
|
||||
});
|
||||
|
||||
it("should substitute Arial Black Bold", () => {
|
||||
@ -370,6 +370,6 @@ describe("getFontSubstitution", function () {
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf_f(\d+),sans-serif$/);
|
||||
expect(fontSubstitution.css).toMatch(/^g_d(\d+)_sf(\d+),sans-serif$/);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user