|
Changing font size |
trictonicmp
Member #16,611
December 2016
|
Hi people, I know I always make weird questions about allegro but, it is possible to change the font size without loading the font again? |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Because allegro does not draw fonts on demand, but caches the glyphs, you cannot resize the font without reloading it. That said, there's nothing stopping you from loading the font at a larger size and then using transformations to downscale or upscale your fonts. EDIT My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
trictonicmp
Member #16,611
December 2016
|
I guess there are downsides on each method, I mean, transformations will pixelate the text and I have never used memfiles i'm gonna look for it but I guess my best bet is to reload the font to change its size |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Reloading from a mem file is faster than reloading from disk. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
jmasterx
Member #11,410
October 2009
|
I made a system that loaded them as needed and picked the best one for the res Loading fonts does not take that much vram. I think allegro prerenders them as monochrome bitmaps... Agui GUI API -> https://github.com/jmasterx/Agui |
codetricity
Member #17,059
March 2019
|
After seeing this thread, I too implemented font scaling using transform. I load the font in at a base size of 32. For me, it was a win/win because now I get a good balance. They look good in windowed mode and also look better in fullscreen (I scale to keep the same ratio). I did have to change my bitmap flag to the following: al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR or ALLEGRO_MAG_LINEAR or ALLEGRO_MIPMAP or ALLEGRO_VIDEO_BITMAP); Thanks for making the suggestion.
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
You might not want ALLEGRO_MAG_LINEAR - it will blur graphics as they get larger. If you prefer crisp edges, don't use it. ALLEGRO_MIN_LINEAR is good though, and makes shrinking bitmaps look better. MIPMAP pre-renders smaller versions, which isn't strictly necessary for fonts. Scaling is more than fast enough. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|