Added font icon generate+merge pipeline
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -40,6 +40,7 @@ config/
|
|||||||
changelog
|
changelog
|
||||||
*.gif
|
*.gif
|
||||||
/core/assets/saves/
|
/core/assets/saves/
|
||||||
|
/out/
|
||||||
|
|
||||||
version.properties
|
version.properties
|
||||||
|
|
||||||
|
|||||||
@@ -299,6 +299,7 @@ project(":tools"){
|
|||||||
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||||
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
||||||
compile "org.reflections:reflections:0.9.11"
|
compile "org.reflections:reflections:0.9.11"
|
||||||
|
compile "org.apache.pdfbox:fontbox:2.0.0"
|
||||||
|
|
||||||
compile arcModule("backends:backend-sdl")
|
compile arcModule("backends:backend-sdl")
|
||||||
}
|
}
|
||||||
|
|||||||
78
core/assets-raw/fontgen/config.json
Normal file
78
core/assets-raw/fontgen/config.json
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"css_prefix_text": "icon-",
|
||||||
|
"css_use_suffix": false,
|
||||||
|
"hinting": true,
|
||||||
|
"units_per_em": 1000,
|
||||||
|
"ascent": 850,
|
||||||
|
"glyphs": [
|
||||||
|
{
|
||||||
|
"uid": "d7271d490b71df4311e32cdacae8b331",
|
||||||
|
"css": "home",
|
||||||
|
"code": 59392,
|
||||||
|
"src": "fontawesome"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uid": "c08a1cde48d96cba21d8c05fa7d7feb1",
|
||||||
|
"css": "doc-text-inv",
|
||||||
|
"code": 61788,
|
||||||
|
"src": "fontawesome"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uid": "178053298e3e5b03551d754d4b9acd8b",
|
||||||
|
"css": "doc-inv",
|
||||||
|
"code": 61787,
|
||||||
|
"src": "fontawesome"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uid": "5408be43f7c42bccee419c6be53fdef5",
|
||||||
|
"css": "doc-text",
|
||||||
|
"code": 61686,
|
||||||
|
"src": "fontawesome"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uid": "ce06b5805120d0c2f8d60cd3f1a4fdb5",
|
||||||
|
"css": "play",
|
||||||
|
"code": 59393,
|
||||||
|
"src": "fontawesome"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uid": "555ef8c86832e686fef85f7af2eb7cde",
|
||||||
|
"css": "left-big",
|
||||||
|
"code": 59394,
|
||||||
|
"src": "fontawesome"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uid": "ad6b3fbb5324abe71a9c0b6609cbb9f1",
|
||||||
|
"css": "right-big",
|
||||||
|
"code": 59395,
|
||||||
|
"src": "fontawesome"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uid": "95376bf082bfec6ce06ea1cda7bd7ead",
|
||||||
|
"css": "up-big",
|
||||||
|
"code": 59396,
|
||||||
|
"src": "fontawesome"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uid": "1c4068ed75209e21af36017df8871802",
|
||||||
|
"css": "down-big",
|
||||||
|
"code": 59397,
|
||||||
|
"src": "fontawesome"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uid": "6f880cbd94039674f0de065ffb57c250",
|
||||||
|
"css": "icon-distribution-transparent.png",
|
||||||
|
"code": 59398,
|
||||||
|
"src": "custom_icons",
|
||||||
|
"selected": true,
|
||||||
|
"svg": {
|
||||||
|
"path": "M0 0L0 50 0 100 0 150 0 200 0 250 0 300 0 350 0 400 0 450 0 500 0 550 0 600 0 650 0 700 0 750 0 800 0 850 0 900 0 950 0 1000 50 1000 100 1000 100 950 100 850 100 750 100 650 100 550 100 450 100 350 100 250 100 150 100 50 100 0 50 0 0 0ZM900 0L900 50 900 150 900 250 900 350 900 450 900 550 900 650 900 750 900 850 900 950 900 1000 950 1000 1000 1000 1000 950 1000 900 1000 850 1000 800 1000 750 1000 700 1000 650 1000 600 1000 550 1000 500 1000 450 1000 400 1000 350 1000 300 1000 250 1000 200 1000 150 1000 100 1000 50 1000 0 950 0 900 0ZM500 106.3C487.5 106.3 475 108.3 462.5 112.5 437.5 120.8 416.7 133.3 400 150L350 200C333.3 216.7 325 233.3 325 250 325 266.7 337.5 279.2 362.5 287.5 387.5 295.8 416.7 300 450 300L550 300C597.6 293.9 649.1 300.5 675 250 675 233.3 666.7 216.7 650 200L600 150C583.3 133.3 562.5 120.8 537.5 112.5 525 108.3 512.5 106.3 500 106.3ZM500 406.3C487.5 406.3 475 408.3 462.5 412.5 437.5 420.8 416.7 433.3 400 450L350 500C333.3 516.7 325 533.3 325 550 325 566.7 337.5 579.2 362.5 587.5 387.5 595.8 416.7 600 450 600L550 600C583.3 600 612.5 595.8 637.5 587.5 662.5 579.2 675 566.7 675 550 675 533.3 666.7 516.7 650 500L600 450C583.3 433.3 562.5 420.8 537.5 412.5 525 408.3 512.5 406.3 500 406.3ZM500 706.3C487.5 706.3 475 708.3 462.5 712.5 437.5 720.8 416.7 733.3 400 750L350 800C333.3 816.7 325 833.3 325 850 325 866.7 337.5 879.2 362.5 887.5 387.5 895.8 416.7 900 450 900L550 900C583.3 900 612.5 895.8 637.5 887.5 662.5 879.2 675 866.7 675 850 675 833.3 666.7 816.7 650 800L600 750C583.3 733.3 562.5 720.8 537.5 712.5 525 708.3 512.5 706.3 500 706.3Z",
|
||||||
|
"width": 1000
|
||||||
|
},
|
||||||
|
"search": [
|
||||||
|
"icon-distribution-transparent.png"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
60
core/assets-raw/fontgen/icons/distribution.svg
Normal file
60
core/assets-raw/fontgen/icons/distribution.svg
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
id="svg3799"
|
||||||
|
width="256"
|
||||||
|
height="256"
|
||||||
|
viewBox="0 0 10 10"
|
||||||
|
sodipodi:docname="icon-distribution-transparent.png.svg"
|
||||||
|
inkscape:version="0.92.4 (f8dce91, 2019-08-02)">
|
||||||
|
<metadata
|
||||||
|
id="metadata3805">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs3803" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#000000"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1280"
|
||||||
|
inkscape:window-height="1318"
|
||||||
|
id="namedview3801"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="45.254834"
|
||||||
|
inkscape:cx="6.2899407"
|
||||||
|
inkscape:cy="4.0348889"
|
||||||
|
inkscape:window-x="1280"
|
||||||
|
inkscape:window-y="27"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="g3829" />
|
||||||
|
<g
|
||||||
|
id="g3829">
|
||||||
|
<path
|
||||||
|
style="fill:#ffffff;fill-opacity:1"
|
||||||
|
d="M 0 0 L 0 0.5 L 0 1 L 0 1.5 L 0 2 L 0 2.5 L 0 3 L 0 3.5 L 0 4 L 0 4.5 L 0 5 L 0 5.5 L 0 6 L 0 6.5 L 0 7 L 0 7.5 L 0 8 L 0 8.5 L 0 9 L 0 9.5 L 0 10 L 0.5 10 L 1 10 L 1 9.5 L 1 8.5 L 1 7.5 L 1 6.5 L 1 5.5 L 1 4.5 L 1 3.5 L 1 2.5 L 1 1.5 L 1 0.5 L 1 0 L 0.5 0 L 0 0 z M 9 0 L 9 0.5 L 9 1.5 L 9 2.5 L 9 3.5 L 9 4.5 L 9 5.5 L 9 6.5 L 9 7.5 L 9 8.5 L 9 9.5 L 9 10 L 9.5 10 L 10 10 L 10 9.5 L 10 9 L 10 8.5 L 10 8 L 10 7.5 L 10 7 L 10 6.5 L 10 6 L 10 5.5 L 10 5 L 10 4.5 L 10 4 L 10 3.5 L 10 3 L 10 2.5 L 10 2 L 10 1.5 L 10 1 L 10 0.5 L 10 0 L 9.5 0 L 9 0 z M 5 1.0625 C 4.875 1.0625 4.75 1.0833335 4.625 1.125 C 4.375 1.2083333 4.1666667 1.3333333 4 1.5 L 3.5 2 C 3.3333333 2.1666667 3.25 2.3333333 3.25 2.5 C 3.25 2.6666667 3.375 2.7916667 3.625 2.875 C 3.875 2.9583333 4.1666667 3 4.5 3 L 5.5 3 C 5.9760929 2.9389882 6.4908205 3.0048105 6.75 2.5 C 6.75 2.3333333 6.6666667 2.1666667 6.5 2 L 6 1.5 C 5.8333333 1.3333333 5.625 1.2083333 5.375 1.125 C 5.25 1.0833335 5.125 1.0625 5 1.0625 z M 5 4.0625 C 4.875 4.0625 4.75 4.0833333 4.625 4.125 C 4.375 4.2083333 4.1666667 4.3333333 4 4.5 L 3.5 5 C 3.3333333 5.1666667 3.25 5.3333333 3.25 5.5 C 3.25 5.6666667 3.375 5.7916667 3.625 5.875 C 3.875 5.9583333 4.1666667 6 4.5 6 L 5.5 6 C 5.8333333 6 6.125 5.9583333 6.375 5.875 C 6.625 5.7916667 6.75 5.6666667 6.75 5.5 C 6.75 5.3333333 6.6666667 5.1666667 6.5 5 L 6 4.5 C 5.8333333 4.3333333 5.625 4.2083333 5.375 4.125 C 5.25 4.0833333 5.125 4.0625 5 4.0625 z M 5 7.0625 C 4.875 7.0625 4.75 7.0833333 4.625 7.125 C 4.375 7.2083333 4.1666667 7.3333333 4 7.5 L 3.5 8 C 3.3333333 8.1666667 3.25 8.3333333 3.25 8.5 C 3.25 8.6666667 3.375 8.7916667 3.625 8.875 C 3.875 8.9583333 4.1666667 9 4.5 9 L 5.5 9 C 5.8333333 9 6.125 8.9583333 6.375 8.875 C 6.625 8.7916667 6.75 8.6666667 6.75 8.5 C 6.75 8.3333333 6.6666667 8.1666667 6.5 8 L 6 7.5 C 5.8333333 7.3333333 5.625 7.2083333 5.375 7.125 C 5.25 7.0833333 5.125 7.0625 5 7.0625 z "
|
||||||
|
id="path3817" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.5 KiB |
3
core/assets-raw/fontgen/merge.pe
Executable file
3
core/assets-raw/fontgen/merge.pe
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
Open("core/assets/fonts/font.ttf")
|
||||||
|
MergeFonts("core/assets-raw/fontgen/out/font.ttf")
|
||||||
|
Generate("core/assets/fonts/font.ttf")
|
||||||
@@ -424,7 +424,7 @@ filter.option.percentile = Percentile
|
|||||||
width = Width:
|
width = Width:
|
||||||
height = Height:
|
height = Height:
|
||||||
menu = Menu
|
menu = Menu
|
||||||
play = \uE800 Play
|
play = Play
|
||||||
campaign = Campaign
|
campaign = Campaign
|
||||||
load = Load
|
load = Load
|
||||||
save = Save
|
save = Save
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=2be8dfe555b6aa4e5307ce56a92e24d8fee39a0b
|
archash=28ea91ea741417c01f0beb3b9dc320dc3f42ff25
|
||||||
|
|||||||
@@ -303,19 +303,6 @@ task pack(dependsOn: classes){
|
|||||||
workingDir = genFolder
|
workingDir = genFolder
|
||||||
}
|
}
|
||||||
|
|
||||||
//upscale icon sprites using different method, which requires an OpenGL context
|
|
||||||
javaexec{
|
|
||||||
if(System.getProperty("os.name").toLowerCase().contains("mac")){
|
|
||||||
jvmArgs "-XstartOnFirstThread"
|
|
||||||
}
|
|
||||||
|
|
||||||
jvmArgs("-Djava.awt.headless=true")
|
|
||||||
main = "mindustry.tools.Upscaler"
|
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
|
||||||
standardInput = System.in
|
|
||||||
workingDir = "../core/assets-raw/sprites_out/ui/icons"
|
|
||||||
}
|
|
||||||
|
|
||||||
copy{
|
copy{
|
||||||
from "../core/assets-raw/sprites_out/ui/icons"
|
from "../core/assets-raw/sprites_out/ui/icons"
|
||||||
into "../core/assets-raw/sprites_out/ui/"
|
into "../core/assets-raw/sprites_out/ui/"
|
||||||
|
|||||||
51
tools/src/mindustry/tools/FontGenerator.java
Normal file
51
tools/src/mindustry/tools/FontGenerator.java
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
package mindustry.tools;
|
||||||
|
|
||||||
|
import arc.*;
|
||||||
|
import arc.files.*;
|
||||||
|
import arc.util.*;
|
||||||
|
import arc.util.io.*;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
/* icon font pipeline:
|
||||||
|
1. take set of pre-defined icons and SVGs
|
||||||
|
2. use Fontello API to get a font with these
|
||||||
|
3. combine fontello font and standard font, get output font
|
||||||
|
4. use apache ttf API to generate a file with constants for every icon size+type (during annotation processing)
|
||||||
|
*/
|
||||||
|
public class FontGenerator{
|
||||||
|
|
||||||
|
public static void main(String[] args){
|
||||||
|
Net net = Core.net = new Net();
|
||||||
|
net.setBlock(true);
|
||||||
|
Fi folder = Fi.get("core/assets-raw/fontgen/out/");
|
||||||
|
folder.mkdirs();
|
||||||
|
|
||||||
|
Log.info("Session...");
|
||||||
|
|
||||||
|
OS.exec("curl", "--fail", "--output", "core/assets-raw/fontgen/out/session", "--form", "config=@core/assets-raw/fontgen/config.json", "http://fontello.com");
|
||||||
|
|
||||||
|
Log.info("Zip...");
|
||||||
|
|
||||||
|
String session = folder.child("session").readString();
|
||||||
|
net.httpGet("http://fontello.com/" + session + "/get", result -> {
|
||||||
|
try{
|
||||||
|
Streams.copyStream(result.getResultAsStream(), folder.child("font.zip").write());
|
||||||
|
}catch(IOException e){
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}, Log::err);
|
||||||
|
|
||||||
|
Log.info("Icon font...");
|
||||||
|
|
||||||
|
ZipFi zip = new ZipFi(folder.child("font.zip"));
|
||||||
|
Fi dest = folder.child("font.ttf");
|
||||||
|
zip.list()[0].child("font").child("fontello.ttf").copyTo(dest);
|
||||||
|
|
||||||
|
Log.info("Merge...");
|
||||||
|
|
||||||
|
OS.exec("fontforge", "-script", "core/assets-raw/fontgen/merge.pe");
|
||||||
|
|
||||||
|
Log.info("Done.");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package mindustry.tools;
|
package mindustry.tools;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.struct.*;
|
|
||||||
import arc.files.*;
|
import arc.files.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.graphics.g2d.TextureAtlas.*;
|
import arc.graphics.g2d.TextureAtlas.*;
|
||||||
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.Log.*;
|
import arc.util.Log.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
@@ -18,7 +18,7 @@ public class ImagePacker{
|
|||||||
static ObjectMap<String, TextureRegion> regionCache = new ObjectMap<>();
|
static ObjectMap<String, TextureRegion> regionCache = new ObjectMap<>();
|
||||||
static ObjectMap<TextureRegion, BufferedImage> imageCache = new ObjectMap<>();
|
static ObjectMap<TextureRegion, BufferedImage> imageCache = new ObjectMap<>();
|
||||||
|
|
||||||
public static void main(String[] args){
|
public static void main(String[] args) throws Exception{
|
||||||
Vars.headless = true;
|
Vars.headless = true;
|
||||||
|
|
||||||
Log.setLogger(new NoopLogHandler());
|
Log.setLogger(new NoopLogHandler());
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package mindustry.tools;
|
package mindustry.tools;
|
||||||
|
|
||||||
import arc.Core;
|
import arc.*;
|
||||||
import arc.files.Fi;
|
import arc.files.*;
|
||||||
import arc.graphics.Color;
|
import arc.graphics.*;
|
||||||
import arc.graphics.Pixmap;
|
import arc.graphics.g2d.*;
|
||||||
import arc.graphics.g2d.Draw;
|
import arc.graphics.gl.*;
|
||||||
import arc.graphics.g2d.Fill;
|
import arc.util.*;
|
||||||
import arc.graphics.gl.FrameBuffer;
|
|
||||||
import arc.util.ScreenUtils;
|
|
||||||
import arc.util.Tmp;
|
|
||||||
|
|
||||||
public class SquareMarcher{
|
public class SquareMarcher{
|
||||||
final int resolution;
|
final int resolution;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import arc.graphics.g2d.*;
|
|||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
|
|
||||||
|
//TODO remove
|
||||||
public class Upscaler{
|
public class Upscaler{
|
||||||
public static void main(String[] args){
|
public static void main(String[] args){
|
||||||
new SdlApplication(new ApplicationListener(){
|
new SdlApplication(new ApplicationListener(){
|
||||||
|
|||||||
Reference in New Issue
Block a user