In this lab you do not need to create a class, just a program that meets the requirements. There should be plenty of opportunities to create functions, but there are no specific functions that are required.
This assignment will introduce a little history of computing. In older computers, before graphical user interfaces such as Windows or Macintosh, fonts were stored in Read Only Memory (ROM) as bit patterns. In the original IBM PC, a character was displayed as an 8 by 8 bit pattern, requiring 8 bytes of data, with each bit representing a pixel. For example, the information for a capital “A” is (for this font, not fonts are not all the same) 24,36, 66, 66, 126, 66, 66, 0. Each value represents one row of 8 pixels. Remember, one byte of memory has 8 bits, so each bit represents a pixel. The color for the character (not individual pixel) was stored separately, so we won’t worry about color in this assignment.
Bitmapped Fonts
The following table shows how this data represents an “A”. The value associated with each bit ranges from the high order bit (value of 128, or 2**7) through the lower order bit (value of 1, or 2**0). Most characters (but not all) left one row and one column blank to create the spacing between characters. In this font you can see that the last row and last column are blank. This will not be true in descenders, characters such as “j” or “g”, where the character descends below the line.
2**7 2**6 2**5 2**4 2**3 2**2 2**1 2**0
Value 128 64 32 16 8 4 2 1
24 X X
36 X X
66 X X
66 X X
126 X X X X X X
66 X X
66 X X
0
Bitmapped Font File
A file has been provided that has the font information for “normal” characters and “bold characters.” The normal characters are the first 256 characters in the file, and the only data you need to worry about for this assignment. Of those, the first 128 characters are standard ASCII characters, any ASCII table will display these characters. The next 128 characters varied from machine to machine. These characters could include characters for playing cards (heart, diamond, club, and spade), or characters used to create
outlines/boxes, characters such as ┌, ┐, ┘, and └, among other characters. We will only need to worry about the first 128 standardized characters for this assignment. If you are interested, the file contains data for 512 characters. The first 256 are a “normal” font (standard and extended ASCII) and the second 256 characters are a “bold” font for the same characters.
Since we have not addressed working with a binary file, where the data is stored in the file the way it is stored in memory, I’ll give you the code to read the data file.
rawFile = open ("cga.bin", "rb") #b for binary data
for x in range (256): #number of characters in the file for y in range (8): #number of bytes per character
data = rawFile.read (1) #read a single byte (an int value) #ugly means each getting the int value into variable “value” (value) = struct.unpack ('B', data)
Assignment
Read the data file and store the information in a data structure. You need to figure out how to store the information such that is can be accessed and displayed on the screen. This will require a multilevel data structure, a list of lists, or a dictionary of lists, or some other structure.
Input and Output
Ask for a string. Continue to ask for a string until the user enters an empty string.
For each string, display on screen a bitmapped representation of the text. Print an “X” for each pixel that would be “on” in the display, and a blank space for each pixel that would be “off.” For example, if I enter “Bitmapped Name” the program should display:
XXXXX X X XX XX X
X X X X X X X
X X XX XXXXX XXX XX XXXX XX XX XX XX XXXX X X X X XXXX XXX XX XXXX
XXXX X X X X X X XX X XX X X X XXX X X XX X X X X X X
X X X X X X X XXXXX XX X XX X XXXXXX X XX X X XXXXX X X X XXXXXX
X X X X X X X X X X X XX X XX X X XX X X X X X X X X
XXXXX XXX XX X X X XXXXXX X X XXXX XXX XX X X XXXXXX X X X XXXX
XXX XXX
Note that you will need to display the entire first row of “pixels” for each letter before moving on to the next row. For each character you will need to work from the high order bit to the low order bit to determine if each pixel should display an “X” or a “ “ in your output.
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme