Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions SketchfabPlugin.pyp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class SketchfabImporter(plugins.CommandData):
from sketchfab import ui_importer

# Check C4D version
if c4d.GetC4DVersion() < 20000 and c4d.GeGetCurrentOS() == c4d.OPERATINGSYSTEM_WIN:
c4d.gui.MessageDialog("Sorry, but the plugin is incompatible with the version of Cinema 4D you are currently running.\n\nThe Sketchfab plugin for Windows requires\nCinema 4D R20 or greater.", c4d.GEMB_OK)
if c4d.GetC4DVersion() < 2024000 and c4d.GeGetCurrentOS() == c4d.OPERATINGSYSTEM_WIN:
c4d.gui.MessageDialog("Sorry, but the plugin is incompatible with the version of Cinema 4D you are currently running.\n\nThe Sketchfab plugin for Windows requires\nCinema 4D 2024 or greater.", c4d.GEMB_OK)
return False

if self.dialog is None:
Expand All @@ -79,8 +79,8 @@ class SketchfabExporter(plugins.CommandData):
from sketchfab import ui_exporter

# Check C4D version
if c4d.GetC4DVersion() < 20000 and c4d.GeGetCurrentOS() == c4d.OPERATINGSYSTEM_WIN:
c4d.gui.MessageDialog("Sorry, but the plugin is incompatible with the version of Cinema 4D you are currently running.\n\nThe Sketchfab plugin for Windows requires\nCinema 4D R20 or greater.", c4d.GEMB_OK)
if c4d.GetC4DVersion() < 2024000 and c4d.GeGetCurrentOS() == c4d.OPERATINGSYSTEM_WIN:
c4d.gui.MessageDialog("Sorry, but the plugin is incompatible with the version of Cinema 4D you are currently running.\n\nThe Sketchfab plugin for Windows requires\nCinema 4D 2024000 or greater.", c4d.GEMB_OK)
return False

if self.dialog is None:
Expand Down
Binary file modified dependencies/OSX/PIL/.dylibs/libXau.6.dylib
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified dependencies/OSX/PIL/.dylibs/libfreetype.6.dylib
Binary file not shown.
Binary file added dependencies/OSX/PIL/.dylibs/libharfbuzz.0.dylib
Binary file not shown.
Binary file not shown.
Binary file removed dependencies/OSX/PIL/.dylibs/libjpeg.9.dylib
Binary file not shown.
Binary file modified dependencies/OSX/PIL/.dylibs/liblcms2.2.dylib
Binary file not shown.
Binary file modified dependencies/OSX/PIL/.dylibs/liblzma.5.dylib
Binary file not shown.
Binary file removed dependencies/OSX/PIL/.dylibs/libopenjp2.2.3.1.dylib
Binary file not shown.
Binary file not shown.
Binary file modified dependencies/OSX/PIL/.dylibs/libpng16.16.dylib
Binary file not shown.
Binary file added dependencies/OSX/PIL/.dylibs/libsharpyuv.0.dylib
Binary file not shown.
Binary file removed dependencies/OSX/PIL/.dylibs/libtiff.5.dylib
Binary file not shown.
Binary file added dependencies/OSX/PIL/.dylibs/libtiff.6.dylib
Binary file not shown.
Binary file modified dependencies/OSX/PIL/.dylibs/libwebp.7.dylib
Binary file not shown.
Binary file modified dependencies/OSX/PIL/.dylibs/libwebpdemux.2.dylib
Binary file not shown.
Binary file modified dependencies/OSX/PIL/.dylibs/libwebpmux.3.dylib
Binary file not shown.
Binary file modified dependencies/OSX/PIL/.dylibs/libxcb.1.1.0.dylib
Binary file not shown.
Binary file removed dependencies/OSX/PIL/.dylibs/libz.1.2.11.dylib
Binary file not shown.
Binary file not shown.
45 changes: 34 additions & 11 deletions dependencies/OSX/PIL/BdfFontFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"""
Parse X Bitmap Distribution Format (BDF)
"""
from __future__ import annotations

from typing import BinaryIO

from . import FontFile, Image

Expand All @@ -36,7 +38,17 @@
bdf_spacing = {"P": "Proportional", "M": "Monospaced", "C": "Cell"}


def bdf_char(f):
def bdf_char(
f: BinaryIO,
) -> (
tuple[
str,
int,
tuple[tuple[int, int], tuple[int, int, int, int], tuple[int, int, int, int]],
Image.Image,
]
| None
):
# skip to STARTCHAR
while True:
s = f.readline()
Expand All @@ -56,37 +68,48 @@ def bdf_char(f):
props[s[:i].decode("ascii")] = s[i + 1 : -1].decode("ascii")

# load bitmap
bitmap = []
bitmap = bytearray()
while True:
s = f.readline()
if not s or s[:7] == b"ENDCHAR":
break
bitmap.append(s[:-1])
bitmap = b"".join(bitmap)
bitmap += s[:-1]

[x, y, l, d] = [int(p) for p in props["BBX"].split()]
[dx, dy] = [int(p) for p in props["DWIDTH"].split()]
# The word BBX
# followed by the width in x (BBw), height in y (BBh),
# and x and y displacement (BBxoff0, BByoff0)
# of the lower left corner from the origin of the character.
width, height, x_disp, y_disp = (int(p) for p in props["BBX"].split())

bbox = (dx, dy), (l, -d - y, x + l, -d), (0, 0, x, y)
# The word DWIDTH
# followed by the width in x and y of the character in device pixels.
dwx, dwy = (int(p) for p in props["DWIDTH"].split())

bbox = (
(dwx, dwy),
(x_disp, -y_disp - height, width + x_disp, -y_disp),
(0, 0, width, height),
)

try:
im = Image.frombytes("1", (x, y), bitmap, "hex", "1")
im = Image.frombytes("1", (width, height), bitmap, "hex", "1")
except ValueError:
# deal with zero-width characters
im = Image.new("1", (x, y))
im = Image.new("1", (width, height))

return id, int(props["ENCODING"]), bbox, im


class BdfFontFile(FontFile.FontFile):
"""Font file plugin for the X11 BDF format."""

def __init__(self, fp):
def __init__(self, fp: BinaryIO) -> None:
super().__init__()

s = fp.readline()
if s[:13] != b"STARTFONT 2.1":
raise SyntaxError("not a valid BDF file")
msg = "not a valid BDF file"
raise SyntaxError(msg)

props = {}
comments = []
Expand Down
Loading