@@ -82,15 +82,21 @@ cc._fontLoader = {
8282 TYPE : {
8383 ".eot" : "embedded-opentype" ,
8484 ".ttf" : "truetype" ,
85+ ".ttc" : "truetype" ,
8586 ".woff" : "woff" ,
8687 ".svg" : "svg"
8788 } ,
8889 _loadFont : function ( name , srcs , type ) {
8990 var doc = document , path = cc . path , TYPE = this . TYPE , fontStyle = cc . newElement ( "style" ) ;
91+ type = type . toLowerCase ( ) ;
9092 fontStyle . type = "text/css" ;
9193 doc . body . appendChild ( fontStyle ) ;
9294
93- var fontStr = "@font-face { font-family:" + name + "; src:" ;
95+ var fontStr = "" ;
96+ if ( isNaN ( name - 0 ) )
97+ fontStr += "@font-face { font-family:" + name + "; src:" ;
98+ else
99+ fontStr += "@font-face { font-family:'" + name + "'; src:" ;
94100 if ( srcs instanceof Array ) {
95101 for ( var i = 0 , li = srcs . length ; i < li ; i ++ ) {
96102 var src = srcs [ i ] ;
@@ -101,7 +107,7 @@ cc._fontLoader = {
101107 } else {
102108 fontStr += "url('" + srcs + "') format('" + TYPE [ type ] + "');" ;
103109 }
104- fontStyle . textContent += fontStr + "}; " ;
110+ fontStyle . textContent += fontStr + "}" ;
105111
106112 //<div style="font-family: PressStart;">.</div>
107113 var preloadDiv = cc . newElement ( "div" ) ;
@@ -126,7 +132,7 @@ cc._fontLoader = {
126132 cb ( null , true ) ;
127133 }
128134} ;
129- cc . loader . register ( [ "font" , "eot" , "ttf" , "woff" , "svg" ] , cc . _fontLoader ) ;
135+ cc . loader . register ( [ "font" , "eot" , "ttf" , "woff" , "svg" , "ttc" ] , cc . _fontLoader ) ;
130136
131137cc . _binaryLoader = {
132138 load : function ( realUrl , url , res , cb ) {
0 commit comments