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

Code before:
     * @param style - The text style to evaluate
     * @returns true if the style can use tinting, false if colors must be baked in
     * @private
     */
    private _canUseTintForStyle(style: TextStyle): boolean
    {
        // If there's a stroke or drop shadow, we need multiple colors baked in so we can't tint
        if (style._stroke || style.dropShadow)
        {
            return false;
        }

        // If there's a complex fill (gradient, pattern, etc.) we can't tint
        if (style._fill.fill)
        {
            return false;
        }

        // If no fill or white fill, we can tint it
        if (!style._fill.fill || style._fill.color === 0xFFFFFF)
        {
            return true;
        }

        // Simple solid color fill can't be tinted (color is baked in)
        return false;
    }
}

/**
 * The BitmapFontManager is a helper that exists to install and uninstall fonts
 * into the cache for BitmapText objects.
 * @category text
 * @advanced
 * @class
 * @example
 * import { BitmapFontManager, BitmapText } from 'pixi.js';
 *
 * BitmapFontManager.install({
 *   name: 'TitleFont',
 *   style: {}
 * });
 *
 * const title = new BitmapText({ text: 'This is the title', style: { fontFamily: 'TitleFont' }});
 */
export const BitmapFontManager = new BitmapFontManagerClass();


Review comment (suggestion):
I think this should do the same thing with less code.

Excluding dropShadows feels unnecessarily constricting. Since tint is a multiply, if you have a black shadow that would work find being tinted, right? [Example here](https://pixiplayground.com/#/edit/xWG4l3U70wnGi3Pkw6g-d).


```suggestion
        // Exclude strokes, shadows and ensure
        // we have a non gradient or pattern fill,
        // and the fill color is white
        return !style._stroke
            && !style.dropShadow
            && !style._fill.fill
            && style._fill.color === 0xFFFFFF;
```

Code after:
    // eslint-disable-next-line max-len
    public install(...args: [string | BitmapFontInstallOptions, (TextStyle | TextStyleOptions)?, BitmapFontInstallOptions?]): BitmapFont
    {
        let options = args[0] as BitmapFontInstallOptions;

        if (typeof options === 'string')
        {
            options = {
                name: options,
                style: args[1],
                chars: args[2]?.chars,
                resolution: args[2]?.resolution,
                padding: args[2]?.padding,
                skipKerning: args[2]?.skipKerning,
            } as BitmapFontInstallOptions;

            // #if _DEBUG
            // eslint-disable-next-line max-len
            deprecation(v8_0_0, 'BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})');
            // #endif
        }

        const name = options?.name;

        if (!name)
        {
            throw new Error('[BitmapFontManager] Property `name` is required.');
        }

        options = { ...this.defaultOptions, ...options };

        const textStyle = options.style;

        const style = textStyle instanceof TextStyle ? textStyle : new TextStyle(textStyle);
        const overrideFill = options.dynamicFill ?? this._canUseTintForStyle(style);
        const font = new DynamicBitmapFont({
            style,
            overrideFill,
            skipKerning: options.skipKerning,
            padding: options.padding,
            resolution: options.resolution,
            overrideSize: false,
            textureStyle: options.textureStyle,
        });

        const flatChars = resolveCharacters(options.chars);

        font.ensureCharacters(flatChars.join(''));

        Cache.set(`${name}-bitmap`, font);