|
|
| color font |
|
GeomanNL
Member #4,337
February 2004
|
I'm looking at the allegro color fonts, and I'd like to know how they get their colors - cause I'd like to be able to change the colors. I've tried set_palette(default_palette) but such a global approach doesn't seem to work - therefore I think there's a palette stored somewhere in the FONT, but I don't know where, or how to access it ! I can't find anything in the allegro.h or the allegro source code which helps me further. |
|
A J
Member #3,025
December 2002
|
i dont think they can be changed dynamically. however, you could write them to a temp map, apply a palette change, then blit to yoru destination map. ___________________________ |
|
GeomanNL
Member #4,337
February 2004
|
ok ... well I must admit I made a mistake. setting the global palette does work, but due to a mistake in one of my routines the color wasn't set to -1, which is required for this... sorry. EDIT: for whoever is interested, here's some code for applying to truetype font to an allegro font, without fancy stuff. It requires the truetype library. It's useful cause the allegttf library is a little outdated. #include <allegro.h> #include "ttf.h" // copy ttf bitmap onto an allegro bitmap int ix, iy; if (src->pixel_mode == ft_pixel_mode_mono) // dunno if this works - untested } static void cleanup (FT_Library engine, FT_Face face) FONT* load_ttf_font (const char* filename, const int points, const int smooth) int points_w, points_h, begin, end; FT_Library engine = 0; // initialize the library // set font size in pixels // in case there's no unicode (ascii) charmap loaded by default error = FT_Set_Charmap(face, face->charmaps[0]); // just pick the first one . FT_GlyphSlot slot = face->glyph; // a small shortcut int ymin, ymax, yorigin; w = slot->metrics.horiAdvance / 64; h = points_h; dx = slot->bitmap_left; if (w && h) fcd->bitmaps[c-begin] = bmp; |
|
|