미생물학 연구 시야넓히기 (미연시)
[Inkscape] SVG 파일에서 텍스트 폰트 변경시 자간이 변하는 현상 해결
Ufungi
2025. 4. 24. 14:20
원인: R 같은 프로그램에서 figure를 pdf로 출력하면 텍스트의 x축 위치를 각각 다 지정해주기 때문
<tspan
x="-63.815434 -60.376907 -57.728951 -56.671677 -54.023731 -52.699753 -51.642479 -49.380291 -46.732338 -45.408367 -42.760414 -40.207714 -37.559769 -34.911816 -32.263866 -29.615915 -26.967964 -24.586718 -21.938766 -20.614794 -19.028877 -15.590351 -12.942406 -11.885126 -9.2371807 -7.6512637"
y="474.66321"
sodipodi:role="line"
id="tspan229168"
style="stroke-width:0.529167">Relative abundance (Color)</tspan>
<tspan
x="-63.815434"
y="474.66321"
sodipodi:role="line"
id="tspan229168"
style="stroke-width:0.529167">Relative abundance (Color)</tspan>
해결: 정규표현식으로 고친다.
1. SVG 파일을 Notepad++ 로 연다
2. 찾을내용: (<tspan[^>]*\bx="[^"\s]+)\s[^"]+
3. 바꿀내용: \1
끝!
추가로 폰트 사이즈 및 폰트 일괄 변경하는 정규 표현식
font-size:\s*[^;]+
font-family:\s*[^;]+