From 957432fae79ec6ea9452844f3b849a39eec03c6c Mon Sep 17 00:00:00 2001 From: Jostein Leira <9363084+josteinl@users.noreply.github.com> Date: Tue, 10 Mar 2026 12:54:30 +0100 Subject: [PATCH] Remove filter of non-ascii characters in `RendererDxf.draw_text()`. --- CHANGES.md | 9 +++++++++ mpldxf/backend_dxf.py | 6 ------ pyproject.toml | 5 +++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b0c83f1..a378c3a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,14 @@ # Changes +## Version 1.0.4 + +_2026-03-10_ + +Change: + +- Remove filter of non-ascii characters in `RendererDxf.draw_text()`. + Let this be up to the caller if any filtering is needed. + ## Version 1.0.3 _2026-02-24_ diff --git a/mpldxf/backend_dxf.py b/mpldxf/backend_dxf.py index fb28401..0685961 100644 --- a/mpldxf/backend_dxf.py +++ b/mpldxf/backend_dxf.py @@ -34,7 +34,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from __future__ import absolute_import, division, unicode_literals from io import BytesIO, StringIO import os import sys @@ -49,8 +48,6 @@ FigureManagerBase, ) from matplotlib.transforms import Affine2D -import matplotlib.transforms as transforms -import matplotlib.collections as mplc import numpy as np from shapely import Point from shapely.geometry import LineString, Polygon @@ -818,9 +815,6 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None): else: dxfattribs["color"] = rgb_to_dxf(gc.get_rgb()) - s = s.replace("\u2212", "-") - s = s.encode("ascii", "ignore").decode() - if s and len(s) > 0 and s[0] == "$": pattern = r"\\mathbf\{(.*?)\}" stripped_text = re.sub(pattern, r"\1", s) diff --git a/pyproject.toml b/pyproject.toml index 655991a..65acb50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,11 @@ [tool.poetry] name = "mpldxf" -version = "1.0.3" +version = "1.0.4" description = "A fork of mpldxf - a matplotlib backend to write DXF drawings. Modified by NGI to handle geotechnical plots" authors = ["David Kent", "Jon-Michael Josefsen ", - "Ingeborg Gjerde "] + "Ingeborg Gjerde ", + "Jostein Leira "] license = "MIT" readme = "README.md" homepage = "https://github.com/norwegian-geotechnical-institute/mpldxf-NGI"