haikuwebkit/LayoutTests/svg/custom/js-font-test.svg

129 lines
5.0 KiB
XML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8"?>
<svg width="800" height="1000" xmlns="http://www.w3.org/2000/svg" onload="init()">
<script language="JavaScript">
var fontFamily1 = "Arial";
var fontFamily2 = "LucidaSansUnicode";
var fontFamily3 = "MS-Gothic";
var entryYOffset = 10;
var entryYDelta = 16;
var entryX = new Array();
entryX[0] = 10;
entryX[1] = 100;
entryX[2] = 190;
var entryXEnd = entryX[0] + entryX[1] + entryX[2];
var entryY = new Array();
entryY[0] = entryYOffset;
entryY[1] = entryYOffset;
entryY[2] = entryYOffset;
var insert;
function drawGrid(xValue, yValue)
{
var line = document.createElement("line");
line.x1.baseVal.value = Math.floor(xValue);
line.y1.baseVal.value = Math.floor(yValue) + (entryYDelta / 2) - 4;
line.x2.baseVal.value = Math.floor(xValue) + entryXEnd;
line.y2.baseVal.value = Math.floor(yValue) + (entryYDelta / 2) - 4;
line.setAttribute("style", "stroke-width:1px; stroke:black; opacity:0.5");
insert.appendChild(line);
}
function entry(message, xValue, yValue, family)
{
var text = document.createElement("text");
// Set X/Y properties using SVG DOM
var xLength = document.rootElement.createSVGLength();
xLength.value = xValue;
var yLength = document.rootElement.createSVGLength();
yLength.value = yValue;
text.x.baseVal.appendItem(xLength);
text.y.baseVal.appendItem(yLength);
// Append "Text" child node
text.appendChild(document.createTextNode(message));
// Choose font-size/font-family
switch (family) {
case 0:
text.setAttribute("font-family", fontFamily1);
break;
case 1:
text.setAttribute("font-family", fontFamily2);
break;
case 2:
text.setAttribute("font-family", fontFamily3);
break;
}
text.setAttribute("font-size", "12");
// Add to tree
insert.appendChild(text);
return entryYDelta;
}
function newEntry(col1, col2, col3, family)
{
drawGrid(entryX[0], entryY[0]);
entryY[0] += entry(col1, entryX[0], entryY[0], family);
entryY[1] += entry(col2, entryX[1], entryY[1], family);
entryY[2] += entry(col3, entryX[2], entryY[2], family);
}
function init()
{
insert = document.getElementById("insert");
newEntry("Arabic", "", "السلام عليكم ", 0);
newEntry("Bengali", "বাঙ্লা", "ষাগতোম", 0); // Which lang?
newEntry("Burmese", "", "မ္ရန္မာ", 0); // Which lang?
newEntry("Cherokee", "ᏣᎳᎩ", "ᎣᏏᏲ", 0); // Which lang?
newEntry("Czech", "česky", "Dobrý den", 0);
newEntry("Danish", "Dansk", "Hej, Goddag", 0);
newEntry("English", "", "Hello", 0);
newEntry("Esperanto", "", "Saluton", 0);
newEntry("Estonian", "", "Tere, Tervist", 0);
newEntry("Finnish", "Suomi", "Hei", 0);
newEntry("French", "Français", "Bonjour, Salut", 0);
newEntry("German", "Deutsch Nord", "Guten Tag", 0);
newEntry("German", "Deutsch Süd", "Grüß Gott", 0);
newEntry("Georgian", "ქართველი", "გამარჯობა", 0); // Which lang?
newEntry("Gujarati", "", "ગુજરાતિ", 0); // Which lang?
newEntry("Greek", "Ελληνικά", "Γειά σας", 0);
newEntry("Hebrew", "", "שלום", 1);
newEntry("Hindi", "", "नमस्ते, नमस्कार।", 0); // Which lang?
newEntry("Italiano", "", "Ciao, Buon giorno", 0);
newEntry("ɪŋglɪʃ", "", "hɛləʊ", 1); // Which lang here?
newEntry("Maltese", "", "Ċaw, Saħħa", 1);
newEntry("Nederlands", "", "Hallo, Dag", 0);
newEntry("Norwegian", "Norsk", "Hei, God dag", 0);
newEntry("Punjabi", "", "ੁਪੁਂਜਾਬਿ", 0); // Which lang?
newEntry("Polish", "", "Dzień dobry, Hej", 0);
newEntry("Russian", "Русский", "Здравствуйте!", 0);
newEntry("Slovak", "", "Dobrý deň", 0);
newEntry("Spanish", "Español", "¡Hola!", 1);
newEntry("Swedish", "Svenska", "Hej, Goddag", 0);
newEntry("Thai", "ภาษาไทย", "สวัสดีครับ, สวัสดีค่ะ", 0); // Which lang?
newEntry("Turkish", "Türkçe", "Merhaba", 0);
newEntry("Vietnamese", "Tiếng Việt", "Xin Chào", 0);
newEntry("Yiddish", "ײַדישע", "דאָס הײַזעלע ", 1);
newEntry("Japanese", "日本語", "こんにちは, コンニチハ", 2);
newEntry("Chinese", "中文,普通话,汉语<E6B189>", "你好", 2);
newEntry("Cantonese", "粵語,廣東話", "早晨, 你好", 2);
newEntry("Korean", "한글", "안녕하세요, 안녕하십니까", 0); // Which lang?
}
</script>
<g id="insert"/>
</svg>