Class: BDFFont
- Inherits:
-
Object
- Object
- BDFFont
- Defined in:
- bdffont.rb
Overview
Note:
iso8859 と jisx0208 のみに対応
BDFフォント描画用クラス
Instance Attribute Summary (collapse)
-
- (Integer) height
readonly
バウンディングボックスの縦幅(最大値).
Instance Method Summary (collapse)
-
- (Object?) [](index)
配列として指定した際に、BDFフォント1文字分用のクラスを返す.
-
- (Object) add(bdffilename, col = [255, 255, 255, 255])
BDFファイルを追加。.
-
- (BDFFont) initialize(bdffilename, col = [255, 255, 255, 255])
constructor
コンストラクタ.
Constructor Details
- (BDFFont) initialize(bdffilename, col = [255, 255, 255, 255])
コンストラクタ
255 256 257 258 259 260 261 |
# File 'bdffont.rb', line 255 def initialize(bdffilename, col = [255, 255, 255, 255]) @bdffiles = [] bdfdt = BDFdata.new(bdffilename, col) @bdffiles.push(bdfdt) @width = bdfdt.width @height = bdfdt.height end |
Instance Attribute Details
- (Integer) height (readonly)
Returns バウンディングボックスの縦幅(最大値)
248 249 250 |
# File 'bdffont.rb', line 248 def height @height end |
Instance Method Details
- (Object?) [](index)
配列として指定した際に、BDFフォント1文字分用のクラスを返す
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'bdffont.rb', line 284 def [](index) @bdffiles.each do |d| code = index case d.charset when :jisx0208 code = self.sjis2jisx0208(code.ord) when :iso10646 # BSJISiso10646ւ̕ϊ@Ȃc code = NKF.nkf('-w -S --cp932', code).ord else code = code.ord end if d.bdf_dic.has_key?(code) return d.bdf_dic[code] end end return nil end |
- (Object) add(bdffilename, col = [255, 255, 255, 255])
BDFファイルを追加。
漢字BDFフォント(jisx0208)でクラスを生成した後、 英数字BDFフォント(iso8859)を一緒に含める時に使う。
271 272 273 274 275 276 |
# File 'bdffont.rb', line 271 def add(bdffilename, col = [255, 255, 255, 255]) bdfdt = BDFdata.new(bdffilename, col) @bdffiles.push(bdfdt) @width = bdfdt.width if @width <= bdfdt.width @height = bdfdt.height if @height <= bdfdt.height end |