Phaser.Text = function (game, x, y, text, style){ x = x || 0; y = y || 0; if (text === undefined || text === null ) { text = ''; } else { text = text.toString(); } style = Phaser.Utils.extend({ } , style); this.type = Phaser.TEXT; this.physicsType = Phaser.SPRITE; this.padding = new Phaser.Point(); this.textBounds = null ; this.canvas = PIXI.CanvasPool.create(this); this.context = this.canvas.getContext('2d'); this.colors = [] ; this.strokeColors = [] ; this.fontStyles = [] ; this.fontWeights = [] ; this.autoRound = false ; this._res = game.renderer.resolution; this._text = text; this._fontComponents = null ; this._lineSpacing = 0; this._charCount = 0; this._width = 0; this._height = 0; Phaser.Sprite.call(this, game, x, y, PIXI.Texture.fromCanvas(this.canvas)); this.setStyle(style); if (text !== '') { this.updateText(); } } ; Phaser.Text.prototype = Object.create(Phaser.Sprite.prototype); Phaser.Text.prototype.constructor = Phaser.Text; Phaser.Text.prototype.preUpdate = function (){ if (!this.preUpdatePhysics() || !this.preUpdateLifeSpan() || !this.preUpdateInWorld()) { return false ; } return this.preUpdateCore(); } ; Phaser.Text.prototype.update = function (){ } ; Phaser.Text.prototype.destroy = function (destroyChildren){ this.texture.destroy(true ); PIXI.CanvasPool.remove(this); Phaser.Component.Destroy.prototype.destroy.call(this, destroyChildren); } ; Phaser.Text.prototype.setShadow = function (x, y, color, blur, shadowStroke, shadowFill){ if (x === undefined) { x = 0; } if (y === undefined) { y = 0; } if (color === undefined) { color = 'rgba(0, 0, 0, 1)'; } if (blur === undefined) { blur = 0; } if (shadowStroke === undefined) { shadowStroke = true ; } if (shadowFill === undefined) { shadowFill = true ; } this.style.shadowOffsetX = x; this.style.shadowOffsetY = y; this.style.shadowColor = color; this.style.shadowBlur = blur; this.style.shadowStroke = shadowStroke; this.style.shadowFill = shadowFill; this.dirty = true ; return this; } ; Phaser.Text.prototype.setStyle = function (style){ style = style || { } ; style.font = style.font || 'bold 20pt Arial'; style.backgroundColor = style.backgroundColor || null ; style.fill = style.fill || 'black'; style.align = style.align || 'left'; style.boundsAlignH = style.boundsAlignH || 'left'; style.boundsAlignV = style.boundsAlignV || 'top'; style.stroke = style.stroke || 'black'; style.strokeThickness = style.strokeThickness || 0; style.wordWrap = style.wordWrap || false ; style.wordWrapWidth = style.wordWrapWidth || 100; style.shadowOffsetX = style.shadowOffsetX || 0; style.shadowOffsetY = style.shadowOffsetY || 0; style.shadowColor = style.shadowColor || 'rgba(0,0,0,0)'; style.shadowBlur = style.shadowBlur || 0; style.tabs = style.tabs || 0; var components = this.fontToComponents(style.font); if (style.fontStyle) { components.fontStyle = style.fontStyle; } if (style.fontVariant) { components.fontVariant = style.fontVariant; } if (style.fontWeight) { components.fontWeight = style.fontWeight; } if (style.fontSize) { if (typeof style.fontSize === 'number') { style.fontSize = style.fontSize + 'px'; } components.fontSize = style.fontSize; } this._fontComponents = components; style.font = this.componentsToFont(this._fontComponents); this.style = style; this.dirty = true ; return this; } ; Phaser.Text.prototype.updateText = function (){ this.texture.baseTexture.resolution = this._res; this.context.font = this.style.font; var outputText = this.text; if (this.style.wordWrap) { outputText = this.runWordWrap(this.text); } var lines = outputText.split(/(?:\r\n|\r|\n)/); var tabs = this.style.tabs; var lineWidths = [] ; var maxLineWidth = 0; var fontProperties = this.determineFontProperties(this.style.font); for (var i = 0; i < _AN_Read_length('length', lines); i++ ){ if (tabs === 0) { var lineWidth = this.context.measureText(lines[i]).width + this.style.strokeThickness + this.padding.x; if (this.style.wordWrap) { lineWidth -= this.context.measureText(' ').width; } } else { var line = lines[i].split(/(?:\t)/); var lineWidth = this.padding.x + this.style.strokeThickness; if (Array.isArray(tabs)) { var tab = 0; for (var c = 0; c < _AN_Read_length('length', line); c++ ){ var section = Math.ceil(this.context.measureText(line[c]).width); if (c > 0) { tab += tabs[c - 1]; } lineWidth = tab + section; } } else { for (var c = 0; c < _AN_Read_length('length', line); c++ ){ lineWidth += Math.ceil(this.context.measureText(line[c]).width); var diff = this.game.math.snapToCeil(lineWidth, tabs) - lineWidth; lineWidth += diff; } } } lineWidths[i] = Math.ceil(lineWidth); maxLineWidth = Math.max(maxLineWidth, lineWidths[i]); } this.canvas.width = maxLineWidth * this._res; var lineHeight = fontProperties.fontSize + this.style.strokeThickness + this.padding.y; var height = lineHeight * _AN_Read_length('length', lines); var lineSpacing = this._lineSpacing; if (lineSpacing < 0 && Math.abs(lineSpacing) > lineHeight) { lineSpacing = - lineHeight; } if (lineSpacing !== 0) { var diff = lineSpacing * (_AN_Read_length('length', lines) - 1); height += diff; } this.canvas.height = height * this._res; this.context.scale(this._res, this._res); if (navigator.isCocoonJS) { this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); } if (this.style.backgroundColor) { this.context.fillStyle = this.style.backgroundColor; this.context.fillRect(0, 0, this.canvas.width, this.canvas.height); } this.context.fillStyle = this.style.fill; this.context.font = this.style.font; this.context.strokeStyle = this.style.stroke; this.context.textBaseline = 'alphabetic'; this.context.lineWidth = this.style.strokeThickness; this.context.lineCap = 'round'; this.context.lineJoin = 'round'; var linePositionX; var linePositionY; this._charCount = 0; for (i = 0; i < _AN_Read_length('length', lines); i++ ){ linePositionX = this.style.strokeThickness / 2; linePositionY = (this.style.strokeThickness / 2 + i * lineHeight) + fontProperties.ascent; if (i > 0) { linePositionY += (lineSpacing * i); } if (this.style.align === 'right') { linePositionX += maxLineWidth - lineWidths[i]; } else if (this.style.align === 'center') { linePositionX += (maxLineWidth - lineWidths[i]) / 2; } if (this.autoRound) { linePositionX = Math.round(linePositionX); linePositionY = Math.round(linePositionY); } if (_AN_Read_length('length', this.colors) > 0 || _AN_Read_length('length', this.strokeColors) > 0 || _AN_Read_length('length', this.fontWeights) > 0 || _AN_Read_length('length', this.fontStyles) > 0) { this.updateLine(lines[i], linePositionX, linePositionY); } else { if (this.style.stroke && this.style.strokeThickness) { this.updateShadow(this.style.shadowStroke); if (tabs === 0) { this.context.strokeText(lines[i], linePositionX, linePositionY); } else { this.renderTabLine(lines[i], linePositionX, linePositionY, false ); } } if (this.style.fill) { this.updateShadow(this.style.shadowFill); if (tabs === 0) { this.context.fillText(lines[i], linePositionX, linePositionY); } else { this.renderTabLine(lines[i], linePositionX, linePositionY, true ); } } } } this.updateTexture(); } ; Phaser.Text.prototype.renderTabLine = function (line, x, y, fill){ var text = line.split(/(?:\t)/); var tabs = this.style.tabs; var snap = 0; if (Array.isArray(tabs)) { var tab = 0; for (var c = 0; c < _AN_Read_length('length', text); c++ ){ if (c > 0) { tab += tabs[c - 1]; } snap = x + tab; if (fill) { this.context.fillText(text[c], snap, y); } else { this.context.strokeText(text[c], snap, y); } } } else { for (var c = 0; c < _AN_Read_length('length', text); c++ ){ var section = Math.ceil(this.context.measureText(text[c]).width); snap = this.game.math.snapToCeil(x, tabs); if (fill) { this.context.fillText(text[c], snap, y); } else { this.context.strokeText(text[c], snap, y); } x = snap + section; } } } ; Phaser.Text.prototype.updateShadow = function (state){ if (state) { this.context.shadowOffsetX = this.style.shadowOffsetX; this.context.shadowOffsetY = this.style.shadowOffsetY; this.context.shadowColor = this.style.shadowColor; this.context.shadowBlur = this.style.shadowBlur; } else { this.context.shadowOffsetX = 0; this.context.shadowOffsetY = 0; this.context.shadowColor = 0; this.context.shadowBlur = 0; } } ; Phaser.Text.prototype.updateLine = function (line, x, y){ for (var i = 0; i < _AN_Read_length('length', line); i++ ){ var letter = line[i]; if (_AN_Read_length('length', this.fontWeights) > 0 || _AN_Read_length('length', this.fontStyles) > 0) { var components = this.fontToComponents(this.context.font); if (this.fontStyles[this._charCount]) { components.fontStyle = this.fontStyles[this._charCount]; } if (this.fontWeights[this._charCount]) { components.fontWeight = this.fontWeights[this._charCount]; } this.context.font = this.componentsToFont(components); } if (this.style.stroke && this.style.strokeThickness) { if (this.strokeColors[this._charCount]) { this.context.strokeStyle = this.strokeColors[this._charCount]; } this.updateShadow(this.style.shadowStroke); this.context.strokeText(letter, x, y); } if (this.style.fill) { if (this.colors[this._charCount]) { this.context.fillStyle = this.colors[this._charCount]; } this.updateShadow(this.style.shadowFill); this.context.fillText(letter, x, y); } x += this.context.measureText(letter).width; this._charCount++ ; } } ; Phaser.Text.prototype.clearColors = function (){ this.colors = [] ; this.strokeColors = [] ; this.dirty = true ; return this; } ; Phaser.Text.prototype.clearFontValues = function (){ this.fontStyles = [] ; this.fontWeights = [] ; this.dirty = true ; return this; } ; Phaser.Text.prototype.addColor = function (color, position){ this.colors[position] = color; this.dirty = true ; return this; } ; Phaser.Text.prototype.addStrokeColor = function (color, position){ this.strokeColors[position] = color; this.dirty = true ; return this; } ; Phaser.Text.prototype.addFontStyle = function (style, position){ this.fontStyles[position] = style; this.dirty = true ; return this; } ; Phaser.Text.prototype.addFontWeight = function (weight, position){ this.fontWeights[position] = weight; this.dirty = true ; return this; } ; Phaser.Text.prototype.runWordWrap = function (text){ var result = ''; var lines = text.split('\n'); for (var i = 0; i < _AN_Read_length('length', lines); i++ ){ var spaceLeft = this.style.wordWrapWidth; var words = lines[i].split(' '); for (var j = 0; j < _AN_Read_length('length', words); j++ ){ var wordWidth = this.context.measureText(words[j]).width; var wordWidthWithSpace = wordWidth + this.context.measureText(' ').width; if (wordWidthWithSpace > spaceLeft) { if (j > 0) { result += '\n'; } result += words[j] + ' '; spaceLeft = this.style.wordWrapWidth - wordWidth; } else { spaceLeft -= wordWidthWithSpace; result += words[j] + ' '; } } if (i < _AN_Read_length('length', lines) - 1) { result += '\n'; } } return result; } ; Phaser.Text.prototype.updateFont = function (components){ var font = this.componentsToFont(components); if (this.style.font !== font) { this.style.font = font; this.dirty = true ; if (this.parent) { this.updateTransform(); } } } ; Phaser.Text.prototype.fontToComponents = function (font){ var m = font.match(/^\s*(?:\b(normal|italic|oblique|inherit)?\b)\s*(?:\b(normal|small-caps|inherit)?\b)\s*(?:\b(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit)?\b)\s*(?:\b(xx-small|x-small|small|medium|large|x-large|xx-large|larger|smaller|0|\d*(?:[.]\d*)?(?:%|[a-z]{2,5}))?\b)\s*(.*)\s*$/); if (m) { return { font: font, fontStyle: m[1] || 'normal', fontVariant: m[2] || 'normal', fontWeight: m[3] || 'normal', fontSize: m[4] || 'medium', fontFamily: m[5]} ; } else { console.warn("Phaser.Text - unparsable CSS font: " + font); return { font: font} ; } } ; Phaser.Text.prototype.componentsToFont = function (components){ var parts = [] ; var v; v = components.fontStyle; if (v && v !== 'normal') { parts.push(v); } v = components.fontVariant; if (v && v !== 'normal') { parts.push(v); } v = components.fontWeight; if (v && v !== 'normal') { parts.push(v); } v = components.fontSize; if (v && v !== 'medium') { parts.push(v); } v = components.fontFamily; if (v) { parts.push(v); } if (!_AN_Read_length('length', parts)) { parts.push(components.font); } return parts.join(" "); } ; Phaser.Text.prototype.setText = function (text){ _AN_Write_text("text", this, false , text.toString() || ''); this.dirty = true ; return this; } ; Phaser.Text.prototype.parseList = function (list){ if (!Array.isArray(list)) { return this; } else { var s = ""; for (var i = 0; i < _AN_Read_length("length", list); i++ ){ if (Array.isArray(list[i])) { s += list[i].join("\t"); if (i < _AN_Read_length("length", list) - 1) { s += "\n"; } } else { s += list[i]; if (i < _AN_Read_length("length", list) - 1) { s += "\t"; } } } } _AN_Write_text("text", this, false , s); this.dirty = true ; return this; } ; Phaser.Text.prototype.setTextBounds = function (x, y, width, height){ if (x === undefined) { this.textBounds = null ; } else { if (!this.textBounds) { this.textBounds = new Phaser.Rectangle(x, y, width, height); } else { this.textBounds.setTo(x, y, width, height); } if (this.style.wordWrapWidth > width) { this.style.wordWrapWidth = width; } } this.updateTexture(); return this; } ; Phaser.Text.prototype.updateTexture = function (){ var base = this.texture.baseTexture; var crop = this.texture.crop; var frame = this.texture.frame; var w = this.canvas.width; var h = this.canvas.height; base.width = w; base.height = h; crop.width = w; crop.height = h; frame.width = w; frame.height = h; this.texture.width = w; this.texture.height = h; this._width = w; this._height = h; if (this.textBounds) { var x = this.textBounds.x; var y = this.textBounds.y; if (this.style.boundsAlignH === 'right') { x += this.textBounds.width - this.canvas.width; } else if (this.style.boundsAlignH === 'center') { x += this.textBounds.halfWidth - (this.canvas.width / 2); } if (this.style.boundsAlignV === 'bottom') { y += this.textBounds.height - this.canvas.height; } else if (this.style.boundsAlignV === 'middle') { y += this.textBounds.halfHeight - (this.canvas.height / 2); } this.pivot.x = - x; this.pivot.y = - y; } this.renderable = (w !== 0 && h !== 0); this.texture.requiresReTint = true ; this.texture.baseTexture.dirty(); } ; Phaser.Text.prototype._renderWebGL = function (renderSession){ if (this.dirty) { this.updateText(); this.dirty = false ; } PIXI.Sprite.prototype._renderWebGL.call(this, renderSession); } ; Phaser.Text.prototype._renderCanvas = function (renderSession){ if (this.dirty) { this.updateText(); this.dirty = false ; } PIXI.Sprite.prototype._renderCanvas.call(this, renderSession); } ; Phaser.Text.prototype.determineFontProperties = function (fontStyle){ var properties = Phaser.Text.fontPropertiesCache[fontStyle]; if (!properties) { properties = { } ; var canvas = Phaser.Text.fontPropertiesCanvas; var context = Phaser.Text.fontPropertiesContext; context.font = fontStyle; var width = Math.ceil(context.measureText('|MÉq').width); var baseline = Math.ceil(context.measureText('|MÉq').width); var height = 2 * baseline; baseline = baseline * 1.4 | 0; canvas.width = width; canvas.height = height; context.fillStyle = '#f00'; context.fillRect(0, 0, width, height); context.font = fontStyle; context.textBaseline = 'alphabetic'; context.fillStyle = '#000'; context.fillText('|MÉq', 0, baseline); if (!context.getImageData(0, 0, width, height)) { properties.ascent = baseline; properties.descent = baseline + 6; properties.fontSize = properties.ascent + properties.descent; Phaser.Text.fontPropertiesCache[fontStyle] = properties; return properties; } var imagedata = context.getImageData(0, 0, width, height).data; var pixels = _AN_Read_length('length', imagedata); var line = width * 4; var i, j; var idx = 0; var stop = false ; for (i = 0; i < baseline; i++ ){ for (j = 0; j < line; j += 4){ if (imagedata[idx + j] !== 255) { stop = true ; break ; } } if (!stop) { idx += line; } else { break ; } } properties.ascent = baseline - i; idx = pixels - line; stop = false ; for (i = height; i > baseline; i-- ){ for (j = 0; j < line; j += 4){ if (imagedata[idx + j] !== 255) { stop = true ; break ; } } if (!stop) { idx -= line; } else { break ; } } properties.descent = i - baseline; properties.descent += 6; properties.fontSize = properties.ascent + properties.descent; Phaser.Text.fontPropertiesCache[fontStyle] = properties; } return properties; } ; Phaser.Text.prototype.getBounds = function (matrix){ if (this.dirty) { this.updateText(); this.dirty = false ; } return PIXI.Sprite.prototype.getBounds.call(this, matrix); } ; Object.defineProperty(Phaser.Text.prototype, 'text', { get: function (){ return this._text; } , set: function (value){ if (value !== this._text) { this._text = value.toString() || ''; this.dirty = true ; if (this.parent) { this.updateTransform(); } } } } ); Object.defineProperty(Phaser.Text.prototype, 'cssFont', { get: function (){ return this.componentsToFont(this._fontComponents); } , set: function (value){ value = value || 'bold 20pt Arial'; this._fontComponents = this.fontToComponents(value); this.updateFont(this._fontComponents); } } ); Object.defineProperty(Phaser.Text.prototype, 'font', { get: function (){ return this._fontComponents.fontFamily; } , set: function (value){ value = value || 'Arial'; value = value.trim(); if (!/^(?:inherit|serif|sans-serif|cursive|fantasy|monospace)$/.exec(value) && !/['",]/.exec(value)) { value = "'" + value + "'"; } this._fontComponents.fontFamily = value; this.updateFont(this._fontComponents); } } ); Object.defineProperty(Phaser.Text.prototype, 'fontSize', { get: function (){ var size = this._fontComponents.fontSize; if (size && /(?:^0$|px$)/.exec(size)) { return parseInt(size, 10); } else { return size; } } , set: function (value){ value = value || '0'; if (typeof value === 'number') { value = value + 'px'; } this._fontComponents.fontSize = value; this.updateFont(this._fontComponents); } } ); Object.defineProperty(Phaser.Text.prototype, 'fontWeight', { get: function (){ return this._fontComponents.fontWeight || 'normal'; } , set: function (value){ value = value || 'normal'; this._fontComponents.fontWeight = value; this.updateFont(this._fontComponents); } } ); Object.defineProperty(Phaser.Text.prototype, 'fontStyle', { get: function (){ return this._fontComponents.fontStyle || 'normal'; } , set: function (value){ value = value || 'normal'; this._fontComponents.fontStyle = value; this.updateFont(this._fontComponents); } } ); Object.defineProperty(Phaser.Text.prototype, 'fontVariant', { get: function (){ return this._fontComponents.fontVariant || 'normal'; } , set: function (value){ value = value || 'normal'; this._fontComponents.fontVariant = value; this.updateFont(this._fontComponents); } } ); Object.defineProperty(Phaser.Text.prototype, 'fill', { get: function (){ return this.style.fill; } , set: function (value){ if (value !== this.style.fill) { this.style.fill = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'align', { get: function (){ return this.style.align; } , set: function (value){ if (value !== this.style.align) { this.style.align = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'resolution', { get: function (){ return this._res; } , set: function (value){ if (value !== this._res) { this._res = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'tabs', { get: function (){ return this.style.tabs; } , set: function (value){ if (value !== this.style.tabs) { this.style.tabs = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'boundsAlignH', { get: function (){ return this.style.boundsAlignH; } , set: function (value){ if (value !== this.style.boundsAlignH) { this.style.boundsAlignH = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'boundsAlignV', { get: function (){ return this.style.boundsAlignV; } , set: function (value){ if (value !== this.style.boundsAlignV) { this.style.boundsAlignV = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'stroke', { get: function (){ return this.style.stroke; } , set: function (value){ if (value !== this.style.stroke) { this.style.stroke = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'strokeThickness', { get: function (){ return this.style.strokeThickness; } , set: function (value){ if (value !== this.style.strokeThickness) { this.style.strokeThickness = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'wordWrap', { get: function (){ return this.style.wordWrap; } , set: function (value){ if (value !== this.style.wordWrap) { this.style.wordWrap = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'wordWrapWidth', { get: function (){ return this.style.wordWrapWidth; } , set: function (value){ if (value !== this.style.wordWrapWidth) { this.style.wordWrapWidth = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'lineSpacing', { get: function (){ return this._lineSpacing; } , set: function (value){ if (value !== this._lineSpacing) { this._lineSpacing = parseFloat(value); this.dirty = true ; if (this.parent) { this.updateTransform(); } } } } ); Object.defineProperty(Phaser.Text.prototype, 'shadowOffsetX', { get: function (){ return this.style.shadowOffsetX; } , set: function (value){ if (value !== this.style.shadowOffsetX) { this.style.shadowOffsetX = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'shadowOffsetY', { get: function (){ return this.style.shadowOffsetY; } , set: function (value){ if (value !== this.style.shadowOffsetY) { this.style.shadowOffsetY = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'shadowColor', { get: function (){ return this.style.shadowColor; } , set: function (value){ if (value !== this.style.shadowColor) { this.style.shadowColor = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'shadowBlur', { get: function (){ return this.style.shadowBlur; } , set: function (value){ if (value !== this.style.shadowBlur) { this.style.shadowBlur = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'shadowStroke', { get: function (){ return this.style.shadowStroke; } , set: function (value){ if (value !== this.style.shadowStroke) { this.style.shadowStroke = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'shadowFill', { get: function (){ return this.style.shadowFill; } , set: function (value){ if (value !== this.style.shadowFill) { this.style.shadowFill = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.Text.prototype, 'width', { get: function (){ if (this.dirty) { this.updateText(); this.dirty = false ; } return this.scale.x * this.texture.frame.width; } , set: function (value){ this.scale.x = value / this.texture.frame.width; this._width = value; } } ); Object.defineProperty(Phaser.Text.prototype, 'height', { get: function (){ if (this.dirty) { this.updateText(); this.dirty = false ; } return this.scale.y * this.texture.frame.height; } , set: function (value){ this.scale.y = value / this.texture.frame.height; this._height = value; } } ); Phaser.Text.fontPropertiesCache = { } ; Phaser.Text.fontPropertiesCanvas = PIXI.CanvasPool.create(Phaser.Text.fontPropertiesCanvas); Phaser.Text.fontPropertiesContext = Phaser.Text.fontPropertiesCanvas.getContext('2d');