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

Code before:

        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;
                currentMaxCharHeight = Math.ceil(Math.max(paddedHeight, currentMaxCharHeight));// / 1.5;
            }

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

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

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

                    const pageData = this._nextPage();

                    canvas = pageData.canvasAndContext.canvas;
                    context = pageData.canvasAndContext.context;
                    textureSource = pageData.texture.source;

                    currentX = 0;
                    currentY = 0;
                    currentMaxCharHeight = 0;
                }
            }

Review comment (suggestion):
[nitpick] Consider removing the commented-out division by 1.5 if it is not required to enhance code clarity.
```suggestion
                currentMaxCharHeight = Math.ceil(Math.max(paddedHeight, currentMaxCharHeight));
```

Code after:
        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;
                currentMaxCharHeight = Math.ceil(Math.max(paddedHeight, currentMaxCharHeight));
            }

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

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

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

                    const pageData = this._nextPage();

                    canvas = pageData.canvasAndContext.canvas;
                    context = pageData.canvasAndContext.context;
                    textureSource = pageData.texture.source;

                    currentX = 0;
                    currentY = 0;
                    currentMaxCharHeight = 0;
                }
            }