From nobody Fri Jan 20 18:43:36 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Nz7gF0rfGz2v0Cc; Fri, 20 Jan 2023 18:43:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Nz7gD72Lkz3CXq; Fri, 20 Jan 2023 18:43:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674240217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6NYfSpoEpJJwDv34y/Jmo42/3xZKx1AK1WWmzymkBdM=; b=OWc33fprjXlXir1AHjBMowvJDyY9RY1mrUwpUtRT5Ki9uTfItFdcFaRRmSxcSgSPf+f0Pm XKAGjJFbhQSzGRVq3yEgf4n1HLeBzL3Jm4AK+wZxgDGG/8GGT/8aVpxIL+Q7WB6bd+AOPd Px81RbrZQJ+HJc3UzpVjxjfvtPhdU/qk+eJwiniNZgSqGw8voJxsmggeCLiVzFtybcXGYB llVIdo76NixxeUvBjD74zvzhaGPRo4l1UY/Isvzzj3+s4FzhG8dqHCK1yOZPiP6GF1biOo eMjiKQCA81Ggg2Qj3RdRJ/r+qej4NgePg5cFrmqOyei5bpNxpkgdIliSmd61Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674240217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6NYfSpoEpJJwDv34y/Jmo42/3xZKx1AK1WWmzymkBdM=; b=OdM9TRMrEsf+mrbImbsDV92TO+CtREAJlbbpGIzOC71sfhkQEOiB9gE634SF1H9ZG0UuyG cbLlIJFOkXTYFpGAsr0VxXhOaid+xWIpWwhLNu87o80crKVjyv1HtoUxItMFe9lqdODiJj QMe0KGrEULswcchSkvcwSbOxr0FbtENUr1kL+uMrB8CWx6DB0LJn9cCyMzCHcskNt0eojz Nj+cPmofrkuN6phTX5kCF4zOteGRRp0j7n/77l7+5ghkzO53otQqcGfywE7EQqw1lccb33 z3LIsSFj/QHWX2UqYIqCmlobHFjH8Xj5LNAVO8Q1JS2okoPb6UloPwCMUH27cQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674240217; a=rsa-sha256; cv=none; b=aPoq+/pJQRDuTbHn1VxYNakSwtXESCmza3B3yTflbCnan/W6nP4ly61yv1JK5J5wwNqt+r qVD6BTs3nsvl6zT3y5AQp5yB1CcIE1YrqxFmPGBCX+5VDd2wdwWTVwu9j+tNz/smuqa0lG IQxGPhJBaLyriPDaH2O8ytJimqhn5lKeTb1dAEOQwnrrNsS29C+3A8JoLzn0kcmobeBR4G qGNc3W7RNHO4ZYIiikauHI4ej//bK+t3DTJMkU+S6MvELqFlyQlmSX0eVLZEZqOQ0cG0nC LpnIGchANgsddIfKKUKggi4F8w+6/cRY3QXHv3R8buhAuyS/awgQTjAujS1dRA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Nz7gD681Gzh3q; Fri, 20 Jan 2023 18:43:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30KIhaR3055829; Fri, 20 Jan 2023 18:43:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30KIhauv055828; Fri, 20 Jan 2023 18:43:36 GMT (envelope-from git) Date: Fri, 20 Jan 2023 18:43:36 GMT Message-Id: <202301201843.30KIhauv055828@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Yuri Victorovich Subject: git: 4d86c9e4eed1 - main - graphics/py-ManimPango: New port: Bindings for Pango for use with Manim List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yuri X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4d86c9e4eed18955d057c752ebd1c444fc0a64a8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=4d86c9e4eed18955d057c752ebd1c444fc0a64a8 commit 4d86c9e4eed18955d057c752ebd1c444fc0a64a8 Author: Yuri Victorovich AuthorDate: 2023-01-20 16:09:03 +0000 Commit: Yuri Victorovich CommitDate: 2023-01-20 18:43:32 +0000 graphics/py-ManimPango: New port: Bindings for Pango for use with Manim --- graphics/Makefile | 1 + graphics/py-ManimPango/Makefile | 27 ++++++ graphics/py-ManimPango/distinfo | 3 + graphics/py-ManimPango/files/isoline_demo.py | 133 +++++++++++++++++++++++++++ graphics/py-ManimPango/pkg-descr | 2 + 5 files changed, 166 insertions(+) diff --git a/graphics/Makefile b/graphics/Makefile index 92f03b93da2f..bb42c7d2230f 100644 --- a/graphics/Makefile +++ b/graphics/Makefile @@ -833,6 +833,7 @@ SUBDIR += proj-data SUBDIR += pstoedit SUBDIR += ptex + SUBDIR += py-ManimPango SUBDIR += py-OWSLib SUBDIR += py-PyOpenGL SUBDIR += py-PyOpenGL-accelerate diff --git a/graphics/py-ManimPango/Makefile b/graphics/py-ManimPango/Makefile new file mode 100644 index 000000000000..9fbd35f2c906 --- /dev/null +++ b/graphics/py-ManimPango/Makefile @@ -0,0 +1,27 @@ +PORTNAME= ManimPango +DISTVERSION= 0.4.3 +CATEGORIES= graphics +MASTER_SITES= PYPI +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} + +MAINTAINER= yuri@FreeBSD.org +COMMENT= Bindings for Pango for use with Manim +WWW= https://manimpango.manim.community/en/latest/ + +LICENSE= MIT + +LIB_DEPENDS= libfontconfig.so:x11-fonts/fontconfig \ + libfreetype.so:print/freetype2 \ + libharfbuzz.so:print/harfbuzz + +USES= gettext-runtime gnome pkgconfig python +USE_PYTHON= distutils cython autoplist pytest # tests fail to import manimpango, see https://github.com/ManimCommunity/ManimPango/issues/99 +USE_GNOME= cairo glib20 pango + +TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} +TEST_WRKSRC= ${WRKSRC}/tests + +post-install: + @${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/manimpango/*${PYTHON_EXT_SUFFIX}.so + +.include diff --git a/graphics/py-ManimPango/distinfo b/graphics/py-ManimPango/distinfo new file mode 100644 index 000000000000..f0c0432a95d9 --- /dev/null +++ b/graphics/py-ManimPango/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1674237306 +SHA256 (ManimPango-0.4.3.tar.gz) = 732f1cb98bcc122c0dee93bb54966aa595f90730e5096ad6d86602cf4ba1a103 +SIZE (ManimPango-0.4.3.tar.gz) = 4076306 diff --git a/graphics/py-ManimPango/files/isoline_demo.py b/graphics/py-ManimPango/files/isoline_demo.py new file mode 100644 index 000000000000..53bd1a51da61 --- /dev/null +++ b/graphics/py-ManimPango/files/isoline_demo.py @@ -0,0 +1,133 @@ +# from examples/isoline_demo.py + +""" Code for demo-ing and experimentation. Prepare for a mess """ +from isosurfaces import plot_isoline +from isosurfaces.isoline import ( + Cell, + build_tree, + Triangulator, + CurveTracer, +) +import numpy as np +import cairo + +min_depth = 5 +pmin = np.array([-8, -6]) +pmax = np.array([8, 6]) + + +def f(x, y): + return y * (x - y) ** 2 - 4 * x - 8 + + +# Here we directly use plot_implicit internals in order to see the quadtree +fn = lambda u: f(u[0], u[1]) +tol = (pmax - pmin) / 1000 +quadtree = build_tree(2, fn, pmin, pmax, min_depth, 5000, tol) +triangles = Triangulator(quadtree, fn).triangulate() +curves = CurveTracer(triangles, fn, tol).trace() + + +def g(x, y): + return x ** 3 - x - y ** 2 + + +# Typical usage +curves1 = plot_isoline( + lambda u: g(u[0], u[1]), + pmin, + pmax, + min_depth=4, + max_quads=1000, +) + + +def h(x, y): + return x ** 4 + y ** 4 - np.sin(x) - np.sin(4 * y) + + +curves2 = plot_isoline(lambda u: h(u[0], u[1]), pmin, pmax, 4, 1000) + + +WIDTH = 640 +HEIGHT = 480 + + +def setup_context(c): + # reflection to change math units to screen units + scale = min(WIDTH / (pmax[0] - pmin[0]), HEIGHT / (pmax[1] - pmin[1])) + c.scale(scale, -scale) + c.translate(WIDTH / scale / 2, -HEIGHT / scale / 2) + c.set_line_join(cairo.LINE_JOIN_BEVEL) + + +def draw_axes(c): + c.save() + c.set_line_width(0.1) + c.move_to(0, -100) + c.line_to(0, 100) + c.stroke() + c.move_to(-100, 0) + c.line_to(100, 0) + c.stroke() + c.restore() + + +def draw_quad(c, quad: Cell): + width = 0 + if quad.depth <= min_depth: + width = 0.02 + elif quad.depth == min_depth + 1: + width = 0.01 + else: + width = 0.005 + c.set_line_width(0.5 * width) + + if quad.children: + c.move_to(*((quad.vertices[0].pos + quad.vertices[1].pos) / 2)) + c.line_to(*((quad.vertices[2].pos + quad.vertices[3].pos) / 2)) + c.move_to(*((quad.vertices[0].pos + quad.vertices[2].pos) / 2)) + c.line_to(*((quad.vertices[1].pos + quad.vertices[3].pos) / 2)) + c.stroke() + for child in quad.children: + draw_quad(c, child) + + +def draw_quads(c): + c.save() + draw_quad(c, quadtree) + c.restore() + + +def draw_bg(c): + c.save() + c.set_source_rgb(1, 1, 1) + c.paint() + c.restore() + + +def draw_curves(c, curves_list, rgb): + print( + "drawing", sum(map(len, curves_list)), "segments in", len(curves_list), "curves" + ) + c.set_source_rgb(*rgb) + # draw curves + c.save() + c.set_line_width(0.03) + for curve in curves_list: + c.move_to(*curve[0]) + for v in curve: + c.line_to(*v) + c.stroke() + c.restore() + + +with cairo.SVGSurface("demo.svg", WIDTH, HEIGHT) as surface: + c = cairo.Context(surface) + setup_context(c) + draw_bg(c) + draw_axes(c) + # draw_quads(c) + draw_curves(c, curves, [0.1, 0.1, 0.8]) + draw_curves(c, curves1, [0.8, 0.1, 0.1]) + draw_curves(c, curves2, [0.1, 0.6, 0.1]) diff --git a/graphics/py-ManimPango/pkg-descr b/graphics/py-ManimPango/pkg-descr new file mode 100644 index 000000000000..13c88e438469 --- /dev/null +++ b/graphics/py-ManimPango/pkg-descr @@ -0,0 +1,2 @@ +ManimPango is a C binding for Pango using Cython, which is internally used in +Manim to render (non-LaTeX) text.