ITKeyword,专注技术干货聚合推荐

注册 | 登录

解决draw - cairo drawing a slanted text

itPublisher 分享于

2021腾讯云限时秒杀,爆款1核2G云服务器298元/3年!(领取2860元代金券),
地址https://cloud.tencent.com/act/cps/redirect?redirect=1062

2021阿里云最低价产品入口+领取代金券(老用户3折起),
入口地址https://www.aliyun.com/minisite/goods

推荐:cairo draw chinese text on windows

/* * cheungmine * 2013-5-5 */#include <stdio.h>#include <stdlib.h>#include <time.h>#ifdef _MSC_VER #include <windows.h> #pragma warning (dis

cairo_move_to (cr, x, y);
cairo_show_text (cr, "hello");

You know, will draw a parallel text to the axis, but now, I want to draw a slanted text somewhat like this:

but avoid cairo_rotate,I have two point, start point and end point, Tell me how to do, thanks

text draw cairo
|
  this question
edited Apr 16 '16 at 8:13 Uzbekjon 8,289 1 22 45 asked Apr 16 '16 at 7:11 fishu 18 6      "but avoid cairo_rotate" ok, then use cairo_matrix_init(), cairo_matrix_rotate() and cairo_set_matrix(). Why do you want to rotate without using cairo_rotate()? –  Uli Schlachter Apr 17 '16 at 7:15      Because I don't want to calculate the direction angle, but to draw text by initial coordinates and destination coordinates directly. –  fishu Apr 18 '16 at 1:38      Calculating the angle is just a call to atan2(). Does "I don't want to calculate the angle" still apply if you are given a function that gets two points as arguments and the text and then draws the text? –  Uli Schlachter Apr 18 '16 at 9:16      Thank you for your kind assistance, "calculate the angle" or atan2() means additional expenses, you know I have a lot of texts, If I can use two points to draw text directly, It'll save me so much cpu time, but, We can't seem to do that, I will take you advice, just call atan2(), I will show you my graphics. –  fishu Apr 19 '16 at 6:15

 | 

1 Answers
1

解决方法

Cairo is not meant for that; use Pango. Other than cairo_rotate, you don't really have any options in Cairo. As the linked page states, Cairo has only a toy text API.


|
  this answer
edited Apr 17 '16 at 12:17 answered Apr 16 '16 at 11:52 oldtechaa 1,278 1 7 25

 | 

推荐:android draw text at canvas

最近在定制一个画文字的控件,想把文字画到指定的点。开始始终会有几个像素的偏差。 经过研究找到了几个在调用画布来画文字的时候需要注意的地方: 1.文字大小的


相关阅读排行


相关内容推荐

最新文章

×

×

请激活账号

为了能正常使用评论、编辑功能及以后陆续为用户提供的其他产品,请激活账号。

您的注册邮箱: 修改

重新发送激活邮件 进入我的邮箱

如果您没有收到激活邮件,请注意检查垃圾箱。