Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for PIXI.BitmapText #394

Closed
wants to merge 1 commit into from
Closed

Conversation

reececomo
Copy link

@reececomo reececomo commented Jan 13, 2024

Example implementation of #393

All you need to do is override createTextField(...) to return BitmapText if that's what your app needs. You'll need to load or generate BitmapFonts yourself. See #393 thread for more examples.

import TaggedText from 'pixi-tagged-text';

export class MyText extends TaggedText {

  protected createTextField(token: TextSegmentToken, text: string, style: Partial<ITextStyle>): Text | BitmapText {
    // You can replace this logic with whatever you need in order to
    // load and style your BitmapFonts (e.g. resize or tint).
    return new BitmapText(text, { fontName: 'MyCustomFont' });
  }
}

@mimshwright
Copy link
Owner

Thanks very much for your PR. I appreciate the effort.
As noted in #393 there are some bigger issues with bitmapText and I'd rather not include a patch like this without more careful consideration.
For now, i'm afraid I'm going to reject this change to the library. But hopefully, your fork will be adequate for your needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants