wisemapping-frontend/packages/web2d/test/playground/font.html

138 lines
4.0 KiB
HTML
Raw Normal View History

2021-07-16 16:41:58 +02:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
2021-10-03 02:23:32 +02:00
2021-07-16 16:41:58 +02:00
<head>
2021-10-03 02:23:32 +02:00
<style>
th,
td {
border: 1px solid black;
}
</style>
2021-07-16 16:41:58 +02:00
<script type="text/javascript">
web2d = {
peer: {}
};
web2d.peer =
{
svg: {}
};
web2d.peer.utils = {};
</script>
<script type="text/javascript">
2021-10-03 02:23:32 +02:00
function multiline(text, family, elemId) {
2021-07-16 16:41:58 +02:00
var overflowWorkspace = new web2d.Workspace();
overflowWorkspace.setSize('200px', '240px');
overflowWorkspace.setCoordSize('200', '240');
overflowWorkspace.setCoordOrigin(0, 0);
2021-10-03 02:23:32 +02:00
[6, 8, 10, 15].forEach(function (size, i) {
2021-07-16 16:41:58 +02:00
var wText = new web2d.Text();
overflowWorkspace.append(wText);
wText.setText(text);
wText.setFont(family, size, 'bold');
wText.setPosition(30, 50 * i);
wText.setColor('red');
});
2021-10-03 02:23:32 +02:00
overflowWorkspace.addItAsChildTo($("#" + elemId));
2021-07-16 16:41:58 +02:00
}
function alignments(text, family, elemId) {
var overflowWorkspace = new web2d.Workspace();
overflowWorkspace.setSize('260px', '240px');
overflowWorkspace.setCoordSize('260', '240');
overflowWorkspace.setCoordOrigin(0, 0);
2021-10-03 02:23:32 +02:00
['center', 'left', 'right'].forEach(function (align, i) {
2021-07-16 16:41:58 +02:00
var wText = new web2d.Text();
overflowWorkspace.append(wText);
wText.setText(text);
wText.setFont(family, 8, 'bold');
wText.setPosition(30, 80 * i);
wText.setColor('red');
wText.setTextAlignment(align);
});
2021-10-03 02:23:32 +02:00
overflowWorkspace.addItAsChildTo($("#" + elemId));
2021-07-16 16:41:58 +02:00
}
function initialize() {
web2d.Toolkit.init();
// Multine tests ...
2021-10-03 02:23:32 +02:00
['Arial', 'Tahoma', 'Verdana', 'Times'].forEach(function (family, i) {
2021-07-16 16:41:58 +02:00
multiline('This multine text.\nLine 1 :)\nLine2', family, 'multi' + i);
});
// Multine tests and alingments .. ...
2021-10-03 02:23:32 +02:00
['Arial', 'Tahoma', 'Verdana', 'Times'].forEach(function (family, i) {
2021-07-16 16:41:58 +02:00
alignments('This multine text.\nThis is the long line just because :)\nShort line', family, 'amulti' + i);
})
}
</script>
</head>
<body onload="initialize();">
2021-10-03 02:23:32 +02:00
<h1>Web2d Fonts Tests</h1>
<table>
<colgroup>
<col style="width:30%" />
<col style="width:60%" />
</colgroup>
<thead>
<tr>
<td></td>
<td>Arial</td>
<td>Tahoma</td>
<td>Verdana</td>
<td>Times</td>
</tr>
</thead>
<tr>
<td>
Multiline Text
</td>
<td>
<div id="multi0"></div>
</td>
<td>
<div id="multi1"></div>
</td>
<td>
<div id="multi2"></div>
</td>
<td>
<div id="multi3"></div>
</td>
</tr>
<tr>
<td>
Multiline Aligment
</td>
<td>
<div id="amulti0"></div>
</td>
<td>
<div id="amulti1"></div>
</td>
<td>
<div id="amulti2"></div>
</td>
<td>
<div id="amulti3"></div>
</td>
</tr>
<!--**************************************************************************-->
</table>
<input type="button" value="Zoom In" onclick="zoomIn()">
2021-07-16 16:41:58 +02:00
</body>
2021-10-03 02:23:32 +02:00
</html>