D64Utility
index
/mnt/common/python/d64py/d64py/D64Utility.py

#======================================================================
# D64Utility.py
#======================================================================

 
Modules
       
d64py

 
Functions
       
asciiToPetsciiChar(fromChar: int) -> int
Convert a single PETSCII character to ASCII.
:param fromChar: The character to be converted.
:return:
asciiToPetsciiString(fromStr: str) -> str
Convert an ASCII string to PETSCII.
:param fromStr: The ASCII string.
:return: The string converted to PETSCII.
findImageType(imagePath: pathlib.Path) -> d64py.Constants.ImageType
Given a path to a file, verify that it's a disk image
and return its image type.
:param imagePath: The path to the file.
:return: The image type.
getCharWidth(char: str, recordData: bytearray)
Get the width of a character in a GEOS font.
:param char: The character whose width is to be returned.
:param recordData: The VLIR record containing font data.
:return: The width of the character in pixels.
getCharacterBitOffset(char: str, recordData: bytearray)
Get the offset in bits from the beginning of a bitstream to the bit
pattern for a given character.
:param c: The character to find the offset for.
:param recordData: The VLIR record containing the font.
:return: The offset of the character from the beginning of a bit stream.
getFontDataOffset(recordData: bytearray)
Get offset to the bitstream data of a font.
:param  recordData: The VLIR record containing the font.
:return: The index to the bitstream data (generally $00ca).
getFontEscape(fontId: int, pointSize: int) -> int
Get the font ID in escape format, given the raw ID and the point size.
:param fontId: The raw font ID.
:param pointSize: The point size of the font.
:return: The font ID in escape format.
getFontId(fontSizeId: int) -> int
Get the raw font ID from an ID in escape format.
:param fontSizeId: The font ID.
:return: The raw font ID (leftmost 10 bits of a two-byte word, shifted).
getFontIndexOffset(recordData: bytearray) -> int
Get offset to the bistream index table of a font.
:param recordData: The VLIR record containing the font.
:return: The index to the bitstream table (generally $0008).
getImageSuffixes() -> list[str]
Return a list of all image type suffixes.
:return: The list of suffixes.
getMegaRecordNo(char: str)
For a mega font, get the VLIR record number that the given character
appears in. Mega fonts store bitstream data in the following records:
48 pt: $20-$2f (blank to '/')
49 pt: $30-$3f ('0' to '?')
50 pt: $40-$4f ('@' to 'O')
51 pt: $50-$5f ('P' to '_')
52 pt: $60-$6f ('`' to 'o')
53 pt: $70-$7f ('p' to DEL)
:param  c: The character whose record number is to be found.
:return: The VLIR record number.
getMegaStringWidth(string: str, megaFontData: bytearray)
For GEOS, return the width of a string in pixels for a given mega-font.
:param string: The string to be measured.
:param megaFontData: The font data (all seven
:return:
getPointSize(escape: int) -> int
Get the point size from a font ID in escape format.
:param escape: The fontID.
:return: The point size (lowest six bits).
getStringWidth(string: str, recordData: bytearray)
For GEOS, return the width of a string in pixels for a given font.
:param string: The string to be measured.
:param recordData: The font data (point-size record).
:return: The string length in pixels.
makeWord(data: bytearray, index: int) -> int
Helper function: make a word from two little-endian bytes.
:param data: The data in which the word is found.
:param index: The location of the first byte.
:return: The word.
petsciiToAsciiChar(fromChar: int) -> int
Convert a single PETSCII character to ASCII.
:param fromChar: The character to be convert.
:return: The converted ASCII character.
petsciiToAsciiString(fromStr: str) -> str
Convert a PETSCII string to ASCII.
:param fromStr: The PETSCII string.
:return: The string translated to ASCII.