-
Notifications
You must be signed in to change notification settings - Fork 1
/
fontfile-ttx-mode.el
82 lines (69 loc) · 2.1 KB
/
fontfile-ttx-mode.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
;;
;; fontfile-ttx-mode
;;
;; An Emacs major mode for editing UFO .glif files
;;
;; Author: Nathan Willis
;;
;; License: GNU GPL v3 or later
;;
;;
;; Notes:
;;
;; - Syntax is currently based on a Trang-generated RelaxNG schema
;; then augmented with a set of well-known OpenType and TrueType
;; tables.
;;
;; References for these tables from
;; http://www.microsoft.com/typography/otspec/otff.htm#otttables
;; http://fontforge.github.io/TrueOpenTables.html
;; http://www.microsoft.com/en-us/Typography/SpecificationsOverview.aspx
;; https://developer.apple.com/fonts/TrueType-Reference-Manual/
;; http://scripts.sil.org/cms/scripts/page.php?site_id=projects&item_id=graide
;;
;; If there are other tables you would like to see recognized,
;; please get in touch. I would be happy to add more useful
;; syntax information that the community needs.
;;
;;
;; Top-level setup
;;
(require 'nxml-mode)
(push "~/.emacs.d/emacs-fontmodes/schemas/ttx-schemas.xml" rng-schema-locating-files)
(push (cons (concat "\\." (regexp-opt '("ttx") t)
"\\'") 'nxml-mode) auto-mode-alist)
;;
;; Folding elements
;;
(require 'hideshow)
(require 'sgml-mode)
(require 'nxml-mode)
(add-to-list 'hs-special-modes-alist
'(nxml-mode
"<!--\\|<[^/>]*[^/]>"
"-->\\|</[^/>]*[^/]>"
"<!--"
sgml-skip-tag-forward
nil))
(add-hook 'nxml-mode-hook 'hs-minor-mode)
;; optional key bindings, easier than hs defaults
(define-key nxml-mode-map (kbd "C-c h") 'hs-toggle-hiding)
;;
;; Eldoc documentation hints
;;
;; The documentation-string array was pulled out into a separate
;; file for brevity here and to make updating the docs easier.
(load-file "~/.emacs.d/fontfile-modes/fontfile-tables-eldoc.el")
;;
;; Entry point
;;
(define-derived-mode fontfile-ttx-mode nxml-mode "FontTools TTX"
"Major mode for editing FontTools TTX files."
:syntax-table fontfile-ttx-syntax-table
;; (setq font-lock-defaults fontfile-ttx-font-lock-defaults)
)
;;
;; Boom goes the dynamite
;;
(provide 'fontfile-ttx-mode)