Gentoo: xfce4 fonts not sized correctly

Quick tip:

Problem: When installing Gentoo, Xfce4 on my new amd64 laptop, the fonts were extremely goofy compared to my old installation on x86. Meaning that terminal fonts looked ok, but gtk based fonts were large and small. I couldn’t figure this out and finally found a solution on XUbuntu’s blog post. I will reiterate it here for my future reference and maybe help someone else with this same problem.

Solution: In ~/.config/xfce4, append to the Xft.xrdb file (or create the file):
Xft.dpi: 96.

Then, log out and log back in. The fonts look normal sized again. I’m not sure what Xfce4 defaults to but whatever it was, it was clearly incorrect for my laptop.

Update: nightmorph, a fellow Gentoo developer, explains how to use the Xfce GUI to change the DPI setting as well. Please see the comments of this post.

  1. ahahah, thanks brother, you solved my problems :)

  2. Whoa, whoa, whoa there!

    It’s Xfce. It’s easy to use. Users shouldn’t have to touch text config files to get good fonts.

    In fact, there’s a handy graphical control for DPI built right into Xfce; it was added to the UI-settings-manager one or two versions ago.

    Menu –> Settings –> User Interface Preferences
    Click the Font DPI dropdown, and select your desired DPI (96 is common; it’s what I use on my systems).

    Make sure to Save session for future logins when you logout, and your DPI is preserved. Never do it the Xubuntu way, I’d say.

    Presto. No muss, no fuss. No editing nasty text files; it’s much easier to make the changes where you should — with the provided graphical tool.

  3. @nightmorph:
    okok, “Never do it the Xubuntu way” is alittle drastic because the “Xfce way” just writes to the above mentioned file anyway. ;)

    I couldn’t find it in the menu, so thanks for letting me know! I will add an update to my post.

    @dav_it: Glad I could help!

  4. You can calculate your correct dpi easily doing this:

    echo “sqrt(WidthInPixels^2+heightInPixels^2)/DiagonalViewingArea” | bc

    which results in 86 DPI for my 19″ lcd with a resolution of 1280×1024

    just wanted to point this out because many people simply use 96 DPI because it’s so common.

    have a look at http://www.raydreams.com/docs/dpi.html for more infos

  5. @marenz: That may be the correct way to find your DPI and it matches what xdpyinfo says for me.

    %% xdpyinfo|grep dots
    resolution: 129×129 dots per inch

    However, I don’t like it. A DPI of 96 looks natural to me and a DPI of 129 makes the “standard” font sizes too large. *shrugs*

    Thanks for the comment.

Leave a Reply