| 419 | | ;;; |
|---|
| 420 | | ;;; Obsolete codes. |
|---|
| 421 | | ;;; |
|---|
| 422 | | |
|---|
| 423 | | (defvar w32-default-logfont '(w32-logfont "FixedSys" 0 0 400 0 nil nil nil 0 1 1 1) |
|---|
| 424 | | "Default font is generated from this.") |
|---|
| 425 | | |
|---|
| 426 | | (defun w32-automatic-font-regist (name lflist &optional encoding-type) |
|---|
| 427 | | (w32-add-font name '((width . 0) |
|---|
| 428 | | (height . 0) |
|---|
| 429 | | (base . 0) |
|---|
| 430 | | (overhang . 0) |
|---|
| 431 | | (encoding-type . 0))) |
|---|
| 432 | | (let (lf metric num encoder |
|---|
| 433 | | (i 0) |
|---|
| 434 | | (width 0) |
|---|
| 435 | | (height 0) |
|---|
| 436 | | (base 0) |
|---|
| 437 | | (overhang 0)) |
|---|
| 438 | | (if (not (numberp encoding-type)) |
|---|
| 439 | | (progn |
|---|
| 440 | | (setq encoder encoding-type) |
|---|
| 441 | | (setq encoding-type 0))) |
|---|
| 442 | | (while (setq lf (car lflist)) |
|---|
| 443 | | (setq metric (w32-get-logfont-info lf) |
|---|
| 444 | | num (cdr (assq 'width metric))) |
|---|
| 445 | | (if (> num width) (setq width num)) |
|---|
| 446 | | (setq num (cdr (assq 'height metric))) |
|---|
| 447 | | (if (> num height) (setq height num)) |
|---|
| 448 | | (setq num (cdr (assq 'base metric))) |
|---|
| 449 | | (if (> num base) (setq base num)) |
|---|
| 450 | | (setq num (cdr (assq 'overhang metric))) |
|---|
| 451 | | (if (> num overhang) (setq overhang num)) |
|---|
| 452 | | (w32-change-font-logfont name i lf) |
|---|
| 453 | | (setq lflist (cdr lflist)) |
|---|
| 454 | | (setq i (1+ i))) |
|---|
| 455 | | (w32-change-font-attribute |
|---|
| 456 | | name |
|---|
| 457 | | (list (cons 'width width) |
|---|
| 458 | | (cons 'height height) |
|---|
| 459 | | (cons 'base base) |
|---|
| 460 | | (cons 'overhang overhang) |
|---|
| 461 | | (cons 'encoding-type encoding-type) |
|---|
| 462 | | (cons 'encoder encoder))))) |
|---|
| 463 | | |
|---|
| 464 | | (defun w32-generate-tribial-logfont-list (logfont) |
|---|
| 465 | | (let* ((bold-font (w32-change-logfont-weight logfont 300)) |
|---|
| 466 | | (italic-font (w32-change-logfont-italic-p logfont t)) |
|---|
| 467 | | (italic-bold-font (w32-change-logfont-italic-p bold-font t))) |
|---|
| 468 | | (list logfont bold-font italic-font italic-bold-font))) |
|---|
| 469 | | |
|---|
| 470 | | (defun w32-regist-initial-font () |
|---|
| 471 | | (w32-automatic-font-regist |
|---|
| 472 | | "initial" |
|---|
| 473 | | (w32-generate-tribial-logfont-list w32-default-logfont) 0)) |
|---|
| 474 | | |
|---|
| 475 | | (defun w32-automatic-fontset-regist (name orgfont) |
|---|
| 476 | | (let ((encoding-alist mw32-charset-windows-font-info-alist) |
|---|
| 477 | | x ret) |
|---|
| 478 | | (while encoding-alist |
|---|
| 479 | | (setq x (car encoding-alist)) |
|---|
| 480 | | (setq encoding-alist (cdr encoding-alist)) |
|---|
| 481 | | (let* ((charset (car x)) |
|---|
| 482 | | (ms-charset (car (cdr x))) |
|---|
| 483 | | (encoding-type (car (cdr (cdr x)))) |
|---|
| 484 | | (font-name (format "%s-%s" orgfont (symbol-name charset))) |
|---|
| 485 | | orglf newlf metric) |
|---|
| 486 | | (setq orglf |
|---|
| 487 | | (w32-change-logfont-charset |
|---|
| 488 | | (cond |
|---|
| 489 | | ((w32-get-font-logfont orgfont 0)) |
|---|
| 490 | | (t |
|---|
| 491 | | w32-default-logfont)) ms-charset)) |
|---|
| 492 | | (setq metric (w32-get-logfont-info orglf)) |
|---|
| 493 | | (if (or (= ms-charset (cdr (assq 'charset-num metric))) |
|---|
| 494 | | ;;; This is very dirty hack. |
|---|
| 495 | | ;; Some Windows(TM) localized editions |
|---|
| 496 | | ;; (at least Windows98 Thai edition) have |
|---|
| 497 | | ;; a bogus font mapper, which may maps a logfont |
|---|
| 498 | | ;; to a font of wrong charset number |
|---|
| 499 | | ;; if any other keys of the logfont are not match. |
|---|
| 500 | | ;; This must be a bug of Windows. Nevertheless, |
|---|
| 501 | | ;; we should make ASCII font to display, thus, |
|---|
| 502 | | ;; we force to set the logfont (that is |
|---|
| 503 | | ;; seemed to be to invalid) to ASCII font of |
|---|
| 504 | | ;; the fontset that will be created. |
|---|
| 505 | | (eq charset 'ascii)) |
|---|
| 506 | | (progn |
|---|
| 507 | | (w32-automatic-font-regist |
|---|
| 508 | | font-name |
|---|
| 509 | | (mapcar |
|---|
| 510 | | (lambda (x) |
|---|
| 511 | | (setq metric (w32-get-logfont-info orglf) |
|---|
| 512 | | newlf (w32-change-logfont-width |
|---|
| 513 | | orglf |
|---|
| 514 | | (cdr (assq 'width metric))) |
|---|
| 515 | | newlf (w32-change-logfont-height |
|---|
| 516 | | newlf |
|---|
| 517 | | (cdr (assq 'height metric)))) |
|---|
| 518 | | newlf) |
|---|
| 519 | | '(0 1 2 3)) |
|---|
| 520 | | encoding-type) |
|---|
| 521 | | (setq ret (cons (cons charset font-name) ret)))))) |
|---|
| 522 | | (new-fontset name ret))) |
|---|
| 523 | | |
|---|
| 524 | | ;(new-fontset "default-fontset" '((ascii . "default") |
|---|
| 525 | | ; (japanese-jisx0208 . "default") |
|---|
| 526 | | ; (katakana-jisx0201 . "default"))) |
|---|
| 527 | | ; |
|---|
| 528 | | ;(set-default-font "default-fontset") |
|---|
| 529 | | |
|---|