From 58641e2bb41cb0915118043e7f3887032ac1a79d Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Wed, 10 Jan 2024 13:45:48 -0300 Subject: [PATCH] [PDF_Print][Fixed] Text not searchable - When using newer rsvg-convert tools i.e. 2.54.7 - Previous versions discarded 100% transparent text - New versions discards text with any level of transparency Fixes #552 --- CHANGELOG.md | 1 + kibot/out_pcb_print.py | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b26f6f3a..7d3e92d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -144,6 +144,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `current`: didn't honor KiCad native DNP flags, they need a filter - PCB Print: - Issues when forcing the board edge and using scaling (#532) + - Text not searchable when using newer rsvg-convert tools (#552) ## [1.6.3] - 2023-06-26 diff --git a/kibot/out_pcb_print.py b/kibot/out_pcb_print.py index 8e7ec917..f03c2450 100644 --- a/kibot/out_pcb_print.py +++ b/kibot/out_pcb_print.py @@ -60,8 +60,6 @@ POLY_FILL_STYLE = ("fill:{0}; fill-opacity:1.0; stroke:{0}; stroke-width:1; stro "stroke-linejoin:round;fill-rule:evenodd;") DRAWING_LAYERS = ['Dwgs.User', 'Cmts.User', 'Eco1.User', 'Eco2.User'] EXTRA_LAYERS = ['F.Fab', 'B.Fab', 'F.CrtYd', 'B.CrtYd'] -# Opacity to make something invisible, but not removable -ALMOST_TRANSPARENT = '0.01' # The following modules will be downloaded after we solve the dependencies # They are just helpers and we solve their dependencies svgutils = None # Will be loaded during dependency check @@ -775,8 +773,8 @@ class PCB_PrintOptions(VariantOptions): if c.tag.endswith('}text'): opacity = c.get('opacity') if opacity is not None and opacity == '0' and c.text is not None: - c.set('opacity', ALMOST_TRANSPARENT) - c.set('style', 'font-family:monospace') + c.set('opacity', '1') + c.set('style', f'font-family:monospace; fill:{self.background_color}; stroke:{self.background_color}') contains_text = True elif c.tag.endswith('}g'): # Process all text inside @@ -785,7 +783,7 @@ class PCB_PrintOptions(VariantOptions): if contains_text: style = e.get('style') if style is not None: - e.set('style', style.replace('fill-opacity:0.0', 'fill-opacity:'+ALMOST_TRANSPARENT)) + e.set('style', style.replace('fill-opacity:0.0', 'fill-opacity:1')) def fix_opacity(self, svg): """ Transparent text is discarded by rsvg-convert.