9 Clear things a little bit.
source | link

In our init file we should be able to set that in our init file to set one font for full range of characters:

 (let ((my-font "DejaVu Sans Mono-14"))
  (set-fontset-font "fontset-startup" '(#x000000 . #x3FFFFF) my-font)
  (set-fontset-font "fontset-default" '(#x000000 . #x3FFFFF) my-font)
  (set-fontset-font "fontset-standard" '(#x000000 . #x3FFFFF) my-font))

or for specific charset:

(let ((my-font "DejaVu Sans Mono-14"))
  (set-fontset-font "fontset-startup" 'unicode my-font)
  (set-fontset-font "fontset-default" 'unicode my-font)
  (set-fontset-font "fontset-standard" 'unicode my-font))

orBut to eliminateset a font for a range of characters, specific script and characters without defined fontspec — all in one goforce it as a fallback font for characters not supported by it we also must add nil as a target:

(let ((my-font "DejaVu Sans Mono-14")
      (font-sets '("fontset-default"
                   "fontset-standard"
                   "fontset-startup")))
  (mapcar
   (lambda (font-set)
     ;; all the characters in that range
     (set-fontset-font font-set '(#x000000 . #x3FFFFF) my-font)

     ;; all the characters belongingwhich tois the script 'symbol'
     ;; that situation should be covered byfull abovepossible range rule)
     (set-fontset-font font-set 'symbol'(#x000000 . #x3FFFFF) my-font)

     ;; for all characters without font specification
     ;; in another words it is a setting for lack of fallback font
     ;; if e.g. ℕ called DOUBLE-STRUCK CAPITAL N is not covered by our font
     ;; it will be displayed as placeholder-box,
     ;; because fallback for our font is now... our font :)
     (set-fontset-font font-set nil my-font))
   font-sets))

Now as we can see under point (cursor) with C-u C-x = or M-x describe-char:

             position: 1430 of 1954 (73%), column: 16
            character: ℕ (displayed as ℕ) (codepoint 8469, #o20425, #x2115)
    preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0x2115
               script: symbol
               syntax: w    which means: word
             category: .:Base, L:Left-to-right (strong)
             to input: type "C-x 8 RET HEX-CODEPOINT" or "C-x 8 RET NAME"
          buffer code: #xE2 #x84 #x95
            file code: #xE2 #x84 #x95 (encoded by coding system utf-8-unix)
              display: no font available

Character code properties: customize what to show
  name: DOUBLE-STRUCK CAPITAL N
  old-name: DOUBLE-STRUCK N
  general-category: Lu (Letter, Uppercase)
  decomposition: (font 78) (font 'N')

Important part: display: no font available.

we should be able to set that in our init file to set one font for full range of characters:

 (let ((my-font "DejaVu Sans Mono-14"))
  (set-fontset-font "fontset-startup" '(#x000000 . #x3FFFFF) my-font)
  (set-fontset-font "fontset-default" '(#x000000 . #x3FFFFF) my-font)
  (set-fontset-font "fontset-standard" '(#x000000 . #x3FFFFF) my-font))

or for specific charset:

(let ((my-font "DejaVu Sans Mono-14"))
  (set-fontset-font "fontset-startup" 'unicode my-font)
  (set-fontset-font "fontset-default" 'unicode my-font)
  (set-fontset-font "fontset-standard" 'unicode my-font))

or to eliminate range of characters, specific script and characters without defined fontspec — all in one go:

(let ((my-font "DejaVu Sans Mono-14")
      (font-sets '("fontset-default"
                   "fontset-standard"
                   "fontset-startup")))
  (mapcar
   (lambda (font-set)
     ;; all the characters in that range
     (set-fontset-font font-set '(#x000000 . #x3FFFFF) my-font)

     ;; all the characters belonging to the script 'symbol'
     ;; that situation should be covered by above range rule
     (set-fontset-font font-set 'symbol my-font)

     ;; for all characters without font specification
     ;; in another words it is a setting for lack of fallback font
     ;; if e.g. ℕ called DOUBLE-STRUCK CAPITAL N is not covered by our font
     ;; it will be displayed as placeholder-box,
     ;; because fallback for our font is now... our font :)
     (set-fontset-font font-set nil my-font))
   font-sets))

In our init file we should be able to set one font for full range of characters:

 (let ((my-font "DejaVu Sans Mono-14"))
  (set-fontset-font "fontset-startup" '(#x000000 . #x3FFFFF) my-font)
  (set-fontset-font "fontset-default" '(#x000000 . #x3FFFFF) my-font)
  (set-fontset-font "fontset-standard" '(#x000000 . #x3FFFFF) my-font))

But to set a font for a range of characters and force it as a fallback font for characters not supported by it we also must add nil as a target:

(let ((my-font "DejaVu Sans Mono-14")
      (font-sets '("fontset-default"
                   "fontset-standard"
                   "fontset-startup")))
  (mapcar
   (lambda (font-set)
     ;; all the characters in that range (which is the full possible range)
     (set-fontset-font font-set '(#x000000 . #x3FFFFF) my-font)

     ;; for all characters without font specification
     ;; in another words it is a setting for lack of fallback font
     ;; if e.g. ℕ called DOUBLE-STRUCK CAPITAL N is not covered by our font
     ;; it will be displayed as placeholder-box,
     ;; because fallback for our font is now... our font :)
     (set-fontset-font font-set nil my-font))
   font-sets))

Now as we can see under point (cursor) with C-u C-x = or M-x describe-char:

             position: 1430 of 1954 (73%), column: 16
            character: ℕ (displayed as ℕ) (codepoint 8469, #o20425, #x2115)
    preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0x2115
               script: symbol
               syntax: w    which means: word
             category: .:Base, L:Left-to-right (strong)
             to input: type "C-x 8 RET HEX-CODEPOINT" or "C-x 8 RET NAME"
          buffer code: #xE2 #x84 #x95
            file code: #xE2 #x84 #x95 (encoded by coding system utf-8-unix)
              display: no font available

Character code properties: customize what to show
  name: DOUBLE-STRUCK CAPITAL N
  old-name: DOUBLE-STRUCK N
  general-category: Lu (Letter, Uppercase)
  decomposition: (font 78) (font 'N')

Important part: display: no font available.

8 Add more info about fallback behaviour.
source | link
(let ((my-font "DejaVu Sans Mono-14")
      (font-sets '("fontset-default"
                   "fontset-standard"
                   "fontset-startup")))
  (mapcar
   (lambda (font-set)
     ;; all the characters in that range
     (set-fontset-font font-set '(#x000000 . #x3FFFFF) my-font) 

     ;; all the characters belonging to the script 'symbol'
     ;; e.g.that situation calledshould DOUBLE-STRUCKbe CAPITALcovered Nby above range rule
     (set-fontset-font font-set 'symbol my-font) 

     ;; for all characters without font specification
     ;; in another words it is a setting for lack of fallback font
     ;; if e.g. ℕ called DOUBLE-STRUCK CAPITAL N is not covered by our font
     ;; it will be displayed as placeholder-box,
     ;; because fallback for our font is now... our font :)
     (set-fontset-font font-set nil my-font))
   font-sets))
(let ((my-font "DejaVu Sans Mono-14")
      (font-sets '("fontset-default"
                   "fontset-standard"
                   "fontset-startup")))
  (mapcar
   (lambda (font-set)
     ;; all the characters in that range
     (set-fontset-font font-set '(#x000000 . #x3FFFFF) my-font)
     ;; all the characters belonging to the script 'symbol'
     ;; e.g.  called DOUBLE-STRUCK CAPITAL N
     (set-fontset-font font-set 'symbol my-font)
     ;; for all characters without font specification
     ;; in another words it is a fallback font
     (set-fontset-font font-set nil my-font))
   font-sets))
(let ((my-font "DejaVu Sans Mono-14")
      (font-sets '("fontset-default"
                   "fontset-standard"
                   "fontset-startup")))
  (mapcar
   (lambda (font-set)
     ;; all the characters in that range
     (set-fontset-font font-set '(#x000000 . #x3FFFFF) my-font) 

     ;; all the characters belonging to the script 'symbol'
     ;; that situation should be covered by above range rule
     (set-fontset-font font-set 'symbol my-font) 

     ;; for all characters without font specification
     ;; in another words it is a setting for lack of fallback font
     ;; if e.g. ℕ called DOUBLE-STRUCK CAPITAL N is not covered by our font
     ;; it will be displayed as placeholder-box,
     ;; because fallback for our font is now... our font :)
     (set-fontset-font font-set nil my-font))
   font-sets))
7 Add comment about fallback font.
source | link
(let ((my-font "DejaVu Sans Mono-14")
      (font-sets '("fontset-default"
                   "fontset-standard"
                   "fontset-startup")))
  (mapcar
   (lambda (font-set)
     ;; all the characters in that range
     (set-fontset-font font-set '(#x000000 . #x3FFFFF) my-font)
     ;; all the characters belonging to the script 'symbol'
     ;; e.g. ℕ called DOUBLE-STRUCK CAPITAL N
     (set-fontset-font font-set 'symbol my-font)
     ;; for all characters without font specification
     ;; in another words it is a fallback font
     (set-fontset-font font-set nil my-font))
   font-sets))
(let ((my-font "DejaVu Sans Mono-14")
      (font-sets '("fontset-default"
                   "fontset-standard"
                   "fontset-startup")))
  (mapcar
   (lambda (font-set)
     ;; all the characters in that range
     (set-fontset-font font-set '(#x000000 . #x3FFFFF) my-font)
     ;; all the characters belonging to the script 'symbol'
     ;; e.g. ℕ called DOUBLE-STRUCK CAPITAL N
     (set-fontset-font font-set 'symbol my-font)
     ;; for all characters without font specification
     (set-fontset-font font-set nil my-font))
   font-sets))
(let ((my-font "DejaVu Sans Mono-14")
      (font-sets '("fontset-default"
                   "fontset-standard"
                   "fontset-startup")))
  (mapcar
   (lambda (font-set)
     ;; all the characters in that range
     (set-fontset-font font-set '(#x000000 . #x3FFFFF) my-font)
     ;; all the characters belonging to the script 'symbol'
     ;; e.g. ℕ called DOUBLE-STRUCK CAPITAL N
     (set-fontset-font font-set 'symbol my-font)
     ;; for all characters without font specification
     ;; in another words it is a fallback font
     (set-fontset-font font-set nil my-font))
   font-sets))
6 Include solution for script.
source | link
5 Add disclaimer.
source | link
4 Add more details.
source | link
3 Revert to previous version.
source | link
2 Add an explanation to the last change.
source | link
1
source | link