1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/mathml/MathJaxFonts.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,178 @@ 1.4 +<!-- -*- mode: HTML; tab-width: 2; indent-tabs-mode: nil; -*- --> 1.5 +<!-- vim: set tabstop=2 expandtab shiftwidth=2 textwidth=80: --> 1.6 +<!-- This Source Code Form is subject to the terms of the Mozilla Public 1.7 + - License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> 1.9 +<!DOCTYPE html> 1.10 +<html> 1.11 + <head> 1.12 + <title>MathJax fonts</title> 1.13 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 1.14 + <script type="text/x-mathjax-config"> 1.15 + MathJax.Hub.Config({ 1.16 + jax: ["output/HTML-CSS"], 1.17 + "HTML-CSS": { availableFonts: ["TeX"] } 1.18 + }); 1.19 + </script> 1.20 + <script type="text/javascript" 1.21 + src="http://cdn.mathjax.org/mathjax/latest/unpacked/MathJax.js"> 1.22 + </script> 1.23 + <script type="text/javascript"> 1.24 + var fontList = [ 1.25 + "MathJax_Main", 1.26 + "MathJax_Size1", 1.27 + "MathJax_Size2", 1.28 + "MathJax_Size3", 1.29 + "MathJax_Size4", 1.30 + "MathJax_AMS", 1.31 + "MathJax_Main-bold" 1.32 + ]; 1.33 + 1.34 + var noChar = codePoint(); 1.35 + 1.36 + function codePoint(aValue, aFont) 1.37 + { 1.38 + var v = 0xFFFD; 1.39 + if (aValue) { 1.40 + v = aValue; 1.41 + } 1.42 + var f = ""; 1.43 + if (aFont) { 1.44 + var i = fontList.indexOf(aFont); 1.45 + if (i > 0) { 1.46 + f = "@" + i; 1.47 + } 1.48 + } 1.49 + var hexacode = Number(v).toString(16).toUpperCase(); 1.50 + while (hexacode.length < 4) { 1.51 + hexacode = "0" + hexacode; 1.52 + } 1.53 + return "\\u" + hexacode + f; 1.54 + } 1.55 + 1.56 + function codePoint2(aList) 1.57 + { 1.58 + if (aList) { 1.59 + return codePoint(aList[0], aList[1]); 1.60 + } else { 1.61 + return noChar; 1.62 + } 1.63 + } 1.64 + 1.65 + function isSupported(aStretch) 1.66 + { 1.67 + for (var x in aStretch) { 1.68 + var part = aStretch[x]; 1.69 + if (part[0] instanceof Array) { 1.70 + // Composite char 1.71 + return false; 1.72 + } else if (part.length > 2) { 1.73 + // Part has scale factor 1.74 + return false; 1.75 + } 1.76 + } 1.77 + return true; 1.78 + } 1.79 + 1.80 + MathJax.Hub.Queue( 1.81 + ["Require", MathJax.Ajax, "[MathJax]/jax/element/mml/jax.js"], 1.82 + ["Require", MathJax.Ajax, "[MathJax]/jax/output/HTML-CSS/jax.js"], 1.83 + ["Require", MathJax.Ajax, "[MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata-extra.js"], 1.84 + function () { 1.85 + 1.86 + var t = document.getElementById("output"); 1.87 + t.value = ""; 1.88 + 1.89 + var fontData = MathJax.OutputJax["HTML-CSS"].FONTDATA; 1.90 + 1.91 + t.value += "# Content below is generated from MathJaxFonts.html. Do not edit.\n"; 1.92 + t.value += "\n"; 1.93 + 1.94 + // Generate the list of external fonts 1.95 + for (var i = 1; i < fontList.length; i++) { 1.96 + t.value += "external." + i + " = " + fontList[i] + "\n"; 1.97 + } 1.98 + t.value += "\n"; 1.99 + 1.100 + // Generate stretchy table for delimiters 1.101 + var delimiters = fontData.DELIMITERS; 1.102 + for (var u in delimiters) { 1.103 + 1.104 + var v = delimiters[u]; 1.105 + 1.106 + if (v.load) { 1.107 + // These characters are already handled when we load fontdata-extra.js 1.108 + continue; 1.109 + } 1.110 + 1.111 + if (v.alias) { 1.112 + if (delimiters.hasOwnProperty(v.alias)) { 1.113 + // use data from the char pointed by this alias 1.114 + v = delimiters[v.alias]; 1.115 + } else { 1.116 + // It is an alias to a non-stretchy char. Ignore it. 1.117 + continue; 1.118 + } 1.119 + } 1.120 + 1.121 + if (v.stretch && !isSupported(v.stretch)) { 1.122 + // This construction is not supported. 1.123 + t.value += "# " + codePoint(u) + " = [not supported]\n"; 1.124 + continue; 1.125 + } 1.126 + 1.127 + t.value += codePoint(u); 1.128 + t.value += " = "; 1.129 + if (v.stretch) { 1.130 + if (v.dir == "V") { 1.131 + t.value += codePoint2(v.stretch.top); 1.132 + t.value += codePoint2(v.stretch.mid); 1.133 + t.value += codePoint2(v.stretch.bot); 1.134 + t.value += codePoint2(v.stretch.ext); 1.135 + } else { 1.136 + t.value += codePoint2(v.stretch.left); 1.137 + t.value += codePoint2(v.stretch.mid); 1.138 + t.value += codePoint2(v.stretch.right); 1.139 + t.value += codePoint2(v.stretch.rep); 1.140 + } 1.141 + } else { 1.142 + t.value += noChar + noChar + noChar + noChar; 1.143 + } 1.144 + 1.145 + for (var i in v.HW) { 1.146 + t.value += codePoint(u, v.HW[i][1]); 1.147 + } 1.148 + 1.149 + t.value += "\n"; 1.150 + } 1.151 + 1.152 + // Generate table for large operators 1.153 + var fonts1 = fontData.FONTS[fontList[1]]; 1.154 + var fonts2 = fontData.FONTS[fontList[2]]; 1.155 + for (var u in fonts1) { 1.156 + if (delimiters.hasOwnProperty(u) || // already listed above 1.157 + u == "version" || u == "available" || 1.158 + u == "directory" || u == "family" || u == "testString") { 1.159 + // Ignore these properties 1.160 + continue; 1.161 + } 1.162 + t.value += codePoint(u); 1.163 + t.value += " = "; 1.164 + t.value += noChar + noChar + noChar + noChar; 1.165 + t.value += codePoint(u, fontList[1]); 1.166 + if (fonts2.hasOwnProperty(u)) { 1.167 + t.value += codePoint(u, fontList[2]); 1.168 + } 1.169 + t.value += "\n"; 1.170 + } 1.171 + 1.172 + }); 1.173 + </script> 1.174 + </head> 1.175 + 1.176 + <body> 1.177 + 1.178 + <textarea id="output" cols="80" rows="20"></textarea> 1.179 + 1.180 + </body> 1.181 +</html>