forked from pixijs/pixijs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix bitmap font spacing issue (pixijs#11065)
- Loading branch information
1 parent
fc1820c
commit 0ebb05d
Showing
5 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Assets } from '../../../../src/assets/Assets'; | ||
import { TextStyle } from '../../../../src/scene/text/TextStyle'; | ||
import { BitmapFont } from '../../../../src/scene/text-bitmap/BitmapFont'; | ||
import { BitmapFontManager } from '../../../../src/scene/text-bitmap/BitmapFontManager'; | ||
import { BitmapText } from '../../../../src/scene/text-bitmap/BitmapText'; | ||
|
||
import type { Container } from '../../../../src/scene/container/Container'; | ||
import type { TestScene } from '../../types'; | ||
|
||
export const scene: TestScene = { | ||
it: 'should render an installed font correctly', | ||
create: async (scene: Container) => | ||
{ | ||
await Assets.load('fonts/outfit.woff2'); | ||
|
||
const style = new TextStyle({ | ||
fontSize: 200, | ||
stroke: { | ||
width: 18, | ||
join: 'round', | ||
} | ||
}); | ||
|
||
BitmapFont.install({ | ||
name: 'big-outfit', | ||
style, | ||
chars: BitmapFontManager.NUMERIC, | ||
}); | ||
|
||
const textBitmap = new BitmapText({ text: 1234, style: { fontFamily: 'big-outfit', fontSize: 50 } }); | ||
|
||
textBitmap.anchor = 0.5; | ||
textBitmap.position.set(128 / 2); | ||
scene.addChild(textBitmap); | ||
}, | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.