🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by ITO Takayuki Thu, 17 Dec 1998 00:00
How to use JIS Level 3
#780
Author: ITO Takayuki
Date: Thu, 17 Dec 1998 00:00
40 lines
2204 bytes
Mule 2.3(Emacs 19.28.1)でJIS第3水準を表示できないものかと思い、以下の
ようにしてみたのですが、表示されません。

1. -misc-fixed-medium-r-normal--16-150-75-75-c-160-jisx0213.1999-1とい
う名前で適当なJIS X 0208のフォントをインストールする。xfdで表示できる
ことを確認する。

2. .Xresourcesに以下のように書いてxrdbし、muleを起動する。

Emacs*FontSet-16:\
		:
	-misc-fixed-medium-r-normal--16-150-75-75-c-160-jisx0213.1999-1,\
		:

3. 文字集合とcoding-systemを定義する。

(defvar lc-jp3
  (new-private-character-set 2 2 2 0 ?O 0 "Japanese Level 3" "JISX0213.1999-1")
  "Leading character for JIS X 0213 Plane 1, Japanese characters Level 3.")
(defvar lc-jp4
  (new-private-character-set 2 2 2 0 ?P 0 "Japanese Level 4" "JISX0213.1999-2")
  "Leading character for JIS X 0213 Plane 2, Japanese characters Level 4.")
(make-coding-system '*euc-japan-new*
  2 ?e "Coding-system of Alternative Japanese EUC (Extended Unix Code)." t
  (list lc-ascii lc-jp3 lc-jp4 nil nil 'ascii-eol 'ascii-cntl))

4. EUCのファイルをC-u C-x C-f filename *euc-japan-new*として読み込む。
あるいは、ESC $ ( Oで第3水準を指示するファイルを作って読み込む。

→ASCIIは表示されるが第3水準は一切表示されない(正確には、半角空白が表
示されているようで、前に表示されていたものが残ることがある)。カーソル
を重ねてみると、一応全角幅で移動する(カーソル自体は半角幅表示)。
*internal*でセーブすると9D FB A1 A1などとなるのでコードとしてはちゃん
と処理されているらしい。

文字集合とフォントのマッピングがうまくいってないような感じなのですが、
何か他に設定など必要でしょうか。

--
伊藤隆幸 (ITO Takayuki)
Re: How to use JIS Level 3
#781
Author: Kenichi Handa
Date: Fri, 18 Dec 1998 00:00
24 lines
1251 bytes
In article <75ben4$14p$1@horse.fsinet.or.jp>,
	yuki@dayo.ne.jp (ITO Takayuki) writes:
> Mule 2.3(Emacs 19.28.1)$B$G(BJIS$BBh(B3$B?e=`$rI=<($G$-$J$$$b$N$+$H;W$$!"0J2<$N(B
> $B$h$&$K$7$F$_$?$N$G$9$,!"I=<($5$l$^$;$s!#(B
[...]
> 2. .Xresources$B$K0J2<$N$h$&$K=q$$$F(Bxrdb$B$7!"(Bmule$B$r5/F0$9$k!#(B
> Emacs*FontSet-16:\
> 		:
> 	-misc-fixed-medium-r-normal--16-150-75-75-c-160-jisx0213.1999-1,\
> 		:

$B$"$i$?$KDj5A$9$kJ8;z%;%C%H$K$D$$$F$O>e5-$N@_Dj$O;H$($^$;$s!J$@$C$?$H;W(B
$B$$$^$9!#$b$&5-21$,$*$\$m$2(B ^.^;;;$B!K!#(B

Mule $B$r5/F0$7$F0J2<$N$h$&$KJ8;z%;%C%H$rDj5A$7$?>e$G!"(B

(set-fontset-font 
  "16" lc-jp3 
  "-misc-fixed-medium-r-normal--16-150-75-75-c-160-jisx0213.1999-1)

$B$r<B9T$9$l$P$h$$$O$:$G$9!#(B

$B!]!]!!$1$s$A$c$s!w#E#T#L(B
      handa@etl.go.jp
Re: How to use JIS Level 3
#782
Author: ITO Takayuki
Date: Sun, 20 Dec 1998 00:00
260 lines
7660 bytes
In article <tl7af0lr50w.fsf@etl.go.jp>
	Kenichi Handa <handa@etl.go.jp> writes:

>Mule を起動して以下のように文字セットを定義した上で、
>
>(set-fontset-font 
>  "16" lc-jp3 
>  "-misc-fixed-medium-r-normal--16-150-75-75-c-160-jisx0213.1999-1)
>
>を実行すればよいはずです。

これで表示されるようになりました。ありがとうございます。ついでにシフト
JISも使えるようにしようと思い、下のようなCCLを書いています(勝手がわか
らないのでとても冗長ですが)。どうにかロード・セーブできるようにはなっ
たのですが、まだ原因不明のバグがあるようです。どなたか興味のある方はデ
バグしてください。_o_

;; newjis.el - support for new JIS (JIS X 0213-1999 Plane 1, 2)
;; Copyright (C) 1998 ITO Takayuki.

;; CAUTION:
;;
;; The standard is currently being reviewed. Not yet fixed.
;; Do not use the standard and this code for practical purposes.
;;
;; The standard name JISX0213, published year 1999,
;; and final characters ?O and ?P are nothing but prediction.
;; EUC and Shift-JIS encodings are also draft proposal.
;; When the formal standard is published they may change.
;;
;; CCL routines for Shift-JIS assume lc-jp3 == 251 and lc-jp4 == 252.
;; If you have already defined other 2-byte 2-column private character sets,
;; you need to change these hard-coded values.

;; BUGS:
;;
;; This elisp code is of alpha quality. Not yet tested thoroughly.
;;
;; EUC file may be recognized as *euc-japan* even though explicitly
;; specified as *euc-japan-new* in reading.
;;
;; SJIS(CR/LF) file may be recognized as *sjis-new*unix even though
;; explicitly specified as *sjis-new*dos in reading.
;;
;; A few ASCII characters may drop in writing SJIS file.

;;; 98.12.19 created for Mule 2.3@19.28 by ITO Takayuki <yuki@dayo.ne.jp>

;; define character sets

(defvar lc-jp3
	(new-private-character-set 2 2 2 0 ?O 0 "Japanese Level 3" "JISX0213.1999-1")
	"Leading character for JIS X 0213 Plane 1, Japanese characters Level 3.")
(defvar lc-jp4
	(new-private-character-set 2 2 2 0 ?P 0 "Japanese Level 4" "JISX0213.1999-2")
	"Leading character for JIS X 0213 Plane 2, Japanese characters Level 4.")

;; bind character sets to fonts

(if (eq window-system 'x)
	(progn
		(set-fontset-font 
			"16" lc-jp3
			"-misc-fixed-medium-r-normal--16-150-75-75-c-160-jisx0213.1999-1")
		(set-fontset-font 
			"16" lc-jp4
			"-misc-fixed-medium-r-normal--16-150-75-75-c-160-jisx0213.1999-2")))

;; define coding system: EUC

(make-coding-system
	'*euc-japan-new* 2 ?e
	"Coding-system of Alternative Japanese EUC (Extended Unix Code)." t
	(list lc-ascii lc-jp3 lc-jp4 nil
		'short 'ascii-eol 'ascii-cntl))

;; define coding system: SJIS

(define-ccl-program ccl-read-sjis-new
	'(3
		((read r0)
		 (loop
			;; 0x00 - 0x7F (ASCII)
			(if (r0 < 128)
				(write-read-repeat r0)
			;; 0x80 (invalid)
			(if (r0 == 128)
				((read r0) (repeat))
			;; 0x81 - 0x9F (JIS X 0213 Plane 1 Row 1 - 62)
			(if (r0 < 160)
				((read r1)
				 (if (r1 <   64) ((read r0) (repeat)))
				 (if (r1 == 127) ((read r0) (repeat)))
				 (if (r1 >  252) ((read r0) (repeat)))
				 (r0 -= 129)
				 (r0 *= 2)
				 (if (r1 > 127) (r1 -= 1))
				 (r1 -= 64)
				 (if (r1 >= 94) ((r1 -= 94) (r0 += 1)))
				 (r0 += 161)
				 (r1 += 161)
				 (write 157)	;LCPRV2
				 (write 251)	;lc-jp3
				 (write r0)
				 (write r1)
				 (read r0)
				 (repeat))
			;; 0xA0 - 0xDF (JIS X 0201 Katakana)
			(if (r0 < 224)
				((write 137)	;lc-kana
				 (write-read-repeat r0))
			;; 0xE0 - 0xEF (JIS X 0213 Plane 1 Row 63 - 94)
			(if (r0 < 240)
				((read r1)
				 (r0 -= 64)
				 ;; same as above
				 (if (r1 <   64) ((read r0) (repeat)))
				 (if (r1 == 127) ((read r0) (repeat)))
				 (if (r1 >  252) ((read r0) (repeat)))
				 (r0 -= 129)
				 (r0 *= 2)
				 (if (r1 > 127) (r1 -= 1))
				 (r1 -= 64)
				 (if (r1 >= 94) ((r1 -= 94) (r0 += 1)))
				 (r0 += 161)
				 (r1 += 161)
				 (write 157)	;LCPRV2
				 (write 251)	;lc-jp3
				 (write r0)
				 (write r1)
				 (read r0)
				 (repeat))
			;; 0xF0 - 0xFE (JIS X 0213 Plane 2 Row 65 - 94)
			(if (r0 < 255)
				((read r1)
				 ;; almost same as above
				 (r0 -= 240)	;from 0xF040
				 (r0 *= 2)
				 (r0 += 64)	;from Row 65
				 (if (r1 <   64) ((read r0) (repeat)))
				 (if (r1 == 127) ((read r0) (repeat)))
				 (if (r1 >  252) ((read r0) (repeat)))
				 (if (r1 > 127) (r1 -= 1))
				 (r1 -= 64)
				 (if (r1 >= 94) ((r1 -= 94) (r0 += 1)))
				 (r0 += 161)
				 (r1 += 161)
				 (write 157)	;LCPRV2
				 (write 252)	;lc-jp4
				 (write r0)
				 (write r1)
				 (read r0)
				 (repeat))
			;; 0xFF (invalid)
			((read r0) (repeat)))))))))))
	"CCL program to read alternative Shift-JIS.")

(define-ccl-program ccl-write-sjis-new
	'(1
		((read r0)
		 (loop
			;; ASCII
			(if (r0 < 128)
				(write-read-repeat r0)
			;; JIS X 0201 katakana
			(if (r0 == 137)		;lc-kana
				((read r0)
				 (write-read-repeat r0))
			;; JIS X 0208
			(if (r0 == 146)		;lc-jp
				((read r0)
				 (read r1)
				 (r0 -= 161)
				 (r1 -= 161)
				 (if (r0 & 1 == 1) (r1 += 94))
				 (r1 += 64)
				 (if (r1 >= 127) (r1 += 1))
				 (r0 /= 2)
				 (r0 += 129)
				 (if (r0 >= 160) (r0 += 64))
				 (write r0)
				 (write r1)
				 (read r0)
				 (repeat))
			;; JIS X 0208
			(if (r0 == 144)		;lc-jpold
				;; same as above
				((read r0)
				 (read r1)
				 (r0 -= 161)
				 (r1 -= 161)
				 (if (r0 & 1 == 1) (r1 += 94))
				 (r1 += 64)
				 (if (r1 >= 127) (r1 += 1))
				 (r0 /= 2)
				 (r0 += 129)
				 (if (r0 >= 160) (r0 += 64))
				 (write r0)
				 (write r1)
				 (read r0)
				 (repeat))
			(if (r0 == 157)		;LCPRV2
				((read r0)
				 ;; JIS X 0213 Plane 1
				 (if (r0 == 251)	;lc-jp3
					;; same as above
					((read r0)
					 (read r1)
					 (r0 -= 161)
					 (r1 -= 161)
					 (if (r0 & 1 == 1) (r1 += 94))
					 (r1 += 64)
					 (if (r1 >= 127) (r1 += 1))
					 (r0 /= 2)
					 (r0 += 129)
					 (if (r0 >= 160) (r0 += 64))
					 (write r0)
					 (write r1)
					 (read r0)
					 (repeat))
				 ;; JIS X 0213 Plane 2
				 (if (r0 == 252)	;lc-jp4
					;; almost same as above
					((read r0)
					 (read r1)
					 (r0 -= 161)
					 (r1 -= 161)
					 ;; Row 1-64 are reserved and
					 ;; cannot be encoded in SJIS
					 (if (r0 < 64) ((read r0) (repeat)))
					 (if (r0 & 1 == 1) (r1 += 94))
					 (r1 += 64)
					 (if (r1 >= 127) (r1 += 1))
					 (r0 -= 64)	;from Row 65
					 (r0 /= 2)
					 (r0 += 240)	;from 0xF040
					 (write r0)
					 (write r1)
					 (read r0)
					 (repeat)))))
			;; other (invalid)
			((read r0) (repeat))))))))))
	"CCL program to write alternative Shift-JIS.")
				   
(make-coding-system
	'*sjis-new* 4 ?s
	"Alternative Shift-JIS (based on JIS X 0213)." t
	(cons ccl-read-sjis-new ccl-write-sjis-new))

;(setq *coding-category-iso-8-2* '*euc-japan-new*)
;(setq *coding-category-sjis* '*sjis-new*)
;(set-coding-priority
;	'(*coding-category-iso-8-2*
;	  *coding-category-sjis*
;	  *coding-category-iso-8-1*
;	  *coding-category-big5*))


--
伊藤隆幸 (ITO Takayuki)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads