[cairo] Cairo text - underlined and striked text
bryce at bryceharrington.org
Wed Jun 13 16:06:49 UTC 2018
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);
> 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:
More information about the cairo