Moved font to unicode4d chain
This commit is contained in:
parent
0152dd9a77
commit
afc1fa52c0
|
@ -4,6 +4,7 @@
|
||||||
<entry key="1c2d010066a39d96ace8af0ecc37c72d6f79109f30939e2959befcd9ce25fc8d">../gdxapp4d-chain-sys-engine/src/chain</entry>
|
<entry key="1c2d010066a39d96ace8af0ecc37c72d6f79109f30939e2959befcd9ce25fc8d">../gdxapp4d-chain-sys-engine/src/chain</entry>
|
||||||
<entry key="f8be3b29da5b6b2cb464f781469ceede6ccfd848d158293a4cdffbc2c41a410b">../gdxapp4d-chain-sys-engine-fuel/src/chain</entry>
|
<entry key="f8be3b29da5b6b2cb464f781469ceede6ccfd848d158293a4cdffbc2c41a410b">../gdxapp4d-chain-sys-engine-fuel/src/chain</entry>
|
||||||
<entry key="8833aa29da5b6b2cb464f781469ceede6ccfd848d158293a4cdffbc2c41b58de">../gdxapp4d-chain-dep-osgi-scr/src/chain</entry>
|
<entry key="8833aa29da5b6b2cb464f781469ceede6ccfd848d158293a4cdffbc2c41b58de">../gdxapp4d-chain-dep-osgi-scr/src/chain</entry>
|
||||||
|
<entry key="9944bb29da5b6b2cb464f781469ceede6ccfd848d158293a4cdffbc2c41b62ed">../gdxapp4d-chain-sys-unicode4d/src/chain</entry>
|
||||||
|
|
||||||
<entry key="7744aa29da5b6b2cb4b8f781469c33de688fd848d158293a4cdddbc2c41b12aa">../gdxapp4d-app-calculator/src/chain</entry>
|
<entry key="7744aa29da5b6b2cb4b8f781469c33de688fd848d158293a4cdddbc2c41b12aa">../gdxapp4d-app-calculator/src/chain</entry>
|
||||||
<entry key="7744aa29da5b6b2cb4b8f781469c33de688fd848d158293a4cdddbc2c41b12aa.gdxapp4d-app-calculator.jar">../gdxapp4d-app-calculator/target/classes</entry>
|
<entry key="7744aa29da5b6b2cb4b8f781469c33de688fd848d158293a4cdddbc2c41b12aa.gdxapp4d-app-calculator.jar">../gdxapp4d-app-calculator/target/classes</entry>
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://wrap-sea.x4o.distributedrebirth.love/xml/ns/warp-sea-root http://warp-sea.x4o.distributedrebirth.love/xml/ns/warp-sea-root-1.0.xsd">
|
xsi:schemaLocation="http://wrap-sea.x4o.distributedrebirth.love/xml/ns/warp-sea-root http://warp-sea.x4o.distributedrebirth.love/xml/ns/warp-sea-root-1.0.xsd">
|
||||||
<link:sea name="System Engine" provider="gdxapp4d.system" author="willemtsade">
|
<link:sea name="System Engine" provider="gdxapp4d.system" author="willemtsade">
|
||||||
|
<!-- Link sys-unicode -->
|
||||||
|
<link:chain key="9944bb29da5b6b2cb464f781469ceede6ccfd848d158293a4cdffbc2c41b62ed"/>
|
||||||
<!-- Link dep-osgi-scr -->
|
<!-- Link dep-osgi-scr -->
|
||||||
<link:chain key="8833aa29da5b6b2cb464f781469ceede6ccfd848d158293a4cdffbc2c41b58de"/>
|
<link:chain key="8833aa29da5b6b2cb464f781469ceede6ccfd848d158293a4cdffbc2c41b58de"/>
|
||||||
<!-- Link vrgem4 -->
|
<!-- Link vrgem4 -->
|
||||||
|
|
10
gdxapp4d-chain-sys-unicode4d/pom.xml
Normal file
10
gdxapp4d-chain-sys-unicode4d/pom.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>love.distributedrebirth.gdxapp4d</groupId>
|
||||||
|
<artifactId>gdxapp4d</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>gdxapp4d-chain-sys-unicode4d</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
</project>
|
Binary file not shown.
30
gdxapp4d-chain-sys-unicode4d/src/chain/warp-sea.xml
Normal file
30
gdxapp4d-chain-sys-unicode4d/src/chain/warp-sea.xml
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<root:ocean xmlns:root="http://wrap-sea.x4o.distributedrebirth.love/xml/ns/warp-sea-root"
|
||||||
|
xmlns:link="http://warp-sea.x4o.distributedrebirth.love/xml/ns/warp-sea-link"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://wrap-sea.x4o.distributedrebirth.love/xml/ns/warp-sea-root http://warp-sea.x4o.distributedrebirth.love/xml/ns/warp-sea-root-1.0.xsd">
|
||||||
|
<link:sea name="System Unicode4D" provider="gdxapp4d.system" author="willemtsade">
|
||||||
|
<link:magic file="plane0/code-2000.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/free-sans.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/new-gardiner-bmp.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/fa-solid-900.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/noto-sans-samaritan.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/noto-sans-sinhala.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/noto-serif-tibetan.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/noto-sans-tagalog.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/noto-sans-tagbanwa.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/noto-sans-tai-le.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/noto-sans-tai-tham.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/noto-sans-batak.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/noto-sans-lepcha.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/noto-sans-balinese.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/noto-sans-sundanese.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/noto-sans-lisu.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/noto-sans-bamum.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane0/noto-sans-glagolitic.ttf" mime="application/x-font-ttf-plane0"/>
|
||||||
|
<link:magic file="plane1/code-2001.ttf" mime="application/x-font-ttf-plane1"/>
|
||||||
|
<link:magic file="plane1/new-gardiner-smp.ttf" mime="application/x-font-ttf-plane1"/>
|
||||||
|
<link:magic file="plane1/noto-sans-brahmi.ttf" mime="application/x-font-ttf-plane1"/>
|
||||||
|
<link:magic file="plane2/code-2002.ttf" mime="application/x-font-ttf-plane2"/>
|
||||||
|
</link:sea>
|
||||||
|
</root:ocean>
|
|
@ -6,6 +6,7 @@ import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -14,6 +15,8 @@ import java.util.function.Consumer;
|
||||||
import org.osgi.framework.BundleActivator;
|
import org.osgi.framework.BundleActivator;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
import org.osgi.framework.BundleException;
|
import org.osgi.framework.BundleException;
|
||||||
|
import org.osgi.framework.InvalidSyntaxException;
|
||||||
|
import org.osgi.framework.ServiceReference;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.x4o.xml.io.X4OConnectionException;
|
import org.x4o.xml.io.X4OConnectionException;
|
||||||
|
@ -149,25 +152,6 @@ public class GDXAppTos4Activator implements BundleActivator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
|
|
||||||
parameter.characters = FreeTypeFontGenerator.DEFAULT_CHARS + getRangeUnicodeUsed();
|
|
||||||
parameter.size = 14;
|
|
||||||
Gdx.app.postRunnable(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("font/code-2000.ttf"));
|
|
||||||
gdxFont = generator.generateFont(parameter);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
while (gdxFont == null) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(100);
|
|
||||||
} catch (InterruptedException ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bootScreen.bootLine("gdx-font: "+parameter.characters.length()+" glyphs loaded.");
|
|
||||||
|
|
||||||
|
|
||||||
SystemWarpShipImpl systemWarpShip = new SystemWarpShipImpl();
|
SystemWarpShipImpl systemWarpShip = new SystemWarpShipImpl();
|
||||||
|
|
||||||
context.registerService(SystemWarpBase.class.getName(), new SystemWarpBaseImpl(), new Hashtable<String, String>());
|
context.registerService(SystemWarpBase.class.getName(), new SystemWarpBaseImpl(), new Hashtable<String, String>());
|
||||||
|
@ -177,11 +161,6 @@ public class GDXAppTos4Activator implements BundleActivator {
|
||||||
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
||||||
Gdx.app.setApplicationLogger(systemGdxLog);
|
Gdx.app.setApplicationLogger(systemGdxLog);
|
||||||
|
|
||||||
context.registerService(SystemGdxFont.class.getName(), new SystemGdxFontImpl(gdxFont), new Hashtable<String, String>());
|
|
||||||
context.registerService(SystemGdxLog.class.getName(), systemGdxLog, new Hashtable<String, String>());
|
|
||||||
context.registerService(SystemGdxBootArgs.class.getName(), new SystemGdxBootArgsImpl(), new Hashtable<String, String>());
|
|
||||||
context.registerService(SystemGdxTerminal.class.getName(), systemGdxTerminal, new Hashtable<String, String>());
|
|
||||||
|
|
||||||
List<SystemWarpSea> registratedSeas = new ArrayList<>();
|
List<SystemWarpSea> registratedSeas = new ArrayList<>();
|
||||||
int result = 0;
|
int result = 0;
|
||||||
try {
|
try {
|
||||||
|
@ -197,8 +176,34 @@ public class GDXAppTos4Activator implements BundleActivator {
|
||||||
startError = true;
|
startError = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bootScreen.bootLine("tos4: chains resolved.");
|
bootScreen.bootLine("tos4: chains resolved.");
|
||||||
|
|
||||||
|
List<File> fonts = systemWarpShip.searchMagic(context, "application/x-font-ttf-plane0");
|
||||||
|
File systemFont = fonts.get(0);
|
||||||
|
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
|
||||||
|
parameter.characters = FreeTypeFontGenerator.DEFAULT_CHARS + getRangeUnicodeUsed();
|
||||||
|
parameter.size = 14;
|
||||||
|
Gdx.app.postRunnable(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.absolute(systemFont.getAbsolutePath()));
|
||||||
|
gdxFont = generator.generateFont(parameter);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
while (gdxFont == null) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(100);
|
||||||
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bootScreen.bootLine("gdx-font: "+parameter.characters.length()+" glyphs loaded.");
|
||||||
|
|
||||||
|
|
||||||
|
context.registerService(SystemGdxFont.class.getName(), new SystemGdxFontImpl(gdxFont), new Hashtable<String, String>());
|
||||||
|
context.registerService(SystemGdxLog.class.getName(), systemGdxLog, new Hashtable<String, String>());
|
||||||
|
context.registerService(SystemGdxBootArgs.class.getName(), new SystemGdxBootArgsImpl(), new Hashtable<String, String>());
|
||||||
|
context.registerService(SystemGdxTerminal.class.getName(), systemGdxTerminal, new Hashtable<String, String>());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
systemWarpShip.loadBundles(context, registratedSeas);
|
systemWarpShip.loadBundles(context, registratedSeas);
|
||||||
} catch (BundleException e) {
|
} catch (BundleException e) {
|
||||||
|
@ -394,6 +399,28 @@ public class GDXAppTos4Activator implements BundleActivator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<File> searchMagic(BundleContext context, String mimeType) {
|
||||||
|
Collection<ServiceReference<SystemWarpSea>> oceansRefs = null;
|
||||||
|
try {
|
||||||
|
oceansRefs = context.getServiceReferences(SystemWarpSea.class, "(warp.sea.name=*)");
|
||||||
|
} catch (InvalidSyntaxException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
List<File> result = new ArrayList<>();
|
||||||
|
for (ServiceReference<SystemWarpSea> serviceRef : oceansRefs) {
|
||||||
|
SystemWarpSea service = context.getService(serviceRef);
|
||||||
|
File waterHome = service.getWarpHome();
|
||||||
|
for (WaterSeaMagic magic:service.getWarpSea().theWater().getSeaMagics()) {
|
||||||
|
if (mimeType.equals(magic.getMime())) {
|
||||||
|
File file = new File(waterHome, magic.getFile());
|
||||||
|
result.add(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SystemGdxLogImpl implements SystemGdxLog, ApplicationLogger {
|
public static class SystemGdxLogImpl implements SystemGdxLog, ApplicationLogger {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package love.distributedrebirth.gdxapp4d.tos4.service;
|
package love.distributedrebirth.gdxapp4d.tos4.service;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
@ -20,4 +21,6 @@ public interface SystemWarpShip {
|
||||||
int loadWaterOcean(BundleContext context, List<SystemWarpSea> registratedSeas, String key, Consumer<String> logger) throws IOException, InterruptedException, X4OConnectionException, SAXException, BundleException;
|
int loadWaterOcean(BundleContext context, List<SystemWarpSea> registratedSeas, String key, Consumer<String> logger) throws IOException, InterruptedException, X4OConnectionException, SAXException, BundleException;
|
||||||
|
|
||||||
void loadBundles(BundleContext context, List<SystemWarpSea> registratedSeas) throws BundleException;
|
void loadBundles(BundleContext context, List<SystemWarpSea> registratedSeas) throws BundleException;
|
||||||
|
|
||||||
|
List<File> searchMagic(BundleContext context, String mimeType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package love.distributedrebirth.gdxapp4d.vrgem4;
|
package love.distributedrebirth.gdxapp4d.vrgem4;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -38,8 +39,16 @@ public class GDXAppVrGem4Activator implements BundleActivator {
|
||||||
|
|
||||||
private static final int VIEW_SLEEP_TIME = 1234;
|
private static final int VIEW_SLEEP_TIME = 1234;
|
||||||
|
|
||||||
|
private ImGuiSetup imguiSetup = new ImGuiSetup();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stop(final BundleContext context) {
|
public void stop(final BundleContext context) {
|
||||||
|
Gdx.app.postRunnable(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
imguiSetup.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -58,6 +67,9 @@ public class GDXAppVrGem4Activator implements BundleActivator {
|
||||||
ServiceReference<SystemGdxFont> gdxFontRef = context.getServiceReference(SystemGdxFont.class);
|
ServiceReference<SystemGdxFont> gdxFontRef = context.getServiceReference(SystemGdxFont.class);
|
||||||
SystemGdxFont gdxFont = context.getService(gdxFontRef);
|
SystemGdxFont gdxFont = context.getService(gdxFontRef);
|
||||||
|
|
||||||
|
ServiceReference<SystemWarpShip> systemWarpShipRef = context.getServiceReference(SystemWarpShip.class);
|
||||||
|
SystemWarpShip systemWarpShip = context.getService(systemWarpShipRef);
|
||||||
|
|
||||||
logger.info(this, "Booting");
|
logger.info(this, "Booting");
|
||||||
GDXAppVrGem4BootScreen bootScreen = new GDXAppVrGem4BootScreen(gdxFont.getFont());
|
GDXAppVrGem4BootScreen bootScreen = new GDXAppVrGem4BootScreen(gdxFont.getFont());
|
||||||
Gdx.app.postRunnable(new Runnable() {
|
Gdx.app.postRunnable(new Runnable() {
|
||||||
|
@ -86,16 +98,13 @@ public class GDXAppVrGem4Activator implements BundleActivator {
|
||||||
}
|
}
|
||||||
bootScreen.bootLine("BãßBȍőnCoffinʸᴰ init done.");
|
bootScreen.bootLine("BãßBȍőnCoffinʸᴰ init done.");
|
||||||
|
|
||||||
|
List<File> fonts = systemWarpShip.searchMagic(context, "application/x-font-ttf-plane0");
|
||||||
bootScreen.bootLine("ImGui Setup");
|
bootScreen.bootLine("ImGui Setup");
|
||||||
try {
|
|
||||||
Thread.sleep(100);
|
|
||||||
} catch (InterruptedException ignored) {
|
|
||||||
}
|
|
||||||
ImBoolean imLoaded = new ImBoolean(false);
|
ImBoolean imLoaded = new ImBoolean(false);
|
||||||
Gdx.app.postRunnable(new Runnable() {
|
Gdx.app.postRunnable(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ImGuiSetup.init();
|
imguiSetup.init(fonts, v -> logger.info(imguiSetup, v));
|
||||||
imLoaded.set(true);
|
imLoaded.set(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -172,8 +181,7 @@ public class GDXAppVrGem4Activator implements BundleActivator {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ServiceReference<SystemWarpShip> systemWarpShipRef = context.getServiceReference(SystemWarpShip.class);
|
|
||||||
SystemWarpShip systemWarpShip = context.getService(systemWarpShipRef);
|
|
||||||
|
|
||||||
List<SystemWarpSea> registratedSeas = new ArrayList<>();
|
List<SystemWarpSea> registratedSeas = new ArrayList<>();
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package love.distributedrebirth.gdxapp4d.vrgem4;
|
package love.distributedrebirth.gdxapp4d.vrgem4;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
|
||||||
import imgui.ImFontConfig;
|
import imgui.ImFontConfig;
|
||||||
|
@ -16,10 +20,10 @@ import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||||
*/
|
*/
|
||||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||||
public class ImGuiSetup {
|
public class ImGuiSetup {
|
||||||
public static final ImGuiImplGlfw imGuiImp = new ImGuiImplGlfw();
|
public final static ImGuiImplGlfw imGuiImp = new ImGuiImplGlfw();
|
||||||
public static final ImGuiImplGl3 imGuiGlImp = new ImGuiImplGl3();
|
public final static ImGuiImplGl3 imGuiGlImp = new ImGuiImplGl3();
|
||||||
|
|
||||||
public static void init() {
|
public void init(List<File> fonts, Consumer<String> logger) {
|
||||||
long windowHandle = -1;
|
long windowHandle = -1;
|
||||||
try {
|
try {
|
||||||
Object window = Gdx.graphics.getClass().getMethod("getWindow").invoke(Gdx.graphics);
|
Object window = Gdx.graphics.getClass().getMethod("getWindow").invoke(Gdx.graphics);
|
||||||
|
@ -28,7 +32,7 @@ public class ImGuiSetup {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
ImGui.createContext();
|
ImGui.createContext();
|
||||||
initFonts(ImGui.getIO());
|
initFonts(ImGui.getIO(), fonts, logger);
|
||||||
imGuiImp.init(windowHandle, true);
|
imGuiImp.init(windowHandle, true);
|
||||||
imGuiGlImp.init("#version 140");
|
imGuiGlImp.init("#version 140");
|
||||||
ImGui.getIO().setIniFilename(null);
|
ImGui.getIO().setIniFilename(null);
|
||||||
|
@ -36,7 +40,7 @@ public class ImGuiSetup {
|
||||||
initStyle();
|
initStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initStyle() {
|
private void initStyle() {
|
||||||
ImGui.styleColorsDark();
|
ImGui.styleColorsDark();
|
||||||
ImGuiStyle style = ImGui.getStyle();
|
ImGuiStyle style = ImGui.getStyle();
|
||||||
style.setWindowRounding(0f);
|
style.setWindowRounding(0f);
|
||||||
|
@ -45,43 +49,25 @@ public class ImGuiSetup {
|
||||||
style.setScrollbarSize(22f);
|
style.setScrollbarSize(22f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initFonts(final ImGuiIO io) {
|
private void initFonts(final ImGuiIO io, List<File> fonts, Consumer<String> logger) {
|
||||||
ImFontConfig fontConfig = new ImFontConfig();
|
ImFontConfig fontConfig = new ImFontConfig();
|
||||||
ImFontGlyphRangesBuilder fontBuilder = new ImFontGlyphRangesBuilder();
|
ImFontGlyphRangesBuilder fontBuilder = new ImFontGlyphRangesBuilder();
|
||||||
addRangeUnicodePlane0(fontBuilder);
|
addRangeUnicodePlane0(fontBuilder);
|
||||||
final short[] glyphRanges = fontBuilder.buildRanges();
|
final short[] glyphRanges = fontBuilder.buildRanges();
|
||||||
|
|
||||||
// Base font has almost everything
|
boolean first = true;
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/code-2000.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
for (File font: fonts) {
|
||||||
|
logger.accept("Load font: "+font);
|
||||||
|
io.getFonts().addFontFromMemoryTTF(Gdx.files.absolute(font.getAbsolutePath()).readBytes(), 22, fontConfig, glyphRanges);
|
||||||
|
if (first) {
|
||||||
fontConfig.setMergeMode(true);
|
fontConfig.setMergeMode(true);
|
||||||
// note: merges ~148 chars, just for 3 sub chars for SUBHEX, but still missing 2 chars from T12 alt1 clock
|
first = false;
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/free-sans.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
}
|
||||||
// Egyptian hieroglyphs
|
}
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/new-gardiner-bmp.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/fa-solid-900.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/noto-sans-samaritan.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/noto-sans-sinhala.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/noto-serif-tibetan.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/noto-sans-tagalog.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/noto-sans-tagbanwa.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/noto-sans-tai-le.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/noto-sans-tai-tham.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/noto-sans-batak.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/noto-sans-lepcha.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/noto-sans-balinese.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/noto-sans-sundanese.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/noto-sans-lisu.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/noto-sans-bamum.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/noto-sans-glagolitic.ttf").readBytes(), 22, fontConfig, glyphRanges);
|
|
||||||
|
|
||||||
// Missig plane 1++
|
|
||||||
// - code-2001
|
|
||||||
// - code-2002
|
|
||||||
// - noto-sans-brahmi
|
|
||||||
fontConfig.destroy();
|
fontConfig.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addRangeUnicodePlane0(ImFontGlyphRangesBuilder fontBuilder) {
|
private void addRangeUnicodePlane0(ImFontGlyphRangesBuilder fontBuilder) {
|
||||||
for (int c=0x0001;c<=0xFFEF;c++) {
|
for (int c=0x0001;c<=0xFFEF;c++) {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append(""+(char)c);
|
buf.append(""+(char)c);
|
||||||
|
@ -89,7 +75,7 @@ public class ImGuiSetup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dispose() {
|
public void dispose() {
|
||||||
imGuiImp.dispose();
|
imGuiImp.dispose();
|
||||||
imGuiGlImp.dispose();
|
imGuiGlImp.dispose();
|
||||||
ImGui.destroyContext();
|
ImGui.destroyContext();
|
||||||
|
|
1
pom.xml
1
pom.xml
|
@ -17,6 +17,7 @@
|
||||||
<module>gdxapp4d-chain-music-templeos</module>
|
<module>gdxapp4d-chain-music-templeos</module>
|
||||||
<module>gdxapp4d-chain-sys-engine</module>
|
<module>gdxapp4d-chain-sys-engine</module>
|
||||||
<module>gdxapp4d-chain-sys-engine-fuel</module>
|
<module>gdxapp4d-chain-sys-engine-fuel</module>
|
||||||
|
<module>gdxapp4d-chain-sys-unicode4d</module>
|
||||||
<module>gdxapp4d-lib-basicwd</module>
|
<module>gdxapp4d-lib-basicwd</module>
|
||||||
<module>gdxapp4d-lib-imxmi</module>
|
<module>gdxapp4d-lib-imxmi</module>
|
||||||
<module>gdxapp4d-lib-numberxd</module>
|
<module>gdxapp4d-lib-numberxd</module>
|
||||||
|
|
Loading…
Reference in a new issue