{"id":0,"registry":{"0":{"submorphs":[],"scripts":[],"id":"007B1FF3-9D5A-4BA5-A688-7223FC90380B","shape":{"__isSmartRef__":true,"id":1},"__layered_droppingEnabled__":true,"halosEnabled":true,"registeredForMouseEvents":true,"__serializedExpressions__":["_Position"],"showsHalos":false,"name":"FontList","partsBinMetaInfo":{"__isSmartRef__":true,"id":2},"_ClipMode":"scroll","isCopyMorphRef":true,"morphRefId":3,"selectedFont":null,"selection":null,"eventHandler":{"__isSmartRef__":true,"id":4},"derivationIds":[8045],"_Rotation":0,"_Scale":1,"__serializedLivelyClosures__":{"__isSmartRef__":true,"id":5},"__LivelyClassName__":"lively.morphic.Box","__SourceModuleName__":"Global.lively.morphic.Core","_Position":"lively.pt(0.0,0.0)"},"1":{"__serializedExpressions__":["position","_Extent","_BorderColor","_Fill","_Padding"],"_BorderWidth":1,"__LivelyClassName__":"lively.morphic.Shapes.Rectangle","__SourceModuleName__":"Global.lively.morphic.Shapes","position":"lively.pt(0.0,0.0)","_Extent":"lively.pt(183.8,221.0)","_BorderColor":"Color.rgb(255,255,255)","_Fill":"Color.rgb(255,255,255)","_Padding":"lively.rect(0,0,0,0)"},"2":{"partsSpaceName":"PartsBin/Text/","migrationLevel":8,"comment":"Finds out what fonts are supported in your browser and let's you choose one.","partName":"FontList","changes":[{"__isSmartRef__":true,"id":3}],"__LivelyClassName__":"lively.PartsBin.PartsBinMetaInfo","__SourceModuleName__":"Global.lively.PartsBin"},"3":{"__serializedExpressions__":["date"],"author":"robertkrahn","message":"onLoad lists fonts","id":"19DEADDF-766D-4A2B-AE9C-4E1996BEB0DA","date":"new Date(\"Mon Apr 28 2014 03:14:37 GMT-0700 (PDT)\")"},"4":{"morph":{"__isSmartRef__":true,"id":0},"__LivelyClassName__":"lively.morphic.EventHandler","__SourceModuleName__":"Global.lively.morphic.Events"},"5":{"onMouseDown":{"__isSmartRef__":true,"id":6},"reset":{"__isSmartRef__":true,"id":13},"availableFonts":{"__isSmartRef__":true,"id":16},"getKnownFonts":{"__isSmartRef__":true,"id":19},"listAvailableFonts":{"__isSmartRef__":true,"id":22},"selectFont":{"__isSmartRef__":true,"id":25},"setupConnections":{"__isSmartRef__":true,"id":28},"onLoad":{"__isSmartRef__":true,"id":31}},"6":{"varMapping":{"__isSmartRef__":true,"id":7},"source":"function onMouseDown(evt) {\n\tif (evt.isCommandKey() || !evt.isLeftMouseButtonDown()) return $super(evt);\n\tvar scroll = this.getScroll();\n\tthis.selectFont(this.localize(evt.getPosition()).addXY(scroll[0], scroll[1]));\n}","funcProperties":{"__isSmartRef__":true,"id":12},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"7":{"this":{"__isSmartRef__":true,"id":0},"__serializedLivelyClosures__":{"__isSmartRef__":true,"id":8}},"8":{"$super":{"__isSmartRef__":true,"id":9}},"9":{"varMapping":{"__isSmartRef__":true,"id":10},"source":"function () {\n\t\t\t\ttry {\n\t\t\t\t\treturn obj.constructor.prototype[name].apply(obj, arguments)\n\t\t\t\t} catch(e) {\n\t\t\t\t\talert('Error in $super call: ' + e + '\\n' + e.stack);\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}","funcProperties":{"__isSmartRef__":true,"id":11},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"10":{"obj":{"__isSmartRef__":true,"id":0},"name":"onMouseDown"},"11":{},"12":{},"13":{"varMapping":{"__isSmartRef__":true,"id":14},"source":"function reset() {\n\tthis.selectedFont = null;\n\tthis.selection = null;\n\tthis.removeAllMorphs();\n\tdisconnectAll(this)\n}","funcProperties":{"__isSmartRef__":true,"id":15},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"14":{"this":{"__isSmartRef__":true,"id":0}},"15":{},"16":{"varMapping":{"__isSmartRef__":true,"id":17},"source":"function availableFonts(fontNames) {\n\tvar testText = 'CmmwwmmwwmmwwmmL',\n\t\tparent = document.body,\n\t\tspan = XHTMLNS.create('span');\n\tspan.textContent = testText;\n\tspan.style.fontSize = '72px';\n\tparent.appendChild(span);\n\tvar defaultWidth = span.offsetWidth, defaultHeight = span.offsetHeight;\n\tvar availableFonts = fontNames.select(function(fontName) {\n\t\ttry {\n\t\t\tif (Global.getComputedStyle(span).fontFamily == fontName) return true;\n\t\t\tspan.style.fontFamily = fontName;\n\t\t\tvar available = defaultWidth !== span.offsetWidth || defaultHeight !== span.offsetHeight;\n\t\t\treturn available;\n\t\t} catch(e) { return false }\n\t})\n\tparent.removeChild(span)\n\treturn availableFonts;\n}","funcProperties":{"__isSmartRef__":true,"id":18},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"17":{"this":{"__isSmartRef__":true,"id":0}},"18":{},"19":{"varMapping":{"__isSmartRef__":true,"id":20},"source":"function getKnownFonts(fontNames) {\n\treturn ['academy engraved let',\n\t\t'algerian',\n\t\t'amaze',\n\t\t'arial',\n\t\t'arial black',\n\t\t'balthazar',\n\t\t'bart',\n\t\t'bimini',\n\t\t'comic sans ms',\n\t\t'book antiqua',\n\t\t'bookman old style',\n\t\t'braggadocio',\n\t\t'britannic bold',\n\t\t'brush script mt',\n\t\t'century gothic',\n\t\t'century schoolbook',\n\t\t'chasm',\n\t\t'chicago',\n\t\t'colonna mt',\n\t\t'comic sans ms',\n\t\t'commercialscript bt',\n\t\t'coolsville ',\n\t\t'courier',\n\t\t'courier new',\n\t\t'cursive',\n\t\t'dayton',\n\t\t'desdemona',\n\t\t'fantasy',\n\t\t'flat brush ',\n\t\t'footlight mt light ',\n\t\t'futurablack bt',\n\t\t'futuralight bt',\n\t\t'garamond',\n\t\t'gaze',\n\t\t'geneva',\n\t\t'georgia',\n\t\t'geotype tt',\n\t\t'helterskelter',\n\t\t'helvetica',\n\t\t'herman',\n\t\t'highlight let',\n\t\t'impact',\n\t\t'jester',\n\t\t'joan',\n\t\t'john handy let',\n\t\t'jokerman let',\n\t\t'kelt',\n\t\t'kids',\n\t\t'kino mt',\n\t\t'la bamba let',\n\t\t'lithograph',\n\t\t'lucida console',\n\t\t'map symbols',\n\t\t'marlett',\n\t\t'matteroffact',\n\t\t'matisse itc ',\n\t\t'matura mt script capitals',\n\t\t'mekanik let',\n\t\t'monaco ',\n\t\t'monospace',\n\t\t'monotype sorts',\n\t\t'ms linedraw',\n\t\t'new york',\n\t\t'olddreadfulno7 bt',\n\t\t'orange let',\n\t\t'palatino ',\n\t\t'playbill',\n\t\t'pump demi bold let',\n\t\t'puppylike',\n\t\t'roland',\n\t\t'sans-serif',\n\t\t'scripts',\n\t\t'scruff let',\n\t\t'serif',\n\t\t'short hand',\n\t\t'signs normal',\n\t\t'simplex',\n\t\t'simpson',\n\t\t'stylus bt',\n\t\t'superfrench',\n\t\t'surfer',\n\t\t'swis721 bt',\n\t\t'swis721 blkoul bt',\n\t\t'symap',\n\t\t'symbol',\n\t\t'tahoma',\n\t\t'technic',\n\t\t'tempus sans itc',\n\t\t'terk ',\n\t\t'times',\n\t\t'times new roman',\n\t\t'trebuchet ms',\n\t\t'trendy',\n\t\t'txt',\n\t\t'verdana',\n\t\t'victorian let',\n\t\t'vineta bt',\n\t\t'vivian',\n\t\t'webdings',\n\t\t'wingdings',\n\t\t'western ',\n\t\t'westminster',\n\t\t'westwood let',\n\t\t'wide latin',\n\t\t'zapfellipt bt',\n\t\t// these are for linux\n\t\t'URW Chancery L',\n\t\t'URW Gothic L',\n\t\t'Century Schoolbook L',\n\t\t'URW Bookman L',\n\t\t'URW Palladio L',\n\t\t'Nimbus Mono L',\n\t\t'Nimbus Sans L',\n\t\t'Nimbus Roman No',\n\t\t'DejaVu Sans',\n\t\t'DejaVu Sans Mono',\n\t\t'DejaVu Serif',\n\t\t'DejaVu Sans Light',\n\t\t'Bitstream Charter',\n\t\t'DejaVu Sans Condensed',\n\t\t'DejaVu Serif Condensed',\n\t\t'Courier ',\n\t\t'Liberation Mono',\n\t\t'Liberation Serif',\n\t\t'FreeSerif',\n\t\t'Liberation Sans',\n\t\t'FreeMono',\n\t\t'FreeSans',\n\t\t'Arial',\n\t\t'Courier New',\n\t\t'Times New Roman',\n\t\t'Verdana',\n\t\t'Lohit Bengali',\n\t\t'Lohit Gujarati',\n\t\t'Lohit Punjabi',\n\t\t'Lohit Tamil',\n\t\t'UnDotum',\n\t\t'Georgia',\n\t\t'Trebuchet MS',\n\t\t'Arial Black',\n\t\t'Impact',\n\t\t'Andale Mono',\n\t\t'Bitstream Vera Sans Mono',\n\t\t'Comic Sans MS',\n\t\t'Bitstream Vera Sans',\n\t\t'Waree'].uniq().sort();\n}","funcProperties":{"__isSmartRef__":true,"id":21},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"20":{"this":{"__isSmartRef__":true,"id":0}},"21":{},"22":{"varMapping":{"__isSmartRef__":true,"id":23},"source":"function listAvailableFonts() {\n\t/*this. listAvailableFonts()*/\n\tthis.reset();\n\tvar listMorph = this,\n\t\tfonts = this.availableFonts(this. getKnownFonts()),\n\t\toffset = pt(0,0);\n\tfonts.forEach(function(font) {\n\t\tvar text = new lively.morphic.Text(offset.extent(pt(this.getExtent().x,20)), font);\n\t\ttext.applyStyle({fill: this.getFill(), borderWidth:0, fontFamily: font, fixedHeight: false, fixedWidth: true, allowInput: false})\n\t\ttext.ignoreEvents();\n\t\tlistMorph.addMorph(text);\n\t\ttext.fit();\n\t\toffset = text.bounds().bottomLeft()\n\t}, this)\n}","funcProperties":{"__isSmartRef__":true,"id":24},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"23":{"this":{"__isSmartRef__":true,"id":0}},"24":{},"25":{"varMapping":{"__isSmartRef__":true,"id":26},"source":"function selectFont(pos) {\n\tvar fontMorphs = this.submorphs, selected;\n\tfor (var i = 0; i < fontMorphs.length; i++) {\n\t\tif (fontMorphs[i].bounds().containsPoint(pos)) selected = fontMorphs[i];\n\t\tfontMorphs[i].setFill(null);\n\t}\n\tif (selected) {\n\t\tselected.setFill(Color.yellow);\n\t\tthis.selectedFont = selected.textString;\n\t\tthis.selection = this.selectedFont;\n\t} else {\n\t\tthis.selectedFont = null;\n\t\tthis.selection = null\n\t}\n}","funcProperties":{"__isSmartRef__":true,"id":27},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"26":{"this":{"__isSmartRef__":true,"id":0}},"27":{},"28":{"varMapping":{"__isSmartRef__":true,"id":29},"source":"function setupConnections() {\n}","funcProperties":{"__isSmartRef__":true,"id":30},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"29":{"this":{"__isSmartRef__":true,"id":0}},"30":{},"31":{"varMapping":{"__isSmartRef__":true,"id":32},"source":"function onLoad() {\n    this.listAvailableFonts();\n}","funcProperties":{"__isSmartRef__":true,"id":33},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"32":{"this":{"__isSmartRef__":true,"id":0}},"33":{"__serializedExpressions__":["timestamp"],"user":"robertkrahn","tags":[],"timestamp":"new Date(\"Mon Apr 28 2014 03:14:23 GMT-0700 (PDT)\")"},"isSimplifiedRegistry":true}}