From 5792e77239c43aea0afc21b2df96153ba31c5399 Mon Sep 17 00:00:00 2001 From: Irie Shinsuke Date: Tue, 12 Mar 2013 07:25:53 +0000 Subject: Patch [#34373] Use i18n monospace font in Text editor and Python console This patch allows Blender to display i18n monospace font in the text editor and the Python interactive console. Wide characters that occupy multiple columns such as CJK characters can be displayed correctly. Furthermore, wrapping, selection, suggestion, cursor drawing, and syntax highlighting should work. Also fixes a bug [#34543]: In Text Editor false color in comment on cyrillic To estimate how many columns each character occupies, this patch uses wcwidth.c written by Markus Kuhn and distributed under MIT-style license: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c wcwidth.c is stored in extern/wcwidth and used as a static library. This patch adds new API to blenfont, blenlib and blenkernel: BLF_get_unifont_mono() BLF_free_unifont_mono() BLF_draw_mono() BLI_wcwidth() BLI_wcswidth() BLI_str_utf8_char_width() BLI_str_utf8_char_width_safe() txt_utf8_offset_to_column() txt_utf8_column_to_offset() --- source/blender/blenfont/intern/blf_internal.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/blenfont/intern/blf_internal.h') diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h index 65a54783978..b1301be46fd 100644 --- a/source/blender/blenfont/intern/blf_internal.h +++ b/source/blender/blenfont/intern/blf_internal.h @@ -53,6 +53,7 @@ void blf_font_attach_from_mem(struct FontBLF *font, const unsigned char *mem, in void blf_font_size(struct FontBLF *font, int size, int dpi); void blf_font_draw(struct FontBLF *font, const char *str, size_t len); void blf_font_draw_ascii(struct FontBLF *font, const char *str, size_t len); +int blf_font_draw_mono(struct FontBLF *font, const char *str, size_t len, int cwidth); void blf_font_buffer(struct FontBLF *font, const char *str); void blf_font_boundbox(struct FontBLF *font, const char *str, struct rctf *box); void blf_font_width_and_height(struct FontBLF *font, const char *str, float *width, float *height); -- cgit v1.2.3