Bold/Italics styles in libharu

264 views
Skip to first unread message

Robert Butler

unread,
Feb 25, 2011, 3:46:31 PM2/25/11
to lib...@googlegroups.com
Hi all,

I am  currently working on converting a project at work from iTextSharp -> libharu (C++) for a specialized use-case of 
one of our proprietary UNIX applications.

However, we need libharu to be able to display text in styles other than just 'normal'; Is there a 'proper' way to set the 
bold/italics (such as accessing bold/italics subfamilies) style[s], or am I relegated to half-assing a solution myself?

Thanks,
- Robert

Pierre Clouthier

unread,
Nov 14, 2017, 3:50:43 PM11/14/17
to libHaru
You need to select the bold or italic version of the font. If a font does not come in a bold or italic version, there is a technique for generating a "faux" bold or italic, but I haven't figured it out yet.

Alex Halser

unread,
Jul 11, 2018, 11:29:53 AM7/11/18
to libHaru
This creates an italic simulation for TrueType fonts that don't support italic:

    Tm := HPDF_Page_GetTextMatrix(page);
    HPDF_Page_SetTextMatrix(page, Tm.a, Tm.b, Tm.c + 0.3333, Tm.d, Tm.x, Tm.y); 

And this is a pretty nice bold simulation:

    HPDF_Page_SetTextRenderingMode(page, HPDF_FILL_THEN_STROKE);
Reply all
Reply to author
Forward
0 new messages