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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unicode support for BitmapFontManager #10514

Merged
merged 2 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/scene/text-bitmap/BitmapFontManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class BitmapFontManagerClass
{
const bitmapFont = this.getFont(text, style);

return getBitmapTextLayout(text.split(''), style, bitmapFont);
return getBitmapTextLayout([...text], style, bitmapFont);
}

/**
Expand Down
7 changes: 7 additions & 0 deletions tests/renderering/text/BitmapFontManager.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Cache } from '../../../src/assets/cache/Cache';

Check warning on line 1 in tests/renderering/text/BitmapFontManager.test.ts

View workflow job for this annotation

GitHub Actions / build

Run autofix to sort these imports!
import { BitmapFontManager } from '../../../src/scene/text-bitmap/BitmapFontManager';
import { TextStyle } from '../../../src/scene/text/TextStyle';

import type { BitmapFont } from '../../../src/scene/text-bitmap/BitmapFont';

Expand All @@ -24,4 +25,10 @@
BitmapFontManager.uninstall('foo');
expect(Cache.get<BitmapFont>('foo-bitmap')).toBeUndefined();
});

it('should return layout for text containing emoji', () => {

Check warning on line 29 in tests/renderering/text/BitmapFontManager.test.ts

View workflow job for this annotation

GitHub Actions / build

Opening curly brace appears on the same line as controlling statement
const layout = BitmapFontManager.getLayout('foo馃憤', new TextStyle());

expect(layout).toBeDefined();
});
});