matplotlib-rs 0.0.8__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- docs/releases/0.0.1.md +268 -0
- docs/releases/0.0.2.md +69 -0
- docs/releases/0.0.3.md +80 -0
- docs/releases/0.0.4.md +73 -0
- docs/releases/0.0.5.md +24 -0
- docs/releases/0.0.6.md +24 -0
- docs/releases/0.0.7.md +24 -0
- docs/releases/0.0.8.md +16 -0
- licenses/LICENSE_CONTOURPY +29 -0
- licenses/LICENSE_CYCLER +27 -0
- licenses/LICENSE_DATEUTIL +54 -0
- licenses/LICENSE_KIWISOLVER +71 -0
- licenses/LICENSE_LIBWEBP +56 -0
- licenses/LICENSE_MATPLOTLIB +1253 -0
- licenses/LICENSE_PYPARSING +20 -0
- licenses/LICENSE_QHULL +39 -0
- licenses/LICENSE_SIX +18 -0
- matplotlib_rs/__init__.py +1683 -0
- matplotlib_rs/__main__.py +27 -0
- matplotlib_rs/_afm.py +500 -0
- matplotlib_rs/_animation_data.py +263 -0
- matplotlib_rs/_api/__init__.py +495 -0
- matplotlib_rs/_api/deprecation.py +534 -0
- matplotlib_rs/_axis_py.py +2991 -0
- matplotlib_rs/_blocking_input.py +31 -0
- matplotlib_rs/_cm.py +1500 -0
- matplotlib_rs/_cm_bivar.py +1289 -0
- matplotlib_rs/_cm_listed.py +2848 -0
- matplotlib_rs/_cm_multivar.py +167 -0
- matplotlib_rs/_color_data.py +1142 -0
- matplotlib_rs/_colormap.py +132 -0
- matplotlib_rs/_constrained_layout.py +825 -0
- matplotlib_rs/_contour.py +108 -0
- matplotlib_rs/_doc_cache.py +12214 -0
- matplotlib_rs/_docstring.py +142 -0
- matplotlib_rs/_enums.py +178 -0
- matplotlib_rs/_figure_rs.py +294 -0
- matplotlib_rs/_fontconfig_pattern.py +129 -0
- matplotlib_rs/_foreign.py +220 -0
- matplotlib_rs/_hook.py +94 -0
- matplotlib_rs/_image.py +160 -0
- matplotlib_rs/_imageio.py +229 -0
- matplotlib_rs/_internal_utils.py +65 -0
- matplotlib_rs/_kiwi.py +484 -0
- matplotlib_rs/_layoutgrid.py +549 -0
- matplotlib_rs/_live.py +192 -0
- matplotlib_rs/_mathtext.py +3103 -0
- matplotlib_rs/_mathtext_data.py +1811 -0
- matplotlib_rs/_mplrs.cp313-win_amd64.pyd +0 -0
- matplotlib_rs/_path.py +25 -0
- matplotlib_rs/_png.py +162 -0
- matplotlib_rs/_pylab_helpers.py +137 -0
- matplotlib_rs/_qhull.py +66 -0
- matplotlib_rs/_rcpush.py +84 -0
- matplotlib_rs/_spines_rs.py +108 -0
- matplotlib_rs/_style_helpers.py +52 -0
- matplotlib_rs/_text_helpers.py +51 -0
- matplotlib_rs/_tight_bbox.py +85 -0
- matplotlib_rs/_tight_layout.py +302 -0
- matplotlib_rs/_tri.py +140 -0
- matplotlib_rs/_type1font.py +1228 -0
- matplotlib_rs/_vendor/__init__.py +8 -0
- matplotlib_rs/_vendor/cycler.py +574 -0
- matplotlib_rs/_vendor/dateutil/__init__.py +27 -0
- matplotlib_rs/_vendor/dateutil/_common.py +44 -0
- matplotlib_rs/_vendor/dateutil/_tzdata_impl.py +148 -0
- matplotlib_rs/_vendor/dateutil/_version.py +5 -0
- matplotlib_rs/_vendor/dateutil/easter.py +90 -0
- matplotlib_rs/_vendor/dateutil/parser/__init__.py +62 -0
- matplotlib_rs/_vendor/dateutil/parser/_parser.py +1614 -0
- matplotlib_rs/_vendor/dateutil/parser/isoparser.py +417 -0
- matplotlib_rs/_vendor/dateutil/relativedelta.py +597 -0
- matplotlib_rs/_vendor/dateutil/rrule.py +1765 -0
- matplotlib_rs/_vendor/dateutil/tz/__init__.py +61 -0
- matplotlib_rs/_vendor/dateutil/tz/_common.py +420 -0
- matplotlib_rs/_vendor/dateutil/tz/_factories.py +81 -0
- matplotlib_rs/_vendor/dateutil/tz/_tzfile.py +1429 -0
- matplotlib_rs/_vendor/dateutil/tz/_tzpath.py +105 -0
- matplotlib_rs/_vendor/dateutil/tz/tz.py +1473 -0
- matplotlib_rs/_vendor/dateutil/tz/win.py +371 -0
- matplotlib_rs/_vendor/dateutil/tzwin.py +3 -0
- matplotlib_rs/_vendor/dateutil/utils.py +72 -0
- matplotlib_rs/_vendor/dateutil/zoneinfo/__init__.py +234 -0
- matplotlib_rs/_vendor/pyparsing/__init__.py +414 -0
- matplotlib_rs/_vendor/pyparsing/actions.py +265 -0
- matplotlib_rs/_vendor/pyparsing/common.py +571 -0
- matplotlib_rs/_vendor/pyparsing/core.py +6973 -0
- matplotlib_rs/_vendor/pyparsing/exceptions.py +354 -0
- matplotlib_rs/_vendor/pyparsing/helpers.py +1770 -0
- matplotlib_rs/_vendor/pyparsing/results.py +929 -0
- matplotlib_rs/_vendor/pyparsing/testing.py +399 -0
- matplotlib_rs/_vendor/pyparsing/unicode.py +357 -0
- matplotlib_rs/_vendor/pyparsing/util.py +515 -0
- matplotlib_rs/_vendor/pyparsing/warnings.py +11 -0
- matplotlib_rs/_vendor/six.py +1004 -0
- matplotlib_rs/animation.py +1843 -0
- matplotlib_rs/artist.py +2302 -0
- matplotlib_rs/axes/__init__.py +19 -0
- matplotlib_rs/axes/_axes.py +9402 -0
- matplotlib_rs/axes/_bar.py +185 -0
- matplotlib_rs/axes/_base.py +5236 -0
- matplotlib_rs/axes/_base_rs.py +727 -0
- matplotlib_rs/axes/_boxplot.py +391 -0
- matplotlib_rs/axes/_hist.py +99 -0
- matplotlib_rs/axes/_secondary_axes.py +357 -0
- matplotlib_rs/axis.py +1963 -0
- matplotlib_rs/backend_bases.py +3760 -0
- matplotlib_rs/backend_managers.py +388 -0
- matplotlib_rs/backend_tools.py +1002 -0
- matplotlib_rs/backends/__init__.py +6 -0
- matplotlib_rs/backends/_backend_pdf_ps.py +451 -0
- matplotlib_rs/backends/backend_agg.py +552 -0
- matplotlib_rs/backends/backend_mixed.py +123 -0
- matplotlib_rs/backends/backend_pdf.py +2711 -0
- matplotlib_rs/backends/backend_pgf.py +1031 -0
- matplotlib_rs/backends/backend_ps.py +1491 -0
- matplotlib_rs/backends/backend_svg.py +1395 -0
- matplotlib_rs/backends/backend_template.py +214 -0
- matplotlib_rs/backends/registry.py +423 -0
- matplotlib_rs/bezier.py +691 -0
- matplotlib_rs/category.py +236 -0
- matplotlib_rs/cbook.py +2762 -0
- matplotlib_rs/cm.py +251 -0
- matplotlib_rs/collections.py +2711 -0
- matplotlib_rs/colorbar.py +1586 -0
- matplotlib_rs/colorizer.py +909 -0
- matplotlib_rs/colors.py +4278 -0
- matplotlib_rs/container.py +256 -0
- matplotlib_rs/contour.py +1756 -0
- matplotlib_rs/dates.py +1847 -0
- matplotlib_rs/dviread.py +1386 -0
- matplotlib_rs/figure.py +3815 -0
- matplotlib_rs/font_manager.py +1855 -0
- matplotlib_rs/ft2font.py +515 -0
- matplotlib_rs/gridspec.py +808 -0
- matplotlib_rs/hatch.py +244 -0
- matplotlib_rs/image.py +1863 -0
- matplotlib_rs/inset.py +291 -0
- matplotlib_rs/layout_engine.py +310 -0
- matplotlib_rs/legend.py +1480 -0
- matplotlib_rs/legend_handler.py +812 -0
- matplotlib_rs/lines.py +1886 -0
- matplotlib_rs/markers.py +908 -0
- matplotlib_rs/mathtext.py +141 -0
- matplotlib_rs/mlab.py +959 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/LICENSE_DEJAVU +99 -0
- matplotlib_rs/mpl-data/fonts/ttf/LICENSE_STIX +124 -0
- matplotlib_rs/mpl-data/fonts/ttf/LastResortHE-Regular.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXGeneral.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralItalic.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXNonUni.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniIta.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmb10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmex10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmmi10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmr10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmss10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmsy10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmti10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmtt10.ttf +0 -0
- matplotlib_rs/mpl-data/images/back-symbolic.svg +46 -0
- matplotlib_rs/mpl-data/images/back.pdf +0 -0
- matplotlib_rs/mpl-data/images/back.png +0 -0
- matplotlib_rs/mpl-data/images/back.svg +46 -0
- matplotlib_rs/mpl-data/images/back_large.png +0 -0
- matplotlib_rs/mpl-data/images/filesave-symbolic.svg +68 -0
- matplotlib_rs/mpl-data/images/filesave.pdf +72 -0
- matplotlib_rs/mpl-data/images/filesave.png +0 -0
- matplotlib_rs/mpl-data/images/filesave.svg +68 -0
- matplotlib_rs/mpl-data/images/filesave_large.png +0 -0
- matplotlib_rs/mpl-data/images/forward-symbolic.svg +46 -0
- matplotlib_rs/mpl-data/images/forward.pdf +0 -0
- matplotlib_rs/mpl-data/images/forward.png +0 -0
- matplotlib_rs/mpl-data/images/forward.svg +46 -0
- matplotlib_rs/mpl-data/images/forward_large.png +0 -0
- matplotlib_rs/mpl-data/images/hand.pdf +0 -0
- matplotlib_rs/mpl-data/images/hand.png +0 -0
- matplotlib_rs/mpl-data/images/hand.svg +130 -0
- matplotlib_rs/mpl-data/images/help-symbolic.svg +52 -0
- matplotlib_rs/mpl-data/images/help.pdf +71 -0
- matplotlib_rs/mpl-data/images/help.png +0 -0
- matplotlib_rs/mpl-data/images/help.svg +52 -0
- matplotlib_rs/mpl-data/images/help_large.png +0 -0
- matplotlib_rs/mpl-data/images/home-symbolic.svg +59 -0
- matplotlib_rs/mpl-data/images/home.pdf +0 -0
- matplotlib_rs/mpl-data/images/home.png +0 -0
- matplotlib_rs/mpl-data/images/home.svg +59 -0
- matplotlib_rs/mpl-data/images/home_large.png +0 -0
- matplotlib_rs/mpl-data/images/matplotlib.pdf +0 -0
- matplotlib_rs/mpl-data/images/matplotlib.png +0 -0
- matplotlib_rs/mpl-data/images/matplotlib.svg +3171 -0
- matplotlib_rs/mpl-data/images/matplotlib_large.png +0 -0
- matplotlib_rs/mpl-data/images/move-symbolic.svg +73 -0
- matplotlib_rs/mpl-data/images/move.pdf +0 -0
- matplotlib_rs/mpl-data/images/move.png +0 -0
- matplotlib_rs/mpl-data/images/move.svg +73 -0
- matplotlib_rs/mpl-data/images/move_large.png +0 -0
- matplotlib_rs/mpl-data/images/qt4_editor_options.pdf +0 -0
- matplotlib_rs/mpl-data/images/qt4_editor_options.png +0 -0
- matplotlib_rs/mpl-data/images/qt4_editor_options.svg +48 -0
- matplotlib_rs/mpl-data/images/qt4_editor_options_large.png +0 -0
- matplotlib_rs/mpl-data/images/subplots-symbolic.svg +81 -0
- matplotlib_rs/mpl-data/images/subplots.pdf +0 -0
- matplotlib_rs/mpl-data/images/subplots.png +0 -0
- matplotlib_rs/mpl-data/images/subplots.svg +81 -0
- matplotlib_rs/mpl-data/images/subplots_large.png +0 -0
- matplotlib_rs/mpl-data/images/zoom_to_rect-symbolic.svg +40 -0
- matplotlib_rs/mpl-data/images/zoom_to_rect.pdf +69 -0
- matplotlib_rs/mpl-data/images/zoom_to_rect.png +0 -0
- matplotlib_rs/mpl-data/images/zoom_to_rect.svg +40 -0
- matplotlib_rs/mpl-data/images/zoom_to_rect_large.png +0 -0
- matplotlib_rs/mpl-data/kpsewhich.lua +4 -0
- matplotlib_rs/mpl-data/matplotlibrc +849 -0
- matplotlib_rs/mpl-data/plot_directive/plot_directive.css +16 -0
- matplotlib_rs/mpl-data/sample_data/Minduka_Present_Blue_Pack.png +0 -0
- matplotlib_rs/mpl-data/sample_data/README.txt +2 -0
- matplotlib_rs/mpl-data/sample_data/Stocks.csv +526 -0
- matplotlib_rs/mpl-data/sample_data/axes_grid/bivariate_normal.npy +0 -0
- matplotlib_rs/mpl-data/sample_data/data_x_x2_x3.csv +11 -0
- matplotlib_rs/mpl-data/sample_data/eeg.dat +0 -0
- matplotlib_rs/mpl-data/sample_data/embedding_in_wx3.xrc +65 -0
- matplotlib_rs/mpl-data/sample_data/goog.npz +0 -0
- matplotlib_rs/mpl-data/sample_data/grace_hopper.jpg +0 -0
- matplotlib_rs/mpl-data/sample_data/jacksboro_fault_dem.npz +0 -0
- matplotlib_rs/mpl-data/sample_data/logo2.png +0 -0
- matplotlib_rs/mpl-data/sample_data/membrane.dat +0 -0
- matplotlib_rs/mpl-data/sample_data/msft.csv +66 -0
- matplotlib_rs/mpl-data/sample_data/s1045.ima.gz +0 -0
- matplotlib_rs/mpl-data/sample_data/topobathy.npz +0 -0
- matplotlib_rs/mpl-data/stylelib/Solarize_Light2.mplstyle +53 -0
- matplotlib_rs/mpl-data/stylelib/_classic_test_patch.mplstyle +8 -0
- matplotlib_rs/mpl-data/stylelib/_mpl-gallery-nogrid.mplstyle +19 -0
- matplotlib_rs/mpl-data/stylelib/_mpl-gallery.mplstyle +19 -0
- matplotlib_rs/mpl-data/stylelib/bmh.mplstyle +27 -0
- matplotlib_rs/mpl-data/stylelib/classic.mplstyle +491 -0
- matplotlib_rs/mpl-data/stylelib/dark_background.mplstyle +26 -0
- matplotlib_rs/mpl-data/stylelib/fast.mplstyle +11 -0
- matplotlib_rs/mpl-data/stylelib/fivethirtyeight.mplstyle +37 -0
- matplotlib_rs/mpl-data/stylelib/ggplot.mplstyle +39 -0
- matplotlib_rs/mpl-data/stylelib/grayscale.mplstyle +29 -0
- matplotlib_rs/mpl-data/stylelib/petroff10.mplstyle +5 -0
- matplotlib_rs/mpl-data/stylelib/petroff6.mplstyle +5 -0
- matplotlib_rs/mpl-data/stylelib/petroff8.mplstyle +5 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-bright.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-colorblind.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark-palette.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark.mplstyle +30 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-darkgrid.mplstyle +30 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-deep.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-muted.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-notebook.mplstyle +21 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-paper.mplstyle +21 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-pastel.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-poster.mplstyle +21 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-talk.mplstyle +21 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-ticks.mplstyle +30 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-white.mplstyle +30 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-whitegrid.mplstyle +30 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8.mplstyle +57 -0
- matplotlib_rs/mpl-data/stylelib/tableau-colorblind10.mplstyle +3 -0
- matplotlib_rs/mpl_toolkits/__init__.py +3 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/__init__.py +11 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/anchored_artists.py +415 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/axes_divider.py +619 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/axes_grid.py +565 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/axes_rgb.py +158 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/axes_size.py +272 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/inset_locator.py +525 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/mpl_axes.py +129 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/parasite_axes.py +261 -0
- matplotlib_rs/mpl_toolkits/axisartist/__init__.py +15 -0
- matplotlib_rs/mpl_toolkits/axisartist/angle_helper.py +396 -0
- matplotlib_rs/mpl_toolkits/axisartist/axes_divider.py +3 -0
- matplotlib_rs/mpl_toolkits/axisartist/axis_artist.py +1148 -0
- matplotlib_rs/mpl_toolkits/axisartist/axisline_style.py +193 -0
- matplotlib_rs/mpl_toolkits/axisartist/axislines.py +475 -0
- matplotlib_rs/mpl_toolkits/axisartist/floating_axes.py +265 -0
- matplotlib_rs/mpl_toolkits/axisartist/grid_finder.py +329 -0
- matplotlib_rs/mpl_toolkits/axisartist/grid_helper_curvelinear.py +353 -0
- matplotlib_rs/mpl_toolkits/axisartist/parasite_axes.py +8 -0
- matplotlib_rs/mpl_toolkits/mplot3d/__init__.py +4 -0
- matplotlib_rs/mpl_toolkits/mplot3d/art3d.py +1758 -0
- matplotlib_rs/mpl_toolkits/mplot3d/axes3d.py +4462 -0
- matplotlib_rs/mpl_toolkits/mplot3d/axis3d.py +807 -0
- matplotlib_rs/mpl_toolkits/mplot3d/proj3d.py +270 -0
- matplotlib_rs/offsetbox.py +1726 -0
- matplotlib_rs/patches.py +5049 -0
- matplotlib_rs/path.py +1147 -0
- matplotlib_rs/patheffects.py +512 -0
- matplotlib_rs/projections/__init__.py +126 -0
- matplotlib_rs/projections/geo.py +512 -0
- matplotlib_rs/projections/polar.py +1518 -0
- matplotlib_rs/pylab.py +68 -0
- matplotlib_rs/pyplot.py +4834 -0
- matplotlib_rs/quiver.py +1236 -0
- matplotlib_rs/rcsetup.py +3435 -0
- matplotlib_rs/sankey.py +815 -0
- matplotlib_rs/scale.py +1002 -0
- matplotlib_rs/spines.py +618 -0
- matplotlib_rs/stackplot.py +144 -0
- matplotlib_rs/streamplot.py +768 -0
- matplotlib_rs/style/__init__.py +269 -0
- matplotlib_rs/style/core.py +28 -0
- matplotlib_rs/table.py +860 -0
- matplotlib_rs/texmanager.py +375 -0
- matplotlib_rs/text.py +2412 -0
- matplotlib_rs/textpath.py +377 -0
- matplotlib_rs/ticker.py +3111 -0
- matplotlib_rs/transforms.py +3069 -0
- matplotlib_rs/tri/__init__.py +24 -0
- matplotlib_rs/tri/_triangulation.py +248 -0
- matplotlib_rs/tri/_tricontour.py +271 -0
- matplotlib_rs/tri/_trifinder.py +97 -0
- matplotlib_rs/tri/_triinterpolate.py +1575 -0
- matplotlib_rs/tri/_tripcolor.py +170 -0
- matplotlib_rs/tri/_triplot.py +87 -0
- matplotlib_rs/tri/_trirefine.py +308 -0
- matplotlib_rs/tri/_tritools.py +264 -0
- matplotlib_rs/typing.py +597 -0
- matplotlib_rs/units.py +196 -0
- matplotlib_rs/widgets.py +4455 -0
- matplotlib_rs-0.0.8.dist-info/METADATA +392 -0
- matplotlib_rs-0.0.8.dist-info/RECORD +352 -0
- matplotlib_rs-0.0.8.dist-info/WHEEL +4 -0
- matplotlib_rs-0.0.8.dist-info/sboms/matplotlib-rs.cyclonedx.json +4390 -0
matplotlib_rs/ft2font.py
ADDED
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
"""Minimal ``matplotlib.ft2font`` replacement backed by the Rust font engine."""
|
|
2
|
+
from enum import Enum, Flag
|
|
3
|
+
from typing import NamedTuple
|
|
4
|
+
|
|
5
|
+
from . import _mplrs
|
|
6
|
+
|
|
7
|
+
__freetype_version__ = "2.14.3"
|
|
8
|
+
__freetype_build_type__ = "local"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class LoadFlags(Flag):
|
|
12
|
+
DEFAULT = 0
|
|
13
|
+
NO_SCALE = 1
|
|
14
|
+
NO_HINTING = 2
|
|
15
|
+
RENDER = 4
|
|
16
|
+
NO_BITMAP = 8
|
|
17
|
+
VERTICAL_LAYOUT = 16
|
|
18
|
+
FORCE_AUTOHINT = 32
|
|
19
|
+
CROP_BITMAP = 64
|
|
20
|
+
PEDANTIC = 128
|
|
21
|
+
IGNORE_GLOBAL_ADVANCE_WIDTH = 512
|
|
22
|
+
NO_RECURSE = 1024
|
|
23
|
+
IGNORE_TRANSFORM = 2048
|
|
24
|
+
MONOCHROME = 4096
|
|
25
|
+
LINEAR_DESIGN = 8192
|
|
26
|
+
NO_AUTOHINT = 32768
|
|
27
|
+
COLOR = 1048576
|
|
28
|
+
COMPUTE_METRICS = 2097152
|
|
29
|
+
BITMAP_METRICS_ONLY = 4194304
|
|
30
|
+
NO_SVG = 16777216
|
|
31
|
+
TARGET_NORMAL = 0
|
|
32
|
+
TARGET_LIGHT = 65536
|
|
33
|
+
TARGET_MONO = 131072
|
|
34
|
+
TARGET_LCD = 196608
|
|
35
|
+
TARGET_LCD_V = 262144
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class StyleFlags(Flag):
|
|
39
|
+
NORMAL = 0
|
|
40
|
+
ITALIC = 1
|
|
41
|
+
BOLD = 2
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class Kerning(Enum):
|
|
45
|
+
DEFAULT = 0
|
|
46
|
+
UNFITTED = 1
|
|
47
|
+
UNSCALED = 2
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class RenderMode(Enum):
|
|
51
|
+
NORMAL = 0
|
|
52
|
+
LIGHT = 1
|
|
53
|
+
MONO = 2
|
|
54
|
+
LCD = 3
|
|
55
|
+
LCD_V = 4
|
|
56
|
+
SDF = 5
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class FaceFlags(Flag):
|
|
60
|
+
SCALABLE = 1
|
|
61
|
+
FIXED_SIZES = 2
|
|
62
|
+
FIXED_WIDTH = 4
|
|
63
|
+
SFNT = 8
|
|
64
|
+
HORIZONTAL = 16
|
|
65
|
+
VERTICAL = 32
|
|
66
|
+
KERNING = 64
|
|
67
|
+
FAST_GLYPHS = 128
|
|
68
|
+
MULTIPLE_MASTERS = 256
|
|
69
|
+
GLYPH_NAMES = 512
|
|
70
|
+
EXTERNAL_STREAM = 1024
|
|
71
|
+
HINTER = 2048
|
|
72
|
+
CID_KEYED = 4096
|
|
73
|
+
TRICKY = 8192
|
|
74
|
+
COLOR = 16384
|
|
75
|
+
VARIATION = 32768
|
|
76
|
+
SVG = 65536
|
|
77
|
+
SBIX = 131072
|
|
78
|
+
SBIX_OVERLAY = 262144
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class Glyph:
|
|
82
|
+
"""The metrics of a loaded glyph (26.6 units, ``linearHoriAdvance`` 16.16;
|
|
83
|
+
font units for `LoadFlags.NO_SCALE` loads)."""
|
|
84
|
+
|
|
85
|
+
def __init__(self, metrics):
|
|
86
|
+
(self.width, self.height, self.horiBearingX, self.horiBearingY,
|
|
87
|
+
self.horiAdvance, self.linearHoriAdvance, self.bbox) = metrics
|
|
88
|
+
self.vertBearingX = self.vertBearingY = self.vertAdvance = 0
|
|
89
|
+
|
|
90
|
+
def __repr__(self):
|
|
91
|
+
return (f"Glyph(width={self.width}, height={self.height}, "
|
|
92
|
+
f"horiAdvance={self.horiAdvance}, bbox={self.bbox})")
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def _fixed(v):
|
|
96
|
+
"""FIXED_MAJOR/FIXED_MINOR of a 16.16 value."""
|
|
97
|
+
v &= 0xffffffff
|
|
98
|
+
major = (v >> 16) & 0xffff
|
|
99
|
+
return (major - 0x10000 if major & 0x8000 else major, v & 0xffff)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class FT2Font:
|
|
103
|
+
"""matplotlib's ``FT2Font`` over the Rust font engine."""
|
|
104
|
+
|
|
105
|
+
def __init__(self, filename, hinting_factor=8, *, face_index=0,
|
|
106
|
+
_fallback_list=None, _kerning_factor=None, _warn_if_used=False):
|
|
107
|
+
self.face_index = face_index
|
|
108
|
+
self._fallback_list = _fallback_list or []
|
|
109
|
+
self._warn_if_used = _warn_if_used
|
|
110
|
+
if hasattr(filename, "read"):
|
|
111
|
+
# a file-like object (matplotlib reads it through a stream)
|
|
112
|
+
self.fname = getattr(filename, "name", "<file-like>")
|
|
113
|
+
filename.seek(0)
|
|
114
|
+
self._f = _mplrs.FT2Font.from_bytes(filename.read(), face_index)
|
|
115
|
+
else:
|
|
116
|
+
self.fname = str(filename)
|
|
117
|
+
self._f = _mplrs.FT2Font(self.fname, face_index)
|
|
118
|
+
self.family_name = self._f.family_name
|
|
119
|
+
self.style_name = self._f.style_name
|
|
120
|
+
self.postscript_name = self._f.postscript_name
|
|
121
|
+
self.num_glyphs = self._f.num_glyphs
|
|
122
|
+
self.units_per_EM = self._f.units_per_em
|
|
123
|
+
self.num_fixed_sizes = 0 # (set by _init_face)
|
|
124
|
+
self.num_named_instances = 0
|
|
125
|
+
self.scalable = True
|
|
126
|
+
self._last = (0.0, 0.0, 0.0)
|
|
127
|
+
self._init_face()
|
|
128
|
+
|
|
129
|
+
def _table(self, tag):
|
|
130
|
+
return self._f.table(tag)
|
|
131
|
+
|
|
132
|
+
def _init_face(self):
|
|
133
|
+
"""Face fields as FreeType's sfnt loader sets them."""
|
|
134
|
+
import struct
|
|
135
|
+
head = self._table("head")
|
|
136
|
+
hhea = self._table("hhea")
|
|
137
|
+
post = self._table("post")
|
|
138
|
+
os2 = self.get_sfnt_table("OS/2")
|
|
139
|
+
self.bbox = struct.unpack(">4h", head[36:44])
|
|
140
|
+
asc, desc, gap = struct.unpack(">3h", hhea[4:10])
|
|
141
|
+
height = asc - desc + gap
|
|
142
|
+
if os2 is not None and os2["fsSelection"] & 128: # USE_TYPO_METRICS
|
|
143
|
+
asc, desc = os2["sTypoAscender"], os2["sTypoDescender"]
|
|
144
|
+
height = asc - desc + os2["sTypoLineGap"]
|
|
145
|
+
elif not (asc or desc) and os2 is not None:
|
|
146
|
+
if os2["sTypoAscender"] or os2["sTypoDescender"]:
|
|
147
|
+
asc, desc = os2["sTypoAscender"], os2["sTypoDescender"]
|
|
148
|
+
height = asc - desc + os2["sTypoLineGap"]
|
|
149
|
+
else:
|
|
150
|
+
asc, desc = os2["usWinAscent"], -os2["usWinDescent"]
|
|
151
|
+
height = asc - desc
|
|
152
|
+
self.ascender, self.descender, self.height = asc, desc, height
|
|
153
|
+
self.max_advance_width = struct.unpack(">H", hhea[10:12])[0]
|
|
154
|
+
vhea = self._table("vhea")
|
|
155
|
+
self.max_advance_height = (struct.unpack(">H", vhea[10:12])[0]
|
|
156
|
+
if vhea and self._table("vmtx") else height)
|
|
157
|
+
if post is not None and len(post) >= 16:
|
|
158
|
+
fmt, _, upos, uthick, fixed = struct.unpack(">IihhI", post[:16])
|
|
159
|
+
else:
|
|
160
|
+
fmt, upos, uthick, fixed = 0x30000, 0, 0, 0
|
|
161
|
+
self.underline_position = upos - int(uthick / 2)
|
|
162
|
+
self.underline_thickness = uthick
|
|
163
|
+
cmap = self._table("cmap")
|
|
164
|
+
is_cff, is_cid, enc_cmap = self._f.cff_kind()
|
|
165
|
+
self.num_charmaps = len(_cmap_subtables(cmap)) + bool(enc_cmap)
|
|
166
|
+
flags = (FaceFlags.SCALABLE | FaceFlags.SFNT | FaceFlags.HORIZONTAL
|
|
167
|
+
| FaceFlags.EXTERNAL_STREAM)
|
|
168
|
+
if vhea and self._table("vmtx"):
|
|
169
|
+
flags |= FaceFlags.VERTICAL
|
|
170
|
+
if fixed:
|
|
171
|
+
flags |= FaceFlags.FIXED_WIDTH
|
|
172
|
+
kern = self._table("kern")
|
|
173
|
+
if kern and len(kern) > 4 and struct.unpack(">H", kern[2:4])[0]:
|
|
174
|
+
flags |= FaceFlags.KERNING
|
|
175
|
+
if is_cff:
|
|
176
|
+
if not is_cid:
|
|
177
|
+
flags |= FaceFlags.GLYPH_NAMES
|
|
178
|
+
else:
|
|
179
|
+
flags |= FaceFlags.HINTER
|
|
180
|
+
if fmt != 0x30000:
|
|
181
|
+
flags |= FaceFlags.GLYPH_NAMES
|
|
182
|
+
if self._table("fvar"):
|
|
183
|
+
# (FreeType sets VARIATION only once coordinates other than the
|
|
184
|
+
# default instance's are applied)
|
|
185
|
+
flags |= FaceFlags.MULTIPLE_MASTERS
|
|
186
|
+
if self._table("COLR") and self._table("CPAL") or self._table("sbix") or self._table("CBDT"):
|
|
187
|
+
flags |= FaceFlags.COLOR
|
|
188
|
+
self.num_fixed_sizes, sbix_overlay = self._count_strikes()
|
|
189
|
+
if self.num_fixed_sizes:
|
|
190
|
+
flags |= FaceFlags.FIXED_SIZES
|
|
191
|
+
if sbix_overlay:
|
|
192
|
+
flags |= FaceFlags.SBIX_OVERLAY
|
|
193
|
+
self.face_flags = flags
|
|
194
|
+
style = StyleFlags.NORMAL
|
|
195
|
+
if os2 is not None:
|
|
196
|
+
if os2["fsSelection"] & 512 or os2["fsSelection"] & 1:
|
|
197
|
+
style |= StyleFlags.ITALIC
|
|
198
|
+
if os2["fsSelection"] & 32:
|
|
199
|
+
style |= StyleFlags.BOLD
|
|
200
|
+
else:
|
|
201
|
+
mac = struct.unpack(">H", head[44:46])[0]
|
|
202
|
+
if mac & 1:
|
|
203
|
+
style |= StyleFlags.BOLD
|
|
204
|
+
if mac & 2:
|
|
205
|
+
style |= StyleFlags.ITALIC
|
|
206
|
+
self.style_flags = style
|
|
207
|
+
self.num_faces = 1
|
|
208
|
+
|
|
209
|
+
def _count_strikes(self):
|
|
210
|
+
"""The embedded bitmap strikes, as FreeType's ``tt_face_load_sbit``
|
|
211
|
+
counts them: (number of strikes, whether ``sbix`` overlays outlines)."""
|
|
212
|
+
import struct
|
|
213
|
+
table = self._table("CBLC") or self._table("EBLC") or self._table("bloc")
|
|
214
|
+
if table:
|
|
215
|
+
if len(table) < 8:
|
|
216
|
+
return 0, False
|
|
217
|
+
version, count = struct.unpack(">II", table[:8])
|
|
218
|
+
if not (version & 0xFFFF0000 in (0x20000, 0x30000)
|
|
219
|
+
or version & 0xFFFF in (0x200, 0x300)) or count >= 0x10000:
|
|
220
|
+
return 0, False
|
|
221
|
+
count = min(count, (len(table) - 8) // 48)
|
|
222
|
+
data = self._table("CBDT") or self._table("EBDT") or self._table("bdat")
|
|
223
|
+
return (count if data else 0), False
|
|
224
|
+
table = self._table("sbix")
|
|
225
|
+
if not table or len(table) < 8:
|
|
226
|
+
return 0, False
|
|
227
|
+
version, sflags, count = struct.unpack(">HHI", table[:8])
|
|
228
|
+
if version < 1 or sflags not in (1, 3) or count >= 0x10000:
|
|
229
|
+
return 0, False
|
|
230
|
+
return min(count, (len(table) - 8) // 4), sflags == 3
|
|
231
|
+
|
|
232
|
+
def set_charmap(self, i):
|
|
233
|
+
self._f.set_charmap(int(i))
|
|
234
|
+
|
|
235
|
+
def select_charmap(self, i):
|
|
236
|
+
pass
|
|
237
|
+
|
|
238
|
+
def clear(self):
|
|
239
|
+
self._last = (0.0, 0.0, 0.0)
|
|
240
|
+
|
|
241
|
+
def set_size(self, ptsize, dpi):
|
|
242
|
+
self._f.set_size(float(ptsize), float(dpi))
|
|
243
|
+
for f in self._fallback_list:
|
|
244
|
+
f.set_size(ptsize, dpi)
|
|
245
|
+
|
|
246
|
+
def _fonts(self):
|
|
247
|
+
return [self, *self._fallback_list]
|
|
248
|
+
|
|
249
|
+
def _set_transform(self, matrix, delta):
|
|
250
|
+
self._f._set_transform([[int(v) for v in row] for row in matrix], [int(v) for v in delta])
|
|
251
|
+
|
|
252
|
+
def get_char_index(self, codepoint, _fallback=False):
|
|
253
|
+
return self._f.get_char_index(codepoint)
|
|
254
|
+
|
|
255
|
+
def get_num_glyphs(self):
|
|
256
|
+
return self.num_glyphs
|
|
257
|
+
|
|
258
|
+
def load_glyph(self, glyph_index, flags=LoadFlags.FORCE_AUTOHINT):
|
|
259
|
+
if not isinstance(flags, LoadFlags):
|
|
260
|
+
flags = LoadFlags(flags)
|
|
261
|
+
return Glyph(self._f.load(int(glyph_index), bool(flags & LoadFlags.NO_SCALE)))
|
|
262
|
+
|
|
263
|
+
def load_char(self, charcode, flags=LoadFlags.FORCE_AUTOHINT):
|
|
264
|
+
return self.load_glyph(self.get_char_index(charcode), flags)
|
|
265
|
+
|
|
266
|
+
def get_path(self):
|
|
267
|
+
return self._f.get_path()
|
|
268
|
+
|
|
269
|
+
def get_glyph_name(self, index):
|
|
270
|
+
if not FaceFlags.GLYPH_NAMES & self.face_flags:
|
|
271
|
+
return f"uni{index:08x}"
|
|
272
|
+
name = self._f.glyph_name(int(index))
|
|
273
|
+
return "" if name is None else name
|
|
274
|
+
|
|
275
|
+
def get_name_index(self, name):
|
|
276
|
+
for i in range(self.num_glyphs):
|
|
277
|
+
if self._f.glyph_name(i) == name:
|
|
278
|
+
return i
|
|
279
|
+
return 0
|
|
280
|
+
|
|
281
|
+
def get_kerning(self, left, right, mode):
|
|
282
|
+
return self._f.get_kerning(int(left), int(right), int(getattr(mode, "value", mode)))
|
|
283
|
+
|
|
284
|
+
def _layout(self, text, flags, *, features=None, language=None):
|
|
285
|
+
items = []
|
|
286
|
+
fonts = self._fonts()
|
|
287
|
+
glyphs = _mplrs.layout_fonts([f._f for f in fonts], text)
|
|
288
|
+
clusters = sorted({g[2] for g in glyphs})
|
|
289
|
+
x = y = 0
|
|
290
|
+
prev_advance = None
|
|
291
|
+
prev_x = 0
|
|
292
|
+
for fi, gid, cluster, xa, ya, xo, yo in glyphs:
|
|
293
|
+
font = fonts[fi]
|
|
294
|
+
g = font.load_glyph(gid, flags)
|
|
295
|
+
prev_kern = 0.0
|
|
296
|
+
if prev_advance is not None:
|
|
297
|
+
prev_kern = (x + xo) - prev_x - prev_advance
|
|
298
|
+
nxt = next((c for c in clusters if c > cluster), len(text))
|
|
299
|
+
items.append(LayoutItem(font, text[cluster:nxt], gid, (x + xo) / 64.0,
|
|
300
|
+
(y + yo) / 64.0, prev_kern / 64.0))
|
|
301
|
+
prev_x = x + xo
|
|
302
|
+
x += xa
|
|
303
|
+
y += ya
|
|
304
|
+
prev_advance = g.linearHoriAdvance / 1024.0
|
|
305
|
+
return items
|
|
306
|
+
|
|
307
|
+
def set_text(self, string, angle=0.0, flags=LoadFlags.DEFAULT, **kwargs):
|
|
308
|
+
fonts = self._fonts()
|
|
309
|
+
self._last, warn, seen = _mplrs.set_text_fonts(
|
|
310
|
+
[f._f for f in fonts], string, [f._warn_if_used for f in fonts])
|
|
311
|
+
if warn:
|
|
312
|
+
from ._text_helpers import warn_on_missing_glyph
|
|
313
|
+
names = ", ".join(fonts[i].family_name for i in seen)
|
|
314
|
+
for c in warn:
|
|
315
|
+
warn_on_missing_glyph(c, names)
|
|
316
|
+
import numpy as np
|
|
317
|
+
return np.array([(it.x, it.y) for it in self._layout(string, flags)],
|
|
318
|
+
dtype=float).reshape(-1, 2)
|
|
319
|
+
|
|
320
|
+
def get_width_height(self):
|
|
321
|
+
w, h, d = self._last
|
|
322
|
+
return int(round(w * 64)), int(round(h * 64))
|
|
323
|
+
|
|
324
|
+
def get_descent(self):
|
|
325
|
+
return int(round(self._last[2] * 64))
|
|
326
|
+
|
|
327
|
+
def get_sfnt(self):
|
|
328
|
+
# (FreeType skips empty records)
|
|
329
|
+
return {(p, e, l, n): b for p, e, l, n, b in self._f.name_records() if b}
|
|
330
|
+
|
|
331
|
+
def get_ps_font_info(self):
|
|
332
|
+
raise ValueError("Could not get PS font info")
|
|
333
|
+
|
|
334
|
+
def get_charmap(self):
|
|
335
|
+
return _read_cmap(self._table("cmap"))
|
|
336
|
+
|
|
337
|
+
def get_sfnt_table(self, name):
|
|
338
|
+
import struct
|
|
339
|
+
tag = {"head": "head", "maxp": "maxp", "OS/2": "OS/2", "hhea": "hhea",
|
|
340
|
+
"vhea": "vhea", "post": "post", "pclt": "PCLT"}.get(name)
|
|
341
|
+
d = self._table(tag) if tag else None
|
|
342
|
+
if d is None:
|
|
343
|
+
return None
|
|
344
|
+
if name == "head":
|
|
345
|
+
(ver, rev, csum, magic, flags, upem, c0, c1, m0, m1, xmin, ymin, xmax, ymax,
|
|
346
|
+
mac, lrp, fdh, itlf, gdf) = struct.unpack(">iiiiHHIIIIhhhhHHhhh", d[:54])
|
|
347
|
+
return dict(version=_fixed(ver), fontRevision=_fixed(rev),
|
|
348
|
+
checkSumAdjustment=csum, magicNumber=magic, flags=flags,
|
|
349
|
+
unitsPerEm=upem, created=(c0, c1), modified=(m0, m1),
|
|
350
|
+
xMin=xmin, yMin=ymin, xMax=xmax, yMax=ymax, macStyle=mac,
|
|
351
|
+
lowestRecPPEM=lrp, fontDirectionHint=fdh,
|
|
352
|
+
indexToLocFormat=itlf, glyphDataFormat=gdf)
|
|
353
|
+
if name == "maxp":
|
|
354
|
+
ver, n = struct.unpack(">iH", d[:6])
|
|
355
|
+
rest = (struct.unpack(">13H", d[6:32]) if ver >= 0x10000 and len(d) >= 32
|
|
356
|
+
else (0,) * 13)
|
|
357
|
+
keys = ["maxPoints", "maxContours", "maxComponentPoints",
|
|
358
|
+
"maxComponentContours", "maxZones", "maxTwilightPoints", "maxStorage",
|
|
359
|
+
"maxFunctionDefs", "maxInstructionDefs", "maxStackElements",
|
|
360
|
+
"maxSizeOfInstructions", "maxComponentElements", "maxComponentDepth"]
|
|
361
|
+
r = dict(version=_fixed(ver), numGlyphs=n, **dict(zip(keys, rest)))
|
|
362
|
+
if ver >= 0x10000:
|
|
363
|
+
# (FreeType's adjustments for broken fonts)
|
|
364
|
+
r["maxFunctionDefs"] = max(r["maxFunctionDefs"], 64)
|
|
365
|
+
r["maxTwilightPoints"] = min(r["maxTwilightPoints"], 0xFFFF - 4)
|
|
366
|
+
return r
|
|
367
|
+
if name == "OS/2":
|
|
368
|
+
if len(d) < 68:
|
|
369
|
+
return None
|
|
370
|
+
v = struct.unpack(">HhHHHhhhhhhhhhhh", d[:32])
|
|
371
|
+
ver = v[0]
|
|
372
|
+
r = dict(version=ver, xAvgCharWidth=v[1], usWeightClass=v[2], usWidthClass=v[3],
|
|
373
|
+
fsType=v[4], ySubscriptXSize=v[5], ySubscriptYSize=v[6],
|
|
374
|
+
ySubscriptXOffset=v[7], ySubscriptYOffset=v[8],
|
|
375
|
+
ySuperscriptXSize=v[9], ySuperscriptYSize=v[10],
|
|
376
|
+
ySuperscriptXOffset=v[11], ySuperscriptYOffset=v[12],
|
|
377
|
+
yStrikeoutSize=v[13], yStrikeoutPosition=v[14], sFamilyClass=v[15],
|
|
378
|
+
panose=bytes(d[32:42]),
|
|
379
|
+
ulUnicodeRange=struct.unpack(">4I", d[42:58]),
|
|
380
|
+
achVendID=bytes(d[58:62]))
|
|
381
|
+
sel, first, last = struct.unpack(">3H", d[62:68])
|
|
382
|
+
r.update(fsSelection=sel, usFirstCharIndex=first, usLastCharIndex=last)
|
|
383
|
+
ta, td, tg, wa, wd = (struct.unpack(">hhhHH", d[68:78]) if len(d) >= 78
|
|
384
|
+
else (0, 0, 0, 0, 0))
|
|
385
|
+
r.update(sTypoAscender=ta, sTypoDescender=td, sTypoLineGap=tg,
|
|
386
|
+
usWinAscent=wa, usWinDescent=wd)
|
|
387
|
+
if ver >= 1:
|
|
388
|
+
r["ulCodePageRange"] = (struct.unpack(">2I", d[78:86]) if len(d) >= 86
|
|
389
|
+
else (0, 0))
|
|
390
|
+
if ver >= 2:
|
|
391
|
+
x = struct.unpack(">hhHHH", d[86:96]) if len(d) >= 96 else (0,) * 5
|
|
392
|
+
r.update(sxHeight=x[0], sCapHeight=x[1], usDefaultChar=x[2],
|
|
393
|
+
usBreakChar=x[3], usMaxContext=x[4])
|
|
394
|
+
if ver >= 5:
|
|
395
|
+
x = struct.unpack(">HH", d[96:100]) if len(d) >= 100 else (0, 0)
|
|
396
|
+
r.update(usLowerOpticalPointSize=x[0], usUpperOpticalPointSize=x[1])
|
|
397
|
+
return r
|
|
398
|
+
if name in ("hhea", "vhea"):
|
|
399
|
+
v = struct.unpack(">ihhhHhhhhhh8xhH", d[:36])
|
|
400
|
+
if name == "hhea":
|
|
401
|
+
keys = ["ascent", "descent", "lineGap", "advanceWidthMax", "minLeftBearing",
|
|
402
|
+
"minRightBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun",
|
|
403
|
+
"caretOffset", "metricDataFormat", "numOfLongHorMetrics"]
|
|
404
|
+
else:
|
|
405
|
+
keys = ["vertTypoAscender", "vertTypoDescender", "vertTypoLineGap",
|
|
406
|
+
"advanceHeightMax", "minTopSideBearing", "minBottomSideBearing",
|
|
407
|
+
"yMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset",
|
|
408
|
+
"metricDataFormat", "numOfLongVerMetrics"]
|
|
409
|
+
return dict(version=_fixed(v[0]), **dict(zip(keys, v[1:])))
|
|
410
|
+
if name == "post":
|
|
411
|
+
fmt, ia, up, ut, fixed, m42, x42, m1, x1 = struct.unpack(">iihhIIIII", d[:32])
|
|
412
|
+
return dict(format=_fixed(fmt), italicAngle=_fixed(ia), underlinePosition=up,
|
|
413
|
+
underlineThickness=ut, isFixedPitch=fixed, minMemType42=m42,
|
|
414
|
+
maxMemType42=x42, minMemType1=m1, maxMemType1=x1)
|
|
415
|
+
if name == "pclt":
|
|
416
|
+
(ver, num, pitch, xh, style, fam, cap, sym) = struct.unpack(">iIHHHHHH", d[:20])
|
|
417
|
+
return dict(version=_fixed(ver), fontNumber=num, pitch=pitch, xHeight=xh,
|
|
418
|
+
style=style, typeFamily=fam, capHeight=cap, symbolSet=sym,
|
|
419
|
+
typeFace=bytes(d[20:36]), characterComplement=bytes(d[36:44]),
|
|
420
|
+
strokeWeight=struct.unpack(">b", d[50:51])[0],
|
|
421
|
+
widthType=struct.unpack(">b", d[51:52])[0],
|
|
422
|
+
serifStyle=d[52])
|
|
423
|
+
return None
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
def _cmap_subtables(cmap):
|
|
427
|
+
"""The cmap subtables FreeType loads: [(platform, encoding, format, offset)]."""
|
|
428
|
+
import struct
|
|
429
|
+
if not cmap or len(cmap) < 4:
|
|
430
|
+
return []
|
|
431
|
+
out = []
|
|
432
|
+
n = struct.unpack(">H", cmap[2:4])[0]
|
|
433
|
+
for i in range(n):
|
|
434
|
+
if 12 + 8 * i > len(cmap):
|
|
435
|
+
break
|
|
436
|
+
pid, eid, off = struct.unpack(">HHI", cmap[4 + 8 * i:12 + 8 * i])
|
|
437
|
+
if off + 2 <= len(cmap):
|
|
438
|
+
out.append((pid, eid, struct.unpack(">H", cmap[off:off + 2])[0], off))
|
|
439
|
+
return out
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
def _read_cmap(cmap):
|
|
443
|
+
"""The Unicode charmap FreeType selects (`find_unicode_charmap`):
|
|
444
|
+
{codepoint: glyph index}."""
|
|
445
|
+
import struct
|
|
446
|
+
subs = [s for s in _cmap_subtables(cmap) if s[2] != 14]
|
|
447
|
+
|
|
448
|
+
def unicode(pid, eid):
|
|
449
|
+
return pid in (0, 2) or (pid == 3 and eid in (1, 10))
|
|
450
|
+
|
|
451
|
+
chosen = None
|
|
452
|
+
for pid, eid, fmt, off in reversed(subs):
|
|
453
|
+
if unicode(pid, eid) and ((pid, eid) in ((3, 10), (0, 4)) or (pid, eid, fmt) == (0, 6, 13)):
|
|
454
|
+
chosen = (fmt, off)
|
|
455
|
+
break
|
|
456
|
+
if chosen is None:
|
|
457
|
+
for pid, eid, fmt, off in reversed(subs):
|
|
458
|
+
if unicode(pid, eid):
|
|
459
|
+
chosen = (fmt, off)
|
|
460
|
+
break
|
|
461
|
+
if chosen is None:
|
|
462
|
+
return {}
|
|
463
|
+
fmt, off = chosen
|
|
464
|
+
out = {}
|
|
465
|
+
if fmt == 4:
|
|
466
|
+
segx2 = struct.unpack(">H", cmap[off + 6:off + 8])[0]
|
|
467
|
+
seg = segx2 // 2
|
|
468
|
+
ends = struct.unpack(f">{seg}H", cmap[off + 14:off + 14 + segx2])
|
|
469
|
+
p = off + 16 + segx2
|
|
470
|
+
starts = struct.unpack(f">{seg}H", cmap[p:p + segx2])
|
|
471
|
+
deltas = struct.unpack(f">{seg}h", cmap[p + segx2:p + 2 * segx2])
|
|
472
|
+
ro_pos = p + 2 * segx2
|
|
473
|
+
ros = struct.unpack(f">{seg}H", cmap[ro_pos:ro_pos + segx2])
|
|
474
|
+
for i in range(seg):
|
|
475
|
+
for c in range(starts[i], ends[i] + 1):
|
|
476
|
+
if c == 0xFFFF:
|
|
477
|
+
continue
|
|
478
|
+
if ros[i] == 0:
|
|
479
|
+
g = (c + deltas[i]) & 0xFFFF
|
|
480
|
+
else:
|
|
481
|
+
q = ro_pos + 2 * i + ros[i] + 2 * (c - starts[i])
|
|
482
|
+
g = struct.unpack(">H", cmap[q:q + 2])[0]
|
|
483
|
+
if g:
|
|
484
|
+
g = (g + deltas[i]) & 0xFFFF
|
|
485
|
+
if g:
|
|
486
|
+
out[c] = g
|
|
487
|
+
elif fmt in (12, 13):
|
|
488
|
+
ng = struct.unpack(">I", cmap[off + 12:off + 16])[0]
|
|
489
|
+
for i in range(ng):
|
|
490
|
+
s, e, g0 = struct.unpack(">3I", cmap[off + 16 + 12 * i:off + 28 + 12 * i])
|
|
491
|
+
for c in range(s, min(e, 0x10FFFF) + 1):
|
|
492
|
+
g = g0 + c - s if fmt == 12 else g0
|
|
493
|
+
if g:
|
|
494
|
+
out[c] = g
|
|
495
|
+
elif fmt == 6:
|
|
496
|
+
first, count = struct.unpack(">HH", cmap[off + 6:off + 10])
|
|
497
|
+
gs = struct.unpack(f">{count}H", cmap[off + 10:off + 10 + 2 * count])
|
|
498
|
+
out = {first + i: g for i, g in enumerate(gs) if g}
|
|
499
|
+
elif fmt == 0:
|
|
500
|
+
out = {c: g for c, g in enumerate(cmap[off + 6:off + 262]) if g}
|
|
501
|
+
return out
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
# type aliases used in annotations of the vendored modules
|
|
505
|
+
CharacterCodeType = int
|
|
506
|
+
GlyphIndexType = int
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
class LayoutItem(NamedTuple):
|
|
510
|
+
ft_object: "FT2Font"
|
|
511
|
+
char: str
|
|
512
|
+
glyph_index: int
|
|
513
|
+
x: float
|
|
514
|
+
y: float
|
|
515
|
+
prev_kern: float
|