| @@ -487,43 +487,14 @@ static void ncurses_check_terminal(void) | |||
| static void ncurses_write_utf32(uint32_t ch) | |||
| { | |||
| #if defined(HAVE_NCURSESW_NCURSES_H) | |||
| static const uint8_t mark[7] = | |||
| { | |||
| 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC | |||
| }; | |||
| char buf[10], *parser; | |||
| char buf[10]; | |||
| int bytes; | |||
| #endif | |||
| if(ch < 0x80) | |||
| { | |||
| addch(ch); | |||
| return; | |||
| } | |||
| #if defined(HAVE_NCURSESW_NCURSES_H) | |||
| if(ch < 0x10000) | |||
| { | |||
| addch(ch); /* FIXME: doesn't work either */ | |||
| return; | |||
| } | |||
| bytes = (ch < 0x800) ? 2 : (ch < 0x10000) ? 3 : 4; | |||
| bytes = _cucul_utf32_to_utf8(buf, ch); | |||
| buf[bytes] = '\0'; | |||
| parser = buf + bytes; | |||
| switch(bytes) | |||
| { | |||
| case 4: *--parser = (ch | 0x80) & 0xbf; ch >>= 6; | |||
| case 3: *--parser = (ch | 0x80) & 0xbf; ch >>= 6; | |||
| case 2: *--parser = (ch | 0x80) & 0xbf; ch >>= 6; | |||
| } | |||
| *--parser = ch | mark[bytes]; | |||
| addstr(buf); | |||
| #else | |||
| addch(' '); | |||
| addch(ch < 0x80 ? ch : '?'); | |||
| #endif | |||
| } | |||
| @@ -392,37 +392,14 @@ static void slang_init_palette(void) | |||
| static void slang_write_utf32(uint32_t ch) | |||
| { | |||
| #ifdef HAVE_SLSMG_UTF8_ENABLE | |||
| static const uint8_t mark[7] = | |||
| { | |||
| 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC | |||
| }; | |||
| char buf[10], *parser; | |||
| char buf[10]; | |||
| int bytes; | |||
| #endif | |||
| if(ch < 0x80) | |||
| { | |||
| SLsmg_write_char(ch); | |||
| return; | |||
| } | |||
| #ifdef HAVE_SLSMG_UTF8_ENABLE | |||
| bytes = (ch < 0x800) ? 2 : (ch < 0x10000) ? 3 : 4; | |||
| bytes = _cucul_utf32_to_utf8(buf, ch); | |||
| buf[bytes] = '\0'; | |||
| parser = buf + bytes; | |||
| switch(bytes) | |||
| { | |||
| case 4: *--parser = (ch | 0x80) & 0xbf; ch >>= 6; | |||
| case 3: *--parser = (ch | 0x80) & 0xbf; ch >>= 6; | |||
| case 2: *--parser = (ch | 0x80) & 0xbf; ch >>= 6; | |||
| } | |||
| *--parser = ch | mark[bytes]; | |||
| SLsmg_write_string(buf); | |||
| #else | |||
| SLsmg_write_char(' '); | |||
| SLsmg_write_char(ch < 0x80 ? ch : ' '); | |||
| #endif | |||
| } | |||
| @@ -9,6 +9,7 @@ optipal_SOURCES = optipal.c | |||
| makefont_SOURCES = makefont.c | |||
| makefont_CFLAGS = `pkg-config --cflags pangoft2` | |||
| makefont_LDFLAGS = `pkg-config --libs pangoft2` | |||
| makefont_LDADD = ../cucul/libcucul.la | |||
| if USE_PANGO | |||
| pango_programs = makefont | |||
| @@ -27,6 +27,9 @@ | |||
| # include <netinet/in.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include <pango/pango.h> | |||
| #include <pango/pangoft2.h> | |||
| @@ -199,35 +202,11 @@ int main(int argc, char *argv[]) | |||
| for(i = blocklist[b]; i < blocklist[b + 1]; i++) | |||
| { | |||
| unsigned int ch = i; | |||
| char buf[10], *parser; | |||
| char buf[10]; | |||
| int x, y, bytes; | |||
| if(ch < 0x80) | |||
| { | |||
| bytes = 1; | |||
| buf[0] = ch; | |||
| buf[1] = '\0'; | |||
| } | |||
| else | |||
| { | |||
| static const unsigned char mark[7] = | |||
| { | |||
| 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC | |||
| }; | |||
| /* FIXME: use libcucul instead of this shit */ | |||
| bytes = (ch < 0x800) ? 2 : (ch < 0x10000) ? 3 : 4; | |||
| buf[bytes] = '\0'; | |||
| parser = buf + bytes; | |||
| switch(bytes) | |||
| { | |||
| case 4: *--parser = (ch | 0x80) & 0xbf; ch >>= 6; | |||
| case 3: *--parser = (ch | 0x80) & 0xbf; ch >>= 6; | |||
| case 2: *--parser = (ch | 0x80) & 0xbf; ch >>= 6; | |||
| } | |||
| *--parser = ch | mark[bytes]; | |||
| } | |||
| bytes = _cucul_utf32_to_utf8(buf, ch); | |||
| buf[bytes] = '\0'; | |||
| /* Print glyph value in comment */ | |||
| printf("/* U+%.04X: \"", i); | |||