[cairo] Cairo text - underlined and striked text

WebSTAR Corp. webstar_corp at yahoo.com
Thu Jun 14 17:02:37 UTC 2018


Bryce, Uli, Thank you for the answers!
I tought that I do something wrong. 

Best,
Michael.

--------------------------------------------
On Wed, 6/13/18, Bryce Harrington <bryce at bryceharrington.org> wrote:

 Subject: Re: [cairo] Cairo text - underlined and striked text
 To: "WebSTAR Corp." <webstar_corp at yahoo.com>
 Cc: cairo at cairographics.org
 Date: Wednesday, June 13, 2018, 6:06 PM
 
 On Wed, Jun 13, 2018 at 07:13:23AM +0000,
 WebSTAR Corp. wrote:
 > Hi All,
 > 
 > I would have a
 question on you:
 > 
 >
 I use Cairo Graphics (1.10.2) on a Visual Studio project.
 > Because Cairo doesn't have functions
 for underlined and striked text, I tried to use
 "cairo_win32_font_face_create_for_hfont" to create
 a font from a Windows HFONT object that supports both
 underlined and striked text.
 > The
 problem is, even if I set underlined & striked text to
 "TRUE" in the HFONT object, the text is still not
 unerlined or striked. Is this a normal behavior?
 > 
 > This is some
 code:
 > 
 > 
 > HFONT hFont;
 > hFont =
 CreateFont(48, 0, 0, 0, FW_DONTCARE, TRUE, TRUE, TRUE,
 DEFAULT_CHARSET, OUT_OUTLINE_PRECIS, CLIP_DEFAULT_PRECIS,
 CLEARTYPE_QUALITY, VARIABLE_PITCH,
 TEXT("Impact"));
 > 
 > cairo_font_face_t* fontFace =
 cairo_win32_font_face_create_for_hfont(hFont);
 > 
 >
 cairo_set_font_face(cr, fontFace);
 > 
 > cairo_set_font_size(cr, fontSize);
 > cairo_set_source_rgb(cr, 0.37, 0.37,
 0.37);
 > 
 >
 cairo_move_to(cr, x, y);
 >
 cairo_show_text(cr, myText); 
 > 
 > cairo_font_face_destroy(fontFace);
 > DeleteObject(hFont);
 >
 
 > 
 > PS: Is there a
 way to create underlined & striked text on
 Cairo?
 
 Have you tried
 Pango for this?  The cairo_show_text() and friends are
 convenient but limited in functionality. 
 See:
 
 https://cairographics.org/manual/cairo-text.html#cairo-show-text
 
 Bryce
 
 -----Inline Attachment Follows-----
 
 


More information about the cairo mailing list