File: textLength.svg

package info (click to toggle)
batik 1.19-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 28,976 kB
  • sloc: java: 192,236; xml: 19,457; javascript: 1,276; sh: 85; makefile: 5
file content (140 lines) | stat: -rw-r--r-- 6,185 bytes parent folder | download | duplicates (2)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" 
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">

<!--

   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

-->
<!-- ====================================================================== -->
<!-- Tests text-anchor on tspan elements                                    -->
<!--                                                                        -->
<!-- @author deweese@apache.org                                             -->
<!-- @version $Id$    -->
<!-- ====================================================================== -->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>  

<svg width="450" height="500" viewBox="0 0 450 500">

    <text class="title" x="50%" y="20">textLength with Anchor</text>


   <defs>
      <g id="fill-rgn">
         <rect x="200" y="5" width="50" height="20"
                 fill="#DDE8FF" stroke="none"/>
         <line x1="225" y1="3" x2="225" y2="27" stroke="red"/>
      </g>

      <g id="bg1">
         <rect x="50"  y="0" width ="350" height="45"
               fill="lightGrey" stroke="black"/>
         <use xlink:href="#fill-rgn"/>
      </g>

      <g id="bg2">
         <rect x="50"  y="0" width ="350" height="45"
               fill="white" stroke="black"/>
         <use xlink:href="#fill-rgn"/>
      </g>
   </defs>
   
   <g font-size="12" >
      <!-- no lengthadjust -->
      <g transform="translate(0,  30)">
              <use xlink:href="#bg1"/>
              <text x="225" y="19" text-anchor="middle">xml-batik</text>
              <text x="225" y="40" text-anchor="middle">No textLength</text>
      </g>
      
      <!-- With lengthAdjust spacingAndGlyphs -->
      <g transform="translate(0, 75)">
              <use xlink:href="#bg2"/>
              <text x="225" y="19" text-anchor="middle" textLength="50"
                      lengthAdjust="spacingAndGlyphs">B</text>
              <text x="225" y="40" text-anchor="middle">textLength="50" lengthAdjust="spacingAndGlyphs"</text>
      </g>
      
      <!-- with lengthAdjust spacing -->
      <g transform="translate(0, 120)">
              <use xlink:href="#bg1"/>
              <text x="225" y="19" text-anchor="middle" textLength="50"
                      lengthAdjust="spacing">B</text>
              <text x="225" y="40" text-anchor="middle">textLength="50" lengthAdjust="spacing"</text>
      </g>
      
      <!-- with lengthAdjust spacing -->
      <g transform="translate(0, 165)">
              <use xlink:href="#bg2"/>
              <text x="225" y="19" text-anchor="middle" textLength="50"
                      lengthAdjust="spacingAndGlyphs">Batik</text>
              <text x="225" y="40" text-anchor="middle">textLength="50" lengthAdjust="spacingAndGlyphs"</text>
      </g>
      
      <!-- with lengthAdjust spacing -->
      <g transform="translate(0, 210)">
              <use xlink:href="#bg1"/>
              <text x="225" y="19" text-anchor="middle" textLength="50"
                      lengthAdjust="spacing">Batik</text>
              <text x="225" y="40" text-anchor="middle">textLength="50" lengthAdjust="spacing"</text>
      </g>
      
      <!-- large number -->
      <g transform="translate(0, 255)">
              <use xlink:href="#bg2"/>
              <text x="225" y="19" text-anchor="middle" textLength="50"
                      lengthAdjust="spacingAndGlyphs">Apache Batik</text>
              <text x="225" y="40" text-anchor="middle">textLength="50" lengthAdjust="spacingAndGlyphs" (shrinking)</text>
      </g>
      
      <!-- large number, no anchor -->
      <g transform="translate(0, 300)">
              <use xlink:href="#bg1"/>
              <text x="200" y="19" textLength="50"
                      lengthAdjust="spacingAndGlyphs">Apache Batik</text>
              <text x="225" y="40" text-anchor="middle">textLength="50" lengthAdjust="spacingAndGlyphs" (no anchor)</text>
      </g>
      
      <!-- large number, tspan -->
      <g transform="translate(0, 345)">
              <use xlink:href="#bg2"/>
              <text x="225" y="19" text-anchor="middle" textLength="50" 
                    lengthAdjust="spacingAndGlyphs">Apache <tspan fill="red">Batik</tspan>!!</text>
              <text x="225" y="40" text-anchor="middle">textLength="50" lengthAdjust="spacingAndGlyphs" (tspan)</text>
      </g>

      <!-- Big Font Squeezed alot -->
      <g transform="translate(0, 390)">
         <rect x="50"  y="0" width ="350" height="95"
               fill="lightGrey" stroke="black"/>
         <rect x="112.5" y="5" width="25" height="80"
                 fill="#DDE8FF" stroke="none"/>
         <line x1="125" y1="3" x2="125" y2="87" stroke="red"/>
         <text x="125" y="79" text-anchor="middle" textLength="25" 
               lengthAdjust="spacingAndGlyphs"
               font-size="100">B a t i k</text>
         <text x="160" y="40">lengthAdjust="spacingAndGlyphs"
          <tspan x="160" dy="1.2em">textLength="25"</tspan>
          <tspan x="160" dy="1.2em">font-size="100"</tspan></text>
      </g>
   </g>

   <!-- ============================================================= -->
   <!-- Batik sample mark                                             -->
   <!-- ============================================================= -->
   <use xlink:href="../../../batikLogo.svg#Batik_Tag_Box" />
</svg>