aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa1998-09-02 04:51:42 +0000
committerKenichi Handa1998-09-02 04:51:42 +0000
commitbe415ea70e7653e4ce342016c6596499006120fb (patch)
tree2193cc2681e7779558a8f239e63b952caea676a4
parent23017390a5f4677fe1b40350d2dfdd70a25238d7 (diff)
downloademacs-be415ea70e7653e4ce342016c6596499006120fb.tar.gz
emacs-be415ea70e7653e4ce342016c6596499006120fb.zip
(ps-mule-font-info-database-bdf): The include ASCII
entry and change Latin-1 entry in the default value. (ps-mule-font-info-database-ps-bdf): New variable. (ccl-encode-ethio-unicode): Bug of CCL code fixed. (ps-mule-generate-font): Give CHARSET arg to FONT-FUNC function registerd in FONT-SPEC. (ps-mule-bitmap-prologue): Fix PostScript code to realize correct charcter width of bitmap fonts. (ps-mule-generate-bitmap-font): Give COLUMNS arg to PostScript procedure NF. (ps-begin-file): Output PostScript code for setting SpaceWidthRatio. (ps-plot-region): Use line-beginning-position to get a position of the beginning of the current line.
-rw-r--r--lisp/ps-print.el90
1 files changed, 59 insertions, 31 deletions
diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index a2de18d534e..6a652b42b87 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -2881,16 +2881,16 @@ See also the variable `ps-font-info-database'.")
2881Currently, data for Japanese and Korean PostScript printers are listed.") 2881Currently, data for Japanese and Korean PostScript printers are listed.")
2882 2882
2883(defconst ps-mule-font-info-database-bdf 2883(defconst ps-mule-font-info-database-bdf
2884 '(;;(ascii 2884 '((ascii
2885 ;; (normal bdf "etl24-latin1.bdf" nil 1) 2885 (normal bdf "etl24-latin1.bdf" nil 1)
2886 ;; (bold bdf "etl16b-latin1.bdf" iso-latin-1 1) 2886 (bold bdf "etl16b-latin1.bdf" iso-latin-1 1)
2887 ;; (italic bdf "etl16i-latin1.bdf" iso-latin-1 1) 2887 (italic bdf "etl16i-latin1.bdf" iso-latin-1 1)
2888 ;; (bold-italic bdf "etl16bi-latin1.bdf" iso-latin-1 1)) 2888 (bold-italic bdf "etl16bi-latin1.bdf" iso-latin-1 1))
2889 ;;(latin-iso8859-1 2889 (latin-iso8859-1
2890 ;; (normal bdf "etl24-latin1.bdf" iso-latin-1 1) 2890 (normal bdf "etl24-latin1.bdf" iso-latin-1 1)
2891 ;; (bold bdf "etl16b-latin1.bdf" iso-latin-1 1) 2891 (bold bdf "etl16b-latin1.bdf" iso-latin-1 1)
2892 ;; (italic bdf "etl16i-latin1.bdf" iso-latin-1 1) 2892 (italic bdf "etl16i-latin1.bdf" iso-latin-1 1)
2893 ;; (bold-italic bdf "etl16bi-latin1.bdf" iso-latin-1 1)) 2893 (bold-italic bdf "etl16bi-latin1.bdf" iso-latin-1 1))
2894 (latin-iso8859-1 2894 (latin-iso8859-1
2895 (normal nil nil iso-latin-1)) 2895 (normal nil nil iso-latin-1))
2896 (latin-iso8859-2 2896 (latin-iso8859-2
@@ -2972,10 +2972,31 @@ Currently, data for Japanese and Korean PostScript printers are listed.")
2972 (tibetan 2972 (tibetan
2973 (normal bdf "mule-tibmdx-24.bdf" ps-mule-encode-7bit 2))) 2973 (normal bdf "mule-tibmdx-24.bdf" ps-mule-encode-7bit 2)))
2974 "Sample setting of the `ps-mule-font-info-database' to use BDF fonts. 2974 "Sample setting of the `ps-mule-font-info-database' to use BDF fonts.
2975BDF (Bitmap Distribution Format) is a format used for distributing
2976X's font source file.
2975 2977
2976Current default value lists BDF fonts included in `intlfonts-1.1' 2978Current default value lists BDF fonts included in `intlfonts-1.1'
2977which is a collection of X11 fonts for all characters supported by 2979which is a collection of X11 fonts for all characters supported by
2978Emacs.") 2980Emacs.
2981
2982With the default value, all characters including ASCII and Latin-1 are
2983printed by BDF fonts. See also `ps-mule-font-info-database-ps-bdf'.")
2984
2985(defconst ps-mule-font-info-database-ps-bdf
2986 (cons '(latin-iso8859-1
2987 (normal nil nil iso-latin-1))
2988 (cdr (cdr ps-mule-font-info-database-bdf)))
2989 "Sample setting of the `ps-mule-font-info-database to use BDF fonts.
2990
2991Current default value lists BDF fonts included in `intlfonts-1.1'
2992which is a collection of X11 fonts for all characters supported by
2993Emacs.
2994
2995With the default value, all characters except for ASCII and Latin-1 are
2996printed by BDF fonts. ASCII and Latin-1 charcaters are printed by
2997PostScript font specified by `ps-font-family'.
2998
2999See also `ps-mule-font-info-database-bdf'.")
2979 3000
2980;; Two typical encoding functions for PostScript fonts. 3001;; Two typical encoding functions for PostScript fonts.
2981 3002
@@ -3021,19 +3042,19 @@ Emacs.")
3021;; Special encoding function for Ethiopic. 3042;; Special encoding function for Ethiopic.
3022(define-ccl-program ccl-encode-ethio-unicode 3043(define-ccl-program ccl-encode-ethio-unicode
3023 `(1 3044 `(1
3024 (read r2) 3045 ((read r2)
3025 (loop 3046 (loop
3026 (if (r2 == ,leading-code-private-22) 3047 (if (r2 == ,leading-code-private-22)
3027 ((read r0) 3048 ((read r0)
3028 (if (r0 == ,(charset-id 'ethiopic)) 3049 (if (r0 == ,(charset-id 'ethiopic))
3029 ((read r1 r2) 3050 ((read r1 r2)
3030 (r1 &= 127) (r2 &= 127) 3051 (r1 &= 127) (r2 &= 127)
3031 (call ccl-encode-ethio-font) 3052 (call ccl-encode-ethio-font)
3032 (write r1) 3053 (write r1)
3033 (write-read-repeat r2)) 3054 (write-read-repeat r2))
3034 ((write r2 r0) 3055 ((write r2 r0)
3035 (repeat)))) 3056 (repeat))))
3036 (write-read-repeat r2))))) 3057 (write-read-repeat r2))))))
3037 3058
3038(defun ps-mule-encode-ethiopic (string) 3059(defun ps-mule-encode-ethiopic (string)
3039 (ccl-execute-on-string (symbol-value 'ccl-encode-ethio-unicode) 3060 (ccl-execute-on-string (symbol-value 'ccl-encode-ethio-unicode)
@@ -3130,7 +3151,7 @@ each element of the list."
3130 (format "f%02x-%d" 3151 (format "f%02x-%d"
3131 (charset-id charset) ps-current-font)))) 3152 (charset-id charset) ps-current-font))))
3132 (if (and func (not font-cache)) 3153 (if (and func (not font-cache))
3133 (ps-output-prologue (funcall func font-spec))) 3154 (ps-output-prologue (funcall func charset font-spec)))
3134 (ps-output-prologue 3155 (ps-output-prologue
3135 (list (format "/%s %f /%s Def%sFontMule\n" 3156 (list (format "/%s %f /%s Def%sFontMule\n"
3136 scaled-font-name ps-font-size font-name 3157 scaled-font-name ps-font-size font-name
@@ -3584,6 +3605,7 @@ NewBitmapDict
3584 0 0 setcharwidth 3605 0 0 setcharwidth
3585 } { 3606 } {
3586 1 index /FontSize get /size exch def 3607 1 index /FontSize get /size exch def
3608 1 index /FontSpaceWidthRatio get /ratio exch def
3587 1 index /FontIndex get exch FirstCode exch 3609 1 index /FontIndex get exch FirstCode exch
3588 GlobalCharName GetBitmap /bmp exch def 3610 GlobalCharName GetBitmap /bmp exch def
3589 %% bmp == [ DWIDTH BBX-WIDTH BBX-HEIGHT BBX-XOFF BBX-YOFF BITMAP ] 3611 %% bmp == [ DWIDTH BBX-WIDTH BBX-HEIGHT BBX-XOFF BBX-YOFF BITMAP ]
@@ -3598,7 +3620,7 @@ NewBitmapDict
3598 } ifelse 3620 } ifelse
3599 /FirstCode -1 store 3621 /FirstCode -1 store
3600 3622
3601 bmp 0 get size div 0 % wx wy 3623 bmp 0 get SpaceWidthRatio ratio div mul size div 0 % wx wy
3602 setcharwidth % We can't use setcachedevice here. 3624 setcharwidth % We can't use setcachedevice here.
3603 3625
3604 bmp 1 get 0 gt bmp 2 get 0 gt and { 3626 bmp 1 get 0 gt bmp 2 get 0 gt and {
@@ -3631,14 +3653,16 @@ NewBitmapDict
3631 3653
3632/GlobalFontIndex 0 def 3654/GlobalFontIndex 0 def
3633 3655
3634%% fontname dimension fontsize relative-compose baseline-offset fbbx |- -- 3656%% fontname dim col fontsize relative-compose baseline-offset fbbx |- --
3635/BitmapFont { 3657/BitmapFont {
3636 14 dict begin 3658 15 dict begin
3637 /FontBBox exch def 3659 /FontBBox exch def
3638 /BaselineOffset exch def 3660 /BaselineOffset exch def
3639 /RelativeCompose exch def 3661 /RelativeCompose exch def
3640 /FontSize exch def 3662 /FontSize exch def
3641 /FontBBox [ FontBBox { FontSize div } forall ] def 3663 /FontBBox [ FontBBox { FontSize div } forall ] def
3664 FontBBox 2 get FontBBox 0 get sub exch div
3665 /FontSpaceWidthRatio exch def
3642 /FontDimension exch def 3666 /FontDimension exch def
3643 /FontIndex GlobalFontIndex def 3667 /FontIndex GlobalFontIndex def
3644 /FontType 3 def 3668 /FontType 3 def
@@ -3652,7 +3676,7 @@ NewBitmapDict
3652} bind def 3676} bind def
3653 3677
3654%% Define a new bitmap font. 3678%% Define a new bitmap font.
3655%% fontname dimension fontsize relative-compose baseline-offset fbbx |- -- 3679%% fontname dim col fontsize relative-compose baseline-offset fbbx |- --
3656/NF { 3680/NF {
3657 /fbbx exch def 3681 /fbbx exch def
3658 %% Convert BDF's FontBoundingBox to PostScript's FontBBox 3682 %% Convert BDF's FontBoundingBox to PostScript's FontBBox
@@ -3685,7 +3709,7 @@ NewBitmapDict
3685 (list ps-mule-bitmap-prologue))) 3709 (list ps-mule-bitmap-prologue)))
3686 3710
3687(defun ps-mule-generate-bitmap-font (&rest args) 3711(defun ps-mule-generate-bitmap-font (&rest args)
3688 (list (apply 'format "/%s %d %f %S %d %S NF\n" args))) 3712 (list (apply 'format "/%s %d %d %f %S %d %S NF\n" args)))
3689 3713
3690(defun ps-mule-generate-bitmap-glyph (font-name code dwidth bbx bitmap) 3714(defun ps-mule-generate-bitmap-glyph (font-name code dwidth bbx bitmap)
3691 (format "/%s %d [ %d %d %d %d %d <%s> ] NG\n" 3715 (format "/%s %d [ %d %d %d %d %d <%s> ] NG\n"
@@ -4355,6 +4379,10 @@ page-height == bm + print-height + tm - ho - hh
4355 (setq font (cdr font) 4379 (setq font (cdr font)
4356 i (1+ i)))) 4380 i (1+ i))))
4357 4381
4382 (let ((font-entry (cdr (assq ps-font-family ps-font-info-database))))
4383 (ps-output (format "/SpaceWidthRatio %f def\n"
4384 (/ (ps-lookup 'space-width) (ps-lookup 'size)))))
4385
4358 (ps-mule-initialize) 4386 (ps-mule-initialize)
4359 4387
4360 (ps-output "\nBeginDoc\n\n" 4388 (ps-output "\nBeginDoc\n\n"
@@ -4603,7 +4631,7 @@ EndDSCPage\n"))
4603 (ps-plot 'ps-basic-plot-string from match-point bg-color)) 4631 (ps-plot 'ps-basic-plot-string from match-point bg-color))
4604 (cond 4632 (cond
4605 ((= match ?\t) ; tab 4633 ((= match ?\t) ; tab
4606 (let ((linestart (save-excursion (beginning-of-line) (point)))) 4634 (let ((linestart (line-beginning-position)))
4607 (forward-char -1) 4635 (forward-char -1)
4608 (setq from (+ linestart (current-column))) 4636 (setq from (+ linestart (current-column)))
4609 (when (re-search-forward "[ \t]+" to t) 4637 (when (re-search-forward "[ \t]+" to t)