|
458 | 458 | /**
|
459 | 459 | * Text parser (UIText)
|
460 | 460 | */
|
| 461 | + var regTTF = /\.ttf$/; |
461 | 462 | parser.TextAttributes = function(widget, options, resourcePath){
|
462 | 463 | var touchScaleChangeAble = options["touchScaleEnable"];
|
463 | 464 | widget.setTouchScaleChangeEnabled(touchScaleChangeAble);
|
|
469 | 470 | }
|
470 | 471 | var fn = options["fontName"];
|
471 | 472 | if (fn != null){
|
472 |
| - widget.setFontName(options["fontName"]); |
| 473 | + if(cc.sys.isNative){ |
| 474 | + if(regTTF.test(fn)){ |
| 475 | + widget.setFontName(cc.path.join(cc.loader.resPath, resourcePath, fn)); |
| 476 | + }else{ |
| 477 | + widget.setFontName(fn); |
| 478 | + } |
| 479 | + }else{ |
| 480 | + widget.setFontName(fn.replace(regTTF, '')); |
| 481 | + } |
473 | 482 | }
|
474 | 483 | var aw = options["areaWidth"];
|
475 | 484 | var ah = options["areaHeight"];
|
|
599 | 608 | /**
|
600 | 609 | * TextField parser (UITextField)
|
601 | 610 | */
|
602 |
| - parser.TextFieldAttributes = function(widget, options, resoutcePath){ |
| 611 | + parser.TextFieldAttributes = function(widget, options, resourcePath){ |
603 | 612 | var ph = options["placeHolder"];
|
604 | 613 | if(ph)
|
605 | 614 | widget.setPlaceHolder(ph);
|
|
608 | 617 | if(fs)
|
609 | 618 | widget.setFontSize(fs);
|
610 | 619 | var fn = options["fontName"];
|
611 |
| - if(fn) |
612 |
| - widget.setFontName(fn); |
| 620 | + if (fn != null){ |
| 621 | + if(cc.sys.isNative){ |
| 622 | + if(regTTF.test(fn)){ |
| 623 | + widget.setFontName(cc.path.join(cc.loader.resPath, resourcePath, fn)); |
| 624 | + }else{ |
| 625 | + widget.setFontName(fn); |
| 626 | + } |
| 627 | + }else{ |
| 628 | + widget.setFontName(fn.replace(regTTF, '')); |
| 629 | + } |
| 630 | + } |
613 | 631 | var tsw = options["touchSizeWidth"];
|
614 | 632 | var tsh = options["touchSizeHeight"];
|
615 | 633 | if(tsw!=null && tsh!=null)
|
|
0 commit comments