XFT fonts may be specified without `pixelsize` #2

Closed
vincentbernat opened this Issue Oct 8, 2012 · 2 comments

2 participants

@vincentbernat

Another valid way to specify an XFT font is to use xft:DejaVu Sans Mono-8. This has not the same effect as using pixelsize. Here is a slight modification of your plugin to work with this notation (I am not very proficient with Perl, feel free to come with another solution):

    foreach my $piece (@pieces) {
        if ($piece =~ /(pixelsize=|[^=-]*?)(\d+)/) {
            $size = $2;

            if ($basesize != 0) {
                $new_size = $basesize;
            } else {
                $new_size = ($change > 0 ? ($size + 1) : ($size - 1));
            }

            $piece =~ s/$size/$new_size/;
        }
        push @resized, $piece;
    }
@vincentbernat

Also, the minimal value should be changed since the specified value is in points instead of pixels. Something like 6 seems OK.

@majutsushi
Owner

OK, I finally had some time to look into this and read up on the different ways the font size can be specified with xft. After modifying your example a bit I think it should now properly handle all of them. Let me know if it works for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment