Ticket #11935: code2

File code2, 6.0 KB (added by gk, 6 years ago)

Added the three global variables to the code snippet

Line 
1var cfniw=0;
2var cftb=null;
3var cfid=0
4var jflist =
5  new Array("Adobe Caslon Pro","Adobe Garamond","Adobe Garamond Pro",
6            "Agency FB","Aharoni","Algerian","American Typewriter",
7            "Andale Mono","Andalus","Angsana New","AngsanaUPC","Apple Chancery",
8            "Arabic Transparent","Arabic Typesetting","Archer","Arial",
9            "Arial Baltic","Arial Black","Arial CE","Arial CYR","Arial Greek",
10            "Arial Narrow","Arial Rounded MT Bold","Arial TUR",
11            "Arial Unicode MS","Arno Pro","Avenir","Ayuthaya","Bandy",
12            "Bank Gothic","Baskerville Old Face","Batang","BatangChe",
13            "Bauer Bodoni","Bauhaus 93","Bell Mt","Bell MT","Bembo",
14            "Berlin Sans FB","Bernard MT Condensed","Big Caslon",
15            "Blackadder ITC","Blairmditc Tt","Bodoni MT","Book Antiqua",
16            "Bookman Old Style","Bookshelf Symbol 7","Bradley Hand ITC",
17            "Britannic Bold","Broadway","Browallia New","BrowalliaUPC",
18            "Brush Script MT","Calibri","Californian FB","Calisto MT",
19            "Cambria","Candara","Castellar","Centaur","Century",
20            "Century Gothic","Century Schoolbook","Chalkboard","Chiller",
21            "Clarendon","Cochin","Colonna MT","Comic Sans","Comic Sans MS",
22            "Consolas","Constantia","Cooper Black","Copperplate Gothic",
23            "Corbel","Cordia New","CordiaUPC","Courier","Courier New",
24            "Courier New Baltic","Courier New CE","Courier New CYR",
25            "Courier New Greek","Courier New TUR","Curlz MT","DaunPenh","David",
26            "Delicious","DFKai-SB","Didot","DilleniaUPC","Din","DokChampa",
27            "Dotum","DotumChe","Edwardian Script ITC","Elephant","Engravers MT",
28            "Eras Bold ITC","Estrangelo Edessa","EucrosiaUPC","Euphemia",
29            "Eurostile","FangSong","Felix Titling","Fontin",
30            "Footlight MT Light","Forte","Franklin Gothic","FrankRuehl",
31            "FreesiaUPC","Freestyle Script","French Script MT","Fruitger",
32            "Futura","Gabriola","Garamond","Gautami","Geneva","Georgia","Gigi",
33            "Gill Sans","Gisha","Gotham","Goudy Old Style","Goudy Stout",
34            "Gulim","GulimChe","Gungsuh","GungsuhChe","Haettenschweiler",
35            "Harlow Solid Italic","Harrington","Helv","Helvetica",
36            "Helvetica Neue","High Tower Text","Hoefler Text","Impact",
37            "Imprint MT Shadow","Inconsolata","Informal Roman","Interstate",
38            "IrisUPC","Iskoola Pota","JasmineUPC","Jazz Let","Jenson",
39            "Jokerman","Juice ITC","KaiTi","Kalinga","Kartika","KodchiangUPC",
40            "Kristen ITC","Krungthep","Kunstler Script","Latha","Leelawadee",
41            "Levenim MT","Liberation Mono","Liberation Sans",
42            "Liberation Sans Narrow","Liberation Serif","LilyUPC",
43            "Lucida Bright","Lucida Calligraphy","Lucida Console","Lucida Fax",
44            "Lucida Grande","Lucida Handwriting","Lucida Sans",
45            "Lucida Sans Typewriter","Lucida Sans Unicode","Magneto",
46            "Maiandra GD","Malgun Gothic","Mangal","Marker Felt","Marlett",
47            "Matura MT Script Capitals","Meiryo","Meiryo UI",
48            "Microsoft Himalaya","Microsoft JhengHei","Microsoft Sans Serif",
49            "Microsoft Uighur","Microsoft YaHei","Microsoft Yi Baiti","MingLiU",
50            "MingLiU_HKSCS","Minion","Minion Pro","Miriam","Mistral",
51            "Modern No. 20","Monaco","Mongolian Baiti","Mono","Monospace",
52            "Monotype Corsiva","MoolBoran","Mrs Eaves","MS Gothic","MS Mincho",
53            "MS Outlook","MS PGothic","MS PMincho","MS Reference Sans Serif",
54            "MS Reference Specialty","MS UI Gothic","MT Extra","Museo",
55            "MV Boli","Myriad","Myriad Pro","Nadeem","Narkisim","Nevis",
56            "News Gothic","Niagara Engraved","Niagara Solid","NSimSun","Nyala",
57            "OCR A Extended","Old English Text MT","Onyx","Optima","Osaka",
58            "Palace Script MT","Palatino","Palatino Linotype","Papyrus",
59            "Parchment","Perpetua","Perpetua Titling MT","Petitabold",
60            "Plantagenet Cherokee","Playbill","PMingLiU","Poor Richard",
61            "Princetown Let","Pristina","Raavi","Rage Italic","Ravie",
62            "Rockwell","Rod","Santa Fe Let","Savoye Let","Script","Scriptina",
63            "Script MT Bold","Segoe Print","Segoe Script","Segoe UI",
64            "Showcard Gothic","Shruti","Silkscreen","SimHei",
65            "Simplified Arabic","SimSun","Sketch Rockwell","Skia","Snap ITC",
66            "Snell Roundhand","Stencil","Styllo","Sylfaen","Symbol",
67            "Synchro Let","System","Tahoma","Tempus Sans ITC","Times",
68            "Times New Roman","Times New Roman Baltic","Times New Roman CE",
69            "Times New Roman CYR","Times New Roman Greek","Times New Roman TUR",
70            "Traditional Arabic","Trajan","Trajan Pro","Trebuchet MS","Tunga",
71            "Tw Cen MT","Univers","Verdana","Viner Hand ITC","Vivaldi",
72            "Vladimir Script","Vrinda","Webdings","Whitney","Wide Latin",
73            "Wingdings","Wingdings 2","Wingdings 3","Zapfino");
74
75function checkFont(b){
76  var d="qwertyuiopasdfghjklzxcvbnm1234567890";
77  var e="Arial Black";
78  if(!$("#fontInstalledTest").length){
79    $("head").append('<style> #fontInstalledTest, #fontTestBed { position: absolute; left: -9999px; top: 0; visibility: hidden; } #fontInstalledTest { font-size: 25px!important; font-family: "'+e+'";} </style>');
80    $("body").append('<div id="fontTestBed"></div>').
81              append('<span id="fontInstalledTest" class="fonttest">'+d+"</span>");
82    cftb=$("#fontTestBed");
83    cfniw=$("#fontInstalledTest").width()
84  }
85  cfid++;
86  var c='<style id="fonttestStyle"> #fonttest' + cfid +
87    ' { font-size: 25px!important; font-family: "'+b+'", "'+e+'"; } </style>';
88  $("head").find("#fonttestStyle").remove().end().append(c);
89  cftb.empty().append('<span id="fonttest'+cfid+'" class="fonttest">' + d +
90    "</span>");
91  var a=cftb.find("span").width();
92  return(a!=cfniw)
93}
94
95function getFonts(){
96  var b=new Array();
97  for(var a=0;a<jflist.length;a++){
98    if(checkFont(jflist[a])){
99      b.push(jflist[a])
100    }
101  }
102  return b
103}