Upgraded to code2000 font
This commit is contained in:
parent
bb76cbbe2f
commit
76014cfe87
|
@ -18,19 +18,34 @@ console.log("<opentype>");
|
|||
let num = font.numGlyphs;
|
||||
for(let glyphIndex = 0; glyphIndex < num; glyphIndex++) {
|
||||
let glyph = font.glyphs.get(glyphIndex);
|
||||
let path = glyph.getPath(0, 0, 72);
|
||||
if (path.commands.length === 0) {
|
||||
|
||||
// JS NOTE: without calling xMin the getContours return empty set.... :''(
|
||||
glyph.xMin;
|
||||
var contours = glyph.getContours();
|
||||
if (contours.length === 0) {
|
||||
// TODO: add compound support
|
||||
continue;
|
||||
}
|
||||
if (glyph.unicodes.length === 0) {
|
||||
continue; // with cmds, these are compound glyphs
|
||||
}
|
||||
let uni = glyph.unicodes.map(formatUnicode).join(', ');
|
||||
console.log("\t<glyph unicode=\""+uni+"\" name=\""+glyph.name+"\">"); /*"advanceWidth=\""+glyph.advanceWidth+"\" "+
|
||||
console.log("\t<glyph unicode=\""+uni+"\" name=\""+glyph.name+"\" advanceWidth=\""+glyph.advanceWidth+"\" "+
|
||||
"xMin=\""+glyph.xMin+"\" xMax=\""+glyph.xMax+"\" yMin=\""+glyph.yMin+"\" yMax=\""+glyph.yMax+"\" "+
|
||||
"leftSideBearing=\""+glyph.leftSideBearing+"\" pathFill=\""+path.fill+"\" "+
|
||||
"strokeStyle=\""+path.stroke+"\" lineWidth=\""+path.strokeWidth+"\">"); */
|
||||
"leftSideBearing=\""+glyph.leftSideBearing+"\">");
|
||||
|
||||
|
||||
for (let contourIndex = 0; contourIndex < contours.length; ++contourIndex) {
|
||||
const contour = contours[contourIndex];
|
||||
console.log("\t\t<contour>");
|
||||
for (let i = 0; i < contour.length; ++i) {
|
||||
let curr = contour[i];
|
||||
console.log("\t\t\t<point x=\""+curr.x+"\" y=\""+curr.y+"\" onCurve=\""+curr.onCurve+"\"/>");
|
||||
}
|
||||
console.log("\t\t</contour>");
|
||||
//console.log(JSON.stringify(curr));
|
||||
}
|
||||
/*
|
||||
for (i = 0; i < path.commands.length; i += 1) {
|
||||
cmd = path.commands[i];
|
||||
if (cmd.type === 'M') {
|
||||
|
@ -45,6 +60,7 @@ for(let glyphIndex = 0; glyphIndex < num; glyphIndex++) {
|
|||
console.log("\t\t<pathClose/>");
|
||||
}
|
||||
}
|
||||
*/``
|
||||
console.log("\t</glyph>");
|
||||
}
|
||||
console.log("</opentype>");
|
||||
|
|
|
@ -4,13 +4,10 @@
|
|||
"description": "Convert font data to XML intermediate.",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "npm run-script conv0 && npm run-script conv1 && npm run-script conv2 && npm run-script conv3 && npm run-script conv4",
|
||||
"conv0": "node conv-font.js ../main-gdxapp/assets/font/free-sans.ttf > bin/free-sans.xml",
|
||||
"conv1": "node conv-font.js ../main-gdxapp/assets/font/noto-sans-cjkjp-medium.otf > bin/noto-sans-cjkjp-medium.xml",
|
||||
"conv2": "node conv-font.js ../main-gdxapp/assets/font/roboto-bold.ttf > bin/roboto-bold.xml",
|
||||
"conv3": "node conv-font.js ../main-gdxapp/assets/font/arslan-wessam.ttf > bin/arslan-wessam.xml",
|
||||
"conv4": "node conv-font.js ../main-gdxapp/assets/font/norse-kawl.otf > bin/norse-kawl.xml",
|
||||
"debug": "node conv-font.js ../main-gdxapp/assets/font/roboto-bold.ttf"
|
||||
"start": "npm run-script conv0 && npm run-script conv1",
|
||||
"conv0": "node conv-font.js ../main-gdxapp/assets/font/code2000.ttf > bin/code2000.xml",
|
||||
"conv1": "node conv-font.js ../main-gdxapp/assets/font/free-sans.ttf > bin/free-sans.xml",
|
||||
"debug": "node conv-font.js ../main-gdxapp/assets/font/free-sans.ttf"
|
||||
},
|
||||
"dependencies": {
|
||||
"opentype.js": "1.3.4"
|
||||
|
|
|
@ -13,11 +13,11 @@ public enum T10PartDecimal implements BãßBȍőnPartAlt2ʸᴰ<T10PartDecimal> {
|
|||
|
||||
PART_1 ("˥","零","zero", "˥","꜒"),
|
||||
PART_2 ("˦","壹","one", "˦","꜓"),
|
||||
PART_3 ("˧","貳","two", "˧","꜔"),
|
||||
PART_4 ("˨","參","three","˨","꜕"),
|
||||
PART_3 ("˧","贰","two", "˧","꜔"),
|
||||
PART_4 ("˨","叁","three","˨","꜕"),
|
||||
PART_5 ("˩","肆","four", "˩","꜖"),
|
||||
PART_6 ("꜖","伍","five", "꜌","꜑"),
|
||||
PART_7 ("꜕","陸","six", "꜋","꜐"),
|
||||
PART_7 ("꜕","陆","six", "꜋","꜐"),
|
||||
PART_8 ("꜔","柒","seven","꜊","꜏"),
|
||||
PART_9 ("꜓","捌","eight","꜉","꜎"),
|
||||
PART_10("꜒","玖","nine", "꜈","꜍"),
|
||||
|
|
|
@ -52,11 +52,11 @@ public enum BaseGlyphSet implements BãßBȍőnGlyphSetʸᴰ<BaseGlyphSet> {
|
|||
GREEK_HEX(GREEK.BȍőnGlyphSetNumber10(),
|
||||
new BaseGlyphSetNumber("ō","α","β","γ","δ","ε","ϝ","ζ","η","θ","ι","κ","λ","μ","ν","ξ"),
|
||||
GREEK.BȍőnGlyphSetNumber36()),
|
||||
CYRILLIC(new BaseGlyphSetNumber("⃝","А","В","Г","Д","Є","Ѕ","З","И","Ѳ"),
|
||||
CYRILLIC(new BaseGlyphSetNumber("Ф","А","В","Г","Д","Є","Ѕ","З","И","Ѳ"),
|
||||
LATIN_BASIC.BȍőnGlyphSetNumber16(),
|
||||
new BaseGlyphSetNumber("А","В","Г","Д","Є","Ѕ","З","И","Ѳ","І","К","Л","М","Н","Ѯ","Ѻ","П","Ч","Р","С","Т","Ѵ","Ф","Х","Ѱ","Ѿ","Ц")),
|
||||
CYRILLIC_HEX(CYRILLIC.BȍőnGlyphSetNumber10(),
|
||||
new BaseGlyphSetNumber("⃝","А","В","Г","Д","Є","Ѕ","З","И","Ѳ","҂"," ҈"," ҉"," ꙰"," ꙱"," ꙲"),
|
||||
new BaseGlyphSetNumber("Ф","А","В","Г","Д","Є","Ѕ","З","И","Ѳ","҂"," ҈"," ҉"," ꙰"," ꙱"," ꙲"),
|
||||
CYRILLIC.BȍőnGlyphSetNumber36()),
|
||||
BENGALI(new BaseGlyphSetNumber("০","১","২","৩","৪","৫","৬","৭","৮","৯"),
|
||||
LATIN_BASIC.BȍőnGlyphSetNumber16(),
|
||||
|
@ -64,6 +64,12 @@ public enum BaseGlyphSet implements BãßBȍőnGlyphSetʸᴰ<BaseGlyphSet> {
|
|||
BENGALI_HEX(BENGALI.BȍőnGlyphSetNumber10(),
|
||||
new BaseGlyphSetNumber("০","১","২","৩","৪","৫","৬","৭","৮","৯","জ্ঞ","ক্ষ","হ","স","ষ","শ"),
|
||||
BENGALI.BȍőnGlyphSetNumber36()),
|
||||
THAI(new BaseGlyphSetNumber("๐","๑","๒","๓","๔","๕","๖","๗","๘","๙"),
|
||||
LATIN_BASIC.BȍőnGlyphSetNumber16(),
|
||||
new BaseGlyphSetNumber("๑","๒","๓","๔","๕","๖","๗","๘","๙","ก","ข","ค","ฆ","ง","จ","ฉ","ช","ฌ","ญ","ฎ","ฐ","ฑ","ฒ","ณ","ด","ท","ธ")),
|
||||
THAI_HEX(THAI.BȍőnGlyphSetNumber10(),
|
||||
new BaseGlyphSetNumber("๐","๑","๒","๓","๔","๕","๖","๗","๘","๙","ก","ข","ค","ฆ","ง","จ"),
|
||||
THAI.BȍőnGlyphSetNumber36()),
|
||||
|
||||
RUNIC(new BaseGlyphSetNumber("ᛰ","ᚠ","ᚢ","ᚦ","ᚬ","ᚱ","ᚴ","ᚼ","ᚾ","ᛁ"),
|
||||
LATIN_BASIC.BȍőnGlyphSetNumber16(),
|
||||
|
@ -84,10 +90,16 @@ public enum BaseGlyphSet implements BãßBȍőnGlyphSetʸᴰ<BaseGlyphSet> {
|
|||
KOREAN_HEX.BȍőnGlyphSetNumber16().withAltGlyphSet(LATIN_TOP),
|
||||
KOREAN_HEX.BȍőnGlyphSetNumber36()),
|
||||
|
||||
CHINA_FINANCIAL_T(new BaseGlyphSetNumber(v -> T10PartDecimal.PART_1.BãßVoorElk(x -> v.add(x.BȍőnChinaKey()))), LATIN_BASIC.BȍőnGlyphSetNumber16(), null),
|
||||
CHINA_FINANCIAL_S(new BaseGlyphSetNumber("零","壹","贰","叁","肆","伍","陆","柒","捌","玖"), LATIN_BASIC.BȍőnGlyphSetNumber16(), null),
|
||||
CHINA_NORMAL_T(new BaseGlyphSetNumber("零","一","二","三","四","五","六","七","八","九"), LATIN_BASIC.BȍőnGlyphSetNumber16(), null),
|
||||
CHINA_NORMAL_S(new BaseGlyphSetNumber("〇","一","二","三","四","五","六","七","八","九"), LATIN_BASIC.BȍőnGlyphSetNumber16(), null),
|
||||
CHINA(
|
||||
new BaseGlyphSetNumber("零","一","二","三","四","五","六","七","八","九"), LATIN_BASIC.BȍőnGlyphSetNumber16(), null),
|
||||
CHINA_FORMAL(
|
||||
new BaseGlyphSetNumber(v -> T10PartDecimal.PART_1.BãßVoorElk(x -> v.add(x.BȍőnChinaKey()))), LATIN_BASIC.BȍőnGlyphSetNumber16(), null),
|
||||
CHINA_FORMAL_OLD(
|
||||
new BaseGlyphSetNumber("零","壹","貳","參","肆","伍","陸","柒","捌","玖"), LATIN_BASIC.BȍőnGlyphSetNumber16(), null),
|
||||
JAPAN(
|
||||
CHINA.BȍőnGlyphSetNumber10(), LATIN_BASIC.BȍőnGlyphSetNumber16(), null),
|
||||
JAPAN_FORMAL(
|
||||
new BaseGlyphSetNumber("零","壱","弐","参","四","五","六","七","八","九"), LATIN_BASIC.BȍőnGlyphSetNumber16(), null),
|
||||
|
||||
ARABIC(new BaseGlyphSetNumber("٠","١","٢","٣","٤","٥","٦","٧","٨","٩"),
|
||||
LATIN_BASIC.BȍőnGlyphSetNumber16(),
|
||||
|
|
Binary file not shown.
BIN
main-gdxapp/assets/font/code2000.ttf
Normal file
BIN
main-gdxapp/assets/font/code2000.ttf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -36,24 +36,19 @@ public class ImGuiSetup {
|
|||
}
|
||||
|
||||
private static void initFonts(final ImGuiIO io) {
|
||||
io.getFonts().addFontDefault();
|
||||
ImFontConfig fontConfig = new ImFontConfig();
|
||||
fontConfig.setMergeMode(true);
|
||||
ImFontGlyphRangesBuilder fontBuilder = new ImFontGlyphRangesBuilder();
|
||||
addRangeUnicodePlane0(fontBuilder);
|
||||
final short[] glyphRanges = fontBuilder.buildRanges();
|
||||
|
||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/noto-sans-cjkjp-medium.otf").readBytes(), 14, fontConfig, glyphRanges);
|
||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/free-sans.ttf").readBytes(), 14, fontConfig, glyphRanges);
|
||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/roboto-bold.ttf").readBytes(), 14, fontConfig, glyphRanges);
|
||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/arslan-wessam.ttf").readBytes(), 14, fontConfig, glyphRanges);
|
||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/norse-kawl.otf").readBytes(), 14, fontConfig, glyphRanges);
|
||||
|
||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/code2000.ttf").readBytes(), 24, fontConfig, glyphRanges);
|
||||
fontConfig.setMergeMode(true);
|
||||
// note: just for 3 sub chars for SUBHEX, but still missing 2 chars from T12 alt1 clock
|
||||
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/free-sans.ttf").readBytes(), 24, fontConfig, glyphRanges);
|
||||
fontConfig.destroy();
|
||||
}
|
||||
|
||||
private static void addRangeUnicodePlane0(ImFontGlyphRangesBuilder fontBuilder) {
|
||||
for (int c=0x0100;c<=0xFFEF;c++) {
|
||||
for (int c=0x0001;c<=0xFFEF;c++) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(""+(char)c);
|
||||
fontBuilder.addText(buf.toString());
|
||||
|
|
|
@ -1,24 +1,17 @@
|
|||
package love.distributedrebirth.gdxapp.screen;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import imgui.ImGui;
|
||||
import imgui.flag.ImGuiCond;
|
||||
import imgui.flag.ImGuiTableFlags;
|
||||
import imgui.type.ImBoolean;
|
||||
import imgui.type.ImInt;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
import love.distributedrebirth.gdxapp.GDXAppMain;
|
||||
import love.distributedrebirth.gdxapp.ImGuiRendererMain;
|
||||
import love.distributedrebirth.numberxd.glyph.BaseGlyphSet;
|
||||
import love.distributedrebirth.numberxd.glyph.BaseGlyphSetNumber;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public class SystemBaseGlyphRenderer extends ImGuiRendererMain {
|
||||
|
||||
private ImInt selectedGlyphPart = new ImInt();
|
||||
|
||||
public SystemBaseGlyphRenderer(GDXAppMain main) {
|
||||
super(main);
|
||||
}
|
||||
|
@ -27,83 +20,45 @@ public class SystemBaseGlyphRenderer extends ImGuiRendererMain {
|
|||
public void render(ImBoolean widgetOpen) {
|
||||
ImGui.setNextWindowPos(200, 200, ImGuiCond.FirstUseEver);
|
||||
ImGui.setNextWindowSize(640, 480, ImGuiCond.FirstUseEver);
|
||||
if (ImGui.begin("Base glyph", widgetOpen)) {
|
||||
List<BaseGlyphSet> bases = new ArrayList<>();
|
||||
for (BaseGlyphSet glyphSet:BaseGlyphSet.values()) {
|
||||
bases.add(glyphSet);
|
||||
}
|
||||
String[] items = new String[bases.size()];
|
||||
for (int i=0;i<items.length;i++) {
|
||||
items[i] = bases.get(i).BȍőnNaam();
|
||||
}
|
||||
String selectedItem = items[selectedGlyphPart.get()];
|
||||
BaseGlyphSet glyphSet = BaseGlyphSet.valueOf(selectedItem);
|
||||
|
||||
ImGui.text("Glyph:");
|
||||
ImGui.sameLine();
|
||||
ImGui.combo("Set", selectedGlyphPart, items);
|
||||
if (ImGui.begin("Base Glyph Set", widgetOpen)) {
|
||||
|
||||
int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV;
|
||||
ImGui.beginTable("base-part", 7, flags);
|
||||
ImGui.tableSetupColumn("Example");
|
||||
ImGui.tableSetupColumn("tel10");
|
||||
ImGui.tableSetupColumn("hon10");
|
||||
ImGui.tableSetupColumn("tel16");
|
||||
ImGui.tableSetupColumn("hon16");
|
||||
ImGui.tableSetupColumn("tel36");
|
||||
ImGui.tableSetupColumn("hon36");
|
||||
ImGui.beginTable("base-part", 3, flags);
|
||||
ImGui.tableSetupColumn("Language");
|
||||
ImGui.tableSetupColumn("10Numbers");
|
||||
ImGui.tableSetupColumn("16Numbers");
|
||||
ImGui.tableHeadersRow();
|
||||
|
||||
int[] numberSet = {0,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,
|
||||
24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42};
|
||||
|
||||
for (int number:numberSet) {
|
||||
int number100 = number * 1;
|
||||
BaseGlyphSetNumber number10 = glyphSet.BȍőnGlyphSetNumber10();
|
||||
BaseGlyphSetNumber number16 = glyphSet.BȍőnGlyphSetNumber16();
|
||||
BaseGlyphSetNumber number36 = glyphSet.BȍőnGlyphSetNumber36();
|
||||
|
||||
for (BaseGlyphSet set:BaseGlyphSet.values()) {
|
||||
ImGui.tableNextRow();
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text(Integer.toString(number));
|
||||
|
||||
if (number10 != null) {
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text(glyphSet.BȍőnPrintGlyphSetNumber10(number, 50));
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text(glyphSet.BȍőnPrintGlyphSetNumber10(number100, 500));
|
||||
} else {
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text("");
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text("");
|
||||
}
|
||||
if (number16 != null) {
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text(glyphSet.BȍőnPrintGlyphSetNumber16(number, 50));
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text(glyphSet.BȍőnPrintGlyphSetNumber16(number100, 500));
|
||||
} else {
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text("");
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text("");
|
||||
}
|
||||
if (number36 != null) {
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text(glyphSet.BȍőnPrintGlyphSetNumber36(number, 50));
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text(glyphSet.BȍőnPrintGlyphSetNumber36(number100, 500));
|
||||
} else {
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text("");
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text("");
|
||||
}
|
||||
ImGui.text(set.BȍőnNaam());
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text(print10Numbers(set));
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text(print16Numbers(set));
|
||||
}
|
||||
|
||||
ImGui.endTable();
|
||||
}
|
||||
ImGui.end();
|
||||
}
|
||||
|
||||
private String print10Numbers(BaseGlyphSet set) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i=0;i<10;i++) {
|
||||
buf.append(set.BȍőnGlyphSetNumber10().BȍőnCharFor(i));
|
||||
buf.append(set.BȍőnGlyphSetNumber10().BȍőnCharSeperator());
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
private String print16Numbers(BaseGlyphSet set) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i=0;i<16;i++) {
|
||||
buf.append(set.BȍőnPrintGlyphSetNumber16(i, 99));
|
||||
buf.append(" ");
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue