@contrail/document-util 1.0.8 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Missing Font Families (not in WIDTHS_MAP)
|
|
2
|
+
|
|
3
|
+
Fonts listed below are not in the document-util widths-map. When used, the 1.2x scale factor is applied to computed width to reduce cut-off for wider fonts.
|
|
4
|
+
|
|
5
|
+
## Fonts in WIDTHS_MAP (for reference)
|
|
6
|
+
|
|
7
|
+
andale mono, arial, avenir, avenir next, calibri, comic sans ms, courier, courier new, fantasy, georgia, helvetica, impact, inter, open sans, palatino, quantify, roboto, sans-serif, snell roundhand, tahoma, times new roman, trebuchet ms, verdana, webdings
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Missing from FONTS_FAMILY_PICKLIST (6 fonts)
|
|
12
|
+
|
|
13
|
+
| Font | Status |
|
|
14
|
+
|------|--------|
|
|
15
|
+
| Arial Black | Not in map – uses arial + 1.2x |
|
|
16
|
+
| Arial Narrow | Not in map – uses arial + 1.2x |
|
|
17
|
+
| Arial Rounded MT Bold | Not in map – uses arial + 1.2x |
|
|
18
|
+
| Bradley Hand | Not in map – uses arial + 1.2x |
|
|
19
|
+
| Copperplate | Not in map – uses arial + 1.2x |
|
|
20
|
+
| Playfair Display | Not in map – uses arial + 1.2x |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Missing from CUSTOM_FONTS_FAMILY (zone-specific)
|
|
25
|
+
|
|
26
|
+
### yulia-zone-1, ralph
|
|
27
|
+
Avenir-Light, Avenir Lt Std-Black, Avenir Lt Std-Heavy, Avenir Lt Std-Roman, Gill Sans MT Std Bold, Gill Sans MT Std Light, Gill Sans MT Std Medium, Helvetica Neue Std Medium, Helvetica Neue Std Bold, Helvetica Neue Std Light, DiNMittelschriftStd, Fenice Std Bold, Fenice Std Light, Fenice Std Regular, Fenice Std Ultra, Shelley, Myriad Pro Bold, Myriad Pro Light, Myriad Pro Regular, Alegre Sans, SegoeUI Bold, SegoeUI Light, SegoeUI
|
|
28
|
+
|
|
29
|
+
### brian-dev, new-balance-prod, new-balance-training, demo
|
|
30
|
+
Didot, Gotham
|
|
31
|
+
|
|
32
|
+
### agron
|
|
33
|
+
Denton, Franklin Gothic Condensed, Franklin Gothic Book, AdihausDIN, AdihausDIN-Cn, AdiHaus, AdiHaus-CE, AdiHaus-ROM, AdiHaus-Turk, adineuePROCond-Rounded, adineuePROCondTT, adineueTEXT, AdiHausPS, AdiHausPSCon, adiNeue, adiNeue2013, adiNeueLogos, adineuePRO, adineuePRO-Beta, adineuePROCond, AdiTECH, ITCFranklinGothicStd-BkCp, ITCFranklinGothicStd-Book, ITCFranklinGothicStd-DmCp
|
|
34
|
+
|
|
35
|
+
### nb-legacy-prod
|
|
36
|
+
Arial Nova, Arial Nova Light, Arial Nova Cond, Arial Nova Cond Light, ITC Garamond Condensed Book
|
|
37
|
+
|
|
38
|
+
### michael-kors
|
|
39
|
+
Montserrat
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Other commonly used missing fonts (examples)
|
|
44
|
+
|
|
45
|
+
- Century Gothic Pro Regular
|
|
46
|
+
- Any font not explicitly listed in WIDTHS_MAP
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
*Generated for dynamic text width fix. The 1.2x scale is applied when font is not in map.*
|
|
@@ -17,7 +17,8 @@ class DocumentTextUtil {
|
|
|
17
17
|
const variant = 0 + (sett.bold ? 1 : 0) + (sett.italic ? 2 : 0);
|
|
18
18
|
const map = sett.map || widths_map_1.WIDTHS_MAP;
|
|
19
19
|
const available = Object.keys(map);
|
|
20
|
-
|
|
20
|
+
const fontNotFoundInMap = available.indexOf(font) === -1;
|
|
21
|
+
if (fontNotFoundInMap) {
|
|
21
22
|
if (sett.fallbackFontFamily && available.indexOf(sett.fallbackFontFamily.toLowerCase()) !== -1) {
|
|
22
23
|
font = sett.fallbackFontFamily.toLowerCase();
|
|
23
24
|
}
|
|
@@ -38,7 +39,7 @@ class DocumentTextUtil {
|
|
|
38
39
|
if (/[\x00-\x1F]/.test(char)) {
|
|
39
40
|
return true;
|
|
40
41
|
}
|
|
41
|
-
const widths = map[font][char] || map[font].
|
|
42
|
+
const widths = map[font][char] || map[font].m;
|
|
42
43
|
const width = widths[variant];
|
|
43
44
|
totalWidth += width;
|
|
44
45
|
wordWidth += width;
|
|
@@ -55,6 +56,9 @@ class DocumentTextUtil {
|
|
|
55
56
|
});
|
|
56
57
|
let letterSpacingWidth = sett.letterSpacing ? charLength * sett.letterSpacing : 0;
|
|
57
58
|
let width = Math.ceil(totalWidth * (fontSize / 100) + letterSpacingWidth);
|
|
59
|
+
if (fontNotFoundInMap && (settings === null || settings === void 0 ? void 0 : settings.width) == null) {
|
|
60
|
+
width = Math.ceil(width * 1.2);
|
|
61
|
+
}
|
|
58
62
|
let height = Math.ceil(fontSize * 1.16);
|
|
59
63
|
if ((settings === null || settings === void 0 ? void 0 : settings.width) != null) {
|
|
60
64
|
width = settings.width;
|