Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to find the width, in pixels, of a string displayed with some font. I know that I can do:

dzen2-textwidth \
   -adobe-times-medium-r-normal--8-80-75-75-p-44-iso8859-1 \
   "A Tale of Two Cities"

(this command comes from the dzen2 package)

However, this doesn't support Xft. I want to be able to use the Xft font format, like "Droid Sans:size=12".

Is there a program that let me do this?

(It goes without saying that it should support Unicode, because I'm not using English. But I guess that anything that supports Xft is modern enough to support Unicode.)

I understand that I could write a program myself (using Ruby / Python / Haskell / NodeJS) if I have GTK/Pango/Whatever bindings, but first I want to see if there's a ready made program (A program in C/C++ is always better for me as I'm using a relatively slow computer and for scripts there's a long starting time (for this reason, BTW, Java is out of the question).

share|improve this question
    
Perhaps you just need a more recent version of dzen2. According to its home page on github, github.com/robm/dzen/wiki, Xft support is optional; the default config.mk file (github.com/robm/dzen/blob/master/config.mk) has it enabled. You could always try downloading the source and building it yourself. –  rici Aug 6 '13 at 4:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.