MCPcopy Create free account
hub / github.com/corbanbrook/dsp.js / loadXML

Function loadXML

examples/js/processing.js:10543–10572  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10541
10542 // Load and parse Batik SVG font as XML into a Processing Glyph object
10543 var loadXML = function loadXML() {
10544 var xmlDoc;
10545
10546 try {
10547 xmlDoc = document.implementation.createDocument("", "", null);
10548 }
10549 catch(e_fx_op) {
10550 Processing.debug(e_fx_op.message);
10551 return;
10552 }
10553
10554 try {
10555 xmlDoc.async = false;
10556 xmlDoc.load(url);
10557 parseSVGFont(xmlDoc.getElementsByTagName("svg")[0]);
10558 }
10559 catch(e_sf_ch) {
10560 // Google Chrome, Safari etc.
10561 Processing.debug(e_sf_ch);
10562 try {
10563 var xmlhttp = new window.XMLHttpRequest();
10564 xmlhttp.open("GET", url, false);
10565 xmlhttp.send(null);
10566 parseSVGFont(xmlhttp.responseXML.documentElement);
10567 }
10568 catch(e) {
10569 Processing.debug(e_sf_ch);
10570 }
10571 }
10572 };
10573
10574 // Create a new object in glyphTable to store this font
10575 p.glyphTable[url] = {};

Callers 1

processing.jsFile · 0.85

Calls 1

parseSVGFontFunction · 0.85

Tested by

no test coverage detected