Class: AtariBitmapFont

Inherits:
NativeFileType show all
Includes:
Font
Defined in:
lib/native_file_types/atari800/AtariBitmapFont.rb

Instance Attribute Summary

Attributes inherited from NativeFileType

#aux_code, #contents, #file_system_image, #file_type, #filename, #meta_data

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Font

#char_height, #draw_string, #font_description, #font_format, #line_of_print, #normalised_font_name, #picture_format, #picture_height, #picture_width, #to_font, #to_picture

Methods inherited from NativeFileType

#<=>, #==, 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

Methods included from SubclassTracking

extended

Constructor Details

This class inherits a constructor from NativeFileType

Class Method Details

.file_system_file_typesObject



14
15
16
17
18
# File 'lib/native_file_types/atari800/AtariBitmapFont.rb', line 14

def self.file_system_file_types
  {
    AtariDos=>:any
  }
end

Instance Method Details

#char_width(a) ⇒ Object



51
52
53
# File 'lib/native_file_types/atari800/AtariBitmapFont.rb', line 51

def char_width(a)
	8
end

#draw_char(canvas, char, x, y, colour) ⇒ Object



55
56
57
58
# File 'lib/native_file_types/atari800/AtariBitmapFont.rb', line 55

def draw_char(canvas,char,x,y,colour)
	b=Atari800.char_to_screen_code(char)
	return draw_bitmap(canvas,b,x,y,colour)
end

#fontnameObject



20
21
22
# File 'lib/native_file_types/atari800/AtariBitmapFont.rb', line 20

def fontname
	filename.sub(/\.FNT$/,'')
end

#get_charlistObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/native_file_types/atari800/AtariBitmapFont.rb', line 31

def get_charlist
	if @charlist.nil? then
		@charlist=[]
		0x80.times do |i|
			b=i
			char_data={}
			char_data[:native_encoding]=Atari800.screen_code_to_atascii(b)
			char_data[:unicode_encoding]=Atari800.atascii_to_unicode(Atari800.screen_code_to_atascii(b))
			char_data[:width]=8 #width in pixels
	  		bitstreams = PNG::Canvas.new char_data[:width],point_size, 0
			draw_bitmap(bitstreams,b,0,0,1)
			char_data[:bitstreams]=bitstreams.data
			@charlist<<char_data
		end
	end
	@charlist
end

#point_sizeObject



24
25
26
# File 'lib/native_file_types/atari800/AtariBitmapFont.rb', line 24

def	point_size
	8
end