4 Announced Date 2005113 Ref http www cns

  • Slides: 34
Download presentation
作業 4 福利逼ㄟ斯滴 中文化 Announced Date: 2005/11/3

作業 4 福利逼ㄟ斯滴 中文化 Announced Date: 2005/11/3

編碼標準 Ref: http: //www. cns 11643. gov. tw/web/word. jsp > ASCII – 8 bits

編碼標準 Ref: http: //www. cns 11643. gov. tw/web/word. jsp > ASCII – 8 bits (理論上有 256 種可能) – 0 x 00 ~ 0 x 7 F 共 128 種字元 • • 0 x 00 ~ 0 x 1 F control characters 0 x 20 ~ 0 x 7 F printable characters > Big 5 – 使用 2 bytes 來存放中文字 (理論上有 65536 種可能) – 實際上為與 ASCII 相容, 只能使用 19782 個 • [0 x 81 ~ 0 x. FE][0 x 40~0 x 7 E, 0 x. A 1 ~ 0 x. FE] = 126 * (63 + 94) = 126 * 157 = 19782 2

編碼標準 – Microsoft Windows Codepage 950 4

編碼標準 – Microsoft Windows Codepage 950 4

編碼標準 – ISO 10646 and Unicode (1) > Goal – 集結全球通用字符集, 成一大聯 – 集

編碼標準 – ISO 10646 and Unicode (1) > Goal – 集結全球通用字符集, 成一大聯 – 集 UCS • Universal multiple-octet coded Character Set – 4 bytes encoding • • 128 Groups 256 Planes each group – BMP • • • Basic Multilingual Plane 00 group, 00 plane 65536 encoding space UCS-2 Unicode – Why in BMP • 若所有字集都在 BMP 中, 就可 以只使用 2 bytes, 否則就要 用 4 bytes, 不能混用 5

編碼標準 – ISO 10646 and Unicode (2) > BMP 6

編碼標準 – ISO 10646 and Unicode (2) > BMP 6

編碼標準 – ISO 10646 and Unicode (2) > UTF: UCS Transformation Format – UTF-16

編碼標準 – ISO 10646 and Unicode (2) > UTF: UCS Transformation Format – UTF-16 • 將一個 32 -bit ISO 10646 字元轉成多個 16 -bit Unicode – UTF-8 • • 將一個32 -bit ISO 10646 字元轉成多個 8 -bit Unicode 將一個16 -bit Unicode 字元轉成多個 8 -bit Unicode 7

中文環境 (4) > 設定 locale – csh/tcsh shell • setenv LC_CTYPE zh_TW. Big 5

中文環境 (4) > 設定 locale – csh/tcsh shell • setenv LC_CTYPE zh_TW. Big 5 – Bourne Shell • export LC_CTYPE=zh_TW. Big 5 – /usr/share/locale/ • • 各國的 locale 資訊 命名規則: 語言_地區名: 字元編碼名稱 > zh_TW. Big 5 > zh_CN. GBK 11

中文環境 (5) > 中文 console (Console Login) – big 5 con - 類似倚天的中文 Console

中文環境 (5) > 中文 console (Console Login) – big 5 con - 類似倚天的中文 Console Ref: http: //netlab. cse. yzu. edu. tw/~statue/freebsd/zh-tut/big 5 con. html • % b 5 c > 中文 Terminal (Remote Login) – M$ Windows: putty, pietty, netterm, multi-term, telnet, …etc. – X Window: xterm, rxvt, aterm, mterm, …etc. – 設定好中文支援,登入後 • • setenv LC_CTYPE en_ISO. 8859 -1 export LC_CTYPE=en_ISO. 8859 -1 即可看到中文 > 中文 Xwindow – 建立 L 10 N 中文環境 • • • (csh/tcsh) (sh/bash) 英文,但支援 multibyte character 安裝中文字形 設定 Shell locale 環境 安裝 xcin 中文輸入程式 12

安裝中文字型 (1) > 兩大中文字型種類 – 點陣字型 (Bitmapped Font) • • • BDF (Bitmap Distribution

安裝中文字型 (1) > 兩大中文字型種類 – 點陣字型 (Bitmapped Font) • • • BDF (Bitmap Distribution Format) 點陣分散格式 HBF (Hanzi Bitmap Font) 漢字點陣字體 PCF (Portable Compiled Font) – 曲線描邊字型 (Outline Fonts) • True Type Font (TTF) 14

安裝中文字型 (2) > Font Path: /usr/X 11 R 6/lib/X 11/fonts/misc/, – % xset q

安裝中文字型 (2) > Font Path: /usr/X 11 R 6/lib/X 11/fonts/misc/, – % xset q /usr/X 11 R 6/lib/X 11/fonts/TTF/, /usr/X 11 R 6/lib/X 11/fonts/Type 1/, > 安裝字型步驟 /usr/X 11 R 6/lib/X 11/fonts/75 dpi/, – 透過 ports 安裝字型檔案 /usr/X 11 R 6/lib/X 11/fonts/100 dpi/, /usr/X 11 R 6/lib/X 11/fonts/local/ – 使用 ttfm 安裝該字型 – 使用 fc-cache 建立字型資料庫 – 修改各軟體設定使用別的字型 15

安裝中文字型 (3) > 安裝 ttfm – True. Type 字型管理 具 > ttfm – ttfinfo

安裝中文字型 (3) > 安裝 ttfm – True. Type 字型管理 具 > ttfm – ttfinfo 讀取 ttf 字型格式資訊的程式 • % ttfinfo /usr/local/share/fonts/True. Type/fireflysung. ttf tytsai@tybsd: /<3>fonts/True. Type> ttfinfo /usr/local/share/fonts/True. Type/fireflysung. ttf TTFINFO_FONT_FILE="/usr/local/share/fonts/True. Type/fireflysung. ttf" TTFINFO_FACE_NUM="1" TTFINFO_FACE_INDEX="0" TTFINFO_FONT_NAME="AR PL New Sung" TTFINFO_FONT_PSNAME="AR-PL-New-Sung" TTFINFO_FOUNDRY_NAME="misc" TTFINFO_WEIGHT_NAME="medium" TTFINFO_WIDTH="normal" TTFINFO_NUMCMAP="3" TTFINFO_CMAP 0="0, 3" TTFINFO_CMAPNAME 0="Apple Unicode, (v. 2. 0)" TTFINFO_CMAP 1="1, 0" TTFINFO_CMAPNAME 1="Apple, Roman" TTFINFO_CMAP 2="3, 1" TTFINFO_CMAPNAME 2="Windows, Unicode" TTFINFO_MAPNUM="3" TTFINFO_FONTMAP 1="-misc-AR PL New Sung-medium-r-normal--0 -0 -p-0 -big 5 -0" TTFINFO_FONTMAP 2="-misc-AR PL New Sung-medium-r-normal--0 -0 -p-0 -gb 2312. 1980 -0" TTFINFO_FONTMAP 3="-misc-AR PL New Sung-medium-r-normal--0 -0 -p-0 -jisx 0208. 1983 -0" 16

安裝中文字型 (4) – ttfm. sh tytsai@tybsd: /<3>fonts/True. Type> ttfm. sh True-Type Font Manager 0.

安裝中文字型 (4) – ttfm. sh tytsai@tybsd: /<3>fonts/True. Type> ttfm. sh True-Type Font Manager 0. 9. 3 Usage: /usr/local/bin/ttfm. sh [option] --add [module] <file>. . . install ttf font --remove [module] <file>. . . remove ttf font from the system --list <module>. . . list all ttf fonts on the system --modules list all ttf manager modules on the system --setdefault <module> <file> set default ming font of module to file --setdefault_kai <module> <file> set default kai font of module to file --initm <module>. . initialize modules --help show this info 17

安裝中文字型 (6) > fireflyttf – % cd /usr/ports/chinese/fireflyttf – % make install clean –

安裝中文字型 (6) > fireflyttf – % cd /usr/ports/chinese/fireflyttf – % make install clean – 透過 ports 安裝的都會自己跑 • • % ttfm. sh --add xttfm /usr/local/share/fonts/True. Type/fireflysung. ttf % fc-cache –f –v /usr/X 11 R 6/lib/X 11/fonts/True. Type/ – File: • • /usr/local/share/fonts/True. Type/fireflysung. ttf /usr/X 11 R 6/lib/X 11/fonts/True. Type/fireflysung. ttf symbolic link 19

安裝中文字型 (7) > 用 xfd 來看 – %setenv LC_CTYPE zh_TW. Big 5 – %

安裝中文字型 (7) > 用 xfd 來看 – %setenv LC_CTYPE zh_TW. Big 5 – % xfd –fa “AR PL New Sung” 20

安裝中文字型 (8) > 增加 Font Path – Edit /etc/X 11/xorg. conf – Restart xwindow

安裝中文字型 (8) > 增加 Font Path – Edit /etc/X 11/xorg. conf – Restart xwindow Section "Files" Rgb. Path Module. Path Font. Path End. Section "/usr/X 11 R 6/lib/X 11/rgb" "/usr/X 11 R 6/lib/modules" "/usr/X 11 R 6/lib/X 11/fonts/misc/" "/usr/X 11 R 6/lib/X 11/fonts/TTF/" "/usr/X 11 R 6/lib/X 11/fonts/Speedo/" "/usr/X 11 R 6/lib/X 11/fonts/Type 1/" "/usr/X 11 R 6/lib/X 11/fonts/CID/" "/usr/X 11 R 6/lib/X 11/fonts/75 dpi/" "/usr/X 11 R 6/lib/X 11/fonts/100 dpi/" "/usr/X 11 R 6/lib/X 11/fonts/local/“ “/usr/X 11 R 6/lib/X 11/fonts/True. Type/” 21

安裝中文 Terminal (1) > rxvt-big 5 – Before • /usr/ports/chinese/rxvt-big 5 – Now, it

安裝中文 Terminal (1) > rxvt-big 5 – Before • /usr/ports/chinese/rxvt-big 5 – Now, it is removed • • I 18 N completely /usr/ports/x 11/rxvt-devel > aterm – /usr/ports/chinese/aterm > eterm – /usr/ports/chinese/eterm > mlterm – /usr/ports/x 11/mlterm 22

安裝中文 Terminal (2) > rxvt – Edit ~/. Xdefaults To use AR PL New

安裝中文 Terminal (2) > rxvt – Edit ~/. Xdefaults To use AR PL New Sung rxvt. mfont: rxvt. border. Color: black rxvt. background: black rxvt. backspacekey: "^H" rxvt. cursor. Color: Indian. Red rxvt. foreground: gray 98 rxvt. geometry: 80 x 24 rxvt. input. Method: xcin rxvt. multibyte_cursor: yes rxvt. multichar_encoding: big 5 rxvt. preedit. Type: Over. The. Spot rxvt. scroll. Tty. Keypress: True rxvt. scroll. Tty. Output: False rxvt. scroll. Bar_right: True rxvt. term. Name: xterm-color rxvt. trough. Color: black !您可選擇想要的字體大小 ! 國喬 16 pt, 國喬 16 pt rxvt. font: 8 x 16 rxvt. mfont: kc 15 f ! End ports/chinese/rxvt configuartion -aliasmisc-ar pl new sung-medium-r-normal-*-*-160 -*-*-p-*-big 5 -0 23

安裝中文 Terminal (3) > aterm – Edit ~/. Xdefaults To use AR PL New

安裝中文 Terminal (3) > aterm – Edit ~/. Xdefaults To use AR PL New Sung aterm. mfont: aterm. border. Color: black aterm. background: black aterm. backspacekey: "^H" aterm. cursor. Color: Indian. Red aterm. foreground: gray 98 aterm. geometry: 80 x 24 aterm. input. Method: xcin aterm. multichar_encoding: big 5 aterm. preedit. Type: Over. The. Spot aterm. scroll. Tty. Keypress: True aterm. scroll. Tty. Output: False aterm. scroll. Bar_right: True aterm. shading: 30 aterm. Name: xterm-color aterm. transparent: True aterm. transpscrollbar: True aterm. trough. Color: black !您可選擇想要的字體大小 ! 國喬 16 pt, 國喬 16 pt aterm. font: 8 x 16 aterm. mfont: kc 15 f ! End ports/chinese/aterm configuartion -aliasmisc-ar pl new sung-medium-r-normal-*-*-160 -*-*-p-*-big 5 -0 24

安裝 xcin 中文輸入程式 (1) > xcin 25 – X window Chinese INput 1. 2.

安裝 xcin 中文輸入程式 (1) > xcin 25 – X window Chinese INput 1. 2. 3. % cd /usr/ports/chinese/xcin 25 ; make install clean setenv LC_CTYPE zh_TW. Big 5 (csh/tcsh) export LC_CTYPE=zh_TW. Big 5 (sh/bash) Edit xinitrc or afterstep/autoexec xcin 2. 5 & exec afterstep Function "Init. Function" # Module "I" Animate Module "I" Wait "I" Module "I" Exec "I" Function "I" End. Function Win. List Monitor. Wharf Pager 0 0 Banner xcin 2. 5 & Workspace. State 25

安裝 xcin 中文輸入程式 (3) > 調成自己要的樣子 Ref: http: //xcin. linux. org. tw/ – System:

安裝 xcin 中文輸入程式 (3) > 調成自己要的樣子 Ref: http: //xcin. linux. org. tw/ – System: /usr/X 11 R 6/etc/xcinrc – Personal: ~/. xcin/xcinrc ~/. xcinrc ; ; XIM Input Style Adjustments. ; (define INPUT_STYLE '(Root Over. The. Spot)) (define OVERSPOT_USE_USRCOLOR "YES") (define OVERSPOT_USE_USRFONTSET "YES") (define OVERSPOT_WINDOW_ONLY "YES") 27

安裝 xcin 中文輸入程式 (4) > 留下自己要的輸入法 (define zh_TW. Big 5 '((DEFAULT_IM "bimsphone") (DEFAULT_IM_MODULE "gen_inp")

安裝 xcin 中文輸入程式 (4) > 留下自己要的輸入法 (define zh_TW. Big 5 '((DEFAULT_IM "bimsphone") (DEFAULT_IM_MODULE "gen_inp") (DEFAULT_IM_SINMD "DEFAULT") (PHRASE "default. phr") ; (CINPUT (cj chewing simplex phone bimspinyin bimsphone jyutping ; array 30 jyutping 0 zh_hex)) (CINPUT (bimsphone)) 28

安裝 xcin 中文輸入程式 (5) > 變更 xcin 的字型 – /usr/X 11 R 6/etc/xcinrc ;

安裝 xcin 中文輸入程式 (5) > 變更 xcin 的字型 – /usr/X 11 R 6/etc/xcinrc ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; This is the global configuration of the zh_TW. Big 5 locale ; (define zh_TW. Big 5 '((DEFAULT_IM "cj") (DEFAULT_IM_MODULE "gen_inp") (DEFAULT_IM_SINMD "DEFAULT") (PHRASE "default. phr") ; (CINPUT (cj chewing simplex phone bimspinyin bimsphone jyutping ; array 30 jyutping 0 zh_hex)) (CINPUT (bimsphone)) (FONTSET "-sony-*-24 -*-iso 8859 -1, -*-medium-r-*-24 -*-big 5 -0") ; (OVERSPOT_FONTSET "-sony-*-16 -*-iso 8859 -1, -*-medium-r-*-16 -*-big 5 -0"))) ; (OVERSPOT_FONTSET "-aliasmisc-ar pl new sung-medium-r-normal-*-16 -*-*-*-big 5 -0"))) ; (OVERSPOT_FONTSET "-aliasdynalab-pmingliu-medium-r-normal-*-16 -*-*-*-big 5 -0"))) (OVERSPOT_FONTSET "-aliasmisc-hanwangwcl 06 -medium-r-normal-*-16 -*-*-*-big 5 -0"))) 29

其他設定 (2) > 安裝 zh-auto-tw-l 10 n – %cd /usr/ports/chinese/auto-tw-l 10 n/ – %make

其他設定 (2) > 安裝 zh-auto-tw-l 10 n – %cd /usr/ports/chinese/auto-tw-l 10 n/ – %make install clean – %cd /usr/local/share/skel/zh_TW. Big 5/ – %ls chbsd [/usr/local/share/skel/zh_TW. Big 5] -chwong- ls dot. Xdefaults dot. fonts. conf dot. vimrc dot. bashrc dot. gtkrc dot. xinitrc dot. cshrc dot. inputrc make. conf dot. emacs dot. muttrc outta-port. supfile 32

其他設定 (3) > 設定適合的 Locale – en_US. ISO 8859 -1 v. s zh_TW. Big

其他設定 (3) > 設定適合的 Locale – en_US. ISO 8859 -1 v. s zh_TW. Big 5 – edit /etc/csh. cshrc (or ~/. cshrc) if ( $MY_TTY == cons || $MY_TTY == ttyv ) then setenv LC_CTYPE zh_TW. Big 5 else setenv LC_CTYPE en_US. ISO 8859 -1 endif 33

References > 中文碼介紹 – http: //www. cns 11643. gov. tw/web/word. jsp > Free. BSD

References > 中文碼介紹 – http: //www. cns 11643. gov. tw/web/word. jsp > Free. BSD Chinese HOWTO – http: //netlab. cse. yzu. edu. tw/~statue/freebsd/zh-tut/index. html > Introduction to i 18 n – http: //www. debian. org/doc/manuals/intro-i 18 n/ 34