raylib: [text] ImageDrawText & ImageDrawTextEx on Raspberry Pi doesn't draw text?
I just cannot get this to work at all, is this function broken or am I missing something?
#include "raylib.h"
int main()
{
int screenWidth = 1024;
int screenHeight = 600;
SetConfigFlags(FLAG_FULLSCREEN_MODE | FLAG_MSAA_4X_HINT | FLAG_VSYNC_HINT);
InitWindow(screenWidth, screenHeight, "Testing");
SetTargetFPS(60);
SpriteFont font30 = LoadSpriteFontEx("resources/segoeui.ttf", 40, 0, 0);
GenTextureMipmaps(&font30.texture);
Image image = LoadImage("resources/cat.png");
ImageResize(&image, 640, 480);
ImageDrawText(&image, (Vector2) { 100, 200 }, "Hello World!", 150, WHITE);
ImageDrawTextEx(&image, (Vector2) { 100, 100 }, font30, "Hello World!", 150, 1, WHITE);
Texture2D texture = LoadTextureFromImage(image);
UnloadImage(image);
while (!WindowShouldClose())
{
BeginDrawing();
DrawTexture(texture, 0, 0, WHITE);
DrawFPS(500, 10);
EndDrawing();
}
TakeScreenshot("screenshot.png");
UnloadSpriteFont(font30);
UnloadTexture(texture);
return 0;
}
The cat.png image is from the examples, textures, resources folder - the ttf I pulled from my windows fonts folder.
The font is rendered as rendered as garbage / weird blocks of white that don’t resemble the text at all. I have a screenshot but there appears to be no attach function here. But even the default font doesn’t work either.
Any help would be much appreciated! Regards
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 15 (7 by maintainers)
I believe the function is called MeasureTextEx, it returns a vector2 where the x property will be the text width.
Sent from Outlook for Androidhttps://aka.ms/AAb9ysg
From: Colesnicov Denis Petrovich @.> Sent: Saturday, May 11, 2024 3:01:54 PM To: raysan5/raylib @.> Cc: Scott Gunn @.>; Mention @.> Subject: Re: [raysan5/raylib] [text] ImageDrawText & ImageDrawTextEx on Raspberry Pi doesn’t draw text? (#356)
Hello in the folk. Please, how can I compute the resulting height and width of the text, for example Hello World?
I need to place the text to the right side of the screen, and I need to know its width…
— Reply to this email directly, view it on GitHubhttps://github.com/raysan5/raylib/issues/356#issuecomment-2105806507, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHV6NH4QFNDIM6H7XXGAV6LZBYQFFAVCNFSM4D4HJRZKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJQGU4DANRVGA3Q. You are receiving this because you were mentioned.Message ID: @.***>
Hello in the folk. Please, how can I compute the resulting height and width of the text, for exampleHello World?I need to place the text to the right side of the screen, and I need to know its width…
EDIT:
sory -
MeasureTextandMeasureTextExfor custom fonts…