Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error making atlas out of multiple fonts #44

Closed
BladePoint opened this issue Sep 22, 2019 · 1 comment
Closed

Error making atlas out of multiple fonts #44

BladePoint opened this issue Sep 22, 2019 · 1 comment
Assignees

Comments

@BladePoint
Copy link

BladePoint commented Sep 22, 2019

I've been trying to make a single atlas out of multiple font files, but I always get a ".cfg not valid" error. What am I doing wrong? This is from an administrator Command Prompt in Windows 10 with Node.js version 12.10.0. I also tried it on a different Windows 10 machine with Node.js LTS version 10.16.3 and the result was the same.

msdf-bmfont --reuse -o Atlas.png font1.ttf

Using following settings
========================================
version         : msdf-bmfont-xml v2.5.2
outputType      : xml
filename        : Atlas.png
fontSize        : 42
charsetFile     : Unspecified, fallback to ASC-II
textureSize     : 2048,2048
texturePadding  : 1
border          : 0
distanceRange   : 4
fieldType       : msdf
roundDecimal    : 0
vector          : false
reuse           : true
smartSize       : false
pot             : false
square          : false
rot             : false
rtl             : false
fontFile        : font1.ttf
========================================
No valid charset file loaded, fallback to ASC-II
Warning: no bitmap for character ' ' (32), adding to font as empty

Generation complete!

wrote cfg file         :  Atlas.cfg
wrote spritesheet[ 0 ] :  Atlas.png
wrote font file        :  font1.fnt

msdf-bmfont --reuse Atlas.cfg font2.ttf

Using following settings
========================================
version         : msdf-bmfont-xml v2.5.2
outputType      : xml
filename        : font2
fontSize        : 42
charsetFile     : Unspecified, fallback to ASC-II
textureSize     : 2048,2048
texturePadding  : 1
border          : 0
distanceRange   : 4
fieldType       : msdf
roundDecimal    : 0
vector          : false
reuse           : Atlas.cfg
smartSize       : false
pot             : false
square          : false
rot             : false
rtl             : false
fontFile        : font2.ttf
========================================
File:  Atlas.cfg  not valid! Aborting...

Here is the Atlas.cfg:

{
	"opt": {
		"version": "msdf-bmfont-xml v2.5.2",
		"outputType": "xml",
		"filename": "Atlas",
		"fontSize": 42,
		"textureSize": [
			2048,
			2048
		],
		"texturePadding": 1,
		"border": 0,
		"distanceRange": 4,
		"fieldType": "msdf",
		"roundDecimal": 0,
		"vector": false,
		"smartSize": false,
		"pot": false,
		"square": false,
		"rot": false,
		"rtl": false,
		"fontFile": "font1.ttf",
		"fontSpacing": [
			0,
			0
		],
		"fontPadding": [
			0,
			0,
			0,
			0
		],
		"textureWidth": 2048,
		"textureHeight": 2048,
		"tolerance": 0,
		"charset": [
			" ",
			"!",
			"\"",
			"#",
			"$",
			"%",
			"&",
			"'",
			"(",
			")",
			"*",
			"+",
			",",
			"-",
			".",
			"/",
			"0",
			"1",
			"2",
			"3",
			"4",
			"5",
			"6",
			"7",
			"8",
			"9",
			":",
			";",
			"<",
			"=",
			">",
			"?",
			"@",
			"A",
			"B",
			"C",
			"D",
			"E",
			"F",
			"G",
			"H",
			"I",
			"J",
			"K",
			"L",
			"M",
			"N",
			"O",
			"P",
			"Q",
			"R",
			"S",
			"T",
			"U",
			"V",
			"W",
			"X",
			"Y",
			"Z",
			"[",
			"\\",
			"]",
			"^",
			"_",
			"`",
			"a",
			"b",
			"c",
			"d",
			"e",
			"f",
			"g",
			"h",
			"i",
			"j",
			"k",
			"l",
			"m",
			"n",
			"o",
			"p",
			"q",
			"r",
			"s",
			"t",
			"u",
			"v",
			"w",
			"x",
			"y",
			"z",
			"{",
			"|",
			"}",
			"~"
		]
	},
	"pages": [
		"Atlas.png"
	],
	"packer": {
		"bins": [
			{
				"width": 2048,
				"height": 2048,
				"maxWidth": 2048,
				"maxHeight": 2048,
				"freeRects": [
					{
						"x": 28,
						"y": 36,
						"width": 31,
						"height": 9
					},
					{
						"x": 40,
						"y": 116,
						"width": 29,
						"height": 4
					},
					{
						"x": 59,
						"y": 72,
						"width": 18,
						"height": 8
					},
					{
						"x": 22,
						"y": 260,
						"width": 18,
						"height": 10
					},
					{
						"x": 69,
						"y": 152,
						"width": 15,
						"height": 4
					},
					{
						"x": 77,
						"y": 108,
						"width": 19,
						"height": 8
					},
					{
						"x": 26,
						"y": 331,
						"width": 9,
						"height": 1
					},
					{
						"x": 35,
						"y": 366,
						"width": 4,
						"height": 2
					},
					{
						"x": 84,
						"y": 188,
						"width": 10,
						"height": 4
					},
					{
						"x": 27,
						"y": 439,
						"width": 18,
						"height": 1
					},
					{
						"x": 39,
						"y": 401,
						"width": 19,
						"height": 3
					},
					{
						"x": 58,
						"y": 436,
						"width": 1991,
						"height": 3
					},
					{
						"x": 78,
						"y": 436,
						"width": 1971,
						"height": 1613
					},
					{
						"x": 87,
						"y": 401,
						"width": 1962,
						"height": 1648
					},
					{
						"x": 94,
						"y": 223,
						"width": 11,
						"height": 5
					},
					{
						"x": 96,
						"y": 144,
						"width": 16,
						"height": 8
					},
					{
						"x": 91,
						"y": 359,
						"width": 1958,
						"height": 7
					},
					{
						"x": 104,
						"y": 359,
						"width": 1945,
						"height": 1690
					},
					{
						"x": 126,
						"y": 333,
						"width": 1923,
						"height": 1716
					},
					{
						"x": 105,
						"y": 258,
						"width": 16,
						"height": 5
					},
					{
						"x": 121,
						"y": 293,
						"width": 1928,
						"height": 5
					},
					{
						"x": 144,
						"y": 292,
						"width": 1905,
						"height": 1757
					},
					{
						"x": 129,
						"y": 292,
						"width": 1920,
						"height": 6
					},
					{
						"x": 72,
						"y": 295,
						"width": 19,
						"height": 1
					},
					{
						"x": 84,
						"y": 263,
						"width": 7,
						"height": 33
					},
					{
						"x": 61,
						"y": 255,
						"width": 11,
						"height": 5
					},
					{
						"x": 30,
						"y": 219,
						"width": 31,
						"height": 6
					},
					{
						"x": 55,
						"y": 192,
						"width": 6,
						"height": 33
					},
					{
						"x": 147,
						"y": 250,
						"width": 1902,
						"height": 1799
					},
					{
						"x": 136,
						"y": 250,
						"width": 1913,
						"height": 8
					},
					{
						"x": 128,
						"y": 143,
						"width": 19,
						"height": 1
					},
					{
						"x": 132,
						"y": 107,
						"width": 27,
						"height": 1
					},
					{
						"x": 144,
						"y": 71,
						"width": 17,
						"height": 1
					},
					{
						"x": 161,
						"y": 98,
						"width": 1888,
						"height": 9
					},
					{
						"x": 112,
						"y": 187,
						"width": 29,
						"height": 1
					},
					{
						"x": 138,
						"y": 179,
						"width": 3,
						"height": 9
					},
					{
						"x": 0,
						"y": 641,
						"width": 2049,
						"height": 1408
					},
					{
						"x": 14,
						"y": 606,
						"width": 2035,
						"height": 9
					},
					{
						"x": 26,
						"y": 606,
						"width": 2023,
						"height": 1443
					},
					{
						"x": 40,
						"y": 571,
						"width": 2009,
						"height": 1478
					},
					{
						"x": 28,
						"y": 571,
						"width": 2021,
						"height": 9
					},
					{
						"x": 161,
						"y": 218,
						"width": 1888,
						"height": 1831
					},
					{
						"x": 141,
						"y": 218,
						"width": 1908,
						"height": 5
					},
					{
						"x": 147,
						"y": 169,
						"width": 18,
						"height": 10
					},
					{
						"x": 165,
						"y": 193,
						"width": 1884,
						"height": 13
					},
					{
						"x": 167,
						"y": 193,
						"width": 1882,
						"height": 1856
					},
					{
						"x": 174,
						"y": 158,
						"width": 1875,
						"height": 11
					},
					{
						"x": 189,
						"y": 158,
						"width": 1860,
						"height": 1891
					},
					{
						"x": 50,
						"y": 525,
						"width": 1999,
						"height": 1524
					},
					{
						"x": 45,
						"y": 474,
						"width": 11,
						"height": 1
					},
					{
						"x": 164,
						"y": 61,
						"width": 21,
						"height": 10
					},
					{
						"x": 196,
						"y": 82,
						"width": 1853,
						"height": 1967
					},
					{
						"x": 185,
						"y": 82,
						"width": 1864,
						"height": 52
					},
					{
						"x": 184,
						"y": 26,
						"width": 7,
						"height": 9
					},
					{
						"x": 209,
						"y": 47,
						"width": 1840,
						"height": 2002
					},
					{
						"x": 191,
						"y": 47,
						"width": 1858,
						"height": 14
					},
					{
						"x": 34,
						"y": 543,
						"width": 2015,
						"height": 2
					},
					{
						"x": 202,
						"y": 18,
						"width": 1847,
						"height": 8
					},
					{
						"x": 212,
						"y": 17,
						"width": 1837,
						"height": 2032
					},
					{
						"x": 223,
						"y": 0,
						"width": 1826,
						"height": 2049
					},
					{
						"x": 211,
						"y": 17,
						"width": 1838,
						"height": 9
					},
					{
						"x": 58,
						"y": 510,
						"width": 1991,
						"height": 1539
					},
					{
						"x": 70,
						"y": 498,
						"width": 1979,
						"height": 1551
					},
					{
						"x": 17,
						"y": 131,
						"width": 13,
						"height": 4
					},
					{
						"x": 28,
						"y": 120,
						"width": 2,
						"height": 15
					},
					{
						"x": 159,
						"y": 35,
						"width": 5,
						"height": 1
					}
				],
				"rects": [],
				"options": {
					"smart": false,
					"pot": false,
					"square": false,
					"allowRotation": false,
					"tag": false,
					"border": 0
				}
			}
		]
	}
}
@soimy soimy self-assigned this Oct 14, 2019
@soimy soimy closed this as completed in 3b57562 Feb 8, 2020
@soimy
Copy link
Owner

soimy commented Feb 8, 2020

Sorry for the late reply.
Per your situation, it seems that you Atlas.cfg does not present in your current dir from these codes:

msdf-bmfont-xml/cli.js

Lines 181 to 185 in 3b57562

function fileValidate(filePath) {
if (require('is-invalid-path')(filePath)) {
console.error('File: ', filePath, ' not valid! Aborting...');
process.exit(1);
} else return path.normalize(filePath);

Tested under MacOS 10.14.6 & Linux, not sure if I can reproduce this under Windows.
But when I'm trying to reproduce your problem, I found some old bugs regarding the multi-font atlas generation! Thank you.
You can try the latest version to see if that solves your problem, if not, feel free to re-open this issue, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants