fontdata-1.0.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
  2. /* vim: set ts=2 et sw=2 tw=80: */
  3. /*************************************************************
  4. *
  5. * MathJax/jax/output/HTML-CSS/font/STIX/fontdata-1.0.js
  6. *
  7. * Patches the STIX font data to work with version 1.0 of
  8. * the STIX fonts (this is a delta from the v1.1 fonts).
  9. *
  10. * ---------------------------------------------------------------------
  11. *
  12. * Copyright (c) 2012-2013 The MathJax Consortium
  13. *
  14. * Licensed under the Apache License, Version 2.0 (the "License");
  15. * you may not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at
  17. *
  18. * http://www.apache.org/licenses/LICENSE-2.0
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an "AS IS" BASIS,
  22. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. */
  26. (function (HTMLCSS,HUB) {
  27. var UPDATE = function (file,add,remove) {
  28. var name = "STIX"+file.replace(/\/[^\/]*$/,'').replace(/\//,'-').replace(/-Regular/,'');
  29. name = name.replace(/-B/,'-b').replace(/-I/,'-i').replace(/-boldItalic/,'-bold-italic');
  30. HUB.Register.LoadHook(HTMLCSS.fontDir+"/"+file+".js",function () {
  31. var FONT = HTMLCSS.FONTDATA.FONTS[name];
  32. for (var id in add) {if (add.hasOwnProperty(id)) {FONT[id] = add[id]}}
  33. if (remove) {for (var i = 0, m = remove.length; i < m; i++) {delete FONT[remove[i]]}}
  34. });
  35. };
  36. HTMLCSS.FONTDATA.STIXversion = "1.0";
  37. delete HTMLCSS.FONTDATA.FONTS["STIXGeneral-bold"].Ranges["LatinExtendedD"];
  38. delete HTMLCSS.FONTDATA.FONTS["STIXGeneral-bold"].Ranges["BBBold"];
  39. HTMLCSS.FONTDATA.DELIMITERS[0x23DE].HW[0] = [.556,"STIXGeneral"];
  40. HTMLCSS.FONTDATA.DELIMITERS[0x23DE].HW[1] = [.926,"STIXSizeOneSym"];
  41. HTMLCSS.FONTDATA.DELIMITERS[0x23DF].HW[0] = [.556,"STIXGeneral"];
  42. HTMLCSS.FONTDATA.DELIMITERS[0x23DF].HW[1] = [.926,"STIXSizeOneSym"];
  43. HUB.Register.LoadHook(HTMLCSS.fontDir+"/fontdata-extra.js",function () {
  44. HTMLCSS.FONTDATA.DELIMITERS[0x23DC].HW[0] = [.556,"STIXGeneral"];
  45. HTMLCSS.FONTDATA.DELIMITERS[0x23DC].HW[1] = [.926,"STIXSizeOneSym"];
  46. HTMLCSS.FONTDATA.DELIMITERS[0x23DD].HW[0] = [.556,"STIXGeneral"];
  47. HTMLCSS.FONTDATA.DELIMITERS[0x23DD].HW[1] = [.926,"STIXSizeOneSym"];
  48. HTMLCSS.FONTDATA.DELIMITERS[0x23E0].HW[0][0] = .926;
  49. HTMLCSS.FONTDATA.DELIMITERS[0x23E1].HW[0][0] = .926;
  50. });
  51. UPDATE("General/Bold/CombDiacritMarks",{},[0x347]);
  52. UPDATE("General/Bold/LetterlikeSymbols",{
  53. 0x2145: [676,0,748,75,703], // stix-mathematical bold double-struck capital D
  54. 0x2146: [676,14,643,50,583], // stix-mathematical bold double-struck small letter d
  55. 0x2147: [473,14,573,50,523], // stix-mathematical bold double-struck small letter e
  56. 0x2148: [691,0,330,65,265], // stix-mathematical bold double-struck small letter i
  57. 0x2149: [691,205,371,-20,311] // stix-mathematical bold double-struck small letter j
  58. });
  59. UPDATE("General/Bold/MathOperators",{
  60. 0x2219: [473,-59,584,85,499] // BULLET OPERATOR
  61. },[0x22C0,0x22C1,0x22C2,0x22C3]);
  62. UPDATE("General/Bold/SpacingModLetters",{},[0x2F7]);
  63. UPDATE("General/BoldItalic/GeneralPunctuation",{
  64. 0x203E: [637,-565,500,0,500] // OVERLINE
  65. });
  66. UPDATE("General/BoldItalic/GreekBoldItalic",{
  67. 0x1D730: [685,0,589,31,721] // MATHEMATICAL BOLD ITALIC CAPITAL UPSILON
  68. });
  69. UPDATE("General/BoldItalic/SpacingModLetters",{
  70. 0x2B2: [1017,-331,350,24,384] // MODIFIER LETTER SMALL J
  71. },[0x2F7]);
  72. UPDATE("General/Italic/CombDiactForSymbols",{
  73. 0x20EC: [681,-548,0,-453,-17], // COMBINING RIGHTWARDS HARPOON WITH BARB DOWNWARDS
  74. 0x20ED: [681,-548,0,-453,-17] // COMBINING LEFTWARDS HARPOON WITH BARB DOWNWARDS
  75. });
  76. UPDATE("General/Italic/GeneralPunctuation",{
  77. 0x203E: [582,-532,500,0,500] // OVERLINE
  78. });
  79. UPDATE("General/Italic/GreekItalic",{
  80. 0x1D6F6: [668,0,567,28,687] // MATHEMATICAL ITALIC CAPITAL UPSILON
  81. });
  82. UPDATE("General/Italic/SpacingModLetters",{},[0x2F7]);
  83. UPDATE("General/Regular/CombDiacritMarks",{},[0x347]);
  84. UPDATE("General/Regular/GreekBoldItalic",{
  85. 0x1D730: [685,0,589,31,721] // MATHEMATICAL BOLD ITALIC CAPITAL UPSILON
  86. });
  87. UPDATE("General/Regular/GreekItalic",{
  88. 0x1D6F6: [668,0,567,28,687] // MATHEMATICAL ITALIC CAPITAL UPSILON
  89. });
  90. UPDATE("General/Regular/LatinExtendedD",{},[0xA792]);
  91. UPDATE("General/Regular/LetterlikeSymbols",{
  92. 0x2145: [662,0,722,70,677], // stix-mathematical bold double-struck capital D
  93. 0x2146: [683,10,574,45,519], // stix-mathematical bold double-struck small letter d
  94. 0x2147: [460,10,523,45,478], // stix-mathematical bold double-struck small letter e
  95. 0x2148: [683,0,258,55,203], // stix-mathematical bold double-struck small letter i
  96. 0x2149: [683,217,305,-15,250] // stix-mathematical bold double-struck small letter j
  97. });
  98. UPDATE("General/Regular/MathOperators",{
  99. 0x22FF: [662,0,560,73,487] // Z NOTATION BAG MEMBERSHIP
  100. });
  101. UPDATE("General/Regular/MiscMathSymbolsA",{},[0x27CB,0x27CD]);
  102. UPDATE("General/Regular/MiscSymbols",{},[0x26E2]);
  103. UPDATE("General/Regular/MiscTechnical",{
  104. 0x23DC: [55,152,556,-10,566], // TOP PARENTHESIS (mathematical use)
  105. 0x23DD: [771,-564,556,-10,566], // BOTTOM PARENTHESIS (mathematical use)
  106. 0x23DE: [117,88,556,-10,566], // TOP CURLY BRACKET (mathematical use)
  107. 0x23DF: [769,-564,556,-10,566], // BOTTOM CURLY BRACKET (mathematical use)
  108. 0x23E0: [66,212,926,-3,929], // TOP TORTOISE SHELL BRACKET (mathematical use)
  109. 0x23E1: [842,-564,926,-3,929] // BOTTOM TORTOISE SHELL BRACKET (mathematical use)
  110. });
  111. UPDATE("General/Regular/PhoneticExtensions",{},[0x1D98,0x1DA3]);
  112. UPDATE("General/Regular/SpacingModLetters",{},[0x2F7]);
  113. UPDATE("General/Regular/SuppMathOperators",{},[0x2AFC,0x2AFF]);
  114. UPDATE("NonUnicode/Bold/PrivateUse",{
  115. 0xE060: [-137,322,0,0,330], // stix-double underbar
  116. 0xE0A1: [691,19,769,27,734], // stix-capital C with stroke
  117. 0xE38A: [676,0,787,50,737], // stix-mathematical bold double-struck capital A
  118. 0xE38B: [676,0,729,75,669], // stix-mathematical bold double-struck capital B
  119. 0xE38D: [676,0,650,75,595], // stix-mathematical bold double-struck capital E
  120. 0xE38E: [676,0,474,75,595], // stix-mathematical bold double-struck capital F
  121. 0xE38F: [691,19,751,45,686], // stix-mathematical bold double-struck capital G
  122. 0xE390: [676,0,380,80,300], // stix-mathematical bold double-struck capital I
  123. 0xE391: [676,19,618,50,548], // stix-mathematical bold double-struck capital J
  124. 0xE392: [676,0,792,75,767], // stix-mathematical bold double-struck capital K
  125. 0xE393: [676,0,662,70,607], // stix-mathematical bold double-struck capital L
  126. 0xE394: [676,0,914,75,839], // stix-mathematical bold double-struck capital M
  127. 0xE395: [691,19,787,45,742], // stix-mathematical bold double-struck capital O
  128. 0xE396: [692,19,702,45,657], // stix-mathematical bold double-struck capital S
  129. 0xE397: [676,0,556,25,645], // stix-mathematical bold double-struck capital T
  130. 0xE398: [676,19,738,70,668], // stix-mathematical bold double-struck capital U
  131. 0xE399: [676,0,627,17,704], // stix-mathematical bold double-struck capital V
  132. 0xE39A: [676,0,996,17,1015], // stix-mathematical bold double-struck capital W
  133. 0xE39B: [676,0,794,20,769], // stix-mathematical bold double-struck capital X
  134. 0xE39C: [676,0,652,23,739], // stix-mathematical bold double-struck capital Y
  135. 0xE39D: [473,14,623,50,563], // stix-mathematical bold double-struck small letter a
  136. 0xE39E: [676,14,643,60,593], // stix-mathematical bold double-struck small letter b
  137. 0xE39F: [473,14,574,50,524], // stix-mathematical bold double-struck small letter c
  138. 0xE3A2: [676,0,474,25,536], // stix-mathematical bold double-struck small letter f
  139. 0xE3A3: [473,205,643,50,583], // stix-mathematical bold double-struck small letter g
  140. 0xE3A4: [676,0,624,60,564], // stix-mathematical bold double-struck small letter h
  141. 0xE3A7: [676,0,646,60,621], // stix-mathematical bold double-struck small letter k
  142. 0xE3A8: [676,0,325,60,265], // stix-mathematical bold double-struck small letter l
  143. 0xE3A9: [473,0,908,60,848], // stix-mathematical bold double-struck small letter m
  144. 0xE3AA: [473,0,624,60,564], // stix-mathematical bold double-struck small letter n
  145. 0xE3AB: [473,14,598,45,553], // stix-mathematical bold double-struck small letter o
  146. 0xE3AC: [473,205,643,60,593], // stix-mathematical bold double-struck small letter p
  147. 0xE3AD: [473,205,643,50,583], // stix-mathematical bold double-struck small letter q
  148. 0xE3AE: [473,0,339,60,445], // stix-mathematical bold double-struck small letter r
  149. 0xE3AF: [473,14,549,52,497], // stix-mathematical bold double-struck small letter s
  150. 0xE3B0: [676,14,446,25,411], // stix-mathematical bold double-struck small letter t
  151. 0xE3B1: [461,16,619,55,559], // stix-mathematical bold double-struck small letter u
  152. 0xE3B2: [461,0,494,6,544], // stix-mathematical bold double-struck small letter v
  153. 0xE3B3: [461,0,786,22,789], // stix-mathematical bold double-struck small letter w
  154. 0xE3B4: [461,0,660,25,635], // stix-mathematical bold double-struck small letter x
  155. 0xE3B5: [461,205,471,-9,537], // stix-mathematical bold double-struck small letter y
  156. 0xE3B6: [461,0,513,40,473] // stix-mathematical bold double-struck small letter z
  157. });
  158. UPDATE("NonUnicode/BoldItalic/PrivateUse",{
  159. 0xE388: [707,14,598,18,563] // stix-small Greek lambda with straight bar through it
  160. });
  161. UPDATE("NonUnicode/Italic/PrivateUse",{
  162. 0xE387: [683,10,557,52,526] // stix-small Greek lambda with straight bar through it
  163. });
  164. UPDATE("NonUnicode/Regular/PrivateUse",{
  165. 0xE041: [911,-433,480,64,398], // stix-modifier letter small h turned, superscript
  166. 0xE042: [755,-425,441,57,387], // stix-modifier letter small a (one-story) turned, superscript
  167. 0xE060: [-140,292,1,11,323], // stix-double underbar
  168. 0xE09F: [662,156,902,0,863], // stix-rising diagonal
  169. 0xE0A0: [662,156,902,0,863], // stix-falling diagonal
  170. 0xE0A1: [676,14,734,18,700], // stix-capital C with stroke
  171. 0xE0E4: [773,80,700,94,606] // stix-Uranus
  172. });
  173. UPDATE("SizeTwoSym/Regular/All",{},[0x2AFF]);
  174. MathJax.Ajax.loadComplete(HTMLCSS.fontDir+"/fontdata-1.0.js");
  175. })(MathJax.OutputJax["HTML-CSS"],MathJax.Hub);