开罗以错误的方向渲染阿拉伯文本
Cairo rendering Arabic text in wrong direction
Cairo 从左到右而不是从右到左呈现阿拉伯文本。此外,字符没有连接。这是我的代码:
#include <cairo.h>
int main (int argc, char *argv[])
{
cairo_t *c;
cairo_surface_t *cs;
cairo_font_face_t * ct;
cs = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 500, 500);
c = cairo_create (cs);
cairo_select_font_face(c, "Arial",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (c, 40);
cairo_set_source_rgb (c, 255, 255, 255);
cairo_move_to (c, 100, 100);
cairo_show_text(c, "كيف الحال");
cairo_surface_write_to_png (cs, "cairo.png");
return 0;
}
这是它的样子:
第一个字母“ك”显示为左侧的第一个字符,而本应位于右侧。 'ك' 也应该连接到 'ي'。所有的字符都是单独显示的,就像英文一样。
The functions with text in their name form cairo's toy text API. The
toy API takes UTF-8 encoded text and is limited in its functionality
to rendering simple left-to-right text with no advanced features. That
means for example that most complex scripts like Hebrew, Arabic, and
Indic scripts are out of question.
Cairo 从左到右而不是从右到左呈现阿拉伯文本。此外,字符没有连接。这是我的代码:
#include <cairo.h>
int main (int argc, char *argv[])
{
cairo_t *c;
cairo_surface_t *cs;
cairo_font_face_t * ct;
cs = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 500, 500);
c = cairo_create (cs);
cairo_select_font_face(c, "Arial",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (c, 40);
cairo_set_source_rgb (c, 255, 255, 255);
cairo_move_to (c, 100, 100);
cairo_show_text(c, "كيف الحال");
cairo_surface_write_to_png (cs, "cairo.png");
return 0;
}
这是它的样子:
第一个字母“ك”显示为左侧的第一个字符,而本应位于右侧。 'ك' 也应该连接到 'ي'。所有的字符都是单独显示的,就像英文一样。
The functions with text in their name form cairo's toy text API. The toy API takes UTF-8 encoded text and is limited in its functionality to rendering simple left-to-right text with no advanced features. That means for example that most complex scripts like Hebrew, Arabic, and Indic scripts are out of question.