Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Change font in paragraph

  • #6128
    Avatar photo[anonymous]

    Hi. I use the WYSIWYG editor for my posts. I can change easily font color, use bold, italic or even exotic things like strikethrough. But I can’t choose font type. Yes, I can choose paragraph style (H1, H2,…) and three predefined paragraph types (Info, Highlight and Success), but this is not what I want.

    I want to choose any font type from a list, like in a computer text editor. I think that Google Fonts is a good option to do it online. But I’ve to edit the head section, put a link to the specific Google Font, then create a CSS class, then edit my post in HTML mode to include it manually… REALLY?! For only one paragraph? Lot of work for something so simple.

    Questions:

    • Why changing fonts in a post (not in a theme) is so painful and not so easy like change colors?
    • I’m missing something? There is an easier way to change a font style without requiring to create a CSS class and edit HTML manually?

    Thanks.

    #6129
    Avatar photo[anonymous]

    Is it okay for you to do it for all paragraphs or do you want to only for selected ones?

    If you want to change all I think you can use custom formats https://getpublii.com/dev/post-editor-api/#customformats

    I have not tried it out myself. You still have to create css classes but you can select them in the editor instead of editing the HTML as I have understood.

    #6133
    Avatar photo[anonymous]

    Thanks, it’s a good trick.

    Anyway, what I want is to use a different font (not always the same) in a single paragraph occasionally, and it’s disproportionate to modify theme CSS files to do it.

    #6136
    Avatar photoBob
    [anonymous] wrote:

    Why changing fonts in a post (not in a theme) is so painful and not so easy like change colors?

    The answer is simple – to have a fast website, you shouldn’t use more than 2-3 different fonts. This is why the post editors do not and will not offer this feature. (I recommend reading the “How to optimize fonts for a faster website” article.

    Almost all Publii themes offer multiple pairs of fonts, so you can try using them for your needs: create a CSS class (using the CSS tool) with the font family, and then apply that class to your paragraph.
    From my point of view and experience (Web Design), in cases where you need to use slogans/text stylized with different fonts, use SVG or any other graphic files.