phaserjs / phaserjs/phaser

Definition of lineSpacing in bitmaptext game object

Open
#6,932 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🕹️ Game Object
Dominant language
JavaScript
Stars
40.3k
Forks
7.2k
PR merge metrics
No merged PRs in 30d

Description

I try to figure out the line height of each line in BitmapText game object.
Test code, which

  • set font size to 30
  • has lineSpacing 20

What is the definition of lineSpacing?
I assume that It is the extra space between each line, no matter the font size is.

But, from the source code

  1. summation lineHeigit and lineSpacing
  2. multiple the scale, the scale is calculated by font size

Therefore, the extra line spacing is lineSpacing value multiple the scale. i.e. not a constant value for all font sizes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodePen reproduction and the referenced calculations in src/gameobjects/bitmaptext/GetBitmapTextSize.js at lines 90, 295, and 376. Compare lineSpacing, lineHeight, and font-size scaling to determine the intended definition, then document the confirmed behavior in the appropriate API documentation. Done means the relationship is stated unambiguously for different font sizes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
game-dev
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.