Class: ShapeTableFont
Overview
Shape Table containing a Beagle Bros “Apple Mechanic” format font see e.g. apple2.org.za/gswv/a2zine/Docs/AppleMechanic.txt Format is: File name starts with “]” shape table that loads at $4000 or $6100 100 entries in shape table entry 1 (offset 0) is a space entry 1..98 : entry 99 is the gap between 2 chars
Instance Attribute Summary
#aux_code, #contents, #file_system_image, #file_type, #filename, #meta_data
Instance Method Summary
collapse
Methods included from Font
#draw_string, #font_format, #normalised_font_name, #picture_format, #picture_height, #picture_width, #to_font, #to_picture
Methods included from ShapeTable
#draw_shape
Methods inherited from AppleBinary
file_system_file_types, #header_length, load_address, #to_disassembly
#<=>, #==, all_native_file_types, best_fit, code_for_tests, compatability_score, #data_without_header, file_type_matches?, #full_filename, #header_length, #initialize, is_valid_file_if, #load_address, load_address, matching_score, native_file_types_possible_on_file_system, non_matching_score, #to_hex_dump, #to_info_dump, #type_description
extended
Constructor Details
This class inherits a constructor from NativeFileType
Instance Method Details
#char_height ⇒ Object
87
88
89
|
# File 'lib/native_file_types/apple2/ShapeTableFont.rb', line 87
def char_height
point_size
end
|
#char_width(c) ⇒ Object
82
83
84
85
|
# File 'lib/native_file_types/apple2/ShapeTableFont.rb', line 82
def char_width(c)
(x,y)=draw_shape(nil,,c[0]-31,0,0,nil)
return x.abs+inter_char_gap
end
|
#draw_char(canvas, char, x, y, colour) ⇒ Object
120
121
122
123
124
125
|
# File 'lib/native_file_types/apple2/ShapeTableFont.rb', line 120
def draw_char(canvas,char,x,y,colour)
shape_number=char[0]-31
(x,y)=draw_shape(canvas,,shape_number,x,y,colour)
(x,y)=draw_shape(canvas,,99,x,y,colour) [x,y]
end
|
#font_description ⇒ Object
115
116
117
|
# File 'lib/native_file_types/apple2/ShapeTableFont.rb', line 115
def font_description
"#{fontname} #{point_size.to_i}"
end
|
#fontname ⇒ Object
111
112
113
|
# File 'lib/native_file_types/apple2/ShapeTableFont.rb', line 111
def fontname
filename[1,100]
end
|
#get_charlist ⇒ Object
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# File 'lib/native_file_types/apple2/ShapeTableFont.rb', line 90
def get_charlist
if @charlist.nil? then
@charlist=[]
(1..96).each do |i|
b=i+31
char_data={}
char_data[:native_encoding]=b
char_data[:unicode_encoding]=b
char_data[:width]=char_width(b.chr) require 'PatchedPNG'
bitstreams = PNG::Canvas.new char_data[:width],point_size, 0
(x,y)=draw_shape(bitstreams,,i,0,0,1)
char_data[:bitstreams]=bitstreams.data
@charlist<<char_data
end
end
@charlist
end
|
#inter_char_gap ⇒ Object
75
76
77
78
79
80
|
# File 'lib/native_file_types/apple2/ShapeTableFont.rb', line 75
def inter_char_gap
if @inter_char_gap.nil? then
calc_point_size_and_inter_char_gap
end
@inter_char_gap
end
|
#line_of_print ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/native_file_types/apple2/ShapeTableFont.rb', line 54
def line_of_print
if @line_of_print.nil? then
canvas = PNG::Canvas.new point_size,point_size, 0
(x,y)=draw_shape(canvas,,34,0,0,1) canvas.data.length.times do |i|
line=canvas.data.length-i-1
canvas.data[line].each {|x| return line unless x==0}
end
end
return point_size-2
end
|
#point_size ⇒ Object
47
48
49
50
51
52
|
# File 'lib/native_file_types/apple2/ShapeTableFont.rb', line 47
def point_size
if @point_size.nil? then
calc_point_size_and_inter_char_gap
end
@point_size
end
|