[cairo] Cairo text - underlined and striked text

WebSTAR Corp. webstar_corp at yahoo.com
Wed Jun 13 07:13:23 UTC 2018


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?

Many thanks,
Michael.


More information about the cairo mailing list