fix font loading
parent
9ee97f187a
commit
a6d68c5773
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
||||||
// COMPILE TIME DEFINITIONS (Generated via gulp)
|
// COMPILE TIME DEFINITIONS (Generated via gulp)
|
||||||
var __DATE__ = "Wed Nov 22 2017 16:08:49 GMT+0100 (CET)";
|
var __DATE__ = "Thu Nov 23 2017 08:11:44 GMT+0100 (CET)";
|
||||||
// END COMPILE TIME DEFINITIONS
|
// END COMPILE TIME DEFINITIONS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11140,12 +11140,18 @@ GameLib.D3.Font.prototype.createInstance = function() {
|
||||||
GameLib.Event.LOAD_FONT,
|
GameLib.Event.LOAD_FONT,
|
||||||
{
|
{
|
||||||
font : this
|
font : this
|
||||||
}
|
},
|
||||||
|
function(fontInstance) {
|
||||||
|
this.instance = fontInstance;
|
||||||
|
GameLib.Component.prototype.createInstance.call(this);
|
||||||
|
}.bind(this),
|
||||||
|
function(error) {
|
||||||
|
console.error(error);
|
||||||
|
this.instance = null;
|
||||||
|
GameLib.Component.prototype.createInstance.call(this);
|
||||||
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.instance = null;
|
|
||||||
|
|
||||||
GameLib.Component.prototype.createInstance.call(this);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31551,7 +31557,7 @@ GameLib.System.Storage.prototype.processBlenderData = function(data) {
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.System.Storage.prototype.loadFont = function(data) {
|
GameLib.System.Storage.prototype.loadFont = function(data, callback, errorCallback) {
|
||||||
|
|
||||||
console.log('loading font : ' + data.font.name);
|
console.log('loading font : ' + data.font.name);
|
||||||
|
|
||||||
|
@ -31569,23 +31575,20 @@ GameLib.System.Storage.prototype.loadFont = function(data) {
|
||||||
function ( font ) {
|
function ( font ) {
|
||||||
|
|
||||||
if (GameLib.Utils.IsEmpty(font.data)) {
|
if (GameLib.Utils.IsEmpty(font.data)) {
|
||||||
GameLib.Event.Emit(
|
|
||||||
GameLib.Event.FONT_NOT_FOUND,
|
errorCallback({message:'font is empty'});
|
||||||
{
|
|
||||||
font: data.font
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
data.font.instance = font;
|
|
||||||
data.font.createInstance();
|
callback(font);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
function(error) {
|
function(error) {
|
||||||
console.error(error.message);
|
errorCallback(error);
|
||||||
throw new Error(error.message);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -46,12 +46,18 @@ GameLib.D3.Font.prototype.createInstance = function() {
|
||||||
GameLib.Event.LOAD_FONT,
|
GameLib.Event.LOAD_FONT,
|
||||||
{
|
{
|
||||||
font : this
|
font : this
|
||||||
}
|
},
|
||||||
|
function(fontInstance) {
|
||||||
|
this.instance = fontInstance;
|
||||||
|
GameLib.Component.prototype.createInstance.call(this);
|
||||||
|
}.bind(this),
|
||||||
|
function(error) {
|
||||||
|
console.error(error);
|
||||||
|
this.instance = null;
|
||||||
|
GameLib.Component.prototype.createInstance.call(this);
|
||||||
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.instance = null;
|
|
||||||
|
|
||||||
GameLib.Component.prototype.createInstance.call(this);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -904,7 +904,7 @@ GameLib.System.Storage.prototype.processBlenderData = function(data) {
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.System.Storage.prototype.loadFont = function(data) {
|
GameLib.System.Storage.prototype.loadFont = function(data, callback, errorCallback) {
|
||||||
|
|
||||||
console.log('loading font : ' + data.font.name);
|
console.log('loading font : ' + data.font.name);
|
||||||
|
|
||||||
|
@ -922,23 +922,20 @@ GameLib.System.Storage.prototype.loadFont = function(data) {
|
||||||
function ( font ) {
|
function ( font ) {
|
||||||
|
|
||||||
if (GameLib.Utils.IsEmpty(font.data)) {
|
if (GameLib.Utils.IsEmpty(font.data)) {
|
||||||
GameLib.Event.Emit(
|
|
||||||
GameLib.Event.FONT_NOT_FOUND,
|
errorCallback({message:'font is empty'});
|
||||||
{
|
|
||||||
font: data.font
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
data.font.instance = font;
|
|
||||||
data.font.createInstance();
|
callback(font);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
function(error) {
|
function(error) {
|
||||||
console.error(error.message);
|
errorCallback(error);
|
||||||
throw new Error(error.message);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue