Skip to content

Creating TextLabel with Custom Font #2431

@kamil2289

Description

@kamil2289

Description of the problem

There is an issue when attempting to create a TextLabel using a custom font (e.g., segoeui.ttf). Even after correctly importing the font, trying to create a TextLabel results in the following error:

[Error] [TextLabel] Failed to render label: Failed to create text format, 80070057 The parameter is incorrect.

Reproduction steps

To reproduce the issue, follow the steps as described in the documentation:

const labelPos = new alt.Vector3(-4.75, 2.497, 71.217);
const labelRot = new alt.Vector3(0, 0, -0.253);
const labelColor = new alt.RGBA(255, 255, 255, 255);
const labelOutlineColor = new alt.RGBA(0, 0, 0, 80);
const labelFontSize = 32;
const labelFontScale = 2;
const labelOutlineWidth = .25;

alt.once('resourceStart', () => {
  alt.Font.register('segoeui.ttf');

  new alt.TextLabel('Welcome to alt:V v16', 'Segoe UI', labelFontSize, labelFontScale, labelPos, labelRot, labelColor, labelOutlineWidth, labelOutlineColor);
});

Expected behaviour

The TextLabel should be created correctly without throwing an error.

Additional context

No response

Operating system

Windows 11 Pro 26100.3775

Version

16.3.36 (release)

Crashdump ID

No response

Confirmation of issue's presence

  • By submitting this ticket, I affirm that I have verified the presence of this issue on the latest RC (Release Candidate) version available at the time of writing this ticket.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Class: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions