macUtils¶
ttLib.macUtils.py – Various Mac-specific stuff.
-
class
fontTools.ttLib.macUtils.
SFNTResourceReader
(path, res_name_or_index)[source]¶ Simple read-only file wrapper for ‘sfnt’ resources.
-
close
()¶ Disable all I/O operations.
-
closed
¶ True if the file is closed.
-
detach
()¶ Disconnect this buffer from its underlying raw stream and return it.
After the raw stream has been detached, the buffer is in an unusable state.
-
fileno
()¶ Returns underlying file descriptor if one exists.
OSError is raised if the IO object does not use a file descriptor.
-
flush
()¶ Does nothing.
-
getbuffer
()¶ Get a read-write view over the contents of the BytesIO object.
-
getvalue
()¶ Retrieve the entire contents of the BytesIO object.
-
isatty
()¶ Always returns False.
BytesIO objects are not connected to a TTY-like device.
-
read
(size=- 1, /)¶ Read at most size bytes, returned as a bytes object.
If the size argument is negative, read until EOF is reached. Return an empty bytes object at EOF.
-
read1
(size=- 1, /)¶ Read at most size bytes, returned as a bytes object.
If the size argument is negative or omitted, read until EOF is reached. Return an empty bytes object at EOF.
-
readable
()¶ Returns True if the IO object can be read.
-
readinto
(buffer, /)¶ Read bytes into buffer.
Returns number of bytes read (0 for EOF), or None if the object is set not to block and has no data to read.
-
readinto1
(buffer, /)¶
-
readline
(size=- 1, /)¶ Next line from the file, as a bytes object.
Retain newline. A non-negative size argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty bytes object at EOF.
-
readlines
(size=None, /)¶ List of bytes objects, each a line from the file.
Call readline() repeatedly and return a list of the lines so read. The optional size argument, if given, is an approximate bound on the total number of bytes in the lines returned.
-
seek
(pos, whence=0, /)¶ Change stream position.
- Seek to byte offset pos relative to position indicated by whence:
0 Start of stream (the default). pos should be >= 0; 1 Current position - pos may be negative; 2 End of stream - pos usually negative.
Returns the new absolute position.
-
seekable
()¶ Returns True if the IO object can be seeked.
-
tell
()¶ Current file position, an integer.
-
truncate
(size=None, /)¶ Truncate the file to at most size bytes.
Size defaults to the current file position, as returned by tell(). The current file position is unchanged. Returns the new size.
-
writable
()¶ Returns True if the IO object can be written.
-
write
(b, /)¶ Write bytes to file.
Return the number of bytes written.
-
writelines
(lines, /)¶ Write lines to the file.
Note that newlines are not added. lines can be any iterable object producing bytes-like objects. This is equivalent to calling write() for each element.
-