How to use font variations

56 views
Skip to first unread message

mes...@gmail.com

unread,
Dec 11, 2015, 6:34:39 PM12/11/15
to rst2pdf-discuss
I am using a particular font MyriadPro, which has of course the Regular, Italic, Bold and BoldItalic version. I have them in my ./fonts folder and I have referred to them in my stylesheet.
When I run rst2pdf on my .rst file, the pdf does pick up the 'ordinary' versions of the font, but not one I want to use for headings called MyriadPro-BlackSemiExt. What happens is that the pdf is produced without an error but the headings look like MyriadPro-Regular.

The relevant bits from my stylesheet file are:

  fontsAlias:
    stdFont: MyriadPro-Regular
    stdBold: MyriadPro-Bold
    stdItalic: MyriadPro-It
    stdBoldItalic: MyriadPro-BoldIt
    stdBlack: MyriadPro-BlackSemiExt

    heading1:
      parent: heading
      fontName: stdBlack
      fontSize: 16

If it's relevant, I'm running on Xubuntu 14.04. I realise that it may be an issue outside of rst2pdf (for example, the Gnome office apps only "see" the Regular version) but I would love to get this going and maybe even renounce MS word!

Any and all help appreciated.

Roberto Alsina

unread,
Dec 11, 2015, 6:38:03 PM12/11/15
to rst2pdf-discuss
Basically, on any style you can set a fontName. You can even directly use something like this:

heading1:
    fontName: MyriadPro-BlackSemiExt

The only problem is knowing the name of fonts, which is trickier than it should be. IIRC you can even use the path to a TTF file (OTF fonts are not supported) Alternatively there is a command to list the full set of available fonts from freetype but I can't remember it.

--
You received this message because you are subscribed to the Google Groups "rst2pdf-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rst2pdf-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mes...@gmail.com

unread,
Dec 12, 2015, 7:03:24 PM12/12/15
to rst2pdf-discuss, ral...@kde.org
Hi Roberto,

Thanks for your reply. Two things:

1) I did find out about using a path name after I posted. This is how the stylesheet is now.


  fontsAlias:
    stdFont: MyriadPro-Regular
    stdBold: MyriadPro-Bold
    stdItalic: MyriadPro-It
    stdBoldItalic: MyriadPro-BoldIt
    stdBlackSemiExt: /home/mike/.fonts/truetype/myriadpro/MyriadPro-BlackSemiExt.ttf

    heading1:
      parent: heading
      fontName: stdBlackSemiExt
      fontSize: 11

But the font isn't picked up,  the headings come out as stdFont.

2) The command to list all the fonts - you mean fc-list? This is what I get for the fonts listed above:
/home/mike/.fonts/truetype/myriadpro/MyriadPro-Regular.ttf: Myriad Pro:style=Regular
/home/mike/.fonts/truetype/myriadpro/MyriadPro-Bold.ttf: Myriad Pro:style=Bold
/home/mike/.fonts/truetype/myriadpro/MyriadPro-It.ttf: Myriad Pro:style=Italic
/home/mike/.fonts/truetype/myriadpro/MyriadPro-BoldIt.ttf: Myriad Pro:style=Bold Italic
/home/mike/.fonts/truetype/myriadpro/MyriadPro-BlackSemiExt.ttf: Myriad Pro,Myriad Pro Black SemiExt:style=Black SemiExtended,Bold

I've tried

   stdBlackSemiExt: MyriadPro-BlackSemiExt
   stdBlackSemiExt: Myriad Pro,Myriad Pro Black SemiExt
   stdBlackSemiExt: Myriad Pro Black SemiExt
   stdBlackSemiExt: MyriadPro-Black SemiExtended
   stdBlackSemiExt: MyriadPro-Black SemiExtended,Bold

All of which give Regular style instead, though the last one does come up in Bold.
What part of the font name exactly should I be using? Do I have to worry about the spaces in the font name?

The happiest solution would be that the file name reference worked, but it doesn't appear to.
I even tried putting the base font as italics to force the issue

   stdFont: /home/mike/.fonts/truetype/myriadpro/MyriadPro-It.ttf

 but it still came up in Regular!

Is there anything further I could try?

Roberto Alsina

unread,
Dec 13, 2015, 7:45:35 AM12/13/15
to rst2pdf-discuss
To be honest, I have not looked at that code in a very very long time. Sorry I can't be of more help/

mes...@gmail.com

unread,
Dec 14, 2015, 6:57:48 AM12/14/15
to rst2pdf-discuss, ral...@kde.org
OK, no problem. I will look into it more and even at the code. I will post here if find anything useful or need any pointers! :)
Reply all
Reply to author
Forward
0 new messages