diff --git a/README.md b/README.md index ec9e2581..25313f0c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ Anyone can submit fonts and textures to this plugin, as long as they meet the re - Fonts/textures must be somewhat high quality. No low-effort submissions. - Fonts/textures must be somewhat unique from other fonts/textures. Try not to re-use other textures. - Full credit must be provided. If you are basing a font/texture off of someone else's design, credit them too! -- Font/texture IDs must be in the snake_case format, and only use the characters `a-z`, `0-9`, and underscores. +- Texture IDs must be in the snake_case format, and only use the characters `a-z`, `0-9`, and underscores. +- Font IDs must be in the kebab-case format, and only use the characters `a-z`, `0-9`, and hyphens. ## How to make a submission To make a submission, create a fork of this repository and edit/upload the necessary files. After all the changes are made, create a pull request and explain what you are adding. @@ -251,6 +252,7 @@ If you want to make a font using different characters, please make an issue abou "text" // The bottom text ], "flat": true, // The font is a flat plane with no depth (optional) + "characterSpacing": 8, // A default amount of character spacing to use (optional) "variants": [ // The variants for this font (optional) { "id": "variant-id", // The ID of the variant diff --git a/scripts/compile.js b/scripts/compile.js index 6d34c108..d54b7f97 100644 --- a/scripts/compile.js +++ b/scripts/compile.js @@ -200,7 +200,7 @@ async function addTitleText(scene, str, args) { let width = 0 const cubes = [] const group = new THREE.Group() - for (const char of str) { + for (const [i, char] of Array.from(str).entries()) { if (char === " ") { width += 8 continue @@ -271,6 +271,7 @@ async function addTitleText(scene, str, args) { character.add(mesh) cubes.push(mesh) } + if (i) max += font.characterSpacing ?? 0 for (const cube of character.children) { cube.position.x -= width + max }