[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
This commit is contained in:
Salvador E. Tropea 2024-01-10 13:45:48 -03:00
parent 2a038d96a2
commit 58641e2bb4
2 changed files with 4 additions and 5 deletions

View File

@ -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

View File

@ -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.