Class: Prune::Fonts::MsGothic

Inherits:
BaseJa show all
Defined in:
lib/prune/fonts/ja/ms_gothic.rb

Constant Summary

Constants inherited from BaseJa

BaseJa::HALF_SIZED_CHARS

Instance Attribute Summary

Attributes inherited from Base

#font_name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseJa

#decode, #width

Methods inherited from Base

bold?, #encoding, font_name, #font_sym, italic?, #name, #reference

Methods included from PObjects

pa, pd, ph, pl, pn, ps

Constructor Details

#initialize(document, options = {}) ⇒ MsGothic

Returns a new instance of MsGothic.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/prune/fonts/ja/ms_gothic.rb', line 15

def initialize(document, options = {})
  super(document)
  self.name = self.class.key(options)
  if bold?(options) && italic?(options)
    self.base_font = pn("MS-Gothic,BoldItalic")
    self.flags = calculate_flags(
      :fixed_pitch => true,
      :symbolic => true,
      :italic => true,
      :force_bold => true)
    self.italic_angle = -11
    self.stem_v = 156
  elsif bold?(options)
    self.base_font = pn("MS-Gothic,Bold")
    self.flags = calculate_flags(
      :fixed_pitch => true,
      :symbolic => true,
      :force_bold => true)
    self.italic_angle = 0
    self.stem_v = 156
  elsif italic?(options)
    self.base_font = pn("MS-Gothic,Italic")
    self.flags = calculate_flags(
      :fixed_pitch => true,
      :symbolic => true,
      :italic => true)
    self.italic_angle = -11
    self.stem_v = 78
  else
    self.base_font = pn("MS-Gothic")
    self.flags = calculate_flags(
      :fixed_pitch => true,
      :symbolic => true)
    self.italic_angle = 0
    self.stem_v = 78
  end
end

Class Method Details

.key(options) ⇒ Object



7
8
9
10
11
12
# File 'lib/prune/fonts/ja/ms_gothic.rb', line 7

def key(options)
  key = font_name
  key << "_bold" if bold?(options)
  key << "_italic" if italic?(options)
  PObjects.pn(key)
end