ugcinc 5.5.0 → 5.5.1
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.
- package/README.md +1 -1
- package/dist/render/utils/fonts.d.ts +2 -2
- package/dist/render/utils/fonts.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -745,7 +745,7 @@ daily, so families added to the catalogue become identifiable and renderable
|
|
|
745
745
|
without a new release. Image Composer text uses a library font through
|
|
746
746
|
`fontFamily` (it takes precedence over `font`); `fontWeight` picks the nearest
|
|
747
747
|
weight the family has. The family list is public at
|
|
748
|
-
`https://media.ugc.inc/owned-uploads/render/
|
|
748
|
+
`https://media.ugc.inc/owned-uploads/render/0c02f309-204e-4ea1-b924-028250cfd029/catalogue.json`
|
|
749
749
|
(`fetchFontLibraryCatalogue()` in `ugcinc/render`).
|
|
750
750
|
|
|
751
751
|
```typescript
|
|
@@ -20,9 +20,9 @@ export declare function getFontFamily(fontType: FontType, fontFamily?: string):
|
|
|
20
20
|
/**
|
|
21
21
|
* Font library: the Google Fonts catalogue mirrored by UGC (open licences).
|
|
22
22
|
* `catalogue.json` lists every family with its available upright weights;
|
|
23
|
-
* files live at `<base
|
|
23
|
+
* files live at `<base>/<slug>.<weight>.ttf` (Latin subset).
|
|
24
24
|
*/
|
|
25
|
-
export declare const FONT_LIBRARY_BASE_URL = "https://media.ugc.inc/owned-uploads/render/
|
|
25
|
+
export declare const FONT_LIBRARY_BASE_URL = "https://media.ugc.inc/owned-uploads/render/0c02f309-204e-4ea1-b924-028250cfd029";
|
|
26
26
|
export interface FontLibraryCatalogue {
|
|
27
27
|
version: number;
|
|
28
28
|
source: 'google-fonts';
|
|
@@ -42,9 +42,9 @@ function getFontFamily(fontType, fontFamily) {
|
|
|
42
42
|
/**
|
|
43
43
|
* Font library: the Google Fonts catalogue mirrored by UGC (open licences).
|
|
44
44
|
* `catalogue.json` lists every family with its available upright weights;
|
|
45
|
-
* files live at `<base
|
|
45
|
+
* files live at `<base>/<slug>.<weight>.ttf` (Latin subset).
|
|
46
46
|
*/
|
|
47
|
-
exports.FONT_LIBRARY_BASE_URL = 'https://media.ugc.inc/owned-uploads/render/
|
|
47
|
+
exports.FONT_LIBRARY_BASE_URL = 'https://media.ugc.inc/owned-uploads/render/0c02f309-204e-4ea1-b924-028250cfd029';
|
|
48
48
|
/** CSS family name a library font is registered under (namespaced so it never collides with bundled fonts). */
|
|
49
49
|
function libraryFontFace(family) {
|
|
50
50
|
return `UGC Library ${family}`;
|
|
@@ -98,7 +98,7 @@ async function loadLibraryFonts(requests) {
|
|
|
98
98
|
const key = `${family}|${wanted}`;
|
|
99
99
|
let pending = loadedLibraryFaces.get(key);
|
|
100
100
|
if (!pending) {
|
|
101
|
-
const face = new FontFace(libraryFontFace(family), `url(${exports.FONT_LIBRARY_BASE_URL}
|
|
101
|
+
const face = new FontFace(libraryFontFace(family), `url(${exports.FONT_LIBRARY_BASE_URL}/${slug}.${fileWeight}.ttf)`, { weight: String(wanted), style: 'normal' });
|
|
102
102
|
pending = face.load().then((loaded) => {
|
|
103
103
|
document.fonts.add(loaded);
|
|
104
104
|
return true;
|