Skip to content

Commit 170c7dd

Browse files
authored
Merge pull request #111 from ManimCommunity/register-font-refactor
register_font: support for new API
2 parents 83faa9b + 0b1667e commit 170c7dd

22 files changed

+522
-430
lines changed

.github/workflows/tests.yml

Lines changed: 24 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ name: Test
22

33
on:
44
push:
5-
branches: [main,tests-build,v*]
5+
branches: [main, tests-build, v*]
66
pull_request:
7-
branches: [main,v*]
7+
branches: [main, v*]
8+
9+
concurrency:
10+
group: ${{ github.ref }}
11+
cancel-in-progress: true
812

913
jobs:
1014
test:
@@ -14,7 +18,7 @@ jobs:
1418
fail-fast: false
1519
matrix:
1620
os: [ubuntu-latest, macos-latest]
17-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
21+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1822
steps:
1923
- uses: actions/checkout@v3
2024
- name: Set up Python ${{ matrix.python-version }}
@@ -43,22 +47,14 @@ jobs:
4347
if: steps.cache-pango.outputs.cache-hit != 'true'
4448
run: |
4549
source packing/build_pango_tests.sh
46-
4750
- name: Install python dependencies
4851
run: |
4952
python -m pip install --upgrade pip
5053
pip install -r requirements-dev.txt
54+
- name: Build Project
55+
run: python setup.py build_ext -i
5156
- name: Run Tests
52-
run: |
53-
python setup.py build_ext -i
54-
python setup.py sdist
55-
pip install .
56-
pytest
57-
- name: Coverage
58-
run: |
59-
coverage report
60-
coverage html
61-
coverage xml
57+
run: pytest -s
6258
- uses: codecov/codecov-action@v3
6359
with:
6460
file: ./.coverage/coverage.xml
@@ -68,78 +64,44 @@ jobs:
6864
path: .pytest_temp/
6965

7066
msvc:
71-
name: ${{matrix.os}} - ${{matrix.python-version}}
67+
name: ${{matrix.os}} - ${{matrix.python-version}} - ${{matrix.architecture}}
7268
runs-on: ${{matrix.os}}
7369
strategy:
7470
fail-fast: false
7571
matrix:
7672
os: [windows-2022]
77-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
73+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
74+
architecture: ["x64", "x86"]
7875
steps:
7976
- uses: actions/checkout@v3
80-
- name: Set up Python ${{ matrix.python-version }} for x64
77+
- name: Set up Python ${{ matrix.python-version }} for ${{matrix.architecture}}
8178
uses: actions/setup-python@v4
8279
with:
8380
python-version: ${{ matrix.python-version }}
84-
architecture: "x64"
81+
architecture: ${{matrix.architecture}}
8582
allow-prereleases: true
86-
- name: Cache Windows
87-
id: cache-windows
88-
uses: actions/cache@v3
89-
with:
90-
path: C:\cibw\pkg-config
91-
key: ${{ hashFiles('packing/download_dlls.py') }}-${{ hashFiles('packing/build_pkgconfig.ps1') }}-1
9283
- name: Download Binary
9384
run: |
9485
python packing/download_dlls.py
95-
- name: Set Path
86+
- name: Set Path for pkg-config
9687
run: |
9788
$env:Path = "C:\cibw\pkg-config\bin;C:\cibw\vendor\bin;$($env:PATH)"
9889
echo "$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
99-
- name: Test x64
90+
- name: Install Python Dependencies
10091
run: |
10192
python -m pip install -U pip
10293
pip install -U setuptools wheel
103-
$env:PKG_CONFIG_PATH="C:\cibw\vendor\lib\pkgconfig"
10494
pip install -r requirements-dev.txt
105-
python setup.py build_ext -i
106-
pytest
107-
- name: Coverage
95+
- name: Build Project
96+
env:
97+
PKG_CONFIG_PATH: C:\cibw\vendor\lib\pkgconfig
98+
run: python setup.py build_ext -i
99+
- name: Run tests
108100
run: |
109-
coverage report
110-
coverage html
111-
coverage xml
112-
- name: Set up Python ${{ matrix.python-version }} for x86
113-
uses: actions/setup-python@v4
114-
with:
115-
python-version: ${{ matrix.python-version }}
116-
architecture: "x86"
117-
allow-prereleases: true
118-
- name: Download Binary
119-
run: |
120-
python packing/download_dlls.py
121-
- name: Build x86 Build
122-
run: |
123-
python -m pip install -U pip
124-
$env:PATH="$env:PATH;C:\cibw\vendor\pkg-config\bin;C:\cibw\vendor\bin"
125-
$env:PKG_CONFIG_PATH="C:\cibw\vendor\lib\pkgconfig"
126-
pip install -r requirements-dev.txt
127-
python setup.py build_ext -i
128-
python setup.py sdist
129-
python -m pip install dist/*
130-
$env:PATH="C:\cibw\vendor\bin;$env:PATH"
131-
pytest
132-
- name: Coverage
133-
run: |
134-
coverage report
135-
coverage html
136-
coverage xml
137-
- uses: codecov/codecov-action@v3
138-
with:
139-
file: ./.coverage/coverage.xml
101+
pytest -s
140102
- uses: actions/upload-artifact@v3
141103
with:
142-
name: test-artifacts-${{matrix.os}}-${{matrix.python-version}}
104+
name: test-artifacts-${{matrix.os}}-${{matrix.python-version}} ${{matrix.architecture}}
143105
path: .pytest_temp/
144106
success-win:
145107
needs: [msvc]

.pre-commit-config.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v4.6.0
44
hooks:
55
- id: check-yaml
66
- id: end-of-file-fixer
@@ -9,19 +9,18 @@ repos:
99
- id: mixed-line-ending
1010
- id: check-merge-conflict
1111
- repo: https://github.com/psf/black
12-
rev: 23.3.0
12+
rev: 24.8.0
1313
hooks:
1414
- id: black
1515
language_version: python3.11
1616
- repo: https://github.com/PyCQA/isort
17-
rev: 5.12.0
17+
rev: 5.13.2
1818
hooks:
1919
- id: isort
2020
- repo: https://github.com/pycqa/flake8
21-
rev: 6.0.0
21+
rev: 7.1.1
2222
hooks:
2323
- id: flake8
24-
additional_dependencies: [flake8-2020, flake8-implicit-str-concat]
2524

2625
- repo: https://github.com/pre-commit/pygrep-hooks
2726
rev: v1.10.0

.readthedocs.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
version: 2
2-
formats: all
3-
conda:
4-
environment: environment.yml
2+
build:
3+
os: ubuntu-22.04
4+
5+
tools:
6+
python: "3.11"
7+
8+
apt_packages:
9+
- libpango1.0-dev
10+
511
python:
6-
version: 3.8
712
install:
13+
- requirements: docs/requirements.txt
814
- method: pip
915
path: .
16+
17+
formats: all

docs/reference.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Manimpango Reference
1010
manimpango.MarkupUtils
1111
manimpango.register_font
1212
manimpango.unregister_font
13+
manimpango.fc_register_font
14+
manimpango.fc_unregister_font
1315
manimpango.list_fonts
1416

1517
Enums

docs/requirements.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
furo
2+
sphinx
3+
sphinxcontrib-applehelp
4+
sphinxcontrib-devhelp
5+
sphinxcontrib-htmlhelp
6+
sphinxcontrib-jsmath
7+
sphinxcontrib-qthelp
8+
sphinxcontrib-serializinghtml
9+
sphinxext-opengraph

manimpango/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
f"{os.environ['PATH']}"
1212
)
1313
try:
14+
from .register_font import * # isort:skip # noqa: F403,F401
1415
from .cmanimpango import * # noqa: F403,F401
1516
from .enums import * # noqa: F403,F401
16-
from .register_font import * # noqa: F403,F401
1717
except ImportError as ie: # pragma: no cover
1818
py_ver = ".".join(map(str, sys.version_info[:3]))
1919
msg = f"""

manimpango/register_font.pxd renamed to manimpango/_register_font.pxd

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
21
from libc.stddef cimport wchar_t
2+
from pango cimport *
33

44

55
cdef extern from "Python.h":
@@ -35,6 +35,13 @@ IF UNAME_SYSNAME == "Windows":
3535
DWORD fl,
3636
unsigned int pdv
3737
)
38+
39+
ctypedef void* HANDLE
40+
HANDLE CreateMutexA(void* lpMutexAttributes, int bInitialOwner, const char* lpName)
41+
int ReleaseMutex(HANDLE hMutex)
42+
int WaitForSingleObject(HANDLE hHandle, unsigned long dwMilliseconds)
43+
int CloseHandle(HANDLE hObject)
44+
3845
ELIF UNAME_SYSNAME == "Darwin":
3946
cdef extern from "Carbon/Carbon.h":
4047
ctypedef struct CFURLRef:

0 commit comments

Comments
 (0)