Skip to content

fontlab_glyport.ui.images

images

Bundle image resources for Qt: the NSImage subset plugins use, and NSCursor.

NSImage.alloc().initWithContentsOfFile_(path), NSImage.imageNamed_(name) over the plugin bundle's resources, and find_image(name, resources) (the SDK's automatic lookup of self.icon = "ExportIcon" or a tool's toolbar) give an image whose pixmap(scale) renders at size() * scale device pixels with alpha:

  • formats Qt reads (PNG, TIFF, ...): from 2x up the name@2x sibling when the bundle has one, else the frame nearest the requested size (multi-image TIFFs carry 1x/2x variants), scaled smoothly;
  • SVG: QSvgRenderer into a transparent image, so every scale is vector;
  • PDF: Qt 5 has no PDF reader, so macOS sips rasterises the page at the requested pixel size into a scratch PNG that is deleted after reading.

Unreadable files give None, as in AppKit. Size is in points: a raster's first frame, an SVG's default size, a PDF page's size at 72 dpi.

Classes

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
IMAGE_TYPES attribute
SIPS attribute
SIPS_TIMEOUT attribute
cursor_class function (qt: Any) -> type <code>NSCursor</code><code> bound to </code><code>qt</code>; standard cursors are shared per binding.
find_image function (name: str | None, resources: str | Path | None) -> Path | None <code>name</code><code> (with or without extension) under </code><code>resources</code> or its lprojs.
image_class function (qt: Any, resources=()) -> type <code>NSImage</code><code> bound to </code><code>qt</code><code> (PythonQt or a namespace with QtGui/QtCore&#91;/QtSvg&#93;) and to the resource folders </code><code>imageNamed&#95;</code> searches.
pdf_size function (path: str | Path, *, run=subprocess.run) -> NSSize | None The first page's size in points, or None when sips cannot read it.
render_pdf function (path: str | Path, width: int, height: int, *, run=subprocess.run) -> bytes | None PNG bytes of the page rasterised at <code>width</code><code> x </code><code>height</code> pixels.
retina_variant function (path: str | Path) -> Path | None A raster's <code>name@2x</code> sibling (AppKit's high-DPI representation).