萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 作業系統 >  >> Solaris 介紹

Solaris 8 使用與編輯 PostScript 字型:DPS 程式設計與 fontedit 實務

簡體中文 PostScript 字型一覽

Solaris DPS (Display PostScript) 系統提供以下中文字型,皆可像羅馬字型同樣使用:

字型名稱說明
宋體 / 宋體 EUC宋體、EUC 編碼、水平顯示
楷體 / 楷體 EUC楷體、EUC 編碼、水平顯示
仿宋體 / 仿宋體 EUC仿宋體、EUC 編碼、水平顯示
黑體 / 黑體 EUC黑體、EUC 編碼、水平顯示

建立複合羅馬與中文字型

可結合任意羅馬字型與中文字型建立複合字型。範例 PostScript 代碼定義 Times-Roman + 楷體 複合字型,ASCII 用 Times 斜體,中文用楷體:

/make EUC font {
  /AsianFont exch def
  /WestFont exch def
  /NewFont exch def
  /CIDInit /ProcSet findresource
  begin
    NewFont [ AsianFont WestFont ]
    beginrearrangedfont
    1 usefont
    1
    endbfrange
    endrearrangedfont
  end
  bind def
} bind def

/LC_Times-Roman /Times-Roman /Kai-Medium make EUC font

DPS 程式設計中使用中文字型

在 DPS 繪圖時,可像使用羅馬字型般直接選用中文字型。範例 C 程式片段:

defineps PSWDisplayText(char *text)
  /pointSize 50 def
  /Helvetica pointSize selectfont (Hello World) stringwidth pop 2 div neg 0 moveto (Hello World) show
  /cpSize 40 def
  /Song-Medium cpSize selectfont (text) stringwidth pop 2 ...

呼叫 PSWDisplayText(中文文字) 即可顯示。DPS 亦支援 TrueType 字型。

使用 fontedit 編輯點陣字型 (BDF → PCF)

  1. 建立工作目錄:mkdir /tmp/newfont && cd /tmp/newfont
  2. 啟動 fontedit:執行 fontedit (僅支援 BDF 格式,不支援 PCF)
  3. 準備 BDF 檔:編碼需從 8481 (0x2121) 起始
  4. 編輯字形:
    • 選擇「裝入」載入 BDF 檔
    • 選擇「選擇」輸入高/低位元組編碼 (如 0x3302)
    • 設定碼長為「多位元組」
    • 點選「編輯」於畫布修改像素 (左鍵開啟、右鍵關閉)
    • 完成後點「存儲」
  5. 轉換為 PCF 格式:bdftopcf -o myfont14.pcf myfont.bdf
  6. 安裝字型:將 PCF 檔放入字型目錄並執行 fc-cache 更新快取。

詳細參數請參閱 bdftopcf(1) 手冊頁。

copyright © 萬盛學電腦網 all rights reserved