Skip to content

Commit

Permalink
default font character spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
ewanhowell5195 committed Aug 31, 2024
1 parent 6bdeebe commit 0891c55
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@
"author": "Ewan Howell",
"description": "Create Minecraft-styled title models!",
"tags": ["Minecraft", "Title", "Logo"],
"version": "1.6.1",
"version": "1.7.0",
"min_version": "4.8.0",
"variant": "both",
"creation_date": "2023-06-10",
Expand Down
13 changes: 13 additions & 0 deletions plugins/minecraft_title_generator/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,5 +394,18 @@
]
}
]
},
"1.7.0": {
"title": "1.7.0",
"date": "2024-08-31",
"author": "Ewan Howell",
"categories": [
{
"title": "Changes",
"list": [
"Fonts now support setting a default character spacing"
]
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
author: "Ewan Howell",
description,
tags: ["Minecraft", "Title", "Logo"],
version: "1.6.1",
version: "1.7.0",
min_version: "4.8.0",
variant: "both",
creation_date: "2023-06-10",
Expand Down Expand Up @@ -1713,6 +1713,7 @@
}
this.texture = Object.keys(fonts[this.font].textures)[1] ?? Object.keys(fonts[this.font].textures)[0]
this.overlay = Object.keys(fonts[this.font].overlays)[0]
this.characterSpacing = fonts[this.font].characterSpacing ?? 0
if (!ignoreUpdate) this.buildPreview()
},
buildPreview() {
Expand Down Expand Up @@ -1751,7 +1752,7 @@
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
Expand Down Expand Up @@ -1821,6 +1822,7 @@
character.add(mesh)
cubes.push(mesh)
}
if (i) max += fonts[this.font].characterSpacing ?? 0
for (const cube of character.children) {
cube.position.x -= width + max
}
Expand Down

0 comments on commit 0891c55

Please sign in to comment.