Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions BRAND.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ when the product adopts the design-system package; until then the hex values in
| Wordmark (3d) | `src/logo/wordmark/sources/wordmark/` | Text + refresh lines only |
| Mono (3e) | `src/logo/sources/mono.svg` and `src/logo/wordmark/sources/lockup-horizontal/mono.svg` | E-paper / single-ink |

Lockup and wordmark SVGs are **outlined paths** (no `<text>`). Rebuild outlines
with `pnpm outline:text` after editing masters that still use text (requires
`fonts/OpenSauceSans-*.otf`).

## Usage

- Do not stretch. Keep aspect ratio.
- Clear space ≈ mark height.
- Yellow-dark (`#FFB300`) on black; yellow-light (`#C89200`) on white.
- Use `favicon` / 16px simplified mark for browser favicons.
- Lockup SVGs still contain `<text>` (Open Sauce Sans). Browsers render them;
CI PNG rasterization may fall back to a system font until text is outlined.
- Lockup / wordmark SVGs use outlined paths (no `<text>`). Run `pnpm outline:text`
if you introduce live text again.

## Layout

Expand Down
12 changes: 7 additions & 5 deletions docs/logo-asset-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
## Masters

1. Update SVG under `src/logo/…` (or OG under `src/og-image/…`).
2. Run `npm run sync:legacy-svg` so root `svg/` matches (legacy CDN).
3. Run `npm run validate && npm run build`.
4. Commit `src/` + synced `svg/` (never commit `dist/`).
2. If wordmark/lockup masters use `<text>`, run `pnpm outline:text` (needs
`fonts/OpenSauceSans-*.otf`).
3. Run `pnpm sync:legacy-svg` so root `svg/` matches (legacy CDN).
4. Run `pnpm validate && pnpm build`.
5. Commit `src/` + synced `svg/` + fonts if changed (never commit `dist/`).

## Build outputs

Expand All @@ -31,9 +33,9 @@ https://cdn.jsdelivr.net/gh/singleton-sd/poc-inkads-assets@<sha>/svg/icon/icon-d

## Follow-ups

- Outline lockup `<text>` to paths for deterministic PNG / email.
- Email / documents packs.
- Point marketing at Pages URLs (`https://assets.inkads.poc.singletonsd.com/…`).
- Point marketing at Pages URLs (`https://assets.inkads.poc.singletonsd.com/…`)
— see marketing issue #94 / PR.

## npm package

Expand Down
93 changes: 93 additions & 0 deletions fonts/Open Sauce Sans OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright (c) 2020 The Open Sauce Sans Authors (https://github.com/marcologous/Open-Sauce-Fonts)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file added fonts/OpenSauceSans-Medium.otf
Binary file not shown.
Binary file added fonts/OpenSauceSans-SemiBold.otf
Binary file not shown.
9 changes: 9 additions & 0 deletions fonts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Fonts (outline tooling)

Open Sauce Sans OTFs used by `pnpm outline:text` to convert lockup/wordmark
`<text>` into paths.

- License: SIL Open Font License — see `Open Sauce Sans OFL.txt`
- Source: https://github.com/marcologous/Open-Sauce-Fonts

These files are for build tooling only; they are not served on the Pages CDN.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@
"test": "node --test scripts/validate-assets.test.mjs",
"build": "node scripts/build.mjs",
"generate": "pnpm build",
"outline:text": "node scripts/outline-text-svgs.mjs",
"prepublishOnly": "pnpm sync:legacy-svg && pnpm validate && pnpm build",
"release": "release-it -VV --dry-run --ci",
"release:ci": "release-it --ci"
"release:ci": "release-it --ci",
"outline:text": "node scripts/outline-text-svgs.mjs"
},
"devDependencies": {
"@release-it/conventional-changelog": "^10.0.6",
"conventional-changelog-conventionalcommits": "^8.0.0",
"opentype.js": "^2.0.0",
"release-it": "^19.2.4",
"sharp": "^0.33.5",
"to-ico": "^1.1.5"
Expand Down
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 110 additions & 0 deletions scripts/outline-text-svgs.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/usr/bin/env node
/**
* Replace <text> in wordmark/lockup SVGs with outlined <path> using
* Open Sauce Sans OTFs under fonts/. Run before committing vector masters.
*
* pnpm outline:text
* pnpm sync:legacy-svg
*/
import { readFile, writeFile, readdir } from "node:fs/promises";
import { readFileSync } from "node:fs";
import { join, dirname } from "node:path";
import { fileURLToPath } from "node:url";
import opentype from "opentype.js";

const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
const FONTS = join(ROOT, "fonts");
const WORDMARK_ROOT = join(ROOT, "src/logo/wordmark/sources");

const WEIGHT_TO_FONT = {
500: "OpenSauceSans-Medium.otf",
600: "OpenSauceSans-SemiBold.otf",
};

/** @type {Map<string, import('opentype.js').Font>} */
const fontCache = new Map();

function loadFont(file) {
if (!fontCache.has(file)) {
const buf = readFileSync(join(FONTS, file));
fontCache.set(file, opentype.parse(buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength)));
}
return fontCache.get(file);
}

/**
* @param {import('opentype.js').Font} font
* @param {string} text
* @param {number} x
* @param {number} y baseline
* @param {number} fontSize
* @param {number} letterSpacing
*/
function textToPathData(font, text, x, y, fontSize, letterSpacing) {
const scale = (1 / font.unitsPerEm) * fontSize;
let cursor = x;
const parts = [];
for (const ch of text) {
const glyph = font.charToGlyph(ch);
const path = glyph.getPath(cursor, y, fontSize);
const d = path.toPathData(2);
if (d) parts.push(d);
cursor += glyph.advanceWidth * scale + letterSpacing;
}
return parts.join(" ");
}

/**
* @param {string} svg
*/
function outlineSvgText(svg) {
return svg.replace(/<text\b([^>]*)>([^<]*)<\/text>/g, (_full, attrs, content) => {
const get = (name) => {
const m = attrs.match(new RegExp(`\\b${name}="([^"]*)"`));
return m ? m[1] : null;
};
const x = Number(get("x") ?? 0);
const y = Number(get("y") ?? 0);
const fontSize = Number(get("font-size") ?? 16);
const weight = Number(get("font-weight") ?? 500);
const fill = get("fill") ?? "#000000";
const letterSpacing = Number(get("letter-spacing") ?? 0);
const fontFile = WEIGHT_TO_FONT[weight] ?? WEIGHT_TO_FONT[500];
const font = loadFont(fontFile);
const d = textToPathData(font, content, x, y, fontSize, letterSpacing);
return `<path d="${d}" fill="${fill}"/>`;
});
}

async function walkSvgs(dir, acc = []) {
const entries = await readdir(dir, { withFileTypes: true });
for (const e of entries) {
const full = join(dir, e.name);
if (e.isDirectory()) await walkSvgs(full, acc);
else if (e.name.endsWith(".svg")) acc.push(full);
}
return acc;
}

async function main() {
const files = await walkSvgs(WORDMARK_ROOT);
let changed = 0;
for (const file of files) {
const before = await readFile(file, "utf8");
if (!/<text\b/.test(before)) continue;
const after = outlineSvgText(before);
if (after === before) continue;
if (/<text\b/.test(after)) {
throw new Error(`failed to outline all text in ${file}`);
}
await writeFile(file, after);
changed += 1;
console.log("outlined", file.replace(ROOT + "/", ""));
}
console.log(`outline complete (${changed} files)`);
}

main().catch((err) => {
console.error(err);
process.exit(1);
});
6 changes: 5 additions & 1 deletion scripts/validate-assets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ export async function validateAssets() {
continue;
}
try {
assertSvgSafe(await readFile(full, "utf8"), path);
const svg = await readFile(full, "utf8");
assertSvgSafe(svg, path);
if (/<text\b/i.test(svg)) {
errors.push(`${path}: outline <text> to paths (pnpm outline:text)`);
}
} catch (e) {
errors.push(e.message);
}
Expand Down
4 changes: 2 additions & 2 deletions src/logo/wordmark/sources/lockup-horizontal/dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading