import { delay } from './delay.js' ; import { Laya } from 'Laya.js' ; import { Text } from 'laya/display/Text.js' ; import { TextRender } from 'laya/webgl/text/TextRender.js' ; import { Sprite } from 'laya/display/Sprite.js' ; /**
 * 检查新版文字渲染正确
 */ class Main { constructor ( ) { Laya . init ( 800 , 600 ) ; Laya . stage . screenMode = 'none' ; this . test1 ( ) ; } createFromTemp ( t , x , y , sx , sy ) { var ret = new Text ( ) ; ret . fontSize = t . fontSize ; ret . color = t . color ; ret . font = t . font ; ret . text = t . text ; ret . pos ( x , y ) ; ret . scale ( sx , sy ) ; Laya . stage . addChild ( ret ) ; return ret ; } async test1 ( ) { TextRender . isWan1Wan = true ; var strTxt = '口😂gM️سلام位किﷺă ฏ๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎' ; var t1 = new Text ( ) ; t1 . font = 'Microsoft YaHei' ; t1 . scale ( 2 , 3 ) ; t1 . fontSize = 20 ; t1 . bold = true ; t1 . text = strTxt ; t1 . color = 'blue' ; t1 . stroke = 2 ; t1 . strokeColor = 'green' ; Laya . stage . addChild ( t1 ) ; var t2 = new Text ( ) ; t2 . fontSize = 50 ; t2 . font = '宋体' ; t2 . text = '国\nI' ; t2 . color = 'red' ; t2 . pos ( 0 , 100 ) ; await delay ( 20 ) ; Laya . stage . addChild ( t2 ) ; var sp1 = new Sprite ( ) ; sp1 . pos ( 66 , 110 ) ; sp1 . size ( 100 , 110 ) ; sp1 . graphics . drawRect ( 0 , 0 , 100 , 110 , null , 'red' , 1 ) ; Laya . stage . addChild ( sp1 ) ; var tx1 = new Text ( ) ; tx1 . pos ( 0 , 24 ) ; tx1 . size ( 100 , 60 ) ; tx1 . text = '8' ; tx1 . font = 'SimHei' ; tx1 . fontSize = 60 ; tx1 . color = 'red' ; tx1 . align = 'center' ; sp1 . addChild ( tx1 ) ; await delay ( 10 ) ; sp1 . scale ( 2 , 2 ) ; await delay ( 10 ) ; ( window as any ) . testEnd = true ; } } new Main ( ) ;