Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors while trying to use raylibpy.load_font_ex() #49

Open
marcotriesdev opened this issue Oct 31, 2024 · 2 comments
Open

Errors while trying to use raylibpy.load_font_ex() #49

marcotriesdev opened this issue Oct 31, 2024 · 2 comments

Comments

@marcotriesdev
Copy link

Hello, I was trying to use the load_font_ex function in raylibpy but I get an error related to the "codepoints" argument. It doesn´t matter if I try to put a 0, an empty list or None as values, it doesn´t work. I know this python raylib binding development may not be active anymore but I would like to know if this is a common issue and I should stuck with the load_font() function, at the cost of having pixelated fonts or finding a long and uncomfortable alternative to scale fonts properly.
Using the latest version of the Raylib-py version, Python 3.11 and VSCode.
I am including the basic error message when I use the None as an argument and my script.

Error:
Captura de pantalla 2024-10-31 171640

import raylibpy as rl

# Initialize window
rl.init_window(800, 600, "Load Font Example")
rl.set_target_fps(60)

# Font parameters
font_size = 32
font_file = "fonts/AntonSC-Regular.ttf"  # Replace with the path to your font file

# Load font
font = rl.load_font_ex(font_file, font_size, None, 0)

# Main loop
while not rl.window_should_close():
    rl.begin_drawing()
    rl.clear_background(rl.RAYWHITE)

    # Draw text using the loaded font
    rl.draw_text_ex(font, "Hello, raylib!", (100, 100), font_size, 1, rl.DARKGRAY)

    rl.end_drawing()

# Unload font and close window
rl.unload_font(font)
rl.close_window()
@overdev
Copy link
Owner

overdev commented Nov 7, 2024

Yes, my bad. I forgot to account for the case where the ˋcodepointsˋ parameter is passed ˋNoneˋ as argument.

The fix is specific for the ˋload_font_exˋ function. If you find any other bug, please let me know.

I'll be uploading the fix soon.

@overdev
Copy link
Owner

overdev commented Nov 7, 2024

Done. I'll publish on PyPI as soon as I remember how to do it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants