mirror of
https://gitlab.constantvzw.org/osp/tools.cobbled-paths.git
synced 2024-12-22 04:30:32 +01:00
Set correct dimensions on HPGL export
This commit is contained in:
parent
b81705d105
commit
64839e50bd
12
app.py
12
app.py
@ -290,6 +290,16 @@ def catalogue():
|
||||
#
|
||||
# FIGLET 2 SVGBOB INTERACTIVE CATALOGUE
|
||||
|
||||
def resizeSVG (m):
|
||||
width = int(m.group(1))
|
||||
height = int(m.group(2))
|
||||
|
||||
viewbox = f'0 0 {width} {height}'
|
||||
|
||||
newHeight = 420
|
||||
newWidth = (width/height) * newHeight
|
||||
|
||||
return f'<svg xmlns="http://www.w3.org/2000/svg" viewbox="{viewbox}" width="{newWidth}mm" height="{newHeight}mm" class="svgbob">'
|
||||
|
||||
@app.route('/hpgl/<id>')
|
||||
def hpgl (id):
|
||||
@ -309,6 +319,8 @@ def hpgl (id):
|
||||
|
||||
svg = re.sub(r'\<rect class="backdrop" x="\d+" y="\d+" width="\d+" height="\d+">\<\/rect\>', '', svg, flags=re.M)
|
||||
|
||||
svg = re.sub(r'<svg xmlns="http://www.w3.org/2000/svg" width="(\d+)" height="(\d+)" class="svgbob">', resizeSVG,svg)
|
||||
|
||||
#print(svg)
|
||||
|
||||
# store as a temporary file
|
||||
|
Loading…
Reference in New Issue
Block a user