diff --git a/.xo-config.cjs b/.xo-config.cjs index 60542fdfc0d..b04efb1b10a 100644 --- a/.xo-config.cjs +++ b/.xo-config.cjs @@ -1,6 +1,10 @@ module.exports = { prettier: true, - ignores: ['./showcases/nuxt-showcase/**', './packages/migration/**'], + ignores: [ + './showcases/nuxt-showcase/**', + './packages/migration/**', + './packages/foundations/assets/**' + ], overrides: [ { files: ['./showcases/angular-showcase/**'], diff --git a/__snapshots__/input/showcase/chromium-highContrast/DBInput-should-match-screenshot-1/DBInput-should-match-screenshot.png b/__snapshots__/input/showcase/chromium-highContrast/DBInput-should-match-screenshot-1/DBInput-should-match-screenshot.png index 41ed15fcc54..79dd78c4384 100644 Binary files a/__snapshots__/input/showcase/chromium-highContrast/DBInput-should-match-screenshot-1/DBInput-should-match-screenshot.png and b/__snapshots__/input/showcase/chromium-highContrast/DBInput-should-match-screenshot-1/DBInput-should-match-screenshot.png differ diff --git a/__snapshots__/input/showcase/chromium/DBInput-should-match-screenshot-1/DBInput-should-match-screenshot.png b/__snapshots__/input/showcase/chromium/DBInput-should-match-screenshot-1/DBInput-should-match-screenshot.png index 7ae87b0621b..1b62de346c7 100644 Binary files a/__snapshots__/input/showcase/chromium/DBInput-should-match-screenshot-1/DBInput-should-match-screenshot.png and b/__snapshots__/input/showcase/chromium/DBInput-should-match-screenshot-1/DBInput-should-match-screenshot.png differ diff --git a/__snapshots__/input/showcase/mobile-chrome/DBInput-should-match-screenshot-1/DBInput-should-match-screenshot.png b/__snapshots__/input/showcase/mobile-chrome/DBInput-should-match-screenshot-1/DBInput-should-match-screenshot.png index f08430e3274..d2248b72fc2 100644 Binary files a/__snapshots__/input/showcase/mobile-chrome/DBInput-should-match-screenshot-1/DBInput-should-match-screenshot.png and b/__snapshots__/input/showcase/mobile-chrome/DBInput-should-match-screenshot-1/DBInput-should-match-screenshot.png differ diff --git a/package-lock.json b/package-lock.json index 16c0f4daf45..bcf29098ab4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39835,6 +39835,7 @@ "cpr": "3.0.1", "cssnano": "^7.0.6", "dotenv": "^16.4.7", + "glob": "11.0.0", "nodemon": "3.1.9", "sass": "1.77.4", "tsx": "^4.19.2", diff --git a/packages/foundations/assets/fonts/NotoSans-Black-EU.woff2 b/packages/foundations/assets/fonts/NotoSans-Black-EU.woff2 new file mode 100644 index 00000000000..eddf01f58f9 Binary files /dev/null and b/packages/foundations/assets/fonts/NotoSans-Black-EU.woff2 differ diff --git a/packages/foundations/assets/fonts/NotoSans-Black.ttf b/packages/foundations/assets/fonts/NotoSans-Black.ttf new file mode 100644 index 00000000000..d5a6e0d15d8 Binary files /dev/null and b/packages/foundations/assets/fonts/NotoSans-Black.ttf differ diff --git a/packages/foundations/assets/fonts/NotoSans-Black.woff2 b/packages/foundations/assets/fonts/NotoSans-Black.woff2 deleted file mode 100644 index 91d018e9ef2..00000000000 Binary files a/packages/foundations/assets/fonts/NotoSans-Black.woff2 and /dev/null differ diff --git a/packages/foundations/assets/fonts/NotoSans-Bold-EU.woff2 b/packages/foundations/assets/fonts/NotoSans-Bold-EU.woff2 new file mode 100644 index 00000000000..8e06215ac63 Binary files /dev/null and b/packages/foundations/assets/fonts/NotoSans-Bold-EU.woff2 differ diff --git a/packages/foundations/assets/fonts/NotoSans-Bold.ttf b/packages/foundations/assets/fonts/NotoSans-Bold.ttf new file mode 100644 index 00000000000..506f7d8426c Binary files /dev/null and b/packages/foundations/assets/fonts/NotoSans-Bold.ttf differ diff --git a/packages/foundations/assets/fonts/NotoSans-Bold.woff2 b/packages/foundations/assets/fonts/NotoSans-Bold.woff2 deleted file mode 100644 index 5bbc9761464..00000000000 Binary files a/packages/foundations/assets/fonts/NotoSans-Bold.woff2 and /dev/null differ diff --git a/packages/foundations/assets/fonts/NotoSans-Light-EU.woff2 b/packages/foundations/assets/fonts/NotoSans-Light-EU.woff2 new file mode 100644 index 00000000000..dd9d527617e Binary files /dev/null and b/packages/foundations/assets/fonts/NotoSans-Light-EU.woff2 differ diff --git a/packages/foundations/assets/fonts/NotoSans-Light.ttf b/packages/foundations/assets/fonts/NotoSans-Light.ttf new file mode 100644 index 00000000000..8d8a67895f6 Binary files /dev/null and b/packages/foundations/assets/fonts/NotoSans-Light.ttf differ diff --git a/packages/foundations/assets/fonts/NotoSans-Light.woff2 b/packages/foundations/assets/fonts/NotoSans-Light.woff2 deleted file mode 100644 index 27810d4643c..00000000000 Binary files a/packages/foundations/assets/fonts/NotoSans-Light.woff2 and /dev/null differ diff --git a/packages/foundations/assets/fonts/NotoSans-Medium-EU.woff2 b/packages/foundations/assets/fonts/NotoSans-Medium-EU.woff2 new file mode 100644 index 00000000000..1e826e6e432 Binary files /dev/null and b/packages/foundations/assets/fonts/NotoSans-Medium-EU.woff2 differ diff --git a/packages/foundations/assets/fonts/NotoSans-Medium.ttf b/packages/foundations/assets/fonts/NotoSans-Medium.ttf new file mode 100644 index 00000000000..a44124bb363 Binary files /dev/null and b/packages/foundations/assets/fonts/NotoSans-Medium.ttf differ diff --git a/packages/foundations/assets/fonts/NotoSans-Medium.woff2 b/packages/foundations/assets/fonts/NotoSans-Medium.woff2 deleted file mode 100644 index 488195332fa..00000000000 Binary files a/packages/foundations/assets/fonts/NotoSans-Medium.woff2 and /dev/null differ diff --git a/packages/foundations/assets/fonts/NotoSans-Regular-EU.woff2 b/packages/foundations/assets/fonts/NotoSans-Regular-EU.woff2 new file mode 100644 index 00000000000..334df980bd0 Binary files /dev/null and b/packages/foundations/assets/fonts/NotoSans-Regular-EU.woff2 differ diff --git a/packages/foundations/assets/fonts/NotoSans-Regular.ttf b/packages/foundations/assets/fonts/NotoSans-Regular.ttf new file mode 100644 index 00000000000..4bac02f2f46 Binary files /dev/null and b/packages/foundations/assets/fonts/NotoSans-Regular.ttf differ diff --git a/packages/foundations/assets/fonts/NotoSans-Regular.woff2 b/packages/foundations/assets/fonts/NotoSans-Regular.woff2 deleted file mode 100644 index 35c97eec5c3..00000000000 Binary files a/packages/foundations/assets/fonts/NotoSans-Regular.woff2 and /dev/null differ diff --git a/packages/foundations/assets/fonts/NotoSans-SemiBold-EU.woff2 b/packages/foundations/assets/fonts/NotoSans-SemiBold-EU.woff2 new file mode 100644 index 00000000000..1f6887e8385 Binary files /dev/null and b/packages/foundations/assets/fonts/NotoSans-SemiBold-EU.woff2 differ diff --git a/packages/foundations/assets/fonts/NotoSans-SemiBold.ttf b/packages/foundations/assets/fonts/NotoSans-SemiBold.ttf new file mode 100644 index 00000000000..e846749015a Binary files /dev/null and b/packages/foundations/assets/fonts/NotoSans-SemiBold.ttf differ diff --git a/packages/foundations/assets/fonts/NotoSans-SemiBold.woff2 b/packages/foundations/assets/fonts/NotoSans-SemiBold.woff2 deleted file mode 100644 index 09a507d975b..00000000000 Binary files a/packages/foundations/assets/fonts/NotoSans-SemiBold.woff2 and /dev/null differ diff --git a/packages/foundations/assets/fonts/NotoSans-Thin-EU.woff2 b/packages/foundations/assets/fonts/NotoSans-Thin-EU.woff2 new file mode 100644 index 00000000000..4ef0833272a Binary files /dev/null and b/packages/foundations/assets/fonts/NotoSans-Thin-EU.woff2 differ diff --git a/packages/foundations/assets/fonts/NotoSans-Thin.ttf b/packages/foundations/assets/fonts/NotoSans-Thin.ttf new file mode 100644 index 00000000000..04335a5bbcc Binary files /dev/null and b/packages/foundations/assets/fonts/NotoSans-Thin.ttf differ diff --git a/packages/foundations/assets/fonts/NotoSans-Thin.woff2 b/packages/foundations/assets/fonts/NotoSans-Thin.woff2 deleted file mode 100644 index ffdca1e1383..00000000000 Binary files a/packages/foundations/assets/fonts/NotoSans-Thin.woff2 and /dev/null differ diff --git a/packages/foundations/assets/fonts/README.md b/packages/foundations/assets/fonts/README.md new file mode 100644 index 00000000000..a10dac9cccc --- /dev/null +++ b/packages/foundations/assets/fonts/README.md @@ -0,0 +1,23 @@ +# Generate fonts + +To generate optimal fonts we use [fonttools](https://github.com/fonttools/fonttools). To use the tools you need python installed: + +1. Install [python](https://docs.python-guide.org/starting/installation/#installation) and [ensure that you can run Python from the command line](https://packaging.python.org/en/latest/tutorials/installing-packages/#ensure-you-can-run-python-from-the-command-line) +2. Install fonttools: `pip3 install fonttools` +3. Install brotli: `pip3 install brotli` + +Afterward, you can generate a font by running the following command: + +```shell +pyftsubset NotoSans-Regular.ttf --layout-features=* --flavor=woff2 --unicodes-file=unicode-eu.txt --output-file=NotoSans-Regular-EU.woff2 +``` + +## Local development + +You can use `packages/foundations/assets/fonts/generate-eu-fonts.ts` to generate all fonts inside this directory. To do so, run the following command: + +```shell +node packages/foundations/assets/fonts/generate-eu-fonts.ts +``` + +To check if everything works fine you can check all glyphs with an [opentype.js.org glyph inspector tool](https://opentype.js.org/glyph-inspector.html). diff --git a/packages/foundations/assets/fonts/generate-eu-fonts.ts b/packages/foundations/assets/fonts/generate-eu-fonts.ts new file mode 100644 index 00000000000..c80b81b1459 --- /dev/null +++ b/packages/foundations/assets/fonts/generate-eu-fonts.ts @@ -0,0 +1,40 @@ +import { exec } from 'node:child_process'; +import { promisify } from 'node:util'; +import { glob } from 'glob'; + +const execAsync = promisify(exec); + +const generateFonts = async () => { + console.log('Generating EU fonts...'); + try { + await execAsync('pyftsubset --help'); + } catch (e) { + console.warn( + 'You need to install pyftsubset. Check packages/foundations/assets/fonts/README.md for more information.' + ); + } + + try { + const files = await glob('**/*.ttf'); + const commands = files.map((file) => + [ + 'pyftsubset', + file, + '--layout-features=*', + '--flavor=woff2', + '--unicodes-file=unicode-eu.txt', + `--output-file=${file.replace('.ttf', '-EU.woff2')}` + ].join(' ') + ); + + for (const command of commands) { + const { stdout, stderr } = await execAsync(command); + if (stdout) console.log(`stdout: ${stdout}`); + if (stderr) console.error(`stderr: ${stderr}`); + } + } catch (error) { + console.error(`Error: ${error.message}`); + } +}; + +void generateFonts(); diff --git a/packages/foundations/assets/fonts/secondary/LICENSE b/packages/foundations/assets/fonts/secondary/LICENSE deleted file mode 100644 index 6a5e228b98f..00000000000 --- a/packages/foundations/assets/fonts/secondary/LICENSE +++ /dev/null @@ -1,51 +0,0 @@ -The DB source code is licensed under the Apache License, Version 2.0, January 2004; -you may not use this file except in compliance with the License. You may obtain a copy -of the Apache License at https://apache.org/licenses/LICENSE-2.0. The DB source code -does not include any DB specific design assets like fonts, icons, trademarks, brandings, etc. - -All Deutsche Bahn AG (hereinafter “DB”) specific design assets like fonts, icons, -trademarks, brandings, etc. (hereinafter “DB Designs”) are licensed under the following -license agreement (the “DB Designs License”): - -- The DB Designs may only be used by external users who are acting as contractors or - service providers for DB or a group company by virtue of a contractual relationship and - use the DB Designs in this context ("User"). A license agreement with third parties who - are not in a contractual relationship with DB or a group company is not possible. -- DB is and remains the owner or holds the exclusive usage rights to the DB Designs. - DB grants the User a royalty-free, non-exclusive, non-transferable, and non-sublicensable - right, limited geographically, temporally, and in content to the duration and purposes - of the contractual relationship with DB or a group company, to use the DB Designs in - accordance with this license agreement. -- The User may use the DB Designs only in connection with or for the fulfillment of - orders and/or services that they provide for DB or a group company. Any other use, - particularly for private personal purposes or for unauthorized third parties, is - prohibited. The User may not sublicense, distribute, or otherwise make the DB Designs - accessible to third parties who are not part of DB AG or a group company, unless this - is expressly permitted by the underlying contractual relationship between the User and - DB or the group company. The User may not modify, alter, convert, edit, reverse engineer, - or decompile the DB Designs; in particular, they may not make any graphical changes - and/or alter, remove, or add technical functions. Editing or using the DB Designs in - an altered form is only permitted with the express prior written consent of DB. -- Unless required by applicable law or agreed to in writing, DB provides the DB Designs - on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions of title, - non-infringement, merchantability, or fitness for a particular purpose. DB is only liable - in cases of intent or gross negligence, within the framework of mandatory statutory - liability provisions, particularly the Product Liability Act, as well as for damages - arising from injury to life, body, or health of individuals. In cases of gross negligence, - liability is limited to typical and foreseeable damages. This limitation of liability also - applies in favor of group companies as well as in favor of vicarious agents of DB and - its group companies. -- This DB Designs License automatically ends at the time when the underlying contractual - relationship between the user and DB or a group company ends. DB may terminate this - DB Designs License at any time without notice for good cause, in particular, if the User - violates this DB Designs License and does not cease the violation within a reasonable - period after a warning. The User is obligated to cease using the DB Designs immediately - upon termination of this DB Designs License and to delete all DB Designs and related files - in their possession or installed on their systems, as well as any backup copies, without delay. -- If any provision of this agreement is or becomes invalid or unenforceable, the remaining - provisions of this agreement shall remain unaffected. In place of the invalid or unenforceable - provision, a provision shall be deemed agreed upon that comes closest to the economic purpose - of the invalid or unenforceable provision in a legally permissible manner. The same applies in - the event of a gap in the agreement. This DB Designs License is governed by and construed in - accordance with the laws of Germany, excluding conflicts of law rules and principles. diff --git a/packages/foundations/assets/fonts/unicode-eu.txt b/packages/foundations/assets/fonts/unicode-eu.txt new file mode 100644 index 00000000000..92678db0f8b --- /dev/null +++ b/packages/foundations/assets/fonts/unicode-eu.txt @@ -0,0 +1,14 @@ +# compare to https://symbl.cc/de/unicode-table/ +U+0000-024F # Latin (all) +U+0020,U+0009,U+000A,U+000D # white space characters +U+00E4,U+00F6,U+00FC,U+00DF # German characters +U+00E9, U+00E8, U+00EA, U+00E0, U+00E7, U+0153 # French characters +U+00E0, U+00E8, U+00E9, U+00F2, U+00F9, U+00EC, U+00C0, U+00C8, U+00C9, U+00D2, U+00D9, U+00CC # Italian characters +U+FB00, U+FB01, U+FB02, U+FB03, U+FB04, U+FB05, U+FB06 # ligatures +U+00E1, U+00E9, U+00ED, U+00F3, U+00FA, U+00F1, U+00BF, U+00A1 # Spanish characters +U+00E5, U+00F8, U+00E6, U+00C5, U+00D8, U+00C6 # Scandinavian characters +U+0104, U+0105, U+0106, U+0107, U+0118, U+0119, U+0141, U+0142, U+0143, U+0144, U+015A, U+015B, U+0179, U+017A, U+017B, U+017C # Polish characters +U+010C, U+010D, U+010E, U+010F, U+011A, U+011B, U+0147, U+0148, U+0158, U+0159, U+0160, U+0161, U+0164, U+0165, U+016E, U+016F, U+017D, U+017E # Czech characters +U+00E9, U+00E8, U+00EB, U+00E4, U+00FC, U+00F6, U+00EF, U+00C9, U+00C8, U+00CB, U+00C4, U+00DC, U+00D6, U+00CF # Netherlands characters +U+0391-03A9, U+03B1-03C9 # Greek characters +U+0410-042F, U+0430-044F # Cyrillic characters diff --git a/packages/foundations/package.json b/packages/foundations/package.json index 03f4d276201..54e0783a41d 100644 --- a/packages/foundations/package.json +++ b/packages/foundations/package.json @@ -48,6 +48,7 @@ "cpr": "3.0.1", "cssnano": "^7.0.6", "dotenv": "^16.4.7", + "glob": "11.0.0", "nodemon": "3.1.9", "sass": "1.77.4", "tsx": "^4.19.2", diff --git a/packages/foundations/scss/fonts/include.scss b/packages/foundations/scss/fonts/include.scss index d2e016cce1f..77c716d7083 100644 --- a/packages/foundations/scss/fonts/include.scss +++ b/packages/foundations/scss/fonts/include.scss @@ -4,14 +4,15 @@ font-family: NotoSans; font-style: normal; font-weight: 300; - src: url("#{assets-paths.$fonts-path}NotoSans-Thin.woff2") format("woff2"); + src: url("#{assets-paths.$fonts-path}NotoSans-Thin-EU.woff2") + format("woff2"); } @font-face { font-family: NotoSans; font-style: normal; font-weight: 400; - src: url("#{assets-paths.$fonts-path}NotoSans-Regular.woff2") + src: url("#{assets-paths.$fonts-path}NotoSans-Regular-EU.woff2") format("woff2"); } @@ -19,14 +20,15 @@ font-family: NotoSans; font-style: normal; font-weight: 500; - src: url("#{assets-paths.$fonts-path}NotoSans-Medium.woff2") format("woff2"); + src: url("#{assets-paths.$fonts-path}NotoSans-Medium-EU.woff2") + format("woff2"); } @font-face { font-family: NotoSans; font-style: normal; font-weight: 600; - src: url("#{assets-paths.$fonts-path}NotoSans-SemiBold.woff2") + src: url("#{assets-paths.$fonts-path}NotoSans-SemiBold-EU.woff2") format("woff2"); } @@ -34,19 +36,22 @@ font-family: NotoSans; font-style: normal; font-weight: 700; - src: url("#{assets-paths.$fonts-path}NotoSans-Bold.woff2") format("woff2"); + src: url("#{assets-paths.$fonts-path}NotoSans-Bold-EU.woff2") + format("woff2"); } @font-face { font-family: "NotoSans Head"; font-style: normal; font-weight: 300; - src: url("#{assets-paths.$fonts-path}NotoSans-Light.woff2") format("woff2"); + src: url("#{assets-paths.$fonts-path}NotoSans-Light-EU.woff2") + format("woff2"); } @font-face { font-family: "NotoSans Head"; font-style: normal; font-weight: 900; - src: url("#{assets-paths.$fonts-path}NotoSans-Black.woff2") format("woff2"); + src: url("#{assets-paths.$fonts-path}NotoSans-Black-EU.woff2") + format("woff2"); }