@superdoc-dev/fonts 0.1.0

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.
Files changed (83) hide show
  1. package/README.md +78 -0
  2. package/assets/AGPL-3.0.txt +228 -0
  3. package/assets/Apache-2.0.txt +204 -0
  4. package/assets/ArchivoBlack-Regular.woff2 +0 -0
  5. package/assets/BacasimeAntique-Regular.woff2 +0 -0
  6. package/assets/C059-BdIta.woff2 +0 -0
  7. package/assets/C059-Bold.woff2 +0 -0
  8. package/assets/C059-Italic.woff2 +0 -0
  9. package/assets/C059-Roman.woff2 +0 -0
  10. package/assets/Caladea-Bold.woff2 +0 -0
  11. package/assets/Caladea-BoldItalic.woff2 +0 -0
  12. package/assets/Caladea-Italic.woff2 +0 -0
  13. package/assets/Caladea-Regular.woff2 +0 -0
  14. package/assets/Caprasimo-Regular.woff2 +0 -0
  15. package/assets/Cardo-Bold.woff2 +0 -0
  16. package/assets/Cardo-Italic.woff2 +0 -0
  17. package/assets/Cardo-Regular.woff2 +0 -0
  18. package/assets/Carlito-Bold.woff2 +0 -0
  19. package/assets/Carlito-BoldItalic.woff2 +0 -0
  20. package/assets/Carlito-Italic.woff2 +0 -0
  21. package/assets/Carlito-Regular.woff2 +0 -0
  22. package/assets/ComicRelief-Bold.woff2 +0 -0
  23. package/assets/ComicRelief-Regular.woff2 +0 -0
  24. package/assets/GPL-2.0.txt +116 -0
  25. package/assets/GUST-Font-License-1.0.txt +28 -0
  26. package/assets/Gelasio-Bold.woff2 +0 -0
  27. package/assets/Gelasio-BoldItalic.woff2 +0 -0
  28. package/assets/Gelasio-Italic.woff2 +0 -0
  29. package/assets/Gelasio-Regular.woff2 +0 -0
  30. package/assets/InconsolataSemiExpanded-Bold.woff2 +0 -0
  31. package/assets/InconsolataSemiExpanded-Regular.woff2 +0 -0
  32. package/assets/LICENSES.md +309 -0
  33. package/assets/LiberationMono-Bold.woff2 +0 -0
  34. package/assets/LiberationMono-BoldItalic.woff2 +0 -0
  35. package/assets/LiberationMono-Italic.woff2 +0 -0
  36. package/assets/LiberationMono-Regular.woff2 +0 -0
  37. package/assets/LiberationSans-Bold.woff2 +0 -0
  38. package/assets/LiberationSans-BoldItalic.woff2 +0 -0
  39. package/assets/LiberationSans-Italic.woff2 +0 -0
  40. package/assets/LiberationSans-Regular.woff2 +0 -0
  41. package/assets/LiberationSansNarrow-Bold.woff2 +0 -0
  42. package/assets/LiberationSansNarrow-BoldItalic.woff2 +0 -0
  43. package/assets/LiberationSansNarrow-Italic.woff2 +0 -0
  44. package/assets/LiberationSansNarrow-Regular.woff2 +0 -0
  45. package/assets/LiberationSerif-Bold.woff2 +0 -0
  46. package/assets/LiberationSerif-BoldItalic.woff2 +0 -0
  47. package/assets/LiberationSerif-Italic.woff2 +0 -0
  48. package/assets/LiberationSerif-Regular.woff2 +0 -0
  49. package/assets/NotoSans-Bold.woff2 +0 -0
  50. package/assets/NotoSans-BoldItalic.woff2 +0 -0
  51. package/assets/NotoSans-Italic.woff2 +0 -0
  52. package/assets/NotoSans-Regular.woff2 +0 -0
  53. package/assets/NotoSansMono-Bold.woff2 +0 -0
  54. package/assets/NotoSansMono-Regular.woff2 +0 -0
  55. package/assets/OFL.txt +191 -0
  56. package/assets/OreganoItalic-Regular.woff2 +0 -0
  57. package/assets/PTSans-Bold.woff2 +0 -0
  58. package/assets/PTSans-BoldItalic.woff2 +0 -0
  59. package/assets/PTSans-Italic.woff2 +0 -0
  60. package/assets/PTSans-Regular.woff2 +0 -0
  61. package/assets/PTSansNarrow-Bold.woff2 +0 -0
  62. package/assets/PTSansNarrow-Regular.woff2 +0 -0
  63. package/assets/Selawik-Bold.woff2 +0 -0
  64. package/assets/Selawik-Regular.woff2 +0 -0
  65. package/assets/TeXGyreBonum-Bold.woff2 +0 -0
  66. package/assets/TeXGyreBonum-BoldItalic.woff2 +0 -0
  67. package/assets/TeXGyreBonum-Italic.woff2 +0 -0
  68. package/assets/TeXGyreBonum-Regular.woff2 +0 -0
  69. package/assets/URWGothic-Book.woff2 +0 -0
  70. package/assets/URWGothic-BookOblique.woff2 +0 -0
  71. package/assets/URWGothic-Demi.woff2 +0 -0
  72. package/assets/URWGothic-DemiOblique.woff2 +0 -0
  73. package/dist/asset-urls.d.ts +8 -0
  74. package/dist/asset-urls.js +76 -0
  75. package/dist/bundled-families.d.ts +9 -0
  76. package/dist/bundled-families.js +40 -0
  77. package/dist/index.d.ts +100 -0
  78. package/dist/index.js +158 -0
  79. package/package.json +41 -0
  80. package/src/asset-urls.ts +76 -0
  81. package/src/bundled-families.ts +40 -0
  82. package/src/index.test.ts +72 -0
  83. package/src/index.ts +209 -0
package/assets/OFL.txt ADDED
@@ -0,0 +1,191 @@
1
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
2
+
3
+ This is the license text covering the OFL-1.1 fonts bundled in this directory
4
+ (Carlito, Liberation Sans, Liberation Serif, Liberation Mono, Caprasimo,
5
+ Bacasime Antique, Oregano Italic, Gelasio, Cardo, Comic Relief, Noto Sans,
6
+ Selawik, Noto Sans Mono, Inconsolata SemiExpanded, PT Sans, Archivo Black, PT
7
+ Sans Narrow). Copyright notices and any Reserved Font Name statements for those fonts
8
+ are reproduced verbatim below, taken from the fonts' own name tables, so they
9
+ travel with this license text. LICENSES.md restates them for convenience.
10
+ Official OFL text: https://openfontlicense.org/open-font-license-official-text/
11
+
12
+ -----------------------------------------------------------
13
+ COPYRIGHT NOTICES (the "above copyright notice" required by condition 2)
14
+
15
+ Carlito:
16
+ Copyright (c) 2010-2013 by tyPoland Lukasz Dziedzic
17
+ (http://www.typoland.com/) with Reserved Font Name "Carlito".
18
+ Licensed under the SIL Open Font License, Version 1.1.
19
+
20
+ Liberation Sans, Liberation Serif, Liberation Mono:
21
+ Digitized data copyright (c) 2010 Google Corporation.
22
+ Copyright (c) 2012 Red Hat, Inc.
23
+ Licensed under the SIL Open Font License, Version 1.1.
24
+ ("Liberation" is a registered trademark of Red Hat, Inc.; these v2.1.5
25
+ files declare no OFL Reserved Font Name.)
26
+
27
+ Caprasimo:
28
+ Copyright 2023 The Caprasimo Project Authors
29
+ (https://github.com/docrepair-fonts/caprasimo-fonts).
30
+ Licensed under the SIL Open Font License, Version 1.1.
31
+ (This v1.001 file declares no OFL Reserved Font Name.)
32
+
33
+ Archivo Black:
34
+ Copyright 2017 The Archivo Black Project Authors
35
+ (https://github.com/Omnibus-Type/ArchivoBlack).
36
+ Licensed under the SIL Open Font License, Version 1.1.
37
+ (This v1.006 file declares no OFL Reserved Font Name.)
38
+
39
+ Bacasime Antique:
40
+ Copyright 2023 The Bacasime Antique Project Authors
41
+ (https://github.com/docrepair-fonts/bacasime-antique-fonts), with Reserved
42
+ Font Name "Playfair".
43
+ Licensed under the SIL Open Font License, Version 1.1.
44
+
45
+ Oregano Italic:
46
+ Copyright (c) 2012 by Brian J. Bonislawsky DBA Astigmatic (AOETI)
47
+ (astigma@astigmatic.com), with Reserved Font Name "Oregano Italic".
48
+ Licensed under the SIL Open Font License, Version 1.1.
49
+
50
+ Gelasio:
51
+ Copyright 2022 The Gelasio Project Authors
52
+ (https://github.com/SorkinType/Gelasio)
53
+ Licensed under the SIL Open Font License, Version 1.1.
54
+ (These v1.008 files declare no OFL Reserved Font Name.)
55
+
56
+ Cardo:
57
+ Copyright (c) 2002-2011, David J. Perry
58
+ (hospes02@scholarsfonts.net)
59
+ Licensed under the SIL Open Font License, Version 1.1.
60
+ (These files declare no OFL Reserved Font Name.)
61
+
62
+ Comic Relief:
63
+ Copyright 2013 The Comic Relief Project Authors
64
+ (https://github.com/loudifier/Comic-Relief)
65
+ Licensed under the SIL Open Font License, Version 1.1.
66
+ (These v1.200 files declare no OFL Reserved Font Name.)
67
+
68
+ Noto Sans:
69
+ Copyright 2022 The Noto Project Authors
70
+ (https://github.com/notofonts/latin-greek-cyrillic)
71
+ Licensed under the SIL Open Font License, Version 1.1.
72
+ (These v2.015 files declare no OFL Reserved Font Name.)
73
+
74
+ Selawik:
75
+ © 2015 Microsoft Corporation (www.microsoft.com), with Reserved Font Name
76
+ "Selawik". Selawik is a trademark of Microsoft Corporation in the United
77
+ States and/or other countries.
78
+ Licensed under the SIL Open Font License, Version 1.1.
79
+
80
+ Noto Sans Mono:
81
+ Copyright 2022 The Noto Project Authors
82
+ (https://github.com/notofonts/latin-greek-cyrillic)
83
+ Licensed under the SIL Open Font License, Version 1.1.
84
+ (These v2.014 files declare no OFL Reserved Font Name.)
85
+
86
+ Inconsolata SemiExpanded:
87
+ Copyright 2006 The Inconsolata Project Authors
88
+ (https://github.com/cyrealtype/Inconsolata)
89
+ Licensed under the SIL Open Font License, Version 1.1.
90
+ (These v3.001 files declare no OFL Reserved Font Name.)
91
+
92
+ PT Sans:
93
+ Copyright (c) 2010, ParaType Ltd.
94
+ (http://www.paratype.com/public), with Reserved Font Names "PT Sans",
95
+ "PT Serif" and "ParaType".
96
+ Licensed under the SIL Open Font License, Version 1.1.
97
+
98
+ PT Sans Narrow:
99
+ Copyright (c) 2010, ParaType Ltd.
100
+ (http://www.paratype.com/public), with Reserved Font Names "PT Sans",
101
+ "PT Serif" and "ParaType".
102
+ Licensed under the SIL Open Font License, Version 1.1.
103
+
104
+ -----------------------------------------------------------
105
+ PREAMBLE
106
+
107
+ The goals of the Open Font License (OFL) are to stimulate worldwide
108
+ development of collaborative font projects, to support the font creation
109
+ efforts of academic and linguistic communities, and to provide a free and
110
+ open framework in which fonts may be shared and improved in partnership
111
+ with others.
112
+
113
+ The OFL allows the licensed fonts to be used, studied, modified and
114
+ redistributed freely as long as they are not sold by themselves. The
115
+ fonts, including any derivative works, can be bundled, embedded,
116
+ redistributed and/or sold with any software provided that any reserved
117
+ names are not used by derivative works. The fonts and derivatives,
118
+ however, cannot be released under any other type of license. The
119
+ requirement for fonts to remain under this license does not apply
120
+ to any document created using the fonts or their derivatives.
121
+
122
+ DEFINITIONS
123
+
124
+ "Font Software" refers to the set of files released by the Copyright
125
+ Holder(s) under this license and clearly marked as such. This may
126
+ include source files, build scripts and documentation.
127
+
128
+ "Reserved Font Name" refers to any names specified as such after the
129
+ copyright statement(s).
130
+
131
+ "Original Version" refers to the collection of Font Software components as
132
+ distributed by the Copyright Holder(s).
133
+
134
+ "Modified Version" refers to any derivative made by adding to, deleting,
135
+ or substituting -- in part or in whole -- any of the components of the
136
+ Original Version, by changing formats or by porting the Font Software to a
137
+ new environment.
138
+
139
+ "Author" refers to any designer, engineer, programmer, technical
140
+ writer or other person who contributed to the Font Software.
141
+
142
+ PERMISSION & CONDITIONS
143
+
144
+ Permission is hereby granted, free of charge, to any person obtaining
145
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
146
+ redistribute, and sell modified and unmodified copies of the Font
147
+ Software, subject to the following conditions:
148
+
149
+ 1) Neither the Font Software nor any of its individual components,
150
+ in Original or Modified Versions, may be sold by itself.
151
+
152
+ 2) Original or Modified Versions of the Font Software may be bundled,
153
+ redistributed and/or sold with any software, provided that each copy
154
+ contains the above copyright notice and this license. These can be
155
+ included either as stand-alone text files, human-readable headers or
156
+ in the appropriate machine-readable metadata fields within text or
157
+ binary files as long as those fields can be easily viewed by the user.
158
+
159
+ 3) No Modified Version of the Font Software may use the Reserved Font
160
+ Name(s) unless explicit written permission is granted by the corresponding
161
+ Copyright Holder. This restriction only applies to the primary font name as
162
+ presented to the users.
163
+
164
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
165
+ Software shall not be used to promote, endorse or advertise any
166
+ Modified Version, except to acknowledge the contribution(s) of the
167
+ Copyright Holder(s) and the Author(s) or with their explicit written
168
+ permission.
169
+
170
+ 5) The Font Software, modified or unmodified, in part or in whole,
171
+ must be distributed entirely under this license, and must not be
172
+ distributed under any other license. The requirement for fonts to
173
+ remain under this license does not apply to any document created
174
+ using the Font Software.
175
+
176
+ TERMINATION
177
+
178
+ This license becomes null and void if any of the above conditions are
179
+ not met.
180
+
181
+ DISCLAIMER
182
+
183
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
184
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
185
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
186
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
187
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
188
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
189
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
190
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
191
+ OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,8 @@
1
+ /**
2
+ * GENERATED by scripts/generate-asset-urls.mjs - do not edit by hand.
3
+ *
4
+ * Each value is a static `new URL('../assets/<file>', import.meta.url)`, the cross-bundler
5
+ * pattern for "emit this asset and give me its final URL". Bundlers rewrite these at build
6
+ * time; under plain Node ESM they resolve to the file:// path inside the package.
7
+ */
8
+ export declare const BUNDLED_FONT_ASSET_URLS: Readonly<Record<string, string>>;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * GENERATED by scripts/generate-asset-urls.mjs - do not edit by hand.
3
+ *
4
+ * Each value is a static `new URL('../assets/<file>', import.meta.url)`, the cross-bundler
5
+ * pattern for "emit this asset and give me its final URL". Bundlers rewrite these at build
6
+ * time; under plain Node ESM they resolve to the file:// path inside the package.
7
+ */
8
+ export const BUNDLED_FONT_ASSET_URLS = Object.freeze({
9
+ 'ArchivoBlack-Regular.woff2': new URL('../assets/ArchivoBlack-Regular.woff2', import.meta.url).href,
10
+ 'BacasimeAntique-Regular.woff2': new URL('../assets/BacasimeAntique-Regular.woff2', import.meta.url).href,
11
+ 'C059-BdIta.woff2': new URL('../assets/C059-BdIta.woff2', import.meta.url).href,
12
+ 'C059-Bold.woff2': new URL('../assets/C059-Bold.woff2', import.meta.url).href,
13
+ 'C059-Italic.woff2': new URL('../assets/C059-Italic.woff2', import.meta.url).href,
14
+ 'C059-Roman.woff2': new URL('../assets/C059-Roman.woff2', import.meta.url).href,
15
+ 'Caladea-Bold.woff2': new URL('../assets/Caladea-Bold.woff2', import.meta.url).href,
16
+ 'Caladea-BoldItalic.woff2': new URL('../assets/Caladea-BoldItalic.woff2', import.meta.url).href,
17
+ 'Caladea-Italic.woff2': new URL('../assets/Caladea-Italic.woff2', import.meta.url).href,
18
+ 'Caladea-Regular.woff2': new URL('../assets/Caladea-Regular.woff2', import.meta.url).href,
19
+ 'Caprasimo-Regular.woff2': new URL('../assets/Caprasimo-Regular.woff2', import.meta.url).href,
20
+ 'Cardo-Bold.woff2': new URL('../assets/Cardo-Bold.woff2', import.meta.url).href,
21
+ 'Cardo-Italic.woff2': new URL('../assets/Cardo-Italic.woff2', import.meta.url).href,
22
+ 'Cardo-Regular.woff2': new URL('../assets/Cardo-Regular.woff2', import.meta.url).href,
23
+ 'Carlito-Bold.woff2': new URL('../assets/Carlito-Bold.woff2', import.meta.url).href,
24
+ 'Carlito-BoldItalic.woff2': new URL('../assets/Carlito-BoldItalic.woff2', import.meta.url).href,
25
+ 'Carlito-Italic.woff2': new URL('../assets/Carlito-Italic.woff2', import.meta.url).href,
26
+ 'Carlito-Regular.woff2': new URL('../assets/Carlito-Regular.woff2', import.meta.url).href,
27
+ 'ComicRelief-Bold.woff2': new URL('../assets/ComicRelief-Bold.woff2', import.meta.url).href,
28
+ 'ComicRelief-Regular.woff2': new URL('../assets/ComicRelief-Regular.woff2', import.meta.url).href,
29
+ 'Gelasio-Bold.woff2': new URL('../assets/Gelasio-Bold.woff2', import.meta.url).href,
30
+ 'Gelasio-BoldItalic.woff2': new URL('../assets/Gelasio-BoldItalic.woff2', import.meta.url).href,
31
+ 'Gelasio-Italic.woff2': new URL('../assets/Gelasio-Italic.woff2', import.meta.url).href,
32
+ 'Gelasio-Regular.woff2': new URL('../assets/Gelasio-Regular.woff2', import.meta.url).href,
33
+ 'InconsolataSemiExpanded-Bold.woff2': new URL('../assets/InconsolataSemiExpanded-Bold.woff2', import.meta.url).href,
34
+ 'InconsolataSemiExpanded-Regular.woff2': new URL('../assets/InconsolataSemiExpanded-Regular.woff2', import.meta.url)
35
+ .href,
36
+ 'LiberationMono-Bold.woff2': new URL('../assets/LiberationMono-Bold.woff2', import.meta.url).href,
37
+ 'LiberationMono-BoldItalic.woff2': new URL('../assets/LiberationMono-BoldItalic.woff2', import.meta.url).href,
38
+ 'LiberationMono-Italic.woff2': new URL('../assets/LiberationMono-Italic.woff2', import.meta.url).href,
39
+ 'LiberationMono-Regular.woff2': new URL('../assets/LiberationMono-Regular.woff2', import.meta.url).href,
40
+ 'LiberationSans-Bold.woff2': new URL('../assets/LiberationSans-Bold.woff2', import.meta.url).href,
41
+ 'LiberationSans-BoldItalic.woff2': new URL('../assets/LiberationSans-BoldItalic.woff2', import.meta.url).href,
42
+ 'LiberationSans-Italic.woff2': new URL('../assets/LiberationSans-Italic.woff2', import.meta.url).href,
43
+ 'LiberationSans-Regular.woff2': new URL('../assets/LiberationSans-Regular.woff2', import.meta.url).href,
44
+ 'LiberationSansNarrow-Bold.woff2': new URL('../assets/LiberationSansNarrow-Bold.woff2', import.meta.url).href,
45
+ 'LiberationSansNarrow-BoldItalic.woff2': new URL('../assets/LiberationSansNarrow-BoldItalic.woff2', import.meta.url)
46
+ .href,
47
+ 'LiberationSansNarrow-Italic.woff2': new URL('../assets/LiberationSansNarrow-Italic.woff2', import.meta.url).href,
48
+ 'LiberationSansNarrow-Regular.woff2': new URL('../assets/LiberationSansNarrow-Regular.woff2', import.meta.url).href,
49
+ 'LiberationSerif-Bold.woff2': new URL('../assets/LiberationSerif-Bold.woff2', import.meta.url).href,
50
+ 'LiberationSerif-BoldItalic.woff2': new URL('../assets/LiberationSerif-BoldItalic.woff2', import.meta.url).href,
51
+ 'LiberationSerif-Italic.woff2': new URL('../assets/LiberationSerif-Italic.woff2', import.meta.url).href,
52
+ 'LiberationSerif-Regular.woff2': new URL('../assets/LiberationSerif-Regular.woff2', import.meta.url).href,
53
+ 'NotoSans-Bold.woff2': new URL('../assets/NotoSans-Bold.woff2', import.meta.url).href,
54
+ 'NotoSans-BoldItalic.woff2': new URL('../assets/NotoSans-BoldItalic.woff2', import.meta.url).href,
55
+ 'NotoSans-Italic.woff2': new URL('../assets/NotoSans-Italic.woff2', import.meta.url).href,
56
+ 'NotoSans-Regular.woff2': new URL('../assets/NotoSans-Regular.woff2', import.meta.url).href,
57
+ 'NotoSansMono-Bold.woff2': new URL('../assets/NotoSansMono-Bold.woff2', import.meta.url).href,
58
+ 'NotoSansMono-Regular.woff2': new URL('../assets/NotoSansMono-Regular.woff2', import.meta.url).href,
59
+ 'OreganoItalic-Regular.woff2': new URL('../assets/OreganoItalic-Regular.woff2', import.meta.url).href,
60
+ 'PTSans-Bold.woff2': new URL('../assets/PTSans-Bold.woff2', import.meta.url).href,
61
+ 'PTSans-BoldItalic.woff2': new URL('../assets/PTSans-BoldItalic.woff2', import.meta.url).href,
62
+ 'PTSans-Italic.woff2': new URL('../assets/PTSans-Italic.woff2', import.meta.url).href,
63
+ 'PTSans-Regular.woff2': new URL('../assets/PTSans-Regular.woff2', import.meta.url).href,
64
+ 'PTSansNarrow-Bold.woff2': new URL('../assets/PTSansNarrow-Bold.woff2', import.meta.url).href,
65
+ 'PTSansNarrow-Regular.woff2': new URL('../assets/PTSansNarrow-Regular.woff2', import.meta.url).href,
66
+ 'Selawik-Bold.woff2': new URL('../assets/Selawik-Bold.woff2', import.meta.url).href,
67
+ 'Selawik-Regular.woff2': new URL('../assets/Selawik-Regular.woff2', import.meta.url).href,
68
+ 'TeXGyreBonum-Bold.woff2': new URL('../assets/TeXGyreBonum-Bold.woff2', import.meta.url).href,
69
+ 'TeXGyreBonum-BoldItalic.woff2': new URL('../assets/TeXGyreBonum-BoldItalic.woff2', import.meta.url).href,
70
+ 'TeXGyreBonum-Italic.woff2': new URL('../assets/TeXGyreBonum-Italic.woff2', import.meta.url).href,
71
+ 'TeXGyreBonum-Regular.woff2': new URL('../assets/TeXGyreBonum-Regular.woff2', import.meta.url).href,
72
+ 'URWGothic-Book.woff2': new URL('../assets/URWGothic-Book.woff2', import.meta.url).href,
73
+ 'URWGothic-BookOblique.woff2': new URL('../assets/URWGothic-BookOblique.woff2', import.meta.url).href,
74
+ 'URWGothic-Demi.woff2': new URL('../assets/URWGothic-Demi.woff2', import.meta.url).href,
75
+ 'URWGothic-DemiOblique.woff2': new URL('../assets/URWGothic-DemiOblique.woff2', import.meta.url).href,
76
+ });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * GENERATED by scripts/generate-bundled-families.ts - do not edit by hand.
3
+ *
4
+ * The Word family names a document can curate via createSuperDocFonts({ include / exclude }), mirrored
5
+ * from @superdoc/font-system's runtime curation set (every logical family the resolver substitutes to a
6
+ * bundled face, including category fallbacks like Verdana). A name outside this set is a typo or an
7
+ * unbundled font, so createSuperDocFonts rejects it instead of silently dropping the intended fonts.
8
+ */
9
+ export declare const BUNDLED_FAMILY_NAMES: readonly string[];
@@ -0,0 +1,40 @@
1
+ /**
2
+ * GENERATED by scripts/generate-bundled-families.ts - do not edit by hand.
3
+ *
4
+ * The Word family names a document can curate via createSuperDocFonts({ include / exclude }), mirrored
5
+ * from @superdoc/font-system's runtime curation set (every logical family the resolver substitutes to a
6
+ * bundled face, including category fallbacks like Verdana). A name outside this set is a typo or an
7
+ * unbundled font, so createSuperDocFonts rejects it instead of silently dropping the intended fonts.
8
+ */
9
+ export const BUNDLED_FAMILY_NAMES = Object.freeze([
10
+ 'Arial',
11
+ 'Arial Black',
12
+ 'Arial MT',
13
+ 'Arial Narrow',
14
+ 'Baskerville Old Face',
15
+ 'Bookman Old Style',
16
+ 'Brush Script MT',
17
+ 'Calibri',
18
+ 'Calibri Light',
19
+ 'Cambria',
20
+ 'Century',
21
+ 'Century Gothic',
22
+ 'Century Schoolbook',
23
+ 'Comic Sans MS',
24
+ 'Consolas',
25
+ 'Cooper Black',
26
+ 'Courier',
27
+ 'Courier New',
28
+ 'Garamond',
29
+ 'Georgia',
30
+ 'Gill Sans MT Condensed',
31
+ 'Helvetica',
32
+ 'ITC Bookman',
33
+ 'Lucida Console',
34
+ 'Segoe UI',
35
+ 'Tahoma',
36
+ 'Times',
37
+ 'Times New Roman',
38
+ 'Trebuchet MS',
39
+ 'Verdana',
40
+ ]);
@@ -0,0 +1,100 @@
1
+ /**
2
+ * `@superdoc-dev/fonts` - the reviewed metric-compatible font substitutes SuperDoc renders for
3
+ * proprietary Word fonts (Carlito for Calibri, Liberation Serif for Times New Roman, etc.).
4
+ *
5
+ * Optional: install it to make the bundled fallbacks load automatically in any bundler app, with
6
+ * no copy step and no `assetBaseUrl`. The asset URLs are written as
7
+ * `new URL('../assets/<file>', import.meta.url)`, which Vite, Webpack 5, Next, Nuxt, esbuild, and
8
+ * Parcel detect, emit, and rewrite to the final hashed path.
9
+ *
10
+ * @beta This package is in preview; its surface may change before 1.0.
11
+ */
12
+ import { BUNDLED_FONT_ASSET_URLS } from './asset-urls';
13
+ /**
14
+ * The full filename -> bundler-emitted URL map for every bundled face. Most consumers use
15
+ * {@link superdocFonts} or {@link resolveBundledFontAssetUrl} instead of reading this directly.
16
+ *
17
+ * @beta
18
+ */
19
+ export { BUNDLED_FONT_ASSET_URLS };
20
+ /**
21
+ * Minimal structural shape of SuperDoc's bundled-font asset context. Kept LOCAL so this
22
+ * package has no dependency on `@superdoc/font-system`; only `file` is read. Assignable to
23
+ * SuperDoc's `FontAssetUrlResolver` by structural typing.
24
+ *
25
+ * @beta
26
+ */
27
+ export interface BundledFontAssetContext {
28
+ /** Asset filename, e.g. `Carlito-Regular.woff2`. */
29
+ file: string;
30
+ family?: string;
31
+ weight?: string;
32
+ style?: 'normal' | 'italic';
33
+ source?: string;
34
+ }
35
+ /**
36
+ * Resolve a bundled substitute face filename to a bundler-emitted URL.
37
+ *
38
+ * Pass as SuperDoc's `fonts.resolveAssetUrl` so the reviewed fallback pack loads from THIS
39
+ * package's emitted assets, with no manual copy step and no `assetBaseUrl`:
40
+ *
41
+ * import { resolveBundledFontAssetUrl } from '@superdoc-dev/fonts';
42
+ * new SuperDoc({ selector: '#editor', document, fonts: { resolveAssetUrl: resolveBundledFontAssetUrl } });
43
+ *
44
+ * Throws on an unknown file, which signals a version mismatch between `@superdoc-dev/fonts` and
45
+ * the `superdoc` core manifest rather than silently degrading to the logical font name.
46
+ *
47
+ * @beta
48
+ */
49
+ export declare function resolveBundledFontAssetUrl(context: BundledFontAssetContext): string;
50
+ /**
51
+ * Drop-in value for SuperDoc's `fonts` config: `new SuperDoc({ fonts: superdocFonts })`.
52
+ * Equivalent to `{ resolveAssetUrl: resolveBundledFontAssetUrl }`.
53
+ *
54
+ * @beta
55
+ */
56
+ export declare const superdocFonts: {
57
+ resolveAssetUrl: (context: BundledFontAssetContext) => string;
58
+ };
59
+ /**
60
+ * Choose which bundled families SuperDoc advertises and renders, by LOGICAL Word family name
61
+ * (`"Calibri"`, never the physical `"Carlito"`).
62
+ *
63
+ * @beta
64
+ */
65
+ export interface SuperDocFontsOptions {
66
+ /** Allow-list: ONLY these logical families are active, e.g. `['Calibri', 'Cambria']`. */
67
+ include?: string[];
68
+ /** Block-list: every bundled family EXCEPT these, e.g. `['Cooper Black', 'Brush Script MT']`. */
69
+ exclude?: string[];
70
+ }
71
+ /**
72
+ * The `fonts` config {@link createSuperDocFonts} returns: the bundled-asset resolver plus the
73
+ * curation. Structurally assignable to SuperDoc's `fonts` option.
74
+ *
75
+ * @beta
76
+ */
77
+ export interface SuperDocFontsConfig {
78
+ resolveAssetUrl: (context: BundledFontAssetContext) => string;
79
+ bundled?: {
80
+ include?: string[];
81
+ exclude?: string[];
82
+ };
83
+ }
84
+ /**
85
+ * Build a curated `fonts` config: the bundled pack, narrowed to the families you choose.
86
+ *
87
+ * import { createSuperDocFonts } from '@superdoc-dev/fonts';
88
+ * new SuperDoc({
89
+ * selector: '#editor',
90
+ * document,
91
+ * fonts: createSuperDocFonts({ exclude: ['Cooper Black', 'Brush Script MT'] }),
92
+ * });
93
+ *
94
+ * Names are Word logical families. Pass neither `include` nor `exclude` for the full pack - that is
95
+ * exactly {@link superdocFonts}. Curation governs the BUNDLED pack only; your own licensed fonts stay
96
+ * separate (`fonts.families` / `fonts.map`).
97
+ *
98
+ * @beta
99
+ */
100
+ export declare function createSuperDocFonts(options?: SuperDocFontsOptions): SuperDocFontsConfig;
package/dist/index.js ADDED
@@ -0,0 +1,158 @@
1
+ /**
2
+ * `@superdoc-dev/fonts` - the reviewed metric-compatible font substitutes SuperDoc renders for
3
+ * proprietary Word fonts (Carlito for Calibri, Liberation Serif for Times New Roman, etc.).
4
+ *
5
+ * Optional: install it to make the bundled fallbacks load automatically in any bundler app, with
6
+ * no copy step and no `assetBaseUrl`. The asset URLs are written as
7
+ * `new URL('../assets/<file>', import.meta.url)`, which Vite, Webpack 5, Next, Nuxt, esbuild, and
8
+ * Parcel detect, emit, and rewrite to the final hashed path.
9
+ *
10
+ * @beta This package is in preview; its surface may change before 1.0.
11
+ */
12
+ import { BUNDLED_FONT_ASSET_URLS } from './asset-urls';
13
+ import { BUNDLED_FAMILY_NAMES } from './bundled-families';
14
+ /**
15
+ * The full filename -> bundler-emitted URL map for every bundled face. Most consumers use
16
+ * {@link superdocFonts} or {@link resolveBundledFontAssetUrl} instead of reading this directly.
17
+ *
18
+ * @beta
19
+ */
20
+ export { BUNDLED_FONT_ASSET_URLS };
21
+ /**
22
+ * Resolve a bundled substitute face filename to a bundler-emitted URL.
23
+ *
24
+ * Pass as SuperDoc's `fonts.resolveAssetUrl` so the reviewed fallback pack loads from THIS
25
+ * package's emitted assets, with no manual copy step and no `assetBaseUrl`:
26
+ *
27
+ * import { resolveBundledFontAssetUrl } from '@superdoc-dev/fonts';
28
+ * new SuperDoc({ selector: '#editor', document, fonts: { resolveAssetUrl: resolveBundledFontAssetUrl } });
29
+ *
30
+ * Throws on an unknown file, which signals a version mismatch between `@superdoc-dev/fonts` and
31
+ * the `superdoc` core manifest rather than silently degrading to the logical font name.
32
+ *
33
+ * @beta
34
+ */
35
+ export function resolveBundledFontAssetUrl(context) {
36
+ const url = BUNDLED_FONT_ASSET_URLS[context.file];
37
+ if (!url) {
38
+ throw new Error(`[@superdoc-dev/fonts] no bundled asset for "${context.file}". This pack ships ` +
39
+ `${Object.keys(BUNDLED_FONT_ASSET_URLS).length} faces; the file is unknown, so ` +
40
+ `@superdoc-dev/fonts and superdoc are likely version-mismatched. Align their versions.`);
41
+ }
42
+ return url;
43
+ }
44
+ /**
45
+ * Drop-in value for SuperDoc's `fonts` config: `new SuperDoc({ fonts: superdocFonts })`.
46
+ * Equivalent to `{ resolveAssetUrl: resolveBundledFontAssetUrl }`.
47
+ *
48
+ * @beta
49
+ */
50
+ export const superdocFonts = {
51
+ resolveAssetUrl: resolveBundledFontAssetUrl,
52
+ };
53
+ /**
54
+ * Build a curated `fonts` config: the bundled pack, narrowed to the families you choose.
55
+ *
56
+ * import { createSuperDocFonts } from '@superdoc-dev/fonts';
57
+ * new SuperDoc({
58
+ * selector: '#editor',
59
+ * document,
60
+ * fonts: createSuperDocFonts({ exclude: ['Cooper Black', 'Brush Script MT'] }),
61
+ * });
62
+ *
63
+ * Names are Word logical families. Pass neither `include` nor `exclude` for the full pack - that is
64
+ * exactly {@link superdocFonts}. Curation governs the BUNDLED pack only; your own licensed fonts stay
65
+ * separate (`fonts.families` / `fonts.map`).
66
+ *
67
+ * @beta
68
+ */
69
+ export function createSuperDocFonts(options = {}) {
70
+ const include = normalizeNameList(options.include, 'include');
71
+ const exclude = normalizeNameList(options.exclude, 'exclude');
72
+ // include and exclude are mutually exclusive intents; accepting both silently would hide which one
73
+ // wins. Reject at the API boundary (this runs in the consumer's setup code, so it fails fast and
74
+ // clearly) rather than picking one arbitrarily.
75
+ if (include && exclude) {
76
+ throw new Error('[@superdoc-dev/fonts] createSuperDocFonts: pass `include` OR `exclude`, not both. ' +
77
+ '`include` is an allow-list (only those families resolve and appear in the toolbar); ' +
78
+ '`exclude` keeps everything but the named families.');
79
+ }
80
+ // Reject names SuperDoc does not bundle. This runs in the consumer's setup code, so it fails fast
81
+ // and clearly - especially for `include`, where a typo would otherwise silently hide the fonts the
82
+ // consumer meant to keep. (Raw `fonts.bundled` set directly stays lenient and only warns.)
83
+ if (include)
84
+ assertKnownFamilies(include, 'include');
85
+ if (exclude)
86
+ assertKnownFamilies(exclude, 'exclude');
87
+ const config = { resolveAssetUrl: resolveBundledFontAssetUrl };
88
+ if (include)
89
+ config.bundled = { include };
90
+ else if (exclude)
91
+ config.bundled = { exclude };
92
+ return config;
93
+ }
94
+ /** Validate and clean a curation list: an array of non-empty strings, or omitted. Throws on misuse. */
95
+ function normalizeNameList(value, field) {
96
+ if (value == null)
97
+ return undefined;
98
+ if (!Array.isArray(value)) {
99
+ throw new Error(`[@superdoc-dev/fonts] createSuperDocFonts: \`${field}\` must be an array of Word font names.`);
100
+ }
101
+ const names = value.map((name) => (typeof name === 'string' ? name.trim() : '')).filter(Boolean);
102
+ if (names.length !== value.length) {
103
+ throw new Error(`[@superdoc-dev/fonts] createSuperDocFonts: \`${field}\` must contain only non-empty font name strings ` +
104
+ `(e.g. ["Calibri", "Cambria"]).`);
105
+ }
106
+ return names.length ? names : undefined;
107
+ }
108
+ /** Normalize a family name for matching: trim, strip surrounding quotes, lowercase. */
109
+ function normalizeKey(name) {
110
+ return name
111
+ .trim()
112
+ .replace(/^["']|["']$/g, '')
113
+ .toLowerCase();
114
+ }
115
+ const KNOWN_FAMILY_KEYS = new Set(BUNDLED_FAMILY_NAMES.map(normalizeKey));
116
+ /** Bounded Levenshtein distance between two short strings, for a "did you mean" hint on a typo. */
117
+ function editDistance(a, b) {
118
+ const m = a.length;
119
+ const n = b.length;
120
+ if (Math.abs(m - n) > 2)
121
+ return 3;
122
+ let prev = Array.from({ length: n + 1 }, (_, i) => i);
123
+ for (let i = 1; i <= m; i += 1) {
124
+ const curr = [i];
125
+ for (let j = 1; j <= n; j += 1) {
126
+ const cost = a[i - 1] === b[j - 1] ? 0 : 1;
127
+ curr[j] = Math.min(curr[j - 1] + 1, prev[j] + 1, prev[j - 1] + cost);
128
+ }
129
+ prev = curr;
130
+ }
131
+ return prev[n];
132
+ }
133
+ /** The closest bundled family within edit distance 2, or null - so a typo gets a concrete suggestion. */
134
+ function closestKnownFamily(name) {
135
+ const key = normalizeKey(name);
136
+ let best = null;
137
+ let bestDist = 3;
138
+ for (const family of BUNDLED_FAMILY_NAMES) {
139
+ const dist = editDistance(key, normalizeKey(family));
140
+ if (dist < bestDist) {
141
+ bestDist = dist;
142
+ best = family;
143
+ }
144
+ }
145
+ return best;
146
+ }
147
+ /** Throw on any curation name SuperDoc does not bundle, with a suggestion and the full valid list. */
148
+ function assertKnownFamilies(names, field) {
149
+ const unknown = names.filter((name) => !KNOWN_FAMILY_KEYS.has(normalizeKey(name)));
150
+ if (unknown.length === 0)
151
+ return;
152
+ const hints = unknown.map((name) => {
153
+ const suggestion = closestKnownFamily(name);
154
+ return suggestion ? `"${name}" (did you mean "${suggestion}"?)` : `"${name}"`;
155
+ });
156
+ throw new Error(`[@superdoc-dev/fonts] createSuperDocFonts: \`${field}\` names a font SuperDoc does not bundle: ${hints.join(', ')}. ` +
157
+ `Curate by Word family name. Bundled families: ${BUNDLED_FAMILY_NAMES.join(', ')}.`);
158
+ }