------------------------------------------------------------ revno: 118061 fixes bug: http://debbugs.gnu.org/17407 committer: Glenn Morris branch nick: trunk timestamp: Mon 2014-10-06 00:00:33 -0700 message: * lisp/Makefile.in (obsolete-autoloads): Write to a separate file, to workaround autoloads bug. (AUTOGENEL): Add obsolete/loaddefs.el. * lisp/loadup.el: Load obsolete/loaddefs.el if present. * lisp/subr.el (do-after-load-evaluation): Don't warn about obsolete/loaddefs.el. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-06 06:30:07 +0000 +++ lisp/ChangeLog 2014-10-06 07:00:33 +0000 @@ -1,5 +1,12 @@ 2014-10-06 Glenn Morris + * Makefile.in (obsolete-autoloads): Write to a separate file, + to workaround autoloads bug. (Bug#17407) + (AUTOGENEL): Add obsolete/loaddefs.el. + * loadup.el: Load obsolete/loaddefs.el if present. + * subr.el (do-after-load-evaluation): + Don't warn about obsolete/loaddefs.el. + * menu-bar.el (menu-bar-games-menu): Remove landmark. It has zero relationship to a game. === modified file 'lisp/Makefile.in' --- lisp/Makefile.in 2014-09-10 16:32:36 +0000 +++ lisp/Makefile.in 2014-10-06 07:00:33 +0000 @@ -68,6 +68,7 @@ cedet/semantic/loaddefs.el \ cedet/ede/loaddefs.el \ cedet/srecode/loaddefs.el \ + obsolete/loaddefs.el \ org/org-loaddefs.el # Value of max-lisp-eval-depth when compiling initially. @@ -194,7 +195,7 @@ obsolete-autoloads: ${lisp}/obsolete/*.el $(emacs) -l autoload \ --eval '(setq generate-autoload-cookie ";;;###obsolete-autoload")' \ - --eval '(setq generated-autoload-file (expand-file-name (unmsys--file-name "$(srcdir)/loaddefs.el")))' \ + --eval '(setq generated-autoload-file (expand-file-name (unmsys--file-name "$(srcdir)/obsolete/loaddefs.el")))' \ -f batch-update-autoloads ${lisp}/obsolete # This is required by the bootstrap-emacs target in ../src/Makefile, so === modified file 'lisp/loadup.el' --- lisp/loadup.el 2014-10-01 22:13:11 +0000 +++ lisp/loadup.el 2014-10-06 07:00:33 +0000 @@ -144,6 +144,8 @@ ;; In case loaddefs hasn't been generated yet. (file-error (load "ldefs-boot.el"))) +(load "obsolete/loaddefs.el" t) + (load "emacs-lisp/nadvice") (load "minibuffer") (load "abbrev") ;lisp-mode.el and simple.el use define-abbrev-table. === modified file 'lisp/subr.el' --- lisp/subr.el 2014-10-01 22:13:11 +0000 +++ lisp/subr.el 2014-10-06 07:00:33 +0000 @@ -3879,7 +3879,9 @@ ;; discard the file name regexp (mapc #'funcall (cdr a-l-element)))) ;; Complain when the user uses obsolete files. - (when (string-match-p "/obsolete/[^/]*\\'" abs-file) + (when (save-match-data + (and (string-match "/obsolete/\\([^/]*\\)\\'" abs-file) + (not (equal "loaddefs.el" (match-string 1 abs-file))))) ;; Maybe we should just use display-warning? This seems yucky... (let* ((file (file-name-nondirectory abs-file)) (msg (format "Package %s is obsolete!" ------------------------------------------------------------ revno: 118060 committer: Glenn Morris branch nick: trunk timestamp: Sun 2014-10-05 23:30:07 -0700 message: * lisp/menu-bar.el (menu-bar-games-menu): Remove landmark. It's not a game you can play, and is of no interest to the casual browser. It was broken for years and no-one even noticed. Ref: http://lists.gnu.org/archive/html/emacs-devel/2014-06/msg00288.html diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-06 03:59:38 +0000 +++ lisp/ChangeLog 2014-10-06 06:30:07 +0000 @@ -1,3 +1,8 @@ +2014-10-06 Glenn Morris + + * menu-bar.el (menu-bar-games-menu): Remove landmark. + It has zero relationship to a game. + 2014-10-06 Leo Liu * imenu.el (imenu): Re-write for clarity. === modified file 'lisp/menu-bar.el' --- lisp/menu-bar.el 2014-10-01 22:13:11 +0000 +++ lisp/menu-bar.el 2014-10-06 06:30:07 +0000 @@ -1330,9 +1330,6 @@ (bindings--define-key menu [life] '(menu-item "Life" life :help "Watch how John Conway's cellular automaton evolves")) - (bindings--define-key menu [land] - '(menu-item "Landmark" landmark - :help "Watch a neural-network robot learn landmarks")) (bindings--define-key menu [hanoi] '(menu-item "Towers of Hanoi" hanoi :help "Watch Towers-of-Hanoi puzzle solved by Emacs")) ------------------------------------------------------------ revno: 118059 committer: Jan Dj?rv branch nick: trunk timestamp: Mon 2014-10-06 08:21:13 +0200 message: * configure.ac: Add -Wno-string-plus-int for clang. diff: === modified file 'ChangeLog' --- ChangeLog 2014-10-04 07:22:51 +0000 +++ ChangeLog 2014-10-06 06:21:13 +0000 @@ -1,3 +1,7 @@ +2014-10-06 Jan Djärv + + * configure.ac: Add -Wno-string-plus-int for clang. + 2014-10-04 Glenn Morris * configure.ac: Silence warning with some old Xrandr.h. (Bug#18465) === modified file 'configure.ac' --- configure.ac 2014-10-04 07:22:51 +0000 +++ configure.ac 2014-10-06 06:21:13 +0000 @@ -825,6 +825,7 @@ gl_WARN_ADD([-Wno-switch]) gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare]) gl_WARN_ADD([-Wno-pointer-sign]) + gl_WARN_ADD([-Wno-string-plus-int]) fi else isystem='-isystem ' ------------------------------------------------------------ revno: 118058 committer: Leo Liu branch nick: trunk timestamp: Mon 2014-10-06 11:59:38 +0800 message: * imenu.el (imenu): Re-write for clarity. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-06 02:02:04 +0000 +++ lisp/ChangeLog 2014-10-06 03:59:38 +0000 @@ -1,3 +1,7 @@ +2014-10-06 Leo Liu + + * imenu.el (imenu): Re-write for clarity. + 2014-10-06 Glenn Morris Remove calendar code obsolete since at least version 23.1. === modified file 'lisp/imenu.el' --- lisp/imenu.el 2014-10-05 00:58:38 +0000 +++ lisp/imenu.el 2014-10-06 03:59:38 +0000 @@ -1034,16 +1034,13 @@ (if (stringp index-item) (setq index-item (assoc index-item (imenu--make-index-alist)))) (when index-item - (push-mark nil t) - (let* ((is-special-item (listp (cdr index-item))) - (function - (if is-special-item - (nth 2 index-item) imenu-default-goto-function)) - (position (if is-special-item - (cadr index-item) (cdr index-item))) - (args (if is-special-item (cdr (cddr index-item))))) - (apply function (car index-item) position args)) - (run-hooks 'imenu-after-jump-hook))) + (pcase index-item + (`(,name ,pos ,fn . ,args) + (push-mark nil t) + (apply fn name pos args) + (run-hooks 'imenu-after-jump-hook)) + (`(,name . ,pos) (imenu (list name pos imenu-default-goto-function))) + (_ (error "Unknown imenu item: %S" index-item))))) (provide 'imenu) ------------------------------------------------------------ revno: 118057 committer: Glenn Morris branch nick: trunk timestamp: Sun 2014-10-05 19:02:04 -0700 message: Remove calendar code obsolete since at least version 23.1 * lisp/calendar/cal-bahai.el (calendar-absolute-from-bahai) (calendar-print-bahai-date, calendar-bahai-prompt-for-date) (calendar-goto-bahai-date, list-bahai-diary-entries) (mark-bahai-calendar-date-pattern, mark-bahai-diary-entries) (insert-bahai-diary-entry, insert-monthly-bahai-diary-entry) (insert-yearly-bahai-diary-entry): * lisp/calendar/cal-china.el (chinese-calendar-time-zone) (chinese-calendar-location-name) (chinese-calendar-daylight-time-offset) (chinese-calendar-standard-time-zone-name) (chinese-calendar-daylight-time-zone-name) (chinese-calendar-daylight-savings-starts) (chinese-calendar-daylight-savings-ends) (chinese-calendar-daylight-savings-starts-time) (chinese-calendar-daylight-savings-ends-time) (chinese-calendar-celestial-stem) (chinese-calendar-terrestrial-branch) (calendar-absolute-from-chinese, calendar-print-chinese-date) (calendar-goto-chinese-date): * lisp/calendar/cal-coptic.el (calendar-absolute-from-coptic) (calendar-print-coptic-date, coptic-prompt-for-date) (calendar-goto-coptic-date, calendar-absolute-from-ethiopic) (calendar-print-ethiopic-date, calendar-goto-ethiopic-date): * lisp/calendar/cal-french.el (calendar-absolute-from-french) (calendar-print-french-date, calendar-goto-french-date): * lisp/calendar/cal-hebrew.el (diary-sabbath-candles-minutes) (calendar-absolute-from-hebrew, calendar-print-hebrew-date) (hebrew-calendar-yahrzeit, calendar-goto-hebrew-date) (holiday-rosh-hashanah-etc, holiday-hanukkah) (holiday-passover-etc, holiday-tisha-b-av-etc) (list-hebrew-diary-entries, mark-hebrew-calendar-date-pattern) (mark-hebrew-diary-entries, insert-hebrew-diary-entry) (insert-monthly-hebrew-diary-entry) (insert-yearly-hebrew-diary-entry, list-yahrzeit-dates) (diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha) (diary-sabbath-candles): * lisp/calendar/cal-islam.el (calendar-absolute-from-islamic) (calendar-print-islamic-date, calendar-goto-islamic-date) (list-islamic-diary-entries, mark-islamic-calendar-date-pattern) (mark-islamic-diary-entries, insert-islamic-diary-entry) (insert-monthly-islamic-diary-entry) (insert-yearly-islamic-diary-entry): * lisp/calendar/cal-iso.el (calendar-absolute-from-iso) (calendar-print-iso-date, calendar-iso-read-args) (calendar-goto-iso-date, calendar-goto-iso-week): * lisp/calendar/cal-julian.el (calendar-absolute-from-julian) (calendar-print-julian-date, calendar-goto-julian-date) (calendar-absolute-from-astro, calendar-print-astro-day-number) (calendar-goto-astro-day-number): * lisp/calendar/cal-mayan.el (calendar-print-mayan-date) (calendar-next-haab-date, calendar-previous-haab-date) (calendar-next-tzolkin-date, calendar-previous-tzolkin-date) (calendar-next-calendar-round-date) (calendar-previous-calendar-round-date) (calendar-absolute-from-mayan-long-count) (calendar-goto-mayan-long-count-date): * lisp/calendar/cal-move.el (scroll-calendar-left) (scroll-calendar-right, scroll-calendar-left-three-months) (scroll-calendar-right-three-months): * lisp/calendar/cal-persia.el (calendar-absolute-from-persian) (calendar-print-persian-date, persian-prompt-for-date) (calendar-goto-persian-date): * lisp/calendar/cal-x.el (calendar-after-frame-setup-hooks): * lisp/calendar/calendar.el (view-diary-entries-initially) (mark-diary-entries-in-calendar, calendar-today-face) (diary-face, holiday-face, view-calendar-holidays-initially) (mark-holidays-in-calendar, initial-calendar-window-hook) (today-visible-calendar-hook, today-invisible-calendar-hook) (hebrew-diary-entry-symbol, islamic-diary-entry-symbol) (bahai-diary-entry-symbol, american-date-diary-pattern) (european-date-diary-pattern, european-calendar-display-form) (american-calendar-display-form, holidays-in-diary-buffer) (all-hebrew-calendar-holidays, all-christian-calendar-holidays) (all-islamic-calendar-holidays, all-bahai-calendar-holidays) (fancy-diary-buffer, increment-calendar-month) (extract-calendar-month, extract-calendar-day) (extract-calendar-year, exit-calendar, calendar-date-is-legal-p) (mark-visible-calendar-date, calendar-version): * lisp/calendar/diary-lib.el (diary-button-face, sexp-diary-entry-symbol) (diary-display-hook, list-diary-entries-hook) (mark-diary-entries-hook, nongregorian-diary-listing-hook) (nongregorian-diary-marking-hook, print-diary-entries-hook) (abbreviated-calendar-year, number-of-diary-entries) (view-other-diary-entries, add-to-diary-list) (include-other-diary-files, simple-diary-display) (fancy-diary-display, print-diary-entries, mark-diary-entries) (mark-sexp-diary-entries, mark-included-diary-files) (mark-calendar-days-named, mark-calendar-month) (mark-calendar-date-pattern, sort-diary-entries) (list-sexp-diary-entries, make-diary-entry, insert-diary-entry) (insert-weekly-diary-entry, insert-monthly-diary-entry) (insert-yearly-diary-entry, insert-anniversary-diary-entry) (insert-block-diary-entry, insert-cyclic-diary-entry) (fancy-diary-font-lock-keywords, fancy-diary-display-mode): * lisp/calendar/holidays.el (general-holidays, oriental-holidays) (local-holidays, other-holidays, hebrew-holidays) (christian-holidays, islamic-holidays, bahai-holidays) (solar-holidays, list-calendar-holidays) (check-calendar-holidays, mark-calendar-holidays) (filter-visible-calendar-holidays): * lisp/calendar/lunar.el (calendar-phases-of-moon, phases-of-moon) (diary-phases-of-moon): Remove obsolete aliases. * lisp/calendar/cal-menu.el (cal-menu-load-hook): Remove obsolete hook. * calendar/cal-x.el (calendar-one-frame-setup) (calendar-only-one-frame-setup, calendar-two-frame-setup): Remove obsolete functions. (cal-x-load-hook): Remove obsolete hook. * calendar/calendar.el (european-calendar-style): Remove obsolete variable. (calendar-date-style): No longer consult european-calendar-style. * calendar/calendar.el (european-calendar, american-calendar): Remove obsolete commands. * calendar/calendar.el (calendar-for-loop): Remove obsolete macro. * calendar/diary-lib.el (diary-face): Remove obsolete variable. (diary-font-lock-date-forms, diary-fancy-font-lock-keywords): Use the face `diary' instead of the variable `diary-face'. * calendar/holidays.el (hebrew-holidays-1, hebrew-holidays-2) (hebrew-holidays-3, hebrew-holidays-4): Remove obsolete variables. * lisp/calendar/icalendar.el (icalendar--date-style): Remove function. Replace all uses with calendar-date-style. * lisp/textmodes/remember.el (calendar-date-style): Declare. (remember-diary-convert-entry): No longer consult european-calendar-style. * test/automated/icalendar-tests.el (icalendar--calendar-style): Remove test, no longer relevant. diff: === modified file 'etc/NEWS' --- etc/NEWS 2014-10-05 12:25:00 +0000 +++ etc/NEWS 2014-10-06 02:02:04 +0000 @@ -143,11 +143,26 @@ `diary-chinese-insert-monthly-entry', `diary-chinese-insert-yearly-entry'. +++ -*** Calendar can list and mark diary entries with Chinese dates. +*** The calendar can now list and mark diary entries with Chinese dates. See `diary-chinese-list-entries' and `diary-chinese-mark-entries'. -*** The mode line of the calendar buffer will not be modified if -`calendar-mode-line-format' is nil. +--- +*** The option `calendar-mode-line-format' can now be nil, +which means to do nothing special with the mode line in calendars. + +--- +*** Many items obsolete since at least version 23.1 have been removed. +The majority were function/variable/face aliases, too numerous to list here. +The remainder were: + +**** Functions `calendar-one-frame-setup', `calendar-only-one-frame-setup', +`calendar-two-frame-setup', `european-calendar', `american-calendar'. + +**** Hooks `cal-menu-load-hook', `cal-x-load-hook'. + +**** Macro `calendar-for-loop'. + +**** Variables `european-calendar-style', `diary-face', `hebrew-holidays-{1,4}'. ** New ERT function `ert-summarize-tests-batch-and-exit'. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-05 17:19:23 +0000 +++ lisp/ChangeLog 2014-10-06 02:02:04 +0000 @@ -1,3 +1,130 @@ +2014-10-06 Glenn Morris + + Remove calendar code obsolete since at least version 23.1. + * calendar/cal-bahai.el (calendar-absolute-from-bahai) + (calendar-print-bahai-date, calendar-bahai-prompt-for-date) + (calendar-goto-bahai-date, list-bahai-diary-entries) + (mark-bahai-calendar-date-pattern, mark-bahai-diary-entries) + (insert-bahai-diary-entry, insert-monthly-bahai-diary-entry) + (insert-yearly-bahai-diary-entry): + * calendar/cal-china.el (chinese-calendar-time-zone) + (chinese-calendar-location-name) + (chinese-calendar-daylight-time-offset) + (chinese-calendar-standard-time-zone-name) + (chinese-calendar-daylight-time-zone-name) + (chinese-calendar-daylight-savings-starts) + (chinese-calendar-daylight-savings-ends) + (chinese-calendar-daylight-savings-starts-time) + (chinese-calendar-daylight-savings-ends-time) + (chinese-calendar-celestial-stem) + (chinese-calendar-terrestrial-branch) + (calendar-absolute-from-chinese, calendar-print-chinese-date) + (calendar-goto-chinese-date): + * calendar/cal-coptic.el (calendar-absolute-from-coptic) + (calendar-print-coptic-date, coptic-prompt-for-date) + (calendar-goto-coptic-date, calendar-absolute-from-ethiopic) + (calendar-print-ethiopic-date, calendar-goto-ethiopic-date): + * calendar/cal-french.el (calendar-absolute-from-french) + (calendar-print-french-date, calendar-goto-french-date): + * calendar/cal-hebrew.el (diary-sabbath-candles-minutes) + (calendar-absolute-from-hebrew, calendar-print-hebrew-date) + (hebrew-calendar-yahrzeit, calendar-goto-hebrew-date) + (holiday-rosh-hashanah-etc, holiday-hanukkah) + (holiday-passover-etc, holiday-tisha-b-av-etc) + (list-hebrew-diary-entries, mark-hebrew-calendar-date-pattern) + (mark-hebrew-diary-entries, insert-hebrew-diary-entry) + (insert-monthly-hebrew-diary-entry) + (insert-yearly-hebrew-diary-entry, list-yahrzeit-dates) + (diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha) + (diary-sabbath-candles): + * calendar/cal-islam.el (calendar-absolute-from-islamic) + (calendar-print-islamic-date, calendar-goto-islamic-date) + (list-islamic-diary-entries, mark-islamic-calendar-date-pattern) + (mark-islamic-diary-entries, insert-islamic-diary-entry) + (insert-monthly-islamic-diary-entry) + (insert-yearly-islamic-diary-entry): + * calendar/cal-iso.el (calendar-absolute-from-iso) + (calendar-print-iso-date, calendar-iso-read-args) + (calendar-goto-iso-date, calendar-goto-iso-week): + * calendar/cal-julian.el (calendar-absolute-from-julian) + (calendar-print-julian-date, calendar-goto-julian-date) + (calendar-absolute-from-astro, calendar-print-astro-day-number) + (calendar-goto-astro-day-number): + * calendar/cal-mayan.el (calendar-print-mayan-date) + (calendar-next-haab-date, calendar-previous-haab-date) + (calendar-next-tzolkin-date, calendar-previous-tzolkin-date) + (calendar-next-calendar-round-date) + (calendar-previous-calendar-round-date) + (calendar-absolute-from-mayan-long-count) + (calendar-goto-mayan-long-count-date): + * calendar/cal-move.el (scroll-calendar-left) + (scroll-calendar-right, scroll-calendar-left-three-months) + (scroll-calendar-right-three-months): + * calendar/cal-persia.el (calendar-absolute-from-persian) + (calendar-print-persian-date, persian-prompt-for-date) + (calendar-goto-persian-date): + * calendar/cal-x.el (calendar-after-frame-setup-hooks): + * calendar/calendar.el (view-diary-entries-initially) + (mark-diary-entries-in-calendar, calendar-today-face) + (diary-face, holiday-face, view-calendar-holidays-initially) + (mark-holidays-in-calendar, initial-calendar-window-hook) + (today-visible-calendar-hook, today-invisible-calendar-hook) + (hebrew-diary-entry-symbol, islamic-diary-entry-symbol) + (bahai-diary-entry-symbol, american-date-diary-pattern) + (european-date-diary-pattern, european-calendar-display-form) + (american-calendar-display-form, holidays-in-diary-buffer) + (all-hebrew-calendar-holidays, all-christian-calendar-holidays) + (all-islamic-calendar-holidays, all-bahai-calendar-holidays) + (fancy-diary-buffer, increment-calendar-month) + (extract-calendar-month, extract-calendar-day) + (extract-calendar-year, exit-calendar, calendar-date-is-legal-p) + (mark-visible-calendar-date, calendar-version): + * calendar/diary-lib.el (diary-button-face, sexp-diary-entry-symbol) + (diary-display-hook, list-diary-entries-hook) + (mark-diary-entries-hook, nongregorian-diary-listing-hook) + (nongregorian-diary-marking-hook, print-diary-entries-hook) + (abbreviated-calendar-year, number-of-diary-entries) + (view-other-diary-entries, add-to-diary-list) + (include-other-diary-files, simple-diary-display) + (fancy-diary-display, print-diary-entries, mark-diary-entries) + (mark-sexp-diary-entries, mark-included-diary-files) + (mark-calendar-days-named, mark-calendar-month) + (mark-calendar-date-pattern, sort-diary-entries) + (list-sexp-diary-entries, make-diary-entry, insert-diary-entry) + (insert-weekly-diary-entry, insert-monthly-diary-entry) + (insert-yearly-diary-entry, insert-anniversary-diary-entry) + (insert-block-diary-entry, insert-cyclic-diary-entry) + (fancy-diary-font-lock-keywords, fancy-diary-display-mode): + * calendar/holidays.el (general-holidays, oriental-holidays) + (local-holidays, other-holidays, hebrew-holidays) + (christian-holidays, islamic-holidays, bahai-holidays) + (solar-holidays, list-calendar-holidays) + (check-calendar-holidays, mark-calendar-holidays) + (filter-visible-calendar-holidays): + * calendar/lunar.el (calendar-phases-of-moon, phases-of-moon) + (diary-phases-of-moon): Remove obsolete aliases. + * calendar/cal-menu.el (cal-menu-load-hook): Remove obsolete hook. + * calendar/cal-x.el (calendar-one-frame-setup) + (calendar-only-one-frame-setup, calendar-two-frame-setup): + Remove obsolete functions. + (cal-x-load-hook): Remove obsolete hook. + * calendar/calendar.el (european-calendar-style): + Remove obsolete variable. + (calendar-date-style): No longer consult european-calendar-style. + * calendar/calendar.el (european-calendar, american-calendar): + Remove obsolete commands. + * calendar/calendar.el (calendar-for-loop): Remove obsolete macro. + * calendar/diary-lib.el (diary-face): Remove obsolete variable. + (diary-font-lock-date-forms, diary-fancy-font-lock-keywords): + Use the face `diary' instead of the variable `diary-face'. + * calendar/holidays.el (hebrew-holidays-1, hebrew-holidays-2) + (hebrew-holidays-3, hebrew-holidays-4): Remove obsolete variables. + * calendar/icalendar.el (icalendar--date-style): Remove function. + Replace all uses with calendar-date-style. + * textmodes/remember.el (calendar-date-style): Declare. + (remember-diary-convert-entry): + No longer consult european-calendar-style. + 2014-10-05 Leo Liu * imenu.el (imenu-default-goto-function): Fix typo. === modified file 'lisp/calendar/cal-bahai.el' --- lisp/calendar/cal-bahai.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/cal-bahai.el 2014-10-06 02:02:04 +0000 @@ -94,9 +94,6 @@ 0) day))) ; days so far this month -(define-obsolete-function-alias 'calendar-absolute-from-bahai - 'calendar-bahai-to-absolute "23.1") - (defun calendar-bahai-from-absolute (date) "Bahá'í date (month day year) corresponding to the absolute DATE." (if (< date calendar-bahai-epoch) @@ -152,9 +149,6 @@ (message "Date is pre-Bahá'í") (message "Bahá'í date: %s" s)))) -(define-obsolete-function-alias - 'calendar-print-bahai-date 'calendar-bahai-print-date "23.1") - (defun calendar-bahai-read-date () "Interactively read the arguments for a Bahá'í date command. Reads a year, month and day." @@ -179,9 +173,6 @@ (lambda (x) (and (< 0 x) (<= x 19)))))) (list (list month day year)))) -(define-obsolete-function-alias - 'calendar-bahai-prompt-for-date 'calendar-bahai-read-date "23.1") - ;;;###cal-autoload (defun calendar-bahai-goto-date (date &optional noecho) "Move cursor to Bahá'í date DATE; echo Bahá'í date unless NOECHO is non-nil." @@ -190,9 +181,6 @@ (calendar-bahai-to-absolute date))) (or noecho (calendar-bahai-print-date))) -(define-obsolete-function-alias - 'calendar-goto-bahai-date 'calendar-bahai-goto-date "23.1") - (defvar displayed-month) (defvar displayed-year) @@ -270,9 +258,6 @@ (diary-list-entries-1 calendar-bahai-month-name-array diary-bahai-entry-symbol 'calendar-bahai-from-absolute)) -(define-obsolete-function-alias - 'list-bahai-diary-entries 'diary-bahai-list-entries "23.1") - (autoload 'calendar-mark-1 "diary-lib") @@ -284,10 +269,6 @@ (calendar-mark-1 month day year 'calendar-bahai-from-absolute 'calendar-bahai-to-absolute color)) -(define-obsolete-function-alias - 'mark-bahai-calendar-date-pattern 'calendar-bahai-mark-date-pattern "23.1") - - (autoload 'diary-mark-entries-1 "diary-lib") ;;;###diary-autoload @@ -300,10 +281,6 @@ diary-bahai-entry-symbol 'calendar-bahai-from-absolute)) -(define-obsolete-function-alias - 'mark-bahai-diary-entries 'diary-bahai-mark-entries "23.1") - - (autoload 'diary-insert-entry-1 "diary-lib") ;;;###cal-autoload @@ -316,9 +293,6 @@ diary-bahai-entry-symbol 'calendar-bahai-from-absolute)) -(define-obsolete-function-alias - 'insert-bahai-diary-entry 'diary-bahai-insert-entry "23.1") - ;;;###cal-autoload (defun diary-bahai-insert-monthly-entry (arg) "Insert a monthly diary entry. @@ -329,9 +303,6 @@ diary-bahai-entry-symbol 'calendar-bahai-from-absolute)) -(define-obsolete-function-alias - 'insert-monthly-bahai-diary-entry 'diary-bahai-insert-monthly-entry "23.1") - ;;;###cal-autoload (defun diary-bahai-insert-yearly-entry (arg) "Insert an annual diary entry. @@ -342,9 +313,6 @@ diary-bahai-entry-symbol 'calendar-bahai-from-absolute)) -(define-obsolete-function-alias - 'insert-yearly-bahai-diary-entry 'diary-bahai-insert-yearly-entry "23.1") - (defvar date) ;; To be called from diary-list-sexp-entries, where DATE is bound. === modified file 'lisp/calendar/cal-china.el' --- lisp/calendar/cal-china.el 2014-05-04 00:16:58 +0000 +++ lisp/calendar/cal-china.el 2014-10-06 02:02:04 +0000 @@ -58,9 +58,6 @@ :prefix "calendar-chinese-" :group 'calendar) -(define-obsolete-variable-alias 'chinese-calendar-time-zone - 'calendar-chinese-time-zone "23.1") - (defcustom calendar-chinese-time-zone '(if (< year 1928) (+ 465 (/ 40.0 60.0)) @@ -78,18 +75,12 @@ (put 'chinese-calendar-time-zone 'risky-local-variable t) -(define-obsolete-variable-alias 'chinese-calendar-location-name - 'calendar-chinese-location-name "23.1") - ;; FIXME unused. (defcustom calendar-chinese-location-name "Beijing" "Name of location used for calculation of Chinese calendar." :type 'string :group 'calendar-chinese) -(define-obsolete-variable-alias 'chinese-calendar-daylight-time-offset - 'calendar-chinese-daylight-time-offset "23.1") - (defcustom calendar-chinese-daylight-time-offset 0 ;; The correct value is as follows, but the Chinese calendrical ;; authorities do NOT use DST in determining astronomical events: @@ -99,9 +90,6 @@ :type 'integer :group 'calendar-chinese) -(define-obsolete-variable-alias 'chinese-calendar-standard-time-zone-name - 'calendar-chinese-standard-time-zone-name "23.1") - (defcustom calendar-chinese-standard-time-zone-name '(if (< year 1928) "PMT" @@ -112,17 +100,11 @@ :type 'sexp :group 'calendar-chinese) -(define-obsolete-variable-alias 'chinese-calendar-daylight-time-zone-name - 'calendar-chinese-daylight-time-zone-name "23.1") - (defcustom calendar-chinese-daylight-time-zone-name "CDT" "Abbreviated name of daylight saving time zone used for Chinese calendar." :type 'string :group 'calendar-chinese) -(define-obsolete-variable-alias 'chinese-calendar-daylight-savings-starts - 'calendar-chinese-daylight-saving-start "23.1") - (defcustom calendar-chinese-daylight-saving-start nil ;; The correct value is as follows, but the Chinese calendrical ;; authorities do NOT use DST in determining astronomical events: @@ -135,9 +117,6 @@ :type 'sexp :group 'calendar-chinese) -(define-obsolete-variable-alias 'chinese-calendar-daylight-savings-ends - 'calendar-chinese-daylight-saving-end "23.1") - (defcustom calendar-chinese-daylight-saving-end nil ;; The correct value is as follows, but the Chinese calendrical ;; authorities do NOT use DST in determining astronomical events: @@ -148,27 +127,18 @@ :type 'sexp :group 'calendar-chinese) -(define-obsolete-variable-alias 'chinese-calendar-daylight-savings-starts-time - 'calendar-chinese-daylight-saving-start-time "23.1") - (defcustom calendar-chinese-daylight-saving-start-time 0 "Number of minutes after midnight that daylight saving time starts. Default is for no daylight saving time." :type 'integer :group 'calendar-chinese) -(define-obsolete-variable-alias 'chinese-calendar-daylight-savings-ends-time - 'calendar-chinese-daylight-saving-end-time "23.1") - (defcustom calendar-chinese-daylight-saving-end-time 0 "Number of minutes after midnight that daylight saving time ends. Default is for no daylight saving time." :type 'integer :group 'calendar-chinese) -(define-obsolete-variable-alias 'chinese-calendar-celestial-stem - 'calendar-chinese-celestial-stem "23.1") - (defcustom calendar-chinese-celestial-stem ["Jia" "Yi" "Bing" "Ding" "Wu" "Ji" "Geng" "Xin" "Ren" "Gui"] "Prefixes used by `calendar-chinese-sexagesimal-name'." @@ -184,9 +154,6 @@ (string :tag "Ren") (string :tag "Gui"))) -(define-obsolete-variable-alias 'chinese-calendar-terrestrial-branch - 'calendar-chinese-terrestrial-branch "23.1") - (defcustom calendar-chinese-terrestrial-branch ["Zi" "Chou" "Yin" "Mao" "Chen" "Si" "Wu" "Wei" "Shen" "You" "Xu" "Hai"] "Suffixes used by `calendar-chinese-sexagesimal-name'." @@ -432,9 +399,6 @@ (calendar-chinese-year g-year)) (calendar-chinese-year (1+ g-year)))))))) -(define-obsolete-function-alias 'calendar-absolute-from-chinese - 'calendar-chinese-to-absolute "23.1") - (defun calendar-chinese-from-absolute (date) "Compute Chinese date (cycle year month day) corresponding to absolute DATE. The absolute date is the number of days elapsed since the (imaginary) @@ -599,9 +563,6 @@ (message "Chinese date: %s" (calendar-chinese-date-string (calendar-cursor-to-date t)))) -(define-obsolete-function-alias 'calendar-print-chinese-date - 'calendar-chinese-print-date "23.1") - (defun calendar-chinese-months-to-alist (l) "Make list of months L into an assoc list." (and l (car l) @@ -671,9 +632,6 @@ (calendar-chinese-to-absolute date))) (or noecho (calendar-chinese-print-date))) -(define-obsolete-function-alias 'calendar-goto-chinese-date - 'calendar-chinese-goto-date "23.1") - (defvar date) ;; To be called from diary-list-sexp-entries, where DATE is bound. === modified file 'lisp/calendar/cal-coptic.el' --- lisp/calendar/cal-coptic.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/cal-coptic.el 2014-10-06 02:02:04 +0000 @@ -75,9 +75,6 @@ (* 30 (1- month)) ; days in prior months this year day))) ; days so far this month -(define-obsolete-function-alias 'calendar-absolute-from-coptic - 'calendar-coptic-to-absolute "23.1") - (defun calendar-coptic-from-absolute (date) "Compute the Coptic equivalent for absolute date DATE. The result is a list of the form (MONTH DAY YEAR). @@ -135,9 +132,6 @@ (message "Date is pre-%s calendar" calendar-coptic-name) (message "%s date: %s" calendar-coptic-name f)))) -(define-obsolete-function-alias 'calendar-print-coptic-date - 'calendar-coptic-print-date "23.1") - (defun calendar-coptic-read-date () "Interactively read the arguments for a Coptic date command. Reads a year, month, and day." @@ -164,9 +158,6 @@ (lambda (x) (and (< 0 x) (<= x last)))))) (list (list month day year)))) -(define-obsolete-function-alias 'coptic-prompt-for-date - 'calendar-coptic-read-date "23.1") - ;;;###cal-autoload (defun calendar-coptic-goto-date (date &optional noecho) "Move cursor to Coptic date DATE. @@ -176,8 +167,6 @@ (calendar-coptic-to-absolute date))) (or noecho (calendar-coptic-print-date))) -(define-obsolete-function-alias 'calendar-goto-coptic-date - 'calendar-coptic-goto-date "23.1") (defvar date) @@ -208,9 +197,6 @@ (let ((calendar-coptic-epoch calendar-ethiopic-epoch)) (calendar-coptic-to-absolute date))) -(define-obsolete-function-alias 'calendar-absolute-from-ethiopic - 'calendar-ethiopic-to-absolute "23.1") - (defun calendar-ethiopic-from-absolute (date) "Compute the Ethiopic equivalent for absolute date DATE. The result is a list of the form (MONTH DAY YEAR). @@ -238,9 +224,6 @@ (calendar-coptic-month-name-array calendar-ethiopic-month-name-array)) (call-interactively 'calendar-coptic-print-date))) -(define-obsolete-function-alias 'calendar-print-ethiopic-date - 'calendar-ethiopic-print-date "23.1") - ;;;###cal-autoload (defun calendar-ethiopic-goto-date (date &optional noecho) "Move cursor to Ethiopic date DATE. @@ -254,9 +237,6 @@ (calendar-ethiopic-to-absolute date))) (or noecho (calendar-ethiopic-print-date))) -(define-obsolete-function-alias 'calendar-goto-ethiopic-date - 'calendar-ethiopic-goto-date "23.1") - ;; To be called from diary-list-sexp-entries, where DATE is bound. ;;;###diary-autoload (defun diary-ethiopic-date () === modified file 'lisp/calendar/cal-french.el' --- lisp/calendar/cal-french.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/cal-french.el 2014-10-06 02:02:04 +0000 @@ -1,7 +1,7 @@ ;;; cal-french.el --- calendar functions for the French Revolutionary calendar -;; Copyright (C) 1988-1989, 1992, 1994-1995, 1997, 2001-2014 Free -;; Software Foundation, Inc. +;; Copyright (C) 1988-1989, 1992, 1994-1995, 1997, 2001-2014 +;; Free Software Foundation, Inc. ;; Author: Edward M. Reingold ;; Maintainer: Glenn Morris @@ -129,9 +129,6 @@ day ; days so far this month (1- calendar-french-epoch)))) ; days before start of calendar -(define-obsolete-function-alias 'calendar-absolute-from-french - 'calendar-french-to-absolute "23.1") - (defun calendar-french-from-absolute (date) "Compute the French Revolutionary equivalent for absolute date DATE. The result is a list of the form (MONTH DAY YEAR). @@ -196,9 +193,6 @@ (message "Date is pre-French Revolution") (message "French Revolutionary date: %s" f)))) -(define-obsolete-function-alias 'calendar-print-french-date - 'calendar-french-print-date "23.1") - ;;;###cal-autoload (defun calendar-french-goto-date (date &optional noecho) "Move cursor to French Revolutionary date DATE. @@ -249,9 +243,6 @@ (calendar-french-to-absolute date))) (or noecho (calendar-french-print-date))) -(define-obsolete-function-alias 'calendar-goto-french-date - 'calendar-french-goto-date "23.1") - (defvar date) ;; To be called from diary-list-sexp-entries, where DATE is bound. === modified file 'lisp/calendar/cal-hebrew.el' --- lisp/calendar/cal-hebrew.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/cal-hebrew.el 2014-10-06 02:02:04 +0000 @@ -32,9 +32,6 @@ (require 'calendar) -(define-obsolete-variable-alias 'diary-sabbath-candles-minutes - 'diary-hebrew-sabbath-candles-minutes "23.1") - (defcustom diary-hebrew-sabbath-candles-minutes 18 "Number of minutes before sunset for sabbath candle lighting. Used by `diary-hebrew-sabbath-candles'." @@ -136,9 +133,6 @@ (calendar-hebrew-elapsed-days year) ; days in prior years -1373429))) ; days elapsed before absolute date 1 -(define-obsolete-function-alias 'calendar-absolute-from-hebrew - 'calendar-hebrew-to-absolute "23.1") - (defun calendar-hebrew-from-absolute (date) "Compute the Hebrew date (month day year) corresponding to absolute DATE. The absolute date is the number of days elapsed since the (imaginary) @@ -194,9 +188,6 @@ (message "Hebrew date (until sunset): %s" (calendar-hebrew-date-string (calendar-cursor-to-date t)))) -(define-obsolete-function-alias 'calendar-print-hebrew-date - 'calendar-hebrew-print-date "23.1") - (defun calendar-hebrew-yahrzeit (death-date year) "Absolute date of the anniversary of Hebrew DEATH-DATE in Hebrew YEAR." (let ((death-day (calendar-extract-day death-date)) @@ -230,9 +221,6 @@ (t (calendar-hebrew-to-absolute (list death-month death-day year)))))) -(define-obsolete-function-alias 'hebrew-calendar-yahrzeit - 'calendar-hebrew-yahrzeit "23.1") - (defun calendar-hebrew-read-date () "Interactively read the arguments for a Hebrew date command. Reads a year, month, and day." @@ -284,9 +272,6 @@ (calendar-hebrew-to-absolute date))) (or noecho (calendar-hebrew-print-date))) -(define-obsolete-function-alias 'calendar-goto-hebrew-date - 'calendar-hebrew-goto-date "23.1") - (defvar displayed-month) ; from calendar-generate (defun calendar-hebrew-date-is-visible-p (month day) @@ -398,10 +383,6 @@ "Hoshanah Rabbah")))))))) ;;;###holiday-autoload -(define-obsolete-function-alias 'holiday-rosh-hashanah-etc - 'holiday-hebrew-rosh-hashanah "23.1") - -;;;###holiday-autoload (defun holiday-hebrew-hanukkah (&optional all) "List of dates related to Hanukkah, as visible in calendar window. Shows only Hanukkah, unless `calendar-hebrew-all-holidays-flag' or ALL @@ -434,10 +415,6 @@ (list (list (calendar-gregorian-from-absolute abs-h) "Hanukkah"))))))) ;;;###holiday-autoload -(define-obsolete-function-alias 'holiday-hanukkah - 'holiday-hebrew-hanukkah "23.1") - -;;;###holiday-autoload (defun holiday-hebrew-passover (&optional all) "List of dates related to Passover, as visible in calendar window. Shows only the major holidays, unless `calendar-hebrew-all-holidays-flag' @@ -520,10 +497,6 @@ "Shavuot (second day)"))))))))) ;;;###holiday-autoload -(define-obsolete-function-alias 'holiday-passover-etc - 'holiday-hebrew-passover "23.1") - -;;;###holiday-autoload (defun holiday-hebrew-tisha-b-av () "List of dates around Tisha B'Av, as visible in calendar window." (when (memq displayed-month '(5 6 7 8 9)) @@ -545,10 +518,6 @@ (calendar-dayname-on-or-before 6 (+ abs-t-a 7))) "Shabbat Nahamu")))))) -;;;###holiday-autoload -(define-obsolete-function-alias 'holiday-tisha-b-av-etc - 'holiday-hebrew-tisha-b-av "23.1") - (autoload 'holiday-julian "cal-julian") ;;;###holiday-autoload @@ -634,9 +603,6 @@ (diary-list-entries-1 calendar-hebrew-month-name-array-leap-year diary-hebrew-entry-symbol 'calendar-hebrew-from-absolute)) -;;;###diary-autoload -(define-obsolete-function-alias 'list-hebrew-diary-entries - 'diary-hebrew-list-entries "23.1") (autoload 'calendar-mark-complex "diary-lib") @@ -662,10 +628,6 @@ (calendar-mark-complex month day year 'calendar-hebrew-from-absolute color)))) -;;;###diary-autoload -(define-obsolete-function-alias 'mark-hebrew-calendar-date-pattern - 'calendar-hebrew-mark-date-pattern "23.1") - (autoload 'diary-mark-entries-1 "diary-lib") ;;;###diary-autoload @@ -678,10 +640,6 @@ diary-hebrew-entry-symbol 'calendar-hebrew-from-absolute)) -;;;###diary-autoload -(define-obsolete-function-alias 'mark-hebrew-diary-entries - 'diary-hebrew-mark-entries "23.1") - (autoload 'diary-insert-entry-1 "diary-lib") ;;;###cal-autoload @@ -693,10 +651,6 @@ diary-hebrew-entry-symbol 'calendar-hebrew-from-absolute)) -;;;###diary-autoload -(define-obsolete-function-alias 'insert-hebrew-diary-entry - 'diary-hebrew-insert-entry "23.1") - ;;;###cal-autoload (defun diary-hebrew-insert-monthly-entry (arg) "Insert a monthly diary entry. @@ -706,9 +660,6 @@ (diary-insert-entry-1 'monthly arg calendar-hebrew-month-name-array-leap-year diary-hebrew-entry-symbol 'calendar-hebrew-from-absolute)) -;;;###diary-autoload -(define-obsolete-function-alias 'insert-monthly-hebrew-diary-entry - 'diary-hebrew-insert-monthly-entry "23.1") ;;;###cal-autoload (defun diary-hebrew-insert-yearly-entry (arg) @@ -719,9 +670,6 @@ (diary-insert-entry-1 'yearly arg calendar-hebrew-month-name-array-leap-year diary-hebrew-entry-symbol 'calendar-hebrew-from-absolute)) -;;;###diary-autoload -(define-obsolete-function-alias 'insert-yearly-hebrew-diary-entry - 'diary-hebrew-insert-yearly-entry "23.1") ;;;###autoload (defun calendar-hebrew-list-yahrzeits (death-date start-year end-year) @@ -786,10 +734,6 @@ (calendar-absolute-from-gregorian (list 1 1 i))))))) "\n")))) (message "Computing Yahrzeits...done")) -;;;###autoload -(define-obsolete-function-alias 'list-yahrzeit-dates - 'calendar-hebrew-list-yahrzeits "23.1") - (defun calendar-hebrew-birthday (date year) "Absolute date of the anniversary of Hebrew birth DATE, in Hebrew YEAR." (let ((b-day (calendar-extract-day date)) @@ -869,8 +813,6 @@ "" (format " and %d day%s" day (if (= day 1) "" "s")))))))))) -;;;###diary-autoload -(define-obsolete-function-alias 'diary-omer 'diary-hebrew-omer "23.1") (autoload 'diary-make-date "diary-lib") @@ -912,9 +854,6 @@ (diary-ordinal-suffix diff)))))) ;;;###diary-autoload -(define-obsolete-function-alias 'diary-yahrzeit 'diary-hebrew-yahrzeit "23.1") - -;;;###diary-autoload (defun diary-hebrew-rosh-hodesh (&optional mark) "Rosh Hodesh diary entry. Entry applies if date is Rosh Hodesh, the day before, or the Saturday before. @@ -976,9 +915,6 @@ (calendar-hebrew-last-month-of-year h-year)) 0 h-month))))))))) -;;;###diary-autoload -(define-obsolete-function-alias 'diary-rosh-hodesh - 'diary-hebrew-rosh-hodesh "23.1") (defconst calendar-hebrew-parashiot-names ["Bereshith" "Noah" "Lech L'cha" "Vayera" "Hayei Sarah" "Toledoth" @@ -1166,8 +1102,6 @@ (cdr parasha)))) (calendar-hebrew-parasha-name parasha))))))))) -(define-obsolete-function-alias 'diary-parasha 'diary-hebrew-parasha "23.1") - (declare-function solar-setup "solar" ()) (declare-function solar-sunrise-sunset "solar" (date)) @@ -1199,10 +1133,6 @@ 60.0)) (cdr sunset))))))))) -;;;###diary-autoload -(define-obsolete-function-alias 'diary-sabbath-candles - 'diary-hebrew-sabbath-candles "23.1") - (provide 'cal-hebrew) === modified file 'lisp/calendar/cal-islam.el' --- lisp/calendar/cal-islam.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/cal-islam.el 2014-10-06 02:02:04 +0000 @@ -87,9 +87,6 @@ leap-years-in-cycle ; leap days this cycle (1- calendar-islamic-epoch)))) ; days before start of calendar -(define-obsolete-function-alias 'calendar-absolute-from-islamic - 'calendar-islamic-to-absolute "23.1") - (defun calendar-islamic-from-absolute (date) "Compute the Islamic date (month day year) corresponding to absolute DATE. The absolute date is the number of days elapsed since the (imaginary) @@ -141,9 +138,6 @@ (message "Date is pre-Islamic") (message "Islamic date (until sunset): %s" i)))) -(define-obsolete-function-alias 'calendar-print-islamic-date - 'calendar-islamic-print-date "23.1") - (defun calendar-islamic-read-date () "Interactively read the arguments for an Islamic date command. Reads a year, month, and day." @@ -177,9 +171,6 @@ (calendar-islamic-to-absolute date))) (or noecho (calendar-islamic-print-date))) -(define-obsolete-function-alias 'calendar-goto-islamic-date - 'calendar-islamic-goto-date "23.1") - (defvar displayed-month) ; from calendar-generate (defvar displayed-year) @@ -260,9 +251,6 @@ diary-islamic-entry-symbol 'calendar-islamic-from-absolute)) -(define-obsolete-function-alias 'list-islamic-diary-entries - 'diary-islamic-list-entries "23.1") - (autoload 'calendar-mark-1 "diary-lib") ;;;###diary-autoload @@ -273,9 +261,6 @@ (calendar-mark-1 month day year 'calendar-islamic-from-absolute 'calendar-islamic-to-absolute color)) -(define-obsolete-function-alias 'mark-islamic-calendar-date-pattern - 'calendar-islamic-mark-date-pattern "23.1") - (autoload 'diary-mark-entries-1 "diary-lib") ;;;###diary-autoload @@ -288,9 +273,6 @@ diary-islamic-entry-symbol 'calendar-islamic-from-absolute)) -(define-obsolete-function-alias - 'mark-islamic-diary-entries 'diary-islamic-mark-entries "23.1") - (autoload 'diary-insert-entry-1 "diary-lib") ;;;###cal-autoload @@ -303,9 +285,6 @@ diary-islamic-entry-symbol 'calendar-islamic-from-absolute)) -(define-obsolete-function-alias 'insert-islamic-diary-entry - 'diary-islamic-insert-entry "23.1") - ;;;###cal-autoload (defun diary-islamic-insert-monthly-entry (arg) "Insert a monthly diary entry. @@ -316,9 +295,6 @@ diary-islamic-entry-symbol 'calendar-islamic-from-absolute)) -(define-obsolete-function-alias 'insert-monthly-islamic-diary-entry - 'diary-islamic-insert-monthly-entry "23.1") - ;;;###cal-autoload (defun diary-islamic-insert-yearly-entry (arg) "Insert an annual diary entry. @@ -328,8 +304,6 @@ (diary-insert-entry-1 'yearly arg calendar-islamic-month-name-array diary-islamic-entry-symbol 'calendar-islamic-from-absolute)) -(define-obsolete-function-alias - 'insert-yearly-islamic-diary-entry 'diary-islamic-insert-yearly-entry "23.1") (defvar date) === modified file 'lisp/calendar/cal-iso.el' --- lisp/calendar/cal-iso.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/cal-iso.el 2014-10-06 02:02:04 +0000 @@ -47,9 +47,6 @@ (* 7 (1- (calendar-extract-month date))) (if (zerop day) 6 (1- day))))) -(define-obsolete-function-alias 'calendar-absolute-from-iso - 'calendar-iso-to-absolute "23.1") - ;;;###cal-autoload (defun calendar-iso-from-absolute (date) "Compute the `ISO commercial date' corresponding to the absolute DATE. @@ -91,9 +88,6 @@ (message "ISO date: %s" (calendar-iso-date-string (calendar-cursor-to-date t)))) -(define-obsolete-function-alias 'calendar-print-iso-date - 'calendar-iso-print-date "23.1") - (defun calendar-iso-read-date (&optional dayflag) "Interactively read the arguments for an ISO date command. Reads a year and week, and if DAYFLAG is non-nil a day (otherwise @@ -118,9 +112,6 @@ 1))) (list (list week day year)))) -(define-obsolete-function-alias 'calendar-iso-read-args - 'calendar-iso-read-date "23.1") - ;;;###cal-autoload (defun calendar-iso-goto-date (date &optional noecho) "Move cursor to ISO DATE; echo ISO date unless NOECHO is non-nil." @@ -129,9 +120,6 @@ (calendar-iso-to-absolute date))) (or noecho (calendar-iso-print-date))) -(define-obsolete-function-alias 'calendar-goto-iso-date - 'calendar-iso-goto-date "23.1") - ;;;###cal-autoload (defun calendar-iso-goto-week (date &optional noecho) "Move cursor to ISO DATE; echo ISO date unless NOECHO is non-nil. @@ -141,9 +129,6 @@ (calendar-iso-to-absolute date))) (or noecho (calendar-iso-print-date))) -(define-obsolete-function-alias 'calendar-goto-iso-week - 'calendar-iso-goto-week "23.1") - (defvar date) ;; To be called from diary-list-sexp-entries, where DATE is bound. === modified file 'lisp/calendar/cal-julian.el' --- lisp/calendar/cal-julian.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/cal-julian.el 2014-10-06 02:02:04 +0000 @@ -45,9 +45,6 @@ (/ (1- year) 4) -2))) -(define-obsolete-function-alias 'calendar-absolute-from-julian - 'calendar-julian-to-absolute "23.1") - ;;;###cal-autoload (defun calendar-julian-from-absolute (date) "Compute the Julian (month day year) corresponding to the absolute DATE. @@ -93,9 +90,6 @@ (message "Julian date: %s" (calendar-julian-date-string (calendar-cursor-to-date t)))) -(define-obsolete-function-alias 'calendar-print-julian-date - 'calendar-julian-print-date "23.1") - ;;;###cal-autoload (defun calendar-julian-goto-date (date &optional noecho) "Move cursor to Julian DATE; echo Julian date unless NOECHO is non-nil." @@ -132,9 +126,6 @@ (calendar-julian-to-absolute date))) (or noecho (calendar-julian-print-date))) -(define-obsolete-function-alias 'calendar-goto-julian-date - 'calendar-julian-goto-date "23.1") - ;;;###holiday-autoload (defun holiday-julian (month day string) "Holiday on MONTH, DAY (Julian) called STRING. @@ -156,9 +147,6 @@ "Absolute date of astronomical (Julian) day number D." (- d 1721424.5)) -(define-obsolete-function-alias 'calendar-absolute-from-astro - 'calendar-astro-to-absolute "23.1") - ;;;###cal-autoload (defun calendar-astro-from-absolute (d) "Astronomical (Julian) day number of absolute date D." @@ -181,9 +169,6 @@ "Astronomical (Julian) day number (at noon UTC): %s.0" (calendar-astro-date-string (calendar-cursor-to-date t)))) -(define-obsolete-function-alias 'calendar-print-astro-day-number - 'calendar-astro-print-day-number "23.1") - ;;;###cal-autoload (defun calendar-astro-goto-day-number (daynumber &optional noecho) "Move cursor to astronomical (Julian) DAYNUMBER. @@ -197,8 +182,6 @@ (calendar-astro-to-absolute daynumber)))) (or noecho (calendar-astro-print-day-number))) -(define-obsolete-function-alias 'calendar-goto-astro-day-number - 'calendar-astro-goto-day-number "23.1") (defvar date) === modified file 'lisp/calendar/cal-mayan.el' --- lisp/calendar/cal-mayan.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/cal-mayan.el 2014-10-06 02:02:04 +0000 @@ -132,9 +132,6 @@ (message "Mayan date: %s" (calendar-mayan-date-string (calendar-cursor-to-date t)))) -(define-obsolete-function-alias 'calendar-print-mayan-date - 'calendar-mayan-print-date "23.1") - (defun calendar-mayan-read-haab-date () "Prompt for a Mayan haab date." (let* ((completion-ignore-case t) @@ -179,9 +176,6 @@ (calendar-absolute-from-gregorian (calendar-cursor-to-date)))))) (or noecho (calendar-mayan-print-date))) -(define-obsolete-function-alias 'calendar-next-haab-date - 'calendar-mayan-next-haab-date "23.1") - ;;;###cal-autoload (defun calendar-mayan-previous-haab-date (haab-date &optional noecho) "Move cursor to previous instance of Mayan HAAB-DATE. @@ -194,9 +188,6 @@ (1- (calendar-absolute-from-gregorian (calendar-cursor-to-date)))))) (or noecho (calendar-mayan-print-date))) -(define-obsolete-function-alias 'calendar-previous-haab-date - 'calendar-mayan-previous-haab-date "23.1") - (defun calendar-mayan-haab-to-string (haab) "Convert Mayan HAAB date (a pair) into its traditional written form." (let ((month (cdr haab))) @@ -247,9 +238,6 @@ (calendar-absolute-from-gregorian (calendar-cursor-to-date)))))) (or noecho (calendar-mayan-print-date))) -(define-obsolete-function-alias 'calendar-next-tzolkin-date - 'calendar-mayan-next-tzolkin-date "23.1") - ;;;###cal-autoload (defun calendar-mayan-previous-tzolkin-date (tzolkin-date &optional noecho) "Move cursor to previous instance of Mayan TZOLKIN-DATE. @@ -262,9 +250,6 @@ (1- (calendar-absolute-from-gregorian (calendar-cursor-to-date)))))) (or noecho (calendar-mayan-print-date))) -(define-obsolete-function-alias 'calendar-previous-tzolkin-date - 'calendar-mayan-previous-tzolkin-date "23.1") - (defun calendar-mayan-tzolkin-to-string (tzolkin) "Convert Mayan TZOLKIN date (a pair) into its traditional written form." (format "%d %s" @@ -309,9 +294,6 @@ (calendar-goto-date (calendar-gregorian-from-absolute date)) (or noecho (calendar-mayan-print-date))))) -(define-obsolete-function-alias 'calendar-next-calendar-round-date - 'calendar-mayan-next-round-date "23.1") - ;;;###cal-autoload (defun calendar-mayan-previous-round-date (tzolkin-date haab-date &optional noecho) @@ -330,9 +312,6 @@ (calendar-goto-date (calendar-gregorian-from-absolute date)) (or noecho (calendar-mayan-print-date))))) -(define-obsolete-function-alias 'calendar-previous-calendar-round-date - 'calendar-mayan-previous-round-date "23.1") - (defun calendar-mayan-long-count-to-absolute (c) "Compute the absolute date corresponding to the Mayan Long Count C. Long count is a list (baktun katun tun uinal kin)" @@ -344,9 +323,6 @@ ;; Days before absolute date 0. (- calendar-mayan-days-before-absolute-zero))) -(define-obsolete-function-alias 'calendar-absolute-from-mayan-long-count - 'calendar-mayan-long-count-to-absolute "23.1") - (defun calendar-mayan-long-count-common-era (lc) "Return non-nil if long count LC represents a date in the Common Era." (let ((base (calendar-mayan-long-count-from-absolute 1))) @@ -377,9 +353,6 @@ (calendar-mayan-long-count-to-absolute date))) (or noecho (calendar-mayan-print-date))) -(define-obsolete-function-alias 'calendar-goto-mayan-long-count-date - 'calendar-mayan-goto-long-count-date "23.1") - (defvar date) ;; To be called from diary-list-sexp-entries, where DATE is bound. === modified file 'lisp/calendar/cal-menu.el' --- lisp/calendar/cal-menu.el 2014-05-04 00:16:58 +0000 +++ lisp/calendar/cal-menu.el 2014-10-06 02:02:04 +0000 @@ -278,14 +278,6 @@ ["Show diary" diary-show-all-entries] ["Exit calendar" calendar-exit])) -;; Undocumented and probably useless. -(defvar cal-menu-load-hook nil - "Hook run on loading of the `cal-menu' package.") -(make-obsolete-variable 'cal-menu-load-hook - "it will be removed in future." "23.1") - -(run-hooks 'cal-menu-load-hook) - (provide 'cal-menu) ;; Local Variables: === modified file 'lisp/calendar/cal-move.el' --- lisp/calendar/cal-move.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/cal-move.el 2014-10-06 02:02:04 +0000 @@ -175,9 +175,6 @@ (t (list month 1 year)))))) (run-hooks 'calendar-move-hook))) -(define-obsolete-function-alias - 'scroll-calendar-left 'calendar-scroll-left "23.1") - ;;;###cal-autoload (defun calendar-scroll-right (&optional arg event) "Scroll the displayed calendar window right by ARG months. @@ -188,9 +185,6 @@ last-nonmenu-event)) (calendar-scroll-left (- (or arg 1)) event)) -(define-obsolete-function-alias - 'scroll-calendar-right 'calendar-scroll-right "23.1") - ;;;###cal-autoload (defun calendar-scroll-left-three-months (arg &optional event) "Scroll the displayed calendar window left by 3*ARG months. @@ -201,9 +195,6 @@ last-nonmenu-event)) (calendar-scroll-left (* 3 arg) event)) -(define-obsolete-function-alias 'scroll-calendar-left-three-months - 'calendar-scroll-left-three-months "23.1") - ;; cf scroll-bar-toolkit-scroll ;;;###cal-autoload (defun calendar-scroll-toolkit-scroll (event) @@ -226,9 +217,6 @@ last-nonmenu-event)) (calendar-scroll-left (* -3 arg) event)) -(define-obsolete-function-alias 'scroll-calendar-right-three-months - 'calendar-scroll-right-three-months "23.1") - ;;;###cal-autoload (defun calendar-forward-day (arg) "Move the cursor forward ARG days. === modified file 'lisp/calendar/cal-persia.el' --- lisp/calendar/cal-persia.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/cal-persia.el 2014-10-06 02:02:04 +0000 @@ -87,9 +87,6 @@ (calendar-persian-last-day-of-month m year)) day)))) ; days so far this month -(define-obsolete-function-alias 'calendar-absolute-from-persian - 'calendar-persian-to-absolute "23.1") - (defun calendar-persian-year-from-absolute (date) "Persian year corresponding to the absolute DATE." (let* ((d0 ; prior days since start of 2820 cycles @@ -163,9 +160,6 @@ (message "Persian date: %s" (calendar-persian-date-string (calendar-cursor-to-date t)))) -(define-obsolete-function-alias 'calendar-print-persian-date - 'calendar-persian-print-date "23.1") - (defun calendar-persian-read-date () "Interactively read the arguments for a Persian date command. Reads a year, month, and day." @@ -192,9 +186,6 @@ (lambda (x) (and (< 0 x) (<= x last)))))) (list (list month day year)))) -(define-obsolete-function-alias 'persian-prompt-for-date - 'calendar-persian-read-date "23.1") - ;;;###cal-autoload (defun calendar-persian-goto-date (date &optional noecho) "Move cursor to Persian date DATE. @@ -204,8 +195,6 @@ (calendar-persian-to-absolute date))) (or noecho (calendar-persian-print-date))) -(define-obsolete-function-alias 'calendar-goto-persian-date - 'calendar-persian-goto-date "23.1") (defvar date) === modified file 'lisp/calendar/cal-x.el' --- lisp/calendar/cal-x.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/cal-x.el 2014-10-06 02:02:04 +0000 @@ -65,9 +65,6 @@ (vertical-scroll-bars boolean)) :group 'calendar) -(define-obsolete-variable-alias 'calendar-after-frame-setup-hooks - 'calendar-after-frame-setup-hook "23.1") - (defcustom calendar-after-frame-setup-hook nil "List of functions to be run after creating a calendar and/or diary frame." :type 'hook @@ -150,36 +147,6 @@ (if (eq config 'one-frame) (calendar-dedicate-diary)))))) - -;;;###cal-autoload -(defun calendar-one-frame-setup (&optional prompt) - "Display calendar and diary in a single dedicated frame. -See `calendar-frame-setup' for more information." - (declare (obsolete calendar-frame-setup "23.1")) - (calendar-frame-setup 'one-frame prompt)) - -;;;###cal-autoload -(defun calendar-only-one-frame-setup (&optional prompt) - "Display calendar in a dedicated frame. -See `calendar-frame-setup' for more information." - (declare (obsolete calendar-frame-setup "23.1")) - (calendar-frame-setup 'calendar-only prompt)) - -;;;###cal-autoload -(defun calendar-two-frame-setup (&optional prompt) - "Display calendar and diary in separate, dedicated frames. -See `calendar-frame-setup' for more information." - (declare (obsolete calendar-frame-setup "23.1")) - (calendar-frame-setup 'two-frames prompt)) - -;; Undocumented and probably useless. -(defvar cal-x-load-hook nil - "Hook run on loading of the `cal-x' package.") -(make-obsolete-variable 'cal-x-load-hook "it will be removed in future." "23.1") - -(run-hooks 'cal-x-load-hook) - - (provide 'cal-x) ;;; cal-x.el ends here === modified file 'lisp/calendar/calendar.el' --- lisp/calendar/calendar.el 2014-09-29 18:14:08 +0000 +++ lisp/calendar/calendar.el 2014-10-06 02:02:04 +0000 @@ -189,9 +189,6 @@ (calendar-redraw)) :group 'calendar) -(define-obsolete-variable-alias 'view-diary-entries-initially - 'calendar-view-diary-initially-flag "23.1") - (defcustom calendar-view-diary-initially-flag nil "Non-nil means display current date's diary entries on entry to calendar. The diary is displayed in another window when the calendar is first displayed, @@ -201,9 +198,6 @@ :type 'boolean :group 'diary) -(define-obsolete-variable-alias 'mark-diary-entries-in-calendar - 'calendar-mark-diary-entries-flag "23.1") - ;; FIXME :set (defcustom calendar-mark-diary-entries-flag nil "Non-nil means mark dates with diary entries, in the calendar window. @@ -225,8 +219,6 @@ See the variable `calendar-today-marker'." :group 'calendar-faces) -(define-obsolete-face-alias 'calendar-today-face 'calendar-today "22.1") - (defface diary '((((min-colors 88) (class color) (background light)) :foreground "red1") @@ -243,8 +235,6 @@ and to highlight the date header in the fancy diary." :group 'calendar-faces) -(define-obsolete-face-alias 'diary-face 'diary "22.1") - (defface holiday '((((class color) (background light)) :background "pink") @@ -256,8 +246,6 @@ See `calendar-holiday-marker'." :group 'calendar-faces) -(define-obsolete-face-alias 'holiday-face 'holiday "22.1") - (defface calendar-weekday-header '((t :inherit font-lock-constant-face)) "Face used for weekday column headers in the calendar. See also the face `calendar-weekend-header'." @@ -307,9 +295,6 @@ :group 'holidays :version "23.1") -(define-obsolete-variable-alias 'view-calendar-holidays-initially - 'calendar-view-holidays-initially-flag "23.1") - (defcustom calendar-view-holidays-initially-flag nil "Non-nil means display holidays for current three month period on entry. The holidays are displayed in another window when the calendar is first @@ -317,9 +302,6 @@ :type 'boolean :group 'holidays) -(define-obsolete-variable-alias 'mark-holidays-in-calendar - 'calendar-mark-holidays-flag "23.1") - ;; FIXME :set (defcustom calendar-mark-holidays-flag nil "Non-nil means mark dates of holidays in the calendar window. @@ -338,9 +320,6 @@ :type 'hook :group 'calendar-hooks) -(define-obsolete-variable-alias 'initial-calendar-window-hook - 'calendar-initial-window-hook "23.1") - (defcustom calendar-initial-window-hook nil "List of functions to be called when the calendar window is created. Quitting the calendar and re-entering it will cause these functions @@ -348,9 +327,6 @@ :type 'hook :group 'calendar-hooks) -(define-obsolete-variable-alias 'today-visible-calendar-hook - 'calendar-today-visible-hook "23.1") - (defcustom calendar-today-visible-hook nil "List of functions called whenever the current date is visible. To mark today's date, add the function `calendar-mark-today'. @@ -363,9 +339,6 @@ :options '(calendar-mark-today calendar-star-date) :group 'calendar-hooks) -(define-obsolete-variable-alias 'today-invisible-calendar-hook - 'calendar-today-invisible-hook "23.1") - (defcustom calendar-today-invisible-hook nil "List of functions called whenever the current date is not visible. See also `calendar-today-visible-hook'." @@ -694,54 +667,22 @@ :group 'diary :version "25.1") -(define-obsolete-variable-alias 'hebrew-diary-entry-symbol - 'diary-hebrew-entry-symbol "23.1") - (defcustom diary-hebrew-entry-symbol "H" "Symbol indicating a diary entry according to the Hebrew calendar." :type 'string :group 'diary) -(define-obsolete-variable-alias 'islamic-diary-entry-symbol - 'diary-islamic-entry-symbol "23.1") - (defcustom diary-islamic-entry-symbol "I" "Symbol indicating a diary entry according to the Islamic calendar." :type 'string :group 'diary) -(define-obsolete-variable-alias 'bahai-diary-entry-symbol - 'diary-bahai-entry-symbol "23.1") - (defcustom diary-bahai-entry-symbol "B" "Symbol indicating a diary entry according to the Bahá'í calendar." :type 'string :group 'diary) -(defcustom european-calendar-style nil - "Non-nil means use the European style of dates in the diary and display. -In this case, a date like 1/2/1990 would be interpreted as -February 1, 1990. See `diary-european-date-forms' for the -default European diary date styles. - -Setting this variable directly does not take effect (if the -calendar package is already loaded). Rather, use either -\\[customize] or the function `calendar-set-date-style'." - :type 'boolean - ;; Without :initialize (require 'calendar) throws an error because - ;; calendar-set-date-style is undefined at this point. - :initialize 'custom-initialize-default - :set (lambda (symbol value) - (if value - (calendar-set-date-style 'european) - (calendar-set-date-style 'american))) - :group 'calendar) - -(make-obsolete-variable 'european-calendar-style 'calendar-date-style "23.1") - -;; If this is autoloaded, c-d-s gets set before any customization of e-c-s. -(defcustom calendar-date-style (if european-calendar-style 'european - 'american) +(defcustom calendar-date-style 'american "Your preferred style for writing dates. The options are: `american' - month/day/year @@ -790,9 +731,6 @@ (choice symbol regexp))))) :group 'diary) -(define-obsolete-variable-alias 'american-date-diary-pattern - 'diary-american-date-forms "23.1") - (defcustom diary-american-date-forms '((month "/" day "[^/0-9]") (month "/" day "/" year "[^0-9]") @@ -814,9 +752,6 @@ (choice symbol regexp))))) :group 'diary) -(define-obsolete-variable-alias 'european-date-diary-pattern - 'diary-european-date-forms "23.1") - (defcustom diary-european-date-forms '((day "/" month "[^/0-9]") (day "/" month "/" year "[^0-9]") @@ -906,9 +841,6 @@ :version "23.1" :group 'calendar) -(define-obsolete-variable-alias 'european-calendar-display-form - 'calendar-european-date-display-form "23.1") - (defcustom calendar-european-date-display-form '((if dayname (concat dayname ", ")) day " " monthname " " year) "Pseudo-pattern governing the way a date appears in the European style. @@ -917,9 +849,6 @@ :type 'sexp :group 'calendar) -(define-obsolete-variable-alias 'american-calendar-display-form - 'calendar-american-date-display-form "23.1") - (defcustom calendar-american-date-display-form '((if dayname (concat dayname ", ")) monthname " " day ", " year) "Pseudo-pattern governing the way a date appears in the American style. @@ -1034,21 +963,6 @@ (calendar-redraw) (calendar-update-mode-line)) -(defun european-calendar () - "Set the interpretation and display of dates to the European style." - (declare (obsolete calendar-set-date-style "23.1")) - (interactive) - (calendar-set-date-style 'european)) - -(defun american-calendar () - "Set the interpretation and display of dates to the American style." - (declare (obsolete calendar-set-date-style "23.1")) - (interactive) - (calendar-set-date-style 'american)) - -(define-obsolete-variable-alias 'holidays-in-diary-buffer - 'diary-show-holidays-flag "23.1") - (defcustom diary-show-holidays-flag t "Non-nil means include holidays in the diary display. The holidays appear in the mode line of the diary buffer, or in the @@ -1062,9 +976,6 @@ :type 'boolean :group 'calendar) -(define-obsolete-variable-alias 'all-hebrew-calendar-holidays - 'calendar-hebrew-all-holidays-flag "23.1") - (defcustom calendar-hebrew-all-holidays-flag nil "If nil, show only major holidays from the Hebrew calendar. This means only those Jewish holidays that appear on secular calendars. @@ -1073,9 +984,6 @@ :type 'boolean :group 'holidays) -(define-obsolete-variable-alias 'all-christian-calendar-holidays - 'calendar-christian-all-holidays-flag "23.1") - (defcustom calendar-christian-all-holidays-flag nil "If nil, show only major holidays from the Christian calendar. This means only those Christian holidays that appear on secular calendars. @@ -1084,9 +992,6 @@ :type 'boolean :group 'holidays) -(define-obsolete-variable-alias 'all-islamic-calendar-holidays - 'calendar-islamic-all-holidays-flag "23.1") - (defcustom calendar-islamic-all-holidays-flag nil "If nil, show only major holidays from the Islamic calendar. This means only those Islamic holidays that appear on secular calendars. @@ -1095,9 +1000,6 @@ :type 'boolean :group 'holidays) -(define-obsolete-variable-alias 'all-bahai-calendar-holidays - 'calendar-bahai-all-holidays-flag "23.1") - (defcustom calendar-bahai-all-holidays-flag nil "If nil, show only major holidays from the Bahá'í calendar. These are the days on which work and school must be suspended. @@ -1128,8 +1030,6 @@ (defconst diary-fancy-buffer "*Fancy Diary Entries*" "Name of the buffer used for the optional fancy display of the diary.") -(define-obsolete-variable-alias 'fancy-diary-buffer 'diary-fancy-buffer "23.1") - (defconst calendar-other-calendars-buffer "*Other Calendars*" "Name of the buffer used for the display of date on other calendars.") @@ -1162,9 +1062,6 @@ (and (< macro-y 0) (> ,mon 1) (setq ,yr (1- ,yr))) (if (< ,yr 1) (setq ,yr (1- ,yr))))) ; 0 AD -> -1 BC, etc -(define-obsolete-function-alias 'increment-calendar-month - 'calendar-increment-month "23.1") - (defvar displayed-month) (defvar displayed-year) @@ -1177,17 +1074,6 @@ (calendar-increment-month mon yr n) (cons mon yr)) -(defmacro calendar-for-loop (var from init to final do &rest body) - "Execute a for loop. -Evaluate BODY with VAR bound to successive integers from INIT to FINAL, -inclusive. The standard macro `dotimes' is preferable in most cases." - (declare (obsolete "use `dotimes' or `while' instead." "23.1") - (debug (symbolp "from" form "to" form "do" body)) - (indent defun)) - `(let ((,var (1- ,init))) - (while (>= ,final (setq ,var (1+ ,var))) - ,@body))) - (defmacro calendar-sum (index initial condition expression) "For INDEX = INITIAL, +1, ... (as long as CONDITION holds), sum EXPRESSION." (declare (debug (symbolp form form form))) @@ -1247,25 +1133,16 @@ "Extract the month part of DATE which has the form (month day year)." (car date)) -(define-obsolete-function-alias 'extract-calendar-month - 'calendar-extract-month "23.1") - ;; Note gives wrong answer for result of (calendar-read-date 'noday), ;; but that is only used by `calendar-other-month'. (defsubst calendar-extract-day (date) "Extract the day part of DATE which has the form (month day year)." (cadr date)) -(define-obsolete-function-alias 'extract-calendar-day - 'calendar-extract-day "23.1") - (defsubst calendar-extract-year (date) "Extract the year part of DATE which has the form (month day year)." (nth 2 date)) -(define-obsolete-function-alias 'extract-calendar-year - 'calendar-extract-year "23.1") - (defsubst calendar-leap-year-p (year) "Return t if YEAR is a Gregorian leap year. A negative year is interpreted as BC; -1 being 1 BC, and so on." @@ -1942,8 +1819,6 @@ (dolist (b calendar-buffers) (quit-windows-on b kill)))))) -(define-obsolete-function-alias 'exit-calendar 'calendar-exit "23.1") - (defun calendar-current-date (&optional offset) "Return the current date in a list (month day year). Optional integer OFFSET is a number of days from the current date." @@ -2496,9 +2371,6 @@ ;; Note there are side effects on calendar navigation. (<= 1 year)))) -(define-obsolete-function-alias 'calendar-date-is-legal-p - 'calendar-date-is-valid-p "23.1") - (defun calendar-date-equal (date1 date2) "Return t if the DATE1 and DATE2 are the same." (and @@ -2571,9 +2443,6 @@ (make-overlay (1- (point)) (1+ (point))) 'face (calendar-make-temp-face mark)))))))) -(define-obsolete-function-alias 'mark-visible-calendar-date - 'calendar-mark-visible-date "23.1") - (defun calendar-star-date () "Replace the date under the cursor in the calendar window with asterisks. You might want to add this function to `calendar-today-visible-hook'." @@ -2748,8 +2617,6 @@ "---") (calendar-string-spread (list str) ?- width))))) -(define-obsolete-function-alias 'calendar-version 'emacs-version "23.1") - (run-hooks 'calendar-load-hook) (provide 'calendar) === modified file 'lisp/calendar/diary-lib.el' --- lisp/calendar/diary-lib.el 2014-09-15 00:20:21 +0000 +++ lisp/calendar/diary-lib.el 2014-10-06 02:02:04 +0000 @@ -48,13 +48,6 @@ :type 'boolean :group 'diary) -(defcustom diary-face 'diary - "Face name to use for diary entries." - :type 'face - :group 'calendar-faces) -(make-obsolete-variable 'diary-face "customize the face `diary' instead." - "23.1") - (defface diary-anniversary '((t :inherit font-lock-keyword-face)) "Face used for anniversaries in the fancy diary display." :version "22.1" @@ -71,8 +64,6 @@ :version "22.1" :group 'calendar-faces) -(define-obsolete-face-alias 'diary-button-face 'diary-button "22.1") - ;; Face markup of calendar and diary displays: Any entry line that ;; ends with [foo:value] where foo is a face attribute (except :box ;; :stipple) or with [face:blah] tags, will have these values applied @@ -132,9 +123,6 @@ :type 'function :group 'diary) -(define-obsolete-variable-alias 'sexp-diary-entry-symbol - 'diary-sexp-entry-symbol "23.1") - (defcustom diary-sexp-entry-symbol "%%" "The string used to indicate a sexp diary entry in `diary-file'. See the documentation for the function `diary-list-sexp-entries'." @@ -167,9 +155,6 @@ :type 'hook :group 'diary) -(define-obsolete-variable-alias 'diary-display-hook 'diary-display-function - "23.1") - (defcustom diary-display-function 'diary-fancy-display "Function used to display the diary. The two standard options are `diary-fancy-display' and `diary-simple-display'. @@ -195,9 +180,6 @@ :version "23.2" ; simple->fancy :group 'diary) -(define-obsolete-variable-alias 'list-diary-entries-hook - 'diary-list-entries-hook "23.1") - (defcustom diary-list-entries-hook nil "Hook run after diary file is culled for relevant entries. @@ -226,9 +208,6 @@ :options '(diary-include-other-diary-files diary-sort-entries) :group 'diary) -(define-obsolete-variable-alias 'mark-diary-entries-hook - 'diary-mark-entries-hook "23.1") - (defcustom diary-mark-entries-hook nil "List of functions called after marking diary entries in the calendar. You might wish to add `diary-mark-included-diary-files', in which case @@ -243,9 +222,6 @@ :options '(diary-mark-included-diary-files) :group 'diary) -(define-obsolete-variable-alias 'nongregorian-diary-listing-hook - 'diary-nongregorian-listing-hook "23.1") - (defcustom diary-nongregorian-listing-hook nil "List of functions called for listing diary file and included files. As the files are processed for diary entries, these functions are used @@ -263,9 +239,6 @@ diary-islamic-list-entries) :group 'diary) -(define-obsolete-variable-alias 'nongregorian-diary-marking-hook - 'diary-nongregorian-marking-hook "23.1") - (defcustom diary-nongregorian-marking-hook nil "List of functions called for marking diary file and included files. As the files are processed for diary entries, these functions are used @@ -283,9 +256,6 @@ diary-islamic-mark-entries) :group 'diary) -(define-obsolete-variable-alias 'print-diary-entries-hook - 'diary-print-entries-hook "23.1") - (defcustom diary-print-entries-hook 'lpr-buffer "Run by `diary-print-entries' after preparing a temporary diary buffer. The buffer shows only the diary entries currently visible in the @@ -333,9 +303,6 @@ :type 'sexp :group 'diary) -(define-obsolete-variable-alias 'abbreviated-calendar-year - 'diary-abbreviated-year-flag "23.1") - (defcustom diary-abbreviated-year-flag t "Interpret a two-digit year DD in a diary entry as either 19DD or 20DD. This applies to the Gregorian, Hebrew, Islamic, and Bahá'í calendars. @@ -484,9 +451,6 @@ ;; Note this assumes diary was called without prefix arg. (diary)))) -(define-obsolete-variable-alias 'number-of-diary-entries - 'diary-number-of-entries "23.1") - (defcustom diary-number-of-entries 1 "Specifies how many days of diary entries are to be displayed initially. This variable affects the diary display when the command \\[diary] is @@ -562,10 +526,6 @@ (let ((diary-file dfile)) (diary-view-entries arg))) -;;;###cal-autoload -(define-obsolete-function-alias 'view-other-diary-entries - 'diary-view-other-diary-entries "23.1") - (defvar diary-syntax-table (let ((st (copy-syntax-table (standard-syntax-table)))) (modify-syntax-entry ?* "w" st) @@ -684,8 +644,6 @@ (list marker dfile literal) globcolor))))))) -(define-obsolete-function-alias 'add-to-diary-list 'diary-add-to-list "23.1") - (defun diary-list-entries-2 (date mark globattr list-only &optional months symbol gdate) "Internal subroutine of `diary-list-entries'. @@ -975,9 +933,6 @@ See also `diary-mark-included-diary-files'." (diary-include-files)) -(define-obsolete-function-alias 'include-other-diary-files - 'diary-include-other-diary-files "23.1") - (defvar date-string) ; bound in diary-list-entries (defun diary-display-no-entries () @@ -1036,9 +991,6 @@ (set-window-point window diary-saved-point) (set-window-start window (point-min))))))) -(define-obsolete-function-alias 'simple-diary-display - 'diary-simple-display "23.1") - (defvar diary-goto-entry-function 'diary-goto-entry "Function called to jump to a diary entry. Modes that require special handling of the included file @@ -1165,9 +1117,6 @@ (diary-fancy-display-mode)) (calendar-set-mode-line date-string)))) -(define-obsolete-function-alias 'fancy-diary-display - 'diary-fancy-display "23.1") - ;; FIXME modernize? (defun diary-print-entries () "Print a hard copy of the diary display. @@ -1212,9 +1161,6 @@ (run-hooks 'diary-print-entries-hook) (kill-buffer temp-buffer)))) -(define-obsolete-function-alias 'print-diary-entries - 'diary-print-entries "23.1") - ;;;###cal-autoload (defun diary-show-all-entries () "Show all of the diary entries in the diary file. @@ -1462,9 +1408,6 @@ (and temp-buff (buffer-name temp-buff) (kill-buffer temp-buff))) (or d-incp (message "Marking diary entries...done")))) -;;;###cal-autoload -(define-obsolete-function-alias 'mark-diary-entries 'diary-mark-entries "23.1") - (defun diary-sexp-entry (sexp entry date) "Process a SEXP diary ENTRY for DATE." (let ((result (if calendar-debug-sexp @@ -1542,9 +1485,6 @@ (or (cadr (diary-pull-attrs entry file-glob-attrs)) (if (consp mark) (car mark))))))))) -(define-obsolete-function-alias 'mark-sexp-diary-entries - 'diary-mark-sexp-entries "23.1") - (defun diary-mark-included-diary-files () "Mark diary entries from included diary files. To use, add this function to `diary-mark-entries-hook'. @@ -1552,9 +1492,6 @@ See also `diary-include-other-diary-files'." (diary-include-files t)) -(define-obsolete-function-alias 'mark-included-diary-files - 'diary-mark-included-diary-files "23.1") - (defun calendar-mark-days-named (dayname &optional color) "Mark all dates in the calendar window that are day DAYNAME of the week. 0 means all Sundays, 1 means all Mondays, and so on. @@ -1577,9 +1514,6 @@ color) (setq day (+ day 7)))))) -(define-obsolete-function-alias 'mark-calendar-days-named - 'calendar-mark-days-named "23.1") - (defun calendar-mark-month (month year p-month p-day p-year &optional color) "Mark dates in the MONTH/YEAR that conform to pattern P-MONTH/P-DAY/P-YEAR. A value of 0 in any position of the pattern is a wildcard. @@ -1593,9 +1527,6 @@ (calendar-mark-visible-date (list month (1+ i) year) color)) (calendar-mark-visible-date (list month p-day year) color)))) -(define-obsolete-function-alias 'mark-calendar-month - 'calendar-mark-month "23.1") - (defun calendar-mark-date-pattern (month day year &optional color) "Mark all dates in the calendar window that conform to MONTH/DAY/YEAR. A value of 0 in any position is a wildcard. Optional argument COLOR is @@ -1608,9 +1539,6 @@ (calendar-mark-month m y month day year color) (calendar-increment-month m y 1))))) -(define-obsolete-function-alias 'mark-calendar-date-pattern - 'calendar-mark-date-pattern "23.1") - ;; Bahai, Hebrew, Islamic. (defun calendar-mark-complex (month day year fromabs &optional color) "Mark dates in the calendar conforming to MONTH DAY YEAR of some system. @@ -1717,8 +1645,6 @@ entries, or change the order." (setq diary-entries-list (sort diary-entries-list 'diary-entry-compare))) -(define-obsolete-function-alias 'sort-diary-entries 'diary-sort-entries "23.1") - (defun diary-list-sexp-entries (date) "Add sexp entries for DATE from the diary file to `diary-entries-list'. @@ -1877,9 +1803,6 @@ (setq entry-found (or entry-found diary-entry))) entry-found)) -(define-obsolete-function-alias 'list-sexp-diary-entries - 'diary-list-sexp-entries "23.1") - (defun diary-make-date (a b c) "Convert A B C into the internal calendar date form. The expected order of the inputs depends on `calendar-date-style', @@ -2141,9 +2064,6 @@ string " ")) ;;;###cal-autoload -(define-obsolete-function-alias 'make-diary-entry 'diary-make-entry "23.1") - -;;;###cal-autoload (defun diary-insert-entry (arg &optional event) "Insert a diary entry for the date indicated by point. Prefix argument ARG makes the entry nonmarking." @@ -2153,9 +2073,6 @@ arg)) ;;;###cal-autoload -(define-obsolete-function-alias 'insert-diary-entry 'diary-insert-entry "23.1") - -;;;###cal-autoload (defun diary-insert-weekly-entry (arg) "Insert a weekly diary entry for the day of the week indicated by point. Prefix argument ARG makes the entry nonmarking." @@ -2163,10 +2080,6 @@ (diary-make-entry (calendar-day-name (calendar-cursor-to-date t)) arg)) -;;;###cal-autoload -(define-obsolete-function-alias 'insert-weekly-diary-entry - 'diary-insert-weekly-entry "23.1") - (defun diary-date-display-form (&optional type) "Return value for `calendar-date-display-form' using `calendar-date-style'. Optional symbol TYPE is either `monthly' or `yearly'." @@ -2222,10 +2135,6 @@ (diary-insert-entry-1 'monthly arg)) ;;;###cal-autoload -(define-obsolete-function-alias 'insert-monthly-diary-entry - 'diary-insert-monthly-entry "23.1") - -;;;###cal-autoload (defun diary-insert-yearly-entry (arg) "Insert an annual diary entry for the day of the year indicated by point. Prefix argument ARG makes the entry nonmarking." @@ -2233,10 +2142,6 @@ (diary-insert-entry-1 'yearly arg)) ;;;###cal-autoload -(define-obsolete-function-alias 'insert-yearly-diary-entry - 'diary-insert-yearly-entry "23.1") - -;;;###cal-autoload (defun diary-insert-anniversary-entry (arg) "Insert an anniversary diary entry for the date given by point. Prefix argument ARG makes the entry nonmarking." @@ -2249,10 +2154,6 @@ arg))) ;;;###cal-autoload -(define-obsolete-function-alias 'insert-anniversary-diary-entry - 'diary-insert-anniversary-entry "23.1") - -;;;###cal-autoload (defun diary-insert-block-entry (arg) "Insert a block diary entry for the days between the point and marked date. Prefix argument ARG makes the entry nonmarking." @@ -2276,10 +2177,6 @@ arg))) ;;;###cal-autoload -(define-obsolete-function-alias 'insert-block-diary-entry - 'diary-insert-block-entry "23.1") - -;;;###cal-autoload (defun diary-insert-cyclic-entry (arg) "Insert a cyclic diary entry starting at the date given by point. Prefix argument ARG makes the entry nonmarking." @@ -2293,10 +2190,6 @@ (calendar-date-string (calendar-cursor-to-date t) nil t)) arg))) -;;;###cal-autoload -(define-obsolete-function-alias 'insert-cyclic-diary-entry - 'diary-insert-cyclic-entry "23.1") - ;;; Diary mode. (defun diary-redraw-calendar () @@ -2357,7 +2250,7 @@ (if (equal (car x) 'backup) (concat "\\)" (eval (car (reverse x)))) "\\)")) - '(1 diary-face))) + '(1 'diary))) diary-date-forms))) (defmacro diary-font-lock-keywords-1 (markfunc listfunc feature months symbol) @@ -2494,11 +2387,8 @@ (put-text-property (match-beginning 0) (match-end 0) 'font-lock-multiline t) t)) -(define-obsolete-variable-alias 'fancy-diary-font-lock-keywords - 'diary-fancy-font-lock-keywords "23.1") - (defvar diary-fancy-font-lock-keywords - `((diary-fancy-date-matcher . diary-face) + `((diary-fancy-date-matcher . 'diary) ("^.*\\([aA]nniversary\\|[bB]irthday\\).*$" . 'diary-anniversary) ("^.*Yahrzeit.*$" . font-lock-constant-face) ("^\\(Erev \\)?Rosh Hodesh.*" . font-lock-function-name-face) @@ -2545,9 +2435,6 @@ (list (cons t diary-fancy-overriding-map))) (view-mode 1)) -(define-obsolete-function-alias 'fancy-diary-display-mode - 'diary-fancy-display-mode "23.1") - ;; Following code from Dave Love . ;; Import Outlook-format appointments from mail messages in Gnus or ;; Rmail using command `diary-from-outlook'. This, or the specialized === modified file 'lisp/calendar/holidays.el' --- lisp/calendar/holidays.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/holidays.el 2014-10-06 02:02:04 +0000 @@ -1,7 +1,7 @@ ;;; holidays.el --- holiday functions for the calendar package -;; Copyright (C) 1989-1990, 1992-1994, 1997, 2001-2014 Free Software -;; Foundation, Inc. +;; Copyright (C) 1989-1990, 1992-1994, 1997, 2001-2014 +;; Free Software Foundation, Inc. ;; Author: Edward M. Reingold ;; Maintainer: Glenn Morris @@ -43,9 +43,6 @@ ;; explicitly load this file. ;;;###autoload -(define-obsolete-variable-alias 'general-holidays - 'holiday-general-holidays "23.1") -;;;###autoload (defcustom holiday-general-holidays (mapcar 'purecopy '((holiday-fixed 1 1 "New Year's Day") @@ -73,9 +70,6 @@ (put 'holiday-general-holidays 'risky-local-variable t) ;;;###autoload -(define-obsolete-variable-alias 'oriental-holidays - 'holiday-oriental-holidays "23.1") -;;;###autoload (defcustom holiday-oriental-holidays (mapcar 'purecopy '((holiday-chinese-new-year) @@ -98,8 +92,6 @@ (put 'holiday-oriental-holidays 'risky-local-variable t) ;;;###autoload -(define-obsolete-variable-alias 'local-holidays 'holiday-local-holidays "23.1") -;;;###autoload (defcustom holiday-local-holidays nil "Local holidays. See the documentation for `calendar-holidays' for details." @@ -109,8 +101,6 @@ (put 'holiday-local-holidays 'risky-local-variable t) ;;;###autoload -(define-obsolete-variable-alias 'other-holidays 'holiday-other-holidays "23.1") -;;;###autoload (defcustom holiday-other-holidays nil "User defined holidays. See the documentation for `calendar-holidays' for details." @@ -120,108 +110,6 @@ (put 'holiday-other-holidays 'risky-local-variable t) ;;;###autoload -(defvar hebrew-holidays-1 - (mapcar 'purecopy - '((holiday-hebrew-rosh-hashanah) - (if calendar-hebrew-all-holidays-flag - (holiday-julian - 11 - (let ((m displayed-month) - (y displayed-year) - year) - (calendar-increment-month m y -1) - (setq year (calendar-extract-year - (calendar-julian-from-absolute - (calendar-absolute-from-gregorian (list m 1 y))))) - (if (zerop (% (1+ year) 4)) - 22 - 21)) "\"Tal Umatar\" (evening)")))) - "Component of the old default value of `holiday-hebrew-holidays'.") -;;;###autoload -(put 'hebrew-holidays-1 'risky-local-variable t) -(make-obsolete-variable 'hebrew-holidays-1 'hebrew-holidays "23.1") - -;;;###autoload -(defvar hebrew-holidays-2 - (mapcar 'purecopy - '((holiday-hebrew-hanukkah) ; respects calendar-hebrew-all-holidays-flag - (if calendar-hebrew-all-holidays-flag - (holiday-hebrew - 10 - (let ((h-year (calendar-extract-year - (calendar-hebrew-from-absolute - (calendar-absolute-from-gregorian - (list displayed-month 28 displayed-year)))))) - (if (= 6 (% (calendar-hebrew-to-absolute (list 10 10 h-year)) - 7)) - 11 10)) - "Tzom Teveth")) - (if calendar-hebrew-all-holidays-flag - (holiday-hebrew 11 15 "Tu B'Shevat")))) - "Component of the old default value of `holiday-hebrew-holidays'.") -;;;###autoload -(put 'hebrew-holidays-2 'risky-local-variable t) -(make-obsolete-variable 'hebrew-holidays-2 'hebrew-holidays "23.1") - -;;;###autoload -(defvar hebrew-holidays-3 - (mapcar 'purecopy - '((if calendar-hebrew-all-holidays-flag - (holiday-hebrew - 11 - (let* ((m displayed-month) - (y displayed-year) - (h-year (progn - (calendar-increment-month m y 1) - (calendar-extract-year - (calendar-hebrew-from-absolute - (calendar-absolute-from-gregorian - (list m (calendar-last-day-of-month m y) y)))))) - (s-s - (calendar-hebrew-from-absolute - (if (= 6 - (% (calendar-hebrew-to-absolute - (list 7 1 h-year)) - 7)) - (calendar-dayname-on-or-before - 6 (calendar-hebrew-to-absolute - (list 11 17 h-year))) - (calendar-dayname-on-or-before - 6 (calendar-hebrew-to-absolute - (list 11 16 h-year)))))) - (day (calendar-extract-day s-s))) - day) - "Shabbat Shirah")))) - "Component of the old default value of `holiday-hebrew-holidays'.") -;;;###autoload -(put 'hebrew-holidays-3 'risky-local-variable t) -(make-obsolete-variable 'hebrew-holidays-3 'hebrew-holidays "23.1") - -;;;###autoload -(defvar hebrew-holidays-4 - (mapcar 'purecopy - '((holiday-hebrew-passover) - (and calendar-hebrew-all-holidays-flag - (let* ((m displayed-month) - (y displayed-year) - (year (progn - (calendar-increment-month m y -1) - (calendar-extract-year - (calendar-julian-from-absolute - (calendar-absolute-from-gregorian (list m 1 y))))))) - (= 21 (% year 28))) - (holiday-julian 3 26 "Kiddush HaHamah")) - (if calendar-hebrew-all-holidays-flag - (holiday-hebrew-tisha-b-av)))) - "Component of the old default value of `holiday-hebrew-holidays'.") -;;;###autoload -(put 'hebrew-holidays-4 'risky-local-variable t) -(make-obsolete-variable 'hebrew-holidays-4 'hebrew-holidays "23.1") - -;;;###autoload -(define-obsolete-variable-alias 'hebrew-holidays - 'holiday-hebrew-holidays "23.1") -;;;###autoload (defcustom holiday-hebrew-holidays (mapcar 'purecopy '((holiday-hebrew-passover) @@ -240,9 +128,6 @@ (put 'holiday-hebrew-holidays 'risky-local-variable t) ;;;###autoload -(define-obsolete-variable-alias 'christian-holidays - 'holiday-christian-holidays "23.1") -;;;###autoload (defcustom holiday-christian-holidays (mapcar 'purecopy '((holiday-easter-etc) ; respects calendar-christian-all-holidays-flag @@ -262,9 +147,6 @@ (put 'holiday-christian-holidays 'risky-local-variable t) ;;;###autoload -(define-obsolete-variable-alias 'islamic-holidays - 'holiday-islamic-holidays "23.1") -;;;###autoload (defcustom holiday-islamic-holidays (mapcar 'purecopy '((holiday-islamic-new-year) @@ -286,8 +168,6 @@ (put 'holiday-islamic-holidays 'risky-local-variable t) ;;;###autoload -(define-obsolete-variable-alias 'bahai-holidays 'holiday-bahai-holidays "23.1") -;;;###autoload (defcustom holiday-bahai-holidays (mapcar 'purecopy '((holiday-bahai-new-year) @@ -309,8 +189,6 @@ (put 'holiday-bahai-holidays 'risky-local-variable t) ;;;###autoload -(define-obsolete-variable-alias 'solar-holidays 'holiday-solar-holidays "23.1") -;;;###autoload (defcustom holiday-solar-holidays (mapcar 'purecopy '((solar-equinoxes-solstices) @@ -516,9 +394,6 @@ (message "Looking up holidays...done")) holiday-list))) -(define-obsolete-function-alias - 'list-calendar-holidays 'calendar-list-holidays "23.1") - ;;;###autoload (defun holidays (&optional arg) "Display the holidays for last month, this month, and next month. @@ -645,9 +520,6 @@ (if (calendar-date-equal date (car h)) (setq holiday-list (append holiday-list (cdr h))))))) -(define-obsolete-function-alias - 'check-calendar-holidays 'calendar-check-holidays "23.1") - ;; Formerly cal-tex-list-holidays. (defun holiday-in-range (d1 d2) @@ -724,9 +596,6 @@ (calendar-mark-visible-date (car holiday) calendar-holiday-marker)) (message "Marking holidays...done"))) -(define-obsolete-function-alias - 'mark-calendar-holidays 'calendar-mark-holidays "23.1") - ;; Below are the functions that calculate the dates of holidays; these ;; are eval'ed in the function calendar-holiday-list. If you ;; write other such functions, be sure to imitate the style used below. @@ -813,9 +682,6 @@ (and (car p) (calendar-date-is-visible-p (car p)) p)) hlist))) -(define-obsolete-function-alias - 'filter-visible-calendar-holidays 'holiday-filter-visible-calendar "23.1") - (defun holiday-sexp (sexp string) "Sexp holiday for dates in the calendar window. SEXP is an expression in variable `year' that is evaluated to === modified file 'lisp/calendar/icalendar.el' --- lisp/calendar/icalendar.el 2014-09-29 18:14:08 +0000 +++ lisp/calendar/icalendar.el 2014-10-06 02:02:04 +0000 @@ -740,16 +740,6 @@ ;; datetime == nil nil)) -(defun icalendar--date-style () - "Return current calendar date style. -Convenience function to handle transition from old -`european-calendar-style' to new `calendar-date-style'." - (if (boundp 'calendar-date-style) - calendar-date-style - (if (with-no-warnings european-calendar-style) - 'european - 'american))) - (defun icalendar--datetime-to-diary-date (datetime &optional separator) "Convert the decoded DATETIME to diary format. Optional argument SEPARATOR gives the separator between month, @@ -757,7 +747,7 @@ Call icalendar--datetime-to-*-date according to the current calendar date style." (funcall (intern-soft (format "icalendar--datetime-to-%s-date" - (icalendar--date-style))) + calendar-date-style)) datetime separator)) (defun icalendar--datetime-to-colontime (datetime) @@ -867,7 +857,7 @@ (match-end 2)))) (setq year (read (substring datestring (match-beginning 3) (match-end 3)))) - (if (eq (icalendar--date-style) 'american) + (if (eq calendar-date-style 'american) (let ((x month)) (setq month day) (setq day x)))) @@ -1451,7 +1441,7 @@ NONMARKER is a regular expression matching the start of non-marking entries. ENTRY-MAIN is the first line of the diary entry." (if (string-match (concat nonmarker - (if (eq (icalendar--date-style) 'european) + (if (eq calendar-date-style 'european) "\\([0-9]+[0-9]?\\)\\s-+\\([a-z]+\\)\\s-+" "\\([a-z]+\\)\\s-+\\([0-9]+[0-9]?\\)\\s-+") "\\*?\\s-*" @@ -1462,8 +1452,8 @@ "\\s-*\\([^0-9]+.*?\\) ?$" ; must not match years ) entry-main) - (let* ((daypos (if (eq (icalendar--date-style) 'european) 1 2)) - (monpos (if (eq (icalendar--date-style) 'european) 2 1)) + (let* ((daypos (if (eq calendar-date-style 'european) 1 2)) + (monpos (if (eq calendar-date-style 'european) 2 1)) (day (read (substring entry-main (match-beginning daypos) (match-end daypos)))) @@ -2300,11 +2290,11 @@ (let ((day (nth 3 dtstart-dec)) (month (nth 4 dtstart-dec))) (setq result (concat "%%(and (diary-date " - (cond ((eq (icalendar--date-style) 'iso) + (cond ((eq calendar-date-style 'iso) (format "t %d %d" month day)) - ((eq (icalendar--date-style) 'european) + ((eq calendar-date-style 'european) (format "%d %d t" day month)) - ((eq (icalendar--date-style) 'american) + ((eq calendar-date-style 'american) (format "%d %d t" month day))) ") (diary-block " dtstart-conv @@ -2326,16 +2316,16 @@ (format "%%%%(and (diary-date %s) (diary-block %s %s)) %s%s%s" (let ((day (nth 3 dtstart-dec))) - (cond ((eq (icalendar--date-style) 'iso) + (cond ((eq calendar-date-style 'iso) (format "t t %d" day)) - ((eq (icalendar--date-style) 'european) + ((eq calendar-date-style 'european) (format "%d t t" day)) - ((eq (icalendar--date-style) 'american) + ((eq calendar-date-style 'american) (format "t %d t" day)))) dtstart-conv (if until until-conv - (if (eq (icalendar--date-style) 'iso) "9999 1 1" "1 1 9999")) ;; FIXME: should be unlimited + (if (eq calendar-date-style 'iso) "9999 1 1" "1 1 9999")) ;; FIXME: should be unlimited (or start-t "") (if end-t "-" "") (or end-t "")))) ;; daily === modified file 'lisp/calendar/lunar.el' --- lisp/calendar/lunar.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/lunar.el 2014-10-06 02:02:04 +0000 @@ -1,7 +1,6 @@ ;;; lunar.el --- calendar functions for phases of the moon -;; Copyright (C) 1992-1993, 1995, 1997, 2001-2014 Free Software -;; Foundation, Inc. +;; Copyright (C) 1992-1993, 1995, 1997, 2001-2014 Free Software Foundation, Inc. ;; Author: Edward M. Reingold ;; Maintainer: Glenn Morris @@ -228,10 +227,6 @@ (lunar-phase-list m1 y1) "\n"))) (message "Computing phases of the moon...done")))) -;;;###cal-autoload -(define-obsolete-function-alias 'calendar-phases-of-moon - 'calendar-lunar-phases "23.1") - ;;;###autoload (defun lunar-phases (&optional arg) "Display the quarters of the moon for last month, this month, and next month. @@ -245,9 +240,6 @@ (displayed-year (calendar-extract-year date))) (calendar-lunar-phases)))) -;;;###autoload -(define-obsolete-function-alias 'phases-of-moon 'lunar-phases "23.1") - (defvar date) ;; To be called from diary-list-sexp-entries, where DATE is bound. @@ -266,10 +258,6 @@ (cons mark (concat (lunar-phase-name (nth 2 phase)) " " (cadr phase)))))) -;;;###diary-autoload -(define-obsolete-function-alias 'diary-phases-of-moon - 'diary-lunar-phases "23.1") - ;; For the Chinese calendar the calculations for the new moon need to be more ;; accurate than those above, so we use more terms in the approximation. (defun lunar-new-moon-time (k) === modified file 'lisp/textmodes/remember.el' --- lisp/textmodes/remember.el 2014-02-19 08:34:45 +0000 +++ lisp/textmodes/remember.el 2014-10-06 02:02:04 +0000 @@ -499,6 +499,8 @@ :type '(choice (const :tag "diary-file" nil) file) :group 'remember) +(defvar calendar-date-style) ; calendar.el + (defun remember-diary-convert-entry (entry) "Translate MSG to an entry readable by diary." (save-match-data @@ -511,23 +513,17 @@ ;; which requires calendar. (require 'calendar) (replace-match - (let ((style (if (boundp 'calendar-date-style) - calendar-date-style - ;; Don't complain about obsolescence. - (if (with-no-warnings european-calendar-style) - 'european - 'american)))) - (cond ((eq style 'european) - (concat (match-string 3 entry) "/" - (match-string 2 entry) "/" - (match-string 1 entry))) - ((eq style 'iso) - (concat (match-string 1 entry) "-" + (cond ((eq calendar-date-style 'european) + (concat (match-string 3 entry) "/" + (match-string 2 entry) "/" + (match-string 1 entry))) + ((eq calendar-date-style 'iso) + (concat (match-string 1 entry) "-" (match-string 2 entry) "-" (match-string 3 entry))) - (t (concat (match-string 2 entry) "/" - (match-string 3 entry) "/" - (match-string 1 entry))))) + (t (concat (match-string 2 entry) "/" + (match-string 3 entry) "/" + (match-string 1 entry)))) t t entry)) entry))) === modified file 'test/ChangeLog' --- test/ChangeLog 2014-10-04 19:04:36 +0000 +++ test/ChangeLog 2014-10-06 02:02:04 +0000 @@ -1,3 +1,8 @@ +2014-10-06 Glenn Morris + + * automated/icalendar-tests.el (icalendar--calendar-style): + Remove test, no longer relevant. + 2014-10-04 Glenn Morris * automated/package-x-test.el: Remove file... === modified file 'test/automated/icalendar-tests.el' --- test/automated/icalendar-tests.el 2014-08-10 17:48:51 +0000 +++ test/automated/icalendar-tests.el 2014-10-06 02:02:04 +0000 @@ -80,18 +80,6 @@ (should (string= (concat "yyyDTSTARTyyy") (icalendar--create-uid entry-full contents))))) -(ert-deftest icalendar--calendar-style () - "Test for `icalendar--date-style'." - (dolist (calendar-date-style '(iso american european)) - (should (eq (icalendar--date-style) calendar-date-style))) - (let ((cds calendar-date-style) - (european-calendar-style t)) - (makunbound 'calendar-date-style) - (should (eq (icalendar--date-style) 'european)) - (with-no-warnings (setq european-calendar-style nil)) ;still get warning!?! FIXME - (should (eq (icalendar--date-style) 'american)) - (setq calendar-date-style cds))) - (ert-deftest icalendar-convert-anniversary-to-ical () "Test method for `icalendar--convert-anniversary-to-ical'." (let* ((calendar-date-style 'iso) ------------------------------------------------------------ revno: 118056 fixes bug: http://debbugs.gnu.org/9927 committer: Paul Eggert branch nick: trunk timestamp: Sun 2014-10-05 16:18:31 -0700 message: * keyboard.c (Qleft, Qright): Remove duplicate definitions. These were already defined in buffer.c, and the duplicate definitions cause problems on platforms like 'gcc -fno-common'. Reported by Peter Dyballa in: http://bugs.gnu.org/9927#137 diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-05 18:03:42 +0000 +++ src/ChangeLog 2014-10-05 23:18:31 +0000 @@ -1,3 +1,10 @@ +2014-10-05 Paul Eggert + + * keyboard.c (Qleft, Qright): Remove duplicate definitions (Bug#9927). + These were already defined in buffer.c, and the duplicate + definitions cause problems on platforms like 'gcc -fno-common'. + Reported by Peter Dyballa in: http://bugs.gnu.org/9927#137 + 2014-10-05 Jan Djärv * nsterm.m (updateFrameSize:): Only call update_frame_tool_bar === modified file 'src/keyboard.c' --- src/keyboard.c 2014-10-01 03:28:16 +0000 +++ src/keyboard.c 2014-10-05 23:18:31 +0000 @@ -5217,7 +5217,6 @@ static Lisp_Object Qabove_handle, Qhandle, Qbelow_handle; static Lisp_Object Qbefore_handle, Qhorizontal_handle, Qafter_handle; Lisp_Object Qup, Qdown, Qtop, Qbottom; -Lisp_Object Qleft, Qright; static Lisp_Object Qleftmost, Qrightmost; static Lisp_Object Qend_scroll; static Lisp_Object Qratio; ------------------------------------------------------------ revno: 118055 fixes bug: http://debbugs.gnu.org/18345 committer: Jan D. branch nick: trunk timestamp: Sun 2014-10-05 20:03:42 +0200 message: Fix disable toolbar for GNUStep. * nsterm.m (updateFrameSize:): Only call update_frame_tool_bar if toolbar is visible. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-05 17:51:11 +0000 +++ src/ChangeLog 2014-10-05 18:03:42 +0000 @@ -1,5 +1,8 @@ 2014-10-05 Jan Djärv + * nsterm.m (updateFrameSize:): Only call update_frame_tool_bar + if toolbar is visible. + * nsfont.m (nsfont_draw): Use CGFloat for GNUstep newer than 0.23 (Bug#18030). === modified file 'src/nsterm.m' --- src/nsterm.m 2014-10-05 15:46:10 +0000 +++ src/nsterm.m 2014-10-05 18:03:42 +0000 @@ -5827,7 +5827,8 @@ { #ifdef NS_IMPL_GNUSTEP // GNUstep does not always update the tool bar height. Force it. - if (toolbar) update_frame_tool_bar (emacsframe); + if (toolbar && [toolbar isVisible]) + update_frame_tool_bar (emacsframe); #endif extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe) ------------------------------------------------------------ revno: 118054 fixes bug: http://debbugs.gnu.org/18030 committer: Jan D. branch nick: trunk timestamp: Sun 2014-10-05 19:51:11 +0200 message: * nsfont.m (nsfont_draw): Use CGFloat for GNUstep newer than 0.23. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-05 15:46:10 +0000 +++ src/ChangeLog 2014-10-05 17:51:11 +0000 @@ -1,5 +1,8 @@ 2014-10-05 Jan Djärv + * nsfont.m (nsfont_draw): Use CGFloat for GNUstep newer than + 0.23 (Bug#18030). + * nsterm.m (syms_of_nsterm): ns-use-fullscreen-animation is new. (toggleFullScreen:): Use ns-use-fullscreen-animation for animate. (ns_select, ns_read_socket): Use unwind_protect to decrease === modified file 'src/nsfont.m' --- src/nsfont.m 2014-08-25 07:00:42 +0000 +++ src/nsfont.m 2014-10-05 17:51:11 +0000 @@ -1039,8 +1039,13 @@ static unsigned char cbuf[1024]; unsigned char *c = cbuf; #ifdef NS_IMPL_GNUSTEP +#if GNUSTEP_GUI_MAJOR_VERSION > 0 || GNUSTEP_GUI_MINOR_VERSION > 22 + static CGFloat advances[1024]; + CGFloat *adv = advances; +#else static float advances[1024]; float *adv = advances; +#endif #else static CGSize advances[1024]; CGSize *adv = advances; ------------------------------------------------------------ revno: 118053 [merge] committer: Glenn Morris branch nick: trunk timestamp: Sun 2014-10-05 10:19:23 -0700 message: Merge from emacs-24; up to r117555 diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2014-10-04 08:20:24 +0000 +++ doc/emacs/ChangeLog 2014-10-05 17:19:23 +0000 @@ -1,7 +1,11 @@ +2014-10-05 Glenn Morris + + * misc.texi (Sorting): + * search.texi (Query Replace): Markup fixes. + 2014-10-04 Martin Rudalics - * frames.texi (Scroll Bars): Describe use of horizontal scroll - bars. + * frames.texi (Scroll Bars): Describe use of horizontal scroll bars. 2014-10-04 Glenn Morris === modified file 'doc/emacs/misc.texi' --- doc/emacs/misc.texi 2014-10-04 07:05:21 +0000 +++ doc/emacs/misc.texi 2014-10-05 17:19:23 +0000 @@ -1935,9 +1935,9 @@ identify a @dfn{sort key} for each record, and then reorder the records into the order determined by the sort keys. The records are ordered so that their keys are in alphabetical order, or, for numeric sorting, in -numeric order. In alphabetic sorting, all upper-case letters `A' through -`Z' come before lower-case `a', in accord with the @acronym{ASCII} character -sequence. +numeric order. In alphabetic sorting, all upper-case letters @samp{A} +through @samp{Z} come before lower-case @samp{a}, in accordance with the +@acronym{ASCII} character sequence. The various sort commands differ in how they divide the text into sort records and in which part of each record is used as the sort key. Most of === modified file 'doc/emacs/search.texi' --- doc/emacs/search.texi 2014-07-03 23:52:42 +0000 +++ doc/emacs/search.texi 2014-10-04 16:46:21 +0000 @@ -1337,7 +1337,7 @@ @item Y @r{(Upper-case)} to replace all remaining occurrences in all remaining buffers in -multi-buffer replacements (like the Dired `Q' command which performs +multi-buffer replacements (like the Dired @key{Q} command that performs query replace on selected files). It answers this question and all subsequent questions in the series with "yes", without further user interaction. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-04 19:23:42 +0000 +++ lisp/ChangeLog 2014-10-05 17:19:23 +0000 @@ -1,3 +1,7 @@ +2014-10-05 Leo Liu + + * imenu.el (imenu-default-goto-function): Fix typo. + 2014-10-04 Thomas Fitzsimmons * net/ntlm.el (ntlm-build-auth-request): === modified file 'lisp/imenu.el' --- lisp/imenu.el 2014-02-22 21:20:49 +0000 +++ lisp/imenu.el 2014-10-05 00:58:38 +0000 @@ -1012,7 +1012,7 @@ (imenu item) nil)) -(defun imenu-default-goto-function (_name position &optional _rest) +(defun imenu-default-goto-function (_name position &rest _rest) "Move to the given position. NAME is ignored. POSITION is where to move. REST is also ignored. ------------------------------------------------------------ revno: 118052 fixes bug: http://debbugs.gnu.org/18345 committer: Jan D. branch nick: trunk timestamp: Sun 2014-10-05 17:46:10 +0200 message: * nsterm.m (ns_draw_window_cursor): Adjust y for hbar cursor only if smaller than line height (Bug#17977). diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-05 14:17:43 +0000 +++ src/ChangeLog 2014-10-05 15:46:10 +0000 @@ -4,6 +4,8 @@ (toggleFullScreen:): Use ns-use-fullscreen-animation for animate. (ns_select, ns_read_socket): Use unwind_protect to decrease apploopnr (Bug#18345). + (ns_draw_window_cursor): Adjust y for hbar cursor only if smaller than + line height (Bug#17977). * macfont.m: Fix indentation and import changes from macport 24.3.94. === modified file 'src/nsterm.m' --- src/nsterm.m 2014-10-05 14:17:43 +0000 +++ src/nsterm.m 2014-10-05 15:46:10 +0000 @@ -2441,7 +2441,10 @@ else if (cursor_type == HBAR_CURSOR) { cursor_height = (cursor_width < 1) ? lrint (0.25 * h) : cursor_width; - fy += h - cursor_height; + if (cursor_height > glyph_row->height) + cursor_height = glyph_row->height; + if (h > cursor_height) // Cursor smaller than line height, move down + fy += h - cursor_height; h = cursor_height; } @@ -6884,7 +6887,7 @@ } else { - error ("Invalid data type in dragging pasteboard"); + fprintf (stderr, "Invalid data type in dragging pasteboard"); return NO; } } ------------------------------------------------------------ revno: 118051 fixes bug: http://debbugs.gnu.org/18345 committer: Jan D. branch nick: trunk timestamp: Sun 2014-10-05 16:17:43 +0200 message: * nsterm.m (ns_select, ns_read_socket): Use unwind_protect to decrease apploopnr. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-05 12:20:17 +0000 +++ src/ChangeLog 2014-10-05 14:17:43 +0000 @@ -2,6 +2,8 @@ * nsterm.m (syms_of_nsterm): ns-use-fullscreen-animation is new. (toggleFullScreen:): Use ns-use-fullscreen-animation for animate. + (ns_select, ns_read_socket): Use unwind_protect to decrease + apploopnr (Bug#18345). * macfont.m: Fix indentation and import changes from macport 24.3.94. === modified file 'src/nsterm.m' --- src/nsterm.m 2014-10-05 12:20:17 +0000 +++ src/nsterm.m 2014-10-05 14:17:43 +0000 @@ -3513,6 +3513,15 @@ } #endif /* NS_IMPL_COCOA) && >= MAC_OS_X_VERSION_10_5 */ +static void +unwind_apploopnr (Lisp_Object not_used) +{ + --apploopnr; + n_emacs_events_pending = 0; + ns_finish_events (); + q_event_ptr = NULL; +} + static int ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) /* -------------------------------------------------------------------------- @@ -3570,6 +3579,7 @@ } else { + ptrdiff_t specpdl_count = SPECPDL_INDEX (); /* Run and wait for events. We must always send one NX_APPDEFINED event to ourself, otherwise [NXApp run] will never exit. */ send_appdefined = YES; @@ -3579,8 +3589,9 @@ { emacs_abort (); } + record_unwind_protect (unwind_apploopnr, Qt); [NSApp run]; - --apploopnr; + unbind_to (specpdl_count, Qnil); /* calls unwind_apploopnr */ } nevents = n_emacs_events_pending; @@ -3687,8 +3698,14 @@ { emacs_abort (); } - [NSApp run]; - --apploopnr; + + { + ptrdiff_t specpdl_count = SPECPDL_INDEX (); + record_unwind_protect (unwind_apploopnr, Qt); + [NSApp run]; + unbind_to (specpdl_count, Qnil); /* calls unwind_apploopnr */ + } + ns_finish_events (); if (nr > 0 && readfds) { ------------------------------------------------------------ revno: 118050 committer: Jan D. branch nick: trunk timestamp: Sun 2014-10-05 14:25:00 +0200 message: * NEWS: Mention ns-use-fullscreen-animation. diff: === modified file 'etc/ChangeLog' --- etc/ChangeLog 2014-09-30 23:19:31 +0000 +++ etc/ChangeLog 2014-10-05 12:25:00 +0000 @@ -1,3 +1,7 @@ +2014-10-05 Jan Djärv + + * NEWS: Mention ns-use-fullscreen-animation. + 2014-09-30 Bill Wohler Release MH-E version 8.6 === modified file 'etc/NEWS' --- etc/NEWS 2014-10-04 19:25:35 +0000 +++ etc/NEWS 2014-10-05 12:25:00 +0000 @@ -92,6 +92,11 @@ codeset is "UTF-8" (as in "en_US.UTF-8"). This is needed because MS-Windows doesn't support UTF-8 as codeset in its locales. +** New variable `ns-use-fullscreen-animation' controls animation for +non-native NS fullscreen. The default is nil. Set to t to enable +animation when entering and leaving fullscreen. For native OSX fullscreen +this has no effect. + * Editing Changes in Emacs 25.1 ------------------------------------------------------------ revno: 118049 committer: Jan D. branch nick: trunk timestamp: Sun 2014-10-05 14:20:17 +0200 message: Add ns-use-fullscreen-animation for non-native fullscreen on NS. * nsterm.m (syms_of_nsterm): ns-use-fullscreen-animation is new. (toggleFullScreen:): Use ns-use-fullscreen-animation for animate. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-05 11:34:59 +0000 +++ src/ChangeLog 2014-10-05 12:20:17 +0000 @@ -1,5 +1,8 @@ 2014-10-05 Jan Djärv + * nsterm.m (syms_of_nsterm): ns-use-fullscreen-animation is new. + (toggleFullScreen:): Use ns-use-fullscreen-animation for animate. + * macfont.m: Fix indentation and import changes from macport 24.3.94. (macfont_closest_traits_index): New function. === modified file 'src/nsterm.m' --- src/nsterm.m 2014-09-24 07:17:51 +0000 +++ src/nsterm.m 2014-10-05 12:20:17 +0000 @@ -6529,7 +6529,7 @@ [fw makeFirstResponder:self]; [w orderOut:self]; r = [fw frameRectForContentRect:[screen frame]]; - [fw setFrame: r display:YES animate:YES]; + [fw setFrame: r display:YES animate:ns_use_fullscreen_animation]; [self windowDidEnterFullScreen:nil]; [fw display]; } @@ -6561,7 +6561,7 @@ FRAME_TOOLBAR_HEIGHT (f) = tobar_height; [self windowWillExitFullScreen:nil]; - [fw setFrame: [w frame] display:YES animate:YES]; + [fw setFrame: [w frame] display:YES animate:ns_use_fullscreen_animation]; [fw close]; [w makeKeyAndOrderFront:NSApp]; [self windowDidExitFullScreen:nil]; @@ -7765,6 +7765,12 @@ #endif ns_last_use_native_fullscreen = ns_use_native_fullscreen; + DEFVAR_BOOL ("ns-use-fullscreen-animation", ns_use_fullscreen_animation, + doc: /*Non-nil means use animation on non-native fullscreen. +For native fullscreen, this does nothing. +Default is nil. */); + ns_use_fullscreen_animation = NO; + DEFVAR_BOOL ("ns-use-srgb-colorspace", ns_use_srgb_colorspace, doc: /*Non-nil means to use sRGB colorspace on OSX >= 10.7. Note that this does not apply to images. ------------------------------------------------------------ revno: 118048 committer: Jan D. branch nick: trunk timestamp: Sun 2014-10-05 13:34:59 +0200 message: Import from macoport 24.3.94. * macfont.m: Fix indentation and import changes from macport 24.3.94. (macfont_closest_traits_index): New function. (macfont_closest_traits_index_p): Renamed from macfont_closest_traits_index. (macfont_list): Use macfont_closest_traits_index_p. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-05 08:17:15 +0000 +++ src/ChangeLog 2014-10-05 11:34:59 +0000 @@ -1,3 +1,12 @@ +2014-10-05 Jan Djärv + + * macfont.m: Fix indentation and import changes from macport + 24.3.94. + (macfont_closest_traits_index): New function. + (macfont_closest_traits_index_p): Renamed from + macfont_closest_traits_index. + (macfont_list): Use macfont_closest_traits_index_p. + 2014-10-05 K. Handa * coding.c (detect_coding_iso_2022): Set coding->rejected === modified file 'src/macfont.m' --- src/macfont.m 2014-09-22 19:20:45 +0000 +++ src/macfont.m 2014-10-05 11:34:59 +0000 @@ -50,25 +50,25 @@ static CFArrayRef mac_ctfont_create_available_families (void); static Boolean mac_ctfont_equal_in_postscript_name (CTFontRef, CTFontRef); static CTLineRef mac_ctfont_create_line_with_string_and_font (CFStringRef, - CTFontRef); + CTFontRef); static CFComparisonResult mac_font_family_compare (const void *, - const void *, void *); + const void *, void *); static Boolean mac_ctfont_descriptor_supports_languages (CTFontDescriptorRef, - CFArrayRef); + CFArrayRef); static CFStringRef mac_ctfont_create_preferred_family_for_attributes (CFDictionaryRef); static CFIndex mac_ctfont_shape (CTFontRef, CFStringRef, - struct mac_glyph_layout *, CFIndex); + struct mac_glyph_layout *, CFIndex); static CFArrayRef mac_font_copy_default_descriptors_for_language (CFStringRef language); static CFStringRef mac_font_copy_default_name_for_charset_and_languages (CFCharacterSetRef charset, - CFArrayRef languages); + CFArrayRef languages); #if USE_CT_GLYPH_INFO static CGGlyph mac_ctfont_get_glyph_for_cid (CTFontRef, - CTCharacterCollection, - CGFontIndex); + CTCharacterCollection, + CGFontIndex); #endif /* The font property key specifying the font design destination. The @@ -129,26 +129,26 @@ static const CGFloat synthetic_bold_factor = 0.024; static Boolean cfnumber_get_font_symbolic_traits_value (CFNumberRef, - FontSymbolicTraits *); + FontSymbolicTraits *); static void macfont_store_descriptor_attributes (FontDescriptorRef, - Lisp_Object); + Lisp_Object); static Lisp_Object macfont_descriptor_entity (FontDescriptorRef, - Lisp_Object, - FontSymbolicTraits); + Lisp_Object, + FontSymbolicTraits); static CFStringRef macfont_create_family_with_symbol (Lisp_Object); static int macfont_glyph_extents (struct font *, CGGlyph, - struct font_metrics *, CGFloat *, int); + struct font_metrics *, CGFloat *, int); static CFMutableDictionaryRef macfont_create_attributes_with_spec (Lisp_Object); static Boolean macfont_supports_charset_and_languages_p (FontDescriptorRef, - CFCharacterSetRef, - Lisp_Object, - CFArrayRef); -static CFIndex macfont_closest_traits_index (CFArrayRef, - FontSymbolicTraits); + CFCharacterSetRef, + Lisp_Object, + CFArrayRef); +static Boolean macfont_closest_traits_index_p (CFArrayRef, FontSymbolicTraits, + CFIndex); static CFDataRef mac_font_copy_uvs_table (FontRef); static void mac_font_get_glyphs_for_variants (CFDataRef, UTF32Char, - const UTF32Char [], - CGGlyph [], CFIndex); + const UTF32Char [], + CGGlyph [], CFIndex); /* From CFData to a lisp string. Always returns a unibyte string. */ @@ -180,15 +180,15 @@ CFIndex i, length = CFStringGetLength (string); for (i = 0; i < length; i++) - if (CFStringGetCharacterAtIndex (string, i) == 0) - break; + if (CFStringGetCharacterAtIndex (string, i) == 0) + break; if (i == length) - return make_unibyte_string (s, strlen (s)); + return make_unibyte_string (s, strlen (s)); } data = CFStringCreateExternalRepresentation (NULL, string, - kCFStringEncodingUTF8, '?'); + kCFStringEncodingUTF8, '?'); if (data) { result = cfdata_to_lisp (data); @@ -206,12 +206,12 @@ cfstring_create_with_string_noencode (Lisp_Object s) { CFStringRef string = CFStringCreateWithBytes (NULL, SDATA (s), SBYTES (s), - kCFStringEncodingUTF8, false); + kCFStringEncodingUTF8, false); if (string == NULL) /* Failed to interpret as UTF 8. Fall back on Mac Roman. */ string = CFStringCreateWithBytes (NULL, SDATA (s), SBYTES (s), - kCFStringEncodingMacRoman, false); + kCFStringEncodingMacRoman, false); return string; } @@ -226,7 +226,7 @@ static CGGlyph mac_font_get_glyph_for_cid (FontRef font, CharacterCollection collection, - CGFontIndex cid) + CGFontIndex cid) { #if USE_CT_GLYPH_INFO return mac_ctfont_get_glyph_for_cid ((CTFontRef) font, collection, cid); @@ -237,17 +237,17 @@ unichar characters[] = {0xfffd}; NSString *string = [NSString stringWithCharacters:characters - length:ARRAYELTS (characters)]; + length:ARRAYELTS (characters)]; NSGlyphInfo *glyphInfo = [NSGlyphInfo glyphInfoWithCharacterIdentifier:cid - collection:collection - baseString:string]; + collection:collection + baseString:string]; NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:nsFont,NSFontAttributeName, - glyphInfo,NSGlyphInfoAttributeName,nil]; + glyphInfo,NSGlyphInfoAttributeName,nil]; NSTextStorage *textStorage = [[NSTextStorage alloc] initWithString:string - attributes:attributes]; + attributes:attributes]; NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init]; NSTextContainer *textContainer = [[NSTextContainer alloc] init]; NSFont *fontInTextStorage; @@ -261,14 +261,14 @@ (void) [layoutManager glyphRangeForTextContainer:textContainer]; fontInTextStorage = [textStorage attribute:NSFontAttributeName atIndex:0 - effectiveRange:NULL]; + effectiveRange:NULL]; if (fontInTextStorage == nsFont - || [[fontInTextStorage fontName] isEqualToString:[nsFont fontName]]) + || [[fontInTextStorage fontName] isEqualToString:[nsFont fontName]]) { - NSGlyph glyph = [layoutManager glyphAtIndex:0]; + NSGlyph glyph = [layoutManager glyphAtIndex:0]; - if (glyph < [nsFont numberOfGlyphs]) - result = glyph; + if (glyph < [nsFont numberOfGlyphs]) + result = glyph; } [textStorage release]; @@ -292,7 +292,7 @@ static Boolean mac_screen_font_get_metrics (ScreenFontRef font, CGFloat *ascent, - CGFloat *descent, CGFloat *leading) + CGFloat *descent, CGFloat *leading) { NSFont *nsFont = [(NSFont *)font printerFont]; NSTextStorage *textStorage; @@ -323,7 +323,7 @@ } usedRect = [layoutManager lineFragmentUsedRectForGlyphAtIndex:0 - effectiveRange:NULL]; + effectiveRange:NULL]; spaceLocation = [layoutManager locationForGlyphAtIndex:0]; [textStorage release]; @@ -342,8 +342,8 @@ static CFIndex mac_font_shape_1 (NSFont *font, NSString *string, - struct mac_glyph_layout *glyph_layouts, CFIndex glyph_len, - BOOL screen_font_p) + struct mac_glyph_layout *glyph_layouts, CFIndex glyph_len, + BOOL screen_font_p) { NSUInteger i; CFIndex result = 0; @@ -360,7 +360,7 @@ /* Append a trailing space to measure baseline position. */ [textStorage appendAttributedString:([[[NSAttributedString alloc] - initWithString:@" "] autorelease])]; + initWithString:@" "] autorelease])]; [textStorage setFont:font]; [textContainer setLineFragmentPadding:0]; [layoutManager setUsesScreenFonts:screen_font_p]; @@ -396,13 +396,13 @@ { NSRange range; NSFont *fontInTextStorage = - [textStorage attribute:NSFontAttributeName atIndex:i - longestEffectiveRange:&range - inRange:(NSMakeRange (0, stringLength))]; + [textStorage attribute:NSFontAttributeName atIndex:i + longestEffectiveRange:&range + inRange:(NSMakeRange (0, stringLength))]; if (!(fontInTextStorage == font - || [[fontInTextStorage fontName] isEqualToString:[font fontName]])) - break; + || [[fontInTextStorage fontName] isEqualToString:[font fontName]])) + break; i = NSMaxRange (range); } if (i < stringLength) @@ -414,12 +414,12 @@ NSRange range = NSMakeRange (0, stringLength); range = [layoutManager glyphRangeForCharacterRange:range - actualCharacterRange:NULL]; + actualCharacterRange:NULL]; numberOfGlyphs = NSMaxRange (range); used = numberOfGlyphs; for (i = 0; i < numberOfGlyphs; i++) - if ([layoutManager notShownAttributeForGlyphAtIndex:i]) - used--; + if ([layoutManager notShownAttributeForGlyphAtIndex:i]) + used--; } if (0 < used && used <= glyph_len) @@ -432,186 +432,186 @@ glyphIndex = 0; while ([layoutManager notShownAttributeForGlyphAtIndex:glyphIndex]) - glyphIndex++; + glyphIndex++; /* For now we assume the direction is not changed within the - string. */ + string. */ [layoutManager getGlyphsInRange:(NSMakeRange (glyphIndex, 1)) - glyphs:NULL characterIndexes:NULL - glyphInscriptions:NULL elasticBits:NULL - bidiLevels:&bidiLevel]; + glyphs:NULL characterIndexes:NULL + glyphInscriptions:NULL elasticBits:NULL + bidiLevels:&bidiLevel]; if (bidiLevel & 1) - permutation = xmalloc (sizeof (NSUInteger) * used); + permutation = xmalloc (sizeof (NSUInteger) * used); else - permutation = NULL; + permutation = NULL; #define RIGHT_TO_LEFT_P permutation /* Fill the `comp_range' member of struct mac_glyph_layout, and - setup a permutation for right-to-left text. */ + setup a permutation for right-to-left text. */ compRange = NSMakeRange (0, 0); for (range = NSMakeRange (0, 0); NSMaxRange (range) < used; - range.length++) - { - struct mac_glyph_layout *gl = glyph_layouts + NSMaxRange (range); - NSUInteger characterIndex = - [layoutManager characterIndexForGlyphAtIndex:glyphIndex]; - - gl->string_index = characterIndex; - - if (characterIndex >= NSMaxRange (compRange)) - { - compRange.location = NSMaxRange (compRange); - do - { - NSRange characterRange = - [string - rangeOfComposedCharacterSequenceAtIndex:characterIndex]; - - compRange.length = - NSMaxRange (characterRange) - compRange.location; - [layoutManager glyphRangeForCharacterRange:compRange - actualCharacterRange:&characterRange]; - characterIndex = NSMaxRange (characterRange) - 1; - } - while (characterIndex >= NSMaxRange (compRange)); - - if (RIGHT_TO_LEFT_P) - for (i = 0; i < range.length; i++) - permutation[range.location + i] = NSMaxRange (range) - i - 1; - - range = NSMakeRange (NSMaxRange (range), 0); - } - - gl->comp_range.location = compRange.location; - gl->comp_range.length = compRange.length; - - while (++glyphIndex < numberOfGlyphs) - if (![layoutManager notShownAttributeForGlyphAtIndex:glyphIndex]) - break; - } + range.length++) + { + struct mac_glyph_layout *gl = glyph_layouts + NSMaxRange (range); + NSUInteger characterIndex = + [layoutManager characterIndexForGlyphAtIndex:glyphIndex]; + + gl->string_index = characterIndex; + + if (characterIndex >= NSMaxRange (compRange)) + { + compRange.location = NSMaxRange (compRange); + do + { + NSRange characterRange = + [string + rangeOfComposedCharacterSequenceAtIndex:characterIndex]; + + compRange.length = + NSMaxRange (characterRange) - compRange.location; + [layoutManager glyphRangeForCharacterRange:compRange + actualCharacterRange:&characterRange]; + characterIndex = NSMaxRange (characterRange) - 1; + } + while (characterIndex >= NSMaxRange (compRange)); + + if (RIGHT_TO_LEFT_P) + for (i = 0; i < range.length; i++) + permutation[range.location + i] = NSMaxRange (range) - i - 1; + + range = NSMakeRange (NSMaxRange (range), 0); + } + + gl->comp_range.location = compRange.location; + gl->comp_range.length = compRange.length; + + while (++glyphIndex < numberOfGlyphs) + if (![layoutManager notShownAttributeForGlyphAtIndex:glyphIndex]) + break; + } if (RIGHT_TO_LEFT_P) - for (i = 0; i < range.length; i++) - permutation[range.location + i] = NSMaxRange (range) - i - 1; + for (i = 0; i < range.length; i++) + permutation[range.location + i] = NSMaxRange (range) - i - 1; /* Then fill the remaining members. */ glyphIndex = prevGlyphIndex = 0; while ([layoutManager notShownAttributeForGlyphAtIndex:glyphIndex]) - glyphIndex++; + glyphIndex++; if (!RIGHT_TO_LEFT_P) - totalAdvance = 0; + totalAdvance = 0; else - { - NSUInteger nrects; - NSRect *glyphRects = - [layoutManager - rectArrayForGlyphRange:(NSMakeRange (0, numberOfGlyphs)) - withinSelectedGlyphRange:(NSMakeRange (NSNotFound, 0)) - inTextContainer:textContainer rectCount:&nrects]; + { + NSUInteger nrects; + NSRect *glyphRects = + [layoutManager + rectArrayForGlyphRange:(NSMakeRange (0, numberOfGlyphs)) + withinSelectedGlyphRange:(NSMakeRange (NSNotFound, 0)) + inTextContainer:textContainer rectCount:&nrects]; - totalAdvance = NSMaxX (glyphRects[0]); - } + totalAdvance = NSMaxX (glyphRects[0]); + } for (i = 0; i < used; i++) - { - struct mac_glyph_layout *gl; - NSPoint location; - NSUInteger nextGlyphIndex; - NSRange glyphRange; - NSRect *glyphRects; - NSUInteger nrects; - - if (!RIGHT_TO_LEFT_P) - gl = glyph_layouts + i; - else - { - NSUInteger dest = permutation[i]; - - gl = glyph_layouts + dest; - if (i < dest) - { - CFIndex tmp = gl->string_index; - - gl->string_index = glyph_layouts[i].string_index; - glyph_layouts[i].string_index = tmp; - } - } - gl->glyph_id = [layoutManager glyphAtIndex:glyphIndex]; - - location = [layoutManager locationForGlyphAtIndex:glyphIndex]; - gl->baseline_delta = spaceLocation.y - location.y; - - for (nextGlyphIndex = glyphIndex + 1; nextGlyphIndex < numberOfGlyphs; - nextGlyphIndex++) - if (![layoutManager - notShownAttributeForGlyphAtIndex:nextGlyphIndex]) - break; - - if (!RIGHT_TO_LEFT_P) - { - CGFloat maxX; - - if (prevGlyphIndex == 0) - glyphRange = NSMakeRange (0, nextGlyphIndex); - else - glyphRange = NSMakeRange (glyphIndex, - nextGlyphIndex - glyphIndex); - glyphRects = - [layoutManager - rectArrayForGlyphRange:glyphRange - withinSelectedGlyphRange:(NSMakeRange (NSNotFound, 0)) - inTextContainer:textContainer rectCount:&nrects]; - maxX = max (NSMaxX (glyphRects[0]), totalAdvance); - gl->advance_delta = location.x - totalAdvance; - gl->advance = maxX - totalAdvance; - totalAdvance = maxX; - } - else - { - CGFloat minX; - - if (nextGlyphIndex == numberOfGlyphs) - glyphRange = NSMakeRange (prevGlyphIndex, - numberOfGlyphs - prevGlyphIndex); - else - glyphRange = NSMakeRange (prevGlyphIndex, - glyphIndex + 1 - prevGlyphIndex); - glyphRects = - [layoutManager - rectArrayForGlyphRange:glyphRange - withinSelectedGlyphRange:(NSMakeRange (NSNotFound, 0)) - inTextContainer:textContainer rectCount:&nrects]; - minX = min (NSMinX (glyphRects[0]), totalAdvance); - gl->advance = totalAdvance - minX; - totalAdvance = minX; - gl->advance_delta = location.x - totalAdvance; - } - - prevGlyphIndex = glyphIndex + 1; - glyphIndex = nextGlyphIndex; - } + { + struct mac_glyph_layout *gl; + NSPoint location; + NSUInteger nextGlyphIndex; + NSRange glyphRange; + NSRect *glyphRects; + NSUInteger nrects; + + if (!RIGHT_TO_LEFT_P) + gl = glyph_layouts + i; + else + { + NSUInteger dest = permutation[i]; + + gl = glyph_layouts + dest; + if (i < dest) + { + CFIndex tmp = gl->string_index; + + gl->string_index = glyph_layouts[i].string_index; + glyph_layouts[i].string_index = tmp; + } + } + gl->glyph_id = [layoutManager glyphAtIndex:glyphIndex]; + + location = [layoutManager locationForGlyphAtIndex:glyphIndex]; + gl->baseline_delta = spaceLocation.y - location.y; + + for (nextGlyphIndex = glyphIndex + 1; nextGlyphIndex < numberOfGlyphs; + nextGlyphIndex++) + if (![layoutManager + notShownAttributeForGlyphAtIndex:nextGlyphIndex]) + break; + + if (!RIGHT_TO_LEFT_P) + { + CGFloat maxX; + + if (prevGlyphIndex == 0) + glyphRange = NSMakeRange (0, nextGlyphIndex); + else + glyphRange = NSMakeRange (glyphIndex, + nextGlyphIndex - glyphIndex); + glyphRects = + [layoutManager + rectArrayForGlyphRange:glyphRange + withinSelectedGlyphRange:(NSMakeRange (NSNotFound, 0)) + inTextContainer:textContainer rectCount:&nrects]; + maxX = max (NSMaxX (glyphRects[0]), totalAdvance); + gl->advance_delta = location.x - totalAdvance; + gl->advance = maxX - totalAdvance; + totalAdvance = maxX; + } + else + { + CGFloat minX; + + if (nextGlyphIndex == numberOfGlyphs) + glyphRange = NSMakeRange (prevGlyphIndex, + numberOfGlyphs - prevGlyphIndex); + else + glyphRange = NSMakeRange (prevGlyphIndex, + glyphIndex + 1 - prevGlyphIndex); + glyphRects = + [layoutManager + rectArrayForGlyphRange:glyphRange + withinSelectedGlyphRange:(NSMakeRange (NSNotFound, 0)) + inTextContainer:textContainer rectCount:&nrects]; + minX = min (NSMinX (glyphRects[0]), totalAdvance); + gl->advance = totalAdvance - minX; + totalAdvance = minX; + gl->advance_delta = location.x - totalAdvance; + } + + prevGlyphIndex = glyphIndex + 1; + glyphIndex = nextGlyphIndex; + } if (RIGHT_TO_LEFT_P) - xfree (permutation); + xfree (permutation); #undef RIGHT_TO_LEFT_P result = used; - } - [textStorage release]; + } + [textStorage release]; return result; } static CFIndex mac_screen_font_shape (ScreenFontRef font, CFStringRef string, - struct mac_glyph_layout *glyph_layouts, - CFIndex glyph_len) + struct mac_glyph_layout *glyph_layouts, + CFIndex glyph_len) { return mac_font_shape_1 ([(NSFont *)font printerFont], - (NSString *) string, - glyph_layouts, glyph_len, YES); + (NSString *) string, + glyph_layouts, glyph_len, YES); } static CGColorRef @@ -649,6 +649,7 @@ CGColorRelease (refcol_); \ } while (0) + /* Mac font driver. */ @@ -711,17 +712,17 @@ CFStringRef font_names[3]; } macfont_language_default_font_names[] = { { CFSTR ("ja"), { CFSTR ("HiraKakuProN-W3"), /* 10.5 - 10.9 */ - CFSTR ("HiraKakuPro-W3"), /* 10.4 */ - NULL }}, + CFSTR ("HiraKakuPro-W3"), /* 10.4 */ + NULL }}, { CFSTR ("ko"), { CFSTR ("AppleSDGothicNeo-Regular"), /* 10.8 - 10.9 */ - CFSTR ("AppleGothic"), /* 10.4 - 10.7 */ - NULL }}, + CFSTR ("AppleGothic"), /* 10.4 - 10.7 */ + NULL }}, { CFSTR ("zh-Hans"), { CFSTR ("STHeitiSC-Light"), /* 10.6 - 10.9 */ - CFSTR ("STXihei"), /* 10.4 - 10.5 */ - NULL }}, + CFSTR ("STXihei"), /* 10.4 - 10.5 */ + NULL }}, { CFSTR ("zh-Hant"), { CFSTR ("STHeitiTC-Light"), /* 10.6 - 10.9 */ - CFSTR ("LiHeiPro"), /* 10.4 - 10.5 */ - NULL }}, + CFSTR ("LiHeiPro"), /* 10.4 - 10.5 */ + NULL }}, { NULL } }; #endif @@ -736,8 +737,8 @@ threshold = CFPreferencesGetAppIntegerValue (CFSTR ("AppleAntiAliasingThreshold"), - kCFPreferencesCurrentApplication, - &valid_p); + kCFPreferencesCurrentApplication, + &valid_p); if (valid_p) macfont_antialias_threshold = threshold; } @@ -771,7 +772,7 @@ static Boolean cfnumber_get_font_symbolic_traits_value (CFNumberRef number, - FontSymbolicTraits *sym_traits) + FontSymbolicTraits *sym_traits) { SInt64 sint64_value; @@ -789,7 +790,7 @@ static void macfont_store_descriptor_attributes (FontDescriptorRef desc, - Lisp_Object spec_or_entity) + Lisp_Object spec_or_entity) { CFStringRef str; CFDictionaryRef dict; @@ -797,66 +798,66 @@ CGFloat floatval; str = mac_font_descriptor_copy_attribute (desc, - MAC_FONT_FAMILY_NAME_ATTRIBUTE); + MAC_FONT_FAMILY_NAME_ATTRIBUTE); if (str) { ASET (spec_or_entity, FONT_FAMILY_INDEX, - macfont_intern_prop_cfstring (str)); + macfont_intern_prop_cfstring (str)); CFRelease (str); } dict = mac_font_descriptor_copy_attribute (desc, MAC_FONT_TRAITS_ATTRIBUTE); if (dict) { struct { - enum font_property_index index; - CFStringRef trait; - CGPoint points[6]; + enum font_property_index index; + CFStringRef trait; + CGPoint points[6]; } numeric_traits[] = - {{FONT_WEIGHT_INDEX, MAC_FONT_WEIGHT_TRAIT, - {{-0.4, 50}, /* light */ - {-0.24, 87.5}, /* (semi-light + normal) / 2 */ - {0, 100}, /* normal */ - {0.24, 140}, /* (semi-bold + normal) / 2 */ - {0.4, 200}, /* bold */ - {CGFLOAT_MAX, CGFLOAT_MAX}}}, - {FONT_SLANT_INDEX, MAC_FONT_SLANT_TRAIT, - {{0, 100}, {0.1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}, - {FONT_WIDTH_INDEX, MAC_FONT_WIDTH_TRAIT, - {{0, 100}, {1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}}; + {{FONT_WEIGHT_INDEX, MAC_FONT_WEIGHT_TRAIT, + {{-0.4, 50}, /* light */ + {-0.24, 87.5}, /* (semi-light + normal) / 2 */ + {0, 100}, /* normal */ + {0.24, 140}, /* (semi-bold + normal) / 2 */ + {0.4, 200}, /* bold */ + {CGFLOAT_MAX, CGFLOAT_MAX}}}, + {FONT_SLANT_INDEX, MAC_FONT_SLANT_TRAIT, + {{0, 100}, {0.1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}, + {FONT_WIDTH_INDEX, MAC_FONT_WIDTH_TRAIT, + {{0, 100}, {1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}}; int i; for (i = 0; i < ARRAYELTS (numeric_traits); i++) - { - num = CFDictionaryGetValue (dict, numeric_traits[i].trait); - if (num && CFNumberGetValue (num, kCFNumberCGFloatType, &floatval)) - { - CGPoint *point = numeric_traits[i].points; + { + num = CFDictionaryGetValue (dict, numeric_traits[i].trait); + if (num && CFNumberGetValue (num, kCFNumberCGFloatType, &floatval)) + { + CGPoint *point = numeric_traits[i].points; - while (point->x < floatval) - point++; - if (point == numeric_traits[i].points) - point++; - else if (point->x == CGFLOAT_MAX) - point--; - floatval = (point - 1)->y + ((floatval - (point - 1)->x) - * ((point->y - (point - 1)->y) - / (point->x - (point - 1)->x))); - FONT_SET_STYLE (spec_or_entity, numeric_traits[i].index, - make_number (lround (floatval))); - } - } + while (point->x < floatval) + point++; + if (point == numeric_traits[i].points) + point++; + else if (point->x == CGFLOAT_MAX) + point--; + floatval = (point - 1)->y + ((floatval - (point - 1)->x) + * ((point->y - (point - 1)->y) + / (point->x - (point - 1)->x))); + FONT_SET_STYLE (spec_or_entity, numeric_traits[i].index, + make_number (lround (floatval))); + } + } num = CFDictionaryGetValue (dict, MAC_FONT_SYMBOLIC_TRAIT); if (num) - { - FontSymbolicTraits sym_traits; - int spacing; + { + FontSymbolicTraits sym_traits; + int spacing; - cfnumber_get_font_symbolic_traits_value (num, &sym_traits); - spacing = (sym_traits & MAC_FONT_TRAIT_MONO_SPACE - ? FONT_SPACING_MONO : FONT_SPACING_PROPORTIONAL); - ASET (spec_or_entity, FONT_SPACING_INDEX, make_number (spacing)); - } + cfnumber_get_font_symbolic_traits_value (num, &sym_traits); + spacing = (sym_traits & MAC_FONT_TRAIT_MONO_SPACE + ? FONT_SPACING_MONO : FONT_SPACING_PROPORTIONAL); + ASET (spec_or_entity, FONT_SPACING_INDEX, make_number (spacing)); + } CFRelease (dict); } @@ -871,7 +872,7 @@ static Lisp_Object macfont_descriptor_entity (FontDescriptorRef desc, Lisp_Object extra, - FontSymbolicTraits synth_sym_traits) + FontSymbolicTraits synth_sym_traits) { Lisp_Object entity; CFDictionaryRef dict; @@ -891,7 +892,7 @@ CFNumberRef num = CFDictionaryGetValue (dict, MAC_FONT_SYMBOLIC_TRAIT); if (num) - cfnumber_get_font_symbolic_traits_value (num, &sym_traits); + cfnumber_get_font_symbolic_traits_value (num, &sym_traits); CFRelease (dict); } if (EQ (AREF (entity, FONT_SIZE_INDEX), make_number (0))) @@ -899,16 +900,16 @@ ASET (entity, FONT_EXTRA_INDEX, Fcopy_sequence (extra)); name = mac_font_descriptor_copy_attribute (desc, MAC_FONT_NAME_ATTRIBUTE); font_put_extra (entity, QCfont_entity, - make_save_ptr_int ((void *) name, sym_traits)); + make_save_ptr_int ((void *) name, sym_traits)); if (synth_sym_traits & MAC_FONT_TRAIT_ITALIC) FONT_SET_STYLE (entity, FONT_SLANT_INDEX, - make_number (FONT_SLANT_SYNTHETIC_ITALIC)); + make_number (FONT_SLANT_SYNTHETIC_ITALIC)); if (synth_sym_traits & MAC_FONT_TRAIT_BOLD) FONT_SET_STYLE (entity, FONT_WEIGHT_INDEX, - make_number (FONT_WEIGHT_SYNTHETIC_BOLD)); + make_number (FONT_WEIGHT_SYNTHETIC_BOLD)); if (synth_sym_traits & MAC_FONT_TRAIT_MONO_SPACE) ASET (entity, FONT_SPACING_INDEX, - make_number (FONT_SPACING_SYNTHETIC_MONO)); + make_number (FONT_SPACING_SYNTHETIC_MONO)); return entity; } @@ -948,36 +949,36 @@ else while (1) { - CFIndex i, count; - - if (families == NULL) - { - families = mac_font_create_available_families (); - using_cache_p = 0; - if (families == NULL) - break; - } - - count = CFArrayGetCount (families); - i = CFArrayBSearchValues (families, CFRangeMake (0, count), - (const void *) family_name, - family_name_comparator, NULL); - if (i < count) - { - CFStringRef name = CFArrayGetValueAtIndex (families, i); - - if ((*family_name_comparator) (name, family_name, NULL) - == kCFCompareEqualTo) - result = CFRetain (name); - } - - if (result || !using_cache_p) - break; - else - { - CFRelease (families); - families = NULL; - } + CFIndex i, count; + + if (families == NULL) + { + families = mac_font_create_available_families (); + using_cache_p = 0; + if (families == NULL) + break; + } + + count = CFArrayGetCount (families); + i = CFArrayBSearchValues (families, CFRangeMake (0, count), + (const void *) family_name, + family_name_comparator, NULL); + if (i < count) + { + CFStringRef name = CFArrayGetValueAtIndex (families, i); + + if ((*family_name_comparator) (name, family_name, NULL) + == kCFCompareEqualTo) + result = CFRetain (name); + } + + if (result || !using_cache_p) + break; + else + { + CFRelease (families); + families = NULL; + } } CFRelease (family_name); @@ -1004,23 +1005,23 @@ signed width_frac : WIDTH_FRAC_BITS, width_int : 16 - WIDTH_FRAC_BITS; }; -#define METRICS_VALUE(metrics, member) \ +#define METRICS_VALUE(metrics, member) \ (((metrics)->member##_high << 8) | (metrics)->member##_low) -#define METRICS_SET_VALUE(metrics, member, value) \ - do {short tmp = (value); (metrics)->member##_low = tmp & 0xff; \ - (metrics)->member##_high = tmp >> 8;} while (0) +#define METRICS_SET_VALUE(metrics, member, value) \ + do {short tmp = (value); (metrics)->member##_low = tmp & 0xff; \ + (metrics)->member##_high = tmp >> 8;} while (0) enum metrics_status - { - METRICS_INVALID = -1, /* metrics entry is invalid */ - METRICS_WIDTH_VALID = -2 /* width is valid but others are invalid */ - }; +{ + METRICS_INVALID = -1, /* metrics entry is invalid */ + METRICS_WIDTH_VALID = -2 /* width is valid but others are invalid */ +}; -#define METRICS_STATUS(metrics) \ +#define METRICS_STATUS(metrics) \ (METRICS_VALUE (metrics, ascent) + METRICS_VALUE (metrics, descent)) -#define METRICS_SET_STATUS(metrics, status) \ - do {METRICS_SET_VALUE (metrics, ascent, 0); \ - METRICS_SET_VALUE (metrics, descent, status);} while (0) +#define METRICS_SET_STATUS(metrics, status) \ + do {METRICS_SET_VALUE (metrics, ascent, 0); \ + METRICS_SET_VALUE (metrics, descent, status);} while (0) #define METRICS_NCOLS_PER_ROW (128) #define LCD_FONT_SMOOTHING_LEFT_MARGIN (0.396f) @@ -1028,8 +1029,8 @@ static int macfont_glyph_extents (struct font *font, CGGlyph glyph, - struct font_metrics *metrics, CGFloat *advance_delta, - int force_integral_p) + struct font_metrics *metrics, CGFloat *advance_delta, + int force_integral_p) { struct macfont_info *macfont_info = (struct macfont_info *) font; FontRef macfont = macfont_info->macfont; @@ -1042,11 +1043,11 @@ if (row >= macfont_info->metrics_nrows) { macfont_info->metrics = - xrealloc (macfont_info->metrics, - sizeof (struct macfont_metrics *) * (row + 1)); + xrealloc (macfont_info->metrics, + sizeof (struct macfont_metrics *) * (row + 1)); memset (macfont_info->metrics + macfont_info->metrics_nrows, 0, - (sizeof (struct macfont_metrics *) - * (row + 1 - macfont_info->metrics_nrows))); + (sizeof (struct macfont_metrics *) + * (row + 1 - macfont_info->metrics_nrows))); macfont_info->metrics_nrows = row + 1; } if (macfont_info->metrics[row] == NULL) @@ -1056,7 +1057,7 @@ new = xmalloc (sizeof (struct macfont_metrics) * METRICS_NCOLS_PER_ROW); for (i = 0; i < METRICS_NCOLS_PER_ROW; i++) - METRICS_SET_STATUS (new + i, METRICS_INVALID); + METRICS_SET_STATUS (new + i, METRICS_INVALID); macfont_info->metrics[row] = new; } cache = macfont_info->metrics[row] + col; @@ -1066,17 +1067,17 @@ CGFloat fwidth; if (macfont_info->screen_font) - fwidth = mac_screen_font_get_advance_width_for_glyph (macfont_info->screen_font, glyph); + fwidth = mac_screen_font_get_advance_width_for_glyph (macfont_info->screen_font, glyph); else - fwidth = mac_font_get_advance_width_for_glyph (macfont, glyph); + fwidth = mac_font_get_advance_width_for_glyph (macfont, glyph); /* For synthetic mono fonts, cache->width_{int,frac} holds the - advance delta value. */ + advance delta value. */ if (macfont_info->spacing == MACFONT_SPACING_SYNTHETIC_MONO) - fwidth = (font->pixel_size - fwidth) / 2; + fwidth = (font->pixel_size - fwidth) / 2; cache->width_int = lround (fwidth); cache->width_frac = lround ((fwidth - cache->width_int) - * WIDTH_FRAC_SCALE); + * WIDTH_FRAC_SCALE); METRICS_SET_STATUS (cache, METRICS_WIDTH_VALID); } if (macfont_info->spacing == MACFONT_SPACING_SYNTHETIC_MONO) @@ -1087,52 +1088,52 @@ if (metrics) { if (METRICS_STATUS (cache) == METRICS_WIDTH_VALID) - { - CGRect bounds = mac_font_get_bounding_rect_for_glyph (macfont, glyph); - - if (macfont_info->synthetic_italic_p) - { - /* We assume the members a, b, c, and d in - synthetic_italic_atfm are non-negative. */ - bounds.origin = - CGPointApplyAffineTransform (bounds.origin, - synthetic_italic_atfm); - bounds.size = - CGSizeApplyAffineTransform (bounds.size, synthetic_italic_atfm); - } - if (macfont_info->synthetic_bold_p) - { - CGFloat d = - - synthetic_bold_factor * mac_font_get_size (macfont) / 2; - - bounds = CGRectInset (bounds, d, d); - } - switch (macfont_info->spacing) - { - case MACFONT_SPACING_PROPORTIONAL: - bounds.origin.x += - (cache->width_frac - / (CGFloat) (WIDTH_FRAC_SCALE * 2)); - break; - case MACFONT_SPACING_MONO: - break; - case MACFONT_SPACING_SYNTHETIC_MONO: - bounds.origin.x += (cache->width_int - + (cache->width_frac - / (CGFloat) WIDTH_FRAC_SCALE)); - break; - } - if (bounds.size.width > 0) - { - bounds.origin.x -= LCD_FONT_SMOOTHING_LEFT_MARGIN; - bounds.size.width += (LCD_FONT_SMOOTHING_LEFT_MARGIN - + LCD_FONT_SMOOTHING_RIGHT_MARGIN); - } - bounds = CGRectIntegral (bounds); - METRICS_SET_VALUE (cache, lbearing, CGRectGetMinX (bounds)); - METRICS_SET_VALUE (cache, rbearing, CGRectGetMaxX (bounds)); - METRICS_SET_VALUE (cache, ascent, CGRectGetMaxY (bounds)); - METRICS_SET_VALUE (cache, descent, -CGRectGetMinY (bounds)); - } + { + CGRect bounds = mac_font_get_bounding_rect_for_glyph (macfont, glyph); + + if (macfont_info->synthetic_italic_p) + { + /* We assume the members a, b, c, and d in + synthetic_italic_atfm are non-negative. */ + bounds.origin = + CGPointApplyAffineTransform (bounds.origin, + synthetic_italic_atfm); + bounds.size = + CGSizeApplyAffineTransform (bounds.size, synthetic_italic_atfm); + } + if (macfont_info->synthetic_bold_p) + { + CGFloat d = + - synthetic_bold_factor * mac_font_get_size (macfont) / 2; + + bounds = CGRectInset (bounds, d, d); + } + switch (macfont_info->spacing) + { + case MACFONT_SPACING_PROPORTIONAL: + bounds.origin.x += - (cache->width_frac + / (CGFloat) (WIDTH_FRAC_SCALE * 2)); + break; + case MACFONT_SPACING_MONO: + break; + case MACFONT_SPACING_SYNTHETIC_MONO: + bounds.origin.x += (cache->width_int + + (cache->width_frac + / (CGFloat) WIDTH_FRAC_SCALE)); + break; + } + if (bounds.size.width > 0) + { + bounds.origin.x -= LCD_FONT_SMOOTHING_LEFT_MARGIN; + bounds.size.width += (LCD_FONT_SMOOTHING_LEFT_MARGIN + + LCD_FONT_SMOOTHING_RIGHT_MARGIN); + } + bounds = CGRectIntegral (bounds); + METRICS_SET_VALUE (cache, lbearing, CGRectGetMinX (bounds)); + METRICS_SET_VALUE (cache, rbearing, CGRectGetMaxX (bounds)); + METRICS_SET_VALUE (cache, ascent, CGRectGetMaxY (bounds)); + METRICS_SET_VALUE (cache, descent, -CGRectGetMinY (bounds)); + } metrics->lbearing = METRICS_VALUE (cache, lbearing); metrics->rbearing = METRICS_VALUE (cache, rbearing); metrics->width = width; @@ -1143,22 +1144,22 @@ if (advance_delta) { switch (macfont_info->spacing) - { - case MACFONT_SPACING_PROPORTIONAL: - *advance_delta = (force_integral_p ? 0 - : - (cache->width_frac - / (CGFloat) (WIDTH_FRAC_SCALE * 2))); - break; - case MACFONT_SPACING_MONO: - *advance_delta = 0; - break; - case MACFONT_SPACING_SYNTHETIC_MONO: - *advance_delta = (force_integral_p ? cache->width_int - : (cache->width_int - + (cache->width_frac - / (CGFloat) WIDTH_FRAC_SCALE))); - break; - } + { + case MACFONT_SPACING_PROPORTIONAL: + *advance_delta = (force_integral_p ? 0 + : - (cache->width_frac + / (CGFloat) (WIDTH_FRAC_SCALE * 2))); + break; + case MACFONT_SPACING_MONO: + *advance_delta = 0; + break; + case MACFONT_SPACING_SYNTHETIC_MONO: + *advance_delta = (force_integral_p ? cache->width_int + : (cache->width_int + + (cache->width_frac + / (CGFloat) WIDTH_FRAC_SCALE))); + break; + } } return width; @@ -1220,7 +1221,7 @@ static CFCharacterSetRef macfont_get_cf_charset_for_name (CFStringRef); static CGGlyph macfont_get_glyph_for_character (struct font *, UTF32Char); static CGGlyph macfont_get_glyph_for_cid (struct font *font, - CharacterCollection, CGFontIndex); + CharacterCollection, CGFontIndex); static CFDataRef macfont_get_uvs_table (struct font *, CharacterCollection *); static struct macfont_cache * @@ -1231,39 +1232,39 @@ if (macfont_cache_dictionary == NULL) { macfont_cache_dictionary = - CFDictionaryCreateMutable (NULL, 0, - &kCFTypeDictionaryKeyCallBacks, NULL); + CFDictionaryCreateMutable (NULL, 0, + &kCFTypeDictionaryKeyCallBacks, NULL); cache = NULL; } else cache = ((struct macfont_cache *) - CFDictionaryGetValue (macfont_cache_dictionary, key)); + CFDictionaryGetValue (macfont_cache_dictionary, key)); if (cache == NULL) { FontRef macfont = mac_font_create_with_name (key, 0); if (macfont) - { - cache = xzalloc (sizeof (struct macfont_cache)); - /* Treat the LastResort font as if it contained glyphs for - all characters. This may look too rough, but neither - CTFontCopyCharacterSet nor -[NSFont coveredCharacterSet] - for this font is correct for non-BMP characters on Mac OS - X 10.5, anyway. */ - if (CFEqual (key, CFSTR ("LastResort"))) - { - CFRange range = CFRangeMake (0, MAX_UNICODE_CHAR + 1); + { + cache = xzalloc (sizeof (struct macfont_cache)); + /* Treat the LastResort font as if it contained glyphs for + all characters. This may look too rough, but neither + CTFontCopyCharacterSet nor -[NSFont coveredCharacterSet] + for this font is correct for non-BMP characters on Mac OS + X 10.5, anyway. */ + if (CFEqual (key, CFSTR ("LastResort"))) + { + CFRange range = CFRangeMake (0, MAX_UNICODE_CHAR + 1); - cache->cf_charset = - CFCharacterSetCreateWithCharactersInRange (NULL, range); - } - if (cache->cf_charset == NULL) - cache->cf_charset = mac_font_copy_character_set (macfont); - CFDictionaryAddValue (macfont_cache_dictionary, key, - (const void *) cache); - CFRelease (macfont); - } + cache->cf_charset = + CFCharacterSetCreateWithCharactersInRange (NULL, range); + } + if (cache->cf_charset == NULL) + cache->cf_charset = mac_font_copy_character_set (macfont); + CFDictionaryAddValue (macfont_cache_dictionary, key, + (const void *) cache); + CFRelease (macfont); + } } return cache; @@ -1285,13 +1286,13 @@ int i; for (i = 0; i < cache->glyph.nrows; i++) - xfree (cache->glyph.matrix[i]); + xfree (cache->glyph.matrix[i]); xfree (cache->glyph.matrix); if (cache->glyph.dictionary) - CFRelease (cache->glyph.dictionary); + CFRelease (cache->glyph.dictionary); memset (&cache->glyph, 0, sizeof (cache->glyph)); if (cache->uvs.table) - CFRelease (cache->uvs.table); + CFRelease (cache->uvs.table); memset (&cache->uvs, 0, sizeof (cache->uvs)); } } @@ -1325,124 +1326,124 @@ int nkeys_or_perm = cache->glyph.row_nkeys_or_perm[row]; if (nkeys_or_perm < ROW_PERM_OFFSET) - { - UniChar unichars[256], ch; - CGGlyph *glyphs; - int i, len; - int nrows; + { + UniChar unichars[256], ch; + CGGlyph *glyphs; + int i, len; + int nrows; #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - dispatch_queue_t queue; - dispatch_group_t group = NULL; + dispatch_queue_t queue; + dispatch_group_t group = NULL; #else - int nkeys; -#endif - - if (row != 0) - { - CFMutableDictionaryRef dictionary; - uintptr_t key, value; - int nshifts; - CGGlyph glyph; - - if (cache->glyph.dictionary == NULL) - cache->glyph.dictionary = - CFDictionaryCreateMutable (NULL, 0, NULL, NULL); - dictionary = cache->glyph.dictionary; - key = c / NGLYPHS_IN_VALUE; - nshifts = ((c % NGLYPHS_IN_VALUE) * sizeof (CGGlyph) * 8); - value = ((uintptr_t) - CFDictionaryGetValue (dictionary, (const void *) key)); - glyph = (value >> nshifts); - if (glyph) - return glyph; - - if (nkeys_or_perm + 1 != ROW_PERM_OFFSET) - { - ch = c; - if (!mac_font_get_glyphs_for_characters (macfont, &ch, - &glyph, 1) - || glyph == 0) - glyph = kCGFontIndexInvalid; - - if (value == 0) - cache->glyph.row_nkeys_or_perm[row] = nkeys_or_perm + 1; - value |= ((uintptr_t) glyph << nshifts); - CFDictionarySetValue (dictionary, (const void *) key, - (const void *) value); - - return glyph; - } - -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - queue = - dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); - group = dispatch_group_create (); - dispatch_group_async (group, queue, ^{ - int nkeys; - uintptr_t key; -#endif - nkeys = nkeys_or_perm; - for (key = row * (256 / NGLYPHS_IN_VALUE); ; key++) - if (CFDictionaryContainsKey (dictionary, - (const void *) key)) - { - CFDictionaryRemoveValue (dictionary, - (const void *) key); - if (--nkeys == 0) - break; - } -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - }); -#endif - } - - len = 0; - for (i = 0; i < 256; i++) - { - ch = row * 256 + i; - if (CFCharacterSetIsLongCharacterMember (cache->cf_charset, ch)) - unichars[len++] = ch; - } - - glyphs = xmalloc (sizeof (CGGlyph) * 256); - if (len > 0) - { - mac_font_get_glyphs_for_characters (macfont, unichars, - glyphs, len); - while (i > len) - { - int next = unichars[len - 1] % 256; - - while (--i > next) - glyphs[i] = kCGFontIndexInvalid; - - len--; - glyphs[i] = glyphs[len]; - if (len == 0) - break; - } - } - if (i > len) - while (i-- > 0) - glyphs[i] = kCGFontIndexInvalid; - - nrows = cache->glyph.nrows; - nkeys_or_perm = nrows + ROW_PERM_OFFSET; - cache->glyph.row_nkeys_or_perm[row] = nkeys_or_perm; - nrows++; - cache->glyph.matrix = xrealloc (cache->glyph.matrix, - sizeof (CGGlyph *) * nrows); - cache->glyph.matrix[nrows - 1] = glyphs; - cache->glyph.nrows = nrows; - -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - if (group) - { - dispatch_group_wait (group, DISPATCH_TIME_FOREVER); - dispatch_release (group); - } -#endif - } + int nkeys; +#endif + + if (row != 0) + { + CFMutableDictionaryRef dictionary; + uintptr_t key, value; + int nshifts; + CGGlyph glyph; + + if (cache->glyph.dictionary == NULL) + cache->glyph.dictionary = + CFDictionaryCreateMutable (NULL, 0, NULL, NULL); + dictionary = cache->glyph.dictionary; + key = c / NGLYPHS_IN_VALUE; + nshifts = ((c % NGLYPHS_IN_VALUE) * sizeof (CGGlyph) * 8); + value = ((uintptr_t) + CFDictionaryGetValue (dictionary, (const void *) key)); + glyph = (value >> nshifts); + if (glyph) + return glyph; + + if (nkeys_or_perm + 1 != ROW_PERM_OFFSET) + { + ch = c; + if (!mac_font_get_glyphs_for_characters (macfont, &ch, + &glyph, 1) + || glyph == 0) + glyph = kCGFontIndexInvalid; + + if (value == 0) + cache->glyph.row_nkeys_or_perm[row] = nkeys_or_perm + 1; + value |= ((uintptr_t) glyph << nshifts); + CFDictionarySetValue (dictionary, (const void *) key, + (const void *) value); + + return glyph; + } + +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 + queue = + dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + group = dispatch_group_create (); + dispatch_group_async (group, queue, ^{ + int nkeys; + uintptr_t key; +#endif + nkeys = nkeys_or_perm; + for (key = row * (256 / NGLYPHS_IN_VALUE); ; key++) + if (CFDictionaryContainsKey (dictionary, + (const void *) key)) + { + CFDictionaryRemoveValue (dictionary, + (const void *) key); + if (--nkeys == 0) + break; + } +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 + }); +#endif + } + + len = 0; + for (i = 0; i < 256; i++) + { + ch = row * 256 + i; + if (CFCharacterSetIsLongCharacterMember (cache->cf_charset, ch)) + unichars[len++] = ch; + } + + glyphs = xmalloc (sizeof (CGGlyph) * 256); + if (len > 0) + { + mac_font_get_glyphs_for_characters (macfont, unichars, + glyphs, len); + while (i > len) + { + int next = unichars[len - 1] % 256; + + while (--i > next) + glyphs[i] = kCGFontIndexInvalid; + + len--; + glyphs[i] = glyphs[len]; + if (len == 0) + break; + } + } + if (i > len) + while (i-- > 0) + glyphs[i] = kCGFontIndexInvalid; + + nrows = cache->glyph.nrows; + nkeys_or_perm = nrows + ROW_PERM_OFFSET; + cache->glyph.row_nkeys_or_perm[row] = nkeys_or_perm; + nrows++; + cache->glyph.matrix = xrealloc (cache->glyph.matrix, + sizeof (CGGlyph *) * nrows); + cache->glyph.matrix[nrows - 1] = glyphs; + cache->glyph.nrows = nrows; + +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 + if (group) + { + dispatch_group_wait (group, DISPATCH_TIME_FOREVER); + dispatch_release (group); + } +#endif + } return cache->glyph.matrix[nkeys_or_perm - ROW_PERM_OFFSET][c % 256]; } @@ -1453,29 +1454,29 @@ CGGlyph glyph; if (cache->glyph.dictionary == NULL) - cache->glyph.dictionary = - CFDictionaryCreateMutable (NULL, 0, NULL, NULL); + cache->glyph.dictionary = + CFDictionaryCreateMutable (NULL, 0, NULL, NULL); key = c / NGLYPHS_IN_VALUE; nshifts = ((c % NGLYPHS_IN_VALUE) * sizeof (CGGlyph) * 8); value = (uintptr_t) CFDictionaryGetValue (cache->glyph.dictionary, - (const void *) key); + (const void *) key); glyph = (value >> nshifts); if (glyph == 0) - { - UniChar unichars[2]; - CGGlyph glyphs[2]; - CFIndex count = macfont_store_utf32char_to_unichars (c, unichars); - - if (mac_font_get_glyphs_for_characters (macfont, unichars, glyphs, - count)) - glyph = glyphs[0]; - if (glyph == 0) - glyph = kCGFontIndexInvalid; - - value |= ((uintptr_t) glyph << nshifts); - CFDictionarySetValue (cache->glyph.dictionary, - (const void *) key, (const void *) value); - } + { + UniChar unichars[2]; + CGGlyph glyphs[2]; + CFIndex count = macfont_store_utf32char_to_unichars (c, unichars); + + if (mac_font_get_glyphs_for_characters (macfont, unichars, glyphs, + count)) + glyph = glyphs[0]; + if (glyph == 0) + glyph = kCGFontIndexInvalid; + + value |= ((uintptr_t) glyph << nshifts); + CFDictionarySetValue (cache->glyph.dictionary, + (const void *) key, (const void *) value); + } return glyph; } @@ -1483,7 +1484,7 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font, CharacterCollection collection, - CGFontIndex cid) + CGFontIndex cid) { struct macfont_info *macfont_info = (struct macfont_info *) font; FontRef macfont = macfont_info->macfont; @@ -1504,34 +1505,34 @@ { CFDataRef uvs_table = mac_font_copy_uvs_table (macfont); CharacterCollection uvs_collection = - MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING; + MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING; if (uvs_table == NULL - && mac_font_get_glyph_for_cid (macfont, - MAC_CHARACTER_COLLECTION_ADOBE_JAPAN1, - 6480) != kCGFontIndexInvalid) - { - /* If the glyph for U+4E55 is accessible via its CID 6480, - then we use the Adobe-Japan1 UVS table, which maps a - variation sequence to a CID, as a fallback. */ - static CFDataRef mac_uvs_table_adobe_japan1 = NULL; + && mac_font_get_glyph_for_cid (macfont, + MAC_CHARACTER_COLLECTION_ADOBE_JAPAN1, + 6480) != kCGFontIndexInvalid) + { + /* If the glyph for U+4E55 is accessible via its CID 6480, + then we use the Adobe-Japan1 UVS table, which maps a + variation sequence to a CID, as a fallback. */ + static CFDataRef mac_uvs_table_adobe_japan1 = NULL; - if (mac_uvs_table_adobe_japan1 == NULL) - mac_uvs_table_adobe_japan1 = - CFDataCreateWithBytesNoCopy (NULL, - mac_uvs_table_adobe_japan1_bytes, - sizeof (mac_uvs_table_adobe_japan1_bytes), - kCFAllocatorNull); - if (mac_uvs_table_adobe_japan1) - { - uvs_table = CFRetain (mac_uvs_table_adobe_japan1); - uvs_collection = MAC_CHARACTER_COLLECTION_ADOBE_JAPAN1; - } - } + if (mac_uvs_table_adobe_japan1 == NULL) + mac_uvs_table_adobe_japan1 = + CFDataCreateWithBytesNoCopy (NULL, + mac_uvs_table_adobe_japan1_bytes, + sizeof (mac_uvs_table_adobe_japan1_bytes), + kCFAllocatorNull); + if (mac_uvs_table_adobe_japan1) + { + uvs_table = CFRetain (mac_uvs_table_adobe_japan1); + uvs_collection = MAC_CHARACTER_COLLECTION_ADOBE_JAPAN1; + } + } if (uvs_table == NULL) - cache->uvs.table = kCFNull; + cache->uvs.table = kCFNull; else - cache->uvs.table = uvs_table; + cache->uvs.table = uvs_table; cache->uvs.collection = uvs_collection; } @@ -1554,11 +1555,11 @@ static int macfont_has_char (Lisp_Object, int); static unsigned macfont_encode_char (struct font *, int); static void macfont_text_extents (struct font *, unsigned int *, int, - struct font_metrics *); + struct font_metrics *); static int macfont_draw (struct glyph_string *, int, int, int, int, bool); static Lisp_Object macfont_shape (Lisp_Object); static int macfont_variation_glyphs (struct font *, int c, - unsigned variations[256]); + unsigned variations[256]); static void macfont_filter_properties (Lisp_Object, Lisp_Object); static struct font_driver macfont_driver = @@ -1610,19 +1611,19 @@ for (i = j = 0; i < SBYTES (SYMBOL_NAME (registry)); i++, j++) { if (str[i] == '.') - re[j++] = '\\'; + re[j++] = '\\'; else if (str[i] == '*') - re[j++] = '.'; + re[j++] = '.'; re[j] = str[i]; if (re[j] == '?') - re[j] = '.'; + re[j] = '.'; } re[j] = '\0'; regexp = make_unibyte_string (re, j); for (i = 0; cf_charset_table[i].name; i++) if (fast_c_string_match_ignore_case - (regexp, cf_charset_table[i].name, - strlen (cf_charset_table[i].name)) >= 0) + (regexp, cf_charset_table[i].name, + strlen (cf_charset_table[i].name)) >= 0) break; if (! cf_charset_table[i].name) return -1; @@ -1635,27 +1636,27 @@ CFMutableCharacterSetRef charset = CFCharacterSetCreateMutable (NULL); if (! charset) - return -1; + return -1; for (j = 0; uniquifier[j]; j++) - { - count += macfont_store_utf32char_to_unichars (uniquifier[j], - unichars + count); - CFCharacterSetAddCharactersInRange (charset, - CFRangeMake (uniquifier[j], 1)); - } + { + count += macfont_store_utf32char_to_unichars (uniquifier[j], + unichars + count); + CFCharacterSetAddCharactersInRange (charset, + CFRangeMake (uniquifier[j], 1)); + } string = CFStringCreateWithCharacters (NULL, unichars, count); if (! string) - { - CFRelease (charset); - return -1; - } + { + CFRelease (charset); + return -1; + } cf_charset_table[i].cf_charset = CFCharacterSetCreateCopy (NULL, - charset); + charset); CFRelease (charset); /* CFCharacterSetCreateWithCharactersInString does not handle - surrogate pairs properly as of Mac OS X 10.5. */ - cf_charset_table[i].cf_charset_string = string; + surrogate pairs properly as of Mac OS X 10.5. */ + cf_charset_table[i].cf_charset_string = string; } return i; } @@ -1668,19 +1669,19 @@ unsigned int *features[2]; }; -#define OTF_SYM_TAG(SYM, TAG) \ - do { \ - unsigned char *p = SDATA (SYMBOL_NAME (SYM)); \ +#define OTF_SYM_TAG(SYM, TAG) \ + do { \ + unsigned char *p = SDATA (SYMBOL_NAME (SYM)); \ TAG = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; \ } while (0) -#define OTF_TAG_STR(TAG, P) \ - do { \ - (P)[0] = (char) (TAG >> 24); \ - (P)[1] = (char) ((TAG >> 16) & 0xFF); \ - (P)[2] = (char) ((TAG >> 8) & 0xFF); \ - (P)[3] = (char) (TAG & 0xFF); \ - (P)[4] = '\0'; \ +#define OTF_TAG_STR(TAG, P) \ + do { \ + (P)[0] = (char) (TAG >> 24); \ + (P)[1] = (char) ((TAG >> 16) & 0xFF); \ + (P)[2] = (char) ((TAG >> 8) & 0xFF); \ + (P)[3] = (char) (TAG & 0xFF); \ + (P)[4] = '\0'; \ } while (0) static struct OpenTypeSpec * @@ -1699,9 +1700,9 @@ OTF_SYM_TAG (spec->script, spec->script_tag); val = assq_no_quit (spec->script, Votf_script_alist); if (CONSP (val) && SYMBOLP (XCDR (val))) - spec->script = XCDR (val); + spec->script = XCDR (val); else - spec->script = Qnil; + spec->script = Qnil; } else spec->script_tag = 0x44464C54; /* "DFLT" */ @@ -1711,7 +1712,7 @@ { val = XCAR (otf_spec); if (! NILP (val)) - OTF_SYM_TAG (val, spec->langsys_tag); + OTF_SYM_TAG (val, spec->langsys_tag); otf_spec = XCDR (otf_spec); } spec->nfeatures[0] = spec->nfeatures[1] = 0; @@ -1721,31 +1722,31 @@ val = XCAR (otf_spec); if (NILP (val)) - continue; + continue; len = Flength (val); spec->features[i] = - (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < XINT (len) - ? 0 - : malloc (XINT (len) * sizeof *spec->features[i])); + (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < XINT (len) + ? 0 + : malloc (XINT (len) * sizeof *spec->features[i])); if (! spec->features[i]) - { - if (i > 0 && spec->features[0]) - free (spec->features[0]); - free (spec); - return NULL; - } + { + if (i > 0 && spec->features[0]) + free (spec->features[0]); + free (spec); + return NULL; + } for (j = 0, negative = 0; CONSP (val); val = XCDR (val)) - { - if (NILP (XCAR (val))) - negative = 1; - else - { - unsigned int tag; + { + if (NILP (XCAR (val))) + negative = 1; + else + { + unsigned int tag; - OTF_SYM_TAG (XCAR (val), tag); - spec->features[i][j++] = negative ? tag & 0x80000000 : tag; - } - } + OTF_SYM_TAG (XCAR (val), tag); + spec->features[i][j++] = negative ? tag & 0x80000000 : tag; + } + } spec->nfeatures[i] = j; } return spec; @@ -1769,16 +1770,16 @@ CGPoint points[6]; } numeric_traits[] = {{FONT_WEIGHT_INDEX, MAC_FONT_WEIGHT_TRAIT, - {{-0.4, 50}, /* light */ - {-0.24, 87.5}, /* (semi-light + normal) / 2 */ - {0, 100}, /* normal */ - {0.24, 140}, /* (semi-bold + normal) / 2 */ - {0.4, 200}, /* bold */ - {CGFLOAT_MAX, CGFLOAT_MAX}}}, + {{-0.4, 50}, /* light */ + {-0.24, 87.5}, /* (semi-light + normal) / 2 */ + {0, 100}, /* normal */ + {0.24, 140}, /* (semi-bold + normal) / 2 */ + {0.4, 200}, /* bold */ + {CGFLOAT_MAX, CGFLOAT_MAX}}}, {FONT_SLANT_INDEX, MAC_FONT_SLANT_TRAIT, - {{0, 100}, {0.1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}, + {{0, 100}, {0.1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}, {FONT_WIDTH_INDEX, MAC_FONT_WIDTH_TRAIT, - {{0, 100}, {1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}}; + {{0, 100}, {1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}}; registry = AREF (spec, FONT_REGISTRY_INDEX); if (NILP (registry) @@ -1792,17 +1793,17 @@ cf_charset_idx = macfont_get_charset (registry); if (cf_charset_idx < 0) - goto err; + goto err; charset = cf_charset_table[cf_charset_idx].cf_charset; charset_string = cf_charset_table[cf_charset_idx].cf_charset_string; lang = cf_charset_table[cf_charset_idx].lang; if (lang) - { - langarray = CFArrayCreateMutable (NULL, 0, &kCFTypeArrayCallBacks); - if (! langarray) - goto err; - CFArrayAppendValue (langarray, lang); - } + { + langarray = CFArrayCreateMutable (NULL, 0, &kCFTypeArrayCallBacks); + if (! langarray) + goto err; + CFArrayAppendValue (langarray, lang); + } } for (extra = AREF (spec, FONT_EXTRA_INDEX); @@ -1813,35 +1814,35 @@ tmp = XCAR (extra); key = XCAR (tmp), val = XCDR (tmp); if (EQ (key, QClang)) - { - if (! langarray) - langarray = CFArrayCreateMutable (NULL, 0, &kCFTypeArrayCallBacks); - if (! langarray) - goto err; - if (SYMBOLP (val)) - val = list1 (val); - for (; CONSP (val); val = XCDR (val)) - if (SYMBOLP (XCAR (val))) - { - CFStringRef lang = - cfstring_create_with_string_noencode (SYMBOL_NAME - (XCAR (val))); + { + if (! langarray) + langarray = CFArrayCreateMutable (NULL, 0, &kCFTypeArrayCallBacks); + if (! langarray) + goto err; + if (SYMBOLP (val)) + val = list1 (val); + for (; CONSP (val); val = XCDR (val)) + if (SYMBOLP (XCAR (val))) + { + CFStringRef lang = + cfstring_create_with_string_noencode (SYMBOL_NAME + (XCAR (val))); - if (lang == NULL) - goto err; - CFArrayAppendValue (langarray, lang); - CFRelease (lang); - } - } + if (lang == NULL) + goto err; + CFArrayAppendValue (langarray, lang); + CFRelease (lang); + } + } else if (EQ (key, QCotf)) - { - otspec = macfont_get_open_type_spec (val); - if (! otspec) - goto err; - script = otspec->script; - } + { + otspec = macfont_get_open_type_spec (val); + if (! otspec) + goto err; + script = otspec->script; + } else if (EQ (key, QCscript)) - script = val; + script = val; } if (! NILP (script) && ! charset) @@ -1849,40 +1850,40 @@ Lisp_Object chars = assq_no_quit (script, Vscript_representative_chars); if (CONSP (chars) && CONSP (CDR (chars))) - { - CFMutableStringRef string = CFStringCreateMutable (NULL, 0); - CFMutableCharacterSetRef cs = CFCharacterSetCreateMutable (NULL); - - if (! string || !cs) - { - if (string) - CFRelease (string); - else if (cs) - CFRelease (cs); - goto err; - } - for (chars = XCDR (chars); CONSP (chars); chars = XCDR (chars)) - if (CHARACTERP (XCAR (chars))) - { - UniChar unichars[2]; - CFIndex count = - macfont_store_utf32char_to_unichars (XFASTINT (XCAR (chars)), - unichars); - CFRange range = CFRangeMake (XFASTINT (XCAR (chars)), 1); - - CFStringAppendCharacters (string, unichars, count); - CFCharacterSetAddCharactersInRange (cs, range); - } - charset = cs; - /* CFCharacterSetCreateWithCharactersInString does not - handle surrogate pairs properly as of Mac OS X 10.5. */ - charset_string = string; - } + { + CFMutableStringRef string = CFStringCreateMutable (NULL, 0); + CFMutableCharacterSetRef cs = CFCharacterSetCreateMutable (NULL); + + if (! string || !cs) + { + if (string) + CFRelease (string); + else if (cs) + CFRelease (cs); + goto err; + } + for (chars = XCDR (chars); CONSP (chars); chars = XCDR (chars)) + if (CHARACTERP (XCAR (chars))) + { + UniChar unichars[2]; + CFIndex count = + macfont_store_utf32char_to_unichars (XFASTINT (XCAR (chars)), + unichars); + CFRange range = CFRangeMake (XFASTINT (XCAR (chars)), 1); + + CFStringAppendCharacters (string, unichars, count); + CFCharacterSetAddCharactersInRange (cs, range); + } + charset = cs; + /* CFCharacterSetCreateWithCharactersInString does not + handle surrogate pairs properly as of Mac OS X 10.5. */ + charset_string = string; + } } attributes = CFDictionaryCreateMutable (NULL, 0, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); if (! attributes) goto err; @@ -1892,15 +1893,15 @@ CFStringRef family = macfont_create_family_with_symbol (tmp); if (! family) - goto err; + goto err; CFDictionaryAddValue (attributes, MAC_FONT_FAMILY_NAME_ATTRIBUTE, - family); + family); CFRelease (family); } traits = CFDictionaryCreateMutable (NULL, 4, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); if (! traits) goto err; @@ -1908,40 +1909,40 @@ { tmp = AREF (spec, numeric_traits[i].index); if (INTEGERP (tmp)) - { - CGPoint *point = numeric_traits[i].points; - CGFloat floatval = (XINT (tmp) >> 8); // XXX - CFNumberRef num; + { + CGPoint *point = numeric_traits[i].points; + CGFloat floatval = (XINT (tmp) >> 8); // XXX + CFNumberRef num; - while (point->y < floatval) - point++; - if (point == numeric_traits[i].points) - point++; - else if (point->y == CGFLOAT_MAX) - point--; - floatval = (point - 1)->x + ((floatval - (point - 1)->y) - * ((point->x - (point - 1)->x) - / (point->y - (point - 1)->y))); - if (floatval > 1.0) - floatval = 1.0; - else if (floatval < -1.0) - floatval = -1.0; - num = CFNumberCreate (NULL, kCFNumberCGFloatType, &floatval); - if (! num) - goto err; - CFDictionaryAddValue (traits, numeric_traits[i].trait, num); - CFRelease (num); - } + while (point->y < floatval) + point++; + if (point == numeric_traits[i].points) + point++; + else if (point->y == CGFLOAT_MAX) + point--; + floatval = (point - 1)->x + ((floatval - (point - 1)->y) + * ((point->x - (point - 1)->x) + / (point->y - (point - 1)->y))); + if (floatval > 1.0) + floatval = 1.0; + else if (floatval < -1.0) + floatval = -1.0; + num = CFNumberCreate (NULL, kCFNumberCGFloatType, &floatval); + if (! num) + goto err; + CFDictionaryAddValue (traits, numeric_traits[i].trait, num); + CFRelease (num); + } } if (CFDictionaryGetCount (traits)) CFDictionaryAddValue (attributes, MAC_FONT_TRAITS_ATTRIBUTE, traits); if (charset) CFDictionaryAddValue (attributes, MAC_FONT_CHARACTER_SET_ATTRIBUTE, - charset); + charset); if (charset_string) CFDictionaryAddValue (attributes, MAC_FONT_CHARACTER_SET_STRING_ATTRIBUTE, - charset_string); + charset_string); if (langarray) CFDictionaryAddValue (attributes, MAC_FONT_LANGUAGES_ATTRIBUTE, langarray); @@ -1962,9 +1963,9 @@ if (otspec) { if (otspec->nfeatures[0] > 0) - free (otspec->features[0]); + free (otspec->features[0]); if (otspec->nfeatures[1] > 0) - free (otspec->features[1]); + free (otspec->features[1]); free (otspec); } @@ -1973,38 +1974,38 @@ static Boolean macfont_supports_charset_and_languages_p (FontDescriptorRef desc, - CFCharacterSetRef charset, - Lisp_Object chars, - CFArrayRef languages) + CFCharacterSetRef charset, + Lisp_Object chars, + CFArrayRef languages) { Boolean result = true; if (charset || VECTORP (chars)) { CFCharacterSetRef desc_charset = - mac_font_descriptor_copy_attribute (desc, - MAC_FONT_CHARACTER_SET_ATTRIBUTE); + mac_font_descriptor_copy_attribute (desc, + MAC_FONT_CHARACTER_SET_ATTRIBUTE); if (desc_charset == NULL) - result = false; + result = false; else - { - if (charset) - result = CFCharacterSetIsSupersetOfSet (desc_charset, charset); - else /* VECTORP (chars) */ - { - ptrdiff_t j; + { + if (charset) + result = CFCharacterSetIsSupersetOfSet (desc_charset, charset); + else /* VECTORP (chars) */ + { + ptrdiff_t j; - for (j = 0; j < ASIZE (chars); j++) - if (TYPE_RANGED_INTEGERP (UTF32Char, AREF (chars, j)) - && CFCharacterSetIsLongCharacterMember (desc_charset, - XFASTINT (AREF (chars, j)))) - break; - if (j == ASIZE (chars)) - result = false; - } - CFRelease (desc_charset); - } + for (j = 0; j < ASIZE (chars); j++) + if (TYPE_RANGED_INTEGERP (UTF32Char, AREF (chars, j)) + && CFCharacterSetIsLongCharacterMember (desc_charset, + XFASTINT (AREF (chars, j)))) + break; + if (j == ASIZE (chars)) + result = false; + } + CFRelease (desc_charset); + } } if (result && languages) result = mac_font_descriptor_supports_languages (desc, languages); @@ -2012,38 +2013,49 @@ return result; } -static CFIndex -macfont_closest_traits_index (CFArrayRef traits_array, - FontSymbolicTraits target) -{ - CFIndex i, result = -1, count = CFArrayGetCount (traits_array); - int min_distance = (1 << 3); +static int +macfont_traits_distance (FontSymbolicTraits sym_traits1, + FontSymbolicTraits sym_traits2) +{ + FontSymbolicTraits diff = (sym_traits1 ^ sym_traits2); + int distance = 0; + + /* We prefer synthetic bold of italic to synthetic italic of bold + when both bold and italic are available but bold-italic is not + available. */ + if (diff & MAC_FONT_TRAIT_BOLD) + distance |= (1 << 0); + if (diff & MAC_FONT_TRAIT_ITALIC) + distance |= (1 << 1); + if (diff & MAC_FONT_TRAIT_MONO_SPACE) + distance |= (1 << 2); + + return distance; +} + +static Boolean +macfont_closest_traits_index_p (CFArrayRef traits_array, + FontSymbolicTraits target, + CFIndex index) +{ + CFIndex i, count = CFArrayGetCount (traits_array); + FontSymbolicTraits traits; + int my_distance; + + traits = ((FontSymbolicTraits) (uintptr_t) + CFArrayGetValueAtIndex (traits_array, index)); + my_distance = macfont_traits_distance (target, traits); for (i = 0; i < count; i++) - { - FontSymbolicTraits traits, diff; - int distance = 0; - - traits = ((FontSymbolicTraits) (uintptr_t) - CFArrayGetValueAtIndex (traits_array, i)); - diff = (target ^ traits); - /* We prefer synthetic bold of italic to synthetic italic of - bold when both bold and italic are available but bold-italic - is not available. */ - if (diff & MAC_FONT_TRAIT_BOLD) - distance |= (1 << 0); - if (diff & MAC_FONT_TRAIT_ITALIC) - distance |= (1 << 1); - if (diff & MAC_FONT_TRAIT_MONO_SPACE) - distance |= (1 << 2); - if (distance < min_distance) - { - min_distance = distance; - result = i; - } - } - - return result; + if (i != index) + { + traits = ((FontSymbolicTraits) (uintptr_t) + CFArrayGetValueAtIndex (traits_array, i)); + if (macfont_traits_distance (target, traits) < my_distance) + return false; + } + + return true; } static Lisp_Object @@ -2068,7 +2080,7 @@ { family_name = macfont_create_family_with_symbol (family); if (family_name == NULL) - goto finish; + goto finish; } attributes = macfont_create_attributes_with_spec (spec); @@ -2081,14 +2093,14 @@ spacing = XINT (AREF (spec, FONT_SPACING_INDEX)); traits = ((CFMutableDictionaryRef) - CFDictionaryGetValue (attributes, MAC_FONT_TRAITS_ATTRIBUTE)); + CFDictionaryGetValue (attributes, MAC_FONT_TRAITS_ATTRIBUTE)); n = FONT_SLANT_NUMERIC (spec); if (n < 0 || n == FONT_SLANT_SYNTHETIC_ITALIC) { synth_sym_traits |= MAC_FONT_TRAIT_ITALIC; if (traits) - CFDictionaryRemoveValue (traits, MAC_FONT_SLANT_TRAIT); + CFDictionaryRemoveValue (traits, MAC_FONT_SLANT_TRAIT); } n = FONT_WEIGHT_NUMERIC (spec); @@ -2096,7 +2108,7 @@ { synth_sym_traits |= MAC_FONT_TRAIT_BOLD; if (traits) - CFDictionaryRemoveValue (traits, MAC_FONT_WEIGHT_TRAIT); + CFDictionaryRemoveValue (traits, MAC_FONT_WEIGHT_TRAIT); } if (languages @@ -2105,15 +2117,15 @@ CFStringRef language = CFArrayGetValueAtIndex (languages, 0); if (CFStringHasPrefix (language, CFSTR ("ja")) - || CFStringHasPrefix (language, CFSTR ("ko")) - || CFStringHasPrefix (language, CFSTR ("zh"))) - synth_sym_traits |= MAC_FONT_TRAIT_MONO_SPACE; + || CFStringHasPrefix (language, CFSTR ("ko")) + || CFStringHasPrefix (language, CFSTR ("zh"))) + synth_sym_traits |= MAC_FONT_TRAIT_MONO_SPACE; } /* Create array of families. */ if (family_name) families = CFArrayCreate (NULL, (const void **) &family_name, - 1, &kCFTypeArrayCallBacks); + 1, &kCFTypeArrayCallBacks); else { CFStringRef pref_family; @@ -2121,46 +2133,46 @@ families = mac_font_create_available_families (); if (families == NULL) - goto err; + goto err; families_count = CFArrayGetCount (families); /* Move preferred family to the front if exists. */ pref_family = - mac_font_create_preferred_family_for_attributes (attributes); + mac_font_create_preferred_family_for_attributes (attributes); if (pref_family) - { - pref_family_index = - CFArrayGetFirstIndexOfValue (families, - CFRangeMake (0, families_count), - pref_family); - CFRelease (pref_family); - } + { + pref_family_index = + CFArrayGetFirstIndexOfValue (families, + CFRangeMake (0, families_count), + pref_family); + CFRelease (pref_family); + } if (pref_family_index > 0) - { - CFMutableArrayRef mutable_families = - CFArrayCreateMutable (NULL, families_count, &kCFTypeArrayCallBacks); + { + CFMutableArrayRef mutable_families = + CFArrayCreateMutable (NULL, families_count, &kCFTypeArrayCallBacks); - if (mutable_families) - { - CFArrayAppendValue (mutable_families, - CFArrayGetValueAtIndex (families, - pref_family_index)); - CFArrayAppendArray (mutable_families, families, - CFRangeMake (0, pref_family_index)); - if (pref_family_index + 1 < families_count) - CFArrayAppendArray (mutable_families, families, - CFRangeMake (pref_family_index + 1, - families_count - - (pref_family_index + 1))); - CFRelease (families); - families = mutable_families; - } - } + if (mutable_families) + { + CFArrayAppendValue (mutable_families, + CFArrayGetValueAtIndex (families, + pref_family_index)); + CFArrayAppendArray (mutable_families, families, + CFRangeMake (0, pref_family_index)); + if (pref_family_index + 1 < families_count) + CFArrayAppendArray (mutable_families, families, + CFRangeMake (pref_family_index + 1, + families_count + - (pref_family_index + 1))); + CFRelease (families); + families = mutable_families; + } + } } charset = CFDictionaryGetValue (attributes, - MAC_FONT_CHARACTER_SET_ATTRIBUTE); + MAC_FONT_CHARACTER_SET_ATTRIBUTE); if (charset) { CFRetain (charset); @@ -2170,11 +2182,11 @@ { val = assq_no_quit (QCscript, AREF (spec, FONT_EXTRA_INDEX)); if (! NILP (val)) - { - val = assq_no_quit (XCDR (val), Vscript_representative_chars); - if (CONSP (val) && VECTORP (XCDR (val))) - chars = XCDR (val); - } + { + val = assq_no_quit (XCDR (val), Vscript_representative_chars); + if (CONSP (val) && VECTORP (XCDR (val))) + chars = XCDR (val); + } val = Qnil; } @@ -2198,151 +2210,152 @@ int j; CFDictionarySetValue (attributes, MAC_FONT_FAMILY_NAME_ATTRIBUTE, - family_name); + family_name); pat_desc = mac_font_descriptor_create_with_attributes (attributes); if (! pat_desc) - goto err; + goto err; /* CTFontDescriptorCreateMatchingFontDescriptors on Mac OS X - 10.7 returns NULL if pat_desc represents the LastResort font. - So we use CTFontDescriptorCreateMatchingFontDescriptor (no - trailing "s") for such a font. */ + 10.7 returns NULL if pat_desc represents the LastResort font. + So we use CTFontDescriptorCreateMatchingFontDescriptor (no + trailing "s") for such a font. */ if (!CFEqual (family_name, CFSTR ("LastResort"))) - descs = mac_font_descriptor_create_matching_font_descriptors (pat_desc, - NULL); + descs = mac_font_descriptor_create_matching_font_descriptors (pat_desc, + NULL); else - { - FontDescriptorRef lr_desc = - mac_font_descriptor_create_matching_font_descriptor (pat_desc, - NULL); - if (lr_desc) - { - descs = CFArrayCreate (NULL, (const void **) &lr_desc, 1, - &kCFTypeArrayCallBacks); - CFRelease (lr_desc); - } - else - descs = NULL; - } + { + FontDescriptorRef lr_desc = + mac_font_descriptor_create_matching_font_descriptor (pat_desc, + NULL); + if (lr_desc) + { + descs = CFArrayCreate (NULL, (const void **) &lr_desc, 1, + &kCFTypeArrayCallBacks); + CFRelease (lr_desc); + } + else + descs = NULL; + } CFRelease (pat_desc); if (! descs) - goto err; + goto err; descs_count = CFArrayGetCount (descs); if (descs_count == 0 - || !macfont_supports_charset_and_languages_p (CFArrayGetValueAtIndex (descs, 0), - charset, chars, - languages)) - { - CFRelease (descs); - continue; - } + || !macfont_supports_charset_and_languages_p (CFArrayGetValueAtIndex (descs, 0), + charset, chars, + languages)) + { + CFRelease (descs); + continue; + } filtered_descs = - CFArrayCreateMutable (NULL, descs_count, &kCFTypeArrayCallBacks); + CFArrayCreateMutable (NULL, descs_count, &kCFTypeArrayCallBacks); traits_array = CFArrayCreateMutable (NULL, descs_count, NULL); for (j = 0; j < descs_count; j++) - { - FontDescriptorRef desc = CFArrayGetValueAtIndex (descs, j); - CFDictionaryRef dict; - CFNumberRef num; - FontSymbolicTraits sym_traits; - - dict = mac_font_descriptor_copy_attribute (desc, - MAC_FONT_TRAITS_ATTRIBUTE); - if (dict == NULL) - continue; - - num = CFDictionaryGetValue (dict, MAC_FONT_SYMBOLIC_TRAIT); - CFRelease (dict); - if (num == NULL - || !cfnumber_get_font_symbolic_traits_value (num, &sym_traits)) - continue; - - if (spacing >= 0 - && !(synth_sym_traits & MAC_FONT_TRAIT_MONO_SPACE) - && (((sym_traits & MAC_FONT_TRAIT_MONO_SPACE) != 0) - != (spacing >= FONT_SPACING_MONO))) - continue; - - /* Don't use a color bitmap font unless its family is - explicitly specified. */ - if ((sym_traits & MAC_FONT_TRAIT_COLOR_GLYPHS) && NILP (family)) - continue; - - if (j > 0 - && !macfont_supports_charset_and_languages_p (desc, charset, - chars, languages)) - continue; - - CFArrayAppendValue (filtered_descs, desc); - CFArrayAppendValue (traits_array, - (const void *) (uintptr_t) sym_traits); - } + { + FontDescriptorRef desc = CFArrayGetValueAtIndex (descs, j); + CFDictionaryRef dict; + CFNumberRef num; + FontSymbolicTraits sym_traits; + + dict = mac_font_descriptor_copy_attribute (desc, + MAC_FONT_TRAITS_ATTRIBUTE); + if (dict == NULL) + continue; + + num = CFDictionaryGetValue (dict, MAC_FONT_SYMBOLIC_TRAIT); + CFRelease (dict); + if (num == NULL + || !cfnumber_get_font_symbolic_traits_value (num, &sym_traits)) + continue; + + if (spacing >= 0 + && !(synth_sym_traits & MAC_FONT_TRAIT_MONO_SPACE) + && (((sym_traits & MAC_FONT_TRAIT_MONO_SPACE) != 0) + != (spacing >= FONT_SPACING_MONO))) + continue; + + /* Don't use a color bitmap font unless its family is + explicitly specified. */ + if ((sym_traits & MAC_FONT_TRAIT_COLOR_GLYPHS) && NILP (family)) + continue; + + if (j > 0 + && !macfont_supports_charset_and_languages_p (desc, charset, + chars, languages)) + continue; + + CFArrayAppendValue (filtered_descs, desc); + CFArrayAppendValue (traits_array, + (const void *) (uintptr_t) sym_traits); + } CFRelease (descs); descs = filtered_descs; descs_count = CFArrayGetCount (descs); for (j = 0; j < descs_count; j++) - { - FontDescriptorRef desc = CFArrayGetValueAtIndex (descs, j); - FontSymbolicTraits sym_traits = - ((FontSymbolicTraits) (uintptr_t) - CFArrayGetValueAtIndex (traits_array, j)); - FontSymbolicTraits mask_min, mask_max, imask, bmask, mmask; - - mask_min = ((synth_sym_traits ^ sym_traits) - & (MAC_FONT_TRAIT_ITALIC | MAC_FONT_TRAIT_BOLD)); - if (FONT_SLANT_NUMERIC (spec) < 0) - mask_min &= ~MAC_FONT_TRAIT_ITALIC; - if (FONT_WEIGHT_NUMERIC (spec) < 0) - mask_min &= ~MAC_FONT_TRAIT_BOLD; - - mask_max = (synth_sym_traits & ~sym_traits); - /* Synthetic bold does not work for bitmap-only fonts on Mac - OS X 10.6. */ - if ((mask_min ^ mask_max) & MAC_FONT_TRAIT_BOLD) - { - CFNumberRef format = - mac_font_descriptor_copy_attribute (desc, - MAC_FONT_FORMAT_ATTRIBUTE); - - if (format) - { - uint32_t format_val; - - if (CFNumberGetValue (format, kCFNumberSInt32Type, - &format_val) - && format_val == MAC_FONT_FORMAT_BITMAP) - mask_max &= ~MAC_FONT_TRAIT_BOLD; - } - } - if (spacing >= 0) - mask_min |= (mask_max & MAC_FONT_TRAIT_MONO_SPACE); - - for (mmask = (mask_min & MAC_FONT_TRAIT_MONO_SPACE); - mmask <= (mask_max & MAC_FONT_TRAIT_MONO_SPACE); - mmask += MAC_FONT_TRAIT_MONO_SPACE) - for (bmask = (mask_min & MAC_FONT_TRAIT_BOLD); - bmask <= (mask_max & MAC_FONT_TRAIT_BOLD); - bmask += MAC_FONT_TRAIT_BOLD) - for (imask = (mask_min & MAC_FONT_TRAIT_ITALIC); - imask <= (mask_max & MAC_FONT_TRAIT_ITALIC); - imask += MAC_FONT_TRAIT_ITALIC) - { - FontSymbolicTraits synth = (imask | bmask | mmask); - - if (synth == 0 - || j == macfont_closest_traits_index (traits_array, - (sym_traits | synth))) - { - entity = macfont_descriptor_entity (desc, extra, synth); - if (! NILP (entity)) - val = Fcons (entity, val); - } - } - } + { + FontDescriptorRef desc = CFArrayGetValueAtIndex (descs, j); + FontSymbolicTraits sym_traits = + ((FontSymbolicTraits) (uintptr_t) + CFArrayGetValueAtIndex (traits_array, j)); + FontSymbolicTraits mask_min, mask_max, imask, bmask, mmask; + + mask_min = ((synth_sym_traits ^ sym_traits) + & (MAC_FONT_TRAIT_ITALIC | MAC_FONT_TRAIT_BOLD)); + if (FONT_SLANT_NUMERIC (spec) < 0) + mask_min &= ~MAC_FONT_TRAIT_ITALIC; + if (FONT_WEIGHT_NUMERIC (spec) < 0) + mask_min &= ~MAC_FONT_TRAIT_BOLD; + + mask_max = (synth_sym_traits & ~sym_traits); + /* Synthetic bold does not work for bitmap-only fonts on Mac + OS X 10.6. */ + if ((mask_min ^ mask_max) & MAC_FONT_TRAIT_BOLD) + { + CFNumberRef format = + mac_font_descriptor_copy_attribute (desc, + MAC_FONT_FORMAT_ATTRIBUTE); + + if (format) + { + uint32_t format_val; + + if (CFNumberGetValue (format, kCFNumberSInt32Type, + &format_val) + && format_val == MAC_FONT_FORMAT_BITMAP) + mask_max &= ~MAC_FONT_TRAIT_BOLD; + } + } + if (spacing >= 0) + mask_min |= (mask_max & MAC_FONT_TRAIT_MONO_SPACE); + + for (mmask = (mask_min & MAC_FONT_TRAIT_MONO_SPACE); + mmask <= (mask_max & MAC_FONT_TRAIT_MONO_SPACE); + mmask += MAC_FONT_TRAIT_MONO_SPACE) + for (bmask = (mask_min & MAC_FONT_TRAIT_BOLD); + bmask <= (mask_max & MAC_FONT_TRAIT_BOLD); + bmask += MAC_FONT_TRAIT_BOLD) + for (imask = (mask_min & MAC_FONT_TRAIT_ITALIC); + imask <= (mask_max & MAC_FONT_TRAIT_ITALIC); + imask += MAC_FONT_TRAIT_ITALIC) + { + FontSymbolicTraits synth = (imask | bmask | mmask); + + if (synth == 0 + || macfont_closest_traits_index_p (traits_array, + (sym_traits | synth), + j)) + { + entity = macfont_descriptor_entity (desc, extra, synth); + if (! NILP (entity)) + val = Fcons (entity, val); + } + } + } CFRelease (traits_array); CFRelease (descs); @@ -2384,13 +2397,13 @@ if (pat_desc) { desc = mac_font_descriptor_create_matching_font_descriptor (pat_desc, - NULL); + NULL); CFRelease (pat_desc); } if (desc) { entity = macfont_descriptor_entity (desc, AREF (spec, FONT_EXTRA_INDEX), - 0); + 0); CFRelease (desc); } unblock_input (); @@ -2413,7 +2426,7 @@ CFIndex i, count = CFArrayGetCount (families); for (i = 0; i < count; i++) - list = Fcons (macfont_intern_prop_cfstring (CFArrayGetValueAtIndex (families, i)), list); + list = Fcons (macfont_intern_prop_cfstring (CFArrayGetValueAtIndex (families, i)), list); CFRelease (families); } @@ -2426,7 +2439,7 @@ macfont_free_entity (Lisp_Object entity) { Lisp_Object val = assq_no_quit (QCfont_entity, - AREF (entity, FONT_EXTRA_INDEX)); + AREF (entity, FONT_EXTRA_INDEX)); CFStringRef name = XSAVE_POINTER (XCDR (val), 0); block_input (); @@ -2444,7 +2457,8 @@ int size; FontRef macfont; FontSymbolicTraits sym_traits; - int i, total_width; + char name[256]; + int len, i, total_width; CGGlyph glyph; CGFloat ascent, descent, leading; @@ -2472,7 +2486,7 @@ return Qnil; font_object = font_build_object (VECSIZE (struct macfont_info), - Qmac_ct, entity, size); + Qmac_ct, entity, size); font = XFONT_OBJECT (font_object); font->pixel_size = size; font->driver = &macfont_driver; @@ -2487,7 +2501,7 @@ val = assq_no_quit (QCdestination, AREF (entity, FONT_EXTRA_INDEX)); if (CONSP (val) && EQ (XCDR (val), make_number (1))) macfont_info->screen_font = mac_screen_font_create_with_name (font_name, - size); + size); else macfont_info->screen_font = NULL; macfont_info->cache = macfont_lookup_cache (font_name); @@ -2507,8 +2521,8 @@ if (sym_traits & MAC_FONT_TRAIT_MONO_SPACE) macfont_info->spacing = MACFONT_SPACING_MONO; else if (INTEGERP (AREF (entity, FONT_SPACING_INDEX)) - && (XINT (AREF (entity, FONT_SPACING_INDEX)) - == FONT_SPACING_SYNTHETIC_MONO)) + && (XINT (AREF (entity, FONT_SPACING_INDEX)) + == FONT_SPACING_SYNTHETIC_MONO)) macfont_info->spacing = MACFONT_SPACING_SYNTHETIC_MONO; if (macfont_info->synthetic_italic_p || macfont_info->synthetic_bold_p) macfont_info->antialias = MACFONT_ANTIALIAS_ON; @@ -2516,8 +2530,8 @@ { val = assq_no_quit (QCantialias, AREF (entity, FONT_EXTRA_INDEX)); if (CONSP (val)) - macfont_info->antialias = - NILP (XCDR (val)) ? MACFONT_ANTIALIAS_OFF : MACFONT_ANTIALIAS_ON; + macfont_info->antialias = + NILP (XCDR (val)) ? MACFONT_ANTIALIAS_OFF : MACFONT_ANTIALIAS_ON; } macfont_info->color_bitmap_p = 0; if (sym_traits & MAC_FONT_TRAIT_COLOR_GLYPHS) @@ -2535,7 +2549,7 @@ { glyph = macfont_get_glyph_for_character (font, ' ' + i); if (glyph == kCGFontIndexInvalid) - break; + break; total_width += macfont_glyph_extents (font, glyph, NULL, NULL, 0); } if (i == 95) @@ -2544,8 +2558,8 @@ font->average_width = font->space_width; /* XXX */ if (!(macfont_info->screen_font - && mac_screen_font_get_metrics (macfont_info->screen_font, - &ascent, &descent, &leading))) + && mac_screen_font_get_metrics (macfont_info->screen_font, + &ascent, &descent, &leading))) { CFStringRef family_name; @@ -2553,21 +2567,21 @@ descent = mac_font_get_descent (macfont); leading = mac_font_get_leading (macfont); /* AppKit and WebKit do some adjustment to the heights of - Courier, Helvetica, and Times. */ + Courier, Helvetica, and Times. */ family_name = mac_font_copy_family_name (macfont); if (family_name) - { - if (CFEqual (family_name, CFSTR ("Courier")) - || CFEqual (family_name, CFSTR ("Helvetica")) - || CFEqual (family_name, CFSTR ("Times"))) - ascent += (ascent + descent) * .15f; - else if (CFStringHasPrefix (family_name, CFSTR ("Hiragino"))) - { - leading *= .25f; - ascent += leading; - } - CFRelease (family_name); - } + { + if (CFEqual (family_name, CFSTR ("Courier")) + || CFEqual (family_name, CFSTR ("Helvetica")) + || CFEqual (family_name, CFSTR ("Times"))) + ascent += (ascent + descent) * .15f; + else if (CFStringHasPrefix (family_name, CFSTR ("Hiragino"))) + { + leading *= .25f; + ascent += leading; + } + CFRelease (family_name); + } } font->ascent = ascent + 0.5f; val = assq_no_quit (QCminspace, AREF (entity, FONT_EXTRA_INDEX)); @@ -2607,13 +2621,13 @@ CFRelease (macfont_info->macfont); CGFontRelease (macfont_info->cgfont); if (macfont_info->screen_font) - CFRelease (macfont_info->screen_font); + CFRelease (macfont_info->screen_font); macfont_release_cache (macfont_info->cache); for (i = 0; i < macfont_info->metrics_nrows; i++) - if (macfont_info->metrics[i]) - xfree (macfont_info->metrics[i]); + if (macfont_info->metrics[i]) + xfree (macfont_info->metrics[i]); if (macfont_info->metrics) - xfree (macfont_info->metrics); + xfree (macfont_info->metrics); macfont_info->cache = NULL; unblock_input (); } @@ -2659,8 +2673,8 @@ } static void -macfont_text_extents (struct font *font, unsigned int *code, - int nglyphs, struct font_metrics *metrics) +macfont_text_extents (struct font *font, unsigned int *code, int nglyphs, + struct font_metrics *metrics) { int width, i; @@ -2669,26 +2683,31 @@ for (i = 1; i < nglyphs; i++) { struct font_metrics m; - int w = macfont_glyph_extents (font, code[i], &m, NULL, 0); + int w = macfont_glyph_extents (font, code[i], metrics ? &m : NULL, + NULL, 0); - if (width + m.lbearing < metrics->lbearing) - metrics->lbearing = width + m.lbearing; - if (width + m.rbearing > metrics->rbearing) - metrics->rbearing = width + m.rbearing; - if (m.ascent > metrics->ascent) - metrics->ascent = m.ascent; - if (m.descent > metrics->descent) - metrics->descent = m.descent; + if (metrics) + { + if (width + m.lbearing < metrics->lbearing) + metrics->lbearing = width + m.lbearing; + if (width + m.rbearing > metrics->rbearing) + metrics->rbearing = width + m.rbearing; + if (m.ascent > metrics->ascent) + metrics->ascent = m.ascent; + if (m.descent > metrics->descent) + metrics->descent = m.descent; + } width += w; } unblock_input (); - metrics->width = width; + if (metrics) + metrics->width = width; } static int macfont_draw (struct glyph_string *s, int from, int to, int x, int y, - bool with_background) + bool with_background) { struct frame * f = s->f; struct macfont_info *macfont_info = (struct macfont_info *) s->font; @@ -2700,7 +2719,7 @@ bool no_antialias_p = (macfont_info->antialias == MACFONT_ANTIALIAS_OFF || (macfont_info->antialias == MACFONT_ANTIALIAS_DEFAULT - && font_size <= macfont_antialias_threshold)); + && font_size <= macfont_antialias_threshold)); int len = to - from; struct face *face = s->face; CGContextRef context; @@ -2710,29 +2729,29 @@ if (with_background) background_rect = CGRectMake (x, y - FONT_BASE (s->font), s->width, FONT_HEIGHT (s->font)); - else + else background_rect = CGRectNull; text_position = CGPointMake (x, -y); glyphs = xmalloc (sizeof (CGGlyph) * len); { - CGFloat advance_delta; + CGFloat advance_delta = 0; int i; CGFloat total_width = 0; positions = xmalloc (sizeof (CGPoint) * len); for (i = 0; i < len; i++) { - int width; + int width; - glyphs[i] = s->char2b[from + i]; - width = (s->padding_p ? 1 - : macfont_glyph_extents (s->font, glyphs[i], - NULL, &advance_delta, - no_antialias_p)); - positions[i].x = total_width + advance_delta; - positions[i].y = 0; - total_width += width; + glyphs[i] = s->char2b[from + i]; + width = (s->padding_p ? 1 + : macfont_glyph_extents (s->font, glyphs[i], + NULL, &advance_delta, + no_antialias_p)); + positions[i].x = total_width + advance_delta; + positions[i].y = 0; + total_width += width; } } @@ -2750,24 +2769,25 @@ CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face, f); CGContextFillRects (context, &background_rect, 1); } - + if (macfont_info->cgfont) { CGAffineTransform atfm; + CGContextScaleCTM (context, 1, -1); CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face, s->f); if (macfont_info->synthetic_italic_p) - atfm = synthetic_italic_atfm; + atfm = synthetic_italic_atfm; else - atfm = CGAffineTransformIdentity; + atfm = CGAffineTransformIdentity; if (macfont_info->synthetic_bold_p) - { - CGContextSetTextDrawingMode (context, kCGTextFillStroke); - CGContextSetLineWidth (context, synthetic_bold_factor * font_size); - CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND (context, face, f); - } + { + CGContextSetTextDrawingMode (context, kCGTextFillStroke); + CGContextSetLineWidth (context, synthetic_bold_factor * font_size); + CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND (context, face, f); + } if (no_antialias_p) - CGContextSetShouldAntialias (context, false); + CGContextSetShouldAntialias (context, false); CGContextSetTextMatrix (context, atfm); CGContextSetTextPosition (context, text_position.x, text_position.y); @@ -2775,23 +2795,23 @@ #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 if (macfont_info->color_bitmap_p #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 - && CTFontDrawGlyphs != NULL + && CTFontDrawGlyphs != NULL #endif - ) - { - if (len > 0) - { - CTFontDrawGlyphs (macfont_info->macfont, glyphs, positions, len, + ) + { + if (len > 0) + { + CTFontDrawGlyphs (macfont_info->macfont, glyphs, positions, len, context); - } - } + } + } else #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 */ - { - CGContextSetFont (context, macfont_info->cgfont); - CGContextSetFontSize (context, font_size); - CGContextShowGlyphsAtPositions (context, glyphs, positions, len); - } + { + CGContextSetFont (context, macfont_info->cgfont); + CGContextSetFontSize (context, font_size); + CGContextShowGlyphsAtPositions (context, glyphs, positions, len); + } } @@ -2829,9 +2849,9 @@ Lisp_Object lglyph = LGSTRING_GLYPH (lgstring, i); if (NILP (lglyph)) - break; + break; if (LGLYPH_CHAR (lglyph) >= 0x10000) - nonbmp_len++; + nonbmp_len++; } len = i; @@ -2846,25 +2866,25 @@ UTF32Char c = LGLYPH_CHAR (LGSTRING_GLYPH (lgstring, i)); if (macfont_store_utf32char_to_unichars (c, unichars + i + j) > 1) - { - nonbmp_indices[j] = i + j; - j++; - } + { + nonbmp_indices[j] = i + j; + j++; + } } nonbmp_indices[j] = len + j; /* sentinel */ block_input (); string = CFStringCreateWithCharactersNoCopy (NULL, unichars, len + nonbmp_len, - kCFAllocatorNull); + kCFAllocatorNull); if (string) { glyph_layouts = alloca (sizeof (struct mac_glyph_layout) * glyph_len); if (macfont_info->screen_font) - used = mac_screen_font_shape (macfont_info->screen_font, string, - glyph_layouts, glyph_len); + used = mac_screen_font_shape (macfont_info->screen_font, string, + glyph_layouts, glyph_len); else - used = mac_font_shape (macfont, string, glyph_layouts, glyph_len); + used = mac_font_shape (macfont, string, glyph_layouts, glyph_len); CFRelease (string); } @@ -2884,40 +2904,40 @@ int xoff, yoff, wadjust; if (NILP (lglyph)) - { - lglyph = Fmake_vector (make_number (LGLYPH_SIZE), Qnil); - LGSTRING_SET_GLYPH (lgstring, i, lglyph); - } + { + lglyph = Fmake_vector (make_number (LGLYPH_SIZE), Qnil); + LGSTRING_SET_GLYPH (lgstring, i, lglyph); + } from = gl->comp_range.location; /* Convert UTF-16 index to UTF-32. */ j = 0; while (nonbmp_indices[j] < from) - j++; + j++; from -= j; LGLYPH_SET_FROM (lglyph, from); to = gl->comp_range.location + gl->comp_range.length; /* Convert UTF-16 index to UTF-32. */ while (nonbmp_indices[j] < to) - j++; + j++; to -= j; LGLYPH_SET_TO (lglyph, to - 1); /* LGLYPH_CHAR is used in `describe-char' for checking whether - the composition is trivial. */ + the composition is trivial. */ { - UTF32Char c; + UTF32Char c; - if (unichars[gl->string_index] >= 0xD800 - && unichars[gl->string_index] < 0xDC00) - c = (((unichars[gl->string_index] - 0xD800) << 10) - + (unichars[gl->string_index + 1] - 0xDC00) + 0x10000); - else - c = unichars[gl->string_index]; - if (macfont_get_glyph_for_character (font, c) != gl->glyph_id) - c = 0; - LGLYPH_SET_CHAR (lglyph, c); + if (unichars[gl->string_index] >= 0xD800 + && unichars[gl->string_index] < 0xDC00) + c = (((unichars[gl->string_index] - 0xD800) << 10) + + (unichars[gl->string_index + 1] - 0xDC00) + 0x10000); + else + c = unichars[gl->string_index]; + if (macfont_get_glyph_for_character (font, c) != gl->glyph_id) + c = 0; + LGLYPH_SET_CHAR (lglyph, c); } { @@ -2936,15 +2956,15 @@ yoff = lround (- gl->baseline_delta); wadjust = lround (gl->advance); if (xoff != 0 || yoff != 0 || wadjust != metrics.width) - { - Lisp_Object vec; + { + Lisp_Object vec; - vec = Fmake_vector (make_number (3), Qnil); - ASET (vec, 0, make_number (xoff)); - ASET (vec, 1, make_number (yoff)); - ASET (vec, 2, make_number (wadjust)); - LGLYPH_SET_ADJUSTMENT (lglyph, vec); - } + vec = Fmake_vector (make_number (3), Qnil); + ASET (vec, 0, make_number (xoff)); + ASET (vec, 1, make_number (yoff)); + ASET (vec, 2, make_number (wadjust)); + LGLYPH_SET_ADJUSTMENT (lglyph, vec); + } } unblock_input (); @@ -2967,7 +2987,7 @@ UInt32 length, num_var_selector_records; struct variation_selector_record variation_selector_records[1]; }; -#define SIZEOF_UVS_TABLE_HEADER \ +#define SIZEOF_UVS_TABLE_HEADER \ (sizeof (struct uvs_table) - sizeof (struct variation_selector_record)) struct unicode_value_range @@ -2979,7 +2999,7 @@ UInt32 num_unicode_value_ranges; struct unicode_value_range unicode_value_ranges[1]; }; -#define SIZEOF_DEFAULT_UVS_TABLE_HEADER \ +#define SIZEOF_DEFAULT_UVS_TABLE_HEADER \ (sizeof (struct default_uvs_table) - sizeof (struct unicode_value_range)) struct uvs_mapping @@ -2992,7 +3012,7 @@ UInt32 num_uvs_mappings; struct uvs_mapping uvs_mappings[1]; }; -#define SIZEOF_NON_DEFAULT_UVS_TABLE_HEADER \ +#define SIZEOF_NON_DEFAULT_UVS_TABLE_HEADER \ (sizeof (struct non_default_uvs_table) - sizeof (struct uvs_mapping)) #pragma pack(pop) @@ -3024,98 +3044,98 @@ #if __LP64__ if (CFDataGetLength (cmap_table) > UINT32_MAX) - goto finish; + goto finish; #endif cmap_len = CFDataGetLength (cmap_table); if (sizeof_sfntCMapHeader > cmap_len) - goto finish; + goto finish; ntables = BUINT16_VALUE (cmap->numTables); if (ntables > ((cmap_len - sizeof_sfntCMapHeader) - / sizeof_sfntCMapEncoding)) - goto finish; + / sizeof_sfntCMapEncoding)) + goto finish; for (i = 0; i < ntables; i++) - if ((BUINT16_VALUE (cmap->encoding[i].platformID) - == kFontUnicodePlatform) - && (BUINT16_VALUE (cmap->encoding[i].scriptID) - == 5)) /* kFontUnicodeV4_0VariationSequenceSemantics */ - { - uvs_offset = BUINT32_VALUE (cmap->encoding[i].offset); - break; - } + if ((BUINT16_VALUE (cmap->encoding[i].platformID) + == kFontUnicodePlatform) + && (BUINT16_VALUE (cmap->encoding[i].scriptID) + == 5)) /* kFontUnicodeV4_0VariationSequenceSemantics */ + { + uvs_offset = BUINT32_VALUE (cmap->encoding[i].offset); + break; + } if (i == ntables - || uvs_offset > cmap_len - || SIZEOF_UVS_TABLE_HEADER > cmap_len - uvs_offset) - goto finish; + || uvs_offset > cmap_len + || SIZEOF_UVS_TABLE_HEADER > cmap_len - uvs_offset) + goto finish; uvs = (struct uvs_table *) ((UInt8 *) cmap + uvs_offset); uvs_len = BUINT32_VALUE (uvs->length); if (uvs_len > cmap_len - uvs_offset - || SIZEOF_UVS_TABLE_HEADER > uvs_len) - goto finish; + || SIZEOF_UVS_TABLE_HEADER > uvs_len) + goto finish; if (BUINT16_VALUE (uvs->format) != 14) - goto finish; + goto finish; nrecords = BUINT32_VALUE (uvs->num_var_selector_records); if (nrecords > ((uvs_len - SIZEOF_UVS_TABLE_HEADER) - / sizeof (struct variation_selector_record))) - goto finish; + / sizeof (struct variation_selector_record))) + goto finish; records = uvs->variation_selector_records; for (i = 0; i < nrecords; i++) - { - UInt32 default_uvs_offset, non_default_uvs_offset; - - default_uvs_offset = BUINT32_VALUE (records[i].default_uvs_offset); - if (default_uvs_offset) - { - struct default_uvs_table *default_uvs; - UInt32 nranges; - - if (default_uvs_offset > uvs_len - || (SIZEOF_DEFAULT_UVS_TABLE_HEADER - > uvs_len - default_uvs_offset)) - goto finish; - - default_uvs = ((struct default_uvs_table *) - ((UInt8 *) uvs + default_uvs_offset)); - nranges = BUINT32_VALUE (default_uvs->num_unicode_value_ranges); - if (nranges > ((uvs_len - default_uvs_offset - - SIZEOF_DEFAULT_UVS_TABLE_HEADER) - / sizeof (struct unicode_value_range))) - goto finish; - /* Now 2 * nranges can't overflow, so we can safely use - `(lo + hi) / 2' instead of `lo + (hi - lo) / 2' in - mac_font_get_glyphs_for_variants. */ - } - - non_default_uvs_offset = - BUINT32_VALUE (records[i].non_default_uvs_offset); - if (non_default_uvs_offset) - { - struct non_default_uvs_table *non_default_uvs; - UInt32 nmappings; - - if (non_default_uvs_offset > uvs_len - || (SIZEOF_NON_DEFAULT_UVS_TABLE_HEADER - > uvs_len - non_default_uvs_offset)) - goto finish; - - non_default_uvs = ((struct non_default_uvs_table *) - ((UInt8 *) uvs + non_default_uvs_offset)); - nmappings = BUINT32_VALUE (non_default_uvs->num_uvs_mappings); - if (nmappings > ((uvs_len - non_default_uvs_offset - - SIZEOF_NON_DEFAULT_UVS_TABLE_HEADER) - / sizeof (struct uvs_mapping))) - goto finish; - /* Now 2 * nmappings can't overflow, so we can safely - use `(lo + hi) / 2' instead of `lo + (hi - lo) / 2' - in mac_font_get_glyphs_for_variants. */ - } - } + { + UInt32 default_uvs_offset, non_default_uvs_offset; + + default_uvs_offset = BUINT32_VALUE (records[i].default_uvs_offset); + if (default_uvs_offset) + { + struct default_uvs_table *default_uvs; + UInt32 nranges; + + if (default_uvs_offset > uvs_len + || (SIZEOF_DEFAULT_UVS_TABLE_HEADER + > uvs_len - default_uvs_offset)) + goto finish; + + default_uvs = ((struct default_uvs_table *) + ((UInt8 *) uvs + default_uvs_offset)); + nranges = BUINT32_VALUE (default_uvs->num_unicode_value_ranges); + if (nranges > ((uvs_len - default_uvs_offset + - SIZEOF_DEFAULT_UVS_TABLE_HEADER) + / sizeof (struct unicode_value_range))) + goto finish; + /* Now 2 * nranges can't overflow, so we can safely use + `(lo + hi) / 2' instead of `lo + (hi - lo) / 2' in + mac_font_get_glyphs_for_variants. */ + } + + non_default_uvs_offset = + BUINT32_VALUE (records[i].non_default_uvs_offset); + if (non_default_uvs_offset) + { + struct non_default_uvs_table *non_default_uvs; + UInt32 nmappings; + + if (non_default_uvs_offset > uvs_len + || (SIZEOF_NON_DEFAULT_UVS_TABLE_HEADER + > uvs_len - non_default_uvs_offset)) + goto finish; + + non_default_uvs = ((struct non_default_uvs_table *) + ((UInt8 *) uvs + non_default_uvs_offset)); + nmappings = BUINT32_VALUE (non_default_uvs->num_uvs_mappings); + if (nmappings > ((uvs_len - non_default_uvs_offset + - SIZEOF_NON_DEFAULT_UVS_TABLE_HEADER) + / sizeof (struct uvs_mapping))) + goto finish; + /* Now 2 * nmappings can't overflow, so we can safely + use `(lo + hi) / 2' instead of `lo + (hi - lo) / 2' + in mac_font_get_glyphs_for_variants. */ + } + } uvs_table = CFDataCreate (NULL, (UInt8 *) uvs, uvs_len); @@ -3138,8 +3158,8 @@ static void mac_font_get_glyphs_for_variants (CFDataRef uvs_table, UTF32Char c, - const UTF32Char selectors[], CGGlyph glyphs[], - CFIndex count) + const UTF32Char selectors[], CGGlyph glyphs[], + CFIndex count) { struct uvs_table *uvs = (struct uvs_table *) CFDataGetBytePtr (uvs_table); struct variation_selector_record *records = uvs->variation_selector_records; @@ -3159,76 +3179,76 @@ UInt32 default_uvs_offset, non_default_uvs_offset; if (selectors[i] < BUINT24_VALUE (records[ir].var_selector)) - { - glyphs[i++] = kCGFontIndexInvalid; - continue; - } + { + glyphs[i++] = kCGFontIndexInvalid; + continue; + } else if (selectors[i] > BUINT24_VALUE (records[ir].var_selector)) - { - ir++; - continue; - } + { + ir++; + continue; + } /* selectors[i] == BUINT24_VALUE (records[ir].var_selector) */ default_uvs_offset = BUINT32_VALUE (records[ir].default_uvs_offset); non_default_uvs_offset = - BUINT32_VALUE (records[ir].non_default_uvs_offset); + BUINT32_VALUE (records[ir].non_default_uvs_offset); #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 dispatch_group_async (group, queue, ^{ #endif - glyphs[i] = kCGFontIndexInvalid; - - if (default_uvs_offset) - { - struct default_uvs_table *default_uvs = - (struct default_uvs_table *) ((UInt8 *) uvs - + default_uvs_offset); - struct unicode_value_range *ranges = - default_uvs->unicode_value_ranges; - UInt32 lo, hi; - - lo = 0; - hi = BUINT32_VALUE (default_uvs->num_unicode_value_ranges); - while (lo < hi) - { - UInt32 mid = (lo + hi) / 2; - - if (c < BUINT24_VALUE (ranges[mid].start_unicode_value)) - hi = mid; - else - lo = mid + 1; - } - if (hi > 0 - && (c <= (BUINT24_VALUE (ranges[hi - 1].start_unicode_value) - + BUINT8_VALUE (ranges[hi - 1].additional_count)))) - glyphs[i] = 0; - } - - if (glyphs[i] == kCGFontIndexInvalid && non_default_uvs_offset) - { - struct non_default_uvs_table *non_default_uvs = - (struct non_default_uvs_table *) ((UInt8 *) uvs - + non_default_uvs_offset); - struct uvs_mapping *mappings = non_default_uvs->uvs_mappings; - UInt32 lo, hi; - - lo = 0; - hi = BUINT32_VALUE (non_default_uvs->num_uvs_mappings); - while (lo < hi) - { - UInt32 mid = (lo + hi) / 2; - - if (c < BUINT24_VALUE (mappings[mid].unicode_value)) - hi = mid; - else - lo = mid + 1; - } - if (hi > 0 && - BUINT24_VALUE (mappings[hi - 1].unicode_value) == c) - glyphs[i] = BUINT16_VALUE (mappings[hi - 1].glyph_id); - } + glyphs[i] = kCGFontIndexInvalid; + + if (default_uvs_offset) + { + struct default_uvs_table *default_uvs = + (struct default_uvs_table *) ((UInt8 *) uvs + + default_uvs_offset); + struct unicode_value_range *ranges = + default_uvs->unicode_value_ranges; + UInt32 lo, hi; + + lo = 0; + hi = BUINT32_VALUE (default_uvs->num_unicode_value_ranges); + while (lo < hi) + { + UInt32 mid = (lo + hi) / 2; + + if (c < BUINT24_VALUE (ranges[mid].start_unicode_value)) + hi = mid; + else + lo = mid + 1; + } + if (hi > 0 + && (c <= (BUINT24_VALUE (ranges[hi - 1].start_unicode_value) + + BUINT8_VALUE (ranges[hi - 1].additional_count)))) + glyphs[i] = 0; + } + + if (glyphs[i] == kCGFontIndexInvalid && non_default_uvs_offset) + { + struct non_default_uvs_table *non_default_uvs = + (struct non_default_uvs_table *) ((UInt8 *) uvs + + non_default_uvs_offset); + struct uvs_mapping *mappings = non_default_uvs->uvs_mappings; + UInt32 lo, hi; + + lo = 0; + hi = BUINT32_VALUE (non_default_uvs->num_uvs_mappings); + while (lo < hi) + { + UInt32 mid = (lo + hi) / 2; + + if (c < BUINT24_VALUE (mappings[mid].unicode_value)) + hi = mid; + else + lo = mid + 1; + } + if (hi > 0 && + BUINT24_VALUE (mappings[hi - 1].unicode_value) == c) + glyphs[i] = BUINT16_VALUE (mappings[hi - 1].glyph_id); + } #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - }); + }); #endif i++; ir++; @@ -3257,26 +3277,26 @@ CGGlyph glyphs[256]; for (i = 0; i < 16; i++) - selectors[i] = 0xFE00 + i; + selectors[i] = 0xFE00 + i; for (; i < 256; i++) - selectors[i] = 0xE0100 + (i - 16); + selectors[i] = 0xE0100 + (i - 16); mac_font_get_glyphs_for_variants (uvs_table, c, selectors, glyphs, 256); for (i = 0; i < 256; i++) - { - CGGlyph glyph = glyphs[i]; + { + CGGlyph glyph = glyphs[i]; - if (uvs_collection != MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING - && glyph != kCGFontIndexInvalid) - glyph = macfont_get_glyph_for_cid (font, uvs_collection, glyph); - if (glyph == kCGFontIndexInvalid) - variations[i] = 0; - else - { - variations[i] = (glyph ? glyph - : macfont_get_glyph_for_character (font, c)); - n++; - } - } + if (uvs_collection != MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING + && glyph != kCGFontIndexInvalid) + glyph = macfont_get_glyph_for_cid (font, uvs_collection, glyph); + if (glyph == kCGFontIndexInvalid) + variations[i] = 0; + else + { + variations[i] = (glyph ? glyph + : macfont_get_glyph_for_character (font, c)); + n++; + } + } } unblock_input (); @@ -3304,7 +3324,7 @@ static Boolean mac_ctfont_descriptor_supports_languages (CTFontDescriptorRef descriptor, - CFArrayRef languages) + CFArrayRef languages) { Boolean result = true; CFArrayRef desc_languages = @@ -3319,13 +3339,13 @@ desc_languages_count = CFArrayGetCount (desc_languages); languages_count = CFArrayGetCount (languages); for (i = 0; i < languages_count; i++) - if (!CFArrayContainsValue (desc_languages, - CFRangeMake (0, desc_languages_count), - CFArrayGetValueAtIndex (languages, i))) - { - result = false; - break; - } + if (!CFArrayContainsValue (desc_languages, + CFRangeMake (0, desc_languages_count), + CFArrayGetValueAtIndex (languages, i))) + { + result = false; + break; + } CFRelease (desc_languages); } @@ -3343,79 +3363,79 @@ { CFStringRef keys[] = { #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 - kCTLanguageAttributeName + kCTLanguageAttributeName #else - CFSTR ("NSLanguage") + CFSTR ("NSLanguage") #endif }; CFTypeRef values[] = {NULL}; CFIndex num_values = 0; CFArrayRef languages - = CFDictionaryGetValue (attributes, MAC_FONT_LANGUAGES_ATTRIBUTE); + = CFDictionaryGetValue (attributes, MAC_FONT_LANGUAGES_ATTRIBUTE); if (languages && CFArrayGetCount (languages) > 0) - { - if (CTGetCoreTextVersion () >= kCTVersionNumber10_9) - values[num_values++] = CFArrayGetValueAtIndex (languages, 0); - else - { - CFCharacterSetRef charset = - CFDictionaryGetValue (attributes, - MAC_FONT_CHARACTER_SET_ATTRIBUTE); + { + if (CTGetCoreTextVersion () >= kCTVersionNumber10_9) + values[num_values++] = CFArrayGetValueAtIndex (languages, 0); + else + { + CFCharacterSetRef charset = + CFDictionaryGetValue (attributes, + MAC_FONT_CHARACTER_SET_ATTRIBUTE); - result = mac_font_copy_default_name_for_charset_and_languages (charset, languages); - } - } + result = mac_font_copy_default_name_for_charset_and_languages (charset, languages); + } + } if (result == NULL) - { - CFAttributedStringRef attr_string = NULL; - CTLineRef ctline = NULL; - CFDictionaryRef attrs - = CFDictionaryCreate (NULL, (const void **) keys, - (const void **) values, num_values, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - - if (attrs) - { - attr_string = CFAttributedStringCreate (NULL, charset_string, - attrs); - CFRelease (attrs); - } - if (attr_string) - { - ctline = CTLineCreateWithAttributedString (attr_string); - CFRelease (attr_string); - } - if (ctline) - { - CFArrayRef runs = CTLineGetGlyphRuns (ctline); - CFIndex i, nruns = CFArrayGetCount (runs); - CTFontRef font; - - for (i = 0; i < nruns; i++) - { - CTRunRef run = CFArrayGetValueAtIndex (runs, i); - CFDictionaryRef attributes = CTRunGetAttributes (run); - CTFontRef font_in_run; - - if (attributes == NULL) - break; - font_in_run = - CFDictionaryGetValue (attributes, kCTFontAttributeName); - if (font_in_run == NULL) - break; - if (i == 0) - font = font_in_run; - else if (!mac_ctfont_equal_in_postscript_name (font, - font_in_run)) - break; - } - if (nruns > 0 && i == nruns) - result = CTFontCopyAttribute (font, kCTFontFamilyNameAttribute); - CFRelease (ctline); - } - } + { + CFAttributedStringRef attr_string = NULL; + CTLineRef ctline = NULL; + CFDictionaryRef attrs + = CFDictionaryCreate (NULL, (const void **) keys, + (const void **) values, num_values, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + + if (attrs) + { + attr_string = CFAttributedStringCreate (NULL, charset_string, + attrs); + CFRelease (attrs); + } + if (attr_string) + { + ctline = CTLineCreateWithAttributedString (attr_string); + CFRelease (attr_string); + } + if (ctline) + { + CFArrayRef runs = CTLineGetGlyphRuns (ctline); + CFIndex i, nruns = CFArrayGetCount (runs); + CTFontRef font; + + for (i = 0; i < nruns; i++) + { + CTRunRef run = CFArrayGetValueAtIndex (runs, i); + CFDictionaryRef attributes = CTRunGetAttributes (run); + CTFontRef font_in_run; + + if (attributes == NULL) + break; + font_in_run = + CFDictionaryGetValue (attributes, kCTFontAttributeName); + if (font_in_run == NULL) + break; + if (i == 0) + font = font_in_run; + else if (!mac_ctfont_equal_in_postscript_name (font, + font_in_run)) + break; + } + if (nruns > 0 && i == nruns) + result = CTFontCopyAttribute (font, kCTFontFamilyNameAttribute); + CFRelease (ctline); + } + } } return result; @@ -3425,14 +3445,14 @@ mac_ctfont_get_advance_width_for_glyph (CTFontRef font, CGGlyph glyph) { return CTFontGetAdvancesForGlyphs (font, kCTFontDefaultOrientation, - &glyph, NULL, 1); + &glyph, NULL, 1); } static inline CGRect mac_ctfont_get_bounding_rect_for_glyph (CTFontRef font, CGGlyph glyph) { return CTFontGetBoundingRectsForGlyphs (font, kCTFontDefaultOrientation, - &glyph, NULL, 1); + &glyph, NULL, 1); } static CFArrayRef @@ -3448,24 +3468,24 @@ CFArrayRef orig_families = CTFontManagerCopyAvailableFontFamilyNames (); if (orig_families) - { - CFIndex i, count = CFArrayGetCount (orig_families); - - families = CFArrayCreateMutable (NULL, count, &kCFTypeArrayCallBacks); - if (families) - for (i = 0; i < count; i++) - { - CFStringRef family = CFArrayGetValueAtIndex (orig_families, i); - - if (!CFStringHasPrefix (family, CFSTR (".")) - && (CTFontManagerCompareFontFamilyNames (family, - CFSTR ("LastResort"), - NULL) - != kCFCompareEqualTo)) - CFArrayAppendValue (families, family); - } - CFRelease (orig_families); - } + { + CFIndex i, count = CFArrayGetCount (orig_families); + + families = CFArrayCreateMutable (NULL, count, &kCFTypeArrayCallBacks); + if (families) + for (i = 0; i < count; i++) + { + CFStringRef family = CFArrayGetValueAtIndex (orig_families, i); + + if (!CFStringHasPrefix (family, CFSTR (".")) + && (CTFontManagerCompareFontFamilyNames (family, + CFSTR ("LastResort"), + NULL) + != kCFCompareEqualTo)) + CFArrayAppendValue (families, family); + } + CFRelease (orig_families); + } } #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 else /* CTFontManagerCopyAvailableFontFamilyNames == NULL */ @@ -3478,41 +3498,41 @@ collection = CTFontCollectionCreateFromAvailableFonts (NULL); if (collection) - { - descs = CTFontCollectionCreateMatchingFontDescriptors (collection); - CFRelease (collection); - } + { + descs = CTFontCollectionCreateMatchingFontDescriptors (collection); + CFRelease (collection); + } if (descs) - { - CFIndex i, count = CFArrayGetCount (descs); - - families = CFArrayCreateMutable (NULL, count, &kCFTypeArrayCallBacks); - if (families) - for (i = 0; i < count; i++) - { - FontDescriptorRef desc = CFArrayGetValueAtIndex (descs, i); - CFStringRef name = - mac_font_descriptor_copy_attribute (desc, - MAC_FONT_FAMILY_NAME_ATTRIBUTE); - - if (name) - { - CFIndex p, limit = CFArrayGetCount (families); - - p = CFArrayBSearchValues (families, CFRangeMake (0, limit), - (const void *) name, - mac_font_family_compare, NULL); - if (p >= limit) - CFArrayAppendValue (families, name); - else if (mac_font_family_compare - (CFArrayGetValueAtIndex (families, p), - name, NULL) != kCFCompareEqualTo) - CFArrayInsertValueAtIndex (families, p, name); - CFRelease (name); - } - } - CFRelease (descs); - } + { + CFIndex i, count = CFArrayGetCount (descs); + + families = CFArrayCreateMutable (NULL, count, &kCFTypeArrayCallBacks); + if (families) + for (i = 0; i < count; i++) + { + FontDescriptorRef desc = CFArrayGetValueAtIndex (descs, i); + CFStringRef name = + mac_font_descriptor_copy_attribute (desc, + MAC_FONT_FAMILY_NAME_ATTRIBUTE); + + if (name) + { + CFIndex p, limit = CFArrayGetCount (families); + + p = CFArrayBSearchValues (families, CFRangeMake (0, limit), + (const void *) name, + mac_font_family_compare, NULL); + if (p >= limit) + CFArrayAppendValue (families, name); + else if (mac_font_family_compare + (CFArrayGetValueAtIndex (families, p), + name, NULL) != kCFCompareEqualTo) + CFArrayInsertValueAtIndex (families, p, name); + CFRelease (name); + } + } + CFRelease (descs); + } } #endif @@ -3534,10 +3554,10 @@ { name2 = CTFontCopyPostScriptName (font2); if (name2) - { - result = CFEqual (name1, name2); - CFRelease (name2); - } + { + result = CFEqual (name1, name2); + CFRelease (name2); + } CFRelease (name1); } @@ -3546,7 +3566,7 @@ static CTLineRef mac_ctfont_create_line_with_string_and_font (CFStringRef string, - CTFontRef macfont) + CTFontRef macfont) { CFStringRef keys[] = {kCTFontAttributeName, kCTKernAttributeName}; CFTypeRef values[] = {NULL, NULL}; @@ -3560,10 +3580,10 @@ if (values[1]) { attributes = CFDictionaryCreate (NULL, (const void **) keys, - (const void **) values, + (const void **) values, ARRAYELTS (keys), - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); CFRelease (values[1]); } if (attributes) @@ -3579,30 +3599,30 @@ if (ctline) { /* Abandon if ctline contains some fonts other than the - specified one. */ + specified one. */ CFArrayRef runs = CTLineGetGlyphRuns (ctline); CFIndex i, nruns = CFArrayGetCount (runs); for (i = 0; i < nruns; i++) - { - CTRunRef run = CFArrayGetValueAtIndex (runs, i); - CFDictionaryRef attributes = CTRunGetAttributes (run); - CTFontRef font_in_run; + { + CTRunRef run = CFArrayGetValueAtIndex (runs, i); + CFDictionaryRef attributes = CTRunGetAttributes (run); + CTFontRef font_in_run; - if (attributes == NULL) - break; - font_in_run = - CFDictionaryGetValue (attributes, kCTFontAttributeName); - if (font_in_run == NULL) - break; - if (!mac_ctfont_equal_in_postscript_name (macfont, font_in_run)) - break; - } + if (attributes == NULL) + break; + font_in_run = + CFDictionaryGetValue (attributes, kCTFontAttributeName); + if (font_in_run == NULL) + break; + if (!mac_ctfont_equal_in_postscript_name (macfont, font_in_run)) + break; + } if (i < nruns) - { - CFRelease (ctline); - ctline = NULL; - } + { + CFRelease (ctline); + ctline = NULL; + } } return ctline; @@ -3610,7 +3630,7 @@ static CFIndex mac_ctfont_shape (CTFontRef font, CFStringRef string, - struct mac_glyph_layout *glyph_layouts, CFIndex glyph_len) + struct mac_glyph_layout *glyph_layouts, CFIndex glyph_len) { CFIndex used, result = 0; CTLineRef ctline = mac_ctfont_create_line_with_string_and_font (string, font); @@ -3627,128 +3647,128 @@ CFIndex total_glyph_count = 0; for (k = 0; k < ctrun_count; k++) - { - CTRunRef ctrun = CFArrayGetValueAtIndex (ctruns, k); - CFIndex i, min_location, glyph_count = CTRunGetGlyphCount (ctrun); - struct mac_glyph_layout *glbuf = glyph_layouts + total_glyph_count; - CFRange string_range, comp_range, range; - CFIndex *permutation; + { + CTRunRef ctrun = CFArrayGetValueAtIndex (ctruns, k); + CFIndex i, min_location, glyph_count = CTRunGetGlyphCount (ctrun); + struct mac_glyph_layout *glbuf = glyph_layouts + total_glyph_count; + CFRange string_range, comp_range, range; + CFIndex *permutation; - if (CTRunGetStatus (ctrun) & kCTRunStatusRightToLeft) - permutation = xmalloc (sizeof (CFIndex) * glyph_count); - else - permutation = NULL; + if (CTRunGetStatus (ctrun) & kCTRunStatusRightToLeft) + permutation = xmalloc (sizeof (CFIndex) * glyph_count); + else + permutation = NULL; #define RIGHT_TO_LEFT_P permutation - /* Now the `comp_range' member of struct mac_glyph_layout is - temporarily used as a work area such that: - glbuf[i].comp_range.location = - min {compRange[i + 1].location, ..., + /* Now the `comp_range' member of struct mac_glyph_layout is + temporarily used as a work area such that: + glbuf[i].comp_range.location = + min {compRange[i + 1].location, ..., compRange[glyph_count - 1].location, maxRange (stringRangeForCTRun)} - glbuf[i].comp_range.length = maxRange (compRange[i]) - where compRange[i] is the range of composed characters - containing i-th glyph. */ - string_range = CTRunGetStringRange (ctrun); - min_location = string_range.location + string_range.length; - for (i = 0; i < glyph_count; i++) - { - struct mac_glyph_layout *gl = glbuf + glyph_count - i - 1; - CFIndex glyph_index; - CFRange rng; - - if (!RIGHT_TO_LEFT_P) - glyph_index = glyph_count - i - 1; - else - glyph_index = i; - CTRunGetStringIndices (ctrun, CFRangeMake (glyph_index, 1), - &gl->string_index); - rng = - CFStringGetRangeOfComposedCharactersAtIndex (string, - gl->string_index); - gl->comp_range.location = min_location; - gl->comp_range.length = rng.location + rng.length; - if (rng.location < min_location) - min_location = rng.location; - } - - /* Fill the `comp_range' member of struct mac_glyph_layout, - and setup a permutation for right-to-left text. */ - comp_range = CFRangeMake (string_range.location, 0); - range = CFRangeMake (0, 0); - while (1) - { - struct mac_glyph_layout *gl = - glbuf + range.location + range.length; - - if (gl->comp_range.length - > comp_range.location + comp_range.length) - comp_range.length = gl->comp_range.length - comp_range.location; - min_location = gl->comp_range.location; - range.length++; - - if (min_location >= comp_range.location + comp_range.length) - { - comp_range.length = min_location - comp_range.location; - for (i = 0; i < range.length; i++) - { - glbuf[range.location + i].comp_range = comp_range; - if (RIGHT_TO_LEFT_P) - permutation[range.location + i] = - range.location + range.length - i - 1; - } - - comp_range = CFRangeMake (min_location, 0); - range.location += range.length; - range.length = 0; - if (range.location == glyph_count) - break; - } - } - - /* Then fill the remaining members. */ - for (range = CFRangeMake (0, 1); range.location < glyph_count; - range.location++) - { - struct mac_glyph_layout *gl; - CGPoint position; - - if (!RIGHT_TO_LEFT_P) - gl = glbuf + range.location; - else - { - CFIndex src, dest; - - src = glyph_count - 1 - range.location; - dest = permutation[src]; - gl = glbuf + dest; - if (src < dest) - { - CFIndex tmp = gl->string_index; - - gl->string_index = glbuf[src].string_index; - glbuf[src].string_index = tmp; - } - } - CTRunGetGlyphs (ctrun, range, &gl->glyph_id); - - CTRunGetPositions (ctrun, range, &position); - gl->advance_delta = position.x - total_advance; - gl->baseline_delta = position.y; - gl->advance = (gl->advance_delta - + CTRunGetTypographicBounds (ctrun, range, - NULL, NULL, NULL)); - total_advance += gl->advance; - } - - if (RIGHT_TO_LEFT_P) - xfree (permutation); + glbuf[i].comp_range.length = maxRange (compRange[i]) + where compRange[i] is the range of composed characters + containing i-th glyph. */ + string_range = CTRunGetStringRange (ctrun); + min_location = string_range.location + string_range.length; + for (i = 0; i < glyph_count; i++) + { + struct mac_glyph_layout *gl = glbuf + glyph_count - i - 1; + CFIndex glyph_index; + CFRange rng; + + if (!RIGHT_TO_LEFT_P) + glyph_index = glyph_count - i - 1; + else + glyph_index = i; + CTRunGetStringIndices (ctrun, CFRangeMake (glyph_index, 1), + &gl->string_index); + rng = + CFStringGetRangeOfComposedCharactersAtIndex (string, + gl->string_index); + gl->comp_range.location = min_location; + gl->comp_range.length = rng.location + rng.length; + if (rng.location < min_location) + min_location = rng.location; + } + + /* Fill the `comp_range' member of struct mac_glyph_layout, + and setup a permutation for right-to-left text. */ + comp_range = CFRangeMake (string_range.location, 0); + range = CFRangeMake (0, 0); + while (1) + { + struct mac_glyph_layout *gl = + glbuf + range.location + range.length; + + if (gl->comp_range.length + > comp_range.location + comp_range.length) + comp_range.length = gl->comp_range.length - comp_range.location; + min_location = gl->comp_range.location; + range.length++; + + if (min_location >= comp_range.location + comp_range.length) + { + comp_range.length = min_location - comp_range.location; + for (i = 0; i < range.length; i++) + { + glbuf[range.location + i].comp_range = comp_range; + if (RIGHT_TO_LEFT_P) + permutation[range.location + i] = + range.location + range.length - i - 1; + } + + comp_range = CFRangeMake (min_location, 0); + range.location += range.length; + range.length = 0; + if (range.location == glyph_count) + break; + } + } + + /* Then fill the remaining members. */ + for (range = CFRangeMake (0, 1); range.location < glyph_count; + range.location++) + { + struct mac_glyph_layout *gl; + CGPoint position; + + if (!RIGHT_TO_LEFT_P) + gl = glbuf + range.location; + else + { + CFIndex src, dest; + + src = glyph_count - 1 - range.location; + dest = permutation[src]; + gl = glbuf + dest; + if (src < dest) + { + CFIndex tmp = gl->string_index; + + gl->string_index = glbuf[src].string_index; + glbuf[src].string_index = tmp; + } + } + CTRunGetGlyphs (ctrun, range, &gl->glyph_id); + + CTRunGetPositions (ctrun, range, &position); + gl->advance_delta = position.x - total_advance; + gl->baseline_delta = position.y; + gl->advance = (gl->advance_delta + + CTRunGetTypographicBounds (ctrun, range, + NULL, NULL, NULL)); + total_advance += gl->advance; + } + + if (RIGHT_TO_LEFT_P) + xfree (permutation); #undef RIGHT_TO_LEFT_P - total_glyph_count += glyph_count; - } + total_glyph_count += glyph_count; + } result = used; } @@ -3763,7 +3783,7 @@ #if USE_CT_GLYPH_INFO static CGGlyph mac_ctfont_get_glyph_for_cid (CTFontRef font, CTCharacterCollection collection, - CGFontIndex cid) + CGFontIndex cid) { CGGlyph result = kCGFontIndexInvalid; UniChar characters[] = {0xfffd}; @@ -3777,27 +3797,27 @@ if (string) { CTGlyphInfoRef glyph_info = - CTGlyphInfoCreateWithCharacterIdentifier (cid, collection, string); + CTGlyphInfoCreateWithCharacterIdentifier (cid, collection, string); CFDictionaryRef attributes = NULL; if (glyph_info) - { - CFStringRef keys[] = {kCTFontAttributeName, - kCTGlyphInfoAttributeName}; - CFTypeRef values[] = {font, glyph_info}; + { + CFStringRef keys[] = {kCTFontAttributeName, + kCTGlyphInfoAttributeName}; + CFTypeRef values[] = {font, glyph_info}; - attributes = CFDictionaryCreate (NULL, (const void **) keys, - (const void **) values, + attributes = CFDictionaryCreate (NULL, (const void **) keys, + (const void **) values, ARRAYELTS (keys), - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - CFRelease (glyph_info); - } + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + CFRelease (glyph_info); + } if (attributes) - { - attr_string = CFAttributedStringCreate (NULL, string, attributes); - CFRelease (attributes); - } + { + attr_string = CFAttributedStringCreate (NULL, string, attributes); + CFRelease (attributes); + } CFRelease (string); } if (attr_string) @@ -3810,24 +3830,24 @@ CFArrayRef runs = CTLineGetGlyphRuns (ctline); if (CFArrayGetCount (runs) > 0) - { - CTRunRef run = CFArrayGetValueAtIndex (runs, 0); - CFDictionaryRef attributes = CTRunGetAttributes (run); - - if (attributes) - { - CTFontRef font_in_run = - CFDictionaryGetValue (attributes, kCTFontAttributeName); - - if (font_in_run - && mac_ctfont_equal_in_postscript_name (font_in_run, font)) - { - CTRunGetGlyphs (run, CFRangeMake (0, 1), &result); - if (result >= CTFontGetGlyphCount (font)) - result = kCGFontIndexInvalid; - } - } - } + { + CTRunRef run = CFArrayGetValueAtIndex (runs, 0); + CFDictionaryRef attributes = CTRunGetAttributes (run); + + if (attributes) + { + CTFontRef font_in_run = + CFDictionaryGetValue (attributes, kCTFontAttributeName); + + if (font_in_run + && mac_ctfont_equal_in_postscript_name (font_in_run, font)) + { + CTRunGetGlyphs (run, CFRangeMake (0, 1), &result); + if (result >= CTFontGetGlyphCount (font)) + result = kCGFontIndexInvalid; + } + } + } CFRelease (ctline); } @@ -3846,9 +3866,9 @@ CFRange range; range = CFStringFind (family, CFSTR ("Apple"), - kCFCompareCaseInsensitive | kCFCompareAnchored); + kCFCompareCaseInsensitive | kCFCompareAnchored); if (range.location != kCFNotFound) - return 1; + return 1; return 0; } @@ -3881,22 +3901,22 @@ #endif { CTFontRef user_font = - CTFontCreateUIFontForLanguage (kCTFontUserFontType, 0, language); + CTFontCreateUIFontForLanguage (kCTFontUserFontType, 0, language); if (user_font) - { - CFArrayRef languages = - CFArrayCreate (NULL, (const void **) &language, 1, - &kCFTypeArrayCallBacks); + { + CFArrayRef languages = + CFArrayCreate (NULL, (const void **) &language, 1, + &kCFTypeArrayCallBacks); - if (languages) - { - result = CTFontCopyDefaultCascadeListForLanguages (user_font, - languages); - CFRelease (languages); - } - CFRelease (user_font); - } + if (languages) + { + result = CTFontCopyDefaultCascadeListForLanguages (user_font, + languages); + CFRelease (languages); + } + CFRelease (user_font); + } } #if MAC_OS_X_VERSION_MIN_REQUIRED < 1080 else /* CTFontCopyDefaultCascadeListForLanguages == NULL */ @@ -3907,55 +3927,55 @@ CFIndex i; for (i = 0; macfont_language_default_font_names[i].language; i++) - { - if (CFEqual (macfont_language_default_font_names[i].language, + { + if (CFEqual (macfont_language_default_font_names[i].language, language)) - { - CFMutableArrayRef descriptors = - CFArrayCreateMutable (NULL, 0, &kCFTypeArrayCallBacks); - - if (descriptors) - { - CFIndex j; - - for (j = 0; - macfont_language_default_font_names[i].font_names[j]; - j++) - { - CFDictionaryRef attributes = - CFDictionaryCreate (NULL, - ((const void **) - &MAC_FONT_NAME_ATTRIBUTE), - ((const void **) - &macfont_language_default_font_names[i].font_names[j]), - 1, &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - - if (attributes) - { - FontDescriptorRef pat_desc = - mac_font_descriptor_create_with_attributes (attributes); - - if (pat_desc) - { - FontDescriptorRef descriptor = - mac_font_descriptor_create_matching_font_descriptor (pat_desc, NULL); - - if (descriptor) - { - CFArrayAppendValue (descriptors, descriptor); - CFRelease (descriptor); - } - CFRelease (pat_desc); - } - CFRelease (attributes); - } - } - result = descriptors; - } - break; - } - } + { + CFMutableArrayRef descriptors = + CFArrayCreateMutable (NULL, 0, &kCFTypeArrayCallBacks); + + if (descriptors) + { + CFIndex j; + + for (j = 0; + macfont_language_default_font_names[i].font_names[j]; + j++) + { + CFDictionaryRef attributes = + CFDictionaryCreate (NULL, + ((const void **) + &MAC_FONT_NAME_ATTRIBUTE), + ((const void **) + &macfont_language_default_font_names[i].font_names[j]), + 1, &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + + if (attributes) + { + FontDescriptorRef pat_desc = + mac_font_descriptor_create_with_attributes (attributes); + + if (pat_desc) + { + FontDescriptorRef descriptor = + mac_font_descriptor_create_matching_font_descriptor (pat_desc, NULL); + + if (descriptor) + { + CFArrayAppendValue (descriptors, descriptor); + CFRelease (descriptor); + } + CFRelease (pat_desc); + } + CFRelease (attributes); + } + } + result = descriptors; + } + break; + } + } } #endif @@ -3964,7 +3984,7 @@ static CFStringRef mac_font_copy_default_name_for_charset_and_languages (CFCharacterSetRef charset, - CFArrayRef languages) + CFArrayRef languages) { CFStringRef result = NULL; CFStringRef language = CFArrayGetValueAtIndex (languages, 0); @@ -3976,29 +3996,29 @@ CFIndex i, count = CFArrayGetCount (descriptors); for (i = 0; i < count; i++) - { - FontDescriptorRef descriptor = - CFArrayGetValueAtIndex (descriptors, i); + { + FontDescriptorRef descriptor = + CFArrayGetValueAtIndex (descriptors, i); - if (macfont_supports_charset_and_languages_p (descriptor, charset, - Qnil, languages)) - { - CFStringRef family = - mac_font_descriptor_copy_attribute (descriptor, - MAC_FONT_FAMILY_NAME_ATTRIBUTE); - if (family) - { - if (!CFStringHasPrefix (family, CFSTR (".")) - && !CFEqual (family, CFSTR ("LastResort"))) + if (macfont_supports_charset_and_languages_p (descriptor, charset, + Qnil, languages)) + { + CFStringRef family = + mac_font_descriptor_copy_attribute (descriptor, + MAC_FONT_FAMILY_NAME_ATTRIBUTE); + if (family) + { + if (!CFStringHasPrefix (family, CFSTR (".")) + && !CFEqual (family, CFSTR ("LastResort"))) { - result = family; - break; - } - else - CFRelease (family); - } - } - } + result = family; + break; + } + else + CFRelease (family); + } + } + } CFRelease (descriptors); } ------------------------------------------------------------ revno: 118047 [merge] committer: K. Handa branch nick: trunk timestamp: Sun 2014-10-05 17:52:51 +0900 message: coding.c (detect_coding_iso_2022): Fix previous change. diff: === modified file 'src/coding.c' --- src/coding.c 2014-10-05 08:17:15 +0000 +++ src/coding.c 2014-10-05 08:52:04 +0000 @@ -3166,7 +3166,7 @@ if (inhibit_iso_escape_detection) break; single_shifting = 0; - rejected |= CATEGORY_MASK_ISO_7BIT; + rejected |= CATEGORY_MASK_ISO_7BIT | CATEGORY_MASK_ISO_7_ELSE; if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1]) & CODING_ISO_FLAG_SINGLE_SHIFT) { @@ -3193,9 +3193,9 @@ single_shifting = 0; break; } + rejected |= CATEGORY_MASK_ISO_7BIT | CATEGORY_MASK_ISO_7_ELSE; if (c >= 0xA0) { - rejected |= CATEGORY_MASK_ISO_7BIT | CATEGORY_MASK_ISO_7_ELSE; found |= CATEGORY_MASK_ISO_8_1; /* Check the length of succeeding codes of the range 0xA0..0FF. If the byte length is even, we include ------------------------------------------------------------ revno: 118046 [merge] committer: K. Handa branch nick: trunk timestamp: Sun 2014-10-05 17:19:03 +0900 message: coding.c (detect_coding_iso_2022): Set coding->rejected correctly when an invalid escape sequence is found (Bug#18610). diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-04 12:28:41 +0000 +++ src/ChangeLog 2014-10-05 08:17:15 +0000 @@ -1,3 +1,8 @@ +2014-10-05 K. Handa + + * coding.c (detect_coding_iso_2022): Set coding->rejected + correctly when an invalid escape sequence is found (Bug#18610). + 2014-10-04 Jan Djärv * gtkutil.c (create_menus): Only add tearoffs to empty menus. === modified file 'src/coding.c' --- src/coding.c 2014-10-03 04:35:10 +0000 +++ src/coding.c 2014-10-05 08:17:15 +0000 @@ -3073,8 +3073,13 @@ ONE_MORE_BYTE (c1); if (c1 < ' ' || c1 >= 0x80 || (id = iso_charset_table[0][c >= ','][c1]) < 0) - /* Invalid designation sequence. Just ignore. */ - break; + { + /* Invalid designation sequence. Just ignore. */ + if (c1 >= 0x80) + rejected |= (CATEGORY_MASK_ISO_7BIT + | CATEGORY_MASK_ISO_7_ELSE); + break; + } } else if (c == '$') { @@ -3088,16 +3093,29 @@ ONE_MORE_BYTE (c1); if (c1 < ' ' || c1 >= 0x80 || (id = iso_charset_table[1][c >= ','][c1]) < 0) - /* Invalid designation sequence. Just ignore. */ - break; + { + /* Invalid designation sequence. Just ignore. */ + if (c1 >= 0x80) + rejected |= (CATEGORY_MASK_ISO_7BIT + | CATEGORY_MASK_ISO_7_ELSE); + break; + } } else - /* Invalid designation sequence. Just ignore it. */ - break; + { + /* Invalid designation sequence. Just ignore it. */ + if (c >= 0x80) + rejected |= (CATEGORY_MASK_ISO_7BIT + | CATEGORY_MASK_ISO_7_ELSE); + break; + } } else { /* Invalid escape sequence. Just ignore it. */ + if (c >= 0x80) + rejected |= (CATEGORY_MASK_ISO_7BIT + | CATEGORY_MASK_ISO_7_ELSE); break; } ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.