help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Droid Sans Mono Italics


From: Peter Dyballa
Subject: Re: Droid Sans Mono Italics
Date: Wed, 15 May 2013 16:31:23 +0200

Am 15.05.2013 um 14:14 schrieb SabreWolfy:

> Why is this font variant not available in Emacs?

Maybe it's not a font variant in LibreOffice? What it is artificially slanted?

You're on a Linux box. You can use xlsfonts and xfontsel do find out whether 
the X server knows about DroidSans; and you can use fc-list to find out whether 
your libfontconfig based fonts service knows about the font. Finally you can 
use, as brute force, find or locate to determine whether any font file related 
to DroidSans exists. If more than the standard font's file exists, just add the 
path to libfontconfig's fonts.conf or .fonts.conf file and run fc-cache! Then 
GNU Emacs will be able to use all DroidSans font variants.

This function by Miles Bader will show you the fonts GNU Emacs knows right now:

(defun list-fonts-display (&optional matching)
     "Display a list of font-families available via font-config, in a new 
buffer.
   If the optional argument MATCHING is non-nil, only font families
   matching that regexp are displayed; interactively, a prefix
   argument will prompt for the regexp.
   The name of each font family is displayed using that family, as
   well as in the default font (to handle the case where a font
   cannot be used to display its own name)."
     (interactive
      (list
       (and current-prefix-arg
            (read-string "Display font families matching regexp: "))))
     (let (families)
       (with-temp-buffer
         (shell-command "fc-list : family" t)
         (goto-char (point-min))
         (while (not (eobp))
           (let ((fam (buffer-substring (line-beginning-position)
                                        (line-end-position))))
             (when (or (null matching) (string-match matching fam))
               (push fam families)))
           (forward-line)))
       (setq families
             (sort families
                   (lambda (x y) (string-lessp (downcase x) (downcase y)))))
       (let ((buf (get-buffer-create "*Font Families*")))
         (with-current-buffer buf
           (erase-buffer)
           (dolist (family families)
             ;; We need to pick one of the comma-separated names to
             ;; actually use the font; choose the longest one because some
             ;; fonts have ambiguous general names as well as specific
             ;; ones.
             (let ((family-name
                    (car (sort (split-string family ",")
                               (lambda (x y) (> (length x) (length y))))))
                   (nice-family (replace-regexp-in-string "," ", " family)))
               (insert (concat (propertize nice-family
                                           'face (list :family family-name))
                               " (" nice-family ")"))
               (newline)))
           (goto-char (point-min)))
         (display-buffer buf))))

BTW, I have from TeX Live these three font files:

/usr/local/texlive/2012/texmf-dist/fonts/truetype/public/droid/DroidSans-Bold.ttf
/usr/local/texlive/2012/texmf-dist/fonts/truetype/public/droid/DroidSans.ttf
/usr/local/texlive/2012/texmf-dist/fonts/truetype/public/droid/DroidSansMono.ttf

You see, not many variants…

--
Greetings

  Pete

If all else fails read the instructions.
                                - Donald Knuth




reply via email to

[Prev in Thread] Current Thread [Next in Thread]