HaxeFlixel / HaxeFlixel/flixel

Different position and wrong height using FFF Tusj font

Open
#1,769 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haxe
Stars
2.2k
Forks
522
Avg merge
34m
Merged PRs (30d)
1

Description

  • Flixel version: dev (updated now)
  • OpenFL version: 3.6.0
  • Lime version: 2.9.0
  • Affected targets: flash/debug, windows/debug

Code snippet reproducing the issue:

package;

import flixel.FlxState;
import flixel.text.FlxText;

class PlayState extends FlxState
{
    override public function create():Void
    {
        var withDefaultFont:FlxText = cast add(new FlxText(0, 0, 0, "TEST", 300));
        withDefaultFont.setGraphicSize(0, 50);
        withDefaultFont.updateHitbox();
        trace(withDefaultFont.frameHeight, withDefaultFont.height);

        var withFFFTusj:FlxText = cast add(new FlxText(0, 0, 0, "TEST", 300));
        withFFFTusj.font = "assets/fonts/FFF_Tusj.ttf";
        withFFFTusj.setGraphicSize(0, 50);
        withFFFTusj.updateHitbox();
        trace(withFFFTusj.frameHeight, withFFFTusj.height);
    }
}

The above code relies on this font unzipped and renamed with an underscore and put into the assets/fonts folder of the project, but the problem also occurs with the Georgia and Georgia Bold fonts included with Win7.


Observed behavior: The two FlxTexts are in very different locations, and the debug output of the second line is 344,344 (in contrast with the first line, which is 379,50.) Screenshot:

ffftusj-different-pos-and-height

Expected behavior: They should be in the same location, and the debug output of the second line should be similar to the first line (at least, the second number should be roughly 50).

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 provided PlayState reproduction using FlxText and compare the default font with FFF Tusj, Georgia, and Georgia Bold on the listed targets. Trace frameHeight and height while checking the differing positions; done means both fonts produce matching placement and a resized height close to 50.

Written by the indexing model from the issue text.

Assessment

Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.