Repository: pixijs/pixijs
File: src/scene/text-bitmap/DynamicBitmapFont.ts (TypeScript)

Code before:
        const style = this._style;

        let currentX = this._currentX;
        let currentY = this._currentY;

        const fontScale = this.baseRenderedFontSize / this.baseMeasurementFontSize;
        const padding = this._padding * fontScale;

        let maxCharHeight = 0;
        let skipTexture = false;

        const maxTextureWidth = canvas.width / this.resolution;
        const maxTextureHeight = canvas.height / this.resolution;

        for (let i = 0; i < charList.length; i++)
        {
            const char = charList[i];

            const metrics = CanvasTextMetrics.measureText(char, style, canvas, false);
            // This is ugly - but italics are given more space so they don't overlap
            const textureGlyphWidth = Math.ceil((style.fontStyle === 'italic' ? 2 : 1) * metrics.width);

            // override the line height.. we want this to be the glyps height
            // not the user specified one.
            metrics.lineHeight = metrics.height;

            const width = metrics.width * fontScale;
            const height = (metrics.height) * fontScale;

            const paddedWidth = textureGlyphWidth + (padding * 2);
            const paddedHeight = height + (padding * 2);

            skipTexture = false;
            // don't let empty characters count towards the maxCharHeight
            if (char !== '\n' && char !== '\r' && char !== '\t' && char !== ' ')
            {
                skipTexture = true;
                maxCharHeight = Math.ceil(Math.max(paddedHeight, maxCharHeight));// / 1.5;
            }

            if (currentX + paddedWidth > maxTextureWidth)
            {
                currentY += maxCharHeight;

                // reset the line x and height..
                maxCharHeight = paddedHeight;
                currentX = 0;

                if (currentY + maxCharHeight > maxTextureHeight)
                {
                    textureSource.update();

Review comment (suggestion):
The comment 'This is ugly - but italics are given more space so they don't overlap' is redundant and appears twice. It should be removed from line 167.
```suggestion
            const textureGlyphWidth = Math.ceil((style.fontStyle === 'italic' ? 2 : 1) * width);
```

Code after:
        const style = this._style;

        let currentX = this._currentX;
        let currentY = this._currentY;

        const fontScale = this.baseRenderedFontSize / this.baseMeasurementFontSize;
        const padding = this._padding * fontScale;

        let maxCharHeight = 0;
        let skipTexture = false;

        const maxTextureWidth = canvas.width / this.resolution;
        const maxTextureHeight = canvas.height / this.resolution;

        for (let i = 0; i < charList.length; i++)
        {
            const char = charList[i];

            const metrics = CanvasTextMetrics.measureText(char, style, canvas, false);

            // override the line height.. we want this to be the glyps height
            // not the user specified one.
            metrics.lineHeight = metrics.height;

            const width = metrics.width * fontScale;
            // This is ugly - but italics are given more space so they don't overlap
            const textureGlyphWidth = Math.ceil((style.fontStyle === 'italic' ? 2 : 1) * width);

            const height = (metrics.height) * fontScale;

            const paddedWidth = textureGlyphWidth + (padding * 2);
            const paddedHeight = height + (padding * 2);

            skipTexture = false;
            // don't let empty characters count towards the maxCharHeight
            if (char !== '\n' && char !== '\r' && char !== '\t' && char !== ' ')
            {
                skipTexture = true;
                maxCharHeight = Math.ceil(Math.max(paddedHeight, maxCharHeight));// / 1.5;
            }

            if (currentX + paddedWidth > maxTextureWidth)
            {
                currentY += maxCharHeight;

                // reset the line x and height..
                maxCharHeight = paddedHeight;
                currentX = 0;

                if (currentY + maxCharHeight > maxTextureHeight)
                {