#Custom font in GUI

77 messages · Page 1 of 1 (latest)

sweet cedar
#

please help me, show me a sample code for 1.21 for rendering your font in your GUI. I have a font in the form of a .ttf file. Please send me a sample code on how to use the font.

untold mortar
#

Remember, cheats are against the rules here.

#

!!cheats

obtuse veldtBOT
#

We do not support hacked clients, cheats, or modifications that are intended to give you the upper hand in a server, competitive or otherwise.
See rule 1 in #welcome and the Discord TOS: https://discordapp.com/terms

sweet cedar
#

Help me pls 😥

fickle turtle
wintry forum
sweet cedar
fickle turtle
# sweet cedar help

I've never done it bro can't help, ur best option is to go read source code of other mods and see how they did it

#

Just came to nerd emoji that guy ngl

sweet cedar
bold wigeon
sweet cedar
bold wigeon
#

in the External Libraries, just search for the class

fickle turtle
#

It came to me in a dream

bold wigeon
untold mortar
misty fern
#

try this maybe

#

there's been an entire thread ab this already with tons of information, it could help

sweet cedar
#

@misty fern Can you help me? I kind of did everything as they wrote in the chat, but the characters are not displayed.

#
{
  "providers": [
    {
      "type": "ttf",
      "file": "fpsboost:font/bahnschrift.ttf",
      "shift": [0, 1],
      "size": 11,
      "oversample": 8
    },
    {
      "type": "bitmap",
      "file": "minecraft:font/default.png",
      "ascent": 7,
      "height": 8,
      "chars": [
        "0123456789",
        "abcdefghij",
        "klmnopqrst",
        "uvwxyz{}[]",
        "ABCDEFGHIJ",
        "KLMNOPQRST",
        "UVWXYZ!\"#$",
        "%&'()*+,-.",
        "/:;<=>?@\\^",
        "_`|~      "
      ]
    }
  ]
}
#

It's displayed in the game like that guy's

#

@fervent lichen hello, can you help me, pls

#

i trying

{
  "providers": [
    {
      "type": "ttf",
      "file": "fpsboost:font/bahnschrift.ttf",
      "shift": [0, 1],
      "size": 11,
      "oversample": 8
    },
    {
      "type": "bitmap",
      "file": "fpsboost:font/bahnschrift.reg.png",
      "ascent": 7,
      "height": 8,
      "chars": [
        "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
        "abcdefghijklmnopqrstuvwxyz",
        "0123456789 *+,-./:;<=>?@[^"
      ]
    }
  ]
}

#

But it didn't help

fervent lichen
#

there should be an error in your console when you run your mod complaining about a missing font png file

#

you have to convert it into a png

#

you will have to look up a ttf to png converter and then use that

#

the png it gives you should go in assets/YOUR_MODID_HERE/textures/font/bahnschrift.reg.png

fervent lichen
fair skiff
# sweet cedar

you have a folder called assets.fpsboost. you need two folders assets and fpsboost

magic grove
#

is that not just how the ide displays it?

#

the only thing in assets is a folder called fpsboost

sweet cedar
#

@fervent lichen What am I doing wrong again? Help pls

crisp gull
#

what does it say in the output log when you run the game?

crisp gull
#

oh i see whats wrong, you put fpsboost:font/bahnschrift.ttf it should be fpsboost:bahnschrift.ttf

crisp gull
# sweet cedar

also this png would not work for a minecraft font, it has to be a grid of characters, like how the vanilla ascii.png one looks like

sweet cedar
crisp gull
#

why not just.. use the ttf file?

crisp gull
sweet cedar
crisp gull
#

well theyre wrong because it does support ttf fonts

sweet cedar
#

Okay, I'll try it like this.

crisp gull
#

why, you can just use the ttf

#
{
  "providers": [
    {
      "type": "ttf",
      "file": "fpsboost:bahnschrift.ttf",
      "shift": [0, 1],
      "size": 11,
      "oversample": 8
    }
  ]
}```
crisp gull
# sweet cedar 😦

when this happens, check the output log and it will tell you exactly why it isnt working

sweet cedar
#

YYEEEEEEEEEEE

fervent lichen
#

neat

bold wigeon
#

Hey @sweet cedar, can you pass your code to see how you make it? I think it would be useful for the future!

crisp gull
# sweet cedar

@bold wigeon ^ you just make a style, set the font to the id of your font, then set that on your text component

#

(you don’t need to convert it to a string first tho)

#

i don’t mean this in a rude way but it’s kinda funny how so many people have run into this same issue recently

sweet cedar
bold wigeon
#

Okay, ty