@pixi/text-bitmap
Advanced tools
Comparing version 5.2.1 to 5.2.2
/*! | ||
* @pixi/text-bitmap - v5.2.1 | ||
* Compiled Tue, 28 Jan 2020 23:33:11 UTC | ||
* @pixi/text-bitmap - v5.2.2 | ||
* Compiled Tue, 21 Apr 2020 03:53:51 UTC | ||
* | ||
@@ -583,3 +583,3 @@ * @pixi/text-bitmap is licensed under the MIT License. | ||
var pages = xml.getElementsByTagName('page'); | ||
var res = utils.getResolutionOfUrl(pages[0].getAttribute('file'), settings.settings.RESOLUTION); | ||
var res = utils.getResolutionOfUrl(pages[0].getAttribute('file')); | ||
var pagesTextures = {}; | ||
@@ -586,0 +586,0 @@ |
/*! | ||
* @pixi/text-bitmap - v5.2.1 | ||
* Compiled Tue, 28 Jan 2020 23:33:11 UTC | ||
* @pixi/text-bitmap - v5.2.2 | ||
* Compiled Tue, 21 Apr 2020 03:53:51 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/text-bitmap is licensed under the MIT License. | ||
*/ | ||
this.PIXI=this.PIXI||{};var _pixi_text_bitmap=function(t,e,i,n,r,a,s,h){"use strict";var o=function(t){function i(e,i){var a=this;void 0===i&&(i={}),t.call(this),this._textWidth=0,this._textHeight=0,this._glyphs=[],this._font={tint:void 0!==i.tint?i.tint:16777215,align:i.align||"left",name:null,size:0},this.font=i.font,this._text=e,this._maxWidth=0,this._maxLineHeight=0,this._letterSpacing=0,this._anchor=new n.ObservablePoint(function(){a.dirty=!0},this,0,0),this.dirty=!1,this.roundPixels=r.settings.ROUND_PIXELS,this.updateText()}t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i;var h={tint:{configurable:!0},align:{configurable:!0},anchor:{configurable:!0},font:{configurable:!0},text:{configurable:!0},maxWidth:{configurable:!0},maxLineHeight:{configurable:!0},textWidth:{configurable:!0},letterSpacing:{configurable:!0},textHeight:{configurable:!0}};return i.prototype.updateText=function(){for(var t=i.fonts[this._font.name],e=this._font.size/t.size,r=new n.Point,h=[],o=[],g=this._text.replace(/(?:\r\n|\r)/g,"\n")||" ",l=g.length,u=this._maxWidth*t.size/this._font.size,f=null,c=0,p=0,d=0,x=-1,_=0,m=0,y=0,b=0;b<l;b++){var v=g.charCodeAt(b),I=g.charAt(b);if(/(?:\s)/.test(I)&&(x=b,_=c),"\r"!==I&&"\n"!==I){var A=t.chars[v];A&&(f&&A.kerning[f]&&(r.x+=A.kerning[f]),h.push({texture:A.texture,line:d,charCode:v,position:new n.Point(r.x+A.xOffset+this._letterSpacing/2,r.y+A.yOffset)}),r.x+=A.xAdvance+this._letterSpacing,c=r.x,y=Math.max(y,A.yOffset+A.texture.height),f=v,-1!==x&&u>0&&r.x>u&&(++m,s.removeItems(h,1+x-m,1+b-x),b=x,x=-1,o.push(_),p=Math.max(p,_),d++,r.x=0,r.y+=t.lineHeight,f=null))}else o.push(c),p=Math.max(p,c),++d,++m,r.x=0,r.y+=t.lineHeight,f=null}var T=g.charAt(g.length-1);"\r"!==T&&"\n"!==T&&(/(?:\s)/.test(T)&&(c=_),o.push(c),p=Math.max(p,c));for(var P=[],O=0;O<=d;O++){var E=0;"right"===this._font.align?E=p-o[O]:"center"===this._font.align&&(E=(p-o[O])/2),P.push(E)}for(var H=h.length,L=this.tint,S=0;S<H;S++){var W=this._glyphs[S];W?W.texture=h[S].texture:((W=new a.Sprite(h[S].texture)).roundPixels=this.roundPixels,this._glyphs.push(W)),W.position.x=(h[S].position.x+P[h[S].line])*e,W.position.y=h[S].position.y*e,W.scale.x=W.scale.y=e,W.tint=L,W.parent||this.addChild(W)}for(var X=H;X<this._glyphs.length;++X)this.removeChild(this._glyphs[X]);if(this._textWidth=p*e,this._textHeight=(r.y+t.lineHeight)*e,0!==this.anchor.x||0!==this.anchor.y)for(var z=0;z<H;z++)this._glyphs[z].x-=this._textWidth*this.anchor.x,this._glyphs[z].y-=this._textHeight*this.anchor.y;this._maxLineHeight=y*e},i.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},i.prototype.getLocalBounds=function(){return this.validate(),t.prototype.getLocalBounds.call(this)},i.prototype.validate=function(){this.dirty&&(this.updateText(),this.dirty=!1)},h.tint.get=function(){return this._font.tint},h.tint.set=function(t){this._font.tint="number"==typeof t&&t>=0?t:16777215,this.dirty=!0},h.align.get=function(){return this._font.align},h.align.set=function(t){this._font.align=t||"left",this.dirty=!0},h.anchor.get=function(){return this._anchor},h.anchor.set=function(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)},h.font.get=function(){return this._font},h.font.set=function(t){t&&("string"==typeof t?(t=t.split(" "),this._font.name=1===t.length?t[0]:t.slice(1).join(" "),this._font.size=t.length>=2?parseInt(t[0],10):i.fonts[this._font.name].size):(this._font.name=t.name,this._font.size="number"==typeof t.size?t.size:parseInt(t.size,10)),this.dirty=!0)},h.text.get=function(){return this._text},h.text.set=function(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)},h.maxWidth.get=function(){return this._maxWidth},h.maxWidth.set=function(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)},h.maxLineHeight.get=function(){return this.validate(),this._maxLineHeight},h.textWidth.get=function(){return this.validate(),this._textWidth},h.letterSpacing.get=function(){return this._letterSpacing},h.letterSpacing.set=function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)},h.textHeight.get=function(){return this.validate(),this._textHeight},i.registerFont=function(t,a){var h={},o=t.getElementsByTagName("info")[0],g=t.getElementsByTagName("common")[0],l=t.getElementsByTagName("page"),u=s.getResolutionOfUrl(l[0].getAttribute("file"),r.settings.RESOLUTION),f={};h.font=o.getAttribute("face"),h.size=parseInt(o.getAttribute("size"),10),h.lineHeight=parseInt(g.getAttribute("lineHeight"),10)/u,h.chars={},a instanceof e.Texture&&(a=[a]);for(var c=0;c<l.length;c++){var p=l[c].getAttribute("id"),d=l[c].getAttribute("file");f[p]=a instanceof Array?a[c]:a[d]}for(var x=t.getElementsByTagName("char"),_=0;_<x.length;_++){var m=x[_],y=parseInt(m.getAttribute("id"),10),b=m.getAttribute("page")||0,v=new n.Rectangle(parseInt(m.getAttribute("x"),10)/u+f[b].frame.x/u,parseInt(m.getAttribute("y"),10)/u+f[b].frame.y/u,parseInt(m.getAttribute("width"),10)/u,parseInt(m.getAttribute("height"),10)/u);h.chars[y]={xOffset:parseInt(m.getAttribute("xoffset"),10)/u,yOffset:parseInt(m.getAttribute("yoffset"),10)/u,xAdvance:parseInt(m.getAttribute("xadvance"),10)/u,kerning:{},texture:new e.Texture(f[b].baseTexture,v),page:b}}for(var I=t.getElementsByTagName("kerning"),A=0;A<I.length;A++){var T=I[A],P=parseInt(T.getAttribute("first"),10)/u,O=parseInt(T.getAttribute("second"),10)/u,E=parseInt(T.getAttribute("amount"),10)/u;h.chars[O]&&(h.chars[O].kerning[P]=E)}return i.fonts[h.font]=h,h},Object.defineProperties(i.prototype,h),i}(i.Container);o.fonts={};var g=function(){};return g.parse=function(t,e){t.bitmapFont=o.registerFont(t.data,e)},g.add=function(){h.LoaderResource.setExtensionXhrType("fnt",h.LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)},g.dirname=function(t){var e=t.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return e===t?".":""===e?"/":e},g.use=function(t,e){if(t.data&&t.type===h.LoaderResource.TYPE.XML)if(0!==t.data.getElementsByTagName("page").length&&0!==t.data.getElementsByTagName("info").length&&null!==t.data.getElementsByTagName("info")[0].getAttribute("face")){var i=t.isDataUrl?"":g.dirname(t.url);t.isDataUrl&&("."===i&&(i=""),this.baseUrl&&i&&"/"===this.baseUrl.charAt(this.baseUrl.length-1)&&(i+="/")),(i=i.replace(this.baseUrl,""))&&"/"!==i.charAt(i.length-1)&&(i+="/");for(var n=t.data.getElementsByTagName("page"),r={},a=function(i){r[i.metadata.pageFile]=i.texture,Object.keys(r).length===n.length&&(g.parse(t,r),e())},s=0;s<n.length;++s){var o=n[s].getAttribute("file"),l=i+o,u=!1;for(var f in this.resources){var c=this.resources[f];if(c.url===l){c.metadata.pageFile=o,c.texture?a(c):c.onAfterMiddleware.add(a),u=!0;break}}if(!u){var p={crossOrigin:t.crossOrigin,loadType:h.LoaderResource.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:o},t.metadata.imageMetadata),parentResource:t};this.add(l,p,a)}}}else e();else e()},t.BitmapFontLoader=g,t.BitmapText=o,t}({},PIXI,PIXI,PIXI,PIXI,PIXI,PIXI.utils,PIXI);Object.assign(this.PIXI,_pixi_text_bitmap); | ||
this.PIXI=this.PIXI||{};var _pixi_text_bitmap=function(t,e,i,n,r,a,s,h){"use strict";var o=function(t){function i(e,i){var a=this;void 0===i&&(i={}),t.call(this),this._textWidth=0,this._textHeight=0,this._glyphs=[],this._font={tint:void 0!==i.tint?i.tint:16777215,align:i.align||"left",name:null,size:0},this.font=i.font,this._text=e,this._maxWidth=0,this._maxLineHeight=0,this._letterSpacing=0,this._anchor=new n.ObservablePoint(function(){a.dirty=!0},this,0,0),this.dirty=!1,this.roundPixels=r.settings.ROUND_PIXELS,this.updateText()}t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i;var h={tint:{configurable:!0},align:{configurable:!0},anchor:{configurable:!0},font:{configurable:!0},text:{configurable:!0},maxWidth:{configurable:!0},maxLineHeight:{configurable:!0},textWidth:{configurable:!0},letterSpacing:{configurable:!0},textHeight:{configurable:!0}};return i.prototype.updateText=function(){for(var t=i.fonts[this._font.name],e=this._font.size/t.size,r=new n.Point,h=[],o=[],g=this._text.replace(/(?:\r\n|\r)/g,"\n")||" ",l=g.length,u=this._maxWidth*t.size/this._font.size,f=null,c=0,p=0,d=0,x=-1,_=0,m=0,y=0,b=0;b<l;b++){var v=g.charCodeAt(b),I=g.charAt(b);if(/(?:\s)/.test(I)&&(x=b,_=c),"\r"!==I&&"\n"!==I){var A=t.chars[v];A&&(f&&A.kerning[f]&&(r.x+=A.kerning[f]),h.push({texture:A.texture,line:d,charCode:v,position:new n.Point(r.x+A.xOffset+this._letterSpacing/2,r.y+A.yOffset)}),r.x+=A.xAdvance+this._letterSpacing,c=r.x,y=Math.max(y,A.yOffset+A.texture.height),f=v,-1!==x&&u>0&&r.x>u&&(++m,s.removeItems(h,1+x-m,1+b-x),b=x,x=-1,o.push(_),p=Math.max(p,_),d++,r.x=0,r.y+=t.lineHeight,f=null))}else o.push(c),p=Math.max(p,c),++d,++m,r.x=0,r.y+=t.lineHeight,f=null}var T=g.charAt(g.length-1);"\r"!==T&&"\n"!==T&&(/(?:\s)/.test(T)&&(c=_),o.push(c),p=Math.max(p,c));for(var P=[],E=0;E<=d;E++){var O=0;"right"===this._font.align?O=p-o[E]:"center"===this._font.align&&(O=(p-o[E])/2),P.push(O)}for(var H=h.length,L=this.tint,S=0;S<H;S++){var W=this._glyphs[S];W?W.texture=h[S].texture:((W=new a.Sprite(h[S].texture)).roundPixels=this.roundPixels,this._glyphs.push(W)),W.position.x=(h[S].position.x+P[h[S].line])*e,W.position.y=h[S].position.y*e,W.scale.x=W.scale.y=e,W.tint=L,W.parent||this.addChild(W)}for(var X=H;X<this._glyphs.length;++X)this.removeChild(this._glyphs[X]);if(this._textWidth=p*e,this._textHeight=(r.y+t.lineHeight)*e,0!==this.anchor.x||0!==this.anchor.y)for(var z=0;z<H;z++)this._glyphs[z].x-=this._textWidth*this.anchor.x,this._glyphs[z].y-=this._textHeight*this.anchor.y;this._maxLineHeight=y*e},i.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},i.prototype.getLocalBounds=function(){return this.validate(),t.prototype.getLocalBounds.call(this)},i.prototype.validate=function(){this.dirty&&(this.updateText(),this.dirty=!1)},h.tint.get=function(){return this._font.tint},h.tint.set=function(t){this._font.tint="number"==typeof t&&t>=0?t:16777215,this.dirty=!0},h.align.get=function(){return this._font.align},h.align.set=function(t){this._font.align=t||"left",this.dirty=!0},h.anchor.get=function(){return this._anchor},h.anchor.set=function(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)},h.font.get=function(){return this._font},h.font.set=function(t){t&&("string"==typeof t?(t=t.split(" "),this._font.name=1===t.length?t[0]:t.slice(1).join(" "),this._font.size=t.length>=2?parseInt(t[0],10):i.fonts[this._font.name].size):(this._font.name=t.name,this._font.size="number"==typeof t.size?t.size:parseInt(t.size,10)),this.dirty=!0)},h.text.get=function(){return this._text},h.text.set=function(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)},h.maxWidth.get=function(){return this._maxWidth},h.maxWidth.set=function(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)},h.maxLineHeight.get=function(){return this.validate(),this._maxLineHeight},h.textWidth.get=function(){return this.validate(),this._textWidth},h.letterSpacing.get=function(){return this._letterSpacing},h.letterSpacing.set=function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)},h.textHeight.get=function(){return this.validate(),this._textHeight},i.registerFont=function(t,r){var a={},h=t.getElementsByTagName("info")[0],o=t.getElementsByTagName("common")[0],g=t.getElementsByTagName("page"),l=s.getResolutionOfUrl(g[0].getAttribute("file")),u={};a.font=h.getAttribute("face"),a.size=parseInt(h.getAttribute("size"),10),a.lineHeight=parseInt(o.getAttribute("lineHeight"),10)/l,a.chars={},r instanceof e.Texture&&(r=[r]);for(var f=0;f<g.length;f++){var c=g[f].getAttribute("id"),p=g[f].getAttribute("file");u[c]=r instanceof Array?r[f]:r[p]}for(var d=t.getElementsByTagName("char"),x=0;x<d.length;x++){var _=d[x],m=parseInt(_.getAttribute("id"),10),y=_.getAttribute("page")||0,b=new n.Rectangle(parseInt(_.getAttribute("x"),10)/l+u[y].frame.x/l,parseInt(_.getAttribute("y"),10)/l+u[y].frame.y/l,parseInt(_.getAttribute("width"),10)/l,parseInt(_.getAttribute("height"),10)/l);a.chars[m]={xOffset:parseInt(_.getAttribute("xoffset"),10)/l,yOffset:parseInt(_.getAttribute("yoffset"),10)/l,xAdvance:parseInt(_.getAttribute("xadvance"),10)/l,kerning:{},texture:new e.Texture(u[y].baseTexture,b),page:y}}for(var v=t.getElementsByTagName("kerning"),I=0;I<v.length;I++){var A=v[I],T=parseInt(A.getAttribute("first"),10)/l,P=parseInt(A.getAttribute("second"),10)/l,E=parseInt(A.getAttribute("amount"),10)/l;a.chars[P]&&(a.chars[P].kerning[T]=E)}return i.fonts[a.font]=a,a},Object.defineProperties(i.prototype,h),i}(i.Container);o.fonts={};var g=function(){};return g.parse=function(t,e){t.bitmapFont=o.registerFont(t.data,e)},g.add=function(){h.LoaderResource.setExtensionXhrType("fnt",h.LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)},g.dirname=function(t){var e=t.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return e===t?".":""===e?"/":e},g.use=function(t,e){if(t.data&&t.type===h.LoaderResource.TYPE.XML)if(0!==t.data.getElementsByTagName("page").length&&0!==t.data.getElementsByTagName("info").length&&null!==t.data.getElementsByTagName("info")[0].getAttribute("face")){var i=t.isDataUrl?"":g.dirname(t.url);t.isDataUrl&&("."===i&&(i=""),this.baseUrl&&i&&"/"===this.baseUrl.charAt(this.baseUrl.length-1)&&(i+="/")),(i=i.replace(this.baseUrl,""))&&"/"!==i.charAt(i.length-1)&&(i+="/");for(var n=t.data.getElementsByTagName("page"),r={},a=function(i){r[i.metadata.pageFile]=i.texture,Object.keys(r).length===n.length&&(g.parse(t,r),e())},s=0;s<n.length;++s){var o=n[s].getAttribute("file"),l=i+o,u=!1;for(var f in this.resources){var c=this.resources[f];if(c.url===l){c.metadata.pageFile=o,c.texture?a(c):c.onAfterMiddleware.add(a),u=!0;break}}if(!u){var p={crossOrigin:t.crossOrigin,loadType:h.LoaderResource.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:o},t.metadata.imageMetadata),parentResource:t};this.add(l,p,a)}}}else e();else e()},t.BitmapFontLoader=g,t.BitmapText=o,t}({},PIXI,PIXI,PIXI,PIXI,PIXI,PIXI.utils,PIXI);Object.assign(this.PIXI,_pixi_text_bitmap); | ||
//# sourceMappingURL=text-bitmap.min.js.map |
/*! | ||
* @pixi/text-bitmap - v5.2.1 | ||
* Compiled Tue, 28 Jan 2020 23:33:11 UTC | ||
* @pixi/text-bitmap - v5.2.2 | ||
* Compiled Tue, 21 Apr 2020 03:53:51 UTC | ||
* | ||
@@ -587,3 +587,3 @@ * @pixi/text-bitmap is licensed under the MIT License. | ||
var pages = xml.getElementsByTagName('page'); | ||
var res = getResolutionOfUrl(pages[0].getAttribute('file'), settings.RESOLUTION); | ||
var res = getResolutionOfUrl(pages[0].getAttribute('file')); | ||
var pagesTextures = {}; | ||
@@ -590,0 +590,0 @@ |
/*! | ||
* @pixi/text-bitmap - v5.2.1 | ||
* Compiled Tue, 28 Jan 2020 23:33:11 UTC | ||
* @pixi/text-bitmap - v5.2.2 | ||
* Compiled Tue, 21 Apr 2020 03:53:51 UTC | ||
* | ||
@@ -591,3 +591,3 @@ * @pixi/text-bitmap is licensed under the MIT License. | ||
var pages = xml.getElementsByTagName('page'); | ||
var res = utils.getResolutionOfUrl(pages[0].getAttribute('file'), settings.settings.RESOLUTION); | ||
var res = utils.getResolutionOfUrl(pages[0].getAttribute('file')); | ||
var pagesTextures = {}; | ||
@@ -594,0 +594,0 @@ |
{ | ||
"name": "@pixi/text-bitmap", | ||
"version": "5.2.1", | ||
"version": "5.2.2", | ||
"main": "lib/text-bitmap.js", | ||
@@ -27,14 +27,14 @@ "module": "lib/text-bitmap.es.js", | ||
"dependencies": { | ||
"@pixi/core": "5.2.1", | ||
"@pixi/display": "5.2.1", | ||
"@pixi/loaders": "5.2.1", | ||
"@pixi/math": "5.2.1", | ||
"@pixi/settings": "5.2.1", | ||
"@pixi/sprite": "5.2.1", | ||
"@pixi/utils": "5.2.1" | ||
"@pixi/core": "5.2.2", | ||
"@pixi/display": "5.2.2", | ||
"@pixi/loaders": "5.2.2", | ||
"@pixi/math": "5.2.2", | ||
"@pixi/settings": "5.2.2", | ||
"@pixi/sprite": "5.2.2", | ||
"@pixi/utils": "5.2.2" | ||
}, | ||
"devDependencies": { | ||
"@pixi/spritesheet": "5.2.1" | ||
"@pixi/spritesheet": "5.2.2" | ||
}, | ||
"gitHead": "b56b4fca1c169f0e6d2a0472251ba1f7399bb4a3" | ||
"gitHead": "c163c466c20f2286b6e41ab90d68a03aad2051d4" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
238313
+ Added@pixi/constants@5.2.2(transitive)
+ Added@pixi/core@5.2.2(transitive)
+ Added@pixi/display@5.2.2(transitive)
+ Added@pixi/loaders@5.2.2(transitive)
+ Added@pixi/math@5.2.2(transitive)
+ Added@pixi/runner@5.2.2(transitive)
+ Added@pixi/settings@5.2.2(transitive)
+ Added@pixi/sprite@5.2.2(transitive)
+ Added@pixi/ticker@5.2.2(transitive)
+ Added@pixi/utils@5.2.2(transitive)
- Removed@pixi/constants@5.2.1(transitive)
- Removed@pixi/core@5.2.1(transitive)
- Removed@pixi/display@5.2.1(transitive)
- Removed@pixi/loaders@5.2.1(transitive)
- Removed@pixi/math@5.2.1(transitive)
- Removed@pixi/runner@5.2.1(transitive)
- Removed@pixi/settings@5.2.1(transitive)
- Removed@pixi/sprite@5.2.1(transitive)
- Removed@pixi/ticker@5.2.1(transitive)
- Removed@pixi/utils@5.2.1(transitive)
Updated@pixi/core@5.2.2
Updated@pixi/display@5.2.2
Updated@pixi/loaders@5.2.2
Updated@pixi/math@5.2.2
Updated@pixi/settings@5.2.2
Updated@pixi/sprite@5.2.2
Updated@pixi/utils@5.2.2