Class: FontRecord

Inherits:
BiffRecord show all
Defined in:
lib/surpass/biff_record.rb

Overview

WARNING

The font with index 4 is omitted in all BIFF versions.
This means the first four fonts have zero-based indexes, and
the fifth font and all following fonts are referenced with one-based
indexes.

Offset Size Contents 0 2 Height of the font (in twips = 1/20 of a point) 2 2 Option flags:

Bit Mask    Contents
0   0001H   1 = Characters are bold (redundant, see below)
1   0002H   1 = Characters are italic
2   0004H   1 = Characters are underlined (redundant, see below)
3   0008H   1 = Characters are struck out
      0010H 1 = Outline
      0020H  1 = Shadow

4 2 Colour index 6 2 Font weight (100-1000).

Standard values are 0190H (400) for normal text and 02BCH
(700) for bold text.

8 2 Escapement type:

0000H = None
0001H = Superscript
0002H = Subscript

10 1 Underline type:

00H = None
01H = Single
21H = Single accounting
02H = Double
22H = Double accounting

11 1 Font family:

00H = None (unknown or don't care)
01H = Roman (variable width, serifed)
02H = Swiss (variable width, sans-serifed)
03H = Modern (fixed width, serifed or sans-serifed)
04H = Script (cursive)
05H = Decorative (specialised, i.e. Old English, Fraktur)

12 1 Character set:

00H = 0 = ANSI Latin
01H = 1 = System default
02H = 2 = Symbol
4DH = 77 = Apple Roman
80H = 128 = ANSI Japanese Shift-JIS
81H = 129 = ANSI Korean (Hangul)
82H = 130 = ANSI Korean (Johab)
86H = 134 = ANSI Chinese Simplified GBK
88H = 136 = ANSI Chinese Traditional BIG5
A1H = 161 = ANSI Greek
A2H = 162 = ANSI Turkish
A3H = 163 = ANSI Vietnamese
B1H = 177 = ANSI Hebrew
B2H = 178 = ANSI Arabic
BAH = 186 = ANSI Baltic
CCH = 204 = ANSI Cyrillic
DEH = 222 = ANSI Thai
EEH = 238 = ANSI Latin II (Central European)
FFH = 255 = OEM Latin I

13 1 Not used 14 var. Font name:

BIFF5/BIFF7: Byte string, 8-bit string length
BIFF8: Unicode string, 8-bit string length

The boldness and underline flags are still set in the options field, but not used on reading the font. Font weight and underline type are specified in separate fields instead.

Constant Summary collapse

RECORD_ID =
0x0031

Constants inherited from BiffRecord

BiffRecord::BIFF_LIMIT, BiffRecord::CONTINUE_RECORD_ID

Instance Attribute Summary

Attributes inherited from BiffRecord

#record_data

Instance Method Summary collapse

Methods inherited from BiffRecord

#record_header, #to_biff

Constructor Details

#initialize(height, options, colour_index, weight, escapement, underline, family, charset, name) ⇒ FontRecord

Returns a new instance of FontRecord.



610
611
612
613
614
# File 'lib/surpass/biff_record.rb', line 610

def initialize(height, options, colour_index, weight, escapement, underline, family, charset, name)
  #TODO implement upack1 fully
  args = [height, options, colour_index, weight, escapement,underline, family, charset, 0x00]
  @record_data = args.pack('v5C4') + [name.length, 0].pack('CC') + name
end