cairo_select_font_face(cr,"Adobe Heiti Std", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_set_font_size(cr,24.0); 选择字体类型并设置其尺寸。(注:可使用 "fc-list" 命令查看系统所安装字体) cairo_move_to(cr,10.0,34.0); cairo_show_text(cr,"我是中国人,我爱我的祖国。"); ...
{ cairo_select_font_face(g_context.cr, "serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); cairo_set_font_size(g_context.cr, 50.0); cairo_set_source_rgba(g_context.cr, 1.0, 0.0, 0.1, 0.9); cairo_move_to(g_context.cr, x, y); cairo_show_text(g_context.cr, "Hello, w...
cairo_select_font_face(cr, "Purisa", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); 这里设置字体。这个函数接受了三个字体参数的传入,字体的名称、样式与轻重。 1 cairo_set_font_size(cr, 13); 这里设定字号。 1 2 cairo_move_to(cr, 20, 30); ...
cairo_t *cr = cairo_create(surface); cairo_select_font_face(cr, "Sazanami Gothic", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); cairo_set_font_size(cr, 30.0); cairo_set_source_rgb(cr, 1.0, 1.0, 1.0); cairo_move_to(cr, 0.0, 35.0); cairo_show_text(cr, "R u 学生."); ...
cairo_select_font_face(cr,"serif",CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); cairo_set_font_size(cr, font_size); cairo_set_source_rgb(cr, red, green, blue); cairo_move_to(cr, x, y); cairo_show_text(cr, "Hello, World!"); ``` 6. 保存画布为图像文件: ```c cairo_sur...
CairoContext::selectFontFace -- cairo_select_font_face— The selectFontFace purpose说明面向对象风格 (method):public CairoContext::selectFontFace ( string $family [, int $slant [, int $weight ]] ) : void过程化风格:cairo_select_font_face ( CairoContext $context , string $family [, int $...
#include <cairo.h> #include <gtk/gtk.h> static gboolean on_expose_event (GtkWidget * widget, GdkEventExpose * event, gpointer data) { cairo_t *cr; cr = gdk_cairo_create (widget->window); cairo_set_source_rgb (cr, 0.627, 0, 0); cairo_select_font_face (cr, "WenQuanYi Zen Hei"...
# Cairo Tutorial: Diagrams (Section #text)cr.set_source_rgb(0.0,0.0,0.0)cr.select_font_face("Georgia",cairo.FONT_SLANT_NORMAL,cairo.FONT_WEIGHT_BOLD)cr.set_font_size(1.2)x_bearing,y_bearing,width,height=cr.text_extents("a")[:4]cr.move_to(0.5-width/2-x_bearing,0.5-height/2-y_bea...
cairo_set_line_width(cr,3);cairo_select_font_face(cr,"STSong",CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD);//设置字体样式cairo_set_font_size(cr,20);//设置字体大小cairo_move_to(cr,100,100);cairo_show_text(cr,"hello world");//绘制英文cairo_move_to(cr,100,200);cairo_show_text(...
例子1: 直接生成一个PNG图片,在上面用自定义的字体和颜色写Hello World#include <cairo.h>intmain (int argc, char *argv[]){ cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 240, 80); cairo_t *cr = cairo_create (surface); cairo_select_font_face (cr, "serif"...