forked from guillaumechereau/goxel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a custom font for mouse buttons icons
I would like to use it for the help bar on top.
- Loading branch information
1 parent
f1d2c73
commit e6e6497
Showing
7 changed files
with
331 additions
and
9 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/python3 | ||
|
||
# Goxel 3D voxels editor | ||
# | ||
# copyright (c) 2024-present Guillaume Chereau <[email protected]> | ||
# | ||
# Goxel is free software: you can redistribute it and/or modify it under the | ||
# terms of the GNU General Public License as published by the Free Software | ||
# Foundation, either version 3 of the License, or (at your option) any later | ||
# version. | ||
# | ||
# Goxel is distributed in the hope that it will be useful, but WITHOUT ANY | ||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# goxel. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
# Script that generates a font file from the svg images in svg/font/ | ||
|
||
import fontforge | ||
import glob | ||
import sys, os, re | ||
|
||
START_CODE = 0xE660 | ||
|
||
def make_font_from_svgs(sources, output): | ||
font = fontforge.font() | ||
font.encoding = "UnicodeFull" | ||
font.fontname = "Goxel" | ||
font.familyname = "Goxel" | ||
font.fullname = "Goxel" | ||
font.version = "1.0.0" | ||
font.weight = "Regular" | ||
font.upos = -100 | ||
font.uwidth = 50 | ||
font.ascent = 850 | ||
font.descent = 150 | ||
font.em = 1000 | ||
for idx, file in enumerate(sorted(sources)): | ||
assert file.endswith(".svg") | ||
code = START_CODE + idx | ||
glyph_name = file.replace(".svg", "") | ||
glyph = font.createChar(code, glyph_name) | ||
glyph.importOutlines(file) | ||
glyph.width = 1000 | ||
font.generate(output) | ||
|
||
sources = glob.glob('svg/glyphs/*.svg') | ||
make_font_from_svgs(sources, "data/fonts/goxel-font.ttf") |