1. Конвертирую .ttf в веб-шрифты:
http://www.font2web.com2. css-файл такой:
Код:
@font-face {
font-family: 'Conv_junegull rg';
src: url('../fonts/junegull rg.eot');
src: url('../fonts/junegull rg.eot?#iefix') format('embedded-opentype'),
url('../fonts/junegull rg.woff') format('woff'),
url('../fonts/junegull rg.ttf') format('truetype'),
url('../fonts/junegull rg.svg#Conv_junegull rg') format('svg');
font-weight: normal;
font-style: normal;
}
3. html-файл такой имеет вид:
Код:
<!DOCTYPE html>
<head>
<link rel="fontPreload" type = "text/css" href = "assets/css/fontPreload.css">
<style type="text/css">
@font-face { font-family: 'Conv_junegull rg'; src: url('assets/fonts/junegull rg.ttf') format("truetype"); }
body{
background: #000000;
padding:0px;
margin:0px;
}
.fontPreload {
font-family: 'Conv_junegull rg';
position:absolute;
left:-100px;
}
</style>
<meta charset="utf-8">
<title>My Game</title>
<link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
<div class="fontPreload">.</div>
<div id="game"></div>
<script src="//github.com/photonstorm/phaser-ce/releases/download/v2.8.1/phaser.min.js"></script>
<script src="js/Game.js"></script>
</body>
</html>
4. Код такой:
Код:
var LText = game.add.text(game.world.width / 2, game.world.height / 2 - 150, 'Test Font', {
font: '55px junegull rg',
fill: '#FFFFFF',
stroke: '#000000',
strokeThickness: 3,
align: 'center'
});
LText.font = 'junegull rg';
В итоге вижу что шрифт самый обычный.
ЧЯДНТ?