main.c 734 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. Use UTF-8 encoding for this file
  3. */
  4. #include "u8x8.h"
  5. u8x8_t u8g2;
  6. int main(void)
  7. {
  8. u8x8_Setup_SDL_128x64(&u8g2);
  9. u8x8_InitDisplay(&u8g2);
  10. u8x8_SetFont(&u8g2, u8x8_font_amstrad_cpc_extended_f);
  11. u8x8_DrawString(&u8g2, 0, 0, "UTF-8 Test");
  12. u8x8_DrawString(&u8g2, 0, 1, "M\xfcnchen");/* works: select umlaut-u directly with code 0xfc */
  13. u8x8_DrawString(&u8g2, 0, 2, "München"); /* does not work: umlaut-u is translated to utf-8, broken output */
  14. u8x8_DrawUTF8(&u8g2, 0, 3, "M\xfcnchen"); /* does not work: Codes above 127 are reserved for UTF-8 encoding */
  15. u8x8_DrawUTF8(&u8g2, 0, 4, "München"); /* works: u8x8 can handle UTF-8 code correctly */
  16. while( u8g_sdl_get_key() < 0 )
  17. ;
  18. return 0;
  19. }