-}
-
-/**
- * \fn void VT_int_ChangeMode(tVTerm *Term, int NewMode)
- * \brief Change the mode of a VTerm
- */
-void VT_int_ChangeMode(tVTerm *Term, int NewMode)
-{
- switch(NewMode)
- {
- case TERM_MODE_TEXT:
- free(Term->Buffer);
- Term->Text = calloc( Term->Width*Term->Height*VT_SCROLLBACK, sizeof(tVT_Char) );
- break;
- case TERM_MODE_FB:
- free(Term->Text);
- Term->Buffer = calloc( Term->Width*Term->Height, sizeof(Uint32) );
- break;
- case TERM_MODE_OPENGL:
- return;
- }
-
- Term->Mode = NewMode;
-}
-
-// ---
-// Font Render
-// ---
-#define MONOSPACE_FONT 10816
-
-#if MONOSPACE_FONT == 10808 // 8x8
-# include "vterm_font_8x8.h"
-#elif MONOSPACE_FONT == 10816 // 8x16
-# include "vterm_font_8x16.h"
-#endif
-
-// === PROTOTYPES ===
-Uint8 *VT_Font_GetChar(Uint32 Codepoint);
-
-// === GLOBALS ===
-int giVT_CharWidth = FONT_WIDTH+1;
-int giVT_CharHeight = FONT_HEIGHT;
-
-// === CODE ===
-/**
- * \fn void VT_Font_Render(Uint32 Codepoint, void *Buffer, int Pitch, Uint32 BGC, Uint32 FGC)
- * \brief Render a font character
- */
-void VT_Font_Render(Uint32 Codepoint, void *Buffer, int Pitch, Uint32 BGC, Uint32 FGC)
-{
- Uint8 *font;
- Uint32 *buf = Buffer;
- int x, y;
-
- font = VT_Font_GetChar(Codepoint);
-
- for(y = 0; y < FONT_HEIGHT; y ++)
- {
- for(x = 0; x < FONT_WIDTH; x ++)
- {
- if(*font & (1 << (FONT_WIDTH-x-1)))
- buf[x] = FGC;
- else
- buf[x] = BGC;
- }
- buf += Pitch;
- font ++;
- }
-}
-
-/**
- * \fn Uint32 VT_Colour12to24(Uint16 Col12)
- * \brief Converts a
- */
-Uint32 VT_Colour12to24(Uint16 Col12)
-{
- Uint32 ret;
- int tmp;
- tmp = Col12 & 0xF;
- ret = (tmp << 0) | (tmp << 4);
- tmp = (Col12 & 0xF0) >> 4;
- ret |= (tmp << 8) | (tmp << 12);
- tmp = (Col12 & 0xF00) >> 8;
- ret |= (tmp << 16) | (tmp << 20);
- return ret;
-}
-
-/**
- * \fn Uint8 *VT_Font_GetChar(Uint32 Codepoint)
- * \brief Gets an index into the font array given a Unicode Codepoint
- * \note See http://en.wikipedia.org/wiki/CP437
- */
-Uint8 *VT_Font_GetChar(Uint32 Codepoint)
-{
- int index = 0;
- if(Codepoint < 128)
- return &VTermFont[Codepoint*FONT_HEIGHT];
- switch(Codepoint)
- {
- case 0xC7: index = 128; break; // Ç
- case 0xFC: index = 129; break; // ü
- case 0xE9: index = 130; break; // é
- case 0xE2: index = 131; break; // â
- case 0xE4: index = 132; break; // ä
- case 0xE0: index = 133; break; // à
- case 0xE5: index = 134; break; // å
- case 0xE7: index = 135; break; // ç
- case 0xEA: index = 136; break; // ê
- case 0xEB: index = 137; break; // ë
- case 0xE8: index = 138; break; // è
- case 0xEF: index = 139; break; // ï
- case 0xEE: index = 140; break; // î
- case 0xEC: index = 141; break; // ì
- case 0xC4: index = 142; break; // Ä
- case 0xC5: index = 143; break; // Å
- }