This commit is contained in:
Paulo Gustavo Veiga
2022-01-03 12:03:01 -08:00
parent 60fffe2c40
commit 5d3f04fe77
13 changed files with 115 additions and 124 deletions

View File

@ -13,6 +13,7 @@
<td>Tahoma</td>
<td>Verdana</td>
<td>Times</td>
<td>Brush Script MT</td>
</tr>
</thead>
<tbody>
@ -32,6 +33,9 @@
<td>
<div id="multi3"></div>
</td>
<td>
<div id="multi4"></div>
</td>
</tr>
<tr>
<td>
@ -49,6 +53,9 @@
<td>
<div id="amulti3"></div>
</td>
<td>
<div id="amulti4"></div>
</td>
</tr>
<!--**************************************************************************-->
</tbody>

View File

@ -1,11 +1,11 @@
import $ from 'jquery';
import {
Toolkit, Workspace, Text,
Workspace, Text,
} from '../../src';
global.$ = $;
function multiline(text, family, elemId) {
function multiline(text, fontName, elemId) {
const workspace = new Workspace();
workspace.setSize('200px', '240px');
workspace.setCoordSize('200', '240');
@ -16,7 +16,7 @@ function multiline(text, family, elemId) {
workspace.append(wText);
wText.setText(text);
wText.setFont(family, size, 'bold');
wText.setFont(fontName, size, 'bold');
wText.setPosition(30, 50 * i);
wText.setColor('blue');
});
@ -45,11 +45,11 @@ function alignments(text, family, elemId) {
}
// Multine tests ...
['Arial', 'Tahoma', 'Verdana', 'Times'].forEach((family, i) => {
multiline('This multine text.\nLine 1 :)\nLine2', family, `multi${i}`);
['Arial', 'Tahoma', 'Verdana', 'Times', 'Brush Script MT'].forEach((fontName, i) => {
multiline('This multine text.\nLine 1 :)\nLine2', fontName, `multi${i}`);
});
// Multine tests and alingments .. ...
['Arial', 'Tahoma', 'Verdana', 'Times'].forEach((family, i) => {
alignments('This multine text.\nThis is the long line just because :)\nShort line', family, `amulti${i}`);
['Arial', 'Tahoma', 'Verdana', 'Times', 'Brush Script MT'].forEach((fontName, i) => {
alignments('This multine text.\nThis is the long line just because :)\nShort line', fontName, `amulti${i}`);
});

View File

@ -18,7 +18,7 @@ const textTestHelper = function textTestHelper(coordSize, textval, font, fontSiz
const workspace = new Workspace();
workspace.setSize('300px', '100px');
workspace.setCoordSize('coordSize', coordSize);
workspace.setCoordSize(coordSize, coordSize);
workspace.setCoordOrigin(0, 0);
workspace.addItAsChildTo($(`#${htmlElemId}`));
@ -36,7 +36,7 @@ const textTestHelper = function textTestHelper(coordSize, textval, font, fontSiz
span.setAttribute('id', `textoHTML${iesimo}`);
const textsize = `${textval} - Scale: ${scale.height}`;
const textHtml = document.createTextNode(textsize);
const fontSize = text.getHtmlFontSize();
const fontSize = text.getHtmlFontSize(textsize);
span.append(textHtml);
span.setAttribute('style', `font-weight:${modifier};font-style: ${style}; font-size:${fontSize}pt; font-family: ${font};width:30;height:30;`);