追蹤
子凌的精靈夜語
關於部落格
一個分享小短文和linux心得的地方
  • 63617

    累積人氣

  • 0

    今日人氣

    0

    追蹤人氣

子凌的linux筆記 - Scim安裝嘸囀米的方法

※產生Scim專用的嘸蝦米Table
由於嘸蝦米非自由軟體,故很難直接取得套件來安裝,
所幸linux開放的架構,只要有輸入法表格檔,就可以自己產生輸入法來使用
Scim所使用的表格檔和gcin、xcin的有點不同,例如:
原來xcin、gcin 中的表格中,嘸蝦米的前幾個字根大致長得像:
a       對
aa      寸
aa      丶
aaa     鑫
aaa     龘
aaa     鑆
aaar    鑆
但在Scim的表格則是:
a       對 100
aa      寸 100
aa      丶 99
aaa     鑫 100
aaa     龘 99
aaa     鑆 98
aaar    鑆 100
後面的數字即代表重碼時的優先順序,不過原來的表格應該是比較接近上面的那種,
小弟寫了個小程式scimtablegenerate.exe,可以幫整個Table補上這些數字,可以在這裡下載
此程式需要mono-jit才可執行(最近都在練習用mono寫程式)
使用時先確定表格為utf8編碼,如果不是,可用iconv轉碼,語法如下:
iconv -f big5 -t utf8 -o liu5.cin.utf8 liu5.cin
如此即可將liu5.cin轉為utf8編碼,並存檔為liu5.cin.utf8
再將liu5.cin.utf8修剪為:
a       對
aa      寸
aa      丶
aaa     鑫
aaa     龘
..............
..............
zu,  づ
zu,v づ
zu.  ズ
zu.  ヅ
zu.v ヅ
zuv, づ
zuv. ヅ
再用小弟的
scimtablegenerate.exe將數字補上
./scimtablegenerate.exe liu5.utf8 liu5.utf8.scim
如此就產生liu5.utf8.scim檔,內容就是補上數字的版本
接下來就是在liu5.utf8.scim中補上其他的資訊,完成後的檔案大致像這樣:
### File header must not be modified
### This file must be encoded into UTF-8.
### This file comes from xcin module.
SCIM_Generic_Table_Phrase_Library_TEXT
VERSION_1_0

### Begin Table definition.
BEGIN_DEFINITION

### An unique id to distinguish this table among others.
### Use uuidgen to generate this kind of id.
UUID = 3d872a7a-760e-400c-8b23-688d38390e81

### A unique number indicates the version of this file.
### For example the last modified date of this file.
### This number must be less than 2^32.
SERIAL_NUMBER = 20040922

ICON = /usr/share/scim/icons/liu5.png

### The default name of this table
NAME = Liu5

### The local names of this table
NAME.zh_CN = 嘸蝦米
NAME.zh_TW = 嘸蝦米
NAME.zh_HK = 嘸蝦米

### Supported languages of this table
LANGUAGES = zh_TW,zh_HK,zh_CN,zh_SG

### Prompt string to be displayed in the status area.
STATUS_PROMPT = 中

### If true then the first candidate phrase
### will be selected automatically during inputing.
AUTO_SELECT = FALSE

### If true then a multi wildcard will be appended
### at the end of inputing string automatically.
AUTO_WILDCARD = TRUE

### If true then the result string will be committed to client automatically.
### This should be used with AUTO_SELECT = TRUE.
AUTO_COMMIT = FALSE

### If true then the inputed string will be automatically splitted during inputing.
AUTO_SPLIT = TRUE

### If true then the phrases' frequencies will be adjusted dynamically.
DYNAMIC_ADJUST = TRUE

### If true then the preedit area will be filled up by the current candidate phrase automatically.
AUTO_FILL = FALSE

### If true then the lookup table will always be shown if there is any candidate phrase.
### Otherwise the lookup table won't be shown unless the user requires it by moving the preedit caret left.
ALWAYS_SHOW_LOOKUP = TRUE

### Use full width punctuation by default
DEF_FULL_WIDTH_PUNCT = TRUE

### Use full width letter by default
DEF_FULL_WIDTH_LETTER = FALSE

### The maxmium length of a key.
MAX_KEY_LENGTH = 4

### Valid input chars.
VALID_INPUT_CHARS = ,.'abcdefghijklmnopqrstuvwxyz[]

### Single wildcard char, can have multiple chars.
SINGLE_WILDCARD_CHAR = ?

### Multi wildcard char.
MULTI_WILDCARD_CHAR = *

### The key strokes to split inputed string.
SPLIT_KEYS = space

### The key strokes to commit the convert result to client.
COMMIT_KEYS = space

### The key strokes to forward the inputed string to client.
FORWARD_KEYS = Return

### The key strokes to select candidiate phrases.
SELECT_KEYS = space,2,3,4,5,6,7,8,9,0
### The key strokes to page up the lookup table.
PAGE_UP_KEYS = Page_Up

### The key strokes to page down the lookup table.
PAGE_DOWN_KEYS = Page_Down,space
END_DEFINITION

### Begin Table data.
BEGIN_TABLE
a       對 100
aa      寸 100
aa      丶 99
aaa     鑫 100
aaa     龘 99
aaa     鑆 98
...................
...................
zu,v づ   98
zu.  ズ 97
zu.  ヅ   96
zu.v ヅ   95
zuv, づ 100
zuv. ヅ 99
END_TABLE
此即為Scim所需要表格檔

※產生Scim的輸入法檔案
有了上面的表格檔後,就可以用scim-產生scim需要bin檔
scim-make-table liu5.utf8.scim -b -o liu5.bin
產生的liu5.bin即可以在scim的設定程式裡,泛用對照表 -> 管理對照表中,
將此檔加入,再重新登入就可以使用嘸蝦米囉
相簿設定
標籤設定
相簿狀態