|
|
|
@ -98,6 +98,7 @@ struct font_directory {
@@ -98,6 +98,7 @@ struct font_directory {
|
|
|
|
|
u32 glyf_offset; |
|
|
|
|
u32 hmtx_offset; |
|
|
|
|
u32 maxp_offset; |
|
|
|
|
u32 post_offset; |
|
|
|
|
|
|
|
|
|
u32 cvt_offset; |
|
|
|
|
u32 cvt_size; |
|
|
|
@ -191,6 +192,7 @@ struct ttf_font {
@@ -191,6 +192,7 @@ struct ttf_font {
|
|
|
|
|
|
|
|
|
|
s16 *cvt; |
|
|
|
|
int cmap_format; |
|
|
|
|
int is_monospace; |
|
|
|
|
|
|
|
|
|
struct font_directory dir; |
|
|
|
|
struct ttf_function *functions; |
|
|
|
@ -646,11 +648,7 @@ render_utf_string(struct ttf_font font, int px_size, u32 *pixels, u32 width, wch
@@ -646,11 +648,7 @@ render_utf_string(struct ttf_font font, int px_size, u32 *pixels, u32 width, wch
|
|
|
|
|
|
|
|
|
|
render_glyph(g, px_size, &lines, scale, pixels, width, offset_x + g.lsb * scale, offset_y); |
|
|
|
|
|
|
|
|
|
#if 1 |
|
|
|
|
offset_x += round_f32(scale * g.advance); |
|
|
|
|
#else |
|
|
|
|
offset_x += px_size * 2; |
|
|
|
|
#endif |
|
|
|
|
offset_x += ceil_f32(scale * g.advance); |
|
|
|
|
|
|
|
|
|
free(lines.data); |
|
|
|
|
} else { |
|
|
|
@ -732,23 +730,23 @@ main(int argc, char **argv)
@@ -732,23 +730,23 @@ main(int argc, char **argv)
|
|
|
|
|
//render_utf_string(font, 18, pixels, width, L"The quick brown fox jumps over the lazy dog", 100, 150);
|
|
|
|
|
//render_utf_string(font, 12, pixels, width, L"This text is seriously small", 100, at); at += 12;
|
|
|
|
|
//render_utf_string(font, 13, pixels, width, L"This text is seriously small", 100, at); at += 13;
|
|
|
|
|
//render_utf_string(font, 14, pixels, width, L"This text is seriously small", 100, at); at += 14;
|
|
|
|
|
render_utf_string(font, 14, pixels, width, L"This text is seriously small", 100, at); at += 14; |
|
|
|
|
//render_utf_string(font, 15, pixels, width, L"This text is seriously small", 100, at); at += 14;
|
|
|
|
|
render_utf_string(font, 20, pixels, width, L"result = XCreateImage(display, visinfo.visual, visinfo.depth, ZPixmap, 0, hc_vram, width, height, pixel_bits, 0);", 100, at); at += 20; |
|
|
|
|
render_utf_string(font, 24, pixels, width, L"The quick brown fox jumps over the lazy dog", 100, at); at += 24; |
|
|
|
|
render_utf_string(font, 26, pixels, width, L"memset(pixels, 0x00, width * height * 4);", 10, at); at += 24; |
|
|
|
|
render_utf_string(font, 24, pixels, width, L"The quick brown fox jumps over the lazy dog", 10, at); at += 24; |
|
|
|
|
|
|
|
|
|
wchar_t *string1 = L"iiiiiiiiil"; |
|
|
|
|
wchar_t *string1 = L"iiiiiiiiiiiiiiiiiii"; |
|
|
|
|
wchar_t *string2 = L"something-some"; |
|
|
|
|
wchar_t *string3 = L"MORE MORE"; |
|
|
|
|
|
|
|
|
|
int w1 = get_string_width(&font, 32, string1, wcslen(string1)); |
|
|
|
|
int w2 = get_string_width(&font, 32, string2, wcslen(string2)); |
|
|
|
|
|
|
|
|
|
render_utf_string(font, 32, pixels, width, string1, 100, at); |
|
|
|
|
render_utf_string(font, 32, pixels, width, string2, 100 + w1, at); |
|
|
|
|
render_utf_string(font, 32, pixels, width, string3, 100 + w1 + w2, at); |
|
|
|
|
render_utf_string(font, 32, pixels, width, string1, 10, at); |
|
|
|
|
render_utf_string(font, 32, pixels, width, string2, 10 + w1, at); |
|
|
|
|
render_utf_string(font, 32, pixels, width, string3, 10 + w1 + w2, at); |
|
|
|
|
at += 80; |
|
|
|
|
render_utf_string(font, 80, pixels, width, L"~!@#$%^&*()_+;:,./\\|", 100, at); |
|
|
|
|
render_utf_string(font, 80, pixels, width, L"~!@#$%^&*()_+;:,./\\||||", 10, at); |
|
|
|
|
|
|
|
|
|
XPutImage(display, window, default_gc, xwindow_buffer, 0, 0, 0, 0, width, height); |
|
|
|
|
|
|
|
|
|