-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (27 loc) · 3.03 KB
/
Makefile
File metadata and controls
45 lines (27 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
##### MF for creation of "extended" SVGs (CLI edited SVGs), for usage in super-projects (see e.g. MF in test/)
### external setting of path to ell_type.m
ELLEVAL?=./
### setting default paths of external programs
OCTAVE?=/opt/octave-4.0.3/
export PATH:= $(OCTAVE)/bin:$(PATH)
SHELL?= /bin/bash
%_shearY.svg : %.svg
sed '/<rect x="0" y="0" width=".*" height=".*" fill="none"\/>/d' $< > $@ # remove BG rec, not possible from within octave as gnuplot term is overwritten by print-command? (not tried) http://stackoverflow.com/questions/18169221/gnuplot-png-file-without-border-line
## get BBox coords with inkscape ;-) https://sourceforge.net/p/inkscape/mailman/message/21202829/ # not available in rsvg-convert from librsvg nor svg_utils https://github.com/btel/svg_utils
## SVG transform https://www.w3.org/TR/SVG/coords.html#TransformAttributeEffectOnSiblingAttributes
x=`inkscape --without-gui --query-id=gnuplot_canvas -X $@ ` ; \
y=`inkscape --without-gui --query-id=gnuplot_canvas -Y $@ ` ; \
sed -i 's/<g id="gnuplot_canvas">/<g id="gnuplot_canvas" transform="translate('$$x,$$y') skewY(-30) translate('-$$x,-$$y')" >/' $@ # basically works, ToDo: do not plot text (overlay in latex) or also repos "separation curve", "ellipse arc", "oblate line", "circle\npoint" # https://developer.mozilla.org/de/docs/Web/SVG/Attribute/transform
%_VB.svg : %.svg
sed '/<text>.*<\/text>/d' $< | sed '/<rect x="0" y="0" width=".*" height=".*" fill="none"\/>/d' > $@ # 1st run: remove text and rec to determing BBox
VAL=`inkscape --without-gui --query-all $@ | grep gnuplot_canvas | awk -F, '{print $$2, $$3, $$4, $$5}' ` ; \
sed "s|viewBox=.*\$$|viewBox='$$VAL' preserveAspectRatio='xMinYMin slice'|" $< > $@ # adjust SVG viewbox for typesetting with latex ;-) # keep rec which is needed in "inc-shearY"-rule later
%-VB.svg : %.svg # remove viewBox for correct view in e.g. firefox
sed "/viewBox.*preserveAspectRatio='xMinYMin slice'/d" $< > $@
.PRECIOUS: %_shearY.svg
%2Dshist_inc-shearY_VB.svg : %2Dshist_shearY.svg %2Danno_VB.svg
sed 's/<rect x="0" y="0" width=".*" height=".*" fill="none"\/>/<use x="0" y="0" xlink:href="$<#gnuplot_canvas" \/>/' $(lastword $^) > $@ # <use ...> needs Inkscape 0.91, SVG inclusion with <image ...> is rasterized by Inkscape http://superuser.com/questions/255086/is-it-possible-to-embed-or-link-one-inkscape-svg-document-inside-another-one http://stackoverflow.com/questions/5451135/embed-svg-in-svg
# inkscape --verb=FitCanvasToDrawing --verb=FileSave --verb=FileClose $@ # auto crop with inkscape: https://shkspr.mobi/blog/2013/03/inkscape-cropping-svg-files-on-the-command-line/ # using JS: http://stackoverflow.com/questions/23560038/html5-inline-svg-autocrop-whitespace#23698133
.PRECIOUS: %.efit-2DpdistOV.svg %_shearY.svg
%2Dshist_inc-pdist-shearY_VB.svg : %2DpdistOV.svg %2Dshist_shearY.svg %2Danno_VB.svg
sed 's/<rect x="0" y="0" width=".*" height=".*" fill="none"\/>/<use x="0" y="0" xlink:href="$(word 1,$^)#gnuplot_canvas" \/><use x="0" y="0" style="opacity:0.90" xlink:href="$(word 2,$^)#gnuplot_canvas" \/>/' $(lastword $^) > $@