]> j8takagi.net git repositories - yacasl2.git/commitdiff
CASL2仕様書のPDFで画像がズレる現象の回避。SVG→EPS変換のBoundingBox原点ずれを修正 v0.5p36
authorj8takagi <j8takagi@nifty.com>
Wed, 27 May 2026 14:26:44 +0000 (23:26 +0900)
committerj8takagi <j8takagi@nifty.com>
Wed, 27 May 2026 14:31:04 +0000 (23:31 +0900)
https://claude.ai/share/316d935c-a0e6-49c7-ab56-e7d9a7050eb9
問題:
  rsvg-convertが生成するEPSのBoundingBox原点が(0,0)でなく
  (7,52)などの非ゼロ値になっており、TeXが図のサイズを誤認して
  後続テキストが図に重なるズレが発生していた。

対策:
  gs -dEPSCropで座標変換込みで再レンダリングし、
  原点を(0,0)に正規化する。

変更内容:
  - images.mk: eps2epsをgs -dEPSCropパイプラインに置き換え
  - images.mk: %.epsルールのログファイル名typo修正
  - images.mk: %.pdfルール追加
  - img/*.svg: font-sizeを10ptに統一(10px/15px/10ptが混在していた)
```

VERSION
doc/casl2_spec/Makefile
doc/casl2_spec/img/1_1-01.svg
doc/casl2_spec/img/r_1-01.svg
doc/casl2_spec/img/r_1-02.svg
doc/casl2_spec/img/r_1-03.svg
doc/casl2_spec/img/r_1-04.svg
doc/casl2_spec/img/r_1-05.svg
doc/images.mk

diff --git a/VERSION b/VERSION
index 1ba37ab77664aa856a9a1fa9b2ad31810422b1f4..144c974c06777ec8671de160cc83d3061f4f7d2d 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-v0.5p35
+v0.5p36
index 387b80864a966eb8e1e08401ed97ff5796994b31..0c7bb32aa088ab091fd18aaf7178b0aa6c0183ac 100644 (file)
@@ -13,7 +13,7 @@ all: casl2_spec.html casl2_spec.pdf
 casl2_spec.html: style.css
 
 clean: texinfo-clean
-       $(RM) *.bak
+       $(RM) *.bak *.dvi
        $(MAKE) -C img clean
 
 distclean: clean texinfo-distclean
index c0473765d1f715dc4928eeb411fe1f76c1359997..01e8cfcb1e2f05ea32972091a8412050ae92d417 100644 (file)
@@ -5,28 +5,28 @@
       <path d="M0,40 Q0,30 10,30 L110,30 Q120,30 120,20 Q120,30 130,30 L225,30 Q235,30 235,40" />
       <path d="M245,40 Q245,30 255,30 L350,30 Q360,30 360,20 Q360,30 370,30 L470,30 Q480,30 480,40" />
     </g>
-    <g font-family="sans-serif" font-size="10px" fill="black">
+    <g font-family="sans-serif" font-size="10pt" fill="black">
       <text x="120" y="15" text-anchor="middle">上位8ビット</text>
       <text x="360" y="15" text-anchor="middle">下位8ビット</text>
     </g>
-    <g font-family="monospace" font-size="10px" fill="black">
-      <text x="5" y="55">15</text>
-      <text x="35" y="55">14</text>
-      <text x="65" y="55">13</text>
-      <text x="95" y="55">12</text>
-      <text x="125" y="55">11</text>
-      <text x="155" y="55">10</text>
-      <text x="190" y="55">9</text>
-      <text x="220" y="55">8</text>
-      <text x="250" y="55">7</text>
-      <text x="280" y="55">6</text>
-      <text x="310" y="55">5</text>
-      <text x="340" y="55">4</text>
-      <text x="370" y="55">3</text>
-      <text x="400" y="55">2</text>
-      <text x="430" y="55">1</text>
-      <text x="460" y="55">0</text>
-      <text x="470" y="55">(ビット番号)</text>
+    <g font-family="monospace" font-size="10pt" fill="black" text-anchor="middle">
+      <text x="15" y="55">15</text>
+      <text x="45" y="55">14</text>
+      <text x="75" y="55">13</text>
+      <text x="105" y="55">12</text>
+      <text x="135" y="55">11</text>
+      <text x="165" y="55">10</text>
+      <text x="195" y="55">9</text>
+      <text x="225" y="55">8</text>
+      <text x="255" y="55">7</text>
+      <text x="285" y="55">6</text>
+      <text x="315" y="55">5</text>
+      <text x="345" y="55">4</text>
+      <text x="375" y="55">3</text>
+      <text x="405" y="55">2</text>
+      <text x="435" y="55">1</text>
+      <text x="465" y="55">0</text>
+      <text x="520" y="55">(ビット番号)</text>
     </g>
     <g stroke="black" stroke-width="1" fill="none">
       <rect x="0" y="60" width="480" height="30" />
@@ -49,7 +49,7 @@
       <path d="M15,90 L15,115 L85,115" />
       <path d="M10,100 L15,90 L20,100" />
     </g>
-    <g font-family="sans-serif" font-size="10px" fill="black">>
+    <g font-family="sans-serif" font-size="10pt" fill="black">>
       <text x="90" y="120">符号(負:1, 非負:0)</text>
     </g>
   </g>
index 942228e4cadef03c152891821fa951d65996750b..d5c8f909d5d226caaf02aaddc86552b3962a7681 100644 (file)
@@ -42,7 +42,7 @@
     <path d="M10,840 L730,840" />
     <path d="M10,900 L730,900" />
   </g>
-  <g font-size="15px" font-family="sans-serif" fill="black">
+  <g font-size="10pt" font-family="sans-serif" fill="black">
     <text x="80" y="55">第1語</text>
     <text x="240" y="55">第2語</text>
     <text x="25" y="75">OP</text>
@@ -58,7 +58,7 @@
     <text x="625" y="85">意味</text>
   </g>
 
-  <g font-size="15px" fill="black">
+  <g font-size="10pt" fill="black">
     <text x="25" y="115">0</text><text x="65" y="115">0</text><text x="100" y="115">&#x2014;</text><text x="140" y="115">&#x2014;</text><text x="245" y="115">&#x2014;</text><text x="345" y="115">1</text><text x="380" y="115" font-family="monospace">NOP</text><text x="555" y="115">no operation</text>
     <text x="25" y="135">1</text><text x="65" y="135">0</text><text x="345" y="135">2</text><text x="380" y="135" font-family="monospace">LD</text><text x="440" y="135" font-family="monospace">r,adr,x</text><text x="555" y="135">load</text>
     <text x="65" y="155">1</text><text x="345" y="155">2</text><text x="380" y="155" font-family="monospace">ST</text><text x="440" y="155" font-family="monospace">r,adr,x</text><text x="555" y="155">store</text>
index 40b277b2ebee6e7c8e99969d554f84061f2bb11e..33ec4dfdd28c7d63fa5805a994ba1fbf29c9f14f 100644 (file)
       </g>
       <circle cx="145" cy="75" r="5" fill="black" />
       <circle cx="620" cy="75" r="5" fill="black" />
-      <text x="625" y="80" font-family="monospace" font-size="15px" fill="black">0</text>
+      <text x="625" y="80" font-family="monospace" font-size="10pt" fill="black">0</text>
     </g>
-    <g font-family="monospace" font-size="15px" fill="black">
-      <text x="35" y="55">OF</text>
-      <text x="105" y="55">15</text>
-      <text x="135" y="55">14</text>
-      <text x="165" y="55">13</text>
-      <text x="195" y="55">12</text>
-      <text x="225" y="55">11</text>
-      <text x="255" y="55">10</text>
-      <text x="290" y="55">9</text>
-      <text x="320" y="55">8</text>
-      <text x="350" y="55">7</text>
-      <text x="380" y="55">6</text>
-      <text x="410" y="55">5</text>
-      <text x="440" y="55">4</text>
-      <text x="470" y="55">3</text>
-      <text x="500" y="55">2</text>
-      <text x="530" y="55">1</text>
-      <text x="560" y="55">0</text>
+    <g font-family="monospace" font-size="10pt" fill="black" text-anchor="middle">
+      <text x="45" y="55">OF</text>
+      <text x="115" y="55">15</text>
+      <text x="145" y="55">14</text>
+      <text x="175" y="55">13</text>
+      <text x="205" y="55">12</text>
+      <text x="235" y="55">11</text>
+      <text x="265" y="55">10</text>
+      <text x="295" y="55">9</text>
+      <text x="325" y="55">8</text>
+      <text x="355" y="55">7</text>
+      <text x="385" y="55">6</text>
+      <text x="415" y="55">5</text>
+      <text x="445" y="55">4</text>
+      <text x="475" y="55">3</text>
+      <text x="505" y="55">2</text>
+      <text x="535" y="55">1</text>
+      <text x="565" y="55">0</text>
     </g>
   </g>
 </svg>
index f1ee87a0e55173cddb334f2191e0cfd53ce01cba..d281206173932fda793886dcc14c99e45334eec8 100644 (file)
       <circle cx="115" cy="75" r="5" fill="black" />
       <circle cx="565" cy="75" r="5" fill="black" />
     </g>
-    <g font-family="monospace" font-size="15px" fill="black">
-      <text x="105" y="55">15</text>
-      <text x="135" y="55">14</text>
-      <text x="165" y="55">13</text>
-      <text x="195" y="55">12</text>
-      <text x="225" y="55">11</text>
-      <text x="255" y="55">10</text>
-      <text x="290" y="55">9</text>
-      <text x="320" y="55">8</text>
-      <text x="350" y="55">7</text>
-      <text x="380" y="55">6</text>
-      <text x="410" y="55">5</text>
-      <text x="440" y="55">4</text>
-      <text x="470" y="55">3</text>
-      <text x="500" y="55">2</text>
-      <text x="530" y="55">1</text>
-      <text x="560" y="55">0</text>
-      <text x="625" y="55">OF</text>
+    <g font-family="monospace" font-size="10pt" fill="black" text-anchor="middle">
+      <text x="115" y="55">15</text>
+      <text x="145" y="55">14</text>
+      <text x="175" y="55">13</text>
+      <text x="205" y="55">12</text>
+      <text x="235" y="55">11</text>
+      <text x="265" y="55">10</text>
+      <text x="295" y="55">9</text>
+      <text x="325" y="55">8</text>
+      <text x="355" y="55">7</text>
+      <text x="385" y="55">6</text>
+      <text x="415" y="55">5</text>
+      <text x="445" y="55">4</text>
+      <text x="475" y="55">3</text>
+      <text x="505" y="55">2</text>
+      <text x="535" y="55">1</text>
+      <text x="565" y="55">0</text>
+      <text x="635" y="55">OF</text>
     </g>
   </g>
 </svg>
index 436ba4b18d7403ec7e574f792ebaec4713f8a236..aadb8bb6d925f9103bd6ea91fd5230ee613324b0 100644 (file)
       </g>
       <circle cx="115" cy="75" r="5" fill="black" />
       <circle cx="620" cy="75" r="5" fill="black" />
-      <text x="625" y="80" font-family="monospace" font-size="15px" fill="black">0</text>
+      <text x="625" y="80" font-family="monospace" font-size="10pt" fill="black">0</text>
     </g>
-    <g font-family="monospace" font-size="15px" fill="black">
-      <text x="35" y="55">OF</text>
-      <text x="105" y="55">15</text>
-      <text x="135" y="55">14</text>
-      <text x="165" y="55">13</text>
-      <text x="195" y="55">12</text>
-      <text x="225" y="55">11</text>
-      <text x="255" y="55">10</text>
-      <text x="290" y="55">9</text>
-      <text x="320" y="55">8</text>
-      <text x="350" y="55">7</text>
-      <text x="380" y="55">6</text>
-      <text x="410" y="55">5</text>
-      <text x="440" y="55">4</text>
-      <text x="470" y="55">3</text>
-      <text x="500" y="55">2</text>
-      <text x="530" y="55">1</text>
-      <text x="560" y="55">0</text>
+    <g font-family="monospace" font-size="10pt" fill="black" text-anchor="middle">
+      <text x="45" y="55">OF</text>
+      <text x="115" y="55">15</text>
+      <text x="145" y="55">14</text>
+      <text x="175" y="55">13</text>
+      <text x="205" y="55">12</text>
+      <text x="235" y="55">11</text>
+      <text x="265" y="55">10</text>
+      <text x="295" y="55">9</text>
+      <text x="325" y="55">8</text>
+      <text x="355" y="55">7</text>
+      <text x="385" y="55">6</text>
+      <text x="415" y="55">5</text>
+      <text x="445" y="55">4</text>
+      <text x="475" y="55">3</text>
+      <text x="505" y="55">2</text>
+      <text x="535" y="55">1</text>
+      <text x="565" y="55">0</text>
     </g>
   </g>
 </svg>
index 4c84c4b4a48a79892f0cb2004cebe39e25a423e1..427d6ea81f354ea73f12c1d71c68335e3e90d526 100644 (file)
       <circle cx="60" cy="75" r="5" fill="black" />
       <circle cx="565" cy="75" r="5" fill="black" />
     </g>
-    <text x="45" y="80" font-family="monospace" font-size="15px" fill="black">0</text>
-    <g font-family="monospace" font-size="15px" fill="black">
-      <text x="105" y="55">15</text>
-      <text x="135" y="55">14</text>
-      <text x="165" y="55">13</text>
-      <text x="195" y="55">12</text>
-      <text x="225" y="55">11</text>
-      <text x="255" y="55">10</text>
-      <text x="290" y="55">9</text>
-      <text x="320" y="55">8</text>
-      <text x="350" y="55">7</text>
-      <text x="380" y="55">6</text>
-      <text x="410" y="55">5</text>
-      <text x="440" y="55">4</text>
-      <text x="470" y="55">3</text>
-      <text x="500" y="55">2</text>
-      <text x="530" y="55">1</text>
-      <text x="560" y="55">0</text>
-      <text x="625" y="55">OF</text>
+    <g font-family="monospace" font-size="10pt" fill="black" text-anchor="middle">
+      <text x="50" y="80">0</text>
+      <text x="115" y="55">15</text>
+      <text x="145" y="55">14</text>
+      <text x="175" y="55">13</text>
+      <text x="205" y="55">12</text>
+      <text x="235" y="55">11</text>
+      <text x="265" y="55">10</text>
+      <text x="295" y="55">9</text>
+      <text x="325" y="55">8</text>
+      <text x="355" y="55">7</text>
+      <text x="385" y="55">6</text>
+      <text x="415" y="55">5</text>
+      <text x="445" y="55">4</text>
+      <text x="475" y="55">3</text>
+      <text x="505" y="55">2</text>
+      <text x="535" y="55">1</text>
+      <text x="565" y="55">0</text>
+      <text x="635" y="55">OF</text>
     </g>
   </g>
 </svg>
index 5f80fd42f230587f2026d502a484c7f606bd7a17..94d2a11c09ceebc6c60d4e2f7379ed295e875693 100644 (file)
@@ -1,8 +1,12 @@
-INKSCAPE := inkscape
-CONVERT := convert
+RSVG_CONVERT := rsvg-convert
+GS := gs
+GS_EPSCROP := $(GS) -q -dNOPAUSE -dBATCH -sDEVICE=eps2write -dEPSCrop
 
 %.png: %.svg
-       $(INKSCAPE) -y 0.0 -e $@ $< >$<2png.log 2>&1
+       $(RSVG_CONVERT) --format=png --output=$@ $< >$<2png.log 2>&1
 
 %.eps: %.svg
-       $(INKSCAPE) --export-type=eps $@ $< >$<2eps.log 2>&1
+       $(RSVG_CONVERT) --format=eps --output=$@.tmp $< >$<2eps.log 2>&1 && $(GS_EPSCROP) -sOutputFile=$@ $@.tmp
+
+%.pdf: %.svg
+       $(RSVG_CONVERT) --format=pdf --output=$@ $< >$<2pdf.log 2>&1