-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4.html
More file actions
139 lines (129 loc) · 2.65 KB
/
4.html
File metadata and controls
139 lines (129 loc) · 2.65 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
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
<html lang="sa">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>...</title>
<style>
@font-face {
font-family: "Chanakya";
src: url("ChanakyaBBTUni.ttf");
}
@font-face {
font-family: "Chanakya";
src: url("ChanakyaBBTUni-Bold.ttf");
font-weight: bold;
}
</style>
</head>
<body onload="f1()">
<div id="glt" style="margin-left:0;margin-right:0;font-size:x-large;word-spacing:-0.25em;font-family:Chanakya;"></div>
<script src="3.js"></script>
<script>
var glt=document.getElementById("glt");
var khchk = document.createElement('span');
glt.appendChild(khchk);
var ss,sw,l1,l2,lw;
var L1,L2,Lw;
var dvv;
var con,cow,LW;
function f1(){
document.fonts.ready.then(function()
{
document.title=n.toString();
ss=s//.split(' ');
sw=new Array();
var i;
for(i=0;i<ss.length;i++)
{
khchk.innerText=ss[i];
sw.push(khchk.offsetWidth);
}
for(i=1;i<=150;i++)
khchk.innerHTML+=i.toString()+"<br>";
dvv=glt.offsetWidth-1;
khchk.innerText="";
l1=new Array();
l2=new Array();
lw=new Array();
i=0;
while(i<sw.length)
{
var w=0;
l1.push(i);
while(i<sw.length)
{
if(w+sw[i]<dvv)w+=sw[i];
else break;
i++;
}
l2.push(i);
lw.push(w);
}
var kn=false;
while(!kn)
{
var wow=0;
con=0;cow=0;
for(i=0;i<l1.length;i++)
{
if(lw[i]-sw[l2[i]-1]>=cow)
{
cow=lw[i]-sw[l2[i]-1];
con=i;
}
if(lw[i]>wow)
wow=lw[i];
}
L1=l1.slice();
L2=l2.slice();
Lw=lw.slice();
l1.splice(con+1,l1.length-con-1);
l2.splice(con+1,l2.length-con-1);
lw.splice(con+1,lw.length-con-1);
l2[con]-=1;
lw[con]-=sw[l2[con]];
i=l2[con];
//dvv=wow;
while(i<sw.length)
{
var w=0;
l1.push(i);
while(i<sw.length)
{
if(w+sw[i]<=dvv)w+=sw[i];
else break;
i++;
}
l2.push(i);
lw.push(w);
}
if(l1.length>L1.length)kn=true;
}
var II=dvv-wow;
glt.style.marginLeft=Math.floor(II/2).toString()+"px";
glt.style.marginRight=(II-Math.floor(II/2)).toString()+"px";
var ks="";
var j;
for(i=0;i<L1.length;i++)
{
ks="";
var w=0;
//var newSpan = document.createElement('span');
//glt.appendChild(newSpan);
for(j=L1[i];j<L2[i];j++)
{
ks+="<span style=\"position:relative;display:inline-block;width:"+sw[j].toString()+";left:"+Math.floor((wow-Lw[i])*(j-L1[i])/(L2[i]-L1[i]))+";\">"+ss[j]+"</span>";
w+=sw[j];
}
//newSpan.innerHTML=ks;
//if(w!=Lw[i]||newSpan.offsetWidth>Lw[i])console.log(i.toString()+":"+newSpan.offsetWidth.toString()+","+Lw[i].toString()+","+w.toString());
glt.innerHTML+=ks+"<br>";
//glt.innerHTML+=ks+"<br>";
glt.style.textAlignLast="left";
}
glt.style.width=glt.offsetWidth;
})
}
</script>
</body>
</html>